Add the gamemode inventory backup function

This commit is contained in:
zontreck 2023-12-18 18:17:02 -07:00
parent 750bc86550
commit 749c1964ad
75 changed files with 8656 additions and 7 deletions

View file

@ -1,6 +1,7 @@
package dev.zontreck.otemod.items;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.blocks.FoiledBlockItem;
import dev.zontreck.otemod.entities.ModEntityTypes;
import dev.zontreck.otemod.implementation.CreativeModeTabs;
import net.minecraft.world.item.CreativeModeTab;
@ -52,6 +53,8 @@ public class ModItems {
public static final RegistryObject<Item> VAULT_RAW_ORE = CreativeModeTabs.addToOTEModTab(ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().stacksTo(64))));
public static final RegistryObject<Item> POSS_BALL = CreativeModeTabs.addToOTEModTab(ITEMS.register("poss_ball", () -> new PossBallItem(new Item.Properties())));
//public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties())));

View file

@ -0,0 +1,27 @@
package dev.zontreck.otemod.items;
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.level.Level;
public class PossBallItem extends Item
{
public PossBallItem(Properties pProperties) {
super(pProperties);
}
public boolean contents=false;
@Override
public boolean isFoil(ItemStack pStack) {
return contents;
}
@Override
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) {
contents = !contents;
return super.use(pLevel, pPlayer, pUsedHand);
}
}