Code cleanup

This commit is contained in:
Raul Tambre 2014-06-13 21:11:02 +03:00
parent b1076d8556
commit 1dcabf262b
16 changed files with 14 additions and 51 deletions

View file

@ -151,8 +151,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
File bptMainDir = new File(new File(evt.getModConfigurationDirectory(), "buildcraft"), "blueprints");
String blueprintServerDir = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL,
"blueprints.serverDir",
"\"$MINECRAFT" + File.separator + "config" + File.separator + "buildcraft" + File.separator
@ -185,9 +183,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
BuildCraftCore.mainConfiguration.save();
}
File serverDir = new File (bptMainDir, "server");
File clientDir = new File (bptMainDir, "client");
serverDB = new BlueprintDatabase();
clientDB = new BlueprintDatabase();

View file

@ -227,7 +227,7 @@ public class BuildCraftTransport extends BuildCraftMod {
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
// 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,
String descr, CreativeTabBuildCraft creativeTab,
Object... ingredients) {
String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
ItemPipe res = BlockGenericPipe.registerPipe(clas, creativeTab);
res.setUnlocalizedName(clas.getSimpleName());

View file

@ -47,8 +47,6 @@ public class BlockBlueprintLibrary extends BlockContainer {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof TileBlueprintLibrary) {
TileBlueprintLibrary tileBlueprint = (TileBlueprintLibrary) tile;
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
}

View file

@ -34,9 +34,6 @@ public class Version implements Runnable {
public static final String VERSION = "@VERSION@";
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 =
"https://raw.githubusercontent.com/BuildCraft/BuildCraft/master/buildcraft_resources/versions.txt";

View file

@ -40,7 +40,6 @@ public abstract class BlueprintBase {
protected MappingRegistry mapping = new MappingRegistry();
private String version = "";
private ComputeDataThread computeData;
private byte [] data;
@ -122,7 +121,7 @@ public abstract class BlueprintBase {
context.rotateLeft();
}
public void writeToNBT (NBTTagCompound nbt) {
public void writeToNBT(NBTTagCompound nbt) {
nbt.setString("version", Version.VERSION);
if (this instanceof Template) {
@ -164,10 +163,6 @@ public abstract class BlueprintBase {
}
public void readFromNBT (NBTTagCompound nbt) {
BlueprintBase result = null;
String versionRead = nbt.getString("version");
sizeX = nbt.getInteger("sizeX");
sizeY = nbt.getInteger("sizeY");
sizeZ = nbt.getInteger("sizeZ");
@ -189,10 +184,10 @@ public abstract class BlueprintBase {
excavate = true;
}
contents = new SchematicBlockBase [sizeX][sizeY][sizeZ];
contents = new SchematicBlockBase[sizeX][sizeY][sizeZ];
try {
loadContents (nbt);
loadContents(nbt);
} catch (BptError e) {
e.printStackTrace();
}
@ -217,7 +212,7 @@ public abstract class BlueprintBase {
return res;
}
public BptContext getContext (World world, Box box) {
public BptContext getContext(World world, Box box) {
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,
* null will be returned.
*/
public synchronized byte [] getData () {
public synchronized byte[] getData() {
if (data != null) {
return data;
} 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 ItemStack getStack ();
public abstract ItemStack getStack();
public void readEntitiesFromWorld(IBuilderContext context, TileEntity anchorTile) {

View file

@ -8,7 +8,6 @@
*/
package buildcraft.core.blueprints;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -37,14 +36,12 @@ public class Template extends BlueprintBase {
@Override
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 posY = (int) (y - context.surroundingBox().pMin().y);
int posZ = (int) (z - context.surroundingBox().pMin().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
// will fix it.
byte [] data = new byte [sizeX * sizeY * sizeZ];
byte [] data = new byte[sizeX * sizeY * sizeZ];
int ind = 0;
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 z = 0; z < sizeZ; ++z) {
if (data [ind] == 1) {
contents [x][y][z] = new SchematicMask(true);
contents[x][y][z] = new SchematicMask(true);
}
ind++;

View file

@ -24,7 +24,7 @@ public class TilePacketWrapper {
this(new Class[] {c});
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes" })
public TilePacketWrapper(Class[] c) {
rootMappings = new ClassSerializer [c.length];

View file

@ -105,7 +105,7 @@ public class ClassMapping extends ClassSerializer {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes" })
public void analyzeClass(final Class<? extends Object> c) {
try {
if (c.isArray()) {

View file

@ -57,8 +57,6 @@ public class RenderEnergyEmitter extends TileEntitySpecialRenderer {
GL11.glTranslatef((float) x, (float) y, (float) z);
float step;
float[] angle = {0, 0, 0};
box.rotateAngleX = angle[0];

View file

@ -105,7 +105,6 @@ public class GuiRefinery extends GuiAdvancedInterface {
}
private void updateSlots() {
Fluid filter0 = container.getFilter(0);
Fluid filter1 = container.getFilter(1);
@ -114,14 +113,11 @@ public class GuiRefinery extends GuiAdvancedInterface {
((FluidSlot) slots[1]).fluid = filter1;
((FluidSlot) slots[1]).colorRenderCache = container.refinery.tanks[1].colorRenderCache;
FluidStack liquid0 = null;
FluidStack liquid1 = null;
if (filter0 != null) {
liquid0 = new FluidStack(filter0, FluidContainerRegistry.BUCKET_VOLUME);
FluidStack liquid0 = new FluidStack(filter0, FluidContainerRegistry.BUCKET_VOLUME);
}
if (filter1 != null) {
liquid1 = new FluidStack(filter1, FluidContainerRegistry.BUCKET_VOLUME);
FluidStack liquid1 = new FluidStack(filter1, FluidContainerRegistry.BUCKET_VOLUME);
}
CraftingResult<FluidStack> crafting = container.refinery.craftingResult;

View file

@ -64,7 +64,6 @@ public class ContainerAdvancedCraftingTable extends BuildCraftContainer {
return workbench.isUseableByPlayer(var1);
}
@SuppressWarnings("rawtypes")
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();

View file

@ -52,7 +52,6 @@ public class ContainerIntegrationTable extends BuildCraftContainer {
return table.isUseableByPlayer(var1);
}
@SuppressWarnings("rawtypes")
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();

View file

@ -60,13 +60,9 @@ public class GuiRedstoneBoard extends GuiAdvancedInterface {
}
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
int xscreen = (width - xSize) / 2;
int yscreen = (height - ySize) / 2;
}
@Override

View file

@ -11,7 +11,6 @@ package buildcraft.transport.pipes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -110,8 +109,6 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> {
}
if (mjStored >= 1) {
World w = container.getWorld();
if (meta > 5) {
return;
}

View file

@ -167,7 +167,6 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> {
return false;
}
@SuppressWarnings("rawtypes")
List<Entity> discoveredEntities = container.getWorldObj().getEntitiesWithinAABB(Entity.class, box);
for (Entity entity : discoveredEntities) {

View file

@ -228,7 +228,6 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> {
transport.injectItem(newItem, direction.getOpposite());
}
@SuppressWarnings("unchecked")
public boolean convertPipe(PipeTransportItems pipe, TravelingItem item) {
if (item.getItemStack().getItem() instanceof ItemPipe) {
if (!(item.getItemStack().getItem() == BuildCraftTransport.pipeItemsStripes)) {