Merge branch 'NextGen' of https://github.com/BuildCraft/BuildCraft into NextGen

This commit is contained in:
Andrew Dudney 2014-04-26 12:06:16 -06:00
commit 0f50e83564
5 changed files with 17 additions and 128 deletions

View file

@ -50,7 +50,6 @@ import buildcraft.core.CommandBuildCraft;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.DefaultProps;
import buildcraft.core.EntityEnergyLaser;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.ItemRobot;
@ -325,9 +324,7 @@ public class BuildCraftCore extends BuildCraftMod {
EntityRegistry.registerModEntity(EntityRobotPicker.class, "bcRobotPicker", EntityIds.ROBOT_PICKER, instance, 50, 1, true);
EntityRegistry.registerModEntity(EntityRobotBuilder.class, "bcRobotBuilder", EntityIds.ROBOT_BUILDER, instance, 50, 1, true);
EntityRegistry.registerModEntity(EntityRobotUrbanism.class, "bcRobotUrbanism", EntityIds.ROBOT_URBANISM, instance, 50, 1, true);
EntityRegistry.registerModEntity(EntityEnergyLaser.class, "bcEnergyLaser", EntityIds.ENERGY_LASER, instance, 50, 1, true);
EntityList.classToStringMapping.remove(EntityRobotBuilder.class);
EntityList.classToStringMapping.remove(EntityEnergyLaser.class);
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcRobot");
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");

View file

@ -24,8 +24,6 @@ import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import buildcraft.BuildCraftCore;
import buildcraft.api.core.Position;
import buildcraft.core.EntityEnergyLaser;
public class EntityUrbanist extends EntityLivingBase {
@ -33,7 +31,7 @@ public class EntityUrbanist extends EntityLivingBase {
* To be used only in debug sessions to adjust the mouse pointer parameters.
*/
private boolean debugPointer = false;
private EntityEnergyLaser laser = null;
// private EntityEnergyLaser laser = null;
public EntityLivingBase player;
public TileUrbanist tile;
@ -143,15 +141,15 @@ public class EntityUrbanist extends EntityLivingBase {
MovingObjectPosition result = this.worldObj.rayTraceBlocks(pos, vec32);
if (debugPointer) {
if (laser == null) {
// note: as this is on the client, it will only work if the
// server client update is deactivated in the server
// updateentity.
laser = new EntityEnergyLaser(worldObj, new Position(posX,
posY, posZ), new Position(posX, posY, posZ));
worldObj.spawnEntityInWorld(laser);
}
// if (laser == null) {
// // note: as this is on the client, it will only work if the
// // server client update is deactivated in the server
// // updateentity.
// laser = new EntityEnergyLaser(worldObj, new Position(posX,
// posY, posZ), new Position(posX, posY, posZ));
//
// worldObj.spawnEntityInWorld(laser);
// }
pos = this.getPosition(1.0F);
pos.xCoord += BuildCraftCore.diffX;
@ -165,13 +163,13 @@ public class EntityUrbanist extends EntityLivingBase {
pos.yCoord + look.yCoord * 200,
pos.zCoord + look.zCoord * 200);
laser.setPositions(
new Position(pos.xCoord, pos.yCoord, pos.zCoord),
new Position(aimed.xCoord, aimed.yCoord, aimed.zCoord));
if (!laser.isVisible()) {
laser.show();
}
// laser.setPositions(
// new Position(pos.xCoord, pos.yCoord, pos.zCoord),
// new Position(aimed.xCoord, aimed.yCoord, aimed.zCoord));
//
// if (!laser.isVisible()) {
// laser.show();
// }
}
return result;

View file

@ -1,77 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* 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.core;
import buildcraft.api.core.Position;
import static buildcraft.core.EntityLaser.LASER_TEXTURES;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class EntityEnergyLaser extends EntityLaser {
public static final short POWER_AVERAGING = 100;
public int displayStage = 0;
private final double power[] = new double[POWER_AVERAGING];
private int powerIndex = 0;
private double powerAverage = 0;
public EntityEnergyLaser(World world) {
super(world);
}
public EntityEnergyLaser(World world, Position head, Position tail) {
super(world, head, tail);
}
public void pushPower(double received) {
powerAverage -= power[powerIndex];
powerAverage += received;
power[powerIndex] = received;
powerIndex++;
if (powerIndex == power.length) {
powerIndex = 0;
}
}
public double getPowerAverage() {
return powerAverage / POWER_AVERAGING;
}
@Override
public ResourceLocation getTexture() {
if (getPowerAverage() <= 1.0)
return LASER_TEXTURES[0];
else if (getPowerAverage() <= 2.0)
return LASER_TEXTURES[1];
else if (getPowerAverage() <= 3.0)
return LASER_TEXTURES[2];
else
return LASER_TEXTURES[3];
}
@Override
protected void updateDataClient() {
super.updateDataClient();
powerAverage = (float) decodeDouble(dataWatcher.getWatchableObjectInt(15));
}
@Override
protected void updateDataServer() {
super.updateDataServer();
dataWatcher.updateObject(15, Integer.valueOf(encodeDouble(powerAverage)));
}
@Override
protected void entityInit() {
super.entityInit();
dataWatcher.addObject(15, Integer.valueOf(0));
}
}

View file

@ -29,8 +29,6 @@ import net.minecraftforge.client.MinecraftForgeClient;
import buildcraft.BuildCraftCore;
import buildcraft.api.core.LaserKind;
import buildcraft.core.EntityBlock;
import buildcraft.core.EntityEnergyLaser;
import buildcraft.core.render.RenderEnergyLaser;
import buildcraft.core.render.RenderEntityBlock;
import buildcraft.core.render.RenderRobot;
import buildcraft.core.render.RenderingEntityBlocks;
@ -111,7 +109,6 @@ public class CoreProxyClient extends CoreProxy {
@Override
public void initializeEntityRendering() {
RenderingRegistry.registerEntityRenderingHandler(EntityBlock.class, RenderEntityBlock.INSTANCE);
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyLaser.class, new RenderEnergyLaser());
RenderingRegistry.registerEntityRenderingHandler(EntityRobot.class, new RenderRobot());
RenderingRegistry.registerEntityRenderingHandler(EntityRobotBuilder.class, new RenderRobot());
}

View file

@ -1,26 +0,0 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* 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.core.render;
import net.minecraft.client.model.ModelRenderer;
public class RenderEnergyLaser extends RenderLaser {
private ModelRenderer box[] = new ModelRenderer[40];
public RenderEnergyLaser() {
for (int i = 0; i < box.length; ++i) {
box[i] = new ModelRenderer(model, box.length - i, 0);
box[i].addBox(0, -0.5F, -0.5F, 16, 1, 1);
box[i].rotationPointX = 0;
box[i].rotationPointY = 0;
box[i].rotationPointZ = 0;
}
}
}