Changed all deprecated functionality to it's equivalent, updated to 1.7.10-10.13.0.1160

This commit is contained in:
Andrew Dudney 2014-07-04 14:30:19 -06:00
parent 3dbd220631
commit ca5bbc3f17
20 changed files with 70 additions and 75 deletions

3
.gitignore vendored
View file

@ -18,3 +18,6 @@ build
#runtime
run
#mac
.DS_Store

View file

@ -129,9 +129,9 @@ public final class PowerHandler implements IBatteryProvider {
public final IPowerReceptor receptor;
private double activationEnergy;
private final SafeTimeTracker doWorkTracker = new SafeTimeTracker();
private final SafeTimeTracker sourcesTracker = new SafeTimeTracker();
private final SafeTimeTracker perditionTracker = new SafeTimeTracker();
private final SafeTimeTracker doWorkTracker = new SafeTimeTracker(1);
private final SafeTimeTracker sourcesTracker = new SafeTimeTracker(1);
private final SafeTimeTracker perditionTracker = new SafeTimeTracker(1);
private PerditionCalculator perdition;
private final PowerReceiver receiver;
private final Type type;
@ -284,7 +284,7 @@ public final class PowerHandler implements IBatteryProvider {
private void applyPerdition() {
double energyStored = getEnergyStored();
if (perditionTracker.markTimeIfDelay(receptor.getWorld(), 1) && energyStored > 0) {
if (perditionTracker.markTimeIfDelay(receptor.getWorld()) && energyStored > 0) {
double prev = energyStored;
double newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay());
if (newEnergy == 0 || newEnergy < energyStored) {
@ -300,14 +300,14 @@ public final class PowerHandler implements IBatteryProvider {
private void applyWork() {
if (getEnergyStored() >= activationEnergy) {
if (doWorkTracker.markTimeIfDelay(receptor.getWorld(), 1)) {
if (doWorkTracker.markTimeIfDelay(receptor.getWorld())) {
receptor.doWork(this);
}
}
}
private void updateSources(ForgeDirection source) {
if (sourcesTracker.markTimeIfDelay(receptor.getWorld(), 1)) {
if (sourcesTracker.markTimeIfDelay(receptor.getWorld())) {
for (int i = 0; i < 6; ++i) {
powerSources[i] -= sourcesTracker.durationOfLastDelay();
if (powerSources[i] < 0) {

View file

@ -22,12 +22,12 @@ apply plugin: 'forge' // adds the forge dependency
apply plugin: 'maven' // for uploading to a maven repo
apply plugin: 'checkstyle'
version = "6.0.16"
version = "6.0.17"
group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]
minecraft {
version = "1.7.2-10.12.1.1079" // McVersion-ForgeVersion this variable is later changed to contain only the MC version, while the apiVersion variable is used for the forge version. Yeah its stupid, and will be changed eentually.
version = "1.7.10-10.13.0.1160" // McVersion-ForgeVersion this variable is later changed to contain only the MC version, while the apiVersion variable is used for the forge version. Yeah its stupid, and will be changed eentually.
assetDir = "run/assets" // the place for ForgeGradle to download the assets. The assets that the launcher gets and stuff

View file

@ -14,6 +14,7 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.HashSet;
import java.util.TreeMap;
import java.util.UUID;
import com.mojang.authlib.GameProfile;
@ -207,7 +208,7 @@ public class BuildCraftCore extends BuildCraftMod {
public static float diffX, diffY, diffZ;
public static GameProfile gameProfile = new GameProfile("buildcraft.core", "[BuildCraft]");
public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("buildcraft.core".getBytes()), "[BuildCraft]");
private static FloatBuffer modelviewF;
private static FloatBuffer projectionF;

View file

@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.BuildCraftBuilders;
@ -257,7 +258,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
public void uploadBlueprintToServer (BlueprintId id, byte [] data) {
try {
if (data != null) {
NBTTagCompound nbt = CompressedStreamTools.decompress(data);
NBTTagCompound nbt = CompressedStreamTools.func_152457_a(data, NBTSizeTracker.field_152451_a);
BlueprintBase bpt = BlueprintBase.loadBluePrint(nbt);
bpt.setData(data);
bpt.id = id;
@ -279,7 +280,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
@RPC (RPCSide.CLIENT)
public void downloadBlueprintToClient (BlueprintId id, byte [] data) {
try {
NBTTagCompound nbt = CompressedStreamTools.decompress(data);
NBTTagCompound nbt = CompressedStreamTools.func_152457_a(data, NBTSizeTracker.field_152451_a);
BlueprintBase bpt = BlueprintBase.loadBluePrint(nbt);
bpt.setData(data);
bpt.id = id;

View file

@ -23,6 +23,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.BuildCraftBuilders;
@ -238,7 +239,7 @@ public class BlueprintDatabase {
public static BlueprintBase load(byte[] data) {
try {
NBTTagCompound nbt = CompressedStreamTools.decompress(data);
NBTTagCompound nbt = CompressedStreamTools.func_152457_a(data, NBTSizeTracker.field_152451_a);
BlueprintBase blueprint = BlueprintBase.loadBluePrint(nbt);
blueprint.setData(data);

View file

@ -31,7 +31,7 @@ public class GuiToggleButton extends GuiBetterButton {
}
@Override
protected int getHoverState(boolean mouseOver) {
public int getHoverState(boolean mouseOver) {
int state = 1;
if (!enabled) {
state = 0;

View file

@ -19,7 +19,7 @@ public class SlotWorkbench extends SlotBase {
@Override
public boolean isItemValid(ItemStack stack) {
return stack != null && stack.isStackable() && !stack.getItem().hasContainerItem();
return stack != null && stack.isStackable() && !stack.getItem().hasContainerItem(stack);
}
@Override

View file

@ -211,7 +211,7 @@ public final class InvUtils {
public static ItemStack consumeItem(ItemStack stack) {
if (stack.stackSize == 1) {
if (stack.getItem().hasContainerItem()) {
if (stack.getItem().hasContainerItem(stack)) {
return stack.getItem().getContainerItem(stack);
} else {
return null;

View file

@ -79,26 +79,30 @@ public class StackHelper {
}
if (oreDictionary) {
int idBase = OreDictionary.getOreID(base);
if (idBase >= 0) {
for (ItemStack itemstack : OreDictionary.getOres(idBase)) {
if (comparison.getItem() == itemstack.getItem() && (itemstack.getItemDamage() == OreDictionary.WILDCARD_VALUE || comparison.getItemDamage() == itemstack.getItemDamage())) {
return true;
}
}
int[] idBase = OreDictionary.getOreIDs(base);
if (idBase.length > 0) {
for (int id : idBase) {
for (ItemStack itemstack : OreDictionary.getOres(OreDictionary.getOreName(id))) {
if (comparison.getItem() == itemstack.getItem() && (itemstack.getItemDamage() == OreDictionary.WILDCARD_VALUE || comparison.getItemDamage() == itemstack.getItemDamage())) {
return true;
}
}
}
}
}
return false;
}
public static boolean isCraftingEquivalent(int oreID, ItemStack comparison) {
if (oreID >= 0) {
for (ItemStack itemstack : OreDictionary.getOres(oreID)) {
if (comparison.getItem() == itemstack.getItem() && (itemstack.getItemDamage() == OreDictionary.WILDCARD_VALUE || comparison.getItemDamage() == itemstack.getItemDamage())) {
return true;
}
}
public static boolean isCraftingEquivalent(int[] oreIDs, ItemStack comparison) {
if (oreIDs.length > 0) {
for(int id : oreIDs) {
for (ItemStack itemstack : OreDictionary.getOres(OreDictionary.getOreName(id))) {
if (comparison.getItem() == itemstack.getItem() && (itemstack.getItemDamage() == OreDictionary.WILDCARD_VALUE || comparison.getItemDamage() == itemstack.getItemDamage())) {
return true;
}
}
}
}
return false;

View file

@ -13,6 +13,7 @@ import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
public class PacketNBT extends PacketCoordinates {
@ -50,7 +51,7 @@ public class PacketNBT extends PacketCoordinates {
data.readBytes(compressed);
try {
this.nbttagcompound = CompressedStreamTools.decompress(compressed);
this.nbttagcompound = CompressedStreamTools.func_152457_a(compressed, NBTSizeTracker.field_152451_a);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View file

@ -223,8 +223,7 @@ public class EntityRobotPicker extends EntityRobot implements IInventory {
public boolean isItemValidForSlot(int var1, ItemStack var2) {
return inv[var1] == null
|| (inv[var1].isItemEqual(var2) && inv[var1].isStackable() && inv[var1].stackSize
+ var2.stackSize <= inv[var1].getItem()
.getItemStackLimit());
+ var2.stackSize <= inv[var1].getMaxStackSize());
}
@Override

View file

@ -24,6 +24,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
@ -468,7 +469,7 @@ public final class Utils {
int length = data.readInt();
byte[] compressed = new byte[length];
data.readBytes(compressed);
return CompressedStreamTools.decompress(compressed);
return CompressedStreamTools.func_152457_a(compressed, NBTSizeTracker.field_152451_a);
} catch (IOException e) {
e.printStackTrace();
return null;

View file

@ -155,7 +155,7 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
if (!stack.isStackable()) {
return null;
}
if (stack.getItem().hasContainerItem()) {
if (stack.getItem().hasContainerItem(stack)) {
return null;
}
}
@ -278,7 +278,7 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
if (!stack.isStackable()) {
return false;
}
if (stack.getItem().hasContainerItem()) {
if (stack.getItem().hasContainerItem(stack)) {
return false;
}
if (getStackInSlot(slot) == null) {

View file

@ -49,8 +49,8 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve
public TankManager<SingleUseTank> tankManager = new TankManager<SingleUseTank>(tank1, tank2, result);
public float animationSpeed = 1;
private int animationStage = 0;
private SafeTimeTracker time = new SafeTimeTracker();
private SafeTimeTracker updateNetworkTime = new SafeTimeTracker();
private SafeTimeTracker time = null;
private SafeTimeTracker updateNetworkTime = new SafeTimeTracker(BuildCraftCore.updateFactor);
private boolean isActive;
@MjBattery(maxCapacity = 1000, maxReceivedPerCycle = 150, minimumConsumption = 1)
@ -107,7 +107,7 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve
return;
}
if (updateNetworkTime.markTimeIfDelay(worldObj, BuildCraftCore.updateFactor)) {
if (updateNetworkTime.markTimeIfDelay(worldObj)) {
sendNetworkUpdate();
}
@ -138,10 +138,16 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve
decreaseAnimation();
}
if (!time.markTimeIfDelay(worldObj, currentRecipe.timeRequired)) {
if (time == null) {
time = new SafeTimeTracker(currentRecipe.timeRequired);
}
if (!time.markTimeIfDelay(worldObj)) {
return;
}
time = null;
if (mjStored >= currentRecipe.energyCost) {
mjStored -= currentRecipe.energyCost;

View file

@ -37,7 +37,7 @@ public class TileTank extends TileBuildCraft implements IFluidHandler {
public final Tank tank = new Tank("tank", FluidContainerRegistry.BUCKET_VOLUME * 16, this);
public final TankManager tankManager = new TankManager(tank);
public boolean hasUpdate = false;
public SafeTimeTracker tracker = new SafeTimeTracker();
public SafeTimeTracker tracker = new SafeTimeTracker(2 * BuildCraftCore.updateFactor);
private int prevLightValue = 0;
/* UPDATING */
@ -57,7 +57,7 @@ public class TileTank extends TileBuildCraft implements IFluidHandler {
moveFluidBelow();
}
if (hasUpdate && tracker.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
if (hasUpdate && tracker.markTimeIfDelay(worldObj)) {
sendNetworkUpdate();
hasUpdate = false;
}

View file

@ -79,11 +79,11 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
private final class CraftingGrid extends SimpleInventory {
public int[] oreIDs = new int[9];
public int[][] oreIDs = new int[9][];
public CraftingGrid() {
super(9, "CraftingSlots", 1);
Arrays.fill(oreIDs, -1);
Arrays.fill(oreIDs, new int[0]);
}
@Override
@ -91,7 +91,14 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
super.setInventorySlotContents(slotId, itemstack);
if (TileAdvancedCraftingTable.this.getWorldObj() == null || !TileAdvancedCraftingTable.this.getWorldObj().isRemote) {
oreIDs[slotId] = itemstack == null ? -1 : OreDictionary.getOreID(itemstack);
int[] id = new int[0];
if(itemstack != null){
int[] ids = OreDictionary.getOreIDs(itemstack);
if(ids.length > 0){
id = ids;
}
}
oreIDs[slotId] = id;
}
}
}

View file

@ -153,7 +153,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
private final short[] inputTTL = new short[]{0, 0, 0, 0, 0, 0};
private final short[] outputTTL = new short[]{OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL};
private final short[] outputCooldown = new short[]{0, 0, 0, 0, 0, 0};
private final SafeTimeTracker tracker = new SafeTimeTracker();
private final SafeTimeTracker tracker = new SafeTimeTracker(BuildCraftCore.updateFactor);
private int clientSyncCounter = 0;
public PipeTransportFluids() {
@ -204,7 +204,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
moveFluids();
if (tracker.markTimeIfDelay(container.getWorldObj(), BuildCraftCore.updateFactor)) {
if (tracker.markTimeIfDelay(container.getWorldObj())) {
boolean init = false;
if (++clientSyncCounter > BuildCraftCore.longUpdateFactor) {

View file

@ -45,8 +45,6 @@ public class PipeTransportItems extends PipeTransport {
public static final int MAX_PIPE_STACKS = 64;
public static final int MAX_PIPE_ITEMS = 1024;
public boolean allowBouncing = false;
// TODO: generalize the use of this hook in particular for obsidian pipe
public IItemTravelingHook travelHook;
public final TravelerSet items = new TravelerSet(this);
@Override
@ -55,10 +53,6 @@ public class PipeTransportItems extends PipeTransport {
}
public void readjustSpeed(TravelingItem item) {
if (container.pipe instanceof IPipeTransportItemsHook) {
((IPipeTransportItemsHook) container.pipe).readjustSpeed(item);
return;
}
PipeEventItem.AdjustSpeed event = new PipeEventItem.AdjustSpeed(item);
container.pipe.handlePipeEvent(event);
if (!event.handled) {
@ -110,10 +104,6 @@ public class PipeTransportItems extends PipeTransport {
item.output = resolveDestination(item);
}
if (container.pipe instanceof IPipeTransportItemsHook) {
((IPipeTransportItemsHook) container.pipe).entityEntered(item, inputOrientation);
}
PipeEventItem.Entered event = new PipeEventItem.Entered(item);
container.pipe.handlePipeEvent(event);
if (event.cancelled) {
@ -177,9 +167,6 @@ public class PipeTransportItems extends PipeTransport {
item.output = resolveDestination(item);
}
if (container.pipe instanceof IPipeTransportItemsHook) {
((IPipeTransportItemsHook) container.pipe).entityEntered(item, item.input);
}
PipeEventItem.Entered event = new PipeEventItem.Entered(item);
container.pipe.handlePipeEvent(event);
if (event.cancelled) {
@ -221,10 +208,6 @@ public class PipeTransportItems extends PipeTransport {
}
}
if (this.container.pipe instanceof IPipeTransportItemsHook) {
Position pos = new Position(container.xCoord, container.yCoord, container.zCoord, item.input);
result = ((IPipeTransportItemsHook) this.container.pipe).filterPossibleMovements(result, pos, item);
}
PipeEventItem.FindDest event = new PipeEventItem.FindDest(item, result);
container.pipe.handlePipeEvent(event);
@ -294,9 +277,6 @@ public class PipeTransportItems extends PipeTransport {
dropItem(item);
}
} else {
if (travelHook != null) {
travelHook.centerReached(this, item);
}
PipeEventItem.ReachedCenter event = new PipeEventItem.ReachedCenter(item);
container.pipe.handlePipeEvent(event);
}
@ -308,10 +288,6 @@ public class PipeTransportItems extends PipeTransport {
container.pipe.handlePipeEvent(event);
boolean handleItem = !event.handled;
if (travelHook != null) {
handleItem = !travelHook.endReached(this, item, tile);
}
// If the item has not been scheduled to removal by the hook
if (handleItem && items.scheduleRemoval(item)) {
handleTileReached(item, tile);
@ -358,10 +334,6 @@ public class PipeTransportItems extends PipeTransport {
return;
}
if (travelHook != null) {
travelHook.drop(this, item);
}
PipeEventItem.DropItem event = new PipeEventItem.DropItem(item, item.toEntityItem());
container.pipe.handlePipeEvent(event);

View file

@ -74,7 +74,6 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
public final PipeRenderState renderState = new PipeRenderState();
public final CoreState coreState = new CoreState();
public boolean[] pipeConnectionsBuffer = new boolean[6];
public SafeTimeTracker networkSyncTracker = new SafeTimeTracker();
@MjBattery
public Pipe pipe;