From 1c23302544d8820b5c03754edd8fdfb527e1c74d Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Tue, 2 Nov 2021 19:04:52 -0700 Subject: [PATCH] Chipping away, Part III --- .../java/com/simibubi/create/AllItems.java | 19 ++---------- .../animations/AnimatedItemDrain.java | 3 +- .../category/animations/AnimatedSpout.java | 5 ++-- .../pulley/PulleyTileEntity.java | 3 +- .../contraptions/particle/CubeParticle.java | 3 +- .../burner/BlazeBurnerRenderer.java | 3 +- .../contraptions/relays/belt/BeltBlock.java | 2 +- .../contraptions/wrench/WrenchItem.java | 12 ++++++++ .../symmetry/SymmetryWandItem.java | 10 +++++++ .../client/SymmetryWandItemRenderer.java | 3 +- .../curiosities/tools/BlueprintContainer.java | 6 ++-- .../curiosities/tools/BlueprintScreen.java | 5 ++-- .../curiosities/tools/ExtendoGripItem.java | 9 ++++++ .../tools/ExtendoGripRenderHandler.java | 10 +++---- .../curiosities/tools/SandPaperItem.java | 12 ++++++++ .../tools/SandPaperItemRenderer.java | 2 +- .../curiosities/weapons/PotatoCannonItem.java | 9 ++++++ .../weapons/PotatoCannonItemRenderer.java | 2 +- .../zapper/ShootableGadgetRenderHandler.java | 3 +- .../zapper/ZapperItemRenderer.java | 2 +- .../zapper/terrainzapper/WorldshaperItem.java | 9 ++++++ .../block/chute/AbstractChuteBlock.java | 2 +- .../block/funnel/AbstractFunnelBlock.java | 2 +- .../inventories/AdjustableCrateScreen.java | 4 +-- .../block/redstone/NixieTubeRenderer.java | 3 +- .../item/LinkedControllerContainer.java | 23 ++++++++------- .../logistics/item/LinkedControllerItem.java | 10 +++++++ .../item/LinkedControllerScreen.java | 5 ++-- .../item/filter/AbstractFilterContainer.java | 6 ++-- .../item/filter/AbstractFilterScreen.java | 3 +- .../item/filter/AttributeFilterContainer.java | 6 ++-- .../item/filter/AttributeFilterScreen.java | 6 ++-- .../schematics/SchematicProcessor.java | 5 ++-- .../content/schematics/SchematicWorld.java | 3 +- .../block/SchematicTableContainer.java | 2 +- .../block/SchematicTableScreen.java | 3 +- .../block/SchematicannonContainer.java | 2 +- .../block/SchematicannonScreen.java | 4 +-- .../client/SchematicAndQuillHandler.java | 4 +-- .../schematics/client/SchematicRenderer.java | 7 ++--- .../packet/SchematicPlacePacket.java | 2 +- .../simibubi/create/events/ClientEvents.java | 15 +++++----- .../simibubi/create/events/CommonEvents.java | 1 - .../render}/ReducedDestroyEffects.java | 2 +- .../create/foundation/command/ChunkUtil.java | 2 +- .../config/ui/ConfigModListScreen.java | 4 +-- .../foundation/config/ui/ConfigScreen.java | 2 +- .../create/foundation/data/BlockStateGen.java | 14 --------- .../foundation/data/CreateRegistrate.java | 29 ------------------- .../create/foundation/fluid/FluidHelper.java | 2 +- .../gui/AbstractSimiContainerScreen.java | 5 ++-- .../create/foundation/gui/AllGuiTextures.java | 6 ++-- .../create/foundation/gui/AllIcons.java | 6 ++-- .../create/foundation/gui/BoxElement.java | 5 ++-- .../create/foundation/gui/GuiGameElement.java | 20 ++++++------- .../foundation/gui/ToolSelectionScreen.java | 16 +++++----- .../create/foundation/gui/UIRenderHelper.java | 10 ++++--- .../gui/mainMenu/CreateMainMenuScreen.java | 3 +- .../foundation/gui/widgets/IconButton.java | 2 +- .../create/foundation/gui/widgets/Label.java | 2 +- .../foundation/item/CreateItemGroupBase.java | 2 +- .../item/render/SimpleCustomRenderer.java | 26 +++++++++++++++++ .../create/foundation/ponder/PonderWorld.java | 8 ++--- .../ponder/PonderWorldParticles.java | 2 +- .../foundation/ponder/SceneBuilder.java | 3 +- .../ponder/content/FunnelScenes.java | 2 +- .../ponder/content/PonderChapter.java | 4 +-- .../foundation/ponder/content/PonderTag.java | 6 ++-- .../ponder/elements/AnimatedSceneElement.java | 5 ++-- .../TileEntityDataInstruction.java | 6 ++-- .../foundation/render/ShadowRenderHelper.java | 3 +- .../render/SuperByteBufferCache.java | 6 ++-- .../tileEntity/behaviour/ValueBox.java | 3 +- .../foundation/utility/BlockHelper.java | 10 ------- .../create/foundation/utility/FontHelper.java | 3 +- .../utility/ghost/GhostBlockRenderer.java | 5 ++-- .../utility/placement/PlacementHelpers.java | 8 +++-- .../worldWrappers/chunk/WrappedChunk.java | 7 +---- 78 files changed, 254 insertions(+), 235 deletions(-) rename src/main/java/com/simibubi/create/foundation/{utility => block/render}/ReducedDestroyEffects.java (97%) create mode 100644 src/main/java/com/simibubi/create/foundation/item/render/SimpleCustomRenderer.java diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index b88cc69e8..efde80ffa 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -21,7 +21,6 @@ import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlo import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem; import com.simibubi.create.content.contraptions.relays.gearbox.VerticalGearboxItem; import com.simibubi.create.content.contraptions.wrench.WrenchItem; -import com.simibubi.create.content.contraptions.wrench.WrenchItemRenderer; import com.simibubi.create.content.curiosities.BuildersTeaItem; import com.simibubi.create.content.curiosities.ChromaticCompoundColor; import com.simibubi.create.content.curiosities.ChromaticCompoundItem; @@ -34,18 +33,12 @@ import com.simibubi.create.content.curiosities.armor.CopperBacktankItem; import com.simibubi.create.content.curiosities.armor.DivingBootsItem; import com.simibubi.create.content.curiosities.armor.DivingHelmetItem; import com.simibubi.create.content.curiosities.symmetry.SymmetryWandItem; -import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandItemRenderer; import com.simibubi.create.content.curiosities.tools.BlueprintItem; import com.simibubi.create.content.curiosities.tools.ExtendoGripItem; -import com.simibubi.create.content.curiosities.tools.ExtendoGripItemRenderer; import com.simibubi.create.content.curiosities.tools.SandPaperItem; -import com.simibubi.create.content.curiosities.tools.SandPaperItemRenderer; import com.simibubi.create.content.curiosities.weapons.PotatoCannonItem; -import com.simibubi.create.content.curiosities.weapons.PotatoCannonItemRenderer; import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperItem; -import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperItemRenderer; import com.simibubi.create.content.logistics.item.LinkedControllerItem; -import com.simibubi.create.content.logistics.item.LinkedControllerItemRenderer; import com.simibubi.create.content.logistics.item.filter.FilterItem; import com.simibubi.create.content.schematics.item.SchematicAndQuillItem; import com.simibubi.create.content.schematics.item.SchematicItem; @@ -201,12 +194,12 @@ public class AllItems { public static final ItemEntry VERTICAL_GEARBOX = REGISTRATE.item("vertical_gearbox", VerticalGearboxItem::new) - .model(AssetLookup.customBlockItemModel("gearbox", "item_vertical")) + .model(AssetLookup.customBlockItemModel("gearbox", "item_vertical")) .register(); public static final ItemEntry EMPTY_BLAZE_BURNER = REGISTRATE.item("empty_blaze_burner", BlazeBurnerBlockItem::empty) - .model(AssetLookup.customBlockItemModel("blaze_burner", "block")) + .model(AssetLookup.customBlockItemModel("blaze_burner", "block")) .register(); public static final ItemEntry GOGGLES = REGISTRATE.item("goggles", GogglesItem::new) @@ -227,19 +220,16 @@ public class AllItems { .register(); public static final ItemEntry SAND_PAPER = REGISTRATE.item("sand_paper", SandPaperItem::new) - .transform(CreateRegistrate.customRenderedItem(() -> SandPaperItemRenderer::new)) .tag(AllTags.AllItemTags.SANDPAPER.tag) .register(); public static final ItemEntry RED_SAND_PAPER = REGISTRATE.item("red_sand_paper", SandPaperItem::new) - .transform(CreateRegistrate.customRenderedItem(() -> SandPaperItemRenderer::new)) .tag(AllTags.AllItemTags.SANDPAPER.tag) .onRegister(s -> TooltipHelper.referTo(s, SAND_PAPER)) .register(); public static final ItemEntry WRENCH = REGISTRATE.item("wrench", WrenchItem::new) .properties(p -> p.stacksTo(1)) - .transform(CreateRegistrate.customRenderedItem(() -> WrenchItemRenderer::new)) .model(AssetLookup.itemModelWithPartials()) .register(); @@ -264,32 +254,27 @@ public class AllItems { public static final ItemEntry LINKED_CONTROLLER = REGISTRATE.item("linked_controller", LinkedControllerItem::new) .properties(p -> p.stacksTo(1)) - .transform(CreateRegistrate.customRenderedItem(() -> LinkedControllerItemRenderer::new)) .model(AssetLookup.itemModelWithPartials()) .register(); public static final ItemEntry POTATO_CANNON = REGISTRATE.item("potato_cannon", PotatoCannonItem::new) .properties(p -> p.stacksTo(1)) - .transform(CreateRegistrate.customRenderedItem(() -> PotatoCannonItemRenderer::new)) .model(AssetLookup.itemModelWithPartials()) .register(); public static final ItemEntry EXTENDO_GRIP = REGISTRATE.item("extendo_grip", ExtendoGripItem::new) - .transform(CreateRegistrate.customRenderedItem(() -> ExtendoGripItemRenderer::new)) .model(AssetLookup.itemModelWithPartials()) .register(); public static final ItemEntry WAND_OF_SYMMETRY = REGISTRATE.item("wand_of_symmetry", SymmetryWandItem::new) - .transform(CreateRegistrate.customRenderedItem(() -> SymmetryWandItemRenderer::new)) .model(AssetLookup.itemModelWithPartials()) .register(); public static final ItemEntry WORLDSHAPER = REGISTRATE.item("handheld_worldshaper", WorldshaperItem::new) .properties(p -> p.rarity(Rarity.EPIC)) - .transform(CreateRegistrate.customRenderedItem(() -> WorldshaperItemRenderer::new)) .lang("Creative Worldshaper") .model(AssetLookup.itemModelWithPartials()) .register(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java index ac38c9366..d6bde42d1 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java @@ -6,6 +6,7 @@ import com.mojang.math.Vector3f; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.fluid.FluidRenderer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraftforge.fluids.FluidStack; @@ -37,7 +38,7 @@ public class AnimatedItemDrain extends AnimatedKinetics { ms.scale(scale, -scale, scale); float from = 2/16f; float to = 1f - from; - FluidRenderer.renderTiledFluidBB(fluid, from, from, from, to, 3/4f, to, buffer, ms, 0xF000F0, false); + FluidRenderer.renderTiledFluidBB(fluid, from, from, from, to, 3/4f, to, buffer, ms, LightTexture.FULL_BRIGHT, false); buffer.endBatch(); matrixStack.popPose(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java index 56fff8ef9..d63059004 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java @@ -10,6 +10,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraft.util.Mth; @@ -68,14 +69,14 @@ public class AnimatedSpout extends AnimatedKinetics { matrixStack.scale(16, -16, 16); float from = 2/16f; float to = 1f - from; - FluidRenderer.renderTiledFluidBB(fluids.get(0), from, from, from, to, to, to, buffer, matrixStack, 0xF000F0, false); + FluidRenderer.renderTiledFluidBB(fluids.get(0), from, from, from, to, to, to, buffer, matrixStack, LightTexture.FULL_BRIGHT, false); matrixStack.popPose(); float width = 1 / 128f * squeeze; matrixStack.translate(scale / 2f, scale * 1.5f, scale / 2f); matrixStack.scale(16, -16, 16); matrixStack.translate(-width / 2, 0, -width / 2); - FluidRenderer.renderTiledFluidBB(fluids.get(0), 0, -0.001f, 0, width, 2.001f, width, buffer, matrixStack, 0xF000F0, + FluidRenderer.renderTiledFluidBB(fluids.get(0), 0, -0.001f, 0, width, 2.001f, width, buffer, matrixStack, LightTexture.FULL_BRIGHT, false); buffer.endBatch(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java index eac9c77dc..fa1abfcf2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java @@ -14,7 +14,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity.RemovalReason; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SimpleWaterloggedBlock; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -153,7 +152,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { } if (movedContraption != null) - movedContraption.remove(RemovalReason.KILLED); + movedContraption.discard(); movedContraption = null; initialOffset = 0; running = false; diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java index 34d24cdf0..6cea4d086 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java @@ -13,6 +13,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.ParticleRenderType; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; @@ -133,7 +134,7 @@ public class CubeParticle extends Particle { float lerpedZ = (float) (Mth.lerp(p_225606_3_, this.zo, this.z) - projectedView.z()); // int light = getBrightnessForRender(p_225606_3_); - int light = 15728880;// 15<<20 && 15<<4 + int light = LightTexture.FULL_BRIGHT;// 15<<20 && 15<<4 double ageMultiplier = 1 - Math.pow(age, 3) / Math.pow(lifetime, 3); for (int i = 0; i < 6; i++) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java index 9437178ed..48792eec6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; @@ -35,7 +36,7 @@ public class BlazeBurnerRenderer extends SafeTileEntityRenderer consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new WrenchItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java index a34835314..5e73f8023 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java @@ -4,17 +4,20 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import javax.annotation.Nonnull; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; +import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandItemRenderer; import com.simibubi.create.content.curiosities.symmetry.mirror.CrossPlaneMirror; import com.simibubi.create.content.curiosities.symmetry.mirror.EmptyMirror; import com.simibubi.create.content.curiosities.symmetry.mirror.PlaneMirror; import com.simibubi.create.content.curiosities.symmetry.mirror.SymmetryMirror; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.item.render.SimpleCustomRenderer; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; @@ -42,6 +45,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IItemRenderProperties; import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.common.util.Constants.BlockFlags; import net.minecraftforge.event.ForgeEventFactory; @@ -328,4 +332,10 @@ public class SymmetryWandItem extends Item { new SymmetryEffectPacket(to, targets)); } + @Override + @OnlyIn(Dist.CLIENT) + public void initializeClient(Consumer consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new SymmetryWandItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java index c019b9f99..4f28a4d67 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java @@ -6,6 +6,7 @@ import com.simibubi.create.foundation.item.render.CustomRenderedItemModelRendere import com.simibubi.create.foundation.item.render.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.BakedModel; @@ -18,7 +19,7 @@ public class SymmetryWandItemRenderer extends CustomRenderedItemModelRenderer { return; ghostInventory.setStackInSlot(9, ItemStack.EMPTY); - serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(containerId, 36 + 9, ItemStack.EMPTY)); + serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(containerId, incrementStateId(), 36 + 9, ItemStack.EMPTY)); contentHolder.inferredIcon = false; return; } @@ -89,7 +89,7 @@ public class BlueprintContainer extends GhostItemContainer { ItemStack toSend = itemstack.copy(); toSend.getOrCreateTag() .putBoolean("InferredFromRecipe", true); - serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(containerId, 36 + 9, toSend)); + serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(containerId, incrementStateId(), 36 + 9, toSend)); } @Override @@ -168,7 +168,7 @@ public class BlueprintContainer extends GhostItemContainer { if (index == 9 && hasItem() && !contentHolder.getBlueprintWorld().isClientSide) { contentHolder.inferredIcon = false; ServerPlayer serverplayerentity = (ServerPlayer) player; - serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(containerId, 36 + 9, getItem())); + serverplayerentity.connection.send(new ClientboundContainerSetSlotPacket(containerId, incrementStateId(), 36 + 9, getItem())); } if (index < 9) onCraftMatrixChanged(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintScreen.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintScreen.java index f8b631573..995e8a718 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintScreen.java @@ -80,7 +80,7 @@ public class BlueprintScreen extends AbstractSimiContainerScreen consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new ExtendoGripItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java index 6ab398acc..d0fb4bfb8 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripRenderHandler.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities.tools; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.util.transform.MatrixTransformStack; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllItems; @@ -45,7 +46,7 @@ public class ExtendoGripRenderHandler { return; if (!Minecraft.getInstance() .getItemRenderer() - .getModel(main, null, null) + .getModel(main, null, null, 0) .isGui3d()) return; pose = AllBlockPartials.DEPLOYER_HAND_HOLDING; @@ -66,8 +67,7 @@ public class ExtendoGripRenderHandler { PoseStack ms = event.getMatrixStack(); MatrixTransformStack msr = MatrixTransformStack.of(ms); AbstractClientPlayer abstractclientplayerentity = mc.player; - mc.getTextureManager() - .bind(abstractclientplayerentity.getSkinTextureLocation()); + RenderSystem.setShaderTexture(0, abstractclientplayerentity.getSkinTextureLocation()); float flip = rightHand ? 1.0F : -1.0F; float swingProgress = event.getSwingProgress(); @@ -115,11 +115,11 @@ public class ExtendoGripRenderHandler { if (!notInOffhand) { ForgeHooksClient.handleCameraTransforms(ms, mc.getItemRenderer() - .getModel(offhandItem, null, null), transform, !rightHand); + .getModel(offhandItem, null, null, 0), transform, !rightHand); ms.translate(flip * -.05f, .15f, -1.2f); ms.translate(0, 0, -animation * 2.25f); if (blockItem && mc.getItemRenderer() - .getModel(heldItem, null, null) + .getModel(heldItem, null, null, 0) .isGui3d()) { msr.rotateY(flip * 45); ms.translate(flip * 0.15f, -0.15f, -.05f); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java index 3ba1ab6be..5ca1adbc9 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java @@ -1,7 +1,10 @@ package com.simibubi.create.content.curiosities.tools; +import java.util.function.Consumer; + import javax.annotation.ParametersAreNonnullByDefault; +import com.simibubi.create.foundation.item.render.SimpleCustomRenderer; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.MethodsReturnNonnullByDefault; @@ -25,6 +28,9 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IItemRenderProperties; import net.minecraftforge.common.util.FakePlayer; @MethodsReturnNonnullByDefault @@ -184,4 +190,10 @@ public class SandPaperItem extends Item { return 5; } + @Override + @OnlyIn(Dist.CLIENT) + public void initializeClient(Consumer consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new SandPaperItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java index c6fe97e1c..561e8a410 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItemRenderer.java @@ -58,7 +58,7 @@ public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new PotatoCannonItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItemRenderer.java index e2d167d7f..a16683806 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItemRenderer.java @@ -57,7 +57,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer exte if (state.getBlock() instanceof CrossCollisionBlock) modelForState = Minecraft.getInstance() .getItemRenderer() - .getModel(new ItemStack(state.getBlock()), Minecraft.getInstance().level, null); + .getModel(new ItemStack(state.getBlock()), null, null, 0); Minecraft.getInstance() .getItemRenderer() diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItem.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItem.java index a1556543b..c3c7140a1 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItem.java @@ -2,10 +2,12 @@ package com.simibubi.create.content.curiosities.zapper.terrainzapper; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import com.simibubi.create.content.curiosities.zapper.PlacementPatterns; import com.simibubi.create.content.curiosities.zapper.ZapperItem; import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.item.render.SimpleCustomRenderer; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.NBTHelper; @@ -21,6 +23,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IItemRenderProperties; public class WorldshaperItem extends ZapperItem { @@ -92,4 +95,10 @@ public class WorldshaperItem extends ZapperItem { NBTHelper.writeEnum(nbt, "Placement", placement); } + @Override + @OnlyIn(Dist.CLIENT) + public void initializeClient(Consumer consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new WorldshaperItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java index 203eac6bb..5949df194 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java @@ -6,11 +6,11 @@ import javax.annotation.Nullable; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.block.render.ReducedDestroyEffects; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.ReducedDestroyEffects; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java index 3e7d3cdb9..2f2221346 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java @@ -8,10 +8,10 @@ import javax.annotation.Nullable; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.block.render.ReducedDestroyEffects; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; -import com.simibubi.create.foundation.utility.ReducedDestroyEffects; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java index 6c7980b90..8be9aca26 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java @@ -116,9 +116,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen consumer) { + consumer.accept(SimpleCustomRenderer.create(this, new LinkedControllerItemRenderer())); + } + } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerScreen.java index fa451ffba..e757d694d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerScreen.java @@ -74,8 +74,7 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen ex } @Override - public void tick() { + protected void containerTick() { handleTooltips(); - super.tick(); handleIndicators(); if (!menu.player.getMainHandItem() diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java index f3bdd5067..8fd8148f7 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java @@ -88,10 +88,10 @@ public class AttributeFilterContainer extends AbstractFilterContainer { } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { if (slotId == 37) - return ItemStack.EMPTY; - return super.clicked(slotId, dragType, clickTypeIn, player); + return; + super.clicked(slotId, dragType, clickTypeIn, player); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java index 7738c9234..465ef40e1 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java @@ -176,8 +176,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen { - boolean placingAir = state.getBlock().isAir(state, world, pos); + boolean placingAir = state.isAir(); if (placingAir && !includeAir) return; diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index 220faa5e6..2029b3c2a 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -56,6 +56,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedClientWorld; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; @@ -76,9 +77,9 @@ import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.EntityViewRenderEvent; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.event.TickEvent.ClientTickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.RenderTickEvent; @@ -199,21 +200,19 @@ public class ClientEvents { } @SubscribeEvent - public static void onRenderOverlay(RenderGameOverlayEvent.Post event) { + public static void afterRenderOverlayLayer(RenderGameOverlayEvent.PostLayer event) { PoseStack ms = event.getMatrixStack(); BufferSource buffers = Minecraft.getInstance() .renderBuffers() .bufferSource(); - int light = 0xF000F0; + int light = LightTexture.FULL_BRIGHT; int overlay = OverlayTexture.NO_OVERLAY; float pt = event.getPartialTicks(); - if (event.getType() == ElementType.AIR) + if (event.getOverlay() == ForgeIngameGui.AIR_LEVEL_ELEMENT) CopperBacktankArmorLayer.renderRemainingAirOverlay(ms, buffers, light, overlay, pt); - if (event.getType() != ElementType.HOTBAR) - return; - - onRenderHotbar(ms, buffers, light, overlay, pt); + if (event.getOverlay() == ForgeIngameGui.HOTBAR_ELEMENT) + onRenderHotbar(ms, buffers, light, overlay, pt); } public static void onRenderHotbar(PoseStack ms, MultiBufferSource buffer, int light, int overlay, diff --git a/src/main/java/com/simibubi/create/events/CommonEvents.java b/src/main/java/com/simibubi/create/events/CommonEvents.java index aab8f0dc3..ea306dfa5 100644 --- a/src/main/java/com/simibubi/create/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/events/CommonEvents.java @@ -32,7 +32,6 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; -import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.event.AddReloadListenerEvent; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.RegisterCommandsEvent; diff --git a/src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java b/src/main/java/com/simibubi/create/foundation/block/render/ReducedDestroyEffects.java similarity index 97% rename from src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java rename to src/main/java/com/simibubi/create/foundation/block/render/ReducedDestroyEffects.java index d1f0ecc0d..a04d0e1fd 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java +++ b/src/main/java/com/simibubi/create/foundation/block/render/ReducedDestroyEffects.java @@ -1,4 +1,4 @@ -package com.simibubi.create.foundation.utility; +package com.simibubi.create.foundation.block.render; import org.apache.commons.lang3.mutable.MutableInt; diff --git a/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java b/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java index f0d9b85b1..af78a79fc 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java +++ b/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java @@ -32,7 +32,7 @@ public class ChunkUtil { public void init() { ChunkStatus.FULL = new ChunkStatus("full", ChunkStatus.HEIGHTMAPS, 0, POST_FEATURES, ChunkStatus.ChunkType.LEVELCHUNK, - (_0, _1, _2, _3, _4, future, _6, chunk) -> future.apply(chunk), (_0, _1, _2, _3, future, chunk) -> { + (_0, _1, _2, _3, _4, _5, future, _7, chunk) -> future.apply(chunk), (_0, _1, _2, _3, future, chunk) -> { if (markedChunks.contains(chunk.getPos() .toLong())) { LOGGER.debug("trying to load unforced chunk " + chunk.getPos() diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigModListScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigModListScreen.java index da0f46eee..fb827019e 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigModListScreen.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigModListScreen.java @@ -16,7 +16,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.TextComponent; import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.loading.moddiscovery.ModInfo; +import net.minecraftforge.forgespi.language.IModInfo; public class ConfigModListScreen extends ConfigScreen { @@ -47,7 +47,7 @@ public class ConfigModListScreen extends ConfigScreen { children().add(list); allEntries = new ArrayList<>(); - ModList.get().getMods().stream().map(ModInfo::getModId).forEach(id -> allEntries.add(new ModEntry(id, this))); + ModList.get().getMods().stream().map(IModInfo::getModId).forEach(id -> allEntries.add(new ModEntry(id, this))); allEntries.sort((e1, e2) -> { int empty = (e2.button.active ? 1 : 0) - (e1.button.active ? 1 : 0); if (empty != 0) diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java index 2993a7bef..36cd12ff4 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java @@ -164,7 +164,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen { float elapsedPartials = minecraft.getDeltaFrameTime(); CreateMainMenuScreen.panorama.render(elapsedPartials, 1); - minecraft.getTextureManager().bind(CreateMainMenuScreen.PANORAMA_OVERLAY_TEXTURES); + RenderSystem.setShaderTexture(0, CreateMainMenuScreen.PANORAMA_OVERLAY_TEXTURES); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); blit(ms, 0, 0, this.width, this.height, 0.0F, 0.0F, 16, 128, 16, 128); diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index ab026611c..93a979b9f 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -18,7 +18,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; -import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock; import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; @@ -241,19 +240,6 @@ public class BlockStateGen { .build(); } - public static NonNullBiConsumer, RegistrateBlockstateProvider> reinforcedRail() { - return (c, p) -> p.getVariantBuilder(c.get()) - .forAllStates(state -> { - return ConfiguredModel.builder() - .modelFile(p.models() - .getExistingFile(p.modLoc( - "block/" + c.getName() + "/block" + (state.getValue(ReinforcedRailBlock.CONNECTS_S) ? "_s" : "") - + (state.getValue(ReinforcedRailBlock.CONNECTS_N) ? "_n" : "")))) - .rotationY(state.getValue(ReinforcedRailBlock.RAIL_SHAPE) == RailShape.EAST_WEST ? 90 : 0) - .build(); - }); - } - public static NonNullBiConsumer, RegistrateBlockstateProvider> linearChassis() { return (c, p) -> { ResourceLocation side = p.modLoc("block/" + c.getName() + "_side"); diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index 6caf7b54c..25edea772 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -19,21 +19,17 @@ import com.simibubi.create.foundation.block.connected.CTModel; import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour; import com.simibubi.create.foundation.block.render.ColoredVertexModel; import com.simibubi.create.foundation.block.render.IBlockVertexColor; -import com.simibubi.create.foundation.item.render.CustomRenderedItemModelRenderer; import com.tterrag.registrate.AbstractRegistrate; import com.tterrag.registrate.builders.BlockBuilder; import com.tterrag.registrate.builders.Builder; import com.tterrag.registrate.builders.FluidBuilder; -import com.tterrag.registrate.builders.ItemBuilder; import com.tterrag.registrate.util.NonNullLazyValue; import com.tterrag.registrate.util.entry.RegistryEntry; import com.tterrag.registrate.util.nullness.NonNullBiFunction; import com.tterrag.registrate.util.nullness.NonNullConsumer; import com.tterrag.registrate.util.nullness.NonNullFunction; import com.tterrag.registrate.util.nullness.NonNullSupplier; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; import net.minecraft.tags.BlockTags; @@ -229,29 +225,10 @@ public class CreateRegistrate extends AbstractRegistrate { return entry -> onClient(() -> () -> registerItemModel(entry, func)); } - public static NonNullUnaryOperator> customRenderedItem( - Supplier>> supplier) { - return b -> { - onClient(() -> () -> customRenderedItem(b, supplier)); - return b; - }; - } - protected static void onClient(Supplier toRun) { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, toRun); } - @OnlyIn(Dist.CLIENT) - private static void customRenderedItem(ItemBuilder b, - Supplier>> supplier) { - b.properties(p -> p.setISTER(() -> supplier.get()::get)) - .onRegister(entry -> { - BlockEntityWithoutLevelRenderer ister = entry.getItemStackTileEntityRenderer(); - if (ister instanceof CustomRenderedItemModelRenderer) - registerCustomRenderedItem(entry, (CustomRenderedItemModelRenderer) ister); - }); - } - @OnlyIn(Dist.CLIENT) private static void registerCTBehviour(Block entry, ConnectedTextureBehaviour behavior) { CreateClient.MODEL_SWAPPER.getCustomBlockModels() @@ -284,10 +261,4 @@ public class CreateRegistrate extends AbstractRegistrate { .register(entry.delegate, func.get()); } - @OnlyIn(Dist.CLIENT) - private static void registerCustomRenderedItem(Item entry, CustomRenderedItemModelRenderer renderer) { - CreateClient.MODEL_SWAPPER.getCustomRenderedItems() - .register(entry.delegate, renderer::createModel); - } - } diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java index cb62eeeb9..2d2c7c977 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java @@ -142,7 +142,7 @@ public class FluidHelper { player.setItemInHand(handIn, emptyingResult.getSecond()); else { player.setItemInHand(handIn, copyOfHeld); - player.getInventory().placeItemBackInInventory(worldIn, emptyingResult.getSecond()); + player.getInventory().placeItemBackInInventory(emptyingResult.getSecond()); } } return true; diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index 534a085a0..34063eb83 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -7,8 +7,6 @@ import java.util.List; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import org.lwjgl.opengl.GL11; - import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.systems.RenderSystem; @@ -16,6 +14,7 @@ import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import net.minecraft.client.Minecraft; @@ -267,7 +266,7 @@ public abstract class AbstractSimiContainerScreen 0.25f) { - RenderSystem.color4f(.7f, .7f, .8f, toolTipAlpha); + RenderSystem.setShaderColor(.7f, .7f, .8f, toolTipAlpha); blit(matrixStack, x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height); - RenderSystem.color4f(1, 1, 1, 1); + RenderSystem.setShaderColor(1, 1, 1, 1); if (toolTip.size() > 0) font.draw(matrixStack, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent); @@ -99,7 +97,7 @@ public class ToolSelectionScreen extends Screen { font.draw(matrixStack, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent); } - RenderSystem.color4f(1, 1, 1, 1); + RenderSystem.setShaderColor(1, 1, 1, 1); if (tools.size() > 1) { String keyName = AllKeys.TOOL_MENU.getBoundKey(); int width = minecraft.getWindow() @@ -124,11 +122,11 @@ public class ToolSelectionScreen extends Screen { .getString(), x + i * 50 + 24, y + 28, 0xCCDDFF); alpha = 1; } - RenderSystem.color4f(0, 0, 0, alpha); + RenderSystem.setShaderColor(0, 0, 0, alpha); tools.get(i) .getIcon() .draw(matrixStack, this, x + i * 50 + 16, y + 12); - RenderSystem.color4f(1, 1, 1, alpha); + RenderSystem.setShaderColor(1, 1, 1, alpha); tools.get(i) .getIcon() .draw(matrixStack, this, x + i * 50 + 16, y + 11); diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index bff1df7b1..33e08e15f 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -5,6 +5,7 @@ import javax.annotation.Nonnull; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.pipeline.TextureTarget; import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; @@ -12,6 +13,7 @@ import com.mojang.blaze3d.vertex.BufferUploader; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import com.simibubi.create.foundation.utility.Color; @@ -42,7 +44,7 @@ public class UIRenderHelper { } private static RenderTarget createFramebuffer(Window mainWindow) { - RenderTarget framebuffer = new RenderTarget(mainWindow.getWidth(), mainWindow.getHeight(), true, + RenderTarget framebuffer = new TextureTarget(mainWindow.getWidth(), mainWindow.getHeight(), true, Minecraft.ON_OSX); framebuffer.setClearColor(0, 0, 0, 0); framebuffer.enableStencil(); @@ -65,7 +67,7 @@ public class UIRenderHelper { Tesselator tessellator = Tesselator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuilder(); - bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); + bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); bufferbuilder.vertex(0, vy, 0).color(1, 1, 1, alpha).uv(0, 0).endVertex(); bufferbuilder.vertex(vx, vy, 0).color(1, 1, 1, alpha).uv(tx, 0).endVertex(); @@ -222,7 +224,7 @@ public class UIRenderHelper { Tesselator tessellator = Tesselator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuilder(); Matrix4f model = ms.last().pose(); - bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormat.POSITION_COLOR); + bufferbuilder.begin(VertexFormat.Mode.TRIANGLES, DefaultVertexFormat.POSITION_COLOR); bufferbuilder.vertex(model, x0, y0, 0).color(fc1.getRed(), fc1.getGreen(), fc1.getBlue(), fc1.getAlpha()).endVertex(); bufferbuilder.vertex(model, x1, y1, 0).color(fc2.getRed(), fc2.getGreen(), fc2.getBlue(), fc2.getAlpha()).endVertex(); @@ -272,7 +274,7 @@ public class UIRenderHelper { private static void drawTexturedQuad(Matrix4f m, Color c, int left, int right, int top, int bot, int z, float u1, float u2, float v1, float v2) { RenderSystem.enableBlend(); BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); - bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); + bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); bufferbuilder.vertex(m, (float) left , (float) bot, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u1, v2).endVertex(); bufferbuilder.vertex(m, (float) right, (float) bot, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u2, v2).endVertex(); bufferbuilder.vertex(m, (float) right, (float) top, (float) z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u2, v1).endVertex(); diff --git a/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java b/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java index 1addb08f5..2f238e9ed 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/mainMenu/CreateMainMenuScreen.java @@ -71,8 +71,7 @@ public class CreateMainMenuScreen extends AbstractSimiScreen { vanillaPanorama.render(elapsedPartials, 1); panorama.render(elapsedPartials, alpha); - minecraft.getTextureManager() - .bind(PANORAMA_OVERLAY_TEXTURES); + RenderSystem.setShaderTexture(0, PANORAMA_OVERLAY_TEXTURES); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java index 49a019b50..49eacc7cc 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java @@ -28,7 +28,7 @@ public class IconButton extends AbstractSimiWidget { AllGuiTextures button = (pressed || !active) ? button = AllGuiTextures.BUTTON_DOWN : (isHovered) ? AllGuiTextures.BUTTON_HOVER : AllGuiTextures.BUTTON; - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); AllGuiTextures.BUTTON.bind(); blit(matrixStack, x, y, button.startX, button.startY, button.width, button.height); icon.draw(matrixStack, this, x + 1, y + 1); diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java index b3b5c73bf..30e92182b 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/Label.java @@ -77,7 +77,7 @@ public class Label extends AbstractSimiWidget { if (text == null || text.getString().isEmpty()) return; - RenderSystem.color4f(1, 1, 1, 1); + RenderSystem.setShaderColor(1, 1, 1, 1); MutableComponent copy = text.plainCopy(); if (suffix != null && !suffix.isEmpty()) copy.append(suffix); diff --git a/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java b/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java index f2357c22b..c930d46db 100644 --- a/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java +++ b/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java @@ -57,7 +57,7 @@ public abstract class CreateItemGroupBase extends CreativeModeTab { if (item instanceof BlockItem) continue; ItemStack stack = new ItemStack(item); - BakedModel model = itemRenderer.getModel(stack, world, null); + BakedModel model = itemRenderer.getModel(stack, world, null, 0); if (model.isGui3d() != specialItems) continue; item.fillItemCategory(this, items); diff --git a/src/main/java/com/simibubi/create/foundation/item/render/SimpleCustomRenderer.java b/src/main/java/com/simibubi/create/foundation/item/render/SimpleCustomRenderer.java new file mode 100644 index 000000000..44b0c5d9f --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/item/render/SimpleCustomRenderer.java @@ -0,0 +1,26 @@ +package com.simibubi.create.foundation.item.render; + +import com.simibubi.create.CreateClient; + +import net.minecraft.world.item.Item; +import net.minecraftforge.client.IItemRenderProperties; + +public class SimpleCustomRenderer implements IItemRenderProperties { + + protected CustomRenderedItemModelRenderer renderer; + + protected SimpleCustomRenderer(CustomRenderedItemModelRenderer renderer) { + this.renderer = renderer; + } + + public static SimpleCustomRenderer create(Item item, CustomRenderedItemModelRenderer renderer) { + CreateClient.MODEL_SWAPPER.getCustomRenderedItems().register(item.delegate, renderer::createModel); + return new SimpleCustomRenderer(renderer); + } + + @Override + public CustomRenderedItemModelRenderer getItemStackRenderer() { + return renderer; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java index 35c63c3dd..d242ec43c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java @@ -84,7 +84,7 @@ public class PonderWorld extends SchematicWorld { originalTileEntities.clear(); blocks.forEach((k, v) -> originalBlocks.put(k, v)); tileEntities.forEach( - (k, v) -> originalTileEntities.put(k, BlockEntity.loadStatic(blocks.get(k), v.save(new CompoundTag())))); + (k, v) -> originalTileEntities.put(k, BlockEntity.loadStatic(k, blocks.get(k), v.save(new CompoundTag())))); entities.forEach(e -> EntityType.create(e.serializeNBT(), this) .ifPresent(originalEntities::add)); } @@ -97,7 +97,7 @@ public class PonderWorld extends SchematicWorld { renderedTileEntities.clear(); originalBlocks.forEach((k, v) -> blocks.put(k, v)); originalTileEntities.forEach((k, v) -> { - BlockEntity te = BlockEntity.loadStatic(originalBlocks.get(k), v.save(new CompoundTag())); + BlockEntity te = BlockEntity.loadStatic(k, originalBlocks.get(k), v.save(new CompoundTag())); onTEadded(te, te.getBlockPos()); tileEntities.put(k, te); renderedTileEntities.add(te); @@ -113,7 +113,7 @@ public class PonderWorld extends SchematicWorld { if (originalBlocks.containsKey(p)) blocks.put(p, originalBlocks.get(p)); if (originalTileEntities.containsKey(p)) { - BlockEntity te = BlockEntity.loadStatic(originalBlocks.get(p), originalTileEntities.get(p) + BlockEntity te = BlockEntity.loadStatic(p, originalBlocks.get(p), originalTileEntities.get(p) .save(new CompoundTag())); onTEadded(te, te.getBlockPos()); tileEntities.put(p, te); @@ -211,7 +211,7 @@ public class PonderWorld extends SchematicWorld { entity.tick(); if (entity.getY() <= -.5f) - entity.remove(); + entity.discard(); if (!entity.isAlive()) iterator.remove(); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java index 3ab53e494..f688e9627 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java @@ -80,7 +80,7 @@ public class PonderWorldParticles { enable.run(); Iterable iterable = this.byType.get(iparticlerendertype); if (iterable != null) { - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); Tesselator tessellator = Tesselator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuilder(); iparticlerendertype.begin(bufferbuilder, mc.textureManager); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java index 7b63c5782..f7dce25d1 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java @@ -7,6 +7,7 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.function.UnaryOperator; +import com.mojang.math.Vector3f; import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.base.KineticBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -329,7 +330,7 @@ public class SceneBuilder { public void createRedstoneParticles(BlockPos pos, int color, int amount) { Vec3 rgb = Color.vectorFromRGB(color); addInstruction(new EmitParticlesInstruction(VecHelper.getCenterOf(pos), Emitter.withinBlockSpace( - new DustParticleOptions((float) rgb.x, (float) rgb.y, (float) rgb.z, 1), Vec3.ZERO), amount, 2)); + new DustParticleOptions(new Vector3f(rgb), 1), Vec3.ZERO), amount, 2)); } } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java index c471c2411..dfc3d68a9 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java @@ -433,7 +433,7 @@ public class FunnelScenes { scene.world.modifyEntities(ItemEntity.class, e -> { if (e.getY() < 1) - e.remove(); + e.discard(); }); if (i == 2) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java index d4954fc2b..820e99cf1 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java @@ -2,12 +2,12 @@ package com.simibubi.create.foundation.ponder.content; import javax.annotation.Nonnull; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.foundation.gui.IScreenRenderable; import com.simibubi.create.foundation.ponder.PonderLocalization; import com.simibubi.create.foundation.ponder.PonderRegistry; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiComponent; import net.minecraft.resources.ResourceLocation; @@ -38,7 +38,7 @@ public class PonderChapter implements IScreenRenderable { @Override public void draw(PoseStack ms, GuiComponent screen, int x, int y) { ms.pushPose(); - Minecraft.getInstance().getTextureManager().bind(icon); + RenderSystem.setShaderTexture(0, icon); ms.scale(0.25f, 0.25f, 1); //x and y offset, blit z offset, tex x and y, tex width and height, entire tex sheet width and height GuiComponent.blit(ms, x, y, 0, 0, 0, 64, 64, 64, 64); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java index 53f950a40..6a3c11525 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java @@ -1,5 +1,6 @@ package com.simibubi.create.foundation.ponder.content; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; @@ -9,7 +10,6 @@ import com.simibubi.create.foundation.gui.IScreenRenderable; import com.simibubi.create.foundation.ponder.PonderLocalization; import com.simibubi.create.foundation.ponder.PonderRegistry; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -150,9 +150,7 @@ public class PonderTag implements IScreenRenderable { ms.pushPose(); ms.translate(x, y, 0); if (icon != null) { - Minecraft.getInstance() - .getTextureManager() - .bind(icon); + RenderSystem.setShaderTexture(0, icon); ms.scale(0.25f, 0.25f, 1); // x and y offset, blit z offset, tex x and y, tex width and height, entire tex // sheet width and height diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java index 529086cb6..75325dff4 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java @@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.foundation.ponder.PonderWorld; import com.simibubi.create.foundation.utility.animation.LerpedFloat; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.util.Mth; @@ -73,10 +74,10 @@ public abstract class AnimatedSceneElement extends PonderSceneElement { protected void renderLast(PonderWorld world, MultiBufferSource buffer, PoseStack ms, float fade, float pt) {} protected int lightCoordsFromFade(float fade) { - int light = 0xF000F0; + int light = LightTexture.FULL_BRIGHT; if (fade != 1) { light = (int) (Mth.lerp(fade, 5, 0xF)); - light = light << 4 | light << 20; + light = LightTexture.pack(light, light); } return light; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/instructions/TileEntityDataInstruction.java b/src/main/java/com/simibubi/create/foundation/ponder/instructions/TileEntityDataInstruction.java index 7debb459f..deb5d8c57 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/instructions/TileEntityDataInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/instructions/TileEntityDataInstruction.java @@ -9,7 +9,6 @@ import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; public class TileEntityDataInstruction extends WorldModifyInstruction { @@ -36,10 +35,9 @@ public class TileEntityDataInstruction extends WorldModifyInstruction { if (!type.isInstance(tileEntity)) return; CompoundTag apply = data.apply(tileEntity.save(new CompoundTag())); - BlockState state = world.getBlockState(pos); if (tileEntity instanceof SyncedTileEntity) - ((SyncedTileEntity) tileEntity).readClientUpdate(state, apply); - tileEntity.load(state, apply); + ((SyncedTileEntity) tileEntity).readClientUpdate(apply); + tileEntity.load(apply); }); } diff --git a/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java index b571dcfe4..e7c3fca17 100644 --- a/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.render; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -105,7 +106,7 @@ public class ShadowRenderHelper { .color(1.0F, 1.0F, 1.0F, alpha) .uv(u, v) .overlayCoords(OverlayTexture.NO_OVERLAY) - .uv2(0xF000F0) + .uv2(LightTexture.FULL_BRIGHT) .normal(entry.normal(), 0.0F, 1.0F, 0.0F) .endVertex(); } diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java index cc7707f78..850170019 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java @@ -7,7 +7,6 @@ import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import org.apache.commons.lang3.tuple.Pair; -import org.lwjgl.opengl.GL11; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; @@ -16,6 +15,7 @@ import com.jozufozu.flywheel.util.VirtualEmptyModelData; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.BlockRenderDispatcher; @@ -123,8 +123,8 @@ public class SuperByteBufferCache { ModelBlockRenderer blockRenderer = dispatcher.getModelRenderer(); BufferBuilder builder = new BufferBuilder(512); - builder.begin(GL11.GL_QUADS, DefaultVertexFormat.BLOCK); - blockRenderer.renderModel(mc.level, model, referenceState, BlockPos.ZERO.above(255), ms, builder, true, + builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + blockRenderer.tesselateBlock(mc.level, model, referenceState, BlockPos.ZERO.above(255), ms, builder, true, mc.level.random, 42, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE); builder.end(); return builder; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java index d03572875..94e4309d1 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBox.java @@ -12,6 +12,7 @@ import com.simibubi.create.foundation.utility.outliner.ChasingAABBOutline; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -229,7 +230,7 @@ public class ValueBox extends ChasingAABBOutline { private static void drawString(PoseStack ms, MultiBufferSource buffer, Component text, float x, float y, int color) { Minecraft.getInstance().font.drawInBatch(text, x, y, color, false, ms.last() - .pose(), buffer, false, 0, 15728880); + .pose(), buffer, false, 0, LightTexture.FULL_BRIGHT); } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index 84e6c9fc6..d5d3aac4a 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -4,15 +4,10 @@ import java.util.function.Consumer; import javax.annotation.Nullable; -import org.apache.commons.lang3.mutable.MutableInt; - import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.actors.SeatBlock; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.particle.ParticleEngine; -import net.minecraft.client.particle.TerrainParticle; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; @@ -23,7 +18,6 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; -import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -44,10 +38,6 @@ import net.minecraft.world.level.block.state.properties.SlabType; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.RenderProperties; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.BlockEvent; diff --git a/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java b/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java index 44e64537c..c9914e91e 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java @@ -9,6 +9,7 @@ import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.math.Matrix4f; import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraftforge.client.MinecraftForgeClient; @@ -78,7 +79,7 @@ public final class FontHelper { MultiBufferSource.BufferSource irendertypebuffer$impl = MultiBufferSource.immediate(Tesselator.getInstance() .getBuilder()); int i = font.drawInBatch(p_228078_1_, p_228078_2_, p_228078_3_, p_228078_4_, p_228078_6_, p_228078_5_, - irendertypebuffer$impl, false, 0, 15728880); + irendertypebuffer$impl, false, 0, LightTexture.FULL_BRIGHT); irendertypebuffer$impl.endBatch(); return i; } diff --git a/src/main/java/com/simibubi/create/foundation/utility/ghost/GhostBlockRenderer.java b/src/main/java/com/simibubi/create/foundation/utility/ghost/GhostBlockRenderer.java index f4cd992de..7cf0d0724 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ghost/GhostBlockRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ghost/GhostBlockRenderer.java @@ -23,6 +23,7 @@ import com.simibubi.create.foundation.utility.placement.PlacementHelpers; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -67,7 +68,7 @@ public abstract class GhostBlockRenderer { ms.translate(pos.getX(), pos.getY(), pos.getZ()); dispatcher.getModelRenderer() - .renderModel(ms.last(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.NO_OVERLAY, + .renderModel(ms.last(), vb, params.state, model, 1f, 1f, 1f, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE); ms.popPose(); @@ -100,7 +101,7 @@ public abstract class GhostBlockRenderer { ms.scale(.85f, .85f, .85f); ms.translate(-.5, -.5, -.5); - // dispatcher.getBlockModelRenderer().renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE); + // dispatcher.getBlockModelRenderer().renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, LightTexture.FULL_BRIGHT, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE); renderModel(params, ms.last(), vb, params.state, model, 1f, 1f, 1f, LevelRenderer.getLightColor(mc.level, pos), OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE); diff --git a/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java b/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java index 118b15edd..262458cc9 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java +++ b/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java @@ -12,6 +12,7 @@ import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import com.simibubi.create.foundation.config.AllConfigs; @@ -34,6 +35,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -145,8 +147,8 @@ public class PlacementHelpers { @SubscribeEvent @OnlyIn(Dist.CLIENT) - public static void onRender(RenderGameOverlayEvent.Post event) { - if (event.getType() != RenderGameOverlayEvent.ElementType.CROSSHAIRS) + public static void afterRenderOverlayLayer(RenderGameOverlayEvent.PostLayer event) { + if (event.getOverlay() != ForgeIngameGui.CROSSHAIR_ELEMENT) return; Minecraft mc = Minecraft.getInstance(); @@ -272,7 +274,7 @@ public class PlacementHelpers { Tesselator tessellator = Tesselator.getInstance(); BufferBuilder buffer = tessellator.getBuilder(); - buffer.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); + buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); Matrix4f mat = ms.last().pose(); buffer.vertex(mat, -1, -1, 0).color(1f, 1f, 1f, alpha).uv(tx, ty).endVertex(); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java index c6c18eaae..e9443426b 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java @@ -84,7 +84,7 @@ public class WrappedChunk implements ChunkAccess { } @Override - public void setBlockEntity(BlockPos p_177426_1_, BlockEntity p_177426_2_) { + public void setBlockEntity(BlockEntity p_177426_2_) { } @@ -123,11 +123,6 @@ public class WrappedChunk implements ChunkAccess { return pos; } - @Override - public void setLastSaveTime(long p_177432_1_) { - - } - @Nullable @Override public ChunkBiomeContainer getBiomes() {