From fcb39641497fe9bd81d7b6257b0af4f80f0645fe Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sun, 17 Nov 2013 19:05:11 +1100 Subject: [PATCH] Amongst other things, added Pixie Jars and prevented Poison and Spring Water from generating in Origin Valley, the Promised Land and the Nether --- .../BiomeGenPromisedLandForest.java | 2 +- .../configuration/BOPAchievements.java | 2 +- .../configuration/BOPCrafting.java | 2 +- .../configuration/BOPEntities.java | 2 +- common/biomesoplenty/entities/EntityBird.java | 2 +- .../biomesoplenty/entities/EntityPixie.java | 6 +- common/biomesoplenty/items/ItemJarEmpty.java | 43 ++++++++++ common/biomesoplenty/items/ItemJarFilled.java | 75 +++++++++++++++++- .../assets/biomesoplenty/lang/en_US.lang | 1 + .../biomesoplenty/textures/items/ambrosia.png | Bin 380 -> 380 bytes .../biomesoplenty/textures/items/jarpixie.png | Bin 0 -> 356 bytes .../textures/items/pixiedust.png | Bin 515 -> 499 bytes 12 files changed, 125 insertions(+), 10 deletions(-) create mode 100644 resources/assets/biomesoplenty/textures/items/jarpixie.png diff --git a/common/biomesoplenty/biomes/promisedland/BiomeGenPromisedLandForest.java b/common/biomesoplenty/biomes/promisedland/BiomeGenPromisedLandForest.java index 7f8d171ee..f914368e2 100644 --- a/common/biomesoplenty/biomes/promisedland/BiomeGenPromisedLandForest.java +++ b/common/biomesoplenty/biomes/promisedland/BiomeGenPromisedLandForest.java @@ -30,7 +30,7 @@ public class BiomeGenPromisedLandForest extends BiomeGenBase implements IWCFog fillerBlock = (byte)Blocks.holyDirt.get().blockID; customBiomeDecorator.treesPerChunk = 10; customBiomeDecorator.grassPerChunk = -999; - customBiomeDecorator.holyTallGrassPerChunk = 50; + customBiomeDecorator.holyTallGrassPerChunk = 100; customBiomeDecorator.promisedWillowPerChunk = 40; customBiomeDecorator.pinkFlowersPerChunk = 12; customBiomeDecorator.rainbowflowersPerChunk = 10; diff --git a/common/biomesoplenty/configuration/BOPAchievements.java b/common/biomesoplenty/configuration/BOPAchievements.java index ab39bf950..16b2ce818 100644 --- a/common/biomesoplenty/configuration/BOPAchievements.java +++ b/common/biomesoplenty/configuration/BOPAchievements.java @@ -100,7 +100,7 @@ public class BOPAchievements int i = 0; int biomeID = world.getBiomeGenForCoords(x, z).biomeID; - //if (world.isRemote) + if (!world.isRemote) { if (Minecraft.getMinecraft().statFileWriter.hasAchievementUnlocked(achAmbrosia) && Minecraft.getMinecraft().statFileWriter.hasAchievementUnlocked(achPhantom) && Minecraft.getMinecraft().statFileWriter.hasAchievementUnlocked(achCoral) && Minecraft.getMinecraft().statFileWriter.hasAchievementUnlocked(achEnderporter)) { diff --git a/common/biomesoplenty/configuration/BOPCrafting.java b/common/biomesoplenty/configuration/BOPCrafting.java index ac09e3e3f..b2c53302f 100644 --- a/common/biomesoplenty/configuration/BOPCrafting.java +++ b/common/biomesoplenty/configuration/BOPCrafting.java @@ -265,7 +265,7 @@ public class BOPCrafting GameRegistry.addRecipe(new ItemStack(Blocks.planks.get(), 1, 10), new Object[] {"##", "##", '#', Blocks.bamboo.get()}); GameRegistry.addRecipe(new ItemStack(Items.jarEmpty.get(), 3, 0), new Object[] {"# #", "# #", "###", '#', Block.glass}); - GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 1, 10), new Object[] {Block.plantYellow, new ItemStack(Item.potion, 1, 0), new ItemStack(Blocks.flowers2.get(), 1, 6), new ItemStack(Blocks.coral.get(), 1, 3), new ItemStack(Blocks.plants.get(), 1, 15), new ItemStack(Items.miscItems.get(), 1, 4), new ItemStack(Items.jarFilled.get(), 1, 0), new ItemStack(Items.food.get(), 1, 0), Item.sugar}); + GameRegistry.addShapelessRecipe(new ItemStack(Items.food.get(), 1, 10), new Object[] {new ItemStack(Items.miscItems.get(), 1, 11), new ItemStack(Item.potion, 1, 0), new ItemStack(Blocks.flowers2.get(), 1, 6), new ItemStack(Blocks.coral.get(), 1, 3), new ItemStack(Blocks.plants.get(), 1, 15), new ItemStack(Items.miscItems.get(), 1, 4), new ItemStack(Items.jarFilled.get(), 1, 0), new ItemStack(Items.food.get(), 1, 0), Item.sugar}); GameRegistry.addRecipe(new ItemStack(Blocks.flesh.get(), 1, 0), new Object[] {"##", "##", '#', new ItemStack(Items.miscItems.get(), 1, 3)}); GameRegistry.addRecipe(new ItemStack(Item.rottenFlesh, 1, 0), new Object[] {"FFF", "FPF", "FFF", 'F', new ItemStack(Items.miscItems.get(), 1, 3), 'P', new ItemStack(Items.jarFilled.get(), 1, 1)}); diff --git a/common/biomesoplenty/configuration/BOPEntities.java b/common/biomesoplenty/configuration/BOPEntities.java index e5eda79c3..79e7a893f 100644 --- a/common/biomesoplenty/configuration/BOPEntities.java +++ b/common/biomesoplenty/configuration/BOPEntities.java @@ -117,7 +117,7 @@ public class BOPEntities { { EntityRegistry.registerModEntity(EntityPixie.class, "Pixie", BOPConfigurationIDs.pixieID, BiomesOPlenty.instance, 80, 3, true); - registerEntityEgg(EntityPixie.class, 16560347, 16645116); + registerEntityEgg(EntityPixie.class, 16742365, 16645116); if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent() && Biomes.promisedLandShrub.isPresent()) { diff --git a/common/biomesoplenty/entities/EntityBird.java b/common/biomesoplenty/entities/EntityBird.java index 948b2591b..256a3ac14 100644 --- a/common/biomesoplenty/entities/EntityBird.java +++ b/common/biomesoplenty/entities/EntityBird.java @@ -8,7 +8,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityBird extends EntityFlyingMob +public class EntityBird extends EntityFlyingCreature { public int courseChangeCooldown; public double waypointX; diff --git a/common/biomesoplenty/entities/EntityPixie.java b/common/biomesoplenty/entities/EntityPixie.java index bb317d48c..e070bdd19 100644 --- a/common/biomesoplenty/entities/EntityPixie.java +++ b/common/biomesoplenty/entities/EntityPixie.java @@ -9,7 +9,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityPixie extends EntityFlyingMob +public class EntityPixie extends EntityFlyingCreature { public int courseChangeCooldown; public double waypointX; @@ -95,9 +95,9 @@ public class EntityPixie extends EntityFlyingMob { super.onEntityUpdate(); - for (int i = 0; i < 3; i++) + for (int i = 0; i < 7; i++) { - if (this.rand.nextInt(3) == 0) + if (this.rand.nextInt(2) == 0) { BiomesOPlenty.proxy.spawnParticle("pixietrail", this.posX + (this.rand.nextDouble()) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble()) * (double)this.width); } diff --git a/common/biomesoplenty/items/ItemJarEmpty.java b/common/biomesoplenty/items/ItemJarEmpty.java index 60756fb90..9be307a2e 100644 --- a/common/biomesoplenty/items/ItemJarEmpty.java +++ b/common/biomesoplenty/items/ItemJarEmpty.java @@ -1,15 +1,19 @@ package biomesoplenty.items; import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import net.minecraftforge.common.FakePlayer; import biomesoplenty.BiomesOPlenty; import biomesoplenty.api.Fluids; import biomesoplenty.api.Items; +import biomesoplenty.entities.EntityPixie; public class ItemJarEmpty extends Item { @@ -76,4 +80,43 @@ public class ItemJarEmpty extends Item return par1ItemStack; } } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) + { + if (par3EntityLivingBase instanceof EntityPixie) + { + EntityPixie entitypixie = (EntityPixie)par3EntityLivingBase; + + entitypixie.setDead(); + + --par1ItemStack.stackSize; + + if (par2EntityPlayer.inventory.getFirstEmptyStack() >= 0) + { + EntityItem entityitem = new EntityItem(par2EntityPlayer.worldObj, par2EntityPlayer.posX, par2EntityPlayer.posY, par2EntityPlayer.posZ, new ItemStack(Items.jarFilled.get(), 1, 2)); + if (!par2EntityPlayer.worldObj.isRemote) + { + par2EntityPlayer.worldObj.spawnEntityInWorld(entityitem); + + if (!(par2EntityPlayer instanceof FakePlayer)) + { + entityitem.onCollideWithPlayer(par2EntityPlayer); + } + } + } + else + { + par2EntityPlayer.dropPlayerItem(new ItemStack(Items.jarFilled.get(), 1, 2)); + } + + return true; + } + else + { + return false; + } + } } diff --git a/common/biomesoplenty/items/ItemJarFilled.java b/common/biomesoplenty/items/ItemJarFilled.java index 06e5abe49..c4cccb163 100644 --- a/common/biomesoplenty/items/ItemJarFilled.java +++ b/common/biomesoplenty/items/ItemJarFilled.java @@ -2,19 +2,28 @@ package biomesoplenty.items; import java.util.List; +import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingData; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.Facing; import net.minecraft.util.Icon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; import biomesoplenty.BiomesOPlenty; import biomesoplenty.api.Items; +import biomesoplenty.configuration.configfile.BOPConfigurationIDs; +import biomesoplenty.entities.EntityPixie; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemJarFilled extends Item { - private static String[] jars = {"jarhoney", "jarpoison"}; + private static String[] jars = {"jarhoney", "jarpoison", "jarpixie"}; @SideOnly(Side.CLIENT) private Icon[] textures; @@ -66,4 +75,66 @@ public class ItemJarFilled extends Item subTypes.add(new ItemStack(itemId, 1, meta)); } } -} + + @Override + public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side, float xoffset, float yoffset, float zoffset) + { + if (itemStack.getItemDamage() == 2) + { + if (entityPlayer.dimension == 0 || entityPlayer.dimension == BOPConfigurationIDs.promisedLandDimID) + { + int i1 = world.getBlockId(x, y, z); + x += Facing.offsetsXForSide[side]; + y += Facing.offsetsYForSide[side]; + z += Facing.offsetsZForSide[side]; + double d0 = 0.0D; + + if (side == 1 && Block.blocksList[i1] != null && Block.blocksList[i1].getRenderType() == 11) + { + d0 = 0.5D; + } + + if (!world.isRemote) + { + EntityPixie entity = new EntityPixie(world); + entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); + entity.rotationYawHead = entity.rotationYaw; + entity.renderYawOffset = entity.rotationYaw; + entity.onSpawnWithEgg((EntityLivingData)null); + world.spawnEntityInWorld(entity); + entity.playLivingSound(); + + if (itemStack.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(itemStack.getDisplayName()); + } + } + + if (!entityPlayer.capabilities.isCreativeMode) + { + --itemStack.stackSize; + + if (itemStack.stackSize <= 0) + { + itemStack = new ItemStack(Items.jarEmpty.get(), 1, 0); + } + + if (!entityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.jarEmpty.get(), 1, 0))) + { + entityPlayer.dropPlayerItem(new ItemStack(Items.jarEmpty.get(), 1, 0)); + } + } + + } + else + { + if (!world.isRemote) + { + entityPlayer.addChatMessage("\u00a75Pixies cannot survive in this environment!"); + } + } + } + + return true; + } + } diff --git a/resources/assets/biomesoplenty/lang/en_US.lang b/resources/assets/biomesoplenty/lang/en_US.lang index 336fe5ddc..fbe3564bd 100644 --- a/resources/assets/biomesoplenty/lang/en_US.lang +++ b/resources/assets/biomesoplenty/lang/en_US.lang @@ -325,6 +325,7 @@ item.bop.miscItems.pixiedust.name=Pixie Dust item.bop.jarEmpty.name=Empty Jar item.bop.jarFilled.jarhoney.name=Honey Jar item.bop.jarFilled.jarpoison.name=Poison Extract Jar +item.bop.jarFilled.jarpixie.name=Pixie Jar item.bop.gems.amethyst.name=Amethyst item.bop.gems.ruby.name=Ruby diff --git a/resources/assets/biomesoplenty/textures/items/ambrosia.png b/resources/assets/biomesoplenty/textures/items/ambrosia.png index 9e6b3709aebc27bbe91cdf11d5ef864a77421245..058b5177b6dceec9e6a73a43205e3460ad10bfc0 100644 GIT binary patch delta 72 zcmV-O0Js1A0{jAyJPN=701m(bYSxJfkw)bjj+EZ`|F-4M|MiWx{~xTr`Tuk41F*)8 e^*5760V5P)aosDB0s_wf0000!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KYKsOo{I zi(`m||JezSdnwA!PC{xWt~$(696zWf#U!G literal 0 HcmV?d00001 diff --git a/resources/assets/biomesoplenty/textures/items/pixiedust.png b/resources/assets/biomesoplenty/textures/items/pixiedust.png index 13c50ec13af6b19ea5dde1a8b2d06aefb79beec3..52e9ed7c4ff45a0c046a6919bb4f987163d1e8fd 100644 GIT binary patch delta 415 zcmV;Q0bu@v1oH!sB#|)~3c>&Y4#EKyC`y2lQz?IMNkl91)Gobx@trkM~XCsXW6DP9*L=!bFZ2?i-%Vp0Mj zc(A5%OvqfgWcqvHZ~?BQCq}Af!GpGmxJXPuWHiG{_YHn?j;Q4sZy01pnuO~PkL8rR zv0L>)3WH^9lCTY;lFU#rrwn$x3lgSV);fRh@i&IB8o|?aEa$(47wzUE#8+y|hZ(3p!ryd; z&m5!Du#2tQtyEE?h(F^yDNF=ctOBj16mwEF`6*O~_&exy?;#-=;k7Q^+yDRo07(Z$ JPDHLkV1k9jyCeVr delta 429 zcmV;e0aE_+1A_#RBnkm@Qb$4nuFf3kks%uj!vFvd!vV){sAQ2wDSvWFL_t(IPqmRt zOF~f;h5a!N8%4iBdSMuZ1W{l_THcCY5Lu8CAwn}FkR}=!LKa00dJTeV(4?R!YSJK# z6750Q!wRooo{LvZ?}dn3aNw}c+Uu;nx8YwfT{BDW`nTw)^y(XH{VKSIa<{^ZV#)K2 zW;#Kp+xhk=?(;#JEq_ZoZ=zYOqA;EiW>$gC6nj5P~OLk{*}Ll~bm_7v2}(MtWhSd=h-ReS?0OeO8}C`{e19ZV8^K|Y>2E@;>DK!} z!k%Ec6&xFIHVA>HL)O|(iA!%ZIQR2gDS