multiblock render changes
This commit is contained in:
parent
bfdde04892
commit
57c8ebdb3d
10 changed files with 62 additions and 139 deletions
|
@ -28,8 +28,8 @@ import com.mojang.datafixers.util.Pair;
|
|||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.RenderLayers;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
|
@ -44,10 +44,12 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.hud.StackInfoHUD;
|
||||
import reborncore.client.multiblock.MultiblockRenderer;
|
||||
import techreborn.client.render.DynamicBucketBakedModel;
|
||||
import techreborn.client.render.DynamicCellBakedModel;
|
||||
import techreborn.events.StackToolTipHandler;
|
||||
import techreborn.init.ModFluids;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.ItemDynamicCell;
|
||||
import techreborn.items.ItemFrequencyTransmitter;
|
||||
|
@ -58,7 +60,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TechRebornClient implements ClientModInitializer {
|
||||
|
@ -145,6 +146,15 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
BlockRenderLayerMap.INSTANCE.putFluid(fluid.getFluid(), RenderLayer.getTranslucent());
|
||||
BlockRenderLayerMap.INSTANCE.putFluid(fluid.getFlowingFluid(), RenderLayer.getTranslucent());
|
||||
}
|
||||
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_GRINDER, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.FUSION_CONTROL_COMPUTER, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.VACUUM_FREEZER, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.FLUID_REPLICATOR, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_SAWMILL, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.DISTILLATION_TOWER, MultiblockRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.IMPLOSION_COMPRESSOR, MultiblockRenderer::new);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,9 +87,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
if (getMultiBlock()) {
|
||||
super.tick();
|
||||
}
|
||||
super.tick();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -29,14 +29,11 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.RebornCoreClient;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity;
|
||||
|
||||
|
@ -54,7 +51,6 @@ public class GuiBlastFurnace extends GuiBase<BuiltContainer> {
|
|||
public void init() {
|
||||
super.init();
|
||||
this.hasMultiBlock = this.blockEntity.getCachedHeat() != 0;
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +94,7 @@ public class GuiBlastFurnace extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void onClick(GuiButtonExtended button, Double x, Double y){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -141,23 +137,18 @@ public class GuiBlastFurnace extends GuiBase<BuiltContainer> {
|
|||
this.addComponent(-1, 3, 1, standardCasing, multiblock);
|
||||
this.addComponent(1, 3, -1, standardCasing, multiblock);
|
||||
this.addComponent(1, 3, 1, standardCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
blockEntity.getPos().getX() - Direction.byId(blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
blockEntity.getPos().getY() - 1,
|
||||
blockEntity.getPos().getZ() - Direction.byId(blockEntity.getFacingInt()).getOffsetZ() * 2);
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||
multiblock.addComponent(new BlockPos(x - Direction.byId(blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
y,
|
||||
z - Direction.byId(blockEntity.getFacingInt()).getOffsetZ() * 2), blockState);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,14 +29,11 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.RebornCoreClient;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.DistillationTowerBlockEntity;
|
||||
|
||||
|
@ -49,12 +46,6 @@ public class GuiDistillationTower extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawBackground(f, mouseX, mouseY);
|
||||
|
@ -92,7 +83,7 @@ public class GuiDistillationTower extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void onClick(GuiButtonExtended button, Double x, Double y){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -137,22 +128,16 @@ public class GuiDistillationTower extends GuiBase<BuiltContainer> {
|
|||
addComponent(1, 3, -1, advancedCasing, multiblock);
|
||||
addComponent(1, 3, 1, advancedCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
blockEntity.getPos().getX() - Direction.byId(blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
blockEntity.getPos().getY() - 1,
|
||||
blockEntity.getPos().getZ() - Direction.byId(blockEntity.getFacingInt()).getOffsetZ() * 2);
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||
multiblock.addComponent(new BlockPos(x - Direction.byId(blockEntity.getFacingInt()).getOffsetX() * 2, y, z - Direction.byId(blockEntity.getFacingInt()).getOffsetZ() * 2), blockState);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,14 +28,11 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.RebornCoreClient;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
|
||||
|
||||
|
@ -52,17 +49,6 @@ public class GuiFluidReplicator extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||
}
|
||||
|
||||
// GuiBase
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawBackground(f, mouseX, mouseY);
|
||||
|
@ -102,7 +88,7 @@ public class GuiFluidReplicator extends GuiBase<BuiltContainer> {
|
|||
// GuiScreen
|
||||
public void onClick(GuiButtonExtended button, Double x, Double y){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -117,18 +103,19 @@ public class GuiFluidReplicator extends GuiBase<BuiltContainer> {
|
|||
addComponent(1, 0, -1, reinforcedCasing, multiblock);
|
||||
addComponent(1, 0, 1, reinforcedCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
this.blockEntity.getPos().getX()
|
||||
- Direction.byId(this.blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
this.blockEntity.getPos().getY() - 1, this.blockEntity.getPos().getZ()
|
||||
- Direction.byId(this.blockEntity.getFacingInt()).getOffsetZ() * 2);
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(
|
||||
x - Direction.byId(this.blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
y,
|
||||
z - Direction.byId(this.blockEntity.getFacingInt()).getOffsetZ() * 2), blockState);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,8 +37,6 @@ import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
|||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.Color;
|
||||
|
@ -119,10 +117,10 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void hologramToggle(GuiButtonExtended button, double x, double y){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
updateMultiBlockRender();
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +128,7 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
private void sendSizeChange(int sizeDelta){
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketFusionControlSize(sizeDelta, blockEntity.getPos()));
|
||||
//Reset the multiblock as it will be wrong now.
|
||||
if(RebornCoreClient.multiblockRenderEvent.currentMultiblock != null){
|
||||
if(blockEntity.renderMultiblock != null){
|
||||
updateMultiBlockRender();
|
||||
}
|
||||
}
|
||||
|
@ -142,11 +140,7 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
List<BlockPos> coils = Torus.generate(new BlockPos(0, 0, 0), blockEntity.size);
|
||||
coils.forEach(pos -> addComponent(pos.getX(), pos.getY(), pos.getZ(), coil, multiblock));
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(blockEntity.getPos().getX(), blockEntity.getPos().getY() - 1,
|
||||
blockEntity.getPos().getZ());
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
|
|
|
@ -34,8 +34,6 @@ import reborncore.client.gui.builder.GuiBase;
|
|||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.ImplosionCompressorBlockEntity;
|
||||
|
||||
|
@ -48,12 +46,6 @@ public class GuiImplosionCompressor extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawBackground(f, mouseX, mouseY);
|
||||
|
@ -94,7 +86,7 @@ public class GuiImplosionCompressor extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -102,19 +94,16 @@ public class GuiImplosionCompressor extends GuiBase<BuiltContainer> {
|
|||
for (int y = -4; y <= -2; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (!((x == 0) && (y == -3) && (z == 0))) {
|
||||
this.addComponent(x, y, z, TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(), multiblock);
|
||||
this.addComponent(x, y + 1, z, TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState(), multiblock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(blockEntity.getPos().getX(), blockEntity.getPos().getY(), blockEntity.getPos().getZ());
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,11 @@ import net.minecraft.block.Blocks;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.RebornCoreClient;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
|
||||
|
||||
|
@ -49,12 +46,6 @@ public class GuiIndustrialGrinder extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawBackground(f, mouseX, mouseY);
|
||||
|
@ -99,7 +90,7 @@ public class GuiIndustrialGrinder extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void onClick(GuiButtonExtended button, double mouseX, double mouseY){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -137,23 +128,20 @@ public class GuiIndustrialGrinder extends GuiBase<BuiltContainer> {
|
|||
addComponent(1, 1, -1, standardCasing, multiblock);
|
||||
addComponent(1, 1, 1, standardCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
this.blockEntity.getPos().getX()
|
||||
- Direction.byId(this.blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
this.blockEntity.getPos().getY() - 1, this.blockEntity.getPos().getZ()
|
||||
- Direction.byId(this.blockEntity.getFacingInt()).getOffsetZ() * 2);
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||
multiblock.addComponent(new BlockPos(
|
||||
x - Direction.byId(this.blockEntity.getFacingInt()).getOffsetX() * 2,
|
||||
y,
|
||||
z - Direction.byId(this.blockEntity.getFacingInt()).getOffsetZ() * 2),
|
||||
blockState);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,14 +29,11 @@ import net.minecraft.block.Blocks;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.RebornCoreClient;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
|
@ -52,7 +49,7 @@ public class GuiIndustrialSawmill extends GuiBase<BuiltContainer> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +95,7 @@ public class GuiIndustrialSawmill extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -136,22 +133,18 @@ public class GuiIndustrialSawmill extends GuiBase<BuiltContainer> {
|
|||
addComponent(1, 1, -1, standardCasing, multiblock);
|
||||
addComponent(1, 1, 1, standardCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
this.blockEntity.getPos().getX()
|
||||
- Direction.byId(this.blockEntity.getFacingInt()).getOffsetY() * 2,
|
||||
this.blockEntity.getPos().getY() - 1, this.blockEntity.getPos().getZ()
|
||||
- Direction.byId(this.blockEntity.getFacingInt()).getOffsetY() * 2).offset(blockEntity.getFacing().getOpposite(), 2);
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final BlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||
multiblock.addComponent(new BlockPos(
|
||||
x - Direction.byId(this.blockEntity.getFacingInt()).getOffsetY() * 2,
|
||||
y,
|
||||
z- Direction.byId(this.blockEntity.getFacingInt()).getOffsetY() * 2), blockState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,14 +28,11 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.RebornCoreClient;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.VacuumFreezerBlockEntity;
|
||||
|
||||
|
@ -48,12 +45,6 @@ public class GuiVacuumFreezer extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawBackground(f, mouseX, mouseY);
|
||||
|
@ -91,7 +82,7 @@ public class GuiVacuumFreezer extends GuiBase<BuiltContainer> {
|
|||
|
||||
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
|
||||
if (GuiBase.slotConfigType == SlotConfigType.NONE) {
|
||||
if (RebornCoreClient.multiblockRenderEvent.currentMultiblock == null) {
|
||||
if (blockEntity.renderMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
|
@ -127,13 +118,10 @@ public class GuiVacuumFreezer extends GuiBase<BuiltContainer> {
|
|||
addComponent(1, -3, -1, advancedCasing, multiblock);
|
||||
addComponent(1, -3, 1, advancedCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(set);
|
||||
RebornCoreClient.multiblockRenderEvent.parent = blockEntity.getPos();
|
||||
MultiblockRenderEvent.anchor = blockEntity.getPos().offset(Direction.DOWN, 1);
|
||||
blockEntity.renderMultiblock = multiblock;
|
||||
}
|
||||
} else {
|
||||
RebornCoreClient.multiblockRenderEvent.setMultiblock(null);
|
||||
blockEntity.renderMultiblock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue