Chipping away, Part III

This commit is contained in:
PepperBell 2021-11-02 19:04:52 -07:00
parent d35f5905ff
commit 1c23302544
78 changed files with 254 additions and 235 deletions

View file

@ -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<VerticalGearboxItem> VERTICAL_GEARBOX =
REGISTRATE.item("vertical_gearbox", VerticalGearboxItem::new)
.model(AssetLookup.<VerticalGearboxItem>customBlockItemModel("gearbox", "item_vertical"))
.model(AssetLookup.customBlockItemModel("gearbox", "item_vertical"))
.register();
public static final ItemEntry<BlazeBurnerBlockItem> EMPTY_BLAZE_BURNER =
REGISTRATE.item("empty_blaze_burner", BlazeBurnerBlockItem::empty)
.model(AssetLookup.<BlazeBurnerBlockItem>customBlockItemModel("blaze_burner", "block"))
.model(AssetLookup.customBlockItemModel("blaze_burner", "block"))
.register();
public static final ItemEntry<GogglesItem> GOGGLES = REGISTRATE.item("goggles", GogglesItem::new)
@ -227,19 +220,16 @@ public class AllItems {
.register();
public static final ItemEntry<SandPaperItem> SAND_PAPER = REGISTRATE.item("sand_paper", SandPaperItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> SandPaperItemRenderer::new))
.tag(AllTags.AllItemTags.SANDPAPER.tag)
.register();
public static final ItemEntry<SandPaperItem> 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<WrenchItem> 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<LinkedControllerItem> 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<PotatoCannonItem> 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<ExtendoGripItem> EXTENDO_GRIP = REGISTRATE.item("extendo_grip", ExtendoGripItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> ExtendoGripItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<SymmetryWandItem> WAND_OF_SYMMETRY =
REGISTRATE.item("wand_of_symmetry", SymmetryWandItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> SymmetryWandItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<WorldshaperItem> 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();

View file

@ -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();

View file

@ -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();

View file

@ -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;

View file

@ -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++) {

View file

@ -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<BlazeBurnerTileE
SuperByteBuffer blazeBuffer = PartialBufferer.get(blazeModel, te.getBlockState());
blazeBuffer.rotateCentered(Direction.UP, AngleHelper.rad(te.headAngle.getValue(partialTicks)));
blazeBuffer.translate(0, offset, 0);
blazeBuffer.light(0xF000F0)
blazeBuffer.light(LightTexture.FULL_BRIGHT)
.renderInto(ms, buffer.getBuffer(RenderType.solid()));
}
}

View file

@ -24,9 +24,9 @@ import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.render.ReducedDestroyEffects;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.ReducedDestroyEffects;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View file

@ -1,11 +1,14 @@
package com.simibubi.create.content.contraptions.wrench;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.AllTags;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.item.render.SimpleCustomRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
@ -20,6 +23,9 @@ import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IItemRenderProperties;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
public class WrenchItem extends Item {
@ -85,4 +91,10 @@ public class WrenchItem extends Item {
minecart.hurt(DamageSource.playerAttack(player), 100);
}
@Override
@OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new WrenchItemRenderer()));
}
}

View file

@ -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<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new SymmetryWandItemRenderer()));
}
}

View file

@ -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<Sy
protected void render(ItemStack stack, SymmetryWandModel model, PartialItemModelRenderer renderer, ItemTransforms.TransformType transformType,
PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
float worldTime = AnimationTickHolder.getRenderTime() / 20;
int maxLight = 0xF000F0;
int maxLight = LightTexture.FULL_BRIGHT;
renderer.render(model.getOriginalModel(), light);
renderer.renderSolidGlowing(model.getPartial("core"), maxLight);

View file

@ -77,7 +77,7 @@ public class BlueprintContainer extends GhostItemContainer<BlueprintSection> {
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<BlueprintSection> {
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<BlueprintSection> {
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();

View file

@ -80,7 +80,7 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
@Override
protected void renderTooltip(PoseStack ms, int x, int y) {
if (!this.minecraft.player.getInventory().getCarried()
if (!menu.getCarried()
.isEmpty() || this.hoveredSlot == null || this.hoveredSlot.hasItem()
|| hoveredSlot.container == menu.playerInventory) {
super.renderTooltip(ms, x, y);
@ -130,9 +130,8 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
}
@Override
public void tick() {
protected void containerTick() {
// handleTooltips();
super.tick();
if (!menu.contentHolder.isEntityAlive())
minecraft.player.closeContainer();

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.curiosities.tools;
import java.util.UUID;
import java.util.function.Consumer;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
@ -8,6 +9,7 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.content.curiosities.armor.BackTankUtil;
import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.render.SimpleCustomRenderer;
import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
@ -35,6 +37,7 @@ import net.minecraft.world.phys.HitResult.Type;
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.client.event.InputEvent.ClickInputEvent;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
@ -321,4 +324,10 @@ public class ExtendoGripItem extends Item {
return holdingGrip;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new ExtendoGripItemRenderer()));
}
}

View file

@ -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);

View file

@ -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<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new SandPaperItemRenderer()));
}
}

View file

@ -58,7 +58,7 @@ public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer<SandP
}
ItemStack toPolish = ItemStack.of(tag.getCompound("Polishing"));
itemRenderer.renderStatic(toPolish, TransformType.NONE, light, overlay, ms, buffer);
itemRenderer.renderStatic(toPolish, TransformType.NONE, light, overlay, ms, buffer, 0);
ms.popPose();
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities.weapons;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Predicate;
import com.simibubi.create.AllEnchantments;
@ -11,6 +12,7 @@ import com.simibubi.create.CreateClient;
import com.simibubi.create.content.curiosities.armor.BackTankUtil;
import com.simibubi.create.content.curiosities.zapper.ShootableGadgetItemMethods;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.render.SimpleCustomRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper;
@ -43,6 +45,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IItemRenderProperties;
public class PotatoCannonItem extends ProjectileWeaponItem {
@ -292,4 +295,10 @@ public class PotatoCannonItem extends ProjectileWeaponItem {
return 15;
}
@Override
@OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new PotatoCannonItemRenderer()));
}
}

View file

@ -57,7 +57,7 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer<Po
localMs.scale(.5f, .5f, .5f);
MatrixTransformStack.of(localMs)
.rotateY(-34);
itemRenderer.renderStatic(ammo, TransformType.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer);
itemRenderer.renderStatic(ammo, TransformType.GUI, light, OverlayTexture.NO_OVERLAY, localMs, buffer, 0);
});
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.curiosities.zapper;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
@ -98,7 +99,7 @@ public abstract class ShootableGadgetRenderHandler {
// Render arm
ms.pushPose();
textureManager.bind(player.getSkinTextureLocation());
RenderSystem.setShaderTexture(0, player.getSkinTextureLocation());
float flip = rightHand ? 1.0F : -1.0F;
float f1 = Mth.sqrt(event.getSwingProgress());

View file

@ -41,7 +41,7 @@ public abstract class ZapperItemRenderer<M extends CustomRenderedItemModel> 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()

View file

@ -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<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new WorldshaperItemRenderer()));
}
}

View file

@ -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;

View file

@ -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;

View file

@ -116,9 +116,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
}
@Override
public void tick() {
super.tick();
protected void containerTick() {
if (!AllBlocks.ADJUSTABLE_CRATE.has(minecraft.level.getBlockState(te.getBlockPos())))
minecraft.setScreen(null);

View file

@ -14,6 +14,7 @@ import com.simibubi.create.foundation.utility.Couple;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.font.glyphs.BakedGlyph;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
@ -115,7 +116,7 @@ public class NixieTubeRenderer extends SafeTileEntityRenderer<NixieTubeTileEntit
private static void drawChar(PoseStack ms, MultiBufferSource buffer, String c, int color) {
Font fontRenderer = Minecraft.getInstance().font;
fontRenderer.drawInBatch(c, 0, 0, color, false, ms.last()
.pose(), buffer, false, 0, 15728880);
.pose(), buffer, false, 0, LightTexture.FULL_BRIGHT);
if (buffer instanceof BufferSource) {
BakedGlyph texturedglyph = fontRenderer.getFontSet(Style.DEFAULT_FONT)
.whiteGlyph();

View file

@ -92,15 +92,17 @@ public class LinkedControllerContainer extends AbstractContainerMenu implements
}
@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 == playerInventory.selected && clickTypeIn != ClickType.THROW)
return ItemStack.EMPTY;
return;
ItemStack held = playerInventory.getCarried();
if (slotId < 36)
return super.clicked(slotId, dragType, clickTypeIn, player);
ItemStack held = getCarried();
if (slotId < 36) {
super.clicked(slotId, dragType, clickTypeIn, player);
return;
}
if (clickTypeIn == ClickType.THROW)
return ItemStack.EMPTY;
return;
int slot = slotId - 36;
if (clickTypeIn == ClickType.CLONE) {
@ -108,21 +110,20 @@ public class LinkedControllerContainer extends AbstractContainerMenu implements
ItemStack stackInSlot = filterInventory.getStackInSlot(slot)
.copy();
stackInSlot.setCount(64);
playerInventory.setCarried(stackInSlot);
return ItemStack.EMPTY;
setCarried(stackInSlot);
return;
}
return ItemStack.EMPTY;
return;
}
if (held.isEmpty()) {
filterInventory.setStackInSlot(slot, ItemStack.EMPTY);
return ItemStack.EMPTY;
return;
}
ItemStack insert = held.copy();
insert.setCount(1);
filterInventory.setStackInSlot(slot, insert);
return held;
}
protected ItemStackHandler createFilterInventory() {

View file

@ -1,9 +1,12 @@
package com.simibubi.create.content.logistics.item;
import java.util.function.Consumer;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler;
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler.Frequency;
import com.simibubi.create.foundation.item.render.SimpleCustomRenderer;
import com.simibubi.create.foundation.utility.Couple;
import net.minecraft.core.BlockPos;
@ -27,6 +30,7 @@ import net.minecraft.world.level.block.LecternBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IItemRenderProperties;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fmllegacy.network.NetworkHooks;
import net.minecraftforge.items.ItemStackHandler;
@ -138,4 +142,10 @@ public class LinkedControllerItem extends Item implements MenuProvider {
return new TranslatableComponent(getDescriptionId());
}
@Override
@OnlyIn(Dist.CLIENT)
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
consumer.accept(SimpleCustomRenderer.create(this, new LinkedControllerItemRenderer()));
}
}

View file

@ -74,8 +74,7 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
}
@Override
public void tick() {
super.tick();
protected void containerTick() {
if (!menu.player.getMainHandItem()
.equals(menu.mainItem, false))
minecraft.player.closeContainer();
@ -102,7 +101,7 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
@Override
protected void renderTooltip(PoseStack ms, int x, int y) {
if (!this.minecraft.player.getInventory().getCarried()
if (!menu.getCarried()
.isEmpty() || this.hoveredSlot == null || this.hoveredSlot.hasItem()
|| hoveredSlot.container == menu.playerInventory) {
super.renderTooltip(ms, x, y);

View file

@ -22,10 +22,10 @@ public abstract class AbstractFilterContainer extends GhostItemContainer<ItemSta
}
@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 == playerInventory.selected && clickTypeIn != ClickType.THROW)
return ItemStack.EMPTY;
return super.clicked(slotId, dragType, clickTypeIn, player);
return;
super.clicked(slotId, dragType, clickTypeIn, player);
}
@Override

View file

@ -78,9 +78,8 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
}
@Override
public void tick() {
protected void containerTick() {
handleTooltips();
super.tick();
handleIndicators();
if (!menu.player.getMainHandItem()

View file

@ -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

View file

@ -176,8 +176,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
}
@Override
public void tick() {
super.tick();
protected void containerTick() {
ItemStack stackInSlot = menu.ghostInventory.getStackInSlot(0);
if (!stackInSlot.equals(lastItemScanned, false))
referenceItemChanged(stackInSlot);
@ -185,8 +184,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
@Override
protected void renderTooltip(PoseStack matrixStack, int mouseX, int mouseY) {
if (this.minecraft.player.getInventory().getCarried()
.isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
if (this.menu.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
if (this.hoveredSlot.index == 37) {
renderComponentTooltip(matrixStack, selectedAttributes, mouseX, mouseY);
return;

View file

@ -13,6 +13,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor;
@ -36,8 +37,8 @@ public class SchematicProcessor extends StructureProcessor {
@Override
public StructureTemplate.StructureBlockInfo process(LevelReader world, BlockPos pos, BlockPos anotherPos, StructureTemplate.StructureBlockInfo rawInfo,
StructureTemplate.StructureBlockInfo info, StructurePlaceSettings settings, @Nullable StructureTemplate template) {
if (info.nbt != null) {
BlockEntity te = info.state.createTileEntity(world);
if (info.nbt != null && info.state.hasBlockEntity()) {
BlockEntity te = ((EntityBlock) info.state.getBlock()).newBlockEntity(info.pos, info.state);
if (te != null) {
CompoundTag nbt = NBTProcessors.process(te, info.nbt, false);
if (nbt != info.nbt)

View file

@ -29,6 +29,7 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.AbstractFurnaceBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
@ -96,7 +97,7 @@ public class SchematicWorld extends WrappedWorld implements ServerLevelAccessor
BlockState blockState = getBlockState(pos);
if (blockState.hasBlockEntity()) {
try {
BlockEntity tileEntity = blockState.createTileEntity(this);
BlockEntity tileEntity = ((EntityBlock) blockState.getBlock()).newBlockEntity(pos, blockState);
if (tileEntity != null) {
onTEadded(tileEntity, pos);
tileEntities.put(pos, tileEntity);

View file

@ -29,7 +29,7 @@ public class SchematicTableContainer extends AbstractContainerMenu {
BlockEntity tileEntity = world.getBlockEntity(extraData.readBlockPos());
if (tileEntity instanceof SchematicTableTileEntity) {
this.te = (SchematicTableTileEntity) tileEntity;
this.te.handleUpdateTag(te.getBlockState(), extraData.readNbt());
this.te.handleUpdateTag(extraData.readNbt());
init();
}
}

View file

@ -140,8 +140,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
}
@Override
public void tick() {
super.tick();
protected void containerTick() {
boolean finished = menu.getSlot(1)
.hasItem();

View file

@ -26,7 +26,7 @@ public class SchematicannonContainer extends AbstractContainerMenu {
BlockEntity tileEntity = world.getBlockEntity(buffer.readBlockPos());
if (tileEntity instanceof SchematicannonTileEntity) {
this.te = (SchematicannonTileEntity) tileEntity;
this.te.handleUpdateTag(te.getBlockState(), buffer.readNbt());
this.te.handleUpdateTag(buffer.readNbt());
init();
}
}

View file

@ -163,7 +163,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
}
@Override
public void tick() {
protected void containerTick() {
SchematicannonTileEntity te = menu.getTileEntity();
if (!placementSettingsHidden()) {
@ -201,8 +201,6 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
}
handleTooltips();
super.tick();
}
protected void handleTooltips() {

View file

@ -207,8 +207,8 @@ public class SchematicAndQuillHandler {
public void saveSchematic(String string, boolean convertImmediately) {
StructureTemplate t = new StructureTemplate();
BoundingBox bb = new BoundingBox(firstPos, secondPos);
BlockPos origin = new BlockPos(bb.x0, bb.y0, bb.z0);
BoundingBox bb = BoundingBox.fromCorners(firstPos, secondPos);
BlockPos origin = new BlockPos(bb.minX(), bb.minY(), bb.minZ());
BlockPos bounds = new BlockPos(bb.getXSpan(), bb.getYSpan(), bb.getZSpan());
t.fillFromWorld(Minecraft.getInstance().level, origin, bounds, true, Blocks.AIR);

View file

@ -7,12 +7,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.lwjgl.opengl.GL11;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
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 com.simibubi.create.content.schematics.SchematicWorld;
import com.simibubi.create.foundation.render.SuperByteBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
@ -109,11 +108,11 @@ public class SchematicRenderer {
BufferBuilder bufferBuilder = buffers.get(blockRenderLayer);
if (startedBufferBuilders.add(blockRenderLayer))
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormat.BLOCK);
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
BlockEntity tileEntity = blockAccess.getBlockEntity(localPos);
if (blockRendererDispatcher.renderModel(state, pos, blockAccess, ms, bufferBuilder, true,
if (blockRendererDispatcher.renderBatched(state, pos, blockAccess, ms, bufferBuilder, true,
minecraft.level.random,
tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE)) {
usedBlockRenderLayers.add(blockRenderLayer);

View file

@ -49,7 +49,7 @@ public class SchematicPlacePacket extends SimplePacketBase {
continue;
printer.handleCurrentTarget((pos, state, tile) -> {
boolean placingAir = state.getBlock().isAir(state, world, pos);
boolean placingAir = state.isAir();
if (placingAir && !includeAir)
return;

View file

@ -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,

View file

@ -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;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.foundation.utility;
package com.simibubi.create.foundation.block.render;
import org.apache.commons.lang3.mutable.MutableInt;

View file

@ -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()

View file

@ -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)

View file

@ -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);

View file

@ -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<DataGenContext<Block, ReinforcedRailBlock>, 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 <B extends LinearChassisBlock> NonNullBiConsumer<DataGenContext<Block, B>, RegistrateBlockstateProvider> linearChassis() {
return (c, p) -> {
ResourceLocation side = p.modLoc("block/" + c.getName() + "_side");

View file

@ -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<CreateRegistrate> {
return entry -> onClient(() -> () -> registerItemModel(entry, func));
}
public static <T extends Item, P> NonNullUnaryOperator<ItemBuilder<T, P>> customRenderedItem(
Supplier<Supplier<CustomRenderedItemModelRenderer<?>>> supplier) {
return b -> {
onClient(() -> () -> customRenderedItem(b, supplier));
return b;
};
}
protected static void onClient(Supplier<Runnable> toRun) {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, toRun);
}
@OnlyIn(Dist.CLIENT)
private static <T extends Item, P> void customRenderedItem(ItemBuilder<T, P> b,
Supplier<Supplier<CustomRenderedItemModelRenderer<?>>> 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<CreateRegistrate> {
.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);
}
}

View file

@ -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;

View file

@ -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<T extends AbstractContainerMen
@Deprecated
private void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue,
int alpha) {
renderer.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR);
renderer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
renderer.vertex((double) (x + 0), (double) (y + 0), 0.0D)
.color(red, green, blue, alpha)
.endVertex();

View file

@ -1,10 +1,10 @@
package com.simibubi.create.foundation.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
@ -145,9 +145,7 @@ public enum AllGuiTextures implements IScreenRenderable {
@OnlyIn(Dist.CLIENT)
public void bind() {
Minecraft.getInstance()
.getTextureManager()
.bind(location);
RenderSystem.setShaderTexture(0, location);
}
@Override

View file

@ -1,12 +1,12 @@
package com.simibubi.create.foundation.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.PoseStack.Pose;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
@ -163,9 +163,7 @@ public class AllIcons implements IScreenRenderable {
@OnlyIn(Dist.CLIENT)
public void bind() {
Minecraft.getInstance()
.getTextureManager()
.bind(ICON_ATLAS);
RenderSystem.setShaderTexture(0, ICON_ATLAS);
}
@Override

View file

@ -7,6 +7,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.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.Couple;
@ -99,7 +100,7 @@ public class BoxElement extends RenderElement {
Tesselator tessellator = Tesselator.getInstance();
BufferBuilder b = tessellator.getBuilder();
Matrix4f model = ms.last().pose();
b.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR);
b.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
//outer top
b.vertex(model, x - f - 1 , y - f - 2 , z).color(c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha()).endVertex();
b.vertex(model, x - f - 1 , y - f - 1 , z).color(c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha()).endVertex();
@ -126,7 +127,7 @@ public class BoxElement extends RenderElement {
b.vertex(model, x + f + 1 + width, y + f + 1 + height, z).color(c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha()).endVertex();
b.vertex(model, x + f + 1 + width, y - f - 1 , z).color(c1.getRed(), c1.getGreen(), c1.getBlue(), c1.getAlpha()).endVertex();
tessellator.end();
b.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR);
b.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
//inner top - includes corners
b.vertex(model, x - f - 1 , y - f - 1 , z).color(c2.getRed(), c2.getGreen(), c2.getBlue(), c2.getAlpha()).endVertex();
b.vertex(model, x - f - 1 , y - f , z).color(c2.getRed(), c2.getGreen(), c2.getBlue(), c2.getAlpha()).endVertex();

View file

@ -18,6 +18,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Sheets;
@ -112,7 +113,7 @@ public class GuiGameElement {
protected void prepareMatrix(PoseStack matrixStack) {
matrixStack.pushPose();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.alphaFunc(516, 0.1F);
RenderSystem.enableAlphaTest();
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
@ -180,8 +181,7 @@ public class GuiGameElement {
transformMatrix(matrixStack);
mc.getTextureManager()
.bind(InventoryMenu.BLOCK_ATLAS);
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
renderModel(blockRenderer, buffer, renderType, vb, matrixStack);
cleanUpMatrix(matrixStack);
@ -195,7 +195,7 @@ public class GuiGameElement {
Vec3 rgb = Color.vectorFromRGB(color == -1 ? this.color : color);
blockRenderer.getModelRenderer()
.renderModel(ms.last(), vb, blockState, blockModel, (float) rgb.x, (float) rgb.y, (float) rgb.z,
0xF000F0, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE);
LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE);
buffer.endBatch();
}
@ -214,7 +214,7 @@ public class GuiGameElement {
RenderType renderType, VertexConsumer vb, PoseStack ms) {
if (blockState.getBlock() instanceof FireBlock) {
Lighting.setupForFlatItems();
blockRenderer.renderBlock(blockState, ms, buffer, 0xF000F0, OverlayTexture.NO_OVERLAY,
blockRenderer.renderSingleBlock(blockState, ms, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY,
VirtualEmptyModelData.INSTANCE);
buffer.endBatch();
Lighting.setupFor3DItems();
@ -228,7 +228,7 @@ public class GuiGameElement {
return;
FluidRenderer.renderTiledFluidBB(new FluidStack(blockState.getFluidState()
.getType(), 1000), 0, 0, 0, 1.0001f, 1.0001f, 1.0001f, buffer, ms, 0xF000F0, false);
.getType(), 1000), 0, 0, 0, 1.0001f, 1.0001f, 1.0001f, buffer, ms, LightTexture.FULL_BRIGHT, false);
buffer.endBatch();
}
}
@ -263,10 +263,10 @@ public class GuiGameElement {
public static void renderItemIntoGUI(PoseStack matrixStack, ItemStack stack, boolean useDefaultLighting) {
ItemRenderer renderer = Minecraft.getInstance().getItemRenderer();
BakedModel bakedModel = renderer.getModel(stack, null, null);
BakedModel bakedModel = renderer.getModel(stack, null, null, 0);
matrixStack.pushPose();
renderer.textureManager.bind(TextureAtlas.LOCATION_BLOCKS);
RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_BLOCKS);
renderer.textureManager.getTexture(TextureAtlas.LOCATION_BLOCKS).setFilter(false, false);
RenderSystem.enableRescaleNormal();
RenderSystem.enableAlphaTest();
@ -274,7 +274,7 @@ public class GuiGameElement {
RenderSystem.defaultAlphaFunc();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
matrixStack.translate(0, 0, 100.0F + renderer.blitOffset);
matrixStack.translate(8.0F, -8.0F, 0.0F);
matrixStack.scale(16.0F, 16.0F, 16.0F);
@ -286,7 +286,7 @@ public class GuiGameElement {
}
}
renderer.render(stack, ItemTransforms.TransformType.GUI, false, matrixStack, buffer, 0xF000F0, OverlayTexture.NO_OVERLAY, bakedModel);
renderer.render(stack, ItemTransforms.TransformType.GUI, false, matrixStack, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
buffer.endBatch();
RenderSystem.enableDepthTest();
if (useDefaultLighting) {

View file

@ -72,11 +72,9 @@ public class ToolSelectionScreen extends Screen {
AllGuiTextures gray = AllGuiTextures.HUD_BACKGROUND;
RenderSystem.enableBlend();
RenderSystem.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f);
RenderSystem.setShaderColor(1, 1, 1, focused ? 7 / 8f : 1 / 2f);
Minecraft.getInstance()
.getTextureManager()
.bind(gray.location);
RenderSystem.setShaderTexture(0, gray.location);
blit(matrixStack, x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height);
float toolTipAlpha = yOffset / 10;
@ -85,9 +83,9 @@ public class ToolSelectionScreen extends Screen {
int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24;
if (toolTipAlpha > 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);

View file

@ -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();

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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();

View file

@ -80,7 +80,7 @@ public class PonderWorldParticles {
enable.run();
Iterable<Particle> 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);

View file

@ -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));
}
}

View file

@ -433,7 +433,7 @@ public class FunnelScenes {
scene.world.modifyEntities(ItemEntity.class, e -> {
if (e.getY() < 1)
e.remove();
e.discard();
});
if (i == 2) {

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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);
});
}

View file

@ -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();
}

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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);

View file

@ -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();

View file

@ -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() {