mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Update Checker Changes!
This commit is contained in:
parent
f896308888
commit
22076b631c
19 changed files with 291 additions and 178 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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")));
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<String> getWailaHead(ItemStack stack, List<String> 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<String> getWailaBody(ItemStack stack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config){
|
||||
|
||||
if(accessor.getTileEntity() instanceof TileEntityCompost){
|
||||
this.compostBody(accessor, 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
|
||||
public List<String> getWailaTail(ItemStack stack, List<String> 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());
|
||||
}
|
||||
|
|
|
@ -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=<Block connected!>
|
||||
tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
|
||||
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
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 1.1 KiB |
1
update/changelog
Normal file
1
update/changelog
Normal file
|
@ -0,0 +1 @@
|
|||
An Update Checker! ...wait, you're not gonna read this anyways.
|
Loading…
Reference in a new issue