net.minecraft.world.BlockRenderView Java Examples

The following examples show how to use net.minecraft.world.BlockRenderView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockModelRendererMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(at = {@At("HEAD")},
	method = {
		"renderSmooth(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z",
		"renderFlat(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z"},
	cancellable = true)
private void onRenderSmoothOrFlat(BlockRenderView blockRenderView_1,
	BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1,
	MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1,
	boolean depthTest, Random random_1, long long_1, int int_1,
	CallbackInfoReturnable<Boolean> cir)
{
	TesselateBlockEvent event = new TesselateBlockEvent(blockState_1);
	WurstClient.INSTANCE.getEventManager().fire(event);
	
	if(event.isCancelled())
	{
		cir.cancel();
		return;
	}
	
	if(!depthTest)
		return;
	
	ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(blockState_1);
	WurstClient.INSTANCE.getEventManager().fire(event2);
	if(!Boolean.TRUE.equals(event2.isRendered()))
		return;
	
	renderSmooth(blockRenderView_1, bakedModel_1, blockState_1, blockPos_1,
		matrixStack_1, vertexConsumer_1, false, random_1, long_1, int_1);
}
 
Example #2
Source File: BlockModelRendererMixin.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Shadow
public boolean renderSmooth(BlockRenderView blockRenderView_1,
	BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1,
	MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1,
	boolean boolean_1, Random random_1, long long_1, int int_1)
{
	return false;
}
 
Example #3
Source File: MixinFluidRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
public void render(BlockRenderView extendedBlockView_1, BlockPos blockPos_1, VertexConsumer vertexConsumer_1, FluidState fluidState_1, CallbackInfoReturnable<Boolean> callbackInfo) {
    Xray xray = (Xray) ModuleManager.getModule(Xray.class);
    if (xray.getSettings().get(0).toToggle().state) return;
    if (xray.isToggled() && !xray.isVisible(fluidState_1.getBlockState().getBlock())) {
        callbackInfo.setReturnValue(false);
        callbackInfo.cancel();
    }
}
 
Example #4
Source File: MixinBlockModelRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void render(BlockRenderView blockRenderView_1, BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1, MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1, boolean boolean_1, Random random_1, long long_1, int int_1, CallbackInfoReturnable<Boolean> ci) {
    try {
        Xray xray = (Xray) ModuleManager.getModule(Xray.class);
        if (!xray.isVisible(blockState_1.getBlock())) {
            ci.setReturnValue(false);
            ci.cancel();
        }
    } catch (Exception ignored) {}
}
 
Example #5
Source File: MixinFluidRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
public void render(BlockRenderView extendedBlockView_1, BlockPos blockPos_1, VertexConsumer vertexConsumer_1, FluidState fluidState_1, CallbackInfoReturnable<Boolean> callbackInfo) {
    Xray xray = (Xray) ModuleManager.getModule(Xray.class);
    if (xray.getSettings().get(0).toToggle().state) return;
    if (xray.isToggled() && !xray.isVisible(fluidState_1.getBlockState().getBlock())) {
        callbackInfo.setReturnValue(false);
        callbackInfo.cancel();
    }
}
 
Example #6
Source File: MixinBlockModelRenderer.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void render(BlockRenderView blockRenderView_1, BakedModel bakedModel_1, BlockState blockState_1, BlockPos blockPos_1, MatrixStack matrixStack_1, VertexConsumer vertexConsumer_1, boolean boolean_1, Random random_1, long long_1, int int_1, CallbackInfoReturnable<Boolean> ci) {
    try {
        Xray xray = (Xray) ModuleManager.getModule(Xray.class);
        if (!xray.isVisible(blockState_1.getBlock())) {
            ci.setReturnValue(false);
            ci.cancel();
        }
    } catch (Exception ignored) {}
}
 
Example #7
Source File: IForgeBlockState.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Get a light value for this block, taking into account the state and coordinates, normal ranges are between 0 and 15.
 */
default int getLightValue(BlockRenderView world, BlockPos pos) {
	return patchwork$getForgeBlock().getLightValue(getBlockState(), world, pos);
}
 
Example #8
Source File: MixinFluidRenderer.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(at = @At("HEAD"), method = "render", cancellable = true)
public void tesselate(BlockRenderView view, BlockPos pos, VertexConsumer bufferBuilder, FluidState state, CallbackInfoReturnable<Boolean> info) {
    stateThreadLocal.set(state);
}
 
Example #9
Source File: MixinFluidRenderer.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(at = @At("RETURN"), method = "render")
public void removeLocal(BlockRenderView view, BlockPos pos, VertexConsumer bufferBuilder, FluidState state, CallbackInfoReturnable<Boolean> info) {
    stateThreadLocal.remove();
}
 
Example #10
Source File: IForgeBlockState.java    From patchwork-api with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Check if the face of a block should block rendering.
 *
 * <p>Faces which are fully opaque should return true, faces with transparency
 * or faces which do not span the full size of the block should return false.
 *
 * @param world The current world
 * @param pos   Block position in world
 * @param face  The side to check
 * @return True if the block is opaque on the specified side.
 * @deprecated This is no longer used for rendering logic.
 */
@Deprecated
default boolean doesSideBlockRendering(BlockRenderView world, BlockPos pos, Direction face) {
	return patchwork$getForgeBlock().doesSideBlockRendering(getBlockState(), world, pos, face);
}
 
Example #11
Source File: IForgeBlock.java    From patchwork-api with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15.
 *
 * @param state
 * @param world
 * @param pos
 * @return The light value
 */
default int getLightValue(BlockState state, BlockRenderView world, BlockPos pos) {
	return state.getLuminance();
}
 
Example #12
Source File: IForgeBlock.java    From patchwork-api with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * note: do not bother implementing hooks, deprecated for removal in 1.15
 * Check if the face of a block should block rendering.
 *
 * <p>Faces which are fully opaque should return true, faces with transparency
 * or faces which do not span the full size of the block should return false.
 *
 * @param state The current block state
 * @param world The current world
 * @param pos   Block position in world
 * @param face  The side to check
 * @return True if the block is opaque on the specified side.
 * @deprecated This is no longer used for rendering logic.
 */
@Deprecated
default boolean doesSideBlockRendering(BlockState state, BlockRenderView world, BlockPos pos, Direction face) {
	return state.isFullOpaque(world, pos);
}