Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ImposterProtoChunk;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.ProtoChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin({ProtoChunk.class, LevelChunk.class, ImposterProtoChunk.class})
@Mixin({ProtoChunk.class, ImposterProtoChunk.class})
public abstract class ChunkAccessDisabledBlockMixin {
@ModifyVariable(
method = "setBlockState(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)Lnet/minecraft/world/level/block/state/BlockState;",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.github.jasonsimpart.mixin.minecraft;

import io.github.jasonsimpart.disabled.DisabledContentManager;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(LevelChunk.class)
public abstract class LevelChunkDisabledBlockMixin {
@Shadow
@Final
Level level;

@ModifyVariable(
method = "setBlockState(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)Lnet/minecraft/world/level/block/state/BlockState;",
at = @At("HEAD"),
argsOnly = true,
ordinal = 0
)
private BlockState createdelightcore$replaceDisabledBlock(BlockState state, BlockPos pos) {
if (this.level.isClientSide) {
return state;
}

return DisabledContentManager.replacementFor(state, (LevelChunk) (Object) this, pos);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public abstract class LevelDisabledBlockMixin {
@ModifyVariable(method = "setBlock", at = @At("HEAD"), argsOnly = true, ordinal = 0)
private BlockState createdelightcore$replaceDisabledBlock(BlockState state, BlockPos pos) {
Level level = (Level) (Object) this;
if (level.isClientSide) {
return state;
}

return DisabledContentManager.replacementFor(keepEnceladusDeepWaterLiquid(state, level, pos), level, pos);
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/createdelightcore.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"cmr.MixinSnowmanCoolerBlockEntity",
"cmr.SnowmanCoolerAccessor",
"minecraft.ChunkAccessDisabledBlockMixin",
"minecraft.LevelChunkDisabledBlockMixin",
"minecraft.LevelDisabledBlockMixin",
"minecraft.SimpleJsonResourceReloadListenerMixin",
"minecraft.WorldGenRegionDisabledBlockMixin",
Expand Down
Loading