minor cleanup

This commit is contained in:
Adrian 2015-09-12 21:17:06 +02:00
parent 80307e4c8e
commit 7b2fd345c8
9 changed files with 4 additions and 105 deletions

View file

@ -182,7 +182,7 @@ public class BuildCraftCore extends BuildCraftMod {
public static BuildCraftCore instance;
public static final boolean NONRELEASED_BLOCKS = true;
public static final boolean TABLET_TESTING = false;
public static final boolean TABLET_TESTING = true;
public enum RenderMode {
Full, NoDynamic
@ -270,16 +270,8 @@ public class BuildCraftCore extends BuildCraftMod {
public static Achievement wrenchAchievement;
public static Achievement engineRedstoneAchievement;
public static float diffX, diffY, diffZ;
public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("buildcraft.core".getBytes()), "[BuildCraft]");
private static FloatBuffer modelviewF;
private static FloatBuffer projectionF;
private static IntBuffer viewport;
private static FloatBuffer pos = ByteBuffer.allocateDirect(3 * 4).asFloatBuffer();
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
BCLog.logger.info("Starting BuildCraft " + Version.getVersion());
@ -696,64 +688,6 @@ public class BuildCraftCore extends BuildCraftMod {
InterModComms.processIMC(event);
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderLast (RenderWorldLastEvent evt) {
// TODO: while the urbanist is deactivated, this code can be dormant.
// it happens to be very expensive at run time, so we need some way
// to operate it only when relevant (e.g. in the cycle following a
// click request).
if (NONRELEASED_BLOCKS) {
return;
}
/**
* Note (SpaceToad): Why on earth this thing eventually worked out is a
* mystery to me. In particular, all the examples I got computed y in
* a different way. Anyone with further OpenGL understanding would be
* welcome to explain.
*
* Anyway, the purpose of this code is to store the block position
* pointed by the mouse at each frame, relative to the entity that has
* the camera.
*
* It got heavily inspire from the two following sources:
* http://nehe.gamedev.net/article/using_gluunproject/16013/
* #ActiveRenderInfo.updateRenderInfo.
*
* See EntityUrbanist#rayTraceMouse for a usage example.
*/
if (modelviewF == null) {
modelviewF = GLAllocation.createDirectFloatBuffer(16);
projectionF = GLAllocation.createDirectFloatBuffer(16);
viewport = GLAllocation.createDirectIntBuffer(16);
}
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelviewF);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projectionF);
GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);
float f = (viewport.get(0) + viewport.get(2)) / 2;
float f1 = (viewport.get(1) + viewport.get(3)) / 2;
float x = Mouse.getX();
float y = Mouse.getY();
// TODO: Minecraft seems to instist to have this winZ re-created at
// each frame - looks like a memory leak to me but I couldn't use a
// static variable instead, as for the rest.
FloatBuffer winZ = GLAllocation.createDirectFloatBuffer(1);
GL11.glReadPixels((int) x, (int) y, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZ);
GLU.gluUnProject(x, y, winZ.get(), modelviewF, projectionF, viewport,
pos);
diffX = pos.get(0);
diffY = pos.get(1);
diffZ = pos.get(2);
}
@SubscribeEvent
public void cleanRegistries(WorldEvent.Unload event) {
for (IWorldProperty property : BuildCraftAPI.worldProperties.values()) {

View file

@ -29,8 +29,6 @@ import buildcraft.core.blueprints.LibraryId;
import buildcraft.core.lib.utils.NBTUtils;
public class LibraryDatabase {
private static final int PAGE_SIZE = 12;
protected Set<LibraryId> blueprintIds;
protected LibraryId[] pages = new LibraryId[0];

View file

@ -111,10 +111,6 @@ public abstract class AdvancedSlot {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
public void selected () {
}
public boolean shouldDrawHighlight() {
return true;
}

View file

@ -445,7 +445,6 @@ public abstract class GuiBuildCraft extends GuiContainer {
public int currentShiftX = 0;
public int currentShiftY = 0;
protected int overlayColor = 0xffffff;
protected int limitWidth = 128;
protected int maxWidth = 124;
protected int minWidth = 24;
protected int currentWidth = minWidth;

View file

@ -1,17 +0,0 @@
package buildcraft.core.lib.network;
import io.netty.buffer.ByteBuf;
import buildcraft.api.core.ISerializable;
public class Serializable implements ISerializable {
@Override
public void readData(ByteBuf stream) {
}
@Override
public void writeData(ByteBuf stream) {
}
}

View file

@ -6,7 +6,7 @@
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy.worldgen;
package buildcraft.core.lib.utils;
/**
* A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java.

View file

@ -13,6 +13,8 @@ import java.util.Random;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
import buildcraft.core.lib.utils.SimplexNoise;
public abstract class GenLayerBiomeReplacer extends GenLayer {
public static final int OFFSET_RANGE = 500000;

View file

@ -32,9 +32,6 @@ public class TransportProxy {
public void registerRenderers() {
}
public void initIconProviders(BuildCraftTransport instance){
}
public void setIconProviderFromPipe(ItemPipe item, Pipe<?> dummyPipe) {
}

View file

@ -139,14 +139,6 @@ public class TravelingItem {
return extraData != null;
}
@Deprecated
public void setInsetionHandler(InsertionHandler handler) {
if (handler == null) {
return;
}
this.insertionHandler = handler;
}
public void setInsertionHandler(InsertionHandler handler) {
if (handler == null) {
return;
@ -321,14 +313,12 @@ public class TravelingItem {
}
public static class InsertionHandler {
public boolean canInsertItem(TravelingItem item, IInventory inv) {
return true;
}
}
public static class TravelingItemCache {
private final Map<Integer, TravelingItem> itemCache = new MapMaker().weakValues().makeMap();
public void cache(TravelingItem item) {