use of net.minecraft.entity.attribute.EntityAttributeModifier in project Reborn12K by SlayeRRROAR.
the class PowerArmorMixin method constructor.
@Inject(method = "<init>", at = @At(value = "RETURN"))
private void constructor(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings, CallbackInfo ci) {
UUID uUID = MODIFIERS[slot.getEntitySlotId()];
if (material == Armors.POWER_ARMOR) {
ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
this.attributeModifiers.forEach(builder::put);
builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uUID, "Armor knockback resistance", this.knockbackResistance, EntityAttributeModifier.Operation.ADDITION));
this.attributeModifiers = builder.build();
}
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project Reborn12K by SlayeRRROAR.
the class ThelositeMixin method constructor.
@Inject(method = "<init>", at = @At(value = "RETURN"))
private void constructor(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings, CallbackInfo ci) {
UUID uUID = MODIFIERS[slot.getEntitySlotId()];
if (material == Armors.THELOSITE_ARMOR) {
ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
this.attributeModifiers.forEach(builder::put);
builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uUID, "Armor knockback resistance", this.knockbackResistance, EntityAttributeModifier.Operation.ADDITION));
this.attributeModifiers = builder.build();
}
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project Reborn12K by SlayeRRROAR.
the class ArcheositeMixin method constructor.
@Inject(method = "<init>", at = @At(value = "RETURN"))
private void constructor(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings, CallbackInfo ci) {
UUID uUID = MODIFIERS[slot.getEntitySlotId()];
if (material == Armors.ARCHEOSITE_ARMOR) {
ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
this.attributeModifiers.forEach(builder::put);
builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uUID, "Armor knockback resistance", this.knockbackResistance, EntityAttributeModifier.Operation.ADDITION));
this.attributeModifiers = builder.build();
}
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project UHC-Mod by CasualUHC.
the class GameManager method startCountDown.
public void startCountDown() {
PlayerUtils.messageEveryPlayer(new LiteralText("Please stand still during the countdown so you don't fall when you get teleported!").formatted(Formatting.GOLD));
// We repeat the code with interval 1 second
AtomicInteger integer = new AtomicInteger(10);
ScheduledFuture<?> future = this.EXECUTOR.scheduleAtFixedRate(() -> {
int i = integer.getAndDecrement();
PlayerUtils.forEveryPlayer(playerEntity -> {
playerEntity.networkHandler.sendPacket(new TitleS2CPacket(new LiteralText(String.valueOf(i)).formatted(Formatting.GREEN)));
playerEntity.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING, SoundCategory.MASTER, 1.0F, 3.0F);
});
}, 0, 1, TimeUnit.SECONDS);
this.FUTURES.add(future);
this.FUTURES.add(this.EXECUTOR.schedule(() -> {
future.cancel(true);
PlayerUtils.forEveryPlayer(playerEntity -> {
playerEntity.networkHandler.sendPacket(new TitleS2CPacket(new LiteralText("Good Luck!").formatted(Formatting.GOLD, Formatting.BOLD)));
playerEntity.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL, SoundCategory.MASTER, 1.0F, 1.0F);
playerEntity.getHungerManager().setSaturationLevel(20F);
EntityAttributeInstance instance = playerEntity.getAttributes().getCustomInstance(EntityAttributes.GENERIC_MAX_HEALTH);
if (instance != null) {
instance.removeModifier(PlayerUtils.HEALTH_BOOST);
instance.addPersistentModifier(new EntityAttributeModifier(PlayerUtils.HEALTH_BOOST, "Health Boost", GameSettings.HEALTH.getValue(), EntityAttributeModifier.Operation.MULTIPLY_BASE));
}
playerEntity.setHealth(playerEntity.getMaxHealth());
});
// Pushing back to main thread
MinecraftServer server = UHCMod.UHC_SERVER;
PlayerUtils.forEveryPlayer(playerEntity -> {
if (!TeamUtils.isNonTeam(playerEntity.getScoreboardTeam()) && !playerEntity.isSpectator()) {
((ServerPlayerMixinInterface) playerEntity).setCoordsBoolean(true);
playerEntity.changeGameMode(GameMode.SURVIVAL);
playerEntity.sendMessage(new LiteralText("You can disable the coordinates above your hotbar by using /coords"), false);
playerEntity.getInventory().clear();
PlayerUtils.setPlayerPlaying(playerEntity, true);
} else {
playerEntity.changeGameMode(GameMode.SPECTATOR);
}
});
server.execute(() -> {
server.getCommandManager().execute(server.getCommandSource(), "/fill 24 250 24 -25 289 -25 air");
server.getCommandManager().execute(server.getCommandSource(), "/spreadplayers 0 0 500 2900 true @e[type=player]");
Events.ON_ACTIVE.trigger();
});
}, 10, TimeUnit.SECONDS));
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project gobber_fabric-1.17 by kwpugh.
the class ArmorItemMixinKnockback method gobberConstructor.
@Inject(method = "<init>", at = @At(value = "RETURN"))
private void gobberConstructor(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings, CallbackInfo ci) {
UUID uUID = MODIFIERS[slot.getEntitySlotId()];
if (material == ItemInit.GOBBER_ARMOR_MATERIAL || material == ItemInit.GOBBER_NETHER_ARMOR_MATERIAL || material == ItemInit.GOBBER_END_ARMOR_MATERIAL || material == ItemInit.GOBBER_DRAGON_ARMOR_MATERIAL) {
ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
this.attributeModifiers.forEach(builder::put);
builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uUID, "Armor knockback resistance", this.knockbackResistance, EntityAttributeModifier.Operation.ADDITION));
this.attributeModifiers = builder.build();
}
}
Aggregations