Crafting manager fixes
This commit is contained in:
parent
a003656419
commit
6f9baaeb30
8 changed files with 108 additions and 82 deletions
|
@ -67,7 +67,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
|||
|
||||
public static final String[] types = new String[] { "all", "others", "you" };
|
||||
static List<String> typeNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(types));
|
||||
public PropertyString TYPE;
|
||||
public static PropertyString TYPE;
|
||||
|
||||
public BlockPlayerDetector() {
|
||||
super();
|
||||
|
|
|
@ -25,9 +25,12 @@
|
|||
package techreborn.events;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.crafting.RecipeType;
|
||||
import net.minecraftforge.common.crafting.VanillaRecipeTypes;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -38,6 +41,9 @@ import techreborn.init.TRContent;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TRRecipeHandler {
|
||||
|
||||
|
@ -53,9 +59,10 @@ public class TRRecipeHandler {
|
|||
if(entityItemPickupEvent.getEntityPlayer() instanceof FakePlayer){
|
||||
return;
|
||||
}
|
||||
World world = entityItemPickupEvent.getItem().world;
|
||||
if (entityItemPickupEvent.getEntityPlayer() instanceof EntityPlayerMP) {
|
||||
if (ItemUtils.isInputEqual("logWood", entityItemPickupEvent.getItem().getItem(), false, false, true)) {
|
||||
for (IRecipe recipe : CraftingManager.REGISTRY) {
|
||||
if (ItemUtils.isInputEqual("logWood", entityItemPickupEvent.getItem().getItem(), false, true)) {
|
||||
for (IRecipe recipe : world.getRecipeManager().getRecipes()) {
|
||||
if (recipe.getRecipeOutput().getItem() == TRContent.TREE_TAP) {
|
||||
entityItemPickupEvent.getEntityPlayer().unlockRecipes(Collections.singletonList(recipe));
|
||||
}
|
||||
|
@ -66,7 +73,7 @@ public class TRRecipeHandler {
|
|||
|
||||
public static void unlockTRRecipes(EntityPlayerMP playerMP) {
|
||||
List<IRecipe> recipeList = new ArrayList<>();
|
||||
for (IRecipe recipe : CraftingManager.REGISTRY) {
|
||||
for (IRecipe recipe : getRecipes(playerMP.world, VanillaRecipeTypes.CRAFTING)) {
|
||||
if (isRecipeValid(recipe)) {
|
||||
recipeList.add(recipe);
|
||||
}
|
||||
|
@ -74,11 +81,28 @@ public class TRRecipeHandler {
|
|||
playerMP.unlockRecipes(recipeList);
|
||||
}
|
||||
|
||||
public static <T extends IRecipe> List<IRecipe> getRecipes(World world, RecipeType<T> type){
|
||||
return world.getRecipeManager().getRecipes().stream().filter(iRecipe -> iRecipe.getType() == type).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Used to get the matching output of a recipe type that only has 1 input
|
||||
*
|
||||
*/
|
||||
public static <T extends IRecipe> ItemStack getMatchingRecipes(World world, RecipeType<T> type, ItemStack input){
|
||||
return getRecipes(world, type).stream()
|
||||
.filter(iRecipe -> iRecipe.getIngredients().size() == 1 && iRecipe.getIngredients().get(0).test(input))
|
||||
.map(IRecipe::getRecipeOutput)
|
||||
.findFirst()
|
||||
.orElse(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
private static boolean isRecipeValid(IRecipe recipe) {
|
||||
if (recipe.getRegistryName() == null) {
|
||||
if (recipe.getId() == null) {
|
||||
return false;
|
||||
}
|
||||
if (!recipe.getRegistryName().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
return false;
|
||||
}
|
||||
if (!recipe.getRecipeOutput().getItem().getRegistryName().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
|
@ -89,7 +113,7 @@ public class TRRecipeHandler {
|
|||
// }
|
||||
//Hide uu recipes
|
||||
for (Ingredient ingredient : recipe.getIngredients()) {
|
||||
if (ingredient.apply(TRContent.Parts.UU_MATTER.getStack())) {
|
||||
if (ingredient.test(TRContent.Parts.UU_MATTER.getStack())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ModRecipes {
|
|||
|
||||
public static void init() {
|
||||
//Gonna rescan to make sure we have an uptodate list
|
||||
OreUtil.scanForOres();
|
||||
//OreUtil.scanForOres();
|
||||
|
||||
CraftingTableRecipes.init();
|
||||
SmeltingRecipes.init();
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.OreUtil;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.init.TRContent.Dusts;
|
||||
|
@ -51,67 +50,67 @@ public class OreDict {
|
|||
TechRebornAPI.ic2Helper.initDuplicates();
|
||||
}
|
||||
// Blocks
|
||||
OreUtil.registerOre("fenceIron", TRContent.REFINED_IRON_FENCE);
|
||||
OreUtil.registerOre("woodRubber", TRContent.RUBBER_LOG);
|
||||
OreUtil.registerOre("logWood", TRContent.RUBBER_LOG);
|
||||
OreUtil.registerOre("logRubber", TRContent.RUBBER_LOG);
|
||||
OreUtil.registerOre("plankWood", TRContent.RUBBER_PLANKS);
|
||||
OreUtil.registerOre("plankRubber", TRContent.RUBBER_PLANKS);
|
||||
OreUtil.registerOre("glassReinforced", TRContent.REINFORCED_GLASS);
|
||||
OreUtil.registerOre("treeSapling", TRContent.RUBBER_SAPLING);
|
||||
OreUtil.registerOre("saplingRubber", TRContent.RUBBER_SAPLING);
|
||||
OreUtil.registerOre("slabWood", TRContent.RUBBER_LOG_SLAB_HALF);
|
||||
OreUtil.registerOre("stairWood", TRContent.RUBBER_LOG_STAIR);
|
||||
OreUtil.registerOre("treeLeaves", TRContent.RUBBER_LEAVES);
|
||||
OreUtil.registerOre("leavesRubber", TRContent.RUBBER_LEAVES);
|
||||
|
||||
// Parts
|
||||
OreUtil.registerOre("circuitBasic", TRContent.Parts.ELECTRONIC_CIRCUIT.getStack());
|
||||
OreUtil.registerOre("circuitAdvanced", TRContent.Parts.ADVANCED_CIRCUIT.getStack());
|
||||
OreUtil.registerOre("circuitElite", TRContent.Parts.INDUSTRIAL_CIRCUIT.getStack());
|
||||
OreUtil.registerOre("circuitStorage", TRContent.Parts.DATA_STORAGE_CHIP.getStack());
|
||||
OreUtil.registerOre("circuitMaster", TRContent.Parts.ENERGY_FLOW_CHIP.getStack());
|
||||
OreUtil.registerOre("craftingDiamondGrinder", TRContent.Parts.DIAMOND_GRINDING_HEAD.getStack());
|
||||
OreUtil.registerOre("craftingTungstenGrinder", TRContent.Parts.TUNGSTEN_GRINDING_HEAD.getStack());
|
||||
OreUtil.registerOre("craftingSuperconductor", TRContent.Parts.SUPERCONDUCTOR.getStack());
|
||||
OreUtil.registerOre("materialResin", TRContent.Parts.SAP.getStack());
|
||||
OreUtil.registerOre("materialRubber", TRContent.Parts.RUBBER.getStack());
|
||||
OreUtil.registerOre("itemRubber", TRContent.Parts.RUBBER.getStack());
|
||||
|
||||
// Frames
|
||||
OreUtil.registerOre("machineBasic", new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
OreUtil.registerOre("machineBlockBasic", new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
OreUtil.registerOre("machineBlockAdvanced", new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
OreUtil.registerOre("machineBlockElite", new ItemStack(TRContent.MachineBlocks.INDUSTRIAL.getFrame()));
|
||||
|
||||
// Tools&Armor
|
||||
OreUtil.registerOre("reBattery", TRContent.RED_CELL_BATTERY);
|
||||
OreUtil.registerOre("lapotronCrystal", TRContent.LAPOTRON_CRYSTAL);
|
||||
OreUtil.registerOre("energyCrystal", TRContent.ENERGY_CRYSTAL);
|
||||
OreUtil.registerOre("drillBasic", TRContent.BASIC_DRILL);
|
||||
OreUtil.registerOre("drillDiamond", TRContent.ADVANCED_DRILL);
|
||||
|
||||
// Misc
|
||||
OreUtil.registerOre("industrialTnt", Blocks.TNT);
|
||||
OreUtil.registerOre("craftingPiston", Blocks.PISTON);
|
||||
OreUtil.registerOre("craftingPiston", Blocks.STICKY_PISTON);
|
||||
OreUtil.registerOre("crafterWood", Blocks.CRAFTING_TABLE);
|
||||
OreUtil.registerOre("craftingIndustrialDiamond", Items.DIAMOND);
|
||||
OreUtil.registerOre("fertilizer", new ItemStack(Items.DYE, 1, 15));
|
||||
OreUtil.registerOre("insulatedGoldCableItem", TRContent.Cables.INSULATED_GOLD.asItem());
|
||||
OreUtil.registerOre("pulpWood", TRContent.Dusts.SAW.getStack());
|
||||
// OreUtil.registerOre("fenceIron", TRContent.REFINED_IRON_FENCE);
|
||||
// OreUtil.registerOre("woodRubber", TRContent.RUBBER_LOG);
|
||||
// OreUtil.registerOre("logWood", TRContent.RUBBER_LOG);
|
||||
// OreUtil.registerOre("logRubber", TRContent.RUBBER_LOG);
|
||||
// OreUtil.registerOre("plankWood", TRContent.RUBBER_PLANKS);
|
||||
// OreUtil.registerOre("plankRubber", TRContent.RUBBER_PLANKS);
|
||||
// OreUtil.registerOre("glassReinforced", TRContent.REINFORCED_GLASS);
|
||||
// OreUtil.registerOre("treeSapling", TRContent.RUBBER_SAPLING);
|
||||
// OreUtil.registerOre("saplingRubber", TRContent.RUBBER_SAPLING);
|
||||
// OreUtil.registerOre("slabWood", TRContent.RUBBER_LOG_SLAB_HALF);
|
||||
// OreUtil.registerOre("stairWood", TRContent.RUBBER_LOG_STAIR);
|
||||
// OreUtil.registerOre("treeLeaves", TRContent.RUBBER_LEAVES);
|
||||
// OreUtil.registerOre("leavesRubber", TRContent.RUBBER_LEAVES);
|
||||
//
|
||||
// // Parts
|
||||
// OreUtil.registerOre("circuitBasic", TRContent.Parts.ELECTRONIC_CIRCUIT.getStack());
|
||||
// OreUtil.registerOre("circuitAdvanced", TRContent.Parts.ADVANCED_CIRCUIT.getStack());
|
||||
// OreUtil.registerOre("circuitElite", TRContent.Parts.INDUSTRIAL_CIRCUIT.getStack());
|
||||
// OreUtil.registerOre("circuitStorage", TRContent.Parts.DATA_STORAGE_CHIP.getStack());
|
||||
// OreUtil.registerOre("circuitMaster", TRContent.Parts.ENERGY_FLOW_CHIP.getStack());
|
||||
// OreUtil.registerOre("craftingDiamondGrinder", TRContent.Parts.DIAMOND_GRINDING_HEAD.getStack());
|
||||
// OreUtil.registerOre("craftingTungstenGrinder", TRContent.Parts.TUNGSTEN_GRINDING_HEAD.getStack());
|
||||
// OreUtil.registerOre("craftingSuperconductor", TRContent.Parts.SUPERCONDUCTOR.getStack());
|
||||
// OreUtil.registerOre("materialResin", TRContent.Parts.SAP.getStack());
|
||||
// OreUtil.registerOre("materialRubber", TRContent.Parts.RUBBER.getStack());
|
||||
// OreUtil.registerOre("itemRubber", TRContent.Parts.RUBBER.getStack());
|
||||
//
|
||||
// // Frames
|
||||
// OreUtil.registerOre("machineBasic", new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
// OreUtil.registerOre("machineBlockBasic", new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
// OreUtil.registerOre("machineBlockAdvanced", new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
// OreUtil.registerOre("machineBlockElite", new ItemStack(TRContent.MachineBlocks.INDUSTRIAL.getFrame()));
|
||||
//
|
||||
// // Tools&Armor
|
||||
// OreUtil.registerOre("reBattery", TRContent.RED_CELL_BATTERY);
|
||||
// OreUtil.registerOre("lapotronCrystal", TRContent.LAPOTRON_CRYSTAL);
|
||||
// OreUtil.registerOre("energyCrystal", TRContent.ENERGY_CRYSTAL);
|
||||
// OreUtil.registerOre("drillBasic", TRContent.BASIC_DRILL);
|
||||
// OreUtil.registerOre("drillDiamond", TRContent.ADVANCED_DRILL);
|
||||
//
|
||||
// // Misc
|
||||
// OreUtil.registerOre("industrialTnt", Blocks.TNT);
|
||||
// OreUtil.registerOre("craftingPiston", Blocks.PISTON);
|
||||
// OreUtil.registerOre("craftingPiston", Blocks.STICKY_PISTON);
|
||||
// OreUtil.registerOre("crafterWood", Blocks.CRAFTING_TABLE);
|
||||
// OreUtil.registerOre("craftingIndustrialDiamond", Items.DIAMOND);
|
||||
// OreUtil.registerOre("fertilizer", new ItemStack(Items.DYE, 1, 15));
|
||||
// OreUtil.registerOre("insulatedGoldCableItem", TRContent.Cables.INSULATED_GOLD.asItem());
|
||||
// OreUtil.registerOre("pulpWood", TRContent.Dusts.SAW.getStack());
|
||||
|
||||
//OreUtil.registerOre("uran235", nothing);
|
||||
//OreUtil.registerOre("uran238", nothing);
|
||||
//OreUtil.registerOre("smallUran235", nothing);
|
||||
|
||||
for (Ores ore : TRContent.Ores.values()) {
|
||||
OreUtil.registerOre("ore" + StringUtils.toFirstCapital(ore.name), new ItemStack(ore.block));
|
||||
}
|
||||
|
||||
for (Dusts dust : TRContent.Dusts.values()) {
|
||||
OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_" + dust.name), dust.getStack());
|
||||
}
|
||||
//
|
||||
// for (Ores ore : TRContent.Ores.values()) {
|
||||
// OreUtil.registerOre("ore" + StringUtils.toFirstCapital(ore.name), new ItemStack(ore.block));
|
||||
// }
|
||||
//
|
||||
// for (Dusts dust : TRContent.Dusts.values()) {
|
||||
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_" + dust.name), dust.getStack());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
Reference in a new issue