parent
daf7a90a28
commit
74f798e9c3
2 changed files with 25 additions and 29 deletions
|
@ -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;
|
package techreborn.init;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
|
|
@ -55,10 +55,13 @@ public class TileRollingMachine extends TilePowerAcceptor
|
||||||
public int runTime = 250;
|
public int runTime = 250;
|
||||||
public ItemStack currentRecipe;
|
public ItemStack currentRecipe;
|
||||||
|
|
||||||
|
private int outputSlot;
|
||||||
|
|
||||||
public int euTick = 5;
|
public int euTick = 5;
|
||||||
|
|
||||||
public TileRollingMachine() {
|
public TileRollingMachine() {
|
||||||
super(1);
|
super(1);
|
||||||
|
outputSlot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,16 +105,16 @@ public class TileRollingMachine extends TilePowerAcceptor
|
||||||
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
|
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
|
||||||
if (this.currentRecipe != null) {
|
if (this.currentRecipe != null) {
|
||||||
boolean hasCrafted = false;
|
boolean hasCrafted = false;
|
||||||
if (this.inventory.getStackInSlot(0) == ItemStack.EMPTY) {
|
if (this.inventory.getStackInSlot(outputSlot) == ItemStack.EMPTY) {
|
||||||
this.inventory.setInventorySlotContents(0, this.currentRecipe);
|
this.inventory.setInventorySlotContents(outputSlot, this.currentRecipe);
|
||||||
this.tickTime = -1;
|
this.tickTime = -1;
|
||||||
hasCrafted = true;
|
hasCrafted = true;
|
||||||
} else {
|
} else {
|
||||||
if (this.inventory.getStackInSlot(0).getCount() + this.currentRecipe.getCount() <= this.currentRecipe
|
if (this.inventory.getStackInSlot(outputSlot).getCount() + this.currentRecipe.getCount() <= this.currentRecipe
|
||||||
.getMaxStackSize()) {
|
.getMaxStackSize()) {
|
||||||
final ItemStack stack = this.inventory.getStackInSlot(0);
|
final ItemStack stack = this.inventory.getStackInSlot(outputSlot);
|
||||||
stack.setCount(stack.getCount() + this.currentRecipe.getCount());
|
stack.setCount(stack.getCount() + this.currentRecipe.getCount());
|
||||||
this.inventory.setInventorySlotContents(0, stack);
|
this.inventory.setInventorySlotContents(outputSlot, stack);
|
||||||
this.tickTime = -1;
|
this.tickTime = -1;
|
||||||
hasCrafted = true;
|
hasCrafted = true;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +197,23 @@ public class TileRollingMachine extends TilePowerAcceptor
|
||||||
tagCompound.setInteger("tickTime", this.tickTime);
|
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
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
|
Loading…
Reference in a new issue