Replaced poison jars with butterfly jars (Although using empty jars seems to be broken)

This commit is contained in:
Forstride 2016-08-09 23:50:43 -04:00
parent 878055bf15
commit edf48390e1
11 changed files with 61 additions and 30 deletions

View file

@ -18,7 +18,6 @@ public class BOPAchievements
public static Achievement obtain_wilted_lily;
public static Achievement eat_shroom_powder;
public static Achievement obtain_thorn;
public static Achievement craft_poison_jar;
public static Achievement craft_flax_string;
public static Achievement craft_muddy_pickaxe;
public static Achievement obtain_deathbloom;

View file

@ -225,12 +225,6 @@ public class AchievementEventHandler
player.addStat(BOPAchievements.craft_terrestrial_artifact);
}
//Pick Your Poison Achievement
if (item != null && item == new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal()).getItem())
{
player.addStat(BOPAchievements.craft_poison_jar);
}
}
@SubscribeEvent

View file

@ -10,7 +10,6 @@ package biomesoplenty.common.init;
import static biomesoplenty.api.achievement.BOPAchievements.craft_ambrosia;
import static biomesoplenty.api.achievement.BOPAchievements.craft_flax_string;
import static biomesoplenty.api.achievement.BOPAchievements.craft_muddy_pickaxe;
import static biomesoplenty.api.achievement.BOPAchievements.craft_poison_jar;
import static biomesoplenty.api.achievement.BOPAchievements.craft_terrestrial_artifact;
import static biomesoplenty.api.achievement.BOPAchievements.eat_shroom_powder;
import static biomesoplenty.api.achievement.BOPAchievements.explore_all_biomes;
@ -67,8 +66,8 @@ public class ModAchievements
//craft_amethyst_sword = addAchievement("achievement.craft_amethyst_sword", "craft_amethyst_sword", -7, 0, new ItemStack(BOPItems.amethyst_sword), craft_flax_string).setSpecial();
obtain_thorn = addAchievement("achievement.obtain_thorn", "obtain_thorn", -3, -1, BlockBOPPlant.paging.getVariantItem(BOPPlants.THORN), obtain_flowers);
craft_poison_jar = addAchievement("achievement.craft_poison_jar", "craft_poison_jar", -3, 1, new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal()), obtain_thorn);
obtain_deathbloom = addAchievement("achievement.obtain_deathbloom", "obtain_deathbloom", -6, 3, BlockBOPFlower.paging.getVariantItem(BOPFlowers.DEATHBLOOM), craft_poison_jar);
//craft_poison_jar = addAchievement("achievement.craft_poison_jar", "craft_poison_jar", -3, 1, new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal()), obtain_thorn);
obtain_deathbloom = addAchievement("achievement.obtain_deathbloom", "obtain_deathbloom", -6, 3, BlockBOPFlower.paging.getVariantItem(BOPFlowers.DEATHBLOOM), obtain_thorn);
obtain_berry = addAchievement("achievement.obtain_berry", "obtain_berry", 2, 1, new ItemStack(BOPItems.berries), obtain_flowers);
eat_shroom_powder = addAchievement("achievement.eat_shroom_powder", "eat_shroom_powder", 5, -1, new ItemStack(BOPItems.shroompowder), obtain_berry);

View file

@ -247,16 +247,12 @@ public class ModCrafting
// Flesh Block
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.flesh), new Object[] {"##", "##", '#', new ItemStack(BOPItems.fleshchunk)});
// Rotten Flesh
GameRegistry.addShapedRecipe(new ItemStack(Items.ROTTEN_FLESH), new Object[] {"FFF", "FPF", "FFF", 'F', new ItemStack(BOPItems.fleshchunk), 'P', new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal())});
// Honeycombs
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.hive, 1, BlockBOPHive.HiveType.HONEYCOMB.ordinal()), new Object [] {"##", "##", '#', new ItemStack(BOPItems.honeycomb)});
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.hive, 1, BlockBOPHive.HiveType.FILLED_HONEYCOMB.ordinal()), new Object [] {"##", "##", '#', new ItemStack(BOPItems.filled_honeycomb)});
// Food
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.shroompowder), new Object[] {new ItemStack(BOPBlocks.mushroom, 1, BlockBOPMushroom.MushroomType.TOADSTOOL.ordinal())});
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal()), new Object[] {BlockBOPPlant.paging.getVariantItem(BOPPlants.POISONIVY), new ItemStack(BOPItems.jar_empty)});
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.ricebowl), new Object[] {Items.BOWL, BlockBOPPlant.paging.getVariantItem(BOPPlants.WILDRICE)});
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.saladfruit), new Object[] {Items.BOWL, BOPItems.peach, Items.APPLE, BOPItems.pear});
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.saladveggie), new Object[] {Items.BOWL, BOPItems.turnip, Items.CARROT, Items.POTATO});

View file

@ -10,6 +10,7 @@ package biomesoplenty.common.item;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.item.BOPItems;
import biomesoplenty.common.entities.EntityButterfly;
import biomesoplenty.common.entities.EntityPixie;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@ -54,10 +55,6 @@ public class ItemJarEmpty extends Item
{
jarContents = ItemJarFilled.JarContents.HONEY;
}
else if (state.getBlock() == BOPBlocks.poison)
{
jarContents = ItemJarFilled.JarContents.POISON;
}
// if it was honey or poison, return the corresponding filled jar
if (jarContents != null)
@ -100,6 +97,20 @@ public class ItemJarEmpty extends Item
}
return true;
}
if (target instanceof EntityButterfly)
{
EntityButterfly butterfly = (EntityButterfly)target;
butterfly.setDead();
--stack.stackSize;
ItemStack butterflyJar = new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.BUTTERFLY.ordinal());
EntityItem butterflyJarEntity = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, butterflyJar);
if (!player.worldObj.isRemote)
{
player.worldObj.spawnEntityInWorld(butterflyJarEntity);
if (!(player instanceof FakePlayer)) {butterflyJarEntity.onCollideWithPlayer(player);}
}
return true;
}
return false;
}

View file

@ -10,6 +10,7 @@ package biomesoplenty.common.item;
import java.util.List;
import biomesoplenty.common.entities.EntityButterfly;
import biomesoplenty.common.entities.EntityPixie;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@ -34,7 +35,7 @@ public class ItemJarFilled extends Item
public enum JarContents implements IStringSerializable
{
HONEY, POISON, PIXIE;
HONEY, BUTTERFLY, PIXIE;
@Override
public String getName()
@ -137,6 +138,22 @@ public class ItemJarFilled extends Item
}
}
public boolean releaseButterfly(ItemStack stack, World world, EntityPlayer player, Vec3d releasePoint)
{
if (world.provider.isSurfaceWorld())
{
EntityButterfly butterfly = new EntityButterfly(world);
butterfly.setLocationAndAngles(releasePoint.xCoord, releasePoint.yCoord, releasePoint.zCoord, MathHelper.wrapDegrees(world.rand.nextFloat() * 360.0F), 0.0F);
world.spawnEntityInWorld(butterfly);
butterfly.playLivingSound();
if (stack.hasDisplayName()) {butterfly.setCustomNameTag(stack.getDisplayName());}
if (!player.capabilities.isCreativeMode) {--stack.stackSize;}
return true;
} else {
player.addChatComponentMessage(new TextComponentString("\u00a75Butterflies cannot survive in this environment!"));
return false;
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
@ -154,7 +171,16 @@ public class ItemJarFilled extends Item
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
case HONEY: case POISON: default:
case BUTTERFLY:
if (this.getContentsType(stack) == JarContents.BUTTERFLY)
{
// release pixie into the air in front of the player (target distance 0.8, but will be closer if there's blocks in the way)
Vec3d releasePoint = this.getAirPositionInFrontOfPlayer(world, player, 0.8D);
this.releaseButterfly(stack, world, player, releasePoint);
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
case HONEY: default:
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
}
}
@ -175,8 +201,16 @@ public class ItemJarFilled extends Item
Vec3d releasePoint = new Vec3d(player.posX + a * distX, player.posY + (double)player.getEyeHeight() + a * distY, player.posZ + a * distZ);
return this.releasePixie(stack, world, player, releasePoint) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
case BUTTERFLY:
double distX1 = hitX - player.posX;
double distY1 = hitY - (player.posY + (double)player.getEyeHeight());
double distZ1 = hitZ - player.posZ;
double a1 = 0.9D;
Vec3d releasePoint1 = new Vec3d(player.posX + a1 * distX1, player.posY + (double)player.getEyeHeight() + a1 * distY1, player.posZ + a1 * distZ1);
return this.releaseButterfly(stack, world, player, releasePoint1) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
// TODO: are you supposed to be able to pour out honey? How much should you get? Why don't we just use buckets?
case HONEY: case POISON: default:
case HONEY: default:
return EnumActionResult.SUCCESS;
}
}

View file

@ -18,8 +18,6 @@ achievement.craft_muddy_pickaxe=Getting a Downgrade
achievement.craft_muddy_pickaxe.desc=Build a...muddy pickaxe...?
achievement.obtain_thorn=Rather Thorny
achievement.obtain_thorn.desc=Collect a prickly thorn!
achievement.craft_poison_jar=Pick Your Poison
achievement.craft_poison_jar.desc=Extract poison from a poison ivy plant
achievement.obtain_deathbloom=I am Become Death
achievement.obtain_deathbloom.desc=Acquire a deadly deathbloom
achievement.obtain_honeycomb=Honeycomb's Big
@ -120,7 +118,7 @@ item.jacaranda_door.name=Jacaranda Door
item.jar_empty.name=Empty Jar
item.jar_filled_honey.name=Honey Jar
item.jar_filled_pixie.name=Pixie Jar
item.jar_filled_poison.name=Poison Extract Jar
item.jar_filled_butterfly.name=Butterfly Jar
item.lush_flower_band.name=Lush Flower Band
item.magic_door.name=Magic Door
item.mahogany_door.name=Mahogany Door

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "biomesoplenty:items/jar_filled_butterfly"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "biomesoplenty:items/jar_filled_poison"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B