Added __on_chunk_unloaded scarpet event (#1451)
* Fixes #1403 * Use concrete type
This commit is contained in:
1 parent
d088ee477e
commit
8c7dfa133e
3 files changed
+27
No files matched your search
@@ -26,6 +26,8 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import static carpet.script.CarpetEventServer.Event.EXPLOSION;
|
||||
import static carpet.script.CarpetEventServer.Event.LIGHTNING;
|
||||
import static carpet.script.CarpetEventServer.Event.CHUNK_UNLOADED;
|
||||
|
||||
|
||||
@Mixin(ServerLevel.class)
|
||||
public class ServerLevel_scarpetMixin implements ServerWorldInterface
|
||||
@@ -50,6 +52,16 @@ public class ServerLevel_scarpetMixin implements ServerWorldInterface
|
||||
EXPLOSION.onExplosion((ServerLevel) (Object)this, entity, null, d, e, f, g, bl, null, null, destructionType);
|
||||
}
|
||||
|
||||
@Inject(method = "unload", at = @At("HEAD"))
|
||||
private void handleChunkUnload(LevelChunk levelChunk, CallbackInfo ci)
|
||||
{
|
||||
if (CHUNK_UNLOADED.isNeeded())
|
||||
{
|
||||
ServerLevel level = (ServerLevel)((Object)this);
|
||||
CHUNK_UNLOADED.onChunkEvent(level, levelChunk.getPos(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private ServerLevelData serverLevelData;
|
||||
|
||||
Reference in new issue
Block a user