Fix some bugs with the crusher

This commit is contained in:
Ellpeck 2015-12-16 20:06:12 +01:00
parent f0710eaa8b
commit a41f73cf7a
2 changed files with 13 additions and 1 deletions

View file

@ -77,7 +77,7 @@ public class CrusherCrafting{
CrusherRecipeRegistry.addRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint), new ItemStack(Items.flint), 50);
CrusherRecipeRegistry.addRecipe("stone", "cobblestone", 1);
CrusherRecipeRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 1, 2));
CrusherRecipeRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
miscRecipes.add(Util.GetRecipes.lastCrusherRecipe());
CrusherRecipeRegistry.addRecipe(new ItemStack(Blocks.tallgrass, 1, Util.WILDCARD), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.GREEN_DYE.ordinal()));

View file

@ -171,6 +171,12 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
List<ItemStack> outputTwos = CrusherRecipeRegistry.getOutputTwos(this.slots[theInput]);
ItemStack outputTwo = outputTwos == null ? null : outputTwos.get(0);
if(outputOne != null){
if(outputOne.getItemDamage() == Util.WILDCARD){
outputOne.setItemDamage(0);
}
if(outputTwo != null && outputTwo.getItemDamage() == Util.WILDCARD){
outputTwo.setItemDamage(0);
}
if((this.slots[theFirstOutput] == null || (this.slots[theFirstOutput].isItemEqual(outputOne) && this.slots[theFirstOutput].stackSize <= this.slots[theFirstOutput].getMaxStackSize()-outputOne.stackSize)) && (outputTwo == null || (this.slots[theSecondOutput] == null || (this.slots[theSecondOutput].isItemEqual(outputTwo) && this.slots[theSecondOutput].stackSize <= this.slots[theSecondOutput].getMaxStackSize()-outputTwo.stackSize)))){
return true;
}
@ -193,6 +199,9 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
if(outputOnes != null){
ItemStack outputOne = outputOnes.get(0);
if(outputOne != null){
if(outputOne.getItemDamage() == Util.WILDCARD){
outputOne.setItemDamage(0);
}
if(this.slots[theFirstOutput] == null){
this.slots[theFirstOutput] = outputOne.copy();
}
@ -206,6 +215,9 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
if(outputTwos != null){
ItemStack outputTwo = outputTwos.get(0);
if(outputTwo != null){
if(outputTwo.getItemDamage() == Util.WILDCARD){
outputTwo.setItemDamage(0);
}
int rand = Util.RANDOM.nextInt(100)+1;
if(rand <= CrusherRecipeRegistry.getOutputTwoChance(this.slots[theInput])){
if(this.slots[theSecondOutput] == null){