Merge remote-tracking branch 'origin/master' into 1.8.X

master
Bartek Bok 2016-02-07 18:27:58 +01:00
commit 6fe6d9f054
11 changed files with 113 additions and 28 deletions

@ -1 +1 @@
Subproject commit 57e5cf3875e63594c399d0424ce32a7207866b37
Subproject commit 930c842774bcb88f83d4ece114396eb07f86fbcc

View File

@ -1,4 +1,4 @@
mod_version=1.5.0
mod_version=1.5.1
api_version=1.1
opc_api_version=3.3.2-1.8
mc_ver=1.8.9

View File

@ -6,12 +6,15 @@ import java.lang.annotation.*;
* Static variables marked with this annotation will be filled with instance
* of requested API (defined by type of variable).
*
* All variables must have type that implements {@link IApiInterface}.
* Static methods marked with this annotation will be called with instance of requested API.
* Methods must have single argument, which will be used to select API.
*
* All used types must implements {@link IApiInterface}.
* If requested type is not provided by OpenPeripheralAddons, variable will not be set.
*
* All variables should be filled in 'init'. Value in 'preInit' is undefined.
*
*/
@Target(ElementType.FIELD)
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiHolder {}

View File

@ -42,7 +42,9 @@ public class TileEntityAutoAnvil extends SyncedTileEntity implements IHasGui, II
protected static final int TOTAL_COOLDOWN = 40;
public static final int TANK_CAPACITY = LiquidXpUtils.getLiquidForLevel(45);
protected int cooldown = 0;
private int cooldown = 0;
private boolean needsTankUpdate;
/**
* The 3 slots in the inventory
@ -109,6 +111,11 @@ public class TileEntityAutoAnvil extends SyncedTileEntity implements IHasGui, II
if (!worldObj.isRemote) {
// if we should auto-drink liquid, do it!
if (automaticSlots.get(AutoSlots.xp)) {
if (needsTankUpdate) {
tank.updateNeighbours(worldObj, getPos());
needsTankUpdate = false;
}
tank.fillFromSides(100, worldObj, getPos(), xpSides.getValue());
}
@ -266,8 +273,14 @@ public class TileEntityAutoAnvil extends SyncedTileEntity implements IHasGui, II
return BitMapUtils.singleBitReceiver(bits, slot.ordinal());
}
@Override
public void validate() {
super.validate();
this.needsTankUpdate = true;
}
@Override
public void onNeighbourChanged(Block block) {
tank.updateNeighbours(worldObj, getPos());
this.needsTankUpdate = true;
}
}

View File

@ -61,6 +61,8 @@ public class TileEntityAutoEnchantmentTable extends SyncedTileEntity implements
private SyncableFlags automaticSlots;
private SyncableInt maxLevel;
private boolean needsTankUpdate;
private final GenericInventory inventory = new TileEntityInventory(this, "autoenchant", true, 2) {
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
@ -113,6 +115,11 @@ public class TileEntityAutoEnchantmentTable extends SyncedTileEntity implements
if (!worldObj.isRemote) {
if (automaticSlots.get(AutoSlots.xp)) {
if (needsTankUpdate) {
tank.updateNeighbours(worldObj, pos);
needsTankUpdate = false;
}
tank.fillFromSides(80, worldObj, pos, xpSides.getValue());
}
@ -354,9 +361,15 @@ public class TileEntityAutoEnchantmentTable extends SyncedTileEntity implements
sync();
}
@Override
public void validate() {
super.validate();
this.needsTankUpdate = true;
}
@Override
public void onNeighbourChanged(Block block) {
tank.updateNeighbours(worldObj, pos);
this.needsTankUpdate = true;
}
}

View File

@ -2,6 +2,7 @@ package openblocks.common.tileentity;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@ -18,9 +19,7 @@ import openblocks.Config;
import openblocks.OpenBlocks;
import openblocks.client.gui.GuiSprinkler;
import openblocks.common.container.ContainerSprinkler;
import openmods.api.IBreakAwareTile;
import openmods.api.IHasGui;
import openmods.api.ISurfaceAttachment;
import openmods.api.*;
import openmods.fakeplayer.FakePlayerPool;
import openmods.fakeplayer.FakePlayerPool.PlayerUser;
import openmods.fakeplayer.OpenModsFakePlayer;
@ -36,7 +35,7 @@ import openmods.sync.SyncableTank;
import openmods.tileentity.SyncedTileEntity;
import openmods.utils.BlockUtils;
public class TileEntitySprinkler extends SyncedTileEntity implements IBreakAwareTile, ISurfaceAttachment, IInventoryProvider, IHasGui, ITickable {
public class TileEntitySprinkler extends SyncedTileEntity implements IBreakAwareTile, ISurfaceAttachment, IInventoryProvider, IHasGui, ITickable, INeighbourAwareTile {
private static final ItemStack BONEMEAL = new ItemStack(Items.dye, 1, 15);
@ -47,6 +46,8 @@ public class TileEntitySprinkler extends SyncedTileEntity implements IBreakAware
private boolean hasBonemeal = false;
private boolean needsTankUpdate;
public enum Flags {
enabled
}
@ -162,7 +163,15 @@ public class TileEntitySprinkler extends SyncedTileEntity implements IBreakAware
@Override
public void update() {
if (!worldObj.isRemote) {
if (tank.getFluidAmount() <= 0) tank.fillFromSide(worldObj, pos, EnumFacing.DOWN);
if (tank.getFluidAmount() <= 0) {
if (needsTankUpdate) {
tank.updateNeighbours(worldObj, pos);
needsTankUpdate = false;
}
tank.fillFromSide(worldObj, pos, EnumFacing.DOWN);
}
if (ticks % Config.sprinklerBonemealConsumeRate == 0) {
hasBonemeal = ItemDistribution.consumeFirstInventoryItem(inventory, BONEMEAL);
@ -236,4 +245,15 @@ public class TileEntitySprinkler extends SyncedTileEntity implements IBreakAware
super.readFromNBT(tag);
inventory.readFromNBT(tag);
}
@Override
public void validate() {
super.validate();
this.needsTankUpdate = true;
}
@Override
public void onNeighbourChanged(Block block) {
this.needsTankUpdate = true;
}
}

View File

@ -69,9 +69,13 @@ public class TileEntityTank extends SyncedTileEntity implements IActivateAwareTi
private final TankRenderLogic renderLogic;
private boolean needsTankUpdate;
@Override
public void validate() {
super.validate();
needsTankUpdate = true;
if (worldObj.isRemote) renderLogic.initialize(worldObj, pos);
}
@ -180,6 +184,7 @@ public class TileEntityTank extends SyncedTileEntity implements IActivateAwareTi
@Override
public void onNeighbourChanged(Block block) {
forceUpdate = true;
needsTankUpdate = true;
}
@Override
@ -258,11 +263,15 @@ public class TileEntityTank extends SyncedTileEntity implements IActivateAwareTi
@Override
public void update() {
ticksSinceLastSync++;
ticksSinceLastUpdate++;
if (Config.shouldTanksUpdate && !worldObj.isRemote && forceUpdate) {
if (needsTankUpdate) {
tank.updateNeighbours(worldObj, pos);
needsTankUpdate = false;
}
forceUpdate = false;
FluidStack contents = tank.getFluid();

View File

@ -53,6 +53,8 @@ public class TileEntityVacuumHopper extends SyncedTileEntity implements IInvento
public SyncableSides itemOutputs;
public SyncableBoolean vacuumDisabled;
private boolean needsTankUpdate;
private final GenericInventory inventory = registerInventoryCallback(new TileEntityInventory(this, "vacuumhopper", true, 10));
@IncludeInterface(ISidedInventory.class)
@ -153,6 +155,11 @@ public class TileEntityVacuumHopper extends SyncedTileEntity implements IInvento
private boolean outputToNeighbors() {
if (OpenMods.proxy.getTicks(worldObj) % 10 == 0) {
if (needsTankUpdate) {
tank.updateNeighbours(worldObj, pos);
needsTankUpdate = false;
}
tank.distributeToSides(50, worldObj, pos, xpOutputs.getValue());
autoInventoryOutput();
return true;
@ -250,8 +257,14 @@ public class TileEntityVacuumHopper extends SyncedTileEntity implements IInvento
inventory.readFromNBT(tag);
}
@Override
public void validate() {
super.validate();
this.needsTankUpdate = true;
}
@Override
public void onNeighbourChanged(Block block) {
tank.updateNeighbours(worldObj, pos);
this.needsTankUpdate = true;
}
}

View File

@ -1,6 +1,5 @@
package openblocks.common.tileentity;
import java.util.List;
import java.util.Set;
import net.minecraft.block.Block;
@ -36,8 +35,6 @@ import openmods.utils.MiscUtils;
import openmods.utils.SidedInventoryAdapter;
import openmods.utils.bitmap.*;
import com.google.common.collect.Lists;
public class TileEntityXPBottler extends SyncedTileEntity implements IInventoryProvider, IHasGui, IConfigurableGuiSlots<AutoSlots>, INeighbourAwareTile, ITickable {
public static final int TANK_CAPACITY = LiquidXpUtils.xpToLiquidRatio(LiquidXpUtils.XP_PER_BOTTLE);
@ -46,7 +43,7 @@ public class TileEntityXPBottler extends SyncedTileEntity implements IInventoryP
protected static final ItemStack GLASS_BOTTLE = new ItemStack(Items.glass_bottle, 1);
protected static final ItemStack XP_BOTTLE = new ItemStack(Items.experience_bottle, 1);
public List<EnumFacing> surroundingTanks = Lists.newArrayList();
private boolean needsTankUpdate;
public static enum Slots {
input,
@ -104,6 +101,11 @@ public class TileEntityXPBottler extends SyncedTileEntity implements IInventoryP
// if we should, we'll autofill the tank
if (automaticSlots.get(AutoSlots.xp)) {
if (needsTankUpdate) {
tank.updateNeighbours(worldObj, pos);
needsTankUpdate = false;
}
tank.fillFromSides(10, worldObj, pos, xpSides.getValue());
}
@ -248,8 +250,14 @@ public class TileEntityXPBottler extends SyncedTileEntity implements IInventoryP
return BitMapUtils.singleBitReceiver(bits, slot.ordinal());
}
@Override
public void validate() {
super.validate();
this.needsTankUpdate = true;
}
@Override
public void onNeighbourChanged(Block block) {
tank.updateNeighbours(worldObj, pos);
this.needsTankUpdate = true;
}
}

View File

@ -3,7 +3,6 @@ package openblocks.common.tileentity;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.Vec3;
import net.minecraftforge.fluids.FluidContainerRegistry;
@ -14,12 +13,11 @@ import openblocks.common.entity.EntityXPOrbNoFly;
import openmods.OpenMods;
import openmods.api.IAddAwareTile;
import openmods.api.INeighbourAwareTile;
import openmods.api.ISurfaceAttachment;
import openmods.liquids.GenericTank;
import openmods.sync.SyncableBoolean;
import openmods.tileentity.SyncedTileEntity;
public class TileEntityXPShower extends SyncedTileEntity implements INeighbourAwareTile, IAddAwareTile, ISurfaceAttachment, ITickable {
public class TileEntityXPShower extends SyncedTileEntity implements INeighbourAwareTile, IAddAwareTile, ITickable {
private static final int DRAIN_PER_CYCLE = 50;
@ -102,10 +100,4 @@ public class TileEntityXPShower extends SyncedTileEntity implements INeighbourAw
super.writeToNBT(nbt);
bufferTank.writeToNBT(nbt);
}
@Override
public EnumFacing getSurfaceDirection() {
return getOrientation().north();
}
}

View File

@ -1,4 +1,18 @@
[
{
version : "1.5.1",
sections :
[
{
title : "openblocks.gui.bugfixes",
lines :
[
"Blocks with internal tanks ignoring neighbouring tanks after reload",
"XP shower popping after block update"
]
}
]
},
{
version : "1.5",
sections :