commit
569fde6e0c
36 changed files with 450 additions and 295 deletions
|
@ -18,7 +18,7 @@
|
|||
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
|
||||
|
||||
<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"/>
|
||||
|
||||
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<property name="mc.version" value="1.3.2"/>
|
||||
<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.full" value="${bc.version}pre7"/>
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraftforge.common.Configuration;
|
||||
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)
|
||||
public class BuildCraftCore {
|
||||
public static enum RenderMode {
|
||||
|
|
|
@ -142,7 +142,7 @@ public class BuildCraftEnergy {
|
|||
LanguageRegistry.addName(bucketOil, "Oil Bucket");
|
||||
|
||||
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");
|
||||
|
||||
RefineryRecipe.registerRefineryRecipe(new RefineryRecipe(new LiquidStack(oilStill.blockID, 1, 0), null, new LiquidStack(fuel.shiftedIndex, 1, 0), 10, 1));
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
|
||||
package buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
@ -49,7 +53,10 @@ import buildcraft.silicon.TileLaser;
|
|||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
@Mod(name="BuildCraft Factory", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
|
@ -77,6 +84,42 @@ public class BuildCraftFactory {
|
|||
@PostInit
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
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
|
||||
public void load(FMLInitializationEvent evt) {
|
||||
|
|
|
@ -242,7 +242,7 @@ public class BuildCraftTransport {
|
|||
|
||||
pipeWaterproof = new ItemBuildCraft(Integer.parseInt(pipeWaterproofId.value)).setIconIndex(2 * 16 + 1);
|
||||
pipeWaterproof.setItemName("pipeWaterproof");
|
||||
pipeWaterproof.setTabToDisplayOn(CreativeTabs.tabMaterials);
|
||||
pipeWaterproof.setCreativeTab(CreativeTabs.tabMaterials);
|
||||
LanguageRegistry.addName(pipeWaterproof, "Pipe Waterproof");
|
||||
genericPipeBlock = new BlockGenericPipe(Integer.parseInt(genericPipeId.value));
|
||||
GameRegistry.registerBlock(genericPipeBlock);
|
||||
|
@ -316,28 +316,28 @@ public class BuildCraftTransport {
|
|||
}
|
||||
|
||||
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");
|
||||
LanguageRegistry.addName(redPipeWire, "Red Pipe Wire");
|
||||
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)));
|
||||
|
||||
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");
|
||||
LanguageRegistry.addName(bluePipeWire, "Blue Pipe Wire");
|
||||
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)));
|
||||
|
||||
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");
|
||||
LanguageRegistry.addName(greenPipeWire, "Green Pipe Wire");
|
||||
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)));
|
||||
|
||||
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");
|
||||
LanguageRegistry.addName(yellowPipeWire, "Yellow Pipe Wire");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11),
|
||||
|
|
|
@ -64,7 +64,7 @@ public class FillerFlattener extends FillerPattern {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public abstract class ItemBptBase extends ItemBuildCraft {
|
|||
|
||||
maxStackSize = 1;
|
||||
iconIndex = 5 * 16 + 0;
|
||||
this.setTabToDisplayOn(CreativeTabs.tabMisc);
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
|
|
|
@ -235,7 +235,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
for (BlockIndex b : path) {
|
||||
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(b.i + 0.5, b.j + 0.5, b.k + 0.5));
|
||||
|
||||
|
|
|
@ -12,20 +12,16 @@ package buildcraft.builders;
|
|||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.LaserKind;
|
||||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.filler.FillerManager;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.api.inventory.ISpecialInventory;
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerFramework;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.TransactorSimple;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.network.TileNetworkData;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
@ -35,8 +31,10 @@ import buildcraft.core.utils.Utils;
|
|||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
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
|
||||
Box box = new Box();
|
||||
|
@ -136,7 +134,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
}
|
||||
|
||||
if (done) {
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +175,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
}
|
||||
|
||||
if (worldObj != null) {
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (currentPattern == null) {
|
||||
|
@ -309,7 +307,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
super.handleDescriptionPacket(packet);
|
||||
|
||||
currentPattern = FillerManager.registry.getPattern(currentPatternId);
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
|
||||
if (!initialized && box.isInitialized()) {
|
||||
box.createLasers(worldObj, LaserKind.Stripes);
|
||||
|
@ -323,7 +321,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
super.handleUpdatePacket(packet);
|
||||
|
||||
currentPattern = FillerManager.registry.getPattern(currentPatternId);
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
|
||||
if (!initialized && box.isInitialized()) {
|
||||
box.createLasers(worldObj, LaserKind.Stripes);
|
||||
|
@ -390,29 +388,24 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
return true;
|
||||
}
|
||||
|
||||
/* ISPECIALINVENTORY */
|
||||
@Override
|
||||
public int addItem(ItemStack stack, boolean doAdd, Orientations from) {
|
||||
|
||||
ITransactor transactor = new TransactorSimple(this);
|
||||
ItemStack added = transactor.add(stack, from, doAdd);
|
||||
return added.stackSize;
|
||||
|
||||
/**
|
||||
* Get the start of the side inventory.
|
||||
* @param side The global side to get the start of range.
|
||||
*/
|
||||
public int getStartInventorySide(ForgeDirection side) {
|
||||
if(side == ForgeDirection.UP)
|
||||
return 0;
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) {
|
||||
for (int i = 9; i < contents.length; ++i) {
|
||||
if (contents[i] != null) {
|
||||
if (doRemove) {
|
||||
return new ItemStack[] { decrStackSize(i, 1) };
|
||||
} else {
|
||||
return new ItemStack[] { contents[i] };
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get the size of the side inventory.
|
||||
* @param side The global side.
|
||||
*/
|
||||
public int getSizeInventorySide(ForgeDirection side) {
|
||||
if(side == ForgeDirection.UP)
|
||||
return 9;
|
||||
return getSizeInventory()-9;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TilePathMarker extends TileMarker {
|
|||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
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.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
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
for (Iterator<TilePathMarker> it = availableMarkers.iterator(); it.hasNext();) {
|
||||
TilePathMarker t = it.next();
|
||||
if (t.worldObj.provider.worldType != w.provider.worldType) {
|
||||
if (t.worldObj.provider.dimensionId != w.provider.dimensionId) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,27 +58,20 @@ public class EntityEnergyLaser extends EntityLaser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void updateData() {
|
||||
super.updateData();
|
||||
|
||||
protected void updateDataClient() {
|
||||
super.updateDataClient();
|
||||
powerAverage = (float)decodeDouble(dataWatcher.getWatchableObjectInt(15));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositions(Position head, Position tail) {
|
||||
super.setPositions(head, tail);
|
||||
protected void updateDataServer() {
|
||||
super.updateDataServer();
|
||||
dataWatcher.updateObject(15, Integer.valueOf(encodeDouble((double)powerAverage)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initClientSide() {
|
||||
super.initClientSide();
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
dataWatcher.addObject(15, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initServerSide() {
|
||||
super.initServerSide();
|
||||
dataWatcher.addObject(15, encodeDouble((double)powerAverage));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,19 +16,22 @@ import net.minecraft.src.Entity;
|
|||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public class EntityLaser extends Entity {
|
||||
public abstract class EntityLaser extends Entity {
|
||||
|
||||
protected Position head, tail;
|
||||
|
||||
public double renderSize = 0;
|
||||
public double angleY = 0;
|
||||
public double angleZ = 0;
|
||||
protected String texture;
|
||||
|
||||
private boolean isVisible = false;
|
||||
protected boolean needsUpdate = true;
|
||||
|
||||
public EntityLaser(World world) {
|
||||
super(world);
|
||||
|
||||
initClientSide();
|
||||
head = new Position(0, 0, 0);
|
||||
tail = new Position(0, 0, 0);
|
||||
}
|
||||
|
||||
public EntityLaser(World world, Position head, Position tail) {
|
||||
|
@ -39,46 +42,23 @@ public class EntityLaser extends Entity {
|
|||
this.tail = tail;
|
||||
|
||||
setPositionAndRotation(head.x, head.y, head.z, 0, 0);
|
||||
|
||||
initServerSide();
|
||||
setSize(10, 10);
|
||||
}
|
||||
|
||||
protected void initClientSide() {
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
preventEntitySpawning = false;
|
||||
noClip = true;
|
||||
isImmuneToFire = true;
|
||||
|
||||
head = new Position(0, 0, 0);
|
||||
tail = new Position(0, 0, 0);
|
||||
|
||||
dataWatcher.addObject(8 , Integer.valueOf(0));
|
||||
dataWatcher.addObject(9 , Integer.valueOf(0));
|
||||
dataWatcher.addObject(8, Integer.valueOf(0));
|
||||
dataWatcher.addObject(9, Integer.valueOf(0));
|
||||
dataWatcher.addObject(10, Integer.valueOf(0));
|
||||
dataWatcher.addObject(11, Integer.valueOf(0));
|
||||
dataWatcher.addObject(12, Integer.valueOf(0));
|
||||
dataWatcher.addObject(13, Integer.valueOf(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
|
||||
|
@ -87,8 +67,13 @@ public class EntityLaser extends Entity {
|
|||
if (head == null || tail == null)
|
||||
return;
|
||||
|
||||
if (CoreProxy.proxy.isSimulating(worldObj) && needsUpdate) {
|
||||
updateDataServer();
|
||||
needsUpdate = false;
|
||||
}
|
||||
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
updateData();
|
||||
updateDataClient();
|
||||
|
||||
boundingBox.minX = Math.min(head.x, tail.x);
|
||||
boundingBox.minY = Math.min(head.y, tail.y);
|
||||
|
@ -116,66 +101,62 @@ public class EntityLaser extends Entity {
|
|||
angleY = -Math.atan2(dy, dx) * 180 / Math.PI;
|
||||
}
|
||||
|
||||
protected void updateData() {
|
||||
|
||||
protected void updateDataClient() {
|
||||
head.x = decodeDouble(dataWatcher.getWatchableObjectInt(8));
|
||||
head.y = decodeDouble(dataWatcher.getWatchableObjectInt(9));
|
||||
head.z = decodeDouble(dataWatcher.getWatchableObjectInt(10));
|
||||
tail.x = decodeDouble(dataWatcher.getWatchableObjectInt(11));
|
||||
tail.y = decodeDouble(dataWatcher.getWatchableObjectInt(12));
|
||||
tail.z = decodeDouble(dataWatcher.getWatchableObjectInt(13));
|
||||
texture = dataWatcher.getWatchableObjectString(16);
|
||||
|
||||
isVisible = (dataWatcher.getWatchableObjectByte(14) == 1);
|
||||
}
|
||||
|
||||
public void setPositions(Position head, Position tail) {
|
||||
|
||||
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(9 , Integer.valueOf(encodeDouble(head.y)));
|
||||
protected void updateDataServer() {
|
||||
dataWatcher.updateObject(8, Integer.valueOf(encodeDouble(head.x)));
|
||||
dataWatcher.updateObject(9, Integer.valueOf(encodeDouble(head.y)));
|
||||
dataWatcher.updateObject(10, Integer.valueOf(encodeDouble(head.z)));
|
||||
dataWatcher.updateObject(11, Integer.valueOf(encodeDouble(tail.x)));
|
||||
dataWatcher.updateObject(12, Integer.valueOf(encodeDouble(tail.y)));
|
||||
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() {
|
||||
dataWatcher.updateObject(14, Byte.valueOf((byte) 1));
|
||||
isVisible = true;
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
dataWatcher.updateObject(14, Byte.valueOf((byte) 0));
|
||||
isVisible = false;
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return dataWatcher.getWatchableObjectByte(14) == 0 ? false : true;
|
||||
return this.isVisible;
|
||||
}
|
||||
|
||||
public void setTexture(String texture) {
|
||||
this.texture = texture;
|
||||
dataWatcher.updateObject(16, texture);
|
||||
}
|
||||
|
||||
public String getTexture() {
|
||||
return texture;
|
||||
}
|
||||
public abstract String getTexture();
|
||||
|
||||
protected int encodeDouble(double d) {
|
||||
return (int) (d * 8000);
|
||||
return (int) (d * 8192);
|
||||
}
|
||||
|
||||
protected double decodeDouble(int i) {
|
||||
return (i / 8000D);
|
||||
return (i / 8192D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {}
|
||||
|
||||
//The read/write to nbt seem to be useless
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
|
@ -201,4 +182,9 @@ public class EntityLaser extends Entity {
|
|||
nbt.setDouble("tailY", tail.y);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.src.World;
|
|||
import buildcraft.api.core.Position;
|
||||
|
||||
public class EntityPowerLaser extends EntityLaser {
|
||||
private String texture;
|
||||
|
||||
public EntityPowerLaser(World world) {
|
||||
super(world);
|
||||
|
@ -13,4 +14,31 @@ public class EntityPowerLaser extends EntityLaser {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
|
|||
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
setTabToDisplayOn(CreativeTabs.tabRedstone);
|
||||
setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
|
|
|
@ -8,7 +8,7 @@ public class ItemWrench extends ItemBuildCraft implements IToolWrench {
|
|||
|
||||
public ItemWrench(int i) {
|
||||
super(i);
|
||||
setTabToDisplayOn(CreativeTabs.tabTools);
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,7 +83,7 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized
|
|||
}
|
||||
|
||||
@Override
|
||||
public Packet getAuxillaryInfoPacket() {
|
||||
public Packet getDescriptionPacket() {
|
||||
return new PacketTileUpdate(this).getPacket();
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
if (s.length() > 0) {
|
||||
int i2 = (lastX - cornerX);
|
||||
int k2 = lastY - cornerY;
|
||||
func_74190_a(s, i2, k2);
|
||||
drawCreativeTabHoveringText(s, i2, k2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TransactorSimple extends Transactor {
|
|||
if(inventory.getStackInSlot(i) == null)
|
||||
continue;
|
||||
|
||||
if(!inventory.getStackInSlot(i).isItemEqual(stack))
|
||||
if(!inventory.getStackInSlot(i).isItemEqual(stack) || !ItemStack.func_77970_a(inventory.getStackInSlot(i), stack))
|
||||
continue;
|
||||
|
||||
if(inventory.getStackInSlot(i).stackSize >= inventory.getStackInSlot(i).getMaxStackSize())
|
||||
|
@ -75,7 +75,7 @@ public class TransactorSimple extends Transactor {
|
|||
return remaining;
|
||||
}
|
||||
|
||||
if(!inventory.getStackInSlot(slot).isItemEqual(stack))
|
||||
if(!inventory.getStackInSlot(slot).isItemEqual(stack) || !ItemStack.func_77970_a(inventory.getStackInSlot(slot), stack))
|
||||
return 0;
|
||||
|
||||
int space = inventory.getStackInSlot(slot).getMaxStackSize() - inventory.getStackInSlot(slot).stackSize;
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface ISynchronizedTile {
|
|||
|
||||
public Packet getUpdatePacket();
|
||||
|
||||
public Packet getAuxillaryInfoPacket();
|
||||
public Packet getDescriptionPacket();
|
||||
|
||||
public PacketPayload getPacketPayload();
|
||||
}
|
||||
|
|
|
@ -103,14 +103,14 @@ public class CoreProxy {
|
|||
|
||||
if (Math.abs(player.posX - x) <= maxDistance && Math.abs(player.posY - y) <= maxDistance
|
||||
&& Math.abs(player.posZ - z) <= maxDistance)
|
||||
player.serverForThisPlayer.sendPacketToPlayer(packet);
|
||||
player.playerNetServerHandler.sendPacketToPlayer(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendToPlayer(EntityPlayer entityplayer, BuildCraftPacket packet) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) entityplayer;
|
||||
player.serverForThisPlayer.sendPacketToPlayer(packet.getPacket());
|
||||
player.playerNetServerHandler.sendPacketToPlayer(packet.getPacket());
|
||||
}
|
||||
|
||||
public void sendToServer(Packet packet) {}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package buildcraft.core.render;
|
||||
|
||||
import buildcraft.api.core.Position;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
@ -38,7 +39,9 @@ public class RenderLaser extends Render {
|
|||
|
||||
GL11.glPushMatrix();
|
||||
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.angleY, 0, 0, 1);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class Utils {
|
|||
|
||||
TileEntity tileInventory = world.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z);
|
||||
ITransactor transactor = Transactor.getTransactorFor(tileInventory);
|
||||
if(transactor != null
|
||||
if(transactor != null && !(tileInventory instanceof TileBuildCraft)
|
||||
&& transactor.add(stack, from, false).stackSize > 0)
|
||||
possibleInventories.add(transactor);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,9 @@ import buildcraft.api.liquids.LiquidTank;
|
|||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.energy.gui.ContainerEngine;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ICrafting;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
|
||||
|
@ -125,7 +127,15 @@ public class EngineIron extends Engine {
|
|||
super.update();
|
||||
|
||||
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 (fill(Orientations.Unknown, liquid, false) == liquid.amount) {
|
||||
|
|
|
@ -189,8 +189,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
engine.orientation = o;
|
||||
}
|
||||
orientation = o.ordinal();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlockId(xCoord, yCoord, zCoord));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -321,10 +321,10 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
|
||||
/* SMP UPDATING */
|
||||
@Override
|
||||
public Packet getAuxillaryInfoPacket() {
|
||||
public Packet getDescriptionPacket() {
|
||||
createEngineIfNeeded();
|
||||
|
||||
return super.getAuxillaryInfoPacket();
|
||||
return super.getDescriptionPacket();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
|
|||
topTexture = 2 * 16 + 11;
|
||||
sideTexture = 2 * 16 + 12;
|
||||
setHardness(1.0F);
|
||||
setCreativeTab(CreativeTabs.tabDeco);
|
||||
setCreativeTab(CreativeTabs.tabDecorations);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ public class BlockHopper extends BlockBuildCraft {
|
|||
public BlockHopper(int blockId) {
|
||||
super(blockId, Material.iron);
|
||||
setHardness(5F);
|
||||
setCreativeTab(CreativeTabs.tabDeco);
|
||||
setCreativeTab(CreativeTabs.tabDecorations);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,8 @@ package buildcraft.factory;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.math.IntMath;
|
||||
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.api.core.Orientations;
|
||||
import buildcraft.api.core.Position;
|
||||
|
@ -57,6 +59,11 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
new Position(i, j, k));
|
||||
|
||||
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
|
||||
|
@ -129,7 +136,7 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -137,7 +144,8 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
if (tile instanceof TileQuarry){
|
||||
TileQuarry quarry = (TileQuarry)tile;
|
||||
Box box = quarry.box;
|
||||
|
||||
if (box.isInitialized() && Integer.MAX_VALUE != box.xMax)
|
||||
{
|
||||
//X - Axis
|
||||
for (int x = box.xMin; x <= box.xMax; x++) {
|
||||
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.xMax, y, box.zMax);
|
||||
}
|
||||
}
|
||||
quarry.destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,13 @@ package buildcraft.factory;
|
|||
|
||||
import java.util.ArrayList;
|
||||
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.api.core.BuildCraftAPI;
|
||||
|
@ -37,10 +44,16 @@ import buildcraft.core.utils.Utils;
|
|||
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ChunkCoordIntPair;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
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 @TileNetworkData
|
||||
|
@ -109,6 +122,9 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
private boolean movingHorizontally;
|
||||
private boolean movingVertically;
|
||||
private double headTrajectory;
|
||||
private Ticket chunkTicket;
|
||||
public @TileNetworkData boolean isAlive;
|
||||
public EntityPlayer placedBy;
|
||||
|
||||
private void createArm() {
|
||||
|
||||
|
@ -127,6 +143,16 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!isAlive && CoreProxy.proxy.isSimulating(worldObj))
|
||||
{
|
||||
super.updateEntity();
|
||||
return;
|
||||
}
|
||||
if (!CoreProxy.proxy.isSimulating(worldObj) && isAlive)
|
||||
{
|
||||
super.updateEntity();
|
||||
return;
|
||||
}
|
||||
super.updateEntity();
|
||||
if (inProcess) {
|
||||
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();
|
||||
}
|
||||
if (inProcess || !isDigging) {
|
||||
|
@ -386,7 +412,6 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
}
|
||||
|
||||
private void mineStack(ItemStack stack) {
|
||||
|
||||
// First, try to add to a nearby chest
|
||||
ItemStack added = Utils.addToRandomInventory(stack, worldObj, xCoord, yCoord, zCoord, Orientations.Unknown);
|
||||
stack.stackSize -= added.stackSize;
|
||||
|
@ -425,6 +450,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
ForgeChunkManager.releaseTicket(chunkTicket);
|
||||
|
||||
super.invalidate();
|
||||
destroy();
|
||||
|
@ -456,6 +482,24 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -473,7 +517,12 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
int ySize = a.yMax() - a.yMin() + 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);
|
||||
|
||||
useDefault = true;
|
||||
|
@ -519,10 +568,10 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
}
|
||||
|
||||
a.removeFromWorld();
|
||||
forceChunkLoading(chunkTicket);
|
||||
}
|
||||
|
||||
private void initializeBluePrintBuilder() {
|
||||
|
||||
BptBlueprint bluePrint = new BptBlueprint(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
for (int i = 0; i < bluePrint.sizeX; ++i) {
|
||||
|
@ -558,11 +607,18 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
|
||||
@Override
|
||||
public void postPacketHandling(PacketUpdate packet) {
|
||||
|
||||
super.postPacketHandling(packet);
|
||||
|
||||
if (isAlive)
|
||||
{
|
||||
createUtilsIfNeeded();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
box.deleteLasers();
|
||||
box.reset();
|
||||
return;
|
||||
}
|
||||
if (arm != null) {
|
||||
arm.setHead(headPosX, headPosY, headPosZ);
|
||||
arm.updatePosition();
|
||||
|
@ -573,6 +629,11 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
if (CoreProxy.proxy.isSimulating(this.worldObj) && !box.initialized)
|
||||
{
|
||||
setBoundaries(false);
|
||||
}
|
||||
|
||||
createUtilsIfNeeded();
|
||||
|
||||
sendNetworkUpdate();
|
||||
|
@ -738,4 +799,32 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -207,6 +207,8 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
assemblyTable.zCoord + 0.475 + (worldObj.rand.nextFloat() - 0.5) / 5F);
|
||||
|
||||
laser.setPositions(head, tail);
|
||||
|
||||
if(!laser.isVisible())
|
||||
laser.show();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ItemFacade extends ItemBuildCraft {
|
|||
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
this.setTabToDisplayOn(CreativeTabs.tabMisc);
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,6 @@ public class ItemFacade extends ItemBuildCraft {
|
|||
return true;
|
||||
} else {
|
||||
if (((TileGenericPipe)tile).addFacade(Orientations.values()[side], ItemFacade.getBlockId(stack.getItemDamage()), ItemFacade.getMetaData(stack.getItemDamage()))){
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ItemGate extends ItemBuildCraft {
|
|||
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
setTabToDisplayOn(CreativeTabs.tabRedstone);
|
||||
setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
|
|
|
@ -26,11 +26,11 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
|
||||
protected ItemPipe(int i) {
|
||||
super(i);
|
||||
this.setTabToDisplayOn(CreativeTabs.tabTransport);
|
||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
if (world.getBlockId(i, j, k) == Block.snow.blockID)
|
||||
|
|
|
@ -94,7 +94,7 @@ public class PipeTransportItems extends PipeTransport {
|
|||
((IPipeTransportItemsHook) container.pipe).entityEntered(item, orientation);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -371,13 +371,13 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
initialize(BlockGenericPipe.createPipe(packet.getPipeId()));
|
||||
}
|
||||
renderState = packet.getRenderState();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getAuxillaryInfoPacket() {
|
||||
public Packet getDescriptionPacket() {
|
||||
bindPipe();
|
||||
|
||||
PacketTileState packet = new PacketTileState(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
@ -613,7 +613,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
break;
|
||||
}
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue