3.5.2 build changes. Removed SidedInventoryAdapter.java to cut down on helper classes.

This commit is contained in:
SirSengir 2013-05-12 08:19:28 +02:00
parent eb836c3ad0
commit 722a3837bf
9 changed files with 83 additions and 155 deletions

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri May 03 16:39:34 CEST 2013
build.number=25
#Sat May 11 12:43:18 CEST 2013
build.number=29

View file

@ -17,7 +17,7 @@
<property name="mc.version" value="1.5.2"/>
<property name="forge.version" value="7.8.0.684"/>
<property name="bc.version" value="3.5.1"/>
<property name="bc.version" value="3.5.2"/>
<property name="bc.version.full" value="${bc.version}"/>
<echo message="Starting build for ${bc.version.full}"/>
@ -30,6 +30,12 @@
<target name="setup">
<!-- Pull localizations -->
<echo message="Pulling localizations..." />
<exec dir="${lang.dir}" executable="git" osfamily="windows" failonerror="true">
<arg line="pull" />
</exec>
<echo message="Unpacking Forge..." />
<unzip dest="${build.dir}">
<fileset dir="${resource.dir}">
@ -94,8 +100,18 @@
<copy todir="${classes.dir}/client">
<fileset dir="${src.dir}/buildcraft_resources">
<exclude name="build.xml"/>
<exclude name="build.number"/>
</fileset>
</copy>
<copy todir="${classes.dir}/client" overwrite="true" failonerror="true">
<fileset dir="${src.dir}/buildcraft_resources">
<include name="mcmod.info"/>
</fileset>
<filterset>
<filter token="VERSION" value="${bc.version.full} (${build.number})" />
</filterset>
</copy>
<!-- Copy localizations -->
<copy todir="${classes.dir}/client">
<fileset dir="${lang.dir}">

View file

@ -0,0 +1,11 @@
#3.5.2
- Added: Pipe plugs. (Krapht)
- Added: Config option to disable oil springs. (CovertJaguar)
- Changed: Some more tweaks to oil spawn. Oil lakes now also spawn in taiga biomes. (CovertJaguar)
- Changed: Fire is now considered a soft block. (CovertJaguar)
- Changed: Pipes with missing info are now deleted. (CovertJaguar)
- Changed: Vanilla ISided support for extraction pipes. (h/t immibis)
- Bugfix: Filler flatten pattern no longer stopped by flowers. (CovertJaguar)
- Bugfix: Possibly fixed power pipe load issues. (CovertJaguar)

View file

@ -2,11 +2,11 @@
{
"modid": "BuildCraft|Core",
"name": "BuildCraft",
"version": "@VERSION@",
"mcversion": "",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more!",
"version": "",
"credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authors": [ "SpaceToad", "BuildCraft Team" ],
@ -19,11 +19,11 @@
{
"modid": "BuildCraft|Builders",
"name": "BC Builders",
"version": "@VERSION@",
"mcversion": "",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Builders Component)",
"version": "",
"credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authors": [ "SpaceToad", "BuildCraft Team" ],
@ -36,11 +36,11 @@
{
"modid": "BuildCraft|Energy",
"name": "BC Energy",
"version": "@VERSION@",
"mcversion": "",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Energy Component)",
"version": "",
"credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authors": [ "SpaceToad", "BuildCraft Team" ],
@ -53,11 +53,11 @@
{
"modid": "BuildCraft|Factory",
"name": "BC Factory",
"version": "@VERSION@",
"mcversion": "",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Factory Component)",
"version": "",
"credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authors": [ "SpaceToad", "BuildCraft Team" ],
@ -70,11 +70,11 @@
{
"modid": "BuildCraft|Silicon",
"name": "BC Silicon",
"version": "@VERSION@",
"mcversion": "",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Silicon Component)",
"version": "",
"credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authors": [ "SpaceToad", "BuildCraft Team" ],
@ -87,11 +87,11 @@
{
"modid": "BuildCraft|Transport",
"name": "BC Transport",
"version": "@VERSION@",
"mcversion": "",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Transport Component)",
"version": "",
"credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "",
"url": "http://www.mod-buildcraft.com/",
"updateUrl": "",
"authors": [ "SpaceToad", "BuildCraft Team" ],

View file

@ -1,5 +1,6 @@
package buildcraft.core.inventory;
import buildcraft.core.utils.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
@ -29,12 +30,14 @@ public abstract class InventoryWrapper implements ISidedInventory {
@Override public boolean isStackValidForSlot(int slotIndex, ItemStack itemstack) { return inventory.isStackValidForSlot(slotIndex, itemstack); }
/* STATIC HELPER */
public static ISidedInventory getWrappedInventory(IInventory inventory) {
public static ISidedInventory getWrappedInventory(Object inventory) {
if(inventory instanceof ISidedInventory)
return (ISidedInventory)inventory;
else if(inventory instanceof net.minecraftforge.common.ISidedInventory)
return new InventoryWrapperForge((net.minecraftforge.common.ISidedInventory)inventory);
else if(inventory instanceof IInventory)
return new InventoryWrapperSimple(Utils.getInventory((IInventory)inventory));
else
return new InventoryWrapperSimple(inventory);
return null;
}
}

View file

@ -10,13 +10,12 @@
package buildcraft.core.triggers;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.utils.SidedInventoryAdapter;
import buildcraft.core.utils.Utils;
import buildcraft.core.inventory.InventoryWrapper;
public class TriggerInventory extends BCTrigger {
@ -63,11 +62,7 @@ public class TriggerInventory extends BCTrigger {
}
if (tile instanceof IInventory) {
IInventory inv = Utils.getInventory(((IInventory) tile));
if (side != ForgeDirection.UNKNOWN && inv instanceof ISidedInventory) {
inv = new SidedInventoryAdapter((ISidedInventory) inv, side);
}
ISidedInventory inv = InventoryWrapper.getWrappedInventory(tile);
int invSize = inv.getSizeInventory();
if (invSize <= 0)
@ -76,7 +71,7 @@ public class TriggerInventory extends BCTrigger {
boolean foundItems = false;
boolean foundSpace = false;
for (int i = 0; i < invSize; ++i) {
for (int i : inv.getAccessibleSlotsFromSide(side.ordinal())) {
ItemStack stack = inv.getStackInSlot(i);
boolean slotEmpty = stack == null || stack.stackSize == 0;

View file

@ -1,91 +0,0 @@
package buildcraft.core.utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
/**
* This class is responsible for abstracting an ISidedInventory as a normal IInventory
*
* @author Krapht
*
*/
public class SidedInventoryAdapter implements IInventory {
private final ISidedInventory _sidedInventory;
private final ForgeDirection _side;
private final int _slotOffset;
public SidedInventoryAdapter(ISidedInventory sidedInventory, ForgeDirection side) {
_sidedInventory = sidedInventory;
_side = side;
_slotOffset = _sidedInventory.getStartInventorySide(side);
}
@Override
public int getSizeInventory() {
return _sidedInventory.getSizeInventorySide(_side);
}
@Override
public ItemStack getStackInSlot(int i) {
return _sidedInventory.getStackInSlot(i + _slotOffset);
}
@Override
public ItemStack decrStackSize(int i, int j) {
return _sidedInventory.decrStackSize(i + _slotOffset, j);
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
_sidedInventory.setInventorySlotContents(i + _slotOffset, itemstack);
}
@Override
public String getInvName() {
return _sidedInventory.getInvName();
}
@Override
public int getInventoryStackLimit() {
return _sidedInventory.getInventoryStackLimit();
}
@Override
public void onInventoryChanged() {
_sidedInventory.onInventoryChanged();
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return _sidedInventory.isUseableByPlayer(entityplayer);
}
@Override
public void openChest() {
_sidedInventory.openChest();
}
@Override
public void closeChest() {
_sidedInventory.closeChest();
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
return _sidedInventory.getStackInSlotOnClosing(slot + _slotOffset);
}
@Override
public boolean isInvNameLocalized() {
return false;
}
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
return true;
}
}

View file

@ -14,21 +14,21 @@ import java.util.LinkedList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import buildcraft.api.core.Position;
import buildcraft.api.inventory.ISpecialInventory;
import buildcraft.core.inventory.InventoryWrapper;
import buildcraft.core.inventory.TransactorRoundRobin;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.CraftingHelper;
import buildcraft.core.utils.SidedInventoryAdapter;
import buildcraft.core.utils.Utils;
public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
@ -281,45 +281,42 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory {
return null;
}
IInventory inventory = null;
if (tile instanceof ISidedInventory){
inventory = new SidedInventoryAdapter((ISidedInventory) tile, direction.getOpposite());
} else if (tile instanceof IInventory) {
inventory = Utils.getInventory((IInventory) tile);
}
ISidedInventory inventory = InventoryWrapper.getWrappedInventory(tile);
if (inventory == null)
return null;
if (inventory == null) return null;
for (int j = 0; j < inventory.getSizeInventory(); ++j) {
for (int j : inventory.getAccessibleSlotsFromSide(direction.ordinal())) {
ItemStack stack = inventory.getStackInSlot(j);
if(stack == null)
continue;
if(stack.stackSize <= 0)
continue;
if(!inventory.canExtractItem(j, stack, direction.ordinal()))
continue;
if(stack.itemID != itemStack.itemID)
continue;
if (stack != null) {
if (stack.stackSize > 0) {
if (stack.itemID == itemStack.itemID) {
if (!stack.isItemStackDamageable()) {
if (stack.itemID == itemStack.itemID && stack.getItemDamage() == itemStack.getItemDamage()) {
inventory.decrStackSize(j, 1);
if (!stack.isItemStackDamageable()) {
if (stack.itemID == itemStack.itemID && stack.getItemDamage() == itemStack.getItemDamage()) {
inventory.decrStackSize(j, 1);
StackPointer result = new StackPointer();
result.inventory = inventory;
result.index = j;
result.item = stack;
StackPointer result = new StackPointer();
result.inventory = inventory;
result.index = j;
result.item = stack;
return result;
}
} else {
if (stack.itemID == itemStack.itemID) {
inventory.decrStackSize(j, 1);
return result;
}
} else {
if (stack.itemID == itemStack.itemID) {
inventory.decrStackSize(j, 1);
StackPointer result = new StackPointer();
result.inventory = inventory;
result.index = j;
result.item = stack;
StackPointer result = new StackPointer();
result.inventory = inventory;
result.index = j;
result.item = stack;
return result;
}
}
}
return result;
}
}
}

View file

@ -108,10 +108,7 @@ public class TileHopper extends TileBuildCraft implements IInventory {
}
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack)
{
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
return true;
}
}