pala M-gadget-4: bottes lestees (explosion atterrissage, legacy)
This commit is contained in:
@@ -72,6 +72,7 @@ public final class PalaTabs {
|
||||
output.accept(PalaItems.CHUNK_ANALYSER);
|
||||
output.accept(PalaItems.GRAPPIN);
|
||||
output.accept(PalaItems.FISHBOWL);
|
||||
output.accept(PalaItems.WEIGHTED_BOOTS);
|
||||
output.accept(PalaItems.CANDY);
|
||||
output.accept(PalaItems.CANDY_BLUE);
|
||||
output.accept(PalaItems.CANDY_GREEN);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package fr.surviepote.pala.events;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
@@ -36,6 +38,29 @@ public final class PalaArmorEvents {
|
||||
entity.addEffect(new MobEffectInstance(effect, duration, amplifier, false, false));
|
||||
}
|
||||
|
||||
private static final java.util.Map<java.util.UUID, Double> LAST_FALL =
|
||||
new java.util.HashMap<>();
|
||||
|
||||
// M-gadget-4 : explosion BREAK legacy (|vel_y| + 0.25 approxime par h/8 + 1,
|
||||
// plafonnee a 4, UNVERIFIED). Annulee en territoire d'autrui.
|
||||
static void weightedBoom(ServerPlayer player, double fell) {
|
||||
ServerLevel level = player.level();
|
||||
BlockPos pos = player.blockPosition();
|
||||
if (!fr.surviepote.pala.events.PalaFactionProtect.canAct(player, level, pos)) {
|
||||
player.sendSystemMessage(net.minecraft.network.chat.Component.literal(
|
||||
"§cTerritoire de faction protege."));
|
||||
return;
|
||||
}
|
||||
float power = (float) Math.min(1.0 + fell / 8.0, 4.0);
|
||||
ItemStack boots = player.getItemBySlot(EquipmentSlot.FEET);
|
||||
if (!boots.isEmpty()) {
|
||||
boots.hurtAndBreak(1, player, EquipmentSlot.FEET);
|
||||
}
|
||||
player.sendSystemMessage(net.minecraft.network.chat.Component.literal("§l§cEXPLOSION !!!!"));
|
||||
level.explode(player, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, power,
|
||||
net.minecraft.world.level.Level.ExplosionInteraction.TNT);
|
||||
}
|
||||
|
||||
private static boolean wearing(ServerPlayer player, EquipmentSlot slot, net.minecraft.world.item.Item item) {
|
||||
ItemStack stack = player.getItemBySlot(slot);
|
||||
return !stack.isEmpty() && stack.getItem() == item;
|
||||
@@ -47,6 +72,21 @@ public final class PalaArmorEvents {
|
||||
effect(player, net.minecraft.world.effect.MobEffects.BLINDNESS, 60, 0);
|
||||
}
|
||||
|
||||
// --- Bottes lestees (M-gadget-4, legacy VERIFIE) : memorise la chute, explosion
|
||||
// a l'atterrissage si > 3 blocs. Annulee en claim d'autrui (anti-grief, ECART).
|
||||
if (wearing(player, EquipmentSlot.FEET, PalaItems.WEIGHTED_BOOTS)) {
|
||||
if (!player.onGround()) {
|
||||
LAST_FALL.put(player.getUUID(), player.fallDistance);
|
||||
} else {
|
||||
Double fell = LAST_FALL.remove(player.getUUID());
|
||||
if (fell != null && fell > 3.0F) {
|
||||
weightedBoom(player, fell);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LAST_FALL.remove(player.getUUID());
|
||||
}
|
||||
|
||||
// --- Armure Paladium (1 procedure par piece dans le legacy) ---
|
||||
if (wearing(player, EquipmentSlot.HEAD, PalaItems.PALADIUM_HELMET)) {
|
||||
effect(player, net.minecraft.world.effect.MobEffects.NIGHT_VISION, 860, 1);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"item.pala.amethyst_mixed_coal": "Amethyst Mixed Coal",
|
||||
"item.pala.amethyst_stick": "Amethyst Stick",
|
||||
"item.pala.compressed_amethyst": "Compressed Amethyst",
|
||||
"item.pala.weighted_boots": "Boom Boots",
|
||||
"item.pala.fishbowl": "Bocal a poissons",
|
||||
"item.pala.grappin": "Grappin",
|
||||
"item.pala.chunk_analyser": "Chunk Analyser",
|
||||
|
||||
Reference in New Issue
Block a user