Jump to content

Recommended Posts

Posted

Title

 

Code :

package io.github.wallibed.magicalmod.core.init;

 

import io.github.wallibed.magicalmod.MagicalMod;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ShulkerBoxBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.shapes.CollisionContext;

public final class ItemInit {
    private ItemInit() {}
    
    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, 
            MagicalMod.MODID);

    static final RegistryObject<Item> SOULS = ITEMS.register("souls",
            () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).fireResistant()));
    
    //Block Items
    public static final RegistryObject<BlockItem> SOUL_BLOCK_ITEM = ITEMS.register("compressed_souls_block",
            () -> new BlockItem(BlockInit.COMPRESSED_SOULS_BLOCK.get(), new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC))));
    
}
 

 

NO ONE CARES THAT I IMPORTED 35 THINGS

 

 

Posted (edited)

Learn basic java since Item != Item.Properties 

for solving this problem yourself take a look into the BlockItem constructor and the required parameters

Edited by Luis_ST
  • Like 1
  • 2 weeks later...
Posted
  On 1/14/2022 at 1:57 AM, Bedwa said:

         () -> new BlockItem(BlockInit.COMPRESSED_SOULS_BLOCK.get(), new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC))));

Expand  

Remove new Item();
New code:
 

  () -> new BlockItem(BlockInit.COMPRESSED_SOULS_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.