aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/general
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-19 18:43:08 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-19 18:43:08 +1000
commit91d3eefe18a1647eb810bc69d37d91fd3affe055 (patch)
tree4cd0ff22eb4cabdb7d314b6d8f018ec6b0f439c3 /src/Java/gtPlusPlus/core/item/general
parent41ec13e3a38d19c6c8e0b6eed505bfc68a79a9a1 (diff)
downloadGT5-Unofficial-91d3eefe18a1647eb810bc69d37d91fd3affe055.tar.gz
GT5-Unofficial-91d3eefe18a1647eb810bc69d37d91fd3affe055.tar.bz2
GT5-Unofficial-91d3eefe18a1647eb810bc69d37d91fd3affe055.zip
+ Added a mode to the debug clearer. It can now fill.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/general')
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java1
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java106
2 files changed, 103 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java b/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java
index 7d5341f3d4..4acb5fa69f 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java
@@ -61,7 +61,6 @@ public class ItemAirFilter extends Item {
suffixName = " [Tier 2]";
}
return (itemName+suffixName);
-
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
index e81911d5cb..c3187ba92c 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java
@@ -1,16 +1,22 @@
package gtPlusPlus.core.item.general;
+import java.util.List;
+
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.item.base.CoreItem;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
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.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@@ -35,8 +41,65 @@ public class ItemAreaClear extends CoreItem {
}
@Override
- public String getItemStackDisplayName(ItemStack tItem) {
- return "Debug Square";
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 2; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Debug Square";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [1]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [2]";
+ }
+ return (itemName+suffixName);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ String mMode = (stack.getItemDamage() == 0 ? "Clear" : "Fill");
+ list.add(EnumChatFormatting.GRAY+""+("Mode: "+mMode));
+ super.addInformation(stack, player, list, bool);
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Mode", 0);
+ tagMain.setTag("GTPP_DEBUG", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getFilterDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("GTPP_DEBUG");
+ if (aNBT != null) {
+ return aNBT.getLong("Mode");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("GTPP_DEBUG");
+ if (aNBT != null) {
+ aNBT.setLong("Mode", aDamage);
+ return true;
+ }
+ }
+ return false;
}
public boolean removeBlocks(World world, BlockPos pos){
@@ -81,10 +144,47 @@ public class ItemAreaClear extends CoreItem {
return true;
}
+ public boolean fillBlocks(World world, BlockPos pos){
+ int x1 = pos.xPos;
+ int y1 = pos.yPos;
+ int z1 = pos.zPos;
+
+ int x2 = (x1-10);
+ int y2 = (y1-1);
+ int z2 = (z1-10);
+
+ fillBlockColumn(world, new BlockPos(x2, y2, z2));
+ return true;
+ }
+
+ public boolean fillBlockColumn(World world, BlockPos pos){
+ for (int i=0; i<21; i++){
+ fillBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i));
+ }
+ return true;
+ }
+
+ public boolean fillBlockRow(World world, BlockPos pos){
+ for (int j=0; j<2; j++){
+ for (int i=0; i<21; i++){
+ if (world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){
+ world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.grass);
+ }
+ }
+ }
+ return true;
+ }
+
@Override
public ItemStack onItemRightClick(ItemStack thisItem, World world, EntityPlayer parEntity) {
BlockPos groundBlock = EntityUtils.findBlockPosUnderEntity(parEntity);
- removeBlocks(world, groundBlock);
+ if (thisItem.getItemDamage() == 0){
+ removeBlocks(world, groundBlock);
+ }
+ else {
+ Utils.LOG_INFO("Filling.");
+ fillBlocks(world, groundBlock);
+ }
return super.onItemRightClick(thisItem, world, parEntity);
}