diff --git a/specialPeopleStuff.properties b/specialPeopleStuff.properties index 322c16c39..8c2c360d0 100644 --- a/specialPeopleStuff.properties +++ b/specialPeopleStuff.properties @@ -18,4 +18,5 @@ ftog_thorgal=actuallyadditions:itemCrystal minetechniker=actuallyadditions:itemCrystalEmpowered@2 3pixel=actuallyadditions:itemMoreDamageLens kirindave=actuallyadditions:itemCrystalEmpowered@3 -theonewhohunts=actuallyadditions:itemCrystalEmpowered@4 \ No newline at end of file +theonewhohunts=actuallyadditions:itemCrystalEmpowered@4 +garantiertnicht=actuallyadditions:itemFillingWand \ No newline at end of file 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 7ff6f14db..18d4bb7f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -193,7 +193,6 @@ public final class InitBooklet{ new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()), new ItemStack(InitItems.itemCanolaSeed)).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText()); new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockLeafGenerator), new PageTextOnly(1).addTextReplacement("", TileEntityLeafGenerator.ENERGY_PRODUCED).addTextReplacement("", TileEntityLeafGenerator.RANGE), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant(); new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockBioReactor), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial(); - ; //No RF Using Items new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(InitItems.itemBag), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant(); @@ -221,6 +220,7 @@ public final class InitBooklet{ //RF Using Items new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemDrill, 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(4, ItemCrafting.RECIPES_DRILL_COLORING), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial(); + new BookletChapter("fillingWand", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemFillingWand), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial(); new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant(); new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing)); new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java index 11220bd4f..a0e9008a5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java @@ -154,6 +154,7 @@ public enum ConfigCrafting{ CHARCOAL_BLOCK("Charcoal Block", ConfigCategories.BLOCKS_CRAFTING), TINY_COAL("Tiny Coal", ConfigCategories.ITEMS_CRAFTING), BAG("Bag", ConfigCategories.ITEMS_CRAFTING), + FILLING_WAND("Handheld Filler", ConfigCategories.ITEMS_CRAFTING), VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING), EMPOWERER("Empowerer", ConfigCategories.BLOCKS_CRAFTING), DISTRIBUTOR_ITEM("Item Distributor", ConfigCategories.BLOCKS_CRAFTING), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java index 6b3176800..cd288206e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/ItemCrafting.java @@ -94,9 +94,22 @@ public final class ItemCrafting{ public static IRecipe recipeBag; public static IRecipe recipeVoidBag; public static IRecipe recipeLensMoreDeath; + public static IRecipe recipeFillingWand; public static void init(){ + //Filling Wand + if(ConfigCrafting.FILLING_WAND.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFillingWand), + "IPI", "DCD", " B ", + 'I', new ItemStack(InitItems.itemCrystalEmpowered, 1, TheCrystals.IRON.ordinal()), + 'P', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), + 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), + 'D', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), + 'B', new ItemStack(InitItems.itemBatteryTriple))); + recipeFillingWand = RecipeUtil.lastIRecipe(); + } + //Bag if(ConfigCrafting.BAG.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBag), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java index 6ef858bc9..aaca6039b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java @@ -19,6 +19,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumActionResult; @@ -29,15 +30,17 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import java.util.List; + public class ItemFillingWand extends ItemEnergy{ public ItemFillingWand(String name){ - super(500000, 1000, name); + super(800000, 2000, name); } @Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){ - if(player.getItemInUseCount() <= 0){ + if(!world.isRemote && player.getItemInUseCount() <= 0){ if(player.isSneaking()){ IBlockState state = world.getBlockState(pos); saveBlock(state, stack); @@ -64,26 +67,28 @@ public class ItemFillingWand extends ItemEnergy{ @Override public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entity, int timeLeft){ - boolean clear = true; - if(entity instanceof EntityPlayer){ - RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (EntityPlayer)entity); - if(result != null && result.getBlockPos() != null){ - if(!stack.hasTagCompound()){ - stack.setTagCompound(new NBTTagCompound()); + if(!world.isRemote){ + boolean clear = true; + if(entity instanceof EntityPlayer){ + RayTraceResult result = WorldUtil.getNearestBlockWithDefaultReachDistance(world, (EntityPlayer)entity); + if(result != null && result.getBlockPos() != null){ + if(!stack.hasTagCompound()){ + stack.setTagCompound(new NBTTagCompound()); + } + NBTTagCompound compound = stack.getTagCompound(); + + BlockPos pos = result.getBlockPos(); + compound.setInteger("SecondX", pos.getX()); + compound.setInteger("SecondY", pos.getY()); + compound.setInteger("SecondZ", pos.getZ()); + + clear = false; } - NBTTagCompound compound = stack.getTagCompound(); - - BlockPos pos = result.getBlockPos(); - compound.setInteger("SecondX", pos.getX()); - compound.setInteger("SecondY", pos.getY()); - compound.setInteger("SecondZ", pos.getZ()); - - clear = false; } - } - if(clear){ - ItemPhantomConnector.clearStorage(stack, "FirstX", "FirstY", "FirstZ"); + if(clear){ + ItemPhantomConnector.clearStorage(stack, "FirstX", "FirstY", "FirstZ"); + } } super.onPlayerStoppedUsing(stack, world, entity, timeLeft); @@ -93,72 +98,129 @@ public class ItemFillingWand extends ItemEnergy{ public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected){ super.onUpdate(stack, world, entity, itemSlot, isSelected); - boolean shouldClear = false; + if(!world.isRemote){ + boolean shouldClear = false; - if(isSelected){ - if(entity instanceof EntityPlayer && stack.hasTagCompound()){ - NBTTagCompound compound = stack.getTagCompound(); + if(isSelected){ + if(entity instanceof EntityPlayer && stack.hasTagCompound()){ + EntityPlayer player = (EntityPlayer)entity; + boolean creative = player.capabilities.isCreativeMode; - BlockPos firstPos = new BlockPos(compound.getInteger("FirstX"), compound.getInteger("FirstY"), compound.getInteger("FirstZ")); - BlockPos secondPos = new BlockPos(compound.getInteger("SecondX"), compound.getInteger("SecondY"), compound.getInteger("SecondZ")); + NBTTagCompound compound = stack.getTagCompound(); - if(!BlockPos.ORIGIN.equals(firstPos) && !BlockPos.ORIGIN.equals(secondPos)){ - IBlockState replaceState = loadBlock(stack); - if(replaceState != null){ - int lowestX = Math.min(firstPos.getX(), secondPos.getX()); - int lowestY = Math.min(firstPos.getY(), secondPos.getY()); - int lowestZ = Math.min(firstPos.getZ(), secondPos.getZ()); + BlockPos firstPos = new BlockPos(compound.getInteger("FirstX"), compound.getInteger("FirstY"), compound.getInteger("FirstZ")); + BlockPos secondPos = new BlockPos(compound.getInteger("SecondX"), compound.getInteger("SecondY"), compound.getInteger("SecondZ")); - int currX = compound.getInteger("CurrX"); - int currY = compound.getInteger("CurrY"); - int currZ = compound.getInteger("CurrZ"); + if(!BlockPos.ORIGIN.equals(firstPos) && !BlockPos.ORIGIN.equals(secondPos)){ + int energyUse = 1500; - BlockPos pos = new BlockPos(lowestX+currX, lowestY+currY, lowestZ+currZ); - IBlockState state = world.getBlockState(pos); + IBlockState replaceState = loadBlock(stack); + if(replaceState != null && (creative || this.getEnergyStored(stack) >= energyUse)){ + int lowestX = Math.min(firstPos.getX(), secondPos.getX()); + int lowestY = Math.min(firstPos.getY(), secondPos.getY()); + int lowestZ = Math.min(firstPos.getZ(), secondPos.getZ()); - if(state.getBlock().isReplaceable(world, pos) && replaceState.getBlock().canPlaceBlockAt(world, pos)){ - world.setBlockState(pos, replaceState, 2); + int currX = compound.getInteger("CurrX"); + int currY = compound.getInteger("CurrY"); + int currZ = compound.getInteger("CurrZ"); - if(!ConfigBoolValues.LESS_SOUND.isEnabled()){ - SoundType sound = replaceState.getBlock().getSoundType(replaceState, world, pos, entity); - world.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume()+1.0F)/2.0F, sound.getPitch()*0.8F); - } - } + BlockPos pos = new BlockPos(lowestX+currX, lowestY+currY, lowestZ+currZ); + IBlockState state = world.getBlockState(pos); - int distX = Math.abs(secondPos.getX()-firstPos.getX()); - int distY = Math.abs(secondPos.getY()-firstPos.getY()); - int distZ = Math.abs(secondPos.getZ()-firstPos.getZ()); + if(state.getBlock().isReplaceable(world, pos) && replaceState.getBlock().canPlaceBlockAt(world, pos)){ + if(creative || removeFittingItem(replaceState, player)){ + world.setBlockState(pos, replaceState, 2); - currX++; - if(currX > distX){ - currX = 0; - currY++; - if(currY > distY){ - currY = 0; - currZ++; - if(currZ > distZ){ + if(!ConfigBoolValues.LESS_SOUND.isEnabled()){ + SoundType sound = replaceState.getBlock().getSoundType(replaceState, world, pos, player); + world.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume()+1.0F)/2.0F, sound.getPitch()*0.8F); + } + + if(!creative){ + this.extractEnergy(stack, energyUse, false); + } + } + else{ shouldClear = true; } } - } - compound.setInteger("CurrX", currX); - compound.setInteger("CurrY", currY); - compound.setInteger("CurrZ", currZ); - } - else{ - shouldClear = true; + int distX = Math.abs(secondPos.getX()-firstPos.getX()); + int distY = Math.abs(secondPos.getY()-firstPos.getY()); + int distZ = Math.abs(secondPos.getZ()-firstPos.getZ()); + + currX++; + if(currX > distX){ + currX = 0; + currY++; + if(currY > distY){ + currY = 0; + currZ++; + if(currZ > distZ){ + shouldClear = true; + } + } + } + + if(!shouldClear){ + compound.setInteger("CurrX", currX); + compound.setInteger("CurrY", currY); + compound.setInteger("CurrZ", currZ); + } + } + else{ + shouldClear = true; + } } } } + else{ + shouldClear = true; + } + + if(shouldClear){ + ItemPhantomConnector.clearStorage(stack, "FirstX", "FirstY", "FirstZ", "SecondX", "SecondY", "SecondZ", "CurrX", "CurrY", "CurrZ"); + } } - else{ - shouldClear = true; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ + super.addInformation(stack, player, list, bool); + + String display = "None"; + + IBlockState state = loadBlock(stack); + if(state != null){ + Block block = state.getBlock(); + ItemStack blockStack = new ItemStack(block, 1, block.getMetaFromState(state)); + if(blockStack.getItem() != null){ + display = blockStack.getDisplayName(); + } } - if(shouldClear){ - ItemPhantomConnector.clearStorage(stack, "FirstX", "FirstY", "FirstZ", "SecondX", "SecondY", "SecondZ", "CurrX", "CurrY", "CurrZ"); + list.add("Selected Block: "+display); + } + + private static boolean removeFittingItem(IBlockState state, EntityPlayer player){ + Block block = state.getBlock(); + ItemStack stack = new ItemStack(block, 1, block.getMetaFromState(state)); + + if(stack != null && stack.getItem() != null){ + for(int i = 0; i < player.inventory.getSizeInventory(); i++){ + ItemStack slot = player.inventory.getStackInSlot(i); + if(slot != null && slot.isItemEqual(stack) && slot.stackSize > 0){ + slot.stackSize--; + if(slot.stackSize <= 0){ + player.inventory.setInventorySlotContents(i, null); + } + + return true; + } + } } + + return false; } private static void saveBlock(IBlockState state, ItemStack stack){ @@ -190,4 +252,9 @@ public class ItemFillingWand extends ItemEnergy{ public int getMaxItemUseDuration(ItemStack stack){ return Integer.MAX_VALUE; } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.EPIC; + } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index ec1f93edf..f384f6aed 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -513,6 +513,7 @@ item.actuallyadditions.itemMiscCrystallizedCanolaSeed.name=Crystallized Canola S item.actuallyadditions.itemMiscEmpoweredCanolaSeed.name=Empowered Canola Seed item.actuallyadditions.itemMiningLens.name=Lens of the Miner item.actuallyadditions.itemMoreDamageLens.name=Lens of the Killer +item.actuallyadditions.itemFillingWand.name=Handheld Filler #Tooltips tooltip.actuallyadditions.onSuffix.desc=On @@ -1053,4 +1054,7 @@ booklet.actuallyadditions.chapter.reviews.name=What people think booklet.actuallyadditions.chapter.reviews.text.1="Actually Additions, to me, is quite magical in a way." -Saphrym "Actually quite cool. Lots of nice little additions. Gonna be in the pack." -Direwolf20 "Mod Dev quite rude and arrogant" -Bubb1e0seven "A whimsical breath of fresh air in a stuffy tech-mod world." -mezz booklet.actuallyadditions.chapter.lensMoreDeath.name=Lens of the Killer -booklet.actuallyadditions.chapter.lensMoreDeath.text.1=The Lens of the Killer works much like the Lens of Certain Death, however it will also drop experience and player-kill loot. This means, however, that it will use a lot more power. To pick up the experience it drops, you might want to try an Experience Solidifier. \ No newline at end of file +booklet.actuallyadditions.chapter.lensMoreDeath.text.1=The Lens of the Killer works much like the Lens of Certain Death, however it will also drop experience and player-kill loot. This means, however, that it will use a lot more power. To pick up the experience it drops, you might want to try an Experience Solidifier. + +booklet.actuallyadditions.chapter.fillingWand.name=Handheld Filler +booklet.actuallyadditions.chapter.fillingWand.text.1=The Handheld Filler is a great way to fill any area with blocks. To do this, first sneak-right-click a block in the world that you want to fill an area with. To actually fill an area, look at the first corner and hold right-click. Let go of right-click at the second corner. The area you mark can be a flat plane or a cube. This process requires some RF for placing the blocks and you need to have the blocks in your inventory. \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/models/item/itemFillingWand.json b/src/main/resources/assets/actuallyadditions/models/item/itemFillingWand.json new file mode 100644 index 000000000..83235ef31 --- /dev/null +++ b/src/main/resources/assets/actuallyadditions/models/item/itemFillingWand.json @@ -0,0 +1,6 @@ +{ + "parent": "actuallyadditions:item/standardItem", + "textures": { + "layer0": "actuallyadditions:items/itemFillingWand" + } +} diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemFillingWand.png b/src/main/resources/assets/actuallyadditions/textures/items/itemFillingWand.png new file mode 100644 index 000000000..1352e79ee Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemFillingWand.png differ