From aacc52d84a25c11d274d94f9f3015c920d847479 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 4 Feb 2020 14:48:21 +0100 Subject: [PATCH] Refactored animated block partials - Moved all block partials used only for rendering out of the registry - Refactored model registry hooks and custom block model handling - Added a safety layer for all tile entity renderers, addresses #76 - Overstressed indicator no longer shows when the kinetic source changes - Fixed framed glass rendering glass textures inbetween blocks - Fixed blockzapper adding itself twice to the item group - Fixed basing not spawning particles properly - Updated Forge - Reworked Schematicannon model --- build.gradle | 2 +- .../com/simibubi/create/AllBlockPartials.java | 113 ++++++ .../java/com/simibubi/create/AllBlocks.java | 50 +-- .../com/simibubi/create/CreateClient.java | 61 +--- .../com/simibubi/create/CreateItemGroup.java | 2 +- .../category/ProcessingViaFanCategory.java | 15 +- .../category/animations/AnimatedCrafter.java | 19 +- .../category/animations/AnimatedMixer.java | 22 +- .../category/animations/AnimatedPress.java | 19 +- .../base/SmartTileEntityRenderer.java | 8 +- .../block/IHaveColoredVertices.java | 14 +- .../block/IHaveCustomBlockModel.java | 14 + .../block/RenderUtilityAxisBlock.java | 18 - .../block/RenderUtilityDirectionalBlock.java | 11 - .../block/SafeTileEntityRenderer.java | 33 ++ .../block/SafeTileEntityRendererFast.java | 25 ++ .../connected/IHaveConnectedTextures.java | 14 +- .../ColoredOverlayTileEntityRenderer.java | 16 +- .../block/render/CustomRenderedItemModel.java | 3 +- .../foundation/gui/ScreenElementRenderer.java | 59 ++- .../create/foundation/utility/AllShapes.java | 5 +- .../foundation/utility/AngleHelper.java | 10 +- .../utility/SuperByteBufferCache.java | 26 +- .../contraptions/base/KineticTileEntity.java | 22 +- .../base/KineticTileEntityRenderer.java | 27 +- .../components/actors/DrillBlock.java | 17 - .../actors/DrillTileEntityRenderer.java | 13 +- .../components/actors/HarvesterBlock.java | 20 - .../actors/HarvesterTileEntityRenderer.java | 15 +- .../MechanicalBearingTileEntityRenderer.java | 27 +- .../MechanicalPistonTileEntityRenderer.java | 4 +- .../crafter/MechanicalCrafterBlock.java | 2 +- .../MechanicalCrafterTileEntityRenderer.java | 45 ++- .../crank/HandCrankTileEntityRenderer.java | 13 +- .../deployer/DeployerTileEntity.java | 7 +- .../deployer/DeployerTileEntityRenderer.java | 21 +- .../fan/EncasedFanTileEntityRenderer.java | 30 +- .../MechanicalMixerTileEntityRenderer.java | 25 +- .../motor/MotorTileEntityRenderer.java | 11 +- .../press/MechanicalPressBlock.java | 16 - .../MechanicalPressTileEntityRenderer.java | 17 +- .../components/saw/SawTileEntityRenderer.java | 23 +- .../processing/BasinTileEntityRenderer.java | 8 +- .../AnalogLeverTileEntityRenderer.java | 20 +- .../relays/belt/BeltTileEntityRenderer.java | 39 +- .../belt/BeltTunnelTileEntityRenderer.java | 16 +- .../relays/elementary/ShaftHalfBlock.java | 14 - .../encased/SplitShaftTileEntityRenderer.java | 11 +- .../contraptions/relays/gauge/GaugeBlock.java | 13 - .../relays/gauge/GaugeTileEntityRenderer.java | 18 +- .../gearbox/GearboxTileEntityRenderer.java | 14 +- .../blockzapper/BlockzapperItem.java | 1 - .../partialWindows/WindowInABlockBlock.java | 10 +- .../belts/BeltObserverTileEntityRenderer.java | 8 +- .../diodes/FlexpeaterTileEntityRenderer.java | 9 +- .../create/modules/palettes/CTGlassBlock.java | 4 +- .../modules/palettes/CTWindowBlock.java | 26 ++ .../block/SchematicannonRenderer.java | 61 ++-- .../blockstates/analog_lever_handle.json | 5 - .../blockstates/analog_lever_indicator.json | 5 - .../create/blockstates/belt_pulley.json | 7 - .../create/blockstates/belt_tunnel_flap.json | 5 - .../blockstates/belt_tunnel_indicator.json | 5 - .../blockstates/deployer_hand_holding.json | 5 - .../blockstates/deployer_hand_pointing.json | 5 - .../blockstates/deployer_hand_punching.json | 5 - .../create/blockstates/deployer_pole.json | 5 - .../assets/create/blockstates/drill_head.json | 16 - .../create/blockstates/encased_fan_inner.json | 16 - .../blockstates/flexpeater_indicator.json | 5 - .../assets/create/blockstates/gauge_dial.json | 5 - .../assets/create/blockstates/gauge_head.json | 6 - .../create/blockstates/gauge_indicator.json | 5 - .../create/blockstates/hand_crank_handle.json | 16 - .../create/blockstates/harvester_blade.json | 14 - .../blockstates/mechanical_bearing_top.json | 16 - .../blockstates/mechanical_crafter_arrow.json | 5 - .../blockstates/mechanical_crafter_belt.json | 5 - .../mechanical_crafter_belt_frame.json | 5 - .../blockstates/mechanical_crafter_lid.json | 5 - .../blockstates/mechanical_mixer_head.json | 5 - .../blockstates/mechanical_mixer_pole.json | 5 - .../blockstates/mechanical_press_head.json | 14 - .../create/blockstates/schematicannon.json | 2 +- .../blockstates/schematicannon_connector.json | 6 - .../blockstates/schematicannon_pipe.json | 6 - .../assets/create/blockstates/shaft_half.json | 16 - .../blockstates/shaftless_cogwheel.json | 13 - .../models/block/analog_lever/indicator.json | 1 + .../models/block/mechanical_bearing_top.json | 66 ++-- .../models/block/schematicannon/base.json | 61 ++++ .../block/schematicannon/connector.json | 55 +++ .../models/block/schematicannon/pipe.json | 74 ++++ .../models/block/schematicannon_base.json | 52 --- .../block/schematicannon_connector.json | 48 --- .../models/block/schematicannon_pipe.json | 61 ---- .../create/models/block/shaft_half.json | 42 +-- .../create/models/item/schematicannon.json | 345 ++++++++++-------- .../create/textures/block/schematicannon.png | Bin 0 -> 573 bytes 99 files changed, 1084 insertions(+), 1140 deletions(-) create mode 100644 src/main/java/com/simibubi/create/AllBlockPartials.java create mode 100644 src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockModel.java delete mode 100644 src/main/java/com/simibubi/create/foundation/block/RenderUtilityAxisBlock.java delete mode 100644 src/main/java/com/simibubi/create/foundation/block/RenderUtilityDirectionalBlock.java create mode 100644 src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java create mode 100644 src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRendererFast.java delete mode 100644 src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/ShaftHalfBlock.java create mode 100644 src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java delete mode 100644 src/main/resources/assets/create/blockstates/analog_lever_handle.json delete mode 100644 src/main/resources/assets/create/blockstates/analog_lever_indicator.json delete mode 100644 src/main/resources/assets/create/blockstates/belt_pulley.json delete mode 100644 src/main/resources/assets/create/blockstates/belt_tunnel_flap.json delete mode 100644 src/main/resources/assets/create/blockstates/belt_tunnel_indicator.json delete mode 100644 src/main/resources/assets/create/blockstates/deployer_hand_holding.json delete mode 100644 src/main/resources/assets/create/blockstates/deployer_hand_pointing.json delete mode 100644 src/main/resources/assets/create/blockstates/deployer_hand_punching.json delete mode 100644 src/main/resources/assets/create/blockstates/deployer_pole.json delete mode 100644 src/main/resources/assets/create/blockstates/drill_head.json delete mode 100644 src/main/resources/assets/create/blockstates/encased_fan_inner.json delete mode 100644 src/main/resources/assets/create/blockstates/flexpeater_indicator.json delete mode 100644 src/main/resources/assets/create/blockstates/gauge_dial.json delete mode 100644 src/main/resources/assets/create/blockstates/gauge_head.json delete mode 100644 src/main/resources/assets/create/blockstates/gauge_indicator.json delete mode 100644 src/main/resources/assets/create/blockstates/hand_crank_handle.json delete mode 100644 src/main/resources/assets/create/blockstates/harvester_blade.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_bearing_top.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_crafter_arrow.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_crafter_belt.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_crafter_belt_frame.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_crafter_lid.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_mixer_head.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_mixer_pole.json delete mode 100644 src/main/resources/assets/create/blockstates/mechanical_press_head.json delete mode 100644 src/main/resources/assets/create/blockstates/schematicannon_connector.json delete mode 100644 src/main/resources/assets/create/blockstates/schematicannon_pipe.json delete mode 100644 src/main/resources/assets/create/blockstates/shaft_half.json delete mode 100644 src/main/resources/assets/create/blockstates/shaftless_cogwheel.json create mode 100644 src/main/resources/assets/create/models/block/schematicannon/base.json create mode 100644 src/main/resources/assets/create/models/block/schematicannon/connector.json create mode 100644 src/main/resources/assets/create/models/block/schematicannon/pipe.json delete mode 100644 src/main/resources/assets/create/models/block/schematicannon_base.json delete mode 100644 src/main/resources/assets/create/models/block/schematicannon_connector.json delete mode 100644 src/main/resources/assets/create/models/block/schematicannon_pipe.json create mode 100644 src/main/resources/assets/create/textures/block/schematicannon.png diff --git a/build.gradle b/build.gradle index df3668ac9..e37909416 100644 --- a/build.gradle +++ b/build.gradle @@ -71,7 +71,7 @@ repositories { } dependencies { - minecraft 'net.minecraftforge:forge:1.14.4-28.1.115' + minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' // compile against the JEI API but do not include it at runtime compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.26:api") diff --git a/src/main/java/com/simibubi/create/AllBlockPartials.java b/src/main/java/com/simibubi/create/AllBlockPartials.java new file mode 100644 index 000000000..257f387ab --- /dev/null +++ b/src/main/java/com/simibubi/create/AllBlockPartials.java @@ -0,0 +1,113 @@ +package com.simibubi.create; + +import static net.minecraft.state.properties.BlockStateProperties.FACING; +import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; + +import java.util.Map; + +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.SuperByteBuffer; + +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.ModelBakeEvent; +import net.minecraftforge.client.event.ModelRegistryEvent; +import net.minecraftforge.client.model.ModelLoader; + +public enum AllBlockPartials { + + SCHEMATICANNON_CONNECTOR("schematicannon/connector"), + SCHEMATICANNON_PIPE("schematicannon/pipe"), + + SHAFTLESS_COGWHEEL("cogwheel_shaftless"), + BELT_PULLEY, + SHAFT_HALF, + + ENCASED_FAN_INNER("encased_fan/propeller"), + HAND_CRANK_HANDLE("hand_crank/handle"), + MECHANICAL_PRESS_HEAD, + MECHANICAL_MIXER_POLE("mixer_pole"), + MECHANICAL_MIXER_HEAD("mixer_head"), + MECHANICAL_CRAFTER_LID("crafter/lid"), + MECHANICAL_CRAFTER_ARROW("crafter/arrow"), + MECHANICAL_CRAFTER_BELT_FRAME("crafter/belt"), + MECHANICAL_CRAFTER_BELT("crafter/belt_animated"), + GAUGE_DIAL("gauge/dial"), + GAUGE_INDICATOR("gauge/indicator"), + GAUGE_HEAD_SPEED("gauge/speed"), + GAUGE_HEAD_STRESS("gauge/stress"), + MECHANICAL_BEARING_TOP, + DRILL, + HARVESTER_BLADE, + DEPLOYER_POLE("deployer/pole"), + DEPLOYER_HAND_POINTING("deployer/hand_pointing"), + DEPLOYER_HAND_PUNCHING("deployer/hand_punching"), + DEPLOYER_HAND_HOLDING("deployer/hand_holding"), + ANALOG_LEVER_HANDLE("analog_lever/handle"), + ANALOG_LEVER_INDICATOR("analog_lever/indicator"), + BELT_TUNNEL_FLAP("belt_tunnel/flap"), + BELT_TUNNEL_INDICATOR("belt_tunnel/indicator"), + FLEXPEATER_INDICATOR("repeaters/flexpeater_indicator"), + + ; + + private ResourceLocation modelLocation; + private IBakedModel bakedModel; + + private AllBlockPartials() { + } + + private AllBlockPartials(String path) { + modelLocation = new ResourceLocation(Create.ID, "block/" + path); + } + + public static void onModelRegistry(ModelRegistryEvent event) { + for (AllBlockPartials partial : AllBlockPartials.values()) { + partial.createModelLocation(); + ModelLoader.addSpecialModel(partial.modelLocation); + } + } + + public static void onModelBake(ModelBakeEvent event) { + Map modelRegistry = event.getModelRegistry(); + for (AllBlockPartials partial : AllBlockPartials.values()) { + partial.createModelLocation(); + partial.bakedModel = modelRegistry.get(partial.modelLocation); + } + } + + private void createModelLocation() { + if (modelLocation == null) + modelLocation = new ResourceLocation(Create.ID, "block/" + Lang.asId(name())); + } + + public IBakedModel get() { + return bakedModel; + } + + public SuperByteBuffer renderOn(BlockState referenceState) { + return CreateClient.bufferCache.renderPartial(this, referenceState); + } + + public SuperByteBuffer renderOnDirectional(BlockState referenceState) { + Direction facing = referenceState.get(FACING); + return renderOnDirectional(referenceState, facing); + } + + public SuperByteBuffer renderOnHorizontal(BlockState referenceState) { + Direction facing = referenceState.get(HORIZONTAL_FACING); + return renderOnDirectional(referenceState, facing); + } + + public SuperByteBuffer renderOnDirectional(BlockState referenceState, Direction facing) { + SuperByteBuffer renderPartial = CreateClient.bufferCache.renderPartial(this, referenceState); + renderPartial.rotateCentered(Axis.X, AngleHelper.rad(AngleHelper.verticalAngle(facing))); + renderPartial.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(facing))); + return renderPartial; + } + +} diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 64df10b21..fceceadf1 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -4,17 +4,12 @@ import com.simibubi.create.foundation.block.IHaveColorHandler; import com.simibubi.create.foundation.block.IHaveCustomBlockItem; import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.ProperStairsBlock; -import com.simibubi.create.foundation.block.RenderUtilityAxisBlock; -import com.simibubi.create.foundation.block.RenderUtilityBlock; -import com.simibubi.create.foundation.block.RenderUtilityDirectionalBlock; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.world.OxidizingBlock; import com.simibubi.create.modules.IModule; import com.simibubi.create.modules.contraptions.CasingBlock; import com.simibubi.create.modules.contraptions.components.actors.DrillBlock; -import com.simibubi.create.modules.contraptions.components.actors.DrillBlock.DrillHeadBlock; import com.simibubi.create.modules.contraptions.components.actors.HarvesterBlock; -import com.simibubi.create.modules.contraptions.components.actors.HarvesterBlock.HarvesterBladeBlock; import com.simibubi.create.modules.contraptions.components.contraptions.bearing.MechanicalBearingBlock; import com.simibubi.create.modules.contraptions.components.contraptions.chassis.LinearChassisBlock; import com.simibubi.create.modules.contraptions.components.contraptions.chassis.RadialChassisBlock; @@ -43,7 +38,6 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelBlock; import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; -import com.simibubi.create.modules.contraptions.relays.elementary.ShaftHalfBlock; import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock; import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock; @@ -69,6 +63,7 @@ import com.simibubi.create.modules.logistics.block.transposer.LinkedTransposerBl import com.simibubi.create.modules.logistics.block.transposer.TransposerBlock; import com.simibubi.create.modules.palettes.CTGlassBlock; import com.simibubi.create.modules.palettes.CTGlassPaneBlock; +import com.simibubi.create.modules.palettes.CTWindowBlock; import com.simibubi.create.modules.palettes.GlassPaneBlock; import com.simibubi.create.modules.palettes.HorizontalCTGlassBlock; import com.simibubi.create.modules.palettes.LayeredCTBlock; @@ -103,8 +98,6 @@ public enum AllBlocks { __SCHEMATICS__(), SCHEMATICANNON(new SchematicannonBlock()), - SCHEMATICANNON_CONNECTOR(new RenderUtilityBlock()), - SCHEMATICANNON_PIPE(new RenderUtilityBlock()), CREATIVE_CRATE(new CreativeCrateBlock()), SCHEMATIC_TABLE(new SchematicTableBlock()), @@ -112,7 +105,6 @@ public enum AllBlocks { SHAFT(new ShaftBlock(Properties.from(Blocks.ANDESITE))), COGWHEEL(new CogWheelBlock(false)), LARGE_COGWHEEL(new CogWheelBlock(true)), - SHAFTLESS_COGWHEEL(new RenderUtilityAxisBlock()), ENCASED_SHAFT(new EncasedShaftBlock()), GEARBOX(new GearboxBlock()), CLUTCH(new ClutchBlock()), @@ -120,60 +112,37 @@ public enum AllBlocks { ENCASED_BELT(new EncasedBeltBlock()), ADJUSTABLE_PULLEY(new AdjustablePulleyBlock()), BELT(new BeltBlock()), - BELT_PULLEY(new RenderUtilityAxisBlock()), MOTOR(new MotorBlock()), WATER_WHEEL(new WaterWheelBlock()), ENCASED_FAN(new EncasedFanBlock()), - ENCASED_FAN_INNER(new RenderUtilityDirectionalBlock()), NOZZLE(new NozzleBlock()), TURNTABLE(new TurntableBlock()), - SHAFT_HALF(new ShaftHalfBlock()), HAND_CRANK(new HandCrankBlock()), - HAND_CRANK_HANDLE(new RenderUtilityDirectionalBlock()), CRUSHING_WHEEL(new CrushingWheelBlock()), CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()), MECHANICAL_PRESS(new MechanicalPressBlock()), - MECHANICAL_PRESS_HEAD(new MechanicalPressBlock.Head()), MECHANICAL_MIXER(new MechanicalMixerBlock()), - MECHANICAL_MIXER_POLE(new RenderUtilityBlock()), - MECHANICAL_MIXER_HEAD(new RenderUtilityBlock()), BASIN(new BasinBlock()), MECHANICAL_CRAFTER(new MechanicalCrafterBlock()), - MECHANICAL_CRAFTER_LID(new RenderUtilityBlock()), - MECHANICAL_CRAFTER_ARROW(new RenderUtilityBlock()), - MECHANICAL_CRAFTER_BELT_FRAME(new RenderUtilityBlock()), - MECHANICAL_CRAFTER_BELT(new RenderUtilityBlock()), SPEED_GAUGE(new GaugeBlock(GaugeBlock.Type.SPEED)), STRESS_GAUGE(new GaugeBlock(GaugeBlock.Type.STRESS)), - GAUGE_DIAL(new RenderUtilityBlock()), - GAUGE_INDICATOR(new RenderUtilityBlock()), - GAUGE_HEAD(new GaugeBlock.Head()), MECHANICAL_PISTON(new MechanicalPistonBlock(false)), STICKY_MECHANICAL_PISTON(new MechanicalPistonBlock(true)), MECHANICAL_PISTON_HEAD(new MechanicalPistonHeadBlock()), PISTON_POLE(new PistonPoleBlock()), MECHANICAL_BEARING(new MechanicalBearingBlock()), - MECHANICAL_BEARING_TOP(new ShaftHalfBlock()), TRANSLATION_CHASSIS(new LinearChassisBlock()), TRANSLATION_CHASSIS_SECONDARY(new LinearChassisBlock()), ROTATION_CHASSIS(new RadialChassisBlock()), DRILL(new DrillBlock()), - DRILL_HEAD(new DrillHeadBlock()), SAW(new SawBlock()), HARVESTER(new HarvesterBlock()), - HARVESTER_BLADE(new HarvesterBladeBlock()), DEPLOYER(new DeployerBlock()), - DEPLOYER_POLE(new RenderUtilityBlock()), - DEPLOYER_HAND_POINTING(new RenderUtilityBlock()), - DEPLOYER_HAND_PUNCHING(new RenderUtilityBlock()), - DEPLOYER_HAND_HOLDING(new RenderUtilityBlock()), CART_ASSEMBLER(new CartAssemblerBlock()), MINECART_ANCHOR(new MinecartAnchorBlock()), ANALOG_LEVER(new AnalogLeverBlock()), - ANALOG_LEVER_HANDLE(new RenderUtilityBlock()), - ANALOG_LEVER_INDICATOR(new RenderUtilityBlock()), ANDESITE_CASING(new CasingBlock("andesite_casing")), COPPER_CASING(new CasingBlock("copper_casing")), @@ -195,13 +164,10 @@ public enum AllBlocks { BELT_FUNNEL(new FunnelBlock()), VERTICAL_FUNNEL(new FunnelBlock.Vertical()), BELT_TUNNEL(new BeltTunnelBlock()), - BELT_TUNNEL_FLAP(new RenderUtilityBlock()), - BELT_TUNNEL_INDICATOR(new RenderUtilityBlock()), ENTITY_DETECTOR(new BeltObserverBlock()), PULSE_REPEATER(new PulseRepeaterBlock()), FLEXPEATER(new FlexpeaterBlock()), FLEXPULSEPEATER(new FlexpeaterBlock()), - FLEXPEATER_INDICATOR(new RenderUtilityBlock()), __CURIOSITIES__(), SYMMETRY_PLANE(new PlaneSymmetryBlock()), @@ -216,13 +182,13 @@ public enum AllBlocks { HORIZONTAL_FRAMED_GLASS(new HorizontalCTGlassBlock(AllCTs.HORIZONTAL_FRAMED_GLASS, AllCTs.FRAMED_GLASS, false)), VERTICAL_FRAMED_GLASS(new VerticalCTGlassBlock(AllCTs.VERTICAL_FRAMED_GLASS, false)), - OAK_GLASS(new VerticalCTGlassBlock(AllCTs.OAK_GLASS, false)), - SPRUCE_GLASS(new VerticalCTGlassBlock(AllCTs.SPRUCE_GLASS, false)), - BIRCH_GLASS(new VerticalCTGlassBlock(AllCTs.BIRCH_GLASS, true)), - JUNGLE_GLASS(new VerticalCTGlassBlock(AllCTs.JUNGLE_GLASS, false)), - DARK_OAK_GLASS(new VerticalCTGlassBlock(AllCTs.DARK_OAK_GLASS, false)), - ACACIA_GLASS(new VerticalCTGlassBlock(AllCTs.ACACIA_GLASS, false)), - IRON_GLASS(new VerticalCTGlassBlock(AllCTs.IRON_GLASS, false)), + OAK_GLASS(new CTWindowBlock(AllCTs.OAK_GLASS, false)), + SPRUCE_GLASS(new CTWindowBlock(AllCTs.SPRUCE_GLASS, false)), + BIRCH_GLASS(new CTWindowBlock(AllCTs.BIRCH_GLASS, true)), + JUNGLE_GLASS(new CTWindowBlock(AllCTs.JUNGLE_GLASS, false)), + DARK_OAK_GLASS(new CTWindowBlock(AllCTs.DARK_OAK_GLASS, false)), + ACACIA_GLASS(new CTWindowBlock(AllCTs.ACACIA_GLASS, false)), + IRON_GLASS(new CTWindowBlock(AllCTs.IRON_GLASS, false)), TILED_GLASS_PANE(new GlassPaneBlock(Properties.from(Blocks.GLASS))), FRAMED_GLASS_PANE(new CTGlassPaneBlock(FRAMED_GLASS.block)), diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 6c1f9dbff..39544be33 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -5,17 +5,13 @@ import java.util.List; import java.util.Map; import java.util.function.Function; -import com.simibubi.create.foundation.block.IHaveColoredVertices; -import com.simibubi.create.foundation.block.connected.CTModel; +import com.simibubi.create.foundation.block.IHaveCustomBlockModel; import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures; -import com.simibubi.create.foundation.block.render.ColoredVertexModel; -import com.simibubi.create.foundation.block.render.CustomRenderedItemModel; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.item.IHaveCustomItemModel; import com.simibubi.create.foundation.utility.SuperByteBufferCache; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionRenderer; -import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockModel; import com.simibubi.create.modules.schematics.ClientSchematicLoader; import com.simibubi.create.modules.schematics.client.SchematicAndQuillHandler; import com.simibubi.create.modules.schematics.client.SchematicHandler; @@ -28,7 +24,6 @@ import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; -import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -107,63 +102,41 @@ public class CreateClient { event.addSprite(new ResourceLocation(Create.ID, "block/belt_animated")); for (AllBlocks allBlocks : AllBlocks.values()) { Block block = allBlocks.get(); - if (!(block instanceof IHaveConnectedTextures)) - continue; - for (SpriteShiftEntry spriteShiftEntry : ((IHaveConnectedTextures) block).getBehaviour().getAllCTShifts()) - event.addSprite(spriteShiftEntry.getTargetResourceLocation()); + if (block instanceof IHaveConnectedTextures) + for (SpriteShiftEntry spriteShiftEntry : ((IHaveConnectedTextures) block).getBehaviour() + .getAllCTShifts()) + event.addSprite(spriteShiftEntry.getTargetResourceLocation()); } } @OnlyIn(Dist.CLIENT) public static void onModelBake(ModelBakeEvent event) { Map modelRegistry = event.getModelRegistry(); + AllBlockPartials.onModelBake(event); - // Swap Models for CT Blocks and Blocks with colored Vertices for (AllBlocks allBlocks : AllBlocks.values()) { Block block = allBlocks.get(); - if (block == null) - continue; - - List blockModelLocations = getAllBlockStateModelLocations(allBlocks); - if (block instanceof IHaveConnectedTextures) - swapModels(modelRegistry, blockModelLocations, t -> new CTModel(t, (IHaveConnectedTextures) block)); - if (block instanceof IHaveColoredVertices) - swapModels(modelRegistry, blockModelLocations, - t -> new ColoredVertexModel(t, (IHaveColoredVertices) block)); - + if (block instanceof IHaveCustomBlockModel) + swapModels(modelRegistry, getAllBlockStateModelLocations(allBlocks), + ((IHaveCustomBlockModel) block)::createModel); } - // Swap Models for custom rendered item models for (AllItems item : AllItems.values()) { - if (!(item.get() instanceof IHaveCustomItemModel)) - continue; - - IHaveCustomItemModel specialItem = (IHaveCustomItemModel) item.get(); - ModelResourceLocation location = new ModelResourceLocation(item.get().getRegistryName(), "inventory"); - CustomRenderedItemModel model = specialItem.createModel(modelRegistry.get(location)); - model.loadPartials(event); - modelRegistry.put(location, model); + if (item.get() instanceof IHaveCustomItemModel) + swapModels(modelRegistry, getItemModelLocation(item), + m -> ((IHaveCustomItemModel) item.get()).createModel(m).loadPartials(event)); } - - swapModels(modelRegistry, getAllBlockStateModelLocations(AllBlocks.WINDOW_IN_A_BLOCK), - WindowInABlockModel::new); - swapModels(modelRegistry, - getBlockModelLocation(AllBlocks.WINDOW_IN_A_BLOCK, - BlockModelShapes.getPropertyMapString(AllBlocks.WINDOW_IN_A_BLOCK.get().getDefaultState() - .with(BlockStateProperties.WATERLOGGED, true).getValues())), - WindowInABlockModel::new); } @OnlyIn(Dist.CLIENT) public static void onModelRegistry(ModelRegistryEvent event) { + AllBlockPartials.onModelRegistry(event); + // Register submodels for custom rendered item models for (AllItems item : AllItems.values()) { - if (!(item.get() instanceof IHaveCustomItemModel)) - continue; - - IHaveCustomItemModel specialItem = (IHaveCustomItemModel) item.get(); - CustomRenderedItemModel model = specialItem.createModel(null); - model.getModelLocations().forEach(ModelLoader::addSpecialModel); + if (item.get() instanceof IHaveCustomItemModel) + ((IHaveCustomItemModel) item.get()).createModel(null).getModelLocations() + .forEach(ModelLoader::addSpecialModel); } } diff --git a/src/main/java/com/simibubi/create/CreateItemGroup.java b/src/main/java/com/simibubi/create/CreateItemGroup.java index d6cc68790..726ce1675 100644 --- a/src/main/java/com/simibubi/create/CreateItemGroup.java +++ b/src/main/java/com/simibubi/create/CreateItemGroup.java @@ -61,7 +61,7 @@ public final class CreateItemGroup extends ItemGroup { if (!item.module.isEnabled()) continue; IBakedModel model = itemRenderer.getModelWithOverrides(item.asStack()); - if ((model.isBuiltInRenderer() || model.isGui3d()) != specialItems) + if (model.isGui3d() != specialItems) continue; if (item.get() instanceof IAddedByOther) continue; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java index a0609a536..cd3d0ff7c 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java @@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category; import java.util.Arrays; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.ScreenResources; import com.simibubi.create.compat.jei.EmptyBackground; @@ -16,6 +17,7 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.item.crafting.IRecipe; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; @@ -66,14 +68,19 @@ public abstract class ProcessingViaFanCategory> implements GlStateManager.rotated(15.5, 0, 1, 0); GlStateManager.scaled(.6f, .6f, .6f); ScreenElementRenderer.renderBlock(this::renderFanCasing); - + GlStateManager.pushMatrix(); float angle = AnimatedKinetics.getCurrentAngle() * 12; float t = 25; GlStateManager.translatef(t, -t, t); GlStateManager.rotated(angle, 0, 0, 1); GlStateManager.translatef(-t, t, -t); - ScreenElementRenderer.renderBlock(this::renderFanInner); + + GlStateManager.translatef(t, 0, 175); + GlStateManager.rotated(90, 0, 1, 0); + GlStateManager.translatef(-t, 0, -175); + + ScreenElementRenderer.renderModel(this::renderFanInner); GlStateManager.popMatrix(); GlStateManager.translated(-10, 0, 95); @@ -88,8 +95,8 @@ public abstract class ProcessingViaFanCategory> implements return AllBlocks.ENCASED_FAN.get().getDefaultState().with(BlockStateProperties.FACING, Direction.WEST); } - protected BlockState renderFanInner() { - return AllBlocks.ENCASED_FAN_INNER.get().getDefaultState().with(BlockStateProperties.FACING, Direction.WEST); + protected IBakedModel renderFanInner() { + return AllBlockPartials.ENCASED_FAN_INNER.get(); } public abstract void renderAttachedBlock(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java index f3a547ea0..89fd71bf6 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrafter.java @@ -1,14 +1,14 @@ package com.simibubi.create.compat.jei.category.animations; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.ScreenElementRenderer; import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterBlock; import net.minecraft.block.BlockState; -import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.util.Direction; -import net.minecraft.util.Direction.Axis; public class AnimatedCrafter extends AnimatedKinetics { @@ -38,35 +38,36 @@ public class AnimatedCrafter extends AnimatedKinetics { GlStateManager.translatef(-45, -5, 0); GlStateManager.scaled(.45f, .45f, .45f); - ScreenElementRenderer.renderBlock(() -> cogwheel(true)); + ScreenElementRenderer.renderModel(() -> cogwheel(true)); ScreenElementRenderer.renderBlock(this::body); GlStateManager.translatef(0, 50, 0); - ScreenElementRenderer.renderBlock(() -> cogwheel(false)); + ScreenElementRenderer.renderModel(() -> cogwheel(false)); ScreenElementRenderer.renderBlock(this::body); if (four) { GlStateManager.translatef(50, -50, 0); - ScreenElementRenderer.renderBlock(() -> cogwheel(false)); + ScreenElementRenderer.renderModel(() -> cogwheel(false)); ScreenElementRenderer.renderBlock(this::body); GlStateManager.translatef(0, 50, 0); - ScreenElementRenderer.renderBlock(() -> cogwheel(true)); + ScreenElementRenderer.renderModel(() -> cogwheel(true)); ScreenElementRenderer.renderBlock(this::body); } else { GlStateManager.translatef(0, 50, 0); - ScreenElementRenderer.renderBlock(() -> cogwheel(true)); + ScreenElementRenderer.renderModel(() -> cogwheel(true)); ScreenElementRenderer.renderBlock(this::body); } GlStateManager.popMatrix(); } - private BlockState cogwheel(boolean forward) { + private IBakedModel cogwheel(boolean forward) { float t = 25; GlStateManager.translatef(t, -t, -t); GlStateManager.rotated(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1); + GlStateManager.rotated(90, 1, 0, 0); GlStateManager.translatef(-t, t, t); - return AllBlocks.SHAFTLESS_COGWHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X); + return AllBlockPartials.SHAFTLESS_COGWHEEL.get(); } private BlockState body() { diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java index 161f910f6..7493a3ac5 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java @@ -1,12 +1,12 @@ package com.simibubi.create.compat.jei.category.animations; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.ScreenElementRenderer; import net.minecraft.block.BlockState; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction.Axis; +import net.minecraft.client.renderer.model.IBakedModel; public class AnimatedMixer extends AnimatedKinetics { @@ -31,7 +31,7 @@ public class AnimatedMixer extends AnimatedKinetics { GlStateManager.scaled(.45f, .45f, .45f); GlStateManager.pushMatrix(); - ScreenElementRenderer.renderBlock(this::cogwheel); + ScreenElementRenderer.renderModel(this::cogwheel); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); @@ -39,11 +39,11 @@ public class AnimatedMixer extends AnimatedKinetics { GlStateManager.popMatrix(); GlStateManager.pushMatrix(); - ScreenElementRenderer.renderBlock(this::pole); + ScreenElementRenderer.renderModel(this::pole); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); - ScreenElementRenderer.renderBlock(this::head); + ScreenElementRenderer.renderModel(this::head); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); @@ -53,30 +53,30 @@ public class AnimatedMixer extends AnimatedKinetics { GlStateManager.popMatrix(); } - private BlockState cogwheel() { + private IBakedModel cogwheel() { float t = 25; GlStateManager.translatef(t, -t, -t); GlStateManager.rotated(getCurrentAngle() * 2, 0, 1, 0); GlStateManager.translatef(-t, t, t); - return AllBlocks.SHAFTLESS_COGWHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Y); + return AllBlockPartials.SHAFTLESS_COGWHEEL.get(); } private BlockState body() { return AllBlocks.MECHANICAL_MIXER.get().getDefaultState(); } - private BlockState pole() { + private IBakedModel pole() { GlStateManager.translatef(0, 51, 0); - return AllBlocks.MECHANICAL_MIXER_POLE.get().getDefaultState(); + return AllBlockPartials.MECHANICAL_MIXER_POLE.get(); } - private BlockState head() { + private IBakedModel head() { float t = 25; GlStateManager.translatef(0, 51, 0); GlStateManager.translatef(t, -t, -t); GlStateManager.rotated(getCurrentAngle() * 4, 0, 1, 0); GlStateManager.translatef(-t, t, t); - return AllBlocks.MECHANICAL_MIXER_HEAD.get().getDefaultState(); + return AllBlockPartials.MECHANICAL_MIXER_HEAD.get(); } private BlockState basin() { diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java index d87636102..de97288c7 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java @@ -3,11 +3,13 @@ package com.simibubi.create.compat.jei.category.animations; import static com.simibubi.create.foundation.utility.AnimationTickHolder.ticks; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.ScreenElementRenderer; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; @@ -49,7 +51,7 @@ public class AnimatedPress extends AnimatedKinetics { GlStateManager.popMatrix(); GlStateManager.pushMatrix(); - ScreenElementRenderer.renderBlock(this::head); + ScreenElementRenderer.renderModel(this::head); GlStateManager.popMatrix(); if (basin) { @@ -63,18 +65,18 @@ public class AnimatedPress extends AnimatedKinetics { private BlockState shaft() { float t = 25; - GlStateManager.translatef(t, -t, t); - GlStateManager.rotated(getCurrentAngle() * 2, 0, 0, 1); - GlStateManager.translatef(-t, t, -t); - return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X); + GlStateManager.translatef(t, -t, -t); + GlStateManager.rotated(getCurrentAngle() * 2, 1, 0, 0); + GlStateManager.translatef(-t, t, t); + return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Z); } private BlockState body() { return AllBlocks.MECHANICAL_PRESS.get().getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, - Direction.EAST); + Direction.SOUTH); } - private BlockState head() { + private IBakedModel head() { float cycle = (ticks + Minecraft.getInstance().getRenderPartialTicks()) % 30; float verticalOffset = 0; if (cycle < 10) { @@ -88,8 +90,7 @@ public class AnimatedPress extends AnimatedKinetics { verticalOffset = 0; } GlStateManager.translated(0, -verticalOffset * 50, 0); - return AllBlocks.MECHANICAL_PRESS_HEAD.get().getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, - Direction.EAST); + return AllBlockPartials.MECHANICAL_PRESS_HEAD.get(); } private BlockState basin() { diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java index 69f572c89..d8ab21323 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java @@ -2,14 +2,12 @@ package com.simibubi.create.foundation.behaviour.base; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.behaviour.linked.LinkRenderer; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; - -public class SmartTileEntityRenderer extends TileEntityRenderer { +public class SmartTileEntityRenderer extends SafeTileEntityRenderer { @Override - public void render(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { - super.render(tileEntityIn, x, y, z, partialTicks, destroyStage); + public void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage); LinkRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage); } diff --git a/src/main/java/com/simibubi/create/foundation/block/IHaveColoredVertices.java b/src/main/java/com/simibubi/create/foundation/block/IHaveColoredVertices.java index affbb3024..f9b0c1348 100644 --- a/src/main/java/com/simibubi/create/foundation/block/IHaveColoredVertices.java +++ b/src/main/java/com/simibubi/create/foundation/block/IHaveColoredVertices.java @@ -1,7 +1,19 @@ package com.simibubi.create.foundation.block; -public interface IHaveColoredVertices { +import com.simibubi.create.foundation.block.render.ColoredVertexModel; + +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public interface IHaveColoredVertices extends IHaveCustomBlockModel { public int getColor(float x, float y, float z); + @Override + @OnlyIn(Dist.CLIENT) + default IBakedModel createModel(IBakedModel original) { + return new ColoredVertexModel(original, this); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockModel.java b/src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockModel.java new file mode 100644 index 000000000..40d6920be --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/block/IHaveCustomBlockModel.java @@ -0,0 +1,14 @@ +package com.simibubi.create.foundation.block; + +import javax.annotation.Nullable; + +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public interface IHaveCustomBlockModel { + + @OnlyIn(value = Dist.CLIENT) + public IBakedModel createModel(@Nullable IBakedModel original); + +} diff --git a/src/main/java/com/simibubi/create/foundation/block/RenderUtilityAxisBlock.java b/src/main/java/com/simibubi/create/foundation/block/RenderUtilityAxisBlock.java deleted file mode 100644 index 8465455aa..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/RenderUtilityAxisBlock.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.simibubi.create.foundation.block; - -import net.minecraft.block.RotatedPillarBlock; -import net.minecraft.block.material.Material; -import net.minecraft.util.BlockRenderLayer; - -public class RenderUtilityAxisBlock extends RotatedPillarBlock implements IRenderUtilityBlock { - - public RenderUtilityAxisBlock() { - super(Properties.create(Material.AIR)); - } - - @Override - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT; - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/block/RenderUtilityDirectionalBlock.java b/src/main/java/com/simibubi/create/foundation/block/RenderUtilityDirectionalBlock.java deleted file mode 100644 index 1fa79aff6..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/RenderUtilityDirectionalBlock.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.simibubi.create.foundation.block; - -import net.minecraft.block.material.Material; - -public class RenderUtilityDirectionalBlock extends ProperDirectionalBlock implements IRenderUtilityBlock { - - public RenderUtilityDirectionalBlock() { - super(Properties.create(Material.AIR)); - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java new file mode 100644 index 000000000..a6c8aaab4 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java @@ -0,0 +1,33 @@ +package com.simibubi.create.foundation.block; + +import net.minecraft.block.Blocks; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.tileentity.TileEntity; + +public abstract class SafeTileEntityRenderer extends TileEntityRenderer { + + @Override + public final void render(T te, double x, double y, double z, float partialTicks, int destroyStage) { + if (isInvalid(te)) + return; + renderWithGL(te, x, y, z, partialTicks, destroyStage); + } + + protected abstract void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage); + + @Override + public final void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, + BufferBuilder buffer) { + if (isInvalid(te)) + return; + renderFast(te, x, y, z, partialTicks, destroyStage, buffer); + } + + protected void renderFast(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { + } + + public boolean isInvalid(T te) { + return te.getBlockState().getBlock() == Blocks.AIR; + } +} diff --git a/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRendererFast.java b/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRendererFast.java new file mode 100644 index 000000000..13e7523bf --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRendererFast.java @@ -0,0 +1,25 @@ +package com.simibubi.create.foundation.block; + +import net.minecraft.block.Blocks; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.client.model.animation.TileEntityRendererFast; + +public abstract class SafeTileEntityRendererFast extends TileEntityRendererFast { + + @Override + public final void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, + BufferBuilder buffer) { + if (isInvalid(te)) + return; + renderFast(te, x, y, z, partialTicks, destroyStage, buffer); + } + + protected abstract void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage, + BufferBuilder buffer); + + public boolean isInvalid(T te) { + return te.getBlockState().getBlock() == Blocks.AIR; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/block/connected/IHaveConnectedTextures.java b/src/main/java/com/simibubi/create/foundation/block/connected/IHaveConnectedTextures.java index a818dfc7f..5404d1f46 100644 --- a/src/main/java/com/simibubi/create/foundation/block/connected/IHaveConnectedTextures.java +++ b/src/main/java/com/simibubi/create/foundation/block/connected/IHaveConnectedTextures.java @@ -1,7 +1,19 @@ package com.simibubi.create.foundation.block.connected; -public interface IHaveConnectedTextures { +import com.simibubi.create.foundation.block.IHaveCustomBlockModel; + +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public interface IHaveConnectedTextures extends IHaveCustomBlockModel { public ConnectedTextureBehaviour getBehaviour(); + @Override + @OnlyIn(Dist.CLIENT) + default IBakedModel createModel(IBakedModel original) { + return new CTModel(original, this); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java index 1dcf5d406..c49687163 100644 --- a/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.foundation.block.render; -import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.block.SafeTileEntityRendererFast; import com.simibubi.create.foundation.utility.SuperByteBuffer; import net.minecraft.block.BlockState; @@ -8,24 +8,24 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.client.model.animation.TileEntityRendererFast; -public abstract class ColoredOverlayTileEntityRenderer extends TileEntityRendererFast { +public abstract class ColoredOverlayTileEntityRenderer extends SafeTileEntityRendererFast { @Override - public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, + public void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { - SuperByteBuffer render = render(getWorld(), te.getPos(), getOverlayState(te), getColor(te, partialTicks)); + SuperByteBuffer render = render(getWorld(), te.getPos(), te.getBlockState(), getOverlayBuffer(te), + getColor(te, partialTicks)); buffer.putBulkData(render.translate(x, y, z).build()); } protected abstract int getColor(T te, float partialTicks); - protected abstract BlockState getOverlayState(T te); + protected abstract SuperByteBuffer getOverlayBuffer(T te); - public static SuperByteBuffer render(World world, BlockPos pos, BlockState state, int color) { + public static SuperByteBuffer render(World world, BlockPos pos, BlockState state, SuperByteBuffer buffer, + int color) { int packedLightmapCoords = state.getPackedLightmapCoords(world, pos); - SuperByteBuffer buffer = CreateClient.bufferCache.renderGenericBlockModel(state); return buffer.color(color).light(packedLightmapCoords); } diff --git a/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModel.java b/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModel.java index 15f7fa801..b942b5cf1 100644 --- a/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModel.java +++ b/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModel.java @@ -59,9 +59,10 @@ public abstract class CustomRenderedItemModel extends WrappedBakedModel { this.partials.put(name, null); } - public void loadPartials(ModelBakeEvent event) { + public CustomRenderedItemModel loadPartials(ModelBakeEvent event) { for (String name : partials.keySet()) partials.put(name, loadModel(event, name)); + return this; } private IBakedModel loadModel(ModelBakeEvent event, String name) { diff --git a/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java index 85f3f8281..cd7bc5fb8 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java @@ -8,10 +8,13 @@ import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.foundation.utility.ColorHelper; import net.minecraft.block.BlockState; +import net.minecraft.block.FireBlock; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; @@ -40,6 +43,15 @@ public class ScreenElementRenderer { } public static void renderBlock(Supplier transformsAndState, int color) { + render(transformsAndState, null, -1); + } + + public static void renderModel(Supplier transformsAndModel) { + render(null, transformsAndModel, -1); + } + + private static void render(Supplier transformsAndState, Supplier transformsAndModel, + int color) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); @@ -51,32 +63,47 @@ public class ScreenElementRenderer { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.translated(0, 0, 200); - BlockState toRender = transformsAndState.get(); - - GlStateManager.scaled(50, -50, 50); Minecraft mc = Minecraft.getInstance(); - mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher(); + IBakedModel modelToRender = null; + BlockState blockToRender = null; + boolean stateMode = transformsAndModel == null; + boolean fire = false; - if (color == -1) { - mc.getBlockRendererDispatcher().renderBlockBrightness(toRender, 1); + if (stateMode) { + blockToRender = transformsAndState.get(); + fire = (blockToRender.getBlock() instanceof FireBlock); + modelToRender = blockRenderer.getModelForState(blockToRender); } else { - GlStateManager.disableLighting(); - GlStateManager.rotated(90, 0, 1, 0); - Vec3d rgb = ColorHelper.getRGB(color); - mc.getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor( - mc.getBlockRendererDispatcher().getModelForState(toRender), 1, (float) rgb.x, (float) rgb.y, - (float) rgb.z); - GlStateManager.enableLighting(); + modelToRender = transformsAndModel.get(); } - if (!toRender.getFluidState().isEmpty()) { + GlStateManager.scaled(50, -50, 50); + mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + + + GlStateManager.pushMatrix(); + if (fire) { + blockRenderer.renderBlockBrightness(blockToRender, 1); + } else { + GlStateManager.rotated(90, 0, 1, 0); + if (color == -1) { + blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1); + } else { + Vec3d rgb = ColorHelper.getRGB(color); + blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, (float) rgb.x, + (float) rgb.y, (float) rgb.z); + } + } + GlStateManager.popMatrix(); + + if (stateMode && !blockToRender.getFluidState().isEmpty()) { RenderHelper.disableStandardItemLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.setTranslation(0, -300, 0); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - mc.getBlockRendererDispatcher().renderFluid(new BlockPos(0, 300, 0), mc.world, bufferbuilder, - toRender.getFluidState()); + blockRenderer.renderFluid(new BlockPos(0, 300, 0), mc.world, bufferbuilder, blockToRender.getFluidState()); Tessellator.getInstance().draw(); bufferbuilder.setTranslation(0, 0, 0); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java b/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java index e0613c64e..99b234100 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java +++ b/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java @@ -91,7 +91,10 @@ public class AllShapes { makeCuboidShape(0, 14, 0, 16, 16, 16)), BASIN_BLOCK_SHAPE = VoxelShapes.or( makeCuboidShape(2, 0, 2, 14, 2, 14), - makeCuboidShape(0, 2, 0, 16, 13, 16)), + VoxelShapes.combine( + makeCuboidShape(0, 2, 0, 16, 13, 16), + makeCuboidShape(2, 5, 2, 14, 14, 14), + IBooleanFunction.ONLY_FIRST)), CRUSHING_WHEEL_COLLISION_SHAPE = makeCuboidShape(0, 0, 0, 16, 22, 16), MECHANICAL_PROCESSOR_SHAPE = VoxelShapes.combineAndSimplify( VoxelShapes.fullCube(), diff --git a/src/main/java/com/simibubi/create/foundation/utility/AngleHelper.java b/src/main/java/com/simibubi/create/foundation/utility/AngleHelper.java index d6c6c9fb9..65d3bb133 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/AngleHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/AngleHelper.java @@ -11,5 +11,13 @@ public class AngleHelper { angle = -angle; return angle; } - + + public static float verticalAngle(Direction facing) { + return facing == Direction.UP ? -90 : facing == Direction.DOWN ? 90 : 0; + } + + public static float rad(float angle) { + return (float) (angle / 180 * Math.PI); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java b/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java index 8fa4791b8..7c07ccd8d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java +++ b/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java @@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL11; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import com.simibubi.create.AllBlockPartials; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; @@ -28,22 +29,29 @@ public class SuperByteBufferCache { } public static final Compartment GENERIC_TILE = new Compartment<>(); + public static final Compartment PARTIAL = new Compartment<>(); + Map, Cache> cache; public SuperByteBufferCache() { cache = new HashMap<>(); registerCompartment(GENERIC_TILE); + registerCompartment(PARTIAL); } - public SuperByteBuffer renderGenericBlockModel(BlockState toRender) { + public SuperByteBuffer renderBlock(BlockState toRender) { return getGeneric(toRender, () -> standardBlockRender(toRender)); } + + public SuperByteBuffer renderPartial(AllBlockPartials partial, BlockState referenceState) { + return get(PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState)); + } - public SuperByteBuffer renderBlockState(Compartment compartment, BlockState toRender) { + public SuperByteBuffer renderBlockIn(Compartment compartment, BlockState toRender) { return get(compartment, toRender, () -> standardBlockRender(toRender)); } - public SuperByteBuffer getGeneric(BlockState key, Supplier supplier) { + SuperByteBuffer getGeneric(BlockState key, Supplier supplier) { return get(GENERIC_TILE, key, supplier); } @@ -67,18 +75,22 @@ public class SuperByteBufferCache { } private SuperByteBuffer standardBlockRender(BlockState renderedState) { + BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); + return standardModelRender(dispatcher.getModelForState(renderedState), renderedState); + } + + private SuperByteBuffer standardModelRender(IBakedModel model, BlockState referenceState) { BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer(); - IBakedModel originalModel = dispatcher.getModelForState(renderedState); BufferBuilder builder = new BufferBuilder(0); Random random = new Random(); - + builder.setTranslation(0, 1, 0); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - blockRenderer.renderModelFlat(Minecraft.getInstance().world, originalModel, renderedState, BlockPos.ZERO.down(), + blockRenderer.renderModelFlat(Minecraft.getInstance().world, model, referenceState, BlockPos.ZERO.down(), builder, true, random, 42, EmptyModelData.INSTANCE); builder.finishDrawing(); - + return new SuperByteBuffer(builder.getByteBuffer()); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index 43f0caac4..b80726221 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -55,6 +55,7 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick protected boolean initNetwork; // Client + int overStressedTime; float overStressedEffect; public KineticTileEntity(TileEntityType typeIn) { @@ -168,15 +169,8 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick public void readClientUpdate(CompoundNBT tag) { boolean overStressedBefore = overStressed; super.readClientUpdate(tag); - if (overStressedBefore != overStressed && speed != 0) { - if (overStressed) { - overStressedEffect = 1; - spawnEffect(ParticleTypes.SMOKE, 0.2f, 5); - } else { - overStressedEffect = -1; - spawnEffect(ParticleTypes.CLOUD, .075f, 2); - } - } + if (overStressedBefore != overStressed && speed != 0) + overStressedTime = overStressedTime == 0 ? 2 : 0; } public boolean isSource() { @@ -284,6 +278,16 @@ public abstract class KineticTileEntity extends SmartTileEntity implements ITick super.tick(); if (world.isRemote) { + if (overStressedTime > 0) + if (--overStressedTime == 0) + if (overStressed) { + overStressedEffect = 1; + spawnEffect(ParticleTypes.SMOKE, 0.2f, 5); + } else { + overStressedEffect = -1; + spawnEffect(ParticleTypes.CLOUD, .075f, 2); + } + if (overStressedEffect != 0) { overStressedEffect -= overStressedEffect * .1f; if (Math.abs(overStressedEffect) < 1 / 128f) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java index 9d42f66ad..99a637713 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.base; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.block.SafeTileEntityRendererFast; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.SuperByteBuffer; @@ -14,31 +15,35 @@ import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.model.animation.TileEntityRendererFast; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber(value = Dist.CLIENT) -public class KineticTileEntityRenderer extends TileEntityRendererFast { +public class KineticTileEntityRenderer extends SafeTileEntityRendererFast { public static final Compartment KINETIC_TILE = new Compartment<>(); public static boolean rainbowMode = false; @Override - public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { - renderRotatingKineticBlock(te, getWorld(), getRenderedBlockState(te), x, y, z, buffer); + renderRotatingBuffer(te, getWorld(), getRotatedModel(te), x, y, z, buffer); } public static void renderRotatingKineticBlock(KineticTileEntity te, World world, BlockState renderedState, double x, double y, double z, BufferBuilder buffer) { - SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, renderedState); - buffer.putBulkData(standardKineticRotationTransform(superByteBuffer, te, world).translate(x, y, z).build()); + SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState); + renderRotatingBuffer(te, world, superByteBuffer, x, y, z, buffer); + } + + public static void renderRotatingBuffer(KineticTileEntity te, World world, SuperByteBuffer superBuffer, double x, + double y, double z, BufferBuilder buffer) { + buffer.putBulkData(standardKineticRotationTransform(superBuffer, te, world).translate(x, y, z).build()); } public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) { float time = AnimationTickHolder.getRenderTick(); float offset = getRotationOffsetForPosition(te, pos, axis); - float angle = ((time * te.getSpeed() * 3f/10 + offset) % 360) / 180 * (float) Math.PI; + float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI; return angle; } @@ -63,8 +68,8 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast 0) + if (te.overStressedEffect != 0) + if (te.overStressedEffect > 0) buffer.color(ColorHelper.mixColors(white, 0xFF0000, te.overStressedEffect)); else buffer.color(ColorHelper.mixColors(white, 0x00FFBB, -te.overStressedEffect)); @@ -89,4 +94,8 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast builder) { - builder.add(FACING); - super.fillStateContainer(builder); - } - - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/DrillTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/DrillTileEntityRenderer.java index 5b15788c4..95e542f1c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/DrillTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/DrillTileEntityRenderer.java @@ -2,8 +2,7 @@ package com.simibubi.create.modules.contraptions.components.actors; import static net.minecraft.state.properties.BlockStateProperties.FACING; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.VecHelper; @@ -18,17 +17,17 @@ import net.minecraft.util.Direction.Axis; public class DrillTileEntityRenderer extends KineticTileEntityRenderer { @Override - protected BlockState getRenderedBlockState(KineticTileEntity te) { - return getRenderedBlockState(te.getBlockState()); + protected SuperByteBuffer getRotatedModel(KineticTileEntity te) { + return getRotatingModel(te.getBlockState()); } - private static BlockState getRenderedBlockState(BlockState state) { - return AllBlocks.DRILL_HEAD.get().getDefaultState().with(FACING, state.get(FACING)); + protected static SuperByteBuffer getRotatingModel(BlockState state) { + return AllBlockPartials.DRILL.renderOnDirectional(state); } public static SuperByteBuffer renderInContraption(MovementContext context) { BlockState state = context.state; - SuperByteBuffer buffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, getRenderedBlockState(state)); + SuperByteBuffer buffer = getRotatingModel(state); float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, state.get(FACING).getOpposite()) ? context.getAnimationSpeed() diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterBlock.java index 8194ccdc3..765fd4d6c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterBlock.java @@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.components.actors; import java.util.List; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.block.IRenderUtilityBlock; import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.VecHelper; @@ -220,23 +219,4 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha return Blocks.AIR.getDefaultState(); } - public static class HarvesterBladeBlock extends HorizontalBlock implements IRenderUtilityBlock { - - public HarvesterBladeBlock() { - super(Properties.from(Blocks.AIR)); - } - - @Override - protected void fillStateContainer(Builder builder) { - builder.add(HORIZONTAL_FACING); - super.fillStateContainer(builder); - } - - @Override - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.SOLID; - } - - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java index 93db412eb..2941fab08 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java @@ -1,10 +1,9 @@ package com.simibubi.create.modules.contraptions.components.actors; -import static com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer.KINETIC_TILE; import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.block.SafeTileEntityRendererFast; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.VecHelper; @@ -12,16 +11,15 @@ import com.simibubi.create.modules.contraptions.components.contraptions.IHaveMov import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class HarvesterTileEntityRenderer extends TileEntityRenderer { +public class HarvesterTileEntityRenderer extends SafeTileEntityRendererFast { @Override - public void renderTileEntityFast(HarvesterTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(HarvesterTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { SuperByteBuffer superBuffer = renderHead(getWorld(), te.getPos(), te.getBlockState(), 0); superBuffer.translate(x, y, z).renderInto(buffer); @@ -39,10 +37,7 @@ public class HarvesterTileEntityRenderer extends TileEntityRenderer capability = crafter diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java index 871da3ed3..605c1c2bc 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crafter/MechanicalCrafterTileEntityRenderer.java @@ -1,15 +1,17 @@ package com.simibubi.create.modules.contraptions.components.crafter; +import static com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; +import static com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer.standardKineticRotationTransform; + import com.mojang.blaze3d.platform.GlStateManager; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.block.render.SpriteShifter; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.TessellatorHelper; -import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase; import com.simibubi.create.modules.contraptions.components.crafter.RecipeGridHandler.GroupedItems; @@ -19,10 +21,8 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; -import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; @@ -30,20 +30,16 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @SuppressWarnings("deprecation") -public class MechanicalCrafterTileEntityRenderer extends TileEntityRenderer { +public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer { public static SpriteShiftEntry animatedTexture = SpriteShifter.get("block/crafter_thingies", "block/crafter_thingies"); @Override - public void render(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks, + public void renderWithGL(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { - super.render(te, x, y, z, partialTicks, destroyStage); - if (!AllBlocks.MECHANICAL_CRAFTER.typeOf(te.getBlockState())) - return; - GlStateManager.pushMatrix(); - Direction facing = te.getBlockState().get(MechanicalCrafterBlock.HORIZONTAL_FACING); + Direction facing = te.getBlockState().get(HORIZONTAL_FACING); Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.58).add(.5, .5, .5); if (te.phase == Phase.EXPORTING) { @@ -137,24 +133,27 @@ public class MechanicalCrafterTileEntityRenderer extends TileEntityRenderer { +public class DeployerTileEntityRenderer extends SafeTileEntityRenderer { @Override - public void render(DeployerTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { - if (!AllBlocks.DEPLOYER.typeOf(te.getBlockState())) - return; - + public void renderWithGL(DeployerTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { renderItem(te, x, y, z, partialTicks); FilteringRenderer.renderOnTileEntity(te, x, y, z, partialTicks, destroyStage); renderComponents(te, x, y, z, partialTicks); @@ -87,7 +84,7 @@ public class DeployerTileEntityRenderer extends TileEntityRenderer builder) { - builder.add(HORIZONTAL_FACING); - super.fillStateContainer(builder); - } - } - @Override public BlockItem getCustomItem(net.minecraft.item.Item.Properties properties) { return new BasinOperatorBlockItem(AllBlocks.MECHANICAL_PRESS, properties); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntityRenderer.java index ecd5a0c3b..53997a1d9 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/press/MechanicalPressTileEntityRenderer.java @@ -2,8 +2,8 @@ package com.simibubi.create.modules.contraptions.components.press; import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; @@ -16,16 +16,16 @@ import net.minecraft.util.math.BlockPos; public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer { @Override - public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { - super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer); + super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer); - BlockState state = getRenderedHeadBlockState(te); BlockPos pos = te.getPos(); - int packedLightmapCoords = state.getPackedLightmapCoords(getWorld(), pos); + BlockState blockState = te.getBlockState(); + int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), pos); float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks); - SuperByteBuffer headRender = CreateClient.bufferCache.renderGenericBlockModel(state); + SuperByteBuffer headRender = AllBlockPartials.MECHANICAL_PRESS_HEAD.renderOnHorizontal(blockState); headRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer); } @@ -35,9 +35,4 @@ public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer te.getBlockState().get(HORIZONTAL_FACING).getAxis()); } - protected BlockState getRenderedHeadBlockState(KineticTileEntity te) { - return AllBlocks.MECHANICAL_PRESS_HEAD.get().getDefaultState().with(HORIZONTAL_FACING, - te.getBlockState().get(HORIZONTAL_FACING)); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/saw/SawTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/saw/SawTileEntityRenderer.java index 019143b5b..798468128 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/saw/SawTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/saw/SawTileEntityRenderer.java @@ -4,8 +4,12 @@ import static net.minecraft.state.properties.BlockStateProperties.AXIS; import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; +import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; +import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; @@ -17,17 +21,17 @@ import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; +import net.minecraft.util.Rotation; import net.minecraft.util.math.MathHelper; @SuppressWarnings("deprecation") -public class SawTileEntityRenderer extends TileEntityRenderer { +public class SawTileEntityRenderer extends SafeTileEntityRenderer { @Override - public void render(SawTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { + public void renderWithGL(SawTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { renderItems(te, x, y, z, partialTicks); FilteringRenderer.renderOnTileEntity(te, x, y, z, partialTicks, destroyStage); renderShaft(te, x, y, z); @@ -36,7 +40,7 @@ public class SawTileEntityRenderer extends TileEntityRenderer { protected void renderShaft(SawTileEntity te, double x, double y, double z) { TessellatorHelper.prepareFastRender(); TessellatorHelper.begin(DefaultVertexFormats.BLOCK); - KineticTileEntityRenderer.renderRotatingKineticBlock(te, getWorld(), getRenderedBlockState(te), x, y, z, + KineticTileEntityRenderer.renderRotatingBuffer(te, getWorld(), getRotatedModel(te), x, y, z, Tessellator.getInstance().getBuffer()); TessellatorHelper.draw(); } @@ -74,11 +78,16 @@ public class SawTileEntityRenderer extends TileEntityRenderer { } } + protected SuperByteBuffer getRotatedModel(KineticTileEntity te) { + BlockState state = te.getBlockState(); + if (state.get(FACING).getAxis().isHorizontal()) + return AllBlockPartials.SHAFT_HALF.renderOnDirectional(state.rotate(Rotation.CLOCKWISE_180)); + return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE, + getRenderedBlockState(te)); + } + protected BlockState getRenderedBlockState(KineticTileEntity te) { BlockState state = te.getBlockState(); - if (state.get(FACING).getAxis().isHorizontal()) { - return AllBlocks.SHAFT_HALF.block.getDefaultState().with(FACING, state.get(FACING).getOpposite()); - } return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state)); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntityRenderer.java index 11556f1d9..1d3af3d9e 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinTileEntityRenderer.java @@ -3,11 +3,11 @@ package com.simibubi.create.modules.contraptions.processing; import java.util.Random; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -15,12 +15,10 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; @SuppressWarnings("deprecation") -public class BasinTileEntityRenderer extends TileEntityRenderer { +public class BasinTileEntityRenderer extends SafeTileEntityRenderer { @Override - public void render(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) { - super.render(basin, x, y, z, partialTicks, destroyStage); - + public void renderWithGL(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); BlockPos pos = basin.getPos(); GlStateManager.translated(x + .5, y + .2f, z + .5); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntityRenderer.java index 253804b01..d49072b33 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntityRenderer.java @@ -1,7 +1,7 @@ package com.simibubi.create.modules.contraptions.redstone; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.block.SafeTileEntityRendererFast; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.SuperByteBuffer; @@ -10,36 +10,28 @@ import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.state.properties.AttachFace; import net.minecraft.util.Direction.Axis; -import net.minecraftforge.client.model.animation.TileEntityRendererFast; -public class AnalogLeverTileEntityRenderer extends TileEntityRendererFast { +public class AnalogLeverTileEntityRenderer extends SafeTileEntityRendererFast { @Override - public void renderTileEntityFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { BlockState leverState = te.getBlockState(); - if (!AllBlocks.ANALOG_LEVER.typeOf(leverState)) - return; - int lightCoords = leverState.getPackedLightmapCoords(getWorld(), te.getPos()); float state = te.clientState.get(partialTicks); // Handle - SuperByteBuffer handle = render(AllBlocks.ANALOG_LEVER_HANDLE); + SuperByteBuffer handle = AllBlockPartials.ANALOG_LEVER_HANDLE.renderOn(leverState); float angle = (float) ((state / 15) * 90 / 180 * Math.PI); handle.translate(-1 / 2f, -1 / 16f, -1 / 2f).rotate(Axis.X, angle).translate(1 / 2f, 1 / 16f, 1 / 2f); transform(handle, leverState).light(lightCoords).translate(x, y, z).renderInto(buffer); // Indicator int color = ColorHelper.mixColors(0x2C0300, 0xCD0000, state / 15f); - SuperByteBuffer indicator = transform(render(AllBlocks.ANALOG_LEVER_INDICATOR), leverState); + SuperByteBuffer indicator = transform(AllBlockPartials.ANALOG_LEVER_INDICATOR.renderOn(leverState), leverState); indicator.light(lightCoords).translate(x, y, z).color(color).renderInto(buffer); } - private SuperByteBuffer render(AllBlocks model) { - return CreateClient.bufferCache.renderGenericBlockModel(model.getDefault()); - } - private SuperByteBuffer transform(SuperByteBuffer buffer, BlockState leverState) { AttachFace face = leverState.get(AnalogLeverBlock.FACE); float rX = face == AttachFace.FLOOR ? 0 : face == AttachFace.WALL ? 90 : 180; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java index a57d91648..e44b53fc0 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java @@ -5,15 +5,16 @@ import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FAC import java.util.Random; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.block.render.SpriteShifter; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.IndependentShadowRenderer; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.TessellatorHelper; -import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; @@ -25,39 +26,35 @@ import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; @SuppressWarnings("deprecation") -public class BeltTileEntityRenderer extends TileEntityRenderer { +public class BeltTileEntityRenderer extends SafeTileEntityRenderer { private static SpriteShiftEntry animatedTexture; @Override - public void render(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { - super.render(te, x, y, z, partialTicks, destroyStage); - + public void renderWithGL(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { TessellatorHelper.prepareFastRender(); TessellatorHelper.begin(DefaultVertexFormats.BLOCK); renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, Tessellator.getInstance().getBuffer()); TessellatorHelper.draw(); - renderItems(te, x, y, z, partialTicks); } @Override - public void renderTileEntityFast(BeltTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { - if (te.hasPulley()) - KineticTileEntityRenderer.renderRotatingKineticBlock(te, getWorld(), getPulleyState(te), x, y, z, buffer); + BlockState blockState = te.getBlockState(); + if (!AllBlocks.BELT.typeOf(blockState)) + return; BlockState renderedState = getBeltState(te); - SuperByteBuffer beltBuffer = CreateClient.bufferCache.renderBlockState(KineticTileEntityRenderer.KINETIC_TILE, + SuperByteBuffer beltBuffer = CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE, renderedState); beltBuffer.color(te.color == -1 ? 0x808080 : te.color); @@ -68,7 +65,7 @@ public class BeltTileEntityRenderer extends TileEntityRenderer { animatedTexture = SpriteShifter.get("block/belt", "block/belt_animated"); if (speed != 0) { float time = AnimationTickHolder.getRenderTick() - * te.getBlockState().get(HORIZONTAL_FACING).getAxisDirection().getOffset(); + * blockState.get(HORIZONTAL_FACING).getAxisDirection().getOffset(); if (renderedState.get(BeltBlock.HORIZONTAL_FACING).getAxis() == Axis.X) speed = -speed; int textureIndex = (int) ((speed * time / 36) % 16); @@ -81,8 +78,17 @@ public class BeltTileEntityRenderer extends TileEntityRenderer { beltBuffer.shiftUVtoSheet(animatedTexture.getOriginal(), animatedTexture.getTarget(), 0, 0); } - int packedLightmapCoords = te.getBlockState().getPackedLightmapCoords(getWorld(), te.getPos()); + int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), te.getPos()); beltBuffer.light(packedLightmapCoords).translate(x, y, z).renderInto(buffer); + + if (te.hasPulley()) { + SuperByteBuffer superBuffer = AllBlockPartials.BELT_PULLEY.renderOn(blockState); + Axis axis = blockState.get(BeltBlock.HORIZONTAL_FACING).getAxis(); + superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2)); + superBuffer.rotateCentered(Axis.Y, (float) (axis == Axis.X ? 0 : Math.PI / 2)); + KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z) + .renderInto(buffer); + } } protected void renderItems(BeltTileEntity te, double x, double y, double z, float partialTicks) { @@ -175,11 +181,6 @@ public class BeltTileEntityRenderer extends TileEntityRenderer { } } - protected BlockState getPulleyState(KineticTileEntity te) { - return AllBlocks.BELT_PULLEY.get().getDefaultState().with(BlockStateProperties.AXIS, - ((IRotate) AllBlocks.BELT.get()).getRotationAxis(te.getBlockState())); - } - protected BlockState getBeltState(KineticTileEntity te) { return te.getBlockState().with(BeltBlock.CASING, false); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTunnelTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTunnelTileEntityRenderer.java index 3e070144f..de73d0b78 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTunnelTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTunnelTileEntityRenderer.java @@ -1,28 +1,24 @@ package com.simibubi.create.modules.contraptions.relays.belt; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.block.SafeTileEntityRendererFast; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.SuperByteBuffer; -import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import net.minecraftforge.client.model.animation.TileEntityRendererFast; -public class BeltTunnelTileEntityRenderer extends TileEntityRendererFast { +public class BeltTunnelTileEntityRenderer extends SafeTileEntityRendererFast { @Override - public void renderTileEntityFast(BeltTunnelTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(BeltTunnelTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { - BlockState flapState = AllBlocks.BELT_TUNNEL_FLAP.get().getDefaultState(); - BlockState indicatorState = AllBlocks.BELT_TUNNEL_INDICATOR.get().getDefaultState(); - SuperByteBuffer flapBuffer = CreateClient.bufferCache.renderGenericBlockModel(flapState); - SuperByteBuffer indicatorBuffer = CreateClient.bufferCache.renderGenericBlockModel(indicatorState); + SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState()); + SuperByteBuffer indicatorBuffer = AllBlockPartials.BELT_TUNNEL_INDICATOR.renderOn(te.getBlockState()); BlockPos pos = te.getPos(); World world = getWorld(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/ShaftHalfBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/ShaftHalfBlock.java deleted file mode 100644 index d32725587..000000000 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/elementary/ShaftHalfBlock.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.simibubi.create.modules.contraptions.relays.elementary; - -import com.simibubi.create.foundation.block.IHaveNoBlockItem; -import com.simibubi.create.foundation.block.ProperDirectionalBlock; - -import net.minecraft.block.Blocks; - -public class ShaftHalfBlock extends ProperDirectionalBlock implements IHaveNoBlockItem { - - public ShaftHalfBlock() { - super(Properties.from(Blocks.AIR)); - } - -} diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/SplitShaftTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/SplitShaftTileEntityRenderer.java index 03fd91311..e2995ce43 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/SplitShaftTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/SplitShaftTileEntityRenderer.java @@ -1,13 +1,11 @@ package com.simibubi.create.modules.contraptions.relays.encased; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; -import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; @@ -17,10 +15,9 @@ import net.minecraft.util.math.BlockPos; public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer { @Override - public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS); - final BlockState defaultState = AllBlocks.SHAFT_HALF.get().getDefaultState(); final BlockPos pos = te.getPos(); float time = AnimationTickHolder.getRenderTick(); @@ -40,8 +37,8 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer { angle += offset; angle = angle / 180f * (float) Math.PI; - BlockState state = defaultState.with(BlockStateProperties.FACING, direction); - SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, state); + SuperByteBuffer superByteBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), + direction); kineticRotationTransform(superByteBuffer, te, axis, angle, getWorld()); superByteBuffer.translate(x, y, z).renderInto(buffer); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java index 9f4ed10af..185d3440b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeBlock.java @@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.relays.gauge; import java.util.Random; -import com.simibubi.create.foundation.block.RenderUtilityBlock; import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Lang; @@ -16,9 +15,6 @@ import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.item.BlockItemUseContext; import net.minecraft.particles.RedstoneParticleData; -import net.minecraft.state.EnumProperty; -import net.minecraft.state.IProperty; -import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; @@ -161,13 +157,4 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { return AllShapes.GAUGE.get(state.get(FACING), state.get(AXIS_ALONG_FIRST_COORDINATE)); } - public static class Head extends RenderUtilityBlock { - public static final IProperty TYPE = EnumProperty.create("type", Type.class); - - @Override - protected void fillStateContainer(Builder builder) { - super.fillStateContainer(builder.add(TYPE)); - } - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java index 23c74edd7..ca504251d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeTileEntityRenderer.java @@ -1,11 +1,12 @@ package com.simibubi.create.modules.contraptions.relays.gauge; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; +import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; @@ -23,21 +24,16 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer { } @Override - public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { BlockState gaugeState = te.getBlockState(); - if (!(gaugeState.getBlock() instanceof GaugeBlock)) - return; - - super.renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, buffer); + super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer); GaugeTileEntity gaugeTE = (GaugeTileEntity) te; int lightCoords = gaugeState.getPackedLightmapCoords(getWorld(), te.getPos()); - BlockState head = AllBlocks.GAUGE_HEAD.get().getDefaultState().with(GaugeBlock.Head.TYPE, type); - BlockState dial = AllBlocks.GAUGE_DIAL.get().getDefaultState(); - - SuperByteBuffer headBuffer = CreateClient.bufferCache.renderGenericBlockModel(head); - SuperByteBuffer dialBuffer = CreateClient.bufferCache.renderGenericBlockModel(dial); + SuperByteBuffer headBuffer = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED + : AllBlockPartials.GAUGE_HEAD_STRESS).renderOn(gaugeState); + SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState); for (Direction facing : Direction.values()) { if (!((GaugeBlock) gaugeState.getBlock()).shouldRenderHeadOnFace(getWorld(), te.getPos(), gaugeState, diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/GearboxTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/GearboxTileEntityRenderer.java index 188e1ada2..b3b1be8fa 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/GearboxTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/GearboxTileEntityRenderer.java @@ -1,13 +1,11 @@ package com.simibubi.create.modules.contraptions.relays.gearbox; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.CreateClient; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; -import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; @@ -17,19 +15,18 @@ import net.minecraft.util.math.BlockPos; public class GearboxTileEntityRenderer extends KineticTileEntityRenderer { @Override - public void renderTileEntityFast(KineticTileEntity te, double x, double y, double z, float partialTicks, + public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer) { final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS); final BlockPos pos = te.getPos(); float time = AnimationTickHolder.getRenderTick(); - final BlockState defaultState = AllBlocks.SHAFT_HALF.get().getDefaultState(); for (Direction direction : Direction.values()) { final Axis axis = direction.getAxis(); if (boxAxis == axis) continue; - BlockState state = defaultState.with(BlockStateProperties.FACING, direction); + SuperByteBuffer shaft = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), direction); float offset = getRotationOffsetForPosition(te, pos, axis); float angle = (time * te.getSpeed() * 3f / 10) % 360; @@ -45,9 +42,8 @@ public class GearboxTileEntityRenderer extends KineticTileEntityRenderer { angle += offset; angle = angle / 180f * (float) Math.PI; - SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockState(KINETIC_TILE, state); - kineticRotationTransform(superByteBuffer, te, axis, angle, getWorld()); - superByteBuffer.translate(x, y, z).renderInto(buffer); + kineticRotationTransform(shaft, te, axis, angle, getWorld()); + shaft.translate(x, y, z).renderInto(buffer); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/blockzapper/BlockzapperItem.java b/src/main/java/com/simibubi/create/modules/curiosities/blockzapper/BlockzapperItem.java index 8e4be547d..7223bc822 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/blockzapper/BlockzapperItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/blockzapper/BlockzapperItem.java @@ -142,7 +142,6 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel { setTier(c, ComponentTier.Chromatic, gunWithPurpurStuff); items.add(gunWithPurpurStuff); } - super.fillItemGroup(group, items); } @Override diff --git a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java index 130af124a..da13e810e 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import com.simibubi.create.foundation.block.IHaveCustomBlockModel; import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.IWithTileEntity; @@ -13,6 +14,7 @@ import net.minecraft.block.FourWayBlock; import net.minecraft.block.PaneBlock; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; +import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.IFluidState; @@ -44,7 +46,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class WindowInABlockBlock extends PaneBlock - implements IWithTileEntity, IHaveNoBlockItem { + implements IWithTileEntity, IHaveNoBlockItem, IHaveCustomBlockModel { public WindowInABlockBlock() { super(Properties.create(Material.ROCK)); @@ -217,4 +219,10 @@ public class WindowInABlockBlock extends PaneBlock return false; } + @Override + @OnlyIn(Dist.CLIENT) + public IBakedModel createModel(IBakedModel original) { + return new WindowInABlockModel(original); + } + } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java index b9a537b2d..dbefcdb41 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java @@ -2,17 +2,15 @@ package com.simibubi.create.modules.logistics.block.belts; import com.mojang.blaze3d.platform.GLX; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.state.properties.BlockStateProperties; -public class BeltObserverTileEntityRenderer extends TileEntityRenderer { +public class BeltObserverTileEntityRenderer extends SafeTileEntityRenderer { @Override - public void render(BeltObserverTileEntity tileEntityIn, double x, double y, double z, float partialTicks, + public void renderWithGL(BeltObserverTileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { - super.render(tileEntityIn, x, y, z, partialTicks, destroyStage); - int i = tileEntityIn.getWorld().getCombinedLight(tileEntityIn.getPos().up() .offset(tileEntityIn.getBlockState().get(BlockStateProperties.HORIZONTAL_FACING)), 0); int j = i % 65536; diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java index d6437b3cd..e7fedd434 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java @@ -1,10 +1,9 @@ package com.simibubi.create.modules.logistics.block.diodes; -import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRenderer; import com.simibubi.create.foundation.utility.ColorHelper; - -import net.minecraft.block.BlockState; +import com.simibubi.create.foundation.utility.SuperByteBuffer; public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRenderer { @@ -14,8 +13,8 @@ public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRender } @Override - protected BlockState getOverlayState(FlexpeaterTileEntity te) { - return AllBlocks.FLEXPEATER_INDICATOR.get().getDefaultState(); + protected SuperByteBuffer getOverlayBuffer(FlexpeaterTileEntity te) { + return AllBlockPartials.FLEXPEATER_INDICATOR.renderOn(te.getBlockState()); } } diff --git a/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java b/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java index b7799aa6a..5970ff60f 100644 --- a/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java +++ b/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java @@ -28,9 +28,7 @@ public class CTGlassBlock extends GlassBlock implements IHaveConnectedTextures { @OnlyIn(Dist.CLIENT) @Override public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { - return adjacentBlockState.getBlock() instanceof CTGlassBlock - ? (!state.canRenderInLayer(BlockRenderLayer.TRANSLUCENT) && side.getAxis().isHorizontal() - || state.getBlock() == adjacentBlockState.getBlock()) + return adjacentBlockState.getBlock() instanceof CTGlassBlock ? true : super.isSideInvisible(state, adjacentBlockState, side); } diff --git a/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java b/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java new file mode 100644 index 000000000..3884fd3aa --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java @@ -0,0 +1,26 @@ +package com.simibubi.create.modules.palettes; + +import com.simibubi.create.AllCTs; + +import net.minecraft.block.BlockState; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.Direction; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public class CTWindowBlock extends VerticalCTGlassBlock { + + public CTWindowBlock(AllCTs spriteShift, boolean hasAlpha) { + super(spriteShift, hasAlpha); + } + + @OnlyIn(Dist.CLIENT) + @Override + public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { + return adjacentBlockState.getBlock() instanceof CTGlassBlock + ? (!state.canRenderInLayer(BlockRenderLayer.TRANSLUCENT) && side.getAxis().isHorizontal() + || state.getBlock() == adjacentBlockState.getBlock()) + : super.isSideInvisible(state, adjacentBlockState, side); + } + +} diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java index 9f172a79f..90951a9b1 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonRenderer.java @@ -3,20 +3,27 @@ package com.simibubi.create.modules.schematics.block; import java.util.Random; import com.mojang.blaze3d.platform.GlStateManager; -import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; +import com.simibubi.create.foundation.utility.SuperByteBuffer; +import com.simibubi.create.foundation.utility.TessellatorHelper; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.particles.ParticleTypes; +import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -public class SchematicannonRenderer extends TileEntityRenderer { +public class SchematicannonRenderer extends SafeTileEntityRenderer { @Override - public void render(SchematicannonTileEntity tileEntityIn, double x, double y, double z, float partialTicks, + public void renderWithGL(SchematicannonTileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); @@ -100,38 +107,40 @@ public class SchematicannonRenderer extends TileEntityRendererb@?P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0n$lCK~y+Tg;KkU zDnSrEGrmQ|2N?JS6$8OoO-%d=jTi18_%DXCu#ur4Xl9_srUrr_DvBaLP<+kh6wY2o z?z#tRx~ID8)T!!L`u)E4cs#J*@8R?LFdPmMiA1nouaQotF_}z2Y`0su-ELGW6-69R zD2+x#W8i!~hu`nVZnuNe>3kmJdryBL5I`oAF%r~jHH{lpRVB!5HcK_D)ha$kQEv4?_%|O-9TV2l}Z?mM#$xI z(gG!iLLnRu2TZ3^QNlTl$73+|6)J~ku~qRsgMJkn&mIx}-H0jm=Gp9Y9 z&5+GzMI!f$#RA9UQRHtn8?06