diff --git a/src/main/java/jesse/keeblarcraft/ChatStuff/ChatFormatting.java b/src/main/java/jesse/keeblarcraft/ChatStuff/ChatFormatting.java index e15b929..b7faf63 100644 --- a/src/main/java/jesse/keeblarcraft/ChatStuff/ChatFormatting.java +++ b/src/main/java/jesse/keeblarcraft/ChatStuff/ChatFormatting.java @@ -24,20 +24,14 @@ public class ChatFormatting { ///////////////////////////////////////////////////////////////////////////// public static String GetColor(COLOR_CODE code) { String colorStr = COLOR_START; - switch(code) { - case BLUE: - return colorStr + "9"; - case GRAY: - return colorStr + "7"; - case GOLD: - return colorStr + "6"; - case RED: - return colorStr + "4"; - case GREEN: - return colorStr + "2"; - } + return switch (code) { + case BLUE -> colorStr + "9"; + case GRAY -> colorStr + "7"; + case GOLD -> colorStr + "6"; + case RED -> colorStr + "4"; + case GREEN -> colorStr + "2"; + }; // If this code is reachable, then someone has not properly handled the above switch-case - return colorStr; } } diff --git a/src/main/java/jesse/keeblarcraft/ChatStuff/ChatMsg.java b/src/main/java/jesse/keeblarcraft/ChatStuff/ChatMsg.java index 6b5c95d..527fdd4 100644 --- a/src/main/java/jesse/keeblarcraft/ChatStuff/ChatMsg.java +++ b/src/main/java/jesse/keeblarcraft/ChatStuff/ChatMsg.java @@ -178,7 +178,7 @@ public class ChatMsg { /// /// @return Formatted string of colored text ///////////////////////////////////////////////////////////////////////////// - public String ColorMsg(String msg, COLOR_CODE color) { + public static String ColorMsg(String msg, COLOR_CODE color) { return ChatFormatting.GetColor(color) + msg + ChatFormatting.COLOR_END; } diff --git a/src/main/java/jesse/keeblarcraft/ConfigMgr/GeneralConfig.java b/src/main/java/jesse/keeblarcraft/ConfigMgr/GeneralConfig.java index 801ccf4..0fa4e13 100644 --- a/src/main/java/jesse/keeblarcraft/ConfigMgr/GeneralConfig.java +++ b/src/main/java/jesse/keeblarcraft/ConfigMgr/GeneralConfig.java @@ -70,8 +70,6 @@ public class GeneralConfig { /// set yet. ///////////////////////////////////////////////////////////////////////////// public DirectionalVec GetSpawnCoords() { - System.out.println("Among us"); - System.out.println("GetSpawnCoords called. is global_spawn null? " + (config.global_spawn == null ? "YES": "NO")); return config.global_spawn; } diff --git a/src/main/java/jesse/keeblarcraft/CustomBlocks/BlockEntities/FactionBlockEntity.java b/src/main/java/jesse/keeblarcraft/CustomBlocks/BlockEntities/FactionBlockEntity.java index 7d66ed1..e91b482 100644 --- a/src/main/java/jesse/keeblarcraft/CustomBlocks/BlockEntities/FactionBlockEntity.java +++ b/src/main/java/jesse/keeblarcraft/CustomBlocks/BlockEntities/FactionBlockEntity.java @@ -36,17 +36,14 @@ import net.minecraft.world.World; public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory, ImplementedInventory { private final DefaultedList inventory = DefaultedList.ofSize(7, ItemStack.EMPTY); - private static final int DEFENSE_SLOT_ONE = 0; - private static final int DEFENSE_SLOT_TWO = 1; - private static final int OFFENSE_SLOT_ONE = 2; - private static final int OFFENSE_SLOT_TWO = 3; - private String faction; // Faction this block belongs to + private String faction = null; // Faction this block belongs to private static int factionPower = 0; private FactionTierEnum factionTier = FactionTierEnum.TIER_INVALID; - Boolean stopMobSpawn = true; - Boolean hasBuildFlight = true; - Boolean hasSuperBeacon = true; - Position3d storedBlockPos; + private Boolean hasStopMobSpawn = true; + private Boolean registeredMobSpawnCallback = false; + private Boolean hasBuildFlight = true; + private Boolean hasSuperBeacon = true; + private Position3d storedBlockPos; private final double factionDefaultRadiusBlocks = 50; // 50 blocks private ArrayList playersInRadius = new ArrayList<>(); private HashMap factionPlayers; @@ -56,17 +53,17 @@ public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHan public FactionBlockEntity(BlockPos pos, BlockState state, String faction) { this(pos, state); this.faction = faction; - - MobSpawnCallback.EVENT.register((world, mob) -> { - HandleMobSpawn(world, mob); - return ActionResult.PASS; - }); + RegisterMobSpawn(); } public void SetFaction(String faction) { this.faction = faction; } + public String GetFaction() { + return this.faction; + } + public FactionBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityRegistration.FACTION_BLOCK_ENTITY, pos, state); storedBlockPos = new Position3d(pos.getX(), pos.getY(), pos.getZ()); @@ -91,13 +88,22 @@ public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHan }; } + private void RegisterMobSpawn() { + if (hasStopMobSpawn && !registeredMobSpawnCallback) { + MobSpawnCallback.EVENT.register((world, mob) -> { + HandleMobSpawn(world, mob); + return ActionResult.PASS; + }); + } + } + // TODO: Make sure mobs are within range before targeting! private void HandleMobSpawn(World world, MobEntity mob) { if (world.isClient()) { return; } - mob.kill(); + mob.setDespawnCounter(0); } @Override @@ -146,11 +152,9 @@ public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHan Math.abs(Math.pow(Math.floor(z) - storedBlockPos.z, 2)))); // Arbitrarily for now; each point of faction power increases the distance by 10. Testing will confirm if this - // is too much or too little. Making this configurable would probably be good too + // is too much or too little. Making this configurable would probably be good to // Default radius; increased by power double factionBlockRadius = factionDefaultRadiusBlocks + (10 * factionPower); - System.out.println("Dist: " + dist); - return Math.ceil(dist) <= factionBlockRadius; } @@ -163,7 +167,7 @@ public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHan // Call when the block attached to this entity is broken so we can send out our last messages to reset players correctly before perishing public void ResetBlock() { - System.out.println("Reset block called. Is world null? " + (world==null?"YES":"NO")); + System.out.println("Reset block called. Is world null? " + (world == null ? "YES" : "NO")); if (world != null) { for (PlayerEntity player : world.getPlayers()) { Boolean isPlayerInFactionRadius = IsPlayerInBounds(player, pos); @@ -172,7 +176,17 @@ public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHan } } } else { - System.out.println("Error, world is null and factionblockentity cannot reset players!"); + System.out.println("Error, world is null and FactionBlockEntity cannot reset players!"); + } + } + + // TODO: There has GOT to be a better way of validating the inventory than this... but it's okay for now! *cries* + public void ValidateInventory() { + // Slots 1, 3, 5 are ATTACK/PASSIVE slots + // Slots 2, 4, 6 are DEFENSE/PASSIVE slots + // Slot 7 is the special slot reserved EXCLUSIVELY for LEGENDARY Tier only! Legendary CANNOT go in other slots! + for (ItemStack item : inventory) { + } } diff --git a/src/main/java/jesse/keeblarcraft/CustomBlocks/Blocks/FactionBaseBlock.java b/src/main/java/jesse/keeblarcraft/CustomBlocks/Blocks/FactionBaseBlock.java index 1a4d0d8..4871715 100644 --- a/src/main/java/jesse/keeblarcraft/CustomBlocks/Blocks/FactionBaseBlock.java +++ b/src/main/java/jesse/keeblarcraft/CustomBlocks/Blocks/FactionBaseBlock.java @@ -1,5 +1,9 @@ package jesse.keeblarcraft.CustomBlocks.Blocks; +import jesse.keeblarcraft.ChatStuff.ChatFormatting; +import jesse.keeblarcraft.ChatStuff.ChatMsg; +import jesse.keeblarcraft.FactionMgr.FactionConfig; +import jesse.keeblarcraft.Utils.CommonStructures.Position3d; import org.jetbrains.annotations.Nullable; import jesse.keeblarcraft.CustomBlocks.BlockEntities.BlockEntityRegistration; @@ -46,29 +50,40 @@ public class FactionBaseBlock extends BlockWithEntity implements BlockEntityProv return; } - if (placer.isPlayer()) { + if (placer != null && placer.isPlayer()) { // We need to run faction checks here and make sure this player owns a faction otherwise they are NOT allowed to place it! ServerPlayerEntity player = (ServerPlayerEntity) placer; String fac = FactionManager.GetInstance().GetFactionOfPlayer(player.getUuidAsString()); - FactionBlockEntity bEntity = (FactionBlockEntity) world.getBlockEntity(pos); + // We need to verify the faction does not already have a block placed in the world; and make sure the placer + // is the owner of the faction. + Boolean canPlaceFactionBlock = FactionManager.GetInstance().CanPlaceFactionBlock(fac); + System.out.println("hasFacBlock: " + canPlaceFactionBlock); + FactionConfig.VALID_FACTION_ROLES role = FactionManager.GetInstance().GetPlayerRole(fac, placer.getUuidAsString()); + System.out.println("Can place block?: " + canPlaceFactionBlock); + System.out.println("Role: " + role.name()); - // Update block entity - if (bEntity != null) { - bEntity.SetFaction(fac); - // Enable chunk loading - world.getChunkManager().setChunkForced(world.getChunk(pos).getPos(), true); - } - - // An empty string implies NO faction; only do things if it is NOT empty - if (!fac.isEmpty()) { - faction = fac; - player.sendMessage(Text.of("This block now belongs to the " + faction + " faction.")); + if (canPlaceFactionBlock && role == FactionConfig.VALID_FACTION_ROLES.OWNER) { + FactionBlockEntity bEntity = (FactionBlockEntity) world.getBlockEntity(pos); + // Update block entity - this is the "ultimate success" portion + if (bEntity != null) { + bEntity.SetFaction(fac); + // Enable chunk loading + world.getChunkManager().setChunkForced(world.getChunk(pos).getPos(), true); + faction = fac; + FactionManager.GetInstance().SetFactionBlock(faction, new Position3d(pos.getX(), pos.getY(), pos.getZ())); + player.sendMessage(Text.of(ChatMsg.ColorMsg("This block now begins to the " + fac + " faction!", ChatFormatting.COLOR_CODE.GOLD))); + } + } else if (canPlaceFactionBlock) { + player.sendMessage(Text.of(ChatMsg.ColorMsg("You cannot place more than one faction block per faction!", ChatFormatting.COLOR_CODE.RED))); + world.breakBlock(pos, true); } else { - player.sendMessage(Text.of("You do not appear to be in a faction, and thus this block cannot be placed!")); - // world.removeBlock(pos, false); + player.sendMessage(Text.of(ChatMsg.ColorMsg("You do not appear to be in a faction or are not the leader of this faction. You cannot place this block!", ChatFormatting.COLOR_CODE.RED))); world.breakBlock(pos, true); } + } else { + // Only a player should be able to place the block in order to set faction appropriately. Destroy! + world.breakBlock(pos, true); } } @@ -94,10 +109,11 @@ public class FactionBaseBlock extends BlockWithEntity implements BlockEntityProv if (bEntity != null) { bEntity.ResetBlock(); } - }t + } // Disable chunk loading world.getChunkManager().setChunkForced(world.getChunk(pos).getPos(), false); + FactionManager.GetInstance().RemoveFactionBlock(faction, new Position3d(pos.getX(), pos.getY(), pos.getZ())); super.onStateReplaced(state, world, pos, newState, moved); } } diff --git a/src/main/java/jesse/keeblarcraft/CustomItems/ItemManager.java b/src/main/java/jesse/keeblarcraft/CustomItems/ItemManager.java index 656b80e..26f6890 100644 --- a/src/main/java/jesse/keeblarcraft/CustomItems/ItemManager.java +++ b/src/main/java/jesse/keeblarcraft/CustomItems/ItemManager.java @@ -13,7 +13,10 @@ package jesse.keeblarcraft.CustomItems; import java.util.ArrayList; import java.util.List; +import jesse.keeblarcraft.CustomItems.Items.FactionBeaconItem; +import jesse.keeblarcraft.CustomItems.Items.FactionFlightItem; import jesse.keeblarcraft.Keeblarcraft; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.minecraft.item.Item; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; @@ -34,7 +37,8 @@ public class ItemManager { /// 1. The name provided here must match these names: /// * This items models/item name /// * This items textures/item name - /// 2 Name must be lowercase & no special characters besides '_' + /// 2. Name must be lowercase & no special characters besides '_' + /// 3. Do NOT provide the Mod ID inside the name part /// /// @arg[in] item is the item to be added to the item list /// @@ -62,7 +66,7 @@ public class ItemManager { CustomItemGroups.RegisterGroups(); // The example item provides a demo of how you could make an item in your class - // Item exampleItem = new Item(new FabricItemSettings()); - // RegisterItem("metaljacket_helmet", exampleItem); + RegisterItem("faction_upgrade_flight", new FactionFlightItem(new FabricItemSettings().maxCount(1))); + RegisterItem("faction_upgrade_beacon", new FactionBeaconItem(new FabricItemSettings().maxCount(1))); } } diff --git a/src/main/java/jesse/keeblarcraft/CustomItems/Items/FactionBeaconItem.java b/src/main/java/jesse/keeblarcraft/CustomItems/Items/FactionBeaconItem.java new file mode 100644 index 0000000..8e079fd --- /dev/null +++ b/src/main/java/jesse/keeblarcraft/CustomItems/Items/FactionBeaconItem.java @@ -0,0 +1,28 @@ +package jesse.keeblarcraft.CustomItems.Items; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; + +public class FactionBeaconItem extends Item { + public FactionBeaconItem(Settings settings) { + super(settings); + } + + @Override + public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + if (world.isClient()) { + user.sendMessage(Text.of("This item can only be placed inside the faction home block!")); + } + return super.use(world, user, hand); + } + + @Override + public boolean isDamageable() { + return false; + } +} diff --git a/src/main/java/jesse/keeblarcraft/CustomItems/Items/FactionFlightItem.java b/src/main/java/jesse/keeblarcraft/CustomItems/Items/FactionFlightItem.java new file mode 100644 index 0000000..891e2a0 --- /dev/null +++ b/src/main/java/jesse/keeblarcraft/CustomItems/Items/FactionFlightItem.java @@ -0,0 +1,28 @@ +package jesse.keeblarcraft.CustomItems.Items; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; + +public class FactionFlightItem extends Item { + public FactionFlightItem(Settings settings) { + super(settings); + } + + @Override + public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + if (world.isClient()) { + user.sendMessage(Text.of("This item can only be placed inside the faction home block!")); + } + return super.use(world, user, hand); + } + + @Override + public boolean isDamageable() { + return false; + } +} diff --git a/src/main/java/jesse/keeblarcraft/FactionMgr/FactionBlockItems.java b/src/main/java/jesse/keeblarcraft/FactionMgr/FactionBlockItems.java new file mode 100644 index 0000000..8d398b4 --- /dev/null +++ b/src/main/java/jesse/keeblarcraft/FactionMgr/FactionBlockItems.java @@ -0,0 +1,24 @@ +package jesse.keeblarcraft.FactionMgr; + +import java.util.Map; + +import static java.util.Map.entry; + +// This class is going to keep track of everything related to items that the faction block is allowed to accept and +// information regarding those items. +public class FactionBlockItems { + public static enum ITEM_TIER { + COMMON, + UNCOMMON, + RARE, + VERY_RARE, + LEGENDARY + } + + // TODO: Need to add the Item information for these down below; but I haven't made them yet! The string should + // make it obvious what needs to go here though. + public static Map FACTION_UPGRADES = Map.ofEntries( + entry("keeblarcraft:faction_flight", ITEM_TIER.UNCOMMON), + entry("keeblarcraft:faction_beacon", ITEM_TIER.RARE) + ); +} diff --git a/src/main/java/jesse/keeblarcraft/FactionMgr/FactionConfig.java b/src/main/java/jesse/keeblarcraft/FactionMgr/FactionConfig.java index 4abebfa..9ad8373 100644 --- a/src/main/java/jesse/keeblarcraft/FactionMgr/FactionConfig.java +++ b/src/main/java/jesse/keeblarcraft/FactionMgr/FactionConfig.java @@ -9,6 +9,7 @@ package jesse.keeblarcraft.FactionMgr; import jesse.keeblarcraft.Utils.CommonStructures.Pair; +import jesse.keeblarcraft.Utils.CommonStructures.Position3d; import static java.util.Map.entry; @@ -30,7 +31,8 @@ public class FactionConfig { OWNER, COOWNER, MANAGEMENT, - EMPLOYEE + EMPLOYEE, + INVALID } private static Map ROLE_LEVELS = Map.ofEntries @@ -50,6 +52,7 @@ public class FactionConfig { entry (3, VALID_FACTION_ROLES.OWNER) ); + // This is the actual faction configuration object that is written to a json file public static class WriteableFaction { // Key = Player UUID // Val = Faction role of player @@ -62,6 +65,9 @@ public class FactionConfig { // TODO: Refactor to map so players can un-invite by name not UUID... List openInvites = new ArrayList(); + Position3d factionBlockLocation; // May be null until faction places it; but only one can be placed! + int numFactionBlocks = 0; + Integer factionBankBalance; Integer factionPower; String factionName; @@ -94,6 +100,38 @@ public class FactionConfig { return success; } + public void SetFactionBlock(String factionName, Position3d blockPos) { + if (IsValid(factionName) && blockPos != null) { + allFactions.get(factionName).numFactionBlocks++; + allFactions.get(factionName).factionBlockLocation = blockPos; + } + } + + public void RemoveFactionBlock(String factionName) { + if (IsValid(factionName)) { + allFactions.get(factionName).factionBlockLocation = null; + allFactions.get(factionName).numFactionBlocks--; + } + } + + public Position3d GetFactionBlock(String factionName) { + Position3d blockLoc = null; + if (IsValid(factionName)){ + blockLoc = allFactions.get(factionName).factionBlockLocation; + } + return blockLoc; + } + + // Will return amount of faction blocks in a faction, where any number less than 0 should be treated + // as an invalid case where the faction may have not existed when this function was called. + public Integer GetNumberOfFactionBlocks(String factionName) { + int amount = -1; + if (IsValid(factionName)) { + amount = allFactions.get(factionName).numFactionBlocks; + } + return amount; + } + // It is assumed that the person calling this function has verified that the person // can in fact set faction power. This is generally just an admin command public Boolean SetPower(String factionName, Integer amount) { @@ -147,6 +185,15 @@ public class FactionConfig { return players; } + public VALID_FACTION_ROLES GetPlayerRole(String factionName, String playerUuid) { + VALID_FACTION_ROLES role = VALID_FACTION_ROLES.INVALID; + // Check to make sure faction exists & player is in faction + if (IsValid(factionName) && allFactions.get(factionName).factionPlayerList.containsKey(playerUuid)) { + role = allFactions.get(factionName).factionPlayerList.get(playerUuid); + } + return role; + } + ///////////////////////////////////////////////////////////////////////////// /// @fn DeleteFaction /// @@ -353,11 +400,7 @@ public class FactionConfig { /// @return True if a faction exists with the specified name, false if not ///////////////////////////////////////////////////////////////////////////// public Boolean IsValid(String factionName) { - if (allFactions.containsKey(factionName)) { - return true; - } else { - return false; - } + return allFactions.containsKey(factionName); } ///////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/jesse/keeblarcraft/FactionMgr/FactionManager.java b/src/main/java/jesse/keeblarcraft/FactionMgr/FactionManager.java index ecb4191..b8ac1f4 100644 --- a/src/main/java/jesse/keeblarcraft/FactionMgr/FactionManager.java +++ b/src/main/java/jesse/keeblarcraft/FactionMgr/FactionManager.java @@ -22,6 +22,7 @@ import jesse.keeblarcraft.Keeblarcraft; import jesse.keeblarcraft.ChatStuff.ChatMenu; import jesse.keeblarcraft.ChatStuff.ChatMsg; import jesse.keeblarcraft.ChatStuff.ChatFormatting.COLOR_CODE; +import jesse.keeblarcraft.Utils.CommonStructures.Position3d; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; @@ -85,6 +86,40 @@ public class FactionManager { FactionTier.InitializeFactionTiers(); } + // Returns true if the faction is allowed to place a faction block. False if not + public Boolean CanPlaceFactionBlock(String factionName) { + return factionConfig.factions.GetNumberOfFactionBlocks(factionName) == 0; + } + + public void SetFactionBlock(String factionName, Position3d newPos) { + // Only consider the faction block now "placed" if we (the manager) agree there are no others + if (factionConfig.factions.GetNumberOfFactionBlocks(factionName) == 0) { + factionConfig.factions.SetFactionBlock(factionName, newPos); + } + + FlashConfig(); + } + + public void RemoveFactionBlock(String factionName, Position3d blockPos) { + // In order to "remove" a block (NOT from the world, just the manager) - it must be the LAST remaining faction + // block. In general, it should NOT be possible (for now) to set more than one faction block in the world from + // the manager's perspective. + Position3d origBlock = factionConfig.factions.GetFactionBlock(factionName); + if (origBlock != null && origBlock.equals(blockPos)) { + factionConfig.factions.RemoveFactionBlock(factionName); + } + + FlashConfig(); + } + + public int GetNumberOfFactionBlocks(String factionName) { + return factionConfig.factions.GetNumberOfFactionBlocks(factionName); + } + + public VALID_FACTION_ROLES GetPlayerRole(String factionName, String uuid) { + return factionConfig.factions.GetPlayerRole(factionName, uuid); + } + // This is purely a chat-based call. Here to help with `/faction info` basically. public void GetFactionInformation(ServerPlayerEntity player) { String factionName = GetFactionOfPlayer(player.getUuidAsString()); diff --git a/src/main/java/jesse/keeblarcraft/GuiMgr/FactionBlockScreenHandler.java b/src/main/java/jesse/keeblarcraft/GuiMgr/FactionBlockScreenHandler.java index a334435..c79c8e9 100644 --- a/src/main/java/jesse/keeblarcraft/GuiMgr/FactionBlockScreenHandler.java +++ b/src/main/java/jesse/keeblarcraft/GuiMgr/FactionBlockScreenHandler.java @@ -11,6 +11,7 @@ import net.minecraft.screen.ArrayPropertyDelegate; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.Slot; +import org.jetbrains.annotations.Nullable; public class FactionBlockScreenHandler extends ScreenHandler { private final Inventory inventory; @@ -44,10 +45,6 @@ public class FactionBlockScreenHandler extends ScreenHandler { addPlayerInventory(playerInventory); addPlayerHotbar(playerInventory); - // Need to reference Kaupendim tutorial again; but we could theoretically just add the player inventory - // right here so that they can drag items in and whatnot (I assume). I am unsure if I am taking that - // direction with this block RIGHT NOW - so for now I am NOT doing that - // Remainder stuff addProperties(arrayPropertyDelegate); } @@ -60,9 +57,10 @@ public class FactionBlockScreenHandler extends ScreenHandler { // This is just for SHIFT+CLICK moving @Override public ItemStack quickMove(PlayerEntity player, int invSlot) { + System.out.println("Is client: " + player.getWorld().isClient()); ItemStack newStack = ItemStack.EMPTY; Slot slot = this.slots.get(invSlot); - if (slot != null && slot.hasStack()) { + if (slot.hasStack()) { ItemStack originalStack = slot.getStack(); newStack = originalStack.copy(); diff --git a/src/main/java/jesse/keeblarcraft/Utils/CommonStructures/Position3d.java b/src/main/java/jesse/keeblarcraft/Utils/CommonStructures/Position3d.java index d1dde69..9b9873d 100644 --- a/src/main/java/jesse/keeblarcraft/Utils/CommonStructures/Position3d.java +++ b/src/main/java/jesse/keeblarcraft/Utils/CommonStructures/Position3d.java @@ -7,6 +7,19 @@ public class Position3d { this.z = z; } + @Override + public boolean equals(Object obj) { + boolean isEqual = false; + if (this == obj) { + isEqual = true; + } else if (obj instanceof Position3d castedObj) { + if (castedObj.x == this.x && castedObj.y == this.y && castedObj.z == this.z) { + isEqual = true; + } + } + return isEqual; + } + public int x; public int y; public int z; diff --git a/src/main/resources/assets/keeblarcraft/lang/en_us.json b/src/main/resources/assets/keeblarcraft/lang/en_us.json index ddd3162..3cc7ce8 100644 --- a/src/main/resources/assets/keeblarcraft/lang/en_us.json +++ b/src/main/resources/assets/keeblarcraft/lang/en_us.json @@ -3,6 +3,8 @@ "item.keeblarcraft.metaljacket_chestplate": "MetalJacket Chestplate", "item.keeblarcraft.metaljacket_leggings": "MetalJacket Leggings", "item.keeblarcraft.metaljacket_boots": "MetalJacket Booties", + "item.keeblarcraft.faction_upgrade_flight": "Faction Flight Upgrade", + "item.keeblarcraft.faction_upgrade_beacon": "Faction Beacon Upgrade", "itemgroup.keeblarcraft": "Keeblarcraft Modded Items", diff --git a/src/main/resources/assets/keeblarcraft/models/item/faction_upgrade_beacon.json b/src/main/resources/assets/keeblarcraft/models/item/faction_upgrade_beacon.json new file mode 100644 index 0000000..b5bbcf0 --- /dev/null +++ b/src/main/resources/assets/keeblarcraft/models/item/faction_upgrade_beacon.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "keeblarcraft:item/faction_upgrade_beacon" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/keeblarcraft/models/item/faction_upgrade_flight.json b/src/main/resources/assets/keeblarcraft/models/item/faction_upgrade_flight.json new file mode 100644 index 0000000..a0f29d0 --- /dev/null +++ b/src/main/resources/assets/keeblarcraft/models/item/faction_upgrade_flight.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "keeblarcraft:item/faction_upgrade_flight" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/keeblarcraft/textures/item/faction_upgrade_beacon.png b/src/main/resources/assets/keeblarcraft/textures/item/faction_upgrade_beacon.png new file mode 100644 index 0000000..6485a2e Binary files /dev/null and b/src/main/resources/assets/keeblarcraft/textures/item/faction_upgrade_beacon.png differ diff --git a/src/main/resources/assets/keeblarcraft/textures/item/faction_upgrade_flight.png b/src/main/resources/assets/keeblarcraft/textures/item/faction_upgrade_flight.png new file mode 100644 index 0000000..b634441 Binary files /dev/null and b/src/main/resources/assets/keeblarcraft/textures/item/faction_upgrade_flight.png differ