Added special case handling for the vanilla furnace to squash XP exploits.
This commit is contained in:
parent
20df5fe093
commit
a00f6129fa
4 changed files with 38 additions and 7 deletions
|
@ -5,6 +5,7 @@ import buildcraft.api.inventory.ISpecialInventory;
|
|||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntityFurnace;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
|
||||
public abstract class Transactor implements ITransactor {
|
||||
|
@ -23,6 +24,10 @@ public abstract class Transactor implements ITransactor {
|
|||
if(object instanceof ISpecialInventory)
|
||||
return new TransactorSpecial((ISpecialInventory)object);
|
||||
|
||||
// Furnaces need to be special cased to prevent vanilla XP exploits.
|
||||
else if(object instanceof TileEntityFurnace)
|
||||
return new TransactorFurnace((ISidedInventory)object);
|
||||
|
||||
else if(object instanceof ISidedInventory)
|
||||
return new TransactorSided((ISidedInventory)object);
|
||||
|
||||
|
|
24
common/buildcraft/core/inventory/TransactorFurnace.java
Normal file
24
common/buildcraft/core/inventory/TransactorFurnace.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package buildcraft.core.inventory;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
|
||||
/**
|
||||
* Will respect ISidedInventory implementation but only accept input from above or below.
|
||||
*/
|
||||
public class TransactorFurnace extends TransactorSided {
|
||||
|
||||
public TransactorFurnace(ISidedInventory inventory) {
|
||||
super(inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int inject(ItemStack stack, Orientations orientation, boolean doAdd) {
|
||||
if(orientation != Orientations.YNeg
|
||||
&& orientation != Orientations.YPos)
|
||||
return 0;
|
||||
|
||||
return super.inject(stack, orientation, doAdd);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,9 @@ import buildcraft.api.core.Orientations;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
|
||||
/**
|
||||
* Manages input on ISidedInventory
|
||||
*/
|
||||
public class TransactorSided extends TransactorSimple {
|
||||
|
||||
ISidedInventory sided;
|
||||
|
|
|
@ -488,10 +488,10 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
float scale = 1.0F;
|
||||
|
||||
if (true) {
|
||||
int var17 = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(), i);
|
||||
float var18 = (var17 >> 16 & 255) / 255.0F;
|
||||
float var19 = (var17 >> 8 & 255) / 255.0F;
|
||||
float var20 = (var17 & 255) / 255.0F;
|
||||
int itemColour = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(), i);
|
||||
float var18 = (itemColour >> 16 & 255) / 255.0F;
|
||||
float var19 = (itemColour >> 8 & 255) / 255.0F;
|
||||
float var20 = (itemColour & 255) / 255.0F;
|
||||
GL11.glColor4f(var18 * scale, var19 * scale, var20 * scale, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -502,11 +502,10 @@ public class RenderPipe extends TileEntitySpecialRenderer {
|
|||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
int i = itemstack.getIconIndex();
|
||||
if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null
|
||||
&& Block.blocksList[itemstack.itemID].blockID != 0) {
|
||||
&& Block.blocksList[itemstack.itemID].blockID != 0)
|
||||
ForgeHooksClient.bindTexture(Block.blocksList[itemstack.itemID].getTextureFile(), 0);
|
||||
} else {
|
||||
else
|
||||
ForgeHooksClient.bindTexture(Item.itemsList[itemstack.itemID].getTextureFile(), 0);
|
||||
}
|
||||
|
||||
drawItem(i, quantity);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue