diff --git a/TexturesToBeMade.txt b/TexturesToBeMade.txt deleted file mode 100644 index 67b773e2c..000000000 --- a/TexturesToBeMade.txt +++ /dev/null @@ -1,5 +0,0 @@ -Textures to be made --------------------------------------------------------------------------------------------------------------- -This file is a reminder to Glenthor for what textures he should make or change. -If you want to give making some of these textures a go, go ahead and make a pull request when you're done. --------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0ccb18688..922d1dfb2 100644 --- a/build.gradle +++ b/build.gradle @@ -12,12 +12,12 @@ buildscript { } apply plugin: 'net.minecraftforge.gradle.forge' -version = "1.8.9-r23" +version = "1.8.9-r25" group = "de.ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" minecraft { - version = "1.8.9-11.15.0.1697" + version = "1.8.9-11.15.1.1732" runDir = "idea" mappings = "stable_20" @@ -38,11 +38,11 @@ repositories { } dependencies { - compile "codechicken:CodeChickenLib:1.8-1.1.2.139:dev" - compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev" - compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev" + //compile "codechicken:CodeChickenLib:1.8-1.1.2.139:dev" + //compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev" + //compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev" - deobfCompile "mezz.jei:jei_1.8.9:2.18.1.88" + deobfCompile "mezz.jei:jei_1.8.9:2.25.6.140" } processResources { diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index 82acde7b5..840c6e8cc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.api; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; -import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn; import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; @@ -28,12 +27,11 @@ public class ActuallyAdditionsAPI{ public static final String MOD_ID = "ActuallyAdditions"; public static final String API_ID = MOD_ID+"API"; - public static final String API_VERSION = "7"; + public static final String API_VERSION = "8"; public static List crusherRecipes = new ArrayList(); public static List ballOfFurReturnItems = new ArrayList(); public static List treasureChestLoot = new ArrayList(); - public static List reconstructorLenses = new ArrayList(); public static List reconstructorLensNoneRecipes = new ArrayList(); public static List coffeeMachineIngredients = new ArrayList(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java index 65bfe09b3..c053dfa1f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java @@ -16,14 +16,14 @@ public interface IBookletEntry{ List getChapters(); + void setChapters(List chapters); + String getUnlocalizedName(); String getLocalizedName(); String getLocalizedNameWithFormatting(); - void setChapters(List chapters); - void addChapter(IBookletChapter chapter); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java index f3b91b773..fb67d6e6f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/EntrySet.java @@ -31,13 +31,6 @@ public class EntrySet{ this.setEntry(page, chapter, entry, pageInIndex); } - public void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex){ - this.page = page; - this.chapter = chapter; - this.entry = entry; - this.pageInIndex = pageInIndex; - } - public static EntrySet readFromNBT(NBTTagCompound compound){ if(compound != null){ if(compound.hasKey("Entry")){ @@ -56,6 +49,13 @@ public class EntrySet{ return new EntrySet(null); } + public void setEntry(BookletPage page, IBookletChapter chapter, IBookletEntry entry, int pageInIndex){ + this.page = page; + this.chapter = chapter; + this.entry = entry; + this.pageInIndex = pageInIndex; + } + public void removeEntry(){ this.setEntry(null, null, null, 1); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java index 8c0bb48be..de2bd038c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.api.lens; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import net.minecraft.item.Item; import net.minecraft.util.BlockPos; @@ -28,8 +27,9 @@ public abstract class Lens{ /** * Invokes the lens type's behavior on a block + * * @param hitBlock The block that was hit - * @param tile The tile the lens was invoked from + * @param tile The tile the lens was invoked from * @return If the Reconstructor should stop continuing (return false if you want it to go through blocks) */ public abstract boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile); @@ -44,14 +44,6 @@ public abstract class Lens{ */ public abstract int getDistance(); - /** - * Registers the lense type - */ - public Lens register(){ - ActuallyAdditionsAPI.reconstructorLenses.add(this); - return this; - } - /** * Sets the item corresponding to the lense */ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 3df0cc7b9..bbd2131d6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting; import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting; import de.ellpeck.actuallyadditions.mod.crafting.ItemCrafting; import de.ellpeck.actuallyadditions.mod.event.InitEvents; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.gen.InitVillager; import de.ellpeck.actuallyadditions.mod.gen.OreGen; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; @@ -68,6 +69,7 @@ public class ActuallyAdditions{ InitToolMaterials.init(); InitArmorMaterials.init(); InitBlocks.init(); + InitFluids.init(); InitItems.init(); FuelHandler.init(); UpdateChecker.init(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index f2438606d..e96154ccf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -12,11 +12,10 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; +import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; -import de.ellpeck.actuallyadditions.mod.util.AssetUtil; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.PosUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import de.ellpeck.actuallyadditions.mod.util.*; +import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; @@ -37,8 +36,12 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.List; + public class BlockAtomicReconstructor extends BlockContainerBase implements IHudDisplay{ + public static final int NAME_FLAVOR_AMOUNTS_1 = 12; + public static final int NAME_FLAVOR_AMOUNTS_2 = 14; private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); public BlockAtomicReconstructor(String name){ @@ -49,24 +52,6 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.EPIC; - } - - @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); - PosUtil.setMetadata(pos, world, rotation, 2); - - super.onBlockPlacedBy(world, pos, state, player, stack); - } - @Override public boolean isOpaqueCube(){ return false; @@ -129,4 +114,64 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); } } + + @Override + protected Class getItemBlock(){ + return TheItemBlock.class; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.EPIC; + } + + @Override + public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ + int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + PosUtil.setMetadata(pos, world, rotation, 2); + + super.onBlockPlacedBy(world, pos, state, player, stack); + } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + + public static class TheItemBlock extends ItemBlockBase{ + + private long lastSysTime; + private int toPick1; + private int toPick2; + + public TheItemBlock(Block block){ + super(block); + this.setHasSubtypes(false); + this.setMaxDamage(0); + } + + @Override + public String getUnlocalizedName(ItemStack stack){ + return this.getUnlocalizedName(); + } + + @Override + public int getMetadata(int damage){ + return damage; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ + long sysTime = System.currentTimeMillis(); + + if(this.lastSysTime+3000 < sysTime){ + this.lastSysTime = sysTime; + this.toPick1 = Util.RANDOM.nextInt(NAME_FLAVOR_AMOUNTS_1)+1; + this.toPick2 = Util.RANDOM.nextInt(NAME_FLAVOR_AMOUNTS_2)+1; + } + + String base = "tile."+ModUtil.MOD_ID_LOWER+"."+((BlockAtomicReconstructor)this.block).getBaseName()+".info."; + list.add(StringUtil.localize(base+"1."+this.toPick1)+" "+StringUtil.localize(base+"2."+this.toPick2)); + } + } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index 1077968f8..a09f346c6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -31,8 +31,8 @@ import net.minecraft.world.World; public class BlockBreaker extends BlockContainerBase{ - private boolean isPlacer; private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); + private boolean isPlacer; public BlockBreaker(boolean isPlacer, String name){ super(Material.rock, name); @@ -43,11 +43,6 @@ public class BlockBreaker extends BlockContainerBase{ this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker(); @@ -81,6 +76,11 @@ public class BlockBreaker extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index 7017e7e06..9bb60e771 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -46,11 +46,6 @@ public class BlockCoalGenerator extends BlockContainerBase{ this.setTickRandomly(true); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityCoalGenerator(); @@ -85,6 +80,11 @@ public class BlockCoalGenerator extends BlockContainerBase{ return EnumRarity.RARE; } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index 0bd4b2af7..7c49c7e23 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -39,14 +39,13 @@ public class BlockCoffeeMachine extends BlockContainerBase{ this.setResistance(10.0F); this.setStepSound(soundTypeStone); - //TODO Fix bounding box - //float f = 1/16F; - //this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f); + float f = 1/16F; + this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f); } @Override - protected PropertyInteger getMetaProperty(){ - return META; + public boolean isFullCube(){ + return false; } @Override @@ -101,4 +100,9 @@ public class BlockCoffeeMachine extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index 267c23653..743dc70d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -53,11 +53,6 @@ public class BlockColoredLamp extends BlockBase{ this.isOn = isOn; } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public Item getItemDropped(IBlockState state, Random rand, int par3){ return Item.getItemFromBlock(InitBlocks.blockColoredLamp); @@ -133,11 +128,6 @@ public class BlockColoredLamp extends BlockBase{ return TheItemBlock.class; } - @Override - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.RARE; - } - @Override protected void registerRendering(){ ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length]; @@ -149,6 +139,15 @@ public class BlockColoredLamp extends BlockBase{ ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs); } + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.RARE; + } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } public static class TheItemBlock extends ItemBlockBase{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java index b872af821..6023cdf34 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java @@ -83,7 +83,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ if(!player.capabilities.isCreativeMode){ player.inventory.getCurrentItem().stackSize--; } - tile.sendUpdate(); + tile.markDirty(); } //Add Fertilizer to player's inventory @@ -95,7 +95,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ player.getCurrentEquippedItem().stackSize += tile.slots[0].stackSize; } tile.slots[0] = null; - tile.sendUpdate(); + tile.markDirty(); } } return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java index 68cc30514..99f96dc5e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCrystal.java @@ -42,11 +42,6 @@ public class BlockCrystal extends BlockBase{ this.setHarvestLevel("pickaxe", 1); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public int damageDropped(IBlockState state){ return this.getMetaFromState(state); @@ -65,11 +60,6 @@ public class BlockCrystal extends BlockBase{ return TheItemBlock.class; } - @Override - public EnumRarity getRarity(ItemStack stack){ - return stack.getItemDamage() >= allCrystals.length ? EnumRarity.COMMON : allCrystals[stack.getItemDamage()].rarity; - } - @Override protected void registerRendering(){ ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length]; @@ -81,6 +71,16 @@ public class BlockCrystal extends BlockBase{ ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs); } + @Override + public EnumRarity getRarity(ItemStack stack){ + return stack.getItemDamage() >= allCrystals.length ? EnumRarity.COMMON : allCrystals[stack.getItemDamage()].rarity; + } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + public static class TheItemBlock extends ItemBlockBase{ public TheItemBlock(Block block){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java index 0082f798a..bbc3db8cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java @@ -41,11 +41,6 @@ public class BlockDirectionalBreaker extends BlockContainerBase{ this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityDirectionalBreaker(); @@ -79,6 +74,11 @@ public class BlockDirectionalBreaker extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index 67e26bea4..44d0e2c50 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -39,10 +39,6 @@ public class BlockDropper extends BlockContainerBase{ this.setResistance(10.0F); this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } @Override public TileEntity createNewTileEntity(World world, int par2){ @@ -77,6 +73,11 @@ public class BlockDropper extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java index e4aa6604f..e1edeea3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java @@ -34,6 +34,11 @@ public class BlockFishingNet extends BlockContainerBase{ return new TileEntityFishingNet(); } + @Override + public boolean isFullCube(){ + return false; + } + @Override public boolean isOpaqueCube(){ return false; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index 84fb63f54..431e0c54d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -44,11 +44,6 @@ public class BlockFluidCollector extends BlockContainerBase{ this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector(); @@ -82,6 +77,11 @@ public class BlockFluidCollector extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java index 1b44fe834..815b9fe56 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java @@ -48,11 +48,6 @@ public class BlockFurnaceDouble extends BlockContainerBase{ this.setTickRandomly(true); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityFurnaceDouble(); @@ -135,6 +130,11 @@ public class BlockFurnaceDouble extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java index a6831a0d3..391bf1903 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java @@ -34,6 +34,11 @@ public class BlockFurnaceSolar extends BlockContainerBase{ return new TileEntityFurnaceSolar(); } + @Override + public boolean isFullCube(){ + return false; + } + @Override public boolean isOpaqueCube(){ return false; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index 4812e0bd0..b23451304 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -36,22 +36,31 @@ public class BlockGreenhouseGlass extends BlockContainerBase{ this.setStepSound(soundTypeStone); } - @Override - @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer(){ - return EnumWorldBlockLayer.CUTOUT; - } - @Override public boolean isFullCube(){ return false; } + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ + IBlockState state = worldIn.getBlockState(pos); + Block block = state.getBlock(); + return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side); + + } + @Override public boolean isOpaqueCube(){ return false; } + @Override + @SideOnly(Side.CLIENT) + public EnumWorldBlockLayer getBlockLayer(){ + return EnumWorldBlockLayer.CUTOUT; + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.EPIC; @@ -61,13 +70,4 @@ public class BlockGreenhouseGlass extends BlockContainerBase{ public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityGreenhouseGlass(); } - - @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ - IBlockState state = worldIn.getBlockState(pos); - Block block = state.getBlock(); - return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side); - - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java index fc2805758..bf4c3571b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java @@ -35,8 +35,8 @@ import java.util.Random; public class BlockGrinder extends BlockContainerBase{ - private final boolean isDouble; private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); + private final boolean isDouble; public BlockGrinder(boolean isDouble, String name){ super(Material.rock, name); @@ -48,11 +48,6 @@ public class BlockGrinder extends BlockContainerBase{ this.setTickRandomly(true); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder(); @@ -95,6 +90,11 @@ public class BlockGrinder extends BlockContainerBase{ return EnumRarity.EPIC; } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java index 710afc2dd..73b9d2f89 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java @@ -37,11 +37,6 @@ public class BlockLampPowerer extends BlockBase{ this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){ this.updateLamp(world, pos); @@ -82,4 +77,9 @@ public class BlockLampPowerer extends BlockBase{ public EnumRarity getRarity(ItemStack stack){ return EnumRarity.RARE; } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 4b3dedbbb..2b02cccb3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -42,8 +42,8 @@ public class BlockLaserRelay extends BlockContainerBase{ } @Override - protected PropertyInteger getMetaProperty(){ - return META; + public boolean isFullCube(){ + return false; } @Override @@ -92,6 +92,11 @@ public class BlockLaserRelay extends BlockContainerBase{ return EnumRarity.EPIC; } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public TileEntity createNewTileEntity(World world, int i){ return new TileEntityLaserRelay(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java index df65d4e48..a9aa228cb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMisc.java @@ -42,27 +42,11 @@ public class BlockMisc extends BlockBase{ this.setHarvestLevel("pickaxe", 1); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public int damageDropped(IBlockState state){ return this.getMetaFromState(state); } - @Override - protected void registerRendering(){ - ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length]; - for(int i = 0; i < allMiscBlocks.length; i++){ - String name = this.getBaseName()+allMiscBlocks[i].name; - resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name); - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name)); - } - ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs); - } - @SuppressWarnings("all") @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list){ @@ -76,11 +60,27 @@ public class BlockMisc extends BlockBase{ return TheItemBlock.class; } + @Override + protected void registerRendering(){ + ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length]; + for(int i = 0; i < allMiscBlocks.length; i++){ + String name = this.getBaseName()+allMiscBlocks[i].name; + resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name); + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name)); + } + ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs); + } + @Override public EnumRarity getRarity(ItemStack stack){ return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity; } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + public static class TheItemBlock extends ItemBlockBase{ public TheItemBlock(Block block){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index fe4a88625..8b72114ef 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -46,11 +46,6 @@ public class BlockOilGenerator extends BlockContainerBase{ this.setTickRandomly(true); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityOilGenerator(); @@ -83,6 +78,11 @@ public class BlockOilGenerator extends BlockContainerBase{ return EnumRarity.RARE; } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java index 3f56a5a01..eef04cd9d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java @@ -28,7 +28,12 @@ public class BlockPhantomBooster extends BlockContainerBase{ this.setStepSound(soundTypeStone); float f = 1F/16F; - this.setBlockBounds(3*f, 0F, 3*f, 1-3*f, 1F, 1-3*f); + this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f); + } + + @Override + public boolean isFullCube(){ + return false; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java index 29d1da66f..4bc6355c8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -31,6 +31,7 @@ import java.util.List; public class BlockSlabs extends BlockBase{ + private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); private Block fullBlock; private int meta; @@ -38,8 +39,6 @@ public class BlockSlabs extends BlockBase{ this(name, fullBlock, 0); } - private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); - public BlockSlabs(String name, Block fullBlock, int meta){ super(fullBlock.getMaterial(), name); this.setHardness(1.5F); @@ -48,11 +47,6 @@ public class BlockSlabs extends BlockBase{ this.meta = meta; } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ this.setBlockBoundsBasedOnState(world, pos); @@ -98,6 +92,11 @@ public class BlockSlabs extends BlockBase{ return EnumRarity.COMMON; } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + public static class TheItemBlock extends ItemBlockBase{ public TheItemBlock(Block block){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java index 3c5f2d85f..dadc6f880 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java @@ -47,9 +47,16 @@ public class BlockSmileyCloud extends BlockContainerBase{ this.setStepSound(soundTypeCloth); this.setTickRandomly(true); } + @Override - protected PropertyInteger getMetaProperty(){ - return META; + public boolean isFullCube(){ + return false; + } + + @Override + public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ + this.setBlockBoundsBasedOnState(world, pos); + super.addCollisionBoxesToList(world, pos, state, axis, list, entity); } @Override @@ -83,28 +90,22 @@ public class BlockSmileyCloud extends BlockContainerBase{ return true; } - @Override - public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ - this.setBlockBoundsBasedOnState(world, pos); - super.addCollisionBoxesToList(world, pos, state, axis, list, entity); - } - @Override public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ int meta = PosUtil.getMetadata(pos, world); float f = 0.0625F; - if(meta == 0){ - this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F-f*3F); - } if(meta == 1){ - this.setBlockBounds(0F, 0F, 0F, 1F-f*3F, 1F, 1F); - } - if(meta == 2){ - this.setBlockBounds(0F, 0F, f*3F, 1F, 1F, 1F); + this.setBlockBounds(0F, 0F, 0F, 1F, 1F-f*3F, 1F-f*2F); } if(meta == 3){ - this.setBlockBounds(f*3F, 0F, 0F, 1F, 1F, 1F); + this.setBlockBounds(0F, 0F, 0F, 1F-f*2F, 1F-f*3F, 1F); + } + if(meta == 0){ + this.setBlockBounds(0F, 0F, f*2F, 1F, 1F-f*3F, 1F); + } + if(meta == 2){ + this.setBlockBounds(f*2F, 0F, 0F, 1F, 1F-f*3F, 1F); } } @@ -143,4 +144,9 @@ public class BlockSmileyCloud extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java index d8eed6bc5..18e4745fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java @@ -46,11 +46,6 @@ public class BlockTreasureChest extends BlockBase{ this.setTickRandomly(true); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ @@ -80,11 +75,6 @@ public class BlockTreasureChest extends BlockBase{ return true; } - @Override - public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){ - return false; - } - @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; @@ -103,6 +93,11 @@ public class BlockTreasureChest extends BlockBase{ } } + @Override + public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){ + return false; + } + private void dropItems(World world, BlockPos pos){ for(int i = 0; i < MathHelper.getRandomIntegerInRange(Util.RANDOM, 3, 6); i++){ TreasureChestLoot theReturn = WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.treasureChestLoot); @@ -129,4 +124,9 @@ public class BlockTreasureChest extends BlockBase{ public EnumRarity getRarity(ItemStack stack){ return EnumRarity.EPIC; } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index ac790f06f..92dad16a1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -48,37 +48,12 @@ public class BlockWildPlant extends BlockBushBase{ this.setStepSound(soundTypeGrass); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state){ BlockPos offset = PosUtil.offset(pos, 0, -1, 0); return PosUtil.getMetadata(pos, world) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this); } - @Override - public Class getItemBlock(){ - return TheItemBlock.class; - } - - @Override - public boolean shouldAddCreative(){ - return false; - } - - @Override - public EnumRarity getRarity(ItemStack stack){ - return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity; - } - - @Override - public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){ - return false; - } - @Override @SideOnly(Side.CLIENT) public Item getItem(World world, BlockPos pos){ @@ -94,6 +69,27 @@ public class BlockWildPlant extends BlockBushBase{ } } + @Override + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ + int metadata = state.getBlock().getMetaFromState(state); + return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune); + } + + @Override + public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){ + return false; + } + + @Override + public Class getItemBlock(){ + return TheItemBlock.class; + } + + @Override + public boolean shouldAddCreative(){ + return false; + } + @Override protected void registerRendering(){ ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length]; @@ -106,9 +102,13 @@ public class BlockWildPlant extends BlockBushBase{ } @Override - public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ - int metadata = state.getBlock().getMetaFromState(state); - return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune); + public EnumRarity getRarity(ItemStack stack){ + return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity; + } + + @Override + protected PropertyInteger getMetaProperty(){ + return META; } public static class TheItemBlock extends ItemBlockBase{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index b9fc6797d..ab5dc92d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -44,11 +44,6 @@ public class BlockXPSolidifier extends BlockContainerBase{ this.setStepSound(soundTypeStone); } - @Override - protected PropertyInteger getMetaProperty(){ - return META; - } - @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityXPSolidifier(); @@ -91,6 +86,11 @@ public class BlockXPSolidifier extends BlockContainerBase{ super.onBlockPlacedBy(world, pos, state, player, stack); } + @Override + protected PropertyInteger getMetaProperty(){ + return META; + } + @Override public void breakBlock(World world, BlockPos pos, IBlockState state){ this.dropInventory(world, pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java index 358e51ba8..4b4d7e727 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/InitBlocks.java @@ -10,19 +10,13 @@ package de.ellpeck.actuallyadditions.mod.blocks; -import de.ellpeck.actuallyadditions.mod.blocks.base.BlockFluidFlowing; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockWallAA; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.util.CompatUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.item.EnumRarity; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; public class InitBlocks{ @@ -52,11 +46,6 @@ public class InitBlocks{ public static Block blockFlax; public static Block blockCoffee; - public static Fluid fluidCanolaOil; - public static Block blockCanolaOil; - public static Fluid fluidOil; - public static Block blockOil; - public static Block blockCanolaPress; public static Block blockFermentingBarrel; @@ -162,7 +151,7 @@ public class InitBlocks{ blockFermentingBarrel = new BlockFermentingBarrel("blockFermentingBarrel"); blockRice = new BlockPlant("blockRice", 1, 2); CompatUtil.registerMFRPlant(blockRice); - blockCanola = new BlockPlant("blockCanola", 5, 5); + blockCanola = new BlockPlant("blockCanola", 2, 3); CompatUtil.registerMFRPlant(blockCanola); blockFlax = new BlockPlant("blockFlax", 2, 4); CompatUtil.registerMFRPlant(blockFlax); @@ -199,53 +188,5 @@ public class InitBlocks{ blockQuartzSlab = new BlockSlabs("blockQuartzSlab", blockMisc, TheMiscBlocks.QUARTZ.ordinal()); blockChiseledQuartzSlab = new BlockSlabs("blockChiseledQuartzSlab", blockMisc, TheMiscBlocks.QUARTZ_CHISELED.ordinal()); blockPillarQuartzSlab = new BlockSlabs("blockPillarQuartzSlab", blockMisc, TheMiscBlocks.QUARTZ_PILLAR.ordinal()); - - registerFluids(); - } - - public static void registerFluids(){ - //Canola Fluid - String canolaOil = "canolaoil"; - if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){ - fluidCanolaOil = new FluidAA(canolaOil, "blockCanolaOil").setRarity(EnumRarity.UNCOMMON); - FluidRegistry.registerFluid(fluidCanolaOil); - } - else{ - errorAlreadyRegistered("Canola Oil Fluid"); - } - fluidCanolaOil = FluidRegistry.getFluid(canolaOil); - - //Canola Block - if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){ - blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil"); - } - else{ - errorAlreadyRegistered("Canola Oil Block"); - } - blockCanolaOil = fluidCanolaOil.getBlock(); - - //Oil Fluid - String oil = "oil"; - if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){ - fluidOil = new FluidAA(oil, "blockOil").setRarity(EnumRarity.UNCOMMON); - FluidRegistry.registerFluid(fluidOil); - } - else{ - errorAlreadyRegistered("Oil Fluid"); - } - fluidOil = FluidRegistry.getFluid(oil); - - //Oil Block - if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){ - blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil"); - } - else{ - errorAlreadyRegistered("Oil Block"); - } - blockOil = fluidOil.getBlock(); - } - - public static void errorAlreadyRegistered(String str){ - ModUtil.LOGGER.warn(str+" from "+ModUtil.NAME+" is not getting used as it has already been registered by another Mod! If this causes Issues (which it shouldn't!), you can turn this off in the Config File!"); } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index b420cb2d6..9cefdf4b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -47,10 +47,6 @@ public class BlockBase extends Block{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -63,13 +59,12 @@ public class BlockBase extends Block{ return true; } - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.COMMON; + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); } - @Override - protected BlockState createBlockState(){ - return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.COMMON; } @Override @@ -82,6 +77,11 @@ public class BlockBase extends Block{ return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); } + @Override + protected BlockState createBlockState(){ + return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + } + protected PropertyInteger getMetaProperty(){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index ded9017f7..e06ec6201 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -46,10 +46,6 @@ public class BlockBushBase extends BlockBush{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -62,13 +58,12 @@ public class BlockBushBase extends BlockBush{ return true; } - public EnumRarity getRarity(ItemStack stack){ - return EnumRarity.COMMON; + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); } - @Override - protected BlockState createBlockState(){ - return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.COMMON; } @Override @@ -81,6 +76,11 @@ public class BlockBushBase extends BlockBush{ return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); } + @Override + protected BlockState createBlockState(){ + return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + } + protected PropertyInteger getMetaProperty(){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 2090ac41c..abc4adbdf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -65,10 +65,6 @@ public abstract class BlockContainerBase extends BlockContainer{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -81,6 +77,10 @@ public abstract class BlockContainerBase extends BlockContainer{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + public EnumRarity getRarity(ItemStack stack){ return EnumRarity.COMMON; } @@ -117,6 +117,45 @@ public abstract class BlockContainerBase extends BlockContainer{ } } + public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){ + ItemStack stack = player.getCurrentEquippedItem(); + if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){ + TileEntity tile = world.getTileEntity(pos); + if(tile instanceof IRedstoneToggle){ + if(!world.isRemote){ + ((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode()); + tile.markDirty(); + + if(tile instanceof TileEntityBase){ + ((TileEntityBase)tile).sendUpdate(); + } + } + return true; + } + } + return false; + } + + @Override + public IBlockState getStateFromMeta(int meta){ + return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta); + } + + @Override + public int getMetaFromState(IBlockState state){ + return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); + } + + @Override + public void updateTick(World world, BlockPos pos, IBlockState state, Random random){ + if(!world.isRemote){ + TileEntity tile = world.getTileEntity(pos); + if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){ + ((IRedstoneToggle)tile).activateOnPulse(); + } + } + } + @Override public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){ this.updateRedstoneState(world, pos); @@ -142,13 +181,8 @@ public abstract class BlockContainerBase extends BlockContainer{ } @Override - public void updateTick(World world, BlockPos pos, IBlockState state, Random random){ - if(!world.isRemote){ - TileEntity tile = world.getTileEntity(pos); - if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){ - ((IRedstoneToggle)tile).activateOnPulse(); - } - } + public void onBlockAdded(World world, BlockPos pos, IBlockState state){ + this.updateRedstoneState(world, pos); } @Override @@ -203,6 +237,11 @@ public abstract class BlockContainerBase extends BlockContainer{ return 0; } + @Override + protected BlockState createBlockState(){ + return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + } + @Override public ArrayList getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){ ArrayList drops = new ArrayList(); @@ -246,45 +285,6 @@ public abstract class BlockContainerBase extends BlockContainer{ return drops; } - @Override - public void onBlockAdded(World world, BlockPos pos, IBlockState state){ - this.updateRedstoneState(world, pos); - } - - public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){ - ItemStack stack = player.getCurrentEquippedItem(); - if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){ - TileEntity tile = world.getTileEntity(pos); - if(tile instanceof IRedstoneToggle){ - if(!world.isRemote){ - ((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode()); - tile.markDirty(); - - if(tile instanceof TileEntityBase){ - ((TileEntityBase)tile).sendUpdate(); - } - } - return true; - } - } - return false; - } - - @Override - protected BlockState createBlockState(){ - return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); - } - - @Override - public IBlockState getStateFromMeta(int meta){ - return this.getMetaProperty() == null ? super.getStateFromMeta(meta) : this.getDefaultState().withProperty(this.getMetaProperty(), meta); - } - - @Override - public int getMetaFromState(IBlockState state){ - return this.getMetaProperty() == null ? super.getMetaFromState(state) : state.getValue(this.getMetaProperty()); - } - protected PropertyInteger getMetaProperty(){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index 5ef231662..665a8baa6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -47,27 +47,6 @@ public class BlockPlant extends BlockCrops{ this.register(); } - @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){ - if(getMetaFromState(state) >= 7){ - if(!world.isRemote){ - - List drops = getDrops(world, pos, state, 0); - for(ItemStack stack : drops){ - if(stack != null && stack.getItem() == this.getSeed()){ - stack.stackSize--; - } - EntityItem entity = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, stack); - world.spawnEntityInWorld(entity); - } - - world.setBlockState(pos, getStateFromMeta(0)); - } - return true; - } - return false; - } - private void register(){ this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName()); @@ -81,10 +60,6 @@ public class BlockPlant extends BlockCrops{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -97,6 +72,10 @@ public class BlockPlant extends BlockCrops{ return false; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + public EnumRarity getRarity(ItemStack stack){ return EnumRarity.RARE; } @@ -106,33 +85,64 @@ public class BlockPlant extends BlockCrops{ return EnumPlantType.Crop; } - @Override - public Item getSeed(){ - return this.seedItem; - } - - @Override - public Item getCrop(){ - return this.returnItem; - } - - @Override - public Item getItemDropped(IBlockState state, Random rand, int par3){ - return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed(); - } - @Override public int damageDropped(IBlockState state){ return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0; } + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){ + if(getMetaFromState(state) >= 7){ + if(!world.isRemote){ + + List drops = getDrops(world, pos, state, 0); + boolean deductedSeedSize = false; + for(ItemStack stack : drops){ + if(stack != null){ + if(stack.getItem() == this.seedItem && !deductedSeedSize){ + stack.stackSize--; + deductedSeedSize = true; + } + + if(stack.stackSize > 0){ + EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); + world.spawnEntityInWorld(entity); + } + } + } + + world.setBlockState(pos, getStateFromMeta(0)); + } + return true; + } + return false; + } + @Override public int getDamageValue(World world, BlockPos pos){ return 0; } + @Override + public Item getSeed(){ + return this.seedItem; + } + @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random); } + + @Override + public Item getCrop(){ + return this.returnItem; + } + + + @Override + public Item getItemDropped(IBlockState state, Random rand, int par3){ + return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed(); + } + + } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java index 0717d9014..6b1d3f824 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockStair.java @@ -50,10 +50,6 @@ public class BlockStair extends BlockStairs{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -66,6 +62,10 @@ public class BlockStair extends BlockStairs{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + public EnumRarity getRarity(ItemStack stack){ return EnumRarity.COMMON; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java index 64270b3b3..3b9ef2ed9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockWallAA.java @@ -49,16 +49,9 @@ public class BlockWallAA extends BlockBase{ this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false)); } - @SuppressWarnings("unchecked") @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list){ - list.add(new ItemStack(item, 1, 0)); - } - - @Override - public int damageDropped(IBlockState state){ - return meta; + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){ + return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west())); } @Override @@ -71,11 +64,29 @@ public class BlockWallAA extends BlockBase{ return false; } + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ + return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side); + } + + @Override + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){ + this.setBlockBoundsBasedOnState(worldIn, pos); + this.maxY = 1.5D; + return super.getCollisionBoundingBox(worldIn, pos, state); + } + @Override public boolean isOpaqueCube(){ return false; } + @Override + public int damageDropped(IBlockState state){ + return meta; + } + @Override public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){ boolean flag = this.canConnectTo(worldIn, pos.north()); @@ -115,11 +126,11 @@ public class BlockWallAA extends BlockBase{ this.setBlockBounds(f, 0.0F, f2, f1, f4, f3); } + @SuppressWarnings("unchecked") @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){ - this.setBlockBoundsBasedOnState(worldIn, pos); - this.maxY = 1.5D; - return super.getCollisionBoundingBox(worldIn, pos, state); + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list){ + list.add(new ItemStack(item, 1, 0)); } public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){ @@ -127,22 +138,6 @@ public class BlockWallAA extends BlockBase{ return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd)); } - @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ - return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side); - } - - @Override - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){ - return state.withProperty(BlockWall.UP, !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, this.canConnectTo(worldIn, pos.north())).withProperty(BlockWall.EAST, this.canConnectTo(worldIn, pos.east())).withProperty(BlockWall.SOUTH, this.canConnectTo(worldIn, pos.south())).withProperty(BlockWall.WEST, this.canConnectTo(worldIn, pos.west())); - } - - @Override - protected BlockState createBlockState(){ - return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH); - } - @Override public IBlockState getStateFromMeta(int meta){ return this.getDefaultState(); @@ -152,4 +147,9 @@ public class BlockWallAA extends BlockBase{ public int getMetaFromState(IBlockState state){ return 0; } + + @Override + protected BlockState createBlockState(){ + return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java index 75424b4d9..e1e4de69d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java @@ -91,11 +91,6 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ this.saveOnClose = saveOnClose; } - @Override - public void drawHoveringText(List list, int x, int y){ - super.drawHoveringText(list, x, y); - } - public FontRenderer getFontRenderer(){ return this.fontRendererObj; } @@ -197,6 +192,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ } } + @Override + public void drawHoveringText(List list, int x, int y){ + super.drawHoveringText(list, x, y); + } + @Override protected void mouseClicked(int par1, int par2, int par3) throws IOException{ this.searchField.mouseClicked(par1, par2, par3); 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 a70d268ee..e41d6ebed 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -50,7 +50,7 @@ public class InitBooklet{ ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc"); ActuallyAdditionsAPI.allAndSearch = new BookletEntryAllSearch("allAndSearch").setSpecial(); } - + public static void postInit(){ initChapters(); } @@ -65,7 +65,7 @@ public class InitBooklet{ new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.redstone), new PageTextOnly(1)); //Miscellaneous - new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeColorLens), new PageReconstructor(4, LensNoneRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensNoneRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensNoneRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensNoneRecipeHandler.recipeLeather).setNoText()).setImportant(); + new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLens).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeColorLens), new PageReconstructor(4, LensNoneRecipeHandler.recipeExplosionLens), new PageReconstructor(5, LensNoneRecipeHandler.recipeDamageLens), new PageReconstructor(6, LensNoneRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(7, LensNoneRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(8, LensNoneRecipeHandler.recipeNetherWart).setNoText()).setImportant(); new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTestifiBucksGreenWall), new PageTextOnly(1), new PageReconstructor(2, LensNoneRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensNoneRecipeHandler.recipeGreenWall).setNoText()); new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("", OreGen.QUARTZ_MIN).addTextReplacement("", OreGen.QUARTZ_MAX), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText()); new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setNoText().setPageStacksWildcard()).setSpecial().setIncomplete(); @@ -87,7 +87,7 @@ public class InitBooklet{ new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockDropper), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText()); new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomLiquiface), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomface.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant(); new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText()); - new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial(); + new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial().setIncomplete(); new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setSpecial().setIncomplete(); new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass)); new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText()); @@ -111,7 +111,7 @@ public class InitBooklet{ //RF Generating Blocks new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1).addTextReplacement("", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText()); new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1).addTextReplacement("", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText()); - new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addTextReplacement("", TileEntityCanolaPress.ENERGY_USE).addTextReplacement("", TileEntityCanolaPress.PRODUCE).addTextReplacement("", TileEntityOilGenerator.ENERGY_PRODUCED), new PageCrafting(2, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(3, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(4, BlockCrafting.recipeOilGen).setNoText()); + new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())).addTextReplacement("", TileEntityCanolaPress.ENERGY_USE).addTextReplacement("", TileEntityCanolaPress.PRODUCE).addTextReplacement("", TileEntityOilGenerator.ENERGY_PRODUCED), new PageCrafting(2, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(3, BlockCrafting.recipeFermentingBarrel).setNoText(), new PageCrafting(4, BlockCrafting.recipeOilGen).setNoText().setPageStacksWildcard()); 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(); //No RF Using Items diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java index 62c0e29a9..3eb2144af 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java @@ -50,11 +50,6 @@ public class BookletChapter implements IBookletChapter{ return this.pages; } - public BookletChapter setIncomplete(){ - this.isIncomplete = true; - return this; - } - @Override public String getUnlocalizedName(){ return this.unlocalizedName; @@ -80,6 +75,11 @@ public class BookletChapter implements IBookletChapter{ return this.displayStack; } + public BookletChapter setIncomplete(){ + this.isIncomplete = true; + return this; + } + public BookletChapter setImportant(){ this.color = EnumChatFormatting.DARK_GREEN; return this; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index e28709ee5..74011bbc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -33,29 +33,19 @@ public class BookletEntry implements IBookletEntry{ this.color = EnumChatFormatting.RESET; } - @Override - public String getUnlocalizedName(){ - return this.unlocalizedName; - } - @Override public List getChapters(){ return this.chapters; } - @Override - public String getLocalizedNameWithFormatting(){ - return this.color+this.getLocalizedName(); - } - @Override public void setChapters(List chapters){ this.chapters = chapters; } @Override - public void addChapter(IBookletChapter chapter){ - this.chapters.add(chapter); + public String getUnlocalizedName(){ + return this.unlocalizedName; } @Override @@ -63,6 +53,16 @@ public class BookletEntry implements IBookletEntry{ return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".indexEntry."+this.unlocalizedName+".name"); } + @Override + public String getLocalizedNameWithFormatting(){ + return this.color+this.getLocalizedName(); + } + + @Override + public void addChapter(IBookletChapter chapter){ + this.chapters.add(chapter); + } + public BookletEntry setImportant(){ this.color = EnumChatFormatting.DARK_GREEN; return this; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java index 89611c055..52599f884 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntryAllSearch.java @@ -23,16 +23,16 @@ public class BookletEntryAllSearch extends BookletEntry{ super(unlocalizedName); } + @Override + public void setChapters(List chapters){ + this.allChapters = (ArrayList)chapters; + this.chapters = (ArrayList)this.allChapters.clone(); + } + @SuppressWarnings("unchecked") @Override public void addChapter(IBookletChapter chapter){ this.allChapters.add(chapter); this.chapters = (ArrayList)this.allChapters.clone(); } - - @Override - public void setChapters(List chapters){ - this.allChapters = (ArrayList)chapters; - this.chapters = (ArrayList)this.allChapters.clone(); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java index 1e3a6af9a..4eef6f123 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java @@ -32,26 +32,11 @@ public class BookletPageAA extends BookletPage{ this.localizationKey = localizationKey; } - @Override - public ItemStack[] getItemStacksForPage(){ - return null; - } - - @Override - public String getClickToSeeRecipeString(){ - return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"); - } - @Override public int getID(){ return Util.arrayContains(this.chapter.getPages(), this)+1; } - public BookletPage setNoText(){ - this.hasNoText = true; - return this; - } - @Override public final String getText(){ if(this.hasNoText){ @@ -74,12 +59,12 @@ public class BookletPageAA extends BookletPage{ } @Override - public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ + public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ } @Override - public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ + public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ } @@ -88,6 +73,21 @@ public class BookletPageAA extends BookletPage{ } + @Override + public ItemStack[] getItemStacksForPage(){ + return null; + } + + @Override + public String getClickToSeeRecipeString(){ + return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"); + } + + public BookletPage setNoText(){ + this.hasNoText = true; + return this; + } + public BookletPageAA addTextReplacement(String text, int replacement){ return this.addTextReplacement(text, Integer.toString(replacement)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index a731d02a6..3f512c03f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -48,30 +48,6 @@ public class PageCrafting extends BookletPageAA{ this.addToPagesWithItemStackData(); } - @Override - public ItemStack[] getItemStacksForPage(){ - if(this.recipes != null){ - ItemStack[] stacks = new ItemStack[this.recipes.length]; - for(int i = 0; i < this.recipes.length; i++){ - if(this.recipes[i] != null){ - ItemStack output = this.recipes[i].getRecipeOutput(); - if(output != null){ - if(!this.arePageStacksWildcard){ - stacks[i] = output; - } - else{ - ItemStack wildcardOutput = output.copy(); - wildcardOutput.setItemDamage(Util.WILDCARD); - stacks[i] = wildcardOutput; - } - } - } - } - return stacks; - } - return null; - } - @Override @SideOnly(Side.CLIENT) public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ @@ -187,4 +163,28 @@ public class PageCrafting extends BookletPageAA{ } } } + + @Override + public ItemStack[] getItemStacksForPage(){ + if(this.recipes != null){ + ItemStack[] stacks = new ItemStack[this.recipes.length]; + for(int i = 0; i < this.recipes.length; i++){ + if(this.recipes[i] != null){ + ItemStack output = this.recipes[i].getRecipeOutput(); + if(output != null){ + if(!this.arePageStacksWildcard){ + stacks[i] = output; + } + else{ + ItemStack wildcardOutput = output.copy(); + wildcardOutput.setItemDamage(Util.WILDCARD); + stacks[i] = wildcardOutput; + } + } + } + } + return stacks; + } + return null; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index efb564d88..288d874f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -39,11 +39,6 @@ public class PageCrusherRecipe extends BookletPageAA{ this.addToPagesWithItemStackData(); } - @Override - public ItemStack[] getItemStacksForPage(){ - return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]); - } - @Override @SideOnly(Side.CLIENT) public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ @@ -129,4 +124,9 @@ public class PageCrusherRecipe extends BookletPageAA{ } } } + + @Override + public ItemStack[] getItemStacksForPage(){ + return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index e86abfee7..f8cde97b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -42,11 +42,6 @@ public class PageFurnace extends BookletPageAA{ this.addToPagesWithItemStackData(); } - @Override - public ItemStack[] getItemStacksForPage(){ - return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result}; - } - @Override @SideOnly(Side.CLIENT) public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ @@ -98,6 +93,11 @@ public class PageFurnace extends BookletPageAA{ } } + @Override + public ItemStack[] getItemStacksForPage(){ + return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result}; + } + private ItemStack getInputForOutput(ItemStack output){ for(Map.Entry o : FurnaceRecipes.instance().getSmeltingList().entrySet()){ ItemStack stack = (ItemStack)(o).getValue(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index e61f7b7b8..d74c04856 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -43,20 +43,6 @@ public class PageReconstructor extends BookletPageAA{ this.addToPagesWithItemStackData(); } - @Override - public ItemStack[] getItemStacksForPage(){ - if(this.recipes != null){ - ArrayList stacks = new ArrayList(); - for(LensNoneRecipe recipe : this.recipes){ - if(recipe != null){ - stacks.addAll(recipe.getOutputs()); - } - } - return stacks.toArray(new ItemStack[stacks.size()]); - } - return null; - } - @Override @SideOnly(Side.CLIENT) public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ @@ -125,4 +111,18 @@ public class PageReconstructor extends BookletPageAA{ } } } + + @Override + public ItemStack[] getItemStacksForPage(){ + if(this.recipes != null){ + ArrayList stacks = new ArrayList(); + for(LensNoneRecipe recipe : this.recipes){ + if(recipe != null){ + stacks.addAll(recipe.getOutputs()); + } + } + return stacks.toArray(new ItemStack[stacks.size()]); + } + return null; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java index 18155443e..8ebdfa28c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageTextOnly.java @@ -31,11 +31,6 @@ public class PageTextOnly extends BookletPageAA{ return this; } - @Override - public ItemStack[] getItemStacksForPage(){ - return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack}; - } - @Override @SideOnly(Side.CLIENT) public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ @@ -44,4 +39,9 @@ public class PageTextOnly extends BookletPageAA{ StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false); } } + + @Override + public ItemStack[] getItemStacksForPage(){ + return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack}; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java index 5633d3056..54c76569e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigCategories.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.config; public enum ConfigCategories{ + PERFORMANCE("PERFORMANCE", "Performance Settings"), FOOD_CRAFTING("Food Crafting", "Crafting Recipes for Food Items"), BLOCKS_CRAFTING("Block Crafting", "Crafting Recipes for Blocks"), ITEMS_CRAFTING("Item Crafting", "Crafting Recipes for Items"), diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java index 027c25924..36608a319 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigValues.java @@ -33,6 +33,10 @@ public class ConfigValues{ public static String[] minerExtraWhitelist; public static String[] minerBlacklist; + public static boolean lessSound; + public static boolean lessParticles; + public static boolean lessBlockBreakingEffects; + public static void defineConfigValues(Configuration config){ for(ConfigCrafting currConf : craftingConfig){ @@ -53,5 +57,9 @@ public class ConfigValues{ plantDimensionBlacklist = config.get(ConfigCategories.WORLD_GEN.name, "Plant Blacklist", new int[0], "The IDs of the dimensions that Actually Additions Plants (Rice for example) are banned in").getIntList(); minerExtraWhitelist = config.get(ConfigCategories.MACHINE_VALUES.name, "Vertical Digger Extra Whitelist", new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option only applies if the miner is in Ores Only Mode.").getStringList(); minerBlacklist = config.get(ConfigCategories.MACHINE_VALUES.name, "Vertical Digger Blacklist", new String[0], "By default, the Vertical Digger mines everything that starts with 'ore' in the OreDictionary. If there is one that it can mine, but shouldn't be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command. This Config Option will apply in both modes.").getStringList(); + + lessSound = config.get(ConfigCategories.PERFORMANCE.name, "Less Sound", false, "If blocks in Actually Additions should have less sounds").getBoolean(); + lessParticles = config.get(ConfigCategories.PERFORMANCE.name, "Less Particles", false, "If blocks in Actually Additions should have less particles").getBoolean(); + lessBlockBreakingEffects = config.get(ConfigCategories.PERFORMANCE.name, "Less Block Breaking Effects", false, "If there should not be a sound effect and particles when a block is being destroyed by a breaker or similar").getBoolean(); } } 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 be7b70a34..2c1f343e2 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 @@ -15,8 +15,6 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler; public enum ConfigBoolValues{ - LEAF_BLOWER_SOUND("Leaf Blower: Sound", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower makes Sounds"), - JAM_VILLAGER_EXISTS("Jam Villager: Existence", ConfigCategories.WORLD_GEN, true, "If the Jam Villager and his House exist"), CROP_FIELD_EXISTS("Crop Field: Existence", ConfigCategories.WORLD_GEN, true, "If the Custom Crop Fields exist"), @@ -53,7 +51,6 @@ public enum ConfigBoolValues{ GIVE_BOOKLET_ON_FIRST_CRAFT("Give Booklet on First Craft", ConfigCategories.OTHER, true, "If the booklet should be given to the player when he first crafts something from the Mod"), ENABLE_SEASONAL("Seasonal Mode", ConfigCategories.OTHER, true, "If Seasonal Mode is enabled"), - LESS_LASER_RELAY_PARTICLES("Laser Relay: Particles", ConfigCategories.MACHINE_VALUES, false, "If the Laser Relay should have less laser particles to prevent lag"), DUNGEON_LOOT("Dungeon Loot", ConfigCategories.OTHER, true, "Should Actually Additions Loot spawn in Dungeons"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index 43ec404e7..1f5fcde97 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -260,7 +260,7 @@ public class BlockCrafting{ if(ConfigCrafting.ENDER_CASING.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()), "WSW", "SRS", "WSW", - 'W', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()), + 'W', new ItemStack(Items.ender_pearl), 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), 'S', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()))); recipeEnderCase = Util.GetRecipes.lastIRecipe(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index 1c0dc34f6..fb9c016fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -191,7 +191,7 @@ public class CreativeTab extends CreativeTabs{ add(InitItems.itemPaxelCrystalGreen); add(InitItems.itemPaxelCrystalWhite); InitForeignPaxels.addToCreativeTab(); - + add(InitBlocks.blockCrystal); add(InitItems.itemCrystal); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java index 5d6bb78ae..f86ab2dfe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.event; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.Block; @@ -25,8 +25,8 @@ public class BucketFillEvent{ @SubscribeEvent public void onBucketFilled(FillBucketEvent event){ - this.fillBucket(event, InitItems.itemBucketOil, InitBlocks.blockOil); - this.fillBucket(event, InitItems.itemBucketCanolaOil, InitBlocks.blockCanolaOil); + this.fillBucket(event, InitItems.itemBucketOil, InitFluids.blockOil); + this.fillBucket(event, InitItems.itemBucketCanolaOil, InitFluids.blockCanolaOil); } private void fillBucket(FillBucketEvent event, Item item, Block fluid){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java index 1ca2eefd8..d8f009d22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/PlayerObtainEvents.java @@ -28,6 +28,19 @@ import java.util.Locale; public class PlayerObtainEvents{ + public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){ + for(int i = 0; i < TheAchievements.values().length; i++){ + TheAchievements ach = TheAchievements.values()[i]; + if(ach.type == type){ + if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){ + if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){ + player.addStat(ach.ach, 1); + } + } + } + } + } + @SubscribeEvent public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ checkAchievements(event.crafting, event.player, InitAchievements.Type.CRAFTING); @@ -51,19 +64,6 @@ public class PlayerObtainEvents{ } } - public static void checkAchievements(ItemStack gotten, EntityPlayer player, InitAchievements.Type type){ - for(int i = 0; i < TheAchievements.values().length; i++){ - TheAchievements ach = TheAchievements.values()[i]; - if(ach.type == type){ - if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){ - if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){ - player.addStat(ach.ach, 1); - } - } - } - } - } - @SubscribeEvent public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){ checkAchievements(event.smelting, event.player, InitAchievements.Type.SMELTING); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java index 163a584fa..2821db6b4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java @@ -16,11 +16,14 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.oredict.OreDictionary; +import java.util.List; + public class TooltipEvent{ private static final String ADVANCED_INFO_TEXT_PRE = EnumChatFormatting.DARK_GRAY+" "; @@ -58,6 +61,11 @@ public class TooltipEvent{ event.toolTip.add(ADVANCED_INFO_TEXT_PRE+baseName); } + //Metadata + int meta = event.itemStack.getItemDamage(); + event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".meta.desc")+":"); + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+meta); + //Unlocalized Name String metaName = event.itemStack.getItem().getUnlocalizedName(event.itemStack); if(metaName != null && baseName != null && !metaName.equals(baseName)){ @@ -65,8 +73,24 @@ public class TooltipEvent{ event.toolTip.add(ADVANCED_INFO_TEXT_PRE+metaName); } + //NBT + NBTTagCompound compound = event.itemStack.getTagCompound(); + if(compound != null && !compound.hasNoTags()){ + event.toolTip.add(ADVANCED_INFO_HEADER_PRE+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".nbt.desc")+":"); + if(KeyUtil.isShiftPressed()){ + List strgList = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(compound.toString(), 200); + for(String strg : strgList){ + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+strg); + } + } + else{ + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+EnumChatFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]"); + } + } + //Disabling Info event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200)); + } else{ if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/FluidAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java similarity index 94% rename from src/main/java/de/ellpeck/actuallyadditions/mod/blocks/FluidAA.java rename to src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java index e38856c67..c71e0a1a6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/FluidAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/FluidAA.java @@ -8,7 +8,7 @@ * © 2016 Ellpeck */ -package de.ellpeck.actuallyadditions.mod.blocks; +package de.ellpeck.actuallyadditions.mod.fluids; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java new file mode 100644 index 000000000..0bab1171f --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/fluids/InitFluids.java @@ -0,0 +1,75 @@ +/* + * This file ("InitFluids.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.fluids; + +import de.ellpeck.actuallyadditions.mod.blocks.base.BlockFluidFlowing; +import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; +import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.EnumRarity; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +public class InitFluids{ + + public static Fluid fluidCanolaOil; + public static Fluid fluidOil; + + public static Block blockCanolaOil; + public static Block blockOil; + + public static void init(){ + //Canola Fluid + String canolaOil = "canolaoil"; + if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){ + fluidCanolaOil = new FluidAA(canolaOil, "blockCanolaOil").setRarity(EnumRarity.UNCOMMON); + FluidRegistry.registerFluid(fluidCanolaOil); + } + else{ + errorAlreadyRegistered("Canola Oil Fluid"); + } + fluidCanolaOil = FluidRegistry.getFluid(canolaOil); + + //Canola Block + if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){ + blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil"); + } + else{ + errorAlreadyRegistered("Canola Oil Block"); + } + blockCanolaOil = fluidCanolaOil.getBlock(); + + //Oil Fluid + String oil = "oil"; + if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){ + fluidOil = new FluidAA(oil, "blockOil").setRarity(EnumRarity.UNCOMMON); + FluidRegistry.registerFluid(fluidOil); + } + else{ + errorAlreadyRegistered("Oil Fluid"); + } + fluidOil = FluidRegistry.getFluid(oil); + + //Oil Block + if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){ + blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil"); + } + else{ + errorAlreadyRegistered("Oil Block"); + } + blockOil = fluidOil.getBlock(); + } + + public static void errorAlreadyRegistered(String str){ + ModUtil.LOGGER.warn(str+" from "+ModUtil.NAME+" is not getting used as it has already been registered by another Mod! If this causes Issues (which it shouldn't!), you can turn this off in the Config File!"); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java index 741f35f77..dc636f81f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerCanolaPress.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; @@ -68,7 +68,7 @@ public class ContainerCanolaPress extends Container{ return null; } } - else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidCanolaOil, 1), newStack) > 0){ + else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitFluids.fluidCanolaOil, 1), newStack) > 0){ if(!this.mergeItemStack(newStack, 1, 2, false)){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java index 02cd7b5c0..6a23ad5df 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; @@ -62,12 +62,12 @@ public class ContainerFermentingBarrel extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ //Shift from Inventory - if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidCanolaOil, 1))){ + if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitFluids.fluidCanolaOil, 1))){ if(!this.mergeItemStack(newStack, 0, 1, false)){ return null; } } - else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidOil, 1), newStack) > 0){ + else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitFluids.fluidOil, 1), newStack) > 0){ if(!this.mergeItemStack(newStack, 2, 3, false)){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java index 657eafe44..a41d04864 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerOilGenerator.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.inventory; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; @@ -60,7 +60,7 @@ public class ContainerOilGenerator extends Container{ //Other Slots in Inventory excluded if(slot >= inventoryStart){ //Shift from Inventory - if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidOil, 1))){ + if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitFluids.fluidOil, 1))){ if(!this.mergeItemStack(newStack, 0, 1, false)){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java index e6436a084..db7c2e000 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiGrinder.java @@ -84,6 +84,7 @@ public class GuiGrinder extends GuiContainer{ } public static class GuiGrinderDouble extends GuiGrinder{ + public GuiGrinderDouble(InventoryPlayer inventory, TileEntityBase tile){ super(inventory, tile, true); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java index 3cd12087b..6ccded60d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.base.*; import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens; import de.ellpeck.actuallyadditions.mod.items.lens.Lenses; @@ -170,7 +171,7 @@ public class InitItems{ public static Item itemPantsCrystalLightBlue; public static Item itemBootsCrystalLightBlue; public static Item itemPaxelCrystalLightBlue; - + public static Item itemPickaxeCrystalBlack; public static Item itemAxeCrystalBlack; public static Item itemShovelCrystalBlack; @@ -203,7 +204,7 @@ public class InitItems{ public static Item itemPantsCrystalWhite; public static Item itemBootsCrystalWhite; public static Item itemPaxelCrystalWhite; - + public static void init(){ ModUtil.LOGGER.info("Initializing Items..."); @@ -248,10 +249,10 @@ public class InitItems{ itemDrillUpgradeThreeByThree = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE, "itemDrillUpgradeThreeByThree"); itemDrillUpgradeFiveByFive = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE, "itemDrillUpgradeFiveByFive"); itemDrillUpgradeBlockPlacing = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER, "itemDrillUpgradeBlockPlacing"); - itemBucketOil = new ItemBucketAA(InitBlocks.blockOil, "itemBucketOil"); - FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET); - itemBucketCanolaOil = new ItemBucketAA(InitBlocks.blockCanolaOil, "itemBucketCanolaOil"); - FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidCanolaOil, new ItemStack(itemBucketCanolaOil), FluidContainerRegistry.EMPTY_BUCKET); + itemBucketOil = new ItemBucketAA(InitFluids.blockOil, "itemBucketOil"); + FluidContainerRegistry.registerFluidContainer(InitFluids.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET); + itemBucketCanolaOil = new ItemBucketAA(InitFluids.blockCanolaOil, "itemBucketCanolaOil"); + FluidContainerRegistry.registerFluidContainer(InitFluids.fluidCanolaOil, new ItemStack(itemBucketCanolaOil), FluidContainerRegistry.EMPTY_BUCKET); itemFertilizer = new ItemFertilizer("itemFertilizer"); itemCoffee = new ItemCoffee("itemCoffee"); itemPhantomConnector = new ItemPhantomConnector("itemPhantomConnector"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index 3d57e3ae7..f805811d6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -52,16 +52,6 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ this.setMaxDamage(0); } - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); - - if(!world.isRemote){ - player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach); - } - return stack; - } - @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){ if(player.isSneaking()){ @@ -81,6 +71,16 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ return false; } + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); + + if(!world.isRemote){ + player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach); + } + return stack; + } + @SuppressWarnings("unchecked") @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java index 98e6e598f..41ee8bbe8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.util.PosUtil; @@ -51,7 +52,9 @@ public class ItemChestToCrateUpgrade extends ItemBase{ } //Set New Block - world.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(PosUtil.getMetadata(pos, world) << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + world.playAuxSFX(2001, pos, Block.getStateId(world.getBlockState(pos))); + } PosUtil.setBlock(pos, world, InitBlocks.blockGiantChest, 0, 2); //Copy Items into new Chest diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java index 58400ae70..492f9f6d1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java @@ -72,6 +72,15 @@ public class ItemCoffee extends ItemFoodBase{ return null; } + public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){ + PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack); + if(effects != null && effects.length > 0){ + for(PotionEffect effect : effects){ + player.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()*20, effect.getAmplifier())); + } + } + } + @Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ ItemStack theStack = stack.copy(); @@ -86,15 +95,6 @@ public class ItemCoffee extends ItemFoodBase{ } } - public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){ - PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack); - if(effects != null && effects.length > 0){ - for(PotionEffect effect : effects){ - player.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()*20, effect.getAmplifier())); - } - } - } - @Override public EnumAction getItemUseAction(ItemStack stack){ return EnumAction.DRINK; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java index 0dd4a3aa8..3640fd7e9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrystal.java @@ -48,6 +48,14 @@ public class ItemCrystal extends ItemBase{ return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.COMMON : BlockCrystal.allCrystals[stack.getItemDamage()].rarity; } + @SuppressWarnings("all") + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List list){ + for(int j = 0; j < BlockCrystal.allCrystals.length; j++){ + list.add(new ItemStack(this, 1, j)); + } + } + @Override protected void registerRendering(){ ResourceLocation[] resLocs = new ResourceLocation[BlockCrystal.allCrystals.length]; @@ -58,12 +66,4 @@ public class ItemCrystal extends ItemBase{ } ActuallyAdditions.proxy.addRenderVariant(this, resLocs); } - - @SuppressWarnings("all") - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List list){ - for(int j = 0; j < BlockCrystal.allCrystals.length; j++){ - list.add(new ItemStack(this, 1, j)); - } - } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 556d45123..6421dda39 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -107,17 +107,6 @@ public class ItemDrill extends ItemEnergy{ return false; } - @Override - protected void registerRendering(){ - ResourceLocation[] resLocs = new ResourceLocation[16]; - for(int i = 0; i < 16; i++){ - String name = this.getBaseName()+TheColoredLampColors.values()[i].name; - resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name); - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name)); - } - ActuallyAdditions.proxy.addRenderVariant(this, resLocs); - } - /** * Checks if a certain Upgrade is installed and returns it as an ItemStack * @@ -342,6 +331,17 @@ public class ItemDrill extends ItemEnergy{ return this.getHasUpgradeAsStack(stack, upgrade) != null; } + @Override + protected void registerRendering(){ + ResourceLocation[] resLocs = new ResourceLocation[16]; + for(int i = 0; i < 16; i++){ + String name = this.getBaseName()+TheColoredLampColors.values()[i].name; + resLocs[i] = new ResourceLocation(ModUtil.MOD_ID_LOWER, name); + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, name)); + } + ActuallyAdditions.proxy.addRenderVariant(this, resLocs); + } + @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java index 7cd298423..ecaad022b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java @@ -24,6 +24,7 @@ public class ItemKnife extends ItemBase{ this.setMaxDamage(100); this.setMaxStackSize(1); this.setContainerItem(this); + this.setNoRepair(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index bf1c922c6..82ac810a9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.items; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.Block; @@ -66,7 +66,7 @@ public class ItemLeafBlower extends ItemBase{ //Breaks the Blocks this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); //Plays a Minecart sounds (It really sounds like a Leaf Blower!) - if(ConfigBoolValues.LEAF_BLOWER_SOUND.isEnabled()){ + if(!ConfigValues.lessSound){ player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); } } @@ -106,14 +106,16 @@ public class ItemLeafBlower extends ItemBase{ Block theBlock = PosUtil.getBlock(theCoord, world); ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(theCoord, world); //Gets all of the Drops the Block should have drops.addAll(theBlock.getDrops(world, theCoord, world.getBlockState(theCoord), 0)); + //Plays the Breaking Sound + if(!ConfigValues.lessBlockBreakingEffects){ + world.playAuxSFX(2001, theCoord, Block.getStateId(world.getBlockState(theCoord))); + } + //Deletes the Block world.setBlockToAir(theCoord); - //Plays the Breaking Sound - world.playAuxSFX(2001, theCoord, Block.getIdFromBlock(theBlock)+(meta << 12)); for(ItemStack theDrop : drops){ //Drops the Items into the World diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 3167d7bbd..6ae2a195e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -39,6 +39,45 @@ public class ItemPhantomConnector extends ItemBase{ this.setMaxStackSize(1); } + public static World getStoredWorld(ItemStack stack){ + NBTTagCompound tag = stack.getTagCompound(); + if(tag != null){ + return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored")); + } + return null; + } + + public static BlockPos getStoredPosition(ItemStack stack){ + NBTTagCompound tag = stack.getTagCompound(); + if(tag != null){ + int x = tag.getInteger("XCoordOfTileStored"); + int y = tag.getInteger("YCoordOfTileStored"); + int z = tag.getInteger("ZCoordOfTileStored"); + if(!(x == 0 && y == 0 && z == 0)){ + return new BlockPos(x, y, z); + } + } + return null; + } + + public static void clearStorage(ItemStack stack){ + stack.setTagCompound(new NBTTagCompound()); + } + + public static void storeConnection(ItemStack stack, int x, int y, int z, World world){ + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null){ + tag = new NBTTagCompound(); + } + + tag.setInteger("XCoordOfTileStored", x); + tag.setInteger("YCoordOfTileStored", y); + tag.setInteger("ZCoordOfTileStored", z); + tag.setInteger("WorldOfTileStored", world.provider.getDimensionId()); + + stack.setTagCompound(tag); + } + @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing par7, float par8, float par9, float par10){ if(!world.isRemote){ @@ -79,45 +118,6 @@ public class ItemPhantomConnector extends ItemBase{ } } - public static BlockPos getStoredPosition(ItemStack stack){ - NBTTagCompound tag = stack.getTagCompound(); - if(tag != null){ - int x = tag.getInteger("XCoordOfTileStored"); - int y = tag.getInteger("YCoordOfTileStored"); - int z = tag.getInteger("ZCoordOfTileStored"); - if(!(x == 0 && y == 0 && z == 0)){ - return new BlockPos(x, y, z); - } - } - return null; - } - - public static World getStoredWorld(ItemStack stack){ - NBTTagCompound tag = stack.getTagCompound(); - if(tag != null){ - return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored")); - } - return null; - } - - public static void clearStorage(ItemStack stack){ - stack.setTagCompound(new NBTTagCompound()); - } - - public static void storeConnection(ItemStack stack, int x, int y, int z, World world){ - NBTTagCompound tag = stack.getTagCompound(); - if(tag == null){ - tag = new NBTTagCompound(); - } - - tag.setInteger("XCoordOfTileStored", x); - tag.setInteger("YCoordOfTileStored", y); - tag.setInteger("ZCoordOfTileStored", z); - tag.setInteger("WorldOfTileStored", world.provider.getDimensionId()); - - stack.setTagCompound(tag); - } - @Override public boolean getShareTag(){ return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java index 58f30faa6..8c794b77b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java @@ -47,6 +47,11 @@ public class ItemAllToolAA extends ItemTool{ private ItemStack repairItem; private String repairOredict; + public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){ + this(toolMat, (ItemStack)null, unlocalizedName, rarity, color); + this.repairOredict = repairItem; + } + public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){ super(4.0F, toolMat, new HashSet()); @@ -60,11 +65,6 @@ public class ItemAllToolAA extends ItemTool{ this.register(); } - public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){ - this(toolMat, (ItemStack)null, unlocalizedName, rarity, color); - this.repairOredict = repairItem; - } - private void register(){ this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); GameRegistry.registerItem(this, this.getBaseName()); @@ -79,11 +79,6 @@ public class ItemAllToolAA extends ItemTool{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel")); - ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel")); - } - protected String getBaseName(){ return this.name; } @@ -92,6 +87,11 @@ public class ItemAllToolAA extends ItemTool{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel")); + ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel")); + } + @Override public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ if(!playerIn.canPlayerEdit(pos.offset(side), side, stack)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index d622568c9..02c77af81 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -26,6 +26,10 @@ public class ItemArmorAA extends ItemArmor{ private String name; private EnumRarity rarity; + public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){ + this(name, material, type, repairItem, textureBase, EnumRarity.RARE); + } + public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase, EnumRarity rarity){ super(material, 0, type); this.repairItem = repairItem; @@ -35,10 +39,6 @@ public class ItemArmorAA extends ItemArmor{ this.register(); } - public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){ - this(name, material, type, repairItem, textureBase, EnumRarity.RARE); - } - private void register(){ this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName()); GameRegistry.registerItem(this, this.getBaseName()); @@ -52,10 +52,6 @@ public class ItemArmorAA extends ItemArmor{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -64,6 +60,10 @@ public class ItemArmorAA extends ItemArmor{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public EnumRarity getRarity(ItemStack stack){ return this.rarity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java index 0d0aaac5f..88dcd4e7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAxeAA.java @@ -49,10 +49,6 @@ public class ItemAxeAA extends ItemAxe{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -61,6 +57,10 @@ public class ItemAxeAA extends ItemAxe{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ return ItemUtil.areItemsEqual(this.repairItem, stack, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java index c06a5fea5..f54470f57 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBase.java @@ -42,10 +42,6 @@ public class ItemBase extends Item{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -53,4 +49,8 @@ public class ItemBase extends Item{ public boolean shouldAddCreative(){ return true; } + + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java index db657d632..509c89a7c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemBucketAA.java @@ -46,10 +46,6 @@ public class ItemBucketAA extends ItemBucket{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -58,6 +54,10 @@ public class ItemBucketAA extends ItemBucket{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.UNCOMMON; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index 01b3b36d0..129ebc385 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -53,10 +53,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -65,6 +61,10 @@ public abstract class ItemEnergy extends ItemEnergyContainer{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public boolean getShareTag(){ return true; @@ -81,6 +81,12 @@ public abstract class ItemEnergy extends ItemEnergyContainer{ list.add(this.getEnergyStored(stack)+"/"+this.getMaxEnergyStored(stack)+" RF"); } + @Override + @SideOnly(Side.CLIENT) + public boolean hasEffect(ItemStack stack){ + return false; + } + @Override @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) @@ -106,12 +112,6 @@ public abstract class ItemEnergy extends ItemEnergyContainer{ return energyDif/maxAmount; } - @Override - @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack stack){ - return false; - } - public void setEnergy(ItemStack stack, int energy){ NBTTagCompound compound = stack.getTagCompound(); if(compound == null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java index 963c357ed..a185c9f5d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemFoodBase.java @@ -43,10 +43,6 @@ public class ItemFoodBase extends ItemFood{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -54,4 +50,8 @@ public class ItemFoodBase extends ItemFood{ public boolean shouldAddCreative(){ return true; } + + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java index 15c227873..03ed69239 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemHoeAA.java @@ -50,10 +50,6 @@ public class ItemHoeAA extends ItemHoe{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -62,6 +58,10 @@ public class ItemHoeAA extends ItemHoe{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public EnumRarity getRarity(ItemStack stack){ return this.rarity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java index ea8a11b27..a9d084248 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemPickaxeAA.java @@ -49,10 +49,6 @@ public class ItemPickaxeAA extends ItemPickaxe{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -61,6 +57,10 @@ public class ItemPickaxeAA extends ItemPickaxe{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ return ItemUtil.areItemsEqual(this.repairItem, stack, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java index 6ade78b73..0a02f544d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java @@ -57,10 +57,6 @@ public class ItemSeed extends ItemSeeds{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -69,6 +65,10 @@ public class ItemSeed extends ItemSeeds{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.RARE; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java index eab2eed72..8fb0a68ea 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemShovelAA.java @@ -50,10 +50,6 @@ public class ItemShovelAA extends ItemSpade{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -62,6 +58,10 @@ public class ItemShovelAA extends ItemSpade{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + @Override public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ return ItemUtil.areItemsEqual(this.repairItem, stack, false); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java index 6f19ca07c..90ec82529 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSwordAA.java @@ -50,10 +50,6 @@ public class ItemSwordAA extends ItemSword{ this.registerRendering(); } - protected void registerRendering(){ - ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); - } - protected String getBaseName(){ return this.name; } @@ -62,6 +58,10 @@ public class ItemSwordAA extends ItemSword{ return true; } + protected void registerRendering(){ + ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); + } + protected Class getItemBlock(){ return ItemBlockBase.class; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java index d5e6ece46..c3c277920 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java @@ -14,6 +14,7 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; @@ -45,7 +46,9 @@ public class LensNone extends Lens{ if(outputs != null && !outputs.isEmpty()){ ItemStack output = outputs.get(0); if(output.getItem() instanceof ItemBlock){ - tile.getWorldObject().playAuxSFX(2001, pos, Block.getIdFromBlock(PosUtil.getBlock(pos, tile.getWorldObject()))+(PosUtil.getMetadata(pos, tile.getWorldObject()) << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + tile.getWorldObject().playAuxSFX(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos))); + } PosUtil.setBlock(pos, tile.getWorldObject(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2); } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java index 4e292ae15..e3f8e4145 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNoneRecipeHandler.java @@ -35,6 +35,7 @@ public class LensNoneRecipeHandler{ public static LensNoneRecipe recipeExplosionLens; public static LensNoneRecipe recipeDamageLens; public static LensNoneRecipe recipeLeather; + public static LensNoneRecipe recipeNetherWart; public static void init(){ //Crystal Blocks @@ -86,6 +87,9 @@ public class LensNoneRecipeHandler{ recipeSoulSand = Util.GetRecipes.lastReconstructorRecipe(); ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Items.rotten_flesh), new ItemStack(Items.leather), 8000); recipeLeather = Util.GetRecipes.lastReconstructorRecipe(); + + ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.red_mushroom), new ItemStack(Items.nether_wart), 150000); + recipeNetherWart = Util.GetRecipes.lastReconstructorRecipe(); } ActuallyAdditionsAPI.addReconstructorLensNoneRecipe(new ItemStack(Blocks.quartz_block), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java index 1d4a143fb..f09d0c45d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java @@ -14,8 +14,8 @@ import de.ellpeck.actuallyadditions.api.lens.Lens; public class Lenses{ - public static final Lens LENS_NONE = new LensNone().register(); - public static final Lens LENS_DETONATION = new LensDetonation().register(); - public static final Lens LENS_DEATH = new LensDeath().register(); - public static final Lens LENS_COLOR = new LensColor().register(); + public static final Lens LENS_NONE = new LensNone(); + public static final Lens LENS_DETONATION = new LensDetonation(); + public static final Lens LENS_DEATH = new LensDeath(); + public static final Lens LENS_COLOR = new LensColor(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java index c5b3ac905..695977f42 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/JEIActuallyAdditionsPlugin.java @@ -11,11 +11,24 @@ package de.ellpeck.actuallyadditions.mod.jei; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble; +import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiGrinder; +import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeCategory; import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeHandler; import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeCategory; import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeHandler; +import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeCategory; +import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeHandler; +import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeCategory; +import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeHandler; +import de.ellpeck.actuallyadditions.mod.nei.NEICoffeeMachineRecipe; +import de.ellpeck.actuallyadditions.mod.util.Util; import mezz.jei.api.*; +import mezz.jei.api.recipe.VanillaRecipeCategoryUid; +import net.minecraft.item.ItemStack; @JEIPlugin public class JEIActuallyAdditionsPlugin implements IModPlugin{ @@ -36,20 +49,56 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{ public void register(IModRegistry registry){ registry.addRecipeCategories( new BookletRecipeCategory(this.helpers.getGuiHelper()), - new CoffeeMachineRecipeCategory(this.helpers.getGuiHelper()) + new CoffeeMachineRecipeCategory(this.helpers.getGuiHelper()), + new CrusherRecipeCategory(this.helpers.getGuiHelper()), + new ReconstructorRecipeCategory(this.helpers.getGuiHelper()) ); registry.addRecipeHandlers( new BookletRecipeHandler(), - new CoffeeMachineRecipeHandler() + new CoffeeMachineRecipeHandler(), + new CrusherRecipeHandler(), + new ReconstructorRecipeHandler() ); registry.addRecipes(ActuallyAdditionsAPI.bookletPagesWithItemStackData); registry.addRecipes(ActuallyAdditionsAPI.coffeeMachineIngredients); + registry.addRecipes(ActuallyAdditionsAPI.crusherRecipes); + registry.addRecipes(ActuallyAdditionsAPI.reconstructorLensNoneRecipes); + + registry.addRecipeClickArea(GuiCoffeeMachine.class, 53, 42, 22, 16, NEICoffeeMachineRecipe.NAME); + registry.addRecipeClickArea(GuiGrinder.class, 80, 40, 24, 22, CrusherRecipeCategory.NAME); + registry.addRecipeClickArea(GuiGrinder.GuiGrinderDouble.class, 51, 40, 74, 22, CrusherRecipeCategory.NAME); + registry.addRecipeClickArea(GuiFurnaceDouble.class, 51, 40, 74, 22, VanillaRecipeCategoryUid.SMELTING); + + INbtIgnoreList ignoreList = this.helpers.getNbtIgnoreList(); + ignoreList.ignoreNbtTagNames(InitItems.itemDrill, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemTeleStaff, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemGrowthRing, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemMagnetRing, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemWaterRemovalRing, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemBattery, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemBatteryDouble, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemBatteryTriple, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemBatteryQuadruple, "Energy"); + ignoreList.ignoreNbtTagNames(InitItems.itemBatteryQuintuple, "Energy"); + + IItemBlacklist blacklist = this.helpers.getItemBlacklist(); + blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockRice)); + blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockCanola)); + blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockFlax)); + blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockCoffee)); + blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD)); + blacklist.addItemToBlacklist(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD)); } @Override public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry){ } + + @Override + public void onRuntimeAvailable(IJeiRuntime jeiRuntime){ + + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java index df015a254..d55566354 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java @@ -36,6 +36,10 @@ public abstract class RecipeWrapperWithButton{ }; } + public abstract int getButtonX(); + + public abstract int getButtonY(); + public boolean handleClick(Minecraft mc, int mouseX, int mouseY){ if(this.theButton.mousePressed(mc, mouseX, mouseY)){ this.theButton.playPressSound(mc.getSoundHandler()); @@ -52,12 +56,9 @@ public abstract class RecipeWrapperWithButton{ return false; } + public abstract BookletPage getPage(); + public void updateButton(Minecraft mc, int mouseX, int mouseY){ this.theButton.drawButton(mc, mouseX, mouseY); } - - public abstract BookletPage getPage(); - - public abstract int getButtonX(); - public abstract int getButtonY(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java index 757edbea0..8c7f099c3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.mod.jei.booklet; -import com.google.common.collect.ImmutableList; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture; @@ -24,6 +23,7 @@ import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -47,12 +47,12 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe @Override public List getFluidInputs(){ - return ImmutableList.of(); + return new ArrayList(); } @Override public List getFluidOutputs(){ - return ImmutableList.of(); + return new ArrayList(); } @Override @@ -96,11 +96,6 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe return this.handleClick(minecraft, mouseX, mouseY); } - @Override - public BookletPage getPage(){ - return this.thePage; - } - @Override public int getButtonX(){ return 0; @@ -110,4 +105,9 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe public int getButtonY(){ return 84; } + + @Override + public BookletPage getPage(){ + return this.thePage; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java index 7b2215f3f..11086038f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.mod.jei.coffee; -import com.google.common.collect.ImmutableList; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing; import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient; @@ -62,29 +61,31 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen @Override public List getFluidInputs(){ - return ImmutableList.of(); + return new ArrayList(); } @Override public List getFluidOutputs(){ - return ImmutableList.of(); + return new ArrayList(); } @Override public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){ - if(this.theIngredient.getExtraText() != null){ - Minecraft.getMinecraft().fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - Minecraft.getMinecraft().fontRendererObj.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - } - if(this.theIngredient.maxAmplifier > 0){ - Minecraft.getMinecraft().fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); - } } @Override public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ this.updateButton(minecraft, mouseX, mouseY); + + if(this.theIngredient.getExtraText() != null){ + minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + minecraft.fontRendererObj.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + } + + if(this.theIngredient.maxAmplifier > 0){ + minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + } } @Override @@ -103,11 +104,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen return this.handleClick(minecraft, mouseX, mouseY); } - @Override - public BookletPage getPage(){ - return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine)); - } - @Override public int getButtonX(){ return 0; @@ -117,4 +113,9 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen public int getButtonY(){ return 70; } + + @Override + public BookletPage getPage(){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine)); + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeCategory.java new file mode 100644 index 000000000..d00501956 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeCategory.java @@ -0,0 +1,82 @@ +/* + * This file ("CrusherRecipeCategor.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei.crusher; + +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nonnull; +import java.util.List; + +public class CrusherRecipeCategory implements IRecipeCategory{ + + public static final String NAME = "actuallyadditions.crushing"; + + private IDrawable background; + + public CrusherRecipeCategory(IGuiHelper helper){ + this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiGrinder"), 60, 13, 56, 79); + } + + @Nonnull + @Override + public String getUid(){ + return NAME; + } + + @Nonnull + @Override + public String getTitle(){ + return StringUtil.localize("container.nei."+NAME+".name"); + } + + @Nonnull + @Override + public IDrawable getBackground(){ + return this.background; + } + + @Override + public void drawExtras(Minecraft minecraft){ + + } + + @Override + public void drawAnimations(Minecraft minecraft){ + + } + + @Override + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper){ + if(recipeWrapper instanceof CrusherRecipeWrapper){ + CrusherRecipeWrapper wrapper = (CrusherRecipeWrapper)recipeWrapper; + + recipeLayout.getItemStacks().init(0, true, 19, 7); + recipeLayout.getItemStacks().set(0, wrapper.theRecipe.getRecipeInputs()); + + recipeLayout.getItemStacks().init(1, true, 7, 55); + recipeLayout.getItemStacks().set(1, wrapper.theRecipe.getRecipeOutputOnes()); + + List outputTwos = wrapper.theRecipe.getRecipeOutputTwos(); + if(outputTwos != null && !outputTwos.isEmpty()){ + recipeLayout.getItemStacks().init(2, true, 31, 55); + recipeLayout.getItemStacks().set(2, outputTwos); + } + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeHandler.java new file mode 100644 index 000000000..698e59d7a --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeHandler.java @@ -0,0 +1,43 @@ +/* + * This file ("CrusherRecipeHandler.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei.crusher; + +import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; +import mezz.jei.api.recipe.IRecipeHandler; +import mezz.jei.api.recipe.IRecipeWrapper; + +import javax.annotation.Nonnull; + +public class CrusherRecipeHandler implements IRecipeHandler{ + + @Nonnull + @Override + public Class getRecipeClass(){ + return CrusherRecipe.class; + } + + @Nonnull + @Override + public String getRecipeCategoryUid(){ + return CrusherRecipeCategory.NAME; + } + + @Nonnull + @Override + public IRecipeWrapper getRecipeWrapper(@Nonnull CrusherRecipe recipe){ + return new CrusherRecipeWrapper(recipe); + } + + @Override + public boolean isRecipeValid(@Nonnull CrusherRecipe recipe){ + return true; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java new file mode 100644 index 000000000..7191d2ffe --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java @@ -0,0 +1,110 @@ +/* + * This file ("CrusherRecipeWrapper.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei.crusher; + +import de.ellpeck.actuallyadditions.api.booklet.BookletPage; +import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; +import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; +import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + +public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ + + public CrusherRecipe theRecipe; + + public CrusherRecipeWrapper(CrusherRecipe recipe){ + this.theRecipe = recipe; + } + + @Override + public List getInputs(){ + return this.theRecipe.getRecipeInputs(); + } + + @Override + public List getOutputs(){ + List list = new ArrayList(); + list.addAll(this.theRecipe.getRecipeOutputOnes()); + + List outputTwos = this.theRecipe.getRecipeOutputTwos(); + if(outputTwos != null && !outputTwos.isEmpty()){ + list.addAll(outputTwos); + } + + return list; + } + + @Override + public List getFluidInputs(){ + return new ArrayList(); + } + + @Override + public List getFluidOutputs(){ + return new ArrayList(); + } + + @Override + public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){ + + } + + @Override + public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ + this.updateButton(minecraft, mouseX, mouseY); + + List outputTwos = this.theRecipe.getRecipeOutputTwos(); + if(outputTwos != null && !outputTwos.isEmpty()){ + minecraft.fontRendererObj.drawString(this.theRecipe.outputTwoChance+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); + } + } + + @Override + public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){ + + } + + @Nullable + @Override + public List getTooltipStrings(int mouseX, int mouseY){ + return null; + } + + @Override + public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ + return this.handleClick(minecraft, mouseX, mouseY); + } + + @Override + public int getButtonX(){ + return -5; + } + + @Override + public int getButtonY(){ + return 26; + } + + @Override + public BookletPage getPage(){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinder)); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java new file mode 100644 index 000000000..6608d1111 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeCategory.java @@ -0,0 +1,77 @@ +/* + * This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei.reconstructor; + +import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe; +import de.ellpeck.actuallyadditions.mod.util.AssetUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nonnull; + +public class ReconstructorRecipeCategory implements IRecipeCategory{ + + private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor); + private IDrawable background; + + public ReconstructorRecipeCategory(IGuiHelper helper){ + this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60); + } + + @Nonnull + @Override + public String getUid(){ + return NEIReconstructorRecipe.NAME; + } + + @Nonnull + @Override + public String getTitle(){ + return StringUtil.localize("container.nei."+NEIReconstructorRecipe.NAME+".name"); + } + + @Nonnull + @Override + public IDrawable getBackground(){ + return this.background; + } + + @Override + public void drawExtras(Minecraft minecraft){ + AssetUtil.renderStackToGui(RECONSTRUCTOR, 34, 19, 1.0F); + } + + @Override + public void drawAnimations(Minecraft minecraft){ + + } + + @Override + public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper){ + if(recipeWrapper instanceof ReconstructorRecipeWrapper){ + ReconstructorRecipeWrapper wrapper = (ReconstructorRecipeWrapper)recipeWrapper; + + recipeLayout.getItemStacks().init(0, true, 4, 18); + recipeLayout.getItemStacks().set(0, wrapper.theRecipe.getInputs()); + + recipeLayout.getItemStacks().init(1, true, 66, 18); + recipeLayout.getItemStacks().set(1, wrapper.theRecipe.getOutputs()); + + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeHandler.java new file mode 100644 index 000000000..1d22fec60 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeHandler.java @@ -0,0 +1,44 @@ +/* + * This file ("ReconstructorRecipeHandler.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei.reconstructor; + +import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; +import de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe; +import mezz.jei.api.recipe.IRecipeHandler; +import mezz.jei.api.recipe.IRecipeWrapper; + +import javax.annotation.Nonnull; + +public class ReconstructorRecipeHandler implements IRecipeHandler{ + + @Nonnull + @Override + public Class getRecipeClass(){ + return LensNoneRecipe.class; + } + + @Nonnull + @Override + public String getRecipeCategoryUid(){ + return NEIReconstructorRecipe.NAME; + } + + @Nonnull + @Override + public IRecipeWrapper getRecipeWrapper(@Nonnull LensNoneRecipe recipe){ + return new ReconstructorRecipeWrapper(recipe); + } + + @Override + public boolean isRecipeValid(@Nonnull LensNoneRecipe recipe){ + return true; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java new file mode 100644 index 000000000..8813147f6 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java @@ -0,0 +1,96 @@ +/* + * This file ("ReconstructorRecipeWrapper.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.jei.reconstructor; + +import de.ellpeck.actuallyadditions.api.booklet.BookletPage; +import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; +import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; +import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + +public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ + + public LensNoneRecipe theRecipe; + + public ReconstructorRecipeWrapper(LensNoneRecipe recipe){ + this.theRecipe = recipe; + } + + @Override + public List getInputs(){ + return this.theRecipe.getInputs(); + } + + @Override + public List getOutputs(){ + return this.theRecipe.getOutputs(); + } + + @Override + public List getFluidInputs(){ + return new ArrayList(); + } + + @Override + public List getFluidOutputs(){ + return new ArrayList(); + } + + @Override + public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){ + + } + + @Override + public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ + this.updateButton(minecraft, mouseX, mouseY); + } + + @Override + public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){ + + } + + @Nullable + @Override + public List getTooltipStrings(int mouseX, int mouseY){ + return null; + } + + @Override + public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ + return this.handleClick(minecraft, mouseX, mouseY); + } + + @Override + public int getButtonX(){ + return 3; + } + + @Override + public int getButtonY(){ + return 40; + } + + @Override + public BookletPage getPage(){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor)); + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java index 7157377b7..9a30f371d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java @@ -30,7 +30,6 @@ public class InitArmorMaterials{ public static void init(){ ModUtil.LOGGER.info("Initializing Armor Materials..."); - //TODO Fix armor textures armorMaterialEmerald = EnumHelper.addArmorMaterial("armorMaterialEmerald", ModUtil.MOD_ID_LOWER+":armorEmerald", 50, new int[]{5, 9, 8, 5}, 15); armorMaterialObsidian = EnumHelper.addArmorMaterial("armorMaterialObsidian", ModUtil.MOD_ID_LOWER+":armorObsidian", 120, new int[]{3, 4, 3, 1}, 10); armorMaterialQuartz = EnumHelper.addArmorMaterial("armorMaterialQuartz", ModUtil.MOD_ID_LOWER+":armorQuartz", 20, new int[]{3, 6, 5, 3}, 8); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index 3a2f43a67..7b4909c58 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -26,7 +26,6 @@ import java.util.Calendar; public class RenderSpecial{ - private double lastTimeForBobbing; private ItemStack theThingToRender; public RenderSpecial(ItemStack stack){ @@ -46,13 +45,8 @@ public class RenderSpecial{ float size = isBlock ? 0.5F : 0.4F; double offsetUp = isBlock ? 0D : 0.1875D; - double bobHeight = 70; - double theTime = Minecraft.getSystemTime(); - double time = theTime/50; - - if(time-bobHeight >= lastTimeForBobbing){ - this.lastTimeForBobbing = time; - } + double bobHeight = 0.3; + double boop = Minecraft.getSystemTime()/1000D; GlStateManager.pushMatrix(); @@ -60,18 +54,14 @@ public class RenderSpecial{ Vec3 playerPos = player.getPositionEyes(partialTicks); GlStateManager.translate(playerPos.xCoord-currentPos.xCoord, playerPos.yCoord-currentPos.yCoord-(player.isSneaking() || Minecraft.getMinecraft().thePlayer.isSneaking() ? 0.125D : 0D), playerPos.zCoord-currentPos.zCoord); - GlStateManager.translate(0D, 2.535D+offsetUp, 0D); + GlStateManager.translate(0D, 2.435D+offsetUp, 0D); GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F); GlStateManager.scale(size, size, size); - if(time-(bobHeight/2) >= lastTimeForBobbing){ - GlStateManager.translate(0D, (time-this.lastTimeForBobbing)/100D, 0D); - } - else{ - GlStateManager.translate(0D, -(time-lastTimeForBobbing)/100D+bobHeight/100D, 0D); - } - - GlStateManager.rotate((float)(theTime/20), 0, 1, 0); + //Make the floaty stuff look nice using sine waves \o/ -xdjackiexd + //Peck edit: What do you mean by "nice" you jackass? >_> + GlStateManager.translate(0D, Math.sin(boop%(2*Math.PI))*bobHeight, 0D); + GlStateManager.rotate((float)(((boop*40D)%360)), 0, 1, 0); GlStateManager.disableLighting(); if(this.theThingToRender != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIActuallyAdditionsConfig.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIActuallyAdditionsConfig.java index 646910642..37d43ec4d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIActuallyAdditionsConfig.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIActuallyAdditionsConfig.java @@ -10,18 +10,9 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.nei.api.API; -import codechicken.nei.api.IConfigureNEI; -import codechicken.nei.recipe.DefaultOverlayHandler; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCrafter; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.Util; -import net.minecraft.item.ItemStack; +public class NEIActuallyAdditionsConfig/* implements IConfigureNEI*/{ -public class NEIActuallyAdditionsConfig implements IConfigureNEI{ - - @Override + /*@Override public void loadConfig(){ ModUtil.LOGGER.info("Initializing Not Enough Items Plugin..."); @@ -80,6 +71,5 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{ @Override public String getVersion(){ return ModUtil.VERSION; - } - + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIBookletRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIBookletRecipe.java index dcffa7320..839347ae2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIBookletRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIBookletRecipe.java @@ -10,33 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEIBookletRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.booklet"; - public NEIBookletRecipe(){ + /*public NEIBookletRecipe(){ RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -169,5 +147,5 @@ public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecip } return null; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICoffeeMachineRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICoffeeMachineRecipe.java index c4235ef86..cd92dceee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICoffeeMachineRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICoffeeMachineRecipe.java @@ -10,38 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing; -import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class NEICoffeeMachineRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEICoffeeMachineRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.coffee"; - public NEICoffeeMachineRecipe(){ + /*public NEICoffeeMachineRecipe(){ super(); RecipeInfo.setGuiOffset(this.getGuiClass(), 35, 3); } @@ -178,5 +151,5 @@ public class NEICoffeeMachineRecipe extends TemplateRecipeHandler implements INE list.add(this.coffeeBeans); return list; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICompostRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICompostRecipe.java index fc7eab9e5..4dff5ca4e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICompostRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICompostRecipe.java @@ -10,31 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; -import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.Collections; - -public class NEICompostRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEICompostRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.compost"; - public NEICompostRecipe(){ + /*public NEICompostRecipe(){ super(); RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -127,5 +107,5 @@ public class NEICompostRecipe extends TemplateRecipeHandler implements INEIRecip public PositionedStack getIngredient(){ return input; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICrusherRecipe.java index 23e12ffd9..6b4569946 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEICrusherRecipe.java @@ -10,31 +10,9 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiGrinder; -import de.ellpeck.actuallyadditions.mod.util.ItemUtil; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; +public class NEICrusherRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ -import java.awt.*; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ - - public NEICrusherRecipe(){ + /*public NEICrusherRecipe(){ RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -204,5 +182,5 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip } return list; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIFurnaceDoubleRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIFurnaceDoubleRecipe.java index fd65dcc97..df2d1e05a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIFurnaceDoubleRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIFurnaceDoubleRecipe.java @@ -10,32 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; - -import java.awt.*; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class NEIFurnaceDoubleRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEIFurnaceDoubleRecipe /*extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.furnaceDouble"; - public NEIFurnaceDoubleRecipe(){ + /*public NEIFurnaceDoubleRecipe(){ RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -145,5 +124,5 @@ public class NEIFurnaceDoubleRecipe extends TemplateRecipeHandler implements INE public List getIngredients(){ return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient)); } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIHairyBallRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIHairyBallRecipe.java index f25599559..5091b2962 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIHairyBallRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIHairyBallRecipe.java @@ -10,31 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.Collections; -import java.util.List; - -public class NEIHairyBallRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEIHairyBallRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.ballOfHair"; - public NEIHairyBallRecipe(){ + /*public NEIHairyBallRecipe(){ super(); RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -148,5 +128,5 @@ public class NEIHairyBallRecipe extends TemplateRecipeHandler implements INEIRec public PositionedStack getIngredient(){ return input; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIReconstructorRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIReconstructorRecipe.java index 2abe18254..5618b8e40 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIReconstructorRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIReconstructorRecipe.java @@ -10,35 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.items.InitItems; -import de.ellpeck.actuallyadditions.mod.items.lens.LensColor; -import de.ellpeck.actuallyadditions.mod.util.*; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEIReconstructorRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.reconstructor"; - public NEIReconstructorRecipe(){ + /*public NEIReconstructorRecipe(){ super(); RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -192,5 +168,5 @@ public class NEIReconstructorRecipe extends TemplateRecipeHandler implements INE list.addAll(this.getCycledIngredients(cycleticks/48, Collections.singletonList(this.result))); return list; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIScreenEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIScreenEvents.java index 99f2729ac..e18599c9f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIScreenEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEIScreenEvents.java @@ -10,25 +10,14 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.IRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.Minecraft; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class NEIScreenEvents{ private static final int NEI_BUTTON_ID = 123782; private TexturedButton neiButton; - @SuppressWarnings("unchecked") + /*@SuppressWarnings("unchecked") @SubscribeEvent public void onInitGuiForNEI(GuiScreenEvent.InitGuiEvent event){ if(event.gui instanceof GuiRecipe){ @@ -75,5 +64,5 @@ public class NEIScreenEvents{ } } } - } + }*/ } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEITreasureChestRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEITreasureChestRecipe.java index 58486bd8d..4c21fddd2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEITreasureChestRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/nei/NEITreasureChestRecipe.java @@ -10,31 +10,11 @@ package de.ellpeck.actuallyadditions.mod.nei; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.recipe.TemplateRecipeHandler; -import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; -import de.ellpeck.actuallyadditions.api.booklet.BookletPage; -import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils; -import de.ellpeck.actuallyadditions.mod.util.ModUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.Collections; -import java.util.List; - -public class NEITreasureChestRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ +public class NEITreasureChestRecipe/* extends TemplateRecipeHandler implements INEIRecipeHandler*/{ public static final String NAME = "actuallyadditions.treasureChest"; - public NEITreasureChestRecipe(){ + /*public NEITreasureChestRecipe(){ super(); RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -150,5 +130,5 @@ public class NEITreasureChestRecipe extends TemplateRecipeHandler implements INE public PositionedStack getIngredient(){ return input; } - } + }*/ } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java index 7d5c5fb26..143233276 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketHandler.java @@ -29,5 +29,6 @@ public class PacketHandler{ theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 1, Side.SERVER); theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 2, Side.SERVER); theNetwork.registerMessage(PacketParticle.Handler.class, PacketParticle.class, 3, Side.CLIENT); + theNetwork.registerMessage(PacketUpdateTileEntity.Handler.class, PacketUpdateTileEntity.class, 4, Side.CLIENT); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java new file mode 100644 index 000000000..d515af4ba --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java @@ -0,0 +1,80 @@ +/* + * This file ("PacketUpdateTileEntity.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.network; + +import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; +import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class PacketUpdateTileEntity implements IMessage{ + + private NBTTagCompound compound; + private BlockPos pos; + + @SuppressWarnings("unused") + public PacketUpdateTileEntity(){ + + } + + public PacketUpdateTileEntity(TileEntityBase tile){ + this.compound = tile.getSyncCompound(); + this.pos = tile.getPos(); + } + + @Override + public void fromBytes(ByteBuf buf){ + PacketBuffer buffer = new PacketBuffer(buf); + try{ + this.compound = buffer.readNBTTagCompoundFromBuffer(); + this.pos = buffer.readBlockPos(); + } + catch(Exception e){ + ModUtil.LOGGER.error("Something went wrong trying to receive a TileEntity packet!", e); + } + } + + @Override + public void toBytes(ByteBuf buf){ + PacketBuffer buffer = new PacketBuffer(buf); + + buffer.writeNBTTagCompoundToBuffer(this.compound); + buffer.writeBlockPos(this.pos); + } + + public static class Handler implements IMessageHandler{ + + @Override + @SideOnly(Side.CLIENT) + public IMessage onMessage(PacketUpdateTileEntity message, MessageContext ctx){ + if(message.pos != null && message.compound != null){ + World world = Minecraft.getMinecraft().theWorld; + if(world != null){ + TileEntity tile = world.getTileEntity(message.pos); + if(tile != null && tile instanceof TileEntityBase){ + ((TileEntityBase)tile).receiveSyncCompound(message.compound); + } + } + } + return null; + } + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/VanillaPacketSyncer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/VanillaPacketSyncer.java deleted file mode 100644 index 05e2b0feb..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/VanillaPacketSyncer.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file ("VanillaPacketSyncer.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense/ - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.network; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.tileentity.TileEntity; - -import java.util.List; - -public class VanillaPacketSyncer{ - - public static void sendTileToNearbyPlayers(TileEntity tile){ - List allPlayers = tile.getWorld().playerEntities; - for(Object player : allPlayers){ - if(player instanceof EntityPlayerMP){ - sendTileToPlayer(tile, (EntityPlayerMP)player, 64); - } - } - } - - public static void sendTileToPlayer(TileEntity tile, EntityPlayerMP player, int maxDistance){ - if(player.getDistance(tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ()) <= maxDistance){ - sendTileToPlayer(tile, player); - } - } - - public static void sendTileToPlayer(TileEntity tile, EntityPlayerMP player){ - if(player.getEntityWorld().getTileEntity(tile.getPos()) == tile){ - player.playerNetServerHandler.sendPacket(tile.getDescriptionPacket()); - } - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java index ac79e6366..6d66e3be0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ore/InitOreDict.java @@ -64,10 +64,6 @@ public class InitOreDict{ addOre(InitItems.itemCrystal, TheCrystals.REDSTONE.ordinal(), "actAddCrystalRed"); } - private static void addOre(ItemStack stack, String name){ - OreDictionary.registerOre(name, stack); - } - private static void addOre(Item item, int meta, String name){ addOre(new ItemStack(item, 1, meta), name); } @@ -76,11 +72,15 @@ public class InitOreDict{ addOre(item, 0, name); } + private static void addOre(Block block, String name){ + addOre(block, 0, name); + } + private static void addOre(Block block, int meta, String name){ addOre(new ItemStack(block, 1, meta), name); } - private static void addOre(Block block, String name){ - addOre(block, 0, name); + private static void addOre(ItemStack stack, String name){ + OreDictionary.registerOre(name, stack); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 1cd95e0d5..a33b7322e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -15,12 +15,13 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.event.InitEvents; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -45,15 +46,33 @@ import java.util.Map; public class ClientProxy implements IProxy{ - private static Map modelLocationsForRegistering = new HashMap(); - private static Map modelVariantsForRegistering = new HashMap(); - public static boolean pumpkinBlurPumpkinBlur; public static boolean jingleAllTheWay; public static boolean bulletForMyValentine; - public static int bookletWordCount; public static int bookletCharCount; + private static Map modelLocationsForRegistering = new HashMap(); + private static Map modelVariantsForRegistering = new HashMap(); + + private static void countBookletWords(){ + bookletWordCount = 0; + bookletCharCount = 0; + + for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){ + for(IBookletChapter chapter : entry.getChapters()){ + for(BookletPage page : chapter.getPages()){ + if(page.getText() != null){ + bookletWordCount += page.getText().split(" ").length; + bookletCharCount += page.getText().length(); + } + } + bookletWordCount += chapter.getLocalizedName().split(" ").length; + bookletCharCount += chapter.getLocalizedName().length(); + } + bookletWordCount += entry.getLocalizedName().split(" ").length; + bookletCharCount += entry.getLocalizedName().length(); + } + } @Override public void preInit(FMLPreInitializationEvent event){ @@ -63,7 +82,7 @@ public class ClientProxy implements IProxy{ Calendar c = Calendar.getInstance(); pumpkinBlurPumpkinBlur = c.get(Calendar.MONTH) == Calendar.OCTOBER; jingleAllTheWay = c.get(Calendar.MONTH) == Calendar.DECEMBER && c.get(Calendar.DAY_OF_MONTH) >= 6 && c.get(Calendar.DAY_OF_MONTH) <= 26; - bulletForMyValentine = c.get(Calendar.MONTH) == Calendar.FEBRUARY && c.get(Calendar.DAY_OF_MONTH) >= 12 && c.get(Calendar.DAY_OF_MONTH) <= 16; + bulletForMyValentine = (c.get(Calendar.MONTH) == Calendar.FEBRUARY && c.get(Calendar.DAY_OF_MONTH) >= 12 && c.get(Calendar.DAY_OF_MONTH) <= 16) || StringUtil.equalsToLowerCase(Minecraft.getMinecraft().getSession().getUsername(), "pinkhrya"); } else{ ModUtil.LOGGER.warn("You have turned Seasonal Mode off. Therefore, you are evil."); @@ -74,8 +93,8 @@ public class ClientProxy implements IProxy{ for(Map.Entry entry : modelVariantsForRegistering.entrySet()){ ModelBakery.registerItemVariants(entry.getKey(), entry.getValue()); } - this.registerCustomFluidBlockRenderer(InitBlocks.fluidCanolaOil); - this.registerCustomFluidBlockRenderer(InitBlocks.fluidOil); + this.registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil); + this.registerCustomFluidBlockRenderer(InitFluids.fluidOil); IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); if(manager instanceof IReloadableResourceManager){ @@ -143,24 +162,4 @@ public class ClientProxy implements IProxy{ public void addRenderVariant(Item item, ResourceLocation... location){ modelVariantsForRegistering.put(item, location); } - - private static void countBookletWords(){ - bookletWordCount = 0; - bookletCharCount = 0; - - for(IBookletEntry entry : ActuallyAdditionsAPI.bookletEntries){ - for(IBookletChapter chapter : entry.getChapters()){ - for(BookletPage page : chapter.getPages()){ - if(page.getText() != null){ - bookletWordCount += page.getText().split(" ").length; - bookletCharCount += page.getText().length(); - } - } - bookletWordCount += chapter.getLocalizedName().split(" ").length; - bookletCharCount += chapter.getLocalizedName().length(); - } - bookletWordCount += entry.getLocalizedName().split(" ").length; - bookletCharCount += entry.getLocalizedName().length(); - } - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/FuelHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/FuelHandler.java index dd8cdb85a..080f057f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/FuelHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/FuelHandler.java @@ -50,11 +50,6 @@ public class FuelHandler implements IFuelHandler{ addFuel(Item.getItemFromBlock(block), metadata, value); } - @Override - public int getBurnTime(ItemStack fuel){ - return getFuelValue(fuel); - } - private static int getFuelValue(ItemStack stack){ if(stack != null && stack.getItem() != null){ Pair pair = Pair.of(stack.getItem(), stack.getItemDamage()); @@ -71,4 +66,9 @@ public class FuelHandler implements IFuelHandler{ } return 0; } + + @Override + public int getBurnTime(ItemStack fuel){ + return getFuelValue(fuel); + } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 0bd966982..c6bf6c649 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -15,6 +15,7 @@ import cofh.api.energy.IEnergyReceiver; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.lens.Lenses; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketParticle; @@ -42,6 +43,25 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple super(1, "reconstructor"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("CurrentTime", this.currentTime); + this.storage.writeToNBT(compound); + } + + @Override + public boolean shouldSyncSlots(){ + return true; + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.currentTime = compound.getInteger("CurrentTime"); + this.storage.readFromNBT(compound); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -99,41 +119,48 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } private void shootLaser(int endX, int endY, int endZ, Lens currentLens){ - this.worldObj.playSoundEffect(this.getX(), this.getY(), this.getZ(), ModUtil.MOD_ID_LOWER+":reconstructor", 0.35F, 1.0F); - PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getX(), this.getY(), this.getZ(), endX, endY, endZ, currentLens.getColor(), 8, 2F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getX(), this.getY(), this.getZ(), 64)); + if(!ConfigValues.lessSound){ + this.worldObj.playSoundEffect(this.getX(), this.getY(), this.getZ(), ModUtil.MOD_ID_LOWER+":reconstructor", 0.35F, 1.0F); + } + PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getX(), this.getY(), this.getZ(), endX, endY, endZ, currentLens.getColor(), ConfigValues.lessParticles ? 2 : 8, 2F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getX(), this.getY(), this.getZ(), 64)); } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("CurrentTime", this.currentTime); - this.storage.writeToNBT(compound); + public int getX(){ + return this.getPos().getX(); } @Override - public boolean shouldSyncSlots(){ - return true; + public int getY(){ + return this.getPos().getY(); } @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.currentTime = compound.getInteger("CurrentTime"); - this.storage.readFromNBT(compound); + public int getZ(){ + return this.getPos().getZ(); } @Override - public void setInventorySlotContents(int i, ItemStack stack){ - super.setInventorySlotContents(i, stack); + public World getWorldObject(){ + return this.getWorld(); + } + + @Override + public void extractEnergy(int amount){ + this.storage.extractEnergy(amount, false); + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack){ + return stack != null && stack.getItem() instanceof ILensItem; + } + + @Override + public void markDirty(){ + super.markDirty(); this.sendUpdate(); } - @Override - public ItemStack decrStackSize(int i, int j){ - this.sendUpdate(); - return super.decrStackSize(i, j); - } - @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){ return this.storage.receiveEnergy(maxReceive, simulate); @@ -159,41 +186,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return stack != null && stack.getItem() instanceof ILensItem; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return true; } - @Override - public int getX(){ - return this.getPos().getX(); - } - - @Override - public int getY(){ - return this.getPos().getY(); - } - - @Override - public int getZ(){ - return this.getPos().getZ(); - } - - @Override - public World getWorldObject(){ - return this.getWorld(); - } - - @Override - public void extractEnergy(int amount){ - this.storage.extractEnergy(amount, false); - } - @Override public int getEnergy(){ return this.storage.getEnergyStored(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 2309c7621..5ee48df56 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -11,7 +11,8 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; -import de.ellpeck.actuallyadditions.mod.network.VanillaPacketSyncer; +import de.ellpeck.actuallyadditions.mod.network.PacketHandler; +import de.ellpeck.actuallyadditions.mod.network.PacketUpdateTileEntity; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; @@ -22,12 +23,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.world.World; +import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; public abstract class TileEntityBase extends TileEntity implements ITickable{ - protected int ticksElapsed; public boolean isRedstonePowered; + protected int ticksElapsed; public static void init(){ ModUtil.LOGGER.info("Registering TileEntities..."); @@ -90,24 +92,21 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } @Override - public void update(){ - this.updateEntity(); - } - - public void updateEntity(){ - this.ticksElapsed++; + public final Packet getDescriptionPacket(){ + NBTTagCompound compound = this.getSyncCompound(); + if(compound != null){ + return new S35PacketUpdateTileEntity(this.pos, 3, compound); + } + else{ + return null; + } } @Override - public Packet getDescriptionPacket(){ - NBTTagCompound tag = new NBTTagCompound(); - this.writeSyncableNBT(tag, true); - return new S35PacketUpdateTileEntity(this.pos, 3, tag); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ - this.readSyncableNBT(pkt.getNbtCompound(), true); + public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + if(pkt != null){ + this.receiveSyncCompound(pkt.getNbtCompound()); + } } @Override @@ -115,6 +114,16 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ return !(oldState.getBlock().isAssociatedBlock(newState.getBlock())); } + public void receiveSyncCompound(NBTTagCompound compound){ + this.readSyncableNBT(compound, true); + } + + public NBTTagCompound getSyncCompound(){ + NBTTagCompound tag = new NBTTagCompound(); + this.writeSyncableNBT(tag, true); + return tag; + } + public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ if(this instanceof IRedstoneToggle){ compound.setBoolean("IsPulseMode", ((IRedstoneToggle)this).isPulseMode()); @@ -127,12 +136,21 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } } - public void setRedstonePowered(boolean powered){ + @Override + public final void update(){ + this.updateEntity(); + } + + public void updateEntity(){ + this.ticksElapsed++; + } + + public final void setRedstonePowered(boolean powered){ this.isRedstonePowered = powered; this.markDirty(); } - protected boolean sendUpdateWithInterval(){ + protected final boolean sendUpdateWithInterval(){ if(this.ticksElapsed%ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){ this.sendUpdate(); return true; @@ -142,7 +160,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } } - public void sendUpdate(){ - VanillaPacketSyncer.sendTileToNearbyPlayers(this); + public final void sendUpdate(){ + PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index f3b5f8f44..56ece8b7c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; @@ -37,6 +38,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst this.isPlacer = false; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("CurrentTime", this.currentTime); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.currentTime = compound.getInteger("CurrentTime"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -57,15 +70,8 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("CurrentTime", this.currentTime); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.currentTime = compound.getInteger("CurrentTime"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return this.isPlacer; } private void doWork(){ @@ -80,15 +86,17 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, worldObj.getBlockState(coordsBlock), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ - worldObj.playAuxSFX(2001, coordsBlock, Block.getIdFromBlock(blockToBreak)+(meta << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + worldObj.playAuxSFX(2001, coordsBlock, Block.getStateId(worldObj.getBlockState(coordsBlock))); + } WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, this.pos); WorldUtil.addToInventory(this, drops, true, true); this.markDirty(); } } - else if(this.isPlacer && PosUtil.getBlock(coordsBlock, worldObj).isReplaceable(worldObj, coordsBlock)){ + else if(this.isPlacer){ int theSlot = WorldUtil.findFirstFilledSlot(this.slots); - this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, this.pos, this.slots[theSlot])); + this.setInventorySlotContents(theSlot, WorldUtil.useItemAtSide(sideToManipulate, worldObj, this.pos, this.slots[theSlot])); if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0){ this.slots[theSlot] = null; } @@ -101,11 +109,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return this.isPlacer; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index 9b58198f5..f56e4361e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; @@ -26,7 +26,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler, IEnergySaver, IFluidSaver{ - public static final int PRODUCE = 120; + public static final int PRODUCE = 80; public static final int ENERGY_USE = 35; private static final int TIME = 30; public EnergyStorage storage = new EnergyStorage(40000); @@ -55,6 +55,22 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored(); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("ProcessTime", this.currentProcessTime); + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.currentProcessTime = compound.getInteger("ProcessTime"); + this.storage.readFromNBT(compound); + this.tank.readFromNBT(compound); + super.readSyncableNBT(compound, sync); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -72,7 +88,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE this.slots[0] = null; } - this.tank.fill(new FluidStack(InitBlocks.fluidCanolaOil, PRODUCE), true); + this.tank.fill(new FluidStack(InitFluids.fluidCanolaOil, PRODUCE), true); this.markDirty(); } } @@ -102,19 +118,8 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - compound.setInteger("ProcessTime", this.currentProcessTime); - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.currentProcessTime = compound.getInteger("ProcessTime"); - this.storage.readFromNBT(compound); - this.tank.readFromNBT(compound); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket); } public boolean isCanola(int slot){ @@ -126,14 +131,9 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket); - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ - return slot == 2 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME)); + return slot == 2 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME)); } @Override @@ -163,7 +163,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE @Override public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain){ - if(resource.getFluid() == InitBlocks.fluidCanolaOil){ + if(resource.getFluid() == InitFluids.fluidCanolaOil){ return this.tank.drain(resource.amount, doDrain); } return null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index e8e5dc3cd..ef75b1688 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -45,6 +45,22 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements return this.currentBurnTime*i/this.maxBurnTime; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("BurnTime", this.currentBurnTime); + compound.setInteger("MaxBurnTime", this.maxBurnTime); + this.storage.writeToNBT(compound); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.currentBurnTime = compound.getInteger("BurnTime"); + this.maxBurnTime = compound.getInteger("MaxBurnTime"); + this.storage.readFromNBT(compound); + super.readSyncableNBT(compound, sync); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -94,19 +110,8 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - compound.setInteger("BurnTime", this.currentBurnTime); - compound.setInteger("MaxBurnTime", this.maxBurnTime); - this.storage.writeToNBT(compound); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.currentBurnTime = compound.getInteger("BurnTime"); - this.maxBurnTime = compound.getInteger("MaxBurnTime"); - this.storage.readFromNBT(compound); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return TileEntityFurnace.getItemBurnTime(stack) > 0; } @Override @@ -114,11 +119,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return TileEntityFurnace.getItemBurnTime(stack) > 0; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return false; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index 7017dd4d7..82652e39c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; @@ -72,6 +73,24 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements return this.brewTime*i/TIME_USED; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + compound.setInteger("Cache", this.coffeeCacheAmount); + compound.setInteger("Time", this.brewTime); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + this.tank.readFromNBT(compound); + this.coffeeCacheAmount = compound.getInteger("Cache"); + this.brewTime = compound.getInteger("Time"); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -92,21 +111,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - compound.setInteger("Cache", this.coffeeCacheAmount); - compound.setInteger("Time", this.brewTime); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - this.tank.readFromNBT(compound); - this.coffeeCacheAmount = compound.getInteger("Cache"); - this.brewTime = compound.getInteger("Time"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1))); } public void storeCoffee(){ @@ -128,7 +134,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if(!worldObj.isRemote){ if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){ if(this.storage.getEnergyStored() >= ENERGY_USED){ - if(this.brewTime%30 == 0){ + if(this.brewTime%30 == 0 && !ConfigValues.lessSound){ this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":coffeeMachine", 0.35F, 1.0F); } @@ -171,11 +177,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1))); - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == SLOT_OUTPUT || (slot >= 3 && slot < this.slots.length-2 && ItemCoffee.getIngredientFromStack(stack) == null) || slot == SLOT_WATER_OUTPUT; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java index 4f09fb2d3..6b31c5228 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCompost.java @@ -27,6 +27,23 @@ public class TileEntityCompost extends TileEntityInventoryBase{ super(1, "compost"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("ConversionTime", this.conversionTime); + } + + @Override + public boolean shouldSyncSlots(){ + return true; + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.conversionTime = compound.getInteger("ConversionTime"); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -45,50 +62,27 @@ public class TileEntityCompost extends TileEntityInventoryBase{ } } - @Override - public boolean shouldSyncSlots(){ - return true; - } - - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("ConversionTime", this.conversionTime); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.conversionTime = compound.getInteger("ConversionTime"); - } - - @Override - public void setInventorySlotContents(int i, ItemStack stack){ - super.setInventorySlotContents(i, stack); - this.sendUpdate(); - } - - @Override - public ItemStack decrStackSize(int i, int j){ - this.sendUpdate(); - return super.decrStackSize(i, j); - } - @Override public int getInventoryStackLimit(){ return AMOUNT; } - @Override - public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ - return this.isItemValidForSlot(slot, stack); - } - @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal(); } + @Override + public void markDirty(){ + super.markDirty(); + this.sendUpdate(); + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ + return this.isItemValidForSlot(slot, stack); + } + @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return stack.getItem() instanceof ItemFertilizer; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index 255b62b43..ebd6d63f2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; @@ -38,6 +39,20 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem super(9, "directionalBreaker"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + compound.setInteger("CurrentTime", this.currentTime); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + this.currentTime = compound.getInteger("CurrentTime"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -72,11 +87,12 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem Block blockToBreak = PosUtil.getBlock(coordsBlock, worldObj); if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(worldObj, pos) > -1.0F){ ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(coordsBlock, worldObj); drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, worldObj.getBlockState(coordsBlock), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ - worldObj.playAuxSFX(2001, coordsBlock, Block.getIdFromBlock(blockToBreak)+(meta << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + worldObj.playAuxSFX(2001, coordsBlock, Block.getStateId(worldObj.getBlockState(coordsBlock))); + } WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, this.getPos(), i); WorldUtil.addToInventory(this, drops, true, true); this.storage.extractEnergy(ENERGY_USE, false); @@ -88,17 +104,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - compound.setInteger("CurrentTime", this.currentTime); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - this.currentTime = compound.getInteger("CurrentTime"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return false; } @SideOnly(Side.CLIENT) @@ -111,11 +118,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return false; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java index 8fd2a6139..60a4982b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDropper.java @@ -25,6 +25,18 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst super(9, "dropper"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("CurrentTime", this.currentTime); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.currentTime = compound.getInteger("CurrentTime"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -45,15 +57,8 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("CurrentTime", this.currentTime); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.currentTime = compound.getInteger("CurrentTime"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return true; } private void doWork(){ @@ -85,11 +90,6 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return true; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return true; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index faed346ed..33131aeb2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -28,6 +28,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne super(2, "energizer"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.writeToNBT(compound); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.readFromNBT(compound); + super.readSyncableNBT(compound, sync); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -54,15 +66,8 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.writeToNBT(compound); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.readFromNBT(compound); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return i == 0 && stack.getItem() instanceof IEnergyContainerItem; } @Override @@ -70,11 +75,6 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return i == 0 && stack.getItem() instanceof IEnergyContainerItem; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index d02151c62..2d9f66303 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -29,6 +29,18 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne super(2, "enervator"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.writeToNBT(compound); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.readFromNBT(compound); + super.readSyncableNBT(compound, sync); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -59,15 +71,8 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.writeToNBT(compound); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.readFromNBT(compound); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return i == 0 && stack.getItem() instanceof IEnergyContainerItem; } @Override @@ -100,11 +105,6 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return i == 0 && stack.getItem() instanceof IEnergyContainerItem; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index a755d6f94..3b42009d9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -40,6 +40,24 @@ public class TileEntityFeeder extends TileEntityInventoryBase{ return this.currentTimer*i/TIME; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("Timer", this.currentTimer); + if(sync){ + compound.setInteger("Animals", this.currentAnimalAmount); + } + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.currentTimer = compound.getInteger("Timer"); + if(sync){ + this.currentAnimalAmount = compound.getInteger("Animals"); + } + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -92,21 +110,8 @@ public class TileEntityFeeder extends TileEntityInventoryBase{ } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("Timer", this.currentTimer); - if(sync){ - compound.setInteger("Animals", this.currentAnimalAmount); - } - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.currentTimer = compound.getInteger("Timer"); - if(sync){ - this.currentAnimalAmount = compound.getInteger("Animals"); - } + public boolean isItemValidForSlot(int i, ItemStack stack){ + return true; } public void feedAnimal(EntityAnimal animal){ @@ -124,11 +129,6 @@ public class TileEntityFeeder extends TileEntityInventoryBase{ return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return true; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return false; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java index 3d221ae4b..4bfb1694f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFermentingBarrel.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.mod.tile; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -34,6 +34,24 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen super(4, "fermentingBarrel"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("ProcessTime", this.currentProcessTime); + this.canolaTank.writeToNBT(compound); + NBTTagCompound tag = new NBTTagCompound(); + this.oilTank.writeToNBT(tag); + compound.setTag("OilTank", tag); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.currentProcessTime = compound.getInteger("ProcessTime"); + this.canolaTank.readFromNBT(compound); + this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank")); + super.readSyncableNBT(compound, sync); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -45,7 +63,7 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen if(this.currentProcessTime >= PROCESS_TIME){ this.currentProcessTime = 0; - this.oilTank.fill(new FluidStack(InitBlocks.fluidOil, produce), true); + this.oilTank.fill(new FluidStack(InitFluids.fluidOil, produce), true); this.canolaTank.drain(produce, true); this.markDirty(); } @@ -54,7 +72,7 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen this.currentProcessTime = 0; } - WorldUtil.emptyBucket(canolaTank, slots, 0, 1, InitBlocks.fluidCanolaOil); + WorldUtil.emptyBucket(canolaTank, slots, 0, 1, InitFluids.fluidCanolaOil); WorldUtil.fillBucket(oilTank, slots, 2, 3); if(this.oilTank.getFluidAmount() > 0){ @@ -76,21 +94,8 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - compound.setInteger("ProcessTime", this.currentProcessTime); - this.canolaTank.writeToNBT(compound); - NBTTagCompound tag = new NBTTagCompound(); - this.oilTank.writeToNBT(tag); - compound.setTag("OilTank", tag); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.currentProcessTime = compound.getInteger("ProcessTime"); - this.canolaTank.readFromNBT(compound); - this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank")); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket); } @SideOnly(Side.CLIENT) @@ -113,19 +118,14 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket); - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ - return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME))); + return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME))); } @Override public int fill(EnumFacing from, FluidStack resource, boolean doFill){ - if(from != EnumFacing.DOWN && resource.getFluid() == InitBlocks.fluidCanolaOil){ + if(from != EnumFacing.DOWN && resource.getFluid() == InitFluids.fluidCanolaOil){ return this.canolaTank.fill(resource, doFill); } return 0; @@ -133,7 +133,7 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen @Override public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain){ - if(resource.getFluid() == InitBlocks.fluidOil){ + if(resource.getFluid() == InitFluids.fluidOil){ return this.oilTank.drain(resource.amount, doDrain); } return null; @@ -146,12 +146,12 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen @Override public boolean canFill(EnumFacing from, Fluid fluid){ - return from != EnumFacing.DOWN && fluid == InitBlocks.fluidCanolaOil; + return from != EnumFacing.DOWN && fluid == InitFluids.fluidCanolaOil; } @Override public boolean canDrain(EnumFacing from, Fluid fluid){ - return from != EnumFacing.UP && fluid == InitBlocks.fluidOil; + return from != EnumFacing.UP && fluid == InitFluids.fluidOil; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 7b1dd60b5..57707f626 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -32,6 +32,18 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece private boolean activateOnceWithSignal; private int oldEnergy; + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + } + @Override public void updateEntity(){ if(!this.worldObj.isRemote){ @@ -113,18 +125,6 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece return compound; } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - } - @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){ return this.storage.receiveEnergy(maxReceive, simulate); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java index 79db068e3..e8cbcec01 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java @@ -29,6 +29,18 @@ public class TileEntityFishingNet extends TileEntityBase{ public int timeUntilNextDrop; + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop"); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -60,16 +72,4 @@ public class TileEntityFishingNet extends TileEntityBase{ } } } - - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop"); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index 49fb8cc59..ca810aac3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -84,11 +84,8 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements else if(this.isPlacer && PosUtil.getBlock(coordsBlock, worldObj).isReplaceable(worldObj, coordsBlock)){ if(this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){ if(this.tank.getFluid().getFluid().getBlock() != null){ - Block block = PosUtil.getBlock(coordsBlock, worldObj); - if(!(block instanceof IFluidBlock) && block != Blocks.lava && block != Blocks.water && block != Blocks.flowing_lava && block != Blocks.flowing_water){ - WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, this.pos, new ItemStack(this.tank.getFluid().getFluid().getBlock())); - this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true); - } + WorldUtil.useItemAtSide(sideToManipulate, worldObj, this.pos, new ItemStack(this.tank.getFluid().getFluid().getBlock())); + this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true); } } } @@ -134,6 +131,20 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements return new FluidTankInfo[]{this.tank.getInfo()}; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("CurrentTime", this.currentTime); + this.tank.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.currentTime = compound.getInteger("CurrentTime"); + this.tank.readFromNBT(compound); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -174,30 +185,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements } } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("CurrentTime", this.currentTime); - this.tank.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.currentTime = compound.getInteger("CurrentTime"); - this.tank.readFromNBT(compound); - } - - @SideOnly(Side.CLIENT) - public int getTankScaled(int i){ - return this.tank.getFluidAmount()*i/this.tank.getCapacity(); - } - - @Override - public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ - return this.isItemValidForSlot(slot, stack); - } - @Override public boolean isItemValidForSlot(int i, ItemStack stack){ if(i == 0){ @@ -211,6 +198,16 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements return false; } + @SideOnly(Side.CLIENT) + public int getTankScaled(int i){ + return this.tank.getFluidAmount()*i/this.tank.getCapacity(); + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ + return this.isItemValidForSlot(slot, stack); + } + @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == 1; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 0eca889d2..3be5c827d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -39,6 +39,22 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements super(4, "furnaceDouble"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("FirstSmeltTime", this.firstSmeltTime); + compound.setInteger("SecondSmeltTime", this.secondSmeltTime); + this.storage.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.firstSmeltTime = compound.getInteger("FirstSmeltTime"); + this.secondSmeltTime = compound.getInteger("SecondSmeltTime"); + this.storage.readFromNBT(compound); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -101,19 +117,8 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("FirstSmeltTime", this.firstSmeltTime); - compound.setInteger("SecondSmeltTime", this.secondSmeltTime); - this.storage.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.firstSmeltTime = compound.getInteger("FirstSmeltTime"); - this.secondSmeltTime = compound.getInteger("SecondSmeltTime"); - this.storage.readFromNBT(compound); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null; } public boolean canSmeltOn(int theInput, int theOutput){ @@ -165,11 +170,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index 356acf99f..213ec304e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -46,6 +46,18 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro return from != EnumFacing.UP; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -67,18 +79,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro } } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - } - public boolean hasBlockAbove(){ for(int y = 1; y <= worldObj.getHeight(); y++){ BlockPos offset = PosUtil.offset(this.pos, 0, y, 0); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java index 7d60df32c..5d0cb8ace 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java @@ -24,6 +24,18 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{ private int timeUntilNextFert; + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.writeSyncableNBT(compound, isForSync); + this.timeUntilNextFert = compound.getInteger("Time"); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.readSyncableNBT(compound, isForSync); + compound.setInteger("Time", this.timeUntilNextFert); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -66,16 +78,4 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{ } return null; } - - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ - super.writeSyncableNBT(compound, isForSync); - this.timeUntilNextFert = compound.getInteger("Time"); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ - super.readSyncableNBT(compound, isForSync); - compound.setInteger("Time", this.timeUntilNextFert); - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index cb3a03232..90d944eeb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil; @@ -50,6 +51,10 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg this.isDouble = false; } + public static int getEnergyUse(boolean isDouble){ + return isDouble ? 60 : 40; + } + @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){ return this.storage.receiveEnergy(maxReceive, simulate); @@ -70,6 +75,22 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg return true; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("FirstCrushTime", this.firstCrushTime); + compound.setInteger("SecondCrushTime", this.secondCrushTime); + this.storage.writeToNBT(compound); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.firstCrushTime = compound.getInteger("FirstCrushTime"); + this.secondCrushTime = compound.getInteger("SecondCrushTime"); + this.storage.readFromNBT(compound); + super.readSyncableNBT(compound, sync); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -142,26 +163,15 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg this.lastSecondCrush = this.secondCrushTime; } - if(shouldPlaySound){ + if(shouldPlaySound && !ConfigValues.lessSound){ this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":crusher", 0.25F, 1.0F); } } } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - compound.setInteger("FirstCrushTime", this.firstCrushTime); - compound.setInteger("SecondCrushTime", this.secondCrushTime); - this.storage.writeToNBT(compound); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.firstCrushTime = compound.getInteger("FirstCrushTime"); - this.secondCrushTime = compound.getInteger("SecondCrushTime"); - this.storage.readFromNBT(compound); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null; } public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){ @@ -187,10 +197,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg return false; } - public static int getEnergyUse(boolean isDouble){ - return isDouble ? 60 : 40; - } - private int getMaxCrushTime(){ return this.isDouble ? 150 : 100; } @@ -257,11 +263,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 9f0dfb8d7..7f99db7ab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -32,6 +32,18 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr public EnergyStorage storage = new EnergyStorage(30000); private int oldEnergy; + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.writeSyncableNBT(compound, isForSync); + this.storage.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + super.readSyncableNBT(compound, isForSync); + this.storage.readFromNBT(compound); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -69,18 +81,6 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr } } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ - super.writeSyncableNBT(compound, isForSync); - this.storage.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ - super.readSyncableNBT(compound, isForSync); - this.storage.readFromNBT(compound); - } - @Override public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){ return this.storage.extractEnergy(maxExtract, simulate); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index 70f672209..a1e750691 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -61,31 +61,86 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt @Override public void onNumberReceived(int text, int textID, EntityPlayer player){ if(text != -1){ - if(this.placeToPut instanceof IInventory){ - if(textID == 0){ - this.slotToPutStart = Math.max(Math.min(text, ((IInventory)this.placeToPut).getSizeInventory()-1), 0); - } - if(textID == 1){ - this.slotToPutEnd = Math.max(Math.min(text, ((IInventory)this.placeToPut).getSizeInventory()), 0); - } + //TODO Find a better solution for the Math.max and Math.min stuff here (also below in initVars()!) + if(textID == 0){ + this.slotToPutStart = this.placeToPut instanceof IInventory ? Math.max(Math.min(text, ((IInventory)this.placeToPut).getSizeInventory()-1), 0) : text; + } + if(textID == 1){ + this.slotToPutEnd = this.placeToPut instanceof IInventory ? Math.max(Math.min(text, ((IInventory)this.placeToPut).getSizeInventory()), 0) : text; } - if(this.placeToPull instanceof IInventory){ - if(textID == 2){ - this.slotToPullStart = Math.max(Math.min(text, ((IInventory)this.placeToPull).getSizeInventory()-1), 0); - } - if(textID == 3){ - this.slotToPullEnd = Math.max(Math.min(text, ((IInventory)this.placeToPull).getSizeInventory()), 0); - } + if(textID == 2){ + this.slotToPullStart = this.placeToPull instanceof IInventory ? Math.max(Math.min(text, ((IInventory)this.placeToPull).getSizeInventory()-1), 0) : text; + } + if(textID == 3){ + this.slotToPullEnd = this.placeToPull instanceof IInventory ? Math.max(Math.min(text, ((IInventory)this.placeToPull).getSizeInventory()), 0) : text; } } this.markDirty(); } + //TODO Fix for new item system + private boolean newPull(){ + /*for(EnumFacing facing : EnumFacing.values()){ + IItemHandler handler = this.placeToPull.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); + if(handler != null){ + for(int i = Math.max(this.lastPullStart, 0); i < Math.min(this.slotToPullEnd, handler.getSlots()); i++){ + ItemStack stackInOtherInv = handler.getStackInSlot(i); + if(stackInOtherInv != null){ + if(this.slots[0] == null || ItemUtil.areItemsEqual(stackInOtherInv, this.slots[0], false)){ + + ItemStack pulled = handler.extractItem(i, this.slots[0] == null ? stackInOtherInv.stackSize : Math.min(stackInOtherInv.stackSize, this.slots[0].getMaxStackSize()-this.slots[0].stackSize), false); + if(pulled != null){ + ItemStack slotCopy = this.slots[0] == null ? null : this.slots[0].copy(); + + if(this.slots[0] == null){ + this.slots[0] = pulled.copy(); + } + else{ + this.slots[0].stackSize+=pulled.stackSize; + } + + if(!ItemUtil.areStacksEqualAndSameSize(slotCopy, this.slots[0], false)){ + return true; + } + } + } + } + } + } + }*/ + return false; + } + + private boolean newPut(){ + /*if(this.slots[0] != null){ + for(EnumFacing facing : EnumFacing.values()){ + IItemHandler handler = this.placeToPut.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); + if(handler != null){ + for(int i = Math.max(this.slotToPutStart, 0); i < Math.min(this.slotToPutEnd, handler.getSlots()); i++){ + ItemStack slotCopy = this.slots[0].copy(); + + ItemStack remaining = handler.insertItem(i, slotCopy, false); + this.slots[0] = remaining == null ? null : remaining.copy(); + + if(!ItemUtil.areStacksEqualAndSameSize(slotCopy, this.slots[0], false)){ + return true; + } + } + } + } + }*/ + return false; + } + /** * Pulls Items from the specified Slots on the specified Side */ - public void pull(){ + private void pull(){ + if(this.newPull()){ + return; + } + //The Inventory to pull from IInventory theInventory = (IInventory)placeToPull; //Does the Inventory even have Slots!? @@ -184,7 +239,11 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt * Puts Items into the specified Slots at the specified Side * (Check pull() for Description, similar to this) */ - public void put(){ + private void put(){ + if(this.newPut()){ + return; + } + IInventory theInventory = (IInventory)placeToPut; if(theInventory.getSizeInventory() > 0){ int theSlotToPut = this.slotToPutStart; @@ -370,6 +429,32 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.markDirty(); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("SideToPut", this.sideToPut); + compound.setInteger("SlotToPut", this.slotToPutStart); + compound.setInteger("SlotToPutEnd", this.slotToPutEnd); + compound.setInteger("SideToPull", this.sideToPull); + compound.setInteger("SlotToPull", this.slotToPullStart); + compound.setInteger("SlotToPullEnd", this.slotToPullEnd); + compound.setBoolean("PullWhitelist", this.isPullWhitelist); + compound.setBoolean("PutWhitelist", this.isPutWhitelist); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.sideToPut = compound.getInteger("SideToPut"); + this.slotToPutStart = compound.getInteger("SlotToPut"); + this.slotToPutEnd = compound.getInteger("SlotToPutEnd"); + this.sideToPull = compound.getInteger("SideToPull"); + this.slotToPullStart = compound.getInteger("SlotToPull"); + this.slotToPullEnd = compound.getInteger("SlotToPullEnd"); + this.isPullWhitelist = compound.getBoolean("PullWhitelist"); + this.isPutWhitelist = compound.getBoolean("PutWhitelist"); + super.readSyncableNBT(compound, sync); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -403,29 +488,8 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("SideToPut", this.sideToPut); - compound.setInteger("SlotToPut", this.slotToPutStart); - compound.setInteger("SlotToPutEnd", this.slotToPutEnd); - compound.setInteger("SideToPull", this.sideToPull); - compound.setInteger("SlotToPull", this.slotToPullStart); - compound.setInteger("SlotToPullEnd", this.slotToPullEnd); - compound.setBoolean("PullWhitelist", this.isPullWhitelist); - compound.setBoolean("PutWhitelist", this.isPutWhitelist); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.sideToPut = compound.getInteger("SideToPut"); - this.slotToPutStart = compound.getInteger("SlotToPut"); - this.slotToPutEnd = compound.getInteger("SlotToPutEnd"); - this.sideToPull = compound.getInteger("SideToPull"); - this.slotToPullStart = compound.getInteger("SlotToPull"); - this.slotToPullEnd = compound.getInteger("SlotToPullEnd"); - this.isPullWhitelist = compound.getBoolean("PullWhitelist"); - this.isPutWhitelist = compound.getBoolean("PutWhitelist"); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return i == 0; } @Override @@ -433,11 +497,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return i == 0; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 17b84f55c..8af8f3240 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -11,33 +11,43 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.wrapper.SidedInvWrapper; + +import java.util.HashMap; +import java.util.Map; public abstract class TileEntityInventoryBase extends TileEntityBase implements ISidedInventory{ public ItemStack slots[]; public String name; + private Map itemHandlers = new HashMap(); + public TileEntityInventoryBase(int slots, String name){ this.initializeSlots(slots); this.name = "container."+ModUtil.MOD_ID_LOWER+"."+name; + + for(EnumFacing facing : EnumFacing.values()){ + this.itemHandlers.put(facing, new SidedInvWrapper(this, facing)); + } } public void initializeSlots(int itemAmount){ this.slots = new ItemStack[itemAmount]; } - @Override - public void updateEntity(){ - super.updateEntity(); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ super.writeSyncableNBT(compound, isForSync); @@ -78,17 +88,51 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements } } + @Override + public void updateEntity(){ + super.updateEntity(); + } + + @Override + public int[] getSlotsForFace(EnumFacing side){ + if(this.slots.length > 0){ + int[] theInt = new int[slots.length]; + for(int i = 0; i < theInt.length; i++){ + theInt[i] = i; + } + return theInt; + } + else{ + return new int[0]; + } + } + + @Override + public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, net.minecraft.util.EnumFacing facing){ + return this.getCapability(capability, facing) != null; + } + @Override public int getInventoryStackLimit(){ return 64; } + @Override + public T getCapability(Capability capability, EnumFacing facing){ + if(facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){ + return (T)this.itemHandlers.get(facing); + } + else{ + return super.getCapability(capability, facing); + } + } @Override public boolean isUseableByPlayer(EntityPlayer player){ return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.worldObj.getTileEntity(this.pos) == this; } + @Override public void openInventory(EntityPlayer player){ @@ -172,20 +216,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements return stack; } - @Override - public int[] getSlotsForFace(EnumFacing side){ - if(this.slots.length > 0){ - int[] theInt = new int[slots.length]; - for(int i = 0; i < theInt.length; i++){ - theInt[i] = i; - } - return theInt; - } - else{ - return new int[0]; - } - } - @Override public String getName(){ return this.name; @@ -198,6 +228,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements @Override public IChatComponent getDisplayName(){ - return null; + return new ChatComponentText(StringUtil.localize(this.getName())); } + } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java index 22f721bf7..b0abbbe7f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java @@ -31,6 +31,24 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I super(2, "repairer"); } + public static boolean canBeRepaired(ItemStack stack){ + return stack != null && stack.getItem().isRepairable(); + } + + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("NextRepairTick", this.nextRepairTick); + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.nextRepairTick = compound.getInteger("NextRepairTick"); + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -64,21 +82,8 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - compound.setInteger("NextRepairTick", this.nextRepairTick); - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.nextRepairTick = compound.getInteger("NextRepairTick"); - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - } - - public static boolean canBeRepaired(ItemStack stack){ - return stack != null && stack.getItem().isRepairable(); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return i == SLOT_INPUT; } @SideOnly(Side.CLIENT) @@ -99,11 +104,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return i == SLOT_INPUT; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == SLOT_OUTPUT; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index 39bf833f4..976991cc0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.IEnergyReceiver; -import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.misc.LaserRelayConnectionHandler; import de.ellpeck.actuallyadditions.mod.network.PacketParticle; @@ -21,9 +21,6 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import io.netty.util.internal.ConcurrentSet; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; @@ -35,30 +32,24 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei private static final float[] COLOR = new float[]{1F, 0F, 0F}; @Override - public void updateEntity(){ - super.updateEntity(); - if(this.worldObj.isRemote){ - this.renderParticles(); - } - } + public void receiveSyncCompound(NBTTagCompound compound){ + BlockPos thisPos = this.pos; + if(compound != null){ + LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos); - @SideOnly(Side.CLIENT) - public void renderParticles(){ - if(Util.RANDOM.nextInt(ConfigBoolValues.LESS_LASER_RELAY_PARTICLES.isEnabled() ? 15 : 8) == 0){ - BlockPos thisPos = this.pos; - LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos); - if(network != null){ - for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){ - if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){ - PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigBoolValues.LESS_LASER_RELAY_PARTICLES.isEnabled() ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, COLOR, 1F); - } - } + NBTTagList list = compound.getTagList("Connections", 10); + for(int i = 0; i < list.tagCount(); i++){ + LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i)); + LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay); } } + else{ + LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos); + } } @Override - public Packet getDescriptionPacket(){ + public NBTTagCompound getSyncCompound(){ NBTTagCompound compound = new NBTTagCompound(); BlockPos thisPos = this.pos; @@ -70,25 +61,31 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei list.appendTag(pair.writeToNBT()); } compound.setTag("Connections", list); - return new S35PacketUpdateTileEntity(thisPos, 3, compound); + return compound; } return null; } @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ - BlockPos thisPos = this.pos; - if(pkt != null && pkt.getNbtCompound() != null){ - LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos); - - NBTTagList list = pkt.getNbtCompound().getTagList("Connections", 10); - for(int i = 0; i < list.tagCount(); i++){ - LaserRelayConnectionHandler.ConnectionPair pair = LaserRelayConnectionHandler.ConnectionPair.readFromNBT(list.getCompoundTagAt(i)); - LaserRelayConnectionHandler.getInstance().addConnection(pair.firstRelay, pair.secondRelay); - } + public void updateEntity(){ + super.updateEntity(); + if(this.worldObj.isRemote){ + this.renderParticles(); } - else{ - LaserRelayConnectionHandler.getInstance().removeRelayFromNetwork(thisPos); + } + + @SideOnly(Side.CLIENT) + public void renderParticles(){ + if(Util.RANDOM.nextInt(ConfigValues.lessParticles ? 15 : 8) == 0){ + BlockPos thisPos = this.pos; + LaserRelayConnectionHandler.Network network = LaserRelayConnectionHandler.getInstance().getNetworkFor(thisPos); + if(network != null){ + for(LaserRelayConnectionHandler.ConnectionPair aPair : network.connections){ + if(aPair.contains(thisPos) && PosUtil.areSamePos(thisPos, aPair.firstRelay)){ + PacketParticle.renderParticlesFromAToB(aPair.firstRelay.getX(), aPair.firstRelay.getY(), aPair.firstRelay.getZ(), aPair.secondRelay.getX(), aPair.secondRelay.getY(), aPair.secondRelay.getZ(), ConfigValues.lessParticles ? 1 : Util.RANDOM.nextInt(3)+1, 0.8F, COLOR, 1F); + } + } + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index 0396749c7..b0ff839a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -33,6 +33,20 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I private int currentWorkTime; private int oldEnergy; + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + compound.setInteger("WorkTime", this.currentWorkTime); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + this.currentWorkTime = compound.getInteger("WorkTime"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -56,20 +70,6 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - compound.setInteger("WorkTime", this.currentWorkTime); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - this.currentWorkTime = compound.getInteger("WorkTime"); - } - public int isMultiblock(){ BlockPos thisPos = this.pos; BlockPos[] positions = new BlockPos[]{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index c112a7cec..ed5a5bf1d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyProvider; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketParticle; import de.ellpeck.actuallyadditions.mod.util.PosUtil; @@ -35,6 +36,18 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr private int nextUseCounter; private int oldEnergy; + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -64,15 +77,17 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr Collections.shuffle(breakPositions); BlockPos theCoord = breakPositions.get(0); - Block theBlock = PosUtil.getBlock(theCoord, worldObj); - int meta = PosUtil.getMetadata(theCoord, worldObj); - this.worldObj.playAuxSFX(2001, theCoord, Block.getIdFromBlock(theBlock)+(meta << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + this.worldObj.playAuxSFX(2001, theCoord, Block.getStateId(worldObj.getBlockState(theCoord))); + } this.worldObj.setBlockToAir(theCoord); this.storage.receiveEnergy(ENERGY_PRODUCED, false); - PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 64)); + if(!ConfigValues.lessParticles){ + PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 64)); + } } } } @@ -91,18 +106,6 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr } } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - } - @Override public int extractEnergy(EnumFacing from, int maxReceive, boolean simulate){ return this.storage.extractEnergy(maxReceive, simulate); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index dd12287a0..1ed6d9606 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -47,6 +47,22 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR super(9, "miner"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + this.storage.writeToNBT(compound); + compound.setInteger("Layer", this.layerAt); + compound.setBoolean("OnlyOres", this.onlyMineOres); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + this.layerAt = compound.getInteger("Layer"); + this.onlyMineOres = compound.getBoolean("OnlyOres"); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -86,7 +102,9 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR drops.addAll(block.getDrops(worldObj, pos, worldObj.getBlockState(pos), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ - worldObj.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(meta << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + worldObj.playAuxSFX(2001, pos, Block.getStateId(worldObj.getBlockState(pos))); + } worldObj.setBlockToAir(pos); WorldUtil.addToInventory(this, drops, true, true); @@ -134,6 +152,12 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR return false; } + private void shootParticles(int endX, int endY, int endZ){ + if(!ConfigValues.lessParticles){ + PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96)); + } + } + private boolean isBlacklisted(Block block){ String reg = block.getRegistryName(); if(reg != null && !reg.isEmpty()){ @@ -146,24 +170,9 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR return false; } - private void shootParticles(int endX, int endY, int endZ){ - PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96)); - } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - this.storage.writeToNBT(compound); - compound.setInteger("Layer", this.layerAt); - compound.setBoolean("OnlyOres", this.onlyMineOres); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - this.layerAt = compound.getInteger("Layer"); - this.onlyMineOres = compound.getBoolean("OnlyOres"); + public boolean isItemValidForSlot(int slot, ItemStack stack){ + return false; } @Override @@ -196,11 +205,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR return true; } - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ - return false; - } - @Override public void onButtonPressed(int buttonID, EntityPlayer player){ if(buttonID == 0){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index bb2eb5f00..8f6806283 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyProvider; -import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.item.ItemStack; @@ -52,6 +52,22 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I return this.currentBurnTime*i/BURN_TIME; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("BurnTime", this.currentBurnTime); + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + super.writeSyncableNBT(compound, sync); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.currentBurnTime = compound.getInteger("BurnTime"); + this.storage.readFromNBT(compound); + this.tank.readFromNBT(compound); + super.readSyncableNBT(compound, sync); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -72,7 +88,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I } } - WorldUtil.emptyBucket(tank, slots, 0, 1, InitBlocks.fluidOil); + WorldUtil.emptyBucket(tank, slots, 0, 1, InitFluids.fluidOil); if(this.storage.getEnergyStored() > 0){ WorldUtil.pushEnergyToAllSides(worldObj, this.pos, this.storage); @@ -100,19 +116,8 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - compound.setInteger("BurnTime", this.currentBurnTime); - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - super.writeSyncableNBT(compound, sync); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.currentBurnTime = compound.getInteger("BurnTime"); - this.storage.readFromNBT(compound); - this.tank.readFromNBT(compound); - super.readSyncableNBT(compound, sync); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0; } @Override @@ -120,11 +125,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot == 1; @@ -152,7 +152,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I @Override public int fill(EnumFacing from, FluidStack resource, boolean doFill){ - if(resource.getFluid() == InitBlocks.fluidOil){ + if(resource.getFluid() == InitFluids.fluidOil){ return this.tank.fill(resource, doFill); } return 0; @@ -170,7 +170,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I @Override public boolean canFill(EnumFacing from, Fluid fluid){ - return from != EnumFacing.DOWN && fluid == InitBlocks.fluidOil; + return from != EnumFacing.DOWN && fluid == InitFluids.fluidOil; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java index fd8a5541f..f2307db89 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomItemface.java @@ -16,7 +16,9 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.capabilities.Capability; +//TODO completely adapt to new item system? public class TileEntityPhantomItemface extends TileEntityPhantomface{ public TileEntityPhantomItemface(){ @@ -46,6 +48,13 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{ return this.isBoundThingInRange() ? this.getInventory().getInventoryStackLimit() : 0; } + @Override + public void clear(){ + if(this.isBoundThingInRange()){ + this.getInventory().clear(); + } + } + @Override public void setInventorySlotContents(int i, ItemStack stack){ if(this.isBoundThingInRange()){ @@ -70,13 +79,16 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{ } @Override - public String getName(){ - return this.name; + public ItemStack removeStackFromSlot(int index){ + if(this.isBoundThingInRange()){ + return this.getInventory().removeStackFromSlot(index); + } + return null; } @Override - public boolean isBoundThingInRange(){ - return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory; + public String getName(){ + return this.name; } public ISidedInventory getSided(){ @@ -94,13 +106,14 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{ } @Override - public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ - return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side)); - } - - @Override - public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ - return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side)); + public T getCapability(Capability capability, EnumFacing facing){ + if(this.isBoundThingInRange()){ + TileEntity tile = worldObj.getTileEntity(this.boundPosition); + if(tile != null){ + return tile.getCapability(capability, facing); + } + } + return super.getCapability(capability, facing); } @Override @@ -109,17 +122,17 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{ } @Override - public ItemStack removeStackFromSlot(int index){ - if(this.isBoundThingInRange()){ - return this.getInventory().removeStackFromSlot(index); - } - return null; + public boolean isBoundThingInRange(){ + return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory; } @Override - public void clear(){ - if(this.isBoundThingInRange()){ - this.getInventory().clear(); - } + public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ + return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side)); + } + + @Override + public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ + return this.isBoundThingInRange() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 272764edc..07bc698f8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.network.PacketParticle; import de.ellpeck.actuallyadditions.mod.util.PosUtil; @@ -47,6 +48,30 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements this.isBreaker = false; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("Range", this.range); + if(this.boundPosition != null){ + compound.setInteger("XCoordOfTileStored", boundPosition.getX()); + compound.setInteger("YCoordOfTileStored", boundPosition.getY()); + compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); + } + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + int x = compound.getInteger("XCoordOfTileStored"); + int y = compound.getInteger("YCoordOfTileStored"); + int z = compound.getInteger("ZCoordOfTileStored"); + this.range = compound.getInteger("Range"); + if(!(x == 0 && y == 0 && z == 0)){ + this.boundPosition = new BlockPos(x, y, z); + this.markDirty(); + } + } + @Override public void updateEntity(){ super.updateEntity(); @@ -101,11 +126,12 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements Block blockToBreak = PosUtil.getBlock(boundPosition, worldObj); if(blockToBreak != null && blockToBreak.getBlockHardness(worldObj, boundPosition) > -1.0F){ ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(boundPosition, worldObj); drops.addAll(blockToBreak.getDrops(worldObj, boundPosition, worldObj.getBlockState(boundPosition), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ - worldObj.playAuxSFX(2001, this.boundPosition, Block.getIdFromBlock(blockToBreak)+(meta << 12)); + if(!ConfigValues.lessBlockBreakingEffects){ + worldObj.playAuxSFX(2001, this.boundPosition, Block.getStateId(worldObj.getBlockState(this.boundPosition))); + } worldObj.setBlockToAir(this.boundPosition); WorldUtil.addToInventory(this, drops, true, true); this.markDirty(); @@ -113,12 +139,10 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } } else{ - if(PosUtil.getBlock(boundPosition, worldObj).isReplaceable(worldObj, boundPosition)){ - int theSlot = WorldUtil.findFirstFilledSlot(this.slots); - this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(EnumFacing.UP, worldObj, boundPosition, this.slots[theSlot])); - if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0){ - this.slots[theSlot] = null; - } + int theSlot = WorldUtil.findFirstFilledSlot(this.slots); + this.setInventorySlotContents(theSlot, WorldUtil.useItemAtSide(EnumFacing.UP, worldObj, boundPosition, this.slots[theSlot])); + if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0){ + this.slots[theSlot] = null; } } } @@ -168,27 +192,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("Range", this.range); - if(this.boundPosition != null){ - compound.setInteger("XCoordOfTileStored", boundPosition.getX()); - compound.setInteger("YCoordOfTileStored", boundPosition.getY()); - compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); - } - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - int x = compound.getInteger("XCoordOfTileStored"); - int y = compound.getInteger("YCoordOfTileStored"); - int z = compound.getInteger("ZCoordOfTileStored"); - this.range = compound.getInteger("Range"); - if(!(x == 0 && y == 0 && z == 0)){ - this.boundPosition = new BlockPos(x, y, z); - this.markDirty(); - } + public boolean isItemValidForSlot(int i, ItemStack stack){ + return !this.isBreaker; } @Override @@ -196,11 +201,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return !this.isBreaker; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return this.isBreaker; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index d93fc32c0..5950f7ab0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -23,6 +23,9 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityDispatcher; +import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -37,8 +40,50 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP private BlockPos boundPosBefore; private Block boundBlockBefore; + private CapabilityDispatcher capabilities; + public TileEntityPhantomface(String name){ super(0, name); + + this.capabilities = ForgeEventFactory.gatherCapabilities(this); + } + + public static int upgradeRange(int defaultRange, World world, BlockPos pos){ + int newRange = defaultRange; + for(int i = 0; i < 3; i++){ + Block block = PosUtil.getBlock(PosUtil.offset(pos, 0, 1+i, 0), world); + if(block == InitBlocks.blockPhantomBooster){ + newRange = newRange*2; + } + else{ + break; + } + } + return newRange; + } + + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("Range", this.range); + if(this.boundPosition != null){ + compound.setInteger("XCoordOfTileStored", boundPosition.getX()); + compound.setInteger("YCoordOfTileStored", boundPosition.getY()); + compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); + } + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + int x = compound.getInteger("XCoordOfTileStored"); + int y = compound.getInteger("YCoordOfTileStored"); + int z = compound.getInteger("ZCoordOfTileStored"); + this.range = compound.getInteger("Range"); + if(!(x == 0 && y == 0 && z == 0)){ + this.boundPosition = new BlockPos(x, y, z); + this.markDirty(); + } } @Override @@ -74,41 +119,13 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("Range", this.range); - if(this.boundPosition != null){ - compound.setInteger("XCoordOfTileStored", boundPosition.getX()); - compound.setInteger("YCoordOfTileStored", boundPosition.getY()); - compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); - } + public T getCapability(Capability capability, EnumFacing facing){ + return this.capabilities.getCapability(capability, facing); } @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - int x = compound.getInteger("XCoordOfTileStored"); - int y = compound.getInteger("YCoordOfTileStored"); - int z = compound.getInteger("ZCoordOfTileStored"); - this.range = compound.getInteger("Range"); - if(!(x == 0 && y == 0 && z == 0)){ - this.boundPosition = new BlockPos(x, y, z); - this.markDirty(); - } - } - - public static int upgradeRange(int defaultRange, World world, BlockPos pos){ - int newRange = defaultRange; - for(int i = 0; i < 3; i++){ - Block block = PosUtil.getBlock(PosUtil.offset(pos, 0, 1+i, 0), world); - if(block == InitBlocks.blockPhantomBooster){ - newRange = newRange*2; - } - else{ - break; - } - } - return newRange; + public boolean isItemValidForSlot(int slot, ItemStack stack){ + return false; } @Override @@ -176,9 +193,4 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return false; } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ - return false; - } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index 3ded41dec..bad0d1d95 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -32,6 +32,18 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement super(18, "rangedCollector"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setBoolean("Whitelist", this.isWhitelist); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.isWhitelist = compound.getBoolean("Whitelist"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ @@ -74,15 +86,8 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setBoolean("Whitelist", this.isWhitelist); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.isWhitelist = compound.getBoolean("Whitelist"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return false; } @Override @@ -90,11 +95,6 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return false; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return slot < WHITELIST_START; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java index e3569d266..db120168a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java @@ -27,17 +27,6 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac public int flyHeight; private String nameBefore; - @Override - public void updateEntity(){ - super.updateEntity(); - if(!worldObj.isRemote){ - if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){ - this.nameBefore = this.name; - this.markDirty(); - } - } - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ super.writeSyncableNBT(compound, sync); @@ -52,6 +41,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac this.name = compound.getString("Name"); } + @Override + public void updateEntity(){ + super.updateEntity(); + if(!worldObj.isRemote){ + if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){ + this.nameBefore = this.name; + this.markDirty(); + } + } + } + @Override public void onTextReceived(String text, int textID, EntityPlayer player){ this.name = text; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java index 8561761f6..bc1617e78 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityXPSolidifier.java @@ -29,6 +29,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I super(1, "xpSolidifier"); } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setShort("Amount", this.amount); + } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.amount = compound.getShort("Amount"); + } + @Override public void updateEntity(){ super.updateEntity(); @@ -54,15 +66,8 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setShort("Amount", this.amount); - } - - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.amount = compound.getShort("Amount"); + public boolean isItemValidForSlot(int i, ItemStack stack){ + return false; } @Override @@ -70,11 +75,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I return this.isItemValidForSlot(slot, stack); } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return false; - } - @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return true; @@ -96,6 +96,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } //TODO Fix XP System to fit points needed in 1.8 (OpenBlocks?) + /** * Gets the Player's XP * (Excerpted from OpenBlocks' XP system with permission, thanks guys!) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java index 75cab1a33..cf2d896ab 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateChecker.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util; public class UpdateChecker{ - public static final String DOWNLOAD_LINK = "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files"; + public static final String DOWNLOAD_LINK = "http://ellpeck.de/actadddownload"; public static final String CHANGELOG_LINK = "http://ellpeck.de/actaddchangelog/"; public static boolean checkFailed; public static boolean needsUpdateNotify; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 4b3593340..9babd4f7f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -43,6 +43,11 @@ public class AssetUtil{ font.drawString(localMachineName, xSize/2-font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE); } + @SideOnly(Side.CLIENT) + public static void renderBlockInWorld(Block block, int meta){ + renderItemInWorld(new ItemStack(block, 1, meta)); + } + @SideOnly(Side.CLIENT) public static void renderItemInWorld(ItemStack stack){ GlStateManager.pushMatrix(); @@ -56,11 +61,6 @@ public class AssetUtil{ GlStateManager.popMatrix(); } - @SideOnly(Side.CLIENT) - public static void renderBlockInWorld(Block block, int meta){ - renderItemInWorld(new ItemStack(block, 1, meta)); - } - @SideOnly(Side.CLIENT) public static void renderStackToGui(ItemStack stack, int x, int y, float scale){ GlStateManager.pushMatrix(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java index 78b6a624c..cc0bd4652 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java @@ -32,7 +32,6 @@ public class FluidStateMapper extends StateMapperBase implements ItemMeshDefinit public FluidStateMapper(Fluid fluid){ this.fluid = fluid; - // have each block hold its fluid per nbt? hm this.location = new ModelResourceLocation(new ResourceLocation(ModUtil.MOD_ID_LOWER, "fluids"), fluid.getName()); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java index e62ac4e4f..63ad713fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -54,6 +54,10 @@ public class ItemUtil{ return stack1 != null && stack2 != null && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD))); } + public static boolean areStacksEqualAndSameSize(ItemStack stack1, ItemStack stack2, boolean checkWildcard){ + return areItemsEqual(stack1, stack2, checkWildcard) && stack1.stackSize == stack2.stackSize; + } + /** * Returns true if list contains stack or if both contain null */ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ModUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ModUtil.java index ddc3cce50..0f052f5e3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ModUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ModUtil.java @@ -17,6 +17,7 @@ import org.apache.logging.log4j.Logger; import java.util.Locale; public class ModUtil{ + public static final String VERSION = "@VERSION@"; //build.gradle public static final String MOD_ID = ActuallyAdditionsAPI.MOD_ID; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java index 2e97727b4..cf56f862d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java @@ -22,6 +22,10 @@ import net.minecraft.world.World; public class PosUtil{ + public static Material getMaterial(BlockPos pos, IBlockAccess world){ + return getBlock(pos, world).getMaterial(); + } + public static Block getBlock(BlockPos pos, IBlockAccess world){ if(pos != null){ IBlockState state = world.getBlockState(pos); @@ -32,10 +36,6 @@ public class PosUtil{ return null; } - public static Material getMaterial(BlockPos pos, IBlockAccess world){ - return getBlock(pos, world).getMaterial(); - } - public static int getMetadata(BlockPos pos, IBlockAccess world){ return getBlock(pos, world).getMetaFromState(world.getBlockState(pos)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index 17cc3c5d8..a0a47372c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.util; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -53,7 +54,7 @@ public class WorldUtil{ public static BlockPos getCoordsFromSide(EnumFacing side, BlockPos pos, int offset){ return new BlockPos(pos.getX()+side.getFrontOffsetX()*(offset+1), pos.getY()+side.getFrontOffsetY()*(offset+1), pos.getZ()+side.getFrontOffsetZ()*(offset+1)); } - + public static void pushEnergyToAllSides(World world, BlockPos pos, EnergyStorage storage){ pushEnergy(world, pos, EnumFacing.UP, storage); pushEnergy(world, pos, EnumFacing.DOWN, storage); @@ -109,43 +110,45 @@ public class WorldUtil{ } } - public static ItemStack placeBlockAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack){ + public static ItemStack useItemAtSide(EnumFacing side, World world, BlockPos pos, ItemStack stack){ if(world instanceof WorldServer && stack != null && stack.getItem() != null){ BlockPos offsetPos = pos.offset(side); + Block block = PosUtil.getBlock(offsetPos, world); + boolean replaceable = block.isReplaceable(world, offsetPos); //Fluids - FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack); - if(fluid != null && fluid.getFluid().getBlock() != null && fluid.getFluid().getBlock().canPlaceBlockAt(world, offsetPos)){ - Block block = PosUtil.getBlock(offsetPos, world); - if(!(block instanceof IFluidBlock) && block != Blocks.lava && block != Blocks.water && block != Blocks.flowing_lava && block != Blocks.flowing_water){ - if(PosUtil.setBlock(pos, world, fluid.getFluid().getBlock(), 0, 2)){ + if(replaceable && FluidContainerRegistry.isFilledContainer(stack) && !(block instanceof IFluidBlock) && !(block instanceof BlockLiquid)){ + FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack); + if(fluid != null && fluid.getFluid().getBlock() != null && fluid.getFluid().getBlock().canPlaceBlockAt(world, offsetPos)){ + if(PosUtil.setBlock(offsetPos, world, fluid.getFluid().getBlock(), 0, 2)){ return stack.getItem().getContainerItem(stack); } } } //Redstone - else if(stack.getItem() == Items.redstone){ - PosUtil.setBlock(pos, world, Blocks.redstone_wire, 0, 2); + else if(replaceable && stack.getItem() == Items.redstone){ + PosUtil.setBlock(offsetPos, world, Blocks.redstone_wire, 0, 2); stack.stackSize--; } //Plants - else if(stack.getItem() instanceof IPlantable){ + else if(replaceable && stack.getItem() instanceof IPlantable){ if(((IPlantable)stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)){ if(world.setBlockState(offsetPos, ((IPlantable)stack.getItem()).getPlant(world, offsetPos), 2)){ stack.stackSize--; } } } + + //Everything else else{ try{ - //Blocks - stack.onItemUse(FakePlayerUtil.getFakePlayer(world), world, pos, side, 0, 0, 0); + stack.onItemUse(FakePlayerUtil.getFakePlayer(world), world, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); return stack; } catch(Exception e){ - ModUtil.LOGGER.error("Something that places Blocks at "+offsetPos.getX()+", "+offsetPos.getY()+", "+offsetPos.getZ()+" in World "+world.provider.getDimensionId()+" threw an Exception! Don't let that happen again!"); + ModUtil.LOGGER.error("Something that places Blocks at "+offsetPos.getX()+", "+offsetPos.getY()+", "+offsetPos.getZ()+" in World "+world.provider.getDimensionId()+" threw an Exception! Don't let that happen again!", e); } } } @@ -243,6 +246,16 @@ public class WorldUtil{ return blocks; } + //TODO make this work for the stupid new item system + + public static boolean addToInventory(IInventory inventory, ArrayList stacks, boolean actuallyDo, boolean shouldAlwaysWork){ + return addToInventory(inventory, stacks, EnumFacing.UP, actuallyDo, shouldAlwaysWork); + } + + public static boolean addToInventory(IInventory inventory, ArrayList stacks, EnumFacing side, boolean actuallyDo, boolean shouldAlwaysWork){ + return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork); + } + /** * Add an ArrayList of ItemStacks to an Array of slots * @@ -295,14 +308,6 @@ public class WorldUtil{ return working >= stacks.size(); } - public static boolean addToInventory(IInventory inventory, ArrayList stacks, boolean actuallyDo, boolean shouldAlwaysWork){ - return addToInventory(inventory, stacks, EnumFacing.UP, actuallyDo, shouldAlwaysWork); - } - - public static boolean addToInventory(IInventory inventory, ArrayList stacks, EnumFacing side, boolean actuallyDo, boolean shouldAlwaysWork){ - return addToInventory(inventory, 0, inventory.getSizeInventory(), stacks, side, actuallyDo, shouldAlwaysWork); - } - public static int findFirstFilledSlot(ItemStack[] slots){ for(int i = 0; i < slots.length; i++){ if(slots[i] != null){ @@ -317,20 +322,19 @@ public class WorldUtil{ } private static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance, boolean p1, boolean p2, boolean p3){ - float f = 1.0F; - float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*f; - float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*f; - double d0 = player.prevPosX+(player.posX-player.prevPosX)*(double)f; - double d1 = player.prevPosY+(player.posY-player.prevPosY)*(double)f+(double)(world.isRemote ? player.getEyeHeight()-player.getDefaultEyeHeight() : player.getEyeHeight()); - double d2 = player.prevPosZ+(player.posZ-player.prevPosZ)*(double)f; + float f = player.rotationPitch; + float f1 = player.rotationYaw; + double d0 = player.posX; + double d1 = player.posY+(double)player.getEyeHeight(); + double d2 = player.posZ; Vec3 vec3 = new Vec3(d0, d1, d2); - float f3 = MathHelper.cos(-f2*0.017453292F-(float)Math.PI); - float f4 = MathHelper.sin(-f2*0.017453292F-(float)Math.PI); - float f5 = -MathHelper.cos(-f1*0.017453292F); - float f6 = MathHelper.sin(-f1*0.017453292F); - float f7 = f4*f5; - float f8 = f3*f5; - Vec3 vec31 = vec3.addVector((double)f7*distance, (double)f6*distance, (double)f8*distance); + float f2 = MathHelper.cos(-f1*0.017453292F-(float)Math.PI); + float f3 = MathHelper.sin(-f1*0.017453292F-(float)Math.PI); + float f4 = -MathHelper.cos(-f*0.017453292F); + float f5 = MathHelper.sin(-f*0.017453292F); + float f6 = f3*f4; + float f7 = f2*f4; + Vec3 vec31 = vec3.addVector((double)f6*distance, (double)f5*distance, (double)f7*distance); return world.rayTraceBlocks(vec3, vec31, p1, p2, p3); } @@ -367,7 +371,7 @@ public class WorldUtil{ } else{ //Shows the Harvest Particles and plays the Block's Sound - world.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(meta << 12)); + world.playAuxSFX(2001, pos, Block.getStateId(state)); } //If the Block was actually "removed", meaning it will drop an Item diff --git a/src/main/resources/assets/actuallyadditions/lang/de_DE.lang b/src/main/resources/assets/actuallyadditions/lang/de_DE.lang index ae56c8e0d..3fe156d93 100644 --- a/src/main/resources/assets/actuallyadditions/lang/de_DE.lang +++ b/src/main/resources/assets/actuallyadditions/lang/de_DE.lang @@ -18,7 +18,6 @@ container.nei.actuallyadditions.treasureChest.info=Gegenstände zu container.nei.actuallyadditions.coffee.name=Kaffeemaschine container.nei.actuallyadditions.coffee.special=Spezialfunktion container.nei.actuallyadditions.coffee.maxAmount=Maximale Menge -container.nei.actuallyadditions.coffee.shift=[UMSCHALT]! container.nei.actuallyadditions.coffee.extra.milk=+01:00, -1 Level container.nei.actuallyadditions.reconstructor.name=Atomarer Umwandler @@ -117,7 +116,6 @@ tile.actuallyadditions.blockMiscIronCasing.name=Eisengehäuse tile.actuallyadditions.blockBlackLotus.name=Schwarze Lotos tile.actuallyadditions.blockTestifiBucksWhiteFence.name=Ethetische Quarz Wand tile.actuallyadditions.blockTestifiBucksGreenFence.name=Ethetische Grüne Wand -tile.actuallyadditions.blockAtomicReconstructor.name=Atomarer Umwandler tile.actuallyadditions.blockCrystalRed.name=Restonia Kristallblock tile.actuallyadditions.blockCrystalBlue.name=Palis Kristallblock tile.actuallyadditions.blockCrystalLightBlue.name=Diamatin Kristallblock @@ -156,6 +154,37 @@ tile.actuallyadditions.blockInputter.add.13.name=Eingelaugtes Salz-Gebäck tile.actuallyadditions.blockInputter.add.14.name=Eierlegendes Schreck-Gebilde tile.actuallyadditions.blockInputter.add.15.name=Exzellentes Spaghetti-Gericht +#Reconstructor / Umwandler + tile.actuallyadditions.blockAtomicReconstructor.name=Atomarer Umwandler + + tile.actuallyadditions.blockAtomicReconstructor.info.1.1=Molekular + tile.actuallyadditions.blockAtomicReconstructor.info.1.2=Materiell + tile.actuallyadditions.blockAtomicReconstructor.info.1.3=Quarkal + tile.actuallyadditions.blockAtomicReconstructor.info.1.4=Atomar + tile.actuallyadditions.blockAtomicReconstructor.info.1.5=Kleines Bisschen + tile.actuallyadditions.blockAtomicReconstructor.info.1.6=Komponente + tile.actuallyadditions.blockAtomicReconstructor.info.1.7=Vittell + tile.actuallyadditions.blockAtomicReconstructor.info.1.8=Transmateriell + tile.actuallyadditions.blockAtomicReconstructor.info.1.9=Partiell + tile.actuallyadditions.blockAtomicReconstructor.info.1.10=Räumlich + tile.actuallyadditions.blockAtomicReconstructor.info.1.11=Stickig + tile.actuallyadditions.blockAtomicReconstructor.info.1.12=Interdimensional + + tile.actuallyadditions.blockAtomicReconstructor.info.2.1=Vermischer + tile.actuallyadditions.blockAtomicReconstructor.info.2.2=Verschieber + tile.actuallyadditions.blockAtomicReconstructor.info.2.3=Rekombinierer + tile.actuallyadditions.blockAtomicReconstructor.info.2.4=Modulator + tile.actuallyadditions.blockAtomicReconstructor.info.2.5=Molekülisator + tile.actuallyadditions.blockAtomicReconstructor.info.2.6=Modifikulisator + tile.actuallyadditions.blockAtomicReconstructor.info.2.7=Veränderer + tile.actuallyadditions.blockAtomicReconstructor.info.2.8=Atomisierer + tile.actuallyadditions.blockAtomicReconstructor.info.2.9=Zerhacker + tile.actuallyadditions.blockAtomicReconstructor.info.2.10=Swapper + tile.actuallyadditions.blockAtomicReconstructor.info.2.11=Vertauscher + tile.actuallyadditions.blockAtomicReconstructor.info.2.12=Austauscher + tile.actuallyadditions.blockAtomicReconstructor.info.2.13=Differenzierer + tile.actuallyadditions.blockAtomicReconstructor.info.2.14=Empfänger + #Items / Gegenstände item.actuallyadditions.itemDrill.name=Bohrer item.actuallyadditions.itemFoodRice.name=Reis @@ -397,6 +426,8 @@ tooltip.actuallyadditions.oredictName.desc=OreDictionary-Einträge tooltip.actuallyadditions.noOredictNameAvail.desc=Keine tooltip.actuallyadditions.codeName.desc=Codename tooltip.actuallyadditions.baseUnlocName.desc=Unlokalisierter Name des Gegenstands +tooltip.actuallyadditions.meta.desc=Metadaten +tooltip.actuallyadditions.nbt.desc=NBT-Daten tooltip.actuallyadditions.unlocName.desc=Unlokalisierter Name der Meta tooltip.actuallyadditions.disablingInfo.desc=Wenn du diese Informationen nicht sehen möchtest, deaktiviere sie in den Actually Additions-Einstellungen! tooltip.actuallyadditions.ctrlForMoreInfo.desc=Drücke STRG für weitere Informationen diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 4aa2e9db2..d999bd5b1 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -116,7 +116,6 @@ tile.actuallyadditions.blockMiscIronCasing.name=Iron Casing tile.actuallyadditions.blockBlackLotus.name=Black Lotus tile.actuallyadditions.blockTestifiBucksWhiteFence.name=Ethetic Quartz Wall tile.actuallyadditions.blockTestifiBucksGreenFence.name=Ethetic Green Wall -tile.actuallyadditions.blockAtomicReconstructor.name=Atomic Reconstructor tile.actuallyadditions.blockCrystalRed.name=Restonia Crystal Block tile.actuallyadditions.blockCrystalBlue.name=Palis Crystal Block tile.actuallyadditions.blockCrystalLightBlue.name=Diamatine Crystal Block @@ -154,6 +153,37 @@ tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger tile.actuallyadditions.blockInputter.add.15.name=Ending Serious Daughter +#Reconstructor +tile.actuallyadditions.blockAtomicReconstructor.name=Atomic Reconstructor + +tile.actuallyadditions.blockAtomicReconstructor.info.1.1=Molecular +tile.actuallyadditions.blockAtomicReconstructor.info.1.2=Material +tile.actuallyadditions.blockAtomicReconstructor.info.1.3=Quarkal +tile.actuallyadditions.blockAtomicReconstructor.info.1.4=Atomatic +tile.actuallyadditions.blockAtomicReconstructor.info.1.5=Tiny Bit +tile.actuallyadditions.blockAtomicReconstructor.info.1.6=Component +tile.actuallyadditions.blockAtomicReconstructor.info.1.7=Vittle +tile.actuallyadditions.blockAtomicReconstructor.info.1.8=Transmaterial +tile.actuallyadditions.blockAtomicReconstructor.info.1.9=Partial +tile.actuallyadditions.blockAtomicReconstructor.info.1.10=Spatial +tile.actuallyadditions.blockAtomicReconstructor.info.1.11=Stuffy +tile.actuallyadditions.blockAtomicReconstructor.info.1.12=Interdimensional + +tile.actuallyadditions.blockAtomicReconstructor.info.2.1=Recombobulizer +tile.actuallyadditions.blockAtomicReconstructor.info.2.2=Shiftulator +tile.actuallyadditions.blockAtomicReconstructor.info.2.3=Recombinator +tile.actuallyadditions.blockAtomicReconstructor.info.2.4=Modulator +tile.actuallyadditions.blockAtomicReconstructor.info.2.5=Moleculizer +tile.actuallyadditions.blockAtomicReconstructor.info.2.6=Modificulator +tile.actuallyadditions.blockAtomicReconstructor.info.2.7=Changer +tile.actuallyadditions.blockAtomicReconstructor.info.2.8=Atomizer +tile.actuallyadditions.blockAtomicReconstructor.info.2.9=Makerator +tile.actuallyadditions.blockAtomicReconstructor.info.2.10=Swapper +tile.actuallyadditions.blockAtomicReconstructor.info.2.11=Exchanger +tile.actuallyadditions.blockAtomicReconstructor.info.2.12=Replacer +tile.actuallyadditions.blockAtomicReconstructor.info.2.13=Differentiator +tile.actuallyadditions.blockAtomicReconstructor.info.2.14=Receiver + #Items item.actuallyadditions.itemDrill.name=Drill item.actuallyadditions.itemFoodRice.name=Rice @@ -395,7 +425,10 @@ tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries tooltip.actuallyadditions.noOredictNameAvail.desc=None tooltip.actuallyadditions.codeName.desc=Code Name tooltip.actuallyadditions.baseUnlocName.desc=Item's Unlocalized Name +tooltip.actuallyadditions.meta.desc=Metadata +tooltip.actuallyadditions.nbt.desc=NBT tooltip.actuallyadditions.unlocName.desc=Meta's Unlocalized Name +tooltip.actuallyadditions.pressShift.desc=Press Shift tooltip.actuallyadditions.disablingInfo.desc=If you don't want this Information to appear, disable it in the Actually Additions Config! tooltip.actuallyadditions.ctrlForMoreInfo.desc=Press CTRL for Advanced Info tooltip.actuallyadditions.extraInfo.desc=Advanced Info diff --git a/src/main/resources/assets/actuallyadditions/models/item/itemCrystalLightBLue.json b/src/main/resources/assets/actuallyadditions/models/item/itemCrystalLightBLue.json index e56c5bf1f..4fc6ee310 100644 --- a/src/main/resources/assets/actuallyadditions/models/item/itemCrystalLightBLue.json +++ b/src/main/resources/assets/actuallyadditions/models/item/itemCrystalLightBLue.json @@ -15,4 +15,4 @@ "scale": [ 1.7, 1.7, 1.7 ] } } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/models/item/itemPotionRIng.json b/src/main/resources/assets/actuallyadditions/models/item/itemPotionRIng.json index 7cf725f15..f680f0012 100644 --- a/src/main/resources/assets/actuallyadditions/models/item/itemPotionRIng.json +++ b/src/main/resources/assets/actuallyadditions/models/item/itemPotionRIng.json @@ -15,4 +15,4 @@ "scale": [ 1.7, 1.7, 1.7 ] } } -} +} \ No newline at end of file diff --git a/update/changelog.md b/update/changelog.md index 08ac19511..8524c2366 100644 --- a/update/changelog.md +++ b/update/changelog.md @@ -1,3 +1,34 @@ +# 1.8.9-r25 +* Fixed assets derping because of wrong capitalization +* Ignore NBT Tags of Energy items in JEI +* Added some fun naming stuff to the Reconstructor that makes it have fun stuffz +* Make the floaty special thingie move more awesome! (xdjackiexd) +* Cheap workaround for glitching into some blocks with a smaller hitbox causing graphical glitches and damanging the player +* Fix Smiley Cloud bounding box +* Fix right-clicking never returned any seeds from plants +* Ignore some Items in JEI +* Fix Coffee Machine bounding box +* Added metadata and NBT to the Control Info for ItemStacks +* Added performance settings for bad PCs +* Remove NEI Recipe Handlers until it gets properly updated +* Rebalanced canola oil +* Made a placer be able to apply bonemeal and do other awesome stuff +* Fixed compost and reconstructor syncing with hoppers going wrong +* Updated stuff for the new item system [This is not important for you if you don't make mods!] + +# 1.8.9-r24 +* Fixed texture names of quartz tools (ssblur) +* Added right-click harvest functionality to all crops. (ssblur) +* Made word count reload when reloading resources +* Fixed Lenses not syncing correctly on the server when converting items +* JEI Implementation for booklet, crusher, coffee machine and reconstructor +* Fixed the drill's 3x3 and 5x5 ming acting weird on servers +* red mushroom -> nether wart in Reconstructor +* Custom packet handler for 98.7% less stack traces when joining worlds +* [API] Removed INEIRecipeHandler +* [API] Removed IHudDisplay +* [API] Removed IEnergyDisplay + # 1.8.9-r23 * Fixed a ginormous bug that screwed over crafting #### DON'T EXPECT EVERYTHING TO WORK PERFECTLY. Seriously, I break lots of stuff probably. diff --git a/update/updateVersions.properties b/update/updateVersions.properties index 9d48179ec..f00da2961 100644 --- a/update/updateVersions.properties +++ b/update/updateVersions.properties @@ -1,2 +1,2 @@ 1.7.10=21 -1.8.9=23 +1.8.9=25