diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/general')
3 files changed, 58 insertions, 9 deletions
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java index 23b0144231..09c4fdfc6b 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java @@ -113,15 +113,15 @@ public class ItemAreaClear extends CoreItem { int y2 = (y1-10); int z2 = (z1-24); - removeBlockColumn(world, new BlockPos(x2, y2, z2)); + removeBlockColumn(world, new BlockPos(x2, y2, z2, world)); return true; } public boolean removeBlockColumn(World world, BlockPos pos){ for (int i=0; i<50; i++){ - removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos-10, pos.zPos+i)); - removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i)); - removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos+10, pos.zPos+i)); + removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos-10, pos.zPos+i, world)); + removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world)); + removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos+10, pos.zPos+i, world)); } return true; } @@ -160,13 +160,13 @@ public class ItemAreaClear extends CoreItem { int y2 = (y1-1); int z2 = (z1-10); - fillBlockColumn(world, new BlockPos(x2, y2, z2)); + fillBlockColumn(world, new BlockPos(x2, y2, z2, world)); 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)); + fillBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world)); } return true; } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java index 761cbf268f..2b3d718538 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java @@ -1,11 +1,15 @@ package gtPlusPlus.core.item.general; +import static gtPlusPlus.core.lib.CORE.RANDOM; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import gtPlusPlus.core.entity.item.ItemEntityGiantEgg; import gtPlusPlus.core.item.base.BaseItemBurnable; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.NBTUtils; @@ -15,6 +19,7 @@ public class ItemGiantEgg extends BaseItemBurnable { public ItemGiantEgg(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, String oredictName, int burnTime, int meta) { super(unlocalizedName, displayName, creativeTab, stackSize, maxDmg, description, oredictName, burnTime, meta); + this.setMaxStackSize(1); } @Override @@ -22,8 +27,13 @@ public class ItemGiantEgg extends BaseItemBurnable { String localName = super.getItemStackDisplayName(aStack); nbtWork(aStack); int size = 1; + int age = 0; if (NBTUtils.hasKey(aStack, "size")){ size = NBTUtils.getInteger(aStack, "size"); + if (NBTUtils.hasKey(aStack, "mTicksExisted")){ + age = NBTUtils.getInteger(aStack, "mTicksExisted"); + return ""+size+" "+localName+" ["+age+"]"; + } return ""+size+" "+localName; } return "?? "+localName; @@ -43,10 +53,9 @@ public class ItemGiantEgg extends BaseItemBurnable { @Override public void onCreated(ItemStack p_77622_1_, World p_77622_2_, EntityPlayer p_77622_3_) { - // TODO Auto-generated method stub super.onCreated(p_77622_1_, p_77622_2_, p_77622_3_); } - + public void nbtWork(ItemStack aStack) { if (NBTUtils.hasKey(aStack, "playerHeld")) { if (NBTUtils.getBoolean(aStack, "playerHeld") && !NBTUtils.hasKey(aStack, "size")) { @@ -55,4 +64,44 @@ public class ItemGiantEgg extends BaseItemBurnable { } } + @Override + public boolean hasCustomEntity(ItemStack stack) { + return true; + } + + @Override + public Entity createEntity(World world, Entity location, ItemStack itemstack) { + + if (location instanceof EntityPlayer) { + + EntityPlayer player = (EntityPlayer) location; + + if (itemstack == null) { + return null; + } + else if (itemstack.stackSize == 0) { + return null; + } + else { + ItemEntityGiantEgg entityitem = new ItemEntityGiantEgg(world, player.posX, player.posY - 0.30000001192092896D + (double)player.getEyeHeight(), player.posZ, itemstack); + entityitem.delayBeforeCanPickup = 40; + entityitem.func_145799_b(player.getCommandSenderName()); + float f = 0.1F; + float f1; + f = 0.3F; + entityitem.motionX = (double)(-MathHelper.sin(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); + entityitem.motionZ = (double)(MathHelper.cos(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); + entityitem.motionY = (double)(-MathHelper.sin(player.rotationPitch / 180.0F * (float)Math.PI) * f + 0.1F); + f = 0.02F; + f1 = RANDOM.nextFloat() * (float)Math.PI * 2.0F; + f *= RANDOM.nextFloat(); + entityitem.motionX += Math.cos((double)f1) * (double)f; + entityitem.motionY += (double)((RANDOM.nextFloat() - RANDOM.nextFloat()) * 0.1F); + entityitem.motionZ += Math.sin((double)f1) * (double)f; + return entityitem; + } + } + return null; + } + } diff --git a/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java b/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java index f8b63a7a19..592b68d06a 100644 --- a/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java +++ b/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java @@ -206,7 +206,7 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { if (NBTUtils.hasKey(itemstack,"mHasEntity") && NBTUtils.getBoolean(itemstack,"mHasEntity")) { Logger.WARNING("Trying to release (2)"); - boolean mDidSpawn = spawnStoredEntity(world, itemstack, new BlockPos(x, y+1, z)); + boolean mDidSpawn = spawnStoredEntity(world, itemstack, new BlockPos(x, y+1, z, world)); if (!mDidSpawn){ PlayerUtils.messagePlayer(player, "You failed to release a "+NBTUtils.getString(itemstack,"mEntityName")+"."); |
