From 22076b631c560c658e4508aa4fe8adf8e3c92ce0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 27 May 2015 21:57:53 +0200 Subject: [PATCH] Update Checker Changes! --- .../blocks/BlockPhantomface.java | 27 +- .../actuallyadditions/blocks/InitBlocks.java | 16 +- .../config/values/ConfigIntValues.java | 5 +- .../crafting/BlockCrafting.java | 2 +- .../creative/CreativeTab.java | 6 +- .../actuallyadditions/items/ItemBucketAA.java | 7 +- .../items/ItemPhantomConnector.java | 2 +- .../tile/TileEntityBase.java | 3 +- .../tile/TileEntityBreaker.java | 2 +- .../tile/TileEntityInventoryBase.java | 11 +- .../tile/TileEntityPhantomPlacer.java | 5 +- .../tile/TileEntityPhantomface.java | 304 ++++++++++++------ .../update/UpdateChecker.java | 18 +- .../actuallyadditions/util/WorldUtil.java | 12 + .../waila/WailaDataProvider.java | 35 +- .../assets/actuallyadditions/lang/en_US.lang | 13 +- .../blocks/models/special/modelEllpeck.png | Bin 718 -> 1076 bytes update/changelog | 1 + newestVersion.txt => update/newestVersion.txt | 0 19 files changed, 291 insertions(+), 178 deletions(-) create mode 100644 update/changelog rename newestVersion.txt => update/newestVersion.txt (100%) diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java index f04cf625c..b80007aed 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java @@ -29,6 +29,8 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte public static final int FACE = 0; public static final int PLACER = 1; public static final int BREAKER = 2; + public static final int LIQUIFACE = 3; + public static final int ENERGYFACE = 4; public int type; @@ -59,9 +61,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte if(tile instanceof TileEntityPhantomface){ TileEntityPhantomface phantom = (TileEntityPhantomface)tile; if(phantom.hasBoundTile()){ - if(phantom.isBoundTileInRage()){ - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord))); - } + if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord))); else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord))); } else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"))); @@ -71,9 +71,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte if(player.isSneaking()){ TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile; if(phantom.hasBoundPosition()){ - if(phantom.isBoundPositionInRange()){ - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ))); - } + if(phantom.isBoundPositionInRange()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ))); else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ))); } else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"))); @@ -92,8 +90,10 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte return new TileEntityPhantomPlacer(); case BREAKER: return new TileEntityPhantomPlacer.TileEntityPhantomBreaker(); + case LIQUIFACE: + return new TileEntityPhantomface.TileEntityPhantomLiquiface(); default: - return new TileEntityPhantomface(); + return new TileEntityPhantomface.TileEntityPhantomItemface(); } } @@ -110,7 +110,16 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte @Override public String getName(){ - return this.type == PLACER ? "blockPhantomPlacer" : (this.type == BREAKER ? "blockPhantomBreaker" : "blockPhantomface"); + switch(this.type){ + case PLACER: + return "blockPhantomPlacer"; + case BREAKER: + return "blockPhantomBreaker"; + case LIQUIFACE: + return "blockPhantomLiquiface"; + default: + return "blockPhantomface"; + } } public static class TheItemBlock extends ItemBlock{ @@ -146,4 +155,4 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte return damage; } } -} +} \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 3423e75f8..5778cb376 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -46,8 +46,9 @@ public class InitBlocks{ public static Block blockOilGenerator; public static Block blockPhantomface; - //public static Block blockPhantomPlacer; - //public static Block blockPhantomBreaker; + public static Block blockPhantomPlacer; + public static Block blockPhantomBreaker; + public static Block blockPhantomLiquiface; public static void init(){ Util.logInfo("Initializing Blocks..."); @@ -68,11 +69,14 @@ public class InitBlocks{ blockPhantomface = new BlockPhantomface(BlockPhantomface.FACE); BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class); - //blockPhantomPlacer = new BlockPhantomface(BlockPhantomface.PLACER); - //BlockUtil.register(blockPhantomPlacer, BlockPhantomface.TheItemBlock.class); + blockPhantomPlacer = new BlockPhantomface(BlockPhantomface.PLACER); + BlockUtil.register(blockPhantomPlacer, BlockPhantomface.TheItemBlock.class); - //blockPhantomBreaker = new BlockPhantomface(BlockPhantomface.BREAKER); - //BlockUtil.register(blockPhantomBreaker, BlockPhantomface.TheItemBlock.class); + blockPhantomLiquiface = new BlockPhantomface(BlockPhantomface.LIQUIFACE); + BlockUtil.register(blockPhantomLiquiface, BlockPhantomface.TheItemBlock.class); + + blockPhantomBreaker = new BlockPhantomface(BlockPhantomface.BREAKER); + BlockUtil.register(blockPhantomBreaker, BlockPhantomface.TheItemBlock.class); blockCoalGenerator = new BlockCoalGenerator(); BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class); diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index f4ad51d58..ccbae20e9 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -72,7 +72,10 @@ public enum ConfigIntValues{ OIL_GEN_ENERGY_PRODUCED("Oil Generator: Energy Produced", ConfigCategories.MACHINE_VALUES, 76, 1, 500, "The Amount of Energy generated by the Oil Generator"), OIL_GEN_FUEL_USED("Oil Generator: Fuel Usage", ConfigCategories.MACHINE_VALUES, 50, 1, 300, "The Amount of Fuel used per Burnup in the Oil Generator"), - OIL_GEN_BURN_TIME("Oil Generator: Burn Time", ConfigCategories.MACHINE_VALUES, 100, 1, 1000, "The Amount of Time Fuel keeps burning for"); + OIL_GEN_BURN_TIME("Oil Generator: Burn Time", ConfigCategories.MACHINE_VALUES, 100, 1, 1000, "The Amount of Time Fuel keeps burning for"), + + PHANTOM_PLACER_TIME("Phantom Placer and Breaker: Time Needed", ConfigCategories.MACHINE_VALUES, 30, 1, 500, "The Amount of Time a Phantom Placer/Breaker needs"), + PHANTOM_PLACER_RANGE("Phantom Placer and Breaker: Range", ConfigCategories.MACHINE_VALUES, 3, 1, 100, "The Default Range of the Phantom Placer/Breaker"); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index 96d7aaca5..e09415721 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -216,7 +216,7 @@ public class BlockCrafting{ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass), "GSG", "SDS", "GSG", 'G', "blockGlass", - 'D', "blockDiamond", + 'D', "gemDiamond", 'S', "treeSapling")); //Placer diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index 91dd6468e..35f03012a 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -27,8 +27,8 @@ public class CreativeTab extends CreativeTabs{ this.list = list; this.addBlock(InitBlocks.blockPhantomface); - //this.addBlock(InitBlocks.blockPhantomPlacer); - //this.addBlock(InitBlocks.blockPhantomBreaker); + this.addBlock(InitBlocks.blockPhantomPlacer); + this.addBlock(InitBlocks.blockPhantomBreaker); this.addBlock(InitBlocks.blockInputter); this.addBlock(InitBlocks.blockInputterAdvanced); @@ -92,7 +92,7 @@ public class CreativeTab extends CreativeTabs{ @Override public Item getTabIconItem(){ - return Item.getItemFromBlock(InitBlocks.blockInputter); + return Item.getItemFromBlock(InitBlocks.blockPhantomPlacer); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java b/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java index f753459b1..6c106c564 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemBucketAA.java @@ -10,7 +10,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -24,6 +23,7 @@ public class ItemBucketAA extends ItemBucket implements INameableItem{ public ItemBucketAA(Block block, String unlocName){ super(block); this.name = unlocName; + this.setContainerItem(Items.bucket); } @Override @@ -31,11 +31,6 @@ public class ItemBucketAA extends ItemBucket implements INameableItem{ return EnumRarity.uncommon; } - @Override - public Item getContainerItem(){ - return Items.bucket; - } - @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java index 4fbe46e4e..e69386905 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java @@ -42,7 +42,7 @@ public class ItemPhantomConnector extends Item implements INameableItem{ if(this.checkHasConnection(stack, player)){ ChunkCoordinates coords = this.getStoredPosition(stack); TileEntity toStore = this.getStoredWorld(stack).getTileEntity(coords.posX, coords.posY, coords.posZ); - if(toStore != null){ + if(toStore != null && ((TileEntityPhantomface)tile).canConnectTo(toStore)){ ((TileEntityPhantomface)tile).boundTile = toStore; this.clearStorage(stack); player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc"))); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index dd32a2e02..f5998df14 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -31,7 +31,8 @@ public class TileEntityBase extends TileEntity{ GameRegistry.registerTileEntity(TileEntityFermentingBarrel.class, ModUtil.MOD_ID_LOWER + ":tileEntityFermentingBarrel"); GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator"); GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoalGenerator"); - GameRegistry.registerTileEntity(TileEntityPhantomface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomface"); + GameRegistry.registerTileEntity(TileEntityPhantomface.TileEntityPhantomItemface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomItemface"); + GameRegistry.registerTileEntity(TileEntityPhantomface.TileEntityPhantomLiquiface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomLiquiface"); GameRegistry.registerTileEntity(TileEntityPhantomPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomPlacer"); GameRegistry.registerTileEntity(TileEntityPhantomPlacer.TileEntityPhantomBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBreaker"); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java index d06e178b4..2fb16fca0 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java @@ -118,7 +118,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{ ItemStack slot = slots[i].copy(); if(actuallyDo){ slots[i].stackSize--; - if(slots[i].stackSize <= 0) slots[i] = null; + if(slots[i].stackSize <= 0) slots[i] = slots[i].getItem().getContainerItem(slots[i]); } return slot; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index ad52e7157..23657083e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -134,10 +134,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements @Override public int[] getAccessibleSlotsFromSide(int side){ - int[] theInt = new int[slots.length]; - for(int i = 0; i < theInt.length; i++){ - theInt[i] = i; + if(this.slots.length > 0){ + int[] theInt = new int[slots.length]; + for(int i = 0; i < theInt.length; i++){ + theInt[i] = i; + } + return theInt; } - return theInt; + else return new int[0]; } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java index c570254d8..1ef588601 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.tile; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -26,9 +27,9 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{ public World boundWorld; public int currentTime; - public final int timeNeeded = 30; + public final int timeNeeded = ConfigIntValues.PHANTOM_PLACER_TIME.getValue(); - public final int range = 3; + public final int range = ConfigIntValues.PHANTOM_PLACER_RANGE.getValue(); public boolean isBreaker; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index 881170494..018e0e2f4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -1,5 +1,6 @@ package ellpeck.actuallyadditions.tile; +import ellpeck.actuallyadditions.blocks.BlockPhantomface; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -9,30 +10,26 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; public class TileEntityPhantomface extends TileEntityInventoryBase{ public TileEntity boundTile; + public int type; + public final int range = ConfigIntValues.PHANTOMFACE_RANGE.getValue(); - public TileEntityPhantomface(){ - super(0, "phantomface"); + public TileEntityPhantomface(String name){ + super(0, name); } - @Override - public void updateEntity(){ - if(!worldObj.isRemote){ - if(!this.hasBoundTile()) this.boundTile = null; - - if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){ - this.boundTile = tempWorld.getTileEntity(tempX, tempY, tempZ); - this.tempX = 0; - this.tempY = 0; - this.tempZ = 0; - this.tempWorld = null; - } - } + public boolean canConnectTo(TileEntity tile){ + return false; } public boolean isBoundTileInRage(){ @@ -50,13 +47,37 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ return false; } + @Override + public void updateEntity(){ + if(!worldObj.isRemote){ + + //TODO Remove after some Updating + if(this.type == BlockPhantomface.FACE && this.getClass() != TileEntityPhantomItemface.class){ + ItemStack[] theSlots = this.slots.clone(); + worldObj.removeTileEntity(xCoord, yCoord, zCoord); + worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityPhantomItemface()); + ((TileEntityPhantomItemface)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone(); + } + + if(!this.hasBoundTile()) this.boundTile = null; + + if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){ + this.boundTile = tempWorld.getTileEntity(tempX, tempY, tempZ); + this.tempX = 0; + this.tempY = 0; + this.tempZ = 0; + this.tempWorld = null; + } + } + } + public boolean hasBoundTile(){ if(this.boundTile != null){ if(this.xCoord == this.boundTile.xCoord && this.yCoord == this.boundTile.yCoord && this.zCoord == this.boundTile.zCoord && this.worldObj == this.boundTile.getWorldObj()){ this.boundTile = null; return false; } - return boundTile instanceof IInventory && boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord) == boundTile && boundTile.getWorldObj() == this.worldObj; + return boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord) == boundTile && boundTile.getWorldObj() == this.worldObj; } return false; } @@ -72,10 +93,10 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ } } - private int tempX; - private int tempY; - private int tempZ; - private World tempWorld; + public int tempX; + public int tempY; + public int tempZ; + public World tempWorld; @Override public void readFromNBT(NBTTagCompound compound){ @@ -86,88 +107,177 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ this.tempWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored")); } - public IInventory getInventory(){ - TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord); - if(tile != null && tile instanceof IInventory){ - return (IInventory)tile; - } - return null; - } - - public ISidedInventory getSided(){ - return this.getInventory() instanceof ISidedInventory ? (ISidedInventory)this.getInventory() : null; - } - @Override - public int getInventoryStackLimit(){ - return this.isBoundTileInRage() ? this.getInventory().getInventoryStackLimit() : 0; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player){ + public boolean canInsertItem(int slot, ItemStack stack, int side){ return false; } - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return this.isBoundTileInRage() && this.getInventory().isItemValidForSlot(i, stack); - } - - @Override - public ItemStack getStackInSlotOnClosing(int i){ - return this.isBoundTileInRage() ? this.getInventory().getStackInSlotOnClosing(i) : null; - } - - @Override - public void setInventorySlotContents(int i, ItemStack stack){ - if(this.isBoundTileInRage()) this.getInventory().setInventorySlotContents(i, stack); - this.markDirty(); - } - - @Override - public int getSizeInventory(){ - return this.isBoundTileInRage() ? this.getInventory().getSizeInventory() : 0; - } - - @Override - public ItemStack getStackInSlot(int i){ - return this.isBoundTileInRage() ? this.getInventory().getStackInSlot(i) : null; - } - - @Override - public ItemStack decrStackSize(int i, int j){ - return this.isBoundTileInRage() ? this.getInventory().decrStackSize(i, j) : null; - } - - @Override - public String getInventoryName(){ - return this.name; - } - - @Override - public int[] getAccessibleSlotsFromSide(int side){ - if(this.isBoundTileInRage()){ - if(this.getSided() != null){ - return this.getSided().getAccessibleSlotsFromSide(side); - } - else{ - int[] theInt = new int[this.getSizeInventory()]; - for(int i = 0; i < theInt.length; i++){ - theInt[i] = i; - } - return theInt; - } - } - return new int[0]; - } - - @Override - public boolean canInsertItem(int slot, ItemStack stack, int side){ - return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side)); - } - @Override public boolean canExtractItem(int slot, ItemStack stack, int side){ - return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side)); + return false; + } + + public static class TileEntityPhantomLiquiface extends TileEntityPhantomface implements IFluidHandler{ + + public TileEntityPhantomLiquiface(){ + super("liquiface"); + this.type = BlockPhantomface.LIQUIFACE; + } + + @Override + public boolean canConnectTo(TileEntity tile){ + return tile instanceof IFluidHandler; + } + + public IFluidHandler getHandler(){ + TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord); + if(tile != null && tile instanceof IFluidHandler){ + return (IFluidHandler)tile; + } + return null; + } + + @Override + public boolean hasBoundTile(){ + return super.hasBoundTile() && this.boundTile instanceof IFluidHandler; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ + if(this.isBoundTileInRage()) return this.getHandler().fill(from, resource, doFill); + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ + if(this.isBoundTileInRage()) return this.getHandler().drain(from, resource, doDrain); + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){ + if(this.isBoundTileInRage()) return this.getHandler().drain(from, maxDrain, doDrain); + return null; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid){ + return this.isBoundTileInRage() && this.getHandler().canFill(from, fluid); + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid){ + return this.isBoundTileInRage() && this.getHandler().canDrain(from, fluid); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from){ + if(this.isBoundTileInRage()) return this.getHandler().getTankInfo(from); + return new FluidTankInfo[0]; + } + } + + public static class TileEntityPhantomItemface extends TileEntityPhantomface{ + + public TileEntityPhantomItemface(){ + super("phantomface"); + this.type = BlockPhantomface.FACE; + } + + @Override + public boolean canConnectTo(TileEntity tile){ + return tile instanceof IInventory; + } + + @Override + public boolean hasBoundTile(){ + return super.hasBoundTile() && this.boundTile instanceof IInventory; + } + + public IInventory getInventory(){ + TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord); + if(tile != null && tile instanceof IInventory){ + return (IInventory)tile; + } + return null; + } + + public ISidedInventory getSided(){ + return this.getInventory() instanceof ISidedInventory ? (ISidedInventory)this.getInventory() : null; + } + + @Override + public int getInventoryStackLimit(){ + return this.isBoundTileInRage() ? this.getInventory().getInventoryStackLimit() : 0; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player){ + return false; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack){ + return this.isBoundTileInRage() && this.getInventory().isItemValidForSlot(i, stack); + } + + @Override + public ItemStack getStackInSlotOnClosing(int i){ + return this.isBoundTileInRage() ? this.getInventory().getStackInSlotOnClosing(i) : null; + } + + @Override + public void setInventorySlotContents(int i, ItemStack stack){ + if(this.isBoundTileInRage()) this.getInventory().setInventorySlotContents(i, stack); + this.markDirty(); + } + + @Override + public int getSizeInventory(){ + return this.isBoundTileInRage() ? this.getInventory().getSizeInventory() : 0; + } + + @Override + public ItemStack getStackInSlot(int i){ + return this.isBoundTileInRage() ? this.getInventory().getStackInSlot(i) : null; + } + + @Override + public ItemStack decrStackSize(int i, int j){ + return this.isBoundTileInRage() ? this.getInventory().decrStackSize(i, j) : null; + } + + @Override + public String getInventoryName(){ + return this.name; + } + + @Override + public int[] getAccessibleSlotsFromSide(int side){ + if(this.isBoundTileInRage()){ + if(this.getSided() != null){ + return this.getSided().getAccessibleSlotsFromSide(side); + } + else{ + int[] theInt = new int[this.getSizeInventory()]; + for(int i = 0; i < theInt.length; i++){ + theInt[i] = i; + } + return theInt; + } + } + return new int[0]; + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, int side){ + return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side)); + } + + @Override + public boolean canExtractItem(int slot, ItemStack stack, int side){ + return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side)); + } + } } diff --git a/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java b/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java index 8d96556a1..24c42bbfd 100644 --- a/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java +++ b/src/main/java/ellpeck/actuallyadditions/update/UpdateChecker.java @@ -6,6 +6,7 @@ import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import net.minecraft.util.StatCollector; import org.apache.logging.log4j.Level; @@ -20,6 +21,7 @@ public class UpdateChecker{ public boolean checkFailed = false; public boolean notified = false; public String onlineVersion; + public String changelog; public void init(){ Util.logInfo("Initializing Update Checker..."); @@ -42,9 +44,11 @@ public class UpdateChecker{ String notice1 = "info." + ModUtil.MOD_ID_LOWER + ".update.generic.desc"; String notice2 = "info." + ModUtil.MOD_ID_LOWER + ".update.versionComp.desc"; String notice3 = "info." + ModUtil.MOD_ID_LOWER + ".update.download.desc"; + String notice4 = "info." + ModUtil.MOD_ID_LOWER + ".update.changelog.desc"; player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal(notice1))); player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice2, ModUtil.VERSION, this.onlineVersion))); player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocalFormatted(notice3, "http://minecraft.curseforge.com/mc-mods/228404-actually-additions/files"))); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted(notice4, changelog))); } } @@ -64,10 +68,16 @@ public class UpdateChecker{ public void run(){ Util.logInfo("Starting Update Check..."); try{ - URL url = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/newestVersion.txt"); - BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); - onlineVersion = r.readLine(); - r.close(); + URL newestURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/update/newestVersion.txt"); + BufferedReader newestReader = new BufferedReader(new InputStreamReader(newestURL.openStream())); + onlineVersion = newestReader.readLine(); + newestReader.close(); + + URL changeURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/update/changelog.txt"); + BufferedReader changeReader = new BufferedReader(new InputStreamReader(changeURL.openStream())); + changelog = changeReader.readLine(); + changeReader.close(); + Util.logInfo("Update Check done!"); } catch(Exception e){ diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index c7037353f..4064f30b5 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -10,6 +10,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.IFluidHandler; @@ -55,11 +57,21 @@ public class WorldUtil{ public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){ if(world instanceof WorldServer){ + + //Fluids + FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack); + if(fluid != null && fluid.getFluid().getBlock() != null && fluid.getFluid().getBlock().canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){ + return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, fluid.getFluid().getBlock()); + } + + //Plants if(stack.getItem() instanceof IPlantable){ if(((IPlantable)stack.getItem()).getPlant(world, x, y, z).canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){ return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, ((IPlantable)stack.getItem()).getPlant(world, x, y, z)); } } + + //Blocks return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0); } return false; diff --git a/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java b/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java index 8bf9f5272..0b6e54cff 100644 --- a/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java +++ b/src/main/java/ellpeck/actuallyadditions/waila/WailaDataProvider.java @@ -1,11 +1,7 @@ package ellpeck.actuallyadditions.waila; -import ellpeck.actuallyadditions.blocks.BlockCompost; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; -import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.util.BlockUtil; -import ellpeck.actuallyadditions.util.INameableItem; -import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; @@ -16,7 +12,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import java.util.List; @@ -24,8 +19,6 @@ import java.util.List; @SuppressWarnings("unused") public class WailaDataProvider implements IWailaDataProvider{ - private final String WAILA_PRE_LANG = "gui." + ModUtil.MOD_ID_LOWER + ".waila."; - @Override public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){ return null; @@ -35,7 +28,7 @@ public class WailaDataProvider implements IWailaDataProvider{ public List getWailaHead(ItemStack stack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ if(ConfigBoolValues.DO_WAILA_INFO.isEnabled()){ - if(accessor.getBlock() instanceof INameableItem){ + if(BlockUtil.wailaRegisterList.contains(accessor.getBlock())){ Item.getItemFromBlock(accessor.getBlock()).addInformation(stack, accessor.getPlayer(), currentTip, true); } } @@ -45,32 +38,9 @@ public class WailaDataProvider implements IWailaDataProvider{ @Override public List getWailaBody(ItemStack stack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ - - if(accessor.getTileEntity() instanceof TileEntityCompost){ - this.compostBody(accessor, currentTip); - } - return currentTip; } - public void compostBody(IWailaDataAccessor accessor, List currentTip){ - int meta = accessor.getMetadata(); - TileEntityCompost tile = (TileEntityCompost)accessor.getTileEntity(); - - if(meta <= tile.amountNeededToConvert){ - String tip1 = StatCollector.translateToLocal(WAILA_PRE_LANG + "compostAmount.name") + ": " + meta + "/" + tile.amountNeededToConvert; - currentTip.add(tip1); - - if(meta == tile.amountNeededToConvert){ - currentTip.add(StatCollector.translateToLocal(WAILA_PRE_LANG + "compostConverting.name")); - } - } - - if(meta == tile.amountNeededToConvert+1){ - currentTip.add(StatCollector.translateToLocal(WAILA_PRE_LANG + "compostDone.name")); - } - } - @Override public List getWailaTail(ItemStack stack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ return currentTip; @@ -85,9 +55,6 @@ public class WailaDataProvider implements IWailaDataProvider{ Util.logInfo("Initializing Waila Plugin..."); WailaDataProvider provider = new WailaDataProvider(); - - registrar.registerBodyProvider(provider, BlockCompost.class); - for(Block theBlock : BlockUtil.wailaRegisterList){ registrar.registerHeadProvider(provider, theBlock.getClass()); } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index fc0b2af1e..f41a17b94 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -57,11 +57,11 @@ tooltip.actuallyadditions.blockPhantomface.desc.2=Input things into me to input tile.actuallyadditions.blockPhantomPlacer.name=Phantom Placer tooltip.actuallyadditions.blockPhantomPlacer.desc.1=Places Blocks from a distance! Connect me with a Phantom Connector! -tooltip.actuallyadditions.blockPhantomPlacer.desc.2=Shift-Right-Click with an empty hand to see its Connections! +tooltip.actuallyadditions.blockPhantomPlacer.desc.2=Sneak-Right-Click with an empty hand to see its Connections! tile.actuallyadditions.blockPhantomBreaker.name=Phantom Breaker tooltip.actuallyadditions.blockPhantomBreaker.desc.1=Breaks Blocks from a distance! Connect me with a Phantom Connector! -tooltip.actuallyadditions.blockPhantomBreaker.desc.2=Shift-Right-Click with an empty hand to see its Connections! +tooltip.actuallyadditions.blockPhantomBreaker.desc.2=Sneak-Right-Click with an empty hand to see its Connections! item.actuallyadditions.itemPhantomConnector.name=Phantom Connector tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block! @@ -119,7 +119,7 @@ tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO tooltip.actuallyadditions.phantom.connected.desc= tooltip.actuallyadditions.phantom.stored.desc= tooltip.actuallyadditions.phantom.noBound.desc=The Connector has no Information stored! -tooltip.actuallyadditions.phantom.notInventory.desc=The stored Block is not an Inventory! +tooltip.actuallyadditions.phantom.notInventory.desc=The stored Block is not the right type of Inventory! tooltip.actuallyadditions.phantom.inWorld.desc=In World tooltip.actuallyadditions.phantom.boundTo.desc=Bound to tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to Block at %s, %s, %s @@ -389,16 +389,13 @@ container.actuallyadditions.nei.crushing.name=Crusher container.actuallyadditions.nei.ballOfHair.name=Ball Of Hair Usage container.actuallyadditions.nei.compost.name=Compost -gui.actuallyadditions.waila.compostAmount.name=Amount of Mashed Food -gui.actuallyadditions.waila.compostDone.name=Done! -gui.actuallyadditions.waila.compostConverting.name=Converting... - info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Update ","bold":"true"},{"text":"for ","bold":"false"},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"available!","color":"none","bold":"false"}] info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}] info.actuallyadditions.update.download.desc=[{"text":"Download the newest Version "},{"text":"here! (Click me!)","color":"dark_green","underlined":"true","clickEvent":{"action":"open_url","value":"%s"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click here to open your Browser and download the newest Version!"}]}}}] info.actuallyadditions.update.failed.desc=[{"text":"The Update Check for "},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"failed! Check your Internet Connection and the Logs for more Info!","color":"none"}] +info.actuallyadditions.update.changelog.desc=Updates: %s -achievement.actuallyadditions.pickUpSolidXP=Hard and Rich and Stuff +achievement.actuallyadditions.pickUpSolidXP=Square and yummy! achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience achievement.actuallyadditions.craftKnifeBlade=Sharp! So Sharp! achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelEllpeck.png b/src/main/resources/assets/actuallyadditions/textures/blocks/models/special/modelEllpeck.png index cd769c4cad83bc2ffaa5dcbc7bf893d005a0b12f..4bdd01e0b3ab4e06253236922f1c19bcbdfbc746 100644 GIT binary patch delta 999 zcmX@dx`ktc%0xp6u0sqAe1{lCHM|-o2CLOGZ}N0;45^5F8*$n%I8bD7@{$YF#9mCc z%XoVAQqTnkEu|)pg*H5G5{o)JFD7`%SbWh|DLlk(Ancw|a^&!e&JJepCT5SCBb_Xd z`E|bAeRo*o{4T+}D6EK?Ic$^I>o>LE?4|`@Q9q|VWnYWOWl@*tbxPOF+Fa6@9)4kX zm2`JSJ?FEBD^D+2wQS}-wUD2)9jjl7_#LLq?e;9D;E6&{A7IM7j zSJF%&N$CdrDzSOLbYfKgg@g);ehJ-mdBwV1S6>Z&u$HncRh3)IPaH6r^fOcC#EFC7 zE&u#8?4Q5;`-bh7-Y2&{m}1?^749@M!Fk@Vvbn!L*8hxZlS#^5>{Vl9y|Tw8+U@{z^kY{{aI^kXL(y5&Q+{>j?NoImaN#=liT zGk<)2yU(kr{{1?yNw2T3OW!?h?x(FhmPewxRqA?zq+Jv$`TWI=Dt1QvIDO>cLQbHf zX_FrxJLY~vGrs=xgyy?@+c$nqV#)Rv|M13B?sSS$-EpTk+x~uh-)_2hzqe=Ij8^@a z1#H)s?*9J~!&dK8QrpJNLb~6 zmeKDA(D*+SjZM~wY}jek^68dE**(9<%CgVv`!}q5*~?iIXlmQ;vaLhlEQ24&C3pVu zta@2h6de3$<=Q=Am(<><{It-we|9Xb{CmPHC8-r3KVB7I`m6jD&>asJy{YYMU~!$*Q(y=`xH+d?*evjEeyjO}VA)yO zR+jlI6Vv8OMQdDL&n6>RCiVGxKaT}SWx_?BxTP<$gAQ}fuJHGq7Jj^Rl51(s&wc%u zFC1R1*ZtfO7{I{rHNUXV=fjLBSNqi`8)mbK#P8s4bdg``*6sIthF86wTd=%;UHfCb z>zjl3O;co#U$P)9m|wE+bBoxC#cFpr>z(zPdcSRay2Qd!uIkX0osks^p4a2|NCN}l z*hj^^=e<84{a*R;JIn9=YTF^4%zZ!X^v{ale}447@SAszopr056&M AOaK4? delta 636 zcmdnOagKF@3KwH>kh>GZx^prwCn`#F9cEzQJIr`Ie?`hfH??{udrud~kczms)4j6} zI|#Vca=fo)`JXG)QO|vHo7hRE@B2@=&hI-yjd;OZo9vi9PN1*h&R?^NGf@jmWS z)n32TPmSJ|?Uu=ZTO6ltHrux0YQ>Qh=wC6%L2ckDQ#{7309JBxCb-TdcecJt4_EZX^`#%k_9 zmhV?iJ-YI#n@9diUx%e!|H|CkCA;qysja)7oi*#(XQ|?>%);y+u5J8#I#wu!F7)bH z8q|JRas5dyp921mzyI2WZ=M#P@}r@EN!Z9?-r2NFtGUk}NHK>96t9xYjX7PfZ&c%8 z<0Q~x;d1E|$NTNY1#4}M(m4MznEt7|&)rh2*17P+Mn<2)ZI*`*PmkB#fB(Ca(+`uA z2g-GAOb%?8ke8~Q0yObtn6FpkHnJ zZdLwS|M~6bJ@aIX>$>yjKR>D}Q}f&A{j=N8E6wlQo!|ZQTjjm8+s}W_+gBSouN}u-%&*WiYYIIN#;J`wCSZ_G9hGBR0C7FLe?yxWbfv2mV%Q~loCIFF_F%$p* diff --git a/update/changelog b/update/changelog new file mode 100644 index 000000000..d8d44271f --- /dev/null +++ b/update/changelog @@ -0,0 +1 @@ +An Update Checker! ...wait, you're not gonna read this anyways. \ No newline at end of file diff --git a/newestVersion.txt b/update/newestVersion.txt similarity index 100% rename from newestVersion.txt rename to update/newestVersion.txt