mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 03:53:12 +01:00
Over-rendered
- Replace AngleHelper.horizontalAngle with horizontalAngleNew (return 0 instead of -90 for vertical directions) - Fix FluidRenderer not calculating correct UVs for integer positions - Fix FluidRenderer rendering streams and flowing texture incorrectly - Slightly improve performance of outlines - Rename PartialBufferer to CachedBufferer - Move specific code out of SuperByteBufferCache into CachedBufferer and BakedModelRenderHelper - Move Compartment inside SuperByteBufferCache - Rename some methods and fields
This commit is contained in:
parent
d15b2281c1
commit
7b4f9f924f
81 changed files with 755 additions and 779 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -14,144 +15,144 @@ import net.minecraft.world.item.DyeColor;
|
|||
|
||||
public class AllBlockPartials {
|
||||
|
||||
public static final PartialModel SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"),
|
||||
SCHEMATICANNON_PIPE = get("schematicannon/pipe"),
|
||||
public static final PartialModel
|
||||
|
||||
SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), SHAFTLESS_LARGE_COGWHEEL = get("large_cogwheel_shaftless"),
|
||||
COGWHEEL_SHAFT = get("cogwheel_shaft"), SHAFT_HALF = get("shaft_half"),
|
||||
SCHEMATICANNON_CONNECTOR = block("schematicannon/connector"),
|
||||
SCHEMATICANNON_PIPE = block("schematicannon/pipe"),
|
||||
|
||||
BELT_PULLEY = get("belt_pulley"), BELT_START = get("belt/start"), BELT_MIDDLE = get("belt/middle"),
|
||||
BELT_END = get("belt/end"), BELT_START_BOTTOM = get("belt/start_bottom"),
|
||||
BELT_MIDDLE_BOTTOM = get("belt/middle_bottom"), BELT_END_BOTTOM = get("belt/end_bottom"),
|
||||
BELT_DIAGONAL_START = get("belt/diagonal_start"), BELT_DIAGONAL_MIDDLE = get("belt/diagonal_middle"),
|
||||
BELT_DIAGONAL_END = get("belt/diagonal_end"),
|
||||
SHAFTLESS_COGWHEEL = block("cogwheel_shaftless"), SHAFTLESS_LARGE_COGWHEEL = block("large_cogwheel_shaftless"),
|
||||
COGWHEEL_SHAFT = block("cogwheel_shaft"), SHAFT_HALF = block("shaft_half"),
|
||||
|
||||
ENCASED_FAN_INNER = get("encased_fan/propeller"), HAND_CRANK_HANDLE = get("hand_crank/handle"),
|
||||
MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"),
|
||||
MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"), MECHANICAL_CRAFTER_LID = get("mechanical_crafter/lid"),
|
||||
MECHANICAL_CRAFTER_ARROW = get("mechanical_crafter/arrow"),
|
||||
MECHANICAL_CRAFTER_BELT_FRAME = get("mechanical_crafter/belt"),
|
||||
MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"),
|
||||
SAW_BLADE_HORIZONTAL_ACTIVE = get("mechanical_saw/blade_horizontal_active"),
|
||||
SAW_BLADE_HORIZONTAL_INACTIVE = get("mechanical_saw/blade_horizontal_inactive"),
|
||||
SAW_BLADE_HORIZONTAL_REVERSED = get("mechanical_saw/blade_horizontal_reversed"),
|
||||
SAW_BLADE_VERTICAL_ACTIVE = get("mechanical_saw/blade_vertical_active"),
|
||||
SAW_BLADE_VERTICAL_INACTIVE = get("mechanical_saw/blade_vertical_inactive"),
|
||||
SAW_BLADE_VERTICAL_REVERSED = get("mechanical_saw/blade_vertical_reversed"), GAUGE_DIAL = get("gauge/dial"),
|
||||
GAUGE_INDICATOR = get("gauge/indicator"), GAUGE_HEAD_SPEED = get("gauge/speedometer/head"),
|
||||
GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), BEARING_TOP = get("bearing/top"),
|
||||
BEARING_TOP_WOODEN = get("bearing/top_wooden"), DRILL_HEAD = get("mechanical_drill/head"),
|
||||
HARVESTER_BLADE = get("mechanical_harvester/blade"), DEPLOYER_POLE = get("deployer/pole"),
|
||||
DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"), DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"),
|
||||
DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"), ANALOG_LEVER_HANDLE = get("analog_lever/handle"),
|
||||
ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"), FUNNEL_FLAP = get("funnel/flap"),
|
||||
BELT_FUNNEL_FLAP = get("belt_funnel/flap"), BELT_TUNNEL_FLAP = get("belt_tunnel/flap"),
|
||||
FLEXPEATER_INDICATOR = get("diodes/indicator"), FLYWHEEL = get("flywheel/wheel"),
|
||||
FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"),
|
||||
BELT_PULLEY = block("belt_pulley"), BELT_START = block("belt/start"), BELT_MIDDLE = block("belt/middle"),
|
||||
BELT_END = block("belt/end"), BELT_START_BOTTOM = block("belt/start_bottom"),
|
||||
BELT_MIDDLE_BOTTOM = block("belt/middle_bottom"), BELT_END_BOTTOM = block("belt/end_bottom"),
|
||||
BELT_DIAGONAL_START = block("belt/diagonal_start"), BELT_DIAGONAL_MIDDLE = block("belt/diagonal_middle"),
|
||||
BELT_DIAGONAL_END = block("belt/diagonal_end"),
|
||||
|
||||
FLYWHEEL_LOWER_ROTATING = get("flywheel/lower_rotating_connector"),
|
||||
FLYWHEEL_UPPER_SLIDING = get("flywheel/upper_sliding_connector"),
|
||||
FLYWHEEL_LOWER_SLIDING = get("flywheel/lower_sliding_connector"),
|
||||
FURNACE_GENERATOR_FRAME = get("furnace_engine/frame"), CUCKOO_MINUTE_HAND = get("cuckoo_clock/minute_hand"),
|
||||
CUCKOO_HOUR_HAND = get("cuckoo_clock/hour_hand"), CUCKOO_LEFT_DOOR = get("cuckoo_clock/left_door"),
|
||||
CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), CUCKOO_PIG = get("cuckoo_clock/pig"),
|
||||
CUCKOO_CREEPER = get("cuckoo_clock/creeper"),
|
||||
ENCASED_FAN_INNER = block("encased_fan/propeller"), HAND_CRANK_HANDLE = block("hand_crank/handle"),
|
||||
MECHANICAL_PRESS_HEAD = block("mechanical_press/head"), MECHANICAL_MIXER_POLE = block("mechanical_mixer/pole"),
|
||||
MECHANICAL_MIXER_HEAD = block("mechanical_mixer/head"), MECHANICAL_CRAFTER_LID = block("mechanical_crafter/lid"),
|
||||
MECHANICAL_CRAFTER_ARROW = block("mechanical_crafter/arrow"),
|
||||
MECHANICAL_CRAFTER_BELT_FRAME = block("mechanical_crafter/belt"),
|
||||
MECHANICAL_CRAFTER_BELT = block("mechanical_crafter/belt_animated"),
|
||||
SAW_BLADE_HORIZONTAL_ACTIVE = block("mechanical_saw/blade_horizontal_active"),
|
||||
SAW_BLADE_HORIZONTAL_INACTIVE = block("mechanical_saw/blade_horizontal_inactive"),
|
||||
SAW_BLADE_HORIZONTAL_REVERSED = block("mechanical_saw/blade_horizontal_reversed"),
|
||||
SAW_BLADE_VERTICAL_ACTIVE = block("mechanical_saw/blade_vertical_active"),
|
||||
SAW_BLADE_VERTICAL_INACTIVE = block("mechanical_saw/blade_vertical_inactive"),
|
||||
SAW_BLADE_VERTICAL_REVERSED = block("mechanical_saw/blade_vertical_reversed"), GAUGE_DIAL = block("gauge/dial"),
|
||||
GAUGE_INDICATOR = block("gauge/indicator"), GAUGE_HEAD_SPEED = block("gauge/speedometer/head"),
|
||||
GAUGE_HEAD_STRESS = block("gauge/stressometer/head"), BEARING_TOP = block("bearing/top"),
|
||||
BEARING_TOP_WOODEN = block("bearing/top_wooden"), DRILL_HEAD = block("mechanical_drill/head"),
|
||||
HARVESTER_BLADE = block("mechanical_harvester/blade"), DEPLOYER_POLE = block("deployer/pole"),
|
||||
DEPLOYER_HAND_POINTING = block("deployer/hand_pointing"), DEPLOYER_HAND_PUNCHING = block("deployer/hand_punching"),
|
||||
DEPLOYER_HAND_HOLDING = block("deployer/hand_holding"), ANALOG_LEVER_HANDLE = block("analog_lever/handle"),
|
||||
ANALOG_LEVER_INDICATOR = block("analog_lever/indicator"), FUNNEL_FLAP = block("funnel/flap"),
|
||||
BELT_FUNNEL_FLAP = block("belt_funnel/flap"), BELT_TUNNEL_FLAP = block("belt_tunnel/flap"),
|
||||
FLEXPEATER_INDICATOR = block("diodes/indicator"), FLYWHEEL = block("flywheel/wheel"),
|
||||
FLYWHEEL_UPPER_ROTATING = block("flywheel/upper_rotating_connector"),
|
||||
|
||||
GANTRY_COGS = get("gantry_carriage/wheels"),
|
||||
FLYWHEEL_LOWER_ROTATING = block("flywheel/lower_rotating_connector"),
|
||||
FLYWHEEL_UPPER_SLIDING = block("flywheel/upper_sliding_connector"),
|
||||
FLYWHEEL_LOWER_SLIDING = block("flywheel/lower_sliding_connector"),
|
||||
FURNACE_GENERATOR_FRAME = block("furnace_engine/frame"), CUCKOO_MINUTE_HAND = block("cuckoo_clock/minute_hand"),
|
||||
CUCKOO_HOUR_HAND = block("cuckoo_clock/hour_hand"), CUCKOO_LEFT_DOOR = block("cuckoo_clock/left_door"),
|
||||
CUCKOO_RIGHT_DOOR = block("cuckoo_clock/right_door"), CUCKOO_PIG = block("cuckoo_clock/pig"),
|
||||
CUCKOO_CREEPER = block("cuckoo_clock/creeper"),
|
||||
|
||||
ROPE_COIL = get("rope_pulley/rope_coil"), ROPE_HALF = get("rope_pulley/rope_half"),
|
||||
ROPE_HALF_MAGNET = get("rope_pulley/rope_half_magnet"),
|
||||
GANTRY_COGS = block("gantry_carriage/wheels"),
|
||||
|
||||
HOSE_COIL = get("hose_pulley/rope_coil"), HOSE = get("hose_pulley/rope"),
|
||||
HOSE_MAGNET = get("hose_pulley/pulley_magnet"), HOSE_HALF = get("hose_pulley/rope_half"),
|
||||
HOSE_HALF_MAGNET = get("hose_pulley/rope_half_magnet"),
|
||||
ROPE_COIL = block("rope_pulley/rope_coil"), ROPE_HALF = block("rope_pulley/rope_half"),
|
||||
ROPE_HALF_MAGNET = block("rope_pulley/rope_half_magnet"),
|
||||
|
||||
MILLSTONE_COG = get("millstone/inner"),
|
||||
HOSE_COIL = block("hose_pulley/rope_coil"), HOSE = block("hose_pulley/rope"),
|
||||
HOSE_MAGNET = block("hose_pulley/pulley_magnet"), HOSE_HALF = block("hose_pulley/rope_half"),
|
||||
HOSE_HALF_MAGNET = block("hose_pulley/rope_half_magnet"),
|
||||
|
||||
SYMMETRY_PLANE = get("symmetry_effect/plane"), SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"),
|
||||
SYMMETRY_TRIPLEPLANE = get("symmetry_effect/tripleplane"),
|
||||
MILLSTONE_COG = block("millstone/inner"),
|
||||
|
||||
STICKER_HEAD = get("sticker/head"),
|
||||
SYMMETRY_PLANE = block("symmetry_effect/plane"), SYMMETRY_CROSSPLANE = block("symmetry_effect/crossplane"),
|
||||
SYMMETRY_TRIPLEPLANE = block("symmetry_effect/tripleplane"),
|
||||
|
||||
PORTABLE_STORAGE_INTERFACE_MIDDLE = get("portable_storage_interface/block_middle"),
|
||||
PORTABLE_STORAGE_INTERFACE_MIDDLE_POWERED = get("portable_storage_interface/block_middle_powered"),
|
||||
PORTABLE_STORAGE_INTERFACE_TOP = get("portable_storage_interface/block_top"),
|
||||
STICKER_HEAD = block("sticker/head"),
|
||||
|
||||
PORTABLE_FLUID_INTERFACE_MIDDLE = get("portable_fluid_interface/block_middle"),
|
||||
PORTABLE_FLUID_INTERFACE_MIDDLE_POWERED = get("portable_fluid_interface/block_middle_powered"),
|
||||
PORTABLE_FLUID_INTERFACE_TOP = get("portable_fluid_interface/block_top"),
|
||||
PORTABLE_STORAGE_INTERFACE_MIDDLE = block("portable_storage_interface/block_middle"),
|
||||
PORTABLE_STORAGE_INTERFACE_MIDDLE_POWERED = block("portable_storage_interface/block_middle_powered"),
|
||||
PORTABLE_STORAGE_INTERFACE_TOP = block("portable_storage_interface/block_top"),
|
||||
|
||||
ARM_COG = get("mechanical_arm/cog"), ARM_BASE = get("mechanical_arm/base"),
|
||||
ARM_LOWER_BODY = get("mechanical_arm/lower_body"), ARM_UPPER_BODY = get("mechanical_arm/upper_body"),
|
||||
ARM_HEAD = get("mechanical_arm/head"), ARM_CLAW_BASE = get("mechanical_arm/claw_base"),
|
||||
ARM_CLAW_GRIP = get("mechanical_arm/claw_grip"),
|
||||
PORTABLE_FLUID_INTERFACE_MIDDLE = block("portable_fluid_interface/block_middle"),
|
||||
PORTABLE_FLUID_INTERFACE_MIDDLE_POWERED = block("portable_fluid_interface/block_middle_powered"),
|
||||
PORTABLE_FLUID_INTERFACE_TOP = block("portable_fluid_interface/block_top"),
|
||||
|
||||
FLAG_SHORT_IN = get("mechanical_arm/flag/short_in"), FLAG_SHORT_OUT = get("mechanical_arm/flag/short_out"),
|
||||
FLAG_LONG_IN = get("mechanical_arm/flag/long_in"), FLAG_LONG_OUT = get("mechanical_arm/flag/long_out"),
|
||||
ARM_COG = block("mechanical_arm/cog"), ARM_BASE = block("mechanical_arm/base"),
|
||||
ARM_LOWER_BODY = block("mechanical_arm/lower_body"), ARM_UPPER_BODY = block("mechanical_arm/upper_body"),
|
||||
ARM_HEAD = block("mechanical_arm/head"), ARM_CLAW_BASE = block("mechanical_arm/claw_base"),
|
||||
ARM_CLAW_GRIP = block("mechanical_arm/claw_grip"),
|
||||
|
||||
MECHANICAL_PUMP_ARROW = get("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = get("mechanical_pump/cog"),
|
||||
FLUID_PIPE_CASING = get("fluid_pipe/casing"), FLUID_VALVE_POINTER = get("fluid_valve/pointer"),
|
||||
FLAG_SHORT_IN = block("mechanical_arm/flag/short_in"), FLAG_SHORT_OUT = block("mechanical_arm/flag/short_out"),
|
||||
FLAG_LONG_IN = block("mechanical_arm/flag/long_in"), FLAG_LONG_OUT = block("mechanical_arm/flag/long_out"),
|
||||
|
||||
SPOUT_TOP = get("spout/top"), SPOUT_MIDDLE = get("spout/middle"), SPOUT_BOTTOM = get("spout/bottom"),
|
||||
MECHANICAL_PUMP_ARROW = block("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = block("mechanical_pump/cog"),
|
||||
FLUID_PIPE_CASING = block("fluid_pipe/casing"), FLUID_VALVE_POINTER = block("fluid_valve/pointer"),
|
||||
|
||||
PECULIAR_BELL = get("peculiar_bell"), HAUNTED_BELL = get("haunted_bell"),
|
||||
SPOUT_TOP = block("spout/top"), SPOUT_MIDDLE = block("spout/middle"), SPOUT_BOTTOM = block("spout/bottom"),
|
||||
|
||||
TOOLBOX_DRAWER = get("toolbox/drawer"),
|
||||
PECULIAR_BELL = block("peculiar_bell"), HAUNTED_BELL = block("haunted_bell"),
|
||||
|
||||
SPEED_CONTROLLER_BRACKET = get("rotation_speed_controller/bracket"),
|
||||
TOOLBOX_DRAWER = block("toolbox/drawer"),
|
||||
|
||||
GOGGLES = get("goggles"),
|
||||
SPEED_CONTROLLER_BRACKET = block("rotation_speed_controller/bracket"),
|
||||
|
||||
EJECTOR_TOP = get("weighted_ejector/top"),
|
||||
GOGGLES = block("goggles"),
|
||||
|
||||
COPPER_BACKTANK_SHAFT = get("copper_backtank/block_shaft_input"),
|
||||
COPPER_BACKTANK_COGS = get("copper_backtank/block_cogs"),
|
||||
EJECTOR_TOP = block("weighted_ejector/top"),
|
||||
|
||||
CRAFTING_BLUEPRINT_1x1 = getEntity("crafting_blueprint_small"),
|
||||
CRAFTING_BLUEPRINT_2x2 = getEntity("crafting_blueprint_medium"),
|
||||
CRAFTING_BLUEPRINT_3x3 = getEntity("crafting_blueprint_large"),
|
||||
COPPER_BACKTANK_SHAFT = block("copper_backtank/block_shaft_input"),
|
||||
COPPER_BACKTANK_COGS = block("copper_backtank/block_cogs"),
|
||||
|
||||
COUPLING_ATTACHMENT = getEntity("minecart_coupling/attachment"),
|
||||
COUPLING_RING = getEntity("minecart_coupling/ring"),
|
||||
COUPLING_CONNECTOR = getEntity("minecart_coupling/connector");
|
||||
CRAFTING_BLUEPRINT_1x1 = entity("crafting_blueprint_small"),
|
||||
CRAFTING_BLUEPRINT_2x2 = entity("crafting_blueprint_medium"),
|
||||
CRAFTING_BLUEPRINT_3x3 = entity("crafting_blueprint_large"),
|
||||
|
||||
COUPLING_ATTACHMENT = entity("minecart_coupling/attachment"),
|
||||
COUPLING_RING = entity("minecart_coupling/ring"),
|
||||
COUPLING_CONNECTOR = entity("minecart_coupling/connector")
|
||||
|
||||
;
|
||||
|
||||
public static final Map<FluidTransportBehaviour.AttachmentTypes, Map<Direction, PartialModel>> PIPE_ATTACHMENTS =
|
||||
new HashMap<>();
|
||||
public static final Map<DyeColor, PartialModel> TOOLBOX_LIDS = new HashMap<>();
|
||||
public static final Map<BlazeBurnerBlock.HeatLevel, PartialModel> BLAZES = new HashMap<>();
|
||||
new EnumMap<>(FluidTransportBehaviour.AttachmentTypes.class);
|
||||
public static final Map<BlazeBurnerBlock.HeatLevel, PartialModel> BLAZES = new EnumMap<>(BlazeBurnerBlock.HeatLevel.class);
|
||||
public static final Map<DyeColor, PartialModel> TOOLBOX_LIDS = new EnumMap<>(DyeColor.class);
|
||||
|
||||
static {
|
||||
populateMaps();
|
||||
}
|
||||
|
||||
static void populateMaps() {
|
||||
for (FluidTransportBehaviour.AttachmentTypes type : FluidTransportBehaviour.AttachmentTypes.values()) {
|
||||
if (!type.hasModel())
|
||||
continue;
|
||||
Map<Direction, PartialModel> map = new HashMap<>();
|
||||
for (Direction d : Iterate.directions) {
|
||||
String asId = Lang.asId(type.name());
|
||||
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getSerializedName())));
|
||||
map.put(d, block("fluid_pipe/" + asId + "/" + Lang.asId(d.getSerializedName())));
|
||||
}
|
||||
PIPE_ATTACHMENTS.put(type, map);
|
||||
}
|
||||
for (BlazeBurnerBlock.HeatLevel heat : BlazeBurnerBlock.HeatLevel.values()) {
|
||||
if (heat == BlazeBurnerBlock.HeatLevel.NONE)
|
||||
continue;
|
||||
BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getSerializedName()));
|
||||
BLAZES.put(heat, block("blaze_burner/blaze/" + heat.getSerializedName()));
|
||||
}
|
||||
for (DyeColor color : DyeColor.values())
|
||||
TOOLBOX_LIDS.put(color, get("toolbox/lid/" + Lang.asId(color.name())));
|
||||
TOOLBOX_LIDS.put(color, block("toolbox/lid/" + Lang.asId(color.name())));
|
||||
}
|
||||
|
||||
private static PartialModel getEntity(String path) {
|
||||
return new PartialModel(Create.asResource("entity/" + path));
|
||||
}
|
||||
|
||||
private static PartialModel get(String path) {
|
||||
private static PartialModel block(String path) {
|
||||
return new PartialModel(Create.asResource("block/" + path));
|
||||
}
|
||||
|
||||
private static PartialModel entity(String path) {
|
||||
return new PartialModel(Create.asResource("entity/" + path));
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
// init static fields
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.simibubi.create.foundation.gui.UIRenderHelper;
|
|||
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
||||
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
|
||||
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.CreateContexts;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||
import com.simibubi.create.foundation.utility.ModelSwapper;
|
||||
|
@ -66,6 +67,9 @@ public class CreateClient {
|
|||
}
|
||||
|
||||
public static void clientInit(final FMLClientSetupEvent event) {
|
||||
BUFFER_CACHE.registerCompartment(CachedBufferer.GENERIC_TILE);
|
||||
BUFFER_CACHE.registerCompartment(CachedBufferer.PARTIAL);
|
||||
BUFFER_CACHE.registerCompartment(CachedBufferer.DIRECTIONAL_PARTIAL);
|
||||
BUFFER_CACHE.registerCompartment(KineticTileEntityRenderer.KINETIC_TILE);
|
||||
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
|
||||
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
|
||||
|
|
|
@ -40,7 +40,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, LightTexture.FULL_BRIGHT, false);
|
||||
FluidRenderer.renderFluidBox(fluid, from, from, from, to, 3/4f, to, buffer, ms, LightTexture.FULL_BRIGHT, false);
|
||||
buffer.endBatch();
|
||||
|
||||
matrixStack.popPose();
|
||||
|
|
|
@ -71,17 +71,19 @@ public class AnimatedSpout extends AnimatedKinetics {
|
|||
matrixStack.pushPose();
|
||||
UIRenderHelper.flipForGuiRender(matrixStack);
|
||||
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, LightTexture.FULL_BRIGHT, false);
|
||||
float from = 3f / 16f;
|
||||
float to = 17f / 16f;
|
||||
FluidRenderer.renderFluidBox(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);
|
||||
UIRenderHelper.flipForGuiRender(matrixStack);
|
||||
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, LightTexture.FULL_BRIGHT,
|
||||
matrixStack.translate(-0.5f, 0, -0.5f);
|
||||
from = -width / 2 + 0.5f;
|
||||
to = width / 2 + 0.5f;
|
||||
FluidRenderer.renderFluidBox(fluids.get(0), from, 0, from, to, 2, to, buffer, matrixStack, LightTexture.FULL_BRIGHT,
|
||||
false);
|
||||
buffer.endBatch();
|
||||
Lighting.setupFor3DItems();
|
||||
|
|
|
@ -4,11 +4,11 @@ import com.jozufozu.flywheel.backend.Backend;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||
import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel;
|
||||
import com.simibubi.create.foundation.render.Compartment;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
@ -29,7 +29,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|||
@EventBusSubscriber(Dist.CLIENT)
|
||||
public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTileEntity> {
|
||||
|
||||
public static final Compartment<BlockState> KINETIC_TILE = new Compartment<>();
|
||||
public static final SuperByteBufferCache.Compartment<BlockState> KINETIC_TILE = new SuperByteBufferCache.Compartment<>();
|
||||
public static boolean rainbowMode = false;
|
||||
|
||||
public KineticTileEntityRenderer(BlockEntityRendererProvider.Context context) {
|
||||
|
@ -47,7 +47,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
|||
|
||||
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, PoseStack ms,
|
||||
VertexConsumer buffer, int light) {
|
||||
SuperByteBuffer superByteBuffer = CreateClient.BUFFER_CACHE.renderBlockIn(KINETIC_TILE, renderedState);
|
||||
SuperByteBuffer superByteBuffer = CachedBufferer.block(KINETIC_TILE, renderedState);
|
||||
renderRotatingBuffer(te, superByteBuffer, ms, buffer, light);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
|||
}
|
||||
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return CreateClient.BUFFER_CACHE.renderBlockIn(KINETIC_TILE, getRenderedBlockState(te));
|
||||
return CachedBufferer.block(KINETIC_TILE, getRenderedBlockState(te));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
@ -29,13 +29,13 @@ public class DrillRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.getFacing(AllBlockPartials.DRILL_HEAD, te.getBlockState());
|
||||
return CachedBufferer.partialFacing(AllBlockPartials.DRILL_HEAD, te.getBlockState());
|
||||
}
|
||||
|
||||
public static void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
|
||||
ContraptionMatrices matrices, MultiBufferSource buffer) {
|
||||
BlockState state = context.state;
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.DRILL_HEAD, state);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(AllBlockPartials.DRILL_HEAD, state);
|
||||
Direction facing = state.getValue(DrillBlock.FACING);
|
||||
|
||||
float speed = (float) (context.contraption.stalled
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -33,7 +33,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
|
|||
protected void renderSafe(HarvesterTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(AllBlockPartials.HARVESTER_BLADE, blockState);
|
||||
transform(te.getLevel(), blockState.getValue(HarvesterBlock.FACING), superBuffer,
|
||||
te.getAnimatedSpeed());
|
||||
superBuffer.light(light)
|
||||
|
@ -44,7 +44,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
|
|||
ContraptionMatrices matrices, MultiBufferSource buffers) {
|
||||
BlockState blockState = context.state;
|
||||
Direction facing = blockState.getValue(HORIZONTAL_FACING);
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(AllBlockPartials.HARVESTER_BLADE, blockState);
|
||||
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, facing.getOpposite())
|
||||
? context.getAnimationSpeed()
|
||||
: 0);
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -62,8 +62,8 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
|
|||
|
||||
private static void render(BlockState blockState, boolean lit, float progress,
|
||||
PoseStack local, Consumer<SuperByteBuffer> drawCallback) {
|
||||
SuperByteBuffer middle = PartialBufferer.get(getMiddleForState(blockState, lit), blockState);
|
||||
SuperByteBuffer top = PartialBufferer.get(getTopForState(blockState), blockState);
|
||||
SuperByteBuffer middle = CachedBufferer.partial(getMiddleForState(blockState, lit), blockState);
|
||||
SuperByteBuffer top = CachedBufferer.partial(getTopForState(blockState), blockState);
|
||||
|
||||
if (local != null) {
|
||||
middle.transform(local);
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity.Animation;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -38,8 +38,8 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
||||
// Render Hands
|
||||
SuperByteBuffer hourHand = PartialBufferer.get(AllBlockPartials.CUCKOO_HOUR_HAND, blockState);
|
||||
SuperByteBuffer minuteHand = PartialBufferer.get(AllBlockPartials.CUCKOO_MINUTE_HAND, blockState);
|
||||
SuperByteBuffer hourHand = CachedBufferer.partial(AllBlockPartials.CUCKOO_HOUR_HAND, blockState);
|
||||
SuperByteBuffer minuteHand = CachedBufferer.partial(AllBlockPartials.CUCKOO_MINUTE_HAND, blockState);
|
||||
float hourAngle = clock.hourHand.get(partialTicks);
|
||||
float minuteAngle = clock.minuteHand.get(partialTicks);
|
||||
rotateHand(hourHand, hourAngle, direction).light(light)
|
||||
|
@ -48,8 +48,8 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
.renderInto(ms, vb);
|
||||
|
||||
// Doors
|
||||
SuperByteBuffer leftDoor = PartialBufferer.get(AllBlockPartials.CUCKOO_LEFT_DOOR, blockState);
|
||||
SuperByteBuffer rightDoor = PartialBufferer.get(AllBlockPartials.CUCKOO_RIGHT_DOOR, blockState);
|
||||
SuperByteBuffer leftDoor = CachedBufferer.partial(AllBlockPartials.CUCKOO_LEFT_DOOR, blockState);
|
||||
SuperByteBuffer rightDoor = CachedBufferer.partial(AllBlockPartials.CUCKOO_RIGHT_DOOR, blockState);
|
||||
float angle = 0;
|
||||
float offset = 0;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
offset = -(angle / 135) * 1 / 2f + 10 / 16f;
|
||||
PartialModel partialModel = (clock.animationType == Animation.PIG ? AllBlockPartials.CUCKOO_PIG : AllBlockPartials.CUCKOO_CREEPER);
|
||||
SuperByteBuffer figure =
|
||||
PartialBufferer.get(partialModel, blockState);
|
||||
CachedBufferer.partial(partialModel, blockState);
|
||||
figure.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(direction.getCounterClockWise())));
|
||||
figure.translate(offset, 0, 0);
|
||||
figure.light(light)
|
||||
|
@ -95,7 +95,7 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
}
|
||||
|
||||
private SuperByteBuffer transform(PartialModel partial, KineticTileEntity te) {
|
||||
return PartialBufferer.getFacing(partial, te.getBlockState(), te.getBlockState()
|
||||
return CachedBufferer.partialFacing(partial, te.getBlockState(), te.getBlockState()
|
||||
.getValue(CuckooClockBlock.HORIZONTAL_FACING)
|
||||
.getOpposite());
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase;
|
||||
import com.simibubi.create.content.contraptions.components.crafter.RecipeGridHandler.GroupedItems;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -171,7 +171,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
|||
|
||||
if (!Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel())) {
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
||||
standardKineticRotationTransform(superBuffer, te, light);
|
||||
superBuffer.rotateCentered(Direction.UP, (float) (blockState.getValue(HORIZONTAL_FACING)
|
||||
.getAxis() != Direction.Axis.X ? 0 : Math.PI / 2));
|
||||
|
@ -212,7 +212,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
|||
}
|
||||
|
||||
private SuperByteBuffer renderAndTransform(PartialModel renderBlock, BlockState crafterState) {
|
||||
SuperByteBuffer buffer = PartialBufferer.get(renderBlock, crafterState);
|
||||
SuperByteBuffer buffer = CachedBufferer.partial(renderBlock, crafterState);
|
||||
float xRot = crafterState.getValue(MechanicalCrafterBlock.POINTING)
|
||||
.getXRotation();
|
||||
float yRot = AngleHelper.horizontalAngle(crafterState.getValue(HORIZONTAL_FACING));
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.jozufozu.flywheel.core.PartialModel;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -39,7 +39,7 @@ public class HandCrankRenderer extends KineticTileEntityRenderer {
|
|||
return;
|
||||
|
||||
Direction facing = state.getValue(FACING);
|
||||
SuperByteBuffer handle = PartialBufferer.getFacing(renderedHandle, state, facing.getOpposite());
|
||||
SuperByteBuffer handle = CachedBufferer.partialFacing(renderedHandle, state, facing.getOpposite());
|
||||
HandCrankTileEntity crank = (HandCrankTileEntity) te;
|
||||
kineticRotationTransform(handle, te, facing.getAxis(),
|
||||
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360, light);
|
||||
|
|
|
@ -35,8 +35,8 @@ public class DeployerActorInstance extends ActorInstance {
|
|||
boolean stationaryTimer;
|
||||
|
||||
float yRot;
|
||||
float xRot;
|
||||
float zRot;
|
||||
float zRotPole;
|
||||
|
||||
ModelData pole;
|
||||
ModelData hand;
|
||||
|
@ -57,8 +57,8 @@ public class DeployerActorInstance extends ActorInstance {
|
|||
|
||||
boolean rotatePole = state.getValue(AXIS_ALONG_FIRST_COORDINATE) ^ facing.getAxis() == Direction.Axis.Z;
|
||||
yRot = AngleHelper.horizontalAngle(facing);
|
||||
zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
zRotPole = rotatePole ? 90 : 0;
|
||||
xRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
zRot = rotatePole ? 90 : 0;
|
||||
|
||||
pole = mat.getModel(AllBlockPartials.DEPLOYER_POLE, state).createInstance();
|
||||
hand = mat.getModel(handPose, state).createInstance();
|
||||
|
@ -100,17 +100,17 @@ public class DeployerActorInstance extends ActorInstance {
|
|||
msr.translate(context.localPos)
|
||||
.translate(offset);
|
||||
|
||||
transformModel(msr, pole, hand, yRot, zRot, zRotPole);
|
||||
transformModel(msr, pole, hand, yRot, xRot, zRot);
|
||||
}
|
||||
|
||||
static void transformModel(MatrixTransformStack msr, ModelData pole, ModelData hand, float yRot, float zRot, float zRotPole) {
|
||||
static void transformModel(MatrixTransformStack msr, ModelData pole, ModelData hand, float yRot, float xRot, float zRot) {
|
||||
|
||||
msr.centre();
|
||||
msr.rotate(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
|
||||
msr.rotate(Direction.UP, (float) ((yRot) / 180 * Math.PI));
|
||||
msr.rotate(Direction.EAST, (float) ((xRot) / 180 * Math.PI));
|
||||
|
||||
msr.push();
|
||||
msr.rotate(Direction.SOUTH, (float) ((zRotPole) / 180 * Math.PI));
|
||||
msr.rotate(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
|
||||
msr.unCentre();
|
||||
pole.setTransform(msr.unwrap());
|
||||
msr.pop();
|
||||
|
|
|
@ -19,9 +19,9 @@ public class DeployerFilterSlot extends ValueBoxTransform {
|
|||
Vec3 vec = VecHelper.voxelSpace(8f, 13.5f, 11.5f);
|
||||
|
||||
float yRot = AngleHelper.horizontalAngle(facing);
|
||||
float zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
float xRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
vec = VecHelper.rotateCentered(vec, yRot, Axis.Y);
|
||||
vec = VecHelper.rotateCentered(vec, zRot, Axis.Z);
|
||||
vec = VecHelper.rotateCentered(vec, xRot, Axis.X);
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
final DeployerTileEntity tile;
|
||||
final Direction facing;
|
||||
final float yRot;
|
||||
final float xRot;
|
||||
final float zRot;
|
||||
final float zRotPole;
|
||||
|
||||
protected final OrientedData pole;
|
||||
|
||||
|
@ -45,8 +45,8 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
boolean rotatePole = blockState.getValue(AXIS_ALONG_FIRST_COORDINATE) ^ facing.getAxis() == Direction.Axis.Z;
|
||||
|
||||
yRot = AngleHelper.horizontalAngle(facing);
|
||||
zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
zRotPole = rotatePole ? 90 : 0;
|
||||
xRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
zRot = rotatePole ? 90 : 0;
|
||||
|
||||
pole = getOrientedMaterial().getModel(AllBlockPartials.DEPLOYER_POLE, blockState).createInstance();
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
relight(pos, pole);
|
||||
|
||||
progress = getProgress(AnimationTickHolder.getPartialTicks());
|
||||
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
||||
updateRotation(pole, hand, yRot, xRot, zRot);
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
hand = getOrientedMaterial().getModel(currentHand, blockState).createInstance();
|
||||
|
||||
relight(pos, hand);
|
||||
updateRotation(pole, hand, yRot, zRot, zRotPole);
|
||||
updateRotation(pole, hand, yRot, xRot, zRot);
|
||||
updatePosition();
|
||||
|
||||
return true;
|
||||
|
@ -129,14 +129,14 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
hand.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
static void updateRotation(OrientedData pole, OrientedData hand, float yRot, float zRot, float zRotPole) {
|
||||
static void updateRotation(OrientedData pole, OrientedData hand, float yRot, float xRot, float zRot) {
|
||||
|
||||
Quaternion q = Direction.SOUTH.step().rotationDegrees(zRot);
|
||||
q.mul(Direction.UP.step().rotationDegrees(yRot));
|
||||
Quaternion q = Direction.UP.step().rotationDegrees(yRot);
|
||||
q.mul(Direction.EAST.step().rotationDegrees(xRot));
|
||||
|
||||
hand.setRotation(q);
|
||||
|
||||
q.mul(Direction.SOUTH.step().rotationDegrees(zRotPole));
|
||||
q.mul(Direction.SOUTH.step().rotationDegrees(zRot));
|
||||
|
||||
pole.setRotation(q);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.simibubi.create.content.contraptions.components.deployer.DeployerTile
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
|
@ -69,12 +69,12 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
boolean punching = te.mode == Mode.PUNCH;
|
||||
|
||||
float yRot = AngleHelper.horizontalAngle(facing) + 180;
|
||||
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
|
||||
float xRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
|
||||
boolean displayMode = facing == Direction.UP && te.getSpeed() == 0 && !punching;
|
||||
|
||||
ms.mulPose(Vector3f.YP.rotationDegrees(yRot));
|
||||
if (!displayMode) {
|
||||
ms.mulPose(Vector3f.XP.rotationDegrees(zRot));
|
||||
ms.mulPose(Vector3f.XP.rotationDegrees(xRot));
|
||||
ms.translate(0, 0, -11 / 16f);
|
||||
}
|
||||
|
||||
|
@ -116,8 +116,8 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
BlockState blockState = te.getBlockState();
|
||||
Vec3 offset = getHandOffset(te, partialTicks, blockState);
|
||||
|
||||
SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState);
|
||||
SuperByteBuffer hand = PartialBufferer.get(te.getHandPose(), blockState);
|
||||
SuperByteBuffer pole = CachedBufferer.partial(AllBlockPartials.DEPLOYER_POLE, blockState);
|
||||
SuperByteBuffer hand = CachedBufferer.partial(te.getHandPose(), blockState);
|
||||
|
||||
transform(pole.translate(offset.x, offset.y, offset.z), blockState, true)
|
||||
.light(light)
|
||||
|
@ -139,15 +139,15 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
private static SuperByteBuffer transform(SuperByteBuffer buffer, BlockState deployerState, boolean axisDirectionMatters) {
|
||||
Direction facing = deployerState.getValue(FACING);
|
||||
|
||||
float zRotLast =
|
||||
float yRot = AngleHelper.horizontalAngle(facing);
|
||||
float xRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
float zRot =
|
||||
axisDirectionMatters && (deployerState.getValue(AXIS_ALONG_FIRST_COORDINATE) ^ facing.getAxis() == Axis.Z) ? 90
|
||||
: 0;
|
||||
float yRot = AngleHelper.horizontalAngle(facing);
|
||||
float zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
|
||||
|
||||
buffer.rotateCentered(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Direction.UP, (float) ((yRot) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Direction.SOUTH, (float) ((zRotLast) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Direction.EAST, (float) ((xRot) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,8 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
|||
Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class);
|
||||
PartialModel handPose = getHandPose(mode);
|
||||
|
||||
SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState);
|
||||
SuperByteBuffer hand = PartialBufferer.get(handPose, blockState);
|
||||
SuperByteBuffer pole = CachedBufferer.partial(AllBlockPartials.DEPLOYER_POLE, blockState);
|
||||
SuperByteBuffer hand = CachedBufferer.partial(handPose, blockState);
|
||||
|
||||
double factor;
|
||||
if (context.contraption.stalled || context.position == null || context.data.contains("StationaryTimer")) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
|
@ -38,9 +38,9 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer {
|
|||
int lightInFront = LevelRenderer.getLightColor(te.getLevel(), te.getBlockPos().relative(direction));
|
||||
|
||||
SuperByteBuffer shaftHalf =
|
||||
PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction.getOpposite());
|
||||
CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction.getOpposite());
|
||||
SuperByteBuffer fanInner =
|
||||
PartialBufferer.getFacing(AllBlockPartials.ENCASED_FAN_INNER, te.getBlockState(), direction.getOpposite());
|
||||
CachedBufferer.partialFacing(AllBlockPartials.ENCASED_FAN_INNER, te.getBlockState(), direction.getOpposite());
|
||||
|
||||
float time = AnimationTickHolder.getRenderTime(te.getLevel());
|
||||
float speed = te.getSpeed() * 5;
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.world.level.block.state.properties.EnumProperty;
|
|||
|
||||
public class FlywheelBlock extends HorizontalKineticBlock implements ITE<FlywheelTileEntity> {
|
||||
|
||||
public static EnumProperty<ConnectionState> CONNECTION = EnumProperty.create("connection", ConnectionState.class);
|
||||
public static final EnumProperty<ConnectionState> CONNECTION = EnumProperty.create("connection", ConnectionState.class);
|
||||
|
||||
public FlywheelBlock(Properties properties) {
|
||||
super(properties);
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock.ConnectionState;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -56,18 +56,18 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
|||
boolean flip = blockState.getValue(FlywheelBlock.CONNECTION) == ConnectionState.LEFT;
|
||||
|
||||
transformConnector(
|
||||
rotateToFacing(PartialBufferer.get(AllBlockPartials.FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true,
|
||||
rotateToFacing(CachedBufferer.partial(AllBlockPartials.FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true,
|
||||
rotation, flip).light(light)
|
||||
.renderInto(ms, vb);
|
||||
transformConnector(
|
||||
rotateToFacing(PartialBufferer.get(AllBlockPartials.FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true,
|
||||
rotateToFacing(CachedBufferer.partial(AllBlockPartials.FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true,
|
||||
rotation, flip).light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
transformConnector(rotateToFacing(PartialBufferer.get(AllBlockPartials.FLYWHEEL_UPPER_SLIDING, blockState), connection),
|
||||
transformConnector(rotateToFacing(CachedBufferer.partial(AllBlockPartials.FLYWHEEL_UPPER_SLIDING, blockState), connection),
|
||||
true, false, rotation, flip).light(light)
|
||||
.renderInto(ms, vb);
|
||||
transformConnector(rotateToFacing(PartialBufferer.get(AllBlockPartials.FLYWHEEL_LOWER_SLIDING, blockState), connection),
|
||||
transformConnector(rotateToFacing(CachedBufferer.partial(AllBlockPartials.FLYWHEEL_LOWER_SLIDING, blockState), connection),
|
||||
false, false, rotation, flip).light(light)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
|||
private void renderFlywheel(KineticTileEntity te, PoseStack ms, int light, BlockState blockState, float angle, VertexConsumer vb) {
|
||||
BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90);
|
||||
Direction facing = referenceState.getValue(BlockStateProperties.HORIZONTAL_FACING);
|
||||
SuperByteBuffer wheel = PartialBufferer.getFacing(AllBlockPartials.FLYWHEEL, referenceState, facing);
|
||||
SuperByteBuffer wheel = CachedBufferer.partialFacing(AllBlockPartials.FLYWHEEL, referenceState, facing);
|
||||
kineticRotationTransform(wheel, te, blockState.getValue(HORIZONTAL_FACING)
|
||||
.getAxis(), AngleHelper.rad(angle), light);
|
||||
wheel.renderInto(ms, vb);
|
||||
|
@ -86,7 +86,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
||||
return CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
||||
.getValue(BlockStateProperties.HORIZONTAL_FACING)
|
||||
.getOpposite());
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
|||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRe
|
|||
Direction facing = te.getBlockState()
|
||||
.getValue(EngineBlock.FACING);
|
||||
float angle = AngleHelper.rad(AngleHelper.horizontalAngle(facing));
|
||||
PartialBufferer.get(frame, te.getBlockState())
|
||||
CachedBufferer.partial(frame, te.getBlockState())
|
||||
.rotateCentered(Direction.UP, angle)
|
||||
.translate(0, 0, -1)
|
||||
.light(light)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.simibubi.create.content.contraptions.components.millstone;
|
||||
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
@ -16,7 +16,7 @@ public class MillstoneRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return CreateClient.BUFFER_CACHE.renderPartial(AllBlockPartials.MILLSTONE_COG, te.getBlockState());
|
||||
return CachedBufferer.partial(AllBlockPartials.MILLSTONE_COG, te.getBlockState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
||||
standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
|
||||
|
||||
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
||||
|
@ -46,12 +46,12 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
|
|||
float time = AnimationTickHolder.getRenderTime(te.getLevel());
|
||||
float angle = ((time * speed * 6 / 10f) % 360) / 180 * (float) Math.PI;
|
||||
|
||||
SuperByteBuffer poleRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState);
|
||||
SuperByteBuffer poleRender = CachedBufferer.partial(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState);
|
||||
poleRender.translate(0, -renderedHeadOffset, 0)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
SuperByteBuffer headRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState);
|
||||
SuperByteBuffer headRender = CachedBufferer.partial(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState);
|
||||
headRender.rotateCentered(Direction.UP, angle)
|
||||
.translate(0, -renderedHeadOffset, 0)
|
||||
.light(light)
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.motor;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
@ -16,7 +16,7 @@ public class CreativeMotorRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState());
|
||||
return CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -36,7 +36,7 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer {
|
|||
BlockState blockState = te.getBlockState();
|
||||
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
|
||||
|
||||
SuperByteBuffer headRender = PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.getValue(HORIZONTAL_FACING));
|
||||
SuperByteBuffer headRender = CachedBufferer.partialFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.getValue(HORIZONTAL_FACING));
|
||||
headRender.translate(0, -renderedHeadOffset, 0)
|
||||
.light(light)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
|
|
|
@ -8,13 +8,12 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
|
@ -82,7 +81,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
|||
rotate = true;
|
||||
}
|
||||
|
||||
SuperByteBuffer superBuffer = PartialBufferer.getFacing(partial, blockState);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partialFacing(partial, blockState);
|
||||
if (rotate) {
|
||||
superBuffer.rotateCentered(Direction.UP, AngleHelper.rad(90));
|
||||
}
|
||||
|
@ -150,9 +149,9 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
|||
if (state.getValue(FACING)
|
||||
.getAxis()
|
||||
.isHorizontal())
|
||||
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF,
|
||||
return CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF,
|
||||
state.rotate(te.getLevel(), te.getBlockPos(), Rotation.CLOCKWISE_180));
|
||||
return CreateClient.BUFFER_CACHE.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
||||
return CachedBufferer.block(KineticTileEntityRenderer.KINETIC_TILE,
|
||||
getRenderedBlockState(te));
|
||||
}
|
||||
|
||||
|
@ -181,14 +180,14 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
|||
SuperByteBuffer superBuffer;
|
||||
if (SawBlock.isHorizontal(state)) {
|
||||
if (shouldAnimate)
|
||||
superBuffer = PartialBufferer.get(AllBlockPartials.SAW_BLADE_HORIZONTAL_ACTIVE, state);
|
||||
superBuffer = CachedBufferer.partial(AllBlockPartials.SAW_BLADE_HORIZONTAL_ACTIVE, state);
|
||||
else
|
||||
superBuffer = PartialBufferer.get(AllBlockPartials.SAW_BLADE_HORIZONTAL_INACTIVE, state);
|
||||
superBuffer = CachedBufferer.partial(AllBlockPartials.SAW_BLADE_HORIZONTAL_INACTIVE, state);
|
||||
} else {
|
||||
if (shouldAnimate)
|
||||
superBuffer = PartialBufferer.get(AllBlockPartials.SAW_BLADE_VERTICAL_ACTIVE, state);
|
||||
superBuffer = CachedBufferer.partial(AllBlockPartials.SAW_BLADE_VERTICAL_ACTIVE, state);
|
||||
else
|
||||
superBuffer = PartialBufferer.get(AllBlockPartials.SAW_BLADE_VERTICAL_INACTIVE, state);
|
||||
superBuffer = CachedBufferer.partial(AllBlockPartials.SAW_BLADE_VERTICAL_INACTIVE, state);
|
||||
}
|
||||
|
||||
PoseStack m = matrices.getModel();
|
||||
|
@ -199,7 +198,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
|||
.rotateX(AngleHelper.verticalAngle(facing));
|
||||
if (!SawBlock.isHorizontal(state))
|
||||
MatrixTransformStack.of(m)
|
||||
.rotateZ(state.getValue(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? 0 : 90);
|
||||
.rotateZ(state.getValue(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? 90 : 0);
|
||||
MatrixTransformStack.of(m)
|
||||
.unCentre();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class BearingRenderer extends KineticTileEntityRenderer {
|
|||
.getValue(BlockStateProperties.FACING);
|
||||
PartialModel top =
|
||||
bearingTe.isWoodenTop() ? AllBlockPartials.BEARING_TOP_WOODEN : AllBlockPartials.BEARING_TOP;
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(top, te.getBlockState());
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(top, te.getBlockState());
|
||||
|
||||
float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks - 1);
|
||||
kineticRotationTransform(superBuffer, te, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI), light);
|
||||
|
@ -50,7 +50,7 @@ public class BearingRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
||||
return CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
||||
.getValue(BearingBlock.FACING)
|
||||
.getOpposite());
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Ori
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
|
||||
|
@ -38,7 +38,7 @@ public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
Direction facing = context.state.getValue(BlockStateProperties.FACING);
|
||||
PartialModel top = AllBlockPartials.BEARING_TOP;
|
||||
SuperByteBuffer superBuffer = PartialBufferer.get(top, context.state);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partial(top, context.state);
|
||||
float renderPartialTicks = AnimationTickHolder.getPartialTicks();
|
||||
|
||||
// rotate to match blockstate
|
||||
|
|
|
@ -16,61 +16,61 @@ import net.minecraft.util.Mth;
|
|||
|
||||
public class StickerInstance extends TileEntityInstance<StickerTileEntity> implements IDynamicInstance {
|
||||
|
||||
float lastOffset = Float.NaN;
|
||||
final Direction facing;
|
||||
final boolean fakeWorld;
|
||||
final int offset;
|
||||
float lastOffset = Float.NaN;
|
||||
final Direction facing;
|
||||
final boolean fakeWorld;
|
||||
final int offset;
|
||||
|
||||
private final ModelData head;
|
||||
private final ModelData head;
|
||||
|
||||
public StickerInstance(MaterialManager modelManager, StickerTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
public StickerInstance(MaterialManager modelManager, StickerTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
|
||||
head = getTransformMaterial().getModel(AllBlockPartials.STICKER_HEAD, blockState).createInstance();
|
||||
head = getTransformMaterial().getModel(AllBlockPartials.STICKER_HEAD, blockState).createInstance();
|
||||
|
||||
fakeWorld = tile.getLevel() != Minecraft.getInstance().level;
|
||||
facing = blockState.getValue(StickerBlock.FACING);
|
||||
offset = blockState.getValue(StickerBlock.EXTENDED) ? 1 : 0;
|
||||
fakeWorld = tile.getLevel() != Minecraft.getInstance().level;
|
||||
facing = blockState.getValue(StickerBlock.FACING);
|
||||
offset = blockState.getValue(StickerBlock.EXTENDED) ? 1 : 0;
|
||||
|
||||
animateHead(offset);
|
||||
}
|
||||
animateHead(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
float offset = tile.piston.getValue(AnimationTickHolder.getPartialTicks());
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
float offset = tile.piston.getValue(AnimationTickHolder.getPartialTicks());
|
||||
|
||||
if (fakeWorld)
|
||||
offset = this.offset;
|
||||
if (fakeWorld)
|
||||
offset = this.offset;
|
||||
|
||||
if (Mth.equal(offset, lastOffset))
|
||||
return;
|
||||
if (Mth.equal(offset, lastOffset))
|
||||
return;
|
||||
|
||||
animateHead(offset);
|
||||
animateHead(offset);
|
||||
|
||||
lastOffset = offset;
|
||||
}
|
||||
lastOffset = offset;
|
||||
}
|
||||
|
||||
private void animateHead(float offset) {
|
||||
PoseStack stack = new PoseStack();
|
||||
MatrixTransformStack.of(stack)
|
||||
.translate(getInstancePosition())
|
||||
.nudge(tile.hashCode())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.unCentre()
|
||||
.translate(0, (offset * offset) * 4 / 16f, 0);
|
||||
private void animateHead(float offset) {
|
||||
PoseStack stack = new PoseStack();
|
||||
MatrixTransformStack.of(stack)
|
||||
.translate(getInstancePosition())
|
||||
.nudge(tile.hashCode())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.unCentre()
|
||||
.translate(0, (offset * offset) * 4 / 16f, 0);
|
||||
|
||||
head.setTransform(stack);
|
||||
}
|
||||
head.setTransform(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, head);
|
||||
}
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, head);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
head.delete();
|
||||
}
|
||||
@Override
|
||||
public void remove() {
|
||||
head.delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ch
|
|||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -28,7 +28,7 @@ public class StickerRenderer extends SafeTileEntityRenderer<StickerTileEntity> {
|
|||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
|
||||
BlockState state = te.getBlockState();
|
||||
SuperByteBuffer head = PartialBufferer.get(AllBlockPartials.STICKER_HEAD, state);
|
||||
SuperByteBuffer head = CachedBufferer.partial(AllBlockPartials.STICKER_HEAD, state);
|
||||
float offset = te.piston.getValue(AnimationTickHolder.getPartialTicks(te.getLevel()));
|
||||
|
||||
if (te.getLevel() != Minecraft.getInstance().level && !te.isVirtual())
|
||||
|
@ -36,9 +36,9 @@ public class StickerRenderer extends SafeTileEntityRenderer<StickerTileEntity> {
|
|||
|
||||
Direction facing = state.getValue(StickerBlock.FACING);
|
||||
head.matrixStacker()
|
||||
.nudge(te.hashCode())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.nudge(te.hashCode())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.unCentre()
|
||||
.translate(0, (offset * offset) * 4 / 16f, 0);
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.jozufozu.flywheel.backend.material.MaterialManager;
|
|||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
|
@ -19,93 +18,93 @@ import net.minecraft.util.Mth;
|
|||
|
||||
public class GantryCarriageInstance extends ShaftInstance implements IDynamicInstance {
|
||||
|
||||
private final ModelData gantryCogs;
|
||||
private final ModelData gantryCogs;
|
||||
|
||||
final Direction facing;
|
||||
final Boolean alongFirst;
|
||||
final Direction.Axis rotationAxis;
|
||||
final float rotationMult;
|
||||
final BlockPos visualPos;
|
||||
final Direction facing;
|
||||
final Boolean alongFirst;
|
||||
final Direction.Axis rotationAxis;
|
||||
final float rotationMult;
|
||||
final BlockPos visualPos;
|
||||
|
||||
private float lastAngle = Float.NaN;
|
||||
private float lastAngle = Float.NaN;
|
||||
|
||||
public GantryCarriageInstance(MaterialManager dispatcher, KineticTileEntity tile) {
|
||||
super(dispatcher, tile);
|
||||
public GantryCarriageInstance(MaterialManager dispatcher, KineticTileEntity tile) {
|
||||
super(dispatcher, tile);
|
||||
|
||||
gantryCogs = getTransformMaterial()
|
||||
.getModel(AllBlockPartials.GANTRY_COGS, blockState)
|
||||
.createInstance();
|
||||
gantryCogs = getTransformMaterial()
|
||||
.getModel(AllBlockPartials.GANTRY_COGS, blockState)
|
||||
.createInstance();
|
||||
|
||||
facing = blockState.getValue(GantryCarriageBlock.FACING);
|
||||
alongFirst = blockState.getValue(GantryCarriageBlock.AXIS_ALONG_FIRST_COORDINATE);
|
||||
rotationAxis = KineticTileEntityRenderer.getRotationAxisOf(tile);
|
||||
facing = blockState.getValue(GantryCarriageBlock.FACING);
|
||||
alongFirst = blockState.getValue(GantryCarriageBlock.AXIS_ALONG_FIRST_COORDINATE);
|
||||
rotationAxis = KineticTileEntityRenderer.getRotationAxisOf(tile);
|
||||
|
||||
rotationMult = getRotationMultiplier(getGantryAxis(), facing);
|
||||
rotationMult = getRotationMultiplier(getGantryAxis(), facing);
|
||||
|
||||
visualPos = facing.getAxisDirection() == Direction.AxisDirection.POSITIVE ? tile.getBlockPos()
|
||||
: tile.getBlockPos()
|
||||
.relative(facing.getOpposite());
|
||||
visualPos = facing.getAxisDirection() == Direction.AxisDirection.POSITIVE ? tile.getBlockPos()
|
||||
: tile.getBlockPos()
|
||||
.relative(facing.getOpposite());
|
||||
|
||||
animateCogs(getCogAngle());
|
||||
}
|
||||
animateCogs(getCogAngle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
float cogAngle = getCogAngle();
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
float cogAngle = getCogAngle();
|
||||
|
||||
if (Mth.equal(cogAngle, lastAngle)) return;
|
||||
if (Mth.equal(cogAngle, lastAngle)) return;
|
||||
|
||||
animateCogs(cogAngle);
|
||||
}
|
||||
animateCogs(cogAngle);
|
||||
}
|
||||
|
||||
private float getCogAngle() {
|
||||
return GantryCarriageRenderer.getAngleForTe(tile, visualPos, rotationAxis) * rotationMult;
|
||||
}
|
||||
private float getCogAngle() {
|
||||
return GantryCarriageRenderer.getAngleForTe(tile, visualPos, rotationAxis) * rotationMult;
|
||||
}
|
||||
|
||||
private void animateCogs(float cogAngle) {
|
||||
PoseStack ms = new PoseStack();
|
||||
MatrixTransformStack.of(ms)
|
||||
.translate(getInstancePosition())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(facing == Direction.UP ? 0 : facing == Direction.DOWN ? 180 : 90)
|
||||
.rotateY(alongFirst ^ facing.getAxis() == Direction.Axis.Z ? 90 : 0)
|
||||
.translate(0, -9 / 16f, 0)
|
||||
.multiply(Vector3f.XP.rotation(-cogAngle))
|
||||
.translate(0, 9 / 16f, 0)
|
||||
.unCentre();
|
||||
private void animateCogs(float cogAngle) {
|
||||
PoseStack ms = new PoseStack();
|
||||
MatrixTransformStack.of(ms)
|
||||
.translate(getInstancePosition())
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(facing == Direction.UP ? 0 : facing == Direction.DOWN ? 180 : 90)
|
||||
.rotateY(alongFirst ^ facing.getAxis() == Direction.Axis.X ? 0 : 90)
|
||||
.translate(0, -9 / 16f, 0)
|
||||
.rotateX(-cogAngle)
|
||||
.translate(0, 9 / 16f, 0)
|
||||
.unCentre();
|
||||
|
||||
gantryCogs.setTransform(ms);
|
||||
}
|
||||
gantryCogs.setTransform(ms);
|
||||
}
|
||||
|
||||
static float getRotationMultiplier(Direction.Axis gantryAxis, Direction facing) {
|
||||
float multiplier = 1;
|
||||
if (gantryAxis == Direction.Axis.Z)
|
||||
if (facing == Direction.DOWN)
|
||||
multiplier *= -1;
|
||||
if (gantryAxis == Direction.Axis.Y)
|
||||
if (facing == Direction.NORTH || facing == Direction.EAST)
|
||||
multiplier *= -1;
|
||||
static float getRotationMultiplier(Direction.Axis gantryAxis, Direction facing) {
|
||||
float multiplier = 1;
|
||||
if (gantryAxis == Direction.Axis.X)
|
||||
if (facing == Direction.UP)
|
||||
multiplier *= -1;
|
||||
if (gantryAxis == Direction.Axis.Y)
|
||||
if (facing == Direction.NORTH || facing == Direction.EAST)
|
||||
multiplier *= -1;
|
||||
|
||||
return multiplier;
|
||||
}
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
private Direction.Axis getGantryAxis() {
|
||||
Direction.Axis gantryAxis = Direction.Axis.X;
|
||||
for (Direction.Axis axis : Iterate.axes)
|
||||
if (axis != rotationAxis && axis != facing.getAxis())
|
||||
gantryAxis = axis;
|
||||
return gantryAxis;
|
||||
}
|
||||
private Direction.Axis getGantryAxis() {
|
||||
Direction.Axis gantryAxis = Direction.Axis.X;
|
||||
for (Direction.Axis axis : Iterate.axes)
|
||||
if (axis != rotationAxis && axis != facing.getAxis())
|
||||
gantryAxis = axis;
|
||||
return gantryAxis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, gantryCogs, rotatingModel);
|
||||
}
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, gantryCogs, rotatingModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
super.remove();
|
||||
gantryCogs.delete();
|
||||
}
|
||||
@Override
|
||||
public void remove() {
|
||||
super.remove();
|
||||
gantryCogs.delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,10 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ga
|
|||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
@ -48,21 +47,21 @@ public class GantryCarriageRenderer extends KineticTileEntityRenderer {
|
|||
if (axis != rotationAxis && axis != facing.getAxis())
|
||||
gantryAxis = axis;
|
||||
|
||||
if (gantryAxis == Axis.Z)
|
||||
if (facing == Direction.DOWN)
|
||||
if (gantryAxis == Axis.X)
|
||||
if (facing == Direction.UP)
|
||||
angleForTe *= -1;
|
||||
if (gantryAxis == Axis.Y)
|
||||
if (facing == Direction.NORTH || facing == Direction.EAST)
|
||||
angleForTe *= -1;
|
||||
|
||||
SuperByteBuffer cogs = PartialBufferer.get(AllBlockPartials.GANTRY_COGS, state);
|
||||
SuperByteBuffer cogs = CachedBufferer.partial(AllBlockPartials.GANTRY_COGS, state);
|
||||
cogs.matrixStacker()
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(facing == Direction.UP ? 0 : facing == Direction.DOWN ? 180 : 90)
|
||||
.rotateY(alongFirst ^ facing.getAxis() == Axis.Z ? 90 : 0)
|
||||
.rotateY(alongFirst ^ facing.getAxis() == Axis.X ? 0 : 90)
|
||||
.translate(0, -9 / 16f, 0)
|
||||
.multiply(Vector3f.XP.rotation(-angleForTe))
|
||||
.rotateX(-angleForTe)
|
||||
.translate(0, 9 / 16f, 0)
|
||||
.unCentre();
|
||||
|
||||
|
@ -74,7 +73,7 @@ public class GantryCarriageRenderer extends KineticTileEntityRenderer {
|
|||
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
||||
float time = AnimationTickHolder.getRenderTime(te.getLevel());
|
||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||
return ((time * te.getSpeed() * 3f / 20 + offset) % 360) / 180 * (float) Math.PI;
|
||||
return (time * te.getSpeed() * 3f / 20 + offset) % 360;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,7 @@ public class GlueInstance extends EntityInstance<SuperGlueEntity> implements ITi
|
|||
Instancer<OrientedData> instancer = getInstancer(materialManager, entity);
|
||||
|
||||
Direction face = entity.getFacingDirection();
|
||||
rotation = new Quaternion(AngleHelper.verticalAngle(face), AngleHelper.horizontalAngleNew(face), 0, true);
|
||||
rotation = new Quaternion(AngleHelper.verticalAngle(face), AngleHelper.horizontalAngle(face), 0, true);
|
||||
|
||||
model = new ConditionalInstance<>(instancer)
|
||||
.withCondition(this::shouldShow)
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
|||
|
||||
ms.pushPose();
|
||||
MatrixTransformStack.of(ms)
|
||||
.rotateY(AngleHelper.horizontalAngleNew(face))
|
||||
.rotateY(AngleHelper.horizontalAngle(face))
|
||||
.rotateX(AngleHelper.verticalAngle(face));
|
||||
Pose peek = ms.last();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
|||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -61,8 +61,8 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
|||
BlockState blockState = te.getBlockState();
|
||||
BlockPos pos = te.getBlockPos();
|
||||
|
||||
SuperByteBuffer halfMagnet = PartialBufferer.get(this.halfMagnet, blockState);
|
||||
SuperByteBuffer halfRope = PartialBufferer.get(this.halfRope, blockState);
|
||||
SuperByteBuffer halfMagnet = CachedBufferer.partial(this.halfMagnet, blockState);
|
||||
SuperByteBuffer halfRope = CachedBufferer.partial(this.halfRope, blockState);
|
||||
SuperByteBuffer magnet = renderMagnet(te);
|
||||
SuperByteBuffer rope = renderRope(te);
|
||||
|
||||
|
@ -109,7 +109,7 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
protected SuperByteBuffer getRotatedCoil(KineticTileEntity te) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
return PartialBufferer.getFacing(getCoil(), blockState,
|
||||
return CachedBufferer.partialFacing(getCoil(), blockState,
|
||||
Direction.get(AxisDirection.POSITIVE, getShaftAxis(te)));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.simibubi.create.foundation.block.ITE;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -24,7 +23,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition.Builder;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
|
@ -36,8 +34,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
|
||||
public class PulleyBlock extends HorizontalAxisKineticBlock implements ITE<PulleyTileEntity> {
|
||||
|
||||
public static EnumProperty<Axis> HORIZONTAL_AXIS = BlockStateProperties.HORIZONTAL_AXIS;
|
||||
|
||||
public PulleyBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pu
|
|||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
@ -31,12 +31,12 @@ public class PulleyRenderer extends AbstractPulleyRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer renderRope(KineticTileEntity te) {
|
||||
return CreateClient.BUFFER_CACHE.renderBlock(AllBlocks.ROPE.getDefaultState());
|
||||
return CachedBufferer.block(AllBlocks.ROPE.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer renderMagnet(KineticTileEntity te) {
|
||||
return CreateClient.BUFFER_CACHE.renderBlock(AllBlocks.PULLEY_MAGNET.getDefaultState());
|
||||
return CachedBufferer.block(AllBlocks.PULLEY_MAGNET.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.render;
|
||||
|
||||
import static com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher.buildStructureBuffer;
|
||||
|
||||
import com.jozufozu.flywheel.event.RenderLayerEvent;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
import com.simibubi.create.foundation.render.Compartment;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
|
||||
|
||||
|
@ -14,7 +12,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
||||
public class SBBContraptionManager extends ContraptionRenderManager<ContraptionRenderInfo> {
|
||||
public static final Compartment<Pair<Contraption, RenderType>> CONTRAPTION = new Compartment<>();
|
||||
public static final SuperByteBufferCache.Compartment<Pair<Contraption, RenderType>> CONTRAPTION = new SuperByteBufferCache.Compartment<>();
|
||||
|
||||
public SBBContraptionManager(LevelAccessor world) {
|
||||
super(world);
|
||||
|
@ -45,7 +43,7 @@ public class SBBContraptionManager extends ContraptionRenderManager<ContraptionR
|
|||
|
||||
if (!renderInfo.isVisible()) return;
|
||||
|
||||
SuperByteBuffer contraptionBuffer = CreateClient.BUFFER_CACHE.get(CONTRAPTION, Pair.of(renderInfo.contraption, layer), () -> buildStructureBuffer(renderInfo.renderWorld, renderInfo.contraption, layer));
|
||||
SuperByteBuffer contraptionBuffer = CreateClient.BUFFER_CACHE.get(CONTRAPTION, Pair.of(renderInfo.contraption, layer), () -> ContraptionRenderDispatcher.buildStructureBuffer(renderInfo.renderWorld, renderInfo.contraption, layer));
|
||||
|
||||
if (!contraptionBuffer.isEmpty()) {
|
||||
ContraptionMatrices matrices = renderInfo.getMatrices();
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
@ -66,9 +66,9 @@ public class CouplingRenderer {
|
|||
|
||||
BlockState renderState = Blocks.AIR.defaultBlockState();
|
||||
VertexConsumer builder = buffer.getBuffer(RenderType.solid());
|
||||
SuperByteBuffer attachment = PartialBufferer.get(AllBlockPartials.COUPLING_ATTACHMENT, renderState);
|
||||
SuperByteBuffer ring = PartialBufferer.get(AllBlockPartials.COUPLING_RING, renderState);
|
||||
SuperByteBuffer connector = PartialBufferer.get(AllBlockPartials.COUPLING_CONNECTOR, renderState);
|
||||
SuperByteBuffer attachment = CachedBufferer.partial(AllBlockPartials.COUPLING_ATTACHMENT, renderState);
|
||||
SuperByteBuffer ring = CachedBufferer.partial(AllBlockPartials.COUPLING_RING, renderState);
|
||||
SuperByteBuffer connector = CachedBufferer.partial(AllBlockPartials.COUPLING_CONNECTOR, renderState);
|
||||
|
||||
Vec3 zero = Vec3.ZERO;
|
||||
Vec3 firstEndpoint = transforms.getFirst()
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class PumpRenderer extends KineticTileEntityRenderer {
|
|||
float angle = Mth.lerp(pump.arrowDirection.getValue(partialTicks), 0, 90) - 90;
|
||||
for (float yRot : new float[] { 0, 90 }) {
|
||||
ms.pushPose();
|
||||
SuperByteBuffer arrow = PartialBufferer.get(AllBlockPartials.MECHANICAL_PUMP_ARROW, blockState);
|
||||
SuperByteBuffer arrow = CachedBufferer.partial(AllBlockPartials.MECHANICAL_PUMP_ARROW, blockState);
|
||||
Direction direction = blockState.getValue(PumpBlock.FACING);
|
||||
MatrixTransformStack.of(ms)
|
||||
.centre()
|
||||
|
@ -53,7 +53,7 @@ public class PumpRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PUMP_COG, te.getBlockState());
|
||||
return CachedBufferer.partialFacing(AllBlockPartials.MECHANICAL_PUMP_COG, te.getBlockState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.jozufozu.flywheel.core.PartialModel;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.AbstractPulleyRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
@ -31,12 +31,12 @@ public class HosePulleyRenderer extends AbstractPulleyRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer renderRope(KineticTileEntity te) {
|
||||
return PartialBufferer.get(AllBlockPartials.HOSE, te.getBlockState());
|
||||
return CachedBufferer.partial(AllBlockPartials.HOSE, te.getBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer renderMagnet(KineticTileEntity te) {
|
||||
return PartialBufferer.get(AllBlockPartials.HOSE_MAGNET, te.getBlockState());
|
||||
return CachedBufferer.partial(AllBlockPartials.HOSE_MAGNET, te.getBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -149,7 +149,7 @@ public class ItemDrainRenderer extends SmartTileEntityRenderer<ItemDrainTileEnti
|
|||
float yOffset = (7 / 16f) * level;
|
||||
ms.pushPose();
|
||||
ms.translate(0, yOffset, 0);
|
||||
FluidRenderer.renderTiledFluidBB(fluidStack, min, yMin - yOffset, min, max, yMin, max, buffer, ms, light,
|
||||
FluidRenderer.renderFluidBox(fluidStack, min, yMin - yOffset, min, max, yMin, max, buffer, ms, light,
|
||||
false);
|
||||
ms.popPose();
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class ItemDrainRenderer extends SmartTileEntityRenderer<ItemDrainTileEnti
|
|||
if (processingTicks != -1) {
|
||||
radius = (float) (Math.pow(((2 * processingProgress) - 1), 2) - 1);
|
||||
AABB bb = new AABB(0.5, 1.0, 0.5, 0.5, 0.25, 0.5).inflate(radius / 32f);
|
||||
FluidRenderer.renderTiledFluidBB(fluidStack2, (float) bb.minX, (float) bb.minY, (float) bb.minZ,
|
||||
FluidRenderer.renderFluidBox(fluidStack2, (float) bb.minX, (float) bb.minY, (float) bb.minZ,
|
||||
(float) bb.maxX, (float) bb.maxY, (float) bb.maxZ, buffer, ms, light, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.jozufozu.flywheel.core.PartialModel;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
|
@ -44,7 +44,7 @@ public class SpoutRenderer extends SafeTileEntityRenderer<SpoutTileEntity> {
|
|||
float yOffset = (11 / 16f) * level;
|
||||
ms.pushPose();
|
||||
ms.translate(0, yOffset, 0);
|
||||
FluidRenderer.renderTiledFluidBB(fluidStack, min, min - yOffset, min, max, min, max, buffer, ms, light,
|
||||
FluidRenderer.renderFluidBox(fluidStack, min, min - yOffset, min, max, min, max, buffer, ms, light,
|
||||
false);
|
||||
ms.popPose();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class SpoutRenderer extends SafeTileEntityRenderer<SpoutTileEntity> {
|
|||
if (processingTicks != -1) {
|
||||
radius = (float) (Math.pow(((2 * processingProgress) - 1), 2) - 1);
|
||||
AABB bb = new AABB(0.5, .5, 0.5, 0.5, -1.2, 0.5).inflate(radius / 32f);
|
||||
FluidRenderer.renderTiledFluidBB(fluidStack, (float) bb.minX, (float) bb.minY, (float) bb.minZ,
|
||||
FluidRenderer.renderFluidBox(fluidStack, (float) bb.minX, (float) bb.minY, (float) bb.minZ,
|
||||
(float) bb.maxX, (float) bb.maxY, (float) bb.maxZ, buffer, ms, light, true);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class SpoutRenderer extends SafeTileEntityRenderer<SpoutTileEntity> {
|
|||
|
||||
ms.pushPose();
|
||||
for (PartialModel bit : BITS) {
|
||||
PartialBufferer.get(bit, te.getBlockState())
|
||||
CachedBufferer.partial(bit, te.getBlockState())
|
||||
.light(light)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
ms.translate(0, -3 * squeeze / 32f, 0);
|
||||
|
|
|
@ -35,7 +35,7 @@ public class FluidValveInstance extends ShaftInstance implements IDynamicInstanc
|
|||
Direction.Axis pipeAxis = FluidValveBlock.getPipeAxis(blockState);
|
||||
Direction.Axis shaftAxis = KineticTileEntityRenderer.getRotationAxisOf(tile);
|
||||
|
||||
boolean twist = pipeAxis.isHorizontal() && shaftAxis == Direction.Axis.Z || pipeAxis.isVertical();
|
||||
boolean twist = pipeAxis.isHorizontal() && shaftAxis == Direction.Axis.X || pipeAxis.isVertical();
|
||||
pointerRotationOffset = twist ? 90 : 0;
|
||||
|
||||
pointer = materialManager.defaultSolid()
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class FluidValveRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
BlockState blockState = te.getBlockState();
|
||||
SuperByteBuffer pointer = PartialBufferer.get(AllBlockPartials.FLUID_VALVE_POINTER, blockState);
|
||||
SuperByteBuffer pointer = CachedBufferer.partial(AllBlockPartials.FLUID_VALVE_POINTER, blockState);
|
||||
Direction facing = blockState.getValue(FluidValveBlock.FACING);
|
||||
|
||||
if (!(te instanceof FluidValveTileEntity))
|
||||
|
@ -43,7 +43,7 @@ public class FluidValveRenderer extends KineticTileEntityRenderer {
|
|||
Axis shaftAxis = KineticTileEntityRenderer.getRotationAxisOf(te);
|
||||
|
||||
int pointerRotationOffset = 0;
|
||||
if (pipeAxis.isHorizontal() && shaftAxis == Axis.Z || pipeAxis.isVertical())
|
||||
if (pipeAxis.isHorizontal() && shaftAxis == Axis.X || pipeAxis.isVertical())
|
||||
pointerRotationOffset = 90;
|
||||
|
||||
MatrixTransformStack.of(ms)
|
||||
|
|
|
@ -63,7 +63,7 @@ public class FluidTankRenderer extends SafeTileEntityRenderer<FluidTankTileEntit
|
|||
|
||||
ms.pushPose();
|
||||
ms.translate(0, clampedLevel - totalHeight, 0);
|
||||
FluidRenderer.renderTiledFluidBB(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false);
|
||||
FluidRenderer.renderFluidBox(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false);
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
|
|||
|
||||
float partial = Mth.clamp(units / totalUnits, 0, 1);
|
||||
xMax += partial * 12 / 16f;
|
||||
FluidRenderer.renderTiledFluidBB(renderedFluid, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light,
|
||||
FluidRenderer.renderFluidBox(renderedFluid, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light,
|
||||
false);
|
||||
|
||||
xMin = xMax;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.jozufozu.flywheel.core.PartialModel;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -33,7 +33,7 @@ public class BlazeBurnerRenderer extends SafeTileEntityRenderer<BlazeBurnerTileE
|
|||
float offset = (Mth.sin((float) ((renderTick / 16f) % (2 * Math.PI))) + .5f) / 16f;
|
||||
|
||||
PartialModel blazeModel = AllBlockPartials.BLAZES.get(heatLevel);
|
||||
SuperByteBuffer blazeBuffer = PartialBufferer.get(blazeModel, te.getBlockState());
|
||||
SuperByteBuffer blazeBuffer = CachedBufferer.partial(blazeModel, te.getBlockState());
|
||||
blazeBuffer.rotateCentered(Direction.UP, AngleHelper.rad(te.headAngle.getValue(partialTicks)));
|
||||
blazeBuffer.translate(0, offset, 0);
|
||||
blazeBuffer.light(LightTexture.FULL_BRIGHT)
|
||||
|
|
|
@ -4,9 +4,8 @@ import com.jozufozu.flywheel.backend.Backend;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||
|
||||
|
@ -44,7 +43,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
|||
BlockState blockState = tileEntityIn.getBlockState();
|
||||
boolean alongX = blockState.getValue(SpeedControllerBlock.HORIZONTAL_AXIS) == Axis.X;
|
||||
|
||||
SuperByteBuffer bracket = PartialBufferer.get(AllBlockPartials.SPEED_CONTROLLER_BRACKET, blockState);
|
||||
SuperByteBuffer bracket = CachedBufferer.partial(AllBlockPartials.SPEED_CONTROLLER_BRACKET, blockState);
|
||||
bracket.translate(0, 1, 0);
|
||||
bracket.rotateCentered(Direction.UP,
|
||||
(float) (alongX ? Math.PI : Math.PI / 2));
|
||||
|
@ -53,7 +52,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
|||
}
|
||||
|
||||
private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) {
|
||||
return CreateClient.BUFFER_CACHE.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
||||
return CachedBufferer.block(KineticTileEntityRenderer.KINETIC_TILE,
|
||||
KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)));
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,10 @@ import com.mojang.math.Vector3f;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.ShadowRenderHelper;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
|
@ -97,7 +96,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
|
||||
PartialModel beltPartial = getBeltPartial(diagonal, start, end, bottom);
|
||||
|
||||
SuperByteBuffer beltBuffer = PartialBufferer.get(beltPartial, blockState)
|
||||
SuperByteBuffer beltBuffer = CachedBufferer.partial(beltPartial, blockState)
|
||||
.light(light);
|
||||
|
||||
SpriteShiftEntry spriteShift = getSpriteShiftEntry(color, diagonal, bottom);
|
||||
|
@ -142,7 +141,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
|||
return stack;
|
||||
};
|
||||
|
||||
SuperByteBuffer superBuffer = CreateClient.BUFFER_CACHE.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, matrixStackSupplier);
|
||||
SuperByteBuffer superBuffer = CachedBufferer.partialDirectional(AllBlockPartials.BELT_PULLEY, blockState, dir, matrixStackSupplier);
|
||||
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class BracketedKineticTileRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
|
||||
renderRotatingBuffer(te,
|
||||
PartialBufferer.getFacingVertical(AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL, te.getBlockState(), facing),
|
||||
CachedBufferer.partialFacingVertical(AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL, te.getBlockState(), facing),
|
||||
ms, buffer.getBuffer(RenderType.solid()), light);
|
||||
|
||||
float offset = getShaftAngleOffset(axis, pos);
|
||||
|
@ -53,7 +53,7 @@ public class BracketedKineticTileRenderer extends KineticTileEntityRenderer {
|
|||
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
|
||||
|
||||
SuperByteBuffer shaft =
|
||||
PartialBufferer.getFacingVertical(AllBlockPartials.COGWHEEL_SHAFT, te.getBlockState(), facing);
|
||||
CachedBufferer.partialFacingVertical(AllBlockPartials.COGWHEEL_SHAFT, te.getBlockState(), facing);
|
||||
kineticRotationTransform(shaft, te, axis, angle, light);
|
||||
shaft.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.relays.encased;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
@ -29,7 +29,7 @@ public class ShaftlessCogRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.getFacingVertical(
|
||||
return CachedBufferer.partialFacingVertical(
|
||||
large ? AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL : AllBlockPartials.SHAFTLESS_COGWHEEL, te.getBlockState(),
|
||||
Direction.fromAxisAndDirection(te.getBlockState()
|
||||
.getValue(EncasedCogwheelBlock.AXIS), AxisDirection.POSITIVE));
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
@ -52,7 +52,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
|
|||
angle = angle / 180f * (float) Math.PI;
|
||||
|
||||
SuperByteBuffer superByteBuffer =
|
||||
PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
||||
CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
||||
kineticRotationTransform(superByteBuffer, te, axis, angle, light);
|
||||
superByteBuffer.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.contraptions.relays.gauge.GaugeBlock.Type;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
|
@ -48,8 +48,8 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
PartialModel partialModel = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS);
|
||||
SuperByteBuffer headBuffer =
|
||||
PartialBufferer.get(partialModel, gaugeState);
|
||||
SuperByteBuffer dialBuffer = PartialBufferer.get(AllBlockPartials.GAUGE_DIAL, gaugeState);
|
||||
CachedBufferer.partial(partialModel, gaugeState);
|
||||
SuperByteBuffer dialBuffer = CachedBufferer.partial(AllBlockPartials.GAUGE_DIAL, gaugeState);
|
||||
|
||||
float dialPivot = 5.75f / 16;
|
||||
float progress = Mth.lerp(partialTicks, gaugeTE.prevDialState, gaugeTE.dialState);
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
@ -38,7 +38,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
|
|||
if (boxAxis == axis)
|
||||
continue;
|
||||
|
||||
SuperByteBuffer shaft = PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
||||
SuperByteBuffer shaft = CachedBufferer.partialFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||
float angle = (time * te.getSpeed() * 3f / 10) % 360;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
@ -58,9 +58,8 @@ public class CopperBacktankArmorLayer<T extends LivingEntity, M extends EntityMo
|
|||
RenderType renderType = Sheets.cutoutBlockSheet();
|
||||
BlockState renderedState = AllBlocks.COPPER_BACKTANK.getDefaultState()
|
||||
.setValue(CopperBacktankBlock.HORIZONTAL_FACING, Direction.SOUTH);
|
||||
SuperByteBuffer backtank = CreateClient.BUFFER_CACHE.renderBlock(renderedState);
|
||||
SuperByteBuffer cogs =
|
||||
CreateClient.BUFFER_CACHE.renderPartial(AllBlockPartials.COPPER_BACKTANK_COGS, renderedState);
|
||||
SuperByteBuffer backtank = CachedBufferer.block(renderedState);
|
||||
SuperByteBuffer cogs = CachedBufferer.partial(AllBlockPartials.COPPER_BACKTANK_COGS, renderedState);
|
||||
|
||||
ms.pushPose();
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@ package com.simibubi.create.content.curiosities.armor;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
@ -28,8 +27,7 @@ public class CopperBacktankRenderer extends KineticTileEntityRenderer {
|
|||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
SuperByteBuffer cogs =
|
||||
CreateClient.BUFFER_CACHE.renderPartial(AllBlockPartials.COPPER_BACKTANK_COGS, blockState);
|
||||
SuperByteBuffer cogs = CachedBufferer.partial(AllBlockPartials.COPPER_BACKTANK_COGS, blockState);
|
||||
cogs.matrixStacker()
|
||||
.centre()
|
||||
.rotateY(180 + AngleHelper.horizontalAngle(blockState.getValue(CopperBacktankBlock.HORIZONTAL_FACING)))
|
||||
|
@ -44,7 +42,7 @@ public class CopperBacktankRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.get(AllBlockPartials.COPPER_BACKTANK_SHAFT, te.getBlockState());
|
||||
return CachedBufferer.partial(AllBlockPartials.COPPER_BACKTANK_SHAFT, te.getBlockState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.content.curiosities.bell;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -26,7 +26,7 @@ public class BellRenderer<TE extends AbstractBellTileEntity> extends SafeTileEnt
|
|||
Direction facing = state.getValue(BellBlock.FACING);
|
||||
BellAttachType attachment = state.getValue(BellBlock.ATTACHMENT);
|
||||
|
||||
SuperByteBuffer bell = PartialBufferer.get(te.getBellModel(), state);
|
||||
SuperByteBuffer bell = CachedBufferer.partial(te.getBellModel(), state);
|
||||
|
||||
if (te.isRinging)
|
||||
bell.rotateCentered(te.ringDirection.getCounterClockWise(), getSwingAngle(te.ringingTicks + partialTicks));
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.curiosities.toolbox;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
@ -28,8 +28,8 @@ public class ToolboxRenderer extends SmartTileEntityRenderer<ToolboxTileEntity>
|
|||
Direction facing = blockState.getValue(ToolboxBlock.FACING)
|
||||
.getOpposite();
|
||||
SuperByteBuffer lid =
|
||||
PartialBufferer.get(AllBlockPartials.TOOLBOX_LIDS.get(tileEntityIn.getColor()), blockState);
|
||||
SuperByteBuffer drawer = PartialBufferer.get(AllBlockPartials.TOOLBOX_DRAWER, blockState);
|
||||
CachedBufferer.partial(AllBlockPartials.TOOLBOX_LIDS.get(tileEntityIn.getColor()), blockState);
|
||||
SuperByteBuffer drawer = CachedBufferer.partial(AllBlockPartials.TOOLBOX_DRAWER, blockState);
|
||||
|
||||
float lidAngle = tileEntityIn.lid.getValue(partialTicks);
|
||||
float drawerOffset = tileEntityIn.drawers.getValue(partialTicks);
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.mojang.math.Matrix3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintSection;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class BlueprintRenderer extends EntityRenderer<BlueprintEntity> {
|
|||
int light) {
|
||||
PartialModel partialModel = entity.size == 3 ? AllBlockPartials.CRAFTING_BLUEPRINT_3x3
|
||||
: entity.size == 2 ? AllBlockPartials.CRAFTING_BLUEPRINT_2x2 : AllBlockPartials.CRAFTING_BLUEPRINT_1x1;
|
||||
SuperByteBuffer sbb = PartialBufferer.get(partialModel, Blocks.AIR.defaultBlockState());
|
||||
SuperByteBuffer sbb = CachedBufferer.partial(partialModel, Blocks.AIR.defaultBlockState());
|
||||
sbb.matrixStacker()
|
||||
.rotateY(-yaw)
|
||||
.rotateX(90.0F + entity.getXRot())
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -33,7 +33,7 @@ public class BeltTunnelRenderer extends SmartTileEntityRenderer<BeltTunnelTileEn
|
|||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
|
||||
SuperByteBuffer flapBuffer = PartialBufferer.get(AllBlockPartials.BELT_TUNNEL_FLAP, te.getBlockState());
|
||||
SuperByteBuffer flapBuffer = CachedBufferer.partial(AllBlockPartials.BELT_TUNNEL_FLAP, te.getBlockState());
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
Vec3 pivot = VecHelper.voxelSpace(0, 10, 1f);
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.IntAttached;
|
||||
|
@ -47,7 +47,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer {
|
|||
float angle = lidProgress * 70;
|
||||
|
||||
if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
|
||||
SuperByteBuffer model = PartialBufferer.get(AllBlockPartials.EJECTOR_TOP, te.getBlockState());
|
||||
SuperByteBuffer model = CachedBufferer.partial(AllBlockPartials.EJECTOR_TOP, te.getBlockState());
|
||||
applyLidAngle(te, angle, model.matrixStacker());
|
||||
model.light(light)
|
||||
.renderInto(ms, vertexBuilder);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.content.logistics.block.diodes;
|
||||
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.ColoredOverlayTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
@ -21,7 +21,7 @@ public class BrassDiodeRenderer extends ColoredOverlayTileEntityRenderer<BrassDi
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getOverlayBuffer(BrassDiodeTileEntity te) {
|
||||
return PartialBufferer.get(AllBlockPartials.FLEXPEATER_INDICATOR, te.getBlockState());
|
||||
return CachedBufferer.partial(AllBlockPartials.FLEXPEATER_INDICATOR, te.getBlockState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -37,7 +37,7 @@ public class FunnelRenderer extends SmartTileEntityRenderer<FunnelTileEntity> {
|
|||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
PartialModel partialModel = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
||||
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
||||
SuperByteBuffer flapBuffer = PartialBufferer.get(partialModel, blockState);
|
||||
SuperByteBuffer flapBuffer = CachedBufferer.partial(partialModel, blockState);
|
||||
Vec3 pivot = VecHelper.voxelSpace(0, 10, 9.5f);
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity.Phase;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
@ -110,12 +110,12 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
|||
}
|
||||
|
||||
private void renderArm(VertexConsumer builder, PoseStack ms, PoseStack msLocal, MatrixTransformStack msr, BlockState blockState, int color, float baseAngle, float lowerArmAngle, float upperArmAngle, float headAngle, boolean hasItem, boolean isBlockItem, int light) {
|
||||
SuperByteBuffer base = PartialBufferer.get(AllBlockPartials.ARM_BASE, blockState).light(light);
|
||||
SuperByteBuffer lowerBody = PartialBufferer.get(AllBlockPartials.ARM_LOWER_BODY, blockState).light(light);
|
||||
SuperByteBuffer upperBody = PartialBufferer.get(AllBlockPartials.ARM_UPPER_BODY, blockState).light(light);
|
||||
SuperByteBuffer head = PartialBufferer.get(AllBlockPartials.ARM_HEAD, blockState).light(light);
|
||||
SuperByteBuffer claw = PartialBufferer.get(AllBlockPartials.ARM_CLAW_BASE, blockState).light(light);
|
||||
SuperByteBuffer clawGrip = PartialBufferer.get(AllBlockPartials.ARM_CLAW_GRIP, blockState);
|
||||
SuperByteBuffer base = CachedBufferer.partial(AllBlockPartials.ARM_BASE, blockState).light(light);
|
||||
SuperByteBuffer lowerBody = CachedBufferer.partial(AllBlockPartials.ARM_LOWER_BODY, blockState).light(light);
|
||||
SuperByteBuffer upperBody = CachedBufferer.partial(AllBlockPartials.ARM_UPPER_BODY, blockState).light(light);
|
||||
SuperByteBuffer head = CachedBufferer.partial(AllBlockPartials.ARM_HEAD, blockState).light(light);
|
||||
SuperByteBuffer claw = CachedBufferer.partial(AllBlockPartials.ARM_CLAW_BASE, blockState).light(light);
|
||||
SuperByteBuffer clawGrip = CachedBufferer.partial(AllBlockPartials.ARM_CLAW_GRIP, blockState);
|
||||
|
||||
transformBase(msr, baseAngle);
|
||||
base.transform(msLocal)
|
||||
|
@ -188,7 +188,7 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return PartialBufferer.get(AllBlockPartials.ARM_COG, te.getBlockState());
|
||||
return CachedBufferer.partial(AllBlockPartials.ARM_COG, te.getBlockState());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE
|
|||
private class SelectionModeValueBox extends CenteredSideValueBoxTransform {
|
||||
|
||||
public SelectionModeValueBox() {
|
||||
super((blockState, direction) -> direction != Direction.DOWN && direction != Direction.UP);
|
||||
super((blockState, direction) -> !direction.getAxis().isVertical());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.jozufozu.flywheel.backend.Backend;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
@ -34,7 +34,7 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
|
|||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
||||
// Handle
|
||||
SuperByteBuffer handle = PartialBufferer.get(AllBlockPartials.ANALOG_LEVER_HANDLE, leverState);
|
||||
SuperByteBuffer handle = CachedBufferer.partial(AllBlockPartials.ANALOG_LEVER_HANDLE, leverState);
|
||||
float angle = (float) ((state / 15) * 90 / 180 * Math.PI);
|
||||
transform(handle, leverState).translate(1 / 2f, 1 / 16f, 1 / 2f)
|
||||
.rotate(Direction.EAST, angle)
|
||||
|
@ -44,7 +44,7 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
|
|||
|
||||
// Indicator
|
||||
int color = Color.mixColors(0x2C0300, 0xCD0000, state / 15f);
|
||||
SuperByteBuffer indicator = transform(PartialBufferer.get(AllBlockPartials.ANALOG_LEVER_INDICATOR, leverState), leverState);
|
||||
SuperByteBuffer indicator = transform(CachedBufferer.partial(AllBlockPartials.ANALOG_LEVER_INDICATOR, leverState), leverState);
|
||||
indicator.light(light)
|
||||
.color(color)
|
||||
.renderInto(ms, vb);
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.mojang.math.Vector3f;
|
|||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.schematics.block.LaunchedItem.ForBlockState;
|
||||
import com.simibubi.create.content.schematics.block.LaunchedItem.ForEntity;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||
|
||||
|
@ -63,14 +63,14 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
|
||||
SuperByteBuffer connector = PartialBufferer.get(AllBlockPartials.SCHEMATICANNON_CONNECTOR, state);
|
||||
SuperByteBuffer connector = CachedBufferer.partial(AllBlockPartials.SCHEMATICANNON_CONNECTOR, state);
|
||||
connector.translate(.5f, 0, .5f);
|
||||
connector.rotate(Direction.UP, (float) ((yaw + 90) / 180 * Math.PI));
|
||||
connector.translate(-.5f, 0, -.5f);
|
||||
connector.light(lightCoords)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
SuperByteBuffer pipe = PartialBufferer.get(AllBlockPartials.SCHEMATICANNON_PIPE, state);
|
||||
SuperByteBuffer pipe = CachedBufferer.partial(AllBlockPartials.SCHEMATICANNON_PIPE, state);
|
||||
pipe.translate(.5f, 15 / 16f, .5f);
|
||||
pipe.rotate(Direction.UP, (float) ((yaw + 90) / 180 * Math.PI));
|
||||
pipe.rotate(Direction.SOUTH, (float) (pitch / 180 * Math.PI));
|
||||
|
|
|
@ -61,38 +61,38 @@ public class FluidRenderer {
|
|||
ms.pushPose();
|
||||
msr.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(direction))
|
||||
.rotateX(direction == Direction.UP ? 0 : direction == Direction.DOWN ? 180 : 90)
|
||||
.rotateX(direction == Direction.UP ? 180 : direction == Direction.DOWN ? 0 : 270)
|
||||
.unCentre();
|
||||
ms.translate(.5, 0, .5);
|
||||
|
||||
float h = (float) (radius);
|
||||
float hMin = (float) (-radius);
|
||||
float hMax = (float) (radius);
|
||||
float y = inbound ? 0 : .5f;
|
||||
float yMin = y;
|
||||
float yMax = y + Mth.clamp(progress * .5f - 1e-6f, 0, 1);
|
||||
float h = radius;
|
||||
float hMin = -radius;
|
||||
float hMax = radius;
|
||||
float y = inbound ? 1 : .5f;
|
||||
float yMin = y - Mth.clamp(progress * .5f, 0, 1);
|
||||
float yMax = y;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ms.pushPose();
|
||||
renderTiledHorizontalFace(h, Direction.SOUTH, hMin, yMin, hMax, yMax, builder, ms, light, color,
|
||||
flowTexture);
|
||||
renderFlowingTiledFace(Direction.SOUTH, hMin, yMin, hMax, yMax, h,
|
||||
builder, ms, light, color, flowTexture);
|
||||
ms.popPose();
|
||||
msr.rotateY(90);
|
||||
}
|
||||
|
||||
if (progress != 1)
|
||||
renderTiledVerticalFace(yMax, Direction.UP, hMin, hMin, hMax, hMax, builder, ms, light, color,
|
||||
stillTexture);
|
||||
renderStillTiledFace(Direction.DOWN, hMin, hMin, hMax, hMax, yMin,
|
||||
builder, ms, light, color, stillTexture);
|
||||
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
public static void renderTiledFluidBB(FluidStack fluidStack, float xMin, float yMin, float zMin, float xMax,
|
||||
public static void renderFluidBox(FluidStack fluidStack, float xMin, float yMin, float zMin, float xMax,
|
||||
float yMax, float zMax, MultiBufferSource buffer, PoseStack ms, int light, boolean renderBottom) {
|
||||
renderTiledFluidBB(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, getFluidBuilder(buffer), ms, light, renderBottom);
|
||||
renderFluidBox(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, getFluidBuilder(buffer), ms, light, renderBottom);
|
||||
}
|
||||
|
||||
public static void renderTiledFluidBB(FluidStack fluidStack, float xMin, float yMin, float zMin, float xMax,
|
||||
public static void renderFluidBox(FluidStack fluidStack, float xMin, float yMin, float zMin, float xMax,
|
||||
float yMax, float zMax, VertexConsumer builder, PoseStack ms, int light, boolean renderBottom) {
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
FluidAttributes fluidAttributes = fluid.getAttributes();
|
||||
|
@ -122,79 +122,97 @@ public class FluidRenderer {
|
|||
boolean positive = side.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
if (side.getAxis()
|
||||
.isHorizontal()) {
|
||||
boolean x = side.getAxis() == Axis.X;
|
||||
renderTiledHorizontalFace(positive ? (x ? xMax : zMax) : (x ? xMin : zMin), side, x ? zMin : xMin, yMin, x ? zMax : xMax, yMax, builder,
|
||||
ms, light, color, fluidTexture);
|
||||
if (side.getAxis() == Axis.X) {
|
||||
renderStillTiledFace(side, zMin, yMin, zMax, yMax, positive ? xMax : xMin,
|
||||
builder, ms, light, color, fluidTexture);
|
||||
} else {
|
||||
renderStillTiledFace(side, xMin, yMin, xMax, yMax, positive ? zMax : zMin,
|
||||
builder, ms, light, color, fluidTexture);
|
||||
}
|
||||
} else {
|
||||
renderTiledVerticalFace(positive ? yMax : yMin, side, xMin, zMin, xMax, zMax, builder, ms,
|
||||
light, color, fluidTexture);
|
||||
renderStillTiledFace(side, xMin, zMin, xMax, zMax, positive ? yMax : yMin,
|
||||
builder, ms, light, color, fluidTexture);
|
||||
}
|
||||
}
|
||||
|
||||
ms.popPose();
|
||||
|
||||
}
|
||||
|
||||
private static void renderTiledVerticalFace(float y, Direction face, float xMin, float zMin, float xMax, float zMax,
|
||||
VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture) {
|
||||
boolean positive = face.getAxisDirection() == Direction.AxisDirection.POSITIVE;
|
||||
public static void renderStillTiledFace(Direction dir, float left, float down, float right, float up,
|
||||
float depth, VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture) {
|
||||
FluidRenderer.renderTiledFace(dir, left, down, right, up, depth, builder, ms, light, color, texture, 1);
|
||||
}
|
||||
|
||||
public static void renderFlowingTiledFace(Direction dir, float left, float down, float right, float up,
|
||||
float depth, VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture) {
|
||||
FluidRenderer.renderTiledFace(dir, left, down, right, up, depth, builder, ms, light, color, texture, 0.5f);
|
||||
}
|
||||
|
||||
public static void renderTiledFace(Direction dir, float left, float down, float right, float up,
|
||||
float depth, VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture,
|
||||
float textureScale) {
|
||||
boolean positive = dir.getAxisDirection() == Direction.AxisDirection.POSITIVE;
|
||||
boolean horizontal = dir.getAxis().isHorizontal();
|
||||
boolean x = dir.getAxis() == Axis.X;
|
||||
|
||||
float shrink = texture.uvShrinkRatio() * 0.25f * textureScale;
|
||||
float centerU = texture.getU0() + (texture.getU1() - texture.getU0()) * 0.5f * textureScale;
|
||||
float centerV = texture.getV0() + (texture.getV1() - texture.getV0()) * 0.5f * textureScale;
|
||||
|
||||
float f;
|
||||
float x2 = 0;
|
||||
float z2 = 0;
|
||||
for (float x1 = xMin; x1 < xMax; x1 = x2) {
|
||||
x2 = Math.min((int) (x1 + 1), xMax);
|
||||
for (float z1 = zMin; z1 < zMax; z1 = z2) {
|
||||
z2 = Math.min((int) (z1 + 1), zMax);
|
||||
|
||||
float u1 = texture.getU(local(x1) * 16);
|
||||
float v1 = texture.getV(local(z1) * 16);
|
||||
float u2 = texture.getU(x2 == xMax ? local(x2) * 16 : 16);
|
||||
float v2 = texture.getV(z2 == zMax ? local(z2) * 16 : 16);
|
||||
|
||||
putVertex(builder, ms, x1, y, positive ? z1 : z2, color, u1, v1, face, light);
|
||||
putVertex(builder, ms, x1, y, positive ? z2 : z1, color, u1, v2, face, light);
|
||||
putVertex(builder, ms, x2, y, positive ? z2 : z1, color, u2, v2, face, light);
|
||||
putVertex(builder, ms, x2, y, positive ? z1 : z2, color, u2, v1, face, light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderTiledHorizontalFace(float h, Direction face, float hMin, float yMin, float hMax,
|
||||
float yMax, VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture) {
|
||||
boolean positive = face.getAxisDirection() == Direction.AxisDirection.POSITIVE;
|
||||
boolean x = face.getAxis() == Axis.X;
|
||||
|
||||
float h2 = 0;
|
||||
float y2 = 0;
|
||||
for (float h1 = hMin; h1 < hMax; h1 = h2) {
|
||||
h2 = Math.min((int) (h1 + 1), hMax);
|
||||
for (float y1 = yMin; y1 < yMax; y1 = y2) {
|
||||
y2 = Math.min((int) (y1 + 1), yMax);
|
||||
float u1, u2;
|
||||
float v1, v2;
|
||||
for (float x1 = left; x1 < right; x1 = x2) {
|
||||
f = Mth.floor(x1);
|
||||
x2 = Math.min(f + 1, right);
|
||||
if (dir == Direction.NORTH || dir == Direction.EAST) {
|
||||
f = Mth.ceil(x2);
|
||||
u1 = texture.getU((f - x2) * 16 * textureScale);
|
||||
u2 = texture.getU((f - x1) * 16 * textureScale);
|
||||
} else {
|
||||
u1 = texture.getU((x1 - f) * 16 * textureScale);
|
||||
u2 = texture.getU((x2 - f) * 16 * textureScale);
|
||||
}
|
||||
u1 = Mth.lerp(shrink, u1, centerU);
|
||||
u2 = Mth.lerp(shrink, u2, centerU);
|
||||
for (float y1 = down; y1 < up; y1 = y2) {
|
||||
f = Mth.floor(y1);
|
||||
y2 = Math.min(f + 1, up);
|
||||
if (dir == Direction.UP) {
|
||||
v1 = texture.getV((y1 - f) * 16 * textureScale);
|
||||
v2 = texture.getV((y2 - f) * 16 * textureScale);
|
||||
} else {
|
||||
f = Mth.ceil(y2);
|
||||
v1 = texture.getV((f - y2) * 16 * textureScale);
|
||||
v2 = texture.getV((f - y1) * 16 * textureScale);
|
||||
}
|
||||
v1 = Mth.lerp(shrink, v1, centerV);
|
||||
v2 = Mth.lerp(shrink, v2, centerV);
|
||||
|
||||
float u1 = texture.getU(local(h1) * 16);
|
||||
float v1 = texture.getV(local(y1) * 16);
|
||||
float u2 = texture.getU(h2 == hMax ? local(h2) * 16 : 16);
|
||||
float v2 = texture.getV(y2 == yMax ? local(y2) * 16 : 16);
|
||||
|
||||
float x1 = x ? h : (positive ? h1 : h2);
|
||||
float x2 = x ? h : (positive ? h2 : h1);
|
||||
float z1 = x ? (positive ? h1 : h2) : h;
|
||||
float z2 = x ? (positive ? h2 : h1) : h;
|
||||
|
||||
putVertex(builder, ms, x1, y2, z2, color, u1, v1, face, light);
|
||||
putVertex(builder, ms, x1, y1, z2, color, u1, v2, face, light);
|
||||
putVertex(builder, ms, x2, y1, z1, color, u2, v2, face, light);
|
||||
putVertex(builder, ms, x2, y2, z1, color, u2, v1, face, light);
|
||||
if (horizontal) {
|
||||
if (x) {
|
||||
putVertex(builder, ms, depth, y2, positive ? x2 : x1, color, u1, v1, dir, light);
|
||||
putVertex(builder, ms, depth, y1, positive ? x2 : x1, color, u1, v2, dir, light);
|
||||
putVertex(builder, ms, depth, y1, positive ? x1 : x2, color, u2, v2, dir, light);
|
||||
putVertex(builder, ms, depth, y2, positive ? x1 : x2, color, u2, v1, dir, light);
|
||||
} else {
|
||||
putVertex(builder, ms, positive ? x1 : x2, y2, depth, color, u1, v1, dir, light);
|
||||
putVertex(builder, ms, positive ? x1 : x2, y1, depth, color, u1, v2, dir, light);
|
||||
putVertex(builder, ms, positive ? x2 : x1, y1, depth, color, u2, v2, dir, light);
|
||||
putVertex(builder, ms, positive ? x2 : x1, y2, depth, color, u2, v1, dir, light);
|
||||
}
|
||||
} else {
|
||||
putVertex(builder, ms, x1, depth, positive ? y1 : y2, color, u1, v1, dir, light);
|
||||
putVertex(builder, ms, x1, depth, positive ? y2 : y1, color, u1, v2, dir, light);
|
||||
putVertex(builder, ms, x2, depth, positive ? y2 : y1, color, u2, v2, dir, light);
|
||||
putVertex(builder, ms, x2, depth, positive ? y1 : y2, color, u2, v1, dir, light);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static float local(float f) {
|
||||
if (f < 0)
|
||||
f += 10;
|
||||
return f - ((int) f);
|
||||
}
|
||||
|
||||
private static void putVertex(VertexConsumer builder, PoseStack ms, float x, float y, float z, int color, float u,
|
||||
float v, Direction face, int light) {
|
||||
|
||||
|
|
|
@ -224,8 +224,8 @@ public class GuiGameElement {
|
|||
.isEmpty())
|
||||
return;
|
||||
|
||||
FluidRenderer.renderTiledFluidBB(new FluidStack(blockState.getFluidState()
|
||||
.getType(), 1000), 0, 0, 0, 1.0001f, 1.0001f, 1.0001f, buffer, ms, LightTexture.FULL_BRIGHT, false);
|
||||
FluidRenderer.renderFluidBox(new FluidStack(blockState.getFluidState()
|
||||
.getType(), 1000), 0, 0, 0, 1, 1, 1, buffer, ms, LightTexture.FULL_BRIGHT, false);
|
||||
buffer.endBatch();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import com.simibubi.create.CreateClient;
|
|||
import com.simibubi.create.foundation.ponder.PonderScene;
|
||||
import com.simibubi.create.foundation.ponder.PonderWorld;
|
||||
import com.simibubi.create.foundation.ponder.Selection;
|
||||
import com.simibubi.create.foundation.render.Compartment;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||
import com.simibubi.create.foundation.render.TileEntityRenderHelper;
|
||||
|
@ -33,7 +32,6 @@ import net.minecraft.client.renderer.LevelRenderer;
|
|||
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;
|
||||
|
@ -41,7 +39,6 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
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.RenderShape;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
@ -57,7 +54,7 @@ import net.minecraftforge.client.model.data.EmptyModelData;
|
|||
|
||||
public class WorldSectionElement extends AnimatedSceneElement {
|
||||
|
||||
public static final Compartment<Pair<Integer, Integer>> DOC_WORLD_SECTION = new Compartment<>();
|
||||
public static final SuperByteBufferCache.Compartment<Pair<Integer, Integer>> DOC_WORLD_SECTION = new SuperByteBufferCache.Compartment<>();
|
||||
|
||||
List<BlockEntity> renderedTileEntities;
|
||||
List<Pair<BlockEntity, Consumer<Level>>> tickableTileEntities;
|
||||
|
@ -396,12 +393,11 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
|||
|
||||
private SuperByteBuffer buildStructureBuffer(PonderWorld world, RenderType layer) {
|
||||
ForgeHooksClient.setRenderLayer(layer);
|
||||
PoseStack ms = new PoseStack();
|
||||
BlockRenderDispatcher dispatcher = Minecraft.getInstance()
|
||||
.getBlockRenderer();
|
||||
ModelBlockRenderer blockRenderer = dispatcher.getModelRenderer();
|
||||
PoseStack ms = new PoseStack();
|
||||
Random random = new Random();
|
||||
BufferBuilder builder = new BufferBuilder(DefaultVertexFormat.BLOCK.getIntegerSize());
|
||||
BufferBuilder builder = new BufferBuilder(512);
|
||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
world.setMask(this.section);
|
||||
|
||||
|
@ -412,8 +408,7 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
|||
ms.pushPose();
|
||||
ms.translate(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
if (state.getRenderShape() != RenderShape.ENTITYBLOCK_ANIMATED && state.getBlock() != Blocks.AIR
|
||||
&& ItemBlockRenderTypes.canRenderInLayer(state, layer)) {
|
||||
if (state.getRenderShape() == RenderShape.MODEL && ItemBlockRenderTypes.canRenderInLayer(state, layer)) {
|
||||
BlockEntity tileEntity = world.getBlockEntity(pos);
|
||||
dispatcher.renderBatched(state, pos, world, ms, builder, true, random,
|
||||
tileEntity != null ? tileEntity.getModelData() : EmptyModelData.INSTANCE);
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.block.ModelBlockRenderer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class BakedModelRenderHelper {
|
||||
|
||||
public static SuperByteBuffer standardBlockRender(BlockState renderedState) {
|
||||
BlockRenderDispatcher dispatcher = Minecraft.getInstance()
|
||||
.getBlockRenderer();
|
||||
return standardModelRender(dispatcher.getBlockModel(renderedState), renderedState);
|
||||
}
|
||||
|
||||
public static SuperByteBuffer standardModelRender(BakedModel model, BlockState referenceState) {
|
||||
return standardModelRender(model, referenceState, new PoseStack());
|
||||
}
|
||||
|
||||
public static SuperByteBuffer standardModelRender(BakedModel model, BlockState referenceState, PoseStack ms) {
|
||||
BufferBuilder builder = getBufferBuilder(model, referenceState, ms);
|
||||
|
||||
return new SuperByteBuffer(builder);
|
||||
}
|
||||
|
||||
public static BufferBuilder getBufferBuilder(BakedModel model, BlockState referenceState, PoseStack ms) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
BlockRenderDispatcher dispatcher = mc.getBlockRenderer();
|
||||
ModelBlockRenderer blockRenderer = dispatcher.getModelRenderer();
|
||||
BufferBuilder builder = new BufferBuilder(512);
|
||||
|
||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
|
||||
blockRenderer.tesselateBlock(mc.level, model, referenceState, BlockPos.ZERO.above(255), ms, builder, true,
|
||||
new Random(), 42, OverlayTexture.NO_OVERLAY, VirtualEmptyModelData.INSTANCE);
|
||||
builder.end();
|
||||
return builder;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache.Compartment;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class CachedBufferer {
|
||||
|
||||
public static final Compartment<BlockState> GENERIC_TILE = new Compartment<>();
|
||||
public static final Compartment<PartialModel> PARTIAL = new Compartment<>();
|
||||
public static final Compartment<Pair<Direction, PartialModel>> DIRECTIONAL_PARTIAL = new Compartment<>();
|
||||
|
||||
public static SuperByteBuffer block(BlockState toRender) {
|
||||
return block(GENERIC_TILE, toRender);
|
||||
}
|
||||
|
||||
public static SuperByteBuffer block(Compartment<BlockState> compartment, BlockState toRender) {
|
||||
return CreateClient.BUFFER_CACHE.get(compartment, toRender, () -> BakedModelRenderHelper.standardBlockRender(toRender));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer partial(PartialModel partial, BlockState referenceState) {
|
||||
return CreateClient.BUFFER_CACHE.get(PARTIAL, partial,
|
||||
() -> BakedModelRenderHelper.standardModelRender(partial.get(), referenceState));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer partial(PartialModel partial, BlockState referenceState,
|
||||
Supplier<PoseStack> modelTransform) {
|
||||
return CreateClient.BUFFER_CACHE.get(PARTIAL, partial,
|
||||
() -> BakedModelRenderHelper.standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer partialFacing(PartialModel partial, BlockState referenceState) {
|
||||
Direction facing = referenceState.getValue(FACING);
|
||||
return partialFacing(partial, referenceState, facing);
|
||||
}
|
||||
|
||||
public static SuperByteBuffer partialFacing(PartialModel partial, BlockState referenceState, Direction facing) {
|
||||
return partialDirectional(partial, referenceState, facing,
|
||||
rotateToFace(facing));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer partialFacingVertical(PartialModel partial, BlockState referenceState, Direction facing) {
|
||||
return partialDirectional(partial, referenceState, facing,
|
||||
rotateToFaceVertical(facing));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer partialDirectional(PartialModel partial, BlockState referenceState, Direction dir,
|
||||
Supplier<PoseStack> modelTransform) {
|
||||
return CreateClient.BUFFER_CACHE.get(DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
||||
() -> BakedModelRenderHelper.standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
||||
}
|
||||
|
||||
public static Supplier<PoseStack> rotateToFace(Direction facing) {
|
||||
return () -> {
|
||||
PoseStack stack = new PoseStack();
|
||||
MatrixTransformStack.of(stack)
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing))
|
||||
.unCentre();
|
||||
return stack;
|
||||
};
|
||||
}
|
||||
|
||||
public static Supplier<PoseStack> rotateToFaceVertical(Direction facing) {
|
||||
return () -> {
|
||||
PoseStack stack = new PoseStack();
|
||||
MatrixTransformStack.of(stack)
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.unCentre();
|
||||
return stack;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class Compartment<T> {
|
||||
public static final Compartment<BlockState> GENERIC_TILE = new Compartment<>();
|
||||
public static final Compartment<PartialModel> PARTIAL = new Compartment<>();
|
||||
public static final Compartment<Pair<Direction, PartialModel>> DIRECTIONAL_PARTIAL = new Compartment<>();
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class PartialBufferer {
|
||||
|
||||
public static SuperByteBuffer get(PartialModel partial, BlockState referenceState) {
|
||||
return CreateClient.BUFFER_CACHE.renderPartial(partial, referenceState);
|
||||
}
|
||||
|
||||
public static SuperByteBuffer getFacing(PartialModel partial, BlockState referenceState) {
|
||||
Direction facing = referenceState.getValue(FACING);
|
||||
return getFacing(partial, referenceState, facing);
|
||||
}
|
||||
|
||||
public static SuperByteBuffer getFacing(PartialModel partial, BlockState referenceState, Direction facing) {
|
||||
return CreateClient.BUFFER_CACHE.renderDirectionalPartial(partial, referenceState, facing,
|
||||
rotateToFace(facing));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer getFacingVertical(PartialModel partial, BlockState referenceState, Direction facing) {
|
||||
return CreateClient.BUFFER_CACHE.renderDirectionalPartial(partial, referenceState, facing,
|
||||
rotateToFaceVertical(facing));
|
||||
}
|
||||
|
||||
public static Supplier<PoseStack> rotateToFace(Direction facing) {
|
||||
return () -> {
|
||||
PoseStack stack = new PoseStack();
|
||||
MatrixTransformStack.of(stack)
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing))
|
||||
.unCentre();
|
||||
return stack;
|
||||
};
|
||||
}
|
||||
|
||||
public static Supplier<PoseStack> rotateToFaceVertical(Direction facing) {
|
||||
return () -> {
|
||||
PoseStack stack = new PoseStack();
|
||||
MatrixTransformStack.of(stack)
|
||||
.centre()
|
||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
||||
.rotateX(AngleHelper.verticalAngle(facing) + 90)
|
||||
.unCentre();
|
||||
return stack;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
|
@ -2,136 +2,53 @@ package com.simibubi.create.foundation.render;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
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;
|
||||
import net.minecraft.client.renderer.block.ModelBlockRenderer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class SuperByteBufferCache {
|
||||
|
||||
private Map<Compartment<?>, Cache<Object, SuperByteBuffer>> cache;
|
||||
protected final Map<Compartment<?>, Cache<Object, SuperByteBuffer>> caches = new HashMap<>();
|
||||
|
||||
public SuperByteBufferCache() {
|
||||
cache = new HashMap<>();
|
||||
registerCompartment(Compartment.GENERIC_TILE);
|
||||
registerCompartment(Compartment.PARTIAL);
|
||||
registerCompartment(Compartment.DIRECTIONAL_PARTIAL);
|
||||
public synchronized void registerCompartment(Compartment<?> compartment) {
|
||||
caches.put(compartment, CacheBuilder.newBuilder()
|
||||
.build());
|
||||
}
|
||||
|
||||
public SuperByteBuffer renderBlock(BlockState toRender) {
|
||||
return getGeneric(toRender, () -> standardBlockRender(toRender));
|
||||
public synchronized void registerCompartment(Compartment<?> compartment, long ticksUntilExpired) {
|
||||
caches.put(compartment, CacheBuilder.newBuilder()
|
||||
.expireAfterAccess(ticksUntilExpired * 50, TimeUnit.MILLISECONDS)
|
||||
.build());
|
||||
}
|
||||
|
||||
public SuperByteBuffer renderPartial(PartialModel partial, BlockState referenceState) {
|
||||
return get(Compartment.PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState));
|
||||
}
|
||||
|
||||
public SuperByteBuffer renderPartial(PartialModel partial, BlockState referenceState,
|
||||
Supplier<PoseStack> modelTransform) {
|
||||
return get(Compartment.PARTIAL, partial,
|
||||
() -> standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
||||
}
|
||||
|
||||
public SuperByteBuffer renderDirectionalPartial(PartialModel partial, BlockState referenceState,
|
||||
Direction dir) {
|
||||
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
||||
() -> standardModelRender(partial.get(), referenceState));
|
||||
}
|
||||
|
||||
public SuperByteBuffer renderDirectionalPartial(PartialModel partial, BlockState referenceState, Direction dir,
|
||||
Supplier<PoseStack> modelTransform) {
|
||||
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
||||
() -> standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
||||
}
|
||||
|
||||
public SuperByteBuffer renderBlockIn(Compartment<BlockState> compartment, BlockState toRender) {
|
||||
return get(compartment, toRender, () -> standardBlockRender(toRender));
|
||||
}
|
||||
|
||||
SuperByteBuffer getGeneric(BlockState key, Supplier<SuperByteBuffer> supplier) {
|
||||
return get(Compartment.GENERIC_TILE, key, supplier);
|
||||
}
|
||||
|
||||
public <T> SuperByteBuffer get(Compartment<T> compartment, T key, Supplier<SuperByteBuffer> supplier) {
|
||||
Cache<Object, SuperByteBuffer> compartmentCache = this.cache.get(compartment);
|
||||
try {
|
||||
return compartmentCache.get(key, supplier::get);
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
public <T> SuperByteBuffer get(Compartment<T> compartment, T key, Callable<SuperByteBuffer> callable) {
|
||||
Cache<Object, SuperByteBuffer> cache = caches.get(compartment);
|
||||
if (cache != null) {
|
||||
try {
|
||||
return cache.get(key, callable);
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> void invalidate(Compartment<T> compartment, T key) {
|
||||
Cache<Object, SuperByteBuffer> compartmentCache = this.cache.get(compartment);
|
||||
compartmentCache.invalidate(key);
|
||||
caches.get(compartment).invalidate(key);
|
||||
}
|
||||
|
||||
public void registerCompartment(Compartment<?> instance) {
|
||||
synchronized (cache) {
|
||||
cache.put(instance, CacheBuilder.newBuilder()
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
public void registerCompartment(Compartment<?> instance, long ticksUntilExpired) {
|
||||
synchronized (cache) {
|
||||
cache.put(instance, CacheBuilder.newBuilder()
|
||||
.expireAfterAccess(ticksUntilExpired * 50, TimeUnit.MILLISECONDS)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
private SuperByteBuffer standardBlockRender(BlockState renderedState) {
|
||||
BlockRenderDispatcher dispatcher = Minecraft.getInstance()
|
||||
.getBlockRenderer();
|
||||
return standardModelRender(dispatcher.getBlockModel(renderedState), renderedState);
|
||||
}
|
||||
|
||||
private SuperByteBuffer standardModelRender(BakedModel model, BlockState referenceState) {
|
||||
return standardModelRender(model, referenceState, new PoseStack());
|
||||
}
|
||||
|
||||
private SuperByteBuffer standardModelRender(BakedModel model, BlockState referenceState, PoseStack ms) {
|
||||
BufferBuilder builder = getBufferBuilder(model, referenceState, ms);
|
||||
|
||||
return new SuperByteBuffer(builder);
|
||||
}
|
||||
|
||||
public static BufferBuilder getBufferBuilder(BakedModel model, BlockState referenceState, PoseStack ms) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
BlockRenderDispatcher dispatcher = mc.getBlockRenderer();
|
||||
ModelBlockRenderer blockRenderer = dispatcher.getModelRenderer();
|
||||
BufferBuilder builder = new BufferBuilder(512);
|
||||
|
||||
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;
|
||||
public <T> void invalidate(Compartment<?> compartment) {
|
||||
caches.get(compartment).invalidateAll();
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
cache.forEach((comp, cache) -> cache.invalidateAll());
|
||||
caches.forEach((compartment, cache) -> cache.invalidateAll());
|
||||
}
|
||||
|
||||
public static class Compartment<T> {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public abstract class ValueBoxTransform {
|
|||
protected Vec3 getLocalOffset(BlockState state) {
|
||||
Vec3 location = getSouthLocation();
|
||||
location = VecHelper.rotateCentered(location, AngleHelper.horizontalAngle(getSide()), Axis.Y);
|
||||
location = VecHelper.rotateCentered(location, AngleHelper.verticalAngle(getSide()), Axis.Z);
|
||||
location = VecHelper.rotateCentered(location, AngleHelper.verticalAngle(getSide()), Axis.X);
|
||||
return location;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ public class ScrollValueHandler {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static boolean onScroll(double delta) {
|
||||
HitResult objectMouseOver = Minecraft.getInstance().hitResult;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
HitResult objectMouseOver = mc.hitResult;
|
||||
if (!(objectMouseOver instanceof BlockHitResult))
|
||||
return false;
|
||||
|
||||
BlockHitResult result = (BlockHitResult) objectMouseOver;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ClientLevel world = mc.level;
|
||||
BlockPos blockPos = result.getBlockPos();
|
||||
|
||||
|
@ -46,13 +46,13 @@ public class ScrollValueHandler {
|
|||
return false;
|
||||
if (!mc.player.mayBuild())
|
||||
return false;
|
||||
if (scrolling.needsWrench && !AllItems.WRENCH.isIn(mc.player.getMainHandItem()))
|
||||
return false;
|
||||
|
||||
passiveScrollDirection = (float) -delta;
|
||||
wrenchCog.bump(3, -delta * 10);
|
||||
int prev = scrolling.scrollableValue;
|
||||
|
||||
if (scrolling.needsWrench && !AllItems.WRENCH.isIn(mc.player.getMainHandItem()))
|
||||
return false;
|
||||
if (scrolling.slotPositioning instanceof Sided)
|
||||
((Sided) scrolling.slotPositioning).fromSide(result.getDirection());
|
||||
if (!scrolling.testHit(objectMouseOver.getLocation()))
|
||||
|
|
|
@ -5,23 +5,9 @@ import net.minecraft.core.Direction.Axis;
|
|||
|
||||
public class AngleHelper {
|
||||
|
||||
/**
|
||||
* Legacy method. See {@link #horizontalAngleNew(Direction)} for new method.
|
||||
*/
|
||||
public static float horizontalAngle(Direction facing) {
|
||||
float angle = facing.toYRot();
|
||||
if (facing.getAxis() == Axis.X)
|
||||
angle = -angle;
|
||||
return angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as {@link #horizontalAngle(Direction)}, but returns 0 instead of -90 for vertical directions.
|
||||
*/
|
||||
public static float horizontalAngleNew(Direction facing) {
|
||||
if (facing.getAxis().isVertical()) {
|
||||
if (facing.getAxis().isVertical())
|
||||
return 0;
|
||||
}
|
||||
float angle = facing.toYRot();
|
||||
if (facing.getAxis() == Axis.X)
|
||||
angle = -angle;
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.server.packs.resources.ResourceManager;
|
|||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
|
||||
// TODO 1.18: remove and replace all usages with ResourceManagerReloadListener
|
||||
@FunctionalInterface
|
||||
public interface ISimpleReloadListener extends PreparableReloadListener {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
|||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.foundation.render.RenderTypes;
|
||||
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
@ -31,23 +32,12 @@ public class BlockClusterOutline extends Outline {
|
|||
|
||||
@Override
|
||||
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) {
|
||||
for (MergeEntry edge : cluster.visibleEdges) {
|
||||
cluster.visibleEdges.forEach(edge -> {
|
||||
Vec3 start = Vec3.atLowerCornerOf(edge.pos);
|
||||
Direction direction = Direction.get(AxisDirection.POSITIVE, edge.axis);
|
||||
renderAACuboidLine(ms, buffer, start, Vec3.atLowerCornerOf(edge.pos.relative(direction)));
|
||||
}
|
||||
});
|
||||
|
||||
for (MergeEntry face : cluster.visibleFaces.keySet()) {
|
||||
AxisDirection axisDirection = cluster.visibleFaces.get(face);
|
||||
Direction direction = Direction.get(axisDirection, face.axis);
|
||||
BlockPos pos = face.pos;
|
||||
if (axisDirection == AxisDirection.POSITIVE)
|
||||
pos = pos.relative(direction.getOpposite());
|
||||
renderBlockFace(ms, buffer, pos, direction);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderBlockFace(PoseStack ms, SuperRenderTypeBuffer buffer, BlockPos pos, Direction face) {
|
||||
Optional<AllSpecialTextures> faceTexture = params.faceTexture;
|
||||
if (!faceTexture.isPresent())
|
||||
return;
|
||||
|
@ -56,12 +46,22 @@ public class BlockClusterOutline extends Outline {
|
|||
.getLocation(), true);
|
||||
VertexConsumer builder = buffer.getLateBuffer(translucentType);
|
||||
|
||||
cluster.visibleFaces.forEach((face, axisDirection) -> {
|
||||
Direction direction = Direction.get(axisDirection, face.axis);
|
||||
BlockPos pos = face.pos;
|
||||
if (axisDirection == AxisDirection.POSITIVE)
|
||||
pos = pos.relative(direction.getOpposite());
|
||||
renderBlockFace(ms, builder, pos, direction);
|
||||
});
|
||||
}
|
||||
|
||||
protected void renderBlockFace(PoseStack ms, VertexConsumer builder, BlockPos pos, Direction face) {
|
||||
Vec3 center = VecHelper.getCenterOf(pos);
|
||||
Vec3 offset = Vec3.atLowerCornerOf(face.getNormal());
|
||||
Vec3 plane = VecHelper.axisAlingedPlaneOf(offset);
|
||||
Axis axis = face.getAxis();
|
||||
|
||||
offset = offset.scale(1 / 2f + 1 / 64d);
|
||||
offset = offset.scale(1 / 2f + 1 / 128d);
|
||||
plane = plane.scale(1 / 2f)
|
||||
.add(offset);
|
||||
|
||||
|
@ -80,8 +80,8 @@ public class BlockClusterOutline extends Outline {
|
|||
|
||||
private static class Cluster {
|
||||
|
||||
Map<MergeEntry, AxisDirection> visibleFaces;
|
||||
Set<MergeEntry> visibleEdges;
|
||||
private Map<MergeEntry, AxisDirection> visibleFaces;
|
||||
private Set<MergeEntry> visibleEdges;
|
||||
|
||||
public Cluster() {
|
||||
visibleEdges = new HashSet<>();
|
||||
|
@ -91,9 +91,9 @@ public class BlockClusterOutline extends Outline {
|
|||
public void include(BlockPos pos) {
|
||||
|
||||
// 6 FACES
|
||||
for (Axis axis : Axis.values()) {
|
||||
for (Axis axis : Iterate.axes) {
|
||||
Direction direction = Direction.get(AxisDirection.POSITIVE, axis);
|
||||
for (int offset : new int[] { 0, 1 }) {
|
||||
for (int offset : Iterate.zeroAndOne) {
|
||||
MergeEntry entry = new MergeEntry(axis, pos.relative(direction, offset));
|
||||
if (visibleFaces.remove(entry) == null)
|
||||
visibleFaces.put(entry, offset == 0 ? AxisDirection.NEGATIVE : AxisDirection.POSITIVE);
|
||||
|
@ -101,11 +101,11 @@ public class BlockClusterOutline extends Outline {
|
|||
}
|
||||
|
||||
// 12 EDGES
|
||||
for (Axis axis : Axis.values()) {
|
||||
for (Axis axis2 : Axis.values()) {
|
||||
for (Axis axis : Iterate.axes) {
|
||||
for (Axis axis2 : Iterate.axes) {
|
||||
if (axis == axis2)
|
||||
continue;
|
||||
for (Axis axis3 : Axis.values()) {
|
||||
for (Axis axis3 : Iterate.axes) {
|
||||
if (axis == axis3)
|
||||
continue;
|
||||
if (axis2 == axis3)
|
||||
|
@ -114,9 +114,9 @@ public class BlockClusterOutline extends Outline {
|
|||
Direction direction = Direction.get(AxisDirection.POSITIVE, axis2);
|
||||
Direction direction2 = Direction.get(AxisDirection.POSITIVE, axis3);
|
||||
|
||||
for (int offset : new int[] { 0, 1 }) {
|
||||
for (int offset : Iterate.zeroAndOne) {
|
||||
BlockPos entryPos = pos.relative(direction, offset);
|
||||
for (int offset2 : new int[] { 0, 1 }) {
|
||||
for (int offset2 : Iterate.zeroAndOne) {
|
||||
entryPos = entryPos.relative(direction2, offset2);
|
||||
MergeEntry entry = new MergeEntry(axis, entryPos);
|
||||
if (!visibleEdges.remove(entry))
|
||||
|
@ -135,8 +135,8 @@ public class BlockClusterOutline extends Outline {
|
|||
|
||||
private static class MergeEntry {
|
||||
|
||||
Axis axis;
|
||||
BlockPos pos;
|
||||
private Axis axis;
|
||||
private BlockPos pos;
|
||||
|
||||
public MergeEntry(Axis axis, BlockPos pos) {
|
||||
this.axis = axis;
|
||||
|
|
|
@ -6,7 +6,6 @@ import javax.annotation.Nullable;
|
|||
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack.Pose;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Matrix3f;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
|
@ -16,6 +15,7 @@ import com.simibubi.create.foundation.utility.AngleHelper;
|
|||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
@ -25,7 +25,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
public abstract class Outline {
|
||||
|
||||
protected OutlineParams params;
|
||||
protected Matrix3f transformNormals;
|
||||
protected Matrix3f transformNormals; // TODO: not used?
|
||||
|
||||
public Outline() {
|
||||
params = new OutlineParams();
|
||||
|
@ -33,6 +33,12 @@ public abstract class Outline {
|
|||
|
||||
public abstract void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt);
|
||||
|
||||
public void tick() {}
|
||||
|
||||
public OutlineParams getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void renderCuboidLine(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 start, Vec3 end) {
|
||||
Vec3 diff = end.subtract(start);
|
||||
float hAngle = AngleHelper.deg(Mth.atan2(diff.x, diff.z));
|
||||
|
@ -125,13 +131,13 @@ public abstract class Outline {
|
|||
}
|
||||
|
||||
protected void putVertex(PoseStack ms, VertexConsumer builder, Vec3 pos, float u, float v, Direction normal) {
|
||||
int i = 15 << 20 | 15 << 4;
|
||||
int j = i >> 16 & '\uffff';
|
||||
int k = i & '\uffff';
|
||||
Pose peek = ms.last();
|
||||
putVertex(ms.last(), builder, (float) pos.x, (float) pos.y, (float) pos.z, u, v, normal);
|
||||
}
|
||||
|
||||
protected void putVertex(PoseStack.Pose pose, VertexConsumer builder, float x, float y, float z, float u, float v, Direction normal) {
|
||||
Color rgb = params.rgb;
|
||||
if (transformNormals == null)
|
||||
transformNormals = peek.normal();
|
||||
transformNormals = pose.normal();
|
||||
|
||||
int xOffset = 0;
|
||||
int yOffset = 0;
|
||||
|
@ -143,23 +149,17 @@ public abstract class Outline {
|
|||
zOffset = normal.getStepZ();
|
||||
}
|
||||
|
||||
builder.vertex(peek.pose(), (float) pos.x, (float) pos.y, (float) pos.z)
|
||||
builder.vertex(pose.pose(), x, y, z)
|
||||
.color(rgb.getRedAsFloat(), rgb.getGreenAsFloat(), rgb.getBlueAsFloat(), rgb.getAlphaAsFloat() * params.alpha)
|
||||
.uv(u, v)
|
||||
.overlayCoords(OverlayTexture.NO_OVERLAY)
|
||||
.uv2(j, k)
|
||||
.normal(peek.normal(), xOffset, yOffset, zOffset)
|
||||
.uv2(params.lightMap)
|
||||
.normal(pose.normal(), xOffset, yOffset, zOffset)
|
||||
.endVertex();
|
||||
|
||||
transformNormals = null;
|
||||
}
|
||||
|
||||
public void tick() {}
|
||||
|
||||
public OutlineParams getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public static class OutlineParams {
|
||||
protected Optional<AllSpecialTextures> faceTexture;
|
||||
protected Optional<AllSpecialTextures> hightlightedFaceTexture;
|
||||
|
@ -168,7 +168,7 @@ public abstract class Outline {
|
|||
protected boolean disableCull;
|
||||
protected boolean disableNormals;
|
||||
protected float alpha;
|
||||
protected int lightMapU, lightMapV;
|
||||
protected int lightMap;
|
||||
protected Color rgb;
|
||||
private float lineWidth;
|
||||
|
||||
|
@ -178,10 +178,7 @@ public abstract class Outline {
|
|||
lineWidth = 1 / 32f;
|
||||
fadeLineWidth = true;
|
||||
rgb = Color.WHITE;
|
||||
|
||||
int i = 15 << 20 | 15 << 4;
|
||||
lightMapU = i >> 16 & '\uffff';
|
||||
lightMapV = i & '\uffff';
|
||||
lightMap = LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
// builder
|
||||
|
@ -196,6 +193,11 @@ public abstract class Outline {
|
|||
return this;
|
||||
}
|
||||
|
||||
public OutlineParams lightMap(int light) {
|
||||
lightMap = light;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OutlineParams lineWidth(float width) {
|
||||
this.lineWidth = width;
|
||||
return this;
|
||||
|
|
|
@ -2,10 +2,9 @@ package com.simibubi.create.foundation.utility.outliner;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
|
||||
|
@ -20,11 +19,8 @@ import net.minecraft.world.phys.Vec3;
|
|||
|
||||
public class Outliner {
|
||||
|
||||
final Map<Object, OutlineEntry> outlines;
|
||||
|
||||
public Map<Object, OutlineEntry> getOutlines() {
|
||||
return Collections.unmodifiableMap(outlines);
|
||||
}
|
||||
private final Map<Object, OutlineEntry> outlines = Collections.synchronizedMap(new HashMap<>());
|
||||
private final Map<Object, OutlineEntry> outlinesView = Collections.unmodifiableMap(outlines);
|
||||
|
||||
// Facade
|
||||
|
||||
|
@ -103,6 +99,10 @@ public class Outliner {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Map<Object, OutlineEntry> getOutlines() {
|
||||
return outlinesView;
|
||||
}
|
||||
|
||||
// Utility
|
||||
|
||||
private void createAABBOutlineIfMissing(Object slot, AABB bb) {
|
||||
|
@ -126,39 +126,30 @@ public class Outliner {
|
|||
|
||||
// Maintenance
|
||||
|
||||
public Outliner() {
|
||||
outlines = Collections.synchronizedMap(new HashMap<>());
|
||||
}
|
||||
|
||||
public void tickOutlines() {
|
||||
Set<Object> toClear = new HashSet<>();
|
||||
|
||||
outlines.forEach((key, entry) -> {
|
||||
entry.ticksTillRemoval--;
|
||||
entry.getOutline()
|
||||
.tick();
|
||||
if (entry.isAlive())
|
||||
return;
|
||||
toClear.add(key);
|
||||
});
|
||||
|
||||
toClear.forEach(outlines::remove);
|
||||
Iterator<OutlineEntry> iterator = outlines.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
OutlineEntry entry = iterator.next();
|
||||
entry.tick();
|
||||
if (!entry.isAlive())
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderOutlines(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) {
|
||||
outlines.forEach((key, entry) -> {
|
||||
Outline outline = entry.getOutline();
|
||||
outline.params.alpha = 1;
|
||||
if (entry.ticksTillRemoval < 0) {
|
||||
|
||||
OutlineParams params = outline.getParams();
|
||||
params.alpha = 1;
|
||||
if (entry.isFading()) {
|
||||
int prevTicks = entry.ticksTillRemoval + 1;
|
||||
float fadeticks = OutlineEntry.fadeTicks;
|
||||
float lastAlpha = prevTicks >= 0 ? 1 : 1 + (prevTicks / fadeticks);
|
||||
float currentAlpha = 1 + (entry.ticksTillRemoval / fadeticks);
|
||||
float alpha = Mth.lerp(pt, lastAlpha, currentAlpha);
|
||||
|
||||
outline.params.alpha = alpha * alpha * alpha;
|
||||
if (outline.params.alpha < 1 / 8f)
|
||||
params.alpha = alpha * alpha * alpha;
|
||||
if (params.alpha < 1 / 8f)
|
||||
return;
|
||||
}
|
||||
outline.render(ms, buffer, pt);
|
||||
|
@ -176,10 +167,19 @@ public class Outliner {
|
|||
ticksTillRemoval = 1;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
ticksTillRemoval--;
|
||||
outline.tick();
|
||||
}
|
||||
|
||||
public boolean isAlive() {
|
||||
return ticksTillRemoval >= -fadeTicks;
|
||||
}
|
||||
|
||||
public boolean isFading() {
|
||||
return ticksTillRemoval < 0;
|
||||
}
|
||||
|
||||
public Outline getOutline() {
|
||||
return outline;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue