-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --keep-searching option to /cfindblock (#635)
* Fix #627 + Fix issue with pasting client command truncating at 256 chars. * Added --keep-searching option to cfindblock * Add #612 * Fixed issue I just noticed with new cfindblock command * that's probably better * undo feature * whoop * Add #612 * Added cminesweeper command * temporary to move to desktop * Changes in response to review * Changes in response to review * did this do something * Changes in response to review * whoop * undid the bullshit whoopsie
- Loading branch information
Showing
7 changed files
with
190 additions
and
35 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
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
23 changes: 23 additions & 0 deletions
23
...main/java/net/earthcomputer/clientcommands/mixin/commands/findblock/ClientLevelMixin.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,23 @@ | ||
package net.earthcomputer.clientcommands.mixin.commands.findblock; | ||
|
||
import net.earthcomputer.clientcommands.event.ClientLevelEvents; | ||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.chunk.LevelChunk; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ClientLevel.class) | ||
public class ClientLevelMixin { | ||
@Inject(method = "unload", at = @At("HEAD")) | ||
private void onChunkUnload(LevelChunk chunk, CallbackInfo ci) { | ||
ClientLevelEvents.UNLOAD_CHUNK.invoker().onUnloadChunk((ClientLevel) (Object) this, chunk.getPos()); | ||
} | ||
|
||
@Inject(method = "onChunkLoaded", at = @At("HEAD")) | ||
private void onChunkLoad(ChunkPos chunkPos, CallbackInfo ci) { | ||
ClientLevelEvents.LOAD_CHUNK.invoker().onLoadChunk((ClientLevel) (Object) this, chunkPos); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/net/earthcomputer/clientcommands/mixin/commands/findblock/LevelChunkMixin.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,30 @@ | ||
package net.earthcomputer.clientcommands.mixin.commands.findblock; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.earthcomputer.clientcommands.event.ClientLevelEvents; | ||
import net.minecraft.client.multiplayer.ClientLevel; | ||
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 net.minecraft.world.level.chunk.LevelChunkSection; | ||
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; | ||
|
||
@Mixin(LevelChunk.class) | ||
public class LevelChunkMixin { | ||
|
||
@Shadow @Final private Level level; | ||
|
||
@WrapOperation(method = "setBlockState", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/chunk/LevelChunkSection;setBlockState(IIILnet/minecraft/world/level/block/state/BlockState;)Lnet/minecraft/world/level/block/state/BlockState;")) | ||
private BlockState onSetBlockState(LevelChunkSection instance, int x, int y, int z, BlockState state, Operation<BlockState> original, BlockPos pos, BlockState redundant, boolean isMoving) { | ||
BlockState oldState = original.call(instance, x, y, z, state); | ||
if (level.isClientSide) { | ||
ClientLevelEvents.CHUNK_UPDATE.invoker().onBlockStateUpdate((ClientLevel) level, pos, oldState, state); | ||
} | ||
return oldState; | ||
} | ||
} |
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