Rolling machine fixes (#1075)

* Fix for issue #942
This commit is contained in:
drcrazy 2017-05-02 20:38:16 +03:00 committed by Modmuss50
parent daf7a90a28
commit 74f798e9c3
2 changed files with 25 additions and 29 deletions

View file

@ -1,27 +1,3 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.init;
import net.minecraft.init.Blocks;

View file

@ -54,11 +54,14 @@ public class TileRollingMachine extends TilePowerAcceptor
public int tickTime;
public int runTime = 250;
public ItemStack currentRecipe;
private int outputSlot;
public int euTick = 5;
public TileRollingMachine() {
super(1);
outputSlot = 0;
}
@Override
@ -102,16 +105,16 @@ public class TileRollingMachine extends TilePowerAcceptor
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
if (this.currentRecipe != null) {
boolean hasCrafted = false;
if (this.inventory.getStackInSlot(0) == ItemStack.EMPTY) {
this.inventory.setInventorySlotContents(0, this.currentRecipe);
if (this.inventory.getStackInSlot(outputSlot) == ItemStack.EMPTY) {
this.inventory.setInventorySlotContents(outputSlot, this.currentRecipe);
this.tickTime = -1;
hasCrafted = true;
} else {
if (this.inventory.getStackInSlot(0).getCount() + this.currentRecipe.getCount() <= this.currentRecipe
if (this.inventory.getStackInSlot(outputSlot).getCount() + this.currentRecipe.getCount() <= this.currentRecipe
.getMaxStackSize()) {
final ItemStack stack = this.inventory.getStackInSlot(0);
final ItemStack stack = this.inventory.getStackInSlot(outputSlot);
stack.setCount(stack.getCount() + this.currentRecipe.getCount());
this.inventory.setInventorySlotContents(0, stack);
this.inventory.setInventorySlotContents(outputSlot, stack);
this.tickTime = -1;
hasCrafted = true;
}
@ -194,6 +197,23 @@ public class TileRollingMachine extends TilePowerAcceptor
tagCompound.setInteger("tickTime", this.tickTime);
}
@Override
public int[] getSlotsForFace(final EnumFacing side) {
if (side.equals(EnumFacing.DOWN))
return new int[] { 0 };
return new int[0];
}
@Override
public boolean canInsertItem(final int Index, final ItemStack itemStack, final EnumFacing side) {
return false;
}
@Override
public boolean canExtractItem(final int Index, final ItemStack itemStack, final EnumFacing side) {
return Index == outputSlot;
}
@Override
public void invalidate() {
super.invalidate();