From 0cf0d3930e4f8759b61435acbf972018ba322269 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Sat, 19 Feb 2022 21:42:40 -0800 Subject: [PATCH] Shuffling the shade - Update Flywheel and add support for unshaded quads - Fix models marking shafts and other parts as unshaded - Refactor SchematicRenderer buffer building - Improve block entity render bounding box caching - Fix #2785 --- gradle.properties | 2 +- .../contraptions/base/KineticTileEntity.java | 16 --- .../actors/HarvesterTileEntity.java | 13 +- .../PortableStorageInterfaceTileEntity.java | 12 +- .../CrushingWheelControllerTileEntity.java | 2 +- .../crusher/CrushingWheelTileEntity.java | 8 +- .../deployer/DeployerTileEntity.java | 4 +- .../flywheel/FlywheelTileEntity.java | 4 +- .../flywheel/engine/EngineTileEntity.java | 11 +- .../mixer/MechanicalMixerTileEntity.java | 2 +- .../press/MechanicalPressTileEntity.java | 2 +- .../components/saw/SawTileEntity.java | 7 +- .../pulley/PulleyTileEntity.java | 5 +- .../waterwheel/WaterWheelTileEntity.java | 2 +- .../fluids/actors/HosePulleyTileEntity.java | 8 +- .../fluids/actors/SpoutTileEntity.java | 11 +- .../fluids/tank/FluidTankTileEntity.java | 25 +--- .../relays/belt/BeltTileEntity.java | 7 +- .../elementary/SimpleKineticTileEntity.java | 2 +- .../curiosities/armor/AllArmorMaterials.java | 41 +++--- .../block/chute/ChuteTileEntity.java | 2 +- .../block/mechanicalArm/ArmTileEntity.java | 7 +- .../block/SchematicannonTileEntity.java | 3 + .../schematics/client/SchematicRenderer.java | 134 +++++++++--------- .../ponder/element/WorldSectionElement.java | 51 +++++-- .../foundation/render/SuperByteBuffer.java | 16 ++- .../tileEntity/CachedRenderBBTileEntity.java | 35 +++++ .../tileEntity/SmartTileEntity.java | 2 +- .../create/models/block/belt_pulley.json | 1 - .../assets/create/models/block/cogwheel.json | 1 - .../models/block/creative_motor/item.json | 1 - .../create/models/block/crushing_wheel.json | 1 - .../create/models/block/deployer/item.json | 1 - .../create/models/block/fluid_valve/item.json | 1 - .../models/block/gantry_shaft/block_end.json | 1 - .../block/gantry_shaft/block_single.json | 1 - .../block/gantry_shaft/block_start.json | 1 - .../create/models/block/hand_crank/block.json | 1 - .../create/models/block/hand_crank/item.json | 1 - .../create/models/block/large_cogwheel.json | 1 - .../models/block/mechanical_drill/head.json | 1 - .../models/block/mechanical_drill/item.json | 1 - .../models/block/mechanical_mixer/head.json | 1 - .../models/block/mechanical_mixer/item.json | 1 - .../create/models/block/millstone/inner.json | 1 - .../assets/create/models/block/shaft.json | 1 - .../create/models/block/shaft_half.json | 1 - .../assets/create/models/block/turntable.json | 1 - .../create/models/block/water_wheel.json | 1 - .../models/item/incomplete_cogwheel.json | 1 - .../item/incomplete_large_cogwheel.json | 1 - 51 files changed, 230 insertions(+), 227 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/tileEntity/CachedRenderBBTileEntity.java diff --git a/gradle.properties b/gradle.properties index 33e29b3df..0e9349580 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ parchment_version = 2022.01.23 # dependency versions registrate_version = MC1.18-1.0.21 -flywheel_version = 1.18-0.6.1.61 +flywheel_version = 1.18-0.6.1.62 jei_minecraft_version = 1.18.1 jei_version = 9.3.2.92 diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index 1a8c1dfa6..543465645 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -42,7 +42,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; @@ -96,7 +95,6 @@ public class KineticTileEntity extends SmartTileEntity effects.tick(); if (level.isClientSide) { - cachedBoundingBox = null; // cache the bounding box for every frame between ticks DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio()); return; } @@ -570,20 +568,6 @@ public class KineticTileEntity extends SmartTileEntity DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this)); } - protected AABB cachedBoundingBox; - - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - if (cachedBoundingBox == null) { - cachedBoundingBox = makeRenderBoundingBox(); - } - return cachedBoundingBox; - } - - protected AABB makeRenderBoundingBox() { - return super.getRenderBoundingBox(); - } - @OnlyIn(Dist.CLIENT) public void tickAudio() { float componentSpeed = Math.abs(getSpeed()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java index a82228c5a..93dc35fa3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java @@ -1,17 +1,13 @@ package com.simibubi.create.content.contraptions.components.actors; -import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; +import com.simibubi.create.foundation.tileEntity.CachedRenderBBTileEntity; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -public class HarvesterTileEntity extends SyncedTileEntity { - - private static final AABB RENDER_BOX = new AABB(0, 0, 0, 1, 1, 1); +public class HarvesterTileEntity extends CachedRenderBBTileEntity { // For simulations such as Ponder private float manuallyAnimatedSpeed; @@ -21,9 +17,8 @@ public class HarvesterTileEntity extends SyncedTileEntity { } @Override - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - return RENDER_BOX.move(worldPosition); + protected AABB createRenderBoundingBox() { + return new AABB(worldPosition); } public float getAnimatedSpeed() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java index d9c56fbd5..2fd454fc4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java @@ -15,8 +15,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity { @@ -113,15 +111,9 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity return powered; } - protected AABB cachedBoundingBox; - @Override - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - if (cachedBoundingBox == null) { - cachedBoundingBox = super.getRenderBoundingBox().inflate(2); - } - return cachedBoundingBox; + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().inflate(2); } public boolean isTransferring() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java index 0101832f3..ba350f9ba 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java @@ -231,7 +231,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity { processingEntity.setPos(entityOutPos.x, entityOutPos.y, entityOutPos.z); } } - processingEntity.hurt(CrushingWheelTileEntity.damageSource, crusherDamage); + processingEntity.hurt(CrushingWheelTileEntity.DAMAGE_SOURCE, crusherDamage); if (!processingEntity.isAlive()) { processingEntity.setPos(entityOutPos.x, entityOutPos.y, entityOutPos.z); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java index 0dae399f3..2e8ad932a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java @@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber public class CrushingWheelTileEntity extends KineticTileEntity { - public static DamageSource damageSource = new DamageSource("create.crush").bypassArmor() + public static final DamageSource DAMAGE_SOURCE = new DamageSource("create.crush").bypassArmor() .setScalesWithDifficulty(); public CrushingWheelTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { @@ -40,7 +40,7 @@ public class CrushingWheelTileEntity extends KineticTileEntity { } @Override - public AABB makeRenderBoundingBox() { + protected AABB createRenderBoundingBox() { return new AABB(worldPosition).inflate(1); } @@ -52,14 +52,14 @@ public class CrushingWheelTileEntity extends KineticTileEntity { @SubscribeEvent public static void crushingIsFortunate(LootingLevelEvent event) { - if (event.getDamageSource() != damageSource) + if (event.getDamageSource() != DAMAGE_SOURCE) return; event.setLootingLevel(2); //This does not currently increase mob drops. It seems like this only works for damage done by an entity. } @SubscribeEvent public static void handleCrushedMobDrops(LivingDropsEvent event) { - if (event.getSource() != CrushingWheelTileEntity.damageSource) + if (event.getSource() != CrushingWheelTileEntity.DAMAGE_SOURCE) return; Vec3 outSpeed = Vec3.ZERO; for (ItemEntity outputItem : event.getDrops()) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java index 6e0fb2f1b..b67b30405 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java @@ -388,8 +388,8 @@ public class DeployerTileEntity extends KineticTileEntity { } @Override - public AABB makeRenderBoundingBox() { - return super.makeRenderBoundingBox().inflate(3); + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().inflate(3); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java index 78a48627a..057b629e2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java @@ -50,8 +50,8 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity { } @Override - public AABB makeRenderBoundingBox() { - return super.makeRenderBoundingBox().inflate(2); + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().inflate(2); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java index 9ecdc12f9..ad23ca72d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java @@ -14,8 +14,6 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public class EngineTileEntity extends SmartTileEntity { @@ -31,14 +29,9 @@ public class EngineTileEntity extends SmartTileEntity { public void addBehaviours(List behaviours) { } - protected AABB cachedBoundingBox; @Override - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - if (cachedBoundingBox == null) { - cachedBoundingBox = super.getRenderBoundingBox().inflate(1.5f); - } - return cachedBoundingBox; + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().inflate(1.5f); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java index 53587571f..237c82984 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java @@ -91,7 +91,7 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { } @Override - public AABB makeRenderBoundingBox() { + protected AABB createRenderBoundingBox() { return new AABB(worldPosition).expandTowards(0, -1.5, 0); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java index 66c0d14b3..ff498a1f0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java @@ -111,7 +111,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { } @Override - public AABB makeRenderBoundingBox() { + protected AABB createRenderBoundingBox() { return new AABB(worldPosition).expandTowards(0, -1.5, 0) .expandTowards(0, 1, 0); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java index cb0bc8b71..defb4f3e6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java @@ -73,8 +73,6 @@ import net.minecraftforge.items.IItemHandler; @MethodsReturnNonnullByDefault public class SawTileEntity extends BlockBreakingKineticTileEntity { - private static final AABB RENDER_BOX = new AABB(0, 0, 0, 1, 1, 1); - private static final Object cuttingRecipesKey = new Object(); public static final Supplier> woodcuttingRecipeType = Suppliers.memoize(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting"))); @@ -125,9 +123,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity { } @Override - protected AABB makeRenderBoundingBox() { - return RENDER_BOX.inflate(.125f) - .move(worldPosition); + protected AABB createRenderBoundingBox() { + return new AABB(worldPosition).inflate(.125f); } @Override 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 a441696f8..df74fa28e 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 @@ -34,8 +34,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { } @Override - public AABB makeRenderBoundingBox() { - return super.makeRenderBoundingBox().expandTowards(0, -offset, 0); + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().expandTowards(0, -offset, 0); } @Override @@ -43,6 +43,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { super.tick(); if (isVirtual()) prevAnimatedOffset = offset; + invalidateRenderBoundingBox(); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java index 2f4aede14..10a0a68ab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java @@ -38,7 +38,7 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity { } @Override - public AABB makeRenderBoundingBox() { + protected AABB createRenderBoundingBox() { return new AABB(worldPosition).inflate(1); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java index 7e3d47a6c..204faf0ee 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java @@ -16,8 +16,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; @@ -99,9 +97,8 @@ public class HosePulleyTileEntity extends KineticTileEntity { } @Override - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - return super.getRenderBoundingBox().expandTowards(0, -offset.getValue(), 0); + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().expandTowards(0, -offset.getValue(), 0); } @Override @@ -122,6 +119,7 @@ public class HosePulleyTileEntity extends KineticTileEntity { isMoving = false; offset.setValue(newOffset); + invalidateRenderBoundingBox(); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java index 10c2447da..b671f0c3a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java @@ -33,8 +33,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; @@ -56,14 +54,9 @@ public class SpoutTileEntity extends SmartTileEntity implements IHaveGoggleInfor processingTicks = -1; } - protected AABB cachedBoundingBox; - @Override - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - if (cachedBoundingBox == null) - cachedBoundingBox = super.getRenderBoundingBox().expandTowards(0, -2, 0); - return cachedBoundingBox; + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().expandTowards(0, -2, 0); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java index c43d2aca0..d1eed27d2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java @@ -25,8 +25,6 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidAttributes; @@ -58,7 +56,6 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI // For rendering purposes only private InterpolatedChasingValue fluidLevel; - private AABB renderBoundingBox; public FluidTankTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); @@ -123,7 +120,7 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI super.initialize(); sendData(); if (level.isClientSide) - updateRenderBoundingBox(); + invalidateRenderBoundingBox(); } private void onPositionChanged() { @@ -304,20 +301,12 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI return isController() ? worldPosition : controller; } - public void updateRenderBoundingBox() { - if (isController()) - renderBoundingBox = super.getRenderBoundingBox().expandTowards(width - 1, height - 1, width - 1); - else - renderBoundingBox = super.getRenderBoundingBox(); - } - @Override - @OnlyIn(Dist.CLIENT) - public AABB getRenderBoundingBox() { - if (renderBoundingBox == null) { - renderBoundingBox = super.getRenderBoundingBox(); - } - return renderBoundingBox; + protected AABB createRenderBoundingBox() { + if (isController()) + return super.createRenderBoundingBox().expandTowards(width - 1, height - 1, width - 1); + else + return super.createRenderBoundingBox(); } @Nullable @@ -380,7 +369,7 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 16); if (isController()) tankInventory.setCapacity(getCapacityMultiplier() * getTotalTankSize()); - updateRenderBoundingBox(); + invalidateRenderBoundingBox(); } if (isController()) { float fillState = getFillState(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index 020db1492..3723b968c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -126,6 +126,7 @@ public class BeltTileEntity extends KineticTileEntity { lighter = new BeltLighter(); } }); + invalidateRenderBoundingBox(); getInventory().tick(); @@ -160,11 +161,11 @@ public class BeltTileEntity extends KineticTileEntity { } @Override - public AABB makeRenderBoundingBox() { + public AABB createRenderBoundingBox() { if (!isController()) - return super.makeRenderBoundingBox(); + return super.createRenderBoundingBox(); else - return super.makeRenderBoundingBox().inflate(beltLength + 1); + return super.createRenderBoundingBox().inflate(beltLength + 1); } protected void initializeItemHandler() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java index 647b60bb0..267f7f9b0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/SimpleKineticTileEntity.java @@ -17,7 +17,7 @@ public class SimpleKineticTileEntity extends KineticTileEntity { } @Override - public AABB makeRenderBoundingBox() { + protected AABB createRenderBoundingBox() { return new AABB(worldPosition).inflate(1); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java b/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java index 24b2f4c77..677fad057 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java @@ -10,8 +10,6 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public enum AllArmorMaterials implements ArmorMaterial { @@ -30,49 +28,56 @@ public enum AllArmorMaterials implements ArmorMaterial { private final float knockbackResistance; private final Supplier repairMaterial; - private AllArmorMaterials(String p_i231593_3_, int p_i231593_4_, int[] p_i231593_5_, int p_i231593_6_, - SoundEvent p_i231593_7_, float p_i231593_8_, float p_i231593_9_, Supplier p_i231593_10_) { - this.name = p_i231593_3_; - this.maxDamageFactor = p_i231593_4_; - this.damageReductionAmountArray = p_i231593_5_; - this.enchantability = p_i231593_6_; - this.soundEvent = p_i231593_7_; - this.toughness = p_i231593_8_; - this.knockbackResistance = p_i231593_9_; - this.repairMaterial = Suppliers.memoize(p_i231593_10_::get); + private AllArmorMaterials(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, + SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier repairMaterial) { + this.name = name; + this.maxDamageFactor = maxDamageFactor; + this.damageReductionAmountArray = damageReductionAmountArray; + this.enchantability = enchantability; + this.soundEvent = soundEvent; + this.toughness = toughness; + this.knockbackResistance = knockbackResistance; + this.repairMaterial = Suppliers.memoize(repairMaterial::get); } - public int getDurabilityForSlot(EquipmentSlot p_200896_1_) { - return MAX_DAMAGE_ARRAY[p_200896_1_.getIndex()] * this.maxDamageFactor; + @Override + public int getDurabilityForSlot(EquipmentSlot slot) { + return MAX_DAMAGE_ARRAY[slot.getIndex()] * this.maxDamageFactor; } - public int getDefenseForSlot(EquipmentSlot p_200902_1_) { - return this.damageReductionAmountArray[p_200902_1_.getIndex()]; + @Override + public int getDefenseForSlot(EquipmentSlot slot) { + return this.damageReductionAmountArray[slot.getIndex()]; } + @Override public int getEnchantmentValue() { return this.enchantability; } + @Override public SoundEvent getEquipSound() { return this.soundEvent; } + @Override public Ingredient getRepairIngredient() { return this.repairMaterial.get(); } - @OnlyIn(Dist.CLIENT) + @Override public String getName() { return this.name; } + @Override public float getToughness() { return this.toughness; } + @Override public float getKnockbackResistance() { return this.knockbackResistance; } -} \ No newline at end of file +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 6d09d3281..38b74d94a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -127,7 +127,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor } @Override - public AABB getRenderBoundingBox() { + protected AABB createRenderBoundingBox() { return new AABB(worldPosition).expandTowards(0, -3, 0); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java index 0d3ff0621..0e0b64824 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java @@ -40,8 +40,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public class ArmTileEntity extends KineticTileEntity implements ITransformableTE { @@ -160,9 +158,8 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE } @Override - @OnlyIn(Dist.CLIENT) - public AABB makeRenderBoundingBox() { - return super.makeRenderBoundingBox().inflate(3); + protected AABB createRenderBoundingBox() { + return super.createRenderBoundingBox().inflate(3); } private boolean checkForMusicAmong(List list) { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index f65d89581..057ea73dd 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -55,6 +55,8 @@ import net.minecraft.world.level.block.state.properties.BedPart; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.phys.AABB; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -812,6 +814,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro } @Override + @OnlyIn(Dist.CLIENT) public AABB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java index 1058517a9..fb9fb0b63 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java @@ -1,15 +1,12 @@ package com.simibubi.create.content.schematics.client; import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; import java.util.Map; import java.util.Random; -import java.util.Set; import com.jozufozu.flywheel.core.model.ModelUtil; -import com.jozufozu.flywheel.util.transform.TransformStack; +import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder; +import com.jozufozu.flywheel.core.model.ShadeSeparatingVertexConsumer; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; @@ -23,17 +20,20 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.ModelBlockRenderer; import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.data.EmptyModelData; public class SchematicRenderer { + private static final ThreadLocal THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new); + private final Map bufferCache = new HashMap<>(getLayerCount()); - private final Set usedBlockRenderLayers = new HashSet<>(getLayerCount()); - private final Set startedBufferBuilders = new HashSet<>(getLayerCount()); private boolean active; private boolean changed; protected SchematicWorld schematic; @@ -69,75 +69,81 @@ public class SchematicRenderer { changed = false; } - public void render(PoseStack ms, SuperRenderTypeBuffer buffer) { + public void render(PoseStack ms, SuperRenderTypeBuffer buffers) { if (!active) return; - for (RenderType layer : RenderType.chunkBufferLayers()) { - if (!usedBlockRenderLayers.contains(layer)) - continue; - SuperByteBuffer superByteBuffer = bufferCache.get(layer); - superByteBuffer.renderInto(ms, buffer.getBuffer(layer)); - } - TileEntityRenderHelper.renderTileEntities(schematic, schematic.getRenderedTileEntities(), ms, buffer); + bufferCache.forEach((layer, buffer) -> { + buffer.renderInto(ms, buffers.getBuffer(layer)); + }); + TileEntityRenderHelper.renderTileEntities(schematic, schematic.getRenderedTileEntities(), ms, buffers); } protected void redraw() { - usedBlockRenderLayers.clear(); - startedBufferBuilders.clear(); - - final SchematicWorld blockAccess = schematic; - final BlockRenderDispatcher blockRendererDispatcher = ModelUtil.VANILLA_RENDERER; - - List blockstates = new LinkedList<>(); - Map buffers = new HashMap<>(); - PoseStack ms = new PoseStack(); - Random random = new Random(); - - BlockPos.betweenClosedStream(blockAccess.getBounds()) - .forEach(localPos -> { - ms.pushPose(); - TransformStack.cast(ms) - .translate(localPos); - BlockPos pos = localPos.offset(anchor); - BlockState state = blockAccess.getBlockState(pos); - - for (RenderType blockRenderLayer : RenderType.chunkBufferLayers()) { - if (!ItemBlockRenderTypes.canRenderInLayer(state, blockRenderLayer)) - continue; - ForgeHooksClient.setRenderType(blockRenderLayer); - if (!buffers.containsKey(blockRenderLayer)) - buffers.put(blockRenderLayer, new BufferBuilder(512)); - - BufferBuilder bufferBuilder = buffers.get(blockRenderLayer); - if (startedBufferBuilders.add(blockRenderLayer)) - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); - - BlockEntity tileEntity = blockAccess.getBlockEntity(localPos); - - if (blockRendererDispatcher.renderBatched(state, pos, blockAccess, ms, bufferBuilder, true, - random, tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE)) { - usedBlockRenderLayers.add(blockRenderLayer); - } - blockstates.add(state); - } - - ForgeHooksClient.setRenderType(null); - ms.popPose(); - }); - - // finishDrawing + bufferCache.clear(); for (RenderType layer : RenderType.chunkBufferLayers()) { - if (!startedBufferBuilders.contains(layer)) - continue; - BufferBuilder buf = buffers.get(layer); - buf.end(); - bufferCache.put(layer, new SuperByteBuffer(buf)); + SuperByteBuffer buffer = drawLayer(layer); + if (!buffer.isEmpty()) + bufferCache.put(layer, buffer); } } + protected SuperByteBuffer drawLayer(RenderType layer) { + BlockRenderDispatcher dispatcher = ModelUtil.VANILLA_RENDERER; + ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); + + PoseStack poseStack = objects.poseStack; + Random random = objects.random; + BlockPos.MutableBlockPos mutableBlockPos = objects.mutableBlockPos; + SchematicWorld renderWorld = schematic; + BoundingBox bounds = renderWorld.getBounds(); + + ShadeSeparatingVertexConsumer shadeSeparatingWrapper = objects.shadeSeparatingWrapper; + ShadeSeparatedBufferBuilder builder = new ShadeSeparatedBufferBuilder(512); + BufferBuilder unshadedBuilder = objects.unshadedBuilder; + + builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + unshadedBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + shadeSeparatingWrapper.prepare(builder, unshadedBuilder); + + ForgeHooksClient.setRenderType(layer); + ModelBlockRenderer.enableCaching(); + for (BlockPos localPos : BlockPos.betweenClosed(bounds.minX(), bounds.minY(), bounds.minZ(), bounds.maxX(), bounds.maxY(), bounds.maxZ())) { + BlockPos pos = mutableBlockPos.setWithOffset(localPos, anchor); + BlockState state = renderWorld.getBlockState(pos); + + poseStack.pushPose(); + poseStack.translate(localPos.getX(), localPos.getY(), localPos.getZ()); + + if (state.getRenderShape() == RenderShape.MODEL && ItemBlockRenderTypes.canRenderInLayer(state, layer)) { + BlockEntity tileEntity = renderWorld.getBlockEntity(localPos); + dispatcher.renderBatched(state, pos, renderWorld, poseStack, shadeSeparatingWrapper, true, random, + tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE); + } + + poseStack.popPose(); + } + ModelBlockRenderer.clearCache(); + ForgeHooksClient.setRenderType(null); + + shadeSeparatingWrapper.clear(); + unshadedBuilder.end(); + builder.appendUnshadedVertices(unshadedBuilder); + builder.end(); + + return new SuperByteBuffer(builder); + } + private static int getLayerCount() { return RenderType.chunkBufferLayers() .size(); } + private static class ThreadLocalObjects { + public final PoseStack poseStack = new PoseStack(); + public final Random random = new Random(); + public final BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + public final ShadeSeparatingVertexConsumer shadeSeparatingWrapper = new ShadeSeparatingVertexConsumer(); + public final BufferBuilder unshadedBuilder = new BufferBuilder(512); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java index 07e648a48..5eedc857e 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java @@ -8,6 +8,8 @@ import java.util.Random; import java.util.function.Consumer; import com.jozufozu.flywheel.core.model.ModelUtil; +import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder; +import com.jozufozu.flywheel.core.model.ShadeSeparatingVertexConsumer; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; @@ -33,6 +35,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.ModelBlockRenderer; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction.Axis; @@ -58,6 +61,8 @@ public class WorldSectionElement extends AnimatedSceneElement { public static final SuperByteBufferCache.Compartment> DOC_WORLD_SECTION = new SuperByteBufferCache.Compartment<>(); + private static final ThreadLocal THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new); + List renderedTileEntities; List>> tickableTileEntities; Selection section; @@ -401,37 +406,57 @@ public class WorldSectionElement extends AnimatedSceneElement { } private SuperByteBuffer buildStructureBuffer(PonderWorld world, RenderType layer) { - ForgeHooksClient.setRenderType(layer); BlockRenderDispatcher dispatcher = ModelUtil.VANILLA_RENDERER; - PoseStack ms = new PoseStack(); - Random random = new Random(); - BufferBuilder builder = new BufferBuilder(512); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); - world.setMask(this.section); + ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); + PoseStack poseStack = objects.poseStack; + Random random = objects.random; + ShadeSeparatingVertexConsumer shadeSeparatingWrapper = objects.shadeSeparatingWrapper; + ShadeSeparatedBufferBuilder builder = new ShadeSeparatedBufferBuilder(512); + BufferBuilder unshadedBuilder = objects.unshadedBuilder; + + builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + unshadedBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + shadeSeparatingWrapper.prepare(builder, unshadedBuilder); + + world.setMask(this.section); + ForgeHooksClient.setRenderType(layer); + ModelBlockRenderer.enableCaching(); section.forEach(pos -> { BlockState state = world.getBlockState(pos); FluidState fluidState = world.getFluidState(pos); - ms.pushPose(); - ms.translate(pos.getX(), pos.getY(), pos.getZ()); + poseStack.pushPose(); + poseStack.translate(pos.getX(), pos.getY(), pos.getZ()); if (state.getRenderShape() == RenderShape.MODEL && ItemBlockRenderTypes.canRenderInLayer(state, layer)) { BlockEntity tileEntity = world.getBlockEntity(pos); - dispatcher.renderBatched(state, pos, world, ms, builder, true, random, + dispatcher.renderBatched(state, pos, world, poseStack, shadeSeparatingWrapper, true, random, tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE); } if (!fluidState.isEmpty() && ItemBlockRenderTypes.canRenderInLayer(fluidState, layer)) dispatcher.renderLiquid(pos, world, builder, fluidState); - ms.popPose(); + poseStack.popPose(); }); - - world.clearMask(); - builder.end(); + ModelBlockRenderer.clearCache(); ForgeHooksClient.setRenderType(null); + world.clearMask(); + + shadeSeparatingWrapper.clear(); + unshadedBuilder.end(); + builder.appendUnshadedVertices(unshadedBuilder); + builder.end(); + return new SuperByteBuffer(builder); } + private static class ThreadLocalObjects { + public final PoseStack poseStack = new PoseStack(); + public final Random random = new Random(); + public final ShadeSeparatingVertexConsumer shadeSeparatingWrapper = new ShadeSeparatingVertexConsumer(); + public final BufferBuilder unshadedBuilder = new BufferBuilder(512); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java index 1500fbb3d..280934641 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -1,7 +1,11 @@ package com.simibubi.create.foundation.render; +import java.util.function.IntPredicate; + +import com.jozufozu.flywheel.api.vertex.ShadedVertexList; import com.jozufozu.flywheel.api.vertex.VertexList; import com.jozufozu.flywheel.backend.OptifineHandler; +import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder; import com.jozufozu.flywheel.core.vertex.BlockVertexList; import com.jozufozu.flywheel.util.DiffuseLightCalculator; import com.jozufozu.flywheel.util.transform.Rotate; @@ -34,6 +38,7 @@ import net.minecraft.world.level.Level; public class SuperByteBuffer implements Scale, Translate, Rotate, TStack { private final VertexList template; + private final IntPredicate shadedPredicate; // Vertex Position private final PoseStack transforms; @@ -65,7 +70,14 @@ public class SuperByteBuffer implements Scale, Translate true; + } transforms = new PoseStack(); transforms.pushPose(); } @@ -142,7 +154,7 @@ public class SuperByteBuffer implements Scale, Translate type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + @Override + @OnlyIn(Dist.CLIENT) + public AABB getRenderBoundingBox() { + if (renderBoundingBox == null) { + renderBoundingBox = createRenderBoundingBox(); + } + return renderBoundingBox; + } + + protected void invalidateRenderBoundingBox() { + renderBoundingBox = null; + } + + protected AABB createRenderBoundingBox() { + return super.getRenderBoundingBox(); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java index 59ca1d3c1..4355880b0 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java @@ -23,7 +23,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.items.CapabilityItemHandler; -public abstract class SmartTileEntity extends SyncedTileEntity implements IPartialSafeNBT, IInteractionChecker { +public abstract class SmartTileEntity extends CachedRenderBBTileEntity implements IPartialSafeNBT, IInteractionChecker { private final Map, TileEntityBehaviour> behaviours = new HashMap<>(); private boolean initialized = false; diff --git a/src/main/resources/assets/create/models/block/belt_pulley.json b/src/main/resources/assets/create/models/block/belt_pulley.json index df86f499c..588c6f543 100644 --- a/src/main/resources/assets/create/models/block/belt_pulley.json +++ b/src/main/resources/assets/create/models/block/belt_pulley.json @@ -13,7 +13,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/cogwheel.json b/src/main/resources/assets/create/models/block/cogwheel.json index 1bb7de2a4..7761b23e9 100644 --- a/src/main/resources/assets/create/models/block/cogwheel.json +++ b/src/main/resources/assets/create/models/block/cogwheel.json @@ -13,7 +13,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/creative_motor/item.json b/src/main/resources/assets/create/models/block/creative_motor/item.json index da44299a2..07f29fc7f 100644 --- a/src/main/resources/assets/create/models/block/creative_motor/item.json +++ b/src/main/resources/assets/create/models/block/creative_motor/item.json @@ -139,7 +139,6 @@ "name": "Axis", "from": [6, 6, 6], "to": [10, 10, 16], - "shade": false, "rotation": {"angle": 22.5, "axis": "z", "origin": [8, 8, 8]}, "faces": { "north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1_1"}, diff --git a/src/main/resources/assets/create/models/block/crushing_wheel.json b/src/main/resources/assets/create/models/block/crushing_wheel.json index 021c59f45..97dfab0e4 100644 --- a/src/main/resources/assets/create/models/block/crushing_wheel.json +++ b/src/main/resources/assets/create/models/block/crushing_wheel.json @@ -14,7 +14,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#axis"}, "east": {"uv": [6, 0, 10, 16], "texture": "#axis"}, diff --git a/src/main/resources/assets/create/models/block/deployer/item.json b/src/main/resources/assets/create/models/block/deployer/item.json index 2dba7845a..5162106d4 100644 --- a/src/main/resources/assets/create/models/block/deployer/item.json +++ b/src/main/resources/assets/create/models/block/deployer/item.json @@ -185,7 +185,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/fluid_valve/item.json b/src/main/resources/assets/create/models/block/fluid_valve/item.json index 56896d0c3..58f32f1f9 100644 --- a/src/main/resources/assets/create/models/block/fluid_valve/item.json +++ b/src/main/resources/assets/create/models/block/fluid_valve/item.json @@ -27,7 +27,6 @@ "name": "Axis", "from": [6, 6, 0], "to": [10, 10, 16], - "shade": false, "faces": { "north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1_1"}, "east": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#1_0"}, diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json index 23c06e41f..f94b5c438 100644 --- a/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_end.json @@ -36,7 +36,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json index 495caf396..6c4ae2d71 100644 --- a/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_single.json @@ -25,7 +25,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json b/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json index 15ab79845..7cae4bb23 100644 --- a/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json +++ b/src/main/resources/assets/create/models/block/gantry_shaft/block_start.json @@ -36,7 +36,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/hand_crank/block.json b/src/main/resources/assets/create/models/block/hand_crank/block.json index 04ef87a0b..7768edcc3 100644 --- a/src/main/resources/assets/create/models/block/hand_crank/block.json +++ b/src/main/resources/assets/create/models/block/hand_crank/block.json @@ -11,7 +11,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 5, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 5], "rotation": 180, "texture": "#0"}, "east": {"uv": [6, 0, 10, 5], "rotation": 180, "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/hand_crank/item.json b/src/main/resources/assets/create/models/block/hand_crank/item.json index 5a8af5816..a9ee1da23 100644 --- a/src/main/resources/assets/create/models/block/hand_crank/item.json +++ b/src/main/resources/assets/create/models/block/hand_crank/item.json @@ -13,7 +13,6 @@ "name": "Axis", "from": [6, 6, 11], "to": [10, 10, 16], - "shade": false, "faces": { "east": {"uv": [6, 0, 10, 5], "rotation": 270, "texture": "#0"}, "south": {"uv": [6, 6, 10, 10], "texture": "#1"}, diff --git a/src/main/resources/assets/create/models/block/large_cogwheel.json b/src/main/resources/assets/create/models/block/large_cogwheel.json index 9d8023293..5d6ed2b5b 100644 --- a/src/main/resources/assets/create/models/block/large_cogwheel.json +++ b/src/main/resources/assets/create/models/block/large_cogwheel.json @@ -27,7 +27,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/mechanical_drill/head.json b/src/main/resources/assets/create/models/block/mechanical_drill/head.json index 0659789ce..72d61cc98 100644 --- a/src/main/resources/assets/create/models/block/mechanical_drill/head.json +++ b/src/main/resources/assets/create/models/block/mechanical_drill/head.json @@ -14,7 +14,6 @@ "name": "Axle", "from": [6, 6, 0], "to": [10, 10, 4], - "shade": false, "faces": { "north": {"uv": [6, 6, 10, 10], "texture": "#0"}, "east": {"uv": [6, 12, 10, 16], "rotation": 90, "texture": "#1"}, diff --git a/src/main/resources/assets/create/models/block/mechanical_drill/item.json b/src/main/resources/assets/create/models/block/mechanical_drill/item.json index f4ee35562..0deb49447 100644 --- a/src/main/resources/assets/create/models/block/mechanical_drill/item.json +++ b/src/main/resources/assets/create/models/block/mechanical_drill/item.json @@ -17,7 +17,6 @@ "name": "Axle", "from": [6, 6, 0], "to": [10, 10, 4], - "shade": false, "faces": { "north": {"uv": [6, 6, 10, 10], "texture": "#0"}, "east": {"uv": [6, 12, 10, 16], "rotation": 90, "texture": "#1"}, diff --git a/src/main/resources/assets/create/models/block/mechanical_mixer/head.json b/src/main/resources/assets/create/models/block/mechanical_mixer/head.json index 18b1f1e2e..e2d190d9b 100644 --- a/src/main/resources/assets/create/models/block/mechanical_mixer/head.json +++ b/src/main/resources/assets/create/models/block/mechanical_mixer/head.json @@ -11,7 +11,6 @@ "name": "MixerCenter", "from": [7, -4.5, 7], "to": [9, 7.5, 9], - "shade": false, "rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 8]}, "faces": { "north": {"uv": [0, 12, 12, 14], "rotation": 90, "texture": "#6"}, diff --git a/src/main/resources/assets/create/models/block/mechanical_mixer/item.json b/src/main/resources/assets/create/models/block/mechanical_mixer/item.json index 0c912b445..93dd7cdd5 100644 --- a/src/main/resources/assets/create/models/block/mechanical_mixer/item.json +++ b/src/main/resources/assets/create/models/block/mechanical_mixer/item.json @@ -121,7 +121,6 @@ "name": "MixerCenter", "from": [7, -4.5, 7], "to": [9, 7.5, 9], - "shade": false, "rotation": {"angle": 22.5, "axis": "y", "origin": [8, 7, 8]}, "faces": { "north": {"uv": [0, 12, 12, 14], "rotation": 90, "texture": "#6"}, diff --git a/src/main/resources/assets/create/models/block/millstone/inner.json b/src/main/resources/assets/create/models/block/millstone/inner.json index 1735ba332..7ed24f315 100644 --- a/src/main/resources/assets/create/models/block/millstone/inner.json +++ b/src/main/resources/assets/create/models/block/millstone/inner.json @@ -94,7 +94,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 8, 10], - "shade": false, "faces": { "north": {"uv": [6, 8, 10, 16], "rotation": 180, "texture": "#1_0"}, "east": {"uv": [6, 8, 10, 16], "rotation": 180, "texture": "#1_0"}, diff --git a/src/main/resources/assets/create/models/block/shaft.json b/src/main/resources/assets/create/models/block/shaft.json index c873dafe2..ff26e7068 100644 --- a/src/main/resources/assets/create/models/block/shaft.json +++ b/src/main/resources/assets/create/models/block/shaft.json @@ -11,7 +11,6 @@ "name": "Axis", "from": [ 6.0, 0.0, 6.0 ], "to": [ 10.0, 16.0, 10.0 ], - "shade": false, "faces": { "north": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, "east": { "texture": "#0", "uv": [ 6.0, 0.0, 10.0, 16.0 ] }, diff --git a/src/main/resources/assets/create/models/block/shaft_half.json b/src/main/resources/assets/create/models/block/shaft_half.json index b8659e7f9..e15224fb1 100644 --- a/src/main/resources/assets/create/models/block/shaft_half.json +++ b/src/main/resources/assets/create/models/block/shaft_half.json @@ -11,7 +11,6 @@ "name": "Axis", "from": [6, 6, 8], "to": [10, 10, 16], - "shade": false, "faces": { "north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"}, "east": {"uv": [6, 0, 10, 8], "rotation": 270, "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/turntable.json b/src/main/resources/assets/create/models/block/turntable.json index c8b67cb35..1246264c6 100644 --- a/src/main/resources/assets/create/models/block/turntable.json +++ b/src/main/resources/assets/create/models/block/turntable.json @@ -15,7 +15,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 7, 10], - "shade": false, "faces": { "north": {"uv": [6, 9, 10, 16], "texture": "#0"}, "east": {"uv": [6, 9, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/block/water_wheel.json b/src/main/resources/assets/create/models/block/water_wheel.json index bf661632e..e85f8cf34 100644 --- a/src/main/resources/assets/create/models/block/water_wheel.json +++ b/src/main/resources/assets/create/models/block/water_wheel.json @@ -14,7 +14,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#axis"}, "east": {"uv": [6, 0, 10, 16], "texture": "#axis"}, diff --git a/src/main/resources/assets/create/models/item/incomplete_cogwheel.json b/src/main/resources/assets/create/models/item/incomplete_cogwheel.json index 50438130a..ca83f56ca 100644 --- a/src/main/resources/assets/create/models/item/incomplete_cogwheel.json +++ b/src/main/resources/assets/create/models/item/incomplete_cogwheel.json @@ -13,7 +13,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"}, diff --git a/src/main/resources/assets/create/models/item/incomplete_large_cogwheel.json b/src/main/resources/assets/create/models/item/incomplete_large_cogwheel.json index 1a9e884e1..9532ae92e 100644 --- a/src/main/resources/assets/create/models/item/incomplete_large_cogwheel.json +++ b/src/main/resources/assets/create/models/item/incomplete_large_cogwheel.json @@ -13,7 +13,6 @@ "name": "Axis", "from": [6, 0, 6], "to": [10, 16, 10], - "shade": false, "faces": { "north": {"uv": [6, 0, 10, 16], "texture": "#0"}, "east": {"uv": [6, 0, 10, 16], "texture": "#0"},