More cleanup.

I hope this fixes the fuckery.
God damn it.
This commit is contained in:
Ellpeck 2016-02-01 20:32:49 +01:00
parent 348dc518c6
commit 228ecd50bd
27 changed files with 372 additions and 368 deletions

View file

@ -123,6 +123,11 @@ public class BlockColoredLamp extends BlockBase{
return this.isOn ? 15 : 0;
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allLampTypes.length];
@ -134,11 +139,6 @@ public class BlockColoredLamp extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.RARE;

View file

@ -55,6 +55,11 @@ public class BlockCrystal extends BlockBase{
}
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allCrystals.length];
@ -66,11 +71,6 @@ public class BlockCrystal extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allCrystals.length ? EnumRarity.COMMON : allCrystals[stack.getItemDamage()].rarity;

View file

@ -55,6 +55,11 @@ public class BlockMisc extends BlockBase{
}
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allMiscBlocks.length];
@ -66,11 +71,6 @@ public class BlockMisc extends BlockBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity;

View file

@ -80,6 +80,16 @@ public class BlockWildPlant extends BlockBushBase{
return false;
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public boolean shouldAddCreative(){
return false;
}
@Override
protected void registerRendering(){
ResourceLocation[] resLocs = new ResourceLocation[allWildPlants.length];
@ -91,16 +101,6 @@ public class BlockWildPlant extends BlockBushBase{
ActuallyAdditions.proxy.addRenderVariant(Item.getItemFromBlock(this), resLocs);
}
@Override
public Class<? extends ItemBlockBase> getItemBlock(){
return TheItemBlock.class;
}
@Override
public boolean shouldAddCreative(){
return false;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;

View file

@ -116,30 +116,32 @@ public class BlockPlant extends BlockCrops{
return true;
}
return false;
} @Override
public Item getSeed(){
return this.seedItem;
}
@Override
public int getDamageValue(World world, BlockPos pos){
return 0;
} @Override
public Item getCrop(){
return this.returnItem;
public Item getSeed(){
return this.seedItem;
}
@Override
public int quantityDropped(IBlockState state, int fortune, Random random){
return this.getMetaFromState(state) >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(state, fortune, random);
} @Override
}
@Override
public Item getCrop(){
return this.returnItem;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int par3){
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
}
}

View file

@ -49,27 +49,12 @@ public class PageCrafting extends BookletPageAA{
}
@Override
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ItemStack[] stacks = new ItemStack[this.recipes.length];
for(int i = 0; i < this.recipes.length; i++){
if(this.recipes[i] != null){
ItemStack output = this.recipes[i].getRecipeOutput();
if(output != null){
if(!this.arePageStacksWildcard){
stacks[i] = output;
}
else{
ItemStack wildcardOutput = output.copy();
wildcardOutput.setItemDamage(Util.WILDCARD);
stacks[i] = wildcardOutput;
}
}
}
}
return stacks;
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
return null;
}
@SuppressWarnings("unchecked")
@ -166,15 +151,6 @@ public class PageCrafting extends BookletPageAA{
}
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.recipes[this.recipePos] != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
}
}
@Override
@SideOnly(Side.CLIENT)
public void updateScreen(int ticksElapsed){
@ -187,4 +163,28 @@ public class PageCrafting extends BookletPageAA{
}
}
}
@Override
public ItemStack[] getItemStacksForPage(){
if(this.recipes != null){
ItemStack[] stacks = new ItemStack[this.recipes.length];
for(int i = 0; i < this.recipes.length; i++){
if(this.recipes[i] != null){
ItemStack output = this.recipes[i].getRecipeOutput();
if(output != null){
if(!this.arePageStacksWildcard){
stacks[i] = output;
}
else{
ItemStack wildcardOutput = output.copy();
wildcardOutput.setItemDamage(Util.WILDCARD);
stacks[i] = wildcardOutput;
}
}
}
}
return stacks;
}
return null;
}
}

View file

@ -43,8 +43,12 @@ public class PageFurnace extends BookletPageAA{
}
@Override
public ItemStack[] getItemStacksForPage(){
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
}
@SuppressWarnings("unchecked")
@ -90,12 +94,8 @@ public class PageFurnace extends BookletPageAA{
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(this.input != null || this.getInputForOutput(this.result) != null){
Minecraft.getMinecraft().getTextureManager().bindTexture(ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
gui.drawRect(gui.getGuiLeft()+37, gui.getGuiTop()+20, 0, 180, 60, 60);
}
public ItemStack[] getItemStacksForPage(){
return this.result == null ? new ItemStack[0] : new ItemStack[]{this.result};
}
private ItemStack getInputForOutput(ItemStack output){

View file

@ -31,11 +31,6 @@ public class PageTextOnly extends BookletPageAA{
return this;
}
@Override
public ItemStack[] getItemStacksForPage(){
return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
}
@Override
@SideOnly(Side.CLIENT)
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
@ -44,4 +39,9 @@ public class PageTextOnly extends BookletPageAA{
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
}
}
@Override
public ItemStack[] getItemStacksForPage(){
return this.stack == null ? new ItemStack[0] : new ItemStack[]{this.stack};
}
}

View file

@ -38,6 +38,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
this.isPlacer = false;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -57,18 +69,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;

View file

@ -55,6 +55,22 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("ProcessTime", this.currentProcessTime);
this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -101,22 +117,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("ProcessTime", this.currentProcessTime);
this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);

View file

@ -45,6 +45,22 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
return this.currentBurnTime*i/this.maxBurnTime;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("BurnTime", this.currentBurnTime);
compound.setInteger("MaxBurnTime", this.maxBurnTime);
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentBurnTime = compound.getInteger("BurnTime");
this.maxBurnTime = compound.getInteger("MaxBurnTime");
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -93,22 +109,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("BurnTime", this.currentBurnTime);
compound.setInteger("MaxBurnTime", this.maxBurnTime);
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentBurnTime = compound.getInteger("BurnTime");
this.maxBurnTime = compound.getInteger("MaxBurnTime");
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return TileEntityFurnace.getItemBurnTime(stack) > 0;

View file

@ -73,6 +73,24 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
return this.brewTime*i/TIME_USED;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound);
compound.setInteger("Cache", this.coffeeCacheAmount);
compound.setInteger("Time", this.brewTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound);
this.coffeeCacheAmount = compound.getInteger("Cache");
this.brewTime = compound.getInteger("Time");
}
@Override
public void updateEntity(){
super.updateEntity();
@ -92,24 +110,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound);
compound.setInteger("Cache", this.coffeeCacheAmount);
compound.setInteger("Time", this.brewTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound);
this.coffeeCacheAmount = compound.getInteger("Cache");
this.brewTime = compound.getInteger("Time");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()) || (i == SLOT_WATER_INPUT && FluidContainerRegistry.containsFluid(stack, new FluidStack(FluidRegistry.WATER, 1)));

View file

@ -27,6 +27,23 @@ public class TileEntityCompost extends TileEntityInventoryBase{
super(1, "compost");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("ConversionTime", this.conversionTime);
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.conversionTime = compound.getInteger("ConversionTime");
}
@Override
public void updateEntity(){
super.updateEntity();
@ -45,23 +62,6 @@ public class TileEntityCompost extends TileEntityInventoryBase{
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("ConversionTime", this.conversionTime);
}
@Override
public boolean shouldSyncSlots(){
return true;
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.conversionTime = compound.getInteger("ConversionTime");
}
@Override
public int getInventoryStackLimit(){
return AMOUNT;

View file

@ -25,6 +25,18 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
super(9, "dropper");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -44,18 +56,6 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;

View file

@ -28,6 +28,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
super(2, "energizer");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -53,18 +65,6 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;

View file

@ -29,6 +29,18 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
super(2, "enervator");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -58,18 +70,6 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;

View file

@ -40,6 +40,24 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
return this.currentTimer*i/TIME;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Timer", this.currentTimer);
if(sync){
compound.setInteger("Animals", this.currentAnimalAmount);
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTimer = compound.getInteger("Timer");
if(sync){
this.currentAnimalAmount = compound.getInteger("Animals");
}
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -91,24 +109,6 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Timer", this.currentTimer);
if(sync){
compound.setInteger("Animals", this.currentAnimalAmount);
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.currentTimer = compound.getInteger("Timer");
if(sync){
this.currentAnimalAmount = compound.getInteger("Animals");
}
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;

View file

@ -39,6 +39,22 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
super(4, "furnaceDouble");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
this.storage.readFromNBT(compound);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -100,22 +116,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
this.storage.readFromNBT(compound);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.instance().getSmeltingResult(stack) != null;

View file

@ -71,6 +71,22 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
return true;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("FirstCrushTime", this.firstCrushTime);
compound.setInteger("SecondCrushTime", this.secondCrushTime);
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.firstCrushTime = compound.getInteger("FirstCrushTime");
this.secondCrushTime = compound.getInteger("SecondCrushTime");
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -149,22 +165,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("FirstCrushTime", this.firstCrushTime);
compound.setInteger("SecondCrushTime", this.secondCrushTime);
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.firstCrushTime = compound.getInteger("FirstCrushTime");
this.secondCrushTime = compound.getInteger("SecondCrushTime");
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;

View file

@ -388,6 +388,32 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
this.markDirty();
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("SideToPut", this.sideToPut);
compound.setInteger("SlotToPut", this.slotToPutStart);
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
compound.setInteger("SideToPull", this.sideToPull);
compound.setInteger("SlotToPull", this.slotToPullStart);
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.sideToPut = compound.getInteger("SideToPut");
this.slotToPutStart = compound.getInteger("SlotToPut");
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
this.sideToPull = compound.getInteger("SideToPull");
this.slotToPullStart = compound.getInteger("SlotToPull");
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
super.readSyncableNBT(compound, sync);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -420,32 +446,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("SideToPut", this.sideToPut);
compound.setInteger("SlotToPut", this.slotToPutStart);
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
compound.setInteger("SideToPull", this.sideToPull);
compound.setInteger("SlotToPull", this.slotToPullStart);
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.sideToPut = compound.getInteger("SideToPut");
this.slotToPutStart = compound.getInteger("SlotToPut");
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
this.sideToPull = compound.getInteger("SideToPull");
this.slotToPullStart = compound.getInteger("SlotToPull");
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == 0;

View file

@ -107,19 +107,12 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
}
}
@Override
public int getInventoryStackLimit(){
return 64;
}
@Override
public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, net.minecraft.util.EnumFacing facing){
return this.getCapability(capability, facing) != null;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player){
return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.worldObj.getTileEntity(this.pos) == this;
} @Override
public int getInventoryStackLimit(){
return 64;
}
@Override
@ -130,7 +123,16 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
else{
return super.getCapability(capability, facing);
}
} @Override
}
@Override
public boolean isUseableByPlayer(EntityPlayer player){
return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.worldObj.getTileEntity(this.pos) == this;
}
@Override
public void openInventory(EntityPlayer player){
}

View file

@ -31,6 +31,20 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
super(2, "repairer");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("NextRepairTick", this.nextRepairTick);
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.nextRepairTick = compound.getInteger("NextRepairTick");
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -63,20 +77,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("NextRepairTick", this.nextRepairTick);
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.nextRepairTick = compound.getInteger("NextRepairTick");
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_INPUT;

View file

@ -47,6 +47,22 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
super(9, "miner");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("Layer", this.layerAt);
compound.setBoolean("OnlyOres", this.onlyMineOres);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.layerAt = compound.getInteger("Layer");
this.onlyMineOres = compound.getBoolean("OnlyOres");
}
@Override
public void updateEntity(){
super.updateEntity();
@ -154,22 +170,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
return false;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound);
compound.setInteger("Layer", this.layerAt);
compound.setBoolean("OnlyOres", this.onlyMineOres);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound);
this.layerAt = compound.getInteger("Layer");
this.onlyMineOres = compound.getBoolean("OnlyOres");
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return false;

View file

@ -52,6 +52,22 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
return this.currentBurnTime*i/BURN_TIME;
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("BurnTime", this.currentBurnTime);
this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentBurnTime = compound.getInteger("BurnTime");
this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
@ -99,22 +115,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("BurnTime", this.currentBurnTime);
this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound);
super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentBurnTime = compound.getInteger("BurnTime");
this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound);
super.readSyncableNBT(compound, sync);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitFluids.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;

View file

@ -104,11 +104,6 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
return null;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(this.isBoundThingInRange()){
@ -120,6 +115,11 @@ public class TileEntityPhantomItemface extends TileEntityPhantomface{
return super.getCapability(capability, facing);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isBoundThingInRange() && this.getInventory().isItemValidForSlot(i, stack);
}
@Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && worldObj.getTileEntity(boundPosition) instanceof IInventory;

View file

@ -48,6 +48,30 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
this.capabilities = ForgeEventFactory.gatherCapabilities(this);
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Range", this.range);
if(this.boundPosition != null){
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored");
this.range = compound.getInteger("Range");
if(!(x == 0 && y == 0 && z == 0)){
this.boundPosition = new BlockPos(x, y, z);
this.markDirty();
}
}
@Override
public void updateEntity(){
super.updateEntity();
@ -81,27 +105,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setInteger("Range", this.range);
if(this.boundPosition != null){
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
}
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored");
this.range = compound.getInteger("Range");
if(!(x == 0 && y == 0 && z == 0)){
this.boundPosition = new BlockPos(x, y, z);
this.markDirty();
}
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
return this.capabilities.getCapability(capability, facing);
}
@Override
@ -109,11 +114,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
return false;
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
return this.capabilities.getCapability(capability, facing);
}
public static int upgradeRange(int defaultRange, World world, BlockPos pos){
int newRange = defaultRange;
for(int i = 0; i < 3; i++){

View file

@ -29,6 +29,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
super(1, "xpSolidifier");
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setShort("Amount", this.amount);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.amount = compound.getShort("Amount");
}
@Override
public void updateEntity(){
super.updateEntity();
@ -53,18 +65,6 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
}
}
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeSyncableNBT(compound, sync);
compound.setShort("Amount", this.amount);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
this.amount = compound.getShort("Amount");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return false;