Merge pull request #1 from SirSengir/master

rebased
This commit is contained in:
Xhamolk 2012-10-05 08:39:21 -07:00
commit 569fde6e0c
36 changed files with 450 additions and 295 deletions

View file

@ -18,7 +18,7 @@
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/> <property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property name="mcp.version" value="72"/> <property name="mcp.version" value="72"/>
<property name="forge.version" value="4.1.1.251"/> <property name="forge.version" value="4.1.4.287"/>
<property name="bc.version" value="3.1.8"/> <property name="bc.version" value="3.1.8"/>
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/> <available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>

View file

@ -17,7 +17,7 @@
<property name="mc.version" value="1.3.2"/> <property name="mc.version" value="1.3.2"/>
<property name="mcp.version" value="72"/> <property name="mcp.version" value="72"/>
<property name="forge.version" value="4.0.0.232"/> <property name="forge.version" value="4.1.4.287"/>
<property name="bc.version" value="3.2.0"/> <property name="bc.version" value="3.2.0"/>
<property name="bc.version.full" value="${bc.version}pre7"/> <property name="bc.version.full" value="${bc.version}pre7"/>

View file

@ -69,7 +69,7 @@ import net.minecraft.src.ItemStack;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property; import net.minecraftforge.common.Property;
@Mod(name="BuildCraft", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Core") @Mod(name="BuildCraft", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", dependencies="required-after:Forge@[4.1.4.285,)")
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true) @NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
public class BuildCraftCore { public class BuildCraftCore {
public static enum RenderMode { public static enum RenderMode {

View file

@ -142,7 +142,7 @@ public class BuildCraftEnergy {
LanguageRegistry.addName(bucketOil, "Oil Bucket"); LanguageRegistry.addName(bucketOil, "Oil Bucket");
bucketFuel = new ItemBuildCraft(Integer.parseInt(bucketFuelId.value)).setItemName("bucketFuel").setContainerItem(Item.bucketEmpty); bucketFuel = new ItemBuildCraft(Integer.parseInt(bucketFuelId.value)).setItemName("bucketFuel").setContainerItem(Item.bucketEmpty);
bucketFuel.setIconIndex(0 * 16 + 3).setMaxStackSize(1).setTabToDisplayOn(CreativeTabs.tabMisc); bucketFuel.setIconIndex(0 * 16 + 3).setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc);
LanguageRegistry.addName(bucketFuel, "Fuel Bucket"); LanguageRegistry.addName(bucketFuel, "Fuel Bucket");
RefineryRecipe.registerRefineryRecipe(new RefineryRecipe(new LiquidStack(oilStill.blockID, 1, 0), null, new LiquidStack(fuel.shiftedIndex, 1, 0), 10, 1)); RefineryRecipe.registerRefineryRecipe(new RefineryRecipe(new LiquidStack(oilStill.blockID, 1, 0), null, new LiquidStack(fuel.shiftedIndex, 1, 0), 10, 1));

View file

@ -8,6 +8,10 @@
package buildcraft; package buildcraft;
import java.util.List;
import com.google.common.collect.Lists;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
@ -49,7 +53,10 @@ import buildcraft.silicon.TileLaser;
import net.minecraft.src.Block; import net.minecraft.src.Block;
import net.minecraft.src.Item; import net.minecraft.src.Item;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.Property; import net.minecraftforge.common.Property;
@Mod(name="BuildCraft Factory", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE) @Mod(name="BuildCraft Factory", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE)
@ -77,6 +84,42 @@ public class BuildCraftFactory {
@PostInit @PostInit
public void postInit(FMLPostInitializationEvent evt) { public void postInit(FMLPostInitializationEvent evt) {
FactoryProxy.proxy.initializeNEIIntegration(); FactoryProxy.proxy.initializeNEIIntegration();
ForgeChunkManager.setForcedChunkLoadingCallback(instance,new QuarryChunkloadCallback());
}
public class QuarryChunkloadCallback implements ForgeChunkManager.OrderedLoadingCallback
{
@Override
public void ticketsLoaded(List<Ticket> tickets, World world) {
for (Ticket ticket : tickets)
{
int quarryX = ticket.getModData().getInteger("quarryX");
int quarryY = ticket.getModData().getInteger("quarryY");
int quarryZ = ticket.getModData().getInteger("quarryZ");
TileQuarry tq = (TileQuarry) world.getBlockTileEntity(quarryX, quarryY, quarryZ);
tq.forceChunkLoading(ticket);
}
}
@Override
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
List<Ticket> validTickets = Lists.newArrayList();
for (Ticket ticket : tickets)
{
int quarryX = ticket.getModData().getInteger("quarryX");
int quarryY = ticket.getModData().getInteger("quarryY");
int quarryZ = ticket.getModData().getInteger("quarryZ");
int blId = world.getBlockId(quarryX, quarryY, quarryZ);
if (blId == quarryBlock.blockID)
{
validTickets.add(ticket);
}
}
return validTickets;
}
} }
@Init @Init
public void load(FMLInitializationEvent evt) { public void load(FMLInitializationEvent evt) {

View file

@ -242,7 +242,7 @@ public class BuildCraftTransport {
pipeWaterproof = new ItemBuildCraft(Integer.parseInt(pipeWaterproofId.value)).setIconIndex(2 * 16 + 1); pipeWaterproof = new ItemBuildCraft(Integer.parseInt(pipeWaterproofId.value)).setIconIndex(2 * 16 + 1);
pipeWaterproof.setItemName("pipeWaterproof"); pipeWaterproof.setItemName("pipeWaterproof");
pipeWaterproof.setTabToDisplayOn(CreativeTabs.tabMaterials); pipeWaterproof.setCreativeTab(CreativeTabs.tabMaterials);
LanguageRegistry.addName(pipeWaterproof, "Pipe Waterproof"); LanguageRegistry.addName(pipeWaterproof, "Pipe Waterproof");
genericPipeBlock = new BlockGenericPipe(Integer.parseInt(genericPipeId.value)); genericPipeBlock = new BlockGenericPipe(Integer.parseInt(genericPipeId.value));
GameRegistry.registerBlock(genericPipeBlock); GameRegistry.registerBlock(genericPipeBlock);
@ -316,28 +316,28 @@ public class BuildCraftTransport {
} }
Property redPipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("redPipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.RED_PIPE_WIRE); Property redPipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("redPipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.RED_PIPE_WIRE);
redPipeWire = new ItemBuildCraft(Integer.parseInt(redPipeWireId.value)).setIconIndex(4 * 16 + 0).setTabToDisplayOn(CreativeTabs.tabRedstone); redPipeWire = new ItemBuildCraft(Integer.parseInt(redPipeWireId.value)).setIconIndex(4 * 16 + 0).setCreativeTab(CreativeTabs.tabRedstone);
redPipeWire.setItemName("redPipeWire"); redPipeWire.setItemName("redPipeWire");
LanguageRegistry.addName(redPipeWire, "Red Pipe Wire"); LanguageRegistry.addName(redPipeWire, "Red Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 1), AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 1),
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(redPipeWire, 8))); new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(redPipeWire, 8)));
Property bluePipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("bluePipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.BLUE_PIPE_WIRE); Property bluePipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("bluePipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.BLUE_PIPE_WIRE);
bluePipeWire = new ItemBuildCraft(Integer.parseInt(bluePipeWireId.value)).setIconIndex(4 * 16 + 1).setTabToDisplayOn(CreativeTabs.tabRedstone); bluePipeWire = new ItemBuildCraft(Integer.parseInt(bluePipeWireId.value)).setIconIndex(4 * 16 + 1).setCreativeTab(CreativeTabs.tabRedstone);
bluePipeWire.setItemName("bluePipeWire"); bluePipeWire.setItemName("bluePipeWire");
LanguageRegistry.addName(bluePipeWire, "Blue Pipe Wire"); LanguageRegistry.addName(bluePipeWire, "Blue Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4), AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4),
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(bluePipeWire, 8))); new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(bluePipeWire, 8)));
Property greenPipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("greenPipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.GREEN_PIPE_WIRE); Property greenPipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("greenPipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.GREEN_PIPE_WIRE);
greenPipeWire = new ItemBuildCraft(Integer.parseInt(greenPipeWireId.value)).setIconIndex(4 * 16 + 2).setTabToDisplayOn(CreativeTabs.tabRedstone); greenPipeWire = new ItemBuildCraft(Integer.parseInt(greenPipeWireId.value)).setIconIndex(4 * 16 + 2).setCreativeTab(CreativeTabs.tabRedstone);
greenPipeWire.setItemName("greenPipeWire"); greenPipeWire.setItemName("greenPipeWire");
LanguageRegistry.addName(greenPipeWire, "Green Pipe Wire"); LanguageRegistry.addName(greenPipeWire, "Green Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 2), AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 2),
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(greenPipeWire, 8))); new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(greenPipeWire, 8)));
Property yellowPipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("yellowPipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.YELLOW_PIPE_WIRE); Property yellowPipeWireId = BuildCraftCore.mainConfiguration.getOrCreateIntProperty("yellowPipeWire.id", Configuration.CATEGORY_ITEM, DefaultProps.YELLOW_PIPE_WIRE);
yellowPipeWire = new ItemBuildCraft(Integer.parseInt(yellowPipeWireId.value)).setIconIndex(4 * 16 + 3).setTabToDisplayOn(CreativeTabs.tabRedstone); yellowPipeWire = new ItemBuildCraft(Integer.parseInt(yellowPipeWireId.value)).setIconIndex(4 * 16 + 3).setCreativeTab(CreativeTabs.tabRedstone);
yellowPipeWire.setItemName("yellowPipeWire"); yellowPipeWire.setItemName("yellowPipeWire");
LanguageRegistry.addName(yellowPipeWire, "Yellow Pipe Wire"); LanguageRegistry.addName(yellowPipeWire, "Yellow Pipe Wire");
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11), AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11),

View file

@ -64,7 +64,7 @@ public class FillerFlattener extends FillerPattern {
} }
if (lastX != Integer.MAX_VALUE && stackToPlace != null) { if (lastX != Integer.MAX_VALUE && stackToPlace != null) {
stackToPlace.getItem().tryPlaceIntoWorld(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(tile.worldObj), tile.worldObj, stackToPlace.getItem().onItemUse(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(tile.worldObj), tile.worldObj,
lastX, lastY - 1, lastZ, 1, 0.0f, 0.0f, 0.0f); lastX, lastY - 1, lastZ, 1, 0.0f, 0.0f, 0.0f);
} }

View file

@ -66,7 +66,7 @@ public abstract class FillerPattern implements IFillerPattern {
} }
if (found && stackToPlace != null) { if (found && stackToPlace != null) {
stackToPlace.getItem().tryPlaceIntoWorld(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(world), world, xSlot, ySlot - 1, stackToPlace.getItem().onItemUse(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(world), world, xSlot, ySlot - 1,
zSlot, 1, 0.0f, 0.0f, 0.0f); zSlot, 1, 0.0f, 0.0f, 0.0f);
} }

View file

@ -27,7 +27,7 @@ public abstract class ItemBptBase extends ItemBuildCraft {
maxStackSize = 1; maxStackSize = 1;
iconIndex = 5 * 16 + 0; iconIndex = 5 * 16 + 0;
this.setTabToDisplayOn(CreativeTabs.tabMisc); this.setCreativeTab(CreativeTabs.tabMisc);
} }
@SuppressWarnings({ "all" }) @SuppressWarnings({ "all" })

View file

@ -235,7 +235,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
for (BlockIndex b : path) { for (BlockIndex b : path) {
if (previous != null) { if (previous != null) {
EntityLaser laser = new EntityPowerLaser(worldObj, EntityPowerLaser laser = new EntityPowerLaser(worldObj,
new Position(previous.i + 0.5, previous.j + 0.5, previous.k + 0.5), new Position(previous.i + 0.5, previous.j + 0.5, previous.k + 0.5),
new Position(b.i + 0.5, b.j + 0.5, b.k + 0.5)); new Position(b.i + 0.5, b.j + 0.5, b.k + 0.5));

View file

@ -12,20 +12,16 @@ package buildcraft.builders;
import buildcraft.BuildCraftCore; import buildcraft.BuildCraftCore;
import buildcraft.api.core.IAreaProvider; import buildcraft.api.core.IAreaProvider;
import buildcraft.api.core.LaserKind; import buildcraft.api.core.LaserKind;
import buildcraft.api.core.Orientations;
import buildcraft.api.filler.FillerManager; import buildcraft.api.filler.FillerManager;
import buildcraft.api.filler.IFillerPattern; import buildcraft.api.filler.IFillerPattern;
import buildcraft.api.gates.IAction; import buildcraft.api.gates.IAction;
import buildcraft.api.gates.IActionReceptor; import buildcraft.api.gates.IActionReceptor;
import buildcraft.api.inventory.ISpecialInventory;
import buildcraft.api.power.IPowerProvider; import buildcraft.api.power.IPowerProvider;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerFramework; import buildcraft.api.power.PowerFramework;
import buildcraft.core.Box; import buildcraft.core.Box;
import buildcraft.core.IMachine; import buildcraft.core.IMachine;
import buildcraft.core.TileBuildCraft; import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.ITransactor;
import buildcraft.core.inventory.TransactorSimple;
import buildcraft.core.network.PacketUpdate; import buildcraft.core.network.PacketUpdate;
import buildcraft.core.network.TileNetworkData; import buildcraft.core.network.TileNetworkData;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
@ -35,8 +31,10 @@ import buildcraft.core.utils.Utils;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPowerReceptor, IMachine, IActionReceptor { public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowerReceptor, IMachine, IActionReceptor {
public @TileNetworkData public @TileNetworkData
Box box = new Box(); Box box = new Box();
@ -136,7 +134,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
} }
if (done) { if (done) {
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
sendNetworkUpdate(); sendNetworkUpdate();
} }
} }
@ -177,7 +175,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
} }
if (worldObj != null) { if (worldObj != null) {
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
} }
if (currentPattern == null) { if (currentPattern == null) {
@ -309,7 +307,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
super.handleDescriptionPacket(packet); super.handleDescriptionPacket(packet);
currentPattern = FillerManager.registry.getPattern(currentPatternId); currentPattern = FillerManager.registry.getPattern(currentPatternId);
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
if (!initialized && box.isInitialized()) { if (!initialized && box.isInitialized()) {
box.createLasers(worldObj, LaserKind.Stripes); box.createLasers(worldObj, LaserKind.Stripes);
@ -323,7 +321,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
super.handleUpdatePacket(packet); super.handleUpdatePacket(packet);
currentPattern = FillerManager.registry.getPattern(currentPatternId); currentPattern = FillerManager.registry.getPattern(currentPatternId);
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
if (!initialized && box.isInitialized()) { if (!initialized && box.isInitialized()) {
box.createLasers(worldObj, LaserKind.Stripes); box.createLasers(worldObj, LaserKind.Stripes);
@ -390,29 +388,24 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
return true; return true;
} }
/* ISPECIALINVENTORY */ /**
@Override * Get the start of the side inventory.
public int addItem(ItemStack stack, boolean doAdd, Orientations from) { * @param side The global side to get the start of range.
*/
ITransactor transactor = new TransactorSimple(this); public int getStartInventorySide(ForgeDirection side) {
ItemStack added = transactor.add(stack, from, doAdd); if(side == ForgeDirection.UP)
return added.stackSize; return 0;
return 9;
} }
@Override /**
public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) { * Get the size of the side inventory.
for (int i = 9; i < contents.length; ++i) { * @param side The global side.
if (contents[i] != null) { */
if (doRemove) { public int getSizeInventorySide(ForgeDirection side) {
return new ItemStack[] { decrStackSize(i, 1) }; if(side == ForgeDirection.UP)
} else { return 9;
return new ItemStack[] { contents[i] }; return getSizeInventory()-9;
}
}
}
return null;
}
} }
}

View file

@ -60,7 +60,7 @@ public class TilePathMarker extends TileMarker {
if (CoreProxy.proxy.isRenderWorld(worldObj)) if (CoreProxy.proxy.isRenderWorld(worldObj))
return; return;
EntityLaser laser = new EntityPowerLaser(worldObj, new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new Position(pathMarker.xCoord + 0.5, pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5)); EntityPowerLaser laser = new EntityPowerLaser(worldObj, new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new Position(pathMarker.xCoord + 0.5, pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5));
laser.show(); laser.show();
laser.setTexture(DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png"); laser.setTexture(DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png");
@ -76,7 +76,7 @@ public class TilePathMarker extends TileMarker {
double nearestDistance = 0, distance; //The initialization of nearestDistance is only to make the compiler shut up double nearestDistance = 0, distance; //The initialization of nearestDistance is only to make the compiler shut up
for (TilePathMarker t : availableMarkers) { for (TilePathMarker t : availableMarkers) {
if (t == this || t == this.links[0] || t == this.links[1] || t.worldObj.provider.worldType != this.worldObj.provider.worldType) if (t == this || t == this.links[0] || t == this.links[1] || t.worldObj.provider.dimensionId != this.worldObj.provider.dimensionId)
continue; continue;
distance = Math.sqrt(Math.pow(this.xCoord - t.xCoord, 2) + Math.pow(this.yCoord - t.yCoord, 2) + Math.pow(this.zCoord - t.zCoord, 2)); distance = Math.sqrt(Math.pow(this.xCoord - t.xCoord, 2) + Math.pow(this.yCoord - t.yCoord, 2) + Math.pow(this.zCoord - t.zCoord, 2));
@ -257,7 +257,7 @@ public class TilePathMarker extends TileMarker {
public static void clearAvailableMarkersList(World w) { public static void clearAvailableMarkersList(World w) {
for (Iterator<TilePathMarker> it = availableMarkers.iterator(); it.hasNext();) { for (Iterator<TilePathMarker> it = availableMarkers.iterator(); it.hasNext();) {
TilePathMarker t = it.next(); TilePathMarker t = it.next();
if (t.worldObj.provider.worldType != w.provider.worldType) { if (t.worldObj.provider.dimensionId != w.provider.dimensionId) {
it.remove(); it.remove();
} }
} }

View file

@ -58,27 +58,20 @@ public class EntityEnergyLaser extends EntityLaser {
} }
@Override @Override
protected void updateData() { protected void updateDataClient() {
super.updateData(); super.updateDataClient();
powerAverage = (float)decodeDouble(dataWatcher.getWatchableObjectInt(15)); powerAverage = (float)decodeDouble(dataWatcher.getWatchableObjectInt(15));
} }
@Override @Override
public void setPositions(Position head, Position tail) { protected void updateDataServer() {
super.setPositions(head, tail); super.updateDataServer();
dataWatcher.updateObject(15, Integer.valueOf(encodeDouble((double)powerAverage))); dataWatcher.updateObject(15, Integer.valueOf(encodeDouble((double)powerAverage)));
} }
@Override @Override
protected void initClientSide() { protected void entityInit() {
super.initClientSide(); super.entityInit();
dataWatcher.addObject(15, Integer.valueOf(0)); dataWatcher.addObject(15, Integer.valueOf(0));
} }
@Override
protected void initServerSide() {
super.initServerSide();
dataWatcher.addObject(15, encodeDouble((double)powerAverage));
}
} }

View file

@ -16,19 +16,22 @@ import net.minecraft.src.Entity;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.World; import net.minecraft.src.World;
public class EntityLaser extends Entity { public abstract class EntityLaser extends Entity {
protected Position head, tail; protected Position head, tail;
public double renderSize = 0; public double renderSize = 0;
public double angleY = 0; public double angleY = 0;
public double angleZ = 0; public double angleZ = 0;
protected String texture;
private boolean isVisible = false;
protected boolean needsUpdate = true;
public EntityLaser(World world) { public EntityLaser(World world) {
super(world); super(world);
initClientSide(); head = new Position(0, 0, 0);
tail = new Position(0, 0, 0);
} }
public EntityLaser(World world, Position head, Position tail) { public EntityLaser(World world, Position head, Position tail) {
@ -39,14 +42,14 @@ public class EntityLaser extends Entity {
this.tail = tail; this.tail = tail;
setPositionAndRotation(head.x, head.y, head.z, 0, 0); setPositionAndRotation(head.x, head.y, head.z, 0, 0);
setSize(10, 10);
initServerSide();
} }
protected void initClientSide() { @Override
protected void entityInit() {
head = new Position(0, 0, 0); preventEntitySpawning = false;
tail = new Position(0, 0, 0); noClip = true;
isImmuneToFire = true;
dataWatcher.addObject(8, Integer.valueOf(0)); dataWatcher.addObject(8, Integer.valueOf(0));
dataWatcher.addObject(9, Integer.valueOf(0)); dataWatcher.addObject(9, Integer.valueOf(0));
@ -56,29 +59,6 @@ public class EntityLaser extends Entity {
dataWatcher.addObject(13, Integer.valueOf(0)); dataWatcher.addObject(13, Integer.valueOf(0));
dataWatcher.addObject(14, Byte.valueOf((byte) 0)); dataWatcher.addObject(14, Byte.valueOf((byte) 0));
dataWatcher.addObject(16, "");
}
protected void initServerSide() {
preventEntitySpawning = false;
noClip = true;
isImmuneToFire = true;
setPositionAndRotation(head.x, head.y, head.z, 0, 0);
setSize(10, 10);
dataWatcher.addObject(8 , Integer.valueOf(encodeDouble(head.x)));
dataWatcher.addObject(9 , Integer.valueOf(encodeDouble(head.y)));
dataWatcher.addObject(10, Integer.valueOf(encodeDouble(head.z)));
dataWatcher.addObject(11, Integer.valueOf(encodeDouble(tail.x)));
dataWatcher.addObject(12, Integer.valueOf(encodeDouble(tail.y)));
dataWatcher.addObject(13, Integer.valueOf(encodeDouble(tail.z)));
dataWatcher.addObject(14, Byte.valueOf((byte) 0));
dataWatcher.addObject(16, "");
} }
@Override @Override
@ -87,8 +67,13 @@ public class EntityLaser extends Entity {
if (head == null || tail == null) if (head == null || tail == null)
return; return;
if (CoreProxy.proxy.isSimulating(worldObj) && needsUpdate) {
updateDataServer();
needsUpdate = false;
}
if (CoreProxy.proxy.isRenderWorld(worldObj)) if (CoreProxy.proxy.isRenderWorld(worldObj))
updateData(); updateDataClient();
boundingBox.minX = Math.min(head.x, tail.x); boundingBox.minX = Math.min(head.x, tail.x);
boundingBox.minY = Math.min(head.y, tail.y); boundingBox.minY = Math.min(head.y, tail.y);
@ -116,24 +101,18 @@ public class EntityLaser extends Entity {
angleY = -Math.atan2(dy, dx) * 180 / Math.PI; angleY = -Math.atan2(dy, dx) * 180 / Math.PI;
} }
protected void updateData() { protected void updateDataClient() {
head.x = decodeDouble(dataWatcher.getWatchableObjectInt(8)); head.x = decodeDouble(dataWatcher.getWatchableObjectInt(8));
head.y = decodeDouble(dataWatcher.getWatchableObjectInt(9)); head.y = decodeDouble(dataWatcher.getWatchableObjectInt(9));
head.z = decodeDouble(dataWatcher.getWatchableObjectInt(10)); head.z = decodeDouble(dataWatcher.getWatchableObjectInt(10));
tail.x = decodeDouble(dataWatcher.getWatchableObjectInt(11)); tail.x = decodeDouble(dataWatcher.getWatchableObjectInt(11));
tail.y = decodeDouble(dataWatcher.getWatchableObjectInt(12)); tail.y = decodeDouble(dataWatcher.getWatchableObjectInt(12));
tail.z = decodeDouble(dataWatcher.getWatchableObjectInt(13)); tail.z = decodeDouble(dataWatcher.getWatchableObjectInt(13));
texture = dataWatcher.getWatchableObjectString(16);
isVisible = (dataWatcher.getWatchableObjectByte(14) == 1);
} }
public void setPositions(Position head, Position tail) { protected void updateDataServer() {
this.head = head;
this.tail = tail;
setPositionAndRotation(head.x, head.y, head.z, 0, 0);
dataWatcher.updateObject(8, Integer.valueOf(encodeDouble(head.x))); dataWatcher.updateObject(8, Integer.valueOf(encodeDouble(head.x)));
dataWatcher.updateObject(9, Integer.valueOf(encodeDouble(head.y))); dataWatcher.updateObject(9, Integer.valueOf(encodeDouble(head.y)));
dataWatcher.updateObject(10, Integer.valueOf(encodeDouble(head.z))); dataWatcher.updateObject(10, Integer.valueOf(encodeDouble(head.z)));
@ -141,41 +120,43 @@ public class EntityLaser extends Entity {
dataWatcher.updateObject(12, Integer.valueOf(encodeDouble(tail.y))); dataWatcher.updateObject(12, Integer.valueOf(encodeDouble(tail.y)));
dataWatcher.updateObject(13, Integer.valueOf(encodeDouble(tail.z))); dataWatcher.updateObject(13, Integer.valueOf(encodeDouble(tail.z)));
onUpdate(); dataWatcher.updateObject(14, Byte.valueOf((byte) (isVisible ? 1 : 0)));
}
public void setPositions(Position head, Position tail) {
this.head = head;
this.tail = tail;
setPositionAndRotation(head.x, head.y, head.z, 0, 0);
needsUpdate = true;
} }
public void show() { public void show() {
dataWatcher.updateObject(14, Byte.valueOf((byte) 1)); isVisible = true;
needsUpdate = true;
} }
public void hide() { public void hide() {
dataWatcher.updateObject(14, Byte.valueOf((byte) 0)); isVisible = false;
needsUpdate = true;
} }
public boolean isVisible() { public boolean isVisible() {
return dataWatcher.getWatchableObjectByte(14) == 0 ? false : true; return this.isVisible;
} }
public void setTexture(String texture) { public abstract String getTexture();
this.texture = texture;
dataWatcher.updateObject(16, texture);
}
public String getTexture() {
return texture;
}
protected int encodeDouble(double d) { protected int encodeDouble(double d) {
return (int) (d * 8000); return (int) (d * 8192);
} }
protected double decodeDouble(int i) { protected double decodeDouble(int i) {
return (i / 8000D); return (i / 8192D);
} }
@Override //The read/write to nbt seem to be useless
protected void entityInit() {}
@Override @Override
protected void readEntityFromNBT(NBTTagCompound nbt) { protected void readEntityFromNBT(NBTTagCompound nbt) {
@ -201,4 +182,9 @@ public class EntityLaser extends Entity {
nbt.setDouble("tailY", tail.y); nbt.setDouble("tailY", tail.y);
nbt.setDouble("tailZ", tail.z); nbt.setDouble("tailZ", tail.z);
} }
//Workaround for the laser's posY loosing it's precision e.g 103.5 becomes 104
public Position renderOffset() {
return new Position(head.x - posX, head.y - posY, head.z - posZ);
}
} }

View file

@ -4,6 +4,7 @@ import net.minecraft.src.World;
import buildcraft.api.core.Position; import buildcraft.api.core.Position;
public class EntityPowerLaser extends EntityLaser { public class EntityPowerLaser extends EntityLaser {
private String texture;
public EntityPowerLaser(World world) { public EntityPowerLaser(World world) {
super(world); super(world);
@ -13,4 +14,31 @@ public class EntityPowerLaser extends EntityLaser {
super(world, head, tail); super(world, head, tail);
} }
@Override
protected void entityInit() {
super.entityInit();
dataWatcher.addObject(15, "");
}
@Override
public String getTexture() {
return texture;
}
public void setTexture(String texture) {
this.texture = texture;
needsUpdate = true;
}
@Override
protected void updateDataClient() {
super.updateDataClient();
texture = dataWatcher.getWatchableObjectString(15);
}
@Override
protected void updateDataServer() {
super.updateDataServer();
dataWatcher.updateObject(15, texture);
}
} }

View file

@ -15,7 +15,7 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
setHasSubtypes(true); setHasSubtypes(true);
setMaxDamage(0); setMaxDamage(0);
setTabToDisplayOn(CreativeTabs.tabRedstone); setCreativeTab(CreativeTabs.tabRedstone);
} }
@SuppressWarnings({ "all" }) @SuppressWarnings({ "all" })

View file

@ -8,7 +8,7 @@ public class ItemWrench extends ItemBuildCraft implements IToolWrench {
public ItemWrench(int i) { public ItemWrench(int i) {
super(i); super(i);
setTabToDisplayOn(CreativeTabs.tabTools); setCreativeTab(CreativeTabs.tabTools);
} }
@Override @Override

View file

@ -83,7 +83,7 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized
} }
@Override @Override
public Packet getAuxillaryInfoPacket() { public Packet getDescriptionPacket() {
return new PacketTileUpdate(this).getPacket(); return new PacketTileUpdate(this).getPacket();
} }

View file

@ -165,7 +165,7 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
if (s.length() > 0) { if (s.length() > 0) {
int i2 = (lastX - cornerX); int i2 = (lastX - cornerX);
int k2 = lastY - cornerY; int k2 = lastY - cornerY;
func_74190_a(s, i2, k2); drawCreativeTabHoveringText(s, i2, k2);
} }
} }

View file

@ -40,7 +40,7 @@ public class TransactorSimple extends Transactor {
if(inventory.getStackInSlot(i) == null) if(inventory.getStackInSlot(i) == null)
continue; continue;
if(!inventory.getStackInSlot(i).isItemEqual(stack)) if(!inventory.getStackInSlot(i).isItemEqual(stack) || !ItemStack.func_77970_a(inventory.getStackInSlot(i), stack))
continue; continue;
if(inventory.getStackInSlot(i).stackSize >= inventory.getStackInSlot(i).getMaxStackSize()) if(inventory.getStackInSlot(i).stackSize >= inventory.getStackInSlot(i).getMaxStackSize())
@ -75,7 +75,7 @@ public class TransactorSimple extends Transactor {
return remaining; return remaining;
} }
if(!inventory.getStackInSlot(slot).isItemEqual(stack)) if(!inventory.getStackInSlot(slot).isItemEqual(stack) || !ItemStack.func_77970_a(inventory.getStackInSlot(slot), stack))
return 0; return 0;
int space = inventory.getStackInSlot(slot).getMaxStackSize() - inventory.getStackInSlot(slot).stackSize; int space = inventory.getStackInSlot(slot).getMaxStackSize() - inventory.getStackInSlot(slot).stackSize;

View file

@ -21,7 +21,7 @@ public interface ISynchronizedTile {
public Packet getUpdatePacket(); public Packet getUpdatePacket();
public Packet getAuxillaryInfoPacket(); public Packet getDescriptionPacket();
public PacketPayload getPacketPayload(); public PacketPayload getPacketPayload();
} }

View file

@ -103,14 +103,14 @@ public class CoreProxy {
if (Math.abs(player.posX - x) <= maxDistance && Math.abs(player.posY - y) <= maxDistance if (Math.abs(player.posX - x) <= maxDistance && Math.abs(player.posY - y) <= maxDistance
&& Math.abs(player.posZ - z) <= maxDistance) && Math.abs(player.posZ - z) <= maxDistance)
player.serverForThisPlayer.sendPacketToPlayer(packet); player.playerNetServerHandler.sendPacketToPlayer(packet);
} }
} }
} }
public void sendToPlayer(EntityPlayer entityplayer, BuildCraftPacket packet) { public void sendToPlayer(EntityPlayer entityplayer, BuildCraftPacket packet) {
EntityPlayerMP player = (EntityPlayerMP) entityplayer; EntityPlayerMP player = (EntityPlayerMP) entityplayer;
player.serverForThisPlayer.sendPacketToPlayer(packet.getPacket()); player.playerNetServerHandler.sendPacketToPlayer(packet.getPacket());
} }
public void sendToServer(Packet packet) {} public void sendToServer(Packet packet) {}

View file

@ -1,5 +1,6 @@
package buildcraft.core.render; package buildcraft.core.render;
import buildcraft.api.core.Position;
import net.minecraft.src.Entity; import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase; import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer; import net.minecraft.src.ModelRenderer;
@ -38,7 +39,9 @@ public class RenderLaser extends Render {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDisable(2896 /* GL_LIGHTING */);
GL11.glTranslated(x, y, z);
Position offset = laser.renderOffset();
GL11.glTranslated(x + offset.x, y + offset.y, z + offset.z);
GL11.glRotatef((float) laser.angleZ, 0, 1, 0); GL11.glRotatef((float) laser.angleZ, 0, 1, 0);
GL11.glRotatef((float) laser.angleY, 0, 0, 1); GL11.glRotatef((float) laser.angleY, 0, 0, 1);

View file

@ -74,7 +74,7 @@ public class Utils {
TileEntity tileInventory = world.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z); TileEntity tileInventory = world.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z);
ITransactor transactor = Transactor.getTransactorFor(tileInventory); ITransactor transactor = Transactor.getTransactorFor(tileInventory);
if(transactor != null if(transactor != null && !(tileInventory instanceof TileBuildCraft)
&& transactor.add(stack, from, false).stackSize > 0) && transactor.add(stack, from, false).stackSize > 0)
possibleInventories.add(transactor); possibleInventories.add(transactor);
} }

View file

@ -18,7 +18,9 @@ import buildcraft.api.liquids.LiquidTank;
import buildcraft.core.DefaultProps; import buildcraft.core.DefaultProps;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
import buildcraft.energy.gui.ContainerEngine; import buildcraft.energy.gui.ContainerEngine;
import net.minecraft.src.Block;
import net.minecraft.src.ICrafting; import net.minecraft.src.ICrafting;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
@ -125,7 +127,15 @@ public class EngineIron extends Engine {
super.update(); super.update();
if (itemInInventory != null) { if (itemInInventory != null) {
LiquidStack liquid = LiquidManager.getLiquidForFilledItem(itemInInventory); LiquidStack liquid = null;
if (Block.ice.blockID == itemInInventory.itemID && heat > COOLANT_THRESHOLD)
{
liquid = LiquidManager.getLiquidForFilledItem(new ItemStack(Item.bucketWater));
}
else
{
liquid = LiquidManager.getLiquidForFilledItem(itemInInventory);
}
if (liquid != null) { if (liquid != null) {
if (fill(Orientations.Unknown, liquid, false) == liquid.amount) { if (fill(Orientations.Unknown, liquid, false) == liquid.amount) {

View file

@ -189,8 +189,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
engine.orientation = o; engine.orientation = o;
} }
orientation = o.ordinal(); orientation = o.ordinal();
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlockId(xCoord, yCoord, zCoord));
break; break;
} }
} }
@ -321,10 +321,10 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
/* SMP UPDATING */ /* SMP UPDATING */
@Override @Override
public Packet getAuxillaryInfoPacket() { public Packet getDescriptionPacket() {
createEngineIfNeeded(); createEngineIfNeeded();
return super.getAuxillaryInfoPacket(); return super.getDescriptionPacket();
} }
@Override @Override

View file

@ -33,7 +33,7 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
topTexture = 2 * 16 + 11; topTexture = 2 * 16 + 11;
sideTexture = 2 * 16 + 12; sideTexture = 2 * 16 + 12;
setHardness(1.0F); setHardness(1.0F);
setCreativeTab(CreativeTabs.tabDeco); setCreativeTab(CreativeTabs.tabDecorations);
} }
@Override @Override

View file

@ -20,7 +20,7 @@ public class BlockHopper extends BlockBuildCraft {
public BlockHopper(int blockId) { public BlockHopper(int blockId) {
super(blockId, Material.iron); super(blockId, Material.iron);
setHardness(5F); setHardness(5F);
setCreativeTab(CreativeTabs.tabDeco); setCreativeTab(CreativeTabs.tabDecorations);
} }
@Override @Override

View file

@ -11,6 +11,8 @@ package buildcraft.factory;
import java.util.ArrayList; import java.util.ArrayList;
import com.google.common.math.IntMath;
import buildcraft.BuildCraftFactory; import buildcraft.BuildCraftFactory;
import buildcraft.api.core.Orientations; import buildcraft.api.core.Orientations;
import buildcraft.api.core.Position; import buildcraft.api.core.Position;
@ -57,6 +59,11 @@ public class BlockQuarry extends BlockMachineRoot {
new Position(i, j, k)); new Position(i, j, k));
world.setBlockMetadataWithNotify(i, j, k, orientation.reverse().ordinal()); world.setBlockMetadataWithNotify(i, j, k, orientation.reverse().ordinal());
if (entityliving instanceof EntityPlayer)
{
TileQuarry tq = (TileQuarry) world.getBlockTileEntity(i,j,k);
tq.placedBy = (EntityPlayer) entityliving;
}
} }
@Override @Override
@ -129,7 +136,7 @@ public class BlockQuarry extends BlockMachineRoot {
@Override @Override
public void breakBlock(World world, int i, int j, int k, int par5, int par6) { public void breakBlock(World world, int i, int j, int k, int par5, int par6) {
if (CoreProxy.proxy.isRenderWorld(world)){ if (!CoreProxy.proxy.isSimulating(world)){
return; return;
} }
@ -137,7 +144,8 @@ public class BlockQuarry extends BlockMachineRoot {
if (tile instanceof TileQuarry){ if (tile instanceof TileQuarry){
TileQuarry quarry = (TileQuarry)tile; TileQuarry quarry = (TileQuarry)tile;
Box box = quarry.box; Box box = quarry.box;
if (box.isInitialized() && Integer.MAX_VALUE != box.xMax)
{
//X - Axis //X - Axis
for (int x = box.xMin; x <= box.xMax; x++) { for (int x = box.xMin; x <= box.xMax; x++) {
markFrameForDecay(world, x, box.yMin, box.zMin); markFrameForDecay(world, x, box.yMin, box.zMin);
@ -162,6 +170,7 @@ public class BlockQuarry extends BlockMachineRoot {
markFrameForDecay(world, box.xMin, y, box.zMax); markFrameForDecay(world, box.xMin, y, box.zMax);
markFrameForDecay(world, box.xMax, y, box.zMax); markFrameForDecay(world, box.xMax, y, box.zMax);
} }
}
quarry.destroy(); quarry.destroy();
} }

View file

@ -11,6 +11,13 @@ package buildcraft.factory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import buildcraft.BuildCraftFactory; import buildcraft.BuildCraftFactory;
import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.core.BuildCraftAPI;
@ -37,10 +44,16 @@ import buildcraft.core.utils.Utils;
import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Block; import net.minecraft.src.Block;
import net.minecraft.src.ChunkCoordIntPair;
import net.minecraft.src.EntityItem; import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.Packet3Chat;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, IPipeConnection, IBuilderInventory { public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, IPipeConnection, IBuilderInventory {
public @TileNetworkData public @TileNetworkData
@ -109,6 +122,9 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
private boolean movingHorizontally; private boolean movingHorizontally;
private boolean movingVertically; private boolean movingVertically;
private double headTrajectory; private double headTrajectory;
private Ticket chunkTicket;
public @TileNetworkData boolean isAlive;
public EntityPlayer placedBy;
private void createArm() { private void createArm() {
@ -127,6 +143,16 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
@Override @Override
public void updateEntity() { public void updateEntity() {
if (!isAlive && CoreProxy.proxy.isSimulating(worldObj))
{
super.updateEntity();
return;
}
if (!CoreProxy.proxy.isSimulating(worldObj) && isAlive)
{
super.updateEntity();
return;
}
super.updateEntity(); super.updateEntity();
if (inProcess) { if (inProcess) {
float energyToUse = 2 + powerProvider.getEnergyStored() / 1000; float energyToUse = 2 + powerProvider.getEnergyStored() / 1000;
@ -138,7 +164,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
} }
} }
if (CoreProxy.proxy.isSimulating(worldObj)) { if (CoreProxy.proxy.isSimulating(worldObj) && inProcess) {
sendNetworkUpdate(); sendNetworkUpdate();
} }
if (inProcess || !isDigging) { if (inProcess || !isDigging) {
@ -386,7 +412,6 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
} }
private void mineStack(ItemStack stack) { private void mineStack(ItemStack stack) {
// First, try to add to a nearby chest // First, try to add to a nearby chest
ItemStack added = Utils.addToRandomInventory(stack, worldObj, xCoord, yCoord, zCoord, Orientations.Unknown); ItemStack added = Utils.addToRandomInventory(stack, worldObj, xCoord, yCoord, zCoord, Orientations.Unknown);
stack.stackSize -= added.stackSize; stack.stackSize -= added.stackSize;
@ -425,6 +450,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
@Override @Override
public void invalidate() { public void invalidate() {
ForgeChunkManager.releaseTicket(chunkTicket);
super.invalidate(); super.invalidate();
destroy(); destroy();
@ -456,6 +482,24 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
} }
private void setBoundaries(boolean useDefault) { private void setBoundaries(boolean useDefault) {
if (chunkTicket == null)
{
chunkTicket = ForgeChunkManager.requestTicket(BuildCraftFactory.instance, worldObj, Type.NORMAL);
}
if (chunkTicket == null)
{
isAlive = false;
if (placedBy!=null && CoreProxy.proxy.isSimulating(worldObj))
{
PacketDispatcher.sendPacketToPlayer(new Packet3Chat(String.format("[BUILDCRAFT] The quarry at %d, %d, %d will not work because there are no more chunkloaders available", xCoord, yCoord, zCoord)), (Player) placedBy);
}
sendNetworkUpdate();
return;
}
chunkTicket.getModData().setInteger("quarryX", xCoord);
chunkTicket.getModData().setInteger("quarryY", yCoord);
chunkTicket.getModData().setInteger("quarryZ", zCoord);
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord >> 4, zCoord >> 4));
IAreaProvider a = null; IAreaProvider a = null;
@ -473,7 +517,12 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
int ySize = a.yMax() - a.yMin() + 1; int ySize = a.yMax() - a.yMin() + 1;
int zSize = a.zMax() - a.zMin() + 1; int zSize = a.zMax() - a.zMin() + 1;
if (xSize < 3 || zSize < 3) { if (xSize < 3 || zSize < 3 || ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth())
{
if (placedBy != null)
{
PacketDispatcher.sendPacketToPlayer(new Packet3Chat(String.format("Quarry size is outside of chunkloading bounds or too small %d %d (%d)", xSize, zSize, chunkTicket.getMaxChunkListDepth())),(Player) placedBy);
}
a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10); a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10);
useDefault = true; useDefault = true;
@ -519,10 +568,10 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
} }
a.removeFromWorld(); a.removeFromWorld();
forceChunkLoading(chunkTicket);
} }
private void initializeBluePrintBuilder() { private void initializeBluePrintBuilder() {
BptBlueprint bluePrint = new BptBlueprint(box.sizeX(), box.sizeY(), box.sizeZ()); BptBlueprint bluePrint = new BptBlueprint(box.sizeX(), box.sizeY(), box.sizeZ());
for (int i = 0; i < bluePrint.sizeX; ++i) { for (int i = 0; i < bluePrint.sizeX; ++i) {
@ -558,11 +607,18 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
@Override @Override
public void postPacketHandling(PacketUpdate packet) { public void postPacketHandling(PacketUpdate packet) {
super.postPacketHandling(packet); super.postPacketHandling(packet);
if (isAlive)
{
createUtilsIfNeeded(); createUtilsIfNeeded();
}
else
{
box.deleteLasers();
box.reset();
return;
}
if (arm != null) { if (arm != null) {
arm.setHead(headPosX, headPosY, headPosZ); arm.setHead(headPosX, headPosY, headPosZ);
arm.updatePosition(); arm.updatePosition();
@ -573,6 +629,11 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
public void initialize() { public void initialize() {
super.initialize(); super.initialize();
if (CoreProxy.proxy.isSimulating(this.worldObj) && !box.initialized)
{
setBoundaries(false);
}
createUtilsIfNeeded(); createUtilsIfNeeded();
sendNetworkUpdate(); sendNetworkUpdate();
@ -738,4 +799,32 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
this.targetZ = z; this.targetZ = z;
} }
public void forceChunkLoading(Ticket ticket) {
if (chunkTicket == null)
{
chunkTicket = ticket;
}
Set<ChunkCoordIntPair> chunks = Sets.newHashSet();
isAlive = true;
ChunkCoordIntPair quarryChunk = new ChunkCoordIntPair(xCoord >> 4, zCoord >> 4);
chunks.add(quarryChunk);
ForgeChunkManager.forceChunk(ticket, quarryChunk);
for (int chunkX = box.xMin >> 4; chunkX <= box.xMax >> 4; chunkX ++)
{
for (int chunkZ = box.zMin >> 4; chunkZ <= box.zMax >> 4; chunkZ ++)
{
ChunkCoordIntPair chunk = new ChunkCoordIntPair(chunkX, chunkZ);
ForgeChunkManager.forceChunk(ticket, chunk);
chunks.add(chunk);
}
}
if (placedBy != null)
{
PacketDispatcher.sendPacketToPlayer(new Packet3Chat(String.format("[BUILDCRAFT] The quarry at %d %d %d will keep %d chunks loaded",xCoord, yCoord, zCoord, chunks.size())),(Player) placedBy);
}
sendNetworkUpdate();
}
} }

View file

@ -207,6 +207,8 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
assemblyTable.zCoord + 0.475 + (worldObj.rand.nextFloat() - 0.5) / 5F); assemblyTable.zCoord + 0.475 + (worldObj.rand.nextFloat() - 0.5) / 5F);
laser.setPositions(head, tail); laser.setPositions(head, tail);
if(!laser.isVisible())
laser.show(); laser.show();
} }

View file

@ -32,7 +32,7 @@ public class ItemFacade extends ItemBuildCraft {
setHasSubtypes(true); setHasSubtypes(true);
setMaxDamage(0); setMaxDamage(0);
this.setTabToDisplayOn(CreativeTabs.tabMisc); this.setCreativeTab(CreativeTabs.tabMisc);
} }
@Override @Override
@ -77,7 +77,6 @@ public class ItemFacade extends ItemBuildCraft {
return true; return true;
} else { } else {
if (((TileGenericPipe)tile).addFacade(Orientations.values()[side], ItemFacade.getBlockId(stack.getItemDamage()), ItemFacade.getMetaData(stack.getItemDamage()))){ if (((TileGenericPipe)tile).addFacade(Orientations.values()[side], ItemFacade.getBlockId(stack.getItemDamage()), ItemFacade.getMetaData(stack.getItemDamage()))){
if (!player.capabilities.isCreativeMode)
stack.stackSize--; stack.stackSize--;
return true; return true;
} }

View file

@ -21,7 +21,7 @@ public class ItemGate extends ItemBuildCraft {
setHasSubtypes(true); setHasSubtypes(true);
setMaxDamage(0); setMaxDamage(0);
setTabToDisplayOn(CreativeTabs.tabRedstone); setCreativeTab(CreativeTabs.tabRedstone);
} }
@SuppressWarnings({ "all" }) @SuppressWarnings({ "all" })

View file

@ -26,11 +26,11 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
protected ItemPipe(int i) { protected ItemPipe(int i) {
super(i); super(i);
this.setTabToDisplayOn(CreativeTabs.tabTransport); this.setCreativeTab(CreativeTabs.tabTransport);
} }
@Override @Override
public boolean tryPlaceIntoWorld(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float par8, float par9, float par10) { public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float par8, float par9, float par10) {
int blockID = BuildCraftTransport.genericPipeBlock.blockID; int blockID = BuildCraftTransport.genericPipeBlock.blockID;
if (world.getBlockId(i, j, k) == Block.snow.blockID) if (world.getBlockId(i, j, k) == Block.snow.blockID)

View file

@ -94,7 +94,7 @@ public class PipeTransportItems extends PipeTransport {
((IPipeTransportItemsHook) container.pipe).entityEntered(item, orientation); ((IPipeTransportItemsHook) container.pipe).entityEntered(item, orientation);
if (!worldObj.isRemote && item.getSynchroTracker().markTimeIfDelay(worldObj, 6 * BuildCraftCore.updateFactor)) { if (!worldObj.isRemote && item.getSynchroTracker().markTimeIfDelay(worldObj, 6 * BuildCraftCore.updateFactor)) {
int dimension = worldObj.provider.worldType; int dimension = worldObj.provider.dimensionId;
PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE, dimension, createItemPacket(item, orientation)); PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE, dimension, createItemPacket(item, orientation));
} }

View file

@ -371,13 +371,13 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
initialize(BlockGenericPipe.createPipe(packet.getPipeId())); initialize(BlockGenericPipe.createPipe(packet.getPipeId()));
} }
renderState = packet.getRenderState(); renderState = packet.getRenderState();
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
} }
return; return;
} }
@Override @Override
public Packet getAuxillaryInfoPacket() { public Packet getDescriptionPacket() {
bindPipe(); bindPipe();
PacketTileState packet = new PacketTileState(this.xCoord, this.yCoord, this.zCoord); PacketTileState packet = new PacketTileState(this.xCoord, this.yCoord, this.zCoord);
@ -613,7 +613,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
} }
break; break;
} }
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord); worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
} }
@Override @Override