Code cleanup
This commit is contained in:
parent
b1076d8556
commit
1dcabf262b
16 changed files with 14 additions and 51 deletions
|
@ -151,8 +151,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void loadConfiguration(FMLPreInitializationEvent evt) {
|
public void loadConfiguration(FMLPreInitializationEvent evt) {
|
||||||
File bptMainDir = new File(new File(evt.getModConfigurationDirectory(), "buildcraft"), "blueprints");
|
|
||||||
|
|
||||||
String blueprintServerDir = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL,
|
String blueprintServerDir = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL,
|
||||||
"blueprints.serverDir",
|
"blueprints.serverDir",
|
||||||
"\"$MINECRAFT" + File.separator + "config" + File.separator + "buildcraft" + File.separator
|
"\"$MINECRAFT" + File.separator + "config" + File.separator + "buildcraft" + File.separator
|
||||||
|
@ -185,9 +183,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
||||||
BuildCraftCore.mainConfiguration.save();
|
BuildCraftCore.mainConfiguration.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
File serverDir = new File (bptMainDir, "server");
|
|
||||||
File clientDir = new File (bptMainDir, "client");
|
|
||||||
|
|
||||||
serverDB = new BlueprintDatabase();
|
serverDB = new BlueprintDatabase();
|
||||||
clientDB = new BlueprintDatabase();
|
clientDB = new BlueprintDatabase();
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(i, j, k);
|
//int meta = world.getBlockMetadata(i, j, k);
|
||||||
|
|
||||||
// TODO: the exculded list is not taken into account. This probably
|
// TODO: the exculded list is not taken into account. This probably
|
||||||
// needs to be migrated to an implementation based on names instead
|
// needs to be migrated to an implementation based on names instead
|
||||||
|
@ -493,8 +493,6 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
public static Item buildPipe(Class<? extends Pipe> clas,
|
public static Item buildPipe(Class<? extends Pipe> clas,
|
||||||
String descr, CreativeTabBuildCraft creativeTab,
|
String descr, CreativeTabBuildCraft creativeTab,
|
||||||
Object... ingredients) {
|
Object... ingredients) {
|
||||||
String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
|
|
||||||
|
|
||||||
ItemPipe res = BlockGenericPipe.registerPipe(clas, creativeTab);
|
ItemPipe res = BlockGenericPipe.registerPipe(clas, creativeTab);
|
||||||
res.setUnlocalizedName(clas.getSimpleName());
|
res.setUnlocalizedName(clas.getSimpleName());
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,6 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(i, j, k);
|
TileEntity tile = world.getTileEntity(i, j, k);
|
||||||
if (tile instanceof TileBlueprintLibrary) {
|
if (tile instanceof TileBlueprintLibrary) {
|
||||||
TileBlueprintLibrary tileBlueprint = (TileBlueprintLibrary) tile;
|
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,6 @@ public class Version implements Runnable {
|
||||||
|
|
||||||
public static final String VERSION = "@VERSION@";
|
public static final String VERSION = "@VERSION@";
|
||||||
public static EnumUpdateState currentVersion = EnumUpdateState.CURRENT;
|
public static EnumUpdateState currentVersion = EnumUpdateState.CURRENT;
|
||||||
public static final int FORGE_VERSION_MAJOR = 4;
|
|
||||||
public static final int FORGE_VERSION_MINOR = 0;
|
|
||||||
public static final int FORGE_VERSION_PATCH = 0;
|
|
||||||
|
|
||||||
private static final String REMOTE_VERSION_FILE =
|
private static final String REMOTE_VERSION_FILE =
|
||||||
"https://raw.githubusercontent.com/BuildCraft/BuildCraft/master/buildcraft_resources/versions.txt";
|
"https://raw.githubusercontent.com/BuildCraft/BuildCraft/master/buildcraft_resources/versions.txt";
|
||||||
|
|
|
@ -40,7 +40,6 @@ public abstract class BlueprintBase {
|
||||||
|
|
||||||
protected MappingRegistry mapping = new MappingRegistry();
|
protected MappingRegistry mapping = new MappingRegistry();
|
||||||
|
|
||||||
private String version = "";
|
|
||||||
private ComputeDataThread computeData;
|
private ComputeDataThread computeData;
|
||||||
private byte [] data;
|
private byte [] data;
|
||||||
|
|
||||||
|
@ -122,7 +121,7 @@ public abstract class BlueprintBase {
|
||||||
context.rotateLeft();
|
context.rotateLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT (NBTTagCompound nbt) {
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
nbt.setString("version", Version.VERSION);
|
nbt.setString("version", Version.VERSION);
|
||||||
|
|
||||||
if (this instanceof Template) {
|
if (this instanceof Template) {
|
||||||
|
@ -164,10 +163,6 @@ public abstract class BlueprintBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT (NBTTagCompound nbt) {
|
public void readFromNBT (NBTTagCompound nbt) {
|
||||||
BlueprintBase result = null;
|
|
||||||
|
|
||||||
String versionRead = nbt.getString("version");
|
|
||||||
|
|
||||||
sizeX = nbt.getInteger("sizeX");
|
sizeX = nbt.getInteger("sizeX");
|
||||||
sizeY = nbt.getInteger("sizeY");
|
sizeY = nbt.getInteger("sizeY");
|
||||||
sizeZ = nbt.getInteger("sizeZ");
|
sizeZ = nbt.getInteger("sizeZ");
|
||||||
|
@ -189,10 +184,10 @@ public abstract class BlueprintBase {
|
||||||
excavate = true;
|
excavate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
contents = new SchematicBlockBase [sizeX][sizeY][sizeZ];
|
contents = new SchematicBlockBase[sizeX][sizeY][sizeZ];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loadContents (nbt);
|
loadContents(nbt);
|
||||||
} catch (BptError e) {
|
} catch (BptError e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -217,7 +212,7 @@ public abstract class BlueprintBase {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BptContext getContext (World world, Box box) {
|
public BptContext getContext(World world, Box box) {
|
||||||
return new BptContext(world, box, mapping);
|
return new BptContext(world, box, mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +235,7 @@ public abstract class BlueprintBase {
|
||||||
* This data is computed asynchronously. If the data is not yet available,
|
* This data is computed asynchronously. If the data is not yet available,
|
||||||
* null will be returned.
|
* null will be returned.
|
||||||
*/
|
*/
|
||||||
public synchronized byte [] getData () {
|
public synchronized byte[] getData() {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
return data;
|
return data;
|
||||||
} else if (computeData == null) {
|
} else if (computeData == null) {
|
||||||
|
@ -263,7 +258,7 @@ public abstract class BlueprintBase {
|
||||||
|
|
||||||
public abstract void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z);
|
public abstract void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z);
|
||||||
|
|
||||||
public abstract ItemStack getStack ();
|
public abstract ItemStack getStack();
|
||||||
|
|
||||||
public void readEntitiesFromWorld(IBuilderContext context, TileEntity anchorTile) {
|
public void readEntitiesFromWorld(IBuilderContext context, TileEntity anchorTile) {
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.core.blueprints;
|
package buildcraft.core.blueprints;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -37,14 +36,12 @@ public class Template extends BlueprintBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z) {
|
public void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z) {
|
||||||
Block block = anchorTile.getWorldObj().getBlock(x, y, z);
|
|
||||||
|
|
||||||
int posX = (int) (x - context.surroundingBox().pMin().x);
|
int posX = (int) (x - context.surroundingBox().pMin().x);
|
||||||
int posY = (int) (y - context.surroundingBox().pMin().y);
|
int posY = (int) (y - context.surroundingBox().pMin().y);
|
||||||
int posZ = (int) (z - context.surroundingBox().pMin().z);
|
int posZ = (int) (z - context.surroundingBox().pMin().z);
|
||||||
|
|
||||||
if (!BuildCraftAPI.isSoftBlock(anchorTile.getWorldObj(), x, y, z)) {
|
if (!BuildCraftAPI.isSoftBlock(anchorTile.getWorldObj(), x, y, z)) {
|
||||||
contents [posX][posY][posZ] = new SchematicMask(true);
|
contents[posX][posY][posZ] = new SchematicMask(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +51,7 @@ public class Template extends BlueprintBase {
|
||||||
// per mask entry, not a byte. However, this is fine, as compression
|
// per mask entry, not a byte. However, this is fine, as compression
|
||||||
// will fix it.
|
// will fix it.
|
||||||
|
|
||||||
byte [] data = new byte [sizeX * sizeY * sizeZ];
|
byte [] data = new byte[sizeX * sizeY * sizeZ];
|
||||||
int ind = 0;
|
int ind = 0;
|
||||||
|
|
||||||
for (int x = 0; x < sizeX; ++x) {
|
for (int x = 0; x < sizeX; ++x) {
|
||||||
|
@ -78,7 +75,7 @@ public class Template extends BlueprintBase {
|
||||||
for (int y = 0; y < sizeY; ++y) {
|
for (int y = 0; y < sizeY; ++y) {
|
||||||
for (int z = 0; z < sizeZ; ++z) {
|
for (int z = 0; z < sizeZ; ++z) {
|
||||||
if (data [ind] == 1) {
|
if (data [ind] == 1) {
|
||||||
contents [x][y][z] = new SchematicMask(true);
|
contents[x][y][z] = new SchematicMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ind++;
|
ind++;
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class TilePacketWrapper {
|
||||||
this(new Class[] {c});
|
this(new Class[] {c});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public TilePacketWrapper(Class[] c) {
|
public TilePacketWrapper(Class[] c) {
|
||||||
rootMappings = new ClassSerializer [c.length];
|
rootMappings = new ClassSerializer [c.length];
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class ClassMapping extends ClassSerializer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
public void analyzeClass(final Class<? extends Object> c) {
|
public void analyzeClass(final Class<? extends Object> c) {
|
||||||
try {
|
try {
|
||||||
if (c.isArray()) {
|
if (c.isArray()) {
|
||||||
|
|
|
@ -57,8 +57,6 @@ public class RenderEnergyEmitter extends TileEntitySpecialRenderer {
|
||||||
|
|
||||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||||
|
|
||||||
float step;
|
|
||||||
|
|
||||||
float[] angle = {0, 0, 0};
|
float[] angle = {0, 0, 0};
|
||||||
|
|
||||||
box.rotateAngleX = angle[0];
|
box.rotateAngleX = angle[0];
|
||||||
|
|
|
@ -105,7 +105,6 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSlots() {
|
private void updateSlots() {
|
||||||
|
|
||||||
Fluid filter0 = container.getFilter(0);
|
Fluid filter0 = container.getFilter(0);
|
||||||
Fluid filter1 = container.getFilter(1);
|
Fluid filter1 = container.getFilter(1);
|
||||||
|
|
||||||
|
@ -114,14 +113,11 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
||||||
((FluidSlot) slots[1]).fluid = filter1;
|
((FluidSlot) slots[1]).fluid = filter1;
|
||||||
((FluidSlot) slots[1]).colorRenderCache = container.refinery.tanks[1].colorRenderCache;
|
((FluidSlot) slots[1]).colorRenderCache = container.refinery.tanks[1].colorRenderCache;
|
||||||
|
|
||||||
FluidStack liquid0 = null;
|
|
||||||
FluidStack liquid1 = null;
|
|
||||||
|
|
||||||
if (filter0 != null) {
|
if (filter0 != null) {
|
||||||
liquid0 = new FluidStack(filter0, FluidContainerRegistry.BUCKET_VOLUME);
|
FluidStack liquid0 = new FluidStack(filter0, FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
}
|
}
|
||||||
if (filter1 != null) {
|
if (filter1 != null) {
|
||||||
liquid1 = new FluidStack(filter1, FluidContainerRegistry.BUCKET_VOLUME);
|
FluidStack liquid1 = new FluidStack(filter1, FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftingResult<FluidStack> crafting = container.refinery.craftingResult;
|
CraftingResult<FluidStack> crafting = container.refinery.craftingResult;
|
||||||
|
|
|
@ -64,7 +64,6 @@ public class ContainerAdvancedCraftingTable extends BuildCraftContainer {
|
||||||
return workbench.isUseableByPlayer(var1);
|
return workbench.isUseableByPlayer(var1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges() {
|
public void detectAndSendChanges() {
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
|
|
|
@ -52,7 +52,6 @@ public class ContainerIntegrationTable extends BuildCraftContainer {
|
||||||
return table.isUseableByPlayer(var1);
|
return table.isUseableByPlayer(var1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges() {
|
public void detectAndSendChanges() {
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
|
|
|
@ -60,13 +60,9 @@ public class GuiRedstoneBoard extends GuiAdvancedInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
int xscreen = (width - xSize) / 2;
|
|
||||||
int yscreen = (height - ySize) / 2;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,6 @@ package buildcraft.transport.pipes;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -110,8 +109,6 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mjStored >= 1) {
|
if (mjStored >= 1) {
|
||||||
World w = container.getWorld();
|
|
||||||
|
|
||||||
if (meta > 5) {
|
if (meta > 5) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,6 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
List<Entity> discoveredEntities = container.getWorldObj().getEntitiesWithinAABB(Entity.class, box);
|
List<Entity> discoveredEntities = container.getWorldObj().getEntitiesWithinAABB(Entity.class, box);
|
||||||
|
|
||||||
for (Entity entity : discoveredEntities) {
|
for (Entity entity : discoveredEntities) {
|
||||||
|
|
|
@ -228,7 +228,6 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> {
|
||||||
transport.injectItem(newItem, direction.getOpposite());
|
transport.injectItem(newItem, direction.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public boolean convertPipe(PipeTransportItems pipe, TravelingItem item) {
|
public boolean convertPipe(PipeTransportItems pipe, TravelingItem item) {
|
||||||
if (item.getItemStack().getItem() instanceof ItemPipe) {
|
if (item.getItemStack().getItem() instanceof ItemPipe) {
|
||||||
if (!(item.getItemStack().getItem() == BuildCraftTransport.pipeItemsStripes)) {
|
if (!(item.getItemStack().getItem() == BuildCraftTransport.pipeItemsStripes)) {
|
||||||
|
|
Loading…
Reference in a new issue