From 653a0f2d5aaa027a8fc79e6d7caef24561012730 Mon Sep 17 00:00:00 2001 From: gottsch Date: Sat, 14 Aug 2021 18:11:08 -0400 Subject: [PATCH 01/19] charms initial commit --- gradle.properties | 2 +- .../someguyssoftware/treasure2/Treasure.java | 2 +- .../capability/TreasureCapabilities.java | 4 + .../treasure2/item/CoinItem.java | 74 ++++++++----------- .../treasure2/item/KeyItem.java | 5 +- .../treasure2/item/LockItem.java | 2 +- .../treasure2/item/TreasureItems.java | 9 ++- src/main/resources/META-INF/mods.toml | 2 +- update.json | 7 +- 9 files changed, 53 insertions(+), 54 deletions(-) diff --git a/gradle.properties b/gradle.properties index 67686ae18..b6d9eab5f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ package_group=someguyssoftware.treasure2 # use alpha, beta, or v (for version) mod_version_type=v -mod_version=1.5.0 +mod_version=1.6.0 #versions mc_version=1.16.5 diff --git a/src/main/java/com/someguyssoftware/treasure2/Treasure.java b/src/main/java/com/someguyssoftware/treasure2/Treasure.java index 9275fcf2e..77cec198b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/Treasure.java +++ b/src/main/java/com/someguyssoftware/treasure2/Treasure.java @@ -54,7 +54,7 @@ public class Treasure implements IMod { // constants public static final String MODID = "treasure2"; protected static final String NAME = "Treasure2"; - protected static final String VERSION = "1.5.0"; + protected static final String VERSION = "1.6.0"; protected static final String UPDATE_JSON_URL = "https://raw.githubusercontent.com/gottsch/gottsch-minecraft-Treasure/1.16.5-master/update.json"; public static Treasure instance; diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java b/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java index a1b23c84c..288884648 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java @@ -37,11 +37,15 @@ public class TreasureCapabilities { @CapabilityInject(IKeyRingCapability.class) public static Capability KEY_RING_CAPABILITY = null; + @CapabilityInject(ICharmableCapability.class) + public static Capability CHARMABLE_CAPABILITY = null; + /** * */ public static void register() { CapabilityManager.INSTANCE.register(IDurabilityCapability.class, new DurabilityCapabilityStorage(), DurabilityCapability::new); CapabilityManager.INSTANCE.register(IKeyRingCapability.class, new KeyRingCapabilityStorage(), KeyRingCapability::new); + CapabilityManager.INSTANCE.register(ICharmableCapability.class, new CharmableCapabilityStorage(), CharmableCapability::new); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java index b3b95f1dc..c97aa6f90 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.Random; import com.someguyssoftware.gottschcore.block.BlockContext; @@ -30,7 +31,6 @@ import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.loot.LootContext; import net.minecraft.loot.LootParameterSets; import net.minecraft.loot.LootParameters; @@ -48,13 +48,10 @@ * @author Mark Gottschling on Sep 13, 2014 * */ -public class CoinItem extends ModItem { +public class CoinItem extends ModItem implements IWishable { private static final int MAX_CUSTOM_STACK_SIZE = 64; public static final int MAX_STACK_SIZE = 8; - // TODO move to IWishable when added - public static final String DROPPED_BY_KEY = "droppedBy"; - private Coins coin; /** @@ -113,8 +110,14 @@ public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entityItem) { Random random = new Random(); for (int itemIndex = 0; itemIndex < entityItemStack.getCount(); itemIndex++) { // generate an item for each item in the stack - generateLootItem(world, random, entityItem, coords); + Optional lootStack = generateLoot(world, random, entityItem.getItem(), coords); + if (lootStack.isPresent()) { + // spawn the item + InventoryHelper.dropItemStack(world, (double)coords.getX(), (double)coords.getY()+1, (double)coords.getZ(), stack); + } } + // remove the item entity + entityItem.remove(); return true; } } @@ -126,10 +129,11 @@ public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entityItem) { * * @param world * @param random - * @param entityItem + * @param itemStack * @param coords */ - private void generateLootItem(World world, Random random, ItemEntity entityItem, ICoords coords) { + @Override + public Optional generateLoot(World world, Random random, ItemStack itemStack, ICoords coords) { List lootTables = new ArrayList<>(); // determine coin type @@ -142,15 +146,19 @@ else if (getCoin() == Coins.GOLD) { lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.RARE)); } - ItemStack stack = null; + // TODO most of this seems repeated from IChestGenerator. Make a common class/methods + + ItemStack outputStack = null; // handle if loot tables is null or size = 0. return an item (apple) to ensure continuing functionality if (lootTables == null || lootTables.size() == 0) { // TODO change to a randomized treasure key - stack = new ItemStack(Items.APPLE); +// stack = new ItemStack(Items.APPLE); + List keys = new ArrayList<>(TreasureItems.keys.get((getCoin() == Coins.SILVER) ? Rarity.UNCOMMON : Rarity.SCARCE)); + outputStack = new ItemStack(keys.get(random.nextInt(keys.size()))); } else { // attempt to get the player who dropped the coin - ItemStack coinItem = entityItem.getItem(); + ItemStack coinItem = itemStack; CompoundNBT nbt = coinItem.getTag(); LOGGER.debug("item as a tag"); PlayerEntity player = null; @@ -173,7 +181,7 @@ else if (getCoin() == Coins.GOLD) { // select a table shell LootTableShell tableShell = lootTables.get(RandomHelper.randomInt(random, 0, lootTables.size()-1)); if (tableShell.getResourceLocation() == null) { - return; + return Optional.empty(); } // get the vanilla table from shell @@ -196,44 +204,20 @@ else if (getCoin() == Coins.GOLD) { // geneate loot from pools lootPool.addRandomItems(itemStacks::add, lootContext); } - - // TODO add back when inject loot tables are working + // get effective rarity -// Rarity effectiveRarity = Treasure.LOOT_TABLE_MASTER.getEffectiveRarity(tableShell, (getCoin() == Coins.SILVER) ? Rarity.UNCOMMON : Rarity.SCARCE); -// LOGGER.debug("coin: using effective rarity -> {}", effectiveRarity); -// -// // get all injected loot tables -// LOGGER.debug("coin: searching for injectable tables for category ->{}, rarity -> {}", tableShell.getCategory(), effectiveRarity); -// Optional> injectLootTableShells = buildInjectedLootTableList(tableShell.getCategory(), effectiveRarity); -// if (injectLootTableShells.isPresent()) { -// LOGGER.debug("coin: found injectable tables for category ->{}, rarity -> {}", tableShell.getCategory(), effectiveRarity); -// LOGGER.debug("coin: size of injectable tables -> {}", injectLootTableShells.get().size()); -// -// // attempt to get the player who dropped the coin -// ItemStack coinItem = entityItem.getItem(); -// NBTTagCompound nbt = coinItem.getTagCompound(); -// EntityPlayer player = null; -// if (nbt != null && nbt.hasKey(DROPPED_BY_KEY)) { -// player = world.getPlayerEntityByName(nbt.getString(DROPPED_BY_KEY)); -// if (player != null && LOGGER.isDebugEnabled()) { -// LOGGER.debug("coin dropped by player -> {}", player.getName()); -// } -// } -// itemStacks.addAll(getLootItems(world, random, injectLootTableShells.get(), getLootContext(world, player))); -// } + Rarity effectiveRarity = TreasureLootTableRegistry.getLootTableMaster().getEffectiveRarity(tableShell, (getCoin() == Coins.SILVER) ? Rarity.UNCOMMON : Rarity.SCARCE); + LOGGER.debug("coin: using effective rarity -> {}", effectiveRarity); + + // get all injected loot tables + injectLoot(world, random, itemStacks, tableShell.getCategory(), effectiveRarity, lootContext); // select one item randomly - stack = itemStacks.get(RandomHelper.randomInt(0, itemStacks.size()-1)); + outputStack = itemStacks.get(RandomHelper.randomInt(0, itemStacks.size()-1)); } - - // spawn the item - if (stack != null) { - InventoryHelper.dropItemStack(world, (double)coords.getX(), (double)coords.getY()+1, (double)coords.getZ(), stack); - } - // remove the item entity - entityItem.remove(); + return Optional.of(outputStack); } - + /** * @return the coin */ diff --git a/src/main/java/com/someguyssoftware/treasure2/item/KeyItem.java b/src/main/java/com/someguyssoftware/treasure2/item/KeyItem.java index 1fb8b6574..d169d4708 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/KeyItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/KeyItem.java @@ -52,10 +52,13 @@ import net.minecraft.util.SoundEvents; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextComponentUtils; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.util.text.event.HoverEvent; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; @@ -113,7 +116,7 @@ public KeyItem(String modID, String name, Item.Properties properties) { setCraftable(false); setSuccessProbability(90D); } - + @Override public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { DurabilityCapabilityProvider provider = new DurabilityCapabilityProvider(); diff --git a/src/main/java/com/someguyssoftware/treasure2/item/LockItem.java b/src/main/java/com/someguyssoftware/treasure2/item/LockItem.java index 6ea0f0de6..f736186bd 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/LockItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/LockItem.java @@ -103,7 +103,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List * Attempting to make a safe call for some performance enchancing mixin mods */ String keyList = getKeys().stream().map(e -> { - ITextComponent txt = e.getName(null); + ITextComponent txt = e.getName(new ItemStack(e)); return txt == null ? "" : txt.getString(); }).collect(Collectors.joining(",")); diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index 28de4479d..4adcecfff 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -19,6 +19,7 @@ */ package com.someguyssoftware.treasure2.item; +import java.util.List; import java.util.function.Supplier; import com.google.common.collect.ArrayListMultimap; @@ -127,7 +128,9 @@ public class TreasureItems { // swords public static Item SKULL_SWORD; - + + // key map + public static Multimap keys; // lock map public static Multimap locks; @@ -255,6 +258,10 @@ public static void registerItems(RegistryEvent.Register event) { KEY_RING = new KeyRingItem(Treasure.MODID, KeyID.KEY_RING_ID, new Item.Properties()); + keys = ArrayListMultimap.create(); + keys.put(WOOD_KEY.getRarity(), WOOD_KEY); + // TODO finish list + // LOCKS WOOD_LOCK = new LockItem(Treasure.MODID, LockID.WOOD_LOCK_ID, new Item.Properties(), new KeyItem[] {WOOD_KEY}) .setCategory(Category.ELEMENTAL) diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 0ff09ec97..163cc2dce 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -17,7 +17,7 @@ issueTrackerURL="https://github.com/gottsch/gottsch-minecraft-Treasure/issues" # modId="treasure2" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -version="1.5.0" #mandatory +version="1.6.0" #mandatory # A display name for the mod displayName="Treasure2" #mandatory diff --git a/update.json b/update.json index 989d52a78..c1c322e6f 100644 --- a/update.json +++ b/update.json @@ -1,12 +1,13 @@ { "homepage": "https://minecraft.curseforge.com/projects/treasure2", "promos": { - "1.16.5-latest": "1.5.0", - "1.16.5-recommended": "1.5.0" + "1.16.5-latest": "1.6.0", + "1.16.5-recommended": "1.6.0" }, "1.16.5": { "1.0.0": "Initial version release.", "1.0.1": "Fixed Ticking block entity on Bound Soul crash.\nFixed missing Loot Table error (for test.json).", - "1.5.0": "Added mist - Gravestones, Bound Souls, and Wither Tree's poison and wither mist.\nAdded Key Ring.\nAdded key merging ability.\nAdded treasure maps to other Treasure chests.\nUpdated bounding boxes of gravestones.\nFixed Well and Wither Tree regitries.\nAttempt to fix LockItem.appendHoverText initialization crash with some performance mods.\nUses Forge-36.2.0" + "1.5.0": "Added mist - Gravestones, Bound Souls, and Wither Tree's poison and wither mist.\nAdded Key Ring.\nAdded key merging ability.\nAdded treasure maps to other Treasure chests.\nUpdated bounding boxes of gravestones.\nFixed Well and Wither Tree regitries.\nAttempt to fix LockItem.appendHoverText initialization crash with some performance mods.\nUses Forge-36.2.0", + "1.6.0": "Charms" } } \ No newline at end of file From db7bd9ce2b630174f142a9c27d0a0cd6895c9e7c Mon Sep 17 00:00:00 2001 From: gottsch Date: Sat, 14 Aug 2021 18:13:05 -0400 Subject: [PATCH 02/19] charms initial commit --- .../CharmableCapabilityStorage.java | 61 ++++++++++++++ .../treasure2/item/IWishable.java | 80 +++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/item/IWishable.java diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java new file mode 100644 index 000000000..fb375242c --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java @@ -0,0 +1,61 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.capability; + +import com.someguyssoftware.treasure2.Treasure; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.INBT; +import net.minecraft.util.Direction; +import net.minecraftforge.common.capabilities.Capability; + +/** + * + * @author Mark Gottschling on Aug 14, 2021 + * + */ +public class CharmableCapabilityStorage implements Capability.IStorage { + private static final String CHARMS = "charms"; + private static final String CHARM = "charm"; + private static final String DATA = "data"; + + @Override + public INBT writeNBT(Capability capability, ICharmableCapability instance, Direction side) { + CompoundNBT nbt = new CompoundNBT(); + try { + nbt.putInt(CHARM, 0); + } catch (Exception e) { + Treasure.LOGGER.error("Unable to write state to NBT:", e); + } + return nbt; + } + + @Override + public void readNBT(Capability capability, ICharmableCapability instance, Direction side, + INBT nbt) { + if (nbt instanceof CompoundNBT) { + CompoundNBT tag = (CompoundNBT) nbt; + if (tag.contains(CHARM)) { +// instance.setCharmable(tag.getInt(CHARM)); + } + } + } + +} diff --git a/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java b/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java new file mode 100644 index 000000000..df0d9caa6 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java @@ -0,0 +1,80 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.item; + +import static com.someguyssoftware.treasure2.Treasure.LOGGER; + +import java.util.List; +import java.util.Optional; +import java.util.Random; + +import com.someguyssoftware.gottschcore.loot.LootTableShell; +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.loot.TreasureLootTableMaster2; +import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; + +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.world.World; + +/** + * @author Mark Gottschling on Aug 14, 2021 + * + */ +public interface IWishable { + public static final String DROPPED_BY_KEY = "droppedBy"; + + /** + * + * @param world + * @param random + * @param entityItem + * @param coords + */ + public Optional generateLoot(World world, Random random, ItemStack itemStack, ICoords coords); + + /** + * + * @param world + * @param random + * @param itemStacks + * @param category + * @param rarity + * @param lootContext + */ + default public void injectLoot(World world, Random random, List itemStacks, String category, Rarity rarity, LootContext lootContext) { + Optional> injectLootTableShells = buildInjectedLootTableList(category, rarity); + if (injectLootTableShells.isPresent()) { + itemStacks.addAll(TreasureLootTableRegistry.getLootTableMaster().getInjectedLootItems(world, random, injectLootTableShells.get(), lootContext)); + } + } + + /** + * + * @param key + * @param rarity + * @return + */ + default public Optional> buildInjectedLootTableList(String key, Rarity rarity) { + return Optional.ofNullable(TreasureLootTableRegistry.getLootTableMaster().getLootTableByKeyRarity(TreasureLootTableMaster2.ManagedTableType.INJECT, key, rarity)); + } +} From a4681f8fcafc527560af6181b8692982f5692f20 Mon Sep 17 00:00:00 2001 From: gottsch Date: Mon, 16 Aug 2021 07:48:52 -0400 Subject: [PATCH 03/19] adding charms and charm capabilities --- .../capability/CharmableCapability.java | 272 +++++++++++++++++- .../CharmableCapabilityProvider.java | 50 ++++ .../capability/ICharmableCapability.java | 52 +++- .../treasure2/charm/Charm.java | 258 +++++++++++++++++ .../treasure2/charm/CharmEntity.java | 101 +++++++ .../treasure2/charm/HealingCharm.java | 108 +++++++ .../treasure2/charm/ICharm.java | 65 +++++ .../treasure2/charm/ICharmData.java | 41 +++ .../treasure2/charm/ICharmEntity.java | 35 +++ .../treasure2/charm/IHealing.java | 29 ++ .../charm/TreasureCharmRegistry.java | 88 ++++++ .../treasure2/charm/TreasureCharms.java | 72 +++++ .../treasure2/config/TreasureConfig.java | 4 +- .../treasure2/enums/Coins.java | 5 +- .../eventhandler/PlayerEventHandler.java | 12 + .../treasure2/item/CoinItem.java | 47 ++- .../treasure2/item/TreasureItems.java | 35 +++ .../assets/treasure2/lang/en_us.json | 10 +- .../treasure2/models/item/copper_coin.json | 21 ++ .../treasure2/models/item/test_coin.json | 21 ++ .../textures/item/coins/copper_coin.png | Bin 0 -> 1885 bytes 21 files changed, 1297 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/Charm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/ICharmData.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/IHealing.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java create mode 100644 src/main/resources/assets/treasure2/models/item/copper_coin.json create mode 100644 src/main/resources/assets/treasure2/models/item/test_coin.json create mode 100644 src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java index f4c33a1e8..3eedbec9b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java @@ -1,14 +1,61 @@ -/** +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . */ package com.someguyssoftware.treasure2.capability; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +import com.someguyssoftware.treasure2.charm.ICharmEntity; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; + /** + * The CharmableCapability provides any item with a Charm Inventory, which is a datatype of Map, List>. + * The Charm Inventory can support three types: FINITE, IMBUE or SOCKET. + * FINITE - Charms that are added on Item spawn and can not be renewed. Once expired, the charm is removed and the space is decremented. + * IMBUE - Charms that can be added via Books, or any IMBUING item. + * SOCKET - Charms that can be added to sockets via Coins or Gems, or any BINDING item. * @author Mark Gottschling on Apr 27, 2020 * */ public class CharmableCapability implements ICharmableCapability { -// private List charmInstances = new ArrayList<>(3); +// private LinkedList> charmEntities = new LinkedList<>(); + @SuppressWarnings("unchecked") + ArrayList[] charmEntities = (ArrayList[])new ArrayList[3]; + private boolean source; + private boolean bindable; + private boolean socketing; + private boolean socketable; + private boolean imbuing; + private boolean imbuable; + private boolean finite; + + private int socketSize; + private int imbueSize; + private int finiteSize; /** * @@ -16,17 +63,212 @@ public class CharmableCapability implements ICharmableCapability { public CharmableCapability() { } -// @Override -// public List getCharmInstances() { -// if (charmInstances == null) { -// this.charmInstances = new ArrayList<>(3); -// } -// return charmInstances; -// } -// -// @Override -// public void setCharmInstances(List instances) { -// this.charmInstances = instances; -// -// } + /** + * + * @param builder + */ + public CharmableCapability(Builder builder) { + init(); + this.finite = builder.finite; + this.finiteSize = finite ? Math.max(1, builder.finiteSize) : 0; + this.socketable = builder.socketable; + this.socketSize = socketable ? Math.max(1, builder.socketSize) : 0; + } + + protected void init() { + charmEntities[CharmInventoryType.FINITE.value] = new ArrayList<>(1); + charmEntities[CharmInventoryType.IMBUE.value] = new ArrayList<>(1); + charmEntities[CharmInventoryType.SOCKET.value] = new ArrayList<>(1); + } + + /** + * Convenience method. + * @param type + * @param entity + */ + @Override + public void add(CharmInventoryType type, ICharmEntity entity) { + charmEntities[type.value].add(entity); + } + + @Override + public boolean isCharmed() { + int size = 0; + for (List list : charmEntities) { + if (list != null) { + size += list.size(); + } + } + if (size > 0) { + return true; + } + return false; + } + + @Override + public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { + tooltip.add(new TranslationTextComponent("tooltip.label.charmed").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.label.charms").withStyle(TextFormatting.YELLOW, TextFormatting.BOLD)); + + // create header text for inventory type + appendHoverText(stack, world, tooltip, flag, CharmInventoryType.FINITE, false); + appendHoverText(stack, world, tooltip, flag, CharmInventoryType.IMBUE, true); + appendHoverText(stack, world, tooltip, flag, CharmInventoryType.SOCKET, true); + } + + private void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag, CharmInventoryType inventoryType, boolean titleFlag) { + List entityList = getCharmEntities()[inventoryType.value]; + if (entityList != null && !entityList.isEmpty()) { + // add title + if (titleFlag) { + tooltip.add(new TranslationTextComponent("tooltip.label.charm.type.finite", inventoryType.name()).withStyle(TextFormatting.DARK_GRAY)); + } + // add charms + for (ICharmEntity entity : entityList) { + entity.getCharm().appendHoverText(stack, world, tooltip, flag, entity); + } + } + } + + @Override + public List[] getCharmEntities() { + if (charmEntities == null) { + this.charmEntities = (ArrayList[])new ArrayList[3]; + } + return charmEntities; + } + + @Override + public void setCharmEntities(List[] entities) { + this.charmEntities = (ArrayList[]) entities; + } + + public boolean isSource() { + return source; + } + + public void setSource(boolean source) { + this.source = source; + } + + public boolean isBindable() { + return bindable; + } + + public void setBindable(boolean bindable) { + this.bindable = bindable; + } + + public boolean isSocketing() { + return socketing; + } + + public void setSocketing(boolean socketing) { + this.socketing = socketing; + } + + public boolean isSocketable() { + return socketable; + } + + public void setSocketable(boolean socketable) { + this.socketable = socketable; + } + + public boolean isImbuing() { + return imbuing; + } + + public void setImbuing(boolean imbuing) { + this.imbuing = imbuing; + } + + public boolean isImbuable() { + return imbuable; + } + + public void setImbuable(boolean imbuable) { + this.imbuable = imbuable; + } + + public boolean isFinite() { + return finite; + } + + public void setFinite(boolean finite) { + this.finite = finite; + } + + /** + * + * @author Mark Gottschling on Aug 15, 2021 + * + */ + public enum CharmInventoryType { + FINITE(0), + IMBUE(1), + SOCKET(2); + + int value; + + CharmInventoryType(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + public static class Builder { + private boolean source; + private boolean bindable; + private boolean socketing; + public boolean socketable; + private boolean imbuing; + private boolean imbuable; + public boolean finite; + + private int socketSize; + private int imbueSize; + public int finiteSize; + + public Builder() {} + + public Builder with(Consumer builder) { + builder.accept(this); + return this; + } + + public Builder socketable(boolean socketable, int size) { + this.socketable = socketable; + this.socketSize = size; + return this; + } + + public Builder socketing(boolean socketing) { + this.socketing = socketing; + return this; + } + + public Builder finite(boolean finite, int size) { + this.finite = finite; + this.finiteSize = size; + return this; + } + + public Builder imbue(boolean imbue, int size) { + this.imbuable = imbue; + this.imbueSize = size; + return this; + } + + public Builder imbuing(boolean imbuing) { + this.imbuing = imbuing; + return this; + } + public ICharmableCapability build() { + return new CharmableCapability(this); + } + } } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java new file mode 100644 index 000000000..ed0259c58 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java @@ -0,0 +1,50 @@ +package com.someguyssoftware.treasure2.capability; + +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.CHARMABLE_CAPABILITY; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.capabilities.ICapabilitySerializable; +import net.minecraftforge.common.util.LazyOptional; + +public class CharmableCapabilityProvider implements ICapabilityProvider, ICapabilitySerializable { + + // capabilities for item + private final ICharmableCapability instance;// = new CharmableCapability(); + + /** + * + */ + public CharmableCapabilityProvider() { + instance = new CharmableCapability(); + } + + /** + * + * @param capability + */ + public CharmableCapabilityProvider(ICharmableCapability capability) { + instance = capability; + } + + @SuppressWarnings("unchecked") + @Override + public LazyOptional getCapability(Capability capability, Direction side) { + if (capability == CHARMABLE_CAPABILITY) { + return (LazyOptional) LazyOptional.of(() -> instance); + } + return LazyOptional.empty(); + } + + @Override + public CompoundNBT serializeNBT() { + CompoundNBT tag = (CompoundNBT)CHARMABLE_CAPABILITY.getStorage().writeNBT(CHARMABLE_CAPABILITY, instance, null); + return tag; + } + + @Override + public void deserializeNBT(CompoundNBT nbt) { + CHARMABLE_CAPABILITY.getStorage().readNBT(CHARMABLE_CAPABILITY, instance, null, nbt); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java index ed3f883ec..21e91d22b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java @@ -1,14 +1,56 @@ -/** +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . */ package com.someguyssoftware.treasure2.capability; +import java.util.List; + +import com.someguyssoftware.treasure2.capability.CharmableCapability.CharmInventoryType; +import com.someguyssoftware.treasure2.charm.ICharmEntity; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.world.World; + /** - * Revamped Charm Capability - * @author Mark Gottschling on Jan 16, 2021 + * CharmableCapability is a capability that has an ICharmEntity inventory + * + * @author Mark Gottschling on Apr 27, 2020 * */ public interface ICharmableCapability { -// public List getCharmInstances(); -// public void setCharmInstances(List instances); + public List[] getCharmEntities(); + public void setCharmEntities(List[] entities); + + /** + * Convenience method. + * @param type + * @param entity + */ + void add(CharmInventoryType type, ICharmEntity entity); + + public boolean isCharmed(); + + public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); + + // an originator of a charm ie coins, gems +// public boolean isCharmSource(); +// public void setCharmSource(boolean isSource); } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java new file mode 100644 index 000000000..47d8dece7 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java @@ -0,0 +1,258 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.function.Consumer; + +import com.someguyssoftware.treasure2.enums.Rarity; + +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; + +/** + * @author Mark Gottschling on Apr 25, 2020 + */ +public abstract class Charm implements ICharm { + public static final int TICKS_PER_SECOND = 20; + + private ResourceLocation name; + private String type; + private int level; + private double maxValue; + private double maxPercent; + private int maxDuration; + private Rarity rarity; + private int priority; + + /* + * if multiple charms of the same type are being processed, only 1 should be updated/executed. + * ex. if multiple harvesting charms are held, only one should update. + */ + private boolean allowMultipleUpdates = false; + + /** + * + * @param builder + */ + protected Charm(Builder builder) { + this.name = builder.name; + this.type = builder.type; + this.level = builder.level; + this.maxValue = builder.value; + this.maxDuration = builder.duration.intValue(); + this.maxPercent = builder.percent; + this.rarity = builder.rarity; + this.priority = builder.priority; + this.allowMultipleUpdates = builder.allowMultipleUpdates; + } + + /** + * + */ + @Override + public ICharmEntity createEntity() { +// ICharmData data = new CharmData(); +// data.setValue(this.getMaxValue()); +// data.setPercent(this.getMaxPercent()); +// data.setDuration(this.getMaxDuration()); + ICharmEntity entity = new CharmEntity(this, this.getMaxValue(),this.getMaxDuration(), this.getMaxPercent()); + return entity; + } + + /** + * + * @param data + * @return + */ + @SuppressWarnings("deprecation") + public String getLabel(ICharmEntity entity) { + return new TranslationTextComponent("tooltip.charm." + getType().toLowerCase(), getLevel()).getString(); + + /* + * 1. check for mod item specific label + * 2. check for specific type prefix (levels 1-10) + * 3. check for general prefix (levels 1-10) + * OR + * 4. check for specific type suffix (levels 11+) + * 5. check for general suffix (levels 11+) + * ex. tooltip.charm.shielding.prefix.level[x], else look for tooltip.charm.prefix.level[x] + tooltip.charm.[type] + */ +// String tooltipKey = "tooltip.charm." + getName().toString().toLowerCase(); +// String label = I18n.translateToLocalFormatted(tooltipKey, +// String.valueOf(Math.toIntExact(Math.round(data.getValue()))), +// String.valueOf(Math.toIntExact(Math.round(getMaxValue())))); +// String prefix = ""; +// String suffix = ""; +// String type = ""; +// if (label.equals(tooltipKey)) { +// type = I18n.translateToLocalFormatted("tooltip.charm." + getType(), +// String.valueOf(Math.toIntExact(Math.round(data.getValue()))), +// String.valueOf(Math.toIntExact(Math.round(getMaxValue())))); +// if (this.getLevel() <= 10) { +// String prefixKey = "tooltip.charm." + getType() + ".prefix.level" + String.valueOf(this.getLevel()); +// prefix = I18n.translateToLocalFormatted(prefixKey); +// if (prefix.equals(prefixKey)) { +// prefix = I18n.translateToLocalFormatted("tooltip.charm.prefix.level" + String.valueOf(this.getLevel())); +// } +// label = prefix + " " + type; +// } +// else { +// String suffixKey = "tooltip.charm." + getType() + ".suffix.level" + String.valueOf(this.getLevel()); +// suffix = I18n.translateToLocalFormatted(suffixKey); +// if (suffix.equals(suffixKey)) { +// suffix = I18n.translateToLocalFormatted("tooltip.charm.suffix.level" + String.valueOf(this.getLevel())); +// } +// label = type + " " + suffix; +// } +// } +// // TODO redo this in future. +// return label + " " + getUsesGauge(data) + " " + (this.isAllowMultipleUpdates() ? (TextFormatting.DARK_PURPLE + "* combinable") : ""); + } + + @Override + public ResourceLocation getName() { + return name; + } + + @Override + public String getType() { + return type; + } + + @Override + public int getLevel() { + return level; + } + + @Override + public double getMaxValue() { + return maxValue; + } + + public double getMaxPercent() { + return maxPercent; + } + + @Override + public int getMaxDuration() { + return maxDuration; + } + + @Override + public Rarity getRarity() { + return rarity; + } + + @Override + public int getPriority() { + return priority; + } + + @Override + public boolean isAllowMultipleUpdates() { + return allowMultipleUpdates; + } + + /** + * + * @author Mark Gottschling on Dec 18, 2020 + * + */ + abstract public static class Builder { + public ResourceLocation name; + public String type; + public Integer level; + public Double value = 0.0; + public Double duration = 0.0; + public Double percent = 0.0; + public Rarity rarity = Rarity.COMMON; + public int priority = 10; + public boolean allowMultipleUpdates = false; + + /** + * + * @param name + * @param type + * @param level + * @param charmClass + */ + public Builder(ResourceLocation name, String type, Integer level) { + this.name = name; + this.type = type; + this.level = level; + } + + /** + * + * @return + */ + abstract public ICharm build(); + + /** + * + * @param builder + * @return + */ + public Builder with(Consumer builder) { + builder.accept(this); + return this; + } + + @Deprecated + public Builder withValue(Double value) { + this.value = value; + return Charm.Builder.this; + } + + public Builder withDuration(Double duration) { + this.duration = duration; + return Charm.Builder.this; + } + + public Builder withPercent(Double percent) { + this.percent = percent; + return Charm.Builder.this; + } + + public Builder withRarity(Rarity rarity) { + this.rarity = rarity; + return Charm.Builder.this; + } + + public Builder withPriority(int priority) { + this.priority = priority; + return Charm.Builder.this; + } + + public Builder withAllowMultipleUpdates(boolean allow) { + this.allowMultipleUpdates = allow; + return Charm.Builder.this; + } + } + + + @Override + public String toString() { + return "Charm [name=" + name + ", type=" + type + ", level=" + level + ", maxValue=" + maxValue + + ", maxPercent=" + maxPercent + ", maxDuration=" + maxDuration + ", rarity=" + rarity + ", priority=" + + priority + ", allowMultipleUpdates=" + allowMultipleUpdates + "]"; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java new file mode 100644 index 000000000..2d1e76a8e --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java @@ -0,0 +1,101 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +public class CharmEntity implements ICharmEntity { + private ICharm charm; + private double value; + private int duration; + private double percent; + + /** + * + */ + public CharmEntity() { } + + /** + * + * @param charm + * @param value + * @param duration + * @param percent + */ + public CharmEntity(ICharm charm, double value, int duration, double percent) { + setCharm(charm); + setValue(value); + setDuration(duration); + setPercent(percent); + } + + @Override + public ICharm getCharm() { + return charm; + } + + @Override + public void setCharm(ICharm charm) { + this.charm = charm; + } + + @Deprecated + @Override + public ICharmData getData() { + // TODO Auto-generated method stub + return null; + } + + @Deprecated + @Override + public void setData(ICharmData data) { + // TODO Auto-generated method stub + + } + + public double getValue() { + return value; + } + + public void setValue(double value) { + this.value = value; + } + + public int getDuration() { + return duration; + } + + public void setDuration(int duration) { + this.duration = duration; + } + + public double getPercent() { + return percent; + } + + public void setPercent(double percent) { + this.percent = percent; + } + + @Override + public String toString() { + return "CharmEntity [charm=" + charm + ", value=" + value + ", duration=" + duration + ", percent=" + percent + + "]"; + } + +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java new file mode 100644 index 000000000..b22e97ad8 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java @@ -0,0 +1,108 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class HealingCharm extends Charm implements IHealing { + private static String HEALING = "healing"; + private static float HEAL_RATE = 1F; + + HealingCharm(Builder builder) { + super(builder); + } + + /** + * + */ + @Override + public float getHealRate() { + return HEAL_RATE; + } + + /** + * + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmData data) { + boolean result = false; + if (world.getGameTime() % 20 == 0) { + if (event instanceof LivingUpdateEvent) { + if (data.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { + float amount = Math.min(getHealRate(), player.getMaxHealth() - player.getHealth()); + player.setHealth(MathHelper.clamp(player.getHealth() + amount, 0.0F, player.getMaxHealth())); + data.setValue(MathHelper.clamp(data.getValue() - amount, 0D, data.getValue())); + // Treasure.logger.debug("new data -> {}", data); + result = true; + } + } + } + return result; + } + + /** + * + */ + @SuppressWarnings("deprecation") + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.healing_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + /** + * + */ + @Override + public CompoundNBT writeToNBT(CompoundNBT nbt) { + try { + nbt.putString("name", this.getName().toString()); + } + catch(Exception e) { + Treasure.LOGGER.error("Unable to write state to NBT:", e); + } + return nbt; + } + + /** + * + * @author Mark Gottschling on Aug 15, 2021 + * + */ + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(HEALING + level), HEALING, level); + } + + @Override + public ICharm build() { + return new HealingCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java new file mode 100644 index 000000000..75cf3ff91 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java @@ -0,0 +1,65 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.enums.Rarity; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.world.World; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Jan 16, 2021 + * + */ +public interface ICharm { + + public ResourceLocation getName(); + public String getType(); + public int getLevel(); + public double getMaxValue(); + public int getMaxDuration(); + public double getMaxPercent(); + public Rarity getRarity(); + public int getPriority(); + boolean isAllowMultipleUpdates(); + + /** + * + */ + ICharmEntity createEntity(); + + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmData data); + + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity); + + public CompoundNBT writeToNBT(CompoundNBT nbt); + +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharmData.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmData.java new file mode 100644 index 000000000..9525dfca9 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmData.java @@ -0,0 +1,41 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import net.minecraft.nbt.CompoundNBT; + +/** + * @author Mark Gottschling on Apr 27, 2020 + * + */ +@Deprecated +public interface ICharmData { + public double getValue(); + public void setValue(double value); + + public int getDuration(); + public void setDuration(int duration); + + public double getPercent(); + public void setPercent(double percent); + + public CompoundNBT writeToNBT(CompoundNBT nbt); + public void readFromNBT(CompoundNBT tag); +} \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java new file mode 100644 index 000000000..13ae62b62 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java @@ -0,0 +1,35 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +/** + * + * @author Mark Gottschling on Jan 16, 2021 + * + */ +public interface ICharmEntity { + ICharm getCharm(); + + void setCharm(ICharm charm); + + ICharmData getData(); + + void setData(ICharmData data); +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/IHealing.java b/src/main/java/com/someguyssoftware/treasure2/charm/IHealing.java new file mode 100644 index 000000000..3af27390f --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/IHealing.java @@ -0,0 +1,29 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +/** + * + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public interface IHealing { + public float getHealRate(); +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java new file mode 100644 index 000000000..89f5f4313 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java @@ -0,0 +1,88 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import net.minecraft.util.ResourceLocation; + +/** + * + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class TreasureCharmRegistry { + private static final Map REGISTRY = new HashMap<>(); + private static final Map> REGISTRY_BY_LEVEL = new HashMap<>(); + + /** + * + * @param charm + */ + public static void register(ICharm charm) { + if (!REGISTRY.containsKey(charm.getName())) { + REGISTRY.put(charm.getName(), charm); + } + if (!REGISTRY_BY_LEVEL.containsKey(Integer.valueOf(charm.getLevel()))) { + List charmList = new ArrayList<>(); + charmList.add(charm); + REGISTRY_BY_LEVEL.put(Integer.valueOf(charm.getLevel()), charmList); + } + else { + REGISTRY_BY_LEVEL.get(Integer.valueOf(charm.getLevel())).add(charm); + } + } + + /** + * + * @param name + * @return + */ + public static Optional get(ResourceLocation name) { + + if (REGISTRY.containsKey(name)) { + return Optional.of(REGISTRY.get(name)); + } + return Optional.empty(); + } + + /** + * @param level + * @return + */ + public static Optional> get(Integer level) { + if (REGISTRY_BY_LEVEL.containsKey(level)) { + return Optional.of(REGISTRY_BY_LEVEL.get(level)); + } + return Optional.empty(); + } + + /** + * + * @return + */ + public static List values() { + return (List) REGISTRY.values(); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java new file mode 100644 index 000000000..8451d83dc --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java @@ -0,0 +1,72 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import com.someguyssoftware.treasure2.enums.Rarity; + +/** + * + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class TreasureCharms { + public static final ICharm HEALING_1; + public static final ICharm HEALING_2; + public static final ICharm HEALING_3; + public static final ICharm HEALING_4; + + public static final ICharm HEALING_15; + + static { + HEALING_1 = new HealingCharm.Builder(1).with($ -> { + $.value = 20.0; + $.allowMultipleUpdates = true; + }) .build(); + + HEALING_2 = new HealingCharm.Builder(2).with($ -> { + $.value = 40.0; + $.allowMultipleUpdates = true; + }) .build(); + + HEALING_3 = new HealingCharm.Builder(3).with($ -> { + $.value = 60.0; + $.allowMultipleUpdates = true; + }) .build(); + + HEALING_4 = new HealingCharm.Builder(4).with($ -> { + $.value = 80.0; + $.allowMultipleUpdates = true; + $.rarity = Rarity.UNCOMMON; + }) .build(); + + HEALING_15 = new HealingCharm.Builder(5).with($ -> { + $.value = 300.0; + $.allowMultipleUpdates = true; + $.rarity = Rarity.EPIC; + }) .build(); + + TreasureCharmRegistry.register(HEALING_1); + TreasureCharmRegistry.register(HEALING_2); + TreasureCharmRegistry.register(HEALING_3); + TreasureCharmRegistry.register(HEALING_4); + + TreasureCharmRegistry.register(HEALING_15); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java index 9d3c35e21..876c38aa3 100644 --- a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java +++ b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java @@ -106,7 +106,7 @@ public TreasureConfig(IMod mod) { } public static class ItemID { - + public static final String COPPER_COIN_ID = "copper_coin"; public static final String SILVER_COIN_ID = "silver_coin"; public static final String GOLD_COIN_ID = "gold_coin"; public static final String SAPPHIRE_ID = "sapphire"; @@ -118,7 +118,7 @@ public static class ItemID { public static final String WITHER_ROOT_ITEM_ID = "wither_root_item"; public static final String SKELETON_ITEM_ID = "skeleton"; public static final String EYE_PATCH_ID = "eye_patch"; - public static final String SPANISH_MOSS_ITEM_ID = "spanish_moss_item"; + public static final String SPANISH_MOSS_ITEM_ID = "spanish_moss_item"; } public static class LockID { diff --git a/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java b/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java index e962722e8..9cbfebc49 100644 --- a/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java +++ b/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java @@ -14,8 +14,9 @@ * */ public enum Coins implements IEnum { - SILVER(0, "Silver Coin"), - GOLD(1, "Gold Coin"); + COPPER(0, "Copper Coin"), + SILVER(1, "Silver Coin"), + GOLD(2, "Gold Coin"); private static final Map codes = new HashMap(); private static final Map values = new HashMap(); diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java index 83b5d80fb..53e305967 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java @@ -7,8 +7,13 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.event.ItemAttributeModifierEvent; import net.minecraftforge.event.entity.item.ItemTossEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -40,4 +45,11 @@ public void onTossCoinEvent(ItemTossEvent event) { stack.setTag(nbt); } } + + @SubscribeEvent + public void onItemInfo(ItemTooltipEvent event) { + if (event.getItemStack().getItem() == Items.EMERALD) { + event.getToolTip().add(new TranslationTextComponent("tooltip.label.coin").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + } + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java index c97aa6f90..61137445d 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java @@ -19,9 +19,13 @@ import com.someguyssoftware.gottschcore.spatial.ICoords; import com.someguyssoftware.gottschcore.world.WorldInfo; import com.someguyssoftware.treasure2.block.IWishingWellBlock; +import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; import com.someguyssoftware.treasure2.config.TreasureConfig; import com.someguyssoftware.treasure2.enums.Coins; import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.item.TreasureItems; import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; import net.minecraft.block.Blocks; @@ -42,6 +46,7 @@ import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.common.capabilities.ICapabilityProvider; /** * @@ -64,13 +69,48 @@ public CoinItem (String modID, String name, Item.Properties properties) { this.coin = Coins.GOLD; } + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + CharmableCapabilityProvider provider = new CharmableCapabilityProvider(); + return provider; + } + /** * */ @Override public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { - super.appendHoverText(stack, worldIn, tooltip, flagIn); + super.appendHoverText(stack, worldIn, tooltip, flagIn); + // standard coin info tooltip.add(new TranslationTextComponent("tooltip.label.coin").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + // charmable info + ICharmableCapability cap = getCap(stack); + if (cap.isCharmed()) { + cap.appendHoverText(stack, worldIn, tooltip, flagIn); + } + } + + /** + * Convenience method. + * @param stack + * @return + */ + public ICharmableCapability getCap(ItemStack stack) { + return stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY, null).orElseThrow(IllegalStateException::new); + } + + /** + * + */ + @Override + public boolean isFoil(ItemStack stack) { + ICharmableCapability cap = getCap(stack); + if (cap.isCharmed()) { + return true; + } + else { + return false; + } } /** @@ -137,7 +177,10 @@ public Optional generateLoot(World world, Random random, ItemStack it List lootTables = new ArrayList<>(); // determine coin type - if (getCoin() == Coins.SILVER) { + if (getCoin() == Coins.COPPER) { + lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.COMMON)); + } + else if (getCoin() == Coins.SILVER) { lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.UNCOMMON)); lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.SCARCE)); } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index 4adcecfff..e90098c92 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -27,6 +27,12 @@ import com.someguyssoftware.gottschcore.item.ModItem; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.block.TreasureBlocks; +import com.someguyssoftware.treasure2.capability.CharmableCapability; +import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.TreasureCharms; +import com.someguyssoftware.treasure2.capability.CharmableCapability.CharmInventoryType; import com.someguyssoftware.treasure2.config.TreasureConfig; import com.someguyssoftware.treasure2.config.TreasureConfig.KeyID; import com.someguyssoftware.treasure2.config.TreasureConfig.LockID; @@ -44,9 +50,12 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.SwordItem; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.ColorHandlerEvent; +import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -109,6 +118,7 @@ public class TreasureItems { public static LockItem WITHER_LOCK; // coins + public static Item COPPER_COIN; public static Item SILVER_COIN; public static Item GOLD_COIN; @@ -118,6 +128,9 @@ public class TreasureItems { public static Item WHITE_PEARL; public static Item BLACK_PEARL; + // charmed + public static CoinItem TEST_COIN; + // wither items public static Item WITHER_STICK_ITEM; public static Item WITHER_ROOT_ITEM; @@ -318,6 +331,7 @@ public static void registerItems(RegistryEvent.Register event) { // NOTE wither lock is a special and isn't used in the general locks list // COINS + COPPER_COIN = new CoinItem(Treasure.MODID, TreasureConfig.ItemID.COPPER_COIN_ID, new Item.Properties()).setCoin(Coins.COPPER); SILVER_COIN = new CoinItem(Treasure.MODID, TreasureConfig.ItemID.SILVER_COIN_ID, new Item.Properties()).setCoin(Coins.SILVER); GOLD_COIN = new CoinItem(Treasure.MODID, TreasureConfig.ItemID.GOLD_COIN_ID, new Item.Properties()); @@ -328,7 +342,26 @@ public static void registerItems(RegistryEvent.Register event) { // PEARLS WHITE_PEARL = new PearlItem(Treasure.MODID, TreasureConfig.ItemID.WHITE_PEARL_ID, new Item.Properties()).setPearl(Pearls.WHITE); BLACK_PEARL = new PearlItem(Treasure.MODID, TreasureConfig.ItemID.BLACK_PEARL_ID, new Item.Properties()).setPearl(Pearls.BLACK); + + // CHARMS + TEST_COIN = new CoinItem(Treasure.MODID, "test_coin", new Item.Properties()) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + ICharmableCapability cap = new CharmableCapability.Builder().with($ -> { + $.finite(true, 1); + $.imbue(true, 1); + $.socketable(true, 1); + }).build(); + // add charms + cap.add(CharmInventoryType.FINITE, TreasureCharms.HEALING_1.createEntity()); + cap.add(CharmInventoryType.IMBUE, TreasureCharms.HEALING_1.createEntity()); + cap.add(CharmInventoryType.SOCKET, TreasureCharms.HEALING_1.createEntity()); + stack.setHoverName(new StringTextComponent("Sal'andaar Stone's Third Eye")); + return new CharmableCapabilityProvider(cap); + } + }; + TEST_COIN.setCoin(Coins.COPPER); + // WITHER ITEMS WITHER_STICK_ITEM = new WitherStickItem(Treasure.MODID, TreasureConfig.ItemID.WITHER_STICK_ITEM_ID, TreasureBlocks.WITHER_BRANCH, new Item.Properties()); WITHER_ROOT_ITEM = new WitherRootItem(Treasure.MODID, TreasureConfig.ItemID.WITHER_ROOT_ITEM_ID, TreasureBlocks.WITHER_ROOT, new Item.Properties()); @@ -378,8 +411,10 @@ public static void registerItems(RegistryEvent.Register event) { PILFERERS_LOCK_PICK, THIEFS_LOCK_PICK, KEY_RING, + COPPER_COIN, SILVER_COIN, GOLD_COIN, + TEST_COIN, RUBY, SAPPHIRE, WHITE_PEARL, diff --git a/src/main/resources/assets/treasure2/lang/en_us.json b/src/main/resources/assets/treasure2/lang/en_us.json index e7098557e..5de0e2560 100644 --- a/src/main/resources/assets/treasure2/lang/en_us.json +++ b/src/main/resources/assets/treasure2/lang/en_us.json @@ -143,9 +143,13 @@ "tooltip.label.charmed":"Hold in hand or in coin pouch for buffs", "tooltip.label.charmed.adornment":"Hold in hand, coin pouch, or hotbar for buffs", "tooltip.label.charms":"Charms:", - "tooltip.label.charmable":"To charm, add charmed items to slots", - "tooltip.label.charmable.slots":"Slots: [%s/%s]", - + "tooltip.label.charmable.slots":"Charms Capacity: %s[available/activated/max.]", + "tooltip.label.charmable.slots.stats":"[%s/%s/%s]", + "tooltip.charm.healing":"Healing %s", + "tooltip.label.charm.type.finite":"[FINITE]", + "tooltip.label.charm.type.imbue":"[IMBUED]", + "tooltip.label.charm.type.socket":"[SOCKETED", + "tooltip.charm.healing_rate": "- heals 0.5 hearts/sec", "tooltip.label.max_locks":"Max Locks: %s", "tooltip.label.container_size":"Inventory Size: %s", diff --git a/src/main/resources/assets/treasure2/models/item/copper_coin.json b/src/main/resources/assets/treasure2/models/item/copper_coin.json new file mode 100644 index 000000000..fa1ab402f --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_coin.json @@ -0,0 +1,21 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "treasure2:item/coins/copper_coin" + }, + "display": { + "thirdperson_righthand": { + "translation": [ 0, 1, 0], + "scale":[ 0.25, 0.25, 0.25] + }, + "firstperson_righthand": { + "translation": [ 0, 2, 0], + "scale": [ 0.5, 0.5, 0.5 ] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 1, 0], + "scale":[ 0.25, 0.25, 0.25] + } + } +} diff --git a/src/main/resources/assets/treasure2/models/item/test_coin.json b/src/main/resources/assets/treasure2/models/item/test_coin.json new file mode 100644 index 000000000..fa1ab402f --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/test_coin.json @@ -0,0 +1,21 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "treasure2:item/coins/copper_coin" + }, + "display": { + "thirdperson_righthand": { + "translation": [ 0, 1, 0], + "scale":[ 0.25, 0.25, 0.25] + }, + "firstperson_righthand": { + "translation": [ 0, 2, 0], + "scale": [ 0.5, 0.5, 0.5 ] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 1, 0], + "scale":[ 0.25, 0.25, 0.25] + } + } +} diff --git a/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png new file mode 100644 index 0000000000000000000000000000000000000000..47aede3689d8ded99a06c05f9a24f44eede4cc2f GIT binary patch literal 1885 zcmV-j2cr0iP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O<|&b|Wba{bv=k1SA21~eWA?A!L-ILqy*%VH>>Q!<^aJ_l$)72{b1WAke)!O>ehOzlz1P@#ThV0~kkPO! zY9^abGZ=Uv$G8Ygv zbWxNO7cfTRMx)LuNh%m*DclUGbHW!Ents#tS17`BB@AVPF`8t*Xy&VrKWV1-GEzh~ zUbzA;9(4^EgSqj>C=fz@^X6xQ&$j8eclCo(1%rO3IU>Mpk7eTUbgM0yJPXEo$hCyX zXx#>oBKYRXEqs*GHhjx&(Iuv$l(rughP*bq$3xUPjSVUP_)F7O0Ha` zVw#*?WrPA}G= zHL9lx8rz8wJ4CSz+Aj+~Bd&|*yHXz*Bz*PqJ&*AODjvwIXI zqP%6#%z1}j^D1^t`8{0brGMGhvup7UTV_p)%T$g{Z}I&Ir}+UMv0=y@0+aLjA9s;c znn%TwVM=l(y$jGhC+Z&1mq0FQUVV50@Fg(wEubeEQm)f779Pjt0vp@zypq&nU$e%w zGT`8y(2ASpu>eb4b(9io4aXd-+2M+N#-k>7vMrsrHM)4SLef^mSp1`J+O-s{?Zt!nZtMe7Bv7arA71HJBd~|I&fE zd3sg|&xpRKFLhVHm*-gHRdE-~cdPmQc#+E=Nj8rxzmgB^U&VJ;fsy=Wo&9}8-yt;*P`{n` zyzJL)EUV9D_>HWPnd3o@2UU5pNLBY+5?!ec}kKNDA>e@wh=3 zB!1+&?D8Auvcm$;j2OAhJaL3rEcdY7!>nSc#M8tvMb#)@$h)j?-r}s*8mx0q{=!gE zTgh^r<_MBlLJDb!kkLRDHCTw#s*z$ML;DF2|FGjvlS?L76^tAUs6&P1_`(0+ceiF~ zYSK*#C4l}H+x{2@0=q!FY1`k&w%tAf{LjFZ*7et0!0adK&8`+Z0>azC#dTMc_khbC zAo`?BhU7?onnI}ryr0oG6@Z~zU|`Mdt+S8Q2OvjXE#CkKhrn2wve!M{9qjGx-!q;5 zegIb%a-2+Ul|Bp?)`{+#!^(@#ly673= zvhY8;L5#RG-+2BQs|inDzd>;giVIxy3~_3N0U1#dxFK*Clv=C*N4EL+UF?P=+E~FY zc=GxUL-)~}j7;Q&{F@J-um>W{^h6sg1_lNOhWSU1q42SJj|H0z*c9Rl8zxE<5)&o< zha1p+^d{q;OXnFhBxQ-x{Nwj8?CD_7rSm9h0XguHHRH?+$f*%I(9ktwP0HkECW-+7 Xu5)Un+LdLl00000NkvXXu0mjfJRpuo literal 0 HcmV?d00001 From d96942e2079779b65d1a3cd65d1d697a002536ad Mon Sep 17 00:00:00 2001 From: gottsch Date: Mon, 16 Aug 2021 13:49:57 +0000 Subject: [PATCH 04/19] feature/render refactor --- .../AbstractChestTileEntityRenderer.java | 94 ++++--------- .../CardboardBoxTileEntityRenderer.java | 66 +++++----- .../CauldronChestTileEntityRenderer.java | 62 +++++---- .../CompressorChestTileEntityRenderer.java | 108 ++++++++------- .../CrateChestTileEntityRenderer.java | 106 ++++++++------- .../ITreasureChestTileEntityRenderer.java | 75 ++++++++++- .../MilkCreateTileEntityRenderer.java | 124 ++++++++++-------- .../tileentity/SafeTileEntityRenderer.java | 6 +- .../WitherChestTileEntityRenderer.java | 4 +- .../WoodChestTileEntityRenderer.java | 1 - 10 files changed, 363 insertions(+), 283 deletions(-) diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java index 81cda077e..f4149d9ee 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java @@ -71,21 +71,31 @@ public void render(AbstractTreasureChestTileEntity tileEntity, float partialTick // push the current transformation matrix + normals matrix matrixStack.pushPose(); + // initial position (centered moved up) + updateTranslation(matrixStack); + // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position - final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.5, 0.5); - matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate + // final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.5, 0.5); + // matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate + + // setup scale matrixStack.scale(-1, -1, 1); - float f = getHorizontalAngle(facing); - matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); + + // adjust the scale of the model + updateScale(matrixStack); + + updateRotation(matrixStack, facing); + // float f = getHorizontalAngle(facing); + // matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); // TEST scale to half size to see if locks are rendered // matrixStack.scale(0.5F, 0.5F, 0.5F); // update the lid rotation - updateModelRotationAngles(tileEntity, partialTicks); + updateModelLidRotation(tileEntity, partialTicks); IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(model.getChestRenderType(getTexture())); @@ -128,73 +138,16 @@ public void renderLocks(AbstractTreasureChestTileEntity tileEntity, MatrixStack // of the block matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); - matrixStack.mulPose(Vector3f.YP.rotationDegrees(lockState.getSlot().getRotation())); - matrixStack.scale(getLocksScaleModifier(), getLocksScaleModifier(), getLocksScaleModifier()); + updateLockRotation(matrixStack, lockState); + // matrixStack.mulPose(Vector3f.YP.rotationDegrees(lockState.getSlot().getRotation())); + updateLockScale(matrixStack); + // matrixStack.scale(getLocksScaleModifier(), getLocksScaleModifier(), getLocksScaleModifier()); Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); matrixStack.popPose(); } } } - /** - * - * @param tileEntity - * @param partialTicks - */ - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { - float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; - lidRotation = 1.0F - lidRotation; - lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - model.getLid().xRot = -(lidRotation * (float) Math.PI / getAngleModifier()); - } - - /** - * Modifies the max angle that the lid can swing. - * The max swing angle by default is 180 degrees. The max swing angle is divided the modifier. - * Increasing the size of the modifier reduces the size of the max swing angle. - * Ex: - * Return 2.0 = 90 degrees - * Return 3.0 = 60 degrees - * Return 4.0 = 45 degrees - * - * @return - */ - public float getAngleModifier() { - return 2.0F; - } - - /** - * Modifies teh scale of the Lock item(s). - * Ranges from 0.0F to x.xF. - * Ex: - * Return 1.0F = full size - * Return 0.5 = half size - * - * @return - */ - public float getLocksScaleModifier() { - return 0.5F; - } - - /** - * Helper method since all my models face the opposite direction of vanilla models - * @param meta - * @return - */ - public int getHorizontalAngle(Direction facing) { - switch (facing) { - default: - case NORTH: - return 0; - case SOUTH: - return 180; - case WEST: - return 90; - case EAST: - return -90; - } - } - /** * @return the texture */ @@ -203,8 +156,7 @@ public ResourceLocation getTexture() { } /** - * @param texture - * the texture to set + * @param texture the texture to set */ public void setTexture(ResourceLocation texture) { this.texture = texture; @@ -213,16 +165,16 @@ public void setTexture(ResourceLocation texture) { /** * @return the model */ + @Override public ITreasureChestModel getModel() { return model; } /** - * @param model - * the model to set + * @param model the model to set */ + @Override public void setModel(ITreasureChestModel model) { this.model = model; } - } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java index 1453d4854..8abcb34ab 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java @@ -36,11 +36,6 @@ public CardboardBoxTileEntityRenderer(TileEntityRendererDispatcher tileEntityRen @Override public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { CardboardBoxTileEntity cte = (CardboardBoxTileEntity) tileEntity; -// float lidRotation = cte.prevLidAngle + (cte.lidAngle - cte.prevLidAngle) * partialTicks; -// lidRotation = 1.0F - lidRotation; -// lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; -// // NOTE positive rotation here (getLid() returns lidLeft property) -// getModel().getLid().zRot = (lidRotation * (float)Math.PI / getAngleModifier()); // update in the inner lid float innerLidRotation = cte.prevInnerLidAngle + (cte.innerLidAngle - cte.prevInnerLidAngle) * partialTicks; @@ -59,35 +54,46 @@ public float getAngleModifier() { return 0.8F; } - @Override - public void renderLocks(AbstractTreasureChestTileEntity te, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { - // Treasure.LOGGER.debug("====================================================================="); - if (te.getLockStates().isEmpty()) { - return; - } - - // render locks - for (LockState lockState : te.getLockStates()) { - if (lockState.getLock() != null) { - // convert lock to an item stack - ItemStack lockStack = new ItemStack(lockState.getLock()); + // @Override + // public void renderLocks(AbstractTreasureChestTileEntity te, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { + // // Treasure.LOGGER.debug("====================================================================="); + // if (te.getLockStates().isEmpty()) { + // return; + // } - matrixStack.pushPose(); + // // render locks + // for (LockState lockState : te.getLockStates()) { + // if (lockState.getLock() != null) { + // // convert lock to an item stack + // ItemStack lockStack = new ItemStack(lockState.getLock()); - // NOTE when rotating the item to match the face of chest, must adjust the - // amount of offset to the x,z axises and - // not rotate() the item - rotate() just spins it in place, not around the axis - // of the block - matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); + // matrixStack.pushPose(); + // // NOTE when rotating the item to match the face of chest, must adjust the + // // amount of offset to the x,z axises and + // // not rotate() the item - rotate() just spins it in place, not around the axis + // // of the block + // matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); +// // rotate the locks on the x axis to lay flat - matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis - matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. - matrixStack.scale(0.35F, 0.35F, 0.35F); - Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); - matrixStack.popPose(); + // matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis + // matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. + // matrixStack.scale(0.35F, 0.35F, 0.35F); + // Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); + // matrixStack.popPose(); - } - } + // } + // } + // } + + @Override + public void updateLockRotation(MatrixStack matrixStack, LockState lockState) { + matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis + matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. + } + + @Override + public float getLockScaleModifier() { + return 0.35F; } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java index b2e1ed9e6..119274472 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java @@ -39,34 +39,46 @@ public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity } @Override - public void renderLocks(AbstractTreasureChestTileEntity te, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { - // Treasure.LOGGER.debug("====================================================================="); - if (te.getLockStates().isEmpty()) { - return; - } + public void updateLockRotation(MatrixStack matrixStack, LockState lockState) { + // rotate the locks on the x axis to lay flat + matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis + matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. + } + + @Override + public float getLockScaleModifier() { + return 0.35F; + } - // render locks - for (LockState lockState : te.getLockStates()) { - if (lockState.getLock() != null) { - // convert lock to an item stack - ItemStack lockStack = new ItemStack(lockState.getLock()); + // @Override + // public void renderLocks(AbstractTreasureChestTileEntity te, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { + // // Treasure.LOGGER.debug("====================================================================="); + // if (te.getLockStates().isEmpty()) { + // return; + // } - matrixStack.pushPose(); + // // render locks + // for (LockState lockState : te.getLockStates()) { + // if (lockState.getLock() != null) { + // // convert lock to an item stack + // ItemStack lockStack = new ItemStack(lockState.getLock()); - // NOTE when rotating the item to match the face of chest, must adjust the - // amount of offset to the x,z axises and - // not rotate() the item - rotate() just spins it in place, not around the axis - // of the block - matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); + // matrixStack.pushPose(); - // rotate the locks on the x axis to lay flat - matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis - matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. - matrixStack.scale(0.35F, 0.35F, 0.35F); - Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); - matrixStack.popPose(); + // // NOTE when rotating the item to match the face of chest, must adjust the + // // amount of offset to the x,z axises and + // // not rotate() the item - rotate() just spins it in place, not around the axis + // // of the block + // matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); - } - } - } + // // rotate the locks on the x axis to lay flat + // matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis + // matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. + // matrixStack.scale(0.35F, 0.35F, 0.35F); + // Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); + // matrixStack.popPose(); + + // } + // } + // } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java index bb651a449..f3695590a 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java @@ -28,60 +28,72 @@ public CompressorChestTileEntityRenderer(TileEntityRendererDispatcher tileEntity setModel(new CompressorChestModel()); } - @Override - public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, - IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { - - if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { - return; // should never happen - } - - // TODO this block goes into method / use template pattern - World world = tileEntity.getLevel(); - boolean hasWorld = (world != null); - BlockState state = tileEntity.getBlockState(); - Direction facing = Direction.NORTH; - if (hasWorld) { - facing = state.getValue(StandardChestBlock.FACING); - } - - // push the current transformation matrix + normals matrix - matrixStack.pushPose(); - - // TODO this block goes into method / use template pattern - // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be - // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. - // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position - final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 0.75, 0.5); - matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate - matrixStack.scale(-1, -1, 1); - float f = getHorizontalAngle(facing); - matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); + // @Override + // public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, + // IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { + + // if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { + // return; // should never happen + // } + + // // TODO this block goes into method / use template pattern + // World world = tileEntity.getLevel(); + // boolean hasWorld = (world != null); + // BlockState state = tileEntity.getBlockState(); + // Direction facing = Direction.NORTH; + // if (hasWorld) { + // facing = state.getValue(StandardChestBlock.FACING); + // } + + // // push the current transformation matrix + normals matrix + // matrixStack.pushPose(); + + // // TODO this block goes into method / use template pattern + // // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be + // // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. + // // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position + // final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 0.75, 0.5); + // matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate + // matrixStack.scale(-1, -1, 1); + // float f = getHorizontalAngle(facing); + // matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); + + // // shrink the size of the chest by half + // matrixStack.scale(0.5F, 0.5F, 0.5F); + + // //////////////// custom lid code ///////////// + // updateModelRotationAngles(tileEntity, partialTicks); + // //////////////// end of lid code ////////////// + + // // TODO this block goes into method / use template pattern + // IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); + // getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); + // matrixStack.popPose(); + + // // TODO this block goes into method / use template pattern + // ////////////// render the locks ////////////////////////////////////// + // renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); + // // if (!te.getLockStates().isEmpty()) { + // // renderLocks(te, x, y, z); + // // } + // ////////////// end of render the locks ////////////////////////////////////// + + // } + @Override + public updateScale(MatrixStack matrixStack) { // shrink the size of the chest by half - matrixStack.scale(0.5F, 0.5F, 0.5F); - - //////////////// custom lid code ///////////// - updateModelRotationAngles(tileEntity, partialTicks); - //////////////// end of lid code ////////////// - - // TODO this block goes into method / use template pattern - IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); - getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); - matrixStack.popPose(); - - // TODO this block goes into method / use template pattern - ////////////// render the locks ////////////////////////////////////// - renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); - // if (!te.getLockStates().isEmpty()) { - // renderLocks(te, x, y, z); - // } - ////////////// end of render the locks ////////////////////////////////////// + matrixStack.scale(0.5F, 0.5F, 0.5F); + } + @Override + public updateTranslation(MatrixStack matrixStack) { + final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 0.75, 0.5); + matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); } @Override - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; lidRotation = 1.0F - lidRotation; lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java index 01d2f80a3..776038237 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java @@ -31,62 +31,76 @@ public CrateChestTileEntityRenderer(TileEntityRendererDispatcher tileEntityRende } @Override - public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, - IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { - - if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { - return; // should never happen - } - - // TODO this block goes into method / use template pattern - World world = tileEntity.getLevel(); - boolean hasWorld = (world != null); - BlockState state = tileEntity.getBlockState(); - Direction facing = Direction.NORTH; - if (hasWorld) { - facing = AbstractChestBlock.getFacing(state); - } - - // push the current transformation matrix + normals matrix - matrixStack.pushPose(); - - // TODO this block goes into method / use template pattern - // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be - // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. - // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position - final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.5, 0.5); - matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate - matrixStack.scale(-1, -1, 1); - float f = getHorizontalAngle(facing); - matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); - - // TODO this block goes into method / use template pattern - //////////////// custom lid code ///////////// + public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { CrateChestTileEntity cte = (CrateChestTileEntity) tileEntity; float latchRotation = cte.prevLatchAngle + (cte.latchAngle - cte.prevLatchAngle) * partialTicks; latchRotation = 1.0F - latchRotation; latchRotation = 1.0F - latchRotation * latchRotation * latchRotation; - ((CrateChestModel)getModel()).getLatch1().xRot = -(latchRotation * (float)Math.PI / 2.0F); + ((CrateChestModel)getModel()).getLatch1().xRot = -(latchRotation * (float)Math.PI / getAngleModifier()); float lidRotation = cte.prevLidAngle + (cte.lidAngle - cte.prevLidAngle) * partialTicks; lidRotation = 1.0F - lidRotation; lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - getModel().getLid().yRot = -(lidRotation * (float)Math.PI / 2.0F); + getModel().getLid().yRot = -(lidRotation * (float)Math.PI / getAngleModifier()); + } + +// @Override +// public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, +// IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { + +// if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { +// return; // should never happen +// } + +// // TODO this block goes into method / use template pattern +// World world = tileEntity.getLevel(); +// boolean hasWorld = (world != null); +// BlockState state = tileEntity.getBlockState(); +// Direction facing = Direction.NORTH; +// if (hasWorld) { +// facing = AbstractChestBlock.getFacing(state); +// } + +// // push the current transformation matrix + normals matrix +// matrixStack.pushPose(); + +// // TODO this block goes into method / use template pattern +// // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be +// // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. +// // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position +// final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.5, 0.5); +// matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate +// matrixStack.scale(-1, -1, 1); +// float f = getHorizontalAngle(facing); +// matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); - //////////////// end of lid code ////////////// +// // TODO this block goes into method / use template pattern +// //////////////// custom lid code ///////////// +// CrateChestTileEntity cte = (CrateChestTileEntity) tileEntity; +// float latchRotation = cte.prevLatchAngle + (cte.latchAngle - cte.prevLatchAngle) * partialTicks; +// latchRotation = 1.0F - latchRotation; +// latchRotation = 1.0F - latchRotation * latchRotation * latchRotation; +// ((CrateChestModel)getModel()).getLatch1().xRot = -(latchRotation * (float)Math.PI / 2.0F); + +// float lidRotation = cte.prevLidAngle + (cte.lidAngle - cte.prevLidAngle) * partialTicks; +// lidRotation = 1.0F - lidRotation; +// lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; +// getModel().getLid().yRot = -(lidRotation * (float)Math.PI / 2.0F); - // TODO this block goes into method / use template pattern - IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); - getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); - matrixStack.popPose(); +// //////////////// end of lid code ////////////// - // TODO this block goes into method / use template pattern - ////////////// render the locks ////////////////////////////////////// - renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); -// if (!te.getLockStates().isEmpty()) { -// renderLocks(te, x, y, z); -// } - ////////////// end of render the locks ////////////////////////////////////// +// // TODO this block goes into method / use template pattern +// IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); +// getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); +// matrixStack.popPose(); - } +// // TODO this block goes into method / use template pattern +// ////////////// render the locks ////////////////////////////////////// +// renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); +// // if (!te.getLockStates().isEmpty()) { +// // renderLocks(te, x, y, z); +// // } +// ////////////// end of render the locks ////////////////////////////////////// + +// } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java index f3cd13413..f63a1a545 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java @@ -16,6 +16,37 @@ public interface ITreasureChestTileEntityRenderer { void renderLocks(AbstractTreasureChestTileEntity tileEntity, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay); + /** + */ + default public void updateTranslation(MatrixStack matrixStack) { + // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be + // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. + // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position + final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.5, 0.5); + matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); + } + + default public void updateScale(MatrixStack matrixStack) { + matrixStack.scale(-1, -1, 1); + } + + default public void updateRotation(MatrixStack matrixStack, Direction direction) { + float angle = getHorizontalAngle(direction); + matrixStack.mulPose(Vector3f.YP.rotationDegrees(-angle)); + } + + /** + * + * @param tileEntity + * @param partialTicks + */ + default public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; + lidRotation = 1.0F - lidRotation; + lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; + model.getLid().xRot = -(lidRotation * (float) Math.PI / getAngleModifier()); + } + /** * * @param tileEntity @@ -32,7 +63,7 @@ default public Direction getDirection(TileEntity tileEntity) { /** * Helper method since all my models face the opposite direction of vanilla models - * @param meta + * @param facing * @return */ default public int getHorizontalAngle(Direction facing) { @@ -48,7 +79,49 @@ default public int getHorizontalAngle(Direction facing) { return -90; } } + + /** + * Modifies the max angle that the lid can swing. + * The max swing angle by default is 180 degrees. The max swing angle is divided the modifier. + * Increasing the size of the modifier reduces the size of the max swing angle. + * Ex: + * Return 0.8 = 225 degrees + * Return 1.0 = 180 degrees + * Return 2.0 = 90 degrees + * Return 3.0 = 60 degrees + * Return 4.0 = 45 degrees + * + * @return + */ + default public float getAngleModifier() { + return 2.0F; + } + /** + * Modifies teh scale of the Lock item(s). + * Ranges from 0.0F to x.xF. + * Ex: + * Return 1.0F = full size + * Return 0.5 = half size + * + * @return + */ + default public float getLocksScaleModifier() { + return 0.5F; + } + + default public void updateLockScale(MatrixStack matrixStack) { + matrixStack.scale(getLocksScaleModifier(), getLocksScaleModifier(), getLocksScaleModifier()); + } + + /** + * + * @param lockState + */ + default public void updateLockRotation(MatrixStack matrixStack, LockState lockState) { + matrixStack.mulPose(Vector3f.YP.rotationDegrees(lockState.getSlot().getRotation())); + } + /** * * @return diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java index 5e68dce2b..bc4ad360d 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java @@ -28,68 +28,80 @@ public MilkCreateTileEntityRenderer(TileEntityRendererDispatcher tileEntityRende setModel(new MilkCrateModel()); } - @Override - public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, - IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { - - if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { - return; // should never happen - } - - // TODO this block goes into method / use template pattern - World world = tileEntity.getLevel(); - boolean hasWorld = (world != null); - BlockState state = tileEntity.getBlockState(); - Direction facing = Direction.NORTH; - if (hasWorld) { - facing = state.getValue(StandardChestBlock.FACING); - } - - // push the current transformation matrix + normals matrix - matrixStack.pushPose(); - - // TODO this block goes into method / use template pattern - // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be - // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. - // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position - final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.15625F, 0.5); - matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate - matrixStack.scale(-1, -1, 1); - float f = getHorizontalAngle(facing); - matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); - - // shrink the size of the chest by half - matrixStack.scale(0.75F, 0.75F, 0.75F); - - //////////////// custom lid code ///////////// - updateModelRotationAngles(tileEntity, partialTicks); - //////////////// end of lid code ////////////// - - // TODO this block goes into method / use template pattern - IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); - getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); - matrixStack.popPose(); - - // TODO this block goes into method / use template pattern - ////////////// render the locks ////////////////////////////////////// - renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); - // if (!te.getLockStates().isEmpty()) { - // renderLocks(te, x, y, z); - // } - ////////////// end of render the locks ////////////////////////////////////// + // @Override + // public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, + // IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { + + // if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { + // return; // should never happen + // } + + // // TODO this block goes into method / use template pattern + // World world = tileEntity.getLevel(); + // boolean hasWorld = (world != null); + // BlockState state = tileEntity.getBlockState(); + // Direction facing = Direction.NORTH; + // if (hasWorld) { + // facing = state.getValue(StandardChestBlock.FACING); + // } + + // // push the current transformation matrix + normals matrix + // matrixStack.pushPose(); + + // // TODO this block goes into method / use template pattern + // // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be + // // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. + // // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position + // final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.15625F, 0.5); + // matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate + // matrixStack.scale(-1, -1, 1); + // float f = getHorizontalAngle(facing); + // matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); + + // // shrink the size of the chest by half + // matrixStack.scale(0.75F, 0.75F, 0.75F); + + // //////////////// custom lid code ///////////// + // updateModelRotationAngles(tileEntity, partialTicks); + // //////////////// end of lid code ////////////// + + // // TODO this block goes into method / use template pattern + // IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); + // getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); + // matrixStack.popPose(); + + // // TODO this block goes into method / use template pattern + // ////////////// render the locks ////////////////////////////////////// + // renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); + // // if (!te.getLockStates().isEmpty()) { + // // renderLocks(te, x, y, z); + // // } + // ////////////// end of render the locks ////////////////////////////////////// + + // } + + // @Override + // public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + // float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; + // lidRotation = 1.0F - lidRotation; + // lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; + // getModel().getLid().xRot = -(lidRotation * (float)Math.PI / 2.0F); + // } + @Override + public float getLocksScaleModifier() { + return 0.28F; } @Override - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { - float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; - lidRotation = 1.0F - lidRotation; - lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - getModel().getLid().xRot = -(lidRotation * (float)Math.PI / 2.0F); + public updateScale(MatrixStack matrixStack) { + // shrink the size of the chest by half + matrixStack.scale(0.75F, 0.75F, 0.75F); } @Override - public float getLocksScaleModifier() { - return 0.28F; + public updateTranslation(MatrixStack matrixStack) { + final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.15625F, 0.5); + matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java index ced78f29e..801c94446 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java @@ -22,14 +22,14 @@ public SafeTileEntityRenderer(TileEntityRendererDispatcher tileEntityRendererDis } @Override - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { SafeTileEntity ste = (SafeTileEntity) tileEntity; if (ste.isLidClosed) { float handleRotation = ste.prevHandleAngle + (ste.handleAngle - ste.prevHandleAngle) * partialTicks; handleRotation = 1.0F - handleRotation; handleRotation = 1.0F - handleRotation * handleRotation * handleRotation; - ((SafeModel)getModel()).getHandleA1().zRot = (handleRotation * (float)Math.PI / 2.0F); + ((SafeModel)getModel()).getHandleA1().zRot = (handleRotation * (float)Math.PI / getAngleModifier()); } else { // render handleB rotating around y-axis @@ -37,7 +37,7 @@ public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity float lidRotation = ste.prevLidAngle + (ste.lidAngle - ste.prevLidAngle) * partialTicks; lidRotation = 1.0F - lidRotation; lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - getModel().getLid().yRot = (lidRotation * (float)Math.PI / 2.0F); + getModel().getLid().yRot = (lidRotation * (float)Math.PI / getAngleModifier()); } @Override diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java index 465e61905..220785845 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java @@ -20,10 +20,10 @@ public WitherChestTileEntityRenderer(TileEntityRendererDispatcher tileEntityRend } @Override - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; lidRotation = 1.0F - lidRotation; lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - ((WitherChestModel)getModel()).getRightFrontDoor().yRot = -(lidRotation * (float)Math.PI / 2.0F); + ((WitherChestModel)getModel()).getRightFrontDoor().yRot = -(lidRotation * (float)Math.PI / getAngleModifier()); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java index e6190bdc9..48098c7e4 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java @@ -18,5 +18,4 @@ public WoodChestTileEntityRenderer(TileEntityRendererDispatcher tileEntityRender setTexture(new ResourceLocation(Treasure.MODID + ":textures/entity/chest/wood-chest.png")); setModel(new StandardChestModel()); } - } From 548f27fb17e5b8ee6e75f3e67b09b8f69a745f9c Mon Sep 17 00:00:00 2001 From: gottsch Date: Mon, 16 Aug 2021 18:42:38 +0000 Subject: [PATCH 05/19] adding new textures for coins and book --- .../textures/item/coins/copper_coin.png | Bin 0 -> 1511 bytes .../treasure2/textures/item/coins/gold_coin2.png | Bin 0 -> 1520 bytes .../textures/item/coins/silver_coin2.png | Bin 0 -> 1280 bytes .../treasure2/textures/item/imbued_book.png | Bin 0 -> 425 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png create mode 100644 src/main/resources/assets/treasure2/textures/item/coins/gold_coin2.png create mode 100644 src/main/resources/assets/treasure2/textures/item/coins/silver_coin2.png create mode 100644 src/main/resources/assets/treasure2/textures/item/imbued_book.png diff --git a/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png new file mode 100644 index 0000000000000000000000000000000000000000..c8373aa40223ee2644eafcd3335704bf768d5eca GIT binary patch literal 1511 zcmV zaB^>EX>4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%c>b8-&4*76KYssW=stRr zkqKD=A=_bqkB0|)AR^nuz`(#T|Hv^EJ~j)m8h}k9F4r+pnvlpc;M12cs0MT&y~()e z(s>3ANm+uLkz)WO4E9_)kCGP90}rMdXI?-~jp%`ftQl)kCO0!t3;@fwYY1?PQ;`4w N002ovPDHLkV1hkF+Iau~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/coins/gold_coin2.png b/src/main/resources/assets/treasure2/textures/item/coins/gold_coin2.png new file mode 100644 index 0000000000000000000000000000000000000000..4d428e3770f7c3cec48b6cc58f3594cd07e0d8c8 GIT binary patch literal 1520 zcmV zaB^>EX>4U6ba`-PAZ2)IW&i+q+O=0{mNO>|{Ld+J1SGK@hxNVOAjeO!xTkHmJ)Zdz z_t=0MBvB;^Mzw$b?&>dmn1z+GKDg+d#>YexIiVBu`mC0;nZJ9WZ=E~2I$khDf>zeh zwLL#UZod|Iv*r0-u6)^g!d7(CycNo@%;@ZSVJi||a@u1R_qt?G+u7e-x6H2Qacn%m zs22Kw5jP>x_zlB~j4w$-8}LiwFbVHxf5?rPYwXm~eE{$1Jz%HPmdia9O1nM5Jz%uu zWUsNC2tBZNvwZg=k@ouhIbqj(4ZXLuyJQ@Ya%yktww2k##0)59E^~N1z7~BypNJ=5 ziv^5Tu$l1`MUfb2b~02cQKvTBLIo}wZtT%A7jQ6SK|Dt;GAJVkS7)n;G zQPx^#y$v?n*P{M3<(W@9@j48or zg6f3T2{Tg4oF$uVv&%k*9CIoNpJIwFuJ{s4EU9vpiuA9pdR0S>H8pAorDmFKuK5;P zY^fvGx^&ZRcis2UV^0Tbo7H>P=z+QStkGs|FlOdF|HT@_-rrQvC?|Gs2FBPB825t# z1T+uMbRc7RFgG~Uk&zUZ!5Y~?PNl&Z7&ML8b~?EGV(u+(%9Job@Y2dk+x<^(>P3@TXhz6 z+op=#O_Y*;fJ=J6~ll zYreF2n64v!)v#UJbPg|JTB3<96>0?0tw2Hl;PhC`_57YF%7OLMx&2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ZO{7Gx%~g($tT+As}L1LRg1xMS8oovekM TUanlt00000NkvXXu0mjfR-LGh literal 0 HcmV?d00001 From be6edc8e6a893784151e4070e08376e5457a1b83 Mon Sep 17 00:00:00 2001 From: gottsch Date: Mon, 16 Aug 2021 22:50:33 +0000 Subject: [PATCH 06/19] add topaz textures --- .../assets/treasure2/textures/item/topaz.png | Bin 0 -> 367 bytes .../treasure2/textures/item/topaz_nugget.png | Bin 0 -> 5756 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/topaz.png create mode 100644 src/main/resources/assets/treasure2/textures/item/topaz_nugget.png diff --git a/src/main/resources/assets/treasure2/textures/item/topaz.png b/src/main/resources/assets/treasure2/textures/item/topaz.png new file mode 100644 index 0000000000000000000000000000000000000000..8370483979d49c2a2223b9ad40c7b995f0854a8a GIT binary patch literal 367 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=De8Ak0{?)V>TT$X?><>&pI=LqJ5`g87c^44}{-PZ!4!i_^&o5*Y_PdKN8K75abi z=$h&{10w?igAD?UZ>}n0>WYYu;F@#RC7{@aWzPTU;oXf759^AU`ncSz`Ok7VK2DeI z*>P!!b8GC{7WJ_%e|AQvrD1`<;geeCY-WPYJX?KQ=A2c~Xi0j#@UFW=*Y~=_BUub) z_VTmsc$cS%F!xRK_>(Sdm|(H_Iosixw&oHNELS9E=$~!YwkiC_-3C%Gg5>GIjb~G+rU&9x7R>E`V z^_kD@nVFfJ=dR`jt2#MVrC^K8Bl~Sz{EZnHo_@&sSnhjM4Hym#p00i_>zopr0DpIg AbN~PV literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/topaz_nugget.png b/src/main/resources/assets/treasure2/textures/item/topaz_nugget.png new file mode 100644 index 0000000000000000000000000000000000000000..aa9427e8531c582d7d100ac3675119dd1bda352d GIT binary patch literal 5756 zcmeHLd0bOh7LF)eC=O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9s+%XX zh4+f$$c^3;0AZq_%IDZR|6qTo1c8%ObKGH@`oxsRT>e1V+yOa^V^kzU)vr$1iraYQ!tflXnXYv&JN xuU!7ZNrPiWI36y##ttdOC9g($=6pKqi34>WEvF>GsT2(tCkzY=DECjy{5OrpbK(F1 literal 0 HcmV?d00001 From f925fe30877d3ab49b702d640c678cc5d1c806b2 Mon Sep 17 00:00:00 2001 From: gottsch Date: Thu, 19 Aug 2021 09:17:39 -0400 Subject: [PATCH 07/19] gettings charms with capabilities to work --- .classpath | 3 +- build.gradle | 17 +- .../someguyssoftware/treasure2/Treasure.java | 6 +- .../treasure2/block/TreasureBlocks.java | 8 + .../capability/CharmableCapability.java | 309 +++++++++++++-- .../CharmableCapabilityStorage.java | 123 +++++- .../capability/ICharmableCapability.java | 41 +- .../treasure2/charm/Charm.java | 188 +++++---- .../treasure2/charm/CharmEntity.java | 74 +++- .../treasure2/charm/HealingCharm.java | 18 +- .../treasure2/charm/ICharm.java | 13 +- .../treasure2/charm/ICharmEntity.java | 51 ++- .../treasure2/charm/TreasureCharms.java | 116 ++++-- .../treasure2/config/TreasureConfig.java | 85 ++++- .../treasure2/enums/Coins.java | 1 + .../treasure2/enums/Pearls.java | 1 + .../eventhandler/PlayerEventHandler.java | 356 +++++++++++++++++- .../treasure2/init/TreasureSetup.java | 23 ++ .../treasure2/item/CharmItem.java | 133 +++++++ .../treasure2/item/CoinItem.java | 1 + .../treasure2/item/IWishable.java | 29 ++ .../treasure2/item/PearlItem.java | 1 + .../treasure2/item/TreasureItems.java | 192 +++++++--- .../treasure2/item/WealthItem.java | 230 +++++++++++ .../network/CharmMessageHandlerOnClient.java | 126 +++++++ .../network/CharmMessageToClient.java | 200 ++++++++++ .../treasure2/util/ModUtils.java | 8 +- .../world/gen/feature/TreasureFeatures.java | 35 +- .../assets/treasure2/lang/en_us.json | 21 +- .../treasure2/models/block/onyx_ore.json | 6 + .../treasure2/models/block/topaz_ore.json | 6 + .../assets/treasure2/models/item/charm.json | 16 + .../models/item/charm_model_copper.json | 6 + .../models/item/charm_model_silver.json | 6 + .../models/item/charmed_gold_coin.json | 21 -- .../treasure2/models/item/charmed_ruby.json | 21 -- .../models/item/charmed_silver_coin.json | 21 -- .../assets/treasure2/models/item/onyx.json | 6 + .../treasure2/models/item/onyx_ore.json | 15 + .../treasure2/models/item/sapphire_charm.json | 6 + .../treasure2/models/item/test_charm.json | 6 + .../assets/treasure2/models/item/topaz.json | 6 + .../treasure2/models/item/topaz_ore.json | 15 + .../textures/item/charm/copper_charm.png | Bin 0 -> 727 bytes .../item/charm/copper_sapphire_charm.png | Bin 0 -> 743 bytes .../textures/item/charm/gold_charm.png | Bin 0 -> 698 bytes .../item/charm/gold_sapphire_charm.png | Bin 0 -> 727 bytes .../textures/item/charm/silver_charm.png | Bin 0 -> 717 bytes .../item/charm/silver_sapphire_charm.png | Bin 0 -> 740 bytes .../textures/item/sapphire_charm.png | Bin 0 -> 711 bytes .../data/curios/tags/items/belt.json | 6 + .../data/curios/tags/items/bracelet.json | 7 + .../data/curios/tags/items/charm.json | 6 + .../data/curios/tags/items/necklace.json | 6 + .../data/curios/tags/items/ring.json | 7 + 55 files changed, 2288 insertions(+), 310 deletions(-) create mode 100644 src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java create mode 100644 src/main/resources/assets/treasure2/models/block/onyx_ore.json create mode 100644 src/main/resources/assets/treasure2/models/block/topaz_ore.json create mode 100644 src/main/resources/assets/treasure2/models/item/charm.json create mode 100644 src/main/resources/assets/treasure2/models/item/charm_model_copper.json create mode 100644 src/main/resources/assets/treasure2/models/item/charm_model_silver.json delete mode 100644 src/main/resources/assets/treasure2/models/item/charmed_gold_coin.json delete mode 100644 src/main/resources/assets/treasure2/models/item/charmed_ruby.json delete mode 100644 src/main/resources/assets/treasure2/models/item/charmed_silver_coin.json create mode 100644 src/main/resources/assets/treasure2/models/item/onyx.json create mode 100644 src/main/resources/assets/treasure2/models/item/onyx_ore.json create mode 100644 src/main/resources/assets/treasure2/models/item/sapphire_charm.json create mode 100644 src/main/resources/assets/treasure2/models/item/test_charm.json create mode 100644 src/main/resources/assets/treasure2/models/item/topaz.json create mode 100644 src/main/resources/assets/treasure2/models/item/topaz_ore.json create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_sapphire_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_sapphire_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_sapphire_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/sapphire_charm.png create mode 100644 src/main/resources/data/curios/tags/items/belt.json create mode 100644 src/main/resources/data/curios/tags/items/bracelet.json create mode 100644 src/main/resources/data/curios/tags/items/charm.json create mode 100644 src/main/resources/data/curios/tags/items/necklace.json create mode 100644 src/main/resources/data/curios/tags/items/ring.json diff --git a/.classpath b/.classpath index 14fe4f12f..ef1991dfe 100644 --- a/.classpath +++ b/.classpath @@ -2,8 +2,9 @@ - + + diff --git a/build.gradle b/build.gradle index a8c441323..c8ab1b060 100644 --- a/build.gradle +++ b/build.gradle @@ -95,6 +95,19 @@ minecraft { // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you + + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + // flatDir { + // dir 'libs' + // } + maven { + url = "https://maven.theillusivec4.top/" + } +} + def gottschcore_path="../gottsch-minecraft-GottschCore/build/libs/GottschCore-mc${mc_version}-f${gottschcore_forge_version}-v${gottschcore_version}.jar" println gottschcore_path dependencies { @@ -102,7 +115,9 @@ dependencies { // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" - compile files('../../ModCommonLibs/libs/commons-cli-1.4.jar') + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.2") + compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.2:api") + //compile files('../../ModCommonLibs/libs/commons-cli-1.4.jar') compile files(gottschcore_path) //shadow files(gottschcore_path) } diff --git a/src/main/java/com/someguyssoftware/treasure2/Treasure.java b/src/main/java/com/someguyssoftware/treasure2/Treasure.java index 77cec198b..5fa3bcbc5 100644 --- a/src/main/java/com/someguyssoftware/treasure2/Treasure.java +++ b/src/main/java/com/someguyssoftware/treasure2/Treasure.java @@ -78,14 +78,12 @@ public Treasure() { eventBus.addListener(this::config); eventBus.addListener(TreasureNetworking::common); eventBus.addListener(TreasureSetup::common); + eventBus.addListener(TreasureSetup::clientSetup); eventBus.addListener(this::clientSetup); // needs to be registered here instead of @Mod.EventBusSubscriber because we need to pass in a constructor argument MinecraftForge.EVENT_BUS.register(new WorldEventHandler(getInstance())); - MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); -// MinecraftForge.EVENT_BUS.register(new TreasureParticles()); -// MOD_EVENT_BUS.register(TreasureParticles.class); -// DistExecutor.runWhenOn(Dist.CLIENT, () -> Treasure::clientOnly); + MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); // need to register here? } public static void clientOnly() { diff --git a/src/main/java/com/someguyssoftware/treasure2/block/TreasureBlocks.java b/src/main/java/com/someguyssoftware/treasure2/block/TreasureBlocks.java index 268ef86b9..69a13387f 100644 --- a/src/main/java/com/someguyssoftware/treasure2/block/TreasureBlocks.java +++ b/src/main/java/com/someguyssoftware/treasure2/block/TreasureBlocks.java @@ -142,6 +142,8 @@ public class TreasureBlocks { public static Block WITHER_PLANKS; public static Block SPANISH_MOSS; + public static Block TOPAZ_ORE; + public static Block ONYX_ORE; public static Block RUBY_ORE; public static Block SAPPHIRE_ORE; @@ -410,6 +412,10 @@ public static void registerBlocks(RegistryEvent.Register event) { .strength(3.0F).sound(SoundType.STONE)); // ORES + TOPAZ_ORE = new TreasureOreBlock(Treasure.MODID, TreasureConfig.BlockID.TOPAZ_ORE_ID, Block.Properties.of(Material.STONE, MaterialColor.STONE) + .strength(3.0F, 5.0F).harvestLevel(3)); + ONYX_ORE = new TreasureOreBlock(Treasure.MODID, TreasureConfig.BlockID.ONYX_ORE_ID, Block.Properties.of(Material.STONE, MaterialColor.STONE) + .strength(3.0F, 5.0F).harvestLevel(3)); RUBY_ORE = new TreasureOreBlock(Treasure.MODID, TreasureConfig.BlockID.RUBY_ORE_ID, Block.Properties.of(Material.STONE, MaterialColor.STONE) .strength(3.0F, 5.0F).harvestLevel(3)); SAPPHIRE_ORE = new TreasureOreBlock(Treasure.MODID, TreasureConfig.BlockID.SAPPHIRE_ORE_ID, Block.Properties.of(Material.STONE, MaterialColor.STONE) @@ -499,6 +505,8 @@ public static void registerBlocks(RegistryEvent.Register event) { BLOCKS.add(SKULL_CROSSBONES); BLOCKS.add(WISHING_WELL_BLOCK); BLOCKS.add(DESERT_WISHING_WELL_BLOCK); + BLOCKS.add(TOPAZ_ORE); + BLOCKS.add(ONYX_ORE); BLOCKS.add(RUBY_ORE); BLOCKS.add(SAPPHIRE_ORE); BLOCKS.add(WITHER_BROKEN_LOG); diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java index 3eedbec9b..34f14fa5a 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java @@ -20,13 +20,20 @@ package com.someguyssoftware.treasure2.capability; import java.util.ArrayList; +import java.util.EnumSet; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.function.Consumer; +import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.charm.TreasureCharms; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; @@ -42,25 +49,46 @@ * */ public class CharmableCapability implements ICharmableCapability { -// private LinkedList> charmEntities = new LinkedList<>(); + /* + * Properties that refer to the Item that has this capability + */ @SuppressWarnings("unchecked") ArrayList[] charmEntities = (ArrayList[])new ArrayList[3]; + // is this item a charm source/originator ie. not an adornment or an item that is "given" a charm private boolean source; + // is this item bindable to a target item that is socketable private boolean bindable; + // can this item create sockets on a target item - REMOVE doesn't belong in Charmable -> has nothing to do with charm inventory private boolean socketing; + // does this item have sockets - accepts bindable items private boolean socketable; + // can this item imbue atarget item private boolean imbuing; + // can this item be imbued private boolean imbuable; + // does this item have "built-in" finite charms private boolean finite; - private int socketSize; - private int imbueSize; - private int finiteSize; + // the base material this item is made of + private BaseMaterial baseMaterial = BaseMaterial.COPPER; + // the item that this capability belongs to + private ResourceLocation sourceItem; + // the max level of any charm that this item can hold (in either of the 3 inventories) + private int maxCharmLevel; + + /* + * Propeties that refer to the Charm Inventory the the Item that has this capability + */ + private int maxSocketsSize; + private int maxImbueSize; + private int maxFiniteSize; + /** * */ public CharmableCapability() { + init(); } /** @@ -68,17 +96,27 @@ public CharmableCapability() { * @param builder */ public CharmableCapability(Builder builder) { - init(); + this(); + this.source = builder.source; + this.bindable = builder.bindable; this.finite = builder.finite; - this.finiteSize = finite ? Math.max(1, builder.finiteSize) : 0; + this.maxFiniteSize = finite ? Math.max(1, builder.maxFiniteSize) : 0; + this.imbuable = builder.imbuable; + this.maxImbueSize = imbuable ? Math.max(1, builder.maxImbueSize) : 0; this.socketable = builder.socketable; - this.socketSize = socketable ? Math.max(1, builder.socketSize) : 0; + this.maxSocketsSize = socketable ? Math.max(1, builder.maxSocketsSize) : 0; + this.baseMaterial = builder.baseMaterial; + this.sourceItem = builder.sourceItem; + this.maxCharmLevel = builder.maxCharmLevel; } + /** + * + */ protected void init() { - charmEntities[CharmInventoryType.FINITE.value] = new ArrayList<>(1); - charmEntities[CharmInventoryType.IMBUE.value] = new ArrayList<>(1); - charmEntities[CharmInventoryType.SOCKET.value] = new ArrayList<>(1); + charmEntities[InventoryType.FINITE.value] = new ArrayList<>(1); + charmEntities[InventoryType.IMBUE.value] = new ArrayList<>(1); + charmEntities[InventoryType.SOCKET.value] = new ArrayList<>(1); } /** @@ -87,8 +125,25 @@ protected void init() { * @param entity */ @Override - public void add(CharmInventoryType type, ICharmEntity entity) { - charmEntities[type.value].add(entity); + public void add(InventoryType type, ICharmEntity entity) { + // test if the level of charm item/cap is >= entity.level; else return + + // test if there is enough space to add +// Treasure.LOGGER.debug("adding type -> {} charm -> {}", type, entity.getCharm()); + if (charmEntities[type.value].size() < getMaxSize(type)) { + charmEntities[type.value].add(entity); + } +// Treasure.LOGGER.debug("ther are {} type -> {} charms", charmEntities[type.value].size(), type); + } + + /** + * Convenience method + * @param type + * @return + */ + public int getMaxSize(InventoryType type) { + // check against SOCKET first as this will be the most common + return (type == InventoryType.SOCKET ? getMaxSocketsSize() : type == InventoryType.IMBUE ? getMaxImbueSize() : getMaxFiniteSize()); } @Override @@ -111,25 +166,59 @@ public void appendHoverText(ItemStack stack, World world, List t tooltip.add(new TranslationTextComponent("tooltip.label.charms").withStyle(TextFormatting.YELLOW, TextFormatting.BOLD)); // create header text for inventory type - appendHoverText(stack, world, tooltip, flag, CharmInventoryType.FINITE, false); - appendHoverText(stack, world, tooltip, flag, CharmInventoryType.IMBUE, true); - appendHoverText(stack, world, tooltip, flag, CharmInventoryType.SOCKET, true); + appendHoverText(stack, world, tooltip, flag, InventoryType.FINITE, false); + appendHoverText(stack, world, tooltip, flag, InventoryType.IMBUE, true); + appendHoverText(stack, world, tooltip, flag, InventoryType.SOCKET, true); } - private void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag, CharmInventoryType inventoryType, boolean titleFlag) { + /** + * + * @param stack + * @param world + * @param tooltip + * @param flag + * @param inventoryType + * @param titleFlag + */ + private void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag, InventoryType inventoryType, boolean titleFlag) { List entityList = getCharmEntities()[inventoryType.value]; if (entityList != null && !entityList.isEmpty()) { // add title if (titleFlag) { - tooltip.add(new TranslationTextComponent("tooltip.label.charm.type.finite", inventoryType.name()).withStyle(TextFormatting.DARK_GRAY)); + TextFormatting color = inventoryType == InventoryType.SOCKET ? TextFormatting.BLUE : TextFormatting.DARK_RED; + tooltip.add( + new TranslationTextComponent("tooltip.label.charm.type." + inventoryType.name().toLowerCase()).withStyle(color) + .append(getCapacityHoverText(stack, world, entityList).withStyle(TextFormatting.WHITE)) + ); } // add charms for (ICharmEntity entity : entityList) { entity.getCharm().appendHoverText(stack, world, tooltip, flag, entity); } + // add socket footer +// if (inventoryType == InventoryType.SOCKET || inventoryType == InventoryType.IMBUE) { +// appendCapacityHoverText(stack, world, tooltip, flag, entityList); +// } } } + @SuppressWarnings("deprecation") + public void appendCapacityHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag, List entities) { + +// tooltip.add(new TranslationTextComponent("tooltip.label.charmable.slots").withStyle(TextFormatting.GRAY)); + tooltip.add(new TranslationTextComponent("tooltip.label.charmable.slots", + String.valueOf(Math.toIntExact(Math.round(entities.size()))), // used + String.valueOf(Math.toIntExact(Math.round(this.maxSocketsSize)))) // max + .withStyle(TextFormatting.WHITE)); + } + + @SuppressWarnings("deprecation") + public TranslationTextComponent getCapacityHoverText(ItemStack stack, World world, List entities) { + return new TranslationTextComponent("tooltip.label.charmable.slots", + String.valueOf(Math.toIntExact(Math.round(entities.size()))), // used + String.valueOf(Math.toIntExact(Math.round(this.maxSocketsSize)))); // max + } + @Override public List[] getCharmEntities() { if (charmEntities == null) { @@ -151,98 +240,230 @@ public void setSource(boolean source) { this.source = source; } + @Override public boolean isBindable() { return bindable; } + @Override public void setBindable(boolean bindable) { this.bindable = bindable; } + @Override public boolean isSocketing() { return socketing; } + @Override public void setSocketing(boolean socketing) { this.socketing = socketing; } + @Override public boolean isSocketable() { return socketable; } + @Override public void setSocketable(boolean socketable) { this.socketable = socketable; } + @Override public boolean isImbuing() { return imbuing; } + @Override public void setImbuing(boolean imbuing) { this.imbuing = imbuing; } + @Override public boolean isImbuable() { return imbuable; } + @Override public void setImbuable(boolean imbuable) { this.imbuable = imbuable; } + @Override public boolean isFinite() { return finite; } + @Override public void setFinite(boolean finite) { this.finite = finite; } + @Override + public int getMaxFiniteSize() { + return maxFiniteSize; + } + + @Override + public int getMaxSocketsSize() { + return maxSocketsSize; + } + + @Override + public int getMaxImbueSize() { + return maxImbueSize; + } + + @Override + public void setMaxSocketsSize(int maxSocketsSize) { + this.maxSocketsSize = maxSocketsSize; + } + + @Override + public void setMaxImbueSize(int maxImbueSize) { + this.maxImbueSize = maxImbueSize; + } + + @Override + public void setMaxFiniteSize(int maxFiniteSize) { + this.maxFiniteSize = maxFiniteSize; + } + + @Override + public BaseMaterial getBaseMaterial() { + return baseMaterial; + } + + @Override + public void setBaseMaterial(BaseMaterial baseMaterial) { + this.baseMaterial = baseMaterial; + } + + @Override + public int getMaxCharmLevel() { + return maxCharmLevel; + } + + @Override + public void setMaxCharmLevel(int maxLevel) { + this.maxCharmLevel = maxLevel; + } + /** * * @author Mark Gottschling on Aug 15, 2021 * */ - public enum CharmInventoryType { + public enum InventoryType { FINITE(0), IMBUE(1), SOCKET(2); - int value; + private static final Map values = new HashMap(); + Integer value; + + // setup reverse lookup + static { + for (InventoryType x : EnumSet.allOf(InventoryType.class)) { + values.put(x.getValue(), x); + } + } + + InventoryType(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + /** + * + * @param value + * @return + */ + public static InventoryType getByValue(Integer value) { + return (InventoryType) values.get(value); + } + } + + /** + * + * @author Mark Gottschling on Aug 16, 2021 + * + */ + public enum BaseMaterial { + NONE(0, 0), + COPPER(1, 1), + SILVER(2, 2), + GOLD(3, 3); + + private int value; + private int maxCharmLevel; - CharmInventoryType(int value) { + BaseMaterial(int value, int maxLevel) { this.value = value; + this.maxCharmLevel = maxLevel; } public int getValue() { return value; } + + public int getMaxCharmLevel() { + return maxCharmLevel; + } } + /** + * + * @author Mark Gottschling on Aug 16, 2021 + * + */ public static class Builder { private boolean source; - private boolean bindable; + public boolean bindable; private boolean socketing; public boolean socketable; - private boolean imbuing; - private boolean imbuable; - public boolean finite; - - private int socketSize; - private int imbueSize; - public int finiteSize; + public boolean imbuing; + public boolean imbuable; + public boolean finite; - public Builder() {} + public BaseMaterial baseMaterial = BaseMaterial.COPPER; + // required property + public ResourceLocation sourceItem; + + // calculated value + private int maxCharmLevel; + + public int maxSocketsSize; + public int maxImbueSize; + public int maxFiniteSize; + + // required to pass the source Item here + public Builder(ResourceLocation sourceItem) { + this.sourceItem = sourceItem; + } public Builder with(Consumer builder) { builder.accept(this); return this; } + public Builder source(boolean source) { + this.source = source; + return this; + } + + public Builder bindable(boolean bindable) { + this.bindable = bindable; + return this; + } + public Builder socketable(boolean socketable, int size) { this.socketable = socketable; - this.socketSize = size; + this.maxSocketsSize = size; return this; } @@ -253,13 +474,13 @@ public Builder socketing(boolean socketing) { public Builder finite(boolean finite, int size) { this.finite = finite; - this.finiteSize = size; + this.maxFiniteSize = size; return this; } public Builder imbue(boolean imbue, int size) { this.imbuable = imbue; - this.imbueSize = size; + this.maxImbueSize = size; return this; } @@ -267,8 +488,32 @@ public Builder imbuing(boolean imbuing) { this.imbuing = imbuing; return this; } + + public Builder baseMaterial(BaseMaterial material) { + this.baseMaterial = material; + return this; + } + +// public Builder sourceItem(ResourceLocation sourceItemName) { +// this.sourceItem = sourceItemName; +// return this; +// } + public ICharmableCapability build() { + // calculate the max charm level based on baseMaterial and the source item. + Treasure.LOGGER.debug("charm source item -> {}", sourceItem); + Optional level = TreasureCharms.getCharmLevel(sourceItem); + this.maxCharmLevel = baseMaterial.getMaxCharmLevel() + (level.isPresent() ? level.get() : 0) ; return new CharmableCapability(this); } } + + @Override + public ResourceLocation getSourceItem() { + return sourceItem; + } + @Override + public void setSourceItem(ResourceLocation sourceItem) { + this.sourceItem = sourceItem; + } } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java index fb375242c..a91ffa868 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java @@ -19,10 +19,18 @@ */ package com.someguyssoftware.treasure2.capability; +import java.util.List; +import java.util.Optional; + import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability.BaseMaterial; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.util.ModUtils; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; @@ -32,15 +40,59 @@ * */ public class CharmableCapabilityStorage implements Capability.IStorage { - private static final String CHARMS = "charms"; - private static final String CHARM = "charm"; - private static final String DATA = "data"; + + private static final String BINDABLE = "bindable"; + private static final String FINITE = "finite"; + private static final String MAX_FINITE_SIZE = "maxFiniteSize"; + private static final String IMBUABLE = "imbuable"; + private static final String IMBUING = "imbuing"; + private static final String MAX_IMBUE_SIZE = "maxImbueSize"; + private static final String SOCKETABLE = "socketable"; + private static final String SOCKETING = "socketing"; + private static final String MAX_SOCKET_SIZE = "maxSocketSize"; + private static final String BASE_MATERIAL = "baseMaterial"; + private static final String SOURCE_ITEM = "sourceItem"; + private static final String MAX_CHARM_LEVEL = "maxCharmLevel"; @Override public INBT writeNBT(Capability capability, ICharmableCapability instance, Direction side) { CompoundNBT nbt = new CompoundNBT(); try { - nbt.putInt(CHARM, 0); + /* + * save charm cap inventories + */ + // create a new list nbt for each inventory type + for (int index = 0; index < instance.getCharmEntities().length; index++) { + List entityList = instance.getCharmEntities()[index]; + if (entityList != null && !entityList.isEmpty()) { + ListNBT listNbt = new ListNBT(); + for (ICharmEntity entity : entityList) { + CompoundNBT entityNbt = new CompoundNBT(); + listNbt.add(entity.save(entityNbt)); + } + nbt.put(InventoryType.getByValue(index).name(), listNbt); + } + } + + /* + * save charm cap properties + */ + nbt.putBoolean(BINDABLE, instance.isBindable()); + + nbt.putBoolean(FINITE, instance.isFinite()); + nbt.putInt(MAX_FINITE_SIZE, instance.getMaxFiniteSize()); + + nbt.putBoolean(IMBUABLE, instance.isImbuable()); + nbt.putBoolean(IMBUING, instance.isImbuing()); + nbt.putInt(MAX_IMBUE_SIZE, instance.getMaxImbueSize()); + + nbt.putBoolean(SOCKETABLE, instance.isSocketable()); + nbt.putBoolean(SOCKETING, instance.isSocketing()); + nbt.putInt(MAX_SOCKET_SIZE, instance.getMaxSocketsSize()); + nbt.putString(BASE_MATERIAL, instance.getBaseMaterial().name()); + nbt.putString(SOURCE_ITEM, instance.getSourceItem().toString()); + nbt.putInt(MAX_CHARM_LEVEL, instance.getMaxCharmLevel()); + } catch (Exception e) { Treasure.LOGGER.error("Unable to write state to NBT:", e); } @@ -52,10 +104,67 @@ public void readNBT(Capability capability, ICharmableCapab INBT nbt) { if (nbt instanceof CompoundNBT) { CompoundNBT tag = (CompoundNBT) nbt; - if (tag.contains(CHARM)) { -// instance.setCharmable(tag.getInt(CHARM)); + for (InventoryType type : InventoryType.values()) { + // clear the list + instance.getCharmEntities()[type.getValue()].clear(); + /* + * load the list + */ + if (tag.contains(type.name())) { + ListNBT listNbt = tag.getList(type.name(), 10); + listNbt.forEach(e -> { + // load entity + Optional entity = ICharmEntity.load((CompoundNBT)e); + if (!entity.isPresent()) { + return; + } + + // add the entity to the list + instance.getCharmEntities()[type.getValue()].add(entity.get()); + }); + } + + // load cap properties + if (tag.contains(BINDABLE)) { + instance.setBindable(tag.getBoolean(BINDABLE)); + } + + if (tag.contains(FINITE)) { + instance.setFinite(tag.getBoolean(FINITE)); + } + if (tag.contains(MAX_FINITE_SIZE)) { + instance.setMaxFiniteSize(tag.getInt(MAX_FINITE_SIZE)); + } + + if (tag.contains(IMBUABLE)) { + instance.setFinite(tag.getBoolean(IMBUABLE)); + } + if (tag.contains(MAX_IMBUE_SIZE)) { + instance.setMaxFiniteSize(tag.getInt(MAX_IMBUE_SIZE)); + } + if (tag.contains(IMBUING)) { + instance.setFinite(tag.getBoolean(IMBUING)); + } + + if (tag.contains(SOCKETABLE)) { + instance.setFinite(tag.getBoolean(SOCKETABLE)); + } + if (tag.contains(MAX_SOCKET_SIZE)) { + instance.setMaxFiniteSize(tag.getInt(MAX_SOCKET_SIZE)); + } + if (tag.contains(SOCKETING)) { + instance.setFinite(tag.getBoolean(SOCKETING)); + } + if (tag.contains(BASE_MATERIAL)) { + instance.setBaseMaterial(BaseMaterial.valueOf(tag.getString(BASE_MATERIAL).toUpperCase())); + } + if (tag.contains(SOURCE_ITEM)) { + instance.setSourceItem(ModUtils.asLocation(tag.getString(SOURCE_ITEM))); + } + if (tag.contains(MAX_CHARM_LEVEL)) { + instance.setMaxCharmLevel(tag.getInt(MAX_CHARM_LEVEL)); + } } } } - } diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java index 21e91d22b..193eb602f 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java @@ -21,11 +21,13 @@ import java.util.List; -import com.someguyssoftware.treasure2.capability.CharmableCapability.CharmInventoryType; +import com.someguyssoftware.treasure2.capability.CharmableCapability.BaseMaterial; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.charm.ICharmEntity; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; @@ -44,13 +46,42 @@ public interface ICharmableCapability { * @param type * @param entity */ - void add(CharmInventoryType type, ICharmEntity entity); + void add(InventoryType type, ICharmEntity entity); public boolean isCharmed(); public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); - // an originator of a charm ie coins, gems -// public boolean isCharmSource(); -// public void setCharmSource(boolean isSource); + public boolean isBindable(); + public void setBindable(boolean bindable); + + public boolean isFinite(); + public void setFinite(boolean finite); + public int getMaxFiniteSize(); + + public boolean isImbuable(); + public void setImbuable(boolean imbue); + public int getMaxImbueSize(); + + public boolean isImbuing(); + public void setImbuing(boolean imbuing); + + public boolean isSocketable(); + public void setSocketable(boolean socketable); + public int getMaxSocketsSize(); + + public boolean isSocketing(); + public void setSocketing(boolean socketing); + void setMaxSocketsSize(int maxSocketsSize); + void setMaxImbueSize(int maxImbueSize); + void setMaxFiniteSize(int maxFiniteSize); + + BaseMaterial getBaseMaterial(); + void setBaseMaterial(BaseMaterial baseMaterial); + + int getMaxCharmLevel(); + void setMaxCharmLevel(int maxLevel); + + ResourceLocation getSourceItem(); + void setSourceItem(ResourceLocation sourceItem); } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java index 47d8dece7..fa15e11c2 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java @@ -19,10 +19,14 @@ */ package com.someguyssoftware.treasure2.charm; +import java.util.Optional; import java.util.function.Consumer; +import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.util.ModUtils; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; @@ -41,13 +45,13 @@ public abstract class Charm implements ICharm { private int maxDuration; private Rarity rarity; private int priority; - + /* * if multiple charms of the same type are being processed, only 1 should be updated/executed. * ex. if multiple harvesting charms are held, only one should update. */ - private boolean allowMultipleUpdates = false; - + private boolean effectStackable = false; + /** * * @param builder @@ -61,7 +65,7 @@ protected Charm(Builder builder) { this.maxPercent = builder.percent; this.rarity = builder.rarity; this.priority = builder.priority; - this.allowMultipleUpdates = builder.allowMultipleUpdates; + this.effectStackable = builder.effectStackable; } /** @@ -69,14 +73,52 @@ protected Charm(Builder builder) { */ @Override public ICharmEntity createEntity() { -// ICharmData data = new CharmData(); -// data.setValue(this.getMaxValue()); -// data.setPercent(this.getMaxPercent()); -// data.setDuration(this.getMaxDuration()); + // ICharmData data = new CharmData(); + // data.setValue(this.getMaxValue()); + // data.setPercent(this.getMaxPercent()); + // data.setDuration(this.getMaxDuration()); ICharmEntity entity = new CharmEntity(this, this.getMaxValue(),this.getMaxDuration(), this.getMaxPercent()); return entity; } - + + /** + * + * @param nbt + * @return + */ + public static Optional load(CompoundNBT nbt) { + Optional charm = Optional.empty(); + // read the name of the charm and fetch from the registry + try { + String charmName = nbt.getString("name"); + ResourceLocation resource = ModUtils.asLocation(charmName); + charm = TreasureCharmRegistry.get(resource); + if (!charm.isPresent()) { + throw new Exception(String.format("Unable to locate charm %s in registry.", resource.toString())); + } + } + catch(Exception e) { + Treasure.LOGGER.error("Unable to read state to NBT:", e); + } + return charm; + } + + /** + * + * @param nbt + * @return + */ + @Override + public CompoundNBT save(CompoundNBT nbt) { + try { + nbt.putString("name", this.name.toString()); + } + catch(Exception e) { + Treasure.LOGGER.error("Unable to write state to NBT:", e); + } + return nbt; + } + /** * * @param data @@ -84,49 +126,61 @@ public ICharmEntity createEntity() { */ @SuppressWarnings("deprecation") public String getLabel(ICharmEntity entity) { - return new TranslationTextComponent("tooltip.charm." + getType().toLowerCase(), getLevel()).getString(); - - /* - * 1. check for mod item specific label - * 2. check for specific type prefix (levels 1-10) - * 3. check for general prefix (levels 1-10) - * OR - * 4. check for specific type suffix (levels 11+) - * 5. check for general suffix (levels 11+) - * ex. tooltip.charm.shielding.prefix.level[x], else look for tooltip.charm.prefix.level[x] + tooltip.charm.[type] - */ -// String tooltipKey = "tooltip.charm." + getName().toString().toLowerCase(); -// String label = I18n.translateToLocalFormatted(tooltipKey, -// String.valueOf(Math.toIntExact(Math.round(data.getValue()))), -// String.valueOf(Math.toIntExact(Math.round(getMaxValue())))); -// String prefix = ""; -// String suffix = ""; -// String type = ""; -// if (label.equals(tooltipKey)) { -// type = I18n.translateToLocalFormatted("tooltip.charm." + getType(), -// String.valueOf(Math.toIntExact(Math.round(data.getValue()))), -// String.valueOf(Math.toIntExact(Math.round(getMaxValue())))); -// if (this.getLevel() <= 10) { -// String prefixKey = "tooltip.charm." + getType() + ".prefix.level" + String.valueOf(this.getLevel()); -// prefix = I18n.translateToLocalFormatted(prefixKey); -// if (prefix.equals(prefixKey)) { -// prefix = I18n.translateToLocalFormatted("tooltip.charm.prefix.level" + String.valueOf(this.getLevel())); -// } -// label = prefix + " " + type; -// } -// else { -// String suffixKey = "tooltip.charm." + getType() + ".suffix.level" + String.valueOf(this.getLevel()); -// suffix = I18n.translateToLocalFormatted(suffixKey); -// if (suffix.equals(suffixKey)) { -// suffix = I18n.translateToLocalFormatted("tooltip.charm.suffix.level" + String.valueOf(this.getLevel())); -// } -// label = type + " " + suffix; -// } -// } -// // TODO redo this in future. -// return label + " " + getUsesGauge(data) + " " + (this.isAllowMultipleUpdates() ? (TextFormatting.DARK_PURPLE + "* combinable") : ""); + return new TranslationTextComponent("tooltip.charm." + getType().toLowerCase(), getLevel()).getString() + " " + getUsesGauge(entity); + + /* + * 1. check for mod item specific label + * 2. check for specific type prefix (levels 1-10) + * 3. check for general prefix (levels 1-10) + * OR + * 4. check for specific type suffix (levels 11+) + * 5. check for general suffix (levels 11+) + * ex. tooltip.charm.shielding.prefix.level[x], else look for tooltip.charm.prefix.level[x] + tooltip.charm.[type] + */ + // String tooltipKey = "tooltip.charm." + getName().toString().toLowerCase(); + // String label = I18n.translateToLocalFormatted(tooltipKey, + // String.valueOf(Math.toIntExact(Math.round(data.getValue()))), + // String.valueOf(Math.toIntExact(Math.round(getMaxValue())))); + // String prefix = ""; + // String suffix = ""; + // String type = ""; + // if (label.equals(tooltipKey)) { + // type = I18n.translateToLocalFormatted("tooltip.charm." + getType(), + // String.valueOf(Math.toIntExact(Math.round(data.getValue()))), + // String.valueOf(Math.toIntExact(Math.round(getMaxValue())))); + // if (this.getLevel() <= 10) { + // String prefixKey = "tooltip.charm." + getType() + ".prefix.level" + String.valueOf(this.getLevel()); + // prefix = I18n.translateToLocalFormatted(prefixKey); + // if (prefix.equals(prefixKey)) { + // prefix = I18n.translateToLocalFormatted("tooltip.charm.prefix.level" + String.valueOf(this.getLevel())); + // } + // label = prefix + " " + type; + // } + // else { + // String suffixKey = "tooltip.charm." + getType() + ".suffix.level" + String.valueOf(this.getLevel()); + // suffix = I18n.translateToLocalFormatted(suffixKey); + // if (suffix.equals(suffixKey)) { + // suffix = I18n.translateToLocalFormatted("tooltip.charm.suffix.level" + String.valueOf(this.getLevel())); + // } + // label = type + " " + suffix; + // } + // } + // // TODO redo this in future. + // return label + " " + getUsesGauge(data) + " " + (this.isAllowMultipleUpdates() ? (TextFormatting.DARK_PURPLE + "* combinable") : ""); } - + + /** + * + * @param data + * @return + */ + @SuppressWarnings("deprecation") + public String getUsesGauge(ICharmEntity entity) { + return new TranslationTextComponent("tooltip.charm.uses_gauge", + String.valueOf(Math.toIntExact(Math.round(entity.getValue()))), + String.valueOf(Math.toIntExact(Math.round(getMaxValue())))).getString(); + } + @Override public ResourceLocation getName() { return name; @@ -155,22 +209,22 @@ public double getMaxPercent() { public int getMaxDuration() { return maxDuration; } - + @Override public Rarity getRarity() { return rarity; } - + @Override public int getPriority() { return priority; } - + @Override - public boolean isAllowMultipleUpdates() { - return allowMultipleUpdates; + public boolean isEffectStackable() { + return effectStackable; } - + /** * * @author Mark Gottschling on Dec 18, 2020 @@ -185,8 +239,8 @@ abstract public static class Builder { public Double percent = 0.0; public Rarity rarity = Rarity.COMMON; public int priority = 10; - public boolean allowMultipleUpdates = false; - + public boolean effectStackable = false; + /** * * @param name @@ -199,13 +253,13 @@ public Builder(ResourceLocation name, String type, Integer level) { this.type = type; this.level = level; } - + /** * * @return */ abstract public ICharm build(); - + /** * * @param builder @@ -215,7 +269,7 @@ public Builder with(Consumer builder) { builder.accept(this); return this; } - + @Deprecated public Builder withValue(Double value) { this.value = value; @@ -231,19 +285,19 @@ public Builder withPercent(Double percent) { this.percent = percent; return Charm.Builder.this; } - + public Builder withRarity(Rarity rarity) { this.rarity = rarity; return Charm.Builder.this; } - + public Builder withPriority(int priority) { this.priority = priority; return Charm.Builder.this; } - + public Builder withAllowMultipleUpdates(boolean allow) { - this.allowMultipleUpdates = allow; + this.effectStackable = allow; return Charm.Builder.this; } } @@ -253,6 +307,6 @@ public Builder withAllowMultipleUpdates(boolean allow) { public String toString() { return "Charm [name=" + name + ", type=" + type + ", level=" + level + ", maxValue=" + maxValue + ", maxPercent=" + maxPercent + ", maxDuration=" + maxDuration + ", rarity=" + rarity + ", priority=" - + priority + ", allowMultipleUpdates=" + allowMultipleUpdates + "]"; + + priority + ", effectStackable=" + effectStackable + "]"; } } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java index 2d1e76a8e..fb51510f3 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java @@ -19,12 +19,17 @@ */ package com.someguyssoftware.treasure2.charm; +import java.util.Comparator; + +import net.minecraft.nbt.CompoundNBT; + public class CharmEntity implements ICharmEntity { + private ICharm charm; private double value; private int duration; private double percent; - + /** * */ @@ -44,6 +49,54 @@ public CharmEntity(ICharm charm, double value, int duration, double percent) { setPercent(percent); } + @Override + public void update(ICharmEntity entity) { + this.setValue(entity.getValue()); + this.setDuration(entity.getDuration()); + this.setPercent(entity.getPercent()); + } + + /** + * + * @param nbt + * @return + */ +// public static Optional load(CompoundNBT nbt) { +// Optional charm = Charm.load((CompoundNBT) nbt.get(CHARM)); +// if (!charm.isPresent()) { +// return Optional.empty(); +// } +// +// ICharmEntity entity = charm.get().createEntity(); +// if (nbt.contains(VALUE)) { +// entity.setValue(nbt.getDouble(VALUE)); +// } +// if (nbt.contains("duration")) { +// entity.setDuration(nbt.getInt("duration")); +// } +// if (nbt.contains("percent")) { +// entity.setPercent(nbt.getDouble("percent")); +// } +// return Optional.of(entity); +// } + + /** + * + * @param nbt + * @return + */ + @Override + public CompoundNBT save(CompoundNBT nbt) { + CompoundNBT charmNbt = new CompoundNBT(); + // save the charm + nbt.put(CHARM, getCharm().save(charmNbt)); + // save the entity data + nbt.putDouble(VALUE, getValue()); + nbt.putInt("duration", getDuration()); + nbt.putDouble("percent", getPercent()); + return nbt; + } + @Override public ICharm getCharm() { return charm; @@ -54,40 +107,32 @@ public void setCharm(ICharm charm) { this.charm = charm; } - @Deprecated @Override - public ICharmData getData() { - // TODO Auto-generated method stub - return null; - } - - @Deprecated - @Override - public void setData(ICharmData data) { - // TODO Auto-generated method stub - - } - public double getValue() { return value; } + @Override public void setValue(double value) { this.value = value; } + @Override public int getDuration() { return duration; } + @Override public void setDuration(int duration) { this.duration = duration; } + @Override public double getPercent() { return percent; } + @Override public void setPercent(double percent) { this.percent = percent; } @@ -97,5 +142,4 @@ public String toString() { return "CharmEntity [charm=" + charm + ", value=" + value + ", duration=" + duration + ", percent=" + percent + "]"; } - } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java index b22e97ad8..1a04c904d 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java @@ -3,7 +3,6 @@ */ package com.someguyssoftware.treasure2.charm; -import java.util.Arrays; import java.util.List; import java.util.Random; @@ -17,7 +16,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; @@ -29,7 +27,7 @@ * */ public class HealingCharm extends Charm implements IHealing { - private static String HEALING = "healing"; + public static String HEALING_TYPE = "healing"; private static float HEAL_RATE = 1F; HealingCharm(Builder builder) { @@ -45,21 +43,21 @@ public float getHealRate() { } /** - * + * NOTE: it is assumed that only the allowable events are calling this action. */ @Override - public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmData data) { + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { boolean result = false; if (world.getGameTime() % 20 == 0) { - if (event instanceof LivingUpdateEvent) { - if (data.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { +// if (event instanceof LivingUpdateEvent) { + if (entity.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { float amount = Math.min(getHealRate(), player.getMaxHealth() - player.getHealth()); player.setHealth(MathHelper.clamp(player.getHealth() + amount, 0.0F, player.getMaxHealth())); - data.setValue(MathHelper.clamp(data.getValue() - amount, 0D, data.getValue())); + entity.setValue(MathHelper.clamp(entity.getValue() - amount, 0D, entity.getValue())); // Treasure.logger.debug("new data -> {}", data); result = true; } - } +// } } return result; } @@ -97,7 +95,7 @@ public CompoundNBT writeToNBT(CompoundNBT nbt) { public static class Builder extends Charm.Builder { public Builder(Integer level) { - super(ModUtils.asLocation(HEALING + level), HEALING, level); + super(ModUtils.asLocation(HEALING_TYPE + level), HEALING_TYPE, level); } @Override diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java index 75cf3ff91..2c22e5fb1 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java @@ -20,6 +20,7 @@ package com.someguyssoftware.treasure2.charm; import java.util.List; +import java.util.Optional; import java.util.Random; import com.someguyssoftware.gottschcore.spatial.ICoords; @@ -49,17 +50,25 @@ public interface ICharm { public double getMaxPercent(); public Rarity getRarity(); public int getPriority(); - boolean isAllowMultipleUpdates(); + boolean isEffectStackable(); /** * */ ICharmEntity createEntity(); - public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmData data); + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity); public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity); public CompoundNBT writeToNBT(CompoundNBT nbt); + + /** + * + * @param nbt + * @return + */ + CompoundNBT save(CompoundNBT nbt); + } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java index 13ae62b62..4c4a7c8eb 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java @@ -19,17 +19,62 @@ */ package com.someguyssoftware.treasure2.charm; +import java.util.Comparator; +import java.util.Optional; + +import net.minecraft.nbt.CompoundNBT; + /** * * @author Mark Gottschling on Jan 16, 2021 * */ public interface ICharmEntity { + static String CHARM = "charm"; + static String VALUE = "value"; + ICharm getCharm(); - void setCharm(ICharm charm); - ICharmData getData(); + double getValue(); + void setValue(double value); + + int getDuration(); + void setDuration(int duration); - void setData(ICharmData data); + double getPercent(); + void setPercent(double percent); + + /** + * + * @param nbt + * @return + */ + CompoundNBT save(CompoundNBT nbt); + + /** + * + * @param nbt + * @return + */ + public static Optional load(CompoundNBT nbt) { + Optional charm = Charm.load((CompoundNBT) nbt.get(CHARM)); + if (!charm.isPresent()) { + return Optional.empty(); + } + + ICharmEntity entity = charm.get().createEntity(); + if (nbt.contains(VALUE)) { + entity.setValue(nbt.getDouble(VALUE)); + } + if (nbt.contains("duration")) { + entity.setDuration(nbt.getInt("duration")); + } + if (nbt.contains("percent")) { + entity.setPercent(nbt.getDouble("percent")); + } + return Optional.of(entity); + } + + void update(ICharmEntity entity); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java index 8451d83dc..2b442be88 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java @@ -19,7 +19,18 @@ */ package com.someguyssoftware.treasure2.charm; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.item.TreasureItems; + +import net.minecraft.item.Items; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; /** * @@ -27,46 +38,89 @@ * */ public class TreasureCharms { - public static final ICharm HEALING_1; - public static final ICharm HEALING_2; - public static final ICharm HEALING_3; - public static final ICharm HEALING_4; + // TODO additional registering (ie tags) needs to take place in a setup event method + // TODO probably need a new class that hold the max level and the spawn level range + private static final Map ITEM_TO_CHARM_LEVELS = new HashMap<>(); - public static final ICharm HEALING_15; + private static final Multimap, String> EVENT_CHARM_MAP = ArrayListMultimap.create(); + + public static final ICharm HEALING_1 = makeHealing(1); + public static final ICharm HEALING_2 = makeHealing(2); + public static final ICharm HEALING_3 = makeHealing(3); + public static final ICharm HEALING_4 = makeHealing(4); + public static final ICharm HEALING_5 = makeHealing(5); + public static final ICharm HEALING_6 = makeHealing(6); + public static final ICharm HEALING_7 = makeHealing(7); + public static final ICharm HEALING_8 = makeHealing(8); + public static final ICharm HEALING_9 = makeHealing(9); + public static final ICharm HEALING_10 = makeHealing(10); + public static final ICharm HEALING_11 = makeHealing(11); + public static final ICharm HEALING_12 = makeHealing(12); + public static final ICharm HEALING_13 = makeHealing(13); + public static final ICharm HEALING_14 = makeHealing(14); + public static final ICharm HEALING_15 = makeHealing(15); static { - HEALING_1 = new HealingCharm.Builder(1).with($ -> { - $.value = 20.0; - $.allowMultipleUpdates = true; - }) .build(); - - HEALING_2 = new HealingCharm.Builder(2).with($ -> { - $.value = 40.0; - $.allowMultipleUpdates = true; - }) .build(); +// ITEM_TO_CHARM_LEVELS.put(TreasureItems.TOPAZ.getRegistryName(), Integer.valueOf(4)); + ITEM_TO_CHARM_LEVELS.put(Items.DIAMOND.getRegistryName(), Integer.valueOf(5)); +// ITEM_TO_CHARM_LEVELS.put(TreasureItems.ONYX.getRegistryName(), Integer.valueOf(6)); + ITEM_TO_CHARM_LEVELS.put(Items.EMERALD.getRegistryName(), Integer.valueOf(7)); + ITEM_TO_CHARM_LEVELS.put(TreasureItems.RUBY.getRegistryName(), Integer.valueOf(9)); + ITEM_TO_CHARM_LEVELS.put(TreasureItems.SAPPHIRE.getRegistryName(), Integer.valueOf(11)); + ITEM_TO_CHARM_LEVELS.put(TreasureItems.WHITE_PEARL.getRegistryName(), Integer.valueOf(9)); + ITEM_TO_CHARM_LEVELS.put(TreasureItems.BLACK_PEARL.getRegistryName(), Integer.valueOf(11)); - HEALING_3 = new HealingCharm.Builder(3).with($ -> { - $.value = 60.0; - $.allowMultipleUpdates = true; - }) .build(); - - HEALING_4 = new HealingCharm.Builder(4).with($ -> { - $.value = 80.0; - $.allowMultipleUpdates = true; - $.rarity = Rarity.UNCOMMON; - }) .build(); - - HEALING_15 = new HealingCharm.Builder(5).with($ -> { - $.value = 300.0; - $.allowMultipleUpdates = true; - $.rarity = Rarity.EPIC; - }) .build(); + EVENT_CHARM_MAP.put(LivingUpdateEvent.class, HealingCharm.HEALING_TYPE); TreasureCharmRegistry.register(HEALING_1); TreasureCharmRegistry.register(HEALING_2); TreasureCharmRegistry.register(HEALING_3); TreasureCharmRegistry.register(HEALING_4); - + TreasureCharmRegistry.register(HEALING_5); + TreasureCharmRegistry.register(HEALING_6); + TreasureCharmRegistry.register(HEALING_7); + TreasureCharmRegistry.register(HEALING_8); + TreasureCharmRegistry.register(HEALING_9); + TreasureCharmRegistry.register(HEALING_10); + TreasureCharmRegistry.register(HEALING_11); + TreasureCharmRegistry.register(HEALING_12); + TreasureCharmRegistry.register(HEALING_13); + TreasureCharmRegistry.register(HEALING_14); TreasureCharmRegistry.register(HEALING_15); } + + /** + * Convenience method to build Healing Charm. + * @param level + * @return + */ + public static ICharm makeHealing(int level) { + return new HealingCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + } + + /** + * Accessor wrapper method to return Optional + * @param name + * @return + */ + public static Optional getCharmLevel(ResourceLocation name) { + if (name != null && ITEM_TO_CHARM_LEVELS.containsKey(name)) { + return Optional.of(ITEM_TO_CHARM_LEVELS.get(name)); + } + return Optional.empty(); + } + + /** + * Accesor wrapp method to return if an charm type is registered to an event. + * @param event + * @param type + * @return + */ + public static boolean isCharmEventRegistered(Class event, String type) { + return EVENT_CHARM_MAP.containsEntry(event, type); + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java index 876c38aa3..d874f4fe1 100644 --- a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java +++ b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java @@ -55,6 +55,7 @@ public class TreasureConfig extends AbstractConfig { public static final String PITS_CATEGORY = "pits"; public static final String MARKERS_CATEGORY = "markers"; public static final String KEYS_AND_LOCKS_CATEGORY = "keys and locks"; + public static final String BOOTY_CATEGORY = "booty"; public static final String COINS_CATEGORY = "coins"; public static final String GEMS_AND_ORES_CATEGORY = "gems and ores"; public static final String FOG_CATEGORY = "fog"; @@ -68,6 +69,7 @@ public class TreasureConfig extends AbstractConfig { public static final Markers MARKERS; public static final Wells WELLS; public static final KeysAndLocks KEYS_LOCKS; + public static final Booty BOOTY; public static final Coins COINS; public static final GemsAndOres GEMS_AND_ORES; public static final Fog FOG; @@ -85,6 +87,7 @@ public class TreasureConfig extends AbstractConfig { MARKERS = new Markers(COMMON_BUILDER); WELLS = new Wells(COMMON_BUILDER); KEYS_LOCKS = new KeysAndLocks(COMMON_BUILDER); + BOOTY = new Booty(COMMON_BUILDER); COINS = new Coins(COMMON_BUILDER); GEMS_AND_ORES = new GemsAndOres(COMMON_BUILDER); FOG = new Fog(COMMON_BUILDER); @@ -199,7 +202,9 @@ public static class BlockID { public static final String SKELETON_ID = "skeleton"; public static final String WITHER_BRANCH_ID = "wither_branch"; - public static final String WITHER_ROOT_ID = "wither_root"; + public static final String WITHER_ROOT_ID = "wither_root"; + public static final String TOPAZ_ORE_ID = "topaz_ore"; + public static final String ONYX_ORE_ID = "onyx_ore"; public static final String RUBY_ORE_ID = "ruby_ore"; public static final String SAPPHIRE_ORE_ID = "sapphire_ore"; public static final String WITHER_BROKEN_LOG_ID = "wither_broken_log"; @@ -210,6 +215,7 @@ public static class BlockID { public static final String FALLING_GRASS_ID = "falling_grass"; public static final String FALLING_SAND_ID = "falling_sand"; public static final String FALLING_RED_SAND_ID = "falling_red_sand"; + } public static class ChestID { @@ -715,11 +721,26 @@ public static class KeysAndLocks { } } + public static class Booty { + public ForgeConfigSpec.ConfigValue wealthMaxStackSize; + + public Booty(final ForgeConfigSpec.Builder builder) { + builder.comment(CATEGORY_DIV, " Treasure Loot and Valuables properties", CATEGORY_DIV) + .push(BOOTY_CATEGORY); + + wealthMaxStackSize = builder + .comment(" The maximum size of a wealth item stacks. ex. Coins, Gems, Pearls") + .defineInRange("Maximum Stack Size:", 8, 1, 64); + builder.pop(); + } + } + /** * * @author Mark Gottschling on Jan 13, 2021 * */ + // TODO replace with Booty public static class Coins { // @RequiresMcRestart public ForgeConfigSpec.ConfigValue coinMaxStackSize; @@ -738,17 +759,31 @@ public Coins(final ForgeConfigSpec.Builder builder) { public static class GemsAndOres { public ForgeConfigSpec.BooleanValue enableGemOreSpawn; + public ForgeConfigSpec.ConfigValue topazGenProbability; + public ForgeConfigSpec.ConfigValue topazOreMaxY; + public ForgeConfigSpec.ConfigValue topazOreMinY; + public ForgeConfigSpec.ConfigValue topazOreVeinSize; + public ForgeConfigSpec.ConfigValue topazOreVeinsPerChunk; + + public ForgeConfigSpec.ConfigValue onyxGenProbability; + public ForgeConfigSpec.ConfigValue onyxOreMaxY; + public ForgeConfigSpec.ConfigValue onyxOreMinY; + public ForgeConfigSpec.ConfigValue onyxOreVeinSize; + public ForgeConfigSpec.ConfigValue onyxOreVeinsPerChunk; + public ForgeConfigSpec.ConfigValue rubyGenProbability; public ForgeConfigSpec.ConfigValue rubyOreMaxY; public ForgeConfigSpec.ConfigValue rubyOreMinY; public ForgeConfigSpec.ConfigValue rubyOreVeinSize; public ForgeConfigSpec.ConfigValue rubyOreVeinsPerChunk; + public ForgeConfigSpec.ConfigValue sapphireGenProbability; public ForgeConfigSpec.ConfigValue sapphireOreMaxY; public ForgeConfigSpec.ConfigValue sapphireOreMinY; public ForgeConfigSpec.ConfigValue sapphireOreVeinSize; public ForgeConfigSpec.ConfigValue sapphireOreVeinsPerChunk; + // TODO rename to Ores public GemsAndOres(final ForgeConfigSpec.Builder builder) { builder.comment(CATEGORY_DIV, " Gems and Ores properties", CATEGORY_DIV) .push(GEMS_AND_ORES_CATEGORY); @@ -759,11 +794,11 @@ public GemsAndOres(final ForgeConfigSpec.Builder builder) { rubyGenProbability = builder .comment(" The probability that a ruby ore will spawn.") - .defineInRange("Probability of ruby ore spawn:", 70.0, 0.0, 100.0); + .defineInRange("Probability of ruby ore spawn:", 65.0, 0.0, 100.0); rubyOreMinY= builder .comment(" The minimum y-value where a ruby ore can spawn.") - .defineInRange("Minimum y-value for ruby ore spawn location:", 8, 1, 255); + .defineInRange("Minimum y-value for ruby ore spawn location:", 6, 1, 255); rubyOreMaxY= builder .comment(" The maximum y-value where a ruby ore can spawn.") @@ -779,11 +814,11 @@ public GemsAndOres(final ForgeConfigSpec.Builder builder) { sapphireGenProbability = builder .comment(" The probability that a sapphire ore will spawn.") - .defineInRange("Probability of sapphire ore spawn:", 70.0, 0.0, 100.0); + .defineInRange("Probability of sapphire ore spawn:", 65.0, 0.0, 100.0); sapphireOreMinY= builder .comment(" The minimum y-value where a sapphire ore can spawn.") - .defineInRange("Minimum y-value for sapphire ore spawn location:", 8, 1, 255); + .defineInRange("Minimum y-value for sapphire ore spawn location:", 6, 1, 255); sapphireOreMaxY= builder .comment(" The maximum y-value where a sapphire ore can spawn.") @@ -797,6 +832,46 @@ public GemsAndOres(final ForgeConfigSpec.Builder builder) { .comment(" The number of sapphire ore veins in a chunk.") .defineInRange("Sapphire ore veins per chunk:", 1, 3, 20); + topazGenProbability = builder + .comment(" The probability that a topaz ore will spawn.") + .defineInRange("Probability of topaz ore spawn:", 75.0, 0.0, 100.0); + + topazOreMinY= builder + .comment(" The minimum y-value where a topaz ore can spawn.") + .defineInRange("Minimum y-value for topaz ore spawn location:", 9, 1, 255); + + topazOreMaxY= builder + .comment(" The maximum y-value where a topaz ore can spawn.") + .defineInRange("Maximum y-value for topaz ore spawn location:", 25, 1, 255); + + topazOreVeinSize = builder + .comment(" The number of topaz ore blocks in a vein.") + .defineInRange("Topaz ore vein size:", 3, 3, 20); + + topazOreVeinsPerChunk = builder + .comment(" The number of topaz ore veins in a chunk.") + .defineInRange("Topaz ore veins per chunk:", 1, 1, 20); + + onyxGenProbability = builder + .comment(" The probability that a onyx ore will spawn.") + .defineInRange("Probability of onyx ore spawn:", 70.0, 0.0, 100.0); + + onyxOreMinY= builder + .comment(" The minimum y-value where a onyx ore can spawn.") + .defineInRange("Minimum y-value for onyx ore spawn location:", 9, 1, 255); + + onyxOreMaxY= builder + .comment(" The maximum y-value where a onyx ore can spawn.") + .defineInRange("Maximum y-value for onyx ore spawn location:", 24, 1, 255); + + onyxOreVeinSize = builder + .comment(" The number of onyx ore blocks in a vein.") + .defineInRange("Onyx ore vein size:", 3, 3, 20); + + onyxOreVeinsPerChunk = builder + .comment(" The number of onyx ore veins in a chunk.") + .defineInRange("Onyx ore veins per chunk:", 1, 1, 20); + builder.pop(); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java b/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java index 9cbfebc49..8b4bafa7e 100644 --- a/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java +++ b/src/main/java/com/someguyssoftware/treasure2/enums/Coins.java @@ -13,6 +13,7 @@ * @author Mark Gottschling on Sep 13, 2014 * */ +@Deprecated public enum Coins implements IEnum { COPPER(0, "Copper Coin"), SILVER(1, "Silver Coin"), diff --git a/src/main/java/com/someguyssoftware/treasure2/enums/Pearls.java b/src/main/java/com/someguyssoftware/treasure2/enums/Pearls.java index 4db1b2dea..a57b73574 100644 --- a/src/main/java/com/someguyssoftware/treasure2/enums/Pearls.java +++ b/src/main/java/com/someguyssoftware/treasure2/enums/Pearls.java @@ -12,6 +12,7 @@ * @author Mark Gottschling on Aug 18, 2019 * */ +@Deprecated public enum Pearls implements IEnum { WHITE(0, "White PearlItem"), BLACK(1, "Black PearlItem"); diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java index 53e305967..51a590758 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java @@ -1,29 +1,267 @@ package com.someguyssoftware.treasure2.eventhandler; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.function.Supplier; + +import com.someguyssoftware.gottschcore.spatial.Coords; import com.someguyssoftware.gottschcore.world.WorldInfo; import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.CharmEntity; +import com.someguyssoftware.treasure2.charm.ICharm; +import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.item.CoinItem; +import com.someguyssoftware.treasure2.item.IWishable; import com.someguyssoftware.treasure2.item.PearlItem; +import com.someguyssoftware.treasure2.network.CharmMessageToClient; +import com.someguyssoftware.treasure2.network.TreasureNetworking; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Hand; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.ItemAttributeModifierEvent; import net.minecraftforge.event.entity.item.ItemTossEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.loading.FMLLoader; +import net.minecraftforge.fml.network.PacketDistributor; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.SlotTypePreset; +import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; +import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; /** * @author Mark Gottschling on Apr 26, 2018 * */ -//@Mod.EventBusSubscriber(modid = Treasure.MODID, bus = EventBusSubscriber.Bus.FORGE) +@Mod.EventBusSubscriber(modid = Treasure.MODID, bus = EventBusSubscriber.Bus.FORGE) public class PlayerEventHandler { + private static final String CURIOS_ID = "curios"; + private static final List curiosSlots = Arrays.asList("necklace", "bracelet", "ring", "charm"); + + /** + * changes to current (1.12.2) methodology + * [x] 1. Register Charm types with Events so only charms related to the event will be processed and can eliminate a instanceof check for every charm. + * [x] 2. Gather all charms to be processed first, filter if appropriate, then sort by priority, then execute them. + */ + + /* + * Subscribing to multiple types of Living events for Charm Interactions so that instanceof doesn't have to be called everytime. + */ + + /** + * + * @param event + */ + @SubscribeEvent + public static void checkCharmsInteraction(LivingUpdateEvent event) { + if (WorldInfo.isClientSide(event.getEntity().level)) { + return; + } + + // do something to player every update tick: + if (event.getEntity() instanceof PlayerEntity) { + + // get the player + ServerPlayerEntity player = (ServerPlayerEntity) event.getEntity(); + processCharms(event, player); + } + } + + /** + * + * @param event + * @param player + */ + private static void processCharms(Event event, ServerPlayerEntity player) { + /* + * a list of charm contexts to execute + */ + List charmsToExecute; + + Treasure.LOGGER.debug("processing charms..."); + // gather all charms + charmsToExecute = gatherCharms(event, player); + Treasure.LOGGER.debug("size of charms to execute -> {}", charmsToExecute.size()); + // TODO filter charms ?? + + // sort charms + Collections.sort(charmsToExecute, CharmContext.priorityComparator); + + // execute charms + executeCharms(event, player, charmsToExecute); + } + + /** + * Examine and collect all Charms (not CharmEntity nor CharmItems) that the player has in valid slots. + * @param event + * @param player + * @return + */ + private static List gatherCharms(Event event, ServerPlayerEntity player) { + final List contexts = new ArrayList<>(5); + + // get the slot provider - curios (general slots) or minecraft (hotbar) + String slotProviderId = ModList.get().isLoaded(CURIOS_ID) ? CURIOS_ID : "minecaft"; + + // check each hand + for (Hand hand : Hand.values()) { + Treasure.LOGGER.debug("checking hand -> {}", hand.name()); + ItemStack heldStack = player.getItemInHand(hand); + heldStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + Treasure.LOGGER.debug("hand charm has cap!"); + for (InventoryType type : InventoryType.values()) { + Treasure.LOGGER.debug("hand charm checking inventory type -> {}", type); + AtomicInteger index = new AtomicInteger(); + // requires indexed for-loop + for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { + ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); + Treasure.LOGGER.debug("hand cap got charm entity -> {}", entity.getCharm().getName().toString()); + // cap.getCharmEntities()[type.getValue()].forEach(entity -> { + if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { + Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); + continue; + } + index.set(i); + CharmContext context = new CharmContext.Builder().with($ -> { + $.hand = hand; + $.itemStack = heldStack; + $.capability = cap; + $.type = type; + $.index = index.get(); + $.entity = entity; + }).build(); + Treasure.LOGGER.debug("hand charm adding to context"); + contexts.add(context); + // }); + } + } + }); + } + + // check slots + if (slotProviderId.equals(CURIOS_ID)) { + // check curio slots + LazyOptional handler = CuriosApi.getCuriosHelper().getCuriosHandler(player); + handler.ifPresent(itemHandler -> { + // curios type names -> head, necklace, back, bracelet, hands, ring, belt, charm, feet + curiosSlots.forEach(slot -> { + Optional stacksOptional = itemHandler.getStacksHandler(slot); + stacksOptional.ifPresent(stacksHandler -> { + ItemStack curiosStack = stacksHandler.getStacks().getStackInSlot(0); + Treasure.LOGGER.debug("curios.charm slot stack -> {}", curiosStack.getDisplayName().getString()); + curiosStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + for (InventoryType type : InventoryType.values()) { + AtomicInteger index = new AtomicInteger(); + // requires indexed for-loop + for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { + ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); + Treasure.LOGGER.debug("curios cap got charm entity -> {}", entity.getCharm().getName().toString()); + + // cap.getCharmEntities()[type.getValue()].forEach(entity -> { + if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { + Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); + continue; + } + index.set(i); + CharmContext curiosContext = new CharmContext.Builder().with($ -> { + $.slotProviderId = slotProviderId; + $.slot = slot; + $.itemStack = curiosStack; + $.capability = cap; + $.type = type; + $.index = index.get(); + $.entity = entity; + }).build(); + Treasure.LOGGER.debug("curios charm adding to context"); + contexts.add(curiosContext); + } + // }); + } + }); + }); + }); + }); + } + else { + // TODO check hotbar slots + // TODO only allow IAdornments from hotbar + } + return contexts; + } + + /** + * + * @param event + * @param player + * @param contexts + */ + private static void executeCharms(Event event, ServerPlayerEntity player, List contexts) { + Treasure.LOGGER.debug("executing charms..."); + /* + * a list of charm types that are non-stackable that should not be executed more than once. + */ + final List executeOnceCharmTypes = new ArrayList<>(5); + + contexts.forEach(context -> { + Treasure.LOGGER.debug("....charm -> {}", context.getEntity().getCharm().getName().toString()); + ICharm charm = (ICharm)context.getEntity().getCharm(); + if (!charm.isEffectStackable()) { + // check if this charm type is already in the monitored list + if (executeOnceCharmTypes.contains(charm.getType())) { + return; + } + else { + Treasure.LOGGER.debug("adding charm to execute once list"); + // add the charm type to the monitored list + executeOnceCharmTypes.add(charm.getType()); + } + } + + // if charm is executable and executes successfully + if (context.getEntity().getCharm().update(player.level, new Random(), new Coords(player.position()), player, event, context.getEntity())) { + // send state message to client + // CharmMessageToClient message = new CharmMessageToClient(player.getStringUUID(), entity, context.hand, context.slot, context.slotProviderId); + // Treasure.logger.debug("Message to client -> {}", message); + // TreasureNetworking.simpleChannel.send(PacketDistributor.PLAYER.with(() -> player), message); + } + + // remove if uses are empty and the capability is bindable ie. charm, not adornment + // NOTE this leaves empty charms on non-bindables for future recharge + if (context.getEntity().getValue() <= 0.0 && context.capability.isBindable()) { + Treasure.LOGGER.debug("charm is empty -> remove"); + // locate the charm from context and remove + context.capability.getCharmEntities()[context.type.getValue()].remove(context.getIndex()); + } + }); + } /** * @@ -35,21 +273,119 @@ public void onTossCoinEvent(ItemTossEvent event) { return; } Treasure.LOGGER.debug("is remote? -> {}", !event.getPlayer().level.isClientSide); -Treasure.LOGGER.debug("{} tossing coin -> {}", event.getPlayer().getName().getString(), event.getEntityItem().getItem().getDisplayName()); + Treasure.LOGGER.debug("{} tossing item -> {}", event.getPlayer().getName().getString(), event.getEntityItem().getItem().getDisplayName().getString()); Item item = event.getEntityItem().getItem().getItem(); - if (item instanceof /*IWishable*/CoinItem || item instanceof PearlItem) { + if (item instanceof IWishable) { ItemStack stack = event.getEntityItem().getItem(); CompoundNBT nbt = new CompoundNBT(); - nbt.putString(CoinItem.DROPPED_BY_KEY, event.getPlayer().getName().getString()); - Treasure.LOGGER.debug("adding tag to coin stack..."); + nbt.putString(IWishable.DROPPED_BY_KEY, event.getPlayer().getName().getString()); + Treasure.LOGGER.debug("adding tag to wishable stack..."); stack.setTag(nbt); } } - - @SubscribeEvent - public void onItemInfo(ItemTooltipEvent event) { - if (event.getItemStack().getItem() == Items.EMERALD) { - event.getToolTip().add(new TranslationTextComponent("tooltip.label.coin").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + + // TODO test - remove + // @SubscribeEvent + // public void onItemInfo(ItemTooltipEvent event) { + // if (event.getItemStack().getItem() == Items.EMERALD) { + // event.getToolTip().add(new TranslationTextComponent("tooltip.label.coin").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + // } + // } + + private static class CharmContext { + private Hand hand; + private String slotProviderId; + private String slot; + private ItemStack itemStack; + private ICharmableCapability capability; + private InventoryType type; + private int index; + private ICharmEntity entity; + + /** + * + */ + CharmContext() {} + + CharmContext(Builder builder) { + this.hand = builder.hand; + this.slotProviderId = builder.slotProviderId; + this.slot = builder.slot; + this.itemStack = builder.itemStack; + this.capability = builder.capability; + this.type = builder.type; + this.index = builder.index; + this.entity = builder.entity; + } + + public static Comparator priorityComparator = new Comparator() { + @Override + public int compare(CharmContext p1, CharmContext p2) { + // use p1 < p2 because the sort should be ascending + if (p1.getEntity().getCharm().getPriority() < p2.getEntity().getCharm().getPriority()) { + // greater than + return 1; + } + else { + // less than + return -1; + } + } + }; + + public Hand getHand() { + return hand; + } + + public String getSlotProviderId() { + return slotProviderId; + } + + public String getSlot() { + return slot; + } + + public ItemStack getItemStack() { + return itemStack; + } + + public InventoryType getType() { + return type; + } + + public int getIndex() { + return index; + } + + public ICharmEntity getEntity() { + return entity; + } + + public static class Builder { + public Hand hand; + public String slotProviderId; + public String slot; + public ItemStack itemStack; + public ICharmableCapability capability; + public InventoryType type; + public int index; + public ICharmEntity entity; + + public Builder with(Consumer builder) { + builder.accept(this); + return this; + } + + public CharmContext build() { + return new CharmContext(this); + } + } + + @Override + public String toString() { + return "CharmContext [hand=" + hand + ", slotProviderId=" + slotProviderId + ", slot=" + slot + + ", itemStack=" + itemStack == null ? "N/A" : itemStack.getDisplayName().getString() + + "type=" + type + "]"; } } } diff --git a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java index f53bb0f16..42ab7e88e 100644 --- a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java +++ b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java @@ -19,14 +19,23 @@ */ package com.someguyssoftware.treasure2.init; +import java.util.Optional; + +import com.google.common.util.concurrent.AtomicDouble; import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.data.TreasureData; +import com.someguyssoftware.treasure2.item.TreasureItems; import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; import com.someguyssoftware.treasure2.registry.TreasureDecayRegistry; import com.someguyssoftware.treasure2.registry.TreasureMetaRegistry; import com.someguyssoftware.treasure2.registry.TreasureTemplateRegistry; +import net.minecraft.item.ItemModelsProperties; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; /** @@ -56,4 +65,18 @@ public static void common(final FMLCommonSetupEvent event) { TreasureTemplateRegistry.create(Treasure.instance); TreasureDecayRegistry.create(Treasure.instance); } + + public static void clientSetup(final FMLClientSetupEvent event) { + event.enqueueWork(() -> { + ItemModelsProperties.register(TreasureItems.CHARM, + new ResourceLocation(Treasure.MODID, "model"), (stack, world, living) -> { + AtomicDouble d = new AtomicDouble(0); + stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + Optional level = TreasureCharms.getCharmLevel(cap.getSourceItem()); + d.set(cap.getBaseMaterial().getMaxCharmLevel() + (level.isPresent() ? level.get() : 0)) ; + }); + return d.floatValue(); + }); + }); + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java new file mode 100644 index 000000000..45eecb71b --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java @@ -0,0 +1,133 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.item; + +import java.util.List; + +import com.someguyssoftware.gottschcore.item.ModItem; +import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.config.TreasureConfig; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +/** + * @author Mark Gottschling on Aug 17, 2021 + * + */ +public class CharmItem extends ModItem { + // TEMP this probably will need to move to CharmableCap or another cap if want to make this work with TAGs. +// private ResourceLocation sourceItem; +// private int charmLevel; + + /** + * + * @param modID + * @param name + * @param properties + */ + public CharmItem(String modID, String name, Properties properties) { + // TODO remove later from creative + super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP) + .stacksTo(1)); +// setCharmLevel(7); + // TODO set default item + } + + /** + * + * @param modID + * @param name + * @param properties + * @param sourceItem + */ +// public CharmItem(String modID, String name, Properties properties, ResourceLocation sourceItem) { +// this(modID, name, properties); +// setSourceItem(sourceItem); +// } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + // TODO create new CharmItemCapProvider which includes POUCHABLE cap (not everything that is charmable is pouchable) + CharmableCapabilityProvider provider = new CharmableCapabilityProvider(); + return provider; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + // charmable info + ICharmableCapability cap = getCap(stack); + if (cap.isCharmed()) { + cap.appendHoverText(stack, worldIn, tooltip, flagIn); + } + } + + /** + * Convenience method. + * @param stack + * @return + */ + public ICharmableCapability getCap(ItemStack stack) { + return stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY, null).orElseThrow(IllegalStateException::new); + } + + /** + * + */ + @Override + public boolean isFoil(ItemStack stack) { + ICharmableCapability cap = getCap(stack); + if (cap.isCharmed()) { + return true; + } + else { + return false; + } + } + +// public ResourceLocation getSourceItem() { +// return sourceItem; +// } +// +// public void setSourceItem(ResourceLocation sourceItem) { +// this.sourceItem = sourceItem; +// } + +// public int getCharmLevel() { +// return charmLevel; +// } +// +// public void setCharmLevel(int charmLevel) { +// this.charmLevel = charmLevel; +// } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java index 61137445d..2552e10b0 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java @@ -53,6 +53,7 @@ * @author Mark Gottschling on Sep 13, 2014 * */ +@Deprecated public class CoinItem extends ModItem implements IWishable { private static final int MAX_CUSTOM_STACK_SIZE = 64; public static final int MAX_STACK_SIZE = 8; diff --git a/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java b/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java index df0d9caa6..0353d1a72 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java @@ -21,12 +21,14 @@ import static com.someguyssoftware.treasure2.Treasure.LOGGER; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Random; import com.someguyssoftware.gottschcore.loot.LootTableShell; import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.enums.Coins; import com.someguyssoftware.treasure2.enums.Rarity; import com.someguyssoftware.treasure2.loot.TreasureLootTableMaster2; import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; @@ -77,4 +79,31 @@ default public void injectLoot(World world, Random random, List itemS default public Optional> buildInjectedLootTableList(String key, Rarity rarity) { return Optional.ofNullable(TreasureLootTableRegistry.getLootTableMaster().getLootTableByKeyRarity(TreasureLootTableMaster2.ManagedTableType.INJECT, key, rarity)); } + + /** + * + * @return + */ + default public List getLootTables() { + return TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.COMMON); + } + + /** + * + * @param random + * @return + */ + default public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.COMMON)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + + /** + * + * @param random + * @return + */ + default public Rarity getDefaultEffectiveRarity(Random random) { + return Rarity.UNCOMMON; + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/PearlItem.java b/src/main/java/com/someguyssoftware/treasure2/item/PearlItem.java index fdbcd21ec..933810b99 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/PearlItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/PearlItem.java @@ -58,6 +58,7 @@ public class PearlItem extends ModItem /*implements IWishable, IPouchable*/ { /** * */ + @Deprecated public PearlItem (String modID, String name, Item.Properties properties) { super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP) .stacksTo(MAX_STACK_SIZE)); diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index e90098c92..5f49fe630 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -19,12 +19,15 @@ */ package com.someguyssoftware.treasure2.item; +import java.util.ArrayList; import java.util.List; +import java.util.Random; import java.util.function.Supplier; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import com.someguyssoftware.gottschcore.item.ModItem; +import com.someguyssoftware.gottschcore.loot.LootTableShell; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.block.TreasureBlocks; import com.someguyssoftware.treasure2.capability.CharmableCapability; @@ -32,7 +35,8 @@ import com.someguyssoftware.treasure2.capability.ICharmableCapability; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; import com.someguyssoftware.treasure2.charm.TreasureCharms; -import com.someguyssoftware.treasure2.capability.CharmableCapability.CharmInventoryType; +import com.someguyssoftware.treasure2.capability.CharmableCapability.BaseMaterial; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.config.TreasureConfig; import com.someguyssoftware.treasure2.config.TreasureConfig.KeyID; import com.someguyssoftware.treasure2.config.TreasureConfig.LockID; @@ -40,6 +44,8 @@ import com.someguyssoftware.treasure2.enums.Coins; import com.someguyssoftware.treasure2.enums.Pearls; import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; +import com.someguyssoftware.treasure2.loot.TreasureLootTableMaster2.SpecialLootTables; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.BlockColors; @@ -49,6 +55,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.item.SwordItem; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.text.StringTextComponent; @@ -102,7 +109,7 @@ public class TreasureItems { public static KeyItem THIEFS_LOCK_PICK; public static KeyRingItem KEY_RING; - + // locks public static LockItem WOOD_LOCK; public static LockItem STONE_LOCK; @@ -121,27 +128,30 @@ public class TreasureItems { public static Item COPPER_COIN; public static Item SILVER_COIN; public static Item GOLD_COIN; - + // gems public static Item SAPPHIRE; public static Item RUBY; public static Item WHITE_PEARL; public static Item BLACK_PEARL; - - // charmed - public static CoinItem TEST_COIN; - + + // charms + public static CharmItem CHARM; + public static CharmItem SAPPHIRE_CHARM; + // public static CoinItem TEST_COIN; + public static CharmItem TEST_CHARM; + // wither items public static Item WITHER_STICK_ITEM; public static Item WITHER_ROOT_ITEM; // other public static Item SKELETON; -// public static Item EYE_PATCH; - + // public static Item EYE_PATCH; + // swords public static Item SKULL_SWORD; - + // key map public static Multimap keys; // lock map @@ -154,13 +164,13 @@ public class TreasureItems { */ @SubscribeEvent public static void registerItems(RegistryEvent.Register event) { - + /* * initialize items */ LOGO = new ModItem(Treasure.MODID, "treasure_tab", new Item.Properties()); TREASURE_TOOL = new TreasureToolItem(Treasure.MODID, "treasure_tool", new Item.Properties()); - + // KEYS WOOD_KEY = new KeyItem(Treasure.MODID, KeyID.WOOD_KEY_ID, new Item.Properties().durability(TreasureConfig.KEYS_LOCKS.woodKeyMaxUses.get())) .setCategory(Category.ELEMENTAL) @@ -270,11 +280,11 @@ public static void registerItems(RegistryEvent.Register event) { .setSuccessProbability(32); KEY_RING = new KeyRingItem(Treasure.MODID, KeyID.KEY_RING_ID, new Item.Properties()); - + keys = ArrayListMultimap.create(); keys.put(WOOD_KEY.getRarity(), WOOD_KEY); // TODO finish list - + // LOCKS WOOD_LOCK = new LockItem(Treasure.MODID, LockID.WOOD_LOCK_ID, new Item.Properties(), new KeyItem[] {WOOD_KEY}) .setCategory(Category.ELEMENTAL) @@ -329,51 +339,143 @@ public static void registerItems(RegistryEvent.Register event) { locks.put(SAPPHIRE_LOCK.getRarity(), SAPPHIRE_LOCK); locks.put(SPIDER_LOCK.getRarity(), SPIDER_LOCK); // NOTE wither lock is a special and isn't used in the general locks list - + // COINS - COPPER_COIN = new CoinItem(Treasure.MODID, TreasureConfig.ItemID.COPPER_COIN_ID, new Item.Properties()).setCoin(Coins.COPPER); - SILVER_COIN = new CoinItem(Treasure.MODID, TreasureConfig.ItemID.SILVER_COIN_ID, new Item.Properties()).setCoin(Coins.SILVER); - GOLD_COIN = new CoinItem(Treasure.MODID, TreasureConfig.ItemID.GOLD_COIN_ID, new Item.Properties()); - + COPPER_COIN = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.COPPER_COIN_ID, new Item.Properties()); + SILVER_COIN = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.SILVER_COIN_ID, new Item.Properties()) { + @Override + public List getLootTables() { + List lootTables = new ArrayList<>(); + lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.UNCOMMON)); + lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.SCARCE)); + return lootTables; + } + @Override + public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.UNCOMMON)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + }; + GOLD_COIN = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.GOLD_COIN_ID, new Item.Properties()) { + @Override + public List getLootTables() { + List lootTables = new ArrayList<>(); + lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.SCARCE)); + lootTables.addAll(TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.RARE)); + return lootTables; + } + @Override + public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.SCARCE)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + }; + // GEMS - SAPPHIRE = new GemItem(Treasure.MODID, TreasureConfig.ItemID.SAPPHIRE_ID, new Item.Properties()); - RUBY = new GemItem(Treasure.MODID, TreasureConfig.ItemID.RUBY_ID, new Item.Properties()); - + RUBY = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.RUBY_ID, new Item.Properties()) { + @Override + public List getLootTables() { + return TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.RARE); + } + @Override + public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.RARE)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + }; + SAPPHIRE = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.SAPPHIRE_ID, new Item.Properties()) { + @Override + public List getLootTables() { + return TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.EPIC); + } + @Override + public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.EPIC)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + }; + // PEARLS - WHITE_PEARL = new PearlItem(Treasure.MODID, TreasureConfig.ItemID.WHITE_PEARL_ID, new Item.Properties()).setPearl(Pearls.WHITE); - BLACK_PEARL = new PearlItem(Treasure.MODID, TreasureConfig.ItemID.BLACK_PEARL_ID, new Item.Properties()).setPearl(Pearls.BLACK); - + WHITE_PEARL = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.WHITE_PEARL_ID, new Item.Properties()) { + @Override + public List getLootTables() { + List lootTables = new ArrayList<>(); + lootTables.add(TreasureLootTableRegistry.getLootTableMaster().getSpecialLootTable(SpecialLootTables.WHITE_PEARL_WELL)); + return lootTables; + } + @Override + public ItemStack getDefaultLootKey (Random random) { + return new ItemStack(Items.DIAMOND); + } + }; + BLACK_PEARL = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.BLACK_PEARL_ID, new Item.Properties()) { + @Override + public List getLootTables() { + List lootTables = new ArrayList<>(); + lootTables.add(TreasureLootTableRegistry.getLootTableMaster().getSpecialLootTable(SpecialLootTables.BLACK_PEARL_WELL)); + return lootTables; + } + @Override + public ItemStack getDefaultLootKey (Random random) { + return new ItemStack(Items.EMERALD); + } + }; + // CHARMS - TEST_COIN = new CoinItem(Treasure.MODID, "test_coin", new Item.Properties()) { + CHARM = new CharmItem(Treasure.MODID, "charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { - ICharmableCapability cap = new CharmableCapability.Builder().with($ -> { + ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { + $.source(true) + .baseMaterial(BaseMaterial.COPPER); + }).build(); + return new CharmableCapabilityProvider(cap); + } + }; + + // TODO create a Builder for Charms + TEST_CHARM = new CharmItem(Treasure.MODID, "test_charm", new Item.Properties()) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + ICharmableCapability cap = new CharmableCapability.Builder(SAPPHIRE.getRegistryName()).with($ -> { $.finite(true, 1); - $.imbue(true, 1); - $.socketable(true, 1); + $.source(true); + $.bindable(true); }).build(); - + // add charms - cap.add(CharmInventoryType.FINITE, TreasureCharms.HEALING_1.createEntity()); - cap.add(CharmInventoryType.IMBUE, TreasureCharms.HEALING_1.createEntity()); - cap.add(CharmInventoryType.SOCKET, TreasureCharms.HEALING_1.createEntity()); - stack.setHoverName(new StringTextComponent("Sal'andaar Stone's Third Eye")); + cap.add(InventoryType.FINITE, TreasureCharms.HEALING_1.createEntity()); + stack.setHoverName(new StringTextComponent("Sal'andaar Stone's Brain")); return new CharmableCapabilityProvider(cap); } }; - TEST_COIN.setCoin(Coins.COPPER); - + + SAPPHIRE_CHARM = new CharmItem(Treasure.MODID, "sapphire_charm", new Item.Properties()) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + ICharmableCapability cap = new CharmableCapability.Builder(SAPPHIRE.getRegistryName()).with($ -> { + $.finite(true, 1) + .bindable(true) + .source(true) + .baseMaterial(BaseMaterial.GOLD); + }).build(); + + // add charms + cap.add(InventoryType.FINITE, TreasureCharms.HEALING_15.createEntity()); + stack.setHoverName(new StringTextComponent("Bindable Sapphire Charm")); + return new CharmableCapabilityProvider(cap); + } + }; + // WITHER ITEMS WITHER_STICK_ITEM = new WitherStickItem(Treasure.MODID, TreasureConfig.ItemID.WITHER_STICK_ITEM_ID, TreasureBlocks.WITHER_BRANCH, new Item.Properties()); WITHER_ROOT_ITEM = new WitherRootItem(Treasure.MODID, TreasureConfig.ItemID.WITHER_ROOT_ITEM_ID, TreasureBlocks.WITHER_ROOT, new Item.Properties()); - + // OTHER SKELETON = new SkeletonItem(Treasure.MODID, TreasureConfig.ItemID.SKELETON_ITEM_ID, TreasureBlocks.SKELETON, new Item.Properties()); - + SKULL_SWORD = new SwordItem(TreasureItemTier.SKULL, 3, -2.4F, new Item.Properties().tab(TreasureItemGroups.MOD_ITEM_GROUP)) .setRegistryName(Treasure.MODID, TreasureConfig.ItemID.SKULL_SWORD_ID); -// EYE_PATCH = new DyeableArmorItem(ArmorMaterial.LEATHER, EquipmentSlotType.HEAD, (new Item.Properties()).group(TreasureItemGroups.MOD_ITEM_GROUP)) -// .setRegistryName(Treasure.MODID, TreasureConfig.ItemID.EYE_PATCH_ID); - + // EYE_PATCH = new DyeableArmorItem(ArmorMaterial.LEATHER, EquipmentSlotType.HEAD, (new Item.Properties()).group(TreasureItemGroups.MOD_ITEM_GROUP)) + // .setRegistryName(Treasure.MODID, TreasureConfig.ItemID.EYE_PATCH_ID); + /* * register items (make sure you always set the registry name). */ @@ -414,7 +516,10 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { COPPER_COIN, SILVER_COIN, GOLD_COIN, - TEST_COIN, + CHARM, + SAPPHIRE_CHARM, + // TEST_COIN, + TEST_CHARM, RUBY, SAPPHIRE, WHITE_PEARL, @@ -423,7 +528,6 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { WITHER_ROOT_ITEM, SKULL_SWORD, SKELETON -// EYE_PATCH ); } @@ -446,7 +550,7 @@ public static void registerItemColours(final ColorHandlerEvent.Item event) { itemColors.register(itemBlockColourHandler, TreasureBlocks.FALLING_GRASS); } - + /** * * @author Mark Gottschling on Aug 12, 2020 diff --git a/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java b/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java new file mode 100644 index 000000000..f6ad48744 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java @@ -0,0 +1,230 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.item; + +import static com.someguyssoftware.treasure2.Treasure.LOGGER; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.Random; + +import com.someguyssoftware.gottschcore.block.BlockContext; +import com.someguyssoftware.gottschcore.item.ModItem; +import com.someguyssoftware.gottschcore.loot.LootPoolShell; +import com.someguyssoftware.gottschcore.loot.LootTableShell; +import com.someguyssoftware.gottschcore.random.RandomHelper; +import com.someguyssoftware.gottschcore.spatial.Coords; +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.gottschcore.world.WorldInfo; +import com.someguyssoftware.treasure2.block.IWishingWellBlock; +import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.config.TreasureConfig; +import com.someguyssoftware.treasure2.enums.Coins; +import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; + +import net.minecraft.block.Blocks; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameterSets; +import net.minecraft.loot.LootParameters; +import net.minecraft.loot.LootPool; +import net.minecraft.loot.LootTable; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +/** + * @author Mark Gottschling on Aug 17, 2021 + * + */ +public class WealthItem extends ModItem implements IWishable { + // NOTE this is kind of moot as the config would already have an upper level + private static final int MAX_CUSTOM_STACK_SIZE = 64; + + /** + * + * @param modID + * @param name + * @param properties + */ + public WealthItem(String modID, String name, Properties properties) { + super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP) + .stacksTo(Math.min(MAX_CUSTOM_STACK_SIZE, TreasureConfig.BOOTY.wealthMaxStackSize.get()))); + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + // standard coin info + tooltip.add(new TranslationTextComponent("tooltip.label.wishable").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + } + + /** + * + */ + @Override + public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entityItem) { + // get the item stack or number of items. + ItemStack entityItemStack = entityItem.getItem(); + + World world = entityItem.level; + if (WorldInfo.isClientSide(world)) { + return super.onEntityItemUpdate(stack, entityItem); + } + + // get the position + ICoords coords = new Coords(entityItem.blockPosition()); + BlockContext blockContext = new BlockContext(world, coords); + int numWishingWellBlocks = 0; + // check if in water + if (blockContext.equalsBlock(Blocks.WATER)) { + // check if the water block is adjacent to 2 wishing well blocks + ICoords checkCoords = coords.add(-1, 0, -1); + for (int z = 0; z < 3; z++) { + for (int x = 0; x < 3; x++) { + BlockContext checkCube = new BlockContext(world, checkCoords); + if (checkCube.toBlock() instanceof IWishingWellBlock) { + numWishingWellBlocks++; + } + if (numWishingWellBlocks >= 2) { + break; + } + } + } + + if (numWishingWellBlocks >=2) { + Random random = new Random(); + for (int itemIndex = 0; itemIndex < entityItemStack.getCount(); itemIndex++) { + // generate an item for each item in the stack + Optional lootStack = generateLoot(world, random, entityItem.getItem(), coords); + if (lootStack.isPresent()) { + // spawn the item + InventoryHelper.dropItemStack(world, (double)coords.getX(), (double)coords.getY()+1, (double)coords.getZ(), lootStack.get()); + } + } + // remove the item entity + entityItem.remove(); + return true; + } + } + return super.onEntityItemUpdate(stack, entityItem); + } + + /** + * + * @param world + * @param random + * @param itemStack + * @param coords + */ + @Override + public Optional generateLoot(World world, Random random, ItemStack itemStack, ICoords coords) { + List lootTables = getLootTables(); + + // TODO most of this seems repeated from IChestGenerator. Make a common class/methods + + ItemStack outputStack = null; + // handle if loot tables is null or size = 0. return an item (apple) to ensure continuing functionality + if (lootTables == null || lootTables.size() == 0) { + outputStack = getDefaultLootKey(random); + } + else { + // attempt to get the player who dropped the coin + ItemStack wealthItem = itemStack; + CompoundNBT nbt = wealthItem.getTag(); + LOGGER.debug("item as a tag"); + PlayerEntity player = null; + if (nbt != null && nbt.contains(DROPPED_BY_KEY)) { + // TODO change to check by UUID + for (PlayerEntity p : world.players()) { + if (p.getName().getString().equalsIgnoreCase(nbt.getString(DROPPED_BY_KEY))) { + player = p; + } + } + if (player != null && LOGGER.isDebugEnabled()) { + LOGGER.debug("coin dropped by player -> {}", player.getName()); + } + else { + LOGGER.debug("can't find player!"); + } + } +// LOGGER.debug("player -> {}", player.getName().getString()); + + // select a table shell + LootTableShell tableShell = lootTables.get(RandomHelper.randomInt(random, 0, lootTables.size()-1)); + if (tableShell.getResourceLocation() == null) { + return Optional.empty(); + } + + // get the vanilla table from shell + LootTable table = world.getServer().getLootTables().get(tableShell.getResourceLocation()); + // get a list of loot pools + List lootPoolShells = tableShell.getPools(); + + // generate a context + LootContext lootContext = new LootContext.Builder((ServerWorld) world) + .withLuck((player != null) ? player.getLuck() : 0) + .withOptionalParameter(LootParameters.THIS_ENTITY, player) + .withParameter(LootParameters.ORIGIN, coords.toVec3d()) + .create(LootParameterSets.CHEST); + + List itemStacks = new ArrayList<>(); + for (LootPoolShell pool : lootPoolShells) { + LOGGER.debug("processing pool -> {}", pool.getName()); + // go get the vanilla managed pool + LootPool lootPool = table.getPool(pool.getName()); + + // geneate loot from pools + lootPool.addRandomItems(itemStacks::add, lootContext); + } + + // get effective rarity + Rarity effectiveRarity = TreasureLootTableRegistry.getLootTableMaster().getEffectiveRarity(tableShell, getDefaultEffectiveRarity(random)); + LOGGER.debug("using effective rarity -> {}", effectiveRarity); + + // get all injected loot tables + injectLoot(world, random, itemStacks, tableShell.getCategory(), effectiveRarity, lootContext); + + for (ItemStack stack : itemStacks) { + LOGGER.debug("possible loot item -> {}", stack.getItem().getRegistryName().toString()); + } + + // select one item randomly + outputStack = itemStacks.get(RandomHelper.randomInt(0, itemStacks.size()-1)); + LOGGER.debug("loot item output stack -> {}", outputStack.getItem().getRegistryName().toString()); + } + return Optional.of(outputStack); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java new file mode 100644 index 000000000..5c08b335f --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java @@ -0,0 +1,126 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.network; + +import java.util.Optional; +import java.util.UUID; +import java.util.function.Supplier; + +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.ICharmEntity; + +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.fml.LogicalSidedProvider; +import net.minecraftforge.fml.network.NetworkEvent; + +/** + * + * @author Mark Gottschling on Aug 7, 2021 + * + */ +public class CharmMessageHandlerOnClient { + public static boolean isThisProtocolAcceptedByClient(String protocolVersion) { + return TreasureNetworking.MESSAGE_PROTOCOL_VERSION.equals(protocolVersion); + } + + public static void onMessageReceived(final CharmMessageToClient message, Supplier ctxSupplier) { + NetworkEvent.Context ctx = ctxSupplier.get(); + LogicalSide sideReceived = ctx.getDirection().getReceptionSide(); + ctx.setPacketHandled(true); + + if (sideReceived != LogicalSide.CLIENT) { + Treasure.LOGGER.warn("CharmMessageToClient received on wrong side -> {}", ctx.getDirection().getReceptionSide()); + return; + } + if (!message.isValid()) { + Treasure.LOGGER.warn("CharmMessageToClient was invalid -> {}", message.toString()); + return; + } + + // we know for sure that this handler is only used on the client side, so it is ok to assume + // that the ctx handler is a client, and that Minecraft exists. + // Packets received on the server side must be handled differently! See MessageHandlerOnServer + + Optional clientWorld = LogicalSidedProvider.CLIENTWORLD.get(sideReceived); + if (!clientWorld.isPresent()) { + Treasure.LOGGER.warn("CharmMessageToClient context could not provide a ClientWorld."); + return; + } + + // This code creates a new task which will be executed by the client during the next tick + // In this case, the task is to call messageHandlerOnClient.processMessage(worldclient, message) + ctx.enqueueWork(() -> processMessage(clientWorld.get(), message)); + } + + private static void processMessage(ClientWorld worldClient, CharmMessageToClient message) { + Treasure.LOGGER.debug("received charm message -> {}", message); + try { + PlayerEntity player = worldClient.getPlayerByUUID(UUID.fromString(message.getPlayerName())); + if (player != null) { + Treasure.LOGGER.debug("valid player -> {}", message.getPlayerName()); + // check hands first + if (message.getHand() != null) { + Treasure.LOGGER.debug("valid hand -> {}", message.getHand()); + // get the item for the hand + ItemStack heldItemStack = player.getItemInHand(message.getHand()); + // determine what is being held in hand + if (heldItemStack != null) { + Treasure.LOGGER.debug("holding item -> {}", heldItemStack.getItem().getRegistryName()); + ICharmableCapability cap = heldItemStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).orElse(null); + if (cap != null) { + updateCharms(heldItemStack, message, cap); + } + } + } + + } + } + catch(Exception e) { + Treasure.LOGGER.error("Unexpected error ->", e); + } + } + + private static void updateCharms(ItemStack heldItemStack, CharmMessageToClient message, ICharmableCapability capability) { + // get the charm that is being sent +// String charmName = message.getCharmName(); + ResourceLocation charmName = new ResourceLocation(message.getCharmName()); + // cycle through the charm states to find the named charm + for(ICharmEntity entity : capability.getCharmEntities()[InventoryType.FINITE.getValue()]) { + if (entity.getCharm().getName().equals(charmName)) { + Treasure.LOGGER.debug("found charm, updating..."); + // update vitals + entity.update(message.getEntity()); + if (entity.getValue() <= 0.0) { + // TODO should each charm have it's own way of checking empty? + capability.getCharmEntities()[InventoryType.FINITE.getValue()].remove(entity); + } + break; + } + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java new file mode 100644 index 000000000..f1160415c --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java @@ -0,0 +1,200 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.network; + +import java.util.Optional; + +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.CharmEntity; +import com.someguyssoftware.treasure2.charm.ICharm; +import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.charm.TreasureCharmRegistry; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.Hand; + +/** + * @author Mark Gottschling on Feb 17, 2020 + * + */ +public class CharmMessageToClient { + private boolean valid; + private String playerName; + private String charmName; + private ICharmEntity entity; + private Hand hand; + private String slot; + private String slotProviderId; + private InventoryType inventoryType; + + /** + * + * @param playerName + */ + public CharmMessageToClient(String playerName, ICharmEntity instance, Hand hand, String slot, String slotProviderId, InventoryType inventoryType) { + valid = true; + this.playerName = playerName; + this.charmName = instance.getCharm().getName().toString(); + this.entity = instance; + this.hand = hand; + this.slot = slot; + this.slotProviderId = slotProviderId; + this.inventoryType = inventoryType; + } + + /** + * + */ + public CharmMessageToClient() { + valid = false; + } + + /** + * + * @param buf + * @return + */ + public static CharmMessageToClient decode(PacketBuffer buf) { + CharmMessageToClient message = new CharmMessageToClient(); + try { + message.setPlayerName(buf.readUtf()); + message.setCharmName(buf.readUtf()); + double value = buf.readDouble(); + int duration = buf.readInt(); + double percent = buf.readDouble(); + Optional optionalCharm = TreasureCharmRegistry.get(ModUtils.asLocation(message.getCharmName())); + if (!optionalCharm.isPresent()) { + throw new RuntimeException(String.format("Unable to find charm %s in registry.", message.getCharmName())); + } + ICharmEntity entity = new CharmEntity(); + entity.setCharm(optionalCharm.get()); + entity.setDuration(duration); + entity.setPercent(percent); + entity.setValue(value); + message.setEntity(entity); + String handAsString = buf.readUtf(); + if (!handAsString.isEmpty()) { + message.hand = Hand.valueOf(handAsString); + } + message.setSlot(buf.readUtf()); + message.setSlotProviderId(buf.readUtf()); + String inventoryType = buf.readUtf(); + if (!inventoryType.isEmpty()) { + message.setInventoryType(InventoryType.valueOf(inventoryType.toUpperCase())); + } + } + catch(Exception e) { + Treasure.LOGGER.error("An error occurred attempting to read message: ", e); + return message; + } + message.setValid( true); + return message; + } + + /** + * + * @param buf + */ + public void encode(PacketBuffer buf) { + if (!isValid()) { + return; + } + buf.writeUtf(getPlayerName()); + buf.writeUtf(getCharmName()); + buf.writeDouble(entity.getValue()); + buf.writeInt(entity.getDuration()); + buf.writeDouble(entity.getPercent()); + String handAsString = ""; + if (hand != null) { + handAsString = hand.name(); + } + buf.writeUtf(handAsString); + buf.writeUtf(slot); + buf.writeUtf(slotProviderId); + buf.writeUtf(inventoryType.name().toLowerCase()); + } + + + + public boolean isValid() { + return valid; + } + public void setValid(boolean messageIsValid) { + this.valid = messageIsValid; + } + + public String getCharmName() { + return charmName; + } + + public void setCharmName(String charmName) { + this.charmName = charmName; + } + + public ICharmEntity getEntity() { + return entity; + } + + public void setEntity(ICharmEntity data) { + this.entity = data; + } + + public String getPlayerName() { + return playerName; + } + + public void setPlayerName(String playerName) { + this.playerName = playerName; + } + + public Hand getHand() { + return hand; + } + + public void setHand(Hand hand) { + this.hand = hand; + } + + public String getSlot() { + return slot; + } + + public void setSlot(String slot) { + this.slot = slot; + } + + public String getSlotProviderId() { + return slotProviderId; + } + + public void setSlotProviderId(String slotProviderId) { + this.slotProviderId = slotProviderId; + } + + public InventoryType getInventoryType() { + return inventoryType; + } + + public void setInventoryType(InventoryType inventoryType) { + this.inventoryType = inventoryType; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/util/ModUtils.java b/src/main/java/com/someguyssoftware/treasure2/util/ModUtils.java index 9be0c212d..d385b27dc 100644 --- a/src/main/java/com/someguyssoftware/treasure2/util/ModUtils.java +++ b/src/main/java/com/someguyssoftware/treasure2/util/ModUtils.java @@ -52,10 +52,14 @@ * */ public class ModUtils { - public static ResourceLocation asLocation(String path) { - return new ResourceLocation(Treasure.MODID, path); + public static ResourceLocation asLocation(String name) { + return hasDomain(name) ? new ResourceLocation(name) : new ResourceLocation(Treasure.MODID, name); } + public static boolean hasDomain(String name) { + return name.indexOf(":") >= 0; + } + /** * * @author Mark Gottschling on Jul 25, 2021 diff --git a/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/TreasureFeatures.java b/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/TreasureFeatures.java index b7c34e6ec..3feabc10a 100644 --- a/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/TreasureFeatures.java +++ b/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/TreasureFeatures.java @@ -49,6 +49,8 @@ public class TreasureFeatures { public static ConfiguredFeature WELL_FEATURE_CONFIG; public static ConfiguredFeature WITHER_TREE_FEATURE_CONFIG; + public static ConfiguredFeature TOPAZ_ORE_FEATURE_CONFIG; + public static ConfiguredFeature ONYX_ORE_FEATURE_CONFIG; public static ConfiguredFeature RUBY_ORE_FEATURE_CONFIG; public static ConfiguredFeature SAPPHIRE_ORE_FEATURE_CONFIG; @@ -95,7 +97,33 @@ public static void registerFeatures(RegistryEvent.Register> event) { WELL_FEATURE.configured(IFeatureConfig.NONE)); WITHER_TREE_FEATURE_CONFIG = Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, "wither_tree", WITHER_TREE_FEATURE.configured(IFeatureConfig.NONE)); - + + TOPAZ_ORE_FEATURE_CONFIG = Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, "topaz_ore", + GEM_ORE_FEATURE + .configured(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, + TreasureBlocks.TOPAZ_ORE.defaultBlockState(), + TreasureConfig.GEMS_AND_ORES.topazOreVeinSize.get())) + .decorated( + Placement.RANGE.configured( + new TopSolidRangeConfig(TreasureConfig.GEMS_AND_ORES.topazOreMinY.get(), + 0, + TreasureConfig.GEMS_AND_ORES.topazOreMaxY.get() - TreasureConfig.GEMS_AND_ORES.topazOreMinY.get()))) + .squared() + .count(TreasureConfig.GEMS_AND_ORES.topazOreVeinsPerChunk.get())); + + ONYX_ORE_FEATURE_CONFIG = Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, "onyx_ore", + GEM_ORE_FEATURE + .configured(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, + TreasureBlocks.ONYX_ORE.defaultBlockState(), + TreasureConfig.GEMS_AND_ORES.onyxOreVeinSize.get())) + .decorated( + Placement.RANGE.configured( + new TopSolidRangeConfig(TreasureConfig.GEMS_AND_ORES.onyxOreMinY.get(), + 0, + TreasureConfig.GEMS_AND_ORES.onyxOreMaxY.get() - TreasureConfig.GEMS_AND_ORES.onyxOreMinY.get()))) + .squared() + .count(TreasureConfig.GEMS_AND_ORES.onyxOreVeinsPerChunk.get())); + RUBY_ORE_FEATURE_CONFIG = Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, "ruby_ore", GEM_ORE_FEATURE .configured(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, @@ -141,6 +169,10 @@ public static void onBiomeLoading(final BiomeLoadingEvent biomeEvent) { ResourceLocation biome = biomeEvent.getName(); if (TreasureConfig.GEMS_AND_ORES.enableGemOreSpawn.get()) { + biomeEvent.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES) + .add(() -> TOPAZ_ORE_FEATURE_CONFIG); + biomeEvent.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES) + .add(() -> ONYX_ORE_FEATURE_CONFIG); biomeEvent.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES) .add(() -> RUBY_ORE_FEATURE_CONFIG); biomeEvent.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES) @@ -153,6 +185,7 @@ public static void onBiomeLoading(final BiomeLoadingEvent biomeEvent) { } else { biomeEvent.getGeneration().getFeatures(GenerationStage.Decoration.TOP_LAYER_MODIFICATION) .add(() -> SURFACE_CHEST_FEATURE_CONFIG); + if (TreasureConfig.WELLS.isEnabled()) { // test if the biome is allowed TreasureBiomeHelper.Result biomeCheck =TreasureBiomeHelper.isBiomeAllowed(biome, TreasureConfig.WELLS.getBiomeWhiteList(), TreasureConfig.WELLS.getBiomeBlackList()); diff --git a/src/main/resources/assets/treasure2/lang/en_us.json b/src/main/resources/assets/treasure2/lang/en_us.json index 5de0e2560..0241aaef3 100644 --- a/src/main/resources/assets/treasure2/lang/en_us.json +++ b/src/main/resources/assets/treasure2/lang/en_us.json @@ -41,6 +41,11 @@ "item.treasure2.sapphire": "Sapphire", "item.treasure2.white_pearl": "White Pearl", "item.treasure2.black_pearl": "Black Pearl", + "item.treasure2.copper_coin_charm": "Copper Coin Charm", + "item.treasure2.silver_coin_charm": "Silver Coin Charm", + "item.treasure2.gold_coin_charm": "Gold Coin Charm", + "item.treasure2.ruby_charm": "Ruby Charm", + "item.treasure2.sapphire_charm": "Sapphire Charm", "item.treasure2.wither_stick_item":"Wither Branch", "item.treasure2.wither_root_item":"Wither Root", @@ -136,22 +141,24 @@ "tooltip.label.specials":"Specials: %s", "tooltip.label.accepts_keys":"Accepts Keys: %s", + "tooltip.label.wishable":"Throw into Wishing Wells", "tooltip.label.coin":"Throw into Wishing Wells", "tooltip.label.key_ring":"Container for keys", "tooltip.label.coin_pouch":"Holds coins, gems, pearls, and charms", "tooltip.label.treasure_tool":"Required for Key/Pick recipes", + "tooltip.label.max_locks":"Max Locks: %s", + "tooltip.label.container_size":"Inventory Size: %s", "tooltip.label.charmed":"Hold in hand or in coin pouch for buffs", "tooltip.label.charmed.adornment":"Hold in hand, coin pouch, or hotbar for buffs", "tooltip.label.charms":"Charms:", - "tooltip.label.charmable.slots":"Charms Capacity: %s[available/activated/max.]", - "tooltip.label.charmable.slots.stats":"[%s/%s/%s]", + "tooltip.label.charmable.slots":"Capacity: [%s/%s] [used/max]", + "tooltip.label.charmable.slots.stats":"[%s/%s]", + "tooltip.label.charm.type.finite":"[FINITE] ", + "tooltip.label.charm.type.imbue":"[IMBUED] ", + "tooltip.label.charm.type.socket":"[SOCKETED] ", "tooltip.charm.healing":"Healing %s", - "tooltip.label.charm.type.finite":"[FINITE]", - "tooltip.label.charm.type.imbue":"[IMBUED]", - "tooltip.label.charm.type.socket":"[SOCKETED", "tooltip.charm.healing_rate": "- heals 0.5 hearts/sec", - "tooltip.label.max_locks":"Max Locks: %s", - "tooltip.label.container_size":"Inventory Size: %s", + "tooltip.charm.uses_gauge":"[%s/%s]", "tooltip.ember_key.specials":"Destroys Wood Locks", "tooltip.ember_lock.specials":"Destroys All Keys regardless of breakability (excluding Ember)", diff --git a/src/main/resources/assets/treasure2/models/block/onyx_ore.json b/src/main/resources/assets/treasure2/models/block/onyx_ore.json new file mode 100644 index 000000000..05be098a0 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/block/onyx_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "treasure2:block/ore_parent", + "textures": { + "0": "treasure2:blocks/onyx_nugget" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/block/topaz_ore.json b/src/main/resources/assets/treasure2/models/block/topaz_ore.json new file mode 100644 index 000000000..45eed66b8 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/block/topaz_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "treasure2:block/ore_parent", + "textures": { + "0": "treasure2:blocks/topaz_nugget" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charm.json b/src/main/resources/assets/treasure2/models/item/charm.json new file mode 100644 index 000000000..7a1de1e2e --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/charm.json @@ -0,0 +1,16 @@ +{ + "parent": "item/generated", + "textures": { + "__comment": "default", + "layer0": "treasure2:item/charm/gold_charm" + }, + "overrides": [ + { + "__comment": "copper charm", + "predicate": { + "model": 1 + }, + "model": "item/charm/charm_model_copper" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charm_model_copper.json b/src/main/resources/assets/treasure2/models/item/charm_model_copper.json new file mode 100644 index 000000000..9b8505868 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/charm_model_copper.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charm_model_silver.json b/src/main/resources/assets/treasure2/models/item/charm_model_silver.json new file mode 100644 index 000000000..ca8c0ca7c --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/charm_model_silver.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charmed_gold_coin.json b/src/main/resources/assets/treasure2/models/item/charmed_gold_coin.json deleted file mode 100644 index a0ad3ceee..000000000 --- a/src/main/resources/assets/treasure2/models/item/charmed_gold_coin.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "parent": "item/handheld", - "textures": { - "layer0": "treasure2:item/coins/charmed_gold_coin" - }, - "display": { - "thirdperson_righthand": { - "translation": [ 0, 1, 0], - "scale":[ 0.25, 0.25, 0.25] - }, - "firstperson_righthand": { - "translation": [ 0, 2, 0], - "scale": [ 0.5, 0.5, 0.5 ] - }, - "ground": { - "rotation": [ 0, 0, 0 ], - "translation": [ 0, 1, 0], - "scale":[ 0.25, 0.25, 0.25] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/charmed_ruby.json b/src/main/resources/assets/treasure2/models/item/charmed_ruby.json deleted file mode 100644 index 7572161af..000000000 --- a/src/main/resources/assets/treasure2/models/item/charmed_ruby.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "parent": "item/handheld", - "textures": { - "layer0": "treasure2:items/charmed_ruby" - }, - "display": { - "thirdperson_righthand": { - "translation": [ 0, 1, 0], - "scale":[ 0.25, 0.25, 0.25] - }, - "firstperson_righthand": { - "translation": [ 0, 2, 0], - "scale": [ 0.5, 0.5, 0.5 ] - }, - "ground": { - "rotation": [ 0, 0, 0 ], - "translation": [ 0, 1, 0], - "scale":[ 0.25, 0.25, 0.25] - } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charmed_silver_coin.json b/src/main/resources/assets/treasure2/models/item/charmed_silver_coin.json deleted file mode 100644 index 31d5af22f..000000000 --- a/src/main/resources/assets/treasure2/models/item/charmed_silver_coin.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "parent": "item/handheld", - "textures": { - "layer0": "treasure2:item/coins/charmed_silver_coin" - }, - "display": { - "thirdperson_righthand": { - "translation": [ 0, 1, 0], - "scale":[ 0.25, 0.25, 0.25] - }, - "firstperson_righthand": { - "translation": [ 0, 2, 0], - "scale": [ 0.5, 0.5, 0.5 ] - }, - "ground": { - "rotation": [ 0, 0, 0 ], - "translation": [ 0, 1, 0], - "scale":[ 0.25, 0.25, 0.25] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/onyx.json b/src/main/resources/assets/treasure2/models/item/onyx.json new file mode 100644 index 000000000..32fc62b05 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/onyx.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:items/onyx" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/onyx_ore.json b/src/main/resources/assets/treasure2/models/item/onyx_ore.json new file mode 100644 index 000000000..5ad4187c0 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/onyx_ore.json @@ -0,0 +1,15 @@ +{ + "parent": "treasure2:block/onyx_ore", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/treasure2/models/item/sapphire_charm.json b/src/main/resources/assets/treasure2/models/item/sapphire_charm.json new file mode 100644 index 000000000..a208a354a --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/sapphire_charm.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/sapphire_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/test_charm.json b/src/main/resources/assets/treasure2/models/item/test_charm.json new file mode 100644 index 000000000..a208a354a --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/test_charm.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/sapphire_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/topaz.json b/src/main/resources/assets/treasure2/models/item/topaz.json new file mode 100644 index 000000000..974caf732 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/topaz.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/topaz" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/topaz_ore.json b/src/main/resources/assets/treasure2/models/item/topaz_ore.json new file mode 100644 index 000000000..7ae0361f2 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/topaz_ore.json @@ -0,0 +1,15 @@ +{ + "parent": "treasure2:block/topaz_ore", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/treasure2/textures/item/charm/copper_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/copper_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..d26b16140eb788ae73bae91803b306e371658b52 GIT binary patch literal 727 zcmV;|0x127P)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

iBGYgils!sp_0MtoDK~y-)&5}J10Z|l%znRA) zA%dus^b*CZY``MyLaVeCJJ8sGN@X%i644_Pe>0v@h{+_pF=(9bCik42d(VNthH9ul zHB=C{lZqqvTXg_>5KNqjl~~|G?v3XFbZQb%FGZ|42kr8SO0mFT;qjG&2Rf{hJBX4; zu8Xg)l%y~^F+OoPb;xDX$dq7n_F=mNvQK+?P)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

iC77+FO*>eB@0OUzTK~y-)&61%C!eA7Izlq3# zsEEm^$ucnf$rtz^!ev>pSPY9kfkl?*L;S(Iv?drQh*cC}s90v01Ho-fEuMDa-gD2n z_rPC67$Opei1K>MdBd|o7XTX~f9-3936f#k3ji2)Du75O(ef0?=8aaP#&Ub-D+LLL z>@yXVbG>^3nr_8Xbr8n;Ei#X2djX^I3Z+5-q^vTXhJat}3z}}BREU&S09^N++E*%) zhhFdcc@7fU$!6265KTL9Ei=i?x~)>%RN Z84sHSSV?1S`LX~2002ovPDHLkV1k5!Q!xMl literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..f4ee4eb28516e7600b94469b51f1ce1d453f80e0 GIT binary patch literal 698 zcmV;r0!96aP)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

iB9xnZXBj2qRXTCo?j9`u>Mu`L0(C z9KWA1n5i=`2=g*9`1G1GoW67#MGq4$SFGOqhT-SOCk!9IF)-}A$iVRM8FqCz4fyu+ zFHzpbX#msrr<56h4A>dTFu+2Cfq|b3f`z$p8^DM&4NQheoj!Jofq{X6A$vJy4B#{X gW(YDLn`Wv207&>*te0e1MgRZ+07*qoM6N<$f(&&$BLDyZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_sapphire_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_sapphire_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..925c76ae53338e49234dd07b855a6a8f2c431043 GIT binary patch literal 727 zcmV;|0x127P)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

iC6gOhW4w?V}0MtoDK~y-)&5xA{Bo&+foq zOV~mQTd2Wil{!kL&i9bU+$1<|7zW9f3^zCNRqA|%Xsw%98t3YQ>+5J^?=e&Ln*5Nz zc#N(TuCFs&>`0Ol04Ys^pagPy0kpA4l9Whk0uaZi)_bEqe_~lx=gjzIl+t``o=zu3 zVN6l<1gLs_fAdXI7}KkT=OzI1eFngME8ZID1T>K6bDQ}mx&pZ4WJDc%doBO~002ov JPDHLkV1m)RMBxAc literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..338de1c26904b65eaf7f4c35b5aed3d62aa66ddd GIT binary patch literal 717 zcmV;;0y6!HP)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

iBIW4|T$2b500Ln>3K~y-)&5|(=gD?z5KNSfB zVuwqxaT0nY_D-WW-I^c`#Zp2R}v>Ci4*g+ zSoFe(UhIb~;>AIJ%1MZ0gQUk4K@gxSD~PMueCtx;q9|U6CCnDYv5A|ufmRw(7?Dm~ zYK8h-!}on~#xdSTGOvRzOpkkS11ABDvnNDpMFLzKeO5D+R^W{9b0DRJyh}{e1OSM_ zhy*y)8M7<{01TG_0MNA^K04zXvhJym^m9D`=-pYD9b@>F00000NkvXXu0mjfPBT5i literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_sapphire_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_sapphire_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..50c7cf9ffdf9a3c1996a646a489747db74fe96d9 GIT binary patch literal 740 zcmVEX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

iC6dk#I$4meK0O3hQK~y-)&5}I|!axv4UnGS^ zg6FVFw|CfHTWfI(YY&iK5R6zUq&0mCOS>%;&mjRJpxs*dgJL$U+W2+5GvAvTX5g$bbA6jRNs`yk1*Qt()tQx2 zc+J5hX3n#>PJG)4N-6roHF;hFAZ5U4R00|&fY%(5=Ot1G0Ho=$GOyvXm3I4Njrny( zDT7DlUa!S`l5#jW0E(i(oM*S0ubNL%obNzH!o+b5z;?FEX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

cJEEa@9j`;up0K`c|K~y-)&67O}gFq04zYP`^ zhMdF3ZgYk$yn=PGN$n+UOc5-_OIV~yt6ffz)?gD5l5SHZN(d?&NWcff49vba%+JCs zAw8)({~jBY^>M8`-^F!?{#vBY=xvN_4Ux;8;BqeUV~Mas0E7+FLszFtObT@HW65TF zpeR}ZlyZoo7N{^15OzpWv?%2OkmuLIcMFr5xbAH Date: Thu, 19 Aug 2021 14:23:50 +0000 Subject: [PATCH 08/19] add charm textures --- .../textures/item/charm/copper_ruby_charm.png | Bin 0 -> 1551 bytes .../textures/item/charm/copper_topaz_charm.png | Bin 0 -> 5549 bytes .../textures/item/charm/gold_ruby_charm.png | Bin 0 -> 1546 bytes .../textures/item/charm/gold_topaz_charm.png | Bin 0 -> 5538 bytes .../textures/item/charm/silver_ruby_charm.png | Bin 0 -> 1495 bytes .../textures/item/charm/silver_topaz_charm.png | Bin 0 -> 5521 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_ruby_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_topaz_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_ruby_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_topaz_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_ruby_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_topaz_charm.png diff --git a/src/main/resources/assets/treasure2/textures/item/charm/copper_ruby_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/copper_ruby_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..da614777088549b5e3d9f91bc44a6b8f154cbe1a GIT binary patch literal 1551 zcmV+q2JrcbP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+SONClI$o9{O1&N1WQ5)j)Peu<_2^8NtRl>tJgOl zV@DYw%R*!dLAmzN-`)L%i|JtJ)nZ5?9JqY)i8F+FtZTJ&`1#zO<03rh-Sq`SC1_=J zL)-QldcA#Me(TRiy|c3Y#O>(fc{`LbGDFyQaXS)TdfI)L_IKIeO=thkx^=pm=e{?9 zQ5F7#9XBC4@Qh;=89$PYHsVQ=V1)NmRyoEj3{OBQ^Rs~4@KeY(?}R&I ziUo{SuzBJxjuJ7@?BuCZrcQ0Pg$hFS+}O}E7jQ6iQH&E885H<&Q)iPT)qx$B0@eg- zzQ#gx+%(546ftroSTeyG;fpu7dr$e3`|7Cok-9`jykdp8c;qy~7|e|)tUw6$jj2w2 z=k4zD=C~tPz@Sc;BPN)SbGbN`Zn-6sXMvp_-W_Xckk#z~5MgXZFeG5$2uNuPbQrS{ z0mle_G9pKk^9cq>l`FXpZbSmei9E)}H%8Nzm6sZ&1w^O>F;J5vgDmeA`C~pJhq8)# zr>a3sqbAKkf)5%(urO*=HZgB%!OWs1%Tc0_8bh=gV~RO(5|l7aA(=}trIa%U&2XLZ zb%sUGC!ccqQ_pbP8P9a)g7hiAXbHtiEUDzmRVtQ$4b@zYHPzgxA(fhM+CsAyTWYx@ z*Sd7ywTEs!_SEy0waw}yYxKn2$E?w2Z7}Aio!wZ2+U(+jMmf>J85mcywxAqn)Ws373SkYsL}wfaT~gONF;OHeGXSMH=}pE)w_A zqIg=qMOQD3PHStG)-uqQyuilZd30~f4jEacY+9PluV@eBjn|y9iFa(xQy%|p)Ln!x zwH9PbIKo-pST&!Je!=m^kw!1AcNjON^Vx~n!arL&uwO6J%2xVV@$Oek{%&Qv!F<%s ze6X`wYU@?Y)W#8bb_$Z>e6#9hCm{|3?k*XARgv7w3iJ@>6(}5GrWE+13cIk)8OW~- zB#wSxD3Gt#;QjFKhituR|8qz9A5@e37dUs=7SqyBkpKVy24YJ`L;(K){{a7>y{D4^ z000SaNLh0L01m_e01m_fl`9S#00007bV*G`2jvJ84i6fLoSQ!cR0TmvN_ytn~r-cz9wk zwQ;IW!BkXatdJ6M?uK_<1@!s7ffOg=E3g<(dr!|@fl3* z-QFbjaxamJ#yC1_1Mu>?0ALm#Qaear*F{0vTb~{}Un-(xn-2g0002ovPDHLkV1gH3 B?9c!J literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/copper_topaz_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/copper_topaz_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..b6ccc3d6db821bbf34a68bd5635529618465b99d GIT binary patch literal 5549 zcmeHKd0Z3M77ntA6f8wlaDfoTLTShzl9Z_I#1cS2MOn&ZG6@6OOa_wBqTo`o;(}g8>0ZSjnA{JawqzbM)7u42LMN~whFFplp_1y^+<9j~){QX}4^X8Yy+MEL9vlOH9r3TN4Y;}+pFsqI)yk~6cq|6e5>;xY1eGB~Os_(S zhz^wy2)fJX7bIl*c-udbj<2(t?%~#6t}kVLP<$im{;hR)TLh&ggT*}!7T-IroMS7y zJZq`eIMHo}x)sfvsaM`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HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_ruby_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_ruby_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..2c3f383ab4938fb30f5c817812c191742ac35f86 GIT binary patch literal 1546 zcmV+l2KD)gP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+SONEb|Wba{bv=k1cU&IQ}LhXKbPu8#Z8Q6<>;G5eA2Nt8} zJ&gUxXYj+@1o4Mo9{EP<(W6JvrTHl2Y1x4|a(Wc8+k84>lg_;C@0N3Zr5#?_-SgNB zg3$u>u`{kSvBg`b6`nuhj9&33P7uQPMKj)>!^g2RH}WZXH|i;NHXlAehQio*1maVS z4xhruv0D*(LhZ8r@PU&Rd;i?UZj7d5^u4<5BO(>eS=67@3fnuF=px#S-r&yez}>`aAP7j-;e?zG)_#z zitlRXE^q7|unYvl3bSH?*_N%M1bWLYUN|%4g7wDktwGX`0)z;*1DqiS0yYu{ie$w( zAwnD#_+)tQ*t-G*CPVA}UF;vU&{~Ra7-;PA)M@SV%F6Nt#m18AdZy zXUxu!$ho+}#g|ZGk)kD)T#-K2*HB}Xsx{TzT;qoA-(nNfw566ib)-`FJ@nY6Yfn87 z|MxM2()1`y4eos7=KDl9M;oz!tew&@3lmVg|&VCm=2p0VK4W zm{}$7-9&C;W|PCF2o9)GnBX*;hyg+0$%R2T?B0<36gLz6w{UZ>kTVmypFqw`=niu4 zar*$Zme+~G3!u3RXG|>*6gCKS%}(5CA#SxaB%}dB~k9Cn{_{3fO%|YXS#-VJ!a@D27w&wkiTFa+*F zUxoB_Z@#>Odxt|gW>F1#vJJGEW7YP@K79xNPf;}+)*HOo;ma?rt$xc%^F63vJ7t{9 zjeJ18^=UAQ`=kf1i~}&oZDZ|-wVm9Z;>xsSHA*_Sd7 z%@hBQ+lWoo9b4MN&bMBa_cPEp^JQ3@Px@CO$ZtAzhf z7ZCaaWMe;1k6&a#D#y`g91ONAE7Xr7&zhW^tkj`zdGYMxCkgpISIwiZw{X!8R}8o8 z>Hd@g)K;l2)hj91Rttu{pOGK-<}p?ERW?7_e=lNw#-ATmguhM=fBwzCjeq*knFA^c z00006VoOIv0RI600RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru

iF z4KAB!&8YwY0N+VOK~y-)&5^$j!B7;3KU#0VY&Te%+oU_2fx#0P?OwqHm`O~=4xXTq zkhCP?DJqminiw>$LE8A!N;L*&J2~h3?l1SiUzex~DXKzdhNY!TY3bifLO4vY9g|IB z_sI^2@uj7Il;mPx9^^Qk18O~mVWAk!I+s1p#(84Yq!hKD!l+z9H8cQ%#fsL{#(CLG z6buVRR72zH?f^J?huFP*nm?(un~5{^6BsO39K8dx<(g8Xj_JFw@zM!8mp!ei9rdQ~ wlIjYNmjH0)cS(05-Y$?R2qlkw9Q>2I0mT?;>_f=2761SM07*qoM6N<$g0kw{hyVZp literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_topaz_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_topaz_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..6523dbd53f28f348ef52e4e8b30780625c6be822 GIT binary patch literal 5538 zcmeHKX;>5I7LHaatKwP|!4N6d>SUQLBq>1=5MtR1RHQCtGMR)(HfIu&s30O@xk#;o z2o+I8r7l&lwxXb*0%|LQ$RbsgUO)u9SVFO)g*y`{#(TZ?`aHM)9G*bFGw*rN`QAC_ zd`wD6ke{9PbZZicWGD3Z3B~`~6CX6EX=xQ59Zq>>Rju~Cq*PGX@cAV(he)5vrPlo1}dD6kfx4`wRt#E| z^6$GI|GWu4(${w;rNsgG^!nBY>z3pBSQuY(b4I`Torq=@Xv#fBSEJ6x+1oHDH&$B51q z*7oemEL%Jw*U>B8s>+h-*>W%Y;p|69^p@;1KAe?Bqp7((JBReskCUca<`u!+5$l>1 z%ATq__H(0ZkJJ6;(Qlzy@8o)-?@z56El}+)y3|Nk+#)R;bJsb_zdX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=u~J- zFd8gcg}|DZ^SlT=!W4?nC`^MIgnzNAf5UkURi!`ft3nNC@xzeSL#v@dBA1z@B9l$c z%ZFe>MF9naViB?F5#Txw-GZYbr4+%Z2%7_ z<0X60h(Y-0_B@DD5g5of7r=uUC43=KVPRUeS}sG-=Y{#RQ2qGnqo>2)dsnlQ z@8Ivu7NYn4d`N@D&)%~I>A1y8?H`GeNaHGq&!`=9$2sE0H#NdQ-#0rfCyle19yz%WJr{;G87O zI5?AaF~)M%l3lZz;JW^S&F2qn$%a14pf9J!G%riOu`?+DK6JjrdM7AJ4to$c&0$PE zdGt&rBS6ngJKsO?Fh9p4Aa!DL^nlui@^HXui8i1j>B`5=q#SgfUK?LrS&kduFg`KZ z+9ocv9a|!v=HRf>Ub>+1#3|cJcLFvVT|Q6wWNdp@6n=5zew_RUetGwyVOt!^Wu&Y2 fVoy$W_$X5RDN(L5(&iApL6Xon$miI?sKkE(Ip0Vl literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_ruby_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_ruby_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..00f15767e7fc9467c252c8ccb2698efc58c15290 GIT binary patch literal 1495 zcmV;|1t|K7P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+SONElH@21{O1&V1cU&I>DTK@PfBqikFMOPh(fA-5Q;ZfLpL}u|g4*?2Gg*IJ_l-S;2fev|a8NO3 zUbnGt`wV@!Js^JT%cI^%-F|dCIz4ZPJR>^@+fKJ5c1utD-lY9p_IJzK-_o`&tm*mQ z3&3ar{@5AUnb_j0GYZcyamK8;5+@kp_e1u$dj0@AbBRyjUD6YFHg7#YLSby&2Js1_ zt*7uFy91#o*3QTeKa6sPc)@OrrepNAy6hv6ie@kBT*@KAumDOv9*Y=)Z-6YvNEnJG zRxsAUX2Gb25;>qb$Wx`L8FSQCe6tuMhgomCNW7=MJ6g~)=yKrJ^d7!buplf!T=b7~F+5D-4|Er^3;~{1A>{G@0kZ^K7Seu{8=h4w! z{DE?MG9M|&PqH#Uke8`ro^w-pk`=OM~JAeZ3;I23F0Vgwc>=g)j zF%oKr8M3+TahG^@>Rs~+$o_S}B@>Lkq%2QJ`xHnx&I zN|SZLpS^x3Me~y5$(9ATdl6=SX*&TCQ{L zqr>Vut@bz0#utiF4k<1!3&{Wg0PsmfK~y-) z&5}KC!axv4A80AvL7kq$4cdYO&{2R$PLOWTkkWlB+yOoSh=L;o35g8?aSBV|rJ)05 zQ-O%$H3k}{o1gFL8_mE|hxDbDzO;9X^;BCu)we@V;**2!XV(cSWI;Nw9X!t?8bs)| zPMsAlaTtbwivw&Lq>v?6O3^Eo&%O7<_Ma2sT0tpA|D}qk*8n)q7PKdGbeRd6;RjO|-XHR4akFy24#PIdKqS9pp4C-ZY{ypPHK x2hx`|2m%0>t0e%V;fP#kyo6llu19(}egTYaWpn3mn}PrU002ovPDHLkV1g?9!YBX$ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_topaz_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_topaz_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..52ac93e48281fe3f2a2e0a8fab9dbe802bc2c5ac GIT binary patch literal 5521 zcmeHKd010d7LO>4ERGv!Q85G;(7x&MP+xe{`^#jT-%GzhvMvD&|E?&O@b6YQbR zhv4f=*H`VT+EJC}Rrvfx``(&~M|2k%d!KYCN`IeA@2c(DxH*;3UuH9SJEp6n&GdlS^uVAlzAjqmJAYkb*|Ss*d82!Lm3m&$ zxvFBz>+Y>PsjbTnakg~&PiflU@^js<6}i9Zj^*BNUjKMtx+U*2!6Jx2OU!uo-Ren+ z+@6RR_cwmA^Hs~5->YKR?kv+B_|oIpCTjNiqVMNSx7(udb>cX`9`}7gIv!ILULHO+ z+w`dYvi6C!p5NF*_Kmk9^GuFtbS{F<1(eM5)&I=Mr@Q>2ydl4ul09be?uFsJ<2oCw zQ|g9@(;*dCcX1w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SfcVp4SLU51(o=n5zF~hePO~)aP@Xhw9L7sbSath&RW;3q8uQzH4d3}2!cQ0%iFZWxeM4={B zAn!5z7fzS~8_iWLwvTy-#gqwVrj58B3~cIPd3%OYYHBl1@4n@}XR_s@vX*-!v z%%AKjK3*~9_|4Bw9{lP4cgcjU_XjGvo Date: Thu, 19 Aug 2021 15:24:26 +0000 Subject: [PATCH 09/19] gem feature --- .../world/gen/feature/GemOreFeature.java | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java b/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java index dd00ace70..83595b4ea 100644 --- a/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java +++ b/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java @@ -22,11 +22,9 @@ * @author Mark Gottschling on Jan 15, 2021 * */ -// TODO extend OreFeature and call place(), perform prob test, then call super.place(); public class GemOreFeature extends OreFeature { private Map chunksSinceLastDimensionOre = new HashMap<>(); -// public GemOreFeature(Function, ? extends OreFeatureConfig> configFactory) { public GemOreFeature(Codec configFactory) { super(configFactory); // NOTE ensure to set the registry name @@ -38,30 +36,15 @@ public GemOreFeature(Codec configFactory) { Treasure.LOGGER.error("Unable to instantiate GemOreFeature:", e); } } - - /** - * NOTE not needed - */ - public void init() { - // setup dimensional properties - for (String dimension : TreasureConfig.GENERAL.dimensionsWhiteList.get()) { - chunksSinceLastDimensionOre.put(dimension, 0); - } - } - @Override public boolean place(ISeedReader seedReader, ChunkGenerator generator, Random rand, BlockPos pos, OreFeatureConfig config) { -// String dimensionName = seedReader.getLevel().getDimension().getType().getRegistryName().toString(); -// ResourceLocation dimensionName = WorldInfo.getDimension(seedReader.getLevel()); -// Treasure.LOGGER.debug("placing @ {} in biome category -> {}", pos.toString(), seedReader.getBiome(pos).getBiomeCategory().getName()); -// Treasure.LOGGER.debug("dimension -> {}, location -> {}", seedReader.getLevel().dimension().getRegistryName(), seedReader.getLevel().dimension().location()); - // ore only generates in overworld - - if (!WorldInfo.isSurfaceWorld(seedReader.getLevel(), pos)) { - Treasure.LOGGER.debug("not a surface world..."); - return false; - } + // unnecessary are OreFeature knows to ignore dimensions that don't allow ore. + // // ore only generates in overworld + // if (!WorldInfo.isSurfaceWorld(seedReader.getLevel(), pos)) { + // Treasure.LOGGER.debug("not a surface world..."); + // return false; + // } // inspect block to determine generation probability double prob = 0; @@ -74,10 +57,11 @@ public boolean place(ISeedReader seedReader, ChunkGenerator generator, Random ra prob = TreasureConfig.GEMS_AND_ORES.sapphireGenProbability.get(); } // Treasure.LOGGER.debug("config probability -> {}", prob); +// TODO add Topaz and Onyx // test the probability if (!RandomHelper.checkProbability(rand, prob)) { -// Treasure.LOGGER.debug("probability NOT met"); + Treasure.LOGGER.debug("probability NOT met"); return false; } From fe033e1762f2f8de910147756dc451914581b02a Mon Sep 17 00:00:00 2001 From: gottsch Date: Thu, 19 Aug 2021 11:40:57 -0400 Subject: [PATCH 10/19] add copper ring --- .../textures/item/adornment/copper_ring.png | Bin 0 -> 1902 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_ring.png diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_ring.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_ring.png new file mode 100644 index 0000000000000000000000000000000000000000..fa9669b3ed8812cc1a1831910ce12f882900cef7 GIT binary patch literal 1902 zcmV-!2a))RP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+T~VRk}M|-{O1%t0+Lw7aVVCEcLN{a$QP@fPaAt1f%sgtGsE z>@l7DJs0oh*5D#osveGnxe1BIlVu~2@h8cs6;G0YaaJPQB5bBfHxdwXx4n}Jhd)40C+Ff=5jD{Ui z)?C<`YxD{=oXlwfCF1YVjR(UTuML2il1ks&qq+DrM@_W?iTNqT|L9HFJSb z!=@5Bae+!C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0RI600RN!9r;`8x010qNS#tmY9>D+r9>D>_X;f1H z000McNliru

Z9AQc`s6K4Pb0Lw{4K~y-))smqK!cY{3ziSYah*&19xU#e&vn&ff zgpabgNAV#9^NPb_vdl7YWyn|(%S?A{_g)=X#1jwa|L;BD`Qh(Nn3}%l*QS1QPDHPP z@A>s+`d~I0H@%{)0NCG0nu$=w+r Date: Thu, 19 Aug 2021 15:48:13 +0000 Subject: [PATCH 11/19] add adornment textures --- .../textures/item/adornment/copper_necklace.png | Bin 0 -> 5765 bytes .../item/adornment/copper_sapphire_necklace.png | Bin 0 -> 1771 bytes .../item/adornment/copper_topaz_necklace.png | Bin 0 -> 5988 bytes .../textures/item/adornment/gold_bracelet.png | Bin 0 -> 792 bytes .../textures/item/adornment/gold_necklace.png | Bin 0 -> 6255 bytes .../textures/item/adornment/gold_ring.png | Bin 0 -> 753 bytes .../item/adornment/gold_sapphire_necklace.png | Bin 0 -> 6256 bytes .../item/adornment/gold_topaz_necklace.png | Bin 0 -> 1796 bytes .../textures/item/adornment/gold_topaz_ring.png | Bin 0 -> 1775 bytes .../textures/item/adornment/silver_necklace.png | Bin 0 -> 6145 bytes .../item/adornment/silver_topaz_necklace.png | Bin 0 -> 5966 bytes .../item/adornment/silver_topaz_ring.png | Bin 0 -> 1729 bytes 12 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_sapphire_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_topaz_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_bracelet.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_ring.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_sapphire_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_topaz_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_topaz_ring.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/silver_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/silver_topaz_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/silver_topaz_ring.png diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..d6192aed7345f715daed6f197108795cd316a633 GIT binary patch literal 5765 zcmeHLd0Z3M77i5Il&$s&E|nPcA(lxd`_e>VE%sh(NGPPLW0$!k{FgR);E7aR||ntVM{3 zQKcXdj6d&+h<&qS`j~+)B{y7xiB<*K_V1@=3!bv_3XZ2fobQ!;U}es&sT}Fk$8~Ls zYI0!W?s2~MP~)XF;?>l=_Qb7EFMj{%N+0!Rb_@S)ij~B%p(`V5^1bo*Q|9mK>VC`< z$JejoymfQKve`d*kG5_(Ej-r3I*~Dbt}pTH7-htjz0s?#UOrm$2D;n-aMVD_{T%kD ziWy_Lt9nj}jE59wD~lG+alb2HM{G(zw68;PEJv(RRz)h@8g!Dy_`IW36EK!S(OBe%MMGQ`Q{h;!7#dEM>WF6s~S& z7N^B7X#Va;d+TN(x|1soaa>f>B|3Yq(WNkAX({*_wXj~@E9@=`zfQC8xUAZ;j-9o& znRX`TSf%H|_iTSUP?VVYC~<*-)VajxCKwP0itm@m!oO`Uyl&A=-1ciVAD%xkwr$J7 zrmDvAIStCGDM3-5AeICc%I110PaP{RSL{5#@zhs4O?)juJbmzgTLsmgJ9q7K4=AH|l<$FfT)F$Xb)QdDWCC5?Ux~kR zvJ8ygeY0C$}!#P6~=2xRJV}j33xKfA7RoHl<0ClTXdFxt*N9(D(ZBrir7A zMl;fkQ~NJAeX-QZBKYg9-t#N-qN5)z=}BYtk7}dHJ}DmcAn9EI-nL=8E4J%)X~CPK z>bri?e-@C_=IK83LEQ=~&npY7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K#7mi0j@{+4XpFa(*sNFlOu&!$+kEiKrh)8^jg-#IqhxnDvj?Vf6Iud=o literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_sapphire_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_sapphire_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..a0b44eac92823885572e2f808548ea883c46939c GIT binary patch literal 1771 zcmV;P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1dTvGg_!{Ld;}0s%&p!#MMG;PSl;(&c-4wvTgS z5J)U{!64QC{?pZ8_%Sdi`WRN!$6{6@3&Q+SU1j(PWUDRSjv| zC$zg;hr8;*ORW8^)c8J-!1at{*iyxPg`fn*zaiQyh<-W>|-8EjJFxnG1v(ZP5f4 zE@tRtN21Qbh^f$vO@Xq;SY`OcLesBIe}y7ESAr=M1|xL&n$%AQS5ogqgCionCfMMD45UW0sr>!l&5ciZ7wWA|+L>recez zzJ?mB)YPaUlvK0LHQz#uOHy1h}YrgG}%N{^$cel(L8 zk?vXGJzWn(U0QHw&-g{DyGcK|9>CQ?{tFCkPu)qk9E3I`h4T>$-~@4v={GT{?t=5T zF?l~zQQND>RHb2uSTl^6Azfp6ldLYWd?8oQAo~_jY^VlwY@$*MrMzFR3#@Jm%yp-6kZ3XzEgMulj?Gwz31o6&f7|Aj?4H&`M4ur!=`W}3+vuOgqX}h)b%~IZr&5;r*o25=AjC<316+JFyPp9b_{VSks ziMIeyuMu&do7%R_96RoECGBcu-D9B*$co_RKg;;asD86ovh6uS!aYZ4yF}*29=;OZ zDylw9{VBH#hGBgiw}HlJ|*es}2nw}CpYqoV!+*~luVULi*E z00006VoOIv0RI600RN!9r;`8x010qNS#tmY9>D+r9>D>_X;f1H000McNliru

iG z2pYy_r)~fM0a!^yK~y-)l~X-S13?gd7dN{qo@gONC50fwRuhXPb&x=W5G^8D1uRmD z#Z~@!AWM~007IW`HMqvveGev;7SHR}* zCJ0UpqtJE@%c+sJAG+pgUoj-sE*A-cQ)uuuS*=56;s{ja7a{x?f|Fe;VB_@MLrdG; zzR!$oDN&OOnrxSgw2-)^)b<cai%;N|@rM<*s4uT#p!dK1{czNbodT{%|fqX2;1*&~21I&K5a<~VNd9xxYO z#n8W?qhXf{*s)Xi?9PB-;39jareFjeU6?I{Pc9-fHjR(gWq{2Lh#$W8p?v=9TV4PF N002ovPDHLkV1mHNOFsYr literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_topaz_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_topaz_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..dfc4c76d63c996b43699487ce9b68a05454385a1 GIT binary patch literal 5988 zcmeHLd0Z3M77i*32zAE=#WB_eWs=Fhlz^F3Mf?&MJQNMM5QW-RdE4Yx4KY^7$3e#pcvn?_WAq0{%7*bB=^pDzH{z(&p9_q zN`Rl2jnxDz5{YEvxV+6N2(n^dwtQN!y^4!?!Bey`DInw*HT+Ouip3dzKT+jg>B$v5EVUec_Z&| zc?szoxRa+vS=c%IWvbo0j&(OK+uyKJ|EhRWX7V!Jd8u`H$?~35Y0HdM{T@p%>+6$i zHx|rrtZ%#%$14%gbG8)%vk-4I*pQ55Vn zAiN{`tfJI+lS02!<~F-@TgbIbTQRP_L8o*VKKr^xPoHI)};B&W76;t}eP&Iiiu>p638{ zEgqbDc=73K>ooxpC%RpqF3X&Zk7#mpb&0Zdgyecn@rqYx!7oNues>`!Q=cljpZ~0G zWb!rprJH|CD~c^8g?}rX6nD`aXbHE=+6ZhKZika?B7SqKU9dB2 z)A1_Ls2sMd<4;b{XYgG=o2ER~d27hzQ@R&t2iYxtI%VCs_$1#(&#|klX`U$)wuLRb zJI#Cah#k2Fwl6NmTsp8f-(iYaJ-vHfi>0l@WX$|NElc;v3dk;tIcCYLjVwFdvM)9A&Uj!|^S(>z*5=+n&ni}G zqPuc#$ZuMg_UyB3U2s8jzsJ1&TChI%N4u-@CKOKnV)TRZ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ZtP%$BxPA4uP z6Jw$v6UDe7m&1fW1m!>?2;woBOsQs zuvCr(X<&nBG&Y^b;Ig<34u?x)vDj}x3o$iLWUYad22pw)p$OlTAcTqJk;-8SMpY>! zMhhZj{#-Q%Yn19>rBWs!8$tpMmc~*5ocfZSKVON!hGH;+G1O2eeU;({OQ^=76ZJ#j z|6&S?Qfd|d8_!#4KZ~ncqgAS7{MG)VXbjPOnCE@qex^X8N8uWEoX?*u>OXK!y;tkJ@1%vD0v5V6lh1sV4l zm??x2z(2^rm=FDMZ4_omA&3rvG@^5{gXwglMEEQ^2(kDOMDE@4z7+Ut*2u&-944DZ zv`#LaXQ(A6$V0^lDCTi^Oqy8CWzcEw2K~otG#1i(mk2^kll3@J4bA@dEp#%pL!ppw zy2(z4cFFfKR8df@N+pwG>UTH)_hR@1oQZv3;r*GpDXiCeu2L08^q(k=zgF=<_wNDr zGR&7Em;zURD0EXuuPi2KA`x@%9C6kXM>n#t(BSP@VNmm~NCD*CgrM>5XjY%l4&WaA%kWc?7GuUF|KnRbZdYc&OdN(3bDMuP;cM Z%x~ZPkW=cKNhnM5@$hp$?6!2xzX6g}?hOC{ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/gold_bracelet.png b/src/main/resources/assets/treasure2/textures/item/adornment/gold_bracelet.png new file mode 100644 index 0000000000000000000000000000000000000000..ec935185058ab8c1f26ed63e6dc253a356cd5f1c GIT binary patch literal 792 zcmV+z1LypSP)EX>4Tx04R}tkv&MmKpe$iQ>7vm2aAX}WT@g`K~%(1t5Adrp;l;lcSTOipZjz4s5y%P0g-r?8KzCVK|H-_ z8=UuvBdjQ^#OK6gCS8#Dk?V@bZ=4G*3p_Jorc?985n{2>#!4HrqNx#25l2-`r+gvf zvC4UivsSLM<~{if!#RCrnd>x%kia6AAVGwJDoQBBMvPXS6bmWZkNfxsUB5&wg;V;BhS0*#vEd>=bb;{*sk16O*>U#SB#pQP7X zTJ#9$-3BhMTbi;5TD+r9>D>_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`M7jJu3ysz*;hnz^T4+MBCkA3Ls!{6H z2)5jm;g(xM5JPt@fKx3 zWU+{f0FVf#0T78!2AC2U1t18epi~KhFqxDARD6X-3o8)RK!uUJN--XkED}>eIt4(f zG!X!SBq|_cQkeh*!xB0bhD8z*V*o{EE_m01CvC2fn zf5-C<`j*90txZ&_;{w%zqOVaz`{z6#0>5Pn#;TM?t4`wo#iITN$L@NKOMhq%)2pTv66&tqz)3I*|iG>w0C{`!?ljKdm^aJqLVSQcUXjOCDVpYhIpVK()B zcw#JSh#`;+0wk<<(L%^%7L~@Lk^zv)0zpFGmiLFi-?K&vnF2#(2?D@O2?RhC2m)Y+ zga(ihlu3m_5=lfu-kHA5pPjY>f z0v`qb6kVU>`X~iH3j8U${%>+wy?ZBsDzFFKMC>1bz-G@7>}|mik?$-XE*G~Pm;2q1 z&Qh$$Qson&!Qm#<8ZMK1X^0T(G}rR|z07Z$nc7gs7MyRog1r;6;PX5~7^l_?H(S?% zHmSpXT`Ww^EXTT;c+IqVm7Qwp**!P~XPs5o5znyCnC@xgX0mq@US%P%uD$ftA+iNg zsy;IR$oxe4;5p6_7tS;}AZZ*EVoKWpMm`Hp|Np!MExT)}T&`;n(@ zcKRhv5LP-V&urPuNmH3S3+#@D0v;9jxxCm>GE=D z)}x`>rvh(Gs`5*_J~5TGzTwmlf#I|F-Z#T3^0sK&JuZ!{cA259`@`?NS!w>6YQ0Ix X=x@_Utne$tWWw>i0(fOJqci>qoyJEk literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/gold_ring.png b/src/main/resources/assets/treasure2/textures/item/adornment/gold_ring.png new file mode 100644 index 0000000000000000000000000000000000000000..ce175b2a213caddd0321155a35639644df740302 GIT binary patch literal 753 zcmVEX>4Tx04R}tkv&MmKpe$iQ>7vm2aAX}WT@g`K~%(1t5Adrp;l;lcSTOipZjz4s5y%P0g-r?8KzCVK|H-_ z8=UuvBdjQ^#OK6gCS8#Dk?V@bZ=4G*3p_Jorc?985n{2>#!4HrqNx#25l2-`r+gvf zvC4UivsSLM<~{if!#RCrnd>x%kia6AAVGwJDoQBBMvPXS6bmWZkNfxsUB5&wg;V;BhS0*#vEd>=bb;{*sk16O*>U#SB#pQP7X zTJ#9$-3BhMTbi;5TD+r9>D>_X;f1H000McNlirurLFyiS~h0e?vL5?h;$mr9A25XC9P`7n@)lOCrIIJ5;%>NE?sKVvd!Ccf%d^zB&F j(i;fGdDUB31qOgGp%`f6b{rT200000NkvXXu0mjfXGTPq literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/gold_sapphire_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/gold_sapphire_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..ee669d3d7b6185b22865251bb2a6f372487e8ec3 GIT binary patch literal 6256 zcmeHLdpuO@{vK4r=)z9rx|@bVrE3wd8W_yI(rX4=L11W3KW7_3Mv+`)^S-V8 zLV_JQPrAJpT?uh*^Q@EXt;(VwkE}Xgmbk-aUmkaDY-`H=tMB9a&nPEfoh>fyo@E?b zLS9y3f8#=&b%$+e%gVgu0i)g@J64<+#^jucG*ns=vM1)7;{9rGZQpo$9qrp+xaf`P z%jk&>i&+I${eDD6gV2sC($K@X-id)2iP47p)vwOuaBhcnKzU%Z{YtXmd8n}L- zy-DybYanbFT$HLMy*)F_KUnIxe3@?I@?f2?!>pp8Ee6>bEPcJv<*k_3)`dqr3Y41< zbU7Dg-w!XHbF0k5`(A#I+X`-zUibG6Gp+~CS#u>6Fl$K2z8gc_lXHy~ka$%$kG!w{#-CMEGG zk1f?Yq1%&{+w`tA>f!C#vt_e2Oq6JWPC6KE?qL+GsjJc?ZxtjM(lq05y>cf!MVP2T zb@DslTB*jSUAn)rOL@eDeJvx0sg7>Q%s$l_JJOl9*p0Atf$@s(>=W%-b+Z;x$FNJb zXnPfeKT@H+H6dNp_Qvf7JTC;Oji}*sDsB)YBZ1<}q(g}>y@MWgrS0-yvvwaY6U}e- zFUf1%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/resources/assets/treasure2/textures/item/adornment/silver_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..91ad5b3f7e68af6e608c3869584c0079e8afafac GIT binary patch literal 6145 zcmeHLd0Z1&5)Oh2QSd@RJcv<85t?+8CM1!_6@W}Uq{A$|S0}}{3v*Y{%F&|h-lF6k)Q6x&jVr3`^Rf&WI zf~w(AKu}TT^r3%VGkd5z+hXLI3JZV5a@Kpu_$@1S)B5U>Gg1;)=SU{4cpRL-=+-u6 zoLq&grBdmCh5RoP)MU_IS_*p&9kal#&B&YDZ2i;dGP zE1P$iJ`b<>BjUy2Q`^g5+nvl9;<~8$0kgAl-sP*0V~#ctFxIDU8`E&3H9q9XGWpEI z1EGp*h{ZN1XkqQzNwN0jqk-Ho<3fmb(J<4E9{uu$zz$mwR6`Hdt#7$PbiR1FtvQaK zeropo-445}vq?V}FAkwjmW=Nx^5$9&DmdakHtEf8m&;B`O%AP_=_I_o-2BeH&DRny zXSaC<+7GWQkSra3ti-HGe$F(1hT+TQ!c$sxMH0&Z=~DT5gH6B_o9?H?v1@4)63HiD z6A%l-z-0$+>lEu2Z@C>9pqrJLx99$7qH%jEVam)1?acl1jC2k^1&BAex!pUL^pBDX z;=xpgy+w=73+FuYinS%TW80S-?Q7oVSux0Hv97%XMb6vJ>=?=APMzbk%j5W<(f;W< zWal)KN65;NR;M?N^mW*x6Rh`Ik8Zv%CVE$J<&0f>quj@~W-ffq5}eIJJd)FZ>7%9^ zn$6?$>b;zP-LbdZq|k5Afr69;5r<13&JU|Scxs(NeL*4R>5%$rzw{M8w>%8$L059w zkh=4!?K$?;m_a|f&L!wwSXk_ouDF@qmIJJbGPBXnZ*TCTE~L6VDukP=f4P+*H*KB0 z$hI~;!FSbBtS4En)4C|S%xh1+_sb_WdzyZ~*s2nT91ka7y%HSWT9g3~9l!-IcFn#1 zB+B-*-LXS?$WE~7KdL7#=b3n)a+2)SYj@Iwy9}T=<&3jWjkj@To;Em z&bMk;t$HB5|Lo*(CUyG}ZS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ULqtS%_o42p+5l%sVeqm{om2PBLLVtJ z=GvX8N_x1p?2P$=10mWzT7;jdXMbxeeDAkPLSE{2p8m(1iSJiiFMgR~>K37+jW3_T MbMoNsbqHDZPY4Dq3IG5A literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/silver_topaz_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/silver_topaz_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..aa0ac980bf50efbfe8da061e78d04a72f1587bad GIT binary patch literal 5966 zcmeHLd0Z3M7LJODY@(pzg2W&q#UTqxNFq@nYylz&v4W^DnM`0H$;4zJLDZskgDQ%O zwumBPvDJdOp@@K#Dz%Dx5kbJ(3Uvp;ry$~+35fWfwa?%0^*@teCb@UM^PO|Qd(OE@ zQi5muni-EbCXq;HLO-t%{M~|h85!bN+xFKWiDdAvCE_qF1k{pMYE*{EVKSDeg2}KB zk&#Hcy8L;_=8mbRuP!;N4FU!mR8>r$TkMgRT_xFA(!jsgZl5Oyr%!3y6(+ww>kHTR zvCerG>*L2S?O0w3=WfUf9$tUyj_#_gN>eKLy_?gJWos=O?ASi{+SQ;KZKRF4?a^69 zI||EGVQb9KpWlsLTJK+Gn3AyTk#u{`39F^1OU&XUZ5U`|&JXq1x-Tf7ohd11hYj^V zQ;|-aH~D6(X+ufJjwv37ZbAwcbM%741nwS^^$5X?iu!`vZlt9(w59D&D=k}xl&93& zrS)v3b=(!3t~rayC;*v&S1)k%ZpS-LqY zOZyem<7}S#D%{QO9WL@(PKAzLfSuE|)y#NO+EsSie)O^X*AK*A{?5^_uwtk!bCrc4 zb>h$m*R%Nk)&9PVan+&z;o(b}f;8@E=a51# ztH`6PMg{B_r~BvC-QRz3zF-53^~d}zvK?_{hzU@H9WDwh&4?`Y`HD3uFrLp37aWLn zWd;UEMlWbFU4O`)R6sGoKk$a6gxW=VxwJ zof;SQ$`b7!uE`61K8seB_lqS;4Rb=|z6|U8M+%{n!)3N*H#TvmBv&6%Z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7Ro?e4VsX~0f#MgrZs0VX|agR|zxVl<~T^H^hhn4#hx1G&-BXb>Xl$95$WB zX3=|Br|0_|R%`IAB{=Cc=Uzuri06Y7f_U;E3NRX`s+7@h7Q+*$VGu*rVicA0DFg+X zu+*0V*{v_hd4VVd62+hg!&0J7`YOc}jHc>`ZqyHf|BER!2GuJ6H=ei9eijckrbX3p zLFyn$EDT{E=6N5upD6_IQ5sC0DEym6{RhsiH!J;cTU4Dmz<(&bxOddsNaToKDl%DL zygU#hROC}MU;-@FZvn1j?=2_>R7S&im+UK%H}lAQvK5qY=pg6{0TNJ(Cp^a$1h`y@ zE5LDqB}_;rl|mrv5wJ&Hl|6x)JSAB;pO+WH+K+@`OYcg~qE?as*btyZLX5 z;V*Cl?E4Du@5~3ndaVVhDiQBLF<6jR`9b&Z0roNkA`q<9pdSi-Af#880cRo}bMG8} z*5XGuwg2qyOMRj{{DY6alKKZd;MAX-e3ZVQ!E%?lEm0!4qM4D7VyarVw;!u2Y z7$y{X54&q*Il^T8qkxWl5@`@m=;a~ioX-d?iLInr@r^y^-}jusl0I43R4e?{v A<^TWy literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/silver_topaz_ring.png b/src/main/resources/assets/treasure2/textures/item/adornment/silver_topaz_ring.png new file mode 100644 index 0000000000000000000000000000000000000000..93ce1ac7843d8c1e656c81f481c61334d415c652 GIT binary patch literal 1729 zcmV;y20r zaB^>EX>4U6ba`-PAZ2)IW&i+q+O=0%mLw+({O1%t0ulnmaaiB;4SakDOYL3L)iZWw zXF`I|5+RYa>Hqva%wPC1MQg-I4JibRpCn0~(NVj9X+6oxdY%`1={$^^>jY!Sp>_K; z<|Cgm?r#e&HmE#~8$C0uN6|&|QRt>+MyK98iE-ZJBu7y?0wHO-ya|cVy zj2mYy-p&1hM4;3>3_0fRAdRO^>u%oUGFruxT!IYd(RVJ)5i_^bH5tq2am+t_!7>!$7ni6-_d0WKr@_d zS|-dz4Fo}yxV0?cinu-ca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c4Z)q%fXxpj Date: Thu, 19 Aug 2021 22:57:58 +0000 Subject: [PATCH 12/19] more textures --- .../adornment/copper_diamond_necklace.png | Bin 0 -> 5963 bytes .../adornment/copper_emerald_necklace.png | Bin 0 -> 6042 bytes .../item/adornment/copper_onyx_necklace.png | Bin 0 -> 5878 bytes .../adornment/copper_sapphire_necklace.png | Bin 1771 -> 6030 bytes .../item/adornment/copper_topaz_necklace.png | Bin 5988 -> 5997 bytes .../item/adornment/gold_diamond_necklace.png | Bin 0 -> 5977 bytes .../item/adornment/gold_emerald_necklace.png | Bin 0 -> 6040 bytes .../item/adornment/gold_onyx_necklace.png | Bin 0 -> 5931 bytes .../adornment/silver_diamond_necklace.png | Bin 0 -> 5910 bytes .../adornment/silver_emerald_necklace.png | Bin 0 -> 5992 bytes .../item/adornment/silver_onyx_necklace.png | Bin 0 -> 5857 bytes .../item/adornment/silver_topaz_necklace.png | Bin 5966 -> 5968 bytes 12 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_diamond_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_emerald_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/copper_onyx_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_diamond_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_emerald_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/gold_onyx_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/silver_diamond_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/silver_emerald_necklace.png create mode 100644 src/main/resources/assets/treasure2/textures/item/adornment/silver_onyx_necklace.png diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_diamond_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_diamond_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..d532bafd2d86cd666a97aacf4372339a50450442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L2(Ci$Wdh;JwG|%w4G{onGM{(>8p8EXgODC?)=__$fNG#^8s^7FC zc3O>NRZC<2@zneEt!oZ@7jG`~vr7nGJlSx3v{*XE`PDc=?F@-?@Y>b4ysF)jqo$N) zw+a_8FVN+?YeaE>9FloqO?Ot@*pF literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_emerald_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_emerald_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..e4989984aab5302781611a216207e7972c46452d GIT binary patch literal 6042 zcmeHLd0Z3M7LKwA2!cSXEJ}!_QtM=6LKX-V2qH^F2?~fyCzDBtWNQ*gzy(CnqNrGG zT|mX9Ac7S7P~1=vt3@ESpzr`uDGC$>3JArA%bNs>_@1@T-|zK5lV2vecfRwTbH97e zxk*wMFY+@pu{FV9FlPP>St01Vh4y7+h+Z8AUP2g*fq8srxH1G%VP$eDUnoMb$~YN< zMbtt*2BU5~6&CS*m$T_}!3U-Kfmr>@GSj7{n^tXbFmy{#&lu_4zpV_LM)R}0cKhWE zahrpCmBwza?Ybu$%3F_a&%9;SwC)#mZQJ#=>qUO8NA73prQ)|YYJ%B;9!FM7tftK> z_8iJ6TtLfD-uZQX(wS&J*k8K4qrD+m0$A@&+~w8FZm!>4)l|J_Z~)vIQMY1U#>ljs z&vK2dBihzfNYq;knui=3HZvZuUA?#DXH~bB?#I*eF*D60-O8GJ%HlA?B50&d{=j&6 zI@e?qnj$XO1w@_FG&{9#%wByD4BZFY7$q4C zZh*Uv4jVTz0$9e8jpPozEP0j_=Oe>8JM2I3NwHlz?}W?7=-3qzOI!pNcSe$y?#vXo zR}6aZxU(Sg3bx6Ve=6pBzi_Hq=@%W9)>-E)So;fSLN{-4H&_m57k@+joK?(@7g|;| z?}Zi!3NAYudY=I9@i6Q543JdUmJ^-z+7ivO#fJkQdsFX!Up{I6L;b;2mztW0))uE} z=MAo>85kJN{&cfZ2;WKmjh<0JVdkmUS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v1ulW0m3! z2?)BOJK=5M|6<}qNmY{njpr3~oW)D7R7vI0!SZ148U$9po###9ai$QoM=6x@IRC#` z)PLaIN3(JvYAcn;P4Le_z8D>iHWHCgClwZ}D_#Z!YgJ_86i_U}(`^B&F8Rx0GUfcYl+As0uW54qeBp;6F~?DNuy~$uHc`qQCCQBTp~aOC#=Vvpl$Yl zY@xfh9kSVsiJR=MZI=vxZ5451WHONuk-xtAe-y)?;3n9Q72aQ&PlSzH`$%PRX#a^) z2CF1*b^iw7C_|7CMkEU9+d`iR8I@(inTWZGm{f!<_ z>i16GN#FN!y_f5q6nH1_`|Nrz*E=cjPT=?1^?#GgqRiVG_f3~``5&d7l zkQ?a7!o1Wzvr2Q)(HUde!UzQhGrLUtnp7?f<)D*Ol>ThrDUXb-tZa<+nTLxpm`Ngk zmRBgP@?g4Wpq`h-4+*MFRq~VoM(g33`lroOqKuN*7LLguv5TjN>^GNXtz?wt^&5!v zi!2<&XL(ti+I+llhp$C(p*43mHe$QF>rszo*~X0x2YaP_U^)C)`}u)ViE%^MZZC7r6yS6?SKP%NQt?z81LP&_{2~)XD_L;Ff zYfAH>u<)Wzwqs?CVhi5!WJa-_I6w66eO5{E%`{>m!=-on@TA5auCcB*)_uE6v$w2T zpJ{Vm77%ylr-Jny`yOQ?4spEj{@@+O< z3Xun<(4*vsmiXkHQs1g@2aNbJ$1sa<>_)v?*40PV^zz_1nRrQa#MIPW+1liDL@#i9 zOKZ1PVs3-~^3y8DDS~fbrYZKSZSS6bd-wV;KgMA)m9A4b9YfYH1-2CTmO9g0aZ7wW cYCXH{;x+rz^{x6JqFaIS_g%y)@cumM-%k()Z2$lO literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_onyx_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_onyx_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..b81fb859bdc1932c10565bda69164ebe86175ab9 GIT binary patch literal 5878 zcmeHLd0Z3M77mIiN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ji1k(A&wS(RKu?*xmKGG~)*cG>5UW0sr>!l&5ciZ7wWA|+L>recez zzJ?mB)YPaUlvK0LHQz#uOxkIPrAKPt)_V#nW@lNg@e<1WZ->^iDLrUyb3S5_*w7}fvg+H z*Uqs%W+7&srm-HmItn9aHwz+qTH+i9xuY;Pxexx1T)hCG7W3>49z$-&kVhV*PC%}S zv^#X_6-|FgWt)2H_HG1Ij}bbEeZs1~kn@D?5z8}k>XJ3JOs5fcv1a?KCLcQcg4@6yBaA(i>MX9?VS`xa1as0MUwqEZT_ykD*htNO4o zepnD+7VQ@%FM(8VQ2r~B>H?LQz^U&PUI(YXQ+NZD>T;gF=jYAN+e&JV%lJh3xFcV~ zrLIW(nIz=1+LCIa7#i2kF|=pyt5obbEmygVP{*Mbk7bcSjDDlq!{YnR+Iu;UxNTSC z`W}3+vuOgqX}f>5^vzP2T- z8T~7uY>Br3P_GejpPSmY%p5!JawY9*W!+<;4akb%=0D5$%BX&`SF-InLc%>qXS+n^ z#U8#A-YTj-OZ_Rg3x;8R9JhhSo_%l_dDDq&wU|v*^yT8&qJDSi{I`KRuA`#<0oe!0 zDyLo{M)H&66*GSi2pYy_r)~fM0a!^yK~y-)l~X-S13?gd7dN{qo@gONC50fwRuhXP zb&x=W5G^8D1uRmD#Z~@!AWM~004i>sridTaI(@dg5XL9ZJA5@ zb#1bzsLUn(34&84pC$-S45QF?4a=#Kwja9YXUVlHd(DhX5t7`? b%?yYizV@Mf{_9&_00000NkvXXu0mjf|426n diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/copper_topaz_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/copper_topaz_necklace.png index dfc4c76d63c996b43699487ce9b68a05454385a1..adf73a042d991e55a138c258527d6a6e9e529265 100644 GIT binary patch delta 1836 zcmV+{2h;fEF6}OmPk+QBj)PgM<_6#Kr&;XhEHCk!`r?WqSV&E`kcp}P{I{9^;KS@T zV_i@mz2ES$(MC?_=r%ub+-bApzJ6>+=V9EO4;Vv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}f0N7N^{;`bE#Up;FwQqz=VT0+gJgi-8Vmo za6=t){D1y!^tNvIz2z?@2;F`vTHSEP`RwctdEhdqF)Mb`+>;_&9^&zL%`y-O`X**3~}W?SZ1|)hG?IgM1HV%NAuCrwRPQ%fezhmQx1J* lYr5h@fXlbyGgGZ;wDh{N*uZYbOQe{zVE-_`-P00s{se)iup0mX literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/silver_emerald_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/silver_emerald_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..72e29cc6e63913577137aa6656661f1e7e0d42a3 GIT binary patch literal 5992 zcmeHLX;c$g77nera0C=_2RcSDiNo| zsF)TPQz+V-M}qO=owlQ1*VsK6;UyB7L|tnL-{@Q=D!Z}xxwyzb2U=hEi{XVseVv-% z6-{O4Cz#iVPuP96Cq05@6O^#{9Cy$Ds%32x;)B|5Ub|5oVdfQ@J-fAIWa~?ZreiL> zMPX|jOW>J&mSQb)mi>%oBeT}CH!Gwb(WXj9&&;~BHs;qkwy)YFVsabR9Y>EEmzH>6 zyO0WTrq*iL!C|F)tX+mV32CLNA$5}sTj$*U&Op)tv=ToR@gG(fON_4sgN{}f&V8p| z$F_TF=GZQ+b$NO6-hm&$bp^ZE^_rwTzUd4|{`es~qdRZGKT=k68aHO)u9lI|=(!Wq zuUaIR-QL$GNwRgZ3Hw&#VT*2cO`DiPFoVWTZ>jsmb^KTL()^qsQ93p9gkgt8LHV7E z6xZE_?gztDGgpR=`FV}sELLkNo*n)wC~Tx#`redps+`Tc@bjF^?tM+uXoZh5J)lh? z!%~VHw4#Y4GK%7IuNHgqR^JEk9XPUSB-9#+GqR zX0UFkd3a~y^rzICr%5SFip$9I&`}cT+v_SrF9(`Q!_bRkq{zktyzM}C>@M#+Wyxbr z<@>Btu@sNj+OebEDw5gP7fK3^9d7R5#l3e}U416{{B-b^_Q~$<**%W}Q^OOC={=)e zN7<>&cdc+Z{Rl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<0!8V>kAOCkYIvFLnOsTifp$8*T z-QTVBFGPPmp;HY#|C`rYFU?!7%0azFd1z0G? z1-Kj*1Ry8}5g6!^cG0wWX}`TxfA z9{P^OMMY>7swh8|pC}STh)?r;4E&BMfb3CfLKP?ci%tCp&Z$2uy+~VyDsGVfKrFg{ z)Za*?xLztMRbRY(7}2RHpsC?l4Amb2sbl{V5&_F47}+HUO62W4{*i2jMO+39a}YoT zqh!K!IWWNEi8uh)9uu(;F^VFv!-wo@g_zL5D$GSf))0BlWCiKZnQH3;BUHaYyAR=- z2uznk5EB9zWan}SVlw$`2R@q#Kx{q)(fW^kAO-%OJwhTT&z^_c0}RBTEM+Ff21G0o z7Z8hiBFMqPfq}AF9|ryBd(;=wN4E$-tU>#60(H&)?GZZZ+M$mRfAAqY>DnbvD z7^PB*W2z4i|7|h+32u=6K;iwB`CwSTwVOg2NA{lx!cQarr2CHm`x)lq2qsr6J{9_4 zNWUzD?nE-?{yFllC9iJq-Q7Kq`nvA$H$DbR>TmQwQh#ysS^9pF>x*2UrNC!_zhu`J zxjsvQ&jNqRuK$}{M(@AF$u$4wwx(fyTT7ZKwwbhUkIqq& z_>I?&V6$%*Q9>$b{Z_c*Kz-l!8lLd%4x5>;IycXhSO-^M6o*%yJ`LAU3MXv2u_?-E aIc4;NLrw8}OB_j+DMAll_oJ@i3I7Ia2=-h6 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/adornment/silver_onyx_necklace.png b/src/main/resources/assets/treasure2/textures/item/adornment/silver_onyx_necklace.png new file mode 100644 index 0000000000000000000000000000000000000000..d90a29e46e565a848b7348f197825c72b1652bc6 GIT binary patch literal 5857 zcmeHLYg7~077l_UDhd&=rD6#YMXZx|Ad@Bv3PRK%g$SZhnaoTeke8VWiHM>|p<1QB zpuUBQrKtE^RjT4!6tN;Gh*HJ+EEEfh*2tCdbU4DXf%iQsfuZ21Y%|wjCz$?gEPq42AqLg z)G8Xya`oHjrs`XM{W_~gMf9+18=ZZ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HswIzg2B3oP-T~mv~Swp{Z>$9quCg3fz1j`F-ouLUC<- z{`?x^FggJ&c5*-&}lB_ILKH-I){HywyM}j=L@REOI-06{J3Cv$55?Qf8W8) zPe+FLV7J!K26K?KHb~9buH7w_j=8t1RF^N5#`}T9JfZqqdCjAA0&5k&V7DRoHRB3L z(EjeAW8R;5ekcFH5RQTonEVT-e*V;HT9Og~003ZmR9JLUVRs;Ka&Km7Y-J#Hd2o|E z1q(`vK@NaG3WHiQVtmy?FEB|07wW5GD}pyzaJbiLfk!gVQPhiW%+5U9}SF zN{A(n^|YQt>ot;w`Av6w05Mn;(+A!_FSC&a(*h(iW;J6tHZ^4}I5;t8Ei^G9H)3IvhzO7iI5jvpHZe6eH8C@@BMH+2BxPeXI5A~6Gc7qdIWjFY zVq`EaVKzB1En_%iV>D%CVP!coF|!&BrU?XLGFQoy#1%6K4+|RYOZ2Ui{uM=kTahj0 z(E}HBb&rpAb*>2NU{vXKmJ?^q*tZDbaHP}4YPlyfssv9Vr9?EF+TvhTg%6(YRwR7;ux}=JVs;Xx)0Cu0051$xL7R_4o9#~k>$kh_YjIBTOtnL zcC%GrR5kEl6mHxFy;@tx{?4d>N`ea=+9^E;j4D2f-ToG}fUfn{Ykse}CtFB-ih!=s z8FbO|Z_yca(cjIH_|$NrKCWgI`26}tyC;C(p9;NMS{2QvO7Ii_Af? Date: Fri, 20 Aug 2021 14:43:46 -0400 Subject: [PATCH 13/19] charms! --- .../someguyssoftware/treasure2/Treasure.java | 2 + .../capability/CharmableCapability.java | 85 ++---- .../CharmableCapabilityStorage.java | 15 +- .../capability/ICharmableCapability.java | 17 +- .../treasure2/charm/BaseMaterial.java | 29 +++ .../treasure2/charm/BaseMaterial2.java | 105 ++++++++ .../treasure2/charm/CharmContext.java | 134 ++++++++++ .../treasure2/charm/CharmEntity.java | 9 +- .../treasure2/charm/CharmableMaterial.java | 111 ++++++++ .../treasure2/charm/HealingCharm.java | 50 +--- .../treasure2/charm/ICharm.java | 2 - .../treasure2/charm/ShieldingCharm.java | 110 ++++++++ .../treasure2/charm/TreasureCharms.java | 128 +++++++-- .../eventhandler/PlayerEventHandler.java | 242 +++++++----------- .../treasure2/init/TreasureSetup.java | 45 +++- .../treasure2/item/CharmItem.java | 2 + .../treasure2/item/TreasureItemTier.java | 6 +- .../treasure2/item/TreasureItems.java | 66 ++--- .../network/CharmMessageHandlerOnClient.java | 49 +++- .../network/CharmMessageToClient.java | 61 +++-- .../treasure2/network/TreasureNetworking.java | 8 +- .../assets/treasure2/lang/en_us.json | 8 +- .../assets/treasure2/models/item/charm.json | 25 +- .../models/item/charm_model_copper.json | 6 - .../models/item/charm_model_silver.json | 6 - .../treasure2/models/item/copper_charm.json | 65 +++++ .../models/item/copper_charm_black_pearl.json | 6 + .../models/item/copper_charm_diamond.json | 6 + .../models/item/copper_charm_emerald.json | 6 + .../models/item/copper_charm_onyx.json | 6 + .../models/item/copper_charm_ruby.json | 6 + .../models/item/copper_charm_sapphire.json | 6 + .../models/item/copper_charm_topaz.json | 6 + .../models/item/copper_charm_white_pearl.json | 6 + .../treasure2/models/item/test_charm.json | 32 ++- .../data/curios/tags/items/bracelet.json | 4 +- .../data/curios/tags/items/charm.json | 7 +- .../data/curios/tags/items/necklace.json | 2 +- .../data/curios/tags/items/ring.json | 3 +- 39 files changed, 1088 insertions(+), 394 deletions(-) create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/CharmContext.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java delete mode 100644 src/main/resources/assets/treasure2/models/item/charm_model_copper.json delete mode 100644 src/main/resources/assets/treasure2/models/item/charm_model_silver.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_black_pearl.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_diamond.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_emerald.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_onyx.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_ruby.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_sapphire.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_topaz.json create mode 100644 src/main/resources/assets/treasure2/models/item/copper_charm_white_pearl.json diff --git a/src/main/java/com/someguyssoftware/treasure2/Treasure.java b/src/main/java/com/someguyssoftware/treasure2/Treasure.java index 5fa3bcbc5..6c827b905 100644 --- a/src/main/java/com/someguyssoftware/treasure2/Treasure.java +++ b/src/main/java/com/someguyssoftware/treasure2/Treasure.java @@ -7,6 +7,7 @@ import com.someguyssoftware.gottschcore.annotation.ModInfo; import com.someguyssoftware.gottschcore.config.IConfig; import com.someguyssoftware.gottschcore.mod.IMod; +import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.config.TreasureConfig; import com.someguyssoftware.treasure2.entity.TreasureEntities; import com.someguyssoftware.treasure2.eventhandler.PlayerEventHandler; @@ -78,6 +79,7 @@ public Treasure() { eventBus.addListener(this::config); eventBus.addListener(TreasureNetworking::common); eventBus.addListener(TreasureSetup::common); + eventBus.addListener(TreasureCharms::setup); eventBus.addListener(TreasureSetup::clientSetup); eventBus.addListener(this::clientSetup); diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java index 34f14fa5a..5217cd347 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java @@ -28,6 +28,9 @@ import java.util.function.Consumer; import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.charm.BaseMaterial; +import com.someguyssoftware.treasure2.charm.BaseMaterial2; +import com.someguyssoftware.treasure2.charm.CharmableMaterial; import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.charm.TreasureCharms; @@ -70,9 +73,11 @@ public class CharmableCapability implements ICharmableCapability { private boolean finite; // the base material this item is made of - private BaseMaterial baseMaterial = BaseMaterial.COPPER; + private ResourceLocation baseMaterial; // the item that this capability belongs to private ResourceLocation sourceItem; + + @Deprecated // the max level of any charm that this item can hold (in either of the 3 inventories) private int maxCharmLevel; @@ -107,7 +112,6 @@ public CharmableCapability(Builder builder) { this.maxSocketsSize = socketable ? Math.max(1, builder.maxSocketsSize) : 0; this.baseMaterial = builder.baseMaterial; this.sourceItem = builder.sourceItem; - this.maxCharmLevel = builder.maxCharmLevel; } /** @@ -195,10 +199,6 @@ private void appendHoverText(ItemStack stack, World world, List for (ICharmEntity entity : entityList) { entity.getCharm().appendHoverText(stack, world, tooltip, flag, entity); } - // add socket footer -// if (inventoryType == InventoryType.SOCKET || inventoryType == InventoryType.IMBUE) { -// appendCapacityHoverText(stack, world, tooltip, flag, entityList); -// } } } @@ -331,25 +331,15 @@ public void setMaxFiniteSize(int maxFiniteSize) { } @Override - public BaseMaterial getBaseMaterial() { + public ResourceLocation getBaseMaterial() { return baseMaterial; } @Override - public void setBaseMaterial(BaseMaterial baseMaterial) { + public void setBaseMaterial(ResourceLocation baseMaterial) { this.baseMaterial = baseMaterial; } - @Override - public int getMaxCharmLevel() { - return maxCharmLevel; - } - - @Override - public void setMaxCharmLevel(int maxLevel) { - this.maxCharmLevel = maxLevel; - } - /** * * @author Mark Gottschling on Aug 15, 2021 @@ -387,35 +377,7 @@ public static InventoryType getByValue(Integer value) { return (InventoryType) values.get(value); } } - - /** - * - * @author Mark Gottschling on Aug 16, 2021 - * - */ - public enum BaseMaterial { - NONE(0, 0), - COPPER(1, 1), - SILVER(2, 2), - GOLD(3, 3); - private int value; - private int maxCharmLevel; - - BaseMaterial(int value, int maxLevel) { - this.value = value; - this.maxCharmLevel = maxLevel; - } - - public int getValue() { - return value; - } - - public int getMaxCharmLevel() { - return maxCharmLevel; - } - } - /** * * @author Mark Gottschling on Aug 16, 2021 @@ -424,19 +386,16 @@ public int getMaxCharmLevel() { public static class Builder { private boolean source; public boolean bindable; - private boolean socketing; public boolean socketable; public boolean imbuing; public boolean imbuable; public boolean finite; + + public ResourceLocation baseMaterial = TreasureCharms.COPPER.getName(); - public BaseMaterial baseMaterial = BaseMaterial.COPPER; // required property public ResourceLocation sourceItem; - // calculated value - private int maxCharmLevel; - public int maxSocketsSize; public int maxImbueSize; public int maxFiniteSize; @@ -467,11 +426,6 @@ public Builder socketable(boolean socketable, int size) { return this; } - public Builder socketing(boolean socketing) { - this.socketing = socketing; - return this; - } - public Builder finite(boolean finite, int size) { this.finite = finite; this.maxFiniteSize = size; @@ -489,21 +443,16 @@ public Builder imbuing(boolean imbuing) { return this; } - public Builder baseMaterial(BaseMaterial material) { + public Builder baseMaterial(ResourceLocation material) { this.baseMaterial = material; return this; } -// public Builder sourceItem(ResourceLocation sourceItemName) { -// this.sourceItem = sourceItemName; -// return this; -// } - public ICharmableCapability build() { // calculate the max charm level based on baseMaterial and the source item. Treasure.LOGGER.debug("charm source item -> {}", sourceItem); - Optional level = TreasureCharms.getCharmLevel(sourceItem); - this.maxCharmLevel = baseMaterial.getMaxCharmLevel() + (level.isPresent() ? level.get() : 0) ; +// Optional level = TreasureCharms.getCharmLevel(sourceItem); +// this.maxCharmLevel = baseMaterial.getMaxLevel() + (level.isPresent() ? level.get() : 0) ; return new CharmableCapability(this); } } @@ -516,4 +465,12 @@ public ResourceLocation getSourceItem() { public void setSourceItem(ResourceLocation sourceItem) { this.sourceItem = sourceItem; } + + @Override + public int getMaxCharmLevel() { + Optional base = TreasureCharms.getBaseMaterial(baseMaterial); + Optional source = TreasureCharms.getSourceItem(sourceItem); + return (base.isPresent() ? base.get().getMaxLevel() : TreasureCharms.COPPER.getMaxLevel()) + (source.isPresent() ? source.get().getMaxLevel() : 0); + } + } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java index a91ffa868..0f95110e8 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java @@ -23,9 +23,11 @@ import java.util.Optional; import com.someguyssoftware.treasure2.Treasure; -import com.someguyssoftware.treasure2.capability.CharmableCapability.BaseMaterial; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.BaseMaterial2; +import com.someguyssoftware.treasure2.charm.CharmableMaterial; import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.util.ModUtils; import net.minecraft.nbt.CompoundNBT; @@ -89,9 +91,8 @@ public INBT writeNBT(Capability capability, ICharmableCapa nbt.putBoolean(SOCKETABLE, instance.isSocketable()); nbt.putBoolean(SOCKETING, instance.isSocketing()); nbt.putInt(MAX_SOCKET_SIZE, instance.getMaxSocketsSize()); - nbt.putString(BASE_MATERIAL, instance.getBaseMaterial().name()); + nbt.putString(BASE_MATERIAL, instance.getBaseMaterial().toString()); nbt.putString(SOURCE_ITEM, instance.getSourceItem().toString()); - nbt.putInt(MAX_CHARM_LEVEL, instance.getMaxCharmLevel()); } catch (Exception e) { Treasure.LOGGER.error("Unable to write state to NBT:", e); @@ -156,14 +157,14 @@ public void readNBT(Capability capability, ICharmableCapab instance.setFinite(tag.getBoolean(SOCKETING)); } if (tag.contains(BASE_MATERIAL)) { - instance.setBaseMaterial(BaseMaterial.valueOf(tag.getString(BASE_MATERIAL).toUpperCase())); +// Optional material = TreasureCharms.getBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); +// Optional material = TreasureCharms.getBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); + instance.setBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); //BaseMaterial.valueOf(tag.getString(BASE_MATERIAL).toUpperCase())); } + if (tag.contains(SOURCE_ITEM)) { instance.setSourceItem(ModUtils.asLocation(tag.getString(SOURCE_ITEM))); } - if (tag.contains(MAX_CHARM_LEVEL)) { - instance.setMaxCharmLevel(tag.getInt(MAX_CHARM_LEVEL)); - } } } } diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java index 193eb602f..da2a62e24 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java @@ -21,8 +21,10 @@ import java.util.List; -import com.someguyssoftware.treasure2.capability.CharmableCapability.BaseMaterial; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.BaseMaterial; +import com.someguyssoftware.treasure2.charm.BaseMaterial2; +import com.someguyssoftware.treasure2.charm.CharmableMaterial; import com.someguyssoftware.treasure2.charm.ICharmEntity; import net.minecraft.client.util.ITooltipFlag; @@ -48,9 +50,9 @@ public interface ICharmableCapability { */ void add(InventoryType type, ICharmEntity entity); - public boolean isCharmed(); - - public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); + public boolean isCharmed(); + public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); + int getMaxCharmLevel(); public boolean isBindable(); public void setBindable(boolean bindable); @@ -76,11 +78,8 @@ public interface ICharmableCapability { void setMaxImbueSize(int maxImbueSize); void setMaxFiniteSize(int maxFiniteSize); - BaseMaterial getBaseMaterial(); - void setBaseMaterial(BaseMaterial baseMaterial); - - int getMaxCharmLevel(); - void setMaxCharmLevel(int maxLevel); + ResourceLocation getBaseMaterial(); + void setBaseMaterial(ResourceLocation baseMaterial); ResourceLocation getSourceItem(); void setSourceItem(ResourceLocation sourceItem); diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java new file mode 100644 index 000000000..d6066d70e --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java @@ -0,0 +1,29 @@ +package com.someguyssoftware.treasure2.charm; + +/** + * + * @author Mark Gottschling on Aug 16, 2021 + * + */ +public enum BaseMaterial { + NONE(0, 0), + COPPER(1, 2), + SILVER(2, 3), + GOLD(3, 4); + + private int value; + private int maxCharmLevel; + + BaseMaterial(int value, int maxLevel) { + this.value = value; + this.maxCharmLevel = maxLevel; + } + + public int getValue() { + return value; + } + + public int getMaxCharmLevel() { + return maxCharmLevel; + } +} \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java new file mode 100644 index 000000000..2fcbc8a62 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java @@ -0,0 +1,105 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import com.someguyssoftware.gottschcore.measurement.Quantity; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TranslationTextComponent; + +/** + * + * @author Mark Gottschling on Aug 19, 2021 + * + */ +public class BaseMaterial2 { +// use a class instead of an enum so more materials can easily be added. might have special charms/adornments like platinum etc. + private ResourceLocation name; + private int maxLevel; + private Quantity levelRange; + + /** + * + * @param name + * @param maxLevel + * @param levelRange + */ + public BaseMaterial2(String name, int maxLevel, Quantity levelRange) { + this.name = ModUtils.asLocation(name); + this.maxLevel = maxLevel; + this.levelRange = levelRange; + } + + /** + * + * @param name + * @param maxLevel + * @param minRange + * @param maxRange + */ + public BaseMaterial2(String name, int maxLevel, Double minRange, Double maxRange) { + this(name, maxLevel, new Quantity(minRange, maxRange)); + } + + /** + * + * @return + */ + public String getDisplayName() { + return new TranslationTextComponent("base_material." + name.toString().replace(":", ".")).getString(); + } + + public ResourceLocation getName() { + return name; + } + + public void setName(ResourceLocation name) { + this.name = name; + } + + public int getMaxLevel() { + return maxLevel; + } + + public void setMaxLevel(int maxLevel) { + this.maxLevel = maxLevel; + } + + public Quantity getLevelRange() { + return levelRange; + } + + public void setLevelRange(Quantity levelRange) { + this.levelRange = levelRange; + } + + /** + * Convenience methods. + * @return + */ + public double getMinRangeLevel() { + return getLevelRange().getMin(); + } + + public double getMaxRangeLevel() { + return getLevelRange().getMax(); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/CharmContext.java b/src/main/java/com/someguyssoftware/treasure2/charm/CharmContext.java new file mode 100644 index 000000000..92a1dba58 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/CharmContext.java @@ -0,0 +1,134 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.Comparator; +import java.util.function.Consumer; + +import com.someguyssoftware.treasure2.capability.ICharmableCapability; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; + +/** + * + * @author Mark Gottschling on Aug 19, 2021 + * + */ +public class CharmContext { + private Hand hand; + private String slotProviderId; + private String slot; + private ItemStack itemStack; + private ICharmableCapability capability; + private InventoryType type; + private int index; + private ICharmEntity entity; + + /** + * + * @param builder + */ + CharmContext(Builder builder) { + this.hand = builder.hand; + this.slotProviderId = builder.slotProviderId; + this.slot = builder.slot; + this.itemStack = builder.itemStack; + this.capability = builder.capability; + this.type = builder.type; + this.index = builder.index; + this.entity = builder.entity; + } + + public static Comparator priorityComparator = new Comparator() { + @Override + public int compare(CharmContext p1, CharmContext p2) { + // use p1 < p2 because the sort should be ascending + if (p1.getEntity().getCharm().getPriority() < p2.getEntity().getCharm().getPriority()) { + // greater than + return 1; + } + else { + // less than + return -1; + } + } + }; + + public Hand getHand() { + return hand; + } + + public String getSlotProviderId() { + return slotProviderId; + } + + public String getSlot() { + return slot; + } + + public ItemStack getItemStack() { + return itemStack; + } + + public InventoryType getType() { + return type; + } + + public int getIndex() { + return index; + } + + public ICharmEntity getEntity() { + return entity; + } + + public static class Builder { + public Hand hand; + public String slotProviderId; + public String slot; + public ItemStack itemStack; + public ICharmableCapability capability; + public InventoryType type; + public int index; + public ICharmEntity entity; + + public Builder with(Consumer builder) { + builder.accept(this); + return this; + } + + public CharmContext build() { + return new CharmContext(this); + } + } + + @Override + public String toString() { + return "CharmContext [hand=" + hand + ", slotProviderId=" + slotProviderId + ", slot=" + slot + + ", itemStack=" + itemStack == null ? "N/A" : itemStack.getDisplayName().getString() + + "type=" + type + "]"; + } + + public ICharmableCapability getCapability() { + return capability; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java index fb51510f3..0211b1783 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/CharmEntity.java @@ -19,10 +19,13 @@ */ package com.someguyssoftware.treasure2.charm; -import java.util.Comparator; - import net.minecraft.nbt.CompoundNBT; +/** + * + * @author Mark Gottschling on Aug 19, 2021 + * + */ public class CharmEntity implements ICharmEntity { private ICharm charm; @@ -62,7 +65,7 @@ public void update(ICharmEntity entity) { * @return */ // public static Optional load(CompoundNBT nbt) { -// Optional charm = Charm.load((CompoundNBT) nbt.get(CHARM)); +// Optional charm = Charm.load((CompoundNBT) nbt.get(COPPER_CHARM)); // if (!charm.isPresent()) { // return Optional.empty(); // } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java b/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java new file mode 100644 index 000000000..f34f0fc60 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java @@ -0,0 +1,111 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TranslationTextComponent; + +/** + * + * @author Mark Gottschling on Aug 20, 2021 + * + */ +public class CharmableMaterial { + private int id; + private ResourceLocation name; + private int maxLevel; + private int minSpawnLevel; + + /** + * + * @param name + * @param maxLevel + * @param levelRange + */ + public CharmableMaterial(int id, String name, int maxLevel, int minSpawnLevel) { + this.id = id; + this.name = ModUtils.asLocation(name); + this.maxLevel = maxLevel; + this.minSpawnLevel = minSpawnLevel; + } + + public CharmableMaterial(int id, String name, int maxLevel) { + this(id, name, maxLevel, 1); + } + + /** + * + * @param name + * @param maxLevel + * @param levelRange + */ + public CharmableMaterial(int id, ResourceLocation name, int maxLevel, int minSpawnLevel) { + this.id = id; + this.name = name; + this.maxLevel = maxLevel; + this.minSpawnLevel = minSpawnLevel; + } + + public CharmableMaterial(int id, ResourceLocation name, int maxLevel) { + this(id, name, maxLevel, 1); + } + + /** + * + * @return + */ + public String getDisplayName() { + return new TranslationTextComponent("charmable_component." + name.toString().replace(":", ".")).getString(); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public ResourceLocation getName() { + return name; + } + + public void setName(ResourceLocation name) { + this.name = name; + } + + public int getMaxLevel() { + return maxLevel; + } + + public void setMaxLevel(int maxLevel) { + this.maxLevel = maxLevel; + } + + public int getMinSpawnLevel() { + return minSpawnLevel; + } + + public void setMinSpawnLevel(int minSpawnLevel) { + this.minSpawnLevel = minSpawnLevel; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java index 1a04c904d..11d729a28 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java @@ -19,7 +19,6 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; -import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.eventbus.api.Event; /** @@ -29,11 +28,11 @@ public class HealingCharm extends Charm implements IHealing { public static String HEALING_TYPE = "healing"; private static float HEAL_RATE = 1F; - + HealingCharm(Builder builder) { super(builder); } - + /** * */ @@ -41,7 +40,7 @@ public class HealingCharm extends Charm implements IHealing { public float getHealRate() { return HEAL_RATE; } - + /** * NOTE: it is assumed that only the allowable events are calling this action. */ @@ -49,51 +48,30 @@ public float getHealRate() { public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { boolean result = false; if (world.getGameTime() % 20 == 0) { -// if (event instanceof LivingUpdateEvent) { - if (entity.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { - float amount = Math.min(getHealRate(), player.getMaxHealth() - player.getHealth()); - player.setHealth(MathHelper.clamp(player.getHealth() + amount, 0.0F, player.getMaxHealth())); - entity.setValue(MathHelper.clamp(entity.getValue() - amount, 0D, entity.getValue())); - // Treasure.logger.debug("new data -> {}", data); - result = true; - } -// } + if (entity.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { + float amount = Math.min(getHealRate(), player.getMaxHealth() - player.getHealth()); + player.setHealth(MathHelper.clamp(player.getHealth() + amount, 0.0F, player.getMaxHealth())); + entity.setValue(MathHelper.clamp(entity.getValue() - amount, 0D, entity.getValue())); + // Treasure.logger.debug("new data -> {}", data); + result = true; + } } return result; } - + /** * */ @SuppressWarnings("deprecation") @Override public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { - TextFormatting color = TextFormatting.RED; + TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); tooltip.add(new TranslationTextComponent("tooltip.charm.healing_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } - - /** - * - */ - @Override - public CompoundNBT writeToNBT(CompoundNBT nbt) { - try { - nbt.putString("name", this.getName().toString()); - } - catch(Exception e) { - Treasure.LOGGER.error("Unable to write state to NBT:", e); - } - return nbt; - } - - /** - * - * @author Mark Gottschling on Aug 15, 2021 - * - */ + public static class Builder extends Charm.Builder { - + public Builder(Integer level) { super(ModUtils.asLocation(HEALING_TYPE + level), HEALING_TYPE, level); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java index 2c22e5fb1..fc8989118 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java @@ -60,8 +60,6 @@ public interface ICharm { public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity); public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity); - - public CompoundNBT writeToNBT(CompoundNBT nbt); /** * diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java new file mode 100644 index 000000000..f4fff9066 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java @@ -0,0 +1,110 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Apr 30, 2020 + * + */ +public class ShieldingCharm extends Charm { + public static String SHIELDING_TYPE = "shielding"; + + private static final Class REGISTERED_EVENT = LivingDamageEvent.class; + + /** + * + * @param builder + */ + ShieldingCharm(Builder builder) { + super(builder); + } + + public static Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity data) { + boolean result = false; + if (data.getValue() > 0 && player.isAlive()) { + // get the source and amount + double amount = ((LivingDamageEvent)event).getAmount(); + // calculate the new amount + double newAmount = 0; + double amountToCharm = amount * data.getPercent(); + double amountToPlayer = amount - amountToCharm; + // Treasure.logger.debug("amount to charm -> {}); amount to player -> {}", amountToCharm, amountToPlayer); + if (data.getValue() >= amountToCharm) { + data.setValue(data.getValue() - amountToCharm); + newAmount = amountToPlayer; + } + else { + newAmount = amount - data.getValue(); + data.setValue(0); + } + ((LivingDamageEvent)event).setAmount((float) newAmount); + result = true; + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.BLUE; + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent("tooltip.charm.shielding_rate", Math.round(entity.getPercent()*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); + + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(SHIELDING_TYPE + level), SHIELDING_TYPE, level); + } + + @Override + public ICharm build() { + return new ShieldingCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java index 2b442be88..8e1b4b373 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java @@ -31,6 +31,7 @@ import net.minecraft.item.Items; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; /** * @@ -38,12 +39,30 @@ * */ public class TreasureCharms { - // TODO additional registering (ie tags) needs to take place in a setup event method - // TODO probably need a new class that hold the max level and the spawn level range - private static final Map ITEM_TO_CHARM_LEVELS = new HashMap<>(); + // TODO this probably can go away in favor of method in Charm private static final Multimap, String> EVENT_CHARM_MAP = ArrayListMultimap.create(); + + private static final Map METAL_REGISTRY = new HashMap<>(); + private static final Map GEM_REGISTRY = new HashMap<>(); + + public static CharmableMaterial COPPER = new CharmableMaterial(1, "copper", 2); + public static CharmableMaterial SILVER = new CharmableMaterial(2, "silver", 3); + public static CharmableMaterial GOLD = new CharmableMaterial(3, "gold", 4); + public static CharmableMaterial DIAMOND; + public static CharmableMaterial EMERALD; + public static CharmableMaterial TOPAZ; + public static CharmableMaterial ONYX; + public static CharmableMaterial RUBY; + public static CharmableMaterial SAPPHIRE; + public static CharmableMaterial WHITE_PEARL; + public static CharmableMaterial BLACK_PEARL; + +// public static final BaseMaterial2 COPPER = new BaseMaterial2("copper", 2, 1D, 2D); +// public static final BaseMaterial2 SILVER = new BaseMaterial2("silver", 3, 1D, 3D); +// public static final BaseMaterial2 GOLD = new BaseMaterial2("gold", 4, 2D, 4D); + public static final ICharm HEALING_1 = makeHealing(1); public static final ICharm HEALING_2 = makeHealing(2); public static final ICharm HEALING_3 = makeHealing(3); @@ -60,15 +79,27 @@ public class TreasureCharms { public static final ICharm HEALING_14 = makeHealing(14); public static final ICharm HEALING_15 = makeHealing(15); + public static final ICharm SHIELDING_1 = makeShielding(1); + public static final ICharm SHIELDING_2 = makeShielding(2); + public static final ICharm SHIELDING_3 = makeShielding(3); + public static final ICharm SHIELDING_4 = makeShielding(4); + public static final ICharm SHIELDING_5 = makeShielding(5); + public static final ICharm SHIELDING_6 = makeShielding(6); + public static final ICharm SHIELDING_7 = makeShielding(7); + public static final ICharm SHIELDING_8 = makeShielding(8); + public static final ICharm SHIELDING_9 = makeShielding(9); + public static final ICharm SHIELDING_10 = makeShielding(10); + public static final ICharm SHIELDING_11 = makeShielding(11); + public static final ICharm SHIELDING_12 = makeShielding(12); + public static final ICharm SHIELDING_13 = makeShielding(13); + public static final ICharm SHIELDING_14 = makeShielding(14); + public static final ICharm SHIELDING_15 = makeShielding(15); + static { -// ITEM_TO_CHARM_LEVELS.put(TreasureItems.TOPAZ.getRegistryName(), Integer.valueOf(4)); - ITEM_TO_CHARM_LEVELS.put(Items.DIAMOND.getRegistryName(), Integer.valueOf(5)); -// ITEM_TO_CHARM_LEVELS.put(TreasureItems.ONYX.getRegistryName(), Integer.valueOf(6)); - ITEM_TO_CHARM_LEVELS.put(Items.EMERALD.getRegistryName(), Integer.valueOf(7)); - ITEM_TO_CHARM_LEVELS.put(TreasureItems.RUBY.getRegistryName(), Integer.valueOf(9)); - ITEM_TO_CHARM_LEVELS.put(TreasureItems.SAPPHIRE.getRegistryName(), Integer.valueOf(11)); - ITEM_TO_CHARM_LEVELS.put(TreasureItems.WHITE_PEARL.getRegistryName(), Integer.valueOf(9)); - ITEM_TO_CHARM_LEVELS.put(TreasureItems.BLACK_PEARL.getRegistryName(), Integer.valueOf(11)); + // register + METAL_REGISTRY.put(COPPER.getName(), COPPER); + METAL_REGISTRY.put(SILVER.getName(), SILVER); + METAL_REGISTRY.put(GOLD.getName(), GOLD); EVENT_CHARM_MAP.put(LivingUpdateEvent.class, HealingCharm.HEALING_TYPE); @@ -87,6 +118,49 @@ public class TreasureCharms { TreasureCharmRegistry.register(HEALING_13); TreasureCharmRegistry.register(HEALING_14); TreasureCharmRegistry.register(HEALING_15); + + TreasureCharmRegistry.register(SHIELDING_1); + TreasureCharmRegistry.register(SHIELDING_2); + TreasureCharmRegistry.register(SHIELDING_3); + TreasureCharmRegistry.register(SHIELDING_4); + TreasureCharmRegistry.register(SHIELDING_5); + TreasureCharmRegistry.register(SHIELDING_6); + TreasureCharmRegistry.register(SHIELDING_7); + TreasureCharmRegistry.register(SHIELDING_8); + TreasureCharmRegistry.register(SHIELDING_9); + TreasureCharmRegistry.register(SHIELDING_10); + TreasureCharmRegistry.register(SHIELDING_11); + TreasureCharmRegistry.register(SHIELDING_12); + TreasureCharmRegistry.register(SHIELDING_13); + TreasureCharmRegistry.register(SHIELDING_14); + TreasureCharmRegistry.register(SHIELDING_15); + } + + /** + * The gem/sourceItem portion of a charm capability takes in a RegistryName of an Item, + * there it needs to be setup and registered in a FML event so that the Items being referenced + * are already create and registered. + * @param event + */ + public static void setup(FMLCommonSetupEvent event) { +// TOPAZ = new CharmableMaterial(1, Items.TOPAZ.getRegistryName(), 4, 1); + DIAMOND = new CharmableMaterial(2, Items.DIAMOND.getRegistryName(), 5, 3); +// ONYX = new CharmableMaterial(3, Items.ONYX.getRegistryName(), 6, 3); + EMERALD = new CharmableMaterial(4, Items.EMERALD.getRegistryName(), 7, 3); + RUBY = new CharmableMaterial(5, TreasureItems.RUBY.getRegistryName(), 9, 4); + SAPPHIRE = new CharmableMaterial(6, TreasureItems.SAPPHIRE.getRegistryName() , 11, 6); + WHITE_PEARL = new CharmableMaterial(7, TreasureItems.WHITE_PEARL.getRegistryName() , 9, 8); + BLACK_PEARL = new CharmableMaterial(8, TreasureItems.BLACK_PEARL.getRegistryName() , 11, 10); + + // regerister + GEM_REGISTRY.put(DIAMOND.getName(), DIAMOND); + GEM_REGISTRY.put(EMERALD.getName(), EMERALD); +// GEM_REGISTRY.put(TOPAZ.getName(), TOPAZ); +// GEM_REGISTRY.put(ONYX.getName(), ONYX); + GEM_REGISTRY.put(RUBY.getName(), RUBY); + GEM_REGISTRY.put(SAPPHIRE.getName(), SAPPHIRE); + GEM_REGISTRY.put(WHITE_PEARL.getName(), WHITE_PEARL); + GEM_REGISTRY.put(BLACK_PEARL.getName(), WHITE_PEARL); } /** @@ -102,14 +176,18 @@ public static ICharm makeHealing(int level) { }) .build(); } - /** - * Accessor wrapper method to return Optional - * @param name - * @return - */ - public static Optional getCharmLevel(ResourceLocation name) { - if (name != null && ITEM_TO_CHARM_LEVELS.containsKey(name)) { - return Optional.of(ITEM_TO_CHARM_LEVELS.get(name)); + public static ICharm makeShielding(int level) { + return new ShieldingCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.percent = level < 4 ? 0.5 : level < 7 ? 0.6 : level < 10 ? 0.7 : 0.8; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + } + + public static Optional getBaseMaterial(ResourceLocation name) { + if (name != null && METAL_REGISTRY.containsKey(name)) { + return Optional.of(METAL_REGISTRY.get(name)); } return Optional.empty(); } @@ -123,4 +201,16 @@ public static Optional getCharmLevel(ResourceLocation name) { public static boolean isCharmEventRegistered(Class event, String type) { return EVENT_CHARM_MAP.containsEntry(event, type); } + + /** + * Accessor wrapper method to return Optional sourceItem + * @param name + * @return + */ + public static Optional getSourceItem(ResourceLocation sourceItem) { + if (sourceItem != null && GEM_REGISTRY.containsKey(sourceItem)) { + return Optional.of(GEM_REGISTRY.get(sourceItem)); + } + return Optional.empty(); + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java index 51a590758..361183cab 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java @@ -1,33 +1,42 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.eventhandler; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; import java.util.Optional; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; -import java.util.function.Predicate; -import java.util.function.Supplier; import com.someguyssoftware.gottschcore.spatial.Coords; import com.someguyssoftware.gottschcore.world.WorldInfo; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; -import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; -import com.someguyssoftware.treasure2.capability.ICharmableCapability; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; -import com.someguyssoftware.treasure2.charm.CharmEntity; +import com.someguyssoftware.treasure2.charm.CharmContext; import com.someguyssoftware.treasure2.charm.ICharm; import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.charm.TreasureCharms; -import com.someguyssoftware.treasure2.item.CoinItem; import com.someguyssoftware.treasure2.item.IWishable; -import com.someguyssoftware.treasure2.item.PearlItem; import com.someguyssoftware.treasure2.network.CharmMessageToClient; import com.someguyssoftware.treasure2.network.TreasureNetworking; @@ -35,25 +44,20 @@ import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.Hand; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.event.ItemAttributeModifierEvent; import net.minecraftforge.event.entity.item.ItemTossEvent; +import net.minecraftforge.event.entity.living.LivingDamageEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.network.PacketDistributor; import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.SlotTypePreset; import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; @@ -64,13 +68,7 @@ @Mod.EventBusSubscriber(modid = Treasure.MODID, bus = EventBusSubscriber.Bus.FORGE) public class PlayerEventHandler { private static final String CURIOS_ID = "curios"; - private static final List curiosSlots = Arrays.asList("necklace", "bracelet", "ring", "charm"); - - /** - * changes to current (1.12.2) methodology - * [x] 1. Register Charm types with Events so only charms related to the event will be processed and can eliminate a instanceof check for every charm. - * [x] 2. Gather all charms to be processed first, filter if appropriate, then sort by priority, then execute them. - */ + private static final List CURIOS_SLOTS = Arrays.asList("necklace", "bracelet", "ring", "charm"); /* * Subscribing to multiple types of Living events for Charm Interactions so that instanceof doesn't have to be called everytime. @@ -94,6 +92,65 @@ public static void checkCharmsInteraction(LivingUpdateEvent event) { processCharms(event, player); } } + + /** + * + * @param event + */ + @SubscribeEvent + public void checkCharmsInteractionWithDamage(LivingDamageEvent event) { + if (WorldInfo.isClientSide(event.getEntity().level)) { + return; + } + + // do something to player every update tick: + if (event.getEntity() instanceof PlayerEntity) { + // get the player + ServerPlayerEntity player = (ServerPlayerEntity) event.getEntity(); + processCharms(event, player); + } + } + + /** + * + * @param event + */ + @SubscribeEvent + public void checkCharmsInteractionWithAttack(LivingHurtEvent event) { + if (WorldInfo.isClientSide(event.getEntity().level)) { + return; + } + + if (event.getSource().getDirectEntity() instanceof PlayerEntity) { + // get the player + ServerPlayerEntity player = (ServerPlayerEntity) event.getSource().getDirectEntity(); + processCharms(event, player); + } + } + +// Maybe use BlockEvent.BreakBlock and then use Global Loot Modifiers?? +// @SubscribeEvent +// public void checkCharmsInteractionWithBlock(BlockEvent.HarvestDropsEvent event) { +// if (WorldInfo.isClientSide(event.getWorld())) { +// return; +// } +// +// if (event.getHarvester() == null) { +// return; +// } +// +// // if the harvested blcok has a tile entity then don't process +// // NOTE this may exclude non-inventory blocks +// IBlockState harvestedState = event.getState(); +// Block harvestedBlock = harvestedState.getBlock(); +// if (harvestedBlock.hasTileEntity(harvestedState)) { +// return; +// } +// +// // get the player +// EntityPlayerMP player = (EntityPlayerMP) event.getHarvester(); +// processCharms(event, player); +// } /** * @@ -106,10 +163,9 @@ private static void processCharms(Event event, ServerPlayerEntity player) { */ List charmsToExecute; - Treasure.LOGGER.debug("processing charms..."); // gather all charms charmsToExecute = gatherCharms(event, player); - Treasure.LOGGER.debug("size of charms to execute -> {}", charmsToExecute.size()); + // TODO filter charms ?? // sort charms @@ -133,18 +189,14 @@ private static List gatherCharms(Event event, ServerPlayerEntity p // check each hand for (Hand hand : Hand.values()) { - Treasure.LOGGER.debug("checking hand -> {}", hand.name()); ItemStack heldStack = player.getItemInHand(hand); heldStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { - Treasure.LOGGER.debug("hand charm has cap!"); for (InventoryType type : InventoryType.values()) { - Treasure.LOGGER.debug("hand charm checking inventory type -> {}", type); AtomicInteger index = new AtomicInteger(); // requires indexed for-loop for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); - Treasure.LOGGER.debug("hand cap got charm entity -> {}", entity.getCharm().getName().toString()); - // cap.getCharmEntities()[type.getValue()].forEach(entity -> { + // OR just check with the charm for allowable event if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); continue; @@ -158,9 +210,7 @@ private static List gatherCharms(Event event, ServerPlayerEntity p $.index = index.get(); $.entity = entity; }).build(); - Treasure.LOGGER.debug("hand charm adding to context"); contexts.add(context); - // }); } } }); @@ -172,20 +222,16 @@ private static List gatherCharms(Event event, ServerPlayerEntity p LazyOptional handler = CuriosApi.getCuriosHelper().getCuriosHandler(player); handler.ifPresent(itemHandler -> { // curios type names -> head, necklace, back, bracelet, hands, ring, belt, charm, feet - curiosSlots.forEach(slot -> { + CURIOS_SLOTS.forEach(slot -> { Optional stacksOptional = itemHandler.getStacksHandler(slot); stacksOptional.ifPresent(stacksHandler -> { ItemStack curiosStack = stacksHandler.getStacks().getStackInSlot(0); - Treasure.LOGGER.debug("curios.charm slot stack -> {}", curiosStack.getDisplayName().getString()); curiosStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { for (InventoryType type : InventoryType.values()) { AtomicInteger index = new AtomicInteger(); // requires indexed for-loop for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); - Treasure.LOGGER.debug("curios cap got charm entity -> {}", entity.getCharm().getName().toString()); - - // cap.getCharmEntities()[type.getValue()].forEach(entity -> { if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); continue; @@ -200,17 +246,15 @@ private static List gatherCharms(Event event, ServerPlayerEntity p $.index = index.get(); $.entity = entity; }).build(); - Treasure.LOGGER.debug("curios charm adding to context"); contexts.add(curiosContext); } - // }); } }); }); }); }); } - else { + else { // TODO check hotbar slots // TODO only allow IAdornments from hotbar } @@ -224,14 +268,12 @@ private static List gatherCharms(Event event, ServerPlayerEntity p * @param contexts */ private static void executeCharms(Event event, ServerPlayerEntity player, List contexts) { - Treasure.LOGGER.debug("executing charms..."); /* * a list of charm types that are non-stackable that should not be executed more than once. */ final List executeOnceCharmTypes = new ArrayList<>(5); contexts.forEach(context -> { - Treasure.LOGGER.debug("....charm -> {}", context.getEntity().getCharm().getName().toString()); ICharm charm = (ICharm)context.getEntity().getCharm(); if (!charm.isEffectStackable()) { // check if this charm type is already in the monitored list @@ -248,17 +290,16 @@ private static void executeCharms(Event event, ServerPlayerEntity player, List {}", message); - // TreasureNetworking.simpleChannel.send(PacketDistributor.PLAYER.with(() -> player), message); + CharmMessageToClient message = new CharmMessageToClient(player.getStringUUID(), context); + TreasureNetworking.simpleChannel.send(PacketDistributor.PLAYER.with(() -> player), message); } // remove if uses are empty and the capability is bindable ie. charm, not adornment // NOTE this leaves empty charms on non-bindables for future recharge - if (context.getEntity().getValue() <= 0.0 && context.capability.isBindable()) { + if (context.getEntity().getValue() <= 0.0 && context.getCapability().isBindable()) { Treasure.LOGGER.debug("charm is empty -> remove"); // locate the charm from context and remove - context.capability.getCharmEntities()[context.type.getValue()].remove(context.getIndex()); + context.getCapability().getCharmEntities()[context.getType().getValue()].remove(context.getIndex()); } }); } @@ -272,14 +313,14 @@ public void onTossCoinEvent(ItemTossEvent event) { if (WorldInfo.isClientSide(event.getPlayer().level)) { return; } - Treasure.LOGGER.debug("is remote? -> {}", !event.getPlayer().level.isClientSide); - Treasure.LOGGER.debug("{} tossing item -> {}", event.getPlayer().getName().getString(), event.getEntityItem().getItem().getDisplayName().getString()); +// Treasure.LOGGER.debug("is remote? -> {}", !event.getPlayer().level.isClientSide); +// Treasure.LOGGER.debug("{} tossing item -> {}", event.getPlayer().getName().getString(), event.getEntityItem().getItem().getDisplayName().getString()); Item item = event.getEntityItem().getItem().getItem(); if (item instanceof IWishable) { ItemStack stack = event.getEntityItem().getItem(); CompoundNBT nbt = new CompoundNBT(); nbt.putString(IWishable.DROPPED_BY_KEY, event.getPlayer().getName().getString()); - Treasure.LOGGER.debug("adding tag to wishable stack..."); +// Treasure.LOGGER.debug("adding tag to wishable stack..."); stack.setTag(nbt); } } @@ -291,101 +332,4 @@ public void onTossCoinEvent(ItemTossEvent event) { // event.getToolTip().add(new TranslationTextComponent("tooltip.label.coin").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); // } // } - - private static class CharmContext { - private Hand hand; - private String slotProviderId; - private String slot; - private ItemStack itemStack; - private ICharmableCapability capability; - private InventoryType type; - private int index; - private ICharmEntity entity; - - /** - * - */ - CharmContext() {} - - CharmContext(Builder builder) { - this.hand = builder.hand; - this.slotProviderId = builder.slotProviderId; - this.slot = builder.slot; - this.itemStack = builder.itemStack; - this.capability = builder.capability; - this.type = builder.type; - this.index = builder.index; - this.entity = builder.entity; - } - - public static Comparator priorityComparator = new Comparator() { - @Override - public int compare(CharmContext p1, CharmContext p2) { - // use p1 < p2 because the sort should be ascending - if (p1.getEntity().getCharm().getPriority() < p2.getEntity().getCharm().getPriority()) { - // greater than - return 1; - } - else { - // less than - return -1; - } - } - }; - - public Hand getHand() { - return hand; - } - - public String getSlotProviderId() { - return slotProviderId; - } - - public String getSlot() { - return slot; - } - - public ItemStack getItemStack() { - return itemStack; - } - - public InventoryType getType() { - return type; - } - - public int getIndex() { - return index; - } - - public ICharmEntity getEntity() { - return entity; - } - - public static class Builder { - public Hand hand; - public String slotProviderId; - public String slot; - public ItemStack itemStack; - public ICharmableCapability capability; - public InventoryType type; - public int index; - public ICharmEntity entity; - - public Builder with(Consumer builder) { - builder.accept(this); - return this; - } - - public CharmContext build() { - return new CharmContext(this); - } - } - - @Override - public String toString() { - return "CharmContext [hand=" + hand + ", slotProviderId=" + slotProviderId + ", slot=" + slot - + ", itemStack=" + itemStack == null ? "N/A" : itemStack.getDisplayName().getString() - + "type=" + type + "]"; - } - } } diff --git a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java index 42ab7e88e..e7451474a 100644 --- a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java +++ b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java @@ -25,6 +25,7 @@ import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapability; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.CharmableMaterial; import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.data.TreasureData; import com.someguyssoftware.treasure2.item.TreasureItems; @@ -32,6 +33,7 @@ import com.someguyssoftware.treasure2.registry.TreasureDecayRegistry; import com.someguyssoftware.treasure2.registry.TreasureMetaRegistry; import com.someguyssoftware.treasure2.registry.TreasureTemplateRegistry; +import com.someguyssoftware.treasure2.util.ModUtils; import net.minecraft.item.ItemModelsProperties; import net.minecraft.util.ResourceLocation; @@ -52,31 +54,48 @@ public static void common(final FMLCommonSetupEvent event) { Treasure.LOGGER.debug("registering in TreasureSetup"); // add mod specific logging IModSetup.addRollingFileAppender(Treasure.instance.getName(), null); - + // register capabilities TreasureCapabilities.register(); // initialize all the data lists, maps, etc TreasureData.initialize(); - + // start the treasure registries TreasureLootTableRegistry.create(Treasure.instance); TreasureMetaRegistry.create(Treasure.instance); TreasureTemplateRegistry.create(Treasure.instance); TreasureDecayRegistry.create(Treasure.instance); } - + public static void clientSetup(final FMLClientSetupEvent event) { + Treasure.LOGGER.debug("setting up item properties dynamically..."); event.enqueueWork(() -> { - ItemModelsProperties.register(TreasureItems.CHARM, - new ResourceLocation(Treasure.MODID, "model"), (stack, world, living) -> { - AtomicDouble d = new AtomicDouble(0); - stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { - Optional level = TreasureCharms.getCharmLevel(cap.getSourceItem()); - d.set(cap.getBaseMaterial().getMaxCharmLevel() + (level.isPresent() ? level.get() : 0)) ; - }); - return d.floatValue(); - }); - }); + ItemModelsProperties.register(TreasureItems.COPPER_CHARM, + new ResourceLocation(Treasure.MODID, "gem"), (stack, world, living) -> { + AtomicDouble d = new AtomicDouble(0); + stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + Optional source = TreasureCharms.getSourceItem(cap.getSourceItem()); + if (source.isPresent()) { + d.set(source.get().getId()); + } + }); + return d.floatValue(); + }); + ItemModelsProperties.register(TreasureItems.TEST_CHARM, + new ResourceLocation(Treasure.MODID, "gem"), (stack, world, living) -> { + AtomicDouble d = new AtomicDouble(0); + stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + Optional source = TreasureCharms.getSourceItem(cap.getSourceItem()); + if (source.isPresent()) { + d.set(source.get().getMaxLevel()); + } + else { + d.set(6); + } + }); + return d.floatValue(); + }); + }); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java index 45eecb71b..7666c968a 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java @@ -22,6 +22,7 @@ import java.util.List; import com.someguyssoftware.gottschcore.item.ModItem; +import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; import com.someguyssoftware.treasure2.capability.ICharmableCapability; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; @@ -75,6 +76,7 @@ public CharmItem(String modID, String name, Properties properties) { @Override public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { // TODO create new CharmItemCapProvider which includes POUCHABLE cap (not everything that is charmable is pouchable) + Treasure.LOGGER.debug("{} item initiating caps", stack.getItem().getRegistryName().toString()); CharmableCapabilityProvider provider = new CharmableCapabilityProvider(); return provider; } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItemTier.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItemTier.java index 64c1d17e1..47dd7921b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItemTier.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItemTier.java @@ -21,7 +21,7 @@ public enum TreasureItemTier implements IItemTier { private final int level; private final int uses; - private final float spped; + private final float speed; private final float attackDamageBonus; private final int enchantmentValue; private final LazyValue repairIngredient; @@ -29,7 +29,7 @@ public enum TreasureItemTier implements IItemTier { private TreasureItemTier(int harvestLevelIn, int maxUsesIn, float speedIn, float attackDamageBonusIn, int enchantmentValueIn, Supplier repairIngredientIn) { this.level = harvestLevelIn; this.uses = maxUsesIn; - this.spped = speedIn; + this.speed = speedIn; this.attackDamageBonus = attackDamageBonusIn; this.enchantmentValue = enchantmentValueIn; this.repairIngredient = new LazyValue<>(repairIngredientIn); @@ -42,7 +42,7 @@ public int getUses() { @Override public float getSpeed() { - return spped; + return speed; } @Override diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index 5f49fe630..798f1a215 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -31,21 +31,18 @@ import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.block.TreasureBlocks; import com.someguyssoftware.treasure2.capability.CharmableCapability; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; import com.someguyssoftware.treasure2.capability.ICharmableCapability; -import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.BaseMaterial; import com.someguyssoftware.treasure2.charm.TreasureCharms; -import com.someguyssoftware.treasure2.capability.CharmableCapability.BaseMaterial; -import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.config.TreasureConfig; import com.someguyssoftware.treasure2.config.TreasureConfig.KeyID; import com.someguyssoftware.treasure2.config.TreasureConfig.LockID; import com.someguyssoftware.treasure2.enums.Category; -import com.someguyssoftware.treasure2.enums.Coins; -import com.someguyssoftware.treasure2.enums.Pearls; import com.someguyssoftware.treasure2.enums.Rarity; -import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; import com.someguyssoftware.treasure2.loot.TreasureLootTableMaster2.SpecialLootTables; +import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.BlockColors; @@ -136,9 +133,9 @@ public class TreasureItems { public static Item BLACK_PEARL; // charms - public static CharmItem CHARM; - public static CharmItem SAPPHIRE_CHARM; - // public static CoinItem TEST_COIN; + public static CharmItem COPPER_CHARM; + public static CharmItem SILVER_CHARM; + public static CharmItem GOLD_CHARM; public static CharmItem TEST_CHARM; // wither items @@ -422,44 +419,53 @@ public ItemStack getDefaultLootKey (Random random) { }; // CHARMS - CHARM = new CharmItem(Treasure.MODID, "charm", new Item.Properties()) { + COPPER_CHARM = new CharmItem(Treasure.MODID, "copper_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { + $.finite(true, 1); + $.bindable(true); $.source(true) - .baseMaterial(BaseMaterial.COPPER); + .baseMaterial(TreasureCharms.COPPER.getName()); }).build(); return new CharmableCapabilityProvider(cap); } }; - - // TODO create a Builder for Charms - TEST_CHARM = new CharmItem(Treasure.MODID, "test_charm", new Item.Properties()) { + SILVER_CHARM = new CharmItem(Treasure.MODID, "silver_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { - ICharmableCapability cap = new CharmableCapability.Builder(SAPPHIRE.getRegistryName()).with($ -> { + ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { $.finite(true, 1); - $.source(true); $.bindable(true); + $.source(true) + .baseMaterial(TreasureCharms.SILVER.getName()); + }).build(); + return new CharmableCapabilityProvider(cap); + } + }; + GOLD_CHARM = new CharmItem(Treasure.MODID, "gold_charm", new Item.Properties()) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { + $.finite(true, 1); + $.bindable(true); + $.source(true) + .baseMaterial(TreasureCharms.GOLD.getName()); }).build(); - - // add charms - cap.add(InventoryType.FINITE, TreasureCharms.HEALING_1.createEntity()); - stack.setHoverName(new StringTextComponent("Sal'andaar Stone's Brain")); return new CharmableCapabilityProvider(cap); } }; - SAPPHIRE_CHARM = new CharmItem(Treasure.MODID, "sapphire_charm", new Item.Properties()) { + // TODO create a Builder for Charms + TEST_CHARM = new CharmItem(Treasure.MODID, "test_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(SAPPHIRE.getRegistryName()).with($ -> { - $.finite(true, 1) - .bindable(true) - .source(true) - .baseMaterial(BaseMaterial.GOLD); + $.finite(true, 1); + $.bindable(true); + $.source(true); + $.baseMaterial(TreasureCharms.COPPER.getName()); }).build(); // add charms - cap.add(InventoryType.FINITE, TreasureCharms.HEALING_15.createEntity()); - stack.setHoverName(new StringTextComponent("Bindable Sapphire Charm")); + cap.add(InventoryType.FINITE, TreasureCharms.HEALING_6.createEntity()); + stack.setHoverName(new StringTextComponent("Test Charm")); return new CharmableCapabilityProvider(cap); } }; @@ -516,9 +522,9 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { COPPER_COIN, SILVER_COIN, GOLD_COIN, - CHARM, - SAPPHIRE_CHARM, - // TEST_COIN, + COPPER_CHARM, + SILVER_CHARM, + GOLD_CHARM, TEST_CHARM, RUBY, SAPPHIRE, diff --git a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java index 5c08b335f..de8204eac 100644 --- a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java +++ b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java @@ -19,6 +19,7 @@ */ package com.someguyssoftware.treasure2.network; +import java.util.List; import java.util.Optional; import java.util.UUID; import java.util.function.Supplier; @@ -34,9 +35,13 @@ import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.LogicalSidedProvider; import net.minecraftforge.fml.network.NetworkEvent; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler; +import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; /** * @@ -44,6 +49,8 @@ * */ public class CharmMessageHandlerOnClient { + private static final String CURIOS_ID = "curios"; + public static boolean isThisProtocolAcceptedByClient(String protocolVersion) { return TreasureNetworking.MESSAGE_PROTOCOL_VERSION.equals(protocolVersion); } @@ -91,12 +98,30 @@ private static void processMessage(ClientWorld worldClient, CharmMessageToClient // determine what is being held in hand if (heldItemStack != null) { Treasure.LOGGER.debug("holding item -> {}", heldItemStack.getItem().getRegistryName()); - ICharmableCapability cap = heldItemStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).orElse(null); - if (cap != null) { - updateCharms(heldItemStack, message, cap); - } +// ICharmableCapability cap = heldItemStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).orElse(null); +// if (cap != null) { +// updateCharms(heldItemStack, message, cap); +// } + heldItemStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + updateCharms(message, cap); + }); } } + else if (CURIOS_ID.equals(message.getSlotProviderId())) { + LazyOptional handler = CuriosApi.getCuriosHelper().getCuriosHandler(player); + handler.ifPresent(itemHandler -> { + Optional stacksOptional = itemHandler.getStacksHandler(message.getSlot()); + stacksOptional.ifPresent(stacksHandler -> { + ItemStack curiosStack = stacksHandler.getStacks().getStackInSlot(0); + curiosStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + updateCharms(message, cap); + }); + }); + }); + } + else { + // TODO do the hotbar + } } } @@ -105,22 +130,26 @@ private static void processMessage(ClientWorld worldClient, CharmMessageToClient } } - private static void updateCharms(ItemStack heldItemStack, CharmMessageToClient message, ICharmableCapability capability) { + private static void updateCharms(CharmMessageToClient message, ICharmableCapability capability) { // get the charm that is being sent // String charmName = message.getCharmName(); ResourceLocation charmName = new ResourceLocation(message.getCharmName()); // cycle through the charm states to find the named charm - for(ICharmEntity entity : capability.getCharmEntities()[InventoryType.FINITE.getValue()]) { - if (entity.getCharm().getName().equals(charmName)) { + List entityList = capability.getCharmEntities()[message.getInventoryType().getValue()]; + if (entityList != null && !entityList.isEmpty() && entityList.size() > message.getIndex()) { + ICharmEntity entity = entityList.get(message.getIndex()); +// for(ICharmEntity entity : capability.getCharmEntities()[message.getInventoryType().getValue()]) { + if (entity != null && entity.getCharm().getName().equals(charmName)) { Treasure.LOGGER.debug("found charm, updating..."); // update vitals entity.update(message.getEntity()); if (entity.getValue() <= 0.0) { - // TODO should each charm have it's own way of checking empty? - capability.getCharmEntities()[InventoryType.FINITE.getValue()].remove(entity); + // TODO should each charm have it's own way of checking empty? (instead of getValue() < 0.0) + capability.getCharmEntities()[message.getInventoryType().getValue()].remove(entity); } - break; +// break; } } +// } } } diff --git a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java index f1160415c..8b54584a9 100644 --- a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java +++ b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageToClient.java @@ -19,10 +19,12 @@ */ package com.someguyssoftware.treasure2.network; +import java.util.Objects; import java.util.Optional; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.CharmContext; import com.someguyssoftware.treasure2.charm.CharmEntity; import com.someguyssoftware.treasure2.charm.ICharm; import com.someguyssoftware.treasure2.charm.ICharmEntity; @@ -38,27 +40,29 @@ */ public class CharmMessageToClient { private boolean valid; - private String playerName; - private String charmName; - private ICharmEntity entity; - private Hand hand; - private String slot; - private String slotProviderId; - private InventoryType inventoryType; + private String playerName; //1 + private String charmName; //2 + private ICharmEntity entity; //3 + private Hand hand; //4 + private String slot; //5 + private String slotProviderId; //6 + private InventoryType inventoryType; //7 + private int index; //8 /** * * @param playerName */ - public CharmMessageToClient(String playerName, ICharmEntity instance, Hand hand, String slot, String slotProviderId, InventoryType inventoryType) { + public CharmMessageToClient(String playerName, CharmContext context) { valid = true; this.playerName = playerName; - this.charmName = instance.getCharm().getName().toString(); - this.entity = instance; - this.hand = hand; - this.slot = slot; - this.slotProviderId = slotProviderId; - this.inventoryType = inventoryType; + this.entity = context.getEntity(); + this.charmName = context.getEntity().getCharm().getName().toString(); + this.hand = context.getHand(); + this.slotProviderId = context.getSlotProviderId(); + this.slot = Objects.toString(context.getSlot(), ""); + this.inventoryType = context.getType(); + this.index = context.getIndex(); } /** @@ -101,6 +105,7 @@ public static CharmMessageToClient decode(PacketBuffer buf) { if (!inventoryType.isEmpty()) { message.setInventoryType(InventoryType.valueOf(inventoryType.toUpperCase())); } + message.setIndex(buf.readInt()); } catch(Exception e) { Treasure.LOGGER.error("An error occurred attempting to read message: ", e); @@ -128,13 +133,16 @@ public void encode(PacketBuffer buf) { handAsString = hand.name(); } buf.writeUtf(handAsString); - buf.writeUtf(slot); - buf.writeUtf(slotProviderId); - buf.writeUtf(inventoryType.name().toLowerCase()); + buf.writeUtf(Objects.toString(slot, "")); + buf.writeUtf(Objects.toString(slotProviderId, "")); + String typeAsString = ""; + if (inventoryType != null) { + typeAsString = inventoryType.name().toLowerCase(); + } + buf.writeUtf(typeAsString); + buf.writeInt(index); } - - public boolean isValid() { return valid; } @@ -197,4 +205,19 @@ public InventoryType getInventoryType() { public void setInventoryType(InventoryType inventoryType) { this.inventoryType = inventoryType; } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + @Override + public String toString() { + return "CharmMessageToClient [valid=" + valid + ", playerName=" + playerName + ", charmName=" + charmName + + ", entity=" + entity + ", hand=" + hand + ", slot=" + slot + ", slotProviderId=" + slotProviderId + + ", inventoryType=" + inventoryType + ", index=" + index + "]"; + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/network/TreasureNetworking.java b/src/main/java/com/someguyssoftware/treasure2/network/TreasureNetworking.java index c30b6e1ce..d054749ba 100644 --- a/src/main/java/com/someguyssoftware/treasure2/network/TreasureNetworking.java +++ b/src/main/java/com/someguyssoftware/treasure2/network/TreasureNetworking.java @@ -3,7 +3,7 @@ */ package com.someguyssoftware.treasure2.network; -import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_SERVER; +import static net.minecraftforge.fml.network.NetworkDirection.*; import java.util.Optional; @@ -21,6 +21,7 @@ public class TreasureNetworking { public static final String MESSAGE_PROTOCOL_VERSION = "1.0"; public static final int POISON_MIST_MESSAGE_ID = 14; public static final int WITHER_MIST_MESSAGE_ID = 15; + public static final int CHARM_MESSAGE_ID = 16; public static final ResourceLocation CHANNEL_NAME = new ResourceLocation(Treasure.MODID, "treasure_channel"); @@ -46,6 +47,11 @@ public static void common(final FMLCommonSetupEvent event) { WitherMistMessageToServer::encode, WitherMistMessageToServer::decode, WitherMistMessageHandlerOnServer::onMessageReceived, Optional.of(PLAY_TO_SERVER)); + + simpleChannel.registerMessage(CHARM_MESSAGE_ID, CharmMessageToClient.class, + CharmMessageToClient::encode, CharmMessageToClient::decode, + CharmMessageHandlerOnClient::onMessageReceived, + Optional.of(PLAY_TO_CLIENT)); } /** diff --git a/src/main/resources/assets/treasure2/lang/en_us.json b/src/main/resources/assets/treasure2/lang/en_us.json index 0241aaef3..6593772f4 100644 --- a/src/main/resources/assets/treasure2/lang/en_us.json +++ b/src/main/resources/assets/treasure2/lang/en_us.json @@ -41,11 +41,9 @@ "item.treasure2.sapphire": "Sapphire", "item.treasure2.white_pearl": "White Pearl", "item.treasure2.black_pearl": "Black Pearl", - "item.treasure2.copper_coin_charm": "Copper Coin Charm", - "item.treasure2.silver_coin_charm": "Silver Coin Charm", - "item.treasure2.gold_coin_charm": "Gold Coin Charm", - "item.treasure2.ruby_charm": "Ruby Charm", - "item.treasure2.sapphire_charm": "Sapphire Charm", + "item.treasure2.copper_charm": "Copper Charm", + "item.treasure2.silver_charm": "Silver Charm", + "item.treasure2.gold_charm": "Gold Charm", "item.treasure2.wither_stick_item":"Wither Branch", "item.treasure2.wither_root_item":"Wither Root", diff --git a/src/main/resources/assets/treasure2/models/item/charm.json b/src/main/resources/assets/treasure2/models/item/charm.json index 7a1de1e2e..b456c553a 100644 --- a/src/main/resources/assets/treasure2/models/item/charm.json +++ b/src/main/resources/assets/treasure2/models/item/charm.json @@ -8,9 +8,30 @@ { "__comment": "copper charm", "predicate": { - "model": 1 + "model": 2 }, "model": "item/charm/charm_model_copper" - } + }, + { + "__comment": "silver charm", + "predicate": { + "model": 3 + }, + "model": "item/charm/charm_model_silver" + }, + { + "__comment": "gold charm", + "predicate": { + "model": 4 + }, + "model": "item/charm/charm_model_gold" + }, + { + "__comment": "copper topaz charm", + "predicate": { + "model": 3 + }, + "model": "item/charm/charm_model_copper_topaz" + } ] } \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charm_model_copper.json b/src/main/resources/assets/treasure2/models/item/charm_model_copper.json deleted file mode 100644 index 9b8505868..000000000 --- a/src/main/resources/assets/treasure2/models/item/charm_model_copper.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "treasure2:item/charm/copper_charm" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charm_model_silver.json b/src/main/resources/assets/treasure2/models/item/charm_model_silver.json deleted file mode 100644 index ca8c0ca7c..000000000 --- a/src/main/resources/assets/treasure2/models/item/charm_model_silver.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "treasure2:item/charm/silver_charm" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm.json b/src/main/resources/assets/treasure2/models/item/copper_charm.json new file mode 100644 index 000000000..6173b9dcc --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm.json @@ -0,0 +1,65 @@ +{ + "parent": "item/generated", + "textures": { + "__comment": "default", + "layer0": "treasure2:item/charm/copper_charm" + }, + "overrides": [ + { + "__comment": "topaz", + "predicate": { + "treasure:gem": 1 + }, + "model": "treasure2:item/copper_charm_topaz" + }, + { + "__comment": "diamond", + "predicate": { + "treasure:gem": 2 + }, + "model": "treasure2:item/copper_charm_diamond" + }, + { + "__comment": "onyx", + "predicate": { + "treasure:gem": 3 + }, + "model": "treasure2:item/copper_charm_onyx" + }, + { + "__comment": "emerald", + "predicate": { + "treasure:gem": 4 + }, + "model": "treasure2:item/copper_charm_emerald" + }, + { + "__comment": "ruby", + "predicate": { + "treasure:gem": 5 + }, + "model": "treasure2:item/copper_charm_ruby" + }, + { + "__comment": "sapphire", + "predicate": { + "treasure:gem": 6 + }, + "model": "treasure2:item/copper_charm_sapphire" + }, + { + "__comment": "white pearl", + "predicate": { + "treasure:gem": 7 + }, + "model": "treasure2:item/copper_charm_white_pearl" + }, + { + "__comment": "black pearl", + "predicate": { + "treasure:gem": 8 + }, + "model": "treasure2:item/copper_charm_black_pearl" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_black_pearl.json b/src/main/resources/assets/treasure2/models/item/copper_charm_black_pearl.json new file mode 100644 index 000000000..5296443ea --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_black_pearl.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_black_pearl_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_diamond.json b/src/main/resources/assets/treasure2/models/item/copper_charm_diamond.json new file mode 100644 index 000000000..2d01cefef --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_diamond.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_diamond_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_emerald.json b/src/main/resources/assets/treasure2/models/item/copper_charm_emerald.json new file mode 100644 index 000000000..f591a0246 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_emerald.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_emerald_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_onyx.json b/src/main/resources/assets/treasure2/models/item/copper_charm_onyx.json new file mode 100644 index 000000000..64489871c --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_onyx.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_onyx_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_ruby.json b/src/main/resources/assets/treasure2/models/item/copper_charm_ruby.json new file mode 100644 index 000000000..573f6c767 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_ruby.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_ruby_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_sapphire.json b/src/main/resources/assets/treasure2/models/item/copper_charm_sapphire.json new file mode 100644 index 000000000..13d050973 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_sapphire.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_sapphire_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_topaz.json b/src/main/resources/assets/treasure2/models/item/copper_charm_topaz.json new file mode 100644 index 000000000..e41900565 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_topaz.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_topaz_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm_white_pearl.json b/src/main/resources/assets/treasure2/models/item/copper_charm_white_pearl.json new file mode 100644 index 000000000..17cecaa04 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/copper_charm_white_pearl.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/copper_white_pearl_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/test_charm.json b/src/main/resources/assets/treasure2/models/item/test_charm.json index a208a354a..8d7c25125 100644 --- a/src/main/resources/assets/treasure2/models/item/test_charm.json +++ b/src/main/resources/assets/treasure2/models/item/test_charm.json @@ -1,6 +1,30 @@ { - "parent": "item/generated", - "textures": { - "layer0": "treasure2:item/sapphire_charm" - } + "parent": "item/generated", + "textures": { + "__comment": "default", + "layer0": "treasure2:item/charm/copper_charm" + }, + "overrides": [ + { + "__comment": "topaz", + "predicate": { + "treasure2:gem": 1 + }, + "model": "treasure2:item/copper_charm_gem_topaz" + }, + { + "__comment": "ruby", + "predicate": { + "treasure2:gem": 5 + }, + "model": "treasure2:item/copper_charm_gem_ruby" + }, + { + "__comment": "sapphire", + "predicate": { + "treasure2:gem": 6 + }, + "model": "treasure2:item/copper_charm_gem_sapphire" + } + ] } \ No newline at end of file diff --git a/src/main/resources/data/curios/tags/items/bracelet.json b/src/main/resources/data/curios/tags/items/bracelet.json index 96191a5a1..dc133efca 100644 --- a/src/main/resources/data/curios/tags/items/bracelet.json +++ b/src/main/resources/data/curios/tags/items/bracelet.json @@ -1,7 +1,7 @@ { "replace": false, "values": [ - "treasure2:sapphire_charm", - "treasure2:charm" + "treasure2:copper_charm", + "treasure2:silver_charm" ] } diff --git a/src/main/resources/data/curios/tags/items/charm.json b/src/main/resources/data/curios/tags/items/charm.json index 41a1533dd..a1fc6cfec 100644 --- a/src/main/resources/data/curios/tags/items/charm.json +++ b/src/main/resources/data/curios/tags/items/charm.json @@ -1,6 +1,11 @@ { "replace": false, "values": [ - "treasure2:charm" + "treasure2:test_charm", + "treasure2:copper_charm", + "treasure2:silver_charm", + "treasure2:gold_charm", + "treasure2:silver_coin", + "treasure2:gold_coin" ] } diff --git a/src/main/resources/data/curios/tags/items/necklace.json b/src/main/resources/data/curios/tags/items/necklace.json index 41a1533dd..8ca504c3e 100644 --- a/src/main/resources/data/curios/tags/items/necklace.json +++ b/src/main/resources/data/curios/tags/items/necklace.json @@ -1,6 +1,6 @@ { "replace": false, "values": [ - "treasure2:charm" + "treasure2:copper_charm" ] } diff --git a/src/main/resources/data/curios/tags/items/ring.json b/src/main/resources/data/curios/tags/items/ring.json index 96191a5a1..9fc7842d8 100644 --- a/src/main/resources/data/curios/tags/items/ring.json +++ b/src/main/resources/data/curios/tags/items/ring.json @@ -1,7 +1,6 @@ { "replace": false, "values": [ - "treasure2:sapphire_charm", - "treasure2:charm" + "treasure2:gold_key" ] } From 71a8bf12de2f52c8025ab5cc1578fcb231c14f05 Mon Sep 17 00:00:00 2001 From: gottsch <17928819+gottsch@users.noreply.github.com> Date: Fri, 20 Aug 2021 15:47:58 -0400 Subject: [PATCH 14/19] Add files via upload --- .../textures/item/coins/copper_coin.png | Bin 0 -> 1511 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png diff --git a/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png new file mode 100644 index 0000000000000000000000000000000000000000..c8373aa40223ee2644eafcd3335704bf768d5eca GIT binary patch literal 1511 zcmV zaB^>EX>4U6ba`-PAZ2)IW&i+q+O=0%mgFc5{O1&N1WRHO$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z`(#T|Hv^EJ~j)m8h}k9F4r+pnvlpc;M12cs0MT&y~()e z(s>3ANm+uLkz)WO4E9_)kCGP90}rMdXI?-~jp%`ftQl)kCO0!t3;@fwYY1?PQ;`4w N002ovPDHLkV1hkF+Iau~ literal 0 HcmV?d00001 From 7c4cada7c491d7fda80bc8a68580f1f750b04a81 Mon Sep 17 00:00:00 2001 From: gottsch Date: Wed, 25 Aug 2021 08:18:27 -0400 Subject: [PATCH 15/19] charms dev --- .classpath | 2 +- .../capability/CharmableCapability.java | 50 +- .../CharmableCapabilityStorage.java | 49 +- .../capability/ICharmableCapability.java | 11 +- .../treasure2/charm/AegisCharm.java | 70 +++ .../treasure2/charm/Charm.java | 23 +- .../treasure2/charm/DecayCurse.java | 98 ++++ .../treasure2/charm/DecrepitCurse.java | 84 +++ .../treasure2/charm/DirtFillCurse.java | 131 +++++ .../treasure2/charm/DirtWalkCurse.java | 115 ++++ .../treasure2/charm/DrainCharm.java | 110 ++++ .../treasure2/charm/FireImmunityCharm.java | 89 +++ .../treasure2/charm/FireResistenceCharm.java | 95 +++ .../treasure2/charm/GreaterHealingCharm.java | 89 +++ .../treasure2/charm/HealingCharm.java | 12 +- .../treasure2/charm/ICharm.java | 7 +- .../treasure2/charm/ICharmEntity.java | 36 +- .../treasure2/charm/IDecay.java | 29 + .../treasure2/charm/ILifeStrike.java | 29 + .../treasure2/charm/IlluminationCharm.java | 164 ++++++ .../charm/IlluminationCharmEntity.java | 118 ++++ .../treasure2/charm/LifeStrikeCharm.java | 116 ++++ .../treasure2/charm/ReflectionCharm.java | 121 ++++ .../treasure2/charm/RuinCurse.java | 134 +++++ .../treasure2/charm/SatietyCharm.java | 101 ++++ .../treasure2/charm/ShieldingCharm.java | 10 +- .../charm/TreasureCharmRegistry.java | 117 ++-- .../treasure2/charm/TreasureCharms.java | 395 +++++++++++-- .../treasure2/command/CharmItemArgument.java | 16 + .../treasure2/command/SpawnCharmCommand.java | 107 ++++ .../treasure2/command/TreasureCommands.java | 1 + .../treasure2/config/TreasureConfig.java | 9 +- .../eventhandler/PlayerEventHandler.java | 3 +- .../treasure2/init/TreasureSetup.java | 4 + .../treasure2/item/TreasureItems.java | 49 +- .../treasure2/loot/TreasureLootFunctions.java | 53 ++ .../loot/TreasureLootTableMaster2.java | 551 ++++++++++-------- .../loot/TreasureLootTableRegistry.java | 9 +- .../loot/function/CharmRandomly.java | 264 +++++++++ .../world/gen/feature/GemOreFeature.java | 22 +- .../treasure2/blockstates/onyx_ore.json | 5 + .../treasure2/blockstates/topaz_ore.json | 5 + .../assets/treasure2/lang/en_us.json | 8 +- .../treasure2/models/item/imbued_book.json | 6 + .../treasure2/textures/blocks/onyx_nugget.png | Bin 0 -> 5918 bytes .../{item => blocks}/topaz_nugget.png | Bin .../textures/item/coins/charmed_gold_coin.png | Bin 560 -> 0 bytes .../item/coins/charmed_silver_coin.png | Bin 642 -> 0 bytes .../textures/item/coins/gold_coin.png | Bin 314 -> 1520 bytes .../textures/item/coins/gold_coin2.png | Bin 1520 -> 0 bytes .../textures/item/coins/silver_coin.png | Bin 268 -> 1280 bytes .../textures/item/coins/silver_coin2.png | Bin 1280 -> 0 bytes .../assets/treasure2/textures/item/onyx.png | Bin 0 -> 2078 bytes .../loot_tables/blocks/onyx_ore.json | 19 + .../loot_tables/blocks/topaz_ore.json | 19 + .../chests/common/general_chest.json | 13 +- .../chests/special/crystal_skull_chest.json | 6 +- .../chests/uncommon/general_chest.json | 126 ++-- .../pools/treasure/common_charms.json | 29 + .../pools/treasure/uncommon_charms.json | 65 +++ .../treasure2/pools/treasure/common.json | 42 +- .../treasure2/pools/treasure/epic.json | 22 +- .../treasure2/pools/treasure/rare.json | 27 +- .../treasure2/pools/treasure/scarce.json | 61 +- .../treasure2/pools/treasure/uncommon.json | 38 +- 65 files changed, 3422 insertions(+), 562 deletions(-) create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/DirtFillCurse.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/DirtWalkCurse.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/IDecay.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/ILifeStrike.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharmEntity.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/command/CharmItemArgument.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/command/SpawnCharmCommand.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootFunctions.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java create mode 100644 src/main/resources/assets/treasure2/blockstates/onyx_ore.json create mode 100644 src/main/resources/assets/treasure2/blockstates/topaz_ore.json create mode 100644 src/main/resources/assets/treasure2/models/item/imbued_book.json create mode 100644 src/main/resources/assets/treasure2/textures/blocks/onyx_nugget.png rename src/main/resources/assets/treasure2/textures/{item => blocks}/topaz_nugget.png (100%) delete mode 100644 src/main/resources/assets/treasure2/textures/item/coins/charmed_gold_coin.png delete mode 100644 src/main/resources/assets/treasure2/textures/item/coins/charmed_silver_coin.png delete mode 100644 src/main/resources/assets/treasure2/textures/item/coins/gold_coin2.png delete mode 100644 src/main/resources/assets/treasure2/textures/item/coins/silver_coin2.png create mode 100644 src/main/resources/assets/treasure2/textures/item/onyx.png create mode 100644 src/main/resources/data/treasure2/loot_tables/blocks/onyx_ore.json create mode 100644 src/main/resources/data/treasure2/loot_tables/blocks/topaz_ore.json create mode 100644 src/main/resources/data/treasure2/loot_tables/pools/treasure/common_charms.json create mode 100644 src/main/resources/data/treasure2/loot_tables/pools/treasure/uncommon_charms.json diff --git a/.classpath b/.classpath index ef1991dfe..f170b8c90 100644 --- a/.classpath +++ b/.classpath @@ -4,7 +4,7 @@ - + diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java index 5217cd347..1f66b9eca 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java @@ -44,8 +44,8 @@ /** * The CharmableCapability provides any item with a Charm Inventory, which is a datatype of Map, List>. - * The Charm Inventory can support three types: FINITE, IMBUE or SOCKET. - * FINITE - Charms that are added on Item spawn and can not be renewed. Once expired, the charm is removed and the space is decremented. + * The Charm Inventory can support three types: INNATE, IMBUE or SOCKET. + * INNATE - Charms that are added on Item spawn and can not be renewed. Once expired, the charm is removed and the space is decremented. * IMBUE - Charms that can be added via Books, or any IMBUING item. * SOCKET - Charms that can be added to sockets via Coins or Gems, or any BINDING item. * @author Mark Gottschling on Apr 27, 2020 @@ -69,8 +69,8 @@ public class CharmableCapability implements ICharmableCapability { private boolean imbuing; // can this item be imbued private boolean imbuable; - // does this item have "built-in" finite charms - private boolean finite; + // does this item have "built-in" innate charms + private boolean innate; // the base material this item is made of private ResourceLocation baseMaterial; @@ -86,7 +86,7 @@ public class CharmableCapability implements ICharmableCapability { */ private int maxSocketsSize; private int maxImbueSize; - private int maxFiniteSize; + private int maxInnateSize; /** @@ -104,8 +104,8 @@ public CharmableCapability(Builder builder) { this(); this.source = builder.source; this.bindable = builder.bindable; - this.finite = builder.finite; - this.maxFiniteSize = finite ? Math.max(1, builder.maxFiniteSize) : 0; + this.innate = builder.innate; + this.maxInnateSize = innate ? Math.max(1, builder.maxInnateSize) : 0; this.imbuable = builder.imbuable; this.maxImbueSize = imbuable ? Math.max(1, builder.maxImbueSize) : 0; this.socketable = builder.socketable; @@ -118,7 +118,7 @@ public CharmableCapability(Builder builder) { * */ protected void init() { - charmEntities[InventoryType.FINITE.value] = new ArrayList<>(1); + charmEntities[InventoryType.INNATE.value] = new ArrayList<>(1); charmEntities[InventoryType.IMBUE.value] = new ArrayList<>(1); charmEntities[InventoryType.SOCKET.value] = new ArrayList<>(1); } @@ -147,7 +147,7 @@ public void add(InventoryType type, ICharmEntity entity) { */ public int getMaxSize(InventoryType type) { // check against SOCKET first as this will be the most common - return (type == InventoryType.SOCKET ? getMaxSocketsSize() : type == InventoryType.IMBUE ? getMaxImbueSize() : getMaxFiniteSize()); + return (type == InventoryType.SOCKET ? getMaxSocketsSize() : type == InventoryType.IMBUE ? getMaxImbueSize() : getMaxInnateSize()); } @Override @@ -170,7 +170,7 @@ public void appendHoverText(ItemStack stack, World world, List t tooltip.add(new TranslationTextComponent("tooltip.label.charms").withStyle(TextFormatting.YELLOW, TextFormatting.BOLD)); // create header text for inventory type - appendHoverText(stack, world, tooltip, flag, InventoryType.FINITE, false); + appendHoverText(stack, world, tooltip, flag, InventoryType.INNATE, false); appendHoverText(stack, world, tooltip, flag, InventoryType.IMBUE, true); appendHoverText(stack, world, tooltip, flag, InventoryType.SOCKET, true); } @@ -291,18 +291,18 @@ public void setImbuable(boolean imbuable) { } @Override - public boolean isFinite() { - return finite; + public boolean isInnate() { + return innate; } @Override - public void setFinite(boolean finite) { - this.finite = finite; + public void setInnate(boolean innate) { + this.innate = innate; } @Override - public int getMaxFiniteSize() { - return maxFiniteSize; + public int getMaxInnateSize() { + return maxInnateSize; } @Override @@ -326,8 +326,8 @@ public void setMaxImbueSize(int maxImbueSize) { } @Override - public void setMaxFiniteSize(int maxFiniteSize) { - this.maxFiniteSize = maxFiniteSize; + public void setMaxInnateSize(int maxInnateSize) { + this.maxInnateSize = maxInnateSize; } @Override @@ -346,7 +346,7 @@ public void setBaseMaterial(ResourceLocation baseMaterial) { * */ public enum InventoryType { - FINITE(0), + INNATE(0), IMBUE(1), SOCKET(2); @@ -389,7 +389,7 @@ public static class Builder { public boolean socketable; public boolean imbuing; public boolean imbuable; - public boolean finite; + public boolean innate; public ResourceLocation baseMaterial = TreasureCharms.COPPER.getName(); @@ -398,7 +398,7 @@ public static class Builder { public int maxSocketsSize; public int maxImbueSize; - public int maxFiniteSize; + public int maxInnateSize; // required to pass the source Item here public Builder(ResourceLocation sourceItem) { @@ -426,9 +426,9 @@ public Builder socketable(boolean socketable, int size) { return this; } - public Builder finite(boolean finite, int size) { - this.finite = finite; - this.maxFiniteSize = size; + public Builder innate(boolean innate, int size) { + this.innate = innate; + this.maxInnateSize = size; return this; } @@ -450,7 +450,7 @@ public Builder baseMaterial(ResourceLocation material) { public ICharmableCapability build() { // calculate the max charm level based on baseMaterial and the source item. - Treasure.LOGGER.debug("charm source item -> {}", sourceItem); +// Treasure.LOGGER.debug("charm source item -> {}", sourceItem); // Optional level = TreasureCharms.getCharmLevel(sourceItem); // this.maxCharmLevel = baseMaterial.getMaxLevel() + (level.isPresent() ? level.get() : 0) ; return new CharmableCapability(this); diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java index 0f95110e8..da7be2dfc 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java @@ -25,7 +25,9 @@ import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.charm.BaseMaterial2; +import com.someguyssoftware.treasure2.charm.Charm; import com.someguyssoftware.treasure2.charm.CharmableMaterial; +import com.someguyssoftware.treasure2.charm.ICharm; import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.util.ModUtils; @@ -44,8 +46,8 @@ public class CharmableCapabilityStorage implements Capability.IStorage { private static final String BINDABLE = "bindable"; - private static final String FINITE = "finite"; - private static final String MAX_FINITE_SIZE = "maxFiniteSize"; + private static final String INNATE = "innate"; + private static final String MAX_INNATE_SIZE = "maxInnateSize"; private static final String IMBUABLE = "imbuable"; private static final String IMBUING = "imbuing"; private static final String MAX_IMBUE_SIZE = "maxImbueSize"; @@ -55,6 +57,7 @@ public class CharmableCapabilityStorage implements Capability.IStorage capability, ICharmableCapability instance, Direction side) { @@ -81,8 +84,8 @@ public INBT writeNBT(Capability capability, ICharmableCapa */ nbt.putBoolean(BINDABLE, instance.isBindable()); - nbt.putBoolean(FINITE, instance.isFinite()); - nbt.putInt(MAX_FINITE_SIZE, instance.getMaxFiniteSize()); + nbt.putBoolean(INNATE, instance.isInnate()); + nbt.putInt(MAX_INNATE_SIZE, instance.getMaxInnateSize()); nbt.putBoolean(IMBUABLE, instance.isImbuable()); nbt.putBoolean(IMBUING, instance.isImbuing()); @@ -114,14 +117,24 @@ public void readNBT(Capability capability, ICharmableCapab if (tag.contains(type.name())) { ListNBT listNbt = tag.getList(type.name(), 10); listNbt.forEach(e -> { - // load entity - Optional entity = ICharmEntity.load((CompoundNBT)e); - if (!entity.isPresent()) { + // load the charm + Optional charm = Charm.load((CompoundNBT) ((CompoundNBT)e).get(CHARM)); + if (!charm.isPresent()) { return; } + // create an entity + ICharmEntity entity = charm.get().createEntity(); + + // load entity + entity.load((CompoundNBT)e); +// Optional entity = ICharmEntity.load((CompoundNBT)e); +// if (!entity.isPresent()) { +// return; +// } // add the entity to the list - instance.getCharmEntities()[type.getValue()].add(entity.get()); +// instance.getCharmEntities()[type.getValue()].add(entity.get()); + instance.getCharmEntities()[type.getValue()].add(entity); }); } @@ -130,31 +143,31 @@ public void readNBT(Capability capability, ICharmableCapab instance.setBindable(tag.getBoolean(BINDABLE)); } - if (tag.contains(FINITE)) { - instance.setFinite(tag.getBoolean(FINITE)); + if (tag.contains(INNATE)) { + instance.setInnate(tag.getBoolean(INNATE)); } - if (tag.contains(MAX_FINITE_SIZE)) { - instance.setMaxFiniteSize(tag.getInt(MAX_FINITE_SIZE)); + if (tag.contains(MAX_INNATE_SIZE)) { + instance.setMaxInnateSize(tag.getInt(MAX_INNATE_SIZE)); } if (tag.contains(IMBUABLE)) { - instance.setFinite(tag.getBoolean(IMBUABLE)); + instance.setImbuable(tag.getBoolean(IMBUABLE)); } if (tag.contains(MAX_IMBUE_SIZE)) { - instance.setMaxFiniteSize(tag.getInt(MAX_IMBUE_SIZE)); + instance.setMaxImbueSize(tag.getInt(MAX_IMBUE_SIZE)); } if (tag.contains(IMBUING)) { - instance.setFinite(tag.getBoolean(IMBUING)); + instance.setImbuing(tag.getBoolean(IMBUING)); } if (tag.contains(SOCKETABLE)) { - instance.setFinite(tag.getBoolean(SOCKETABLE)); + instance.setSocketable(tag.getBoolean(SOCKETABLE)); } if (tag.contains(MAX_SOCKET_SIZE)) { - instance.setMaxFiniteSize(tag.getInt(MAX_SOCKET_SIZE)); + instance.setMaxSocketsSize(tag.getInt(MAX_SOCKET_SIZE)); } if (tag.contains(SOCKETING)) { - instance.setFinite(tag.getBoolean(SOCKETING)); + instance.setSocketing(tag.getBoolean(SOCKETING)); } if (tag.contains(BASE_MATERIAL)) { // Optional material = TreasureCharms.getBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java index da2a62e24..ee6869e83 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java @@ -57,9 +57,9 @@ public interface ICharmableCapability { public boolean isBindable(); public void setBindable(boolean bindable); - public boolean isFinite(); - public void setFinite(boolean finite); - public int getMaxFiniteSize(); + public boolean isInnate(); + public void setInnate(boolean innate); + public int getMaxInnateSize(); public boolean isImbuable(); public void setImbuable(boolean imbue); @@ -72,11 +72,14 @@ public interface ICharmableCapability { public void setSocketable(boolean socketable); public int getMaxSocketsSize(); + @Deprecated public boolean isSocketing(); + @Deprecated public void setSocketing(boolean socketing); + void setMaxSocketsSize(int maxSocketsSize); void setMaxImbueSize(int maxImbueSize); - void setMaxFiniteSize(int maxFiniteSize); + void setMaxInnateSize(int maxInnateSize); ResourceLocation getBaseMaterial(); void setBaseMaterial(ResourceLocation baseMaterial); diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java new file mode 100644 index 000000000..a82107620 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java @@ -0,0 +1,70 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; + +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; + +/** + * + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class AegisCharm extends ShieldingCharm { + + AegisCharm(Builder builder) { + super(builder); + } + + public static String AEGIS_TYPE = "aegis"; + + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.BLUE; + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent("tooltip.charm.aegis_rate", 100).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); + + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(AEGIS_TYPE, level)), AEGIS_TYPE, level); + this.percent = 100D; + } + + @Override + public ICharm build() { + return new AegisCharm(this); + } + } + +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java index fa15e11c2..1f699109f 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java @@ -68,19 +68,23 @@ protected Charm(Builder builder) { this.effectStackable = builder.effectStackable; } + abstract public Class getRegisteredEvent(); + + /** * */ @Override public ICharmEntity createEntity() { - // ICharmData data = new CharmData(); - // data.setValue(this.getMaxValue()); - // data.setPercent(this.getMaxPercent()); - // data.setDuration(this.getMaxDuration()); ICharmEntity entity = new CharmEntity(this, this.getMaxValue(),this.getMaxDuration(), this.getMaxPercent()); return entity; } + @Override + public boolean isCurse() { + return false; + } + /** * * @param nbt @@ -260,6 +264,16 @@ public Builder(ResourceLocation name, String type, Integer level) { */ abstract public ICharm build(); + /** + * + * @param type + * @param level + * @return + */ + public static String makeName(String type, int level) { + return type + "_" + level; + } + /** * * @param builder @@ -270,7 +284,6 @@ public Builder with(Consumer builder) { return this; } - @Deprecated public Builder withValue(Double value) { this.value = value; return Charm.Builder.this; diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java new file mode 100644 index 000000000..5ae415867 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java @@ -0,0 +1,98 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class DecayCurse extends Charm implements IDecay { + public static String DECAY_TYPE = "decay"; + private static float DECAY_RATE = 2F; + + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + DecayCurse(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean isCurse() { + return true; + } + + /** + * + */ + @Override + public float getDecayRate() { + return DECAY_RATE; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + if (world.getGameTime() % 20 == 0) { + if (player.isAlive() && entity.getValue() > 0 && player.getHealth() > 0.0) { + if (world.getGameTime() % 100 == 0) { + player.setHealth(MathHelper.clamp(player.getHealth() - getDecayRate(), 0.0F, player.getMaxHealth())); + entity.setValue(MathHelper.clamp(entity.getValue() - 1.0, 0D, entity.getValue())); + // Treasure.logger.debug("new data -> {}", data); + result = true; + } + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.DARK_RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.decay_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(DECAY_TYPE, level)), DECAY_TYPE, level); + } + + @Override + public ICharm build() { + return new DecayCurse(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java new file mode 100644 index 000000000..b45316295 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java @@ -0,0 +1,84 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class DecrepitCurse extends Charm { + public static String DECREPIT_TYPE = "decrepit"; + + private static final Class REGISTERED_EVENT = LivingDamageEvent.class; + + DecrepitCurse(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean isCurse() { + return true; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + if (world.getGameTime() % 20 == 0) { + if (player.isAlive() && entity.getValue() > 0 && player.getHealth() > 0.0) { + double amount = ((LivingDamageEvent)event).getAmount(); + ((LivingDamageEvent)event).setAmount((float) (amount * entity.getPercent())); + entity.setValue(MathHelper.clamp(entity.getValue() - 1.0, 0D, entity.getValue())); + result = true; + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.DARK_RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.decrepit_rate", Math.round((entity.getPercent()-1)*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(DECREPIT_TYPE, level)), DECREPIT_TYPE, level); + } + + @Override + public ICharm build() { + return new DecrepitCurse(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DirtFillCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/DirtFillCurse.java new file mode 100644 index 000000000..4252d3066 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DirtFillCurse.java @@ -0,0 +1,131 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +import com.google.common.collect.Lists; +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.block.Blocks; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 24, 2021 + * + */ +public class DirtFillCurse extends Charm { + public static final String DIRT_FILL_TYPE = "dirt_fill"; + + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + /** + * + * @param builder + */ + DirtFillCurse(Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean isCurse() { + return true; + } + + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + // update every 10 seconds + if (world.getGameTime() % 200 == 0) { + if (player.isAlive() && entity.getValue() > 0) { + // randomly select an empty inventory slot and fill it with dirt + List emptySlots = getEmptySlotsRandomized(player.inventory, random); + if (emptySlots != null && !emptySlots.isEmpty()) { + player.inventory.setItem(((Integer)emptySlots.get(emptySlots.size() - 1)).intValue(), new ItemStack(Blocks.DIRT, 1)); + entity.setValue(MathHelper.clamp(entity.getValue() - 1.0, 0D, entity.getValue())); + result = true; + } + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.DARK_RED; + tooltip.add(new StringTextComponent(" ").append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + } + + /** + * + * @param inventory + * @param rand + * @return + */ + private List getEmptySlotsRandomized(IInventory inventory, Random rand) { + List list = Lists.newArrayList(); + for (int i = 0; i < Math.min(36, inventory.getContainerSize()); ++i) { + if (inventory.getItem(i).isEmpty()) { + list.add(Integer.valueOf(i)); + } + } + Collections.shuffle(list, rand); + return list; + } + + /** + * + */ + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(DIRT_FILL_TYPE, level)), DIRT_FILL_TYPE, level); + } + + @Override + public ICharm build() { + return new DirtFillCurse(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DirtWalkCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/DirtWalkCurse.java new file mode 100644 index 000000000..a8475c2b9 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DirtWalkCurse.java @@ -0,0 +1,115 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +import com.google.common.collect.Lists; +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 24, 2021 + * + */ +public class DirtWalkCurse extends Charm { + public static final String DIRT_WALK_TYPE = "dirt_walk"; + + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + /** + * + * @param builder + */ + DirtWalkCurse(Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean isCurse() { + return true; + } + + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + // update every 10 seconds + if (world.getGameTime() % 200 == 0) { + if (player.isAlive() && entity.getValue() > 0) { + // if the current position where standing isn't already dirt, change it to dirt + BlockState state = world.getBlockState(coords.down(1).toPos()); + if (state.getBlock() != Blocks.DIRT) { + world.setBlockAndUpdate(coords.down(1).toPos(), Blocks.DIRT.defaultBlockState()); + entity.setValue(MathHelper.clamp(entity.getValue() - 1.0, 0D, entity.getValue())); + result = true; + } + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.DARK_RED; + tooltip.add(new StringTextComponent(" ").append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + } + + /** + * + */ + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(DIRT_WALK_TYPE, level)), DIRT_WALK_TYPE, level); + } + + @Override + public ICharm build() { + return new DirtWalkCurse(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java new file mode 100644 index 000000000..bda6064f5 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java @@ -0,0 +1,110 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.charm.Charm.Builder; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.MobEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.DamageSource; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * drains 1 health; value = uses, duration = range + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class DrainCharm extends Charm { + public static final String DRAIN_TYPE = "drain"; + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + DrainCharm(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + if (world.getGameTime() % (TICKS_PER_SECOND * 5) == 0) { + if (entity.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { + // get player position + double px = player.position().x; + double py = player.position().y; + double pz = player.position().z; + + // calculate the new amount + int range = entity.getDuration(); + AtomicInteger drainedHealth = new AtomicInteger(0); + List mobs = world.getEntitiesOfClass(MobEntity.class, new AxisAlignedBB(px - range, py - range, pz - range, px + range, py + range, pz + range)); + if (mobs.isEmpty()) { + return result; + } + mobs.forEach(mob -> { + boolean flag = mob.hurt(DamageSource.playerAttack(player), (float) 1.0F); + Treasure.LOGGER.debug("health drained from mob -> {} was successful -> {}", mob.getName(), flag); + if (flag) { + drainedHealth.getAndAdd(1); + } + }); + + if (drainedHealth.get() > 0) { + player.setHealth(MathHelper.clamp(player.getHealth() + drainedHealth.get(), 0.0F, player.getMaxHealth())); + entity.setValue(MathHelper.clamp(entity.getValue() - 1D, 0D, entity.getValue())); + result = true; + } + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.drain_rate", Math.toIntExact(Math.round(entity.getPercent() * 100))).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(DRAIN_TYPE, level)), DRAIN_TYPE, level); + } + + @Override + public ICharm build() { + return new DrainCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java new file mode 100644 index 000000000..9165c3c77 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java @@ -0,0 +1,89 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class FireImmunityCharm extends Charm { + public static final String FIRE_IMMUNITY_TYPE = "fire_immunity"; + private static final Class REGISTERED_EVENT = LivingDamageEvent.class; + + FireImmunityCharm(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + if (entity.getValue() > 0 && player.isAlive() && ((LivingDamageEvent)event).getSource().isFire()) { + // get the fire damage amount + double amount = ((LivingDamageEvent)event).getAmount(); + + // if damage is fire damage + if (entity.getValue() >= amount) { + entity.setValue(entity.getValue() - amount); + } + else { + entity.setValue(0); + } + ((LivingDamageEvent)event).setAmount(0F); + result = true; + } + + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.fire_immunity_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(FIRE_IMMUNITY_TYPE, level)), FIRE_IMMUNITY_TYPE, level); + } + + @Override + public ICharm build() { + return new FireImmunityCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java new file mode 100644 index 000000000..703bc62fa --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java @@ -0,0 +1,95 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class FireResistenceCharm extends Charm { + public static final String FIRE_RESISTENCE_TYPE = "fire_resistence"; + private static final Class REGISTERED_EVENT = LivingDamageEvent.class; + + FireResistenceCharm(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + if (((LivingDamageEvent)event).getSource().isFire() && entity.getValue() > 0 && player.isAlive()) { + // get the fire damage amount + double amount = ((LivingDamageEvent)event).getAmount(); + // calculate the new amount + double newAmount = 0; + double amountToCharm = amount * entity.getPercent(); + double amountToPlayer = amount - amountToCharm; + + if (entity.getValue() >= amountToCharm) { + entity.setValue(entity.getValue() - amountToCharm); + newAmount = amountToPlayer; + } + else { + newAmount = amount - entity.getValue(); + entity.setValue(0); + } + ((LivingDamageEvent)event).setAmount((float) newAmount); + + result = true; + } + + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.fire_resistence_rate", Math.toIntExact(Math.round(entity.getPercent() * 100))).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(FIRE_RESISTENCE_TYPE, level)), FIRE_RESISTENCE_TYPE, level); + } + + @Override + public ICharm build() { + return new FireResistenceCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java new file mode 100644 index 000000000..3cae1f198 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java @@ -0,0 +1,89 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class GreaterHealingCharm extends Charm implements IHealing { + public static String HEALING_TYPE = "greater_healing"; + private static float HEAL_RATE = 2F; + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + GreaterHealingCharm(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + /** + * + */ + @Override + public float getHealRate() { + return HEAL_RATE; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + if (world.getGameTime() % 10 == 0) { + if (entity.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { + float amount = Math.min(getHealRate(), player.getMaxHealth() - player.getHealth()); + player.setHealth(MathHelper.clamp(player.getHealth() + amount, 0.0F, player.getMaxHealth())); + entity.setValue(MathHelper.clamp(entity.getValue() - amount, 0D, entity.getValue())); + result = true; + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.greater_healing_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(HEALING_TYPE, level)), HEALING_TYPE, level); + } + + @Override + public ICharm build() { + return new GreaterHealingCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java index 11d729a28..4d28ae026 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java @@ -19,6 +19,7 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.eventbus.api.Event; /** @@ -28,11 +29,17 @@ public class HealingCharm extends Charm implements IHealing { public static String HEALING_TYPE = "healing"; private static float HEAL_RATE = 1F; - + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + HealingCharm(Builder builder) { super(builder); } + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + /** * */ @@ -62,7 +69,6 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p /** * */ - @SuppressWarnings("deprecation") @Override public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; @@ -73,7 +79,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List public static class Builder extends Charm.Builder { public Builder(Integer level) { - super(ModUtils.asLocation(HEALING_TYPE + level), HEALING_TYPE, level); + super(ModUtils.asLocation(makeName(HEALING_TYPE, level)), HEALING_TYPE, level); } @Override diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java index fc8989118..a38601787 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharm.java @@ -20,7 +20,6 @@ package com.someguyssoftware.treasure2.charm; import java.util.List; -import java.util.Optional; import java.util.Random; import com.someguyssoftware.gottschcore.spatial.ICoords; @@ -67,6 +66,8 @@ public interface ICharm { * @return */ CompoundNBT save(CompoundNBT nbt); - - + + public Class getRegisteredEvent(); + + public boolean isCurse(); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java index 4c4a7c8eb..7fd4440bb 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ICharmEntity.java @@ -19,7 +19,6 @@ */ package com.someguyssoftware.treasure2.charm; -import java.util.Comparator; import java.util.Optional; import net.minecraft.nbt.CompoundNBT; @@ -57,23 +56,36 @@ public interface ICharmEntity { * @param nbt * @return */ - public static Optional load(CompoundNBT nbt) { - Optional charm = Charm.load((CompoundNBT) nbt.get(CHARM)); - if (!charm.isPresent()) { - return Optional.empty(); - } - - ICharmEntity entity = charm.get().createEntity(); +// public static Optional load(CompoundNBT nbt) { +// Optional charm = Charm.load((CompoundNBT) nbt.get(CHARM)); +// if (!charm.isPresent()) { +// return Optional.empty(); +// } +// +// ICharmEntity entity = charm.get().createEntity(); +// if (nbt.contains(VALUE)) { +// entity.setValue(nbt.getDouble(VALUE)); +// } +// if (nbt.contains("duration")) { +// entity.setDuration(nbt.getInt("duration")); +// } +// if (nbt.contains("percent")) { +// entity.setPercent(nbt.getDouble("percent")); +// } +// return Optional.of(entity); +// } + + default public boolean load(CompoundNBT nbt) { if (nbt.contains(VALUE)) { - entity.setValue(nbt.getDouble(VALUE)); + setValue(nbt.getDouble(VALUE)); } if (nbt.contains("duration")) { - entity.setDuration(nbt.getInt("duration")); + setDuration(nbt.getInt("duration")); } if (nbt.contains("percent")) { - entity.setPercent(nbt.getDouble("percent")); + setPercent(nbt.getDouble("percent")); } - return Optional.of(entity); + return true; } void update(ICharmEntity entity); diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/IDecay.java b/src/main/java/com/someguyssoftware/treasure2/charm/IDecay.java new file mode 100644 index 000000000..fab8efad8 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/IDecay.java @@ -0,0 +1,29 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +/** + * + * @author Mark Gottschling on Aug 24, 2021 + * + */ +public interface IDecay { + public float getDecayRate(); +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ILifeStrike.java b/src/main/java/com/someguyssoftware/treasure2/charm/ILifeStrike.java new file mode 100644 index 000000000..2a1c7a681 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ILifeStrike.java @@ -0,0 +1,29 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +/** + * + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public interface ILifeStrike { + public float getLifeAmount(); +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java new file mode 100644 index 000000000..9bc9bd21e --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java @@ -0,0 +1,164 @@ +/** + * + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.block.BlockContext; +import com.someguyssoftware.gottschcore.spatial.Coords; +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * @author Mark Gottschling on Aug 15, 2021 + * + */ +public class IlluminationCharm extends Charm { + public static String ILLUMINATION_TYPE = "illumination"; + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + /** + * + * @param builder + */ + IlluminationCharm(Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public ICharmEntity createEntity() { + ICharmEntity entity = new IlluminationCharmEntity(this, this.getMaxValue(),this.getMaxDuration(), this.getMaxPercent()); + return entity; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + if (world.getGameTime() % 100 == 0) { + if (entity.getValue() > 0 && player.isAlive()) { + ICoords currentCoords = new Coords((int)Math.floor(player.position().x), (int)Math.floor(player.position().y), (int)Math.floor(player.position().z)); + + /* + * validation checks + */ + // check that the block at current position is air or replaceable + BlockContext cube = new BlockContext(world, currentCoords); + if (!cube.isAir() && !cube.isReplaceable()) { + return false; + } + // check that the block underneath is solid + cube = new BlockContext(world, currentCoords.down(1)); + if (!cube.isSolid()) { + Treasure.LOGGER.debug("not solid at -> {}", currentCoords.down(1)); + return false; + } + if (!(entity instanceof IlluminationCharmEntity)) { + Treasure.LOGGER.debug("entity are not instance of IlluminationCharmData -> {}.{}", this.getClass().getSimpleName(), entity.getClass().getSimpleName()); + return false; + } + + IlluminationCharmEntity charmEntity = (IlluminationCharmEntity)entity; + // cast as linked list + List list = (List)charmEntity.getCoordsList(); + Treasure.LOGGER.debug("charm coords list size -> {}", list.size()); + double value = entity.getValue(); + + boolean isUpdated = false; + // check if the coordsList is empty or not + if (list.isEmpty()) { + // add current position + list.add(0, currentCoords); + isUpdated = true; + } + else { + // determine if new position is different than last position - ie first element in entity.coordsList + ICoords firstCoords = list.get(0); + if (!currentCoords.equals(firstCoords) && firstCoords.getDistanceSq(currentCoords) >= 25) { + // add current coords to coords list + list.add(0, currentCoords); + // check if coords list is greater than max (entity.value) + if (list.size() > (int)charmEntity.getValue()) { + // get difference in size + int diff = (int) (list.size() - charmEntity.getValue()); + // Treasure.logger.debug("diff -> {}", diff); + for (int index = 0; index < diff; index++) { + ICoords lastCoords = list.get(list.size()-1); + Block block = world.getBlockState(lastCoords.toPos()).getBlock(); + if (block == Blocks.TORCH) { + // Treasure.logger.debug("set torch to air at -> {}", lastCoords.toShortString()); +// world.setBlockToAir(lastCoords.toPos()); + Block.updateOrDestroy(world.getBlockState(lastCoords.toPos()), Blocks.AIR.defaultBlockState(), world, lastCoords.toPos(), 3); + } + else { + // Treasure.logger.debug("torch no longer found at -> {}", currentCoords.toShortString()); + // decrement value since torch was harvested + value -= 1; + } + list.remove(lastCoords); + // Treasure.logger.debug("remove torch from list at -> {}; new size ->{}", lastCoords.toShortString(), list.size()); + } + } + isUpdated = true; + } + } + if (isUpdated == true ) { + world.setBlockAndUpdate(currentCoords.toPos(), Blocks.TORCH.defaultBlockState()); + // Treasure.logger.debug("set torch at -> {}", currentCoords.toShortString()); + if (value < 0) value = 0; + entity.setValue(value); + // Treasure.logger.debug("new entity -> {}", entity); + result = true; + } + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.illumination_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(ILLUMINATION_TYPE, level)), ILLUMINATION_TYPE, level); + } + + @Override + public ICharm build() { + return new IlluminationCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharmEntity.java b/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharmEntity.java new file mode 100644 index 000000000..cb8878a5a --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharmEntity.java @@ -0,0 +1,118 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + +import com.someguyssoftware.gottschcore.spatial.ICoords; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; + +/** + * + * @author Mark Gottschling on Aug 24, 2021 + * + */ +public class IlluminationCharmEntity extends CharmEntity { + private List coordsList; + + /** + * + * @param charm + * @param value + * @param duration + * @param percent + */ + public IlluminationCharmEntity(ICharm charm, double value, int duration, double percent) { + super(charm, value, duration, percent); + setCoordsList(Collections.synchronizedList(new LinkedList<>())); + } + + /** + * + */ + @Override + public boolean load(CompoundNBT nbt) { + super.load(nbt); + ListNBT list = nbt.getList("illuminationCoords", 10); +// Treasure.logger.debug("illumination tag list size -> {}", list.tagCount()); + for (int i = 0; i < list.size(); i++) { + CompoundNBT tag = (CompoundNBT) list.get(i); + ICoords coords = ICoords.readFromNBT(tag); + if (coords != null) { + getCoordsList().add(coords); + } + } + return true; + } + + /** + * + * @return + */ + public List getCoordsList() { + if (coordsList == null) { + coordsList = new LinkedList<>(); + } + return coordsList; + } + + /** + * + * @param blockList + */ + public void setCoordsList(List blockList) { + this.coordsList = blockList; + } + + @Override + public String toString() { + return "IlluminationCharmEntity [" + /*coordsList=" + coordsList + ",*/ " toString()=" + super.toString() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((coordsList == null) ? 0 : coordsList.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + IlluminationCharmEntity other = (IlluminationCharmEntity) obj; + if (coordsList == null) { + if (other.coordsList != null) + return false; + } else if (!coordsList.equals(other.coordsList)) + return false; + return true; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java new file mode 100644 index 000000000..4c200b089 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java @@ -0,0 +1,116 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.DamageSource; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class LifeStrikeCharm extends Charm implements ILifeStrike { + public static String LIFE_STRIKE_TYPE = "life_strike"; + private static float LIFE_AMOUNT = 2F; + private static final Class REGISTERED_EVENT = LivingHurtEvent.class; + + LifeStrikeCharm(Builder builder) { + super(builder); + } + + @Override + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + /** + * + */ + @Override + public float getLifeAmount() { + return LIFE_AMOUNT; + } + + /** + * NOTE: it is assumed that only the allowable events are calling this action. + */ + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + if (entity.getValue() > 0 && player.isAlive()) { + DamageSource source = ((LivingHurtEvent) event).getSource(); + + if (source.getEntity() instanceof PlayerEntity) { + if (player.getHealth() > 5.0F) { + // get the source and amount + double amount = ((LivingHurtEvent)event).getAmount(); + // increase damage amount + ((LivingHurtEvent)event).setAmount((float) (Math.max(2F, amount * entity.getPercent()))); + // reduce players health + player.setHealth(MathHelper.clamp(player.getHealth() - LIFE_AMOUNT, 0.0F, player.getMaxHealth())); + entity.setValue(MathHelper.clamp(entity.getValue() - 1, 0D, entity.getValue())); + result = true; + } + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.RED; + tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); + tooltip.add(new TranslationTextComponent("tooltip.charm.life_strike_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(LIFE_STRIKE_TYPE, level)), LIFE_STRIKE_TYPE, level); + } + + @Override + public ICharm build() { + return new LifeStrikeCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java new file mode 100644 index 000000000..299577f65 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java @@ -0,0 +1,121 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.MobEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * reflection: value = # of uses, duration = range, percent = % of damage reflected + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class ReflectionCharm extends Charm { + public static String REFLECTION_TYPE = "reflection"; + + private static final Class REGISTERED_EVENT = LivingDamageEvent.class; + + /** + * + * @param builder + */ + public ReflectionCharm(Builder builder) { + super(builder); + } + + protected ReflectionCharm(Charm.Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + if (entity.getValue() > 0 && player.isAlive()) { + // get player position + double px = player.position().x; + double py = player.position().y; + double pz = player.position().z; + + // get the source and amount + double amount = ((LivingDamageEvent)event).getAmount(); + // calculate the new amount + double reflectedAmount = amount * entity.getPercent(); + int range = entity.getDuration(); + + List mobs = world.getEntitiesOfClass(MobEntity.class, new AxisAlignedBB(px - range, py - range, pz - range, px + range, py + range, pz + range)); + mobs.forEach(mob -> { + boolean flag = mob.hurt(DamageSource.playerAttack(player), (float) reflectedAmount); + Treasure.LOGGER.debug("reflected damage {} onto mob -> {} was successful -> {}", reflectedAmount, mob.getName(), flag); + }); + + // get all the mob within a radius + entity.setValue(entity.getValue() - 1.0); + result = true; + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.BLUE; + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent("tooltip.charm.reflection_rate", Math.toIntExact((long)entity.getPercent()*100), entity.getDuration()).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); + + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(REFLECTION_TYPE, level)), REFLECTION_TYPE, level); + } + + @Override + public ICharm build() { + return new ReflectionCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java new file mode 100644 index 000000000..6e316d4fb --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java @@ -0,0 +1,134 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +import com.google.common.collect.FluentIterable; +import com.google.common.collect.Lists; +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.block.Blocks; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 24, 2021 + * + */ +public class RuinCurse extends Charm { + public static final String RUIN_TYPE = "ruin"; + + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + /** + * + * @param builder + */ + RuinCurse(Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean isCurse() { + return true; + } + + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + // update every 10 seconds + if (player.isAlive() && entity.getValue() > 0 && player.getHealth() > 0.0) { + if (world.getGameTime() % (entity.getDuration() * TICKS_PER_SECOND) == 0) { + FluentIterable inventoryEquipment = (FluentIterable) player.getArmorSlots(); + inventoryEquipment.append(player.getHandSlots()); + + List actualEquipment = new ArrayList<>(5); + inventoryEquipment.forEach(itemStack -> { + if (itemStack.getItem() != Items.AIR) { + actualEquipment.add(itemStack); + } + }); + if (actualEquipment != null && actualEquipment.size() > 0) { + // randomly pick an item + ItemStack selectedItemStack = actualEquipment.get(random.nextInt(actualEquipment.size())); + Treasure.LOGGER.debug("damaging item -> {}, current damage -> {} of {}", selectedItemStack.getDisplayName(), selectedItemStack.getDamageValue(), selectedItemStack.getMaxDamage()); + // damage the item + if (selectedItemStack.isDamageableItem()) { + selectedItemStack.hurt(1, random, null); + Treasure.LOGGER.debug("damaged item -> {}, now at damaged -> {} of {}", selectedItemStack.getDisplayName(), selectedItemStack.getDamageValue(), selectedItemStack.getMaxDamage()); + entity.setValue(MathHelper.clamp(entity.getValue() - 1.0, 0D, entity.getValue())); + } + } + Treasure.LOGGER.debug("charm {} new data -> {}", this.getName(), entity); + result = true; + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.DARK_RED; + tooltip.add(new StringTextComponent(" ").append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + tooltip.add(new TranslationTextComponent("tooltip.charm.ruin_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + } + + /** + * + */ + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(RUIN_TYPE, level)), RUIN_TYPE, level); + } + + @Override + public ICharm build() { + return new RuinCurse(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java new file mode 100644 index 000000000..cb6461c57 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java @@ -0,0 +1,101 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.charm; + +import java.util.List; +import java.util.Random; + +import com.someguyssoftware.gottschcore.spatial.ICoords; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingDamageEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.eventbus.api.Event; + +/** + * + * @author Mark Gottschling on Aug 23, 2021 + * + */ +public class SatietyCharm extends Charm { + public static final String SATIETY_TYPE = "satiety"; + public static final int MAX_FOOD_LEVEL = 20; + + private static final Class REGISTERED_EVENT = LivingUpdateEvent.class; + + /** + * + * @param builder + */ + SatietyCharm(Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { + return REGISTERED_EVENT; + } + + @Override + public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { + boolean result = false; + + if (world.getGameTime() % TICKS_PER_SECOND == 0) { + if (player.isAlive() && entity.getValue() > 0 && player.getFoodData().getFoodLevel() < MAX_FOOD_LEVEL) { + player.getFoodData().eat(1, 1); + entity.setValue(entity.getValue() - 1); + result = true; + } + } + return result; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { + TextFormatting color = TextFormatting.BLUE; + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); + tooltip.add(new StringTextComponent(" ") + .append(new TranslationTextComponent("tooltip.charm.satiety_rate")).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + + } + + public static class Builder extends Charm.Builder { + + public Builder(Integer level) { + super(ModUtils.asLocation(makeName(SATIETY_TYPE, level)), SATIETY_TYPE, level); + } + + @Override + public ICharm build() { + return new SatietyCharm(this); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java index f4fff9066..13877dc76 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java @@ -50,11 +50,15 @@ public class ShieldingCharm extends Charm { * * @param builder */ - ShieldingCharm(Builder builder) { + public ShieldingCharm(Builder builder) { super(builder); } - public static Class getRegisteredEvent() { + protected ShieldingCharm(Charm.Builder builder) { + super(builder); + } + + public Class getRegisteredEvent() { return REGISTERED_EVENT; } @@ -99,7 +103,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List public static class Builder extends Charm.Builder { public Builder(Integer level) { - super(ModUtils.asLocation(SHIELDING_TYPE + level), SHIELDING_TYPE, level); + super(ModUtils.asLocation(makeName(SHIELDING_TYPE, level)), SHIELDING_TYPE, level); } @Override diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java index 89f5f4313..889384d36 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.function.Predicate; import net.minecraft.util.ResourceLocation; @@ -33,56 +34,74 @@ * */ public class TreasureCharmRegistry { - private static final Map REGISTRY = new HashMap<>(); - private static final Map> REGISTRY_BY_LEVEL = new HashMap<>(); + private static final Map REGISTRY = new HashMap<>(); + private static final Map> REGISTRY_BY_LEVEL = new HashMap<>(); - /** - * - * @param charm - */ - public static void register(ICharm charm) { - if (!REGISTRY.containsKey(charm.getName())) { - REGISTRY.put(charm.getName(), charm); - } - if (!REGISTRY_BY_LEVEL.containsKey(Integer.valueOf(charm.getLevel()))) { - List charmList = new ArrayList<>(); - charmList.add(charm); - REGISTRY_BY_LEVEL.put(Integer.valueOf(charm.getLevel()), charmList); - } - else { - REGISTRY_BY_LEVEL.get(Integer.valueOf(charm.getLevel())).add(charm); - } - } + /** + * + * @param charm + */ + public static void register(ICharm charm) { + if (!REGISTRY.containsKey(charm.getName())) { + REGISTRY.put(charm.getName(), charm); + } + if (!REGISTRY_BY_LEVEL.containsKey(Integer.valueOf(charm.getLevel()))) { + List charmList = new ArrayList<>(); + charmList.add(charm); + REGISTRY_BY_LEVEL.put(Integer.valueOf(charm.getLevel()), charmList); + } + else { + REGISTRY_BY_LEVEL.get(Integer.valueOf(charm.getLevel())).add(charm); + } + } - /** - * - * @param name - * @return - */ - public static Optional get(ResourceLocation name) { - - if (REGISTRY.containsKey(name)) { - return Optional.of(REGISTRY.get(name)); - } - return Optional.empty(); - } - - /** - * @param level - * @return - */ - public static Optional> get(Integer level) { - if (REGISTRY_BY_LEVEL.containsKey(level)) { - return Optional.of(REGISTRY_BY_LEVEL.get(level)); - } - return Optional.empty(); - } + /** + * + * @param name + * @return + */ + public static Optional get(ResourceLocation name) { - /** - * - * @return - */ - public static List values() { - return (List) REGISTRY.values(); - } + if (REGISTRY.containsKey(name)) { + return Optional.of(REGISTRY.get(name)); + } + return Optional.empty(); + } + + /** + * @param level + * @return + */ + public static Optional> get(Integer level) { + if (REGISTRY_BY_LEVEL.containsKey(level)) { + return Optional.of(REGISTRY_BY_LEVEL.get(level)); + } + return Optional.empty(); + } + + /** + * + * @param predicate + * @return + */ + public static Optional> get(Predicate predicate) { + List charms = new ArrayList<>(); + for (ICharm c : TreasureCharmRegistry.values()) { + if (predicate.test(c.getLevel())) { + charms.add(c); + } + } + if (charms.size() == 0) { + return Optional.empty(); + } + return Optional.of(charms); + } + + /** + * + * @return + */ + public static List values() { + return (List) REGISTRY.values(); + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java index 8e1b4b373..a2702e484 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java @@ -19,7 +19,10 @@ */ package com.someguyssoftware.treasure2.charm; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Optional; @@ -39,10 +42,6 @@ * */ public class TreasureCharms { - - // TODO this probably can go away in favor of method in Charm - private static final Multimap, String> EVENT_CHARM_MAP = ArrayListMultimap.create(); - private static final Map METAL_REGISTRY = new HashMap<>(); private static final Map GEM_REGISTRY = new HashMap<>(); @@ -59,10 +58,7 @@ public class TreasureCharms { public static CharmableMaterial WHITE_PEARL; public static CharmableMaterial BLACK_PEARL; -// public static final BaseMaterial2 COPPER = new BaseMaterial2("copper", 2, 1D, 2D); -// public static final BaseMaterial2 SILVER = new BaseMaterial2("silver", 3, 1D, 3D); -// public static final BaseMaterial2 GOLD = new BaseMaterial2("gold", 4, 2D, 4D); - + // charms public static final ICharm HEALING_1 = makeHealing(1); public static final ICharm HEALING_2 = makeHealing(2); public static final ICharm HEALING_3 = makeHealing(3); @@ -79,6 +75,15 @@ public class TreasureCharms { public static final ICharm HEALING_14 = makeHealing(14); public static final ICharm HEALING_15 = makeHealing(15); + public static final ICharm GREATER_HEALING_8 = makeGreaterHealing(8); + public static final ICharm GREATER_HEALING_9 = makeGreaterHealing(9); + public static final ICharm GREATER_HEALING_10 = makeGreaterHealing(10); + public static final ICharm GREATER_HEALING_11 = makeGreaterHealing(11); + public static final ICharm GREATER_HEALING_12 = makeGreaterHealing(12); + public static final ICharm GREATER_HEALING_13 = makeGreaterHealing(13); + public static final ICharm GREATER_HEALING_14 = makeGreaterHealing(14); + public static final ICharm GREATER_HEALING_15 = makeGreaterHealing(15); + public static final ICharm SHIELDING_1 = makeShielding(1); public static final ICharm SHIELDING_2 = makeShielding(2); public static final ICharm SHIELDING_3 = makeShielding(3); @@ -95,45 +100,161 @@ public class TreasureCharms { public static final ICharm SHIELDING_14 = makeShielding(14); public static final ICharm SHIELDING_15 = makeShielding(15); + public static final ICharm AEGIS_1 = makeAegis(1); + public static final ICharm AEGIS_2 = makeAegis(2); + public static final ICharm AEGIS_3 = makeAegis(3); + public static final ICharm AEGIS_4 = makeAegis(4); + public static final ICharm AEGIS_5 = makeAegis(5); + public static final ICharm AEGIS_6 = makeAegis(6); + public static final ICharm AEGIS_7 = makeAegis(7); + public static final ICharm AEGIS_8 = makeAegis(8); + public static final ICharm AEGIS_9 = makeAegis(9); + public static final ICharm AEGIS_10 = makeAegis(10); + public static final ICharm AEGIS_11 = makeAegis(11); + public static final ICharm AEGIS_12 = makeAegis(12); + public static final ICharm AEGIS_13 = makeAegis(13); + public static final ICharm AEGIS_14 = makeAegis(14); + public static final ICharm AEGIS_15 = makeAegis(15); + + public static final ICharm FIRE_IMMUNITY_1 = makeFireImmunity(1); + public static final ICharm FIRE_IMMUNITY_2 = makeFireImmunity(2); + public static final ICharm FIRE_IMMUNITY_3 = makeFireImmunity(3); + public static final ICharm FIRE_IMMUNITY_4 = makeFireImmunity(4); + public static final ICharm FIRE_IMMUNITY_5 = makeFireImmunity(5); + public static final ICharm FIRE_IMMUNITY_6 = makeFireImmunity(6); + public static final ICharm FIRE_IMMUNITY_7 = makeFireImmunity(7); + public static final ICharm FIRE_IMMUNITY_8 = makeFireImmunity(8); + public static final ICharm FIRE_IMMUNITY_9 = makeFireImmunity(9); + public static final ICharm FIRE_IMMUNITY_10 = makeFireImmunity(10); + public static final ICharm FIRE_IMMUNITY_11 = makeFireImmunity(11); + public static final ICharm FIRE_IMMUNITY_12 = makeFireImmunity(12); + public static final ICharm FIRE_IMMUNITY_13 = makeFireImmunity(13); + public static final ICharm FIRE_IMMUNITY_14 = makeFireImmunity(14); + public static final ICharm FIRE_IMMUNITY_15 = makeFireImmunity(15); + + public static final ICharm FIRE_RESISTENCE_1 = makeFireResistence(1); + public static final ICharm FIRE_RESISTENCE_2 = makeFireResistence(2); + public static final ICharm FIRE_RESISTENCE_3 = makeFireResistence(3); + public static final ICharm FIRE_RESISTENCE_4 = makeFireResistence(4); + public static final ICharm FIRE_RESISTENCE_5 = makeFireResistence(5); + public static final ICharm FIRE_RESISTENCE_6 = makeFireResistence(6); + public static final ICharm FIRE_RESISTENCE_7 = makeFireResistence(7); + public static final ICharm FIRE_RESISTENCE_8 = makeFireResistence(8); + public static final ICharm FIRE_RESISTENCE_9 = makeFireResistence(9); + public static final ICharm FIRE_RESISTENCE_10 = makeFireResistence(10); + public static final ICharm FIRE_RESISTENCE_11 = makeFireResistence(11); + public static final ICharm FIRE_RESISTENCE_12 = makeFireResistence(12); + public static final ICharm FIRE_RESISTENCE_13 = makeFireResistence(13); + public static final ICharm FIRE_RESISTENCE_14 = makeFireResistence(14); + public static final ICharm FIRE_RESISTENCE_15 = makeFireResistence(15); + + public static final ICharm SATIETY_1 = makeSatiety(1); + public static final ICharm SATIETY_2 = makeSatiety(2); + public static final ICharm SATIETY_3 = makeSatiety(3); + public static final ICharm SATIETY_4 = makeSatiety(4); + public static final ICharm SATIETY_5 = makeSatiety(5); + public static final ICharm SATIETY_6 = makeSatiety(6); + public static final ICharm SATIETY_7 = makeSatiety(7); + public static final ICharm SATIETY_8 = makeSatiety(8); + public static final ICharm SATIETY_9 = makeSatiety(9); + public static final ICharm SATIETY_10 = makeSatiety(10); + public static final ICharm SATIETY_11 = makeSatiety(11); + public static final ICharm SATIETY_12 = makeSatiety(12); + public static final ICharm SATIETY_13 = makeSatiety(13); + public static final ICharm SATIETY_14 = makeSatiety(14); + public static final ICharm SATIETY_15 = makeSatiety(15); + + public static final ICharm LIFE_STRIKE_1 = makeLifeStrike(1); + public static final ICharm LIFE_STRIKE_2 = makeLifeStrike(2); + public static final ICharm LIFE_STRIKE_3 = makeLifeStrike(3); + public static final ICharm LIFE_STRIKE_4 = makeLifeStrike(4); + public static final ICharm LIFE_STRIKE_5 = makeLifeStrike(5); + public static final ICharm LIFE_STRIKE_6 = makeLifeStrike(6); + public static final ICharm LIFE_STRIKE_7 = makeLifeStrike(7); + public static final ICharm LIFE_STRIKE_8 = makeLifeStrike(8); + public static final ICharm LIFE_STRIKE_9 = makeLifeStrike(9); + public static final ICharm LIFE_STRIKE_10 = makeLifeStrike(10); + public static final ICharm LIFE_STRIKE_11 = makeLifeStrike(11); + public static final ICharm LIFE_STRIKE_12 = makeLifeStrike(12); + public static final ICharm LIFE_STRIKE_13 = makeLifeStrike(13); + public static final ICharm LIFE_STRIKE_14 = makeLifeStrike(14); + public static final ICharm LIFE_STRIKE_15 = makeLifeStrike(15); + + public static final ICharm REFLECTION_1 = makeReflection(1); + public static final ICharm REFLECTION_2 = makeReflection(2); + public static final ICharm REFLECTION_3 = makeReflection(3); + public static final ICharm REFLECTION_4 = makeReflection(4); + public static final ICharm REFLECTION_5 = makeReflection(5); + public static final ICharm REFLECTION_6 = makeReflection(6); + public static final ICharm REFLECTION_7 = makeReflection(7); + public static final ICharm REFLECTION_8 = makeReflection(8); + public static final ICharm REFLECTION_9 = makeReflection(9); + public static final ICharm REFLECTION_10 = makeReflection(10); + public static final ICharm REFLECTION_11 = makeReflection(11); + public static final ICharm REFLECTION_12 = makeReflection(12); + public static final ICharm REFLECTION_13 = makeReflection(13); + public static final ICharm REFLECTION_14 = makeReflection(14); + public static final ICharm REFLECTION_15 = makeReflection(15); + + public static final ICharm DRAIN_1 = makeDrain(1); + public static final ICharm DRAIN_2 = makeDrain(2); + public static final ICharm DRAIN_3 = makeDrain(3); + public static final ICharm DRAIN_4 = makeDrain(4); + public static final ICharm DRAIN_5 = makeDrain(5); + public static final ICharm DRAIN_6 = makeDrain(6); + public static final ICharm DRAIN_7 = makeDrain(7); + public static final ICharm DRAIN_8 = makeDrain(8); + public static final ICharm DRAIN_9 = makeDrain(9); + public static final ICharm DRAIN_10 = makeDrain(10); + public static final ICharm DRAIN_11 = makeDrain(11); + public static final ICharm DRAIN_12 = makeDrain(12); + public static final ICharm DRAIN_13 = makeDrain(13); + public static final ICharm DRAIN_14 = makeDrain(14); + public static final ICharm DRAIN_15 = makeDrain(15); + + public static final ICharm ILLUMINATION_3 = makeIllumination(3); + public static final ICharm ILLUMINATION_6 = makeIllumination(6); + public static final ICharm ILLUMINATION_9 = makeIllumination(9); + public static final ICharm ILLUMINATION_12 = makeIllumination(12); + public static final ICharm ILLUMINATION_15 = makeIllumination(15); + + // HARVESTING + + // curses + public static final ICharm DECAY_1 = makeDecay(1); + public static final ICharm DECAY_3 = makeDecay(3); + public static final ICharm DECAY_5 = makeDecay(5); + public static final ICharm DECAY_7 = makeDecay(7); + + public static final ICharm DECREPIT_1 = makeDecrepit(1); + public static final ICharm DECREPIT_2 = makeDecrepit(2); + public static final ICharm DECREPIT_3 = makeDecrepit(3); + public static final ICharm DECREPIT_4 = makeDecrepit(4); + public static final ICharm DECREPIT_5 = makeDecrepit(5); + public static final ICharm DECREPIT_6 = makeDecrepit(6); + public static final ICharm DECREPIT_7 = makeDecrepit(7); + public static final ICharm DECREPIT_8 = makeDecrepit(8); + + public static final ICharm DIRT_FILL_2 = makeDirtFill(2); + public static final ICharm DIRT_FILL_4 = makeDirtFill(4); + public static final ICharm DIRT_FILL_6 = makeDirtFill(6); + + public static final ICharm DIRT_WALK_2 = makeDirtWalk(2); + public static final ICharm DIRT_WALK_4 = makeDirtWalk(4); + public static final ICharm DIRT_WALK_6 = makeDirtWalk(6); + + public static final ICharm RUIN_1 = makeRuin(1); + public static final ICharm RUIN_3 = makeRuin(3); + public static final ICharm RUIN_5 = makeRuin(5); + public static final ICharm RUIN_7 = makeRuin(7); + public static final ICharm RUIN_9 = makeRuin(9); + public static final ICharm RUIN_11 = makeRuin(11); + static { // register METAL_REGISTRY.put(COPPER.getName(), COPPER); METAL_REGISTRY.put(SILVER.getName(), SILVER); METAL_REGISTRY.put(GOLD.getName(), GOLD); - - EVENT_CHARM_MAP.put(LivingUpdateEvent.class, HealingCharm.HEALING_TYPE); - - TreasureCharmRegistry.register(HEALING_1); - TreasureCharmRegistry.register(HEALING_2); - TreasureCharmRegistry.register(HEALING_3); - TreasureCharmRegistry.register(HEALING_4); - TreasureCharmRegistry.register(HEALING_5); - TreasureCharmRegistry.register(HEALING_6); - TreasureCharmRegistry.register(HEALING_7); - TreasureCharmRegistry.register(HEALING_8); - TreasureCharmRegistry.register(HEALING_9); - TreasureCharmRegistry.register(HEALING_10); - TreasureCharmRegistry.register(HEALING_11); - TreasureCharmRegistry.register(HEALING_12); - TreasureCharmRegistry.register(HEALING_13); - TreasureCharmRegistry.register(HEALING_14); - TreasureCharmRegistry.register(HEALING_15); - - TreasureCharmRegistry.register(SHIELDING_1); - TreasureCharmRegistry.register(SHIELDING_2); - TreasureCharmRegistry.register(SHIELDING_3); - TreasureCharmRegistry.register(SHIELDING_4); - TreasureCharmRegistry.register(SHIELDING_5); - TreasureCharmRegistry.register(SHIELDING_6); - TreasureCharmRegistry.register(SHIELDING_7); - TreasureCharmRegistry.register(SHIELDING_8); - TreasureCharmRegistry.register(SHIELDING_9); - TreasureCharmRegistry.register(SHIELDING_10); - TreasureCharmRegistry.register(SHIELDING_11); - TreasureCharmRegistry.register(SHIELDING_12); - TreasureCharmRegistry.register(SHIELDING_13); - TreasureCharmRegistry.register(SHIELDING_14); - TreasureCharmRegistry.register(SHIELDING_15); } /** @@ -143,9 +264,9 @@ public class TreasureCharms { * @param event */ public static void setup(FMLCommonSetupEvent event) { -// TOPAZ = new CharmableMaterial(1, Items.TOPAZ.getRegistryName(), 4, 1); + TOPAZ = new CharmableMaterial(1, TreasureItems.TOPAZ.getRegistryName(), 4, 1); DIAMOND = new CharmableMaterial(2, Items.DIAMOND.getRegistryName(), 5, 3); -// ONYX = new CharmableMaterial(3, Items.ONYX.getRegistryName(), 6, 3); + ONYX = new CharmableMaterial(3, TreasureItems.ONYX.getRegistryName(), 6, 3); EMERALD = new CharmableMaterial(4, Items.EMERALD.getRegistryName(), 7, 3); RUBY = new CharmableMaterial(5, TreasureItems.RUBY.getRegistryName(), 9, 4); SAPPHIRE = new CharmableMaterial(6, TreasureItems.SAPPHIRE.getRegistryName() , 11, 6); @@ -155,34 +276,202 @@ public static void setup(FMLCommonSetupEvent event) { // regerister GEM_REGISTRY.put(DIAMOND.getName(), DIAMOND); GEM_REGISTRY.put(EMERALD.getName(), EMERALD); -// GEM_REGISTRY.put(TOPAZ.getName(), TOPAZ); -// GEM_REGISTRY.put(ONYX.getName(), ONYX); + GEM_REGISTRY.put(TOPAZ.getName(), TOPAZ); + GEM_REGISTRY.put(ONYX.getName(), ONYX); GEM_REGISTRY.put(RUBY.getName(), RUBY); GEM_REGISTRY.put(SAPPHIRE.getName(), SAPPHIRE); GEM_REGISTRY.put(WHITE_PEARL.getName(), WHITE_PEARL); GEM_REGISTRY.put(BLACK_PEARL.getName(), WHITE_PEARL); } + public static Comparator levelComparator = new Comparator() { + @Override + public int compare(CharmableMaterial p1, CharmableMaterial p2) { + return Integer.compare(p1.getMaxLevel(), p2.getMaxLevel()); + } + }; + + public static List getGemValues() { + return new ArrayList<>(GEM_REGISTRY.values()); + } + /** * Convenience method to build Healing Charm. * @param level * @return */ public static ICharm makeHealing(int level) { - return new HealingCharm.Builder(level).with($ -> { + ICharm charm = new HealingCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeGreaterHealing(int level) { + ICharm charm = new GreaterHealingCharm.Builder(level).with($ -> { $.value = level * 20.0; $.effectStackable = true; $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; }) .build(); + TreasureCharmRegistry.register(charm); + return charm; } public static ICharm makeShielding(int level) { - return new ShieldingCharm.Builder(level).with($ -> { + ICharm charm = new ShieldingCharm.Builder(level).with($ -> { $.value = level * 20.0; $.percent = level < 4 ? 0.5 : level < 7 ? 0.6 : level < 10 ? 0.7 : 0.8; $.effectStackable = true; $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; }) .build(); + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeAegis(int level) { + ICharm charm = new AegisCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.effectStackable = false; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeFireImmunity(int level) { + ICharm charm = new FireImmunityCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.effectStackable = false; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeFireResistence(int level) { + ICharm charm = new FireResistenceCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.percent = level < 6 ? 0.3 : level < 11 ? 0.5 : 0.8; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeSatiety(int level) { + ICharm charm = new SatietyCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeLifeStrike(int level) { + ICharm charm = new LifeStrikeCharm.Builder(level).with($ -> { + $.value = level * 20.0; + $.percent = level < 4 ? 1.2 : level < 7 ? 1.4 : level < 10 ? 1.6 : level < 13 ? 1.8 : 2.0; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeReflection(int level) { + ICharm charm = new ReflectionCharm.Builder(level).with($ -> { + $.value = level < 8 ? (level * 10.0 + 10.0) : ((level -7) * 10.0 + 10.0); + $.percent = level < 3 ? 0.2 : level < 5 ? 0.35 : level < 7 ? 0.50 : level <9 ? 0.65 : level < 11 ? 0.8 : level < 13 ? 0.95 : 1.1; + $.duration = level < 4 ? 2D : level < 7 ? 3D : level < 10 ? 4D : level < 13 ? 5D : 6D; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeDrain(int level) { + ICharm charm = new DrainCharm.Builder(level).with($ -> { + $.value = level < 8 ? (level * 10.0 + 10.0) : ((level -7) * 10.0 + 10.0); + $.duration = level < 4 ? 2D : level < 7 ? 3D : level < 10 ? 4D : level < 13 ? 5D : 6D; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(charm); + return charm; + } + + public static ICharm makeIllumination(int level) { + ICharm charm = new IlluminationCharm.Builder(level).with($ -> { + $.value = level < 4 ? 3D : level < 7 ? 6D : 30D; + $.effectStackable = false; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(charm); + return charm; + } + + // curses + public static ICharm makeDecay(int level) { + ICharm curse = new DecayCurse.Builder(level).with($ -> { + $.value = level * 20.0; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(curse); + return curse; + } + + public static ICharm makeDecrepit(int level) { + ICharm curse = new DecrepitCurse.Builder(level).with($ -> { + $.value = level * 10.0 + 10.0; + $.percent = 1D + ((level + (level % 2))/20); +// $.duration = 20.0; set in 1.12.2 but not used. + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(curse); + return curse; + } + + public static ICharm makeDirtFill(int level) { + ICharm curse = new DirtFillCurse.Builder(level).with($ -> { + $.value = level * 25D; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(curse); + return curse; + } + + public static ICharm makeDirtWalk(int level) { + ICharm curse = new DirtWalkCurse.Builder(level).with($ -> { + $.value = level * 25D; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(curse); + return curse; + } + + public static ICharm makeRuin(int level) { + ICharm charm = new RuinCurse.Builder(level).with($ -> { + $.value = level *20D; + $.duration = level < 4 ? 20D : level < 7 ? 17D : level < 10 ? 15D : level < 13 ? 13D : 10D; + $.effectStackable = true; + $.rarity = level < 4 ? Rarity.COMMON : level < 7 ? Rarity.UNCOMMON : level < 10 ? Rarity.SCARCE : level < 13 ? Rarity.RARE : Rarity .EPIC; + }) .build(); + TreasureCharmRegistry.register(charm); + return charm; } public static Optional getBaseMaterial(ResourceLocation name) { @@ -191,16 +480,6 @@ public static Optional getBaseMaterial(ResourceLocation name) } return Optional.empty(); } - - /** - * Accesor wrapp method to return if an charm type is registered to an event. - * @param event - * @param type - * @return - */ - public static boolean isCharmEventRegistered(Class event, String type) { - return EVENT_CHARM_MAP.containsEntry(event, type); - } /** * Accessor wrapper method to return Optional sourceItem diff --git a/src/main/java/com/someguyssoftware/treasure2/command/CharmItemArgument.java b/src/main/java/com/someguyssoftware/treasure2/command/CharmItemArgument.java new file mode 100644 index 000000000..9be720dc0 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/command/CharmItemArgument.java @@ -0,0 +1,16 @@ +package com.someguyssoftware.treasure2.command; + +import java.util.concurrent.CompletableFuture; + +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.suggestion.Suggestions; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; + +import net.minecraft.command.arguments.ItemArgument; + +public class CharmItemArgument extends ItemArgument { + + public CompletableFuture listSuggestions(CommandContext p_listSuggestions_1_, SuggestionsBuilder sb) { + return sb.suggest("treasure2:copper_charm").buildFuture(); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/command/SpawnCharmCommand.java b/src/main/java/com/someguyssoftware/treasure2/command/SpawnCharmCommand.java new file mode 100644 index 000000000..621e851c8 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/command/SpawnCharmCommand.java @@ -0,0 +1,107 @@ +/** + * + */ +package com.someguyssoftware.treasure2.command; + +import java.util.Arrays; +import java.util.Collection; +import java.util.EnumSet; +import java.util.List; +import java.util.Optional; +import java.util.Random; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.suggestion.SuggestionProvider; +import com.someguyssoftware.gottschcore.loot.LootTableShell; +import com.someguyssoftware.gottschcore.random.RandomWeightedCollection; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.block.TreasureBlocks; +import com.someguyssoftware.treasure2.charm.ICharm; +import com.someguyssoftware.treasure2.data.TreasureData; +import com.someguyssoftware.treasure2.enums.ChestGeneratorType; +import com.someguyssoftware.treasure2.enums.Rarity; +import com.someguyssoftware.treasure2.enums.WorldGenerators; +import com.someguyssoftware.treasure2.generator.chest.IChestGenerator; +import com.someguyssoftware.treasure2.item.CharmItem; +import com.someguyssoftware.treasure2.tileentity.AbstractTreasureChestTileEntity; + +import net.minecraft.block.Block; +import net.minecraft.command.CommandSource; +import net.minecraft.command.Commands; +import net.minecraft.command.ISuggestionProvider; +import net.minecraft.command.arguments.BlockPosArgument; +import net.minecraft.command.arguments.EntityArgument; +import net.minecraft.command.arguments.ItemArgument; +import net.minecraft.command.arguments.ItemInput; +import net.minecraft.command.arguments.ResourceLocationArgument; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.inventory.ItemStackHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; +import net.minecraft.world.server.ServerWorld; + +/** + * + * @author Mark Gottschling on Aug 20, 2021 + * + */ +public class SpawnCharmCommand { + public static void register(CommandDispatcher dispatcher) { + dispatcher + .register(Commands.literal("t2-charm") + .requires(source -> { + return source.hasPermission(2); + }) + .then(Commands.argument("targets", EntityArgument.players()) + .then(Commands.argument("charm",ResourceLocationArgument.id()) + .suggests(SUGGEST_CHARM) + .executes((source) -> { + return giveCharm(source.getSource(), ResourceLocationArgument.getId(source, "charm"), EntityArgument.getPlayers(source, "targets"), 1); + }) + + // .then(Commands.argument("pos", BlockPosArgument.blockPos()) + // .executes(source -> { + // return spawn(source.getSource(), BlockPosArgument.getOrLoadBlockPos(source, "pos"), ""); + // }) + // .then(Commands.argument("name", StringArgumentType.string()) + // .suggests(SUGGEST_CHARM).executes(source -> { + // return spawn(source.getSource(), BlockPosArgument.getOrLoadBlockPos(source, "pos"), + // StringArgumentType.getString(source, "name")); + // }) + // ) + // ) + ) + ) + ); + } + + private static final SuggestionProvider SUGGEST_CHARM = (source, builder) -> { + return ISuggestionProvider.suggest(Arrays.asList("treasure2:copper_charm", "treasure2:silver_charm", "treasure2:gold_charm").stream(), builder); + }; + + private static int giveCharm(CommandSource source, ResourceLocation charmLocation, Collection players, int p_198497_3_) throws CommandSyntaxException { + Treasure.LOGGER.debug("spawn charm resource location -> {}", charmLocation); + // ResourceLocation charmLocation = new ResourceLocation(charmItemName); + Item item = Registry.ITEM.getOptional(charmLocation).orElseThrow(IllegalStateException::new); + if (item instanceof CharmItem) { + for(ServerPlayerEntity player : players) { + ItemStack stack = new ItemStack(item, 1); + // TODO get capability + // TODO add random charms + + + boolean flag = player.inventory.add(stack); +// TODO look at give for rest of it. + } + } + return 1; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/command/TreasureCommands.java b/src/main/java/com/someguyssoftware/treasure2/command/TreasureCommands.java index fdd2a15e8..55365531b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/command/TreasureCommands.java +++ b/src/main/java/com/someguyssoftware/treasure2/command/TreasureCommands.java @@ -23,5 +23,6 @@ public static void onServerStarting(RegisterCommandsEvent event) { SpawnWellCommand.register(event.getDispatcher()); SpawnRuinsCommand.register(event.getDispatcher()); SpawnProximitySpawnerCommand.register(event.getDispatcher()); + SpawnCharmCommand.register(event.getDispatcher()); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java index d874f4fe1..e620639c7 100644 --- a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java +++ b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java @@ -112,6 +112,8 @@ public static class ItemID { public static final String COPPER_COIN_ID = "copper_coin"; public static final String SILVER_COIN_ID = "silver_coin"; public static final String GOLD_COIN_ID = "gold_coin"; + public static final String TOPAZ_ID = "topaz"; + public static final String ONYX_ID = "onyx"; public static final String SAPPHIRE_ID = "sapphire"; public static final String RUBY_ID = "ruby"; public static final String WHITE_PEARL_ID = "white_pearl"; @@ -121,7 +123,8 @@ public static class ItemID { public static final String WITHER_ROOT_ITEM_ID = "wither_root_item"; public static final String SKELETON_ITEM_ID = "skeleton"; public static final String EYE_PATCH_ID = "eye_patch"; - public static final String SPANISH_MOSS_ITEM_ID = "spanish_moss_item"; + public static final String SPANISH_MOSS_ITEM_ID = "spanish_moss_item"; + } public static class LockID { @@ -294,7 +297,9 @@ public static class General { builder.comment(CATEGORY_DIV, " General properties for Treasure mod.", CATEGORY_DIV).push("general"); enableDefaultLootTablesCheck = builder - .comment(" Enable/Disable a check to ensure the default loot tables exist on the file system.", "If enabled, then you will not be able to remove any default loot tables (but they can be edited).", "Only disable if you know what you're doing.") + .comment(" Enable/Disable a check to ensure the default loot tables exist on the file system.", "If enabled, then you will not be able to remove any default loot tables (but they can be edited).", + "This option should be enabled at least for the first run of the mod to create the default settings.", + "Only disable if you know what you're doing.") .define("Enable default loot tables check:", true); enableDefaultTemplatesCheck = builder diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java index 361183cab..7b075dbdb 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java @@ -197,7 +197,8 @@ private static List gatherCharms(Event event, ServerPlayerEntity p for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); // OR just check with the charm for allowable event - if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { +// if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { + if (!entity.getCharm().getRegisteredEvent().equals(event.getClass())) { Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); continue; } diff --git a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java index e7451474a..dcf79142a 100644 --- a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java +++ b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java @@ -29,6 +29,7 @@ import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.data.TreasureData; import com.someguyssoftware.treasure2.item.TreasureItems; +import com.someguyssoftware.treasure2.loot.TreasureLootFunctions; import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; import com.someguyssoftware.treasure2.registry.TreasureDecayRegistry; import com.someguyssoftware.treasure2.registry.TreasureMetaRegistry; @@ -55,6 +56,9 @@ public static void common(final FMLCommonSetupEvent event) { // add mod specific logging IModSetup.addRollingFileAppender(Treasure.instance.getName(), null); + // regsiter functions + TreasureLootFunctions.register(); + // register capabilities TreasureCapabilities.register(); diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index 798f1a215..83ff2d158 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -127,6 +127,8 @@ public class TreasureItems { public static Item GOLD_COIN; // gems + public static Item TOPAZ; + public static Item ONYX; public static Item SAPPHIRE; public static Item RUBY; public static Item WHITE_PEARL; @@ -137,6 +139,7 @@ public class TreasureItems { public static CharmItem SILVER_CHARM; public static CharmItem GOLD_CHARM; public static CharmItem TEST_CHARM; + public static CharmItem IMBUED_BOOK; // wither items public static Item WITHER_STICK_ITEM; @@ -369,6 +372,29 @@ public ItemStack getDefaultLootKey (Random random) { }; // GEMS + TOPAZ = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.TOPAZ_ID, new Item.Properties()) { + @Override + public List getLootTables() { + return TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.SCARCE); + } + @Override + public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.SCARCE)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + }; + ONYX = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.ONYX_ID, new Item.Properties()) { + @Override + public List getLootTables() { + return TreasureLootTableRegistry.getLootTableMaster().getLootTableByRarity(Rarity.RARE); + } + @Override + public ItemStack getDefaultLootKey (Random random) { + List keys = new ArrayList<>(TreasureItems.keys.get(Rarity.RARE)); + return new ItemStack(keys.get(random.nextInt(keys.size()))); + } + }; + RUBY = new WealthItem(Treasure.MODID, TreasureConfig.ItemID.RUBY_ID, new Item.Properties()) { @Override public List getLootTables() { @@ -422,7 +448,7 @@ public ItemStack getDefaultLootKey (Random random) { COPPER_CHARM = new CharmItem(Treasure.MODID, "copper_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { - $.finite(true, 1); + $.innate(true, 1); $.bindable(true); $.source(true) .baseMaterial(TreasureCharms.COPPER.getName()); @@ -433,7 +459,7 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { SILVER_CHARM = new CharmItem(Treasure.MODID, "silver_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { - $.finite(true, 1); + $.innate(true, 1); $.bindable(true); $.source(true) .baseMaterial(TreasureCharms.SILVER.getName()); @@ -444,7 +470,7 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { GOLD_CHARM = new CharmItem(Treasure.MODID, "gold_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { - $.finite(true, 1); + $.innate(true, 1); $.bindable(true); $.source(true) .baseMaterial(TreasureCharms.GOLD.getName()); @@ -452,19 +478,29 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { return new CharmableCapabilityProvider(cap); } }; + IMBUED_BOOK = new CharmItem(Treasure.MODID, "imbued_book", new Item.Properties()) { + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { + $.innate(true, 1); + $.imbuing(true); + $.source(true); + }).build(); + return new CharmableCapabilityProvider(cap); + } + }; // TODO create a Builder for Charms TEST_CHARM = new CharmItem(Treasure.MODID, "test_charm", new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(SAPPHIRE.getRegistryName()).with($ -> { - $.finite(true, 1); + $.innate(true, 1); $.bindable(true); $.source(true); $.baseMaterial(TreasureCharms.COPPER.getName()); }).build(); // add charms - cap.add(InventoryType.FINITE, TreasureCharms.HEALING_6.createEntity()); + cap.add(InventoryType.INNATE, TreasureCharms.HEALING_6.createEntity()); stack.setHoverName(new StringTextComponent("Test Charm")); return new CharmableCapabilityProvider(cap); } @@ -525,7 +561,10 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { COPPER_CHARM, SILVER_CHARM, GOLD_CHARM, + IMBUED_BOOK, TEST_CHARM, + TOPAZ, + ONYX, RUBY, SAPPHIRE, WHITE_PEARL, diff --git a/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootFunctions.java b/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootFunctions.java new file mode 100644 index 000000000..31eb6b3c0 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootFunctions.java @@ -0,0 +1,53 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.loot; + +import com.someguyssoftware.treasure2.loot.function.CharmRandomly; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.loot.LootFunctionType; +import net.minecraft.util.registry.Registry; + +/** + * + * @author Mark Gottschling on Aug 20, 2021 + * + */ +public class TreasureLootFunctions { + + public static LootFunctionType CHARM_RANDOMLY; + + /** + * + */ + public static void register() { + CHARM_RANDOMLY = register("charm_randomly", new LootFunctionType(new CharmRandomly.Serializer())); + } + + /** + * + * @param name + * @param type + * @return + */ + public static LootFunctionType register(String name, LootFunctionType type) { + return Registry.register(Registry.LOOT_FUNCTION_TYPE, ModUtils.asLocation(name), type); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableMaster2.java b/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableMaster2.java index 27f6bf459..03ea77854 100644 --- a/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableMaster2.java +++ b/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableMaster2.java @@ -20,8 +20,11 @@ package com.someguyssoftware.treasure2.loot; import java.io.IOException; -import java.lang.reflect.Field; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; @@ -30,7 +33,6 @@ import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; @@ -48,12 +50,17 @@ import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.someguyssoftware.gottschcore.loot.LootTableMaster2; import com.someguyssoftware.gottschcore.loot.LootTableShell; import com.someguyssoftware.gottschcore.mod.IMod; +import com.someguyssoftware.gottschcore.version.BuildVersion; +import com.someguyssoftware.gottschcore.version.VersionChecker; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.enums.Rarity; +import net.minecraft.loot.RandomValueRange; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; @@ -65,24 +72,24 @@ * SRG names for MinecraftServer * * field_240767_f_ -> Impl -* field name -> field_152367_a, class -> File -* field name -> field_213219_c, class -> WorldSettings -* field_71310_m, class -> LevelSave -* field_240766_e_, class -> PlayerData -* field_240767_f_, class -> Impl -* field_110456_c, class -> Proxy -* field_71311_j, class -> long[] -* field_240768_i_, class -> ServerWorldInfo -* field_147145_h, class -> Logger -* field_71307_n, class -> Snooper -* field_71322_p, class -> ArrayList -* field_240769_m_, class -> TimeTracker -* field_71304_b, class -> EmptyProfiler -* field_147144_o, class -> NetworkSystem -* field_213220_d, class -> Minecraft$$Lambda$5286/1287817936 -* field_147147_p, class -> ServerStatusResponse -* field_147146_q, class -> Random -* field_184112_s, class -> DataFixerUpper + * field name -> field_152367_a, class -> File + * field name -> field_213219_c, class -> WorldSettings + * field_71310_m, class -> LevelSave + * field_240766_e_, class -> PlayerData + * field_240767_f_, class -> Impl + * field_110456_c, class -> Proxy + * field_71311_j, class -> long[] + * field_240768_i_, class -> ServerWorldInfo + * field_147145_h, class -> Logger + * field_71307_n, class -> Snooper + * field_71322_p, class -> ArrayList + * field_240769_m_, class -> TimeTracker + * field_71304_b, class -> EmptyProfiler + * field_147144_o, class -> NetworkSystem + * field_213220_d, class -> Minecraft$$Lambda$5286/1287817936 + * field_147147_p, class -> ServerStatusResponse + * field_147146_q, class -> Random + * field_184112_s, class -> DataFixerUpper * field_195576_ac = DataPackRegistries * field_240765_ak_ = TemplateManager */ @@ -102,14 +109,14 @@ public static enum ManagedTableType { public static Logger LOGGER = LogManager.getLogger(Treasure.LOGGER.getName()); + private static final Gson GSON_INSTANCE = (new GsonBuilder()) + .registerTypeAdapter(RandomValueRange.class, new RandomValueRange.Serializer()).create(); // public static final String CUSTOM_LOOT_TABLES_RESOURCE_PATH = "/loot_tables/"; public static final String CUSTOM_LOOT_TABLE_KEY = "CUSTOM"; - private static final String SAVE_FORMAT_LEVEL_SAVE_SRG_NAME = "field_71310_m"; - /* * Guava Table of loot table ResourceLocations for Chests based on LootTableManager-key and Rarity */ @@ -155,10 +162,10 @@ public TreasureLootTableMaster2(IMod mod) { super(mod); // initialize the maps -// for (Rarity r : Rarity.values()) { -// CHEST_LOOT_TABLES_RESOURCE_LOCATION_TABLE.put(CUSTOM_LOOT_TABLE_KEY, r, new ArrayList()); -// CHEST_LOOT_TABLES_TABLE.put(CUSTOM_LOOT_TABLE_KEY, r, new ArrayList()); -// } + // for (Rarity r : Rarity.values()) { + // CHEST_LOOT_TABLES_RESOURCE_LOCATION_TABLE.put(CUSTOM_LOOT_TABLE_KEY, r, new ArrayList()); + // CHEST_LOOT_TABLES_TABLE.put(CUSTOM_LOOT_TABLE_KEY, r, new ArrayList()); + // } } // TODO possibly remove or get new name @@ -170,97 +177,97 @@ public void init(ServerWorld world) { CHEST_LOOT_TABLES_RESOURCE_LOCATION_TABLE.put(CUSTOM_LOOT_TABLE_KEY, r, new ArrayList()); CHEST_LOOT_TABLES_TABLE.put(CUSTOM_LOOT_TABLE_KEY, r, new ArrayList()); } - -// Path path = Paths.get(world.getSaveHandler().getWorldDirectory().getPath(), "datapacks", "treasure2"); + + // Path path = Paths.get(world.getSaveHandler().getWorldDirectory().getPath(), "datapacks", "treasure2"); Object save = ObfuscationReflectionHelper.getPrivateValue(MinecraftServer.class, world.getServer(), SAVE_FORMAT_LEVEL_SAVE_SRG_NAME); -// List list = Arrays.asList( -// "field_152367_a","field_213219_c" -// ,"field_71310_m" -// ,"field_240766_e_" -// ,"field_240767_f_" -// ,"field_110456_c" -// ,"field_71311_j" -// ,"field_240768_i_" -// ,"field_147145_h" -// ,"field_71307_n" -// ,"field_71322_p" -// ,"field_240769_m_" -// ,"field_71304_b" -// ,"field_147144_o" -// ,"field_213220_d" -// ,"field_147147_p" -// ,"field_147146_q" -// ,"field_184112_s" -// "field_71320_r" -// ,"field_71319_s" -// ,"field_71305_c" -// ,"field_71318_t" -// ,"field_71317_u" -// ,"field_71316_v" -// ,"field_71315_w" -// ,"field_71325_x" -// ,"field_190519_A" -// ,"field_71284_A" -// ,"field_71285_B" -// ,"field_71286_C" -// ,"field_71280_D" -// ,"field_143008_E" -// ,"field_71292_I" -// ,"field_71293_J" -// ,"field_71288_M" -// ,"field_147141_M" -// ,"field_175588_P" -// ,"field_71296_Q" -// ,"field_71299_R" -// ,"field_71295_T" -// ,"field_104057_T" -// ,"field_147143_S" -// ,"field_152365_W" -// ,"field_152366_X" -// ,"field_147142_T" -// ,"field_175590_aa" -// ,"field_211151_aa" -// ,"field_213213_ab" -// ,"field_213214_ac" -// ,"field_184111_ab" -// ,"field_195577_ad" -// ,"field_200255_ai" -// ,"field_229733_al_" -// ,"field_201301_aj" -// ,"field_200258_al" -// ,"field_213215_ap" -// ,"field_205745_an" -// ,"field_211152_ao" -// ,"field_213217_au" -// ,"field_213218_av"); -// Field field = ObfuscationReflectionHelper.findField(MinecraftServer.class, "field_213218_av"); -// for (String s : list) { -// try { -// Treasure.LOGGER.debug("getting field -> {}", s); -// Field f = world.getServer().getClass().getSuperclass().getDeclaredField(s); -//// Field f = b.getClass().getSuperclass().getDeclaredField("i"); -// f.setAccessible(true); -// Object o = f.get(world.getServer()); -// if (f != null && o != null) { -// Treasure.LOGGER.debug("field name -> {}, class -> {}", f.getName(), o.getClass().getSimpleName()); -// } -// } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { -// Treasure.LOGGER.error("ERROR", e); -// } -// } - -// Treasure.LOGGER.debug("field name -> {}", field.getName()); -// Object save = null; -// try { -// save = field.get(world.getServer()); -// Treasure.LOGGER.debug("field name -> {}, class -> {}", field.getName(), save.getClass().getSimpleName()); -// } catch (IllegalArgumentException e) { -// Treasure.LOGGER.error("ERROR", e); -// } catch (IllegalAccessException e) { -// Treasure.LOGGER.error("ERROR", e); -// } - + // List list = Arrays.asList( + // "field_152367_a","field_213219_c" + // ,"field_71310_m" + // ,"field_240766_e_" + // ,"field_240767_f_" + // ,"field_110456_c" + // ,"field_71311_j" + // ,"field_240768_i_" + // ,"field_147145_h" + // ,"field_71307_n" + // ,"field_71322_p" + // ,"field_240769_m_" + // ,"field_71304_b" + // ,"field_147144_o" + // ,"field_213220_d" + // ,"field_147147_p" + // ,"field_147146_q" + // ,"field_184112_s" + // "field_71320_r" + // ,"field_71319_s" + // ,"field_71305_c" + // ,"field_71318_t" + // ,"field_71317_u" + // ,"field_71316_v" + // ,"field_71315_w" + // ,"field_71325_x" + // ,"field_190519_A" + // ,"field_71284_A" + // ,"field_71285_B" + // ,"field_71286_C" + // ,"field_71280_D" + // ,"field_143008_E" + // ,"field_71292_I" + // ,"field_71293_J" + // ,"field_71288_M" + // ,"field_147141_M" + // ,"field_175588_P" + // ,"field_71296_Q" + // ,"field_71299_R" + // ,"field_71295_T" + // ,"field_104057_T" + // ,"field_147143_S" + // ,"field_152365_W" + // ,"field_152366_X" + // ,"field_147142_T" + // ,"field_175590_aa" + // ,"field_211151_aa" + // ,"field_213213_ab" + // ,"field_213214_ac" + // ,"field_184111_ab" + // ,"field_195577_ad" + // ,"field_200255_ai" + // ,"field_229733_al_" + // ,"field_201301_aj" + // ,"field_200258_al" + // ,"field_213215_ap" + // ,"field_205745_an" + // ,"field_211152_ao" + // ,"field_213217_au" + // ,"field_213218_av"); + // Field field = ObfuscationReflectionHelper.findField(MinecraftServer.class, "field_213218_av"); + // for (String s : list) { + // try { + // Treasure.LOGGER.debug("getting field -> {}", s); + // Field f = world.getServer().getClass().getSuperclass().getDeclaredField(s); + //// Field f = b.getClass().getSuperclass().getDeclaredField("i"); + // f.setAccessible(true); + // Object o = f.get(world.getServer()); + // if (f != null && o != null) { + // Treasure.LOGGER.debug("field name -> {}, class -> {}", f.getName(), o.getClass().getSimpleName()); + // } + // } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + // Treasure.LOGGER.error("ERROR", e); + // } + // } + + // Treasure.LOGGER.debug("field name -> {}", field.getName()); + // Object save = null; + // try { + // save = field.get(world.getServer()); + // Treasure.LOGGER.debug("field name -> {}, class -> {}", field.getName(), save.getClass().getSimpleName()); + // } catch (IllegalArgumentException e) { + // Treasure.LOGGER.error("ERROR", e); + // } catch (IllegalAccessException e) { + // Treasure.LOGGER.error("ERROR", e); + // } + if (save instanceof SaveFormat.LevelSave) { Path path = ((SaveFormat.LevelSave) save).getWorldDir().resolve("datapacks").resolve("treasure2"); setWorldDataBaseFolder(path.toFile()); @@ -304,7 +311,7 @@ protected void createPack() { Treasure.LOGGER.error("Unable to create pack.mcmeta:", e); } } - + /** * TODO move this to GottschCore as this will be the defacto way to do it in 1.15+ * NOTE this doesn't check the versions of the resource file vs the file system file - just checks for the existance on the file system. @@ -318,21 +325,99 @@ public void buildAndExpose(String basePath, String modID, List resourceR Path fileSystemFilePath = Paths.get(getMod().getConfig().getConfigFolder(), getMod().getId(), "mc1_16", basePath, resourceRelativePath); Treasure.LOGGER.debug("TreasureLootTableMaster2 | buildAndExpose | file system path -> {}", fileSystemFilePath.toString()); try { + Path resourcePath = Paths.get("data", modID, basePath, resourceRelativePath); + Treasure.LOGGER.debug("TreasureLootTableMaster2 | buildAndExpose | full resource path -> {}", resourcePath.toString()); + + // TODO don't like the FileUtils.copyInputStreamToFile is duplicated in both conditions. + // TODO don't like that resourcePath is gotten 2x as a stream - once in isFilesystemVersionCurrent and again after that. + // check if file already exists if (Files.notExists(fileSystemFilePath)) { -// Path resourcePath = Paths.get(basePath, modID, resourceRelativePath); - Path resourcePath = Paths.get("data", modID, basePath, resourceRelativePath); - Treasure.LOGGER.debug("TreasureLootTableMaster2 | buildAndExpose | full resource path -> {}", resourcePath.toString()); - FileUtils.copyInputStreamToFile(Objects.requireNonNull(Treasure.class.getClassLoader().getResourceAsStream(resourcePath.toString())), + FileUtils.copyInputStreamToFile(Objects.requireNonNull(Treasure.class.getClassLoader().getResourceAsStream(resourcePath.toString())), fileSystemFilePath.toFile()); // TODO add a flag if a file was copied over - save it in the manager } + // NOTE remember, i couldn't load the json as a resource because it had some bizarre file path and wouldn't let me load. + else { + boolean isCurrent = false; + try { + isCurrent = isFileSystemVersionCurrent(resourcePath, fileSystemFilePath); + } + catch(Exception e) { + Treasure.LOGGER.warn(e.getMessage(), e); + return; + } + Treasure.LOGGER.error("is file system (config) loot table current -> {}", isCurrent); + if (!isCurrent) { + // make a backup of the file system file + FileUtils.copyFile(fileSystemFilePath.toFile(), Paths.get(fileSystemFilePath.toString() + ".bak").toFile()); + // copy the resource to the file system + FileUtils.copyInputStreamToFile(Objects.requireNonNull(Treasure.class.getClassLoader().getResourceAsStream(resourcePath.toString())), + fileSystemFilePath.toFile()); + } + } } catch (Exception e) { Treasure.LOGGER.error("Copying loot table resources error:", e); } }); } + /** + * TODO Replace the version in GottschCore with this one. + */ + @Override + protected boolean isFileSystemVersionCurrent(Path resourceFilePath, Path fileSystemFilePath) throws Exception { + boolean result = true; + Treasure.LOGGER.debug("Verifying the most current version for the loot table -> {} ...", fileSystemFilePath.getFileName()); + + // file system loot table - can't load as a resource at this location + String configJson; + try { + configJson = com.google.common.io.Files.toString(fileSystemFilePath.toFile(), StandardCharsets.UTF_8); + } + catch (IOException e) { + LOGGER.warn("Couldn't load config loot table from {}", fileSystemFilePath.toString(), e); + return false; + } + LootTableShell fileSystemLootTable = loadLootTable(configJson); + + // jar resource loot table + LootTableShell resourceLootTable = null; + try { + InputStream resourceStream = Treasure.class.getClassLoader().getResourceAsStream(resourceFilePath.toString()); + Reader reader = new InputStreamReader(resourceStream, StandardCharsets.UTF_8); + resourceLootTable = loadLootTable(reader); + } + catch(Exception e) { + throw new Exception(String.format("Couldn't load resource loot table %s ", resourceFilePath), e); + } + Treasure.LOGGER.debug("TreasureLootTableMaster2 | buildAndExpose | resource version -> {}", resourceLootTable.getVersion()); + Treasure.LOGGER.debug("\n\t...file system loot table -> {}\n\t...version -> {}\n\t...resource loot table -> {}\n\t...version -> {}", + fileSystemFilePath.toString(), + fileSystemLootTable.getVersion(), + resourceFilePath.toString(), + resourceLootTable.getVersion()); + + // compare versions + if (resourceLootTable != null && fileSystemLootTable != null) { + BuildVersion resourceVersion = new BuildVersion(resourceLootTable.getVersion()); + BuildVersion fsVersion = new BuildVersion(fileSystemLootTable.getVersion()); + result = VersionChecker.checkVersionUsingForge(resourceVersion, fsVersion); + } + return result; + + } + + /** + * + * @param reader + * @return + */ + public LootTableShell loadLootTable(Reader reader) { + return GSON_INSTANCE.fromJson(reader, LootTableShell.class); + } + + // /** * * @param modID @@ -447,118 +532,118 @@ public void registerInjects(String modID, List locations) { } } -// /** -// * Call in WorldEvent.Load event handler. -// * Overide this method if you have a different cache mechanism. -// * @param world -// * @param modID -// */ -// @Deprecated -// public void register(String modID) { -// // copy all folders/files from config to world data -// moveLootTables(modID, ""); -// -// for (String location : CHEST_LOOT_TABLE_FOLDER_LOCATIONS) { -// // get loot table files as ResourceLocations from the file system location -// List resourceLocations = getLootTablesResourceLocations(modID, location); -// // load each ResourceLocation as LootTable and map it. -// for (ResourceLocation resourceLocation : resourceLocations) { -// Path path = Paths.get(resourceLocation.getPath()); -// LOGGER.debug("path to resource loc -> {}", path.toString()); -// // map the loot table resource location -// Rarity key = Rarity.valueOf(path.getName(path.getNameCount()-2).toString().toUpperCase()); -// // add to resourcemap -// CHEST_LOOT_TABLES_RESOURCE_LOCATION_TABLE.get(CUSTOM_LOOT_TABLE_KEY, key).add(resourceLocation); -// // create loot table -// Optional lootTable = loadLootTable(getWorldDataBaseFolder(), resourceLocation); -// if (lootTable.isPresent()) { -// // add resource location to table -// lootTable.get().setResourceLocation(resourceLocation); -// // add loot table to map -// CHEST_LOOT_TABLES_TABLE.get(CUSTOM_LOOT_TABLE_KEY, key).add(lootTable.get()); -// LOGGER.debug("tabling loot table: {} {} -> {}", CUSTOM_LOOT_TABLE_KEY, key, resourceLocation); -// CHEST_LOOT_TABLES_MAP.put(resourceLocation, lootTable.get()); -// } -// else { -// LOGGER.debug("unable to load loot table from -> {} : {}", getWorldDataBaseFolder(), resourceLocation); -// } -// // register it with MC -// // Seems that you don't have to manually register loot tables anymore -// // ResourceLocation vanillaLoc = LootTables.register(resourceLocation); -// // LOGGER.debug("vanillaLoc -> {}", vanillaLoc); -// } -// } -// -// /* -// * register special loot tables -// */ -// for (String location : SPECIAL_CHEST_LOOT_TABLE_FOLDER_LOCATIONS) { -// List specialLocations = getLootTablesResourceLocations(modID, location); -// LOGGER.debug("size of special chest loot table locations -> {}", specialLocations.size()); -// // load each ResourceLocation as LootTable and map it. -// for (ResourceLocation resourceLocation : specialLocations) { -// Path path = Paths.get(resourceLocation.getPath()); -// LOGGER.debug("path to special resource loc -> {}", path.toString()); -// // create loot table -// Optional lootTable = loadLootTable(getWorldDataBaseFolder(), resourceLocation); -// if (lootTable.isPresent()) { -// // add resource location to table -// lootTable.get().setResourceLocation(resourceLocation); -// // add to map -// SpecialLootTables specialLootTables = SpecialLootTables.valueOf(com.google.common.io.Files.getNameWithoutExtension(path.getName(path.getNameCount()-1).toString().toUpperCase())); -// LOGGER.debug("special loot tables enum -> {}", specialLootTables); -// // add to special map -// SPECIAL_LOOT_TABLES_MAP.put(specialLootTables, lootTable.get()); -// LOGGER.debug("tabling special loot table: {} -> {}", specialLootTables, resourceLocation); -// // add to the resource location -> lootTableShell map -// CHEST_LOOT_TABLES_MAP.put(resourceLocation, lootTable.get()); -// // register with vanilla -// // LootTableList.register(resourceLocation); -// } -// else { -// LOGGER.debug("unable to load special loot table from -> {} : {}", getWorldDataBaseFolder(), resourceLocation); -// } -// } -// } -// -// /* -// * register inject loot tables -// * -// */ -// for (String location : INJECT_LOOT_TABLE_FOLDER_LOCATIONS) { -// List resourceLocations = getLootTablesResourceLocations(modID, location); -// for (ResourceLocation resourceLocation : resourceLocations) { -// Path path = Paths.get(resourceLocation.getPath()); -// LOGGER.debug("path to inject resource loc -> {}", path.toString()); -// // map the loot table resource location -// Rarity rarity = Rarity.valueOf(path.getName(path.getNameCount()-2).toString().toUpperCase()); -// // load loot table to get categories -// // create loot table -// Optional lootTable = loadLootTable(getWorldDataBaseFolder(), resourceLocation); -// if (lootTable.isPresent()) { -// // add resource location to table -// lootTable.get().setResourceLocation(resourceLocation); -// LOGGER.debug("loaded inject loot table shell -> {}", resourceLocation); -// List keys = lootTable.get().getCategories(); -// keys.forEach(key -> { -// LOGGER.debug("using inject key to table -> {}", key); -// key = key.isEmpty() ? "general" : key; -// if (!INJECT_LOOT_TABLES_RESOURCE_LOCATION_TABLE.containsRow(key)) { -// // initialize -// for (Rarity r : Rarity.values()) { -// INJECT_LOOT_TABLES_RESOURCE_LOCATION_TABLE.put(key, r, new ArrayList()); -// INJECT_LOOT_TABLES_TABLE.put(key, r, new ArrayList()); -// } -// } -// INJECT_LOOT_TABLES_RESOURCE_LOCATION_TABLE.get(key, rarity).add(resourceLocation); -// INJECT_LOOT_TABLES_TABLE.get(key, rarity).add(lootTable.get()); -// LOGGER.debug("tabling inject loot table: {} {} -> {}", key, rarity, resourceLocation); -// }); -// } -// // LootTableList.register(resourceLocation); -// } -// } -// } + // /** + // * Call in WorldEvent.Load event handler. + // * Overide this method if you have a different cache mechanism. + // * @param world + // * @param modID + // */ + // @Deprecated + // public void register(String modID) { + // // copy all folders/files from config to world data + // moveLootTables(modID, ""); + // + // for (String location : CHEST_LOOT_TABLE_FOLDER_LOCATIONS) { + // // get loot table files as ResourceLocations from the file system location + // List resourceLocations = getLootTablesResourceLocations(modID, location); + // // load each ResourceLocation as LootTable and map it. + // for (ResourceLocation resourceLocation : resourceLocations) { + // Path path = Paths.get(resourceLocation.getPath()); + // LOGGER.debug("path to resource loc -> {}", path.toString()); + // // map the loot table resource location + // Rarity key = Rarity.valueOf(path.getName(path.getNameCount()-2).toString().toUpperCase()); + // // add to resourcemap + // CHEST_LOOT_TABLES_RESOURCE_LOCATION_TABLE.get(CUSTOM_LOOT_TABLE_KEY, key).add(resourceLocation); + // // create loot table + // Optional lootTable = loadLootTable(getWorldDataBaseFolder(), resourceLocation); + // if (lootTable.isPresent()) { + // // add resource location to table + // lootTable.get().setResourceLocation(resourceLocation); + // // add loot table to map + // CHEST_LOOT_TABLES_TABLE.get(CUSTOM_LOOT_TABLE_KEY, key).add(lootTable.get()); + // LOGGER.debug("tabling loot table: {} {} -> {}", CUSTOM_LOOT_TABLE_KEY, key, resourceLocation); + // CHEST_LOOT_TABLES_MAP.put(resourceLocation, lootTable.get()); + // } + // else { + // LOGGER.debug("unable to load loot table from -> {} : {}", getWorldDataBaseFolder(), resourceLocation); + // } + // // register it with MC + // // Seems that you don't have to manually register loot tables anymore + // // ResourceLocation vanillaLoc = LootTables.register(resourceLocation); + // // LOGGER.debug("vanillaLoc -> {}", vanillaLoc); + // } + // } + // + // /* + // * register special loot tables + // */ + // for (String location : SPECIAL_CHEST_LOOT_TABLE_FOLDER_LOCATIONS) { + // List specialLocations = getLootTablesResourceLocations(modID, location); + // LOGGER.debug("size of special chest loot table locations -> {}", specialLocations.size()); + // // load each ResourceLocation as LootTable and map it. + // for (ResourceLocation resourceLocation : specialLocations) { + // Path path = Paths.get(resourceLocation.getPath()); + // LOGGER.debug("path to special resource loc -> {}", path.toString()); + // // create loot table + // Optional lootTable = loadLootTable(getWorldDataBaseFolder(), resourceLocation); + // if (lootTable.isPresent()) { + // // add resource location to table + // lootTable.get().setResourceLocation(resourceLocation); + // // add to map + // SpecialLootTables specialLootTables = SpecialLootTables.valueOf(com.google.common.io.Files.getNameWithoutExtension(path.getName(path.getNameCount()-1).toString().toUpperCase())); + // LOGGER.debug("special loot tables enum -> {}", specialLootTables); + // // add to special map + // SPECIAL_LOOT_TABLES_MAP.put(specialLootTables, lootTable.get()); + // LOGGER.debug("tabling special loot table: {} -> {}", specialLootTables, resourceLocation); + // // add to the resource location -> lootTableShell map + // CHEST_LOOT_TABLES_MAP.put(resourceLocation, lootTable.get()); + // // register with vanilla + // // LootTableList.register(resourceLocation); + // } + // else { + // LOGGER.debug("unable to load special loot table from -> {} : {}", getWorldDataBaseFolder(), resourceLocation); + // } + // } + // } + // + // /* + // * register inject loot tables + // * + // */ + // for (String location : INJECT_LOOT_TABLE_FOLDER_LOCATIONS) { + // List resourceLocations = getLootTablesResourceLocations(modID, location); + // for (ResourceLocation resourceLocation : resourceLocations) { + // Path path = Paths.get(resourceLocation.getPath()); + // LOGGER.debug("path to inject resource loc -> {}", path.toString()); + // // map the loot table resource location + // Rarity rarity = Rarity.valueOf(path.getName(path.getNameCount()-2).toString().toUpperCase()); + // // load loot table to get categories + // // create loot table + // Optional lootTable = loadLootTable(getWorldDataBaseFolder(), resourceLocation); + // if (lootTable.isPresent()) { + // // add resource location to table + // lootTable.get().setResourceLocation(resourceLocation); + // LOGGER.debug("loaded inject loot table shell -> {}", resourceLocation); + // List keys = lootTable.get().getCategories(); + // keys.forEach(key -> { + // LOGGER.debug("using inject key to table -> {}", key); + // key = key.isEmpty() ? "general" : key; + // if (!INJECT_LOOT_TABLES_RESOURCE_LOCATION_TABLE.containsRow(key)) { + // // initialize + // for (Rarity r : Rarity.values()) { + // INJECT_LOOT_TABLES_RESOURCE_LOCATION_TABLE.put(key, r, new ArrayList()); + // INJECT_LOOT_TABLES_TABLE.put(key, r, new ArrayList()); + // } + // } + // INJECT_LOOT_TABLES_RESOURCE_LOCATION_TABLE.get(key, rarity).add(resourceLocation); + // INJECT_LOOT_TABLES_TABLE.get(key, rarity).add(lootTable.get()); + // LOGGER.debug("tabling inject loot table: {} {} -> {}", key, rarity, resourceLocation); + // }); + // } + // // LootTableList.register(resourceLocation); + // } + // } + // } /** * @@ -567,7 +652,7 @@ public void registerInjects(String modID, List locations) { */ protected void moveLootTables(String modID, String location) { Path configFilePath = Paths.get(getMod().getConfig().getConfigFolder(), modID, "mc1_16", LOOT_TABLES_FOLDER, location).toAbsolutePath(); -// Path worldDataFilePath = Paths.get(getWorldDataBaseFolder().toString(), modID, location).toAbsolutePath(); + // Path worldDataFilePath = Paths.get(getWorldDataBaseFolder().toString(), modID, location).toAbsolutePath(); Path worldDataFilePath = Paths.get(getWorldDataBaseFolder().toString(), "data", modID, "loot_tables", location).toAbsolutePath(); Set fileList = new HashSet<>(); diff --git a/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableRegistry.java b/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableRegistry.java index 3ed5f50af..904318ab1 100644 --- a/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableRegistry.java +++ b/src/main/java/com/someguyssoftware/treasure2/loot/TreasureLootTableRegistry.java @@ -26,6 +26,7 @@ import com.someguyssoftware.gottschcore.json.JSMin; import com.someguyssoftware.gottschcore.mod.IMod; import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.config.TreasureConfig; import net.minecraft.server.MinecraftServer; import net.minecraft.world.server.ServerWorld; @@ -88,9 +89,11 @@ private static void buildAndExpose(String modID) { */ public static void register(final String modID) { if (!REGISTERED_MODS.contains(modID)) { - buildAndExpose(modID); - // copy all folders/files from config to world data - lootTableMaster.moveLootTables(modID, ""); + if (TreasureConfig.GENERAL.enableDefaultLootTablesCheck.get()) { + buildAndExpose(modID); + // copy all folders/files from config to world data + lootTableMaster.moveLootTables(modID, ""); + } lootTableMaster.registerChests(modID, lootResources.getChestLootTableFolderLocations()); lootTableMaster.registerSpecials(modID, lootResources.getSpecialLootTableFolderLocations()); lootTableMaster.registerInjects(modID, lootResources.getInjectLootTableFolderLocations()); diff --git a/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java b/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java new file mode 100644 index 000000000..e6cbd0baa --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java @@ -0,0 +1,264 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.loot.function; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Random; + +import javax.annotation.Nullable; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.CharmableMaterial; +import com.someguyssoftware.treasure2.charm.ICharm; +import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.charm.TreasureCharmRegistry; +import com.someguyssoftware.treasure2.charm.TreasureCharms; +import com.someguyssoftware.treasure2.loot.TreasureLootFunctions; +import com.someguyssoftware.treasure2.util.ModUtils; + +import net.minecraft.item.ItemStack; +import net.minecraft.loot.IRandomRange; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootFunction; +import net.minecraft.loot.LootFunctionType; +import net.minecraft.loot.RandomRanges; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; +import net.minecraft.util.JSONUtils; + +/** + * This function will add charms to the INNATE inventory of an item with CharmableCapability by default. + * @author Mark Gottschling on Aug 20, 2021 + * + */ +public class CharmRandomly extends LootFunction { + private List charms; + private IRandomRange levels; + private List gems; + private InventoryType type; + + /** + * + * @param conditions + */ + protected CharmRandomly(ILootCondition[] conditions, @Nullable List charms, IRandomRange range, InventoryType type) { + super(conditions); + this.charms = charms == null ? Collections.emptyList() : charms; + this.levels = range; + this.type = type; + } + + @Override + public LootFunctionType getType() { + return TreasureLootFunctions.CHARM_RANDOMLY; + } + + @Override + protected ItemStack run(ItemStack stack, LootContext context) { + Random rand = context.getRandom(); + Treasure.LOGGER.debug("selected item from charm pool -> {}", stack.getDisplayName()); + stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + Treasure.LOGGER.debug("has charm cap"); + ICharm charm = null; + + if (this.charms.isEmpty()) { + List tempCharms = new ArrayList<>(); + + // check the levels property + if(levels != null) { + int level = this.levels.getInt(rand); + // get all the charms from level + Optional> levelCharms = TreasureCharmRegistry.get(level); + if (levelCharms.isPresent()) { + tempCharms.addAll(levelCharms.get()); + } + } + else { + // if charms list is empty and levels are null, create a default list of minor charms + Optional> defaultCharms = TreasureCharmRegistry.get(level -> { + return level <= cap.getMaxCharmLevel(); + }); + if (defaultCharms.isPresent()) { + tempCharms.addAll(defaultCharms.get()); + } + } + Treasure.LOGGER.debug("temp charms size -> {}", tempCharms.size()); + if (!tempCharms.isEmpty()) { + // TEMP dump all charms + for (ICharm c : tempCharms) { + Treasure.LOGGER.debug("temp charm -> {}", c.getName().toString()); + } + // select a charm randomly + charm = tempCharms.get(rand.nextInt(tempCharms.size())); + Treasure.LOGGER.debug("selected charm for item -> {}", charm.getName().toString()); + } + } + else { + charm = charms.get(rand.nextInt(charms.size())); + Treasure.LOGGER.debug("selected charm for item -> {}", charm.getName().toString()); + } + + if (charm != null) { + Treasure.LOGGER.debug("charm is not null -> {}", charm.getName()); + List charmEntities = cap.getCharmEntities()[type.getValue()]; + // ensure that the item doesn't already have the same charm or same type or exceeded the maximum charms. + boolean previousCharmExists = false; + for (ICharmEntity entity : charmEntities) { + if (entity.getCharm().getType().equalsIgnoreCase(charm.getType()) || + entity.getCharm().getName().equals(charm.getName())) { + previousCharmExists = true; + break; + } + } + if (!previousCharmExists) { + Treasure.LOGGER.debug("adding charm to charm instances - > {}", charm.getName().toString()); + charmEntities.add(charm.createEntity()); + } + } + + // cycle thru all charms in stack inventory to determine highest level charm + int highestLevel = 0; + for (int index =0; index < InventoryType.values().length; index++) { + for (ICharmEntity entity : cap.getCharmEntities()[index]) { + if (entity.getCharm().getLevel() > highestLevel) { + highestLevel = entity.getCharm().getLevel(); + } + } + } + // select the correct gem/sourceItem + int baseMaterialLevel = TreasureCharms.getBaseMaterial(cap.getBaseMaterial()).get().getMaxLevel(); + if (highestLevel > baseMaterialLevel) { + List gems = TreasureCharms.getGemValues(); + Collections.sort(gems, TreasureCharms.levelComparator); + for (CharmableMaterial gem : gems) { + if (baseMaterialLevel + gem.getMaxLevel() >= highestLevel) { + cap.setSourceItem(gem.getName()); + break; + } + } + } + }); + Treasure.LOGGER.debug("returning charmed item -> {}", stack.getDisplayName().getString()); + return stack; + } + + public static CharmRandomly.Builder builder() { + return new CharmRandomly.Builder(); + } + + public static class Builder extends LootFunction.Builder { + List charms; + IRandomRange range; + protected CharmRandomly.Builder getThis() { + return this; + } + + public CharmRandomly.Builder withCharm(ICharm charm) { + // TODO complete this is to build from within mod (ie not loot_table) + return this; + } + + public CharmRandomly.Builder withLevel(int level) { + return this; + } + + @Override + public ILootFunction build() { + return new CharmRandomly(this.getConditions(), charms, range, InventoryType.INNATE); + } + } + + public static class Serializer extends LootFunction.Serializer { + @Override + public void serialize(JsonObject json, CharmRandomly value, JsonSerializationContext context) { + if (!value.charms.isEmpty()) { + JsonArray jsonArray = new JsonArray(); + for (ICharm charm : value.charms) { + jsonArray.add(new JsonPrimitive(charm.getName().toString())); + } + json.add("charms", jsonArray); + } + if (!value.gems.isEmpty()) { + JsonArray jsonArray = new JsonArray(); + for (String gem : value.gems) { + jsonArray.add(new JsonPrimitive(gem)); + } + json.add("gems", jsonArray); + } + json.add("levels", RandomRanges.serialize(value.levels, context)); + } + @Override + public CharmRandomly deserialize(JsonObject json, JsonDeserializationContext context, + ILootCondition[] conditions) { + + Map charmsByType = new HashMap<>(10); + List list = Lists.newArrayList(); + + IRandomRange range = null; + if (json.has("levels")) { + range = RandomRanges.deserialize(json.get("levels"), context); + } + + if (json.has("charms")) { + for (JsonElement element : JSONUtils.getAsJsonArray(json, "charms")) { + String charmName = JSONUtils.convertToString(element, "charm"); + + Optional charm = TreasureCharmRegistry.get(ModUtils.asLocation(charmName)); + if (!charm.isPresent()) { + Treasure.LOGGER.warn("Unknown charm '{}'", charmName); + } + + // add to the map to prevent duplicates of same charm + if (!charmsByType.containsKey(charm.get().getType())) { + charmsByType.put(charm.get().getType(), charm.get()); + // add to the list of charms + list.add(charm.get()); + } + } + } + // TODO get gems + + InventoryType type = InventoryType.INNATE; + if (json.has("type")) { + String typeString = JSONUtils.getAsString(json, "type"); + try { + type = InventoryType.valueOf(typeString.toUpperCase()); + } + catch(Exception e) {} + } + return new CharmRandomly(conditions, list, range, type); + } + + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java b/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java index 83595b4ea..43bf511f0 100644 --- a/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java +++ b/src/main/java/com/someguyssoftware/treasure2/world/gen/feature/GemOreFeature.java @@ -29,22 +29,10 @@ public GemOreFeature(Codec configFactory) { super(configFactory); // NOTE ensure to set the registry name this.setRegistryName(Treasure.MODID, "gem_ore"); - - try { - init(); - } catch (Exception e) { - Treasure.LOGGER.error("Unable to instantiate GemOreFeature:", e); - } } @Override public boolean place(ISeedReader seedReader, ChunkGenerator generator, Random rand, BlockPos pos, OreFeatureConfig config) { - // unnecessary are OreFeature knows to ignore dimensions that don't allow ore. - // // ore only generates in overworld - // if (!WorldInfo.isSurfaceWorld(seedReader.getLevel(), pos)) { - // Treasure.LOGGER.debug("not a surface world..."); - // return false; - // } // inspect block to determine generation probability double prob = 0; @@ -52,16 +40,22 @@ public boolean place(ISeedReader seedReader, ChunkGenerator generator, Random ra // Treasure.LOGGER.debug("ruby gem"); prob = TreasureConfig.GEMS_AND_ORES.rubyGenProbability.get(); } - else { + else if (config.state.getBlock() == TreasureBlocks.SAPPHIRE_ORE) { // Treasure.LOGGER.debug("sapphire gem: view size -> {}", TreasureConfig.GEMS_AND_ORES.sapphireOreVeinSize.get()); prob = TreasureConfig.GEMS_AND_ORES.sapphireGenProbability.get(); } + else if (config.state.getBlock() == TreasureBlocks.TOPAZ_ORE) { + prob = TreasureConfig.GEMS_AND_ORES.topazGenProbability.get(); + } + else if (config.state.getBlock() == TreasureBlocks.ONYX_ORE) { + prob = TreasureConfig.GEMS_AND_ORES.onyxGenProbability.get(); + } // Treasure.LOGGER.debug("config probability -> {}", prob); // TODO add Topaz and Onyx // test the probability if (!RandomHelper.checkProbability(rand, prob)) { - Treasure.LOGGER.debug("probability NOT met"); +// Treasure.LOGGER.debug("probability NOT met"); return false; } diff --git a/src/main/resources/assets/treasure2/blockstates/onyx_ore.json b/src/main/resources/assets/treasure2/blockstates/onyx_ore.json new file mode 100644 index 000000000..c621c4f0e --- /dev/null +++ b/src/main/resources/assets/treasure2/blockstates/onyx_ore.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "treasure2:block/onyx_ore" } + } +} diff --git a/src/main/resources/assets/treasure2/blockstates/topaz_ore.json b/src/main/resources/assets/treasure2/blockstates/topaz_ore.json new file mode 100644 index 000000000..00b8dd9ef --- /dev/null +++ b/src/main/resources/assets/treasure2/blockstates/topaz_ore.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "treasure2:block/topaz_ore" } + } +} diff --git a/src/main/resources/assets/treasure2/lang/en_us.json b/src/main/resources/assets/treasure2/lang/en_us.json index 6593772f4..484594c49 100644 --- a/src/main/resources/assets/treasure2/lang/en_us.json +++ b/src/main/resources/assets/treasure2/lang/en_us.json @@ -34,7 +34,7 @@ "item.treasure2.sapphire_lock":"Sapphire Lock", "item.treasure2.spider_lock":"Spider Lock", "item.treasure2.wither_lock":"Wither Lock", - + "item.treasure2.copper_coin": "Copper Coin", "item.treasure2.silver_coin": "Silver Coin", "item.treasure2.gold_coin": "Gold Coin", "item.treasure2.ruby": "Ruby", @@ -80,6 +80,8 @@ "block.treasure2.wishing_well_block":"Wishing Well Stone", "block.treasure2.desert_wishing_well_block":"Desert Wishing Well Stone", + "block.treasure2.topaz_ore":"Topaz Ore", + "block.treasure2.onyx_ore":"Onyx Ore", "block.treasure2.ruby_ore":"Ruby Ore", "block.treasure2.sapphire_ore":"Sapphire Ore", "block.treasure2.wither_branch":"Wither Branch", @@ -127,6 +129,8 @@ "block.treasure2.skeleton":"Skeleton", "block.treasure2.skull_and_crossbones":"Skull and Crossbones", + "entity.bound_soul":"Bound Soul", + "tooltip.yes":"Yes", "tooltip.no":"No", "tooltip.label.rarity":"Rarity: %s", @@ -151,7 +155,7 @@ "tooltip.label.charms":"Charms:", "tooltip.label.charmable.slots":"Capacity: [%s/%s] [used/max]", "tooltip.label.charmable.slots.stats":"[%s/%s]", - "tooltip.label.charm.type.finite":"[FINITE] ", + "tooltip.label.charm.type.innate":"[INNATE] ", "tooltip.label.charm.type.imbue":"[IMBUED] ", "tooltip.label.charm.type.socket":"[SOCKETED] ", "tooltip.charm.healing":"Healing %s", diff --git a/src/main/resources/assets/treasure2/models/item/imbued_book.json b/src/main/resources/assets/treasure2/models/item/imbued_book.json new file mode 100644 index 000000000..ed6a9ee07 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/imbued_book.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/imbued_book" + } +} diff --git a/src/main/resources/assets/treasure2/textures/blocks/onyx_nugget.png b/src/main/resources/assets/treasure2/textures/blocks/onyx_nugget.png new file mode 100644 index 0000000000000000000000000000000000000000..ad29c2df284eabfae8a71f4507309c428276161d GIT binary patch literal 5918 zcmeHKX;>3!5)K21W>A!MR0Nk80lAWNE^;y15J6D~kr6}z zIfWHvKs-?KKtOR&P*)H^6mdL35f2anRbM*U z$7|ta>})IsgPF{Ab@D_1PgH&;PC);j)j5@d!Dtl3@&e_4paLh6B0^C(jFZPmU>qDR z5@ImXo%dZ*+~ciO6X z)mpIiNj#E7!xx(m(YZ&v4zItN$`9V0rn}s~>4YGXT7VpHXnCb(oLPCB-Mp>T%gANpyp9}GoMD!NJFNC7?Jm+}bH%PxJ;H)Jcw2CSGD%|~9^zKT4*$Nr4w6x$8Bxj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ana)N z2pKz?gIDpg(eFw#36E1j2+q->RTR7}7H16;vW34Iz(0@raV&sxt)iF71tc!IprO};0!S19U=jcdfx;q<_eXa< zJ>Ppr$i}LO){_(sN=RfPKoW~T@{q}$SAB^0Ne>wh{k=f)gJnpR6oQ>s!4dL#Un8m__!AQBu7 zi_t`6C^PvZJnH}6;ggr6B3BiP?Sw#4N*1mY2d_+kEkGcVfUWupQG_4^;6ns5i$NpM zAR(E+Vv)%Ns*p?vDG(uEWnQ^;UI%yAUnQV}X`FnoMgN-62u)!VDb+|6cPU$&j;vx z76++Zfk?x=rQZCNFeLvx&!@oenf%ZxC6h~IxPNj{|Aw;})uk)yi%4U}#rKCJM^~ex zBwVB_6%MCrUp5FStH{C2z*Vq7bqmlsj&4DrU_=Ov&dISRd1n`WO0PnQ#t@)V70}42 z@HHmEzc2zy{WZuJ)%R<;zLx8YD)2?%uj=|*t}m*< z7lFU3>;G0R?1$%NI0F6gr$C>EFBu(Nfj&u3;JYt$!enC7FqxanOhu?=lEgJghQWNR ztNf_7-im*N8nxtHPiL(M>gtnCEKRbKtx;0}*U5o5t1T+c8vC<7#_106pF|UrhOWSF zT<7j-{rr%5Sy{`^dFvL>97vg)($}fUivw;w|6!WFRzj-7jb zaE@5}=HaysSk0}-Z)drQ*Kz?}UZbPMHq0$%9jj4#)ZT39kdYekCw)J+%{4!>UIzQP zf%{>rg29w4@!4DAI=nlzTdzWuT2m7cTX9{=?~~Pa=o_I4LLQnZhU@I*bYQ`X#D4)O CB---; literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/topaz_nugget.png b/src/main/resources/assets/treasure2/textures/blocks/topaz_nugget.png similarity index 100% rename from src/main/resources/assets/treasure2/textures/item/topaz_nugget.png rename to src/main/resources/assets/treasure2/textures/blocks/topaz_nugget.png diff --git a/src/main/resources/assets/treasure2/textures/item/coins/charmed_gold_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/charmed_gold_coin.png deleted file mode 100644 index 5db2a05e479d3e354bfb3c41acbecedffa4b9f88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 560 zcmV-00?+-4P) zg;!AoO_?TMqc{IvKyr6xEav-e3|Fzxg=Ke#J!j9Hoq>NG^1I;1C7eE>UbidXe}M!2Ai)} z#YbjdqP;e_f|gK$2Dl-i@a5LpfTRN0oDe@T{R+H*2)%o&kwGDnue}&sc#3vs7`u6n zbv}D*2}uAc6HW=>f+TPWeU9L%eo6oleypyAxPgfRkkGCBKw@-m8Qj>MynqOtyt4=x z+MNRuk`L^UB@2+C%7CN0^Pn0EGLSRcy-P@oCA9ydKpH!}f}(&2*czu3B!~KEMFj9h zL7lr-b>$@ROv+#aXhJ*z&i=bjFlHKB7`bh--9Aq~IuVZM(3nzv0Rc(ue|Q5T?7W9F zPh5rysdqj3v8mVS&OBh`Bi8_>Y(1d=b_I9X>p0_&UH;e$-zT#lzp+BuTZlsF8~u;V yP++$M0w`2h6vw8UO1RxB_v76yVENfrnRUP8D8sZF3V zT53(_3MkpIEKA6`#M=jech0fcAQ&(foN|iaoSE|+XJ%Zc!bOModV5We3MdNHA_gch zzrXMP3*7JPvyqh*Fr(9)VWyzQ-JTwsYc~Hv+}S5Q?C-bo%nWMA*Ds$tfGQRvXv9=m zotoz5-kv)Lj1LUh(8L6-TCLM?1hWDZ>;y4|7+IT~;#s5N{s2z~2krLwIEK-#@A778 z0e2KpjaX5jMS&e3Gdw>}YikQ)WVKRZc6ZkWfRN=71ZUtwAY>)XM|?aYir~FRgWyDv zG-K<-dy*_U{X|IWQcQkNx%%eb#BU15JAKtX$q=rudm~?j3n;>9$;i<+Pz*}HyC_BIG|qrh^n$vt@2=b z*qzxa2QPipDugsDY{hDAj+;xsZmIeBiG c+-2AKH%A)|UYn|xs{jB107*qoM6N<$f^}C9`2YX_ diff --git a/src/main/resources/assets/treasure2/textures/item/coins/gold_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/gold_coin.png index ebe8f9c4656d4d88f8ba4c95f20e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NJZk4*EMTsQ+4#YcOWiM;Kw0M}VBYxGeUDF*xCS+wzTl4fh47?4M^;ehW2Tl+w<1R4!d`J0d5U?h3JzCkJ6GY7z4hjRVto@f*jctIwy?!G zj+Vxo!b8WUVzbeWPI73xMlAw(bw>VU;O_umEU3#cJxA#WKJTB3<96>0?0tw2Hl; zPhC`_57YF%7OLMx&2zA*pGC`@)BH9Q3GrQaKxTBqhbQB^6GnY!zHX{(0d$we^f(|d zJ)MsJy{D6rAsBxLbV*G`2jvJ5 z4ht^dh{eGG007ZRL_t(I%VYfi|33pIfCZc2;kANTO|=bv&xqFmm_{q_Qw;bFMmC5M z<^^=kKR@ljYRK8cbttZ3LYB1hKE?3!(+-@P85kHCjBT4Ry>NJ~;D2Oi!)!qZFbmWa znHdhR75r}-{GO4CoRE4K6H&k(h%l$aTyt!z83Unk!5WR&6ygdOCI$)tSq8j%^8nQV z+u-+%$F`a=u=9Bk)cpBLBg3uxf3c?nbVIDXPr;)OSu-+VM9xgesS!EQIDaf;c=hH1 kTr<|BOm1dkq%=DN0M=A>+Tz>4b^rhX07*qoM6N<$f_~1}RR910 delta 270 zcmV+p0rCFu3%UZ3Ba`6-7JndPNK#Dz0D30?0Dyx40QzJA0D#f}0Ct7|0PN`i06Crj z02Thme$zSt006*AL_t(|+G70w|33pIfCZc2;kANTO|=bv&xj%T|Nnm!d}xip|3BYv zVa12m2>eG^&xq`W!)pcqTX~;iU|?Wi`1xrERwti5T!-QkxB)QDxPLU_GKBH}|Nj^^ zpFLcMRU@(mFhiKg3Hi@Y8nMR$%ygJ*j%_tV;bZe2)@a105LehRF;EDYDDgks0NddA zjK{W`F|hM_5T*In{lBQuh@OyO{)HL%^V1HjnlTK(m7s8G#%chmnTe6o>@~ diff --git a/src/main/resources/assets/treasure2/textures/item/coins/gold_coin2.png b/src/main/resources/assets/treasure2/textures/item/coins/gold_coin2.png deleted file mode 100644 index 4d428e3770f7c3cec48b6cc58f3594cd07e0d8c8..0000000000000000000000000000000000000000 G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j@k>L)<(8MxA${&EeN{v^HH)FMYf&o*#z-PDvl;Bp5Tcrs*DcBLRKA(sQ*&*+;n zK>sb!wdVD$agNgmAVs}O+yDoMz(}65*L~jI+1j^%Ya0Fg0bY@EpBdLLO#lD@24YJ` zL;#flj{ud5sVHdx000SaNLh0L01FZT01FZU(%pXi00007bV*G`2jv3;5G6B|P3JBE z00CM_L_t(I%f*vFP69y`hrfNZe}F^^T`4$#L<>!z(c@^R$Iw!()C=e-^a9xE1xzRi zR>FovvRVGj8w=yg3es3O-Mq=~%QtV{z<)1qp%R5|Wnw(>eg{OM+i5gVRjjpGYYBn? zRb@Jz5(EJ+olXHFKf}#t3lYH>gL9uUB0{-bW_x>wczwNK=@;zAW1gR%*xlV@I2=-` zR8UpYG$jl}+K+8KuP80^8*44I*^DGfh~t>iXhfD})M_>Q{XRf$wG`m{KECghrYT91 zaCLLd@yT(1=A1)Smjc%2Er7gnS(X7%DwP((^MLoSkjS^xYp=&vqmcuF)jf!!DA$eS zn7i9MF3&GGJUV1DnP7}r02E%qIfsZ)uh;2zyQnIv%Gv1|)oOLAK>;8lG@C8%AMUZ% z;(1#C100000 literal 0 HcmV?d00001 diff --git a/src/main/resources/data/treasure2/loot_tables/blocks/onyx_ore.json b/src/main/resources/data/treasure2/loot_tables/blocks/onyx_ore.json new file mode 100644 index 000000000..7a019c7e5 --- /dev/null +++ b/src/main/resources/data/treasure2/loot_tables/blocks/onyx_ore.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "treasure2:onyx" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} diff --git a/src/main/resources/data/treasure2/loot_tables/blocks/topaz_ore.json b/src/main/resources/data/treasure2/loot_tables/blocks/topaz_ore.json new file mode 100644 index 000000000..b3d19fa6b --- /dev/null +++ b/src/main/resources/data/treasure2/loot_tables/blocks/topaz_ore.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "treasure2:topaz" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} diff --git a/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json index 8d31027e5..4b227e211 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json @@ -1,5 +1,5 @@ { - "version" : "1.0.0", + "version" : "2.0.0", "category": "general", "rarity": "common", "type": "minecraft:chest", @@ -16,6 +16,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/common_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json index a47fcb62b..9709d0327 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json @@ -1,8 +1,8 @@ { "version": "1.0", "category": "general", - "rarity": "epic", - "type": "minecraft:chest", + "rarity": "epic", + "type": "minecraft:chest", "pools": [ { "name": "treasure", @@ -173,4 +173,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json index 0c5589344..c57eee8fb 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json @@ -1,5 +1,5 @@ { - "version": "1.0", + "version": "2.0.0", "category": "general", "rarity": "uncommon", "type": "minecraft:chest", @@ -8,11 +8,22 @@ "name": "treasure", "rolls": 2, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/treasure/uncommon", - "weight": 30 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/treasure/uncommon", + "weight": 30 + } + ] + }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/uncommon_charms", + "weight": 1 + } ] }, { @@ -22,11 +33,11 @@ "max": 4 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/items/uncommon", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/items/uncommon", + "weight": 1 + } ] }, { @@ -36,11 +47,11 @@ "max": 2 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/armor/uncommon", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/armor/uncommon", + "weight": 1 + } ] }, { @@ -50,11 +61,11 @@ "max": 2 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/food/uncommon", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/food/uncommon", + "weight": 1 + } ] }, { @@ -64,11 +75,11 @@ "max": 1 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/tools/uncommon", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/tools/uncommon", + "weight": 1 + } ] }, { @@ -78,14 +89,13 @@ "max": 2 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/potions/uncommon", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/potions/uncommon", + "weight": 1 + } ] }, - { "name": "common_items", "rolls": { @@ -93,11 +103,11 @@ "max": 2 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/items/common", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/items/common", + "weight": 1 + } ] }, { @@ -107,11 +117,11 @@ "max": 1 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/armor/common", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/armor/common", + "weight": 1 + } ] }, { @@ -121,11 +131,11 @@ "max": 1 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/food/common", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/food/common", + "weight": 1 + } ] }, { @@ -135,11 +145,11 @@ "max": 1 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/tools/common", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/tools/common", + "weight": 1 + } ] }, { @@ -149,12 +159,12 @@ "max": 1 }, "entries": [ - { - "type": "minecraft:loot_table", - "name": "treasure2:pools/potions/common", - "weight": 1 - } + { + "type": "minecraft:loot_table", + "name": "treasure2:pools/potions/common", + "weight": 1 + } ] } ] -} +} \ No newline at end of file diff --git a/src/main/resources/data/treasure2/loot_tables/pools/treasure/common_charms.json b/src/main/resources/data/treasure2/loot_tables/pools/treasure/common_charms.json new file mode 100644 index 000000000..3c75c05fc --- /dev/null +++ b/src/main/resources/data/treasure2/loot_tables/pools/treasure/common_charms.json @@ -0,0 +1,29 @@ +{ + "version": "1.0", + "pools": [ + { + "name": "uncommon_charms", + "rolls": 1, + "entries": [ + { + "entryName": "charm1", + "type": "item", + "name": "treasure2:copper_charm", + "weight": 1, + "conditions": [ + { + "condition": "random_chance", + "chance": 0.1 + } + ], + "functions": [ + { + "function": "treasure2:charm_randomly", + "levels": 1 + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/treasure2/loot_tables/pools/treasure/uncommon_charms.json b/src/main/resources/data/treasure2/loot_tables/pools/treasure/uncommon_charms.json new file mode 100644 index 000000000..a4c47dc3b --- /dev/null +++ b/src/main/resources/data/treasure2/loot_tables/pools/treasure/uncommon_charms.json @@ -0,0 +1,65 @@ +{ + "version": "1.0", + "pools": [ + { + "name": "uncommon_charms", + "rolls": 1, + "entries": [ + { + "entryName": "charm1", + "type": "item", + "name": "treasure2:copper_charm", + "weight": 1, + "conditions": [ + { + "condition": "random_chance", + "chance": 0.2 + } + ], + "functions": [ + { + "function": "treasure2:charm_randomly", + "levels": 1 + } + ] + }, + { + "entryName": "charm2", + "type": "item", + "name": "treasure2:copper_charm", + "weight": 1, + "conditions": [ + { + "condition": "random_chance", + "chance": 0.15 + } + ], + "functions": [ + { + "function": "treasure2:charm_randomly", + "levels": 2 + } + ] + }, + { + "entryName": "charm3", + "type": "item", + "name": "treasure2:silver_charm", + "weight": 1, + "conditions": [ + { + "condition": "random_chance", + "chance": 0.1 + } + ], + "functions": [ + { + "function": "treasure2:charm_randomly", + "levels": 3 + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/loot_tables/treasure2/pools/treasure/common.json b/src/main/resources/loot_tables/treasure2/pools/treasure/common.json index 51f7eed5f..1155cd48f 100644 --- a/src/main/resources/loot_tables/treasure2/pools/treasure/common.json +++ b/src/main/resources/loot_tables/treasure2/pools/treasure/common.json @@ -1,5 +1,6 @@ { -"version": "2.0", +"version": "3.0", +"since": "mc1.16.5-v1.6.0", "type": "minecraft:chest", "pools": [ { @@ -70,44 +71,29 @@ "rolls": 1, "entries": [ { - "entryName": "silver_coin", + "entryName": "copper_coin", "type": "item", - "name": "treasure2:silver_coin", + "name": "treasure2:copper_coin", "weight": 25, "functions": [ { "function": "set_count", - "count": { - "min": 0, - "max": 1 - } + "count": 1 } ] - } - ] - }, - { - "name": "common_charms", - "rolls": 1, - "entries": [ + }, { - "entryName": "charm1", + "entryName": "silver_coin", "type": "item", - "name": "treasure2:charmed_silver_coin", - "weight": 1, - "conditions": [ - { - "condition": "random_chance", - "chance": 0.2 - } - ], + "name": "treasure2:silver_coin", + "weight": 25, "functions": [ { - "function": "treasure2:charm_randomly", - "charms": [ - "lesser_healing", - "durable_shielding" - ] + "function": "set_count", + "count": { + "min": 0, + "max": 1 + } } ] } diff --git a/src/main/resources/loot_tables/treasure2/pools/treasure/epic.json b/src/main/resources/loot_tables/treasure2/pools/treasure/epic.json index 57a9ca123..02b9f94ab 100644 --- a/src/main/resources/loot_tables/treasure2/pools/treasure/epic.json +++ b/src/main/resources/loot_tables/treasure2/pools/treasure/epic.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0", + "since": "mc1.16.5-v1.6.0", "pools": [ { "name": "epic_keys", @@ -131,6 +132,18 @@ } ] }, + { + "entryName": "topaz", + "type": "item", + "name": "treasure2:topaz", + "weight": 15 + }, + { + "entryName": "onyx", + "type": "item", + "name": "treasure2:onyx", + "weight": 15 + }, { "entryName": "sapphire", "type": "item", @@ -192,13 +205,6 @@ ] } ] - }, - { - "name": "epic_charms", - "rolls": 1, - "entries": [ - - ] } ] } diff --git a/src/main/resources/loot_tables/treasure2/pools/treasure/rare.json b/src/main/resources/loot_tables/treasure2/pools/treasure/rare.json index fed13d015..acac0ed1e 100644 --- a/src/main/resources/loot_tables/treasure2/pools/treasure/rare.json +++ b/src/main/resources/loot_tables/treasure2/pools/treasure/rare.json @@ -1,10 +1,17 @@ { - "version": "1.0", + "version": "2.0", + "since": "mc1.16.5-v1.6.0", "pools": [ { "name": "rare_keys", "rolls": 1, "entries": [ + { + "entryName": "lightning_key", + "type": "item", + "name": "treasure2:lightning_key", + "weight": 10 + }, { "entryName": "metallurgists_key", "type": "item", @@ -119,6 +126,18 @@ } ] }, + { + "entryName": "topaz", + "type": "item", + "name": "treasure2:topaz", + "weight": 15 + }, + { + "entryName": "onyx", + "type": "item", + "name": "treasure2:onyx", + "weight": 15 + }, { "entryName": "sapphire", "type": "item", @@ -162,12 +181,6 @@ ] } ] - }, - { - "name": "rare_charms", - "rolls": 1, - "entries": [ - ] } ] } diff --git a/src/main/resources/loot_tables/treasure2/pools/treasure/scarce.json b/src/main/resources/loot_tables/treasure2/pools/treasure/scarce.json index 94377aa65..ea80a0b10 100644 --- a/src/main/resources/loot_tables/treasure2/pools/treasure/scarce.json +++ b/src/main/resources/loot_tables/treasure2/pools/treasure/scarce.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0", + "since": "mc1.16.5-v1.6.0", "pools": [ { "name": "scarce_keys", @@ -35,6 +36,42 @@ } ] }, + { + "entryName": "leaf_key", + "type": "item", + "name": "treasure2:leaf_key", + "weight": 20, + "functions": [ + { + "function": "set_count", + "count": { + "min": 1, + "max": 2 + } + } + ] + }, + { + "entryName": "ember_key", + "type": "item", + "name": "treasure2:ember_key", + "weight": 25, + "functions": [ + { + "function": "set_count", + "count": { + "min": 1, + "max": 2 + } + } + ] + }, + { + "entryName": "lightning_key", + "type": "item", + "name": "treasure2:lightning_key", + "weight": 7 + }, { "entryName": "gold_key", "type": "item", @@ -74,6 +111,21 @@ "name": "scarce_treasure", "rolls": 1, "entries": [ + { + "entryName": "copper_coin", + "type": "item", + "name": "treasure2:copper_coin", + "weight": 10, + "functions": [ + { + "function": "set_count", + "count": { + "min": 1, + "max": 3 + } + } + ] + }, { "entryName": "silver_coin", "type": "item", @@ -153,13 +205,6 @@ ] } ] - }, - { - "name": "scarce_charms", - "rolls": 1, - "entries": [ - - ] } ] } diff --git a/src/main/resources/loot_tables/treasure2/pools/treasure/uncommon.json b/src/main/resources/loot_tables/treasure2/pools/treasure/uncommon.json index 6e2bfa877..23f9d8660 100644 --- a/src/main/resources/loot_tables/treasure2/pools/treasure/uncommon.json +++ b/src/main/resources/loot_tables/treasure2/pools/treasure/uncommon.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0", + "since": "mc1.16.5-v1.6.0", "pools": [ { "name": "uncommon_keys", @@ -80,6 +81,18 @@ } ] }, + { + "entryName": "ember_key", + "type": "item", + "name": "treasure2:ember_key", + "weight": 10 + }, + { + "entryName": "leaf_key", + "type": "item", + "name": "treasure2:leaf_key", + "weight": 15 + }, { "entryName": "gold_key", "type": "item", @@ -98,6 +111,21 @@ "name": "uncommon_treasure", "rolls": 1, "entries": [ + { + "entryName": "copper_coin", + "type": "item", + "name": "treasure2:copper_coin", + "weight": 35, + "functions": [ + { + "function": "set_count", + "count": { + "min": 1, + "max": 2 + } + } + ] + }, { "entryName": "silver_coin", "type": "item", @@ -129,12 +157,6 @@ ] } ] - }, - { - "name": "uncommon_charms", - "rolls": 1, - "entries": [ - ] - } + } ] } \ No newline at end of file From 79080bb7fd41e89224ce45cc50b0d16758f98163 Mon Sep 17 00:00:00 2001 From: gottsch Date: Wed, 25 Aug 2021 13:57:35 -0400 Subject: [PATCH 16/19] fixing/updating loot tables and clean up --- .../capability/CharmableCapability.java | 57 ++++++---------- .../CharmableCapabilityStorage.java | 4 -- .../capability/ICharmableCapability.java | 12 +--- .../treasure2/charm/BaseMaterial.java | 29 -------- .../treasure2/charm/BaseMaterial2.java | 1 + .../treasure2/charm/CharmableMaterial.java | 28 ++++++-- .../charm/TreasureCharmRegistry.java | 19 ++++++ .../treasure2/charm/TreasureCharms.java | 7 +- .../eventhandler/PlayerEventHandler.java | 5 +- .../treasure2/init/TreasureSetup.java | 2 +- .../treasure2/item/TreasureItems.java | 1 - .../loot/function/CharmRandomly.java | 66 ++++++++++++++++--- .../assets/treasure2/lang/en_us.json | 4 +- .../chests/common/general_chest.json | 1 + .../chests/epic/general_chest.json | 14 +++- .../chests/rare/general_chest.json | 16 ++++- .../chests/scarce/general_chest.json | 14 +++- .../chests/special/black_pearl_well.json | 14 +++- .../chests/special/cauldron_chest.json | 14 +++- .../chests/special/crystal_skull_chest.json | 44 ++++++++++++- .../chests/special/gold_skull_chest.json | 32 ++++++++- .../chests/special/skull_chest.json | 14 +++- .../chests/special/white_pearl_well.json | 14 +++- .../chests/special/wither_chest.json | 13 +++- .../chests/uncommon/general_chest.json | 1 + 25 files changed, 315 insertions(+), 111 deletions(-) delete mode 100644 src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java index 1f66b9eca..ca4a5eed9 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java @@ -27,9 +27,6 @@ import java.util.Optional; import java.util.function.Consumer; -import com.someguyssoftware.treasure2.Treasure; -import com.someguyssoftware.treasure2.charm.BaseMaterial; -import com.someguyssoftware.treasure2.charm.BaseMaterial2; import com.someguyssoftware.treasure2.charm.CharmableMaterial; import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.charm.TreasureCharms; @@ -61,8 +58,7 @@ public class CharmableCapability implements ICharmableCapability { private boolean source; // is this item bindable to a target item that is socketable private boolean bindable; - // can this item create sockets on a target item - REMOVE doesn't belong in Charmable -> has nothing to do with charm inventory - private boolean socketing; + // does this item have sockets - accepts bindable items private boolean socketable; // can this item imbue atarget item @@ -77,10 +73,6 @@ public class CharmableCapability implements ICharmableCapability { // the item that this capability belongs to private ResourceLocation sourceItem; - @Deprecated - // the max level of any charm that this item can hold (in either of the 3 inventories) - private int maxCharmLevel; - /* * Propeties that refer to the Charm Inventory the the Item that has this capability */ @@ -164,6 +156,17 @@ public boolean isCharmed() { return false; } + /** + * + */ + @Override + public int getMaxCharmLevel() { + Optional base = TreasureCharms.getBaseMaterial(baseMaterial); + Optional source = TreasureCharms.getSourceItem(sourceItem); + CharmableMaterial effectiveBase = base.isPresent() ? base.get() : TreasureCharms.COPPER; + return effectiveBase.getMaxLevel() + (int) Math.floor(effectiveBase.getLevelMultiplier() * (source.isPresent() ? source.get().getMaxLevel() : 0)); + } + @Override public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { tooltip.add(new TranslationTextComponent("tooltip.label.charmed").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); @@ -250,16 +253,6 @@ public void setBindable(boolean bindable) { this.bindable = bindable; } - @Override - public boolean isSocketing() { - return socketing; - } - - @Override - public void setSocketing(boolean socketing) { - this.socketing = socketing; - } - @Override public boolean isSocketable() { return socketable; @@ -340,6 +333,15 @@ public void setBaseMaterial(ResourceLocation baseMaterial) { this.baseMaterial = baseMaterial; } + @Override + public ResourceLocation getSourceItem() { + return sourceItem; + } + @Override + public void setSourceItem(ResourceLocation sourceItem) { + this.sourceItem = sourceItem; + } + /** * * @author Mark Gottschling on Aug 15, 2021 @@ -456,21 +458,4 @@ public ICharmableCapability build() { return new CharmableCapability(this); } } - - @Override - public ResourceLocation getSourceItem() { - return sourceItem; - } - @Override - public void setSourceItem(ResourceLocation sourceItem) { - this.sourceItem = sourceItem; - } - - @Override - public int getMaxCharmLevel() { - Optional base = TreasureCharms.getBaseMaterial(baseMaterial); - Optional source = TreasureCharms.getSourceItem(sourceItem); - return (base.isPresent() ? base.get().getMaxLevel() : TreasureCharms.COPPER.getMaxLevel()) + (source.isPresent() ? source.get().getMaxLevel() : 0); - } - } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java index da7be2dfc..6977f6986 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java @@ -92,7 +92,6 @@ public INBT writeNBT(Capability capability, ICharmableCapa nbt.putInt(MAX_IMBUE_SIZE, instance.getMaxImbueSize()); nbt.putBoolean(SOCKETABLE, instance.isSocketable()); - nbt.putBoolean(SOCKETING, instance.isSocketing()); nbt.putInt(MAX_SOCKET_SIZE, instance.getMaxSocketsSize()); nbt.putString(BASE_MATERIAL, instance.getBaseMaterial().toString()); nbt.putString(SOURCE_ITEM, instance.getSourceItem().toString()); @@ -166,9 +165,6 @@ public void readNBT(Capability capability, ICharmableCapab if (tag.contains(MAX_SOCKET_SIZE)) { instance.setMaxSocketsSize(tag.getInt(MAX_SOCKET_SIZE)); } - if (tag.contains(SOCKETING)) { - instance.setSocketing(tag.getBoolean(SOCKETING)); - } if (tag.contains(BASE_MATERIAL)) { // Optional material = TreasureCharms.getBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); // Optional material = TreasureCharms.getBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java index ee6869e83..79603f0eb 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java @@ -22,9 +22,6 @@ import java.util.List; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; -import com.someguyssoftware.treasure2.charm.BaseMaterial; -import com.someguyssoftware.treasure2.charm.BaseMaterial2; -import com.someguyssoftware.treasure2.charm.CharmableMaterial; import com.someguyssoftware.treasure2.charm.ICharmEntity; import net.minecraft.client.util.ITooltipFlag; @@ -50,9 +47,9 @@ public interface ICharmableCapability { */ void add(InventoryType type, ICharmEntity entity); - public boolean isCharmed(); - public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); + public boolean isCharmed(); int getMaxCharmLevel(); + public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); public boolean isBindable(); public void setBindable(boolean bindable); @@ -72,11 +69,6 @@ public interface ICharmableCapability { public void setSocketable(boolean socketable); public int getMaxSocketsSize(); - @Deprecated - public boolean isSocketing(); - @Deprecated - public void setSocketing(boolean socketing); - void setMaxSocketsSize(int maxSocketsSize); void setMaxImbueSize(int maxImbueSize); void setMaxInnateSize(int maxInnateSize); diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java deleted file mode 100644 index d6066d70e..000000000 --- a/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.someguyssoftware.treasure2.charm; - -/** - * - * @author Mark Gottschling on Aug 16, 2021 - * - */ -public enum BaseMaterial { - NONE(0, 0), - COPPER(1, 2), - SILVER(2, 3), - GOLD(3, 4); - - private int value; - private int maxCharmLevel; - - BaseMaterial(int value, int maxLevel) { - this.value = value; - this.maxCharmLevel = maxLevel; - } - - public int getValue() { - return value; - } - - public int getMaxCharmLevel() { - return maxCharmLevel; - } -} \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java index 2fcbc8a62..4d4f55141 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/BaseMaterial2.java @@ -30,6 +30,7 @@ * @author Mark Gottschling on Aug 19, 2021 * */ +@Deprecated public class BaseMaterial2 { // use a class instead of an enum so more materials can easily be added. might have special charms/adornments like platinum etc. private ResourceLocation name; diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java b/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java index f34f0fc60..840d40dd8 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/CharmableMaterial.java @@ -33,7 +33,8 @@ public class CharmableMaterial { private int id; private ResourceLocation name; private int maxLevel; - private int minSpawnLevel; + private int minSpawnLevel = 1; + private double levelMultiplier = 1.0; /** * @@ -53,20 +54,31 @@ public CharmableMaterial(int id, String name, int maxLevel) { } /** - * + * Full constructor * @param name * @param maxLevel * @param levelRange */ - public CharmableMaterial(int id, ResourceLocation name, int maxLevel, int minSpawnLevel) { + public CharmableMaterial(int id, ResourceLocation name, int maxLevel, int minSpawnLevel, double levelMultiplier) { this.id = id; this.name = name; this.maxLevel = maxLevel; this.minSpawnLevel = minSpawnLevel; + this.levelMultiplier = levelMultiplier; + } + + /** + * + * @param name + * @param maxLevel + * @param levelRange + */ + public CharmableMaterial(int id, ResourceLocation name, int maxLevel, int minSpawnLevel) { + this(id, name, maxLevel, minSpawnLevel, 1D); } public CharmableMaterial(int id, ResourceLocation name, int maxLevel) { - this(id, name, maxLevel, 1); + this(id, name, maxLevel, 1, 1D); } /** @@ -108,4 +120,12 @@ public int getMinSpawnLevel() { public void setMinSpawnLevel(int minSpawnLevel) { this.minSpawnLevel = minSpawnLevel; } + + public double getLevelMultiplier() { + return levelMultiplier; + } + + public void setLevelMultiplier(double levelMultiplier) { + this.levelMultiplier = levelMultiplier; + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java index 889384d36..f6dd7d5a9 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.function.BiPredicate; import java.util.function.Predicate; import net.minecraft.util.ResourceLocation; @@ -96,6 +97,24 @@ public static Optional> get(Predicate predicate) { } return Optional.of(charms); } + + /** + * + * @param predicate + * @return + */ + public static Optional> getBy(Predicate predicate) { + List charms = new ArrayList<>(); + for (ICharm c : TreasureCharmRegistry.values()) { + if (predicate.test(c)) { + charms.add(c); + } + } + if (charms.size() == 0) { + return Optional.empty(); + } + return Optional.of(charms); + } /** * diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java index a2702e484..517239d85 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharms.java @@ -30,6 +30,7 @@ import com.google.common.collect.Multimap; import com.someguyssoftware.treasure2.enums.Rarity; import com.someguyssoftware.treasure2.item.TreasureItems; +import com.someguyssoftware.treasure2.util.ModUtils; import net.minecraft.item.Items; import net.minecraft.util.ResourceLocation; @@ -45,9 +46,9 @@ public class TreasureCharms { private static final Map METAL_REGISTRY = new HashMap<>(); private static final Map GEM_REGISTRY = new HashMap<>(); - public static CharmableMaterial COPPER = new CharmableMaterial(1, "copper", 2); - public static CharmableMaterial SILVER = new CharmableMaterial(2, "silver", 3); - public static CharmableMaterial GOLD = new CharmableMaterial(3, "gold", 4); + public static CharmableMaterial COPPER = new CharmableMaterial(1, ModUtils.asLocation("copper"), 2, 1, 0.5D); + public static CharmableMaterial SILVER = new CharmableMaterial(2, ModUtils.asLocation("silver"), 3, 1, 0.75D); + public static CharmableMaterial GOLD = new CharmableMaterial(3, ModUtils.asLocation("gold"), 4); public static CharmableMaterial DIAMOND; public static CharmableMaterial EMERALD; diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java index 7b075dbdb..762f2c4fa 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java @@ -233,8 +233,9 @@ private static List gatherCharms(Event event, ServerPlayerEntity p // requires indexed for-loop for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); - if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { - Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); +// if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { + if (!entity.getCharm().getRegisteredEvent().equals(event.getClass())) { + Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); continue; } index.set(i); diff --git a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java index dcf79142a..1862861df 100644 --- a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java +++ b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java @@ -92,7 +92,7 @@ public static void clientSetup(final FMLClientSetupEvent event) { stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { Optional source = TreasureCharms.getSourceItem(cap.getSourceItem()); if (source.isPresent()) { - d.set(source.get().getMaxLevel()); + d.set(source.get().getMaxLevel()); // this is wrong } else { d.set(6); diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index 83ff2d158..5af428079 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -34,7 +34,6 @@ import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; import com.someguyssoftware.treasure2.capability.ICharmableCapability; -import com.someguyssoftware.treasure2.charm.BaseMaterial; import com.someguyssoftware.treasure2.charm.TreasureCharms; import com.someguyssoftware.treasure2.config.TreasureConfig; import com.someguyssoftware.treasure2.config.TreasureConfig.KeyID; diff --git a/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java b/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java index e6cbd0baa..425e21706 100644 --- a/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java +++ b/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java @@ -36,6 +36,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; +import com.someguyssoftware.gottschcore.random.RandomHelper; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; @@ -63,10 +64,16 @@ * */ public class CharmRandomly extends LootFunction { + private static final String CHARM = "charm"; + private static final String LEVELS = "levels"; + private static final String CURSE_CHANCE = "curseChance"; + + private List charms; private IRandomRange levels; private List gems; private InventoryType type; + private IRandomRange curseChance; /** * @@ -78,6 +85,14 @@ protected CharmRandomly(ILootCondition[] conditions, @Nullable List char this.levels = range; this.type = type; } + + protected CharmRandomly(ILootCondition[] conditions, @Nullable List charms, IRandomRange levels, InventoryType type, IRandomRange curseChance) { + super(conditions); + this.charms = charms == null ? Collections.emptyList() : charms; + this.levels = levels; + this.type = type; + this.curseChance = curseChance; + } @Override public LootFunctionType getType() { @@ -98,16 +113,37 @@ protected ItemStack run(ItemStack stack, LootContext context) { // check the levels property if(levels != null) { int level = this.levels.getInt(rand); - // get all the charms from level - Optional> levelCharms = TreasureCharmRegistry.get(level); + // TODO if level > cap's max level, then use the max level + + double curseProb = this.curseChance != null ? this.levels.getInt(rand) : 0.0; + Treasure.LOGGER.debug("curse chance -> {}", curseProb); + Optional> levelCharms; + if (curseProb > 0.0) { + levelCharms = TreasureCharmRegistry.getBy(c -> { + if (c.isCurse()) { + return c.getLevel() == level && RandomHelper.checkProbability(rand, curseProb); + } + else { + return c.getLevel() == level; + } + }); + } + else { + // get all the charms from level +// levelCharms = TreasureCharmRegistry.get(level); + levelCharms = TreasureCharmRegistry.getBy(c -> { + return c.getLevel() == level && !c.isCurse(); + }); + } + if (levelCharms.isPresent()) { tempCharms.addAll(levelCharms.get()); } } else { // if charms list is empty and levels are null, create a default list of minor charms - Optional> defaultCharms = TreasureCharmRegistry.get(level -> { - return level <= cap.getMaxCharmLevel(); + Optional> defaultCharms = TreasureCharmRegistry.getBy(c -> { + return c.getLevel() <= cap.getMaxCharmLevel() && !c.isCurse(); }); if (defaultCharms.isPresent()) { tempCharms.addAll(defaultCharms.get()); @@ -124,6 +160,7 @@ protected ItemStack run(ItemStack stack, LootContext context) { Treasure.LOGGER.debug("selected charm for item -> {}", charm.getName().toString()); } } + // explicitly listed charms to use. levels, curseChance are ignored else { charm = charms.get(rand.nextInt(charms.size())); Treasure.LOGGER.debug("selected charm for item -> {}", charm.getName().toString()); @@ -156,13 +193,18 @@ protected ItemStack run(ItemStack stack, LootContext context) { } } } - // select the correct gem/sourceItem - int baseMaterialLevel = TreasureCharms.getBaseMaterial(cap.getBaseMaterial()).get().getMaxLevel(); + + /* + * select the correct gem/sourceItem + */ + CharmableMaterial baseMaterial = TreasureCharms.getBaseMaterial(cap.getBaseMaterial()).get(); + int baseMaterialLevel = baseMaterial.getMaxLevel(); + // if the highest charm level is > the base's max level, then select a gem to increase the items total max level if (highestLevel > baseMaterialLevel) { List gems = TreasureCharms.getGemValues(); Collections.sort(gems, TreasureCharms.levelComparator); for (CharmableMaterial gem : gems) { - if (baseMaterialLevel + gem.getMaxLevel() >= highestLevel) { + if (baseMaterialLevel + Math.floor(baseMaterial.getLevelMultiplier() * gem.getMaxLevel()) >= highestLevel) { cap.setSourceItem(gem.getName()); break; } @@ -200,6 +242,7 @@ public ILootFunction build() { } public static class Serializer extends LootFunction.Serializer { + @Override public void serialize(JsonObject json, CharmRandomly value, JsonSerializationContext context) { if (!value.charms.isEmpty()) { @@ -217,7 +260,9 @@ public void serialize(JsonObject json, CharmRandomly value, JsonSerializationCon json.add("gems", jsonArray); } json.add("levels", RandomRanges.serialize(value.levels, context)); + json.add(CURSE_CHANCE, RandomRanges.serialize(value.curseChance, context)); } + @Override public CharmRandomly deserialize(JsonObject json, JsonDeserializationContext context, ILootCondition[] conditions) { @@ -229,6 +274,11 @@ public CharmRandomly deserialize(JsonObject json, JsonDeserializationContext con if (json.has("levels")) { range = RandomRanges.deserialize(json.get("levels"), context); } + + IRandomRange curseChance = null; + if (json.has(CURSE_CHANCE)) { + range = RandomRanges.deserialize(json.get(CURSE_CHANCE), context); + } if (json.has("charms")) { for (JsonElement element : JSONUtils.getAsJsonArray(json, "charms")) { @@ -257,7 +307,7 @@ public CharmRandomly deserialize(JsonObject json, JsonDeserializationContext con } catch(Exception e) {} } - return new CharmRandomly(conditions, list, range, type); + return new CharmRandomly(conditions, list, range, type, curseChance); } } diff --git a/src/main/resources/assets/treasure2/lang/en_us.json b/src/main/resources/assets/treasure2/lang/en_us.json index 484594c49..297b27f23 100644 --- a/src/main/resources/assets/treasure2/lang/en_us.json +++ b/src/main/resources/assets/treasure2/lang/en_us.json @@ -150,8 +150,8 @@ "tooltip.label.treasure_tool":"Required for Key/Pick recipes", "tooltip.label.max_locks":"Max Locks: %s", "tooltip.label.container_size":"Inventory Size: %s", - "tooltip.label.charmed":"Hold in hand or in coin pouch for buffs", - "tooltip.label.charmed.adornment":"Hold in hand, coin pouch, or hotbar for buffs", + "tooltip.label.charmed":"Hold in hand or equip for buffs", + "tooltip.label.charmed.adornment":"Hold in hand or equip for buffs", "tooltip.label.charms":"Charms:", "tooltip.label.charmable.slots":"Capacity: [%s/%s] [used/max]", "tooltip.label.charmable.slots.stats":"[%s/%s]", diff --git a/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json index 4b227e211..b1ed6a3e3 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/common/general_chest.json @@ -1,5 +1,6 @@ { "version" : "2.0.0", + "since":"mc1.16.5-v1.6.0", "category": "general", "rarity": "common", "type": "minecraft:chest", diff --git a/src/main/resources/data/treasure2/loot_tables/chests/epic/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/epic/general_chest.json index a97019b40..79e9fbc03 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/epic/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/epic/general_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since": "mc1.16.5-v.1.6.0", "category": "general", "rarity": "epic", "type": "minecraft:chest", @@ -18,6 +19,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/epic_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/rare/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/rare/general_chest.json index 992c2f0cd..45cffed7a 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/rare/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/rare/general_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since": "mc1.16.5-v1.6.0", "category": "general", "rarity": "rare", "type": "minecraft:chest", @@ -14,10 +15,21 @@ { "type": "minecraft:loot_table", "name": "treasure2:pools/treasure/rare", - "weight": 30 + "weight": 1 } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/rare_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/scarce/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/scarce/general_chest.json index fab8569c9..8de30224c 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/scarce/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/scarce/general_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since":"mc1.16.5-v1.6.0", "category": "general", "rarity": "scarce", "type": "minecraft:chest", @@ -18,6 +19,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/scarce_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/black_pearl_well.json b/src/main/resources/data/treasure2/loot_tables/chests/special/black_pearl_well.json index d59b3a4bd..c3a1e9852 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/black_pearl_well.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/black_pearl_well.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since":"mc1.16.5-v1.6.0", "category": "black_pearl_well", "rarity": "epic", "type": "minecraft:chest", @@ -18,6 +19,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/epic_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/cauldron_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/special/cauldron_chest.json index 04325311c..ea73f18d3 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/cauldron_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/cauldron_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since":"mc1.16.5-v1.6.0", "type": "minecraft:chest", "pools": [ { @@ -16,6 +17,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/epic_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json index 9709d0327..af9baf4f7 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/crystal_skull_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since": "mc1.16.5-v1.6.0", "category": "general", "rarity": "epic", "type": "minecraft:chest", @@ -76,6 +77,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/epic_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": 4, @@ -140,6 +152,36 @@ } ] }, + { + "entryName": "topaz", + "type": "item", + "name": "treasure2:topaz", + "weight": 25, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 2, + "max": 4 + } + } + ] + }, + { + "entryName": "onyx", + "type": "item", + "name": "treasure2:onyx", + "weight": 25, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 2, + "max": 4 + } + } + ] + }, { "entryName": "sapphire", "type": "minecraft:item", diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/gold_skull_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/special/gold_skull_chest.json index 0a18294ac..ade4f8c0b 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/gold_skull_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/gold_skull_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since": "mc1.16.5-v1.6.0", "type": "minecraft:chest", "pools": [{ "name": "treasure", @@ -88,6 +89,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/rare_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": 4, @@ -136,6 +148,24 @@ } }] }, + { + "entryName": "topaz", + "type": "item", + "name": "treasure2:topaz", + "weight": 25 + }, + { + "entryName": "onyx", + "type": "item", + "name": "treasure2:onyx", + "weight": 25 + }, + { + "entryName": "ruby", + "type": "minecraft:item", + "name": "treasure2:ruby", + "weight": 15 + }, { "entryName": "sapphire", "type": "minecraft:item", diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/skull_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/special/skull_chest.json index 3e6d80c80..600ecd087 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/skull_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/skull_chest.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since":"mc1.16.5-v1.6.0", "type": "minecraft:chest", "pools": [ { @@ -86,6 +87,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/scarce_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": 4, diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/white_pearl_well.json b/src/main/resources/data/treasure2/loot_tables/chests/special/white_pearl_well.json index 969d2743e..a0cd2d3f7 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/white_pearl_well.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/white_pearl_well.json @@ -1,5 +1,6 @@ { - "version": "1.0", + "version": "2.0.0", + "since":"mc1.16.5-1.6.0", "type": "minecraft:chest", "pools": [ { @@ -16,6 +17,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/rare_charms", + "weight": 1 + } + ] + }, { "name": "items", "rolls": { diff --git a/src/main/resources/data/treasure2/loot_tables/chests/special/wither_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/special/wither_chest.json index 60271d0fd..34444ffe3 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/special/wither_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/special/wither_chest.json @@ -1,5 +1,5 @@ { - "version": "1.0", + "version": "2.0.0", "category": "wither_chest", "rarity": "scarce", "type": "minecraft:chest", @@ -15,6 +15,17 @@ } ] }, + { + "name": "charms", + "rolls": 1, + "entries": [ + { + "type": "loot_table", + "name": "treasure2:pools/treasure/scarce_charms", + "weight": 1 + } + ] + }, { "name": "bones", "rolls": 1, diff --git a/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json b/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json index c57eee8fb..4061226ae 100644 --- a/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json +++ b/src/main/resources/data/treasure2/loot_tables/chests/uncommon/general_chest.json @@ -1,5 +1,6 @@ { "version": "2.0.0", + "since":"mc1.16.5-v1.6.0", "category": "general", "rarity": "uncommon", "type": "minecraft:chest", From b33287293f06558602f7a6e4b9059e498102e400 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 26 Aug 2021 11:21:34 -0400 Subject: [PATCH 17/19] TE renderer refactor --- .../AbstractChestTileEntityRenderer.java | 20 ++++- .../CardboardBoxTileEntityRenderer.java | 53 +++++------ .../CauldronChestTileEntityRenderer.java | 53 +++++------ .../CompressorChestTileEntityRenderer.java | 77 +++++----------- .../CrateChestTileEntityRenderer.java | 89 ++++--------------- .../DreadPirateChestTileEntityRenderer.java | 19 ++++ .../GoldStrongboxTileEntityRenderer.java | 18 +++- .../ITreasureChestTileEntityRenderer.java | 11 ++- .../IronStrongboxTileEntityRenderer.java | 52 ++++------- .../IronboundChestTileEntityRenderer.java | 19 ++++ .../MilkCreateTileEntityRenderer.java | 85 +++++------------- .../MoldyCrateChestTileEntityRenderer.java | 19 ++++ .../PirateChestTileEntityRenderer.java | 19 ++++ .../tileentity/SafeTileEntityRenderer.java | 21 ++++- .../SkullChestTileEntityRenderer.java | 21 ++++- .../SpiderChestTileEntityRenderer.java | 19 ++++ .../VikingChestTileEntityRenderer.java | 19 ++++ .../WitherChestTileEntityRenderer.java | 19 ++++ .../WoodChestTileEntityRenderer.java | 19 ++++ 19 files changed, 354 insertions(+), 298 deletions(-) diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java index f4149d9ee..f3a7a5afc 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/AbstractChestTileEntityRenderer.java @@ -1,5 +1,21 @@ -/** +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . */ package com.someguyssoftware.treasure2.gui.render.tileentity; @@ -20,8 +36,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.World; /** diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java index 8abcb34ab..c5d9a4750 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CardboardBoxTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.mojang.blaze3d.matrix.MatrixStack; @@ -34,7 +53,7 @@ public CardboardBoxTileEntityRenderer(TileEntityRendererDispatcher tileEntityRen } @Override - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { CardboardBoxTileEntity cte = (CardboardBoxTileEntity) tileEntity; // update in the inner lid @@ -54,38 +73,6 @@ public float getAngleModifier() { return 0.8F; } - // @Override - // public void renderLocks(AbstractTreasureChestTileEntity te, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { - // // Treasure.LOGGER.debug("====================================================================="); - // if (te.getLockStates().isEmpty()) { - // return; - // } - - // // render locks - // for (LockState lockState : te.getLockStates()) { - // if (lockState.getLock() != null) { - // // convert lock to an item stack - // ItemStack lockStack = new ItemStack(lockState.getLock()); - - // matrixStack.pushPose(); - - // // NOTE when rotating the item to match the face of chest, must adjust the - // // amount of offset to the x,z axises and - // // not rotate() the item - rotate() just spins it in place, not around the axis - // // of the block - // matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); -// - // rotate the locks on the x axis to lay flat - // matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis - // matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. - // matrixStack.scale(0.35F, 0.35F, 0.35F); - // Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); - // matrixStack.popPose(); - - // } - // } - // } - @Override public void updateLockRotation(MatrixStack matrixStack, LockState lockState) { matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java index 119274472..9a0cd8573 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CauldronChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.mojang.blaze3d.matrix.MatrixStack; @@ -29,7 +48,7 @@ public CauldronChestTileEntityRenderer(TileEntityRendererDispatcher tileEntityRe } @Override - public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { + public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { CauldronChestTileEntity cte = (CauldronChestTileEntity) tileEntity; float lidRotation = cte.prevLidAngle + (cte.lidAngle - cte.prevLidAngle) * partialTicks; lidRotation = 1.0F - lidRotation; @@ -49,36 +68,4 @@ public void updateLockRotation(MatrixStack matrixStack, LockState lockState) { public float getLockScaleModifier() { return 0.35F; } - - // @Override - // public void renderLocks(AbstractTreasureChestTileEntity te, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { - // // Treasure.LOGGER.debug("====================================================================="); - // if (te.getLockStates().isEmpty()) { - // return; - // } - - // // render locks - // for (LockState lockState : te.getLockStates()) { - // if (lockState.getLock() != null) { - // // convert lock to an item stack - // ItemStack lockStack = new ItemStack(lockState.getLock()); - - // matrixStack.pushPose(); - - // // NOTE when rotating the item to match the face of chest, must adjust the - // // amount of offset to the x,z axises and - // // not rotate() the item - rotate() just spins it in place, not around the axis - // // of the block - // matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); - - // // rotate the locks on the x axis to lay flat - // matrixStack.mulPose(Vector3f.XP.rotationDegrees(90)); // NOTE changed from Y to X axis - // matrixStack.mulPose(Vector3f.ZP.rotationDegrees(lockState.getSlot().getRotation())); // NOTE now Z axis is the Y axis since we rotated on the X axis first. - // matrixStack.scale(0.35F, 0.35F, 0.35F); - // Minecraft.getInstance().getItemRenderer().renderStatic(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); - // matrixStack.popPose(); - - // } - // } - // } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java index f3695590a..126ee35f0 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CompressorChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.mojang.blaze3d.matrix.MatrixStack; @@ -28,66 +47,14 @@ public CompressorChestTileEntityRenderer(TileEntityRendererDispatcher tileEntity setModel(new CompressorChestModel()); } - // @Override - // public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, - // IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { - - // if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { - // return; // should never happen - // } - - // // TODO this block goes into method / use template pattern - // World world = tileEntity.getLevel(); - // boolean hasWorld = (world != null); - // BlockState state = tileEntity.getBlockState(); - // Direction facing = Direction.NORTH; - // if (hasWorld) { - // facing = state.getValue(StandardChestBlock.FACING); - // } - - // // push the current transformation matrix + normals matrix - // matrixStack.pushPose(); - - // // TODO this block goes into method / use template pattern - // // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be - // // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. - // // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position - // final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 0.75, 0.5); - // matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate - // matrixStack.scale(-1, -1, 1); - // float f = getHorizontalAngle(facing); - // matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); - - // // shrink the size of the chest by half - // matrixStack.scale(0.5F, 0.5F, 0.5F); - - // //////////////// custom lid code ///////////// - // updateModelRotationAngles(tileEntity, partialTicks); - // //////////////// end of lid code ////////////// - - // // TODO this block goes into method / use template pattern - // IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); - // getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); - // matrixStack.popPose(); - - // // TODO this block goes into method / use template pattern - // ////////////// render the locks ////////////////////////////////////// - // renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); - // // if (!te.getLockStates().isEmpty()) { - // // renderLocks(te, x, y, z); - // // } - // ////////////// end of render the locks ////////////////////////////////////// - - // } - @Override - public updateScale(MatrixStack matrixStack) { + public void updateScale(MatrixStack matrixStack) { // shrink the size of the chest by half matrixStack.scale(0.5F, 0.5F, 0.5F); } @Override - public updateTranslation(MatrixStack matrixStack) { + public void updateTranslation(MatrixStack matrixStack) { final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 0.75, 0.5); matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); } @@ -101,7 +68,7 @@ public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, f } @Override - public float getLocksScaleModifier() { + public float getLockScaleModifier() { return 0.20F; } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java index 776038237..cf4e130fe 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/CrateChestTileEntityRenderer.java @@ -1,22 +1,31 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; -import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; import com.someguyssoftware.treasure2.Treasure; -import com.someguyssoftware.treasure2.block.AbstractChestBlock; -import com.someguyssoftware.treasure2.block.StandardChestBlock; import com.someguyssoftware.treasure2.gui.model.CrateChestModel; import com.someguyssoftware.treasure2.tileentity.AbstractTreasureChestTileEntity; import com.someguyssoftware.treasure2.tileentity.CrateChestTileEntity; -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.vector.Vector3f; -import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -43,64 +52,4 @@ public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, f lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; getModel().getLid().yRot = -(lidRotation * (float)Math.PI / getAngleModifier()); } - -// @Override -// public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, -// IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { - -// if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { -// return; // should never happen -// } - -// // TODO this block goes into method / use template pattern -// World world = tileEntity.getLevel(); -// boolean hasWorld = (world != null); -// BlockState state = tileEntity.getBlockState(); -// Direction facing = Direction.NORTH; -// if (hasWorld) { -// facing = AbstractChestBlock.getFacing(state); -// } - -// // push the current transformation matrix + normals matrix -// matrixStack.pushPose(); - -// // TODO this block goes into method / use template pattern -// // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be -// // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. -// // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position -// final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.5, 0.5); -// matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate -// matrixStack.scale(-1, -1, 1); -// float f = getHorizontalAngle(facing); -// matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); - -// // TODO this block goes into method / use template pattern -// //////////////// custom lid code ///////////// -// CrateChestTileEntity cte = (CrateChestTileEntity) tileEntity; -// float latchRotation = cte.prevLatchAngle + (cte.latchAngle - cte.prevLatchAngle) * partialTicks; -// latchRotation = 1.0F - latchRotation; -// latchRotation = 1.0F - latchRotation * latchRotation * latchRotation; -// ((CrateChestModel)getModel()).getLatch1().xRot = -(latchRotation * (float)Math.PI / 2.0F); - -// float lidRotation = cte.prevLidAngle + (cte.lidAngle - cte.prevLidAngle) * partialTicks; -// lidRotation = 1.0F - lidRotation; -// lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; -// getModel().getLid().yRot = -(lidRotation * (float)Math.PI / 2.0F); - -// //////////////// end of lid code ////////////// - -// // TODO this block goes into method / use template pattern -// IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); -// getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); -// matrixStack.popPose(); - -// // TODO this block goes into method / use template pattern -// ////////////// render the locks ////////////////////////////////////// -// renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); -// // if (!te.getLockStates().isEmpty()) { -// // renderLocks(te, x, y, z); -// // } -// ////////////// end of render the locks ////////////////////////////////////// - -// } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/DreadPirateChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/DreadPirateChestTileEntityRenderer.java index d067f90fc..0e4b3634c 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/DreadPirateChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/DreadPirateChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/GoldStrongboxTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/GoldStrongboxTileEntityRenderer.java index c8e122ffc..90b5b30f5 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/GoldStrongboxTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/GoldStrongboxTileEntityRenderer.java @@ -1,5 +1,21 @@ -/** +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . */ package com.someguyssoftware.treasure2.gui.render.tileentity; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java index f63a1a545..bdc6b93a4 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/ITreasureChestTileEntityRenderer.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.someguyssoftware.treasure2.block.StandardChestBlock; import com.someguyssoftware.treasure2.gui.model.ITreasureChestModel; +import com.someguyssoftware.treasure2.lock.LockState; import com.someguyssoftware.treasure2.tileentity.AbstractTreasureChestTileEntity; import net.minecraft.block.BlockState; @@ -10,6 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; public interface ITreasureChestTileEntityRenderer { @@ -27,7 +30,7 @@ default public void updateTranslation(MatrixStack matrixStack) { } default public void updateScale(MatrixStack matrixStack) { - matrixStack.scale(-1, -1, 1); + matrixStack.scale(1, 1, 1); } default public void updateRotation(MatrixStack matrixStack, Direction direction) { @@ -44,7 +47,7 @@ default public void updateModelLidRotation(AbstractTreasureChestTileEntity tile float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; lidRotation = 1.0F - lidRotation; lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - model.getLid().xRot = -(lidRotation * (float) Math.PI / getAngleModifier()); + getModel().getLid().xRot = -(lidRotation * (float) Math.PI / getAngleModifier()); } /** @@ -106,12 +109,12 @@ default public float getAngleModifier() { * * @return */ - default public float getLocksScaleModifier() { + default public float getLockScaleModifier() { return 0.5F; } default public void updateLockScale(MatrixStack matrixStack) { - matrixStack.scale(getLocksScaleModifier(), getLocksScaleModifier(), getLocksScaleModifier()); + matrixStack.scale(getLockScaleModifier(), getLockScaleModifier(), getLockScaleModifier()); } /** diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronStrongboxTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronStrongboxTileEntityRenderer.java index 287c71350..a96ba98a2 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronStrongboxTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronStrongboxTileEntityRenderer.java @@ -1,5 +1,21 @@ -/** +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . */ package com.someguyssoftware.treasure2.gui.render.tileentity; @@ -25,40 +41,8 @@ public IronStrongboxTileEntityRenderer(TileEntityRendererDispatcher tileEntityRe setModel(new StrongboxModel()); } - /** - * - * @param te - * @param x - * @param y - * @param z - */ -// public void renderLocks(AbstractTreasureChestTileEntity tileEntity, MatrixStack matrixStack, IRenderTypeBuffer renderBuffer, int combinedLight, int combinedOverlay) { -// if (tileEntity.getLockStates().isEmpty()) { -// return; -// } -// -// // render locks -// tileEntity.getLockStates().forEach(lockState -> { -// // for (LockState lockState : tileEntity.getLockStates()) { -// -// if (lockState.getLock() != null) { -// // convert lock to an item stack -// ItemStack lockStack = new ItemStack(lockState.getLock()); -// -// matrixStack.pushPose(); -// matrixStack.translate(lockState.getSlot().getXOffset(), lockState.getSlot().getYOffset(), lockState.getSlot().getZOffset()); -// matrixStack.mulPose(Vector3f.YP.rotationDegrees(lockState.getSlot().getRotation())); -//// if this works, can remove this method altogether and update abstract super to use getLocksScaleModifier -// matrixStack.scale(getLocksScaleModifier(), getLocksScaleModifier(), getLocksScaleModifier()); -// Minecraft.getInstance().getItemRenderer().renderItem(lockStack, ItemCameraTransforms.TransformType.NONE, combinedLight, OverlayTexture.NO_OVERLAY, matrixStack, renderBuffer); -// matrixStack.popPose(); -// } -// // } -// }); -// } - @Override - public float getLocksScaleModifier() { + public float getLockScaleModifier() { return 0.25F; } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronboundChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronboundChestTileEntityRenderer.java index 01ecbb1f0..31a641083 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronboundChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/IronboundChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java index bc4ad360d..5f7ea5ab2 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MilkCreateTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.mojang.blaze3d.matrix.MatrixStack; @@ -28,79 +47,19 @@ public MilkCreateTileEntityRenderer(TileEntityRendererDispatcher tileEntityRende setModel(new MilkCrateModel()); } - // @Override - // public void render(AbstractTreasureChestTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, - // IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) { - - // if (!(tileEntity instanceof AbstractTreasureChestTileEntity)) { - // return; // should never happen - // } - - // // TODO this block goes into method / use template pattern - // World world = tileEntity.getLevel(); - // boolean hasWorld = (world != null); - // BlockState state = tileEntity.getBlockState(); - // Direction facing = Direction.NORTH; - // if (hasWorld) { - // facing = state.getValue(StandardChestBlock.FACING); - // } - - // // push the current transformation matrix + normals matrix - // matrixStack.pushPose(); - - // // TODO this block goes into method / use template pattern - // // The model is defined centred on [0,0,0], so if we drew it at the current render origin, its centre would be - // // at the corner of the block, sunk halfway into the ground and overlapping into the adjacent blocks. - // // We want it to hover above the centre of the hopper base, so we need to translate up and across to the desired position - // final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.15625F, 0.5); - // matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); // translate - // matrixStack.scale(-1, -1, 1); - // float f = getHorizontalAngle(facing); - // matrixStack.mulPose(Vector3f.YP.rotationDegrees(-f)); - - // // shrink the size of the chest by half - // matrixStack.scale(0.75F, 0.75F, 0.75F); - - // //////////////// custom lid code ///////////// - // updateModelRotationAngles(tileEntity, partialTicks); - // //////////////// end of lid code ////////////// - - // // TODO this block goes into method / use template pattern - // IVertexBuilder renderBuffer = renderTypeBuffer.getBuffer(getModel().getChestRenderType(getTexture())); - // getModel().renderAll(matrixStack, renderBuffer, combinedLight, combinedOverlay, tileEntity); - // matrixStack.popPose(); - - // // TODO this block goes into method / use template pattern - // ////////////// render the locks ////////////////////////////////////// - // renderLocks(tileEntity, matrixStack, renderTypeBuffer, combinedLight, combinedOverlay); - // // if (!te.getLockStates().isEmpty()) { - // // renderLocks(te, x, y, z); - // // } - // ////////////// end of render the locks ////////////////////////////////////// - - // } - - // @Override - // public void updateModelRotationAngles(AbstractTreasureChestTileEntity tileEntity, float partialTicks) { - // float lidRotation = tileEntity.prevLidAngle + (tileEntity.lidAngle - tileEntity.prevLidAngle) * partialTicks; - // lidRotation = 1.0F - lidRotation; - // lidRotation = 1.0F - lidRotation * lidRotation * lidRotation; - // getModel().getLid().xRot = -(lidRotation * (float)Math.PI / 2.0F); - // } - @Override - public float getLocksScaleModifier() { + public float getLockScaleModifier() { return 0.28F; } @Override - public updateScale(MatrixStack matrixStack) { + public void updateScale(MatrixStack matrixStack) { // shrink the size of the chest by half matrixStack.scale(0.75F, 0.75F, 0.75F); } @Override - public updateTranslation(MatrixStack matrixStack) { + public void updateTranslation(MatrixStack matrixStack) { final Vector3d TRANSLATION_OFFSET = new Vector3d(0.5, 1.15625F, 0.5); matrixStack.translate(TRANSLATION_OFFSET.x, TRANSLATION_OFFSET.y, TRANSLATION_OFFSET.z); } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MoldyCrateChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MoldyCrateChestTileEntityRenderer.java index 8789bc8f1..f17973764 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MoldyCrateChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/MoldyCrateChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/PirateChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/PirateChestTileEntityRenderer.java index 3088c9037..b18bc9703 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/PirateChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/PirateChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java index 801c94446..d2ffc0ef4 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SafeTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; @@ -41,7 +60,7 @@ public void updateModelLidRotation(AbstractTreasureChestTileEntity tileEntity, f } @Override - public float getLocksScaleModifier() { + public float getLockScaleModifier() { return 0.3F; } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SkullChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SkullChestTileEntityRenderer.java index 36a37d254..c25e4f940 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SkullChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SkullChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; @@ -55,7 +74,7 @@ public float getAngleModifier() { } @Override - public float getLocksScaleModifier() { + public float getLockScaleModifier() { return 0.25F; } } diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SpiderChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SpiderChestTileEntityRenderer.java index a42da34f4..0e9260e37 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SpiderChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/SpiderChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/VikingChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/VikingChestTileEntityRenderer.java index cb9e6c8af..86dcecd18 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/VikingChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/VikingChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java index 220785845..f007c7ee4 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WitherChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java index 48098c7e4..dce7c9f1b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/render/tileentity/WoodChestTileEntityRenderer.java @@ -1,3 +1,22 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ package com.someguyssoftware.treasure2.gui.render.tileentity; import com.someguyssoftware.treasure2.Treasure; From 0091a8d7f864674a24627d8d64ad796f0effd186 Mon Sep 17 00:00:00 2001 From: gottsch Date: Sun, 29 Aug 2021 10:07:51 -0400 Subject: [PATCH 18/19] charms, charms, charms textures, item models, pouches, event handling, refactoring, new charms, loot table updates --- .../capability/CharmableCapability.java | 337 +++++++++++------- .../CharmableCapabilityProvider.java | 8 +- .../CharmableCapabilityStorage.java | 11 + .../capability/ICharmableCapability.java | 15 + .../capability/PouchCapabilityProvider.java | 64 ++++ .../capability/TreasureCapabilities.java | 7 +- .../treasure2/charm/AegisCharm.java | 2 +- .../treasure2/charm/Charm.java | 2 +- .../treasure2/charm/DecayCurse.java | 2 +- .../treasure2/charm/DecrepitCurse.java | 2 +- .../treasure2/charm/DrainCharm.java | 2 +- .../treasure2/charm/FireImmunityCharm.java | 2 +- .../treasure2/charm/FireResistenceCharm.java | 2 +- .../treasure2/charm/GreaterHealingCharm.java | 4 +- .../treasure2/charm/HealingCharm.java | 2 +- .../treasure2/charm/IlluminationCharm.java | 2 +- .../treasure2/charm/LifeStrikeCharm.java | 2 +- .../treasure2/charm/ReflectionCharm.java | 3 +- .../treasure2/charm/RuinCurse.java | 2 +- .../treasure2/charm/SatietyCharm.java | 2 +- .../treasure2/charm/ShieldingCharm.java | 2 +- .../charm/TreasureCharmRegistry.java | 2 +- .../treasure2/command/SpawnChestCommand.java | 21 +- .../treasure2/config/TreasureConfig.java | 5 +- .../eventhandler/AnvilEventHandler.java | 99 ++++- .../eventhandler/PlayerEventHandler.java | 125 ++++--- .../generator/chest/IChestGenerator.java | 4 +- .../treasure2/gui/PouchContainerScreen.java | 91 +++++ .../treasure2/gui/TreasureGuis.java | 1 + .../treasure2/init/TreasureSetup.java | 24 +- .../treasure2/inventory/PouchContainer.java | 111 ++++++ .../treasure2/inventory/PouchInventory.java | 135 +++++++ .../treasure2/inventory/PouchSlot.java | 43 +++ .../inventory/TreasureContainers.java | 5 + .../treasure2/item/CharmBook.java | 59 +++ .../treasure2/item/CharmItem.java | 194 ++++++++-- .../treasure2/item/CoinItem.java | 2 +- .../treasure2/item/IWishable.java | 4 - .../treasure2/item/PouchItem.java | 113 ++++++ .../treasure2/item/TreasureItems.java | 45 +-- .../treasure2/item/WealthItem.java | 5 +- .../loot/function/CharmRandomly.java | 29 +- .../network/CharmMessageHandlerOnClient.java | 6 +- .../assets/treasure2/lang/en_us.json | 73 +++- .../models/item/apprentices_pouch.json | 6 - .../assets/treasure2/models/item/charm.json | 37 -- .../{imbued_book.json => charm_book.json} | 2 +- .../treasure2/models/item/copper_charm.json | 18 +- .../treasure2/models/item/gold_charm.json | 65 ++++ .../models/item/gold_charm_black_pearl.json | 6 + .../models/item/gold_charm_diamond.json | 6 + .../models/item/gold_charm_emerald.json | 6 + .../models/item/gold_charm_onyx.json | 6 + .../models/item/gold_charm_ruby.json | 6 + .../models/item/gold_charm_sapphire.json | 6 + .../models/item/gold_charm_topaz.json | 6 + .../models/item/gold_charm_white_pearl.json | 6 + .../treasure2/models/item/high_fog.json | 10 - .../models/item/high_poison_fog.json | 10 - .../models/item/high_wither_fog.json | 10 - .../assets/treasure2/models/item/low_fog.json | 10 - .../treasure2/models/item/low_poison_fog.json | 10 - .../treasure2/models/item/low_wither_fog.json | 10 - .../treasure2/models/item/lucky_pouch.json | 6 - .../treasure2/models/item/masters_pouch.json | 6 - .../assets/treasure2/models/item/med_fog.json | 10 - .../treasure2/models/item/med_poison_fog.json | 10 - .../treasure2/models/item/med_wither_fog.json | 10 - .../assets/treasure2/models/item/onyx.json | 2 +- .../assets/treasure2/models/item/pouch.json | 2 +- .../treasure2/models/item/silver_charm.json | 65 ++++ .../models/item/silver_charm_black_pearl.json | 6 + .../models/item/silver_charm_diamond.json | 6 + .../models/item/silver_charm_emerald.json | 6 + .../models/item/silver_charm_onyx.json | 6 + .../models/item/silver_charm_ruby.json | 6 + .../models/item/silver_charm_sapphire.json | 6 + .../models/item/silver_charm_topaz.json | 6 + .../models/item/silver_charm_white_pearl.json | 6 + .../textures/item/apprentices_pouch.png | Bin 504 -> 0 bytes .../item/charm/copper_black_pearl_charm.png | Bin 0 -> 1926 bytes .../item/charm/copper_diamond_charm.png | Bin 0 -> 5540 bytes .../item/charm/copper_emerald_charm.png | Bin 0 -> 5573 bytes .../textures/item/charm/copper_onyx_charm.png | Bin 0 -> 5517 bytes .../item/charm/copper_white_pearl_charm.png | Bin 0 -> 1934 bytes .../item/charm/gold_black_pearl_charm.png | Bin 0 -> 739 bytes .../item/charm/gold_diamond_charm.png | Bin 0 -> 5515 bytes .../item/charm/gold_emerald_charm.png | Bin 0 -> 5555 bytes .../textures/item/charm/gold_onyx_charm.png | Bin 0 -> 5491 bytes .../item/charm/gold_white_pearl_charm.png | Bin 0 -> 747 bytes .../item/charm/silver_black_pearl_charm.png | Bin 0 -> 743 bytes .../item/charm/silver_diamond_charm.png | Bin 0 -> 5497 bytes .../item/charm/silver_emerald_charm.png | Bin 0 -> 5510 bytes .../textures/item/charm/silver_onyx_charm.png | Bin 0 -> 5462 bytes .../item/charm/silver_white_pearl_charm.png | Bin 0 -> 733 bytes .../item/{imbued_book.png => charm_book.png} | Bin .../textures/item/coins/copper_coin.png | Bin 1511 -> 1867 bytes .../textures/item/coins/gold_coin.png | Bin 1520 -> 314 bytes .../textures/item/coins/silver_coin.png | Bin 1280 -> 268 bytes .../treasure2/textures/item/lucky_pouch.png | Bin 533 -> 0 bytes .../treasure2/textures/item/masters_pouch.png | Bin 531 -> 0 bytes .../data/curios/tags/items/bracelet.json | 2 - .../data/curios/tags/items/charm.json | 5 +- .../data/curios/tags/items/necklace.json | 1 - .../data/curios/tags/items/ring.json | 1 - .../chests/common/general_chest.json | 4 +- .../chests/epic/general_chest.json | 4 +- .../chests/rare/general_chest.json | 4 +- .../chests/scarce/general_chest.json | 6 +- .../chests/uncommon/general_chest.json | 4 +- .../loot_tables/pools/treasure/common.json | 35 +- .../pools/treasure/epic_charms.json | 95 +++++ .../loot_tables/pools/treasure/rare.json | 56 ++- .../pools/treasure/rare_charms.json | 86 +++++ .../loot_tables/pools/treasure/scarce.json | 85 ++++- .../pools/treasure/scarce_charms.json} | 70 ++-- .../loot_tables/pools/treasure/uncommon.json | 77 ++-- .../data/treasure2/tags/items/pouch.json | 7 + .../loot_tables/default_loot_tables_list.json | 10 +- .../loot_tables/entities/bound_soul.json | 35 -- .../chests/common/general_chest.json | 22 -- .../chests/rare/armor_tool_chest.json | 140 -------- .../chests/rare/food_potion_chest.json | 118 ------ .../chests/scarce/armor_tool_chest.json | 146 -------- .../chests/scarce/food_potion_chest.json | 121 ------- .../chests/uncommon/armor_tool_chest.json | 137 ------- .../chests/uncommon/food_potion_chest.json | 115 ------ .../chests/uncommon/general_chest.json | 36 -- .../treasure2/pools/food/common.json | 308 ---------------- .../treasure2/pools/food/epic.json | 23 -- .../treasure2/pools/food/rare.json | 68 ---- .../treasure2/pools/food/scarce.json | 23 -- .../treasure2/pools/food/uncommon.json | 90 ----- .../treasure2/pools/items/common.json | 183 ---------- .../treasure2/pools/items/epic.json | 138 ------- .../treasure2/pools/items/rare.json | 237 ------------ .../treasure2/pools/items/scarce.json | 114 ------ .../treasure2/pools/items/uncommon.json | 225 ------------ .../treasure2/pools/potions/common.json | 60 ---- .../treasure2/pools/potions/epic.json | 84 ----- .../treasure2/pools/potions/rare.json | 120 ------- .../treasure2/pools/potions/scarce.json | 120 ------- .../treasure2/pools/potions/uncommon.json | 84 ----- .../treasure2/pools/tools/common.json | 48 --- .../treasure2/pools/tools/epic.json | 49 --- .../treasure2/pools/tools/rare.json | 62 ---- .../treasure2/pools/tools/scarce.json | 89 ----- .../treasure2/pools/tools/uncommon.json | 63 ---- .../treasure2/pools/treasure/common.json | 103 ------ .../treasure2/pools/treasure/epic.json | 210 ----------- .../treasure2/pools/treasure/epic_charms.json | 116 ------ .../treasure2/pools/treasure/rare.json | 186 ---------- .../treasure2/pools/treasure/rare_charms.json | 142 -------- .../treasure2/pools/treasure/scarce.json | 210 ----------- .../pools/treasure/scarce_charms.json | 117 ------ .../treasure2/pools/treasure/uncommon.json | 162 --------- 156 files changed, 2011 insertions(+), 4911 deletions(-) create mode 100644 src/main/java/com/someguyssoftware/treasure2/capability/PouchCapabilityProvider.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/gui/PouchContainerScreen.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/inventory/PouchInventory.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/inventory/PouchSlot.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/item/CharmBook.java create mode 100644 src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java delete mode 100644 src/main/resources/assets/treasure2/models/item/apprentices_pouch.json delete mode 100644 src/main/resources/assets/treasure2/models/item/charm.json rename src/main/resources/assets/treasure2/models/item/{imbued_book.json => charm_book.json} (56%) create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_black_pearl.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_diamond.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_emerald.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_onyx.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_ruby.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_sapphire.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_topaz.json create mode 100644 src/main/resources/assets/treasure2/models/item/gold_charm_white_pearl.json delete mode 100644 src/main/resources/assets/treasure2/models/item/high_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/high_poison_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/high_wither_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/low_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/low_poison_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/low_wither_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/lucky_pouch.json delete mode 100644 src/main/resources/assets/treasure2/models/item/masters_pouch.json delete mode 100644 src/main/resources/assets/treasure2/models/item/med_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/med_poison_fog.json delete mode 100644 src/main/resources/assets/treasure2/models/item/med_wither_fog.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_black_pearl.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_diamond.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_emerald.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_onyx.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_ruby.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_sapphire.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_topaz.json create mode 100644 src/main/resources/assets/treasure2/models/item/silver_charm_white_pearl.json delete mode 100644 src/main/resources/assets/treasure2/textures/item/apprentices_pouch.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_black_pearl_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_diamond_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_emerald_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_onyx_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/copper_white_pearl_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_black_pearl_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_diamond_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_emerald_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_onyx_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/gold_white_pearl_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_black_pearl_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_diamond_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_emerald_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_onyx_charm.png create mode 100644 src/main/resources/assets/treasure2/textures/item/charm/silver_white_pearl_charm.png rename src/main/resources/assets/treasure2/textures/item/{imbued_book.png => charm_book.png} (100%) delete mode 100644 src/main/resources/assets/treasure2/textures/item/lucky_pouch.png delete mode 100644 src/main/resources/assets/treasure2/textures/item/masters_pouch.png create mode 100644 src/main/resources/data/treasure2/loot_tables/pools/treasure/epic_charms.json create mode 100644 src/main/resources/data/treasure2/loot_tables/pools/treasure/rare_charms.json rename src/main/resources/{loot_tables/treasure2/pools/treasure/uncommon_charms.json => data/treasure2/loot_tables/pools/treasure/scarce_charms.json} (52%) create mode 100644 src/main/resources/data/treasure2/tags/items/pouch.json delete mode 100644 src/main/resources/loot_tables/entities/bound_soul.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/common/general_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/rare/armor_tool_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/rare/food_potion_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/scarce/armor_tool_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/scarce/food_potion_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/uncommon/armor_tool_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/uncommon/food_potion_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/chests/uncommon/general_chest.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/food/common.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/food/epic.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/food/rare.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/food/scarce.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/food/uncommon.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/items/common.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/items/epic.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/items/rare.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/items/scarce.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/items/uncommon.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/potions/common.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/potions/epic.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/potions/rare.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/potions/scarce.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/potions/uncommon.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/tools/common.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/tools/epic.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/tools/rare.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/tools/scarce.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/tools/uncommon.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/common.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/epic.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/epic_charms.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/rare.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/rare_charms.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/scarce.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/scarce_charms.json delete mode 100644 src/main/resources/loot_tables/treasure2/pools/treasure/uncommon.json diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java index ca4a5eed9..eeef6c8cc 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapability.java @@ -26,8 +26,12 @@ import java.util.Map; import java.util.Optional; import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.charm.CharmableMaterial; +import com.someguyssoftware.treasure2.charm.ICharm; import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.charm.TreasureCharms; @@ -52,42 +56,45 @@ public class CharmableCapability implements ICharmableCapability { /* * Properties that refer to the Item that has this capability */ - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") ArrayList[] charmEntities = (ArrayList[])new ArrayList[3]; - // is this item a charm source/originator ie. not an adornment or an item that is "given" a charm - private boolean source; - // is this item bindable to a target item that is socketable - private boolean bindable; - - // does this item have sockets - accepts bindable items - private boolean socketable; - // can this item imbue atarget item - private boolean imbuing; - // can this item be imbued - private boolean imbuable; - // does this item have "built-in" innate charms - private boolean innate; - - // the base material this item is made of - private ResourceLocation baseMaterial; - // the item that this capability belongs to - private ResourceLocation sourceItem; - - /* - * Propeties that refer to the Charm Inventory the the Item that has this capability - */ - private int maxSocketsSize; - private int maxImbueSize; - private int maxInnateSize; - - + // is this item a charm source/originator ie. not an adornment or an item that is imbued or socketed with a charm + private boolean source; + // can this item cast/execute its charms + private boolean executing; + // is this item bindable to a target item that is socketable + private boolean bindable; + // does this item have sockets - accepts bindable items + private boolean socketable; + // can this item imbue atarget item + private boolean imbuing; + // can this item be imbued + private boolean imbuable; + // does this item have "built-in" innate charms + private boolean innate; + + // the base material this item is made of + private ResourceLocation baseMaterial; + // the item that this capability belongs to + private ResourceLocation sourceItem; + // the current charm with the highest level + private ICharmEntity highestLevel; + + /* + * Propeties that refer to the Charm Inventory the the Item that has this capability + */ + private int maxSocketsSize; + private int maxImbueSize; + private int maxInnateSize; + + /** * */ public CharmableCapability() { init(); } - + /** * * @param builder @@ -95,6 +102,7 @@ public CharmableCapability() { public CharmableCapability(Builder builder) { this(); this.source = builder.source; + this.executing = builder.executing; this.bindable = builder.bindable; this.innate = builder.innate; this.maxInnateSize = innate ? Math.max(1, builder.maxInnateSize) : 0; @@ -105,7 +113,7 @@ public CharmableCapability(Builder builder) { this.baseMaterial = builder.baseMaterial; this.sourceItem = builder.sourceItem; } - + /** * */ @@ -114,7 +122,7 @@ protected void init() { charmEntities[InventoryType.IMBUE.value] = new ArrayList<>(1); charmEntities[InventoryType.SOCKET.value] = new ArrayList<>(1); } - + /** * Convenience method. * @param type @@ -123,13 +131,66 @@ protected void init() { @Override public void add(InventoryType type, ICharmEntity entity) { // test if the level of charm item/cap is >= entity.level; else return - +// if (entity.getCharm().getLevel() > this.getMaxCharmLevel()) { +// Treasure.LOGGER.debug("supplied charm entity has a greater level than the max allowed"); +// return; +// } + // test if there is enough space to add -// Treasure.LOGGER.debug("adding type -> {} charm -> {}", type, entity.getCharm()); + // Treasure.LOGGER.debug("adding type -> {} charm -> {}", type, entity.getCharm()); if (charmEntities[type.value].size() < getMaxSize(type)) { charmEntities[type.value].add(entity); + + // record highest level charm + if (highestLevel == null || entity.getCharm().getLevel() > highestLevel.getCharm().getLevel()) { + highestLevel = entity; + } } -// Treasure.LOGGER.debug("ther are {} type -> {} charms", charmEntities[type.value].size(), type); + // Treasure.LOGGER.debug("ther are {} type -> {} charms", charmEntities[type.value].size(), type); + } + + public void remove(InventoryType type, ICharmEntity entity) { + // STUB + } + + /** + * + * @param type + * @param index + */ + @Override + public void remove(InventoryType type, int index) { + getCharmEntities()[type.getValue()].remove(index); + // recalc highest level + highestLevel = null; + getAllCharmEntities().forEach(entity -> { + if (highestLevel == null || entity.getCharm().getLevel() > highestLevel.getCharm().getLevel()) { + highestLevel = entity; + } + }); + } + + /** + * + * @param charm + * @return + */ + @Override + public boolean contains(ICharm charm) { + for (ICharmEntity entity : getAllCharmEntities()) { + if (entity.getCharm().getType().equalsIgnoreCase(charm.getType()) || + entity.getCharm().getName().equals(charm.getName())) { + return true; + } + } + return false; + } + + @Override + public List getAllCharmEntities() { + return Stream.of(charmEntities[InventoryType.INNATE.value], charmEntities[InventoryType.IMBUE.value], charmEntities[InventoryType.SOCKET.value]) + .flatMap(x -> x.stream()) + .collect(Collectors.toList()); } /** @@ -137,11 +198,12 @@ public void add(InventoryType type, ICharmEntity entity) { * @param type * @return */ + @Override public int getMaxSize(InventoryType type) { // check against SOCKET first as this will be the most common return (type == InventoryType.SOCKET ? getMaxSocketsSize() : type == InventoryType.IMBUE ? getMaxImbueSize() : getMaxInnateSize()); } - + @Override public boolean isCharmed() { int size = 0; @@ -166,10 +228,10 @@ public int getMaxCharmLevel() { CharmableMaterial effectiveBase = base.isPresent() ? base.get() : TreasureCharms.COPPER; return effectiveBase.getMaxLevel() + (int) Math.floor(effectiveBase.getLevelMultiplier() * (source.isPresent() ? source.get().getMaxLevel() : 0)); } - + @Override public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { - tooltip.add(new TranslationTextComponent("tooltip.label.charmed").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); +// tooltip.add(new TranslationTextComponent("tooltip.charmable.usage").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); tooltip.add(new TranslationTextComponent("tooltip.label.charms").withStyle(TextFormatting.YELLOW, TextFormatting.BOLD)); // create header text for inventory type @@ -177,7 +239,7 @@ public void appendHoverText(ItemStack stack, World world, List t appendHoverText(stack, world, tooltip, flag, InventoryType.IMBUE, true); appendHoverText(stack, world, tooltip, flag, InventoryType.SOCKET, true); } - + /** * * @param stack @@ -195,7 +257,7 @@ private void appendHoverText(ItemStack stack, World world, List TextFormatting color = inventoryType == InventoryType.SOCKET ? TextFormatting.BLUE : TextFormatting.DARK_RED; tooltip.add( new TranslationTextComponent("tooltip.label.charm.type." + inventoryType.name().toLowerCase()).withStyle(color) - .append(getCapacityHoverText(stack, world, entityList).withStyle(TextFormatting.WHITE)) + .append(getCapacityHoverText(stack, world, entityList).withStyle(TextFormatting.WHITE)) ); } // add charms @@ -205,24 +267,25 @@ private void appendHoverText(ItemStack stack, World world, List } } - @SuppressWarnings("deprecation") + @SuppressWarnings("deprecation") public void appendCapacityHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag, List entities) { - -// tooltip.add(new TranslationTextComponent("tooltip.label.charmable.slots").withStyle(TextFormatting.GRAY)); - tooltip.add(new TranslationTextComponent("tooltip.label.charmable.slots", + + // tooltip.add(new TranslationTextComponent("tooltip.charmable.slots").withStyle(TextFormatting.GRAY)); + tooltip.add(new TranslationTextComponent("tooltip.charmable.slots", String.valueOf(Math.toIntExact(Math.round(entities.size()))), // used String.valueOf(Math.toIntExact(Math.round(this.maxSocketsSize)))) // max .withStyle(TextFormatting.WHITE)); - } - - @SuppressWarnings("deprecation") + } + + @SuppressWarnings("deprecation") public TranslationTextComponent getCapacityHoverText(ItemStack stack, World world, List entities) { - return new TranslationTextComponent("tooltip.label.charmable.slots", + return new TranslationTextComponent("tooltip.charmable.slots", String.valueOf(Math.toIntExact(Math.round(entities.size()))), // used String.valueOf(Math.toIntExact(Math.round(this.maxSocketsSize)))); // max - } - + } + @Override + // TODO need to rename to getCharmEntityLists() public List[] getCharmEntities() { if (charmEntities == null) { this.charmEntities = (ArrayList[])new ArrayList[3]; @@ -235,10 +298,13 @@ public void setCharmEntities(List[] entities) { this.charmEntities = (ArrayList[]) entities; } + // TODO probably could use a rename + @Override public boolean isSource() { return source; } + @Override public void setSource(boolean source) { this.source = source; } @@ -292,12 +358,12 @@ public boolean isInnate() { public void setInnate(boolean innate) { this.innate = innate; } - + @Override public int getMaxInnateSize() { return maxInnateSize; } - + @Override public int getMaxSocketsSize() { return maxSocketsSize; @@ -322,7 +388,7 @@ public void setMaxImbueSize(int maxImbueSize) { public void setMaxInnateSize(int maxInnateSize) { this.maxInnateSize = maxInnateSize; } - + @Override public ResourceLocation getBaseMaterial() { return baseMaterial; @@ -332,7 +398,7 @@ public ResourceLocation getBaseMaterial() { public void setBaseMaterial(ResourceLocation baseMaterial) { this.baseMaterial = baseMaterial; } - + @Override public ResourceLocation getSourceItem() { return sourceItem; @@ -341,6 +407,16 @@ public ResourceLocation getSourceItem() { public void setSourceItem(ResourceLocation sourceItem) { this.sourceItem = sourceItem; } + + @Override + public boolean isExecuting() { + return executing; + } + + @Override + public void setExecuting(boolean executing) { + this.executing = executing; + } /** * @@ -351,17 +427,17 @@ public enum InventoryType { INNATE(0), IMBUE(1), SOCKET(2); - + private static final Map values = new HashMap(); Integer value; - + // setup reverse lookup static { for (InventoryType x : EnumSet.allOf(InventoryType.class)) { values.put(x.getValue(), x); } } - + InventoryType(Integer value) { this.value = value; } @@ -369,7 +445,7 @@ public enum InventoryType { public Integer getValue() { return value; } - + /** * * @param value @@ -379,83 +455,94 @@ public static InventoryType getByValue(Integer value) { return (InventoryType) values.get(value); } } - + /** * * @author Mark Gottschling on Aug 16, 2021 * */ public static class Builder { - private boolean source; - public boolean bindable; - public boolean socketable; - public boolean imbuing; - public boolean imbuable; - public boolean innate; - - public ResourceLocation baseMaterial = TreasureCharms.COPPER.getName(); - - // required property - public ResourceLocation sourceItem; - - public int maxSocketsSize; - public int maxImbueSize; - public int maxInnateSize; - - // required to pass the source Item here - public Builder(ResourceLocation sourceItem) { - this.sourceItem = sourceItem; - } - - public Builder with(Consumer builder) { - builder.accept(this); - return this; - } - - public Builder source(boolean source) { - this.source = source; - return this; - } - + public boolean source; + public boolean executing = true; + public boolean bindable; + public boolean socketable; + public boolean imbuing; + public boolean imbuable; + public boolean innate; + + public ResourceLocation baseMaterial = TreasureCharms.COPPER.getName(); + + // required property + public ResourceLocation sourceItem; + + public int maxSocketsSize; + public int maxImbueSize; + public int maxInnateSize; + + // required to pass the source Item here + public Builder(ResourceLocation sourceItem) { + this.sourceItem = sourceItem; + } + + public Builder with(Consumer builder) { + builder.accept(this); + return this; + } + + public Builder source(boolean source) { + this.source = source; + return this; + } + + public Builder executing(boolean executing) { + this.executing = executing; + return this; + } + public Builder bindable(boolean bindable) { this.bindable = bindable; return this; } - - public Builder socketable(boolean socketable, int size) { - this.socketable = socketable; - this.maxSocketsSize = size; - return this; - } - - public Builder innate(boolean innate, int size) { - this.innate = innate; - this.maxInnateSize = size; - return this; - } - - public Builder imbue(boolean imbue, int size) { - this.imbuable = imbue; - this.maxImbueSize = size; - return this; - } - - public Builder imbuing(boolean imbuing) { - this.imbuing = imbuing; - return this; - } - - public Builder baseMaterial(ResourceLocation material) { - this.baseMaterial = material; - return this; - } - - public ICharmableCapability build() { - // calculate the max charm level based on baseMaterial and the source item. -// Treasure.LOGGER.debug("charm source item -> {}", sourceItem); -// Optional level = TreasureCharms.getCharmLevel(sourceItem); -// this.maxCharmLevel = baseMaterial.getMaxLevel() + (level.isPresent() ? level.get() : 0) ; - return new CharmableCapability(this); - } + + public Builder socketable(boolean socketable, int size) { + this.socketable = socketable; + this.maxSocketsSize = size; + return this; + } + + public Builder innate(boolean innate, int size) { + this.innate = innate; + this.maxInnateSize = size; + return this; + } + + public Builder imbue(boolean imbue, int size) { + this.imbuable = imbue; + this.maxImbueSize = size; + return this; + } + + public Builder imbuing(boolean imbuing) { + this.imbuing = imbuing; + return this; + } + + public Builder baseMaterial(ResourceLocation material) { + this.baseMaterial = material; + return this; + } + + public ICharmableCapability build() { + // calculate the max charm level based on baseMaterial and the source item. + // Treasure.LOGGER.debug("charm source item -> {}", sourceItem); + // Optional level = TreasureCharms.getCharmLevel(sourceItem); + // this.maxCharmLevel = baseMaterial.getMaxLevel() + (level.isPresent() ? level.get() : 0) ; + return new CharmableCapability(this); + } + } + + @Override + public ICharmEntity getHighestLevel() { + return highestLevel; } } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java index ed0259c58..c350f1635 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityProvider.java @@ -1,6 +1,6 @@ package com.someguyssoftware.treasure2.capability; -import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.CHARMABLE_CAPABILITY; +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.CHARMABLE; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; @@ -31,7 +31,7 @@ public CharmableCapabilityProvider(ICharmableCapability capability) { @SuppressWarnings("unchecked") @Override public LazyOptional getCapability(Capability capability, Direction side) { - if (capability == CHARMABLE_CAPABILITY) { + if (capability == CHARMABLE) { return (LazyOptional) LazyOptional.of(() -> instance); } return LazyOptional.empty(); @@ -39,12 +39,12 @@ public LazyOptional getCapability(Capability capability, Direction sid @Override public CompoundNBT serializeNBT() { - CompoundNBT tag = (CompoundNBT)CHARMABLE_CAPABILITY.getStorage().writeNBT(CHARMABLE_CAPABILITY, instance, null); + CompoundNBT tag = (CompoundNBT)CHARMABLE.getStorage().writeNBT(CHARMABLE, instance, null); return tag; } @Override public void deserializeNBT(CompoundNBT nbt) { - CHARMABLE_CAPABILITY.getStorage().readNBT(CHARMABLE_CAPABILITY, instance, null, nbt); + CHARMABLE.getStorage().readNBT(CHARMABLE, instance, null, nbt); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java index 6977f6986..d23fda82e 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/CharmableCapabilityStorage.java @@ -45,6 +45,8 @@ */ public class CharmableCapabilityStorage implements Capability.IStorage { + private static final String SOURCE = "source"; + private static final String EXECUTING = "executing"; private static final String BINDABLE = "bindable"; private static final String INNATE = "innate"; private static final String MAX_INNATE_SIZE = "maxInnateSize"; @@ -82,6 +84,8 @@ public INBT writeNBT(Capability capability, ICharmableCapa /* * save charm cap properties */ + nbt.putBoolean(SOURCE, instance.isSource()); + nbt.putBoolean(EXECUTING, instance.isExecuting());; nbt.putBoolean(BINDABLE, instance.isBindable()); nbt.putBoolean(INNATE, instance.isInnate()); @@ -138,6 +142,13 @@ public void readNBT(Capability capability, ICharmableCapab } // load cap properties + if (tag.contains(SOURCE)) { + instance.setSource(tag.getBoolean(SOURCE)); + } + if (tag.contains(EXECUTING)) { + instance.setExecuting(tag.getBoolean(EXECUTING)); + } + if (tag.contains(BINDABLE)) { instance.setBindable(tag.getBoolean(BINDABLE)); } diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java index 79603f0eb..49617f0cf 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/ICharmableCapability.java @@ -22,6 +22,7 @@ import java.util.List; import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.ICharm; import com.someguyssoftware.treasure2.charm.ICharmEntity; import net.minecraft.client.util.ITooltipFlag; @@ -51,6 +52,9 @@ public interface ICharmableCapability { int getMaxCharmLevel(); public void appendHoverText(ItemStack stack, World world, List tooltip, ITooltipFlag flag); + public boolean isSource(); + public void setSource(boolean source); + public boolean isBindable(); public void setBindable(boolean bindable); @@ -69,6 +73,8 @@ public interface ICharmableCapability { public void setSocketable(boolean socketable); public int getMaxSocketsSize(); + public int getMaxSize(InventoryType type); + void setMaxSocketsSize(int maxSocketsSize); void setMaxImbueSize(int maxImbueSize); void setMaxInnateSize(int maxInnateSize); @@ -78,4 +84,13 @@ public interface ICharmableCapability { ResourceLocation getSourceItem(); void setSourceItem(ResourceLocation sourceItem); + + public boolean contains(ICharm charm); + public List getAllCharmEntities(); + ICharmEntity getHighestLevel(); + + void remove(InventoryType type, int index); + boolean isExecuting(); + public void setExecuting(boolean executing); + } \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/PouchCapabilityProvider.java b/src/main/java/com/someguyssoftware/treasure2/capability/PouchCapabilityProvider.java new file mode 100644 index 000000000..b53512ed6 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/capability/PouchCapabilityProvider.java @@ -0,0 +1,64 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.capability; + +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.POUCH_CAPABILITY; + +import com.someguyssoftware.treasure2.inventory.PouchInventory; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.capabilities.ICapabilitySerializable; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.ItemStackHandler; + +/** + * + * @author Mark Gottschling on May 14, 2020 + * + */ +public class PouchCapabilityProvider implements ICapabilityProvider, ICapabilitySerializable { + + // capabilities for item + private final ItemStackHandler instance = new ItemStackHandler(PouchInventory.INVENTORY_SIZE); + + @SuppressWarnings("unchecked") + @Override + public LazyOptional getCapability(Capability capability, Direction side) { + if (capability ==POUCH_CAPABILITY) { + return (LazyOptional) LazyOptional.of(() -> instance); + } + return LazyOptional.empty(); + } + + @Override + public CompoundNBT serializeNBT() { + CompoundNBT tag = this.instance.serializeNBT(); + return tag; + } + + @Override + public void deserializeNBT(CompoundNBT nbt) { +// POUCH_CAPABILITY.getStorage().readNBT(POUCH_CAPABILITY, instance, null, nbt); + this.instance.deserializeNBT(nbt); + } +} \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java b/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java index 288884648..22455c669 100644 --- a/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java +++ b/src/main/java/com/someguyssoftware/treasure2/capability/TreasureCapabilities.java @@ -38,7 +38,10 @@ public class TreasureCapabilities { public static Capability KEY_RING_CAPABILITY = null; @CapabilityInject(ICharmableCapability.class) - public static Capability CHARMABLE_CAPABILITY = null; + public static Capability CHARMABLE = null; + + @CapabilityInject(IItemHandler.class) + public static Capability POUCH_CAPABILITY = null; /** * @@ -47,5 +50,5 @@ public static void register() { CapabilityManager.INSTANCE.register(IDurabilityCapability.class, new DurabilityCapabilityStorage(), DurabilityCapability::new); CapabilityManager.INSTANCE.register(IKeyRingCapability.class, new KeyRingCapabilityStorage(), KeyRingCapability::new); CapabilityManager.INSTANCE.register(ICharmableCapability.class, new CharmableCapabilityStorage(), CharmableCapability::new); - } + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java index a82107620..1bf7119a1 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/AegisCharm.java @@ -50,7 +50,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List tooltip.add(new StringTextComponent(" ") .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); tooltip.add(new StringTextComponent(" ") - .append(new TranslationTextComponent("tooltip.charm.aegis_rate", 100).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); + .append(new TranslationTextComponent("tooltip.charm.rate.aegis", 100).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java index 1f699109f..01a5b0624 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/Charm.java @@ -130,7 +130,7 @@ public CompoundNBT save(CompoundNBT nbt) { */ @SuppressWarnings("deprecation") public String getLabel(ICharmEntity entity) { - return new TranslationTextComponent("tooltip.charm." + getType().toLowerCase(), getLevel()).getString() + " " + getUsesGauge(entity); + return new TranslationTextComponent("tooltip.charm.type." + getType().toLowerCase()).getString() + " " + String.valueOf(getLevel()) + " " + getUsesGauge(entity); /* * 1. check for mod item specific label diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java index 5ae415867..f2b42d543 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DecayCurse.java @@ -81,7 +81,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.DARK_RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.decay_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.decay").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java index b45316295..6a34e1e95 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DecrepitCurse.java @@ -67,7 +67,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.DARK_RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.decrepit_rate", Math.round((entity.getPercent()-1)*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.decrepit", Math.round((this.getMaxPercent()-1)*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java index bda6064f5..cec5bca79 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/DrainCharm.java @@ -93,7 +93,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.drain_rate", Math.toIntExact(Math.round(entity.getPercent() * 100))).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.drain", this.getMaxDuration()).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java index 9165c3c77..013be1e79 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/FireImmunityCharm.java @@ -72,7 +72,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.fire_immunity_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.fire_immunity").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java index 703bc62fa..83fc6c393 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/FireResistenceCharm.java @@ -78,7 +78,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.fire_resistence_rate", Math.toIntExact(Math.round(entity.getPercent() * 100))).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.fire_resistence", Math.toIntExact(Math.round(entity.getPercent() * 100))).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java index 3cae1f198..e37ffda4e 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/GreaterHealingCharm.java @@ -54,7 +54,7 @@ public float getHealRate() { @Override public boolean update(World world, Random random, ICoords coords, PlayerEntity player, Event event, final ICharmEntity entity) { boolean result = false; - if (world.getGameTime() % 10 == 0) { + if (world.getGameTime() % 20 == 0) { if (entity.getValue() > 0 && player.getHealth() < player.getMaxHealth() && player.isAlive()) { float amount = Math.min(getHealRate(), player.getMaxHealth() - player.getHealth()); player.setHealth(MathHelper.clamp(player.getHealth() + amount, 0.0F, player.getMaxHealth())); @@ -72,7 +72,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.greater_healing_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.greater_healing").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java index 4d28ae026..229f868ce 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/HealingCharm.java @@ -73,7 +73,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.healing_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.healing").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java index 9bc9bd21e..c7b6e4c29 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/IlluminationCharm.java @@ -147,7 +147,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.illumination_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.illumination").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java index 4c200b089..57349e713 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/LifeStrikeCharm.java @@ -99,7 +99,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.RED; tooltip.add(new TranslationTextComponent(getLabel(entity)).withStyle(color)); - tooltip.add(new TranslationTextComponent("tooltip.charm.life_strike_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.life_strike", Math.round((this.getMaxPercent()-1)*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } public static class Builder extends Charm.Builder { diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java index 299577f65..d2b1844d1 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ReflectionCharm.java @@ -103,7 +103,8 @@ public void appendHoverText(ItemStack stack, World worldIn, List tooltip.add(new StringTextComponent(" ") .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); tooltip.add(new StringTextComponent(" ") - .append(new TranslationTextComponent("tooltip.charm.reflection_rate", Math.toIntExact((long)entity.getPercent()*100), entity.getDuration()).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); + // TODO crud all these rates need to pull from the charm! + .append(new TranslationTextComponent("tooltip.charm.rate.reflection", Math.round(this.getMaxPercent()*100), entity.getDuration()).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java b/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java index 6e316d4fb..73cb9d46c 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/RuinCurse.java @@ -114,7 +114,7 @@ public boolean update(World world, Random random, ICoords coords, PlayerEntity p public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn, ICharmEntity entity) { TextFormatting color = TextFormatting.DARK_RED; tooltip.add(new StringTextComponent(" ").append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); - tooltip.add(new TranslationTextComponent("tooltip.charm.ruin_rate").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + tooltip.add(new TranslationTextComponent("tooltip.charm.rate.ruin").withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } /** diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java index cb6461c57..60046764b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/SatietyCharm.java @@ -83,7 +83,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List tooltip.add(new StringTextComponent(" ") .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); tooltip.add(new StringTextComponent(" ") - .append(new TranslationTextComponent("tooltip.charm.satiety_rate")).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); + .append(new TranslationTextComponent("tooltip.charm.rate.satiety")).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC)); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java b/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java index 13877dc76..1d6130e35 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/ShieldingCharm.java @@ -96,7 +96,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List tooltip.add(new StringTextComponent(" ") .append(new TranslationTextComponent(getLabel(entity)).withStyle(color))); tooltip.add(new StringTextComponent(" ") - .append(new TranslationTextComponent("tooltip.charm.shielding_rate", Math.round(entity.getPercent()*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); + .append(new TranslationTextComponent("tooltip.charm.rate.shielding", Math.round(this.getMaxPercent()*100)).withStyle(TextFormatting.GRAY, TextFormatting.ITALIC))); } diff --git a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java index f6dd7d5a9..8c30426ee 100644 --- a/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java +++ b/src/main/java/com/someguyssoftware/treasure2/charm/TreasureCharmRegistry.java @@ -121,6 +121,6 @@ public static Optional> getBy(Predicate predicate) { * @return */ public static List values() { - return (List) REGISTRY.values(); + return new ArrayList<>(REGISTRY.values()); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/command/SpawnChestCommand.java b/src/main/java/com/someguyssoftware/treasure2/command/SpawnChestCommand.java index b4cf8a0fb..9a6710f60 100644 --- a/src/main/java/com/someguyssoftware/treasure2/command/SpawnChestCommand.java +++ b/src/main/java/com/someguyssoftware/treasure2/command/SpawnChestCommand.java @@ -20,6 +20,7 @@ import com.someguyssoftware.treasure2.block.TreasureBlocks; import com.someguyssoftware.treasure2.data.TreasureData; import com.someguyssoftware.treasure2.enums.ChestGeneratorType; +import com.someguyssoftware.treasure2.enums.PitTypes; import com.someguyssoftware.treasure2.enums.Rarity; import com.someguyssoftware.treasure2.enums.WorldGenerators; import com.someguyssoftware.treasure2.generator.chest.IChestGenerator; @@ -72,6 +73,10 @@ public static List getNames() { } } + private static final SuggestionProvider SUGGEST_RARITY = (source, builder) -> { + return ISuggestionProvider.suggest(Rarity.getNames().stream(), builder); + }; + private static final SuggestionProvider SUGGEST_CHEST = (source, builder) -> { return ISuggestionProvider.suggest(TreasureData.CHESTS_BY_NAME.keySet().stream(), builder); }; @@ -84,13 +89,19 @@ public static void register(CommandDispatcher dispatcher) { }) .then(Commands.argument("pos", BlockPosArgument.blockPos()) .executes(source -> { - return spawn(source.getSource(), BlockPosArgument.getOrLoadBlockPos(source, "pos"), ""); + return spawn(source.getSource(), BlockPosArgument.getOrLoadBlockPos(source, "pos"), "", Rarity.COMMON.name()); }) .then(Commands.argument("name", StringArgumentType.string()) .suggests(SUGGEST_CHEST).executes(source -> { return spawn(source.getSource(), BlockPosArgument.getOrLoadBlockPos(source, "pos"), - StringArgumentType.getString(source, "name")); + StringArgumentType.getString(source, "name"), Rarity.COMMON.name()); }) + .then(Commands.argument("rarity", StringArgumentType.string()) + .suggests(SUGGEST_RARITY).executes(source -> { + return spawn(source.getSource(), BlockPosArgument.getOrLoadBlockPos(source, "pos"), + StringArgumentType.getString(source, "name"), StringArgumentType.getString(source, "rarity")); + }) + ) ) ) ); @@ -103,12 +114,12 @@ public static void register(CommandDispatcher dispatcher) { * @param name * @return */ - private static int spawn(CommandSource source, BlockPos pos, String name) { - Treasure.LOGGER.info("executing spawn chest, pos -> {}, name -> {}", pos, name); + private static int spawn(CommandSource source, BlockPos pos, String name, String rarityName) { + Treasure.LOGGER.info("executing spawn chest, pos -> {}, name -> {}, rarity -> {}", pos, name, rarityName); try { ServerWorld world = source.getLevel(); Random random = new Random(); - Rarity rarity = Rarity.COMMON; + Rarity rarity = rarityName.isEmpty() ? Rarity.COMMON : Rarity.valueOf(rarityName.toUpperCase()); Optional chests = Optional.empty(); // get the chest world generator diff --git a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java index e620639c7..2f445cc9b 100644 --- a/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java +++ b/src/main/java/com/someguyssoftware/treasure2/config/TreasureConfig.java @@ -124,7 +124,10 @@ public static class ItemID { public static final String SKELETON_ITEM_ID = "skeleton"; public static final String EYE_PATCH_ID = "eye_patch"; public static final String SPANISH_MOSS_ITEM_ID = "spanish_moss_item"; - + public static final String CHARM_BOOK = "charm_book"; + public static final String COPPER_CHARM = "copper_charm"; + public static final String SILVER_CHARM = "silver_charm"; + public static final String GOLD_CHARM = "gold_charm"; } public static class LockID { diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/AnvilEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/AnvilEventHandler.java index 81675ece9..04c35d23c 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/AnvilEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/AnvilEventHandler.java @@ -19,11 +19,21 @@ */ package com.someguyssoftware.treasure2.eventhandler; +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.CHARMABLE; import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.DURABILITY_CAPABILITY; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicReference; + import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; import com.someguyssoftware.treasure2.capability.IDurabilityCapability; +import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.charm.ICharmEntity; +import com.someguyssoftware.treasure2.item.KeyItem; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.AnvilUpdateEvent; @@ -45,8 +55,12 @@ public static void onAnvilUpdate(AnvilUpdateEvent event) { ItemStack leftItemStack = event.getLeft(); ItemStack rightItemStack = event.getRight(); - if (leftItemStack.getCapability(DURABILITY_CAPABILITY).isPresent() - && rightItemStack.getCapability(DURABILITY_CAPABILITY).isPresent()) { +// Treasure.LOGGER.debug("is imbuing -> {}", leftItemStack.getCapability(CHARMABLE).map(cap -> cap.isImbuing()).orElse(false)); +// Treasure.LOGGER.debug("is imbuable -> {}", rightItemStack.getCapability(CHARMABLE).map(cap -> cap.isImbuable()).orElse(false)); + + // check for KeyItems and having the durability capability + if (leftItemStack.getItem() instanceof KeyItem && leftItemStack.getCapability(DURABILITY_CAPABILITY).isPresent() + && rightItemStack.getItem() instanceof KeyItem && rightItemStack.getCapability(DURABILITY_CAPABILITY).isPresent()) { event.setCost(1); LazyOptional leftItemCap = leftItemStack.getCapability(DURABILITY_CAPABILITY); LazyOptional rightItemCap = rightItemStack.getCapability(DURABILITY_CAPABILITY); @@ -78,6 +92,87 @@ public static void onAnvilUpdate(AnvilUpdateEvent event) { } event.setOutput(outputItem); } + // else check for Book -> Charm or Book -> Adornment +// else if (leftItemStack.getItem() instanceof CharmBook && rightItemStack.getCapability(TreasureCapabilities.CHARMABLE).isPresent()) {} + + // TODO add logging + // TODO reenable when add adornments +// else if (leftItemStack.getCapability(CHARMABLE).map(cap -> cap.isImbuing()).orElse(false) && +// rightItemStack.getCapability(CHARMABLE).map(cap -> cap.isImbuable()).orElse(false)) { +// event.setCost(1); +// if (Treasure.LOGGER.isDebugEnabled()) { +// Treasure.LOGGER.debug("book -> charm"); +// } +// doImbueItem(event, leftItemStack, rightItemStack); +// } + } + + /** + * + * @param left + * @param right + * @return + * @return + */ + public static void doImbueItem(AnvilUpdateEvent event, ItemStack left, ItemStack right) { +// ItemStack outputItem = new ItemStack(right.getItem()); + + // TODO determine if the right is a high enough level + left.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(leftCap -> { + Treasure.LOGGER.debug("have left cap"); + right.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(rightCap -> { + Treasure.LOGGER.debug("have right cap"); + ICharmEntity leftEntity = leftCap.getCharmEntities()[InventoryType.INNATE.getValue()].get(0); + if (Treasure.LOGGER.isDebugEnabled()) { + Treasure.LOGGER.debug("leftEntity.level -> {}, rightCap.maxLevel -> {}", leftEntity.getCharm().getLevel(), rightCap.getMaxCharmLevel()); + } + if (rightCap.getMaxCharmLevel() >= leftEntity.getCharm().getLevel()) { + Treasure.LOGGER.debug("charm can take imbuing"); + + Optional output; + if (rightCap.isSource()) { + Treasure.LOGGER.debug("charm is a source -> do innate"); + // TODO create method. all the same steps, just different inventories + // check the innate size +// if (rightCap.getCharmEntities()[InventoryType.INNATE.getValue()].size() < rightCap.getMaxInnateSize()) { +// outputItem.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(outputCap -> { +// // copy existing charms from right to output +// outputCap.setCharmEntities(rightCap.getCharmEntities()); +// // copy left charm to output innate +// outputCap.add(InventoryType.INNATE, leftEntity); +// // TODO set the output +// }); +// } + output = createCharmOutputStack(right.getItem(), leftEntity, rightCap, InventoryType.INNATE); + } + else { + Treasure.LOGGER.debug("charm is not a source -> do imbue"); + // check the imbue size + output = createCharmOutputStack(right.getItem(), leftEntity, rightCap, InventoryType.IMBUE); + } + if (output.isPresent()) { + Treasure.LOGGER.debug("output is present"); + event.setOutput(output.get()); + } + } + }); + }); + } + + private static Optional createCharmOutputStack(Item item, ICharmEntity entity, ICharmableCapability rightCap, InventoryType type) { + ItemStack outputStack = new ItemStack(item); + AtomicReference stackRef = new AtomicReference<>(); + if (rightCap.getCharmEntities()[type.getValue()].size() < rightCap.getMaxSize(type)) { + outputStack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(outputCap -> { + // copy existing charms from right to output + outputCap.setCharmEntities(rightCap.getCharmEntities()); + // copy left charm to output innate + outputCap.add(type, entity); + // reference the output + stackRef.set(outputStack); + }); + } + return stackRef.get() == null ? Optional.empty() : Optional.of(stackRef.get()); } } } diff --git a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java index 762f2c4fa..c321179de 100644 --- a/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java +++ b/src/main/java/com/someguyssoftware/treasure2/eventhandler/PlayerEventHandler.java @@ -19,6 +19,8 @@ */ package com.someguyssoftware.treasure2.eventhandler; +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.*; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -92,7 +94,7 @@ public static void checkCharmsInteraction(LivingUpdateEvent event) { processCharms(event, player); } } - + /** * * @param event @@ -110,7 +112,7 @@ public void checkCharmsInteractionWithDamage(LivingDamageEvent event) { processCharms(event, player); } } - + /** * * @param event @@ -120,37 +122,37 @@ public void checkCharmsInteractionWithAttack(LivingHurtEvent event) { if (WorldInfo.isClientSide(event.getEntity().level)) { return; } - + if (event.getSource().getDirectEntity() instanceof PlayerEntity) { // get the player ServerPlayerEntity player = (ServerPlayerEntity) event.getSource().getDirectEntity(); processCharms(event, player); } } - -// Maybe use BlockEvent.BreakBlock and then use Global Loot Modifiers?? -// @SubscribeEvent -// public void checkCharmsInteractionWithBlock(BlockEvent.HarvestDropsEvent event) { -// if (WorldInfo.isClientSide(event.getWorld())) { -// return; -// } -// -// if (event.getHarvester() == null) { -// return; -// } -// -// // if the harvested blcok has a tile entity then don't process -// // NOTE this may exclude non-inventory blocks -// IBlockState harvestedState = event.getState(); -// Block harvestedBlock = harvestedState.getBlock(); -// if (harvestedBlock.hasTileEntity(harvestedState)) { -// return; -// } -// -// // get the player -// EntityPlayerMP player = (EntityPlayerMP) event.getHarvester(); -// processCharms(event, player); -// } + + // Maybe use BlockEvent.BreakBlock and then use Global Loot Modifiers?? + // @SubscribeEvent + // public void checkCharmsInteractionWithBlock(BlockEvent.HarvestDropsEvent event) { + // if (WorldInfo.isClientSide(event.getWorld())) { + // return; + // } + // + // if (event.getHarvester() == null) { + // return; + // } + // + // // if the harvested blcok has a tile entity then don't process + // // NOTE this may exclude non-inventory blocks + // IBlockState harvestedState = event.getState(); + // Block harvestedBlock = harvestedState.getBlock(); + // if (harvestedBlock.hasTileEntity(harvestedState)) { + // return; + // } + // + // // get the player + // EntityPlayerMP player = (EntityPlayerMP) event.getHarvester(); + // processCharms(event, player); + // } /** * @@ -165,7 +167,7 @@ private static void processCharms(Event event, ServerPlayerEntity player) { // gather all charms charmsToExecute = gatherCharms(event, player); - + // TODO filter charms ?? // sort charms @@ -186,35 +188,38 @@ private static List gatherCharms(Event event, ServerPlayerEntity p // get the slot provider - curios (general slots) or minecraft (hotbar) String slotProviderId = ModList.get().isLoaded(CURIOS_ID) ? CURIOS_ID : "minecaft"; - + // check each hand for (Hand hand : Hand.values()) { ItemStack heldStack = player.getItemInHand(hand); - heldStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { - for (InventoryType type : InventoryType.values()) { - AtomicInteger index = new AtomicInteger(); - // requires indexed for-loop - for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { - ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); - // OR just check with the charm for allowable event -// if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { - if (!entity.getCharm().getRegisteredEvent().equals(event.getClass())) { - Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); - continue; +// Treasure.LOGGER.debug("is executing -> {}", heldStack.getCapability(CHARMABLE).map(cap -> cap.isExecuting()).orElse(false)); + if (heldStack.getCapability(CHARMABLE).map(cap -> cap.isExecuting()).orElse(false)) { + heldStack.getCapability(CHARMABLE).ifPresent(cap -> { + for (InventoryType type : InventoryType.values()) { + AtomicInteger index = new AtomicInteger(); + // requires indexed for-loop + for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { + ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); + // OR just check with the charm for allowable event + // if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { + if (!entity.getCharm().getRegisteredEvent().equals(event.getClass())) { +// Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); + continue; + } + index.set(i); + CharmContext context = new CharmContext.Builder().with($ -> { + $.hand = hand; + $.itemStack = heldStack; + $.capability = cap; + $.type = type; + $.index = index.get(); + $.entity = entity; + }).build(); + contexts.add(context); } - index.set(i); - CharmContext context = new CharmContext.Builder().with($ -> { - $.hand = hand; - $.itemStack = heldStack; - $.capability = cap; - $.type = type; - $.index = index.get(); - $.entity = entity; - }).build(); - contexts.add(context); } - } - }); + }); + } } // check slots @@ -227,15 +232,15 @@ private static List gatherCharms(Event event, ServerPlayerEntity p Optional stacksOptional = itemHandler.getStacksHandler(slot); stacksOptional.ifPresent(stacksHandler -> { ItemStack curiosStack = stacksHandler.getStacks().getStackInSlot(0); - curiosStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + curiosStack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { for (InventoryType type : InventoryType.values()) { AtomicInteger index = new AtomicInteger(); // requires indexed for-loop for (int i = 0; i < cap.getCharmEntities()[type.getValue()].size(); i++) { ICharmEntity entity = cap.getCharmEntities()[type.getValue()].get(i); -// if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { + // if (!TreasureCharms.isCharmEventRegistered(event.getClass(), entity.getCharm().getType())) { if (!entity.getCharm().getRegisteredEvent().equals(event.getClass())) { - Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); + // Treasure.LOGGER.debug("charm type -> {} is not register for this event -> {}", entity.getCharm().getType(), event.getClass().getSimpleName()); continue; } index.set(i); @@ -300,8 +305,10 @@ private static void executeCharms(Event event, ServerPlayerEntity player, List remove"); + // TODO call cap.remove() -> recalcs highestLevel // locate the charm from context and remove - context.getCapability().getCharmEntities()[context.getType().getValue()].remove(context.getIndex()); + // context.getCapability().getCharmEntities()[context.getType().getValue()].remove(context.getIndex()); + context.getCapability().remove(context.getType(), context.getIndex()); } }); } @@ -315,14 +322,14 @@ public void onTossCoinEvent(ItemTossEvent event) { if (WorldInfo.isClientSide(event.getPlayer().level)) { return; } -// Treasure.LOGGER.debug("is remote? -> {}", !event.getPlayer().level.isClientSide); -// Treasure.LOGGER.debug("{} tossing item -> {}", event.getPlayer().getName().getString(), event.getEntityItem().getItem().getDisplayName().getString()); + // Treasure.LOGGER.debug("is remote? -> {}", !event.getPlayer().level.isClientSide); + // Treasure.LOGGER.debug("{} tossing item -> {}", event.getPlayer().getName().getString(), event.getEntityItem().getItem().getDisplayName().getString()); Item item = event.getEntityItem().getItem().getItem(); if (item instanceof IWishable) { ItemStack stack = event.getEntityItem().getItem(); CompoundNBT nbt = new CompoundNBT(); nbt.putString(IWishable.DROPPED_BY_KEY, event.getPlayer().getName().getString()); -// Treasure.LOGGER.debug("adding tag to wishable stack..."); + // Treasure.LOGGER.debug("adding tag to wishable stack..."); stack.setTag(nbt); } } diff --git a/src/main/java/com/someguyssoftware/treasure2/generator/chest/IChestGenerator.java b/src/main/java/com/someguyssoftware/treasure2/generator/chest/IChestGenerator.java index 3abda259e..884ef24c1 100644 --- a/src/main/java/com/someguyssoftware/treasure2/generator/chest/IChestGenerator.java +++ b/src/main/java/com/someguyssoftware/treasure2/generator/chest/IChestGenerator.java @@ -252,7 +252,9 @@ default public void fillChest(final World world, Random random, final TileEntity if (lootPool != null) { // geneate loot from pools - if (pool.getName().equalsIgnoreCase("treasure")) { + if (pool.getName().equalsIgnoreCase("treasure") || + pool.getName().equalsIgnoreCase("charms")) { + LOGGER.debug("generating loot from treasure/charm pool -> {}", pool.getName()); lootPool.addRandomItems(treasureStacks::add, lootContext); } else { diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/PouchContainerScreen.java b/src/main/java/com/someguyssoftware/treasure2/gui/PouchContainerScreen.java new file mode 100644 index 000000000..990276c21 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/gui/PouchContainerScreen.java @@ -0,0 +1,91 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.gui; + +import java.awt.Color; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.inventory.PouchContainer; + +import net.minecraft.client.gui.screen.inventory.ContainerScreen; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +/** + * + * @author Mark Gottschling on May 14, 2020 + * + */ +public class PouchContainerScreen extends ContainerScreen { + // This is the resource location for the background image for the GUI + private static final ResourceLocation TEXTURE = new ResourceLocation(Treasure.MODID, "textures/gui/container/pouch.png"); + + /** + * + * @param screenContainer + * @param playerInventory + * @param title + */ + public PouchContainerScreen(PouchContainer screenContainer, PlayerInventory playerInventory, + ITextComponent title) { + super(screenContainer, playerInventory, title); + // Set the width and height of the gui. Should match the size of the TEXTURE! + imageWidth = 177; + imageHeight = 200; + } + + @Override + public void render(MatrixStack matrix, int mouseX, int mouseY, float p_230430_4_) { + this.renderBackground(matrix); + super.render(matrix, mouseX, mouseY, p_230430_4_); + this.renderTooltip(matrix, mouseX, mouseY); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + * Taken directly from ChestScreen + */ + @Override + public void renderLabels(MatrixStack matrixStack, int mouseX, int mouseY ) { + final float LABEL_XPOS = 5; + final float FONT_Y_SPACING = 10; + final float CHEST_LABEL_YPOS = 5; + font.draw(matrixStack, this.title.getString(), LABEL_XPOS, CHEST_LABEL_YPOS, Color.darkGray.getRGB()); + final float PLAYER_INV_LABEL_YPOS = getMenu().getPlayerInventoryYPos() - FONT_Y_SPACING; + this.font.draw(matrixStack, this.inventory.getDisplayName().getString(), + LABEL_XPOS, PLAYER_INV_LABEL_YPOS, Color.darkGray.getRGB()); + } + + @Override + protected void renderBg(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { + RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); + this.minecraft.getTextureManager().bind(TEXTURE); + + // width and height are the size provided to the window when initialised after creation. + // xSize, ySize are the expected size of the TEXTURE-? usually seems to be left as a default. + // The code below is typical for vanilla containers, so I've just copied that- it appears to centre the TEXTURE within + // the available window + int edgeSpacingX = (this.width - this.imageWidth) / 2; + int edgeSpacingY = (this.height - this.imageHeight) / 2; + this.blit(matrixStack, edgeSpacingX, edgeSpacingY, 0, 0, this.imageWidth, this.imageHeight); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/gui/TreasureGuis.java b/src/main/java/com/someguyssoftware/treasure2/gui/TreasureGuis.java index 9bee6044c..1d8831a39 100644 --- a/src/main/java/com/someguyssoftware/treasure2/gui/TreasureGuis.java +++ b/src/main/java/com/someguyssoftware/treasure2/gui/TreasureGuis.java @@ -68,6 +68,7 @@ public static void onClientSetupEvent(FMLClientSetupEvent event) { ScreenManager.register(TreasureContainers.COMPRESSOR_CHEST_CONTAINER_TYPE, CompressorChestContainerScreen::new); ScreenManager.register(TreasureContainers.KEY_RING_CONTAINER_TYPE, KeyRingContainerScreen::new); + ScreenManager.register(TreasureContainers.POUCH_CONTAINER_TYPE, PouchContainerScreen::new); // tell the renderer that the base is rendered using CUTOUT_MIPPED (to match the Block Hopper) RenderTypeLookup.setRenderLayer(TreasureBlocks.WOOD_CHEST, RenderType.cutoutMipped()); diff --git a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java index 1862861df..c0eec0eb7 100644 --- a/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java +++ b/src/main/java/com/someguyssoftware/treasure2/init/TreasureSetup.java @@ -72,13 +72,17 @@ public static void common(final FMLCommonSetupEvent event) { TreasureDecayRegistry.create(Treasure.instance); } + /** + * + * @param event + */ public static void clientSetup(final FMLClientSetupEvent event) { Treasure.LOGGER.debug("setting up item properties dynamically..."); event.enqueueWork(() -> { ItemModelsProperties.register(TreasureItems.COPPER_CHARM, new ResourceLocation(Treasure.MODID, "gem"), (stack, world, living) -> { AtomicDouble d = new AtomicDouble(0); - stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + stack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { Optional source = TreasureCharms.getSourceItem(cap.getSourceItem()); if (source.isPresent()) { d.set(source.get().getId()); @@ -86,16 +90,24 @@ public static void clientSetup(final FMLClientSetupEvent event) { }); return d.floatValue(); }); - ItemModelsProperties.register(TreasureItems.TEST_CHARM, + ItemModelsProperties.register(TreasureItems.SILVER_CHARM, new ResourceLocation(Treasure.MODID, "gem"), (stack, world, living) -> { AtomicDouble d = new AtomicDouble(0); - stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + stack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { Optional source = TreasureCharms.getSourceItem(cap.getSourceItem()); if (source.isPresent()) { - d.set(source.get().getMaxLevel()); // this is wrong + d.set(source.get().getId()); } - else { - d.set(6); + }); + return d.floatValue(); + }); + ItemModelsProperties.register(TreasureItems.GOLD_CHARM, + new ResourceLocation(Treasure.MODID, "gem"), (stack, world, living) -> { + AtomicDouble d = new AtomicDouble(0); + stack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { + Optional source = TreasureCharms.getSourceItem(cap.getSourceItem()); + if (source.isPresent()) { + d.set(source.get().getId()); } }); return d.floatValue(); diff --git a/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java new file mode 100644 index 000000000..314a650da --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java @@ -0,0 +1,111 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.inventory; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.inventory.container.ContainerType; +import net.minecraft.inventory.container.Slot; +import net.minecraft.network.PacketBuffer; + +/** + * + * @author Mark Gottschling on Jan 16, 2018 + * + */ +public class PouchContainer extends AbstractChestContainer { + public static PouchContainer create(int windowID, PlayerInventory playerInventory, PacketBuffer extraData) { + return new PouchContainer(windowID, TreasureContainers.POUCH_CONTAINER_TYPE, playerInventory, PouchInventory.INVENTORY_SIZE); + } + + /** + * Client-side constructor + * @param windowID + * @param skullChestContainerType + * @param playerInventory + * @param slotCount + */ + private PouchContainer(int windowID, ContainerType containerType, PlayerInventory playerInventory, int slotCount) { + this(windowID, containerType, playerInventory, new Inventory(slotCount)); + + } + + /** + * Server-side constructor + * @param windowID + * @param playerInventory + * @param inventory + */ + public PouchContainer(int windowID, ContainerType containerType, PlayerInventory playerInventory, IInventory inventory) { + super(windowID, containerType, playerInventory, inventory); + + // set the dimensions + setHotbarYPos(176); + setPlayerInventoryYPos(118); + + // set the dimensions + setContainerInventoryColumnCount(3); + setContainerInventoryRowCount(3); + // skull has 13 less columns - to center move the xpos over by xspacing*2 + setContainerInventoryXPos(8 + getSlotXSpacing() * 3); + setContainerInventoryYPos(52); + + // build the container + buildContainer(playerInventory, inventory); + } + + /** + * Pouch prevents the held slot (which contains the key ring itself) from being moved. + */ + @Override + public void buildHotbar(PlayerInventory player) { + for (int x = 0; x < HOTBAR_SLOT_COUNT; x++) { + int slotNumber = x; + if (slotNumber == player.selected) { + addSlot(new NoSlot(player, slotNumber, getHotbarXPos() + getSlotXSpacing() * x, getHotbarYPos())); + } + else { + addSlot(new Slot(player, slotNumber, getHotbarXPos() + getSlotXSpacing() * x, getHotbarYPos())); + } + } + } + + /** + * + */ + @Override + public void buildContainerInventory() { + for (int y = 0; y < getContainerInventoryRowCount(); y++) { + for (int x = 0; x < getContainerInventoryColumnCount(); x++) { + int slotNumber = (y * getContainerInventoryColumnCount()) + x; + int xpos = getContainerInventoryXPos() + x * getSlotXSpacing(); + int ypos = getContainerInventoryYPos() + y * getSlotYSpacing(); + // pouches use PouchSlot + addSlot(new PouchSlot(this.contents, slotNumber, xpos, ypos)); + } + } + } + + @Override + public int getContainerInventorySlotCount() { + return 9; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/inventory/PouchInventory.java b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchInventory.java new file mode 100644 index 000000000..f1b14b2b2 --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchInventory.java @@ -0,0 +1,135 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.inventory; + +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.POUCH_CAPABILITY; + +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.config.TreasureConfig; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraftforge.items.IItemHandler; + +/** + * @author Mark Gottschling on Mar 9, 2018 + * + */ +public class PouchInventory extends Inventory { + public static int INVENTORY_SIZE = 9; + + /* + * Reference to the owning ItemStack + */ + private ItemStack itemStack; + + /** + * + * @param stack + */ + public PouchInventory(ItemStack stack) { + super(INVENTORY_SIZE); + // save a ref to the item stack + this.itemStack = stack; + IItemHandler itemHandler = stack.getCapability(POUCH_CAPABILITY, null).orElseThrow(IllegalStateException::new); + readInventoryFromHandler(itemHandler); + } + + /** + * + * @param handler + */ + public void readInventoryFromHandler(IItemHandler handler) { + try { + // read the inventory + for (int i = 0; i < INVENTORY_SIZE; i++) { + setItem(i, handler.getStackInSlot(i)); + } + } + catch(Exception e) { + Treasure.LOGGER.error("Error reading items from IItemHandler:", e); + } + } + + /** + * + * @param handler + */ + public void writeInventoryToHandler(IItemHandler handler) { + try { + for (int i = 0; i < INVENTORY_SIZE; i++) { + handler.insertItem(i, getItem(i), false); + } + } + catch(Exception e) { + Treasure.LOGGER.error("Error writing Inventory to IItemHandler:", e); + } + } + + ///////////// IInventory Method + + /* (non-Javadoc) + * @see net.minecraft.inventory.IInventory#getSizeInventory() + */ + @Override + public int getContainerSize() { + return INVENTORY_SIZE; + } + + /* (non-Javadoc) + * @see net.minecraft.inventory.IInventory#getInventoryStackLimit() + * + * If using custom Slots, this value must equal Slot.getItemStackLimit() + */ + @Override + public int getMaxStackSize() { + return TreasureConfig.BOOTY.wealthMaxStackSize.get(); + } + + /* (non-Javadoc) + * @see net.minecraft.inventory.IInventory#closeInventory(net.minecraft.entity.player.EntityPlayer) + */ + @Override + public void stopOpen(PlayerEntity player) { + /* + * write the locked state to the nbt + */ + IItemHandler itemHandler = getItemStack().getCapability(POUCH_CAPABILITY, null).orElseThrow(IllegalStateException::new); + writeInventoryToHandler(itemHandler); + } + + /** + * @return the itemStack + */ + public ItemStack getItemStack() { + return itemStack; + } + + /** + * @param itemStack the itemStack to set + */ + public void setItemStack(ItemStack itemStack) { + this.itemStack = itemStack; + } + + /////////// End of IInventory methods + +} \ No newline at end of file diff --git a/src/main/java/com/someguyssoftware/treasure2/inventory/PouchSlot.java b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchSlot.java new file mode 100644 index 000000000..9e61bcefe --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchSlot.java @@ -0,0 +1,43 @@ +package com.someguyssoftware.treasure2.inventory; + +import java.util.Set; +import java.util.stream.Collectors; + +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.item.CharmItem; +import com.someguyssoftware.treasure2.item.WealthItem; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.container.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +/** + * + * @author Mark Gottschling on May 14, 2020 + * + */ +public class PouchSlot extends Slot { + + /** + * + * @param inventoryIn + * @param index + * @param xPosition + * @param yPosition + */ + public PouchSlot(IInventory inventoryIn, int index, int xPosition, int yPosition) { + super(inventoryIn, index, xPosition, yPosition); + } + + + @Override + public boolean mayPlace(ItemStack stack) { + Set tags = stack.getItem().getTags().stream().filter(tag -> tag.getNamespace().equals(Treasure.MODID)) .map(ResourceLocation::getPath).collect(Collectors.toSet()); + // TODO in next releases replace CharmItem with some sort of tag + if (stack.getItem() instanceof WealthItem || stack.getItem() instanceof CharmItem || tags.contains("pouch")) { + return true; + } + return false; + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/inventory/TreasureContainers.java b/src/main/java/com/someguyssoftware/treasure2/inventory/TreasureContainers.java index fe0edd5a1..e5a5b2eb7 100644 --- a/src/main/java/com/someguyssoftware/treasure2/inventory/TreasureContainers.java +++ b/src/main/java/com/someguyssoftware/treasure2/inventory/TreasureContainers.java @@ -24,6 +24,7 @@ public class TreasureContainers { public static ContainerType WITHER_CHEST_CONTAINER_TYPE; public static ContainerType KEY_RING_CONTAINER_TYPE; + public static ContainerType POUCH_CONTAINER_TYPE; @Mod.EventBusSubscriber(modid = Treasure.MODID, bus = EventBusSubscriber.Bus.MOD) public static class RegistrationHandler { @@ -53,6 +54,10 @@ public static void registerContainers(final RegistryEvent.Register. + */ +package com.someguyssoftware.treasure2.item; + +import java.util.List; + +import com.someguyssoftware.treasure2.capability.ICharmableCapability; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; + +/** + * + * @author Mark Gottschling on Aug 27, 2021 + * + */ +public class CharmBook extends CharmItem { + + /** + * + * @param modID + * @param name + * @param properties + */ + public CharmBook(String modID, String name, Properties properties) { + super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP).stacksTo(1)); + } + + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + tooltip.add(new TranslationTextComponent("tooltip.label.charm_book").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); + // charmable info + ICharmableCapability cap = getCap(stack); + if (cap.isCharmed()) { + cap.appendHoverText(stack, worldIn, tooltip, flagIn); + } + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java index 7666c968a..c1a931da2 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CharmItem.java @@ -19,18 +19,30 @@ */ package com.someguyssoftware.treasure2.item; +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.*; + import java.util.List; +import java.util.Optional; + +import javax.annotation.Nullable; import com.someguyssoftware.gottschcore.item.ModItem; import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; +import com.someguyssoftware.treasure2.capability.CharmableCapabilityStorage; import com.someguyssoftware.treasure2.capability.ICharmableCapability; import com.someguyssoftware.treasure2.capability.TreasureCapabilities; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.Charm; +import com.someguyssoftware.treasure2.charm.ICharm; +import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.config.TreasureConfig; +import com.someguyssoftware.treasure2.util.ModUtils; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; @@ -43,9 +55,6 @@ * */ public class CharmItem extends ModItem { - // TEMP this probably will need to move to CharmableCap or another cap if want to make this work with TAGs. -// private ResourceLocation sourceItem; -// private int charmLevel; /** * @@ -54,24 +63,9 @@ public class CharmItem extends ModItem { * @param properties */ public CharmItem(String modID, String name, Properties properties) { - // TODO remove later from creative - super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP) - .stacksTo(1)); -// setCharmLevel(7); - // TODO set default item + super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP).stacksTo(1)); } - - /** - * - * @param modID - * @param name - * @param properties - * @param sourceItem - */ -// public CharmItem(String modID, String name, Properties properties, ResourceLocation sourceItem) { -// this(modID, name, properties); -// setSourceItem(sourceItem); -// } + @Override public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { @@ -88,6 +82,7 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); // charmable info + tooltip.add(new TranslationTextComponent("tooltip.charmable.usage").withStyle(TextFormatting.GOLD, TextFormatting.ITALIC)); ICharmableCapability cap = getCap(stack); if (cap.isCharmed()) { cap.appendHoverText(stack, worldIn, tooltip, flagIn); @@ -100,7 +95,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List * @return */ public ICharmableCapability getCap(ItemStack stack) { - return stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY, null).orElseThrow(IllegalStateException::new); + return stack.getCapability(TreasureCapabilities.CHARMABLE, null).orElseThrow(IllegalStateException::new); } /** @@ -116,20 +111,149 @@ public boolean isFoil(ItemStack stack) { return false; } } + + // /////////////////////////////////////////////////////////// + private static final String SOURCE = "source"; + private static final String EXECUTING = "executing"; + private static final String BINDABLE = "bindable"; + private static final String INNATE = "innate"; + private static final String MAX_INNATE_SIZE = "maxInnateSize"; + private static final String IMBUABLE = "imbuable"; + private static final String IMBUING = "imbuing"; + private static final String MAX_IMBUE_SIZE = "maxImbueSize"; + private static final String SOCKETABLE = "socketable"; + private static final String MAX_SOCKET_SIZE = "maxSocketSize"; + private static final String BASE_MATERIAL = "baseMaterial"; + private static final String SOURCE_ITEM = "sourceItem"; + private static final String CHARM = "charm"; + + /** + * NOTE getShareTag() and readShareTag() are required to sync item capabilities server -> client. I needed this when holding charms in hands and then swapping hands. + */ + @Override + public CompoundNBT getShareTag(ItemStack stack) { + CompoundNBT nbt = stack.getOrCreateTag(); + ICharmableCapability cap = stack.getCapability(CHARMABLE).orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")); -// public ResourceLocation getSourceItem() { -// return sourceItem; -// } -// -// public void setSourceItem(ResourceLocation sourceItem) { -// this.sourceItem = sourceItem; -// } + // TODO is there a way to call CharmableCapabilityStorage.write() from here? This is an exact duplicate + try { + /* + * save charm cap inventories + */ + // create a new list nbt for each inventory type + for (int index = 0; index < cap.getCharmEntities().length; index++) { + List entityList = cap.getCharmEntities()[index]; + if (entityList != null && !entityList.isEmpty()) { + ListNBT listNbt = new ListNBT(); + for (ICharmEntity entity : entityList) { + CompoundNBT entityNbt = new CompoundNBT(); + listNbt.add(entity.save(entityNbt)); + } + nbt.put(InventoryType.getByValue(index).name(), listNbt); + } + } + + /* + * save charm cap properties + */ + nbt.putBoolean(SOURCE, cap.isSource()); + nbt.putBoolean(EXECUTING, cap.isExecuting());; + nbt.putBoolean(BINDABLE, cap.isBindable()); + + nbt.putBoolean(INNATE, cap.isInnate()); + nbt.putInt(MAX_INNATE_SIZE, cap.getMaxInnateSize()); + + nbt.putBoolean(IMBUABLE, cap.isImbuable()); + nbt.putBoolean(IMBUING, cap.isImbuing()); + nbt.putInt(MAX_IMBUE_SIZE, cap.getMaxImbueSize()); + + nbt.putBoolean(SOCKETABLE, cap.isSocketable()); + nbt.putInt(MAX_SOCKET_SIZE, cap.getMaxSocketsSize()); + nbt.putString(BASE_MATERIAL, cap.getBaseMaterial().toString()); + nbt.putString(SOURCE_ITEM, cap.getSourceItem().toString()); + + } catch (Exception e) { + Treasure.LOGGER.error("Unable to write state to NBT:", e); + } + return nbt; + } + + @Override + public void readShareTag(ItemStack stack, @Nullable CompoundNBT nbt) { + super.readShareTag(stack, nbt); -// public int getCharmLevel() { -// return charmLevel; -// } -// -// public void setCharmLevel(int charmLevel) { -// this.charmLevel = charmLevel; -// } + if (nbt instanceof CompoundNBT) { + ICharmableCapability cap = stack.getCapability(CHARMABLE).orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")); + + CompoundNBT tag = (CompoundNBT) nbt; + for (InventoryType type : InventoryType.values()) { + // clear the list + cap.getCharmEntities()[type.getValue()].clear(); + /* + * load the list + */ + if (tag.contains(type.name())) { + ListNBT listNbt = tag.getList(type.name(), 10); + listNbt.forEach(e -> { + // load the charm + Optional charm = Charm.load((CompoundNBT) ((CompoundNBT)e).get(CHARM)); + if (!charm.isPresent()) { + return; + } + // create an entity + ICharmEntity entity = charm.get().createEntity(); + + // load entity + entity.load((CompoundNBT)e); + + // add the entity to the list + cap.getCharmEntities()[type.getValue()].add(entity); + }); + } + + // load cap properties + if (tag.contains(SOURCE)) { + cap.setSource(tag.getBoolean(SOURCE)); + } + if (tag.contains(EXECUTING)) { + cap.setExecuting(tag.getBoolean(EXECUTING)); + } + + if (tag.contains(BINDABLE)) { + cap.setBindable(tag.getBoolean(BINDABLE)); + } + + if (tag.contains(INNATE)) { + cap.setInnate(tag.getBoolean(INNATE)); + } + if (tag.contains(MAX_INNATE_SIZE)) { + cap.setMaxInnateSize(tag.getInt(MAX_INNATE_SIZE)); + } + + if (tag.contains(IMBUABLE)) { + cap.setImbuable(tag.getBoolean(IMBUABLE)); + } + if (tag.contains(MAX_IMBUE_SIZE)) { + cap.setMaxImbueSize(tag.getInt(MAX_IMBUE_SIZE)); + } + if (tag.contains(IMBUING)) { + cap.setImbuing(tag.getBoolean(IMBUING)); + } + + if (tag.contains(SOCKETABLE)) { + cap.setSocketable(tag.getBoolean(SOCKETABLE)); + } + if (tag.contains(MAX_SOCKET_SIZE)) { + cap.setMaxSocketsSize(tag.getInt(MAX_SOCKET_SIZE)); + } + if (tag.contains(BASE_MATERIAL)) { + cap.setBaseMaterial(ModUtils.asLocation(tag.getString(BASE_MATERIAL))); //BaseMaterial.valueOf(tag.getString(BASE_MATERIAL).toUpperCase())); + } + + if (tag.contains(SOURCE_ITEM)) { + cap.setSourceItem(ModUtils.asLocation(tag.getString(SOURCE_ITEM))); + } + } + } + } } diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java index 2552e10b0..f97961d74 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java @@ -97,7 +97,7 @@ public void appendHoverText(ItemStack stack, World worldIn, List * @return */ public ICharmableCapability getCap(ItemStack stack) { - return stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY, null).orElseThrow(IllegalStateException::new); + return stack.getCapability(TreasureCapabilities.CHARMABLE, null).orElseThrow(IllegalStateException::new); } /** diff --git a/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java b/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java index 0353d1a72..77c271935 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/IWishable.java @@ -19,8 +19,6 @@ */ package com.someguyssoftware.treasure2.item; -import static com.someguyssoftware.treasure2.Treasure.LOGGER; - import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -28,12 +26,10 @@ import com.someguyssoftware.gottschcore.loot.LootTableShell; import com.someguyssoftware.gottschcore.spatial.ICoords; -import com.someguyssoftware.treasure2.enums.Coins; import com.someguyssoftware.treasure2.enums.Rarity; import com.someguyssoftware.treasure2.loot.TreasureLootTableMaster2; import com.someguyssoftware.treasure2.loot.TreasureLootTableRegistry; -import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.loot.LootContext; import net.minecraft.world.World; diff --git a/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java b/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java new file mode 100644 index 000000000..12677b56b --- /dev/null +++ b/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java @@ -0,0 +1,113 @@ +/* + * This file is part of Treasure2. + * Copyright (c) 2021, Mark Gottschling (gottsch) + * + * All rights reserved. + * + * Treasure2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Treasure2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Treasure2. If not, see . + */ +package com.someguyssoftware.treasure2.item; + +import java.util.List; + +import com.someguyssoftware.gottschcore.item.ModItem; +import com.someguyssoftware.gottschcore.world.WorldInfo; +import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.PouchCapabilityProvider; +import com.someguyssoftware.treasure2.inventory.PouchContainer; +import com.someguyssoftware.treasure2.inventory.PouchInventory; +import com.someguyssoftware.treasure2.inventory.TreasureContainers; + +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.ActionResult; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.fml.network.NetworkHooks; + +/** + * @author Mark Gottschling on May 13, 2020 + * + */ +public class PouchItem extends ModItem implements INamedContainerProvider { + + public PouchItem(String modID, String name, Properties properties) { + super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP).stacksTo(1)); + } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { + PouchCapabilityProvider provider = new PouchCapabilityProvider(); + return provider; + } + + /** + * + */ + @Override + public void appendHoverText(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + super.appendHoverText(stack, worldIn, tooltip, flagIn); + tooltip.add(new TranslationTextComponent("tooltip.label.pouch").withStyle(TextFormatting.GOLD)); + } + + @Override + public ActionResult use(World worldIn, PlayerEntity playerIn, Hand handIn) { + // exit if on the client + if (WorldInfo.isClientSide(worldIn)) { + return new ActionResult(ActionResultType.PASS, playerIn.getItemInHand(handIn)); + } + + // get the container provider + INamedContainerProvider namedContainerProvider = this; + + // open the chest + NetworkHooks.openGui((ServerPlayerEntity)playerIn, namedContainerProvider, (packetBuffer)->{}); + // NOTE: (packetBuffer)->{} is just a do-nothing because we have no extra data to send + + return new ActionResult(ActionResultType.SUCCESS, playerIn.getItemInHand(handIn)); + } + + @Override + public Container createMenu(int windowID, PlayerInventory inventory, PlayerEntity player) { + // get the held item + ItemStack heldItem = player.getItemInHand(Hand.MAIN_HAND); + if (heldItem == null || !(heldItem.getItem() instanceof PouchItem)) { + heldItem = player.getItemInHand(Hand.OFF_HAND); + if (heldItem == null || !(heldItem.getItem() instanceof PouchItem)) + return null; + } + + // create inventory from item + IInventory itemInventory = new PouchInventory(heldItem); + // open the container + return new PouchContainer(windowID, TreasureContainers.POUCH_CONTAINER_TYPE, inventory, itemInventory); + } + + @Override + public ITextComponent getDisplayName() { + return new TranslationTextComponent("item.treasure2.pouch"); + } +} diff --git a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java index 5af428079..ed51db68c 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/TreasureItems.java @@ -105,6 +105,7 @@ public class TreasureItems { public static KeyItem THIEFS_LOCK_PICK; public static KeyRingItem KEY_RING; + public static PouchItem POUCH; // locks public static LockItem WOOD_LOCK; @@ -137,8 +138,7 @@ public class TreasureItems { public static CharmItem COPPER_CHARM; public static CharmItem SILVER_CHARM; public static CharmItem GOLD_CHARM; - public static CharmItem TEST_CHARM; - public static CharmItem IMBUED_BOOK; + public static CharmItem CHARM_BOOK; // wither items public static Item WITHER_STICK_ITEM; @@ -444,67 +444,56 @@ public ItemStack getDefaultLootKey (Random random) { }; // CHARMS - COPPER_CHARM = new CharmItem(Treasure.MODID, "copper_charm", new Item.Properties()) { + COPPER_CHARM = new CharmItem(Treasure.MODID, TreasureConfig.ItemID.COPPER_CHARM, new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { $.innate(true, 1); $.bindable(true); - $.source(true) + $.source(true); + $.executing(true) .baseMaterial(TreasureCharms.COPPER.getName()); }).build(); return new CharmableCapabilityProvider(cap); } }; - SILVER_CHARM = new CharmItem(Treasure.MODID, "silver_charm", new Item.Properties()) { + SILVER_CHARM = new CharmItem(Treasure.MODID, TreasureConfig.ItemID.SILVER_CHARM, new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { $.innate(true, 1); $.bindable(true); - $.source(true) + $.source(true); + $.executing(true) .baseMaterial(TreasureCharms.SILVER.getName()); }).build(); return new CharmableCapabilityProvider(cap); } }; - GOLD_CHARM = new CharmItem(Treasure.MODID, "gold_charm", new Item.Properties()) { + GOLD_CHARM = new CharmItem(Treasure.MODID, TreasureConfig.ItemID.GOLD_CHARM, new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { $.innate(true, 1); $.bindable(true); - $.source(true) + $.source(true); + $.executing(true) .baseMaterial(TreasureCharms.GOLD.getName()); }).build(); return new CharmableCapabilityProvider(cap); } }; - IMBUED_BOOK = new CharmItem(Treasure.MODID, "imbued_book", new Item.Properties()) { + CHARM_BOOK = new CharmBook(Treasure.MODID, TreasureConfig.ItemID.CHARM_BOOK, new Item.Properties()) { public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { ICharmableCapability cap = new CharmableCapability.Builder(Items.AIR.getRegistryName()).with($ -> { $.innate(true, 1); $.imbuing(true); $.source(true); + $.executing(false); }).build(); return new CharmableCapabilityProvider(cap); } }; - // TODO create a Builder for Charms - TEST_CHARM = new CharmItem(Treasure.MODID, "test_charm", new Item.Properties()) { - public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { - ICharmableCapability cap = new CharmableCapability.Builder(SAPPHIRE.getRegistryName()).with($ -> { - $.innate(true, 1); - $.bindable(true); - $.source(true); - $.baseMaterial(TreasureCharms.COPPER.getName()); - }).build(); - - // add charms - cap.add(InventoryType.INNATE, TreasureCharms.HEALING_6.createEntity()); - stack.setHoverName(new StringTextComponent("Test Charm")); - return new CharmableCapabilityProvider(cap); - } - }; - + POUCH = new PouchItem(Treasure.MODID, "pouch", new Item.Properties()); + // WITHER ITEMS WITHER_STICK_ITEM = new WitherStickItem(Treasure.MODID, TreasureConfig.ItemID.WITHER_STICK_ITEM_ID, TreasureBlocks.WITHER_BRANCH, new Item.Properties()); WITHER_ROOT_ITEM = new WitherRootItem(Treasure.MODID, TreasureConfig.ItemID.WITHER_ROOT_ITEM_ID, TreasureBlocks.WITHER_ROOT, new Item.Properties()); @@ -560,8 +549,8 @@ public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) { COPPER_CHARM, SILVER_CHARM, GOLD_CHARM, - IMBUED_BOOK, - TEST_CHARM, + CHARM_BOOK, + POUCH, TOPAZ, ONYX, RUBY, diff --git a/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java b/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java index f6ad48744..40ce58815 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/WealthItem.java @@ -67,9 +67,6 @@ * */ public class WealthItem extends ModItem implements IWishable { - // NOTE this is kind of moot as the config would already have an upper level - private static final int MAX_CUSTOM_STACK_SIZE = 64; - /** * * @param modID @@ -78,7 +75,7 @@ public class WealthItem extends ModItem implements IWishable { */ public WealthItem(String modID, String name, Properties properties) { super(modID, name, properties.tab(TreasureItemGroups.MOD_ITEM_GROUP) - .stacksTo(Math.min(MAX_CUSTOM_STACK_SIZE, TreasureConfig.BOOTY.wealthMaxStackSize.get()))); + .stacksTo(TreasureConfig.BOOTY.wealthMaxStackSize.get())); } /** diff --git a/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java b/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java index 425e21706..691ea2640 100644 --- a/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java +++ b/src/main/java/com/someguyssoftware/treasure2/loot/function/CharmRandomly.java @@ -57,6 +57,8 @@ import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.loot.functions.ILootFunction; import net.minecraft.util.JSONUtils; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; /** * This function will add charms to the INNATE inventory of an item with CharmableCapability by default. @@ -103,7 +105,7 @@ public LootFunctionType getType() { protected ItemStack run(ItemStack stack, LootContext context) { Random rand = context.getRandom(); Treasure.LOGGER.debug("selected item from charm pool -> {}", stack.getDisplayName()); - stack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + stack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { Treasure.LOGGER.debug("has charm cap"); ICharm charm = null; @@ -168,31 +170,14 @@ protected ItemStack run(ItemStack stack, LootContext context) { if (charm != null) { Treasure.LOGGER.debug("charm is not null -> {}", charm.getName()); - List charmEntities = cap.getCharmEntities()[type.getValue()]; - // ensure that the item doesn't already have the same charm or same type or exceeded the maximum charms. - boolean previousCharmExists = false; - for (ICharmEntity entity : charmEntities) { - if (entity.getCharm().getType().equalsIgnoreCase(charm.getType()) || - entity.getCharm().getName().equals(charm.getName())) { - previousCharmExists = true; - break; - } - } - if (!previousCharmExists) { + if (!cap.contains(charm)) { Treasure.LOGGER.debug("adding charm to charm instances - > {}", charm.getName().toString()); - charmEntities.add(charm.createEntity()); + cap.add(type, charm.createEntity()); } } // cycle thru all charms in stack inventory to determine highest level charm - int highestLevel = 0; - for (int index =0; index < InventoryType.values().length; index++) { - for (ICharmEntity entity : cap.getCharmEntities()[index]) { - if (entity.getCharm().getLevel() > highestLevel) { - highestLevel = entity.getCharm().getLevel(); - } - } - } + int highestLevel = cap.getHighestLevel().getCharm().getLevel(); /* * select the correct gem/sourceItem @@ -210,7 +195,7 @@ protected ItemStack run(ItemStack stack, LootContext context) { } } } - }); + }); Treasure.LOGGER.debug("returning charmed item -> {}", stack.getDisplayName().getString()); return stack; } diff --git a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java index de8204eac..4606c708d 100644 --- a/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java +++ b/src/main/java/com/someguyssoftware/treasure2/network/CharmMessageHandlerOnClient.java @@ -98,11 +98,11 @@ private static void processMessage(ClientWorld worldClient, CharmMessageToClient // determine what is being held in hand if (heldItemStack != null) { Treasure.LOGGER.debug("holding item -> {}", heldItemStack.getItem().getRegistryName()); -// ICharmableCapability cap = heldItemStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).orElse(null); +// ICharmableCapability cap = heldItemStack.getCapability(TreasureCapabilities.CHARMABLE).orElse(null); // if (cap != null) { // updateCharms(heldItemStack, message, cap); // } - heldItemStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + heldItemStack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { updateCharms(message, cap); }); } @@ -113,7 +113,7 @@ else if (CURIOS_ID.equals(message.getSlotProviderId())) { Optional stacksOptional = itemHandler.getStacksHandler(message.getSlot()); stacksOptional.ifPresent(stacksHandler -> { ItemStack curiosStack = stacksHandler.getStacks().getStackInSlot(0); - curiosStack.getCapability(TreasureCapabilities.CHARMABLE_CAPABILITY).ifPresent(cap -> { + curiosStack.getCapability(TreasureCapabilities.CHARMABLE).ifPresent(cap -> { updateCharms(message, cap); }); }); diff --git a/src/main/resources/assets/treasure2/lang/en_us.json b/src/main/resources/assets/treasure2/lang/en_us.json index 297b27f23..ab5715a32 100644 --- a/src/main/resources/assets/treasure2/lang/en_us.json +++ b/src/main/resources/assets/treasure2/lang/en_us.json @@ -37,6 +37,8 @@ "item.treasure2.copper_coin": "Copper Coin", "item.treasure2.silver_coin": "Silver Coin", "item.treasure2.gold_coin": "Gold Coin", + "item.treasure2.topaz": "Topaz", + "item.treasure2.onyx": "Onyx", "item.treasure2.ruby": "Ruby", "item.treasure2.sapphire": "Sapphire", "item.treasure2.white_pearl": "White Pearl", @@ -44,6 +46,8 @@ "item.treasure2.copper_charm": "Copper Charm", "item.treasure2.silver_charm": "Silver Charm", "item.treasure2.gold_charm": "Gold Charm", + "item.treasure2.charm_book": "Charm Book", + "item.treasure2.pouch": "Pouch", "item.treasure2.wither_stick_item":"Wither Branch", "item.treasure2.wither_root_item":"Wither Root", @@ -146,20 +150,71 @@ "tooltip.label.wishable":"Throw into Wishing Wells", "tooltip.label.coin":"Throw into Wishing Wells", "tooltip.label.key_ring":"Container for keys", - "tooltip.label.coin_pouch":"Holds coins, gems, pearls, and charms", + "tooltip.label.pouch":"Holds small valuables - coins, gems, charms, etc.", "tooltip.label.treasure_tool":"Required for Key/Pick recipes", "tooltip.label.max_locks":"Max Locks: %s", "tooltip.label.container_size":"Inventory Size: %s", - "tooltip.label.charmed":"Hold in hand or equip for buffs", - "tooltip.label.charmed.adornment":"Hold in hand or equip for buffs", + "tooltip.charmable.usage":"Hold in hand or equip for buffs", + "tooltip.charmable.usage.adornment":"Hold in hand or equip for buffs", + + "tooltip.label.charm_book":"Keep for Adornments in version 1.7", + "tooltip.charmable.slots":"Capacity: [%s/%s] [used/max]", + "tooltip.charmable.slots.stats":"[%s/%s]", + "tooltip.charmable.inventory.innate":"[INNATE] ", + "tooltip.charmable.inventory.imbue":"[IMBUED] ", + "tooltip.charmable.inventory.socket":"[SOCKETED] ", + "tooltip.label.charms":"Charms:", - "tooltip.label.charmable.slots":"Capacity: [%s/%s] [used/max]", - "tooltip.label.charmable.slots.stats":"[%s/%s]", - "tooltip.label.charm.type.innate":"[INNATE] ", - "tooltip.label.charm.type.imbue":"[IMBUED] ", - "tooltip.label.charm.type.socket":"[SOCKETED] ", + "tooltip.charm.type.aegis": "Aegis", + "tooltip.charm.type.drain": "Draining", + "tooltip.charm.type.fire_immunity": "Fire Immunity", + "tooltip.charm.type.fire_resistence": "Fire Resistence", + "tooltip.charm.type.greater_healing": "Greater Healing", + "tooltip.charm.type.healing": "Healing", + "tooltip.charm.type.illumination": "Illlumination", + "tooltip.charm.type.life_strike": "Life Strike", + "tooltip.charm.type.reflection": "Reflection", + "tooltip.charm.type.satiety": "Satiety", + "tooltip.charm.type.shielding": "Shielding", + "tooltip.charm.type.decay": "Decay", + "tooltip.charm.type.decrepit": "Decrepit", + "tooltip.charm.type.dirt_fill": "Dirt", + "tooltip.charm.type.dirt_walk": "Dirt", + "tooltip.charm.type.ruin": "Ruin", + + "tooltip.charm.prefix.level1":"Lesser", + "tooltip.charm.prefix.level2":"", + "tooltip.charm.prefix.level3":"Greater", + "tooltip.charm.prefix.level4":"Grand", + "tooltip.charm.prefix.level5":"Huge", + "tooltip.charm.prefix.level6":"Massive", + "tooltip.charm.prefix.level8":"Giant", + "tooltip.charm.prefix.level9":"Cyclopean", + "tooltip.charm.prefix.level10":"Colossal", + + "tooltip.adornment.type.ring":"Ring", + + "tooltip.charm.suffix.level13":"%s of the Leviathan", + "tooltip.charm.suffix.level14":"%s of the Demogorgon", + "tooltip.charm.suffix.level15":"%s of the Whale", + + "tooltip.charm.level": "%s %s", "tooltip.charm.healing":"Healing %s", - "tooltip.charm.healing_rate": "- heals 0.5 hearts/sec", + + "tooltip.charm.rate.aegis": "- absorbs all damage", + "tooltip.charm.rate.drain": "- drains 0.5 hearts/5 sec from all in %s block radius", + "tooltip.charm.rate.fire_immunity": "- absorbs all fire damage", + "tooltip.charm.rate.fire_resistence": "- absorbs %s%% of fire damage", + "tooltip.charm.rate.greater_healing": "- heals 1 hearts/sec", + "tooltip.charm.rate.healing": "- heals 0.5 hearts/sec", + "tooltip.charm.rate.illumination": "- illuminates every 5 sec", + "tooltip.charm.rate.life_strike": "- inflicts +%s%% damage for 1 heart health", + "tooltip.charm.rate.reflection":"- reflects %s%% damage to all in %s block radius", + "tooltip.charm.rate.satiety": "- restores 0.5 hunger/sec", + "tooltip.charm.rate.shielding": "- absorbs %s%% of damage", + "tooltip.charm.rate.decay": "- your health decays 1 heart/5 sec", + "tooltip.charm.rate.decrepit": "- you take +%s%% damage when hit", + "tooltip.charm.rate.ruin": "- your equipment ruins 1 damage/%s sec", "tooltip.charm.uses_gauge":"[%s/%s]", "tooltip.ember_key.specials":"Destroys Wood Locks", diff --git a/src/main/resources/assets/treasure2/models/item/apprentices_pouch.json b/src/main/resources/assets/treasure2/models/item/apprentices_pouch.json deleted file mode 100644 index 158adab02..000000000 --- a/src/main/resources/assets/treasure2/models/item/apprentices_pouch.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "treasure2:items/apprentices_pouch" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/charm.json b/src/main/resources/assets/treasure2/models/item/charm.json deleted file mode 100644 index b456c553a..000000000 --- a/src/main/resources/assets/treasure2/models/item/charm.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "__comment": "default", - "layer0": "treasure2:item/charm/gold_charm" - }, - "overrides": [ - { - "__comment": "copper charm", - "predicate": { - "model": 2 - }, - "model": "item/charm/charm_model_copper" - }, - { - "__comment": "silver charm", - "predicate": { - "model": 3 - }, - "model": "item/charm/charm_model_silver" - }, - { - "__comment": "gold charm", - "predicate": { - "model": 4 - }, - "model": "item/charm/charm_model_gold" - }, - { - "__comment": "copper topaz charm", - "predicate": { - "model": 3 - }, - "model": "item/charm/charm_model_copper_topaz" - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/imbued_book.json b/src/main/resources/assets/treasure2/models/item/charm_book.json similarity index 56% rename from src/main/resources/assets/treasure2/models/item/imbued_book.json rename to src/main/resources/assets/treasure2/models/item/charm_book.json index ed6a9ee07..5838dc345 100644 --- a/src/main/resources/assets/treasure2/models/item/imbued_book.json +++ b/src/main/resources/assets/treasure2/models/item/charm_book.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "treasure2:item/imbued_book" + "layer0": "treasure2:item/charm_book" } } diff --git a/src/main/resources/assets/treasure2/models/item/copper_charm.json b/src/main/resources/assets/treasure2/models/item/copper_charm.json index 6173b9dcc..6ac20af25 100644 --- a/src/main/resources/assets/treasure2/models/item/copper_charm.json +++ b/src/main/resources/assets/treasure2/models/item/copper_charm.json @@ -8,56 +8,56 @@ { "__comment": "topaz", "predicate": { - "treasure:gem": 1 + "treasure2:gem": 1 }, "model": "treasure2:item/copper_charm_topaz" }, { "__comment": "diamond", "predicate": { - "treasure:gem": 2 + "treasure2:gem": 2 }, "model": "treasure2:item/copper_charm_diamond" }, { "__comment": "onyx", "predicate": { - "treasure:gem": 3 + "treasure2:gem": 3 }, "model": "treasure2:item/copper_charm_onyx" }, { "__comment": "emerald", "predicate": { - "treasure:gem": 4 + "treasure2:gem": 4 }, "model": "treasure2:item/copper_charm_emerald" }, { "__comment": "ruby", "predicate": { - "treasure:gem": 5 + "treasure2:gem": 5 }, "model": "treasure2:item/copper_charm_ruby" }, { "__comment": "sapphire", "predicate": { - "treasure:gem": 6 + "treasure2:gem": 6 }, "model": "treasure2:item/copper_charm_sapphire" }, { "__comment": "white pearl", "predicate": { - "treasure:gem": 7 + "treasure2:gem": 7 }, "model": "treasure2:item/copper_charm_white_pearl" }, - { + { "__comment": "black pearl", "predicate": { - "treasure:gem": 8 + "treasure2:gem": 8 }, "model": "treasure2:item/copper_charm_black_pearl" } diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm.json b/src/main/resources/assets/treasure2/models/item/gold_charm.json new file mode 100644 index 000000000..c926e2dcb --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm.json @@ -0,0 +1,65 @@ +{ + "parent": "item/generated", + "textures": { + "__comment": "default", + "layer0": "treasure2:item/charm/gold_charm" + }, + "overrides": [ + { + "__comment": "topaz", + "predicate": { + "treasure2:gem": 1 + }, + "model": "treasure2:item/gold_charm_topaz" + }, + { + "__comment": "diamond", + "predicate": { + "treasure2:gem": 2 + }, + "model": "treasure2:item/gold_charm_diamond" + }, + { + "__comment": "onyx", + "predicate": { + "treasure2:gem": 3 + }, + "model": "treasure2:item/gold_charm_onyx" + }, + { + "__comment": "emerald", + "predicate": { + "treasure2:gem": 4 + }, + "model": "treasure2:item/gold_charm_emerald" + }, + { + "__comment": "ruby", + "predicate": { + "treasure2:gem": 5 + }, + "model": "treasure2:item/gold_charm_ruby" + }, + { + "__comment": "sapphire", + "predicate": { + "treasure2:gem": 6 + }, + "model": "treasure2:item/gold_charm_sapphire" + }, + { + "__comment": "white pearl", + "predicate": { + "treasure2:gem": 7 + }, + "model": "treasure2:item/gold_charm_white_pearl" + }, + { + "__comment": "black pearl", + "predicate": { + "treasure2:gem": 8 + }, + "model": "treasure2:item/gold_charm_black_pearl" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_black_pearl.json b/src/main/resources/assets/treasure2/models/item/gold_charm_black_pearl.json new file mode 100644 index 000000000..bfaeb6e82 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_black_pearl.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_black_pearl_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_diamond.json b/src/main/resources/assets/treasure2/models/item/gold_charm_diamond.json new file mode 100644 index 000000000..e35121399 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_diamond.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_diamond_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_emerald.json b/src/main/resources/assets/treasure2/models/item/gold_charm_emerald.json new file mode 100644 index 000000000..06752195e --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_emerald.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_emerald_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_onyx.json b/src/main/resources/assets/treasure2/models/item/gold_charm_onyx.json new file mode 100644 index 000000000..20688ad16 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_onyx.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_onyx_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_ruby.json b/src/main/resources/assets/treasure2/models/item/gold_charm_ruby.json new file mode 100644 index 000000000..4baf19a86 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_ruby.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_ruby_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_sapphire.json b/src/main/resources/assets/treasure2/models/item/gold_charm_sapphire.json new file mode 100644 index 000000000..a5fd7334c --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_sapphire.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_sapphire_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_topaz.json b/src/main/resources/assets/treasure2/models/item/gold_charm_topaz.json new file mode 100644 index 000000000..2dad6572b --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_topaz.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_topaz_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/gold_charm_white_pearl.json b/src/main/resources/assets/treasure2/models/item/gold_charm_white_pearl.json new file mode 100644 index 000000000..4bfe65ece --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/gold_charm_white_pearl.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/gold_white_pearl_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/high_fog.json b/src/main/resources/assets/treasure2/models/item/high_fog.json deleted file mode 100644 index cf87d8446..000000000 --- a/src/main/resources/assets/treasure2/models/item/high_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/high_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/high_poison_fog.json b/src/main/resources/assets/treasure2/models/item/high_poison_fog.json deleted file mode 100644 index 75af3c762..000000000 --- a/src/main/resources/assets/treasure2/models/item/high_poison_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/high_poison_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/high_wither_fog.json b/src/main/resources/assets/treasure2/models/item/high_wither_fog.json deleted file mode 100644 index cfa5a11e5..000000000 --- a/src/main/resources/assets/treasure2/models/item/high_wither_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/high_wither_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/low_fog.json b/src/main/resources/assets/treasure2/models/item/low_fog.json deleted file mode 100644 index 49f81433a..000000000 --- a/src/main/resources/assets/treasure2/models/item/low_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/low_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/low_poison_fog.json b/src/main/resources/assets/treasure2/models/item/low_poison_fog.json deleted file mode 100644 index 11c6e3424..000000000 --- a/src/main/resources/assets/treasure2/models/item/low_poison_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/low_poison_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/low_wither_fog.json b/src/main/resources/assets/treasure2/models/item/low_wither_fog.json deleted file mode 100644 index 4de0e34c2..000000000 --- a/src/main/resources/assets/treasure2/models/item/low_wither_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/low_wither_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/lucky_pouch.json b/src/main/resources/assets/treasure2/models/item/lucky_pouch.json deleted file mode 100644 index 3abd85923..000000000 --- a/src/main/resources/assets/treasure2/models/item/lucky_pouch.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "treasure2:items/lucky_pouch" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/masters_pouch.json b/src/main/resources/assets/treasure2/models/item/masters_pouch.json deleted file mode 100644 index 40c5fc1a8..000000000 --- a/src/main/resources/assets/treasure2/models/item/masters_pouch.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "treasure2:items/masters_pouch" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/med_fog.json b/src/main/resources/assets/treasure2/models/item/med_fog.json deleted file mode 100644 index 29a71ad82..000000000 --- a/src/main/resources/assets/treasure2/models/item/med_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/med_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/med_poison_fog.json b/src/main/resources/assets/treasure2/models/item/med_poison_fog.json deleted file mode 100644 index dc1555baa..000000000 --- a/src/main/resources/assets/treasure2/models/item/med_poison_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/med_poison_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/med_wither_fog.json b/src/main/resources/assets/treasure2/models/item/med_wither_fog.json deleted file mode 100644 index 813e669be..000000000 --- a/src/main/resources/assets/treasure2/models/item/med_wither_fog.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "treasure2:block/med_wither_fog", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/treasure2/models/item/onyx.json b/src/main/resources/assets/treasure2/models/item/onyx.json index 32fc62b05..91f09a1c0 100644 --- a/src/main/resources/assets/treasure2/models/item/onyx.json +++ b/src/main/resources/assets/treasure2/models/item/onyx.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "treasure2:items/onyx" + "layer0": "treasure2:item/onyx" } } \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/pouch.json b/src/main/resources/assets/treasure2/models/item/pouch.json index 3b0be4c55..9ffe9fefc 100644 --- a/src/main/resources/assets/treasure2/models/item/pouch.json +++ b/src/main/resources/assets/treasure2/models/item/pouch.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "treasure2:items/pouch" + "layer0": "treasure2:item/pouch" } } \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm.json b/src/main/resources/assets/treasure2/models/item/silver_charm.json new file mode 100644 index 000000000..83c311832 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm.json @@ -0,0 +1,65 @@ +{ + "parent": "item/generated", + "textures": { + "__comment": "default", + "layer0": "treasure2:item/charm/silver_charm" + }, + "overrides": [ + { + "__comment": "topaz", + "predicate": { + "treasure2:gem": 1 + }, + "model": "treasure2:item/silver_charm_topaz" + }, + { + "__comment": "diamond", + "predicate": { + "treasure2:gem": 2 + }, + "model": "treasure2:item/silver_charm_diamond" + }, + { + "__comment": "onyx", + "predicate": { + "treasure2:gem": 3 + }, + "model": "treasure2:item/silver_charm_onyx" + }, + { + "__comment": "emerald", + "predicate": { + "treasure2:gem": 4 + }, + "model": "treasure2:item/silver_charm_emerald" + }, + { + "__comment": "ruby", + "predicate": { + "treasure2:gem": 5 + }, + "model": "treasure2:item/silver_charm_ruby" + }, + { + "__comment": "sapphire", + "predicate": { + "treasure2:gem": 6 + }, + "model": "treasure2:item/silver_charm_sapphire" + }, + { + "__comment": "white pearl", + "predicate": { + "treasure2:gem": 7 + }, + "model": "treasure2:item/silver_charm_white_pearl" + }, + { + "__comment": "black pearl", + "predicate": { + "treasure2:gem": 8 + }, + "model": "treasure2:item/silver_charm_black_pearl" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_black_pearl.json b/src/main/resources/assets/treasure2/models/item/silver_charm_black_pearl.json new file mode 100644 index 000000000..f05dc23b5 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_black_pearl.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_black_pearl_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_diamond.json b/src/main/resources/assets/treasure2/models/item/silver_charm_diamond.json new file mode 100644 index 000000000..bbf3788e0 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_diamond.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_diamond_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_emerald.json b/src/main/resources/assets/treasure2/models/item/silver_charm_emerald.json new file mode 100644 index 000000000..e7644f166 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_emerald.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_emerald_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_onyx.json b/src/main/resources/assets/treasure2/models/item/silver_charm_onyx.json new file mode 100644 index 000000000..836023296 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_onyx.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_onyx_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_ruby.json b/src/main/resources/assets/treasure2/models/item/silver_charm_ruby.json new file mode 100644 index 000000000..4987e0abf --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_ruby.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_ruby_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_sapphire.json b/src/main/resources/assets/treasure2/models/item/silver_charm_sapphire.json new file mode 100644 index 000000000..4e581f1f3 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_sapphire.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_sapphire_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_topaz.json b/src/main/resources/assets/treasure2/models/item/silver_charm_topaz.json new file mode 100644 index 000000000..d9197552b --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_topaz.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_topaz_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/models/item/silver_charm_white_pearl.json b/src/main/resources/assets/treasure2/models/item/silver_charm_white_pearl.json new file mode 100644 index 000000000..6d598b9e9 --- /dev/null +++ b/src/main/resources/assets/treasure2/models/item/silver_charm_white_pearl.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "treasure2:item/charm/silver_white_pearl_charm" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/treasure2/textures/item/apprentices_pouch.png b/src/main/resources/assets/treasure2/textures/item/apprentices_pouch.png deleted file mode 100644 index 7efc822eee15d76f7406ea22c5b6c5a745c5b923..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 504 zcmVzqTmbh4QOa+X(pJV%+hHaiSyKiRR?5-GClaxG!KdUPBF%31}2UaD1+vE~CPyoN| z1(Iw?X;tE91YfI)Ef1Qx+5y1m@k;}|d-xQ9o7-am)@~mzoF5Ic-nfOoeP|kA-TBCy zl$fOC{s@B^JdxPl-{JM$BQ~>)9}yg88AlPEN}U`AGuYkV;qARoY-azq=M}(q=a$r0 ze;~0G(P=ufIgt2bGn1G`pxQ~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dM&W4f&xzJ{|7$RERbsNLfh^mGbe?s)EZ@ce2Z z!EG$#p8PKcU+iVukwIVp00D$)LqkwWLqi~Na&Km7Y-Iodc$|HaJxIeq9K~N#r9~`=rZLv^wsD&i2R|084ld5RI=Bjg;0K7Co0Fo8 zl=#1-&?3fz<9@um_qclp2(21Z&Atgh)hr{EOo;iysu*}h5Mc<2LX?=Pr?QJVc#f}o z`1pDk=ULw8{v3l!(PV&6B%WisVG(Z-&um&c=Y8S`t4Ip*Iq|qb7bJe~SS+1h6*X9h)2fkTB18KL5C5>^Pm@a~R~3vL3#dbd6<3MGL47u)_A z1p>Q3yJ_3s$F|)*0sPOvmDcswTfpom>CLVdI|9Pnz{Pb}llOqj9U%IoONQh~ewsq5 z1iYWoHx+=PTVP<#?X9zq(+40&T`k`L2Zz8|nX=bC-W}}i?cXz<{(b;g7IK_SZItT( z000JJOGiWi{{a60|De66lK=n!32;bRa{vGi!~g&e!~vBn4jTXf00(qQO+^Rg2pSAJ zE_Lkoc>n+a@JU2LR5;7clCf&SP#A^3?}2n>(5aUIn9gVCL{=$oF4FZ|SEPUI1l1^2Rad{9_y7O^ M07*qoM6N<$f)*;Fd;kCd literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/copper_diamond_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/copper_diamond_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..928d640d58a3bb27d635442ccbe382e49ca1d2e9 GIT binary patch literal 5540 zcmeHKc~}$I7LOpJsVpuP0g*JQ6*2ol5)(lZmJ|XAv_i$gWM%?^Y-9onh}D7$0!50g zT0udq;(`jIpNjSaS_E1a!P2^dVCyawii%pqHxnqv_k8yGeXswSd`ae>`#ZmT?r+XH zH?tu)(ANs@fXCr*R$@O<2>NS_eI`yoznur31329Htdy{DT?n8jXtZjXTmchw$r_jd z8{{$^&T#4HWy`g0u9Kg|yjwYb&U>?)dLk0_)TW~Ezt8Qh6Bk}7O4#Cf?BmSzT-&3!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cmzss)wn_R?~Z^noM{L#~b_ul-&HNSy( zW^?g8e<5KI|Lm?R%>x!IWxxV8fiUJIevaDgI>rGQEi{25UyD1IwjWHG`b}{~7ce~u z6naN+>fsps%Rfb&@2&o3XZy0$_^57Fad5sg1{_~QG5yP){DS)Jv009mag(>EgTvV` zDP#brKf__iY}NIWJ$C zRCM>=BJ)b3)Lg+>YB)Qlq-Az^HP|}6x1qL-e!S^KL;2B^=|7k0J3f*&ST;lEu2g`?E7TT^%!b*u>rxZzy|K z8*k-O7B|adlNevYu_xV=O~LW=dhI0ZDbuG&Jj+%J83aPps;IW04#rcU0wK^hSXeeU HX2rh%dBaMK literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/copper_onyx_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/copper_onyx_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..a367a03b87b2c2fdcee794c6ea384dba8c3da864 GIT binary patch literal 5517 zcmeHKX;>5I7LI^|EFzLxT)2j~P=Tx@WRXCDAVk>&u0RWv$z&1&NhTx%0TfYCfnr6$ zy0n5&LBSRDx&T^=vS?YXwW3(%q99sjQL2IqdS?Q~c(2!9pXc_U$&--p%zNH*zIVlw~-IF=A{ctGN_#lkLZ-Vz(xm6s!z zZn&O&QPh)GT95BqV_&>!<@%_`s^$J(+lP2;@|pCGh*u8+XvvXhuO3fXAE_{pzWVI< zWdr|^xgNKUaE3FS#ZRUl&zF1kZYy|lwPYlGil(W(=BOh7K!4I~d~K;-YHvR5v$9hG zPXC+htqmPYTR$psN>Epvxon`ZHKKlRXGF=~tJX>PpVILCnZFWT>Z9)qI&yAo_{lPM z+m1Oe+4#PfRoM{(my_Yxcn+U$S9Q9yDR7U$S<9mCr=k3y7Y0XKxBg_h)FJ9XT8rgD z_L6RkKEE|~(7j*8UzFm64_fS#2Ta&jT=4Pvk0bGg%Z7f;+ONN;z$6qb9r?(lCF#=6 z!<&GfCFPF{Bx`Lu7()evwte?Xhc;L7Ga|r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5w{Wg;;JO-dVC*T+lX8!+yJ$taP^m0AxBt&0?a<2Yr! zN~Xn#Knf&-D+!SOk0?5let8ftNqD<=u{?C z>`0=E#9|VI%623HbdW}3GpSCF5S0Vcm~0&?fkKS{3J}7mP;#;q$3V)RpEp0%in-xYSLa8`n00P8xHc3cjvq=n*laRy~ zIYA_bP)uWr(J*WgOG||b%XJG7@Q8FW^|d8H1|VWsCFc=+q>A{&*B64NawrG^FwtmE zbdDp(iN>Nb9a${8(`(RjNTo)r7UQH*$)npAf!xI?A%GT-R1QcWic%rbdY~zDJyZ~Y zz^Y&vmhp&KN(9VP+X@8du_EXCz#xD%gBA>lus#{<6n8*E(Jq}S?*jh^Q&2RlQT%T_ zuc6~CZYo3rt783C{=ygtMBdHwHt;x8AUdPeh$>0&C!6{=obzZ^dZWIuDoH1P5EM7M z8XY7usa7fiLEF4s0K`<}5!FBfB+}jjRL9XvU^JkRKgV6mM@LPtl4#O62&X-ozi008h!b~P+UG=K_nlb}6>-e$!aug>jExFkU#_kI&e$m73a|Ot%p}IcE^L#p5B{>S|%&K!_+w3lsfD);cNRTvrwZUBJlMz zylrGTO^f!R)4%+=>`IH@xQs^0axIXqkj!izDmS70zQ{9-d(5z3PXW z@*8yx{uUz>Q=|5`FIa=0KG$KnduINZEqelq{bWnIs(QyzN6OG3`9jc0hSwB53*SvJm}ql1q3Z6_>XDC{?QYqJ?hZCtP5mV+<&f{+A~WE!V?KH% zpRFzGDY>${eapF+v#n>6kJj6VSozyF)+`!wip$DNXsErUkK1)oZ*{w-z}4`#p+zL` bkS@dE!XW3>&n!F9-QxtFe*8o3QEC4Iv^zE? literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/copper_white_pearl_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/copper_white_pearl_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..5c64f367931598337138c069b8f9592d84f8ad36 GIT binary patch literal 1934 zcmV;92XXj`P) zaB^>EX>4U6ba`-PAZ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%l+|_19a#>?i5Xt`<82!rQ>bbyt)3fXf{q`lL&S zi_@%24YJ`L;yPgKmb4KPLdS>000SaNLh0L01m_e01m_fl`9S#00007bV*G` z2jvJF4FD4f?+zva008nyL_t(I%gvIpYQj(yhQH*RRH#TRC4<8q+CAWKCttt^=xFI9 zD7ZRy>N9i^T%Ef30!~f|aa1r4*|cP+wxV$;fR(TL5@`eM3q~6h(}>PpLbm&TI)2DJ72M5XW(G z4gkV1#Pd7~gS7eFQV|A&&NG%UsR(V`=^Q9mCA~%+fZ1~K)5y9^VUR9o9Y}xH3BPex U5A`G|lK=n!07*qoM6N<$g6S5GS^xk5 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_black_pearl_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_black_pearl_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..be98291efbecdde551a608b3221fd22a5c785c3c GIT binary patch literal 739 zcmV<90v!E`P)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv06PFc06*zYk`({|010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

%L12S%_O}hX90N_bPK~y-)V_+E6z*Nulzp0+- zf3h|IKWO&<|3Nd-4S{Kfx!~nO2J#F!)y_b^W|;H;A2h>j2qRXTCo?j9`u>Mu`L0(C z9KWA1n5i=`2=g*9`1G1GoW67#MGq4$SFGOqhT-SOCk!9IF)-}A$iVRM8FqCnxD5FA z^Do1MLn;jSA3b7Fl#^pvsdNXcI-D+G`u>#R{-Z|>)|QqG_a8mN8D32I0#i{=j^XI> z<9Gucrxz?V7#Qj~AkOAv!EFE|&NMI?B6a%MDFy}x28QhAm@$CU0GJ`jd~BMj0syGq VX^rygU`_x4002ovPDHLkV1jo{P1pbc literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_diamond_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_diamond_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..22d3e094ebb4f7374491097dad12454340747cc4 GIT binary patch literal 5515 zcmeHKd0Z3M7LG-hMj|N1q9DY8Pbv;sNXTM>B6}gSx`0)g%uGTg$;6pJA}Uf)3xfI- zlnU0WwI~*85pgND7K+l!(&7RtZd9PHrSRN9T%a?7VtmhMpTFPhe%437q($M!rX+{Xtwhf`=Rdus>+LzPXu|vlSNqcAFHlx?p0(%x0J6frkus)7-~BzAQg!w!aTjly*k{tF$?~OLZMfwO&`Y+@of{gIc(*58}Jt zuetJTf1BCc9=!u6vKRNvTZtwnUk>u0ULYyPr+` z(SiZ$JK_cDMXnC6Ifm%^mDL~T)kXBUCS{c@DSN|{k4<7(;J0Xi?VQ!M-1>)&vhKTQ zu8*sWXVtSj{_)}OWnoV5YfhZbRjgm~#q~=S+~C{ZX|`2*ii3<5@49?<@cf;2jGD-* za0{&V`sDbuIofSumi+p0?FSscW(OwR{_^H_hecyDt(;2o?iLbhe^)NSuA?%2?=6ta)5C@OH|?Tfkx9J#bl z84Bpz<9_a5`Ab=7%dV8K7q*u891aYxUtK>*-E0A+-u`|gFEe1S9rtK1OJD{y+BxJ` zQN~}PHI{7c)3Er0^6$aO(U#5b*4T8~nQwNZ?Q`~LS32S@cjf7W6VPsZTprQqSii&f zn!Fo8d%l=|PaJ6&&z;|vS=_N{BaJF8KQC_F=hD)N(w;1(Rg717KtK2d>{N`I_H)M3 z{>kFa>${)yb-kVY)lI9q#?E5+#A!}pP+wNz!!f&;pE7eVWR6NPYj--o?%37%#Yeg- zCH8(dC)}SGytJjW&g;0P)281iRQiS<-K!2iKbS%4hPXl%{NZpXJKpjz#o_ zz5}VWvx0n&{(~iwIzn1M;@I_&EE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_o!R*oIcaZ1iEcaI3)fj#g7D!% T#Qi$4HA+apT>sKJ@#%j6N_ik^ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_emerald_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_emerald_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..4b2aa7cbf9b75bb832a0a2cbcb956edd99bd8e2c GIT binary patch literal 5555 zcmeHLd0Z3M7LFS#i@0GasDwa8mSM7zg@i>whzKZPixzoIW+ow!WI`4aD2kwhC~7N} zMU;wlp^73}6~vXDQna>~f)x~n*1989OSRIOKoQ^b+2`-~`k%>fLhiZW`R=*joO3Rd z%tgWeX2w>=BofI?7~mU<|D8-+6O8aro8AG4L>il$6ds`og>+=43KL6ZC|Q%JM9HXL zDkhQiSH92vQ044sntp9*t;;A|FA+ELfO!1TXZ;oB)7%rB8XNgpm9jO|yYfdHu=MQ8kot}_?x!mhoMKDhf#PnxhmTFi?8zy8 z-BH-?*`7%=+xa#beE)>Wn|93hzk9qe_}cE?$j1-%s?Y41wY;?%zGkxJ(&%Spj6;mF z+R_V)^(!+O%WA>+v?-wz+i2j5q(XOfrg>xK?u@H#$$iP68N)Ye>&&^lB;$+f6ZAf> zdv1@~&DM#orF3*Fvi8D#g37ygbc^Qv%W|i{G$_?MYO`Nt8n(*i&VuskVI|}iucO!Z zr%x@S-Xn)>q?_G7a4>wzE?xV?Wj{MvF5GdXyvqq2TOPydtZ81g>85e4>9I;t5lgY` z=918?s}piIUC(-0lhMQvd){?&=0;jzZo}=Z&NbcQAiFG~;(3+v^qB42)3;vJ=IgZZ zwNy0P#JPF>MDd5mH%z^C@VGu++&b>g#`eI~yJw9Lm{K=sLb~Nxnf;{cjqBC(*6^Kv zLwxVIR*oJ$JuMC~YNh(0TgvcIW39XUr|wK)^xUZ&R%ICpu0VH&;5^Xl?DD#m^8ci z*!k+s)Egfc*=>mE$i%VlFE`D*T$St!Ub-*s~oKaD+vtq}ZM$?+@4wG|*q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G~M z_wh*=CjQK9BntHRB@Gboou~I@x?+Bcff{O9XG-5{Q?IDJ^ApUy{yWHT;I=)r*JgQtlUKM4xqj@JF=MKK uf%jPwuOqnyq8d{0nCNtJZ<%y2{-bO@3RltGEyD2Kl7xQ2zK7;Tr~L{4DL^Oy literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_onyx_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_onyx_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..7a03314f6762815771ff834a413de83faf067d8d GIT binary patch literal 5491 zcmeHLYg7~07LJG!DX7&}1iUhaD$r{(d6I_&|7LiM( zR0UcUvEl=lwTOt)YF%PW6@0d8d8r`WGl62f*K4n9-Tre}6LR+X_ILLA zX77C%HipZB9qnE0DHMvMBqT5b{GLqSc2w}`)-{AsD7Guo<v3t+APU zVenC1alM`ulT?!D5@9#3FqDzJFyPliQPLlp`q%D@zb4b}b#lnxQP4B}@(;})_UBD( z(L73q`IYK<^#rTH|ldZYkJ2BueG@ zPij4ze{W@Yb<5S2{K`AuB;M0BG3wTbjH~uYkzqAE%+MBg-MB5;+k@ww{V4p6$hlCI zU)KV!tSPKd+fFapxw!Q5m#@8f@aDnfz@`;PYl6k>$KW#R#s(jhi6NWTR`p-G$$sgG~LnV9Ud+#v0YviHY;c|cjp!k zwTW5UGB3dWM&=~pmG(S+LqHyJJ)_%e@53pJ<}Qmkz4Z(E+##1l?mJ0)YL^7O&AYhz zHM+N^ykpafJLhBj#NC(nmu-U+i*Jj0=};esce$0y;`jVAo|ldKNY7o84a89uckLRk zLF@m~dF;&F!c&=7;#5=7C1xt`_p!2_eh#*=?!BdqRJZGEud5EP+UUA2_^bo5E~CWx zrgv@gl_NW%x&}V|)|MO9o?X6m(+7_BQclv$pFTg3)Ky0vtjJn6p?Yg&{C3*u>i6Lr zr8SQ@gI8P+IoHP@2%vKYfoNbib@DmQ_>zZvLDZ<9CJU zaeCoa)iF^*PSwnieVjWFdhnd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HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/gold_white_pearl_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/gold_white_pearl_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..65f2e3bbf58550a9d957e367c9cd9023e8978d43 GIT binary patch literal 747 zcmVEX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv06PFc06*zYk`({|010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

%L1Osq1+eQEY0O(0XK~y-)&62-r!cY{(e+d~} zDg`0qUF#$+HKokl@g> z9q#x2?#DR?{&mTo)UqdaW3!F|t)rkmq%v0t-o`Y8#E&#LSMhZeT!c8rpF@XY|IPII zoz_=Ia0i_m7(7YTt2*#bSm*#PC?hlim;2tl6be9rquoi%~G z-ynp*_kD_@u+Gc7G|V(jNsh@2HxQnl)JqJ&X!>^pRzL;$ d-J8r;sUx*|YAwUqci;d3002ovPDHLkV1jU1QThM? literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_black_pearl_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_black_pearl_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..5ec59ac0f7946abc8f94705892b8f639fb8543a2 GIT binary patch literal 743 zcmV?P)EX>4Tx04R}tkv&MmKpe$iQ>8^J9qdrVAwzYtAS&W0RV;#q(pG5I!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOiKh(eT@si(4wIe3n*d-(Wz7w1{t=l&dnO3`G1Pb8jWx?vG-5YKE{ zI_G`j2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv06PFc06*zYk`({|010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

%L1|7H!gr@)i0OUzTK~y-)%~CrKf`5|)P0 zOGCm1=(Zr%RwgufBzh}pu^<`@CLTgVu?5BpkZgmEdjKicN`ncz@zXfnOy<3L^Jaj* z4jNEN11i4;vjdatz&BDI1P$kygdrNv zl|u}j0^jp+tSarv2Uie6KwJf)=?ugoPb1&{0~%17BnbeZKGgt#UAe9fAuoD0P002ovPDHLkV1hFTMFao< literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_diamond_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_diamond_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..6df0d38ace0ac3addd14106d6b468b11448b1b44 GIT binary patch literal 5497 zcmeHKYg7~07LG_o0t8TO6)nU8p{-6PFY+n@lz>DDAP*m)$Yf>$DS43u0<;whf`a0! zmWtk1(6$Igd|;O%R9ecTKG338t5s1d*wvz_Alic0dnO>pd%gC$*6lx&m1NF7-~P@% z-|W3lrXV70t^?JTN}*63q#=?>@asf=#*YKv?tPC?3dI`Dj9zSvL``&^UaL^52)Z#t zN6?9MrGi39zxd;#xZQ)6ez=&QO_S-pMT?~*xA8yvP^ ze`Y637B@ZoIIXF8O`LOGZusDZ&%S01ZoApDT)EA=wf{lSq;Hd~-tSra zd#Ea9{Tb>h_mq}tDc)gD(7>8cO^QdNv~I{f$F#t4Urk2eAAT+^`LL6l{J8HZW!*RiXXu(y<-%#ZL3$k6Yz;dY7gat#sbkOl@-g zVba{lvsI9|ZH-js>0KTTK1jhSQpvsL2i53(Ja=6p~kDwnLr zto^2Z`u0FIWz2+>q7xL}i7{6td^J{ddQ)mAjTdW|?L@1}_DUJI_=?@#x$jG81bQb} zlCw)9-89z5-E(CrIVuu(c#|Hf#==c{Vjuj zew?E}zOu|?9rteD#o&8xKA8cx3}=&e@|^qThxtd0jk^~;yXKSco9tH$!vmIjTZJU? zSv4E$O%rPiN@TR4>9k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9=SWe%E%n1{Z|^T7YX6qTekY5q5!C(u!r*?OZ%t4|Ks zhs)m~Fyr%io&_FdiUd8%VAN+w|6)`BhVvcH$`IhI)n{0&A4Q}LkA@qGN@UH><^s861Z2@Uw8X9CZ?@9xbj0ng0i zDT2S0*kFKWQl=7p*4}8F(1vOO$A09qf{1T(=~qL1e#~iPB;OWu1F=b zqXoy?Hi@Z?0Zw`TGm2{ijvbhDxXnl6vSu23YGb@p=+v1r;ri^4@(w-7wb{F1)>yZI zbB!IlrY=;!*LCv9`V7w4EZBKGY*p64`?BElJ3IVVEp0nbJAAX+Ir6O>?pBAT=Rf~= zAR_tRz#fe4E!~tA+TKh59IDwoA;zxvtM;DHC$_rGo+nLYebLZCamw)9o$>m)SDh)* z@MjGjVEBzgf7SlBg_W&^`?_7Gc$_*FwB;5}rKT(?o*rCd=w9eaPf^iA8 qu~y7!_WNRg@$lqFe>eSM)x?7b66m)tO@zQsDbk=YN%fqBoPPnxBMjyM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_emerald_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_emerald_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..ae1d890f28f03f6575d4603fd4a695d4798935aa GIT binary patch literal 5510 zcmeHKdt4J&7LFDWEMO}X0Y%cF1*(%533))UJS9Q^32H#4nam6j$%{-v0w|)k6sl5} zA{9Yms|MLxENZC=K6tfN9_vbdtO5e-3tOQpELME5Gl62 zH|LzopnCF5(pMxW}HY93+jj}wK7R6Lx`FT z6+%Sx(j)>wf91l8m4!cf**;Ew>##*ckah8d^8L~Zs|Kz<_A$!f_~Itc zRN18`k2|^+vGqRbi9oJnLvEv|fgPN8HEj-0o}GB9E!|=6@W9&BF*cbTMexcIm(0id z`bXynKgmo+9^|+DwQWf4X6>~ z0o=$e@S;Z*ZVBjHQYa4TdwZyEZvM&B?YsIc>x9R}-`?2w*U*4_232 zuNKvYX6tjhYaagHzP3B{=M!#wS^@}_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u*MX;JmVc;tJhE>eG)EanL_)6qYw z&31-Y@UA<@`1z|c9Y42jeOQ}wg7&TBRl;7)MFL?)uoP=-B0(ecN_0n`YDPTI$ zUkxX5V?)9wD6kQal%mn7xD<*`rz7ip$VzoGg~s7DX7z~6BGXPM+ z@&OoZ77JiAVIKenK?#I_EJOm*%&7PZR0Ap?1gFBt$x@65me4`AFP#O@lRyT*0NHea z<3j}jCWpbI(`XU~D1pr=qSaC?wLzJAR5%rkQGskKM5BVf07!*dSTr;iz=3>V0Ol|x zJ}^XOA~4fLg$v6KjN$W0bTaj+B}N8nl9XyWj}$3YX!TDg;-qp!r~z@&Xufog4~NC@ zWpP+6A79o}&~ikLVp)rG(x_y%X#$40VHhEZC681NCLU_oMZ zTq>0`{&JER>I}u879=KR5B@|epZ;@66L?(%={;k^7q`$ zVdLJxN>v6{n<<)To#KVdKLL#dYFxiea9XvqLQtCfF5A$%h#dUO=<0?K9SW*5Hrad@7#|;R ztA4B1wo~%6>AuJxwY{{y%(MM)8s@k7ilG=A{Smx&NHs$W| z+VZ!TP+qI>PkhaGEyEd`s23ZM)8d{z^}El2;bpVBPh@>he7NKzFuBp?=;b{N*1P0I zO*3X1$5tjJIOA9Q`#Bb!SD2~QM$0-Io08}_SK>4Rq3j5J{*mbB4Q$&4erQxkRgie& FzW^SnD0~0_ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/charm/silver_onyx_charm.png b/src/main/resources/assets/treasure2/textures/item/charm/silver_onyx_charm.png new file mode 100644 index 0000000000000000000000000000000000000000..148d5f5be077ffa7a758b230ea5bcfe8bdf64756 GIT binary patch literal 5462 zcmeHKd0Z3M7LFBBG2qrJ1+{rWz%7|cNJu6SEP{am0b~e6ct>kXqDP(QHxtqD+P<7f>J8BY7u)UAjbE6_WAq0{^!kalDT)j^WAg5 zd(OF;Wud`-wl)qnG#brT>hBu{euq%k0Bi95!GmWgjb_D7iHIh{P$NU9CzL8R&LER@ zI0HASlr);@+U2O2eU0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2&+g6@j3ChK^G)`A(Ki)DJc?d{()o&J6RR~B-d@|u3800006VoOIv06PFc06*zYk`({|010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru

%L1`VaUl*0f30NP1JK~y-)&62SWf-n?CFNU%Z zR-#Kkfvq1xFn$rc6AUh8ASNX67i=96KY^t#c3_mDP8v)oL0o)Wn|Dv{yYB&iT`XXl z1x&9Ni&|(=i|-*X@ykJSOpFj~4ifDnc%FxhXAoC0*=w7`X_|h1a_A|DH77300>fj# zZo4x&u}vf7=Nzu literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/treasure2/textures/item/imbued_book.png b/src/main/resources/assets/treasure2/textures/item/charm_book.png similarity index 100% rename from src/main/resources/assets/treasure2/textures/item/imbued_book.png rename to src/main/resources/assets/treasure2/textures/item/charm_book.png diff --git a/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/copper_coin.png index c8373aa40223ee2644eafcd3335704bf768d5eca..ef19600cf957ec8a5ce8dc39d01801b8c3d08b7d 100644 GIT binary patch delta 1773 zcmVL|&@AuG4d(b$EZuf&$8lycaf5-D ziYf_+X@C9M%^&zMMQeNzjVVTpk54{vMnmoTr1>Q4=X3wCXX8u1xds?r4z*i9CGYte z{o(e)>4T21{YLi)>o#;+-Ui+9%xKhmkm%>tPktLpZ8c(2xrci2s>^?#IHBzCv5ihd zcKtT@9bUjv4RGX`n^ZjR7+IY8kx`IF*1$L>PJ4+F`{({lE=_o}_OwYuyh7>zrkCfRhF z!NdcUyZKr~5qtyMGE09#QJZanvs6WLLNu=g`d;7Mgz3^jApXxe}%_!5HC{Z;N?1_?u#SFM}eodT|9@ zJmMNKhH~SHSrCN!)-6ne&$8vWckweq)nnSAS+T%uk7eQrbc=s2H+6QH7f`PhA|rJh z07dW}0EQeCu#sG#NLHAI2s|nT%0SM}^8p1Y1g-$d-XU9zu=4PYcZB9#4jg%OV{d{G z!9^#~1~~<>ybp*U@roGA$Sog2h(Usyk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i`y8_7m{Z{* z1tp^R5{i~sQl*MiGSyaBeGOG>tf?W_nl#&7^DQ)Ov89u>#p;*#1J-D<#)GLoE}X1E z8$vfUOi-^gu5$*)*b*2IodF~?cg{8?Yq>MmIol#*RXBe}kgju6XiJ7XD72N>H9EPw zG50ZV23Wu2jXz<|bn5;G=Gatu;_ZU9lE!uo6ybQVLeq#dh#7wltoJJ%Z8Bln3l17`Gr`kw6WhX8 z7x1W?hdl#>=bZM5C5yl1P@Quqxk!pk3A4vWv{bgUev)o}ll5m=%}Rs&EO^E8b21Yx`<-<2hpeCW&Bfx#`{+6B z&gp*yILX9A5iO3WlUD5TN6wnVw@lYKh%Z0@+JY%0i+>KkaF^WlSADFNOj*ctuvd-_ zKiJC0%suw%%e*ufdE>)TgqS|AlIEMe>`k8fHvMVQ)6iFnDbDN_w(6g&;T6N?o0{=J z{h4_$Qoy{Zk3S6vrS`+3_9oD=L4Lc7Ub-p2kmg6>{53;@(_F;z_z%~`1R&GJKkxtm z00v@9M??Vs0RI60puMM)lV%1We-I7^ClmSuC;$Ke!bwCyR5;6HV4x5%ViPR2R{xJp zy!+@)4D~G7G`i>+;gRGf@lx%eQL?aEeor00000NkvXXu0mjfV^+*i diff --git a/src/main/resources/assets/treasure2/textures/item/coins/gold_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/gold_coin.png index 4d428e3770f7c3cec48b6cc58f3594cd07e0d8c8..ebe8f9c4656d4d88f8ba4c95f20e6b1e3888cf66 100644 GIT binary patch delta 270 zcmV+p0rCFu3%UZ3Ba`6-7JndPNK#Dz0D30?0Dyx40QzJA0D#f}0Ct7|0PN`i06Crj z02Thme$zSt006*AL_t(|+G70w|33pIfCZc2;kANTO|=bv&xj%T|Nnm!d}xip|3BYv zVa12m2>eG^&xq`W!)pcqTX~;iU|?Wi`1xrERwti5T!-QkxB)QDxPLU_GKBH}|Nj^^ zpFLcMRU@(mFhiKg3Hi@Y8nMR$%ygJ*j%_tV;bZe2)@a105LehRF;EDYDDgks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Pf#(e0m`V^NJZk4*EMTsQ+4#YcOWiM;Kw0M}VBYxGeUDF*xCS+wzTl4fh47?4M^;ehW2Tl+w<1R4!d`J0d5U?h3JzCkJ6GY7z4hjRVto@f*jctIwy?!G zj+Vxo!b8WUVzbeWPI73xMlAw(bw>VU;O_umEU3#cJxA#WKJTB3<96>0?0tw2Hl; zPhC`_57YF%7OLMx&2zA*pGC`@)BH9Q3GrQaKxTBqhbQB^6GnY!zHX{(0d$we^f(|d zJ)MsJy{D6rAsBxLbV*G`2jvJ5 z4ht^dh{eGG007ZRL_t(I%VYfi|33pIfCZc2;kANTO|=bv&xqFmm_{q_Qw;bFMmC5M z<^^=kKR@ljYRK8cbttZ3LYB1hKE?3!(+-@P85kHCjBT4Ry>NJ~;D2Oi!)!qZFbmWa znHdhR75r}-{GO4CoRE4K6H&k(h%l$aTyt!z83Unk!5WR&6ygdOCI$)tSq8j%^8nQV z+u-+%$F`a=u=9Bk)cpBLBg3uxf3c?nbVIDXPr;)OSu-+VM9xgesS!EQIDaf;c=hH1 kTr<|BOm1dkq%=DN0M=A>+Tz>4b^rhX07*qoM6N<$f_~1}RR910 diff --git a/src/main/resources/assets/treasure2/textures/item/coins/silver_coin.png b/src/main/resources/assets/treasure2/textures/item/coins/silver_coin.png index e789706c807706addb2e0bf62dd2c72b07f60cdb..03ad6cc468b01ed10db90bcaf28fbd01f31b425c 100644 GIT binary patch delta 241 zcmZqR>S3CoT+hIk_MoCO|{#S9F5M?jcysy3fAP>{XE)7O>#5j!V? zHs8q|!FPc|Gd*1#Lo7}&oqSr5MUlhh=q(MNa}gb_79B?xvtLT^_gQ&4@9dg8OI{og zFZy1RB>yBO?f#FGKMwAOS_>jHOEC8NE8)djs81?IEo@afL~QqMSJri;qdAi2)!_n)P%J9pJFXQT!E n`8?(L!na2R3jWNzcT4aB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvwyQV{ z{MRaa36^DfSdQ^<&f7sRzsul|gpl!dd_hLYl3XRkh1$P=I{ky6HO`RJ5PkCA;OCM{ zHe(Xa_S+=GZk*?ZxlHc#wBN8$38ZY7zD@fKymO6F1iQ}~k0HZ4Wi6z^F#o!!A6d4CghKx9~co^aSIyb9c z&#|L@dH`>q9k4Tb>g65^GJYEP14dKNdXC+S(1Eo}Y4)K72`HI!Awst zV9c#{;mR7+AzWPWXeT;217p@P7!QL16to?jnSaR6*}>f4%p{A4LM>Qh9pqFVjDbPd z*lOpUyDM`qc_VdS@n)YfM}xZmgE<=1P39hXJ7KNn^^GDcLE|YLm>TJ5Y%t0;;t&1! zcS(Qi;3G%UK2MhRHSzEAqSLri2XB~y5)xreVp7)4)h|4qThlorL}{Tp5JZ; zb$@kP)wS(lv;Pv5gQRN!S>A(m1Ihslx&z~6k8d}qZKr?VRr8lw;pf?%XGISb{g@RU zu`c1_5dG_mtmw30#2;(wq;6k2i~-F`tW`B3V>D8UA5q!PGzU#)2Q;8;u~+1+}&k*F6r5gTOZQvYZEgZeHHh) zq+b{Q>3~~Sf00v@9M??Vs0RI60puMM)00009a7bBm0Dk}u z!~g&e!~vBn4jTXf00(qQO+^Rg2oMem2ZSMP>;M1&u1Q2eR5;76Q?U^PAq+EIY6f7Q zpTo0w7SF*XloUQ{79bTI4<^a+QE8B5WMgWr@B}ZdNJMp0H*?L59W){$s&34@2z7y( zEF!8%2;nAT$3sK}5!sRf0Ius=pJqTrb#!hnGnzq+5mHJ(M8=*Z@0`=8&{}WZw9r1~ zqK;9!xXZ=DLmUZ|QtkpoWSAMe_g~551eOkF5k%~x8_7Sd@)%mq8A>UgtgiB3KGO-_ X5dnbj-Bx4000000NkvXXu0mjf^*>Pv diff --git a/src/main/resources/assets/treasure2/textures/item/lucky_pouch.png b/src/main/resources/assets/treasure2/textures/item/lucky_pouch.png deleted file mode 100644 index 5aacb9a75f3d07c7c344c795178ce6ec83c7b6ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 533 zcmV+w0_y#VP)w-uB z5CqY{N3h?r0%i4(*o=;b>kPGJ9t=LeK+q@`UXC!V|kFQ}pXwG+%D{5cD8BzhL^}B{G`yOI<;$ z1|3hfrX-;WFu9L8IPP)HuHg2&ub%&aRuNawF6LqeWVhNPx7U|wdgX=cjjtNTXyb+^ zN}Pb!Xtnltb_EjOfw+WfSup_^Bo4$4I7{*fsXd8!_ooO$i`4V0K@_s}kw93$?LPmS&-_B&TM_a8B zv4MxQNnw3UYb+AQ|IBhFw2C&4#@+Zcm-#LhbLqz@r%$zWmZpZt4)>kt$JfCx@L%x< X!pX@8cvvwx00000NkvXXu0mjfC{X!; diff --git a/src/main/resources/assets/treasure2/textures/item/masters_pouch.png b/src/main/resources/assets/treasure2/textures/item/masters_pouch.png deleted file mode 100644 index 791808bbd75beeb018fa38d2732ba9b6efe5c96b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 531 zcmV+u0_^>XP)=sdS7FewEGm1woV^98do5a zjRc}ZNWc~L8s7`v0%0wSS3#L_H0R8mb2JvkmA%rp{@DPsUayBS1|bAO2&9yZMkB&7 zJi~~hHBw5FBq0n#EbB1eXf!T63E&rQ2JrUh0rcTr8GtvRAI|3OA_DX2BlhnVZ zFKDfShwSCjB7*FD^F8-J9=W-@Mr+O0RfRN7>2x~u`~4G=LJ#h5|8jG8jg*o~rIPz% z+cwQ+^CYF0nzC-Uix2|e_W?-L6oC1Bj#7%rWCFl+It8$vUyubsZ~{J79LE@A*lxG@ zzK;;%^%yssO};gXBBYe8Rx1D;#{r;Pt)7{f1wjBntyW{PSWqsPiK2+*a+wnvW7zF> z#WC*pdz4ZbV{l!UD2i|#2iJ8m#-Oz(O;bvx5?X6otrp|)IJ2MYOp+v*ag=bBF`Lb> zZ5z+?a9x);j!!RGuh$F)1KRC2N-65~Isi(kgIPl0c^+D8hQnc=qIJOsUi VuKy@TrE>rP002ovPDHLkV1goM- Date: Sun, 29 Aug 2021 19:31:51 -0400 Subject: [PATCH 19/19] fixed keyring and pouch containers if offhand is holding keyring or pouch don't use NoSlot in container. --- .../treasure2/inventory/KeyRingContainer.java | 6 ++- .../treasure2/inventory/PouchContainer.java | 4 +- .../treasure2/item/CoinItem.java | 10 ++++- .../treasure2/item/PouchItem.java | 44 +++++++++++++++++++ src/main/resources/META-INF/mods.toml | 2 +- update.json | 2 +- 6 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/someguyssoftware/treasure2/inventory/KeyRingContainer.java b/src/main/java/com/someguyssoftware/treasure2/inventory/KeyRingContainer.java index 624a1257f..1ea9ebe2c 100644 --- a/src/main/java/com/someguyssoftware/treasure2/inventory/KeyRingContainer.java +++ b/src/main/java/com/someguyssoftware/treasure2/inventory/KeyRingContainer.java @@ -19,6 +19,9 @@ */ package com.someguyssoftware.treasure2.inventory; +import com.someguyssoftware.treasure2.item.KeyRingItem; +import com.someguyssoftware.treasure2.item.TreasureItems; + import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Inventory; @@ -75,7 +78,8 @@ public KeyRingContainer(int windowID, ContainerType containerType, PlayerInve public void buildHotbar(PlayerInventory player) { for (int x = 0; x < HOTBAR_SLOT_COUNT; x++) { int slotNumber = x; - if (slotNumber == player.selected) { + // TODO determine if the item is in left hand + if (slotNumber == player.selected && player.offhand.get(0).getItem() != TreasureItems.KEY_RING) { addSlot(new NoSlot(player, slotNumber, getHotbarXPos() + getSlotXSpacing() * x, getHotbarYPos())); } else { diff --git a/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java index 314a650da..fccd652bc 100644 --- a/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java +++ b/src/main/java/com/someguyssoftware/treasure2/inventory/PouchContainer.java @@ -19,6 +19,8 @@ */ package com.someguyssoftware.treasure2.inventory; +import com.someguyssoftware.treasure2.item.TreasureItems; + import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Inventory; @@ -79,7 +81,7 @@ public PouchContainer(int windowID, ContainerType containerType, PlayerInvent public void buildHotbar(PlayerInventory player) { for (int x = 0; x < HOTBAR_SLOT_COUNT; x++) { int slotNumber = x; - if (slotNumber == player.selected) { + if (slotNumber == player.selected && player.offhand.get(0).getItem() != TreasureItems.POUCH) { addSlot(new NoSlot(player, slotNumber, getHotbarXPos() + getSlotXSpacing() * x, getHotbarYPos())); } else { diff --git a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java index f97961d74..acafa7c73 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/CoinItem.java @@ -18,6 +18,7 @@ import com.someguyssoftware.gottschcore.spatial.Coords; import com.someguyssoftware.gottschcore.spatial.ICoords; import com.someguyssoftware.gottschcore.world.WorldInfo; +import com.someguyssoftware.treasure2.Treasure; import com.someguyssoftware.treasure2.block.IWishingWellBlock; import com.someguyssoftware.treasure2.capability.CharmableCapabilityProvider; import com.someguyssoftware.treasure2.capability.ICharmableCapability; @@ -246,7 +247,14 @@ else if (getCoin() == Coins.GOLD) { LootPool lootPool = table.getPool(pool.getName()); // geneate loot from pools - lootPool.addRandomItems(itemStacks::add, lootContext); + // TODO https://github.com/gottsch/gottsch-minecraft-Treasure/issues/242 + // lootPool is null. + if (lootPool != null) { + lootPool.addRandomItems(itemStacks::add, lootContext); + } + else { + Treasure.LOGGER.warn("loot pool -> {} is null", pool.getName()); + } } // get effective rarity diff --git a/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java b/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java index 12677b56b..b87f469eb 100644 --- a/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java +++ b/src/main/java/com/someguyssoftware/treasure2/item/PouchItem.java @@ -19,15 +19,26 @@ */ package com.someguyssoftware.treasure2.item; +import static com.someguyssoftware.treasure2.capability.TreasureCapabilities.*; + import java.util.List; +import java.util.Optional; + +import javax.annotation.Nullable; import com.someguyssoftware.gottschcore.item.ModItem; import com.someguyssoftware.gottschcore.world.WorldInfo; import com.someguyssoftware.treasure2.Treasure; +import com.someguyssoftware.treasure2.capability.ICharmableCapability; import com.someguyssoftware.treasure2.capability.PouchCapabilityProvider; +import com.someguyssoftware.treasure2.capability.CharmableCapability.InventoryType; +import com.someguyssoftware.treasure2.charm.Charm; +import com.someguyssoftware.treasure2.charm.ICharm; +import com.someguyssoftware.treasure2.charm.ICharmEntity; import com.someguyssoftware.treasure2.inventory.PouchContainer; import com.someguyssoftware.treasure2.inventory.PouchInventory; import com.someguyssoftware.treasure2.inventory.TreasureContainers; +import com.someguyssoftware.treasure2.util.ModUtils; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; @@ -38,6 +49,7 @@ import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; @@ -47,6 +59,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.network.NetworkHooks; +import net.minecraftforge.items.IItemHandler; /** * @author Mark Gottschling on May 13, 2020 @@ -110,4 +123,35 @@ public Container createMenu(int windowID, PlayerInventory inventory, PlayerEntit public ITextComponent getDisplayName() { return new TranslationTextComponent("item.treasure2.pouch"); } + + //////////////////////// + /** + * NOTE getShareTag() and readShareTag() are required to sync item capabilities server -> client. I needed this when holding charms in hands and then swapping hands. + */ + @Override + public CompoundNBT getShareTag(ItemStack stack) { + CompoundNBT nbt = stack.getOrCreateTag(); + IItemHandler cap = stack.getCapability(POUCH_CAPABILITY).orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")); + + try { + + } catch (Exception e) { + Treasure.LOGGER.error("Unable to write state to NBT:", e); + } + return nbt; + } + + @Override + public void readShareTag(ItemStack stack, @Nullable CompoundNBT nbt) { + super.readShareTag(stack, nbt); + + if (nbt instanceof CompoundNBT) { + IItemHandler cap = stack.getCapability(POUCH_CAPABILITY).orElseThrow(() -> new IllegalArgumentException("LazyOptional must not be empty!")); + + CompoundNBT tag = (CompoundNBT) nbt; + + } + } } + + diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 5cd2a9482..70d8b0483 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -68,7 +68,7 @@ Base API for all my mods. # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[1.3,)" #mandatory + versionRange="[1.4,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="BEFORE" # Side this dependency is applied on - BOTH, CLIENT or SERVER diff --git a/update.json b/update.json index c87e8e259..66e81425a 100644 --- a/update.json +++ b/update.json @@ -9,6 +9,6 @@ "1.0.1": "Fixed Ticking block entity on Bound Soul crash.\nFixed missing Loot Table error (for test.json).", "1.5.0": "Added mist - Gravestones, Bound Souls, and Wither Tree's poison and wither mist.\nAdded Key Ring.\nAdded key merging ability.\nAdded treasure maps to other Treasure chests.\nUpdated bounding boxes of gravestones.\nFixed Well and Wither Tree regitries.\nAttempt to fix LockItem.appendHoverText initialization crash with some performance mods.\nUses Forge-36.2.0", "1.5.1": "Fixed java.lang.NullPointerException: Initializing game at net.minecraft.item.Item.handler$zpo000$getDisplayName(Item.java:526) ~[?:?]", - "1.6.0": "Charms" + "1.6.0": "Added Charms (except Harvesting).\nAdded Pouch Item.(standard only, Lucks, Apprentice and Master will not be added).\nUses GottschCore 1.4.0 which fixes crash bug on mob spawn by ProximitySpawner.\nPrevent crashes when coins thrown in wells has an exception.\n" } } \ No newline at end of file