Update Checker Changes!

This commit is contained in:
Ellpeck 2015-05-27 21:57:53 +02:00
parent f896308888
commit 22076b631c
19 changed files with 291 additions and 178 deletions

View file

@ -29,6 +29,8 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
public static final int FACE = 0; public static final int FACE = 0;
public static final int PLACER = 1; public static final int PLACER = 1;
public static final int BREAKER = 2; public static final int BREAKER = 2;
public static final int LIQUIFACE = 3;
public static final int ENERGYFACE = 4;
public int type; public int type;
@ -59,9 +61,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
if(tile instanceof TileEntityPhantomface){ if(tile instanceof TileEntityPhantomface){
TileEntityPhantomface phantom = (TileEntityPhantomface)tile; TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
if(phantom.hasBoundTile()){ if(phantom.hasBoundTile()){
if(phantom.isBoundTileInRage()){ 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)));
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.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"))); 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()){ if(player.isSneaking()){
TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile; TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile;
if(phantom.hasBoundPosition()){ if(phantom.hasBoundPosition()){
if(phantom.isBoundPositionInRange()){ 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)));
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.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"))); 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(); return new TileEntityPhantomPlacer();
case BREAKER: case BREAKER:
return new TileEntityPhantomPlacer.TileEntityPhantomBreaker(); return new TileEntityPhantomPlacer.TileEntityPhantomBreaker();
case LIQUIFACE:
return new TileEntityPhantomface.TileEntityPhantomLiquiface();
default: default:
return new TileEntityPhantomface(); return new TileEntityPhantomface.TileEntityPhantomItemface();
} }
} }
@ -110,7 +110,16 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
@Override @Override
public String getName(){ 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{ public static class TheItemBlock extends ItemBlock{

View file

@ -46,8 +46,9 @@ public class InitBlocks{
public static Block blockOilGenerator; public static Block blockOilGenerator;
public static Block blockPhantomface; public static Block blockPhantomface;
//public static Block blockPhantomPlacer; public static Block blockPhantomPlacer;
//public static Block blockPhantomBreaker; public static Block blockPhantomBreaker;
public static Block blockPhantomLiquiface;
public static void init(){ public static void init(){
Util.logInfo("Initializing Blocks..."); Util.logInfo("Initializing Blocks...");
@ -68,11 +69,14 @@ public class InitBlocks{
blockPhantomface = new BlockPhantomface(BlockPhantomface.FACE); blockPhantomface = new BlockPhantomface(BlockPhantomface.FACE);
BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class); BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class);
//blockPhantomPlacer = new BlockPhantomface(BlockPhantomface.PLACER); blockPhantomPlacer = new BlockPhantomface(BlockPhantomface.PLACER);
//BlockUtil.register(blockPhantomPlacer, BlockPhantomface.TheItemBlock.class); BlockUtil.register(blockPhantomPlacer, BlockPhantomface.TheItemBlock.class);
//blockPhantomBreaker = new BlockPhantomface(BlockPhantomface.BREAKER); blockPhantomLiquiface = new BlockPhantomface(BlockPhantomface.LIQUIFACE);
//BlockUtil.register(blockPhantomBreaker, BlockPhantomface.TheItemBlock.class); BlockUtil.register(blockPhantomLiquiface, BlockPhantomface.TheItemBlock.class);
blockPhantomBreaker = new BlockPhantomface(BlockPhantomface.BREAKER);
BlockUtil.register(blockPhantomBreaker, BlockPhantomface.TheItemBlock.class);
blockCoalGenerator = new BlockCoalGenerator(); blockCoalGenerator = new BlockCoalGenerator();
BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class); BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class);

View file

@ -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_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_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 name;
public final String category; public final String category;

View file

@ -216,7 +216,7 @@ public class BlockCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass),
"GSG", "SDS", "GSG", "GSG", "SDS", "GSG",
'G', "blockGlass", 'G', "blockGlass",
'D', "blockDiamond", 'D', "gemDiamond",
'S', "treeSapling")); 'S', "treeSapling"));
//Placer //Placer

View file

@ -27,8 +27,8 @@ public class CreativeTab extends CreativeTabs{
this.list = list; this.list = list;
this.addBlock(InitBlocks.blockPhantomface); this.addBlock(InitBlocks.blockPhantomface);
//this.addBlock(InitBlocks.blockPhantomPlacer); this.addBlock(InitBlocks.blockPhantomPlacer);
//this.addBlock(InitBlocks.blockPhantomBreaker); this.addBlock(InitBlocks.blockPhantomBreaker);
this.addBlock(InitBlocks.blockInputter); this.addBlock(InitBlocks.blockInputter);
this.addBlock(InitBlocks.blockInputterAdvanced); this.addBlock(InitBlocks.blockInputterAdvanced);
@ -92,7 +92,7 @@ public class CreativeTab extends CreativeTabs{
@Override @Override
public Item getTabIconItem(){ public Item getTabIconItem(){
return Item.getItemFromBlock(InitBlocks.blockInputter); return Item.getItemFromBlock(InitBlocks.blockPhantomPlacer);
} }
@Override @Override

View file

@ -10,7 +10,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
@ -24,6 +23,7 @@ public class ItemBucketAA extends ItemBucket implements INameableItem{
public ItemBucketAA(Block block, String unlocName){ public ItemBucketAA(Block block, String unlocName){
super(block); super(block);
this.name = unlocName; this.name = unlocName;
this.setContainerItem(Items.bucket);
} }
@Override @Override
@ -31,11 +31,6 @@ public class ItemBucketAA extends ItemBucket implements INameableItem{
return EnumRarity.uncommon; return EnumRarity.uncommon;
} }
@Override
public Item getContainerItem(){
return Items.bucket;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {

View file

@ -42,7 +42,7 @@ public class ItemPhantomConnector extends Item implements INameableItem{
if(this.checkHasConnection(stack, player)){ if(this.checkHasConnection(stack, player)){
ChunkCoordinates coords = this.getStoredPosition(stack); ChunkCoordinates coords = this.getStoredPosition(stack);
TileEntity toStore = this.getStoredWorld(stack).getTileEntity(coords.posX, coords.posY, coords.posZ); 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; ((TileEntityPhantomface)tile).boundTile = toStore;
this.clearStorage(stack); this.clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc"))); player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));

View file

@ -31,7 +31,8 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityFermentingBarrel.class, ModUtil.MOD_ID_LOWER + ":tileEntityFermentingBarrel"); GameRegistry.registerTileEntity(TileEntityFermentingBarrel.class, ModUtil.MOD_ID_LOWER + ":tileEntityFermentingBarrel");
GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator"); GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator");
GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoalGenerator"); 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.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomPlacer");
GameRegistry.registerTileEntity(TileEntityPhantomPlacer.TileEntityPhantomBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBreaker"); GameRegistry.registerTileEntity(TileEntityPhantomPlacer.TileEntityPhantomBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBreaker");
} }

View file

@ -118,7 +118,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
ItemStack slot = slots[i].copy(); ItemStack slot = slots[i].copy();
if(actuallyDo){ if(actuallyDo){
slots[i].stackSize--; 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; return slot;
} }

View file

@ -134,10 +134,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
@Override @Override
public int[] getAccessibleSlotsFromSide(int side){ public int[] getAccessibleSlotsFromSide(int side){
if(this.slots.length > 0){
int[] theInt = new int[slots.length]; int[] theInt = new int[slots.length];
for(int i = 0; i < theInt.length; i++){ for(int i = 0; i < theInt.length; i++){
theInt[i] = i; theInt[i] = i;
} }
return theInt; return theInt;
} }
else return new int[0];
}
} }

View file

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.tile; package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -26,9 +27,9 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
public World boundWorld; public World boundWorld;
public int currentTime; 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; public boolean isBreaker;

View file

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.tile; package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.blocks.BlockPhantomface;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -9,30 +10,26 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; 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 class TileEntityPhantomface extends TileEntityInventoryBase{
public TileEntity boundTile; public TileEntity boundTile;
public int type;
public final int range = ConfigIntValues.PHANTOMFACE_RANGE.getValue(); public final int range = ConfigIntValues.PHANTOMFACE_RANGE.getValue();
public TileEntityPhantomface(){ public TileEntityPhantomface(String name){
super(0, "phantomface"); super(0, name);
} }
@Override public boolean canConnectTo(TileEntity tile){
public void updateEntity(){ return false;
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 isBoundTileInRage(){ public boolean isBoundTileInRage(){
@ -50,13 +47,37 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
return false; 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(){ public boolean hasBoundTile(){
if(this.boundTile != null){ 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()){ if(this.xCoord == this.boundTile.xCoord && this.yCoord == this.boundTile.yCoord && this.zCoord == this.boundTile.zCoord && this.worldObj == this.boundTile.getWorldObj()){
this.boundTile = null; this.boundTile = null;
return false; 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; return false;
} }
@ -72,10 +93,10 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
} }
} }
private int tempX; public int tempX;
private int tempY; public int tempY;
private int tempZ; public int tempZ;
private World tempWorld; public World tempWorld;
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readFromNBT(NBTTagCompound compound){
@ -86,6 +107,93 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
this.tempWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored")); this.tempWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored"));
} }
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return false;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int 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(){ public IInventory getInventory(){
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord); TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
if(tile != null && tile instanceof IInventory){ if(tile != null && tile instanceof IInventory){
@ -170,4 +278,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
public boolean canExtractItem(int slot, ItemStack stack, int side){ public boolean canExtractItem(int slot, ItemStack stack, int side){
return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side)); return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
} }
}
} }

View file

@ -6,6 +6,7 @@ import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
@ -20,6 +21,7 @@ public class UpdateChecker{
public boolean checkFailed = false; public boolean checkFailed = false;
public boolean notified = false; public boolean notified = false;
public String onlineVersion; public String onlineVersion;
public String changelog;
public void init(){ public void init(){
Util.logInfo("Initializing Update Checker..."); Util.logInfo("Initializing Update Checker...");
@ -42,9 +44,11 @@ public class UpdateChecker{
String notice1 = "info." + ModUtil.MOD_ID_LOWER + ".update.generic.desc"; String notice1 = "info." + ModUtil.MOD_ID_LOWER + ".update.generic.desc";
String notice2 = "info." + ModUtil.MOD_ID_LOWER + ".update.versionComp.desc"; String notice2 = "info." + ModUtil.MOD_ID_LOWER + ".update.versionComp.desc";
String notice3 = "info." + ModUtil.MOD_ID_LOWER + ".update.download.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.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(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(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(){ public void run(){
Util.logInfo("Starting Update Check..."); Util.logInfo("Starting Update Check...");
try{ try{
URL url = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/newestVersion.txt"); URL newestURL = new URL("https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/update/newestVersion.txt");
BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); BufferedReader newestReader = new BufferedReader(new InputStreamReader(newestURL.openStream()));
onlineVersion = r.readLine(); onlineVersion = newestReader.readLine();
r.close(); 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!"); Util.logInfo("Update Check done!");
} }
catch(Exception e){ catch(Exception e){

View file

@ -10,6 +10,8 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection; 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.FluidTank;
import net.minecraftforge.fluids.IFluidHandler; 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){ public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
if(world instanceof WorldServer){ 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(stack.getItem() instanceof IPlantable){
if(((IPlantable)stack.getItem()).getPlant(world, x, y, z).canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){ 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)); 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 stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
} }
return false; return false;

View file

@ -1,11 +1,7 @@
package ellpeck.actuallyadditions.waila; package ellpeck.actuallyadditions.waila;
import ellpeck.actuallyadditions.blocks.BlockCompost;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.tile.TileEntityCompost;
import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataAccessor;
@ -16,7 +12,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
@ -24,8 +19,6 @@ import java.util.List;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class WailaDataProvider implements IWailaDataProvider{ public class WailaDataProvider implements IWailaDataProvider{
private final String WAILA_PRE_LANG = "gui." + ModUtil.MOD_ID_LOWER + ".waila.";
@Override @Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){ public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config){
return null; return null;
@ -35,7 +28,7 @@ public class WailaDataProvider implements IWailaDataProvider{
public List<String> getWailaHead(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ public List<String> getWailaHead(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
if(ConfigBoolValues.DO_WAILA_INFO.isEnabled()){ 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); Item.getItemFromBlock(accessor.getBlock()).addInformation(stack, accessor.getPlayer(), currentTip, true);
} }
} }
@ -45,32 +38,9 @@ public class WailaDataProvider implements IWailaDataProvider{
@Override @Override
public List<String> getWailaBody(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ public List<String> getWailaBody(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
if(accessor.getTileEntity() instanceof TileEntityCompost){
this.compostBody(accessor, currentTip);
}
return currentTip; return currentTip;
} }
public void compostBody(IWailaDataAccessor accessor, List<String> 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 @Override
public List<String> getWailaTail(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){ public List<String> getWailaTail(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
return currentTip; return currentTip;
@ -85,9 +55,6 @@ public class WailaDataProvider implements IWailaDataProvider{
Util.logInfo("Initializing Waila Plugin..."); Util.logInfo("Initializing Waila Plugin...");
WailaDataProvider provider = new WailaDataProvider(); WailaDataProvider provider = new WailaDataProvider();
registrar.registerBodyProvider(provider, BlockCompost.class);
for(Block theBlock : BlockUtil.wailaRegisterList){ for(Block theBlock : BlockUtil.wailaRegisterList){
registrar.registerHeadProvider(provider, theBlock.getClass()); registrar.registerHeadProvider(provider, theBlock.getClass());
} }

View file

@ -57,11 +57,11 @@ tooltip.actuallyadditions.blockPhantomface.desc.2=Input things into me to input
tile.actuallyadditions.blockPhantomPlacer.name=Phantom Placer 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.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 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.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 item.actuallyadditions.itemPhantomConnector.name=Phantom Connector
tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block! 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=<Block connected!> tooltip.actuallyadditions.phantom.connected.desc=<Block connected!>
tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!> tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
tooltip.actuallyadditions.phantom.noBound.desc=The Connector has no Information stored! 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.inWorld.desc=In World
tooltip.actuallyadditions.phantom.boundTo.desc=Bound to tooltip.actuallyadditions.phantom.boundTo.desc=Bound to
tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to Block at %s, %s, %s 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.ballOfHair.name=Ball Of Hair Usage
container.actuallyadditions.nei.compost.name=Compost 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.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.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.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.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.pickUpSolidXP.desc=Pick up some Solidified Experience
achievement.actuallyadditions.craftKnifeBlade=Sharp! So Sharp! achievement.actuallyadditions.craftKnifeBlade=Sharp! So Sharp!
achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade

Binary file not shown.

Before

Width:  |  Height:  |  Size: 718 B

After

Width:  |  Height:  |  Size: 1.1 KiB

1
update/changelog Normal file
View file

@ -0,0 +1 @@
An Update Checker! ...wait, you're not gonna read this anyways.