Skip to content

Commit

Permalink
Fix model registry
Browse files Browse the repository at this point in the history
  • Loading branch information
khjxiaogu committed Jan 15, 2025
1 parent 4d44ea0 commit 9f4f1ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void render(MultiblockBlockEntityMaster<T2GeneratorState> blockEntity, fl
Direction facing = orientation.front();
matrixStack.rotateAround(FHGuiHelper.DIR_TO_FACING.apply(facing), 0.5f, 0.5f, 0.5f);
List<BakedQuad> quads = FUEL.getAllQuads();

RenderUtils.renderModelTESRFast(quads, bufferIn.getBuffer(RenderType.solid()), matrixStack, combinedLightIn, combinedOverlayIn);
matrixStack.popPose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ public MechCalcRenderer(BlockEntityRendererProvider.Context rendererDispatcherIn
@Override
public void render(MechCalcTileEntity te, float partialTicks, PoseStack matrixStack,
MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {

BlockPos blockPos = te.getBlockPos();
BlockState state = te.getLevel().getBlockState(blockPos);
if (state.getBlock() != FHBlocks.MECHANICAL_CALCULATOR.get())
return;
//if (state.getBlock() != FHBlocks.MECHANICAL_CALCULATOR.get())
// return;
Direction rd = te.getDirection().getClockWise();

matrixStack.pushPose();
matrixStack.rotateAround(new Quaternionf().rotateY(te.getDirection().toYRot()/180F*Mth.PI), 0.5f, 0.5f, 0.5f);
double forward = ((double) te.process / 1067) / 16d;
matrixStack.translate(rd.getStepX() * forward, 0, rd.getStepZ() * forward);

List<BakedQuad> quads = MODEL.apply(ModelData.builder().with(DynamicSubmodelCallbacks.getProperty(), register).build());
RenderUtils.renderModelTESRFast(quads, bufferIn.getBuffer(RenderType.solid()), matrixStack, combinedLightIn, combinedOverlayIn);
matrixStack.popPose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ public static void registerModels(ModelEvent.RegisterAdditional ev)
{
FHMain.LOGGER.info("===========Dynamic Model Register========");
DynamicBlockModelReference.registeredModels.forEach(rl->{
ev.register(new ModelResourceLocation(rl,"dynamic"));
ev.register(rl);
FHMain.LOGGER.info(rl);
});
}
@SubscribeEvent
public static void registerBERenders(RegisterRenderers event){
FHMain.LOGGER.info("===========Dynamic Block Renderers========");
event.registerBlockEntityRenderer(FHMultiblocks.Logic.GENERATOR_T1.masterBE().get(), T1GeneratorRenderer::new);
event.registerBlockEntityRenderer(FHMultiblocks.Logic.GENERATOR_T2.masterBE().get(), T2GeneratorRenderer::new);
event.registerBlockEntityRenderer(FHBlockEntityTypes.MECH_CALC.get(), MechCalcRenderer::new);
Expand Down

0 comments on commit 9f4f1ec

Please sign in to comment.