-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3071d15
commit a578165
Showing
6 changed files
with
86 additions
and
2 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
24 changes: 24 additions & 0 deletions
24
...ain/java/dev/cammiescorner/arcanuscontinuum/common/compat/ExplosiveEnhancementCompat.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,24 @@ | ||
package dev.cammiescorner.arcanuscontinuum.common.compat; | ||
|
||
import net.minecraft.registry.tag.FluidTags; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.superkat.explosiveenhancement.ExplosiveEnhancement; | ||
import net.superkat.explosiveenhancement.ExplosiveEnhancementClient; | ||
import net.superkat.explosiveenhancement.api.ExplosiveApi; | ||
|
||
public class ExplosiveEnhancementCompat { | ||
public static void spawnEnhancedBooms(World world, double x, double y, double z, float power, boolean didDestroyBlocks) { | ||
boolean isUnderWater = false; | ||
BlockPos pos = BlockPos.create(x, y, z); | ||
|
||
if(ExplosiveEnhancementClient.config.underwaterExplosions && world.getFluidState(pos).isIn(FluidTags.WATER)) { | ||
isUnderWater = true; | ||
|
||
if(ExplosiveEnhancementClient.config.debugLogs) | ||
ExplosiveEnhancement.LOGGER.info("particle is underwater!"); | ||
} | ||
|
||
ExplosiveApi.spawnParticles(world, x, y, z, power, isUnderWater, didDestroyBlocks); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...a/dev/cammiescorner/arcanuscontinuum/common/packets/s2c/SyncExplosionParticlesPacket.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,48 @@ | ||
package dev.cammiescorner.arcanuscontinuum.common.packets.s2c; | ||
|
||
import dev.cammiescorner.arcanuscontinuum.Arcanus; | ||
import dev.cammiescorner.arcanuscontinuum.common.compat.ExplosiveEnhancementCompat; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.network.ClientPlayNetworkHandler; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.particle.ParticleTypes; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.World; | ||
import org.quiltmc.loader.api.QuiltLoader; | ||
import org.quiltmc.qsl.networking.api.PacketByteBufs; | ||
import org.quiltmc.qsl.networking.api.PacketSender; | ||
import org.quiltmc.qsl.networking.api.ServerPlayNetworking; | ||
|
||
public class SyncExplosionParticlesPacket { | ||
public static final Identifier ID = Arcanus.id("sync_explosion_particles"); | ||
|
||
public static void send(ServerPlayerEntity player, double x, double y, double z, float strength, boolean didDestroyBlocks) { | ||
PacketByteBuf buf = PacketByteBufs.create(); | ||
|
||
buf.writeDouble(x); | ||
buf.writeDouble(y); | ||
buf.writeDouble(z); | ||
buf.writeFloat(strength); | ||
buf.writeBoolean(didDestroyBlocks); | ||
|
||
ServerPlayNetworking.send(player, ID, buf); | ||
} | ||
|
||
public static void handle(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender sender) { | ||
double x = buf.readDouble(); | ||
double y = buf.readDouble(); | ||
double z = buf.readDouble(); | ||
float strength = buf.readFloat(); | ||
boolean didDestroyBlocks = buf.readBoolean(); | ||
|
||
client.execute(() -> { | ||
World world = client.world; | ||
|
||
if(QuiltLoader.isModLoaded("explosiveenhancement")) | ||
ExplosiveEnhancementCompat.spawnEnhancedBooms(world, x, y, z, strength, didDestroyBlocks); | ||
else | ||
world.addParticle(ParticleTypes.EXPLOSION_EMITTER, x, y, z, 1, 1, 1); | ||
}); | ||
} | ||
} |
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