forked from KidsDontPlay/Storage-Network
-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
facade rendering now uses tesselateBlock, configs updated
- Loading branch information
Showing
14 changed files
with
88 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/lothrazar/storagenetwork/block/cable/CableFacadeRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.lothrazar.storagenetwork.block.cable; | ||
|
||
import com.lothrazar.storagenetwork.registry.ConfigRegistry; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import com.mojang.blaze3d.vertex.VertexMultiConsumer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.client.renderer.block.BlockRenderDispatcher; | ||
import net.minecraft.client.renderer.block.ModelBlockRenderer; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; | ||
import net.minecraft.client.resources.model.BakedModel; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraftforge.client.model.data.ModelData; | ||
|
||
public class CableFacadeRenderer implements BlockEntityRenderer<TileCable> { | ||
|
||
private BlockRenderDispatcher brd; | ||
private ModelBlockRenderer renderer; | ||
|
||
public CableFacadeRenderer(BlockEntityRendererProvider.Context d) { | ||
this.brd = d.getBlockRenderDispatcher(); | ||
this.renderer = brd.getModelRenderer(); | ||
} | ||
|
||
@Override | ||
public boolean shouldRenderOffScreen(TileCable te) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void render(TileCable te, float v, PoseStack matrixStack, MultiBufferSource ibuffer, int packedLight, int packedOverlay) { | ||
if (ConfigRegistry.enableFacades.get() && te.getFacadeState() != null) { | ||
BlockState facadeState = te.getFacadeState(); | ||
BakedModel model = this.brd.getBlockModel(facadeState); | ||
VertexConsumer vertexConsumer = VertexMultiConsumer.create(ibuffer.getBuffer(RenderType.solid())); | ||
renderer.tesselateBlock(te.getLevel(), model, facadeState, te.getBlockPos(), | ||
matrixStack, vertexConsumer, false, te.getLevel().random, packedLight, packedOverlay, | ||
ModelData.EMPTY, RenderType.solid()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
src/main/java/com/lothrazar/storagenetwork/block/facade/TesrCable.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/main/java/com/lothrazar/storagenetwork/block/facade/TesrExportCable.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/main/java/com/lothrazar/storagenetwork/block/facade/TesrImportCable.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/main/java/com/lothrazar/storagenetwork/block/facade/TesrImportFilterCable.java
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
src/main/java/com/lothrazar/storagenetwork/block/facade/TesrStorageCable.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters