Deprecated Forge's ISidedInventroy, there is a vanilla solution. Added temporary config option to legacy furnace slot orientation.
This commit is contained in:
parent
9f8a07f7d8
commit
a91a50cd9d
3 changed files with 27 additions and 9 deletions
|
@ -26,6 +26,7 @@ import static net.minecraftforge.common.ForgeVersion.*;
|
|||
public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer
|
||||
{
|
||||
public static int clumpingThreshold = 64;
|
||||
public static boolean legacyFurnaceSides = false;
|
||||
|
||||
public ForgeDummyContainer()
|
||||
{
|
||||
|
@ -77,6 +78,10 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
|
|||
clumpingThreshold = 64;
|
||||
clumpingThresholdProperty.set(64);
|
||||
}
|
||||
|
||||
Property furnaceOutput = config.get(Configuration.CATEGORY_GENERAL, "legacyFurnceOutput", false);
|
||||
furnaceOutput.comment = "Controls the sides of vanilla furnaces for Forge's ISidedInventroy, Vanilla defines the output as the bottom, but mods/Forge define it as the sides. Settings this to true will restore the old side relations.";
|
||||
legacyFurnaceSides = furnaceOutput.getBoolean(false);
|
||||
|
||||
if (config.hasChanged())
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.inventory.IInventory;
|
|||
/** Inventory ranges mapped by side. This class is implemented by TileEntities
|
||||
* that provide different inventory slot ranges to different sides.
|
||||
*/
|
||||
@Deprecated //A equivalent Interface is now in Minecraft Vanilla will be removed next major MC version
|
||||
public interface ISidedInventory extends IInventory
|
||||
{
|
||||
|
||||
|
@ -17,12 +18,14 @@ public interface ISidedInventory extends IInventory
|
|||
* Get the start of the side inventory.
|
||||
* @param side The global side to get the start of range.
|
||||
*/
|
||||
@Deprecated
|
||||
int getStartInventorySide(ForgeDirection side);
|
||||
|
||||
/**
|
||||
* Get the size of the side inventory.
|
||||
* @param side The global side.
|
||||
*/
|
||||
@Deprecated
|
||||
int getSizeInventorySide(ForgeDirection side);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,19 +8,20 @@
|
|||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
@@ -16,8 +17,9 @@
|
||||
@@ -16,8 +17,10 @@
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
-
|
||||
-public class TileEntityFurnace extends TileEntity implements ISidedInventory
|
||||
+import net.minecraftforge.common.ForgeDirection;
|
||||
+import net.minecraftforge.common.ForgeDummyContainer;
|
||||
+
|
||||
+public class TileEntityFurnace extends TileEntity implements ISidedInventory, net.minecraftforge.common.ISidedInventory
|
||||
{
|
||||
/**
|
||||
* The ItemStacks that hold the items currently being used in the furnace
|
||||
@@ -268,8 +270,7 @@
|
||||
@@ -268,8 +271,7 @@
|
||||
|
||||
if (this.furnaceItemStacks[1].stackSize == 0)
|
||||
{
|
||||
|
@ -30,7 +31,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -315,8 +316,12 @@
|
||||
@@ -315,8 +317,12 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -45,7 +46,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -327,15 +332,15 @@
|
||||
@@ -327,15 +333,15 @@
|
||||
{
|
||||
if (this.canSmelt())
|
||||
{
|
||||
|
@ -65,7 +66,7 @@
|
|||
}
|
||||
|
||||
--this.furnaceItemStacks[0].stackSize;
|
||||
@@ -362,7 +367,7 @@
|
||||
@@ -362,7 +368,7 @@
|
||||
int i = par0ItemStack.getItem().itemID;
|
||||
Item item = par0ItemStack.getItem();
|
||||
|
||||
|
@ -74,7 +75,7 @@
|
|||
{
|
||||
Block block = Block.blocksList[i];
|
||||
|
||||
@@ -423,4 +428,41 @@
|
||||
@@ -423,4 +429,50 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -105,9 +106,18 @@
|
|||
+ @Override
|
||||
+ public int getStartInventorySide(ForgeDirection side)
|
||||
+ {
|
||||
+ if (side == ForgeDirection.DOWN) return 1;
|
||||
+ if (side == ForgeDirection.UP) return 0;
|
||||
+ return 2;
|
||||
+ if (ForgeDummyContainer.legacyFurnaceSides)
|
||||
+ {
|
||||
+ if (side == ForgeDirection.DOWN) return 1;
|
||||
+ if (side == ForgeDirection.UP) return 0;
|
||||
+ return 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (side == ForgeDirection.DOWN) return 2;
|
||||
+ if (side == ForgeDirection.UP) return 0;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
|
Loading…
Reference in a new issue