Fixed the quarry arm in SMP.

This commit is contained in:
Kyprus 2012-05-12 15:25:46 -04:00
parent c72a7729d7
commit 169a8a4805
5 changed files with 23 additions and 42 deletions

View file

@ -28,7 +28,6 @@ import net.minecraft.src.buildcraft.core.CoreProxy;
import net.minecraft.src.buildcraft.core.DefaultActionProvider;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.DefaultTriggerProvider;
import net.minecraft.src.buildcraft.core.EntityBlock;
import net.minecraft.src.buildcraft.core.EntityLaser;
import net.minecraft.src.buildcraft.core.EntityRobot;
import net.minecraft.src.buildcraft.core.ItemBuildCraftTexture;
@ -130,7 +129,7 @@ public class BuildCraftCore {
MinecraftForge.registerConnectionHandler(new ConnectionHandler());
MinecraftForge.registerEntity(EntityRobot.class, mod_BuildCraftCore.instance, EntityIds.ROBOT, 50, 10, true);
MinecraftForge.registerEntity(EntityBlock.class, mod_BuildCraftCore.instance, EntityIds.BLOCK, 50, 10, true);
//MinecraftForge.registerEntity(EntityBlock.class, mod_BuildCraftCore.instance, EntityIds.BLOCK, 50, 10, true);
MinecraftForge.registerEntity(EntityLaser.class, mod_BuildCraftCore.instance, EntityIds.LASER, 50, 10, true);
}

View file

@ -20,7 +20,6 @@ import net.minecraft.src.buildcraft.core.BlockIndex;
import net.minecraft.src.buildcraft.core.CoreProxy;
import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.ItemBuildCraftTexture;
import net.minecraft.src.buildcraft.core.network.EntityIds;
import net.minecraft.src.buildcraft.energy.BlockEngine;
import net.minecraft.src.buildcraft.energy.BlockOilFlowing;
import net.minecraft.src.buildcraft.energy.BlockOilStill;
@ -33,7 +32,6 @@ import net.minecraft.src.buildcraft.energy.ItemFuel;
import net.minecraft.src.buildcraft.energy.OilBucketHandler;
import net.minecraft.src.buildcraft.energy.OilPopulate;
import net.minecraft.src.buildcraft.energy.TriggerEngineHeat;
import net.minecraft.src.buildcraft.factory.EntityMechanicalArm;
import net.minecraft.src.forge.Configuration;
import net.minecraft.src.forge.MinecraftForge;
import net.minecraft.src.forge.Property;
@ -65,7 +63,7 @@ public class BuildCraftEnergy {
// Register gui handler
MinecraftForge.setGuiHandler(mod_BuildCraftEnergy.instance, new GuiHandler());
MinecraftForge.registerEntity(EntityMechanicalArm.class, mod_BuildCraftEnergy.instance, EntityIds.MECHANICAL_ARM, 50, 10, true);
//MinecraftForge.registerEntity(EntityMechanicalArm.class, mod_BuildCraftEnergy.instance, EntityIds.MECHANICAL_ARM, 50, 10, true);
}
public static void initialize () {

View file

@ -49,17 +49,10 @@ public class EntityRobot extends Entity {
public static int MAX_SIZE = 20;
/**
* Constructor for Forge Netcode
* @param world
* @param xPos
* @param yPos
* @param zPos
*/
public EntityRobot(World world, double xPos, double yPos, double zPos) {
super(world);
setPosition(xPos, yPos, zPos);
public EntityRobot(World world) {
super(world);
}
public EntityRobot(World world, Box box) {
super(world);

View file

@ -35,17 +35,7 @@ public class EntityMechanicalArm extends Entity {
public EntityMechanicalArm(World world) {
super (world);
}
/**
* Constructor for Forge netcode.
* @param world
* @param xPos
* @param yPos
* @param zPos
*/
public EntityMechanicalArm(World world, double xPos, double yPos, double zPos) {
super(world);
setPosition(xPos, yPos, zPos);
}
public EntityMechanicalArm(World world, double i, double j, double k, double width, double height) {
super(world);
@ -91,10 +81,7 @@ public class EntityMechanicalArm extends Entity {
}
@Override
protected void entityInit() {
// TODO Auto-generated method stub
}
protected void entityInit() {}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {

View file

@ -20,8 +20,8 @@ import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.IAreaProvider;
import net.minecraft.src.buildcraft.api.IPipeConnection;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
@ -32,8 +32,8 @@ import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.core.Box;
import net.minecraft.src.buildcraft.core.BptBlueprint;
import net.minecraft.src.buildcraft.core.BptBuilderBlueprint;
import net.minecraft.src.buildcraft.core.BptBuilderBase;
import net.minecraft.src.buildcraft.core.BptBuilderBlueprint;
import net.minecraft.src.buildcraft.core.DefaultAreaProvider;
import net.minecraft.src.buildcraft.core.EntityRobot;
import net.minecraft.src.buildcraft.core.IBuilderInventory;
@ -56,6 +56,7 @@ public class TileQuarry extends TileMachine implements IArmListener,
public @TileNetworkData double speed = 0.03;
public EntityRobot builder;
public @TileNetworkData boolean builderDone = false;
boolean loadArm = false;
@ -83,7 +84,7 @@ public class TileQuarry extends TileMachine implements IArmListener,
initializeBluePrintBuilder();
}
if (bluePrintBuilder.done) {
if (builderDone) {
box.deleteLasers();
if (arm == null) {
@ -129,7 +130,7 @@ public class TileQuarry extends TileMachine implements IArmListener,
.useEnergy(energyToUse, energyToUse, true);
if (energy > 0) {
arm.doMove(0.015 + (float) energy / 200F);
arm.doMove(0.015 + energy / 200F);
}
}
@ -147,7 +148,10 @@ public class TileQuarry extends TileMachine implements IArmListener,
}
@Override
public void doWork() {
public void doWork() {
builderDone = bluePrintBuilder.done;
if (APIProxy.isClient(worldObj)) {
return;
}
@ -163,7 +167,7 @@ public class TileQuarry extends TileMachine implements IArmListener,
createUtilsIfNeeded();
if (bluePrintBuilder != null) {
if (!bluePrintBuilder.done) {
if (!builderDone) {
// configuration for building phase
powerProvider.configure(20, 25, 25, 25, MAX_ENERGY);
@ -351,9 +355,9 @@ public class TileQuarry extends TileMachine implements IArmListener,
return;
}
int i = (int) targetX;
int j = (int) targetY - 1;
int k = (int) targetZ;
int i = targetX;
int j = targetY - 1;
int k = targetZ;
//Collect any lost items laying around
AxisAlignedBB axis = AxisAlignedBB.getBoundingBoxFromPool(arm.headPosX - 0.5, arm.headPosY, arm.headPosZ - 0.5, arm.headPosX + 1.5, arm.headPosY + 1.5, arm.headPosZ + 1.5);
@ -386,7 +390,7 @@ public class TileQuarry extends TileMachine implements IArmListener,
}
}
worldObj.setBlockWithNotify((int) i, (int) j, (int) k, 0);
worldObj.setBlockWithNotify(i, j, k, 0);
}
}
@ -413,8 +417,8 @@ public class TileQuarry extends TileMachine implements IArmListener,
float f2 = worldObj.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(worldObj,
(float) xCoord + f, (float) yCoord + f1 + 0.5F,
(float) zCoord + f2, stackUtils.items);
xCoord + f, yCoord + f1 + 0.5F,
zCoord + f2, stackUtils.items);
float f3 = 0.05F;
entityitem.motionX = (float) worldObj.rand