mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-30 23:04:57 +01:00
Oh god the line endings
- Isolate AllBlockPartials to PartialModel - Further cleanup to PartialBufferer
This commit is contained in:
parent
446b24f1cf
commit
063e98983f
59 changed files with 234 additions and 199 deletions
|
@ -1,27 +1,20 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour.AttachmentTypes;
|
import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour;
|
||||||
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
|
||||||
|
|
||||||
public class AllBlockPartials {
|
public class AllBlockPartials {
|
||||||
|
|
||||||
private static final List<AllBlockPartials> all = new ArrayList<>();
|
public static final PartialModel SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"),
|
||||||
|
|
||||||
public static final AllBlockPartials SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"),
|
|
||||||
SCHEMATICANNON_PIPE = get("schematicannon/pipe"),
|
SCHEMATICANNON_PIPE = get("schematicannon/pipe"),
|
||||||
|
|
||||||
SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), SHAFT_HALF = get("shaft_half"),
|
SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), SHAFT_HALF = get("shaft_half"),
|
||||||
|
@ -112,69 +105,40 @@ public class AllBlockPartials {
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
public static final Map<AttachmentTypes, Map<Direction, AllBlockPartials>> PIPE_ATTACHMENTS = map();
|
public static final Map<FluidTransportBehaviour.AttachmentTypes, Map<Direction, PartialModel>> PIPE_ATTACHMENTS = new HashMap<>();
|
||||||
public static final Map<HeatLevel, AllBlockPartials> BLAZES = map();
|
public static final Map<BlazeBurnerBlock.HeatLevel, PartialModel> BLAZES = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
populateMaps();
|
populateMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
static void populateMaps() {
|
||||||
|
for (FluidTransportBehaviour.AttachmentTypes type : FluidTransportBehaviour.AttachmentTypes.values()) {
|
||||||
private ResourceLocation modelLocation;
|
|
||||||
private IBakedModel bakedModel;
|
|
||||||
|
|
||||||
private AllBlockPartials() {}
|
|
||||||
|
|
||||||
private static void populateMaps() {
|
|
||||||
for (AttachmentTypes type : AttachmentTypes.values()) {
|
|
||||||
if (!type.hasModel())
|
if (!type.hasModel())
|
||||||
continue;
|
continue;
|
||||||
Map<Direction, AllBlockPartials> map = map();
|
Map<Direction, PartialModel> map = new HashMap<>();
|
||||||
for (Direction d : Iterate.directions) {
|
for (Direction d : Iterate.directions) {
|
||||||
String asId = Lang.asId(type.name());
|
String asId = Lang.asId(type.name());
|
||||||
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getString())));
|
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getString())));
|
||||||
}
|
}
|
||||||
PIPE_ATTACHMENTS.put(type, map);
|
PIPE_ATTACHMENTS.put(type, map);
|
||||||
}
|
}
|
||||||
for (HeatLevel heat : HeatLevel.values()) {
|
for (BlazeBurnerBlock.HeatLevel heat : BlazeBurnerBlock.HeatLevel.values()) {
|
||||||
if (heat == HeatLevel.NONE)
|
if (heat == BlazeBurnerBlock.HeatLevel.NONE)
|
||||||
continue;
|
continue;
|
||||||
BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getString()));
|
BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T, U> Map<T, U> map() {
|
private static PartialModel getEntity(String path) {
|
||||||
return new HashMap<>();
|
return new PartialModel(new ResourceLocation(Create.ID, "entity/" + path));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AllBlockPartials getEntity(String path) {
|
private static PartialModel get(String path) {
|
||||||
AllBlockPartials partials = new AllBlockPartials();
|
return new PartialModel(new ResourceLocation(Create.ID, "block/" + path));
|
||||||
partials.modelLocation = new ResourceLocation(Create.ID, "entity/" + path);
|
|
||||||
all.add(partials);
|
|
||||||
return partials;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AllBlockPartials get(String path) {
|
public static void clientInit() {
|
||||||
AllBlockPartials partials = new AllBlockPartials();
|
// init static fields
|
||||||
partials.modelLocation = new ResourceLocation(Create.ID, "block/" + path);
|
|
||||||
all.add(partials);
|
|
||||||
return partials;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onModelRegistry(ModelRegistryEvent event) {
|
|
||||||
for (AllBlockPartials partial : all)
|
|
||||||
ModelLoader.addSpecialModel(partial.modelLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onModelBake(ModelBakeEvent event) {
|
|
||||||
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
|
||||||
for (AllBlockPartials partial : all)
|
|
||||||
partial.bakedModel = modelRegistry.get(partial.modelLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBakedModel get() {
|
|
||||||
return bakedModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.simibubi.create.foundation.render.KineticRenderer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||||
import com.simibubi.create.foundation.render.backend.Backend;
|
import com.simibubi.create.foundation.render.backend.Backend;
|
||||||
import com.simibubi.create.foundation.render.backend.OptifineHandler;
|
import com.simibubi.create.foundation.render.backend.OptifineHandler;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
||||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||||
import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
|
import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
|
||||||
|
@ -115,6 +116,8 @@ public class CreateClient {
|
||||||
.getResourceManager();
|
.getResourceManager();
|
||||||
if (resourceManager instanceof IReloadableResourceManager)
|
if (resourceManager instanceof IReloadableResourceManager)
|
||||||
((IReloadableResourceManager) resourceManager).addReloadListener(new ResourceReloadHandler());
|
((IReloadableResourceManager) resourceManager).addReloadListener(new ResourceReloadHandler());
|
||||||
|
|
||||||
|
AllBlockPartials.clientInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
public static void onTextureStitch(TextureStitchEvent.Pre event) {
|
||||||
|
@ -128,7 +131,7 @@ public class CreateClient {
|
||||||
|
|
||||||
public static void onModelBake(ModelBakeEvent event) {
|
public static void onModelBake(ModelBakeEvent event) {
|
||||||
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||||
AllBlockPartials.onModelBake(event);
|
PartialModel.onModelBake(event);
|
||||||
|
|
||||||
getCustomBlockModels()
|
getCustomBlockModels()
|
||||||
.foreach((block, modelFunc) -> swapModels(modelRegistry, getAllBlockStateModelLocations(block), modelFunc));
|
.foreach((block, modelFunc) -> swapModels(modelRegistry, getAllBlockStateModelLocations(block), modelFunc));
|
||||||
|
@ -141,7 +144,7 @@ public class CreateClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onModelRegistry(ModelRegistryEvent event) {
|
public static void onModelRegistry(ModelRegistryEvent event) {
|
||||||
AllBlockPartials.onModelRegistry(event);
|
PartialModel.onModelRegistry(event);
|
||||||
|
|
||||||
getCustomRenderedItems().foreach((item, modelFunc) -> modelFunc.apply(null)
|
getCustomRenderedItems().foreach((item, modelFunc) -> modelFunc.apply(null)
|
||||||
.getModelLocations()
|
.getModelLocations()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
||||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import mezz.jei.api.gui.drawable.IDrawable;
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
import net.minecraft.util.math.vector.Vector3f;
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
|
@ -30,7 +31,7 @@ public class AnimatedBlazeBurner implements IDrawable {
|
||||||
.scale(scale)
|
.scale(scale)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
|
|
||||||
AllBlockPartials blaze = AllBlockPartials.BLAZES.get(heatLevel);
|
PartialModel blaze = AllBlockPartials.BLAZES.get(heatLevel);
|
||||||
GuiGameElement.of(blaze)
|
GuiGameElement.of(blaze)
|
||||||
.atLocal(1, 1.65, 1)
|
.atLocal(1, 1.65, 1)
|
||||||
.rotate(0, 180, 0)
|
.rotate(0, 180, 0)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category.animations;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import mezz.jei.api.gui.drawable.IDrawable;
|
import mezz.jei.api.gui.drawable.IDrawable;
|
||||||
|
@ -19,7 +20,7 @@ public abstract class AnimatedKinetics implements IDrawable {
|
||||||
return AllBlocks.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, axis);
|
return AllBlocks.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AllBlockPartials cogwheel() {
|
protected PartialModel cogwheel() {
|
||||||
return AllBlockPartials.SHAFTLESS_COGWHEEL;
|
return AllBlockPartials.SHAFTLESS_COGWHEEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class DrillRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return PartialBufferer.getDirectionalSouth(AllBlockPartials.DRILL_HEAD, te.getBlockState());
|
return PartialBufferer.getFacing(AllBlockPartials.DRILL_HEAD, te.getBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
public static void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
@ -110,7 +111,7 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
|
||||||
return psi;
|
return psi;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AllBlockPartials getMiddleForState(BlockState state, boolean lit) {
|
static PartialModel getMiddleForState(BlockState state, boolean lit) {
|
||||||
if (AllBlocks.PORTABLE_FLUID_INTERFACE.has(state))
|
if (AllBlocks.PORTABLE_FLUID_INTERFACE.has(state))
|
||||||
return lit ? AllBlockPartials.PORTABLE_FLUID_INTERFACE_MIDDLE_POWERED
|
return lit ? AllBlockPartials.PORTABLE_FLUID_INTERFACE_MIDDLE_POWERED
|
||||||
: AllBlockPartials.PORTABLE_FLUID_INTERFACE_MIDDLE;
|
: AllBlockPartials.PORTABLE_FLUID_INTERFACE_MIDDLE;
|
||||||
|
@ -118,7 +119,7 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<Por
|
||||||
: AllBlockPartials.PORTABLE_STORAGE_INTERFACE_MIDDLE;
|
: AllBlockPartials.PORTABLE_STORAGE_INTERFACE_MIDDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AllBlockPartials getTopForState(BlockState state) {
|
static PartialModel getTopForState(BlockState state) {
|
||||||
if (AllBlocks.PORTABLE_FLUID_INTERFACE.has(state))
|
if (AllBlocks.PORTABLE_FLUID_INTERFACE.has(state))
|
||||||
return AllBlockPartials.PORTABLE_FLUID_INTERFACE_TOP;
|
return AllBlockPartials.PORTABLE_FLUID_INTERFACE_TOP;
|
||||||
return AllBlockPartials.PORTABLE_STORAGE_INTERFACE_TOP;
|
return AllBlockPartials.PORTABLE_STORAGE_INTERFACE_TOP;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity.Animation;
|
import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity.Animation;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -79,9 +80,9 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
||||||
// Figure
|
// Figure
|
||||||
if (clock.animationType != Animation.NONE) {
|
if (clock.animationType != Animation.NONE) {
|
||||||
offset = -(angle / 135) * 1 / 2f + 10 / 16f;
|
offset = -(angle / 135) * 1 / 2f + 10 / 16f;
|
||||||
AllBlockPartials allBlockPartials = (clock.animationType == Animation.PIG ? AllBlockPartials.CUCKOO_PIG : AllBlockPartials.CUCKOO_CREEPER);
|
PartialModel partialModel = (clock.animationType == Animation.PIG ? AllBlockPartials.CUCKOO_PIG : AllBlockPartials.CUCKOO_CREEPER);
|
||||||
SuperByteBuffer figure =
|
SuperByteBuffer figure =
|
||||||
PartialBufferer.get(allBlockPartials, blockState);
|
PartialBufferer.get(partialModel, blockState);
|
||||||
figure.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(direction.rotateYCCW())));
|
figure.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(direction.rotateYCCW())));
|
||||||
figure.translate(offset, 0, 0);
|
figure.translate(offset, 0, 0);
|
||||||
figure.light(packedLightmapCoords)
|
figure.light(packedLightmapCoords)
|
||||||
|
@ -95,8 +96,8 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
||||||
return transform(AllBlockPartials.SHAFT_HALF, te);
|
return transform(AllBlockPartials.SHAFT_HALF, te);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SuperByteBuffer transform(AllBlockPartials partial, KineticTileEntity te) {
|
private SuperByteBuffer transform(PartialModel partial, KineticTileEntity te) {
|
||||||
return PartialBufferer.getDirectionalSouth(partial, te.getBlockState(), te.getBlockState()
|
return PartialBufferer.getFacing(partial, te.getBlockState(), te.getBlockState()
|
||||||
.get(CuckooClockBlock.HORIZONTAL_FACING)
|
.get(CuckooClockBlock.HORIZONTAL_FACING)
|
||||||
.getOpposite());
|
.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.content.contraptions.components.crafter.RecipeGridHan
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
@ -194,7 +195,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SuperByteBuffer renderAndTransform(MechanicalCrafterTileEntity te, AllBlockPartials renderBlock,
|
private SuperByteBuffer renderAndTransform(MechanicalCrafterTileEntity te, PartialModel renderBlock,
|
||||||
BlockState crafterState, BlockPos pos) {
|
BlockState crafterState, BlockPos pos) {
|
||||||
SuperByteBuffer buffer = PartialBufferer.get(renderBlock, crafterState);
|
SuperByteBuffer buffer = PartialBufferer.get(renderBlock, crafterState);
|
||||||
float xRot = crafterState.get(MechanicalCrafterBlock.POINTING)
|
float xRot = crafterState.get(MechanicalCrafterBlock.POINTING)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockRenderType;
|
import net.minecraft.block.BlockRenderType;
|
||||||
|
@ -40,7 +41,7 @@ public class HandCrankBlock extends DirectionalKineticBlock implements ITE<HandC
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public AllBlockPartials getRenderedHandle() {
|
public PartialModel getRenderedHandle() {
|
||||||
return AllBlockPartials.HAND_CRANK_HANDLE;
|
return AllBlockPartials.HAND_CRANK_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.content.contraptions.components.crank;
|
package com.simibubi.create.content.contraptions.components.crank;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.core.ModelData;
|
import com.simibubi.create.foundation.render.backend.core.ModelData;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
||||||
|
@ -25,7 +25,7 @@ public class HandCrankInstance extends SingleRotatingInstance implements IDynami
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
|
|
||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
AllBlockPartials renderedHandle = null;
|
PartialModel renderedHandle = null;
|
||||||
if (block instanceof HandCrankBlock)
|
if (block instanceof HandCrankBlock)
|
||||||
renderedHandle = ((HandCrankBlock) block).getRenderedHandle();
|
renderedHandle = ((HandCrankBlock) block).getRenderedHandle();
|
||||||
if (renderedHandle == null)
|
if (renderedHandle == null)
|
||||||
|
|
|
@ -3,12 +3,12 @@ package com.simibubi.create.content.contraptions.components.crank;
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -32,14 +32,14 @@ public class HandCrankRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
AllBlockPartials renderedHandle = null;
|
PartialModel renderedHandle = null;
|
||||||
if (block instanceof HandCrankBlock)
|
if (block instanceof HandCrankBlock)
|
||||||
renderedHandle = ((HandCrankBlock) block).getRenderedHandle();
|
renderedHandle = ((HandCrankBlock) block).getRenderedHandle();
|
||||||
if (renderedHandle == null)
|
if (renderedHandle == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Direction facing = state.get(FACING);
|
Direction facing = state.get(FACING);
|
||||||
SuperByteBuffer handle = PartialBufferer.getDirectionalSouth(renderedHandle, state, facing.getOpposite());
|
SuperByteBuffer handle = PartialBufferer.getFacing(renderedHandle, state, facing.getOpposite());
|
||||||
HandCrankTileEntity crank = (HandCrankTileEntity) te;
|
HandCrankTileEntity crank = (HandCrankTileEntity) te;
|
||||||
kineticRotationTransform(handle, te, facing.getAxis(),
|
kineticRotationTransform(handle, te, facing.getAxis(),
|
||||||
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360, light);
|
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360, light);
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.crank;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.DyeHelper;
|
import com.simibubi.create.foundation.utility.DyeHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -68,7 +68,7 @@ public class ValveHandleBlock extends HandCrankBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public AllBlockPartials getRenderedHandle() {
|
public PartialModel getRenderedHandle() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram;
|
||||||
import com.simibubi.create.foundation.render.backend.core.ModelData;
|
import com.simibubi.create.foundation.render.backend.core.ModelData;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial;
|
import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -48,7 +49,7 @@ public class DeployerActorInstance extends ActorInstance {
|
||||||
|
|
||||||
BlockState state = context.state;
|
BlockState state = context.state;
|
||||||
DeployerTileEntity.Mode mode = NBTHelper.readEnum(context.tileData, "Mode", DeployerTileEntity.Mode.class);
|
DeployerTileEntity.Mode mode = NBTHelper.readEnum(context.tileData, "Mode", DeployerTileEntity.Mode.class);
|
||||||
AllBlockPartials handPose = DeployerRenderer.getHandPose(mode);
|
PartialModel handPose = DeployerRenderer.getHandPose(mode);
|
||||||
|
|
||||||
stationaryTimer = context.data.contains("StationaryTimer");
|
stationaryTimer = context.data.contains("StationaryTimer");
|
||||||
facing = state.get(FACING);
|
facing = state.get(FACING);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
|
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.core.OrientedData;
|
import com.simibubi.create.foundation.render.backend.core.OrientedData;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.ITickableInstance;
|
import com.simibubi.create.foundation.render.backend.instancing.ITickableInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
||||||
|
@ -31,7 +32,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
||||||
|
|
||||||
protected OrientedData hand;
|
protected OrientedData hand;
|
||||||
|
|
||||||
AllBlockPartials currentHand;
|
PartialModel currentHand;
|
||||||
float progress;
|
float progress;
|
||||||
private boolean newHand = false;
|
private boolean newHand = false;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean updateHandPose() {
|
private boolean updateHandPose() {
|
||||||
AllBlockPartials handPose = tile.getHandPose();
|
PartialModel handPose = tile.getHandPose();
|
||||||
|
|
||||||
if (currentHand == handPose) return false;
|
if (currentHand == handPose) return false;
|
||||||
currentHand = handPose;
|
currentHand = handPose;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -161,7 +162,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||||
BlockPos pos = BlockPos.ZERO;
|
BlockPos pos = BlockPos.ZERO;
|
||||||
Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class);
|
Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class);
|
||||||
World world = context.world;
|
World world = context.world;
|
||||||
AllBlockPartials handPose = getHandPose(mode);
|
PartialModel handPose = getHandPose(mode);
|
||||||
|
|
||||||
SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState);
|
SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState);
|
||||||
SuperByteBuffer hand = PartialBufferer.get(handPose, blockState);
|
SuperByteBuffer hand = PartialBufferer.get(handPose, blockState);
|
||||||
|
@ -192,7 +193,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||||
.renderInto(ms, builder);
|
.renderInto(ms, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AllBlockPartials getHandPose(DeployerTileEntity.Mode mode) {
|
static PartialModel getHandPose(DeployerTileEntity.Mode mode) {
|
||||||
return mode == DeployerTileEntity.Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING : AllBlockPartials.DEPLOYER_HAND_POINTING;
|
return mode == DeployerTileEntity.Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING : AllBlockPartials.DEPLOYER_HAND_POINTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
|
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
|
@ -342,7 +343,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
||||||
sendData();
|
sendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllBlockPartials getHandPose() {
|
public PartialModel getHandPose() {
|
||||||
return mode == Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING
|
return mode == Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING
|
||||||
: heldItem.isEmpty() ? AllBlockPartials.DEPLOYER_HAND_POINTING : AllBlockPartials.DEPLOYER_HAND_HOLDING;
|
: heldItem.isEmpty() ? AllBlockPartials.DEPLOYER_HAND_POINTING : AllBlockPartials.DEPLOYER_HAND_HOLDING;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +396,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
float progress = 0;
|
float progress = 0;
|
||||||
int timerSpeed = getTimerSpeed();
|
int timerSpeed = getTimerSpeed();
|
||||||
AllBlockPartials handPose = getHandPose();
|
PartialModel handPose = getHandPose();
|
||||||
|
|
||||||
if (state == State.EXPANDING)
|
if (state == State.EXPANDING)
|
||||||
progress = 1 - (timer - partialTicks * timerSpeed) / 1000f;
|
progress = 1 - (timer - partialTicks * timerSpeed) / 1000f;
|
||||||
|
|
|
@ -38,9 +38,9 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer {
|
||||||
int lightInFront = WorldRenderer.getLightmapCoordinates(te.getWorld(), te.getPos().offset(direction));
|
int lightInFront = WorldRenderer.getLightmapCoordinates(te.getWorld(), te.getPos().offset(direction));
|
||||||
|
|
||||||
SuperByteBuffer shaftHalf =
|
SuperByteBuffer shaftHalf =
|
||||||
PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction.getOpposite());
|
PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction.getOpposite());
|
||||||
SuperByteBuffer fanInner =
|
SuperByteBuffer fanInner =
|
||||||
PartialBufferer.getDirectionalSouth(AllBlockPartials.ENCASED_FAN_INNER, te.getBlockState(), direction.getOpposite());
|
PartialBufferer.getFacing(AllBlockPartials.ENCASED_FAN_INNER, te.getBlockState(), direction.getOpposite());
|
||||||
|
|
||||||
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
float speed = te.getSpeed() * 5;
|
float speed = te.getSpeed() * 5;
|
||||||
|
|
|
@ -72,7 +72,13 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
||||||
.renderInto(ms, vb);
|
.renderInto(ms, vb);
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperByteBuffer wheel = PartialBufferer.getHorizontal(AllBlockPartials.FLYWHEEL, blockState.rotate(Rotation.CLOCKWISE_90));
|
renderFlywheel(te, ms, light, blockState, angle, vb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderFlywheel(KineticTileEntity te, MatrixStack ms, int light, BlockState blockState, float angle, IVertexBuilder vb) {
|
||||||
|
BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90);
|
||||||
|
Direction facing = referenceState.get(BlockStateProperties.HORIZONTAL_FACING);
|
||||||
|
SuperByteBuffer wheel = PartialBufferer.getFacing(AllBlockPartials.FLYWHEEL, referenceState, facing);
|
||||||
kineticRotationTransform(wheel, te, blockState.get(HORIZONTAL_FACING)
|
kineticRotationTransform(wheel, te, blockState.get(HORIZONTAL_FACING)
|
||||||
.getAxis(), AngleHelper.rad(angle), light);
|
.getAxis(), AngleHelper.rad(angle), light);
|
||||||
wheel.renderInto(ms, vb);
|
wheel.renderInto(ms, vb);
|
||||||
|
@ -80,7 +86,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
||||||
.get(BlockStateProperties.HORIZONTAL_FACING)
|
.get(BlockStateProperties.HORIZONTAL_FACING)
|
||||||
.getOpposite());
|
.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -95,7 +95,7 @@ public abstract class EngineBlock extends HorizontalBlock implements IWrenchable
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public abstract AllBlockPartials getFrameModel();
|
public abstract PartialModel getFrameModel();
|
||||||
|
|
||||||
protected abstract boolean isValidBaseBlock(BlockState baseBlock, IBlockReader world, BlockPos pos);
|
protected abstract boolean isValidBaseBlock(BlockState baseBlock, IBlockReader world, BlockPos pos);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.foundation.render.backend.core.ModelData;
|
import com.simibubi.create.foundation.render.backend.core.ModelData;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance;
|
import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -25,7 +25,7 @@ public class EngineInstance extends TileEntityInstance<EngineTileEntity> {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EngineBlock engineBlock = (EngineBlock) block;
|
EngineBlock engineBlock = (EngineBlock) block;
|
||||||
AllBlockPartials frame = engineBlock.getFrameModel();
|
PartialModel frame = engineBlock.getFrameModel();
|
||||||
|
|
||||||
Direction facing = blockState.get(BlockStateProperties.HORIZONTAL_FACING);
|
Direction facing = blockState.get(BlockStateProperties.HORIZONTAL_FACING);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRe
|
||||||
.getBlock();
|
.getBlock();
|
||||||
if (block instanceof EngineBlock) {
|
if (block instanceof EngineBlock) {
|
||||||
EngineBlock engineBlock = (EngineBlock) block;
|
EngineBlock engineBlock = (EngineBlock) block;
|
||||||
AllBlockPartials frame = engineBlock.getFrameModel();
|
PartialModel frame = engineBlock.getFrameModel();
|
||||||
if (frame != null) {
|
if (frame != null) {
|
||||||
Direction facing = te.getBlockState()
|
Direction facing = te.getBlockState()
|
||||||
.get(EngineBlock.HORIZONTAL_FACING);
|
.get(EngineBlock.HORIZONTAL_FACING);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllShapes;
|
import com.simibubi.create.AllShapes;
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||||
|
|
||||||
import net.minecraft.block.AbstractFurnaceBlock;
|
import net.minecraft.block.AbstractFurnaceBlock;
|
||||||
|
@ -41,7 +42,7 @@ public class FurnaceEngineBlock extends EngineBlock implements ITE<FurnaceEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllBlockPartials getFrameModel() {
|
public PartialModel getFrameModel() {
|
||||||
return AllBlockPartials.FURNACE_GENERATOR_FRAME;
|
return AllBlockPartials.FURNACE_GENERATOR_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class CreativeMotorRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, te.getBlockState());
|
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.contraptions.components.press;
|
package com.simibubi.create.content.contraptions.components.press;
|
||||||
|
|
||||||
|
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -38,7 +40,7 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer {
|
||||||
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, pos);
|
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, pos);
|
||||||
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
|
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
|
||||||
|
|
||||||
SuperByteBuffer headRender = PartialBufferer.getHorizontal(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState);
|
SuperByteBuffer headRender = PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.get(HORIZONTAL_FACING));
|
||||||
headRender.translate(0, -renderedHeadOffset, 0)
|
headRender.translate(0, -renderedHeadOffset, 0)
|
||||||
.light(packedLightmapCoords)
|
.light(packedLightmapCoords)
|
||||||
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -54,7 +55,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
||||||
protected void renderBlade(SawTileEntity te, MatrixStack ms, IRenderTypeBuffer buffer, int light) {
|
protected void renderBlade(SawTileEntity te, MatrixStack ms, IRenderTypeBuffer buffer, int light) {
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
SuperByteBuffer superBuffer;
|
SuperByteBuffer superBuffer;
|
||||||
AllBlockPartials partial;
|
PartialModel partial;
|
||||||
float speed = te.getSpeed();
|
float speed = te.getSpeed();
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
|
@ -82,7 +83,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
||||||
.rotateY(90)
|
.rotateY(90)
|
||||||
.unCentre();
|
.unCentre();
|
||||||
}
|
}
|
||||||
superBuffer = PartialBufferer.getDirectionalSouth(partial, blockState);
|
superBuffer = PartialBufferer.getFacing(partial, blockState);
|
||||||
superBuffer.light(light)
|
superBuffer.light(light)
|
||||||
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
|
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
|
||||||
|
|
||||||
|
@ -141,7 +142,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
if (state.get(FACING).getAxis().isHorizontal())
|
if (state.get(FACING).getAxis().isHorizontal())
|
||||||
return PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, state.rotate(te.getWorld(), te.getPos(), Rotation.CLOCKWISE_180));
|
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, state.rotate(te.getWorld(), te.getPos(), Rotation.CLOCKWISE_180));
|
||||||
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
return CreateClient.bufferCache.renderBlockIn(KineticTileEntityRenderer.KINETIC_TILE,
|
||||||
getRenderedBlockState(te));
|
getRenderedBlockState(te));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.BackHalfShaftInstance;
|
import com.simibubi.create.content.contraptions.base.BackHalfShaftInstance;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.foundation.render.backend.core.OrientedData;
|
import com.simibubi.create.foundation.render.backend.core.OrientedData;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -31,7 +32,7 @@ public class BearingInstance<B extends KineticTileEntity & IBearingTileEntity> e
|
||||||
|
|
||||||
blockOrientation = getBlockStateOrientation(facing);
|
blockOrientation = getBlockStateOrientation(facing);
|
||||||
|
|
||||||
AllBlockPartials top =
|
PartialModel top =
|
||||||
bearing.isWoodenTop() ? AllBlockPartials.BEARING_TOP_WOODEN : AllBlockPartials.BEARING_TOP;
|
bearing.isWoodenTop() ? AllBlockPartials.BEARING_TOP_WOODEN : AllBlockPartials.BEARING_TOP;
|
||||||
|
|
||||||
topInstance = getOrientedMaterial().getModel(top, blockState).createInstance();
|
topInstance = getOrientedMaterial().getModel(top, blockState).createInstance();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
@ -32,7 +33,7 @@ public class BearingRenderer extends KineticTileEntityRenderer {
|
||||||
IBearingTileEntity bearingTe = (IBearingTileEntity) te;
|
IBearingTileEntity bearingTe = (IBearingTileEntity) te;
|
||||||
final Direction facing = te.getBlockState()
|
final Direction facing = te.getBlockState()
|
||||||
.get(BlockStateProperties.FACING);
|
.get(BlockStateProperties.FACING);
|
||||||
AllBlockPartials top =
|
PartialModel top =
|
||||||
bearingTe.isWoodenTop() ? AllBlockPartials.BEARING_TOP_WOODEN : AllBlockPartials.BEARING_TOP;
|
bearingTe.isWoodenTop() ? AllBlockPartials.BEARING_TOP_WOODEN : AllBlockPartials.BEARING_TOP;
|
||||||
SuperByteBuffer superBuffer = PartialBufferer.get(top, te.getBlockState());
|
SuperByteBuffer superBuffer = PartialBufferer.get(top, te.getBlockState());
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ public class BearingRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
return PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), te.getBlockState()
|
||||||
.get(BearingBlock.FACING)
|
.get(BearingBlock.FACING)
|
||||||
.getOpposite());
|
.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
@ -35,7 +36,7 @@ public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
||||||
if (FastRenderDispatcher.available()) return;
|
if (FastRenderDispatcher.available()) return;
|
||||||
|
|
||||||
Direction facing = context.state.get(BlockStateProperties.FACING);
|
Direction facing = context.state.get(BlockStateProperties.FACING);
|
||||||
AllBlockPartials top = AllBlockPartials.BEARING_TOP;
|
PartialModel top = AllBlockPartials.BEARING_TOP;
|
||||||
SuperByteBuffer superBuffer = PartialBufferer.get(top, context.state);
|
SuperByteBuffer superBuffer = PartialBufferer.get(top, context.state);
|
||||||
float renderPartialTicks = AnimationTickHolder.getPartialTicks();
|
float renderPartialTicks = AnimationTickHolder.getPartialTicks();
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pu
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -25,11 +25,11 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
private AllBlockPartials halfRope;
|
private PartialModel halfRope;
|
||||||
private AllBlockPartials halfMagnet;
|
private PartialModel halfMagnet;
|
||||||
|
|
||||||
public AbstractPulleyRenderer(TileEntityRendererDispatcher dispatcher, AllBlockPartials halfRope,
|
public AbstractPulleyRenderer(TileEntityRendererDispatcher dispatcher, PartialModel halfRope,
|
||||||
AllBlockPartials halfMagnet) {
|
PartialModel halfMagnet) {
|
||||||
super(dispatcher);
|
super(dispatcher);
|
||||||
this.halfRope = halfRope;
|
this.halfRope = halfRope;
|
||||||
this.halfMagnet = halfMagnet;
|
this.halfMagnet = halfMagnet;
|
||||||
|
@ -90,7 +90,7 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
protected abstract Axis getShaftAxis(KineticTileEntity te);
|
protected abstract Axis getShaftAxis(KineticTileEntity te);
|
||||||
|
|
||||||
protected abstract AllBlockPartials getCoil();
|
protected abstract PartialModel getCoil();
|
||||||
|
|
||||||
protected abstract SuperByteBuffer renderRope(KineticTileEntity te);
|
protected abstract SuperByteBuffer renderRope(KineticTileEntity te);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
protected SuperByteBuffer getRotatedCoil(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedCoil(KineticTileEntity te) {
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
return PartialBufferer.getDirectionalSouth(getCoil(), blockState, Direction.getFacingFromAxis(AxisDirection.POSITIVE, getShaftAxis(te)));
|
return PartialBufferer.getFacing(getCoil(), blockState, Direction.getFacingFromAxis(AxisDirection.POSITIVE, getShaftAxis(te)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -24,7 +25,7 @@ public class PulleyRenderer extends AbstractPulleyRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AllBlockPartials getCoil() {
|
protected PartialModel getCoil() {
|
||||||
return AllBlockPartials.ROPE_COIL;
|
return AllBlockPartials.ROPE_COIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class PumpRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||||
return PartialBufferer.getDirectionalSouth(AllBlockPartials.MECHANICAL_PUMP_COG, te.getBlockState());
|
return PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PUMP_COG, te.getBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.AbstractPulleyRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.AbstractPulleyRenderer;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -24,7 +25,7 @@ public class HosePulleyRenderer extends AbstractPulleyRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AllBlockPartials getCoil() {
|
protected PartialModel getCoil() {
|
||||||
return AllBlockPartials.HOSE_COIL;
|
return AllBlockPartials.HOSE_COIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour;
|
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.behaviour.fluid.SmartFluidTankBehaviour.TankSegment;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
|
@ -21,7 +22,7 @@ public class SpoutRenderer extends SafeTileEntityRenderer<SpoutTileEntity> {
|
||||||
super(dispatcher);
|
super(dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final AllBlockPartials[] BITS =
|
static final PartialModel[] BITS =
|
||||||
{ AllBlockPartials.SPOUT_TOP, AllBlockPartials.SPOUT_MIDDLE, AllBlockPartials.SPOUT_BOTTOM };
|
{ AllBlockPartials.SPOUT_TOP, AllBlockPartials.SPOUT_MIDDLE, AllBlockPartials.SPOUT_BOTTOM };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,7 +71,7 @@ public class SpoutRenderer extends SafeTileEntityRenderer<SpoutTileEntity> {
|
||||||
squeeze = -1;
|
squeeze = -1;
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
for (AllBlockPartials bit : BITS) {
|
for (PartialModel bit : BITS) {
|
||||||
PartialBufferer.get(bit, te.getBlockState())
|
PartialBufferer.get(bit, te.getBlockState())
|
||||||
.light(light)
|
.light(light)
|
||||||
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
@ -31,7 +32,7 @@ public class BlazeBurnerRenderer extends SafeTileEntityRenderer<BlazeBurnerTileE
|
||||||
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld()) + (te.hashCode() % 13) * 16f;
|
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld()) + (te.hashCode() % 13) * 16f;
|
||||||
float offset = (MathHelper.sin((float) ((renderTick / 16f) % (2 * Math.PI))) + .5f) / 16f;
|
float offset = (MathHelper.sin((float) ((renderTick / 16f) % (2 * Math.PI))) + .5f) / 16f;
|
||||||
|
|
||||||
AllBlockPartials blazeModel = AllBlockPartials.BLAZES.get(heatLevel);
|
PartialModel blazeModel = AllBlockPartials.BLAZES.get(heatLevel);
|
||||||
SuperByteBuffer blazeBuffer = PartialBufferer.get(blazeModel, te.getBlockState());
|
SuperByteBuffer blazeBuffer = PartialBufferer.get(blazeModel, te.getBlockState());
|
||||||
blazeBuffer.rotateCentered(Direction.UP, AngleHelper.rad(te.headAngle.getValue(partialTicks)));
|
blazeBuffer.rotateCentered(Direction.UP, AngleHelper.rad(te.headAngle.getValue(partialTicks)));
|
||||||
blazeBuffer.translate(0, offset, 0);
|
blazeBuffer.translate(0, offset, 0);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstanceData;
|
import com.simibubi.create.foundation.render.backend.instancing.InstanceData;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer;
|
||||||
|
@ -57,7 +58,7 @@ public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
|
||||||
DyeColor color = tile.color.orElse(null);
|
DyeColor color = tile.color.orElse(null);
|
||||||
|
|
||||||
for (boolean bottom : Iterate.trueAndFalse) {
|
for (boolean bottom : Iterate.trueAndFalse) {
|
||||||
AllBlockPartials beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom);
|
PartialModel beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom);
|
||||||
SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
|
SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
|
||||||
|
|
||||||
InstancedModel<BeltData> beltModel = modelManager.getMaterial(KineticRenderMaterials.BELTS).getModel(beltPartial, blockState);
|
InstancedModel<BeltData> beltModel = modelManager.getMaterial(KineticRenderMaterials.BELTS).getModel(beltPartial, blockState);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.ShadowRenderHelper;
|
import com.simibubi.create.foundation.render.ShadowRenderHelper;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
@ -95,7 +96,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
|
|
||||||
for (boolean bottom : Iterate.trueAndFalse) {
|
for (boolean bottom : Iterate.trueAndFalse) {
|
||||||
|
|
||||||
AllBlockPartials beltPartial = getBeltPartial(diagonal, start, end, bottom);
|
PartialModel beltPartial = getBeltPartial(diagonal, start, end, bottom);
|
||||||
|
|
||||||
SuperByteBuffer beltBuffer = PartialBufferer.get(beltPartial, blockState)
|
SuperByteBuffer beltBuffer = PartialBufferer.get(beltPartial, blockState)
|
||||||
.light(light);
|
.light(light);
|
||||||
|
@ -159,7 +160,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
: bottom ? AllSpriteShifts.BELT_OFFSET : AllSpriteShifts.BELT;
|
: bottom ? AllSpriteShifts.BELT_OFFSET : AllSpriteShifts.BELT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AllBlockPartials getBeltPartial(boolean diagonal, boolean start, boolean end, boolean bottom) {
|
public static PartialModel getBeltPartial(boolean diagonal, boolean start, boolean end, boolean bottom) {
|
||||||
if (diagonal) {
|
if (diagonal) {
|
||||||
if (start) return AllBlockPartials.BELT_DIAGONAL_START;
|
if (start) return AllBlockPartials.BELT_DIAGONAL_START;
|
||||||
if (end) return AllBlockPartials.BELT_DIAGONAL_END;
|
if (end) return AllBlockPartials.BELT_DIAGONAL_END;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
|
||||||
angle = angle / 180f * (float) Math.PI;
|
angle = angle / 180f * (float) Math.PI;
|
||||||
|
|
||||||
SuperByteBuffer superByteBuffer =
|
SuperByteBuffer superByteBuffer =
|
||||||
PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
||||||
kineticRotationTransform(superByteBuffer, te, axis, angle, light);
|
kineticRotationTransform(superByteBuffer, te, axis, angle, light);
|
||||||
superByteBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
superByteBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.relays.gauge.GaugeBlock.Type;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -46,9 +47,9 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
|
||||||
GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
|
GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
|
||||||
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), gaugeState, te.getPos());
|
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), gaugeState, te.getPos());
|
||||||
|
|
||||||
AllBlockPartials allBlockPartials = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS);
|
PartialModel partialModel = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS);
|
||||||
SuperByteBuffer headBuffer =
|
SuperByteBuffer headBuffer =
|
||||||
PartialBufferer.get(allBlockPartials, gaugeState);
|
PartialBufferer.get(partialModel, gaugeState);
|
||||||
SuperByteBuffer dialBuffer = PartialBufferer.get(AllBlockPartials.GAUGE_DIAL, gaugeState);
|
SuperByteBuffer dialBuffer = PartialBufferer.get(AllBlockPartials.GAUGE_DIAL, gaugeState);
|
||||||
|
|
||||||
float dialPivot = 5.75f / 16;
|
float dialPivot = 5.75f / 16;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
|
||||||
if (boxAxis == axis)
|
if (boxAxis == axis)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SuperByteBuffer shaft = PartialBufferer.getDirectionalSouth(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
SuperByteBuffer shaft = PartialBufferer.getFacing(AllBlockPartials.SHAFT_HALF, te.getBlockState(), direction);
|
||||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||||
float angle = (time * te.getSpeed() * 3f / 10) % 360;
|
float angle = (time * te.getSpeed() * 3f / 10) % 360;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllBlockPartials getModel() {
|
public PartialModel getModel() {
|
||||||
return AllBlockPartials.SYMMETRY_CROSSPLANE;
|
return AllBlockPartials.SYMMETRY_CROSSPLANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
@ -50,7 +50,7 @@ public class EmptyMirror extends SymmetryMirror {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllBlockPartials getModel() {
|
public PartialModel getModel() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
|
@ -82,7 +83,7 @@ public class PlaneMirror extends SymmetryMirror {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllBlockPartials getModel() {
|
public PartialModel getModel() {
|
||||||
return AllBlockPartials.SYMMETRY_PLANE;
|
return AllBlockPartials.SYMMETRY_PLANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -80,7 +80,7 @@ public abstract class SymmetryMirror {
|
||||||
|
|
||||||
public abstract String typeName();
|
public abstract String typeName();
|
||||||
|
|
||||||
public abstract AllBlockPartials getModel();
|
public abstract PartialModel getModel();
|
||||||
|
|
||||||
public void applyModelTransform(MatrixStack ms) {}
|
public void applyModelTransform(MatrixStack ms) {}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -43,7 +44,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllBlockPartials getModel() {
|
public PartialModel getModel() {
|
||||||
return AllBlockPartials.SYMMETRY_TRIPLEPLANE;
|
return AllBlockPartials.SYMMETRY_TRIPLEPLANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.curiosities.tools;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ public class ExtendoGripRenderHandler {
|
||||||
|
|
||||||
public static float mainHandAnimation;
|
public static float mainHandAnimation;
|
||||||
public static float lastMainHandAnimation;
|
public static float lastMainHandAnimation;
|
||||||
public static AllBlockPartials pose = AllBlockPartials.DEPLOYER_HAND_PUNCHING;
|
public static PartialModel pose = AllBlockPartials.DEPLOYER_HAND_PUNCHING;
|
||||||
|
|
||||||
public static void tick() {
|
public static void tick() {
|
||||||
lastMainHandAnimation = mainHandAnimation;
|
lastMainHandAnimation = mainHandAnimation;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
||||||
import com.simibubi.create.content.logistics.block.FlapData;
|
import com.simibubi.create.content.logistics.block.FlapData;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstanceData;
|
import com.simibubi.create.foundation.render.backend.instancing.InstanceData;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedModel;
|
||||||
|
@ -26,7 +27,7 @@ public class FunnelInstance extends TileEntityInstance<FunnelTileEntity> impleme
|
||||||
|
|
||||||
if (!tile.hasFlap()) return;
|
if (!tile.hasFlap()) return;
|
||||||
|
|
||||||
AllBlockPartials flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
||||||
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
||||||
InstancedModel<FlapData> model = modelManager.getMaterial(KineticRenderMaterials.FLAPS)
|
InstancedModel<FlapData> model = modelManager.getMaterial(KineticRenderMaterials.FLAPS)
|
||||||
.getModel(flapPartial, blockState);
|
.getModel(flapPartial, blockState);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
@ -34,9 +35,9 @@ public class FunnelRenderer extends SmartTileEntityRenderer<FunnelTileEntity> {
|
||||||
|
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
AllBlockPartials allBlockPartials = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
PartialModel partialModel = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
||||||
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
||||||
SuperByteBuffer flapBuffer = PartialBufferer.get(allBlockPartials, blockState);
|
SuperByteBuffer flapBuffer = PartialBufferer.get(partialModel, blockState);
|
||||||
Vector3d pivot = VecHelper.voxelSpace(0, 10, 9.5f);
|
Vector3d pivot = VecHelper.voxelSpace(0, 10, 9.5f);
|
||||||
MatrixStacker msr = MatrixStacker.of(ms);
|
MatrixStacker msr = MatrixStacker.of(ms);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
|
||||||
import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
|
import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
import com.simibubi.create.foundation.item.SmartInventory;
|
import com.simibubi.create.foundation.item.SmartInventory;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||||
|
@ -100,7 +101,7 @@ public abstract class ArmInteractionPoint {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void transformFlag(MatrixStack stack) {}
|
void transformFlag(MatrixStack stack) {}
|
||||||
|
|
||||||
AllBlockPartials getFlagType() {
|
PartialModel getFlagType() {
|
||||||
return mode == Mode.TAKE ? AllBlockPartials.FLAG_LONG_OUT : AllBlockPartials.FLAG_LONG_IN;
|
return mode == Mode.TAKE ? AllBlockPartials.FLAG_LONG_OUT : AllBlockPartials.FLAG_LONG_IN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import com.simibubi.create.foundation.utility.VirtualEmptyModelData;
|
import com.simibubi.create.foundation.utility.VirtualEmptyModelData;
|
||||||
|
@ -53,7 +53,7 @@ public class GuiGameElement {
|
||||||
return new GuiBlockStateRenderBuilder(state);
|
return new GuiBlockStateRenderBuilder(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GuiRenderBuilder of(AllBlockPartials partial) {
|
public static GuiRenderBuilder of(PartialModel partial) {
|
||||||
return new GuiBlockPartialRenderBuilder(partial);
|
return new GuiBlockPartialRenderBuilder(partial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ public class GuiGameElement {
|
||||||
|
|
||||||
public static class GuiBlockPartialRenderBuilder extends GuiBlockModelRenderBuilder {
|
public static class GuiBlockPartialRenderBuilder extends GuiBlockModelRenderBuilder {
|
||||||
|
|
||||||
public GuiBlockPartialRenderBuilder(AllBlockPartials partial) {
|
public GuiBlockPartialRenderBuilder(PartialModel partial) {
|
||||||
super(partial.get(), null);
|
super(partial.get(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@ package com.simibubi.create.foundation.render;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
|
||||||
public class Compartment<T> {
|
public class Compartment<T> {
|
||||||
public static final Compartment<BlockState> GENERIC_TILE = new Compartment<>();
|
public static final Compartment<BlockState> GENERIC_TILE = new Compartment<>();
|
||||||
public static final Compartment<AllBlockPartials> PARTIAL = new Compartment<>();
|
public static final Compartment<PartialModel> PARTIAL = new Compartment<>();
|
||||||
public static final Compartment<Pair<Direction, AllBlockPartials>> DIRECTIONAL_PARTIAL = new Compartment<>();
|
public static final Compartment<Pair<Direction, PartialModel>> DIRECTIONAL_PARTIAL = new Compartment<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.simibubi.create.foundation.render;
|
package com.simibubi.create.foundation.render;
|
||||||
|
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
|
@ -16,43 +15,19 @@ import net.minecraft.util.Direction;
|
||||||
|
|
||||||
public class PartialBufferer {
|
public class PartialBufferer {
|
||||||
|
|
||||||
public static SuperByteBuffer get(AllBlockPartials partial, BlockState referenceState) {
|
public static SuperByteBuffer get(PartialModel partial, BlockState referenceState) {
|
||||||
return CreateClient.bufferCache.renderPartial(partial, referenceState);
|
return CreateClient.bufferCache.renderPartial(partial, referenceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SuperByteBuffer getDirectionalSouth(AllBlockPartials partial, BlockState referenceState) {
|
public static SuperByteBuffer getFacing(PartialModel partial, BlockState referenceState) {
|
||||||
Direction facing = referenceState.get(FACING);
|
Direction facing = referenceState.get(FACING);
|
||||||
return getDirectionalSouth(partial, referenceState, facing);
|
return getFacing(partial, referenceState, facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SuperByteBuffer getDirectional(AllBlockPartials partial, BlockState referenceState) {
|
public static SuperByteBuffer getFacing(PartialModel partial, BlockState referenceState, Direction facing) {
|
||||||
Direction facing = referenceState.get(FACING);
|
|
||||||
return getDirectional(partial, referenceState, facing);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SuperByteBuffer getHorizontal(AllBlockPartials partial, BlockState referenceState) {
|
|
||||||
Direction facing = referenceState.get(HORIZONTAL_FACING);
|
|
||||||
return getDirectionalSouth(partial, referenceState, facing);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SuperByteBuffer getDirectionalSouth(AllBlockPartials partial, BlockState referenceState, Direction facing) {
|
|
||||||
return CreateClient.bufferCache.renderDirectionalPartial(partial, referenceState, facing, rotateToFace(facing));
|
return CreateClient.bufferCache.renderDirectionalPartial(partial, referenceState, facing, rotateToFace(facing));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SuperByteBuffer getDirectional(AllBlockPartials partial, BlockState referenceState, Direction facing) {
|
|
||||||
Supplier<MatrixStack> ms = () -> {
|
|
||||||
MatrixStack stack = new MatrixStack();
|
|
||||||
MatrixStacker.of(stack)
|
|
||||||
.centre()
|
|
||||||
.rotateY(AngleHelper.horizontalAngle(facing))
|
|
||||||
.rotateX(facing == Direction.UP ? 0 : facing == Direction.DOWN ? 180 : 90)
|
|
||||||
.unCentre();
|
|
||||||
|
|
||||||
return stack;
|
|
||||||
};
|
|
||||||
return CreateClient.bufferCache.renderDirectionalPartial(partial, referenceState, facing, ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Supplier<MatrixStack> rotateToFace(Direction facing) {
|
public static Supplier<MatrixStack> rotateToFace(Direction facing) {
|
||||||
return () -> {
|
return () -> {
|
||||||
MatrixStack stack = new MatrixStack();
|
MatrixStack stack = new MatrixStack();
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.lwjgl.opengl.GL11;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.utility.VirtualEmptyModelData;
|
import com.simibubi.create.foundation.utility.VirtualEmptyModelData;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -41,23 +41,23 @@ public class SuperByteBufferCache {
|
||||||
return getGeneric(toRender, () -> standardBlockRender(toRender));
|
return getGeneric(toRender, () -> standardBlockRender(toRender));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperByteBuffer renderPartial(AllBlockPartials partial, BlockState referenceState) {
|
public SuperByteBuffer renderPartial(PartialModel partial, BlockState referenceState) {
|
||||||
return get(Compartment.PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState));
|
return get(Compartment.PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperByteBuffer renderPartial(AllBlockPartials partial, BlockState referenceState,
|
public SuperByteBuffer renderPartial(PartialModel partial, BlockState referenceState,
|
||||||
Supplier<MatrixStack> modelTransform) {
|
Supplier<MatrixStack> modelTransform) {
|
||||||
return get(Compartment.PARTIAL, partial,
|
return get(Compartment.PARTIAL, partial,
|
||||||
() -> standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
() -> standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperByteBuffer renderDirectionalPartial(AllBlockPartials partial, BlockState referenceState,
|
public SuperByteBuffer renderDirectionalPartial(PartialModel partial, BlockState referenceState,
|
||||||
Direction dir) {
|
Direction dir) {
|
||||||
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
||||||
() -> standardModelRender(partial.get(), referenceState));
|
() -> standardModelRender(partial.get(), referenceState));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuperByteBuffer renderDirectionalPartial(AllBlockPartials partial, BlockState referenceState, Direction dir,
|
public SuperByteBuffer renderDirectionalPartial(PartialModel partial, BlockState referenceState, Direction dir,
|
||||||
Supplier<MatrixStack> modelTransform) {
|
Supplier<MatrixStack> modelTransform) {
|
||||||
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
||||||
() -> standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
() -> standardModelRender(partial.get(), referenceState, modelTransform.get()));
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.simibubi.create.foundation.render.backend.core;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper class for loading and accessing json models.
|
||||||
|
* <p>
|
||||||
|
* Creating a PartialModel will make the associated modelLocation automatically load.
|
||||||
|
* As such, PartialModels must be initialized at or before {@link ModelRegistryEvent}.
|
||||||
|
* Once {@link ModelBakeEvent} finishes, all PartialModels (with valid modelLocations)
|
||||||
|
* will have their bakedModel fields populated.
|
||||||
|
* <p>
|
||||||
|
* Attempting to create a PartialModel after ModelRegistryEvent will cause an error.
|
||||||
|
*/
|
||||||
|
public class PartialModel {
|
||||||
|
|
||||||
|
private static boolean tooLate = false;
|
||||||
|
private static final List<PartialModel> all = new ArrayList<>();
|
||||||
|
|
||||||
|
protected final ResourceLocation modelLocation;
|
||||||
|
protected IBakedModel bakedModel;
|
||||||
|
|
||||||
|
public PartialModel(ResourceLocation modelLocation) {
|
||||||
|
|
||||||
|
if (tooLate) throw new RuntimeException("PartialModel '" + modelLocation + "' loaded after ModelRegistryEvent");
|
||||||
|
|
||||||
|
this.modelLocation = modelLocation;
|
||||||
|
all.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onModelRegistry(ModelRegistryEvent event) {
|
||||||
|
for (PartialModel partial : all)
|
||||||
|
ModelLoader.addSpecialModel(partial.modelLocation);
|
||||||
|
|
||||||
|
tooLate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onModelBake(ModelBakeEvent event) {
|
||||||
|
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||||
|
for (PartialModel partial : all)
|
||||||
|
partial.bakedModel = modelRegistry.get(partial.modelLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBakedModel get() {
|
||||||
|
return bakedModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -14,11 +14,11 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
|
||||||
import com.simibubi.create.foundation.render.Compartment;
|
import com.simibubi.create.foundation.render.Compartment;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||||
import com.simibubi.create.foundation.render.backend.Backend;
|
import com.simibubi.create.foundation.render.backend.Backend;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.core.PartialModel;
|
||||||
import com.simibubi.create.foundation.render.backend.gl.BasicProgram;
|
import com.simibubi.create.foundation.render.backend.gl.BasicProgram;
|
||||||
import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec;
|
import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec;
|
||||||
import com.simibubi.create.foundation.render.backend.gl.shader.ShaderCallback;
|
import com.simibubi.create.foundation.render.backend.gl.shader.ShaderCallback;
|
||||||
|
@ -101,15 +101,15 @@ public class RenderMaterial<P extends BasicProgram, MODEL extends InstancedModel
|
||||||
models.put(instance, CacheBuilder.newBuilder().build());
|
models.put(instance, CacheBuilder.newBuilder().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MODEL getModel(AllBlockPartials partial, BlockState referenceState) {
|
public MODEL getModel(PartialModel partial, BlockState referenceState) {
|
||||||
return get(PARTIAL, partial, () -> buildModel(partial.get(), referenceState));
|
return get(PARTIAL, partial, () -> buildModel(partial.get(), referenceState));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MODEL getModel(AllBlockPartials partial, BlockState referenceState, Direction dir) {
|
public MODEL getModel(PartialModel partial, BlockState referenceState, Direction dir) {
|
||||||
return getModel(partial, referenceState, dir, rotateToFace(dir));
|
return getModel(partial, referenceState, dir, rotateToFace(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MODEL getModel(AllBlockPartials partial, BlockState referenceState, Direction dir, Supplier<MatrixStack> modelTransform) {
|
public MODEL getModel(PartialModel partial, BlockState referenceState, Direction dir, Supplier<MatrixStack> modelTransform) {
|
||||||
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial),
|
||||||
() -> buildModel(partial.get(), referenceState, modelTransform.get()));
|
() -> buildModel(partial.get(), referenceState, modelTransform.get()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue