aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/general
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-10 00:11:09 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-10 00:11:09 +1000
commit258c257722f8728c3b5119b8b09c6932938d0efe (patch)
treef6c1f7540178dd93fc2f71cecb6efed75dabc5b1 /src/Java/gtPlusPlus/core/item/general
parent07881ec4484b594855014a9194c0ac7d98042e1d (diff)
downloadGT5-Unofficial-258c257722f8728c3b5119b8b09c6932938d0efe.tar.gz
GT5-Unofficial-258c257722f8728c3b5119b8b09c6932938d0efe.tar.bz2
GT5-Unofficial-258c257722f8728c3b5119b8b09c6932938d0efe.zip
+ Added a debug item for clearing big areas.
+ Started using BlockPos. % Changed some loading of blocks. ^ Version Bump.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/general')
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
new file mode 100644
index 0000000000..8e841aa284
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
@@ -0,0 +1,90 @@
+package gtPlusPlus.core.item.general;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.array.BlockPos;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ItemAreaClear extends CoreItem {
+
+ public IIcon[] mIcon = new IIcon[1];
+
+ public ItemAreaClear() {
+ super("itemDebugClearing", AddToCreativeTab.tabMachines, 1, 100, ChatFormatting.OBFUSCATED+"F A M C Y N A M E", EnumRarity.rare,
+ EnumChatFormatting.BOLD, false, null);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.mIcon[0] = reg.registerIcon(CORE.MODID + ":" + "itemLavaFilter");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.mIcon[0];
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack tItem) {
+ return "Debug Square";
+ }
+
+ public boolean removeBlocks(World world, BlockPos pos){
+ int x1 = pos.xPos;
+ int y1 = pos.yPos;
+ int z1 = pos.zPos;
+
+ int x2 = (x1-12);
+ int y2 = (y1-5);
+ int z2 = (z1-12);
+
+ removeBlockColumn(world, new BlockPos(x2, y2, z2));
+ return true;
+ }
+
+ public boolean removeBlockColumn(World world, BlockPos pos){
+ for (int i=0; i<25; i++){
+ removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i));
+ }
+ return true;
+ }
+
+ public boolean removeBlockRow(World world, BlockPos pos){
+ for (int j=0; j<10; j++){
+ for (int i=0; i<25; i++){
+ if (!world.isAirBlock(pos.xPos+i, pos.yPos+j, pos.zPos) &&
+ world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock &&
+ world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.glowstone){
+ int chance = MathUtils.randInt(0, 100);
+ if (chance <= 0){
+ world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.glowstone);
+ }
+ else {
+ world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.air);
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack thisItem, World world, EntityPlayer parEntity) {
+ BlockPos groundBlock = EntityUtils.findBlockPosUnderEntity(parEntity);
+ removeBlocks(world, groundBlock);
+ return super.onItemRightClick(thisItem, world, parEntity);
+ }
+
+}