Crafting manager fixes
This commit is contained in:
parent
a003656419
commit
6f9baaeb30
8 changed files with 108 additions and 82 deletions
|
@ -27,9 +27,8 @@ package techreborn.tiles.machine.iron;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
|
@ -39,6 +38,7 @@ import reborncore.common.util.ItemUtils;
|
|||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.TRTileEntities;
|
||||
|
||||
public class TileIronFurnace extends TileMachineBase
|
||||
|
@ -120,7 +120,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
|
||||
public void cookItems() {
|
||||
if (this.canSmelt()) {
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory.getStackInSlot(this.input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(this.input1));
|
||||
|
||||
if (inventory.getStackInSlot(this.output).isEmpty()) {
|
||||
inventory.setStackInSlot(this.output, itemstack.copy());
|
||||
|
@ -138,7 +138,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
public boolean canSmelt() {
|
||||
if (inventory.getStackInSlot(this.input1).isEmpty())
|
||||
return false;
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory.getStackInSlot(this.input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(this.input1));
|
||||
if (itemstack.isEmpty())
|
||||
return false;
|
||||
if (inventory.getStackInSlot(this.output).isEmpty())
|
||||
|
@ -154,7 +154,7 @@ public class TileIronFurnace extends TileMachineBase
|
|||
}
|
||||
|
||||
public ItemStack getResultFor(final ItemStack stack) {
|
||||
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
||||
final ItemStack result = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, stack);
|
||||
if (!result.isEmpty()) {
|
||||
return result.copy();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.item.crafting.Ingredient;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.api.IToolDrop;
|
||||
|
@ -47,6 +48,7 @@ import techreborn.TechReborn;
|
|||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
|
@ -91,7 +93,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
return lastRecipe;
|
||||
}
|
||||
}
|
||||
for (IRecipe testRecipe : CraftingManager.REGISTRY) {
|
||||
for (IRecipe testRecipe : TRRecipeHandler.getRecipes(world, VanillaRecipeTypes.CRAFTING)) {
|
||||
if (testRecipe.matches(crafting, world)) {
|
||||
lastRecipe = testRecipe;
|
||||
return testRecipe;
|
||||
|
|
|
@ -27,8 +27,8 @@ package techreborn.tiles.machine.tier1;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.ItemHandlerProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -40,6 +40,7 @@ import techreborn.TechReborn;
|
|||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
|
||||
|
@ -70,7 +71,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
|
||||
public void cookItems() {
|
||||
if (canSmelt()) {
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory.getStackInSlot(input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(input1));
|
||||
|
||||
if (inventory.getStackInSlot(output).isEmpty()) {
|
||||
inventory.setStackInSlot(output, itemstack.copy());
|
||||
|
@ -89,7 +90,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
if (inventory.getStackInSlot(input1).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory.getStackInSlot(input1));
|
||||
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, inventory.getStackInSlot(input1));
|
||||
if (itemstack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -108,7 +109,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public ItemStack getResultFor(ItemStack stack) {
|
||||
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
||||
final ItemStack result = TRRecipeHandler.getMatchingRecipes(world, VanillaRecipeTypes.SMELTING, stack);
|
||||
if (!result.isEmpty()) {
|
||||
return result.copy();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import reborncore.common.registration.RebornRegister;
|
|||
import reborncore.common.registration.config.ConfigRegistry;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blocks.tier1.BlockPlayerDetector;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRTileEntities;
|
||||
|
||||
|
@ -71,14 +72,13 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
if (canUseEnergy(euPerTick)) {
|
||||
Iterator<EntityPlayer> tIterator = super.world.playerEntities.iterator();
|
||||
while (tIterator.hasNext()) {
|
||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||
EntityPlayer player = tIterator.next();
|
||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) world.getBlockState(pos).getBlock();
|
||||
int meta = blockMachineBase.getMetaFromState(world.getBlockState(pos));
|
||||
if (meta == 0) {// ALL
|
||||
String type = world.getBlockState(pos).get(BlockPlayerDetector.TYPE);
|
||||
if (type.equals("all")) {// ALL
|
||||
redstone = true;
|
||||
} else if (meta == 1) {// Others
|
||||
} else if (type.equals("others")) {// Others
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue