Updated freezer multiblock. More work on #1672

This commit is contained in:
drcrazy 2019-04-01 15:27:58 +03:00
parent 8ad5419ce1
commit 74d1837167
2 changed files with 46 additions and 5 deletions

View file

@ -98,7 +98,8 @@ public class GuiVacuumFreezer extends GuiBase {
{
// This code here makes a basic multiblock and then sets to the selected one.
final Multiblock multiblock = new Multiblock();
IBlockState reinforcedCasing = ModBlocks.MACHINE_CASINGS.getDefaultState().withProperty(BlockMachineCasing.TYPE, "reinforced");
IBlockState reinforcedCasing = ModBlocks.MACHINE_CASINGS.getDefaultState().withProperty(BlockMachineCasing.TYPE, "reinforced");
IBlockState advancedCasing = ModBlocks.MACHINE_CASINGS.getDefaultState().withProperty(BlockMachineCasing.TYPE, "advanced");
addComponent(0, -1, 0, reinforcedCasing, multiblock);
addComponent(1, -1, 0, reinforcedCasing, multiblock);
@ -110,6 +111,27 @@ public class GuiVacuumFreezer extends GuiBase {
addComponent(1, -1, -1, reinforcedCasing, multiblock);
addComponent(1, -1, 1, reinforcedCasing, multiblock);
if (TileVacuumFreezer.bigMultiblock) {
addComponent(1, -2, 0, advancedCasing, multiblock);
addComponent(0, -2, 1, advancedCasing, multiblock);
addComponent(-1, -2, 0, advancedCasing, multiblock);
addComponent(0, -2, -1, advancedCasing, multiblock);
addComponent(-1, -2, -1, advancedCasing, multiblock);
addComponent(-1, -2, 1, advancedCasing, multiblock);
addComponent(1, -2, -1, advancedCasing, multiblock);
addComponent(1, -2, 1, advancedCasing, multiblock);
addComponent(0, -3, 0, reinforcedCasing, multiblock);
addComponent(1, -3, 0, reinforcedCasing, multiblock);
addComponent(0, -3, 1, reinforcedCasing, multiblock);
addComponent(-1, -3, 0, reinforcedCasing, multiblock);
addComponent(0, -3, -1, reinforcedCasing, multiblock);
addComponent(-1, -3, -1, reinforcedCasing, multiblock);
addComponent(-1, -3, 1, reinforcedCasing, multiblock);
addComponent(1, -3, -1, reinforcedCasing, multiblock);
addComponent(1, -3, 1, reinforcedCasing, multiblock);
}
final MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.parent = tile.getPos();

View file

@ -25,6 +25,7 @@
package techreborn.tiles.multiblock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
@ -44,6 +45,9 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
public static int maxInput = 64;
@ConfigRegistry(config = "machines", category = "vacuumfreezer", key = "VacuumFreezerMaxEnergy", comment = "Vacuum Freezer Max Energy (Value in EU)")
public static int maxEnergy = 64_000;
@ConfigRegistry(config = "machines", category = "vacuumfreezer", key = "VacuumFreezerBigMultiblock", comment = "Vacuum Freezer requires big multiblock")
public static boolean bigMultiblock = false;
public MultiblockChecker multiblockChecker;
@ -59,20 +63,35 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
if(multiblockChecker == null){
return false;
}
return multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
final boolean up = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, -2, 0));
final boolean chamber = multiblockChecker.checkRingYHollow(1, 1, MultiblockChecker.ADVANCED_CASING, new BlockPos(0, -1, 0));
if (bigMultiblock) {
return down && chamber && up;
}
else {
return up;
}
}
// TileGenericMachine
@Override
public void update() {
if(multiblockChecker == null){
multiblockChecker = new MultiblockChecker(world, pos.down());
}
if (!world.isRemote && getMultiBlock()) {
super.update();
}
}
// TileEntity
@Override
public void validate() {
super.validate();
multiblockChecker = new MultiblockChecker(world, pos.down());
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {