23w45a fixes and unmaintainable optimized TNT rule pseudofix.

This commit is contained in:
gnembon committed 2023-11-08 21:41:49 +01:00
1 parent e1bd03cbef
commit 5c1da81b9f
9 files changed
+53 -20

No files matched your search

@@ -38,6 +38,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.QuartPos;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
@@ -46,6 +47,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.level.Ticket;
import net.minecraft.server.level.TicketType;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.PalettedContainer;
@@ -1066,7 +1068,7 @@ public class WorldAccess
float thePowah = powah;
// copy of ServerWorld.createExplosion #TRACK#
Explosion explosion = new Explosion(cc.level(), source, null, null, pos.x, pos.y, pos.z, powah, createFire, mode)
Explosion explosion = new Explosion(cc.level(), source, null, null, pos.x, pos.y, pos.z, powah, createFire, mode, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE)
{
@Override
@Nullable
@@ -1082,10 +1084,11 @@ public class WorldAccess
{
explosion.clearToBlow();
}
Explosion.BlockInteraction finalMode = mode;
cc.level().players().forEach(spe -> {
if (spe.distanceToSqr(pos) < 4096.0D)
{
spe.connection.send(new ClientboundExplodePacket(pos.x, pos.y, pos.z, thePowah, explosion.getToBlow(), explosion.getHitPlayers().get(spe)));
spe.connection.send(new ClientboundExplodePacket(pos.x, pos.y, pos.z, thePowah, explosion.getToBlow(), explosion.getHitPlayers().get(spe), finalMode, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE));
}
});
return Value.TRUE;
@@ -12,8 +12,8 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import net.minecraft.commands.CommandRuntimeException;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.storage.LevelResource;
import java.io.BufferedWriter;
@@ -473,4 +473,17 @@ public class AppStoreManager
}
CarpetScriptServer.LOG.info("Downloaded app " + target + " from " + contentUrl);
}
public static class CommandRuntimeException extends RuntimeException {
private final Component message;
public CommandRuntimeException(Component message) {
super(message.getString(), null, false, false);
this.message = message;
}
public Component getComponent() {
return message;
}
}
}