More fixes 637

This commit is contained in:
modmuss50 2019-02-21 23:07:44 +00:00
parent f51222ac3e
commit 18b3535607
21 changed files with 96 additions and 240 deletions

View file

@ -172,8 +172,8 @@ public class TileCable extends TileEntity
sendingFace.add(face);
}
}
} else if (tile.hasCapability(CapabilityEnergy.ENERGY, face.getOpposite())) {
IEnergyStorage energyTile = tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite());
} else if (tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite()).isPresent()) {
IEnergyStorage energyTile = tile.getCapability(CapabilityEnergy.ENERGY, face.getOpposite()).orElse(null);
if (energyTile != null && energyTile.canReceive()) {
acceptors.add(energyTile);
}

View file

@ -126,10 +126,10 @@ public class TileFusionControlComputer extends TilePowerAcceptor
*
* @param stack ItemStack ItemStack to insert
* @param slot int Slot ID to check
* @param oreDic boolean Should we use ore dictionary
* @param tags boolean Should we use tags
* @return boolean Returns true if ItemStack will fit into slot
*/
public boolean canFitStack(ItemStack stack, int slot, boolean oreDic) {// Checks to see if it can
public boolean canFitStack(ItemStack stack, int slot, boolean tags) {// Checks to see if it can
// fit the stack
if (stack.isEmpty()) {
return true;
@ -137,7 +137,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
if (inventory.getStackInSlot(slot).isEmpty()) {
return true;
}
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, oreDic)) {
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, tags)) {
if (stack.getCount() + inventory.getStackInSlot(slot).getCount() <= stack.getMaxStackSize()) {
return true;
}
@ -185,9 +185,9 @@ public class TileFusionControlComputer extends TilePowerAcceptor
}
private boolean validateReactorRecipeInputs(FusionReactorRecipe recipe, ItemStack slot1, ItemStack slot2) {
if (ItemUtils.isItemEqual(slot1, recipe.getTopInput(), true, true, true)) {
if (ItemUtils.isItemEqual(slot1, recipe.getTopInput(), true, true)) {
if (recipe.getBottomInput() != null) {
if (!ItemUtils.isItemEqual(slot2, recipe.getBottomInput(), true, true, true)) {
if (!ItemUtils.isItemEqual(slot2, recipe.getBottomInput(), true, true)) {
return false;
}
}

View file

@ -74,8 +74,8 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
public void checkForWater() {
waterblocks = 0;
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
if (world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) {
for (EnumFacing facing : EnumFacing.values()) {
if (facing.getAxis().isHorizontal() && world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) {
waterblocks++;
}
}

View file

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.*;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumFacing;
import reborncore.api.IToolDrop;
import reborncore.api.recipe.IBaseRecipeType;
@ -48,6 +49,7 @@ import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
import techreborn.init.TRTileEntities;
import techreborn.tiles.machine.tier1.TileElectricFurnace;
@RebornRegister(TechReborn.MOD_ID)
public class TileIronAlloyFurnace extends TileMachineBase
@ -77,54 +79,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
if (stack.isEmpty()) {
return 0;
} else {
int burnTime = net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack);
if (burnTime >= 0)
return burnTime;
Item item = stack.getItem();
if (item == Item.getItemFromBlock(Blocks.WOODEN_SLAB)) {
return 150;
} else if (item == Item.getItemFromBlock(Blocks.WOOL)) {
return 100;
} else if (item == Item.getItemFromBlock(Blocks.CARPET)) {
return 67;
} else if (item == Item.getItemFromBlock(Blocks.LADDER)) {
return 300;
} else if (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON)) {
return 100;
} else if (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD) {
return 300;
} else if (item == Item.getItemFromBlock(Blocks.COAL_BLOCK)) {
return 16000;
} else if (item instanceof ItemTool && "WOOD".equals(((ItemTool) item).getToolMaterialName())) {
return 200;
} else if (item instanceof ItemSword && "WOOD".equals(((ItemSword) item).getToolMaterialName())) {
return 200;
} else if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe) item).getMaterialName())) {
return 200;
} else if (item == Items.STICK) {
return 100;
} else if (item != Items.BOW && item != Items.FISHING_ROD) {
if (item == Items.SIGN) {
return 200;
} else if (item == Items.COAL) {
return 1600;
} else if (item == Items.LAVA_BUCKET) {
return 20000;
} else if (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL) {
if (item == Items.BLAZE_ROD) {
return 2400;
} else if (item instanceof ItemDoor && item != Items.IRON_DOOR) {
return 200;
} else {
return item instanceof ItemBoat ? 400 : 0;
}
} else {
return 100;
}
} else {
return 300;
}
return TileEntityFurnace.getBurnTimes().getOrDefault(stack.getItem(), 0);
}
}
@ -174,11 +129,11 @@ public class TileIronAlloyFurnace extends TileMachineBase
}
for (final Object input : recipeType.getInputs()) {
boolean hasItem = false;
boolean useOreDict = input instanceof String || recipeType.useOreDic();
boolean useTags = input instanceof String || recipeType.useOreDic();
boolean checkSize = input instanceof ItemStack;
for (int inputslot = 0; inputslot < 2; inputslot++) {
if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputslot), true, true,
useOreDict)) {
if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputslot), true,
useTags)) {
ItemStack stack = RecipeTranslator.getStackFromObject(input);
if (!checkSize || inventory.getStackInSlot(inputslot).getCount() >= stack.getCount()) {
hasItem = true;
@ -255,7 +210,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
for (Object input : recipeType.getInputs()) {
boolean useOreDict = input instanceof String || recipeType.useOreDic();
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
if (ItemUtils.isInputEqual(input, this.inventory.getStackInSlot(inputSlot), true, true, useOreDict)) {
if (ItemUtils.isInputEqual(input, this.inventory.getStackInSlot(inputSlot), true, useOreDict)) {
int count = 1;
if (input instanceof ItemStack) {
count = RecipeTranslator.getStackFromObject(input).getCount();
@ -342,11 +297,11 @@ public class TileIronAlloyFurnace extends TileMachineBase
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isInputEqual(recipe.getInputs().get(0), stack, true, true, true)))
&& ItemUtils.isInputEqual(recipe.getInputs().get(0), stack, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isInputEqual(recipe.getInputs().get(1), stack, true, true, true)))
&& ItemUtils.isInputEqual(recipe.getInputs().get(1), stack, true, true)))
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getCookTime, this::setCookTime)
.syncIntegerValue(this::getCurrentItemBurnTime, this::setCurrentItemBurnTime).addInventory().create(this);

View file

@ -86,7 +86,7 @@ public class TileIronFurnace extends TileMachineBase
this.updateState();
}
if (this.fuel <= 0 && this.canSmelt()) {
this.fuel = this.fuelGague = (int) (TileEntityFurnace.getItemBurnTime(inventory.getStackInSlot(this.fuelslot)) * 1.25);
this.fuel = this.fuelGague = (int) (TileEntityFurnace.getBurnTimes().getOrDefault(inventory.getStackInSlot(this.fuelslot).getItem(), 0) * 1.25);
if (this.fuel > 0) {
// Fuel slot
ItemStack fuelStack = inventory.getStackInSlot(this.fuelslot);
@ -165,7 +165,7 @@ public class TileIronFurnace extends TileMachineBase
final IBlockState BlockStateContainer = this.world.getBlockState(this.pos);
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != this.fuel > 0)
if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != this.fuel > 0)
blockMachineBase.setActive(this.fuel > 0, this.world, this.pos);
}
}

View file

@ -82,7 +82,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
// TileGenericMachine
@Override
public void update() {
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
multiblockChecker = new MultiblockChecker(world, downCenter);
@ -98,7 +98,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
}
if (getMultiBlock()) {
super.update();
super.tick();
}
tank.compareAndUpdate();

View file

@ -66,14 +66,14 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
// TileGenericMachine
@Override
public void update() {
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
multiblockChecker = new MultiblockChecker(world, downCenter);
}
if (!world.isRemote && getMutliBlock()){
super.update();
super.tick();
}
}

View file

@ -128,14 +128,14 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
// TileGenericMachine
@Override
public void update() {
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
multiblockChecker = new MultiblockChecker(world, downCenter);
}
if (!world.isRemote && getMutliBlock()){
super.update();
super.tick();
}
}

View file

@ -24,7 +24,6 @@
package techreborn.tiles.machine.multiblock;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
@ -94,7 +93,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
private static IInventoryAccess<TileIndustrialGrinder> getInventoryAccess(){
return (slotID, stack, face, direction, tile) -> {
if(slotID == 1){
return stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
}
return true;
};
@ -102,7 +101,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
// TilePowerAcceptor
@Override
public void update() {
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2).down();
multiblockChecker = new MultiblockChecker(world, downCenter);
@ -119,7 +118,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
}
if (!world.isRemote && getMultiBlock()) {
super.update();
super.tick();
}
tank.compareAndUpdate();

View file

@ -24,7 +24,6 @@
package techreborn.tiles.machine.multiblock;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
@ -92,7 +91,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
// TileGenericMachine
@Override
public void update() {
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2).down();
multiblockChecker = new MultiblockChecker(world, downCenter);
@ -109,7 +108,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
}
if (!world.isRemote && getMutliBlock()) {
super.update();
super.tick();
}
tank.compareAndUpdate();
@ -139,7 +138,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
private static IInventoryAccess<TileIndustrialSawmill> getInventoryAccess(){
return (slotID, stack, face, direction, tile) -> {
if(direction == IInventoryAccess.AccessDirection.INSERT){
return stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
}
return true;
};

View file

@ -62,9 +62,9 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
// TileGenericMachine
@Override
public void update() {
public void tick() {
if (!world.isRemote && getMultiBlock()) {
super.update();
super.tick();
}
}

View file

@ -93,7 +93,7 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
}
if (lastRedstone != redstone) {
WorldUtils.updateBlock(world, pos);
world.notifyNeighborsOfStateChange(pos, world.getBlockState(pos).getBlock(), true);
world.notifyNeighborsOfStateChange(pos, world.getBlockState(pos).getBlock());
}
}
}