Merge pull request #2802 from gamerforEA/6.5.x
Fix bugs and remove unnecessary nullchecks.
This commit is contained in:
commit
b6bac2c714
21 changed files with 108 additions and 122 deletions
|
@ -24,7 +24,7 @@ public abstract class ResourceId {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj.getClass() != getClass()) {
|
||||
if (obj == null || obj.getClass() != getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class BlockMarker extends BlockBuildCraft {
|
|||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(i, j, k);
|
||||
if (tile instanceof TileMarker && !(tile instanceof TileConstructionMarker)) {
|
||||
if (tile instanceof TileMarker) {
|
||||
((TileMarker) tile).tryConnection();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,32 +26,30 @@ public class RenderArchitect extends RenderBoxProvider {
|
|||
|
||||
TileArchitect architect = (TileArchitect) tileentity;
|
||||
|
||||
if (architect != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
|
||||
|
||||
for (LaserData laser : architect.subLasers) {
|
||||
if (laser != null) {
|
||||
GL11.glPushMatrix();
|
||||
RenderLaser
|
||||
.doRenderLaserWave(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
laser, EntityLaser.LASER_TEXTURES[3]);
|
||||
for (LaserData laser : architect.subLasers) {
|
||||
if (laser != null) {
|
||||
GL11.glPushMatrix();
|
||||
RenderLaser
|
||||
.doRenderLaserWave(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
laser, EntityLaser.LASER_TEXTURES[3]);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,39 +62,37 @@ public class RenderConstructionMarker extends RenderBoxProvider {
|
|||
|
||||
TileConstructionMarker marker = (TileConstructionMarker) tileentity;
|
||||
|
||||
if (marker != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
|
||||
|
||||
if (marker.laser != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
|
||||
|
||||
if (marker.laser != null) {
|
||||
GL11.glPushMatrix();
|
||||
RenderLaser
|
||||
.doRenderLaser(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
marker.laser, EntityLaser.LASER_TEXTURES[4]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (marker.itemBlueprint != null) {
|
||||
doRenderItem(marker.itemBlueprint,
|
||||
marker.xCoord + 0.5F,
|
||||
marker.yCoord + 0.2F,
|
||||
marker.zCoord + 0.5F);
|
||||
}
|
||||
|
||||
//GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopAttrib();
|
||||
RenderLaser
|
||||
.doRenderLaser(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
marker.laser, EntityLaser.LASER_TEXTURES[4]);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderItems.render(tileentity, x, y, z);
|
||||
}
|
||||
|
||||
if (marker.itemBlueprint != null) {
|
||||
doRenderItem(marker.itemBlueprint,
|
||||
marker.xCoord + 0.5F,
|
||||
marker.yCoord + 0.2F,
|
||||
marker.zCoord + 0.5F);
|
||||
}
|
||||
|
||||
//GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderItems.render(tileentity, x, y, z);
|
||||
}
|
||||
|
||||
public void doRenderItem(ItemStack stack, double x, double y, double z) {
|
||||
|
|
|
@ -662,11 +662,9 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
return new PacketCommand(this, "setItemRequirements", new CommandWriter() {
|
||||
public void write(ByteBuf data) {
|
||||
data.writeShort(items.size());
|
||||
if (items != null) {
|
||||
for (ItemStack rb : items) {
|
||||
NetworkUtils.writeStack(data, rb);
|
||||
data.writeShort(rb.stackSize);
|
||||
}
|
||||
for (ItemStack rb : items) {
|
||||
NetworkUtils.writeStack(data, rb);
|
||||
data.writeShort(rb.stackSize);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
|
|||
}
|
||||
|
||||
if (findTarget(false)) {
|
||||
if (box != null && ((headPosX < box.xMin || headPosX > box.xMax) || (headPosZ < box.zMin || headPosZ > box.zMax))) {
|
||||
if ((headPosX < box.xMin || headPosX > box.xMax) || (headPosZ < box.zMin || headPosZ > box.zMax)) {
|
||||
setHead(box.xMin + 1, yCoord + 2, box.zMin + 1);
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI
|
|||
// In this case, since idling() does it anyway, we should return.
|
||||
return;
|
||||
} else if (stage == Stage.MOVING) {
|
||||
int energyUsed = this.getBattery().useEnergy(20, (int) Math.ceil(20 + getBattery().getEnergyStored() / 10), false);
|
||||
int energyUsed = this.getBattery().useEnergy(20, (int) Math.ceil(20D + (double) getBattery().getEnergyStored() / 10), false);
|
||||
|
||||
if (energyUsed >= 20) {
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
|||
}
|
||||
|
||||
public void createDestroyItems(BuildingSlotBlock slot) {
|
||||
int hardness = (int) Math.ceil(getBlockBreakEnergy(slot) / BuilderAPI.BREAK_ENERGY);
|
||||
int hardness = (int) Math.ceil((double) getBlockBreakEnergy(slot) / BuilderAPI.BREAK_ENERGY);
|
||||
|
||||
for (int i = 0; i < hardness; ++i) {
|
||||
slot.addStackConsumed(new ItemStack(BuildCraftCore.buildToolBlock));
|
||||
|
@ -217,8 +217,6 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
|||
}
|
||||
|
||||
public void saveBuildStateToNBT(NBTTagCompound nbt, IBuildingItemsProvider builder) {
|
||||
NBTTagList clearList = new NBTTagList();
|
||||
|
||||
nbt.setByteArray("usedLocationList", BitSetUtils.toByteArray(usedLocations));
|
||||
|
||||
NBTTagList buildingList = new NBTTagList();
|
||||
|
|
|
@ -63,6 +63,9 @@ public final class SchematicRegistry implements ISchematicRegistry {
|
|||
}
|
||||
|
||||
for (Constructor<?> c : clazz.getConstructors()) {
|
||||
if (c == null) {
|
||||
continue;
|
||||
}
|
||||
Class<?>[] typesSignature = c.getParameterTypes();
|
||||
if (typesSignature.length != params.length) {
|
||||
// non-matching constructor count arguments, skip
|
||||
|
@ -87,7 +90,7 @@ public final class SchematicRegistry implements ISchematicRegistry {
|
|||
if (!valid) {
|
||||
continue;
|
||||
}
|
||||
if (c != null && params.length == 0) {
|
||||
if (params.length == 0) {
|
||||
emptyConstructorMap.put(clazz, c);
|
||||
}
|
||||
return c;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ConfigManager implements IModGuiFactory {
|
|||
}
|
||||
|
||||
public ConfigManager(Configuration c) {
|
||||
this.config = c;
|
||||
config = c;
|
||||
}
|
||||
|
||||
public ConfigCategory getCat(String name) {
|
||||
|
|
|
@ -445,14 +445,10 @@ public abstract class TileEngineBase extends TileBuildCraft implements IPipeConn
|
|||
public void getGUINetworkData(int id, int value) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
int iEnergy = Math.round(energy);
|
||||
iEnergy = (iEnergy & 0xffff0000) | (value & 0xffff);
|
||||
energy = iEnergy;
|
||||
energy = (energy & 0xffff0000) | (value & 0xffff);
|
||||
break;
|
||||
case 1:
|
||||
iEnergy = Math.round(energy);
|
||||
iEnergy = (iEnergy & 0xffff) | ((value & 0xffff) << 16);
|
||||
energy = iEnergy;
|
||||
energy = (energy & 0xffff) | ((value & 0xffff) << 16);
|
||||
break;
|
||||
case 2:
|
||||
currentOutput = value;
|
||||
|
@ -464,9 +460,9 @@ public abstract class TileEngineBase extends TileBuildCraft implements IPipeConn
|
|||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
iCrafting.sendProgressBarUpdate(container, 0, Math.round(energy) & 0xffff);
|
||||
iCrafting.sendProgressBarUpdate(container, 1, (Math.round(energy) & 0xffff0000) >> 16);
|
||||
iCrafting.sendProgressBarUpdate(container, 2, Math.round(currentOutput));
|
||||
iCrafting.sendProgressBarUpdate(container, 0, energy & 0xffff);
|
||||
iCrafting.sendProgressBarUpdate(container, 1, (energy & 0xffff0000) >> 16);
|
||||
iCrafting.sendProgressBarUpdate(container, 2, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(container, 3, Math.round(heat * 100));
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager {
|
|||
@Override
|
||||
public void addRecipe(String id, FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy,
|
||||
int delay) {
|
||||
String name = result.getFluid().getName();
|
||||
|
||||
if (ingredient1 == null || ingredient2 == null || result == null) {
|
||||
BCLog.logger.warn("Rejected refinery recipe " + id + " due to a null FluidStack!");
|
||||
|
|
|
@ -26,36 +26,34 @@ public class RenderBuilder extends RenderBoxProvider {
|
|||
|
||||
TileAbstractBuilder builder = (TileAbstractBuilder) tileentity;
|
||||
|
||||
if (builder != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
|
||||
|
||||
if (builder.getPathLaser() != null) {
|
||||
for (LaserData laser : builder.getPathLaser()) {
|
||||
if (laser != null) {
|
||||
GL11.glPushMatrix();
|
||||
RenderLaser
|
||||
.doRenderLaser(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
laser, EntityLaser.LASER_TEXTURES[4]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (builder.getPathLaser() != null) {
|
||||
for (LaserData laser : builder.getPathLaser()) {
|
||||
if (laser != null) {
|
||||
GL11.glPushMatrix();
|
||||
RenderLaser
|
||||
.doRenderLaser(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
laser, EntityLaser.LASER_TEXTURES[4]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
//GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderItems.render(tileentity, x, y, z);
|
||||
}
|
||||
|
||||
//GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderItems.render(tileentity, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
|||
return tankCoolant.fill(resource, doFill);
|
||||
} else if (BuildcraftFuelRegistry.fuel.getFuel(resource.getFluid()) != null) {
|
||||
int filled = tankFuel.fill(resource, doFill);
|
||||
if (filled > 0 && tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null && tankFuel.getFluid().getFluid() != currentFuel) {
|
||||
if (filled > 0 && tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null && (currentFuel == null || tankFuel.getFluid().getFluid() != currentFuel.getFluid())) {
|
||||
currentFuel = BuildcraftFuelRegistry.fuel.getFuel(tankFuel.getFluid().getFluid());
|
||||
}
|
||||
return filled;
|
||||
|
|
|
@ -1123,7 +1123,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
&& !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) {
|
||||
gameProfile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner"));
|
||||
}
|
||||
if (!StringUtils.isNullOrEmpty(gameProfile.getName())) {
|
||||
if (gameProfile != null && !StringUtils.isNullOrEmpty(gameProfile.getName())) {
|
||||
if (!gameProfile.isComplete()
|
||||
|| !gameProfile.getProperties().containsKey("textures")) {
|
||||
gameProfile = MinecraftServer.getServer().func_152358_ax()
|
||||
|
|
|
@ -34,7 +34,7 @@ public class StationIndex {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj.getClass() != getClass()) {
|
||||
if (obj == null || obj.getClass() != getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,13 +100,16 @@ public class TileLaser extends TileBuildCraft implements IHasWork, IControllable
|
|||
return;
|
||||
}
|
||||
|
||||
// We have a table and can work, so we create a laser if
|
||||
// necessary.
|
||||
laser.isVisible = true;
|
||||
// We have a laser
|
||||
if (laser != null) {
|
||||
// We have a table and can work, so we create a laser if
|
||||
// necessary.
|
||||
laser.isVisible = true;
|
||||
|
||||
// We have a laser and may update it
|
||||
if (laser != null && canUpdateLaser()) {
|
||||
updateLaser();
|
||||
// We may update laser
|
||||
if (canUpdateLaser()) {
|
||||
updateLaser();
|
||||
}
|
||||
}
|
||||
|
||||
// Consume power and transfer it to the table.
|
||||
|
|
|
@ -415,10 +415,8 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable
|
|||
pipeRemoved.clear();
|
||||
}
|
||||
|
||||
if (pipe != null) {
|
||||
pipeRemoved.put(new BlockIndex(x, y, z), pipe);
|
||||
updateNeighbourSignalState(pipe);
|
||||
}
|
||||
pipeRemoved.put(new BlockIndex(x, y, z), pipe);
|
||||
updateNeighbourSignalState(pipe);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
public void initFromPipe(Class<? extends Pipe> pipeClass) {
|
||||
capacity = LIQUID_IN_PIPE;
|
||||
flowRate = fluidCapacities.get(pipeClass);
|
||||
travelDelay = MathUtils.clamp(Math.round(16 / (flowRate / 10)), 1, MAX_TRAVEL_DELAY);
|
||||
travelDelay = MathUtils.clamp(Math.round(16F / (flowRate / 10)), 1, MAX_TRAVEL_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -108,7 +108,7 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> implements IEnergy
|
|||
FluidTankInfo tankInfo = transport.getTankInfo(side)[0];
|
||||
FluidStack extracted;
|
||||
|
||||
if (tankInfo.fluid != null && tankInfo.fluid != null) {
|
||||
if (tankInfo.fluid != null) {
|
||||
extracted = fluidHandler.drain(side.getOpposite(), new FluidStack(tankInfo.fluid, amount), false);
|
||||
} else {
|
||||
extracted = fluidHandler.drain(side.getOpposite(), amount, false);
|
||||
|
|
|
@ -12,12 +12,13 @@ import buildcraft.transport.PipeIconProvider;
|
|||
|
||||
public class PipePowerEmerald extends PipePowerWood {
|
||||
|
||||
protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerEmerald_Standard.ordinal();
|
||||
protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
|
||||
|
||||
public PipePowerEmerald(Item item) {
|
||||
super(item);
|
||||
|
||||
standardIconIndex = PipeIconProvider.TYPE.PipePowerEmerald_Standard.ordinal();
|
||||
|
||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
|
||||
|
||||
battery = new RFBattery(2560 * 50, 2560, 0);
|
||||
|
||||
transport.initFromPipe(this.getClass());
|
||||
|
|
|
@ -103,10 +103,6 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
|
|||
return;
|
||||
}
|
||||
|
||||
if (sources == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (allowExtraction) {
|
||||
allowExtraction = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue