Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ legacyForge {
)
}

// jvmArguments.add("-XX:+AllowEnhancedClassRedefinition")
// Enable Enhanced Class Redefinition (JBR)
jvmArguments.add("-XX:+AllowEnhancedClassRedefinition")
}

mods {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.robertx22.mine_and_slash.a_libraries.curios;

public enum CuriosSlots {

NECKLACE(RefCurios.NECKLACE),
OMEN(RefCurios.OMEN),
RING(RefCurios.RING),
MASTER_BAG(RefCurios.MASTER_BAG);

public String name;

CuriosSlots(String name) {
this.name = name;
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Optional;
import java.util.stream.Collectors;

public class MyCurioUtils {
public class MyCuriosUtils {

public static List<String> SLOTS = Arrays.asList("ring", "necklace", "omen", "backpack");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.robertx22.mine_and_slash.a_libraries.curios;

public class RefCurio {
public class RefCurios {

public static final String RING = "ring";
public static final String OMEN = "omen";
public static final String NECKLACE = "necklace";
public static final String MASTER_BAG = "master_bag";

}

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.robertx22.mine_and_slash.a_libraries.curios.interfaces;

import com.robertx22.mine_and_slash.a_libraries.curios.CurioSlots;
import com.robertx22.mine_and_slash.a_libraries.curios.CuriosSlots;

public interface INecklace extends ICuriosType {

@Override
public default String curioTypeName() {
return CurioSlots.NECKLACE.name;
return CuriosSlots.NECKLACE.name;
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.robertx22.mine_and_slash.a_libraries.curios.interfaces;

import com.robertx22.mine_and_slash.a_libraries.curios.CurioSlots;
import com.robertx22.mine_and_slash.a_libraries.curios.CuriosSlots;

public interface IOmen extends ICuriosType {
@Override
public default String curioTypeName() {
return CurioSlots.OMEN.name;
return CuriosSlots.OMEN.name;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.robertx22.mine_and_slash.a_libraries.curios.interfaces;

import com.robertx22.mine_and_slash.a_libraries.curios.CurioSlots;
import com.robertx22.mine_and_slash.a_libraries.curios.CuriosSlots;

public interface IRing extends ICuriosType {
@Override
public default String curioTypeName() {
return CurioSlots.RING.name;
return CuriosSlots.RING.name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.robertx22.library_of_exile.main.Packets;
import com.robertx22.library_of_exile.packets.SyncPlayerCapToClient;
import com.robertx22.library_of_exile.utils.LoadSave;
import com.robertx22.mine_and_slash.a_libraries.curios.MyCurioUtils;
import com.robertx22.mine_and_slash.a_libraries.curios.RefCurio;
import com.robertx22.mine_and_slash.a_libraries.curios.MyCuriosUtils;
import com.robertx22.mine_and_slash.a_libraries.curios.RefCurios;
import com.robertx22.mine_and_slash.capability.DirtySync;
import com.robertx22.mine_and_slash.capability.entity.SummonedData;
import com.robertx22.mine_and_slash.capability.player.data.*;
Expand Down Expand Up @@ -233,7 +233,7 @@ private void syncData() {
public void recalcOmensFilled() {
try {
omensFilled = 0;
ItemStack stack = MyCurioUtils.get(RefCurio.OMEN, player, 0);
ItemStack stack = MyCuriosUtils.get(RefCurios.OMEN, player, 0);
if (StackSaving.OMEN.has(stack)) {
var omen = StackSaving.OMEN.loadFrom(stack);
this.omensFilled = omen.calcPiecesEquipped(player);
Expand All @@ -245,7 +245,7 @@ public void recalcOmensFilled() {

public OmenData getOmen() {
try {
ItemStack stack = MyCurioUtils.get(RefCurio.OMEN, player, 0);
ItemStack stack = MyCuriosUtils.get(RefCurios.OMEN, player, 0);
if (StackSaving.OMEN.has(stack)) {
var omen = StackSaving.OMEN.loadFrom(stack);
return omen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.robertx22.addons.orbs_of_crafting.currency.IItemAsCurrency;
import com.robertx22.library_of_exile.utils.SoundUtils;
import com.robertx22.mine_and_slash.a_libraries.curios.CuriosSlots;
import com.robertx22.mine_and_slash.a_libraries.curios.MyCuriosUtils;
import com.robertx22.mine_and_slash.capability.player.container.BackpackMenu;
import com.robertx22.mine_and_slash.capability.player.helper.BackpackInventory;
import com.robertx22.mine_and_slash.mmorpg.SlashRef;
Expand Down Expand Up @@ -99,7 +101,7 @@ public BackpackInventory getInv(BackpackType type) {

public boolean tryAutoPickup(Player p, ItemStack stack, boolean shouldPlaySound) {

if (p.getInventory().countItem(SlashItems.MASTER_BAG.get()) < 1) {
if (p.getInventory().countItem(SlashItems.MASTER_BAG.get()) < 1 && !hasCuriosBackpack(p)) {
return false;
}
boolean result = false;
Expand All @@ -121,18 +123,18 @@ public boolean tryAutoPickup(Player p, ItemStack stack, boolean shouldPlaySound)

}

private boolean hasCuriosBackpack(Player p) {
var backpackItem = MyCuriosUtils.get(CuriosSlots.MASTER_BAG.name, p, 0);
return !backpackItem.isEmpty();
}

public boolean tryAutoPickup(Player p, ItemStack stack){
return tryAutoPickup(p, stack, true);
}
// todo every time before you open backpack, it will replace locked slots with blocked slots that cant be clicked on and throw out/give items back

public void openBackpack(BackpackType type, Player p, int rows) {
if (!p.level().isClientSide) {

if (!p.getMainHandItem().is(SlashItems.MASTER_BAG.get())) {
return;
}

BackpackInventory inv = getInv(type);
//inv.throwOutBlockedSlotItems(rows * 9);
p.openMenu(new SimpleMenuProvider((i, playerInventory, playerEntity) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.robertx22.library_of_exile.registry.ExileRegistryType;
import com.robertx22.library_of_exile.registry.IAutoGson;
import com.robertx22.library_of_exile.registry.JsonExileRegistry;
import com.robertx22.mine_and_slash.a_libraries.curios.RefCurio;
import com.robertx22.mine_and_slash.a_libraries.curios.RefCurios;
import com.robertx22.mine_and_slash.aoe_data.database.gear_slots.GearSlots;
import com.robertx22.mine_and_slash.config.forge.ServerContainer;
import com.robertx22.mine_and_slash.database.data.gear_types.bases.SlotFamily;
Expand Down Expand Up @@ -164,11 +164,11 @@ public static boolean isItemOfThisSlot(GearSlot slot, ItemStack stack) {
} else if (id.equals(GearSlots.NECKLACE)) {
bool = CuriosApi.getCuriosHelper()
.getCurioTags(item)
.contains(RefCurio.NECKLACE);
.contains(RefCurios.NECKLACE);
} else if (id.equals(GearSlots.RING)) {
bool = CuriosApi.getCuriosHelper()
.getCurioTags(item)
.contains(RefCurio.RING);
.contains(RefCurios.RING);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.robertx22.mine_and_slash.event_hooks.damage_hooks;

import com.robertx22.mine_and_slash.a_libraries.curios.MyCurioUtils;
import com.robertx22.mine_and_slash.a_libraries.curios.MyCuriosUtils;
import com.robertx22.mine_and_slash.event_hooks.damage_hooks.util.AttackInformation;
import com.robertx22.mine_and_slash.event_hooks.damage_hooks.util.DmgSourceUtils;
import com.robertx22.mine_and_slash.saveclasses.item_classes.GearItemData;
Expand Down Expand Up @@ -29,7 +29,7 @@ public static void damageCurioItems(LivingEntity en, float dmg) {

Player player = (Player) en;

List<ItemStack> curios = MyCurioUtils.getAllSlots(player);
List<ItemStack> curios = MyCuriosUtils.getAllSlots(player);

curios.forEach(x -> x.hurtAndBreak(getItemDamage(dmg), player, (entity) -> {
entity.broadcastBreakEvent(EquipmentSlot.MAINHAND);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.robertx22.mine_and_slash.event_hooks.my_events;

import com.robertx22.mine_and_slash.a_libraries.curios.MyCurioUtils;
import com.robertx22.mine_and_slash.a_libraries.curios.MyCuriosUtils;
import com.robertx22.mine_and_slash.capability.DirtySync;
import com.robertx22.mine_and_slash.capability.entity.EntityData;
import com.robertx22.mine_and_slash.database.data.omen.OmenSet;
Expand Down Expand Up @@ -178,7 +178,7 @@ private void recalcGears() {
}

if (entity instanceof Player) {
MyCurioUtils.getAllSlots((Player) entity)
MyCuriosUtils.getAllSlots((Player) entity)
.forEach(x -> {
GearData data = new GearData(x, null, unitdata.get());
list.add(data);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.robertx22.mine_and_slash.event_hooks.ontick;

import com.robertx22.mine_and_slash.a_libraries.curios.MyCurioUtils;
import com.robertx22.mine_and_slash.a_libraries.curios.MyCuriosUtils;
import com.robertx22.mine_and_slash.database.data.omen.OmenData;
import com.robertx22.mine_and_slash.saveclasses.item_classes.GearItemData;
import com.robertx22.mine_and_slash.uncommon.datasaving.Load;
Expand Down Expand Up @@ -69,7 +69,7 @@ public static void check(Player player) {
}
}

for (ICurioStacksHandler handler : MyCurioUtils.getHandlers(player)) {
for (ICurioStacksHandler handler : MyCuriosUtils.getHandlers(player)) {

for (int i = 0; i < handler
.getSlots(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
import com.robertx22.mine_and_slash.vanilla_mc.packets.OpenEntityStatsRequestPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.QuickUsePotionPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.UnsummonPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.backpack.OpenCuriosBackpackPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.spells.TellServerToCastSpellPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.client.settings.KeyModifier;

import java.util.Stack;

public class OnKeyPress {

public static int cooldown = 0;
Expand Down Expand Up @@ -50,21 +53,30 @@ public static void onEndTick(Minecraft mc) {
return;
}

if (KeybindsRegister.UNSUMMON.isDown()) {
Packets.sendToServer(new UnsummonPacket());
cooldown = 3;
} else if (KeybindsRegister.HUB_SCREEN_KEY.isDown()) {
if (KeybindsRegister.HUB_SCREEN_KEY.isDown()) {
mc.setScreen(new MainHubScreen());
cooldown = 10;
} else if (KeybindsRegister.HOTBAR_SWAP.isDown()) {
} else if (KeybindsRegister.OPEN_MASTER_BACKPACK.isDown()) {
Packets.sendToServer(new OpenCuriosBackpackPacket());
cooldown = 10;
} else if (KeybindsRegister.SHOW_ENTITY_STATS.isDown()) {
if (showEntityStats(mc)) {
cooldown = 10;
}
}

if (KeybindsRegister.QUICK_DRINK_POTION.consumeClick()) {
Packets.sendToServer(new QuickUsePotionPacket());
}

if (KeybindsRegister.HOTBAR_SWAP.isDown()) {
SpellKeybind.IS_ON_SECONd_HOTBAR = !SpellKeybind.IS_ON_SECONd_HOTBAR;
cooldown = 5;
} else if (KeybindsRegister.QUICK_DRINK_POTION.consumeClick()) {
Packets.sendToServer(new QuickUsePotionPacket());
} else if (KeybindsRegister.SHOW_ENTITY_STATS.isDown()) {
if (showEntityStats(mc)) {
cooldown = 10;
}
}

if (KeybindsRegister.UNSUMMON.isDown()) {
Packets.sendToServer(new UnsummonPacket());
cooldown = 3;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/robertx22/mine_and_slash/mmorpg/MMORPG.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.robertx22.library_of_exile.registry.util.ExileRegistryUtil;
import com.robertx22.library_of_exile.utils.Watch;
import com.robertx22.mine_and_slash.a_libraries.curios.CurioEvents;
import com.robertx22.mine_and_slash.a_libraries.curios.RefCurio;
import com.robertx22.mine_and_slash.a_libraries.curios.RefCurios;
import com.robertx22.mine_and_slash.a_libraries.neat.NeatForgeConfig;
import com.robertx22.mine_and_slash.aoe_data.database.stat_conditions.StatConditions;
import com.robertx22.mine_and_slash.aoe_data.database.stat_effects.StatEffects;
Expand Down Expand Up @@ -241,9 +241,9 @@ public void accept(GatherDataEvent x) {
public void interMod(InterModEnqueueEvent event) {


InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder(RefCurio.RING).size(2).build());
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder(RefCurio.NECKLACE).size(1).build());
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder(RefCurio.OMEN).size(1).build());
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder(RefCurios.RING).size(2).build());
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder(RefCurios.NECKLACE).size(1).build());
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder(RefCurios.OMEN).size(1).build());

ModLoadingContext.get()
.registerConfig(ModConfig.Type.SERVER, CompatConfig.spec, NeatForgeConfig.defaultConfigName(ModConfig.Type.SERVER, "mine_and_slash_compatibility"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public class KeybindsRegister {

public static KeyMapping HOTBAR_SWAP = new KeyMapping(prefix + "hotbar_swap", GLFW.GLFW_KEY_F1, CATEGORY);

public static KeyMapping QUICK_DRINK_POTION = new KeyMapping(prefix + "quick_drink_potion", KeyConflictContext.IN_GAME, InputConstants.Type.KEYSYM,GLFW.GLFW_KEY_P, CATEGORY);
public static KeyMapping QUICK_DRINK_POTION = new KeyMapping(prefix + "quick_drink_potion", KeyConflictContext.IN_GAME, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_P, CATEGORY);

public static KeyMapping SHOW_ENTITY_STATS = new KeyMapping(prefix + "show_entity_stats", KeyConflictContext.IN_GAME, InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_EQUAL, CATEGORY);

public static KeyMapping OPEN_MASTER_BACKPACK = new KeyMapping(prefix + "open_master_backpack", GLFW.GLFW_KEY_B, CATEGORY);

public static SpellKeybind SPELL_HOTBAR_1 = new SpellKeybind(1, GLFW.GLFW_KEY_R, null, true);
public static SpellKeybind SPELL_HOTBAR_2 = new SpellKeybind(2, GLFW.GLFW_KEY_V, null, true);
public static SpellKeybind SPELL_HOTBAR_3 = new SpellKeybind(3, GLFW.GLFW_KEY_C, null, true);
Expand All @@ -43,6 +45,7 @@ public static void register(RegisterKeyMappingsEvent x) {
x.register(HOTBAR_SWAP);
x.register(QUICK_DRINK_POTION);
x.register(SHOW_ENTITY_STATS);
x.register(OPEN_MASTER_BACKPACK);
for (SpellKeybind k : SpellKeybind.ALL) {
x.register(k.key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.robertx22.mine_and_slash.vanilla_mc.packets.*;
import com.robertx22.mine_and_slash.vanilla_mc.packets.backpack.BackPackLootMenuPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.backpack.OpenBackpackPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.backpack.OpenCuriosBackpackPacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.perks.PerkChangePacket;
import com.robertx22.mine_and_slash.vanilla_mc.packets.spells.TellServerToCancelSpellCast;
import com.robertx22.mine_and_slash.vanilla_mc.packets.spells.TellServerToCastSpellPacket;
Expand Down Expand Up @@ -45,6 +46,7 @@ public static void register() {
Packets.registerClientToServerPacket(MMORPG.NETWORK, new BackPackLootMenuPacket(), i++);
Packets.registerClientToServerPacket(MMORPG.NETWORK, new QuickUsePotionPacket(), i++);
Packets.registerClientToServerPacket(MMORPG.NETWORK, new OpenEntityStatsRequestPacket(), i++);
Packets.registerClientToServerPacket(MMORPG.NETWORK, new OpenCuriosBackpackPacket(), i++);


// Packets.registerClientToServerPacket(MMORPG.NETWORK, new SetupHotbarPacket(), i++);
Expand Down
Loading