Jump to content

PooPmeep

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

PooPmeep's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Oh, that's because I tried running it with both server tick events and client tick events, and neither worked, they both gave the same crashlog. I ended up getting everything to work without the tick events anyway, so it's not really an issue anymore.
  2. This worked just fine on 1.18.2 so it's really strange...
  3. Also, here is the actual code: package net.qualityequipment.procedures; import net.minecraft.network.chat.Component; import net.qualityequipment.network.QualityEquipmentModVariables; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec2; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.Level; import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.ShovelItem; import net.minecraft.world.item.ShieldItem; import net.minecraft.world.item.PickaxeItem; import net.minecraft.world.item.Items; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.HoeItem; import net.minecraft.world.item.CrossbowItem; import net.minecraft.world.item.BowItem; import net.minecraft.world.item.AxeItem; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.inventory.Slot; import net.minecraft.world.entity.Entity; import net.minecraft.sounds.SoundSource; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerLevel; import net.minecraft.resources.ResourceLocation; import net.minecraft.core.BlockPos; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSource; import java.util.function.Supplier; import java.util.Map; import java.io.IOException; import java.io.FileReader; import java.io.File; import java.io.BufferedReader; import com.google.gson.Gson; public class TakenslotresultProcedure { public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) { if (entity == null) return; boolean repeat = false; String material = ""; File qualityequipment = new File(""); File chance = new File(""); File stats = new File(""); com.google.gson.JsonObject mainjsonobject = new com.google.gson.JsonObject(); com.google.gson.JsonObject chancejsonobject = new com.google.gson.JsonObject(); com.google.gson.JsonObject statsjsonobject = new com.google.gson.JsonObject(); double Worthless = 0; double Broken = 0; double Chipped = 0; double Bulky = 0; double Rusted = 0; double Clumsy = 0; double Shorter = 0; double Pokey = 0; double Broad = 0; double Thin = 0; double Vicious = 0; double Longer = 0; double Sharp = 0; double Keen = 0; double Graceful = 0; double Sweeping = 0; double Legendary = 0; double ClumsyBow = 0; double Cracked = 0; double Light = 0; double Powerful = 0; double LegendaryBow = 0; double Crumbling = 0; double Dented = 0; double Heavy = 0; double Thick = 0; double Lucky = 0; double Springy = 0; double Speedy = 0; double Tough = 0; double Protective = 0; double Solid = 0; double Masterful = 0; double HeavyShield = 0; double ThickShield = 0; double SolidShield = 0; chance = new File((FMLPaths.GAMEDIR.get().toString() + "/config/QualityEquipment/"), File.separator + "reforgechance.json"); stats = new File((FMLPaths.GAMEDIR.get().toString() + "/config/QualityEquipment/"), File.separator + "reforgestats.json"); { try { BufferedReader bufferedReader = new BufferedReader(new FileReader(chance)); StringBuilder jsonstringbuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { jsonstringbuilder.append(line); } bufferedReader.close(); chancejsonobject = new Gson().fromJson(jsonstringbuilder.toString(), com.google.gson.JsonObject.class); Worthless = chancejsonobject.get("Worthless").getAsDouble(); Broken = chancejsonobject.get("Broken").getAsDouble(); Chipped = chancejsonobject.get("Chipped").getAsDouble(); Bulky = chancejsonobject.get("Bulky").getAsDouble(); Rusted = chancejsonobject.get("Rusted").getAsDouble(); Clumsy = chancejsonobject.get("Clumsy").getAsDouble(); Pokey = chancejsonobject.get("Pokey").getAsDouble(); Shorter = chancejsonobject.get("Short").getAsDouble(); Broad = chancejsonobject.get("Broad").getAsDouble(); Thin = chancejsonobject.get("Thin").getAsDouble(); Vicious = chancejsonobject.get("Vicious").getAsDouble(); Longer = chancejsonobject.get("Long").getAsDouble(); Sharp = chancejsonobject.get("Sharp").getAsDouble(); Keen = chancejsonobject.get("Keen").getAsDouble(); Graceful = chancejsonobject.get("Graceful").getAsDouble(); Sweeping = chancejsonobject.get("Sweeping").getAsDouble(); Legendary = chancejsonobject.get("Legendary").getAsDouble(); ClumsyBow = chancejsonobject.get("Clumsy Bow").getAsDouble(); Cracked = chancejsonobject.get("Cracked").getAsDouble(); Light = chancejsonobject.get("Light").getAsDouble(); Powerful = chancejsonobject.get("Powerful").getAsDouble(); LegendaryBow = chancejsonobject.get("Legendary Bow").getAsDouble(); Crumbling = chancejsonobject.get("Crumbling").getAsDouble(); Dented = chancejsonobject.get("Dented").getAsDouble(); Heavy = chancejsonobject.get("Heavy").getAsDouble(); Thick = chancejsonobject.get("Thick").getAsDouble(); Lucky = chancejsonobject.get("Lucky").getAsDouble(); Springy = chancejsonobject.get("Springy").getAsDouble(); Speedy = chancejsonobject.get("Speedy").getAsDouble(); Tough = chancejsonobject.get("Tough").getAsDouble(); Protective = chancejsonobject.get("Protective").getAsDouble(); Solid = chancejsonobject.get("Solid").getAsDouble(); Masterful = chancejsonobject.get("Masterful").getAsDouble(); HeavyShield = chancejsonobject.get("Heavy Shield").getAsDouble(); ThickShield = chancejsonobject.get("Thick Shield").getAsDouble(); SolidShield = chancejsonobject.get("Solid Shield").getAsDouble(); } catch (IOException e) { e.printStackTrace(); } } { try { BufferedReader bufferedReader = new BufferedReader(new FileReader(stats)); StringBuilder jsonstringbuilder = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { jsonstringbuilder.append(line); } bufferedReader.close(); statsjsonobject = new Gson().fromJson(jsonstringbuilder.toString(), com.google.gson.JsonObject.class); if ((entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof SwordItem || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY) .getItem() instanceof PickaxeItem || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof AxeItem || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof ShovelItem || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof HoeItem) { if (world instanceof ServerLevel _level) _level.getServer().getCommands() .performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), "data remove block ~ ~ ~ Items[{Slot:0b}].tag.display"); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Worthless", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Broken", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Chipped", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Bulky", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Rusted", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Clumsy", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Short", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Broad", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Thin", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Vicious", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Long", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Sharp", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Keen", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Graceful", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Sweeping", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Legendary", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Pokey", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Reforged", (true)); repeat = true; while (repeat == true) { if (Math.random() <= Worthless) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Worthless", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A74" + "" + statsjsonobject.get("Worthless Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-10% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Worthless Negative Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Worthless Negative Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-1 Reach Distance\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Broken) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Broken", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A78" + "" + statsjsonobject.get("Broken Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Broken Negative Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Chipped) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Chipped", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Chipped Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Chipped Negative Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Chipped Negative Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Bulky) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Bulky", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A78" + "" + statsjsonobject.get("Bulky Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-15% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Bulky Negative Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Rusted) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Rusted", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Rusted Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-10% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Rusted Negative Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Pokey) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Pokey", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7e" + "" + statsjsonobject.get("Pokey Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-10% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Pokey Positive Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Clumsy) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Clumsy", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Clumsy Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-5% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Clumsy Negative Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Shorter) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Short", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Short Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-1 Reach Distance\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Broad) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Broad", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7e" + "" + statsjsonobject.get("Broad Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-5% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Broad Negative Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Broad Positive Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Thin) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Thin", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7e" + "" + statsjsonobject.get("Thin Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Thin Positive Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Thin Negative Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Vicious) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Vicious", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7e" + "" + statsjsonobject.get("Vicious Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Vicious Positive Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-0.5 Reach Distance\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Longer) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Long", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Long Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+0.5 Reach Distance\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Sharp) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Sharp", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Sharp Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Sharp Positive Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Keen) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Keen", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Keen Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Keen Positive Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Keen Positive Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Graceful) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Graceful", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7b" + "" + statsjsonobject.get("Graceful Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+15% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Graceful Positive Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Sweeping) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Sweeping", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7b" + "" + statsjsonobject.get("Sweeping Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Sweeping Positive Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+0.5 Reach Distance\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Legendary) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Legendary", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7d" + "" + statsjsonobject.get("Legendary Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+10% Dig Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Legendary Positive Attack Speed Display").getAsString() + " Attack Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Legendary Positive Attack Damage Display").getAsString() + " Attack Damage\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+0.5 Reach Distance\",\"italic\":false}]']}")); repeat = false; } else { repeat = true; } } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(2)).remove(1); _player.containerMenu.broadcastChanges(); } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(1)).remove(1); _player.containerMenu.broadcastChanges(); } { boolean _setval = true; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } new Object() { private int ticks = 0; private float waitTicks; private LevelAccessor world; public void start(LevelAccessor world, int waitTicks) { this.waitTicks = waitTicks; MinecraftForge.EVENT_BUS.register(this); this.world = world; } @SubscribeEvent public void tick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.ticks += 1; if (this.ticks >= this.waitTicks) run(); } } private void run() { { boolean _setval = false; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } MinecraftForge.EVENT_BUS.unregister(this); } }.start(world, (int) 3.5); if (world instanceof Level _level) { if (!_level.isClientSide()) { _level.playSound(null, new BlockPos(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1); } else { _level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1, false); } } } if (((entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() == Items.BOW || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() == Items.CROSSBOW) && (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(1)).getItem() : ItemStack.EMPTY) .getItem() == Blocks.OAK_LOG.asItem() || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof BowItem || (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY) .getItem() instanceof CrossbowItem) { if (world instanceof Level _level) { if (!_level.isClientSide()) { _level.playSound(null, new BlockPos(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1); } else { _level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1, false); } } if (world instanceof ServerLevel _level) _level.getServer().getCommands() .performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), "data remove block ~ ~ ~ Items[{Slot:0b}].tag.display"); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Clumsy Bow", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Cracked", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Light", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Powerful", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Legendary Bow", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Reforged", (true)); repeat = true; while (repeat == true) { if (Math.random() <= ClumsyBow) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Clumsy Bow", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Clumsy Bow Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Clumsy Bow Negative Projectile Damage Display").getAsString() + " Projectile Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Cracked) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Cracked", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A78" + "" + statsjsonobject.get("Cracked Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Cracked Negative Projectile Damage Display").getAsString() + " Projectile Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Light) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Light", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Light Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Light Positive Projectile Damage Display").getAsString() + " Projectile Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Powerful) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Powerful", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7b" + "" + statsjsonobject.get("Powerful Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Powerful Positive Projectile Damage Display").getAsString() + " Projectile Damage\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= LegendaryBow) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Legendary Bow", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7d" + "" + statsjsonobject.get("Legendary Bow Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Main Hand:\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Legendary Bow Positive Projectile Damage Display").getAsString() + " Projectile Damage\",\"italic\":false}]']}")); repeat = false; } else { repeat = true; } } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(2)).remove(1); _player.containerMenu.broadcastChanges(); } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(1)).remove(1); _player.containerMenu.broadcastChanges(); } { boolean _setval = true; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } new Object() { private int ticks = 0; private float waitTicks; private LevelAccessor world; public void start(LevelAccessor world, int waitTicks) { this.waitTicks = waitTicks; MinecraftForge.EVENT_BUS.register(this); this.world = world; } @SubscribeEvent public void tick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.ticks += 1; if (this.ticks >= this.waitTicks) run(); } } private void run() { { boolean _setval = false; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } MinecraftForge.EVENT_BUS.unregister(this); } }.start(world, (int) 3.5); } if ((entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof ArmorItem) { if (world instanceof Level _level) { if (!_level.isClientSide()) { _level.playSound(null, new BlockPos(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1); } else { _level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1, false); } } if (world instanceof ServerLevel _level) _level.getServer().getCommands() .performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), "data remove block ~ ~ ~ Items[{Slot:0b}].tag.display"); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Crumbling", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Dented", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Heavy", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Thick", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Lucky", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Springy", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Speedy", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Tough", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Protective", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Solid", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Masterful", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Reforged", (true)); repeat = true; while (repeat == true) { if (Math.random() <= Crumbling) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Crumbling", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Crumbling Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A7c-" + statsjsonobject.get("Crumbling Negative Armor Toughness Display").getAsString() + " Armor Toughness\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A7c-" + statsjsonobject.get("Crumbling Negative Armor Display").getAsString() + " Armor\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Dented) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Dented", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A78" + "" + statsjsonobject.get("Dented Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A7c-" + statsjsonobject.get("Dented Negative Armor Display").getAsString() + " Armor\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Heavy) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Heavy", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Heavy Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A7c-" + statsjsonobject.get("Heavy Negative Speed Display").getAsString() + " Speed\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Thick) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Thick", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7e" + "" + statsjsonobject.get("Thick Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A7c-" + statsjsonobject.get("Thick Negative Speed Display").getAsString() + " Speed\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Thick Positive Armor Display").getAsString() + " Armor\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Lucky) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Lucky", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7b" + "" + statsjsonobject.get("Lucky Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A79 \u00A79+" + statsjsonobject.get("Lucky Positive Luck Display").getAsString() + " Luck\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Springy) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Springy", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Springy Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+0.5 Jump Height\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Speedy) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Speedy", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Speedy Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Speedy Positive Speed Display").getAsString() + " Speed\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Tough) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Tough", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Tough Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Tough Positive Armor Toughness Display").getAsString() + " Armor Toughness\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Protective) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Protective", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Protective Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Protective Positive Armor Display").getAsString() + " Armor\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Solid) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Solid", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Solid Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Solid Positive Knockback Resistance Display").getAsString() + " Knockback Resistance\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= Masterful) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Masterful", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7d" + "" + statsjsonobject.get("Masterful Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77While Worn:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Masterful Positive Armor Toughness Display").getAsString() + " Armor Toughness\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Masterful Positive Armor Display").getAsString() + " Armor\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Masterful Positive Knockback Resistance Display").getAsString() + " Knockback Resistance\",\"italic\":false}]']}")); repeat = false; } else { repeat = true; } } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(2)).remove(1); _player.containerMenu.broadcastChanges(); } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(1)).remove(1); _player.containerMenu.broadcastChanges(); } { boolean _setval = true; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } new Object() { private int ticks = 0; private float waitTicks; private LevelAccessor world; public void start(LevelAccessor world, int waitTicks) { this.waitTicks = waitTicks; MinecraftForge.EVENT_BUS.register(this); this.world = world; } @SubscribeEvent public void tick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.ticks += 1; if (this.ticks >= this.waitTicks) run(); } } private void run() { { boolean _setval = false; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } MinecraftForge.EVENT_BUS.unregister(this); } }.start(world, (int) 3.5); } if ((entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() instanceof ShieldItem) { if (world instanceof Level _level) { if (!_level.isClientSide()) { _level.playSound(null, new BlockPos(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1); } else { _level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.anvil.use")), SoundSource.NEUTRAL, 1, 1, false); } } if (world instanceof ServerLevel _level) _level.getServer().getCommands() .performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), "data remove block ~ ~ ~ Items[{Slot:0b}].tag.display"); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Heavy Shield", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Thick Shield", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Solid Shield", (false)); (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Reforged", (true)); repeat = true; while (repeat == true) { if (Math.random() <= HeavyShield) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Heavy Shield", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7c" + "" + statsjsonobject.get("Heavy Shield Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A7c-" + statsjsonobject.get("Heavy Shield Negative Speed Display").getAsString() + " Speed\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= ThickShield) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Thick Shield", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A7e" + "" + statsjsonobject.get("Thick Shield Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A7c-" + statsjsonobject.get("Thick Shield Negative Speed Display").getAsString() + " Speed\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Thick Shield Positive Armor Display").getAsString() + " Armor\",\"italic\":false}]']}")); repeat = false; } else if (Math.random() <= SolidShield) { (entity instanceof ServerPlayer _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag() .putBoolean("Solid Shield", (true)); if (world instanceof ServerLevel _level) _level.getServer().getCommands().performPrefixedCommand( new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(), ("data modify block ~ ~ ~ Items[{Slot:0b}].tag.display set value {Lore:['[{\"text\":\"\u00A79 \",\"italic\":false}]','[{\"text\":\"\u00A77Quality: \u00A79" + "" + statsjsonobject.get("Solid Shield Name").getAsString() + "\",\"italic\":false}]','[{\"text\":\"\u00A77When in Off Hand:\",\"italic\":false}]','[{\"text\":\"\u00A7c \u00A79+" + statsjsonobject.get("Solid Shield Positive Knockback Resistance Display").getAsString() + " Knockback Resistance\",\"italic\":false}]']}")); repeat = false; } else { repeat = true; } } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(2)).remove(1); _player.containerMenu.broadcastChanges(); } if (entity instanceof ServerPlayer _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) { ((Slot) _slots.get(1)).remove(1); _player.containerMenu.broadcastChanges(); } { boolean _setval = true; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } new Object() { private int ticks = 0; private float waitTicks; private LevelAccessor world; public void start(LevelAccessor world, int waitTicks) { this.waitTicks = waitTicks; MinecraftForge.EVENT_BUS.register(this); this.world = world; } @SubscribeEvent public void tick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.ticks += 1; if (this.ticks >= this.waitTicks) run(); } } private void run() { { boolean _setval = false; entity.getCapability(QualityEquipmentModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { capability.successhammer2 = _setval; capability.syncPlayerVariables(entity); }); } MinecraftForge.EVENT_BUS.unregister(this); } }.start(world, (int) 3.5); } } catch (IOException e) { e.printStackTrace(); } } } }
  4. Hey, I'm having the following issue with my mod: Whenever I Include the client/server/world tick events in my code, It will work for a bit but then crash when I try it with something else that has the tick event. Here is the crash log: ---- Minecraft Crash Report ---- // Surprise! Haha. Well, this is awkward. Time: 2022-09-26 19:12:48 Description: Unexpected error java.lang.ClassCastException: class net.qualityequipment.procedures.TakenslotresultProcedure$3 cannot be cast to class net.qualityequipment.procedures.TakenslotresultProcedure$1 (net.qualityequipment.procedures.TakenslotresultProcedure$3 and net.qualityequipment.procedures.TakenslotresultProcedure$1 are in module quality_equipment@1.0.5 of loader 'TRANSFORMER' @79e66b2f) at net.qualityequipment.procedures.___tick_ClientTickEvent.invoke(.dynamic) ~[%23188!/:?] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23107!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23107!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23107!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPreClientTick(ForgeEventFactory.java:798) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23182%23189!/:?] {re:classloading} at net.minecraft.client.Minecraft.tick(Minecraft.java:1718) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1078) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:700) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.1.1.jar%2395!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.qualityequipment.procedures.___tick_ClientTickEvent.invoke(.dynamic) ~[%23188!/:?] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23107!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23107!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23107!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPreClientTick(ForgeEventFactory.java:798) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23182%23189!/:?] {re:classloading} -- Affected level -- Details: All players: 1 total; [LocalPlayer['Dev'/133, l='ClientLevel', x=451.88, y=77.00, z=476.00]] Chunk stats: 289, 157 Level dimension: minecraft:overworld Level spawn location: World: (192,72,176), Section: (at 0,8,0 in 12,4,11; chunk contains blocks 192,-64,176 to 207,319,191), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511) Level time: 772728 game time, 184654 day time Server brand: forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:450) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2278) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:722) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.1.1.jar%2395!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23108!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} -- Last reload -- Details: Reload number: 1 Reload reason: initial Finished: Yes Packs: Default, Mod Resources -- System Details -- Details: Minecraft Version: 1.19.2 Minecraft Version ID: 1.19.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 17.0.4.1, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 1031423184 bytes (983 MiB) / 2126512128 bytes (2028 MiB) up to 4278190080 bytes (4080 MiB) CPUs: 6 Processor Vendor: GenuineIntel Processor Name: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz Identifier: Intel64 Family 6 Model 158 Stepping 13 Microarchitecture: Coffee Lake Frequency (GHz): 3.70 Number of physical packages: 1 Number of physical CPUs: 6 Number of logical CPUs: 6 Graphics card #0 name: Radeon RX 580 Series Graphics card #0 vendor: Advanced Micro Devices, Inc. (0x1002) Graphics card #0 VRAM (MB): 4095.00 Graphics card #0 deviceId: 0x67df Graphics card #0 versionInfo: DriverVersion=30.0.15021.1001 Memory slot #0 capacity (MB): 8192.00 Memory slot #0 clockSpeed (GHz): 2.13 Memory slot #0 type: DDR4 Memory slot #1 capacity (MB): 8192.00 Memory slot #1 clockSpeed (GHz): 2.13 Memory slot #1 type: DDR4 Virtual memory max (MB): 28601.90 Virtual memory used (MB): 22510.93 Swap memory total (MB): 12288.00 Swap memory used (MB): 101.61 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump Launched Version: MOD_DEV Backend library: LWJGL version 3.3.1 build 7 Backend API: Radeon RX 580 Series GL version 3.2.14800 Core Profile Forward-Compatible Context 22.4.1 30.0.15021.1001, ATI Technologies Inc. Window size: 854x480 GL Caps: Using framebuffer using OpenGL 3.2 GL debug messages: Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge' Type: Integrated Server (map_client.txt) Graphics mode: fast Resource Packs: Current Language: English (US) CPU: 6x Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz Server Running: true Player Count: 1 / 8; [ServerPlayer['Dev'/133, l='ServerLevel[New World]', x=451.88, y=77.00, z=476.00]] Data Packs: vanilla, mod:forge, mod:quality_equipment (incompatible) World Generation: Stable ModLauncher: 10.0.8+10.0.8+main.0ef7e830 ModLauncher launch target: forgeclientuserdev ModLauncher naming: mcp ModLauncher services: mixin-0.8.5.jar mixin PLUGINSERVICE eventbus-6.0.3.jar eventbus PLUGINSERVICE fmlloader-1.19.2-43.1.1.jar slf4jfixer PLUGINSERVICE fmlloader-1.19.2-43.1.1.jar object_holder_definalize PLUGINSERVICE fmlloader-1.19.2-43.1.1.jar runtime_enum_extender PLUGINSERVICE fmlloader-1.19.2-43.1.1.jar capability_token_subclass PLUGINSERVICE accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE fmlloader-1.19.2-43.1.1.jar runtimedistcleaner PLUGINSERVICE modlauncher-10.0.8.jar mixin TRANSFORMATIONSERVICE modlauncher-10.0.8.jar fml TRANSFORMATIONSERVICE FML Language Providers: minecraft@1.0 lowcodefml@null javafml@null Mod List: forge-1.19.2-43.1.1_mapped_official_1.19.2-recomp.|Minecraft |minecraft |1.19.2 |DONE |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f |Forge |forge |43.1.1 |DONE |Manifest: NOSIGNATURE main |Quality Equipment |quality_equipment |1.0.5 |DONE |Manifest: NOSIGNATURE Crash Report UUID: b9a681b6-3d8d-4d99-8ff5-15ae20336b6f FML: 43.1 Forge: net.minecraftforge:43.1.1
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.