Publish changes to fix mod, and add vault limitations
This commit is contained in:
parent
19573bbd56
commit
553ff429f3
130 changed files with 211075 additions and 208965 deletions
|
@ -19,8 +19,6 @@ public class ModItems {
|
|||
|
||||
public static final RegistryObject<Item> IHAN_CRYSTAL = ITEMS.register("ihan_crystal", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
||||
public static final RegistryObject<Item> ETERNIUM_DUST = ITEMS.register("eternium_dust", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
||||
public static final RegistryObject<Item> AURORA_COMPOUND = ITEMS.register("aurora_compound", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
||||
|
||||
|
@ -29,9 +27,6 @@ public class ModItems {
|
|||
public static final RegistryObject<Item> RAW_COBALT = ITEMS.register("raw_cobalt", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
public static final RegistryObject<Item> COBALT_NUGGET = ITEMS.register("cobalt_nugget", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
public static final RegistryObject<Item> COBALT_INGOT = ITEMS.register("cobalt_ingot", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
public static final RegistryObject<Item> PATTERN = ITEMS.register("pattern", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
public static final RegistryObject<Item> SCORCHED_BRICK = ITEMS.register("scorched_brick", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
public static final RegistryObject<Item> COPPER_CAN = ITEMS.register("copper_can", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(16)));
|
||||
public static final RegistryObject<Item> ETERNIUM_INGOT = ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
|
||||
|
||||
|
||||
|
@ -43,6 +38,21 @@ public class ModItems {
|
|||
public static final RegistryObject<Item> SCRUBBER_FRAME = ITEMS.register("scrubber_frame", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
|
||||
|
||||
public static final RegistryObject<Item> VAULTSTEEL_INGOT = ITEMS.register("vault_steel_ingot", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_BL = ITEMS.register("vault_fragment_lower_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_LC = ITEMS.register("vault_fragment_lower", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_BR = ITEMS.register("vault_fragment_lower_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_L = ITEMS.register("vault_fragment_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_R = ITEMS.register("vault_fragment_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_UR = ITEMS.register("vault_fragment_upper_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_UL = ITEMS.register("vault_fragment_upper_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_U = ITEMS.register("vault_fragment_upper", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
public static final RegistryObject<Item> VAULT_FRAG_C = ITEMS.register("vault_fragment_center", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
|
||||
|
||||
public static final RegistryObject<Item> VAULT = ITEMS.register("vault", () -> new VaultItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
|
||||
public static final RegistryObject<Item> VAULT_RAW_ORE = ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
|
||||
|
||||
|
||||
public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
|
||||
|
|
78
src/main/java/dev/zontreck/otemod/items/VaultItem.java
Normal file
78
src/main/java/dev/zontreck/otemod/items/VaultItem.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package dev.zontreck.otemod.items;
|
||||
|
||||
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.items.lore.LoreContainer;
|
||||
import dev.zontreck.libzontreck.items.lore.LoreEntry;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.chat.ChatServerOverride;
|
||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||
import dev.zontreck.otemod.configs.Profile;
|
||||
import dev.zontreck.otemod.events.LoreHandlers;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.SimpleFoiledItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public class VaultItem extends Item
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean isFoil(ItemStack pStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item asItem()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public VaultItem(Properties pProperties) {
|
||||
super(pProperties);
|
||||
//TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand)
|
||||
{
|
||||
OTEMod.LOGGER.info("Vault item is being used");
|
||||
if(!pLevel.isClientSide && pUsedHand == InteractionHand.MAIN_HAND)
|
||||
{
|
||||
ItemStack is = pPlayer.getItemInHand(pUsedHand);
|
||||
|
||||
Profile p = Profile.get_profile_of(pPlayer.getStringUUID());
|
||||
if(OTEServerConfig.MAX_VAULTS.get()>0)
|
||||
{
|
||||
if(p.available_vaults >= OTEServerConfig.MAX_VAULTS.get())
|
||||
{
|
||||
ChatServerOverride.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You cannot activate anymore vaults due to the maximum set by the server admin")), OTEMod.THE_SERVER);
|
||||
return InteractionResultHolder.pass(is);
|
||||
} else {
|
||||
p.available_vaults++;
|
||||
p.commit();
|
||||
ChatServerOverride.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER);
|
||||
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
|
||||
|
||||
return InteractionResultHolder.consume(is);
|
||||
}
|
||||
}else {
|
||||
p.available_vaults++;
|
||||
p.commit();
|
||||
ChatServerOverride.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER);
|
||||
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
|
||||
|
||||
return InteractionResultHolder.consume(is);
|
||||
}
|
||||
}
|
||||
|
||||
return super.use(pLevel, pPlayer, pUsedHand);
|
||||
}
|
||||
}
|
Reference in a new issue