fix #2274
This commit is contained in:
parent
b498bff9bd
commit
47a09b3a2a
4 changed files with 16 additions and 20 deletions
|
@ -722,6 +722,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
public void updateRequirements() {
|
||||
ArrayList<ItemStack> reqCopy = null;
|
||||
if (currentBuilder instanceof BptBuilderBlueprint) {
|
||||
currentBuilder.initialize();
|
||||
reqCopy = ((BptBuilderBlueprint) currentBuilder).neededItems;
|
||||
}
|
||||
|
||||
|
@ -733,6 +734,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
public void updateRequirements(EntityPlayer caller) {
|
||||
ArrayList<ItemStack> reqCopy = null;
|
||||
if (currentBuilder instanceof BptBuilderBlueprint) {
|
||||
currentBuilder.initialize();
|
||||
reqCopy = ((BptBuilderBlueprint) currentBuilder).neededItems;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,17 +62,21 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
|||
context = bluePrint.getContext(world, box);
|
||||
}
|
||||
|
||||
protected abstract void initialize ();
|
||||
public void initialize() {
|
||||
if (!initialized) {
|
||||
internalInit();
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void internalInit();
|
||||
|
||||
protected abstract BuildingSlot reserveNextBlock(World world);
|
||||
|
||||
protected abstract BuildingSlot getNextBlock(World world, TileAbstractBuilder inv);
|
||||
|
||||
public boolean buildNextSlot(World world, TileAbstractBuilder builder, double x, double y, double z) {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
initialize();
|
||||
|
||||
if (world.getTotalWorldTime() < nextBuildDate) {
|
||||
return false;
|
||||
|
@ -90,11 +94,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
|||
|
||||
public boolean buildSlot(World world, IBuildingItemsProvider builder, BuildingSlot slot, double x, double y,
|
||||
double z) {
|
||||
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
initialize();
|
||||
|
||||
if (slot != null) {
|
||||
slot.built = true;
|
||||
|
@ -113,10 +113,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
|||
}
|
||||
|
||||
public BuildingSlot reserveNextSlot(World world) {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
initialize();
|
||||
|
||||
return reserveNextBlock(world);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void initialize () {
|
||||
protected void internalInit () {
|
||||
for (int j = blueprint.sizeY - 1; j >= 0; --j) {
|
||||
for (int i = 0; i < blueprint.sizeX; ++i) {
|
||||
for (int k = 0; k < blueprint.sizeZ; ++k) {
|
||||
|
@ -192,10 +192,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
|
||||
public void deploy () {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
initialize();
|
||||
|
||||
for (BuildingSlotBlock b : buildList) {
|
||||
if (b.mode == Mode.ClearIfInvalid) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void initialize () {
|
||||
protected void internalInit () {
|
||||
if (blueprint.excavate) {
|
||||
for (int j = blueprint.sizeY - 1; j >= 0; --j) {
|
||||
for (int i = 0; i < blueprint.sizeX; ++i) {
|
||||
|
|
Loading…
Reference in a new issue