From e46851e7899515a22609d72830e93978e7e4b4ac Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 2 Jun 2016 20:07:36 +0200 Subject: [PATCH] Water bowl doc and config --- .../mod/booklet/InitBooklet.java | 1 + .../mod/config/values/ConfigBoolValues.java | 4 ++- .../mod/event/EntityLivingEvents.java | 36 ++++++++++--------- .../assets/actuallyadditions/lang/en_US.lang | 5 ++- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index 0c51820c4..ffc0cd70b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -89,6 +89,7 @@ public class InitBooklet{ new BookletChapter("lushCaves", ActuallyAdditionsAPI.entryMisc, new ItemStack(Blocks.STONE), new PageTextOnly(1), new PagePicture(2, "pageLushCaves", 0).setNoText()); new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemHairyBall), new PagePicture(1, "pageFurBalls", 110).setStack(new ItemStack(InitItems.itemHairyBall)), new PageTextOnly(2)).setSpecial(); new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockBlackLotus)), new PageCrafting(2, ItemCrafting.recipeBlackDye)); + new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemWaterBowl), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemWaterBowl))); //No RF Using Blocks new BookletChapter("itemStorage", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockLaserRelayItemWhitelist), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeLaserRelayItem).setNoText().setPageStacksWildcard(), new PageCrafting(4, BlockCrafting.recipeLaserRelayItemWhitelist).setNoText().setPageStacksWildcard(), new PageCrafting(5, BlockCrafting.recipeItemInterface).setNoText()).setImportant(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java index 926dddedc..886612496 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigBoolValues.java @@ -49,7 +49,9 @@ public enum ConfigBoolValues{ DUNGEON_LOOT("Dungeon Loot", ConfigCategories.OTHER, true, "Should Actually Additions Loot spawn in Dungeons"), GEN_LUSH_CAVES("Generate Lush Caves", ConfigCategories.WORLD_GEN, true, "Should caves with trees and grass randomly generate underground"), - BOOKLET_TEXT_TO_FILE("Booklet Text to File", ConfigCategories.OTHER, false, "Should the entire text of the booklet be put into a new file in the Minecraft Folder on startup or resource reload. This is for debug purposes only and shouldn't really ever be needed."); + BOOKLET_TEXT_TO_FILE("Booklet Text to File", ConfigCategories.OTHER, false, "Should the entire text of the booklet be put into a new file in the Minecraft Folder on startup or resource reload. This is for debug purposes only and shouldn't really ever be needed."), + + WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "If right-clicking a bowl on water should create a water bowl"); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java index 693ad7436..ee1ab2bc4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/EntityLivingEvents.java @@ -94,26 +94,28 @@ public class EntityLivingEvents{ @SubscribeEvent public void onPlayerInteractEvent(PlayerInteractEvent event){ if(event.getWorld() != null){ - if(event.getItemStack() != null && event.getItemStack().getItem() == Items.BOWL){ - RayTraceResult trace = WorldUtil.getNearestBlockWithDefaultReachDistance(event.getWorld(), event.getEntityPlayer(), true, false, false); - ActionResult result = ForgeEventFactory.onBucketUse(event.getEntityPlayer(), event.getWorld(), event.getItemStack(), trace); - if(result == null && trace != null && trace.getBlockPos() != null){ - if(event.getEntityPlayer().canPlayerEdit(trace.getBlockPos().offset(trace.sideHit), trace.sideHit, event.getItemStack())){ - IBlockState state = event.getWorld().getBlockState(trace.getBlockPos()); - Material material = state.getMaterial(); + if(ConfigBoolValues.WATER_BOWL.isEnabled()){ + if(event.getItemStack() != null && event.getItemStack().getItem() == Items.BOWL){ + RayTraceResult trace = WorldUtil.getNearestBlockWithDefaultReachDistance(event.getWorld(), event.getEntityPlayer(), true, false, false); + ActionResult result = ForgeEventFactory.onBucketUse(event.getEntityPlayer(), event.getWorld(), event.getItemStack(), trace); + if(result == null && trace != null && trace.getBlockPos() != null){ + if(event.getEntityPlayer().canPlayerEdit(trace.getBlockPos().offset(trace.sideHit), trace.sideHit, event.getItemStack())){ + IBlockState state = event.getWorld().getBlockState(trace.getBlockPos()); + Material material = state.getMaterial(); - if(material == Material.WATER && state.getValue(BlockLiquid.LEVEL) == 0){ - event.getEntityPlayer().playSound(SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F); + if(material == Material.WATER && state.getValue(BlockLiquid.LEVEL) == 0){ + event.getEntityPlayer().playSound(SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F); - if(!event.getWorld().isRemote){ - event.getWorld().setBlockState(trace.getBlockPos(), Blocks.AIR.getDefaultState(), 11); - event.getItemStack().stackSize--; + if(!event.getWorld().isRemote){ + event.getWorld().setBlockState(trace.getBlockPos(), Blocks.AIR.getDefaultState(), 11); + event.getItemStack().stackSize--; - ItemStack bowl = new ItemStack(InitItems.itemWaterBowl); - if(!event.getEntityPlayer().inventory.addItemStackToInventory(bowl.copy())){ - EntityItem entityItem = new EntityItem(event.getWorld(), event.getEntityPlayer().posX, event.getEntityPlayer().posY, event.getEntityPlayer().posZ, bowl.copy()); - entityItem.setPickupDelay(0); - event.getWorld().spawnEntityInWorld(entityItem); + ItemStack bowl = new ItemStack(InitItems.itemWaterBowl); + if(!event.getEntityPlayer().inventory.addItemStackToInventory(bowl.copy())){ + EntityItem entityItem = new EntityItem(event.getWorld(), event.getEntityPlayer().posX, event.getEntityPlayer().posY, event.getEntityPlayer().posZ, bowl.copy()); + entityItem.setPickupDelay(0); + event.getWorld().spawnEntityInWorld(entityItem); + } } } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 9544da20e..f52aea55b 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -882,4 +882,7 @@ booklet.actuallyadditions.chapter.lushCaves.text.1=If you have ever done any Manual Stand is a block that is supposed to mainly be used on Servers. You can, provided you are the person who placed it down, set a page in the GUI that will open when someone else accesses it by pressing the "Set Page"-button while being on the desired page. The Wall-Mount Manual does not save pages another player navigated to, meaing re-accessing the Manual will cause it to always end up on the page speficied by the placer. -booklet.actuallyadditions.chapter.bookStand.text.2=People were using this not to have to have a manual item on their hotbar. This is not supposed to be used for that, because the Actually Additions Manual has bookmarks and also keeps the page you were on before. This, however, does neither. This was also originally made for Better Than Minecon. But whatever. \ No newline at end of file +booklet.actuallyadditions.chapter.bookStand.text.2=People were using this not to have to have a manual item on their hotbar. This is not supposed to be used for that, because the Actually Additions Manual has bookmarks and also keeps the page you were on before. This, however, does neither. This was also originally made for Better Than Minecon. But whatever. + +booklet.actuallyadditions.chapter.waterBowl.name=Bowl of Water +booklet.actuallyadditions.chapter.waterBowl.text.1=The Bowl of Water can be obtained by right-cliking a bowl on water anywhere in the world. When the Bowl of Water is then right-clicked onto a block, the water will be placed, much like a Bucket. This can be used, for example, for early game farms. \ No newline at end of file