1.20 working
This commit is contained in:
6 files changed
+22
-31
No files matched your search
@@ -14,8 +14,8 @@ public class Xp2Items {
|
||||
|
||||
public static final String MODID = "xp2items";
|
||||
|
||||
public Xp2Items(FMLJavaModLoadingContext context) {
|
||||
IEventBus modEventBus = context.getModEventBus();
|
||||
public Xp2Items() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
items.register(modEventBus);
|
||||
creativeTab.register(modEventBus);
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.jenny.xp2items.items;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
@@ -14,7 +11,7 @@ import static com.jenny.xp2items.Xp2Items.MODID;
|
||||
public class items {
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||
|
||||
public static final RegistryObject<Item> XP_TALISMAN = ITEMS.register("xp_talisman", () -> new xpTalisman(new Item.Properties().setId(ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MODID, "xp_talisman"))).stacksTo(1)));
|
||||
public static final RegistryObject<Item> XP_TALISMAN = ITEMS.register("xp_talisman", () -> new xpTalisman(new Item.Properties().stacksTo(1)));
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
ITEMS.register(bus);
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
@@ -69,7 +69,7 @@ public class xpTalisman extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull InteractionResult use(@NotNull Level level, @NotNull Player player, @NotNull InteractionHand interactionHand) {
|
||||
public InteractionResultHolder<ItemStack> use(@NotNull Level level, @NotNull Player player, @NotNull InteractionHand interactionHand) {
|
||||
if (!level.isClientSide) {
|
||||
if (ServerConfig.C_XP_AMOUNT.get() > 0) { // xp amount mode
|
||||
spawnItem(level, (ServerPlayer) player);
|
||||
@@ -79,6 +79,6 @@ public class xpTalisman extends Item {
|
||||
} else {
|
||||
effects(level, player);
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
return InteractionResultHolder.success(player.getItemInHand(interactionHand));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user