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();
}
}
}
}