diff --git a/src/main/java/com/simibubi/create/AllEntities.java b/src/main/java/com/simibubi/create/AllEntities.java index 7da80aa5f..a32e96ac9 100644 --- a/src/main/java/com/simibubi/create/AllEntities.java +++ b/src/main/java/com/simibubi/create/AllEntities.java @@ -60,10 +60,11 @@ public enum AllEntities { } + @SuppressWarnings("unchecked") // TODO 1.15 this generic stuff is incompatible with the enum system - need strong types @OnlyIn(value = Dist.CLIENT) public static void registerRenderers() { // RenderingRegistry.registerEntityRenderingHandler(CardboardBoxEntity.class, CardboardBoxEntityRenderer::new); - RenderingRegistry.registerEntityRenderingHandler(ContraptionEntity.class, ContraptionEntityRenderer::new); + RenderingRegistry.registerEntityRenderingHandler((EntityType) CONTRAPTION.type, ContraptionEntityRenderer::new); } } diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 289cd0cdb..c93a4cb9a 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -169,7 +169,7 @@ public enum AllItems { } private static Properties defaultProperties(AllItems item) { - return includeInItemGroup().setTEISR(() -> item::getRenderer); + return includeInItemGroup().setISTER(() -> item::getRenderer); } private static int module() { diff --git a/src/main/java/com/simibubi/create/AllKeys.java b/src/main/java/com/simibubi/create/AllKeys.java index ffb5b4367..60bba93ca 100644 --- a/src/main/java/com/simibubi/create/AllKeys.java +++ b/src/main/java/com/simibubi/create/AllKeys.java @@ -54,7 +54,7 @@ public enum AllKeys { } public static boolean isKeyDown(int key) { - return GLFW.glfwGetKey(Minecraft.getInstance().mainWindow.getHandle(), key) != 0; + return GLFW.glfwGetKey(Minecraft.getInstance().getWindow().getHandle(), key) != 0; } public static boolean ctrlDown() { diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index f23f5cd83..d02f9d305 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -1,5 +1,6 @@ package com.simibubi.create; +import java.util.function.Function; import java.util.function.Supplier; import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer; @@ -88,6 +89,7 @@ import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity; import net.minecraft.block.Block; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; @@ -190,61 +192,62 @@ public enum AllTileEntities { @OnlyIn(Dist.CLIENT) public static void registerRenderers() { - bind(SchematicannonTileEntity.class, new SchematicannonRenderer()); + bind(SCHEMATICANNON, SchematicannonRenderer::new); - bind(ShaftTileEntity.class, new KineticTileEntityRenderer()); - bind(TurntableTileEntity.class, new KineticTileEntityRenderer()); - bind(MotorTileEntity.class, new MotorTileEntityRenderer()); - bind(EncasedShaftTileEntity.class, new EncasedShaftTileEntityRenderer()); - bind(AdjustablePulleyTileEntity.class, new EncasedShaftTileEntityRenderer()); - bind(DrillTileEntity.class, new DrillTileEntityRenderer()); - bind(SawTileEntity.class, new SawTileEntityRenderer()); - bind(EncasedFanTileEntity.class, new EncasedFanTileEntityRenderer()); - bind(GearboxTileEntity.class, new GearboxTileEntityRenderer()); - bind(GearshiftTileEntity.class, new SplitShaftTileEntityRenderer()); - bind(ClutchTileEntity.class, new SplitShaftTileEntityRenderer()); - bind(SequencedGearshiftTileEntity.class, new SplitShaftTileEntityRenderer()); - bind(BeltTileEntity.class, new BeltTileEntityRenderer()); - bind(WaterWheelTileEntity.class, new KineticTileEntityRenderer()); - bind(HandCrankTileEntity.class, new HandCrankTileEntityRenderer()); - bind(CuckooClockTileEntity.class, new CuckooClockRenderer()); - bind(AnalogLeverTileEntity.class, new AnalogLeverTileEntityRenderer()); + bind(SHAFT, KineticTileEntityRenderer::new); + bind(TURNTABLE, KineticTileEntityRenderer::new); + bind(MOTOR, MotorTileEntityRenderer::new); + bind(ENCASED_SHAFT, EncasedShaftTileEntityRenderer::new); + bind(ADJUSTABLE_PULLEY, EncasedShaftTileEntityRenderer::new); + bind(DRILL, DrillTileEntityRenderer::new); + bind(SAW, SawTileEntityRenderer::new); + bind(ENCASED_FAN, EncasedFanTileEntityRenderer::new); + bind(GEARBOX, GearboxTileEntityRenderer::new); + bind(GEARSHIFT, SplitShaftTileEntityRenderer::new); + bind(CLUTCH, SplitShaftTileEntityRenderer::new); + bind(SEQUENCED_GEARSHIFT, SplitShaftTileEntityRenderer::new); + bind(BELT, BeltTileEntityRenderer::new); + bind(WATER_WHEEL, KineticTileEntityRenderer::new); + bind(HAND_CRANK, HandCrankTileEntityRenderer::new); + bind(CUCKOO_CLOCK, CuckooClockRenderer::new); + bind(ANALOG_LEVER, AnalogLeverTileEntityRenderer::new); - bind(MechanicalPistonTileEntity.class, new MechanicalPistonTileEntityRenderer()); - bind(MechanicalBearingTileEntity.class, new BearingTileEntityRenderer()); - bind(ClockworkBearingTileEntity.class, new BearingTileEntityRenderer()); - bind(PulleyTileEntity.class, new PulleyRenderer()); - bind(HarvesterTileEntity.class, new HarvesterTileEntityRenderer()); + bind(MECHANICAL_PISTON, MechanicalPistonTileEntityRenderer::new); + bind(MECHANICAL_BEARING, BearingTileEntityRenderer::new); + bind(CLOCKWORK_BEARING, BearingTileEntityRenderer::new); + bind(ROPE_PULLEY, PulleyRenderer::new); + bind(HARVESTER, HarvesterTileEntityRenderer::new); - bind(CrushingWheelTileEntity.class, new KineticTileEntityRenderer()); - bind(MechanicalPressTileEntity.class, new MechanicalPressTileEntityRenderer()); - bind(MechanicalMixerTileEntity.class, new MechanicalMixerTileEntityRenderer()); - bind(MechanicalCrafterTileEntity.class, new MechanicalCrafterTileEntityRenderer()); - bind(SpeedGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.SPEED)); - bind(StressGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.STRESS)); - bind(BasinTileEntity.class, new BasinTileEntityRenderer()); - bind(DeployerTileEntity.class, new DeployerTileEntityRenderer()); - bind(FlywheelTileEntity.class, new FlywheelRenderer()); - bind(FurnaceEngineTileEntity.class, new EngineRenderer<>()); - bind(SpeedControllerTileEntity.class, new SpeedControllerRenderer()); + bind(CRUSHING_WHEEL, KineticTileEntityRenderer::new); + bind(MECHANICAL_PRESS, MechanicalPressTileEntityRenderer::new); + bind(MECHANICAL_MIXER, MechanicalMixerTileEntityRenderer::new); + bind(MECHANICAL_CRAFTER, MechanicalCrafterTileEntityRenderer::new); + bind(SPEED_GAUGE, disp -> new GaugeTileEntityRenderer(disp, GaugeBlock.Type.SPEED)); + bind(STRESS_GAUGE, disp -> new GaugeTileEntityRenderer(disp, GaugeBlock.Type.STRESS)); + bind(BASIN, BasinTileEntityRenderer::new); + bind(DEPLOYER, DeployerTileEntityRenderer::new); + bind(FLYWHEEL, FlywheelRenderer::new); + bind(FURNACE_ENGINE, EngineRenderer::new); + bind(ROTATION_SPEED_CONTROLLER, SpeedControllerRenderer::new); - bind(RedstoneLinkTileEntity.class, new SmartTileEntityRenderer<>()); - bind(ExtractorTileEntity.class, new SmartTileEntityRenderer<>()); - bind(LinkedExtractorTileEntity.class, new SmartTileEntityRenderer<>()); - bind(TransposerTileEntity.class, new SmartTileEntityRenderer<>()); - bind(LinkedTransposerTileEntity.class, new SmartTileEntityRenderer<>()); - bind(FunnelTileEntity.class, new SmartTileEntityRenderer<>()); - bind(BeltTunnelTileEntity.class, new BeltTunnelTileEntityRenderer()); - bind(BeltObserverTileEntity.class, new BeltObserverTileEntityRenderer()); - bind(FlexpeaterTileEntity.class, new FlexpeaterTileEntityRenderer()); + bind(REDSTONE_BRIDGE, SmartTileEntityRenderer::new); + bind(EXTRACTOR, SmartTileEntityRenderer::new); + bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new); + bind(TRANSPOSER, SmartTileEntityRenderer::new); + bind(LINKED_TRANSPOSER, SmartTileEntityRenderer::new); + bind(BELT_FUNNEL, SmartTileEntityRenderer::new); + bind(BELT_TUNNEL, BeltTunnelTileEntityRenderer::new); + bind(ENTITY_DETECTOR, BeltObserverTileEntityRenderer::new); + bind(FLEXPEATER, FlexpeaterTileEntityRenderer::new); -// bind(LogisticalControllerTileEntity.class, new LogisticalControllerTileEntityRenderer()); -// bind(LogisticiansTableTileEntity.class, new LogisticiansTableTileEntityRenderer()); +// bind(LogisticalController, LogisticalControllerTileEntityRenderer::new); +// bind(LogisticiansTable, LogisticiansTableTileEntityRenderer::new); } + @SuppressWarnings("unchecked") // TODO 1.15 this generic stuff is incompatible with the enum system - need strong types @OnlyIn(Dist.CLIENT) - private static void bind(Class clazz, TileEntityRenderer renderer) { - ClientRegistry.bindTileEntitySpecialRenderer(clazz, renderer); + private static void bind(AllTileEntities type, Function> renderer) { + ClientRegistry.bindTileEntityRenderer((TileEntityType) type.type, (Function>) renderer); } } diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 06882c481..11cfa0069 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -23,6 +23,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelShapes; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ModelResourceLocation; +import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; import net.minecraft.util.ResourceLocation; @@ -87,7 +88,7 @@ public class CreateClient { @OnlyIn(Dist.CLIENT) public static void onTextureStitch(TextureStitchEvent.Pre event) { - if (!event.getMap().getBasePath().equals("textures")) + if (!event.getMap().getId().equals(AtlasTexture.LOCATION_BLOCKS_TEXTURE)) return; event.addSprite(new ResourceLocation(Create.ID, "block/belt_animated")); diff --git a/src/main/java/com/simibubi/create/CreateItemGroup.java b/src/main/java/com/simibubi/create/CreateItemGroup.java index 726ce1675..3d884a950 100644 --- a/src/main/java/com/simibubi/create/CreateItemGroup.java +++ b/src/main/java/com/simibubi/create/CreateItemGroup.java @@ -60,7 +60,7 @@ public final class CreateItemGroup extends ItemGroup { continue; if (!item.module.isEnabled()) continue; - IBakedModel model = itemRenderer.getModelWithOverrides(item.asStack()); + IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, Minecraft.getInstance().player); if (model.isGui3d() != specialItems) continue; if (item.get() instanceof IAddedByOther) diff --git a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java index fb1d6ba23..dd1e33185 100644 --- a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java +++ b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java @@ -38,7 +38,7 @@ public class DoubleItemIcon implements IDrawable { secondaryStack = secondarySupplier.get(); } - RenderHelper.enableGUIStandardItemLighting(); + RenderHelper.enable(); RenderSystem.color4f(1, 1, 1, 1); RenderSystem.enableDepthTest(); RenderSystem.pushMatrix(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java index 2fe1c390e..1205eda1f 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java @@ -55,14 +55,14 @@ public class BlastingViaFanCategory extends ProcessingViaFanCategory state); RenderSystem.popMatrix(); RenderSystem.pushMatrix(); RenderSystem.translated(0, 200, 0); - RenderSystem.rotated(90, 1, 0, 0); - RenderSystem.rotated(270, 0, 0, 1); + RenderSystem.rotatef(90, 1, 0, 0); + RenderSystem.rotatef(270, 0, 0, 1); ScreenElementRenderer.renderBlock(() -> state); RenderSystem.popMatrix(); 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 30207d41b..6c4465c97 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 @@ -64,8 +64,8 @@ public abstract class ProcessingViaFanCategory> implements RenderSystem.enableDepthTest(); RenderSystem.translated(28, 18, 0); - RenderSystem.rotated(10.5, -1f, 0, 0); - RenderSystem.rotated(15.5, 0, 1, 0); + RenderSystem.rotatef(10.5f, -1f, 0, 0); + RenderSystem.rotatef(15.5f, 0, 1, 0); RenderSystem.scaled(.6f, .6f, .6f); ScreenElementRenderer.renderBlock(this::renderFanCasing); @@ -73,18 +73,18 @@ public abstract class ProcessingViaFanCategory> implements float angle = AnimatedKinetics.getCurrentAngle() * 12; float t = 25; RenderSystem.translatef(t, -t, t); - RenderSystem.rotated(angle, 0, 0, 1); + RenderSystem.rotatef(angle, 0, 0, 1); RenderSystem.translatef(-t, t, -t); RenderSystem.translatef(t, 0, 175); - RenderSystem.rotated(90, 0, 1, 0); + RenderSystem.rotatef(90, 0, 1, 0); RenderSystem.translatef(-t, 0, -175); ScreenElementRenderer.renderModel(this::renderFanInner); RenderSystem.popMatrix(); RenderSystem.translated(-10, 0, 95); - RenderSystem.rotated(7, 0, 1, 0); + RenderSystem.rotatef(7, 0, 1, 0); renderAttachedBlock(); RenderSystem.popMatrix(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SplashingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SplashingCategory.java index b0ecc5acd..7e3c559ae 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SplashingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SplashingCategory.java @@ -116,14 +116,14 @@ public class SplashingCategory extends ProcessingViaFanCategory RenderSystem.pushMatrix(); RenderSystem.translated(0, 200, 0); - RenderSystem.rotated(90, 1, 0, 0); + RenderSystem.rotatef(90, 1, 0, 0); ScreenElementRenderer.renderBlock(() -> state); RenderSystem.popMatrix(); RenderSystem.pushMatrix(); RenderSystem.translated(0, 200, 0); - RenderSystem.rotated(90, 1, 0, 0); - RenderSystem.rotated(270, 0, 0, 1); + RenderSystem.rotatef(90, 1, 0, 0); + RenderSystem.rotatef(270, 0, 0, 1); ScreenElementRenderer.renderBlock(() -> state); RenderSystem.popMatrix(); 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 a7b00dd70..4e5250e06 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 @@ -64,8 +64,8 @@ public class AnimatedCrafter extends AnimatedKinetics { private IBakedModel cogwheel(boolean forward) { float t = 25; RenderSystem.translatef(t, -t, -t); - RenderSystem.rotated(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1); - RenderSystem.rotated(90, 1, 0, 0); + RenderSystem.rotatef(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1); + RenderSystem.rotatef(90, 1, 0, 0); RenderSystem.translatef(-t, t, t); return AllBlockPartials.SHAFTLESS_COGWHEEL.get(); } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java index 57639a2c1..32aa96e8f 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java @@ -37,7 +37,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics { float t = 25; RenderSystem.translatef(t, -t, t); - RenderSystem.rotated(angle, 0, 0, 1); + RenderSystem.rotatef(angle, 0, 0, 1); RenderSystem.translatef(-t, t, -t); return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X); @@ -49,7 +49,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics { float t = 25; RenderSystem.translatef(t, -t, t); - RenderSystem.rotated(angle, 0, 0, 1); + RenderSystem.rotatef(angle, 0, 0, 1); RenderSystem.translatef(-t, t, -t); return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X); 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 a851c9ec1..24beceb43 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 @@ -56,7 +56,7 @@ public class AnimatedMixer extends AnimatedKinetics { private IBakedModel cogwheel() { float t = 25; RenderSystem.translatef(t, -t, -t); - RenderSystem.rotated(getCurrentAngle() * 2, 0, 1, 0); + RenderSystem.rotatef(getCurrentAngle() * 2, 0, 1, 0); RenderSystem.translatef(-t, t, t); return AllBlockPartials.SHAFTLESS_COGWHEEL.get(); } @@ -74,7 +74,7 @@ public class AnimatedMixer extends AnimatedKinetics { float t = 25; RenderSystem.translatef(0, 51, 0); RenderSystem.translatef(t, -t, -t); - RenderSystem.rotated(getCurrentAngle() * 4, 0, 1, 0); + RenderSystem.rotatef(getCurrentAngle() * 4, 0, 1, 0); RenderSystem.translatef(-t, t, t); return AllBlockPartials.MECHANICAL_MIXER_HEAD.get(); } 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 49bdb190d..fbdd14a87 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 @@ -66,7 +66,7 @@ public class AnimatedPress extends AnimatedKinetics { private BlockState shaft() { float t = 25; RenderSystem.translatef(t, -t, -t); - RenderSystem.rotated(getCurrentAngle() * 2, 1, 0, 0); + RenderSystem.rotatef(getCurrentAngle() * 2, 1, 0, 0); RenderSystem.translatef(-t, t, t); return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Z); } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSaw.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSaw.java index 25ae6ca42..12e7a048c 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSaw.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSaw.java @@ -46,7 +46,7 @@ public class AnimatedSaw extends AnimatedKinetics { private BlockState shaft() { float t = 25; RenderSystem.translatef(t, -t, t); - RenderSystem.rotated(-getCurrentAngle() * 2, 0, 0, 1); + RenderSystem.rotatef(-getCurrentAngle() * 2, 0, 0, 1); RenderSystem.translatef(-t, t, -t); return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X); } diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/ValueBox.java b/src/main/java/com/simibubi/create/foundation/behaviour/ValueBox.java index 47935f8fe..b8b92b06a 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/ValueBox.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/ValueBox.java @@ -76,7 +76,7 @@ public class ValueBox { RenderSystem.translated(-7 - font.getStringWidth(countString), 10, 10 + 1 / 4f); double scale = 1.5; - RenderSystem.rotated(0, 1, 0, 0); + RenderSystem.rotatef(0, 1, 0, 0); RenderSystem.scaled(scale, scale, scale); font.drawString(countString, 0, 0, isFilter ? 0xFFFFFF : 0xEDEDED); RenderSystem.translated(0, 0, -1 / 16f); 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 d8ab21323..13edf9f77 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 @@ -4,8 +4,14 @@ 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.TileEntityRendererDispatcher; + public class SmartTileEntityRenderer extends SafeTileEntityRenderer { + public SmartTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override public void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage); 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 3e0bceee6..768d54e3c 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenElementRenderer.java @@ -88,7 +88,7 @@ public class ScreenElementRenderer { if (fire) { blockRenderer.renderBlockBrightness(blockToRender, 1); } else { - RenderSystem.rotated(90, 0, 1, 0); + RenderSystem.rotatef(90, 0, 1, 0); if (color == -1) { blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1); } else { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/KineticDebugger.java b/src/main/java/com/simibubi/create/modules/contraptions/KineticDebugger.java index 4e4002292..5b03361aa 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/KineticDebugger.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/KineticDebugger.java @@ -1,11 +1,13 @@ package com.simibubi.create.modules.contraptions; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.config.AllConfigs; -import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.world.ClientWorld; import net.minecraft.tileentity.TileEntity; @@ -17,7 +19,7 @@ import net.minecraft.world.World; public class KineticDebugger { - public static void renderSourceOutline() { + public static void renderSourceOutline(MatrixStack ms, IRenderTypeBuffer buffer) { if (!isActive()) return; KineticTileEntity te = getSelectedTE(); @@ -28,20 +30,16 @@ public class KineticDebugger { BlockPos toOutline = te.hasSource() ? te.source : te.getPos(); VoxelShape shape = world.getBlockState(toOutline).getShape(world, toOutline); - TessellatorHelper.prepareForDrawing(); - RenderSystem.disableTexture(); - RenderSystem.lineWidth(3); - RenderSystem.pushMatrix(); - RenderSystem.translated(toOutline.getX(), toOutline.getY(), toOutline.getZ()); + IVertexBuilder vb = buffer.getBuffer(RenderType.getLines()); + + ms.push(); + ms.translate(toOutline.getX(), toOutline.getY(), toOutline.getZ()); float f = 1 + 1 / 128f; - RenderSystem.scaled(f, f, f); + ms.scale(f, f, f); - WorldRenderer.drawShape(shape, 0, 0, 0, te.hasSource() ? .5f : 1, .75f, .75f, 1); + WorldRenderer.func_228431_a_(ms, vb, shape, 0, 0, 0, te.hasSource() ? .5f : 1, .75f, .75f, 1); - RenderSystem.popMatrix(); - RenderSystem.lineWidth(1); - RenderSystem.enableTexture(); - TessellatorHelper.cleanUpAfterDrawing(); + ms.pop(); } public static boolean isActive() { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/WrenchItemRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/WrenchItemRenderer.java index b2883c040..ec7f535b8 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/WrenchItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/WrenchItemRenderer.java @@ -1,9 +1,11 @@ package com.simibubi.create.modules.contraptions; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.item.ItemStack; @@ -11,22 +13,22 @@ import net.minecraft.item.ItemStack; public class WrenchItemRenderer extends ItemStackTileEntityRenderer { @Override - public void renderByItem(ItemStack stack) { + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - WrenchModel mainModel = (WrenchModel) itemRenderer.getModelWithOverrides(stack); + WrenchModel mainModel = (WrenchModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, Minecraft.getInstance().player); float worldTime = AnimationTickHolder.getRenderTick(); RenderSystem.pushMatrix(); RenderSystem.translatef(0.5F, 0.5F, 0.5F); - itemRenderer.renderItem(stack, mainModel.getBakedModel()); + itemRenderer.renderItem(stack, mainModel.getBakedModel()); // TODO 1.15 what transform type is this? float angle = worldTime * -.5f % 360; float xOffset = -1/32f; float zOffset = 0; RenderSystem.translatef(-xOffset, 0, -zOffset); - RenderSystem.rotated(angle, 0, 1, 0); + RenderSystem.rotatef(angle, 0, 1, 0); RenderSystem.translatef(xOffset, 0, zOffset); itemRenderer.renderItem(stack, mainModel.getPartial("gear")); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java index 954e3e4cb..6d70c4b2c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/ContraptionEntityRenderer.java @@ -96,9 +96,9 @@ public class ContraptionEntityRenderer extends EntityRenderer RenderSystem.pushMatrix(); RenderSystem.translated(x, y, z); RenderSystem.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z); - RenderSystem.rotated(degPitch, 0, 0, 1); - RenderSystem.rotated(degYaw, 0, 1, 0); - RenderSystem.rotated(degRoll, 1, 0, 0); + RenderSystem.rotatef(degPitch, 0, 0, 1); + RenderSystem.rotatef(degYaw, 0, 1, 0); + RenderSystem.rotatef(degRoll, 1, 0, 0); RenderSystem.translated(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z); ContraptionRenderer.renderTEsWithGL(entity.world, entity.getContraption(), entity.getPositionVec(), new Vec3d(degRoll, degYaw, degPitch), ms, buffers); 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 a24d2befe..db316af25 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 @@ -93,7 +93,7 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer< float earlyProgress = MathHelper.clamp(progress * 2, 0, 1); float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1); -// RenderSystem.rotated(lateProgress * 360, 0, 0, 1); +// RenderSystem.rotatef(lateProgress * 360, 0, 0, 1); ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress); Vec3d centering = new Vec3d(-items.minX + (-items.width + 1) / 2f, diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crank/HandCrankBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crank/HandCrankBlock.java index 1d455aa0a..f9e8ae9f7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crank/HandCrankBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crank/HandCrankBlock.java @@ -47,7 +47,7 @@ public class HandCrankBlock extends DirectionalKineticBlock implements IWithTile @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Direction preferred = getPreferredFacing(context); - if (preferred == null || context.isPlacerSneaking()) + if (preferred == null || context.getPlayer().isSneaking()) return getDefaultState().with(FACING, context.getFace()); return getDefaultState().with(FACING, preferred.getOpposite()); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java index a0409b0de..ce856a4da 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerTileEntityRenderer.java @@ -32,6 +32,7 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.BlockItem; import net.minecraft.util.Direction; @@ -44,6 +45,10 @@ import net.minecraft.world.World; @SuppressWarnings("deprecation") public class DeployerTileEntityRenderer extends SafeTileEntityRenderer { + public DeployerTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override public void renderWithGL(DeployerTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java index 56bf5616c..6feba93d6 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanBlock.java @@ -45,7 +45,7 @@ public class EncasedFanBlock extends DirectionalKineticBlock implements IWithTil if (preferredFacing == null) preferredFacing = context.getNearestLookingDirection(); return getDefaultState().with(FACING, - context.isPlacerSneaking() ? preferredFacing : preferredFacing.getOpposite()); + context.getPlayer().isSneaking() ? preferredFacing : preferredFacing.getOpposite()); } protected void blockUpdate(BlockState state, World worldIn, BlockPos pos) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/EngineRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/EngineRenderer.java index 9f4579451..b384bf273 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/EngineRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/engine/EngineRenderer.java @@ -1,15 +1,20 @@ package com.simibubi.create.modules.contraptions.components.flywheel.engine; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.foundation.block.SafeTileEntityRendererFast; +import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; import net.minecraft.block.Block; import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; -public class EngineRenderer extends SafeTileEntityRendererFast { +public class EngineRenderer extends SafeTileEntityRenderer { + + public EngineRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } @Override protected void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage, diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntityRenderer.java index 537b8d1c3..a97b3f2b9 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MechanicalMixerTileEntityRenderer.java @@ -12,11 +12,16 @@ import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer { + public MechanicalMixerTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorBlock.java index 79b9a7492..d3fb1a016 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/motor/MotorBlock.java @@ -34,7 +34,7 @@ public class MotorBlock extends HorizontalKineticBlock { @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Direction preferred = getPreferredHorizontalFacing(context); - if (context.isPlacerSneaking() || preferred == null) + if (context.getPlayer().isSneaking() || preferred == null) return super.getStateForPlacement(context); return getDefaultState().with(HORIZONTAL_FACING, preferred); } 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 cc58803e7..088fab878 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 @@ -21,6 +21,7 @@ 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.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; @@ -30,6 +31,10 @@ import net.minecraft.util.math.MathHelper; @SuppressWarnings("deprecation") public class SawTileEntityRenderer extends SafeTileEntityRenderer { + public SawTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override public void renderWithGL(SawTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { renderItems(te, x, y, z, partialTicks); @@ -71,8 +76,8 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer RenderSystem.scaled(.5, .5, .5); if (alongZ) - RenderSystem.rotated(90, 0, 1, 0); - RenderSystem.rotated(90, 1, 0, 0); + RenderSystem.rotatef(90, 0, 1, 0); + RenderSystem.rotatef(90, 1, 0, 0); itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.FIXED); RenderSystem.popMatrix(); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java index 31dc0c453..cc9913a09 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/waterwheel/WaterWheelBlock.java @@ -129,7 +129,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock { return getDefaultState().with(HORIZONTAL_FACING, placedOn.get(HORIZONTAL_FACING)); if (facing.getAxis().isHorizontal()) return getDefaultState().with(HORIZONTAL_FACING, - context.isPlacerSneaking() ? facing.getOpposite() : facing); + context.getPlayer().isSneaking() ? facing.getOpposite() : facing); return super.getStateForPlacement(context); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/goggle/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/goggle/GoggleOverlayRenderer.java index 9a76cd34b..b9e9247aa 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/goggle/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/goggle/GoggleOverlayRenderer.java @@ -68,7 +68,7 @@ public class GoggleOverlayRenderer { }; - tooltipScreen.init(mc, mc.mainWindow.getScaledWidth(), mc.mainWindow.getScaledHeight()); + tooltipScreen.init(mc, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight()); tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2); ItemStack item = goggles; ScreenElementRenderer.render3DItem(() -> { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinBlock.java index 27f26b8d7..329e5a25c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/processing/BasinBlock.java @@ -111,11 +111,6 @@ public class BasinBlock extends Block implements IWithTileEntity { + public BasinTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override - public void renderWithGL(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) { - RenderSystem.pushMatrix(); + protected void renderSafe(BasinTileEntity basin, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, + int light, int overlay) { + ms.push(); BlockPos pos = basin.getPos(); - RenderSystem.translated(x + .5, y + .2f, z + .5); + ms.translate(.5, .2f, .5); Random r = new Random(pos.hashCode()); IItemHandlerModifiable inv = basin.inventory.orElse(new ItemStackHandler()); @@ -31,13 +40,13 @@ public class BasinTileEntityRenderer extends SafeTileEntityRenderer { +public class AnalogLeverTileEntityRenderer extends SafeTileEntityRenderer { + + public AnalogLeverTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } @Override public void renderFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks, diff --git a/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java index 48eba0ce9..d56b4408a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/redstone/ContactBlock.java @@ -41,7 +41,7 @@ public class ContactBlock extends ProperDirectionalBlock implements IPortableBlo BlockState state = getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); Direction placeDirection = context.getFace().getOpposite(); - if (context.isPlacerSneaking() || hasValidContact(context.getWorld(), context.getPos(), placeDirection)) + if (context.getPlayer().isSneaking() || hasValidContact(context.getWorld(), context.getPos(), placeDirection)) state = state.with(FACING, placeDirection); if (hasValidContact(context.getWorld(), context.getPos(), state.get(FACING))) state = state.with(POWERED, true); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java index fbad3dd1f..e42591aaf 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java @@ -10,10 +10,15 @@ import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; public class SpeedControllerRenderer extends SmartTileEntityRenderer { + public SpeedControllerRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override public void renderWithGL(SpeedControllerTileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java index 2e3503b80..b48534469 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java @@ -102,7 +102,7 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock @Override public BlockState getStateForPlacement(BlockItemUseContext context) { Axis preferredAxis = RotatedPillarKineticBlock.getPreferredAxis(context); - if (preferredAxis != null && !context.isPlacerSneaking()) + if (preferredAxis != null && !context.getPlayer().isSneaking()) return withAxis(preferredAxis, context); return withAxis(context.getNearestLookingDirection().getAxis(), context); } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java index 619706039..707a2a29b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java @@ -391,10 +391,10 @@ public class BeltBlock extends HorizontalKineticBlock : BlockRenderType.ENTITYBLOCK_ANIMATED; } - @Override - public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) { - return state.get(CASING) && state.get(SLOPE) != Slope.VERTICAL && layer == getRenderLayer(); - } +// @Override // TODO 1.15 register layer +// public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) { +// return state.get(CASING) && state.get(SLOPE) != Slope.VERTICAL && layer == getRenderLayer(); +// } public static void initBelt(World world, BlockPos pos) { if (world.isRemote) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java index 500d3e069..e38bbcf8f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java @@ -37,7 +37,7 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { @Override public ActionResultType onItemUse(ItemUseContext context) { - if (context.isPlacerSneaking()) { + if (context.getPlayer().isSneaking()) { context.getItem().setTag(null); return ActionResultType.SUCCESS; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltMovementHandler.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltMovementHandler.java index 3189c5e70..c4575af62 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltMovementHandler.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltMovementHandler.java @@ -84,7 +84,7 @@ public class BeltMovementHandler { return; // Not on top - if (entityIn.posY - .25f < pos.getY()) + if (entityIn.getY() - .25f < pos.getY()) return; // Lock entities in place @@ -113,15 +113,15 @@ public class BeltMovementHandler { Direction.getFacingFromAxis(POSITIVE, beltFacing.rotateY().getAxis()).getDirectionVec(); Vec3d movement = new Vec3d(movementDirection.getDirectionVec()).scale(movementSpeed); - double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.posX) : (pos.getZ() + .5f - entityIn.posZ); + double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.getZ()) : (pos.getZ() + .5f - entityIn.getZ()); if (Math.abs(diffCenter) > 48 / 64f) return; Part part = blockState.get(BeltBlock.PART); float top = 13 / 16f; boolean onSlope = notHorizontal && (part == Part.MIDDLE || part == Part.PULLEY - || part == (slope == Slope.UPWARD ? Part.END : Part.START) && entityIn.posY - pos.getY() < top - || part == (slope == Slope.UPWARD ? Part.START : Part.END) && entityIn.posY - pos.getY() > top); + || part == (slope == Slope.UPWARD ? Part.END : Part.START) && entityIn.getY() - pos.getY() < top + || part == (slope == Slope.UPWARD ? Part.START : Part.END) && entityIn.getY() - pos.getY() > top); boolean movingDown = onSlope && slope == (movementFacing == beltFacing ? Slope.DOWNWARD : Slope.UPWARD); boolean movingUp = onSlope && slope == (movementFacing == beltFacing ? Slope.UPWARD : Slope.DOWNWARD); @@ -181,7 +181,7 @@ public class BeltMovementHandler { || AllBlocks.BELT.typeOf(world.getBlockState(entityIn.getPosition().down()))); if (movedPastEndingSlope && !movingDown && Math.abs(movementSpeed) > 0) - entityIn.setPosition(entityIn.posX, entityIn.posY + movement.y, entityIn.posZ); + entityIn.setPosition(entityIn.getY(), entityIn.getY() + movement.y, entityIn.getZ()); if (movedPastEndingSlope) { entityIn.setMotion(movement); entityIn.velocityChanged = true; 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 ea63efe67..adb60db43 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 @@ -26,6 +26,7 @@ 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.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; @@ -38,6 +39,10 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer { +public class BeltTunnelTileEntityRenderer extends SafeTileEntityRenderer { + + public BeltTunnelTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } @Override - public void renderFast(BeltTunnelTileEntity te, double x, double y, double z, float partialTicks, - int destroyStage, BufferBuilder buffer) { + protected void renderSafe(BeltTunnelTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, + int light, int overlay) { 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(); + World world = te.getWorld(); for (Direction direction : Direction.values()) { if (!te.flaps.containsKey(direction)) @@ -43,20 +52,22 @@ public class BeltTunnelTileEntityRenderer extends SafeTileEntityRendererFast open GUI - if (context.isPlacerSneaking()) { + if (context.getPlayer().isSneaking()) { if (context.getWorld().isRemote) { DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { openHandgunGUI(context.getItem(), context.getHand() == Hand.OFF_HAND); 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 dbefcdb41..f1a5aeba2 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 @@ -4,10 +4,15 @@ 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.TileEntityRendererDispatcher; import net.minecraft.state.properties.BlockStateProperties; public class BeltObserverTileEntityRenderer extends SafeTileEntityRenderer { + public BeltObserverTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override public void renderWithGL(BeltObserverTileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { 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 9ddd0e39f..cb1695872 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 @@ -5,8 +5,14 @@ import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRende import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.SuperByteBuffer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; + public class FlexpeaterTileEntityRenderer extends ColoredOverlayTileEntityRenderer { + public FlexpeaterTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override protected int getColor(FlexpeaterTileEntity te, float partialTicks) { return ColorHelper.mixColors(0x2C0300, 0xCD0000, te.state / (float) te.maxState.getValue()); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java index 690dbabef..2638a1272 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateBlock.java @@ -56,7 +56,7 @@ public class FlexcrateBlock extends ProperDirectionalBlock { BlockPos pos = context.getPos(); World world = context.getWorld(); - if (!context.isPlacerSneaking()) { + if (!context.getPlayer().isSneaking()) { for (Direction d : Direction.values()) { BlockState state = world.getBlockState(pos.offset(d)); if (AllBlocks.FLEXCRATE.typeOf(state) && !state.get(DOUBLE)) diff --git a/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java b/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java index e91796803..c115653a1 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java +++ b/src/main/java/com/simibubi/create/modules/schematics/MaterialChecklist.java @@ -61,7 +61,7 @@ public class MaterialChecklist { string.append("\n" + TextFormatting.RED + "* Disclaimer *\n\n"); string.append("Material List may be inaccurate due to relevant chunks not being loaded."); string.append("\"}"); - pages.add(new StringNBT(string.toString())); + pages.add(StringNBT.of(string.toString())); string = new StringBuilder("{\"text\":\""); } @@ -89,7 +89,7 @@ public class MaterialChecklist { if (itemsWritten == 6) { itemsWritten = 0; string.append("\"}"); - pages.add(new StringNBT(string.toString())); + pages.add(StringNBT.of(string.toString())); string = new StringBuilder("{\"text\":\""); } @@ -101,7 +101,7 @@ public class MaterialChecklist { if (itemsWritten == 6) { itemsWritten = 0; string.append("\"}"); - pages.add(new StringNBT(string.toString())); + pages.add(StringNBT.of(string.toString())); string = new StringBuilder("{\"text\":\""); } @@ -110,7 +110,7 @@ public class MaterialChecklist { } string.append("\"}"); - pages.add(new StringNBT(string.toString())); + pages.add(StringNBT.of(string.toString())); tag.put("pages", pages); tag.putString("author", "Schematicannon"); diff --git a/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java index d780187e2..d591c0c04 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/modules/schematics/SchematicWorld.java @@ -78,7 +78,7 @@ public class SchematicWorld extends WrappedWorld { } @Override - public int getLightFor(LightType type, BlockPos pos) { + public int getLightLevel(LightType p_226658_1_, BlockPos p_226658_2_) { return 10; } @@ -98,11 +98,6 @@ public class SchematicWorld extends WrappedWorld { return Collections.emptyList(); } - @Override - public int getLightSubtracted(BlockPos pos, int amount) { - return 0; - } - @Override public int getSkylightSubtracted() { return 0; diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java index ac130ece5..f718a1846 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java @@ -6,6 +6,8 @@ import static com.simibubi.create.ScreenResources.SCHEMATIC_TABLE_PROGRESS; import java.nio.file.Paths; import java.util.List; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; @@ -125,7 +127,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen { + public SchematicannonRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + @Override - public void renderWithGL(SchematicannonTileEntity tileEntityIn, double x, double y, double z, float partialTicks, - int destroyStage) { + protected void renderSafe(SchematicannonTileEntity tileEntityIn, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, + int light, int overlay) { Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); @@ -81,13 +88,14 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer () -> { displayBlueprintScreen(); });