Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

    • U mean this?   java -Xmx4096M -Xms4096M -jar server.jar nogui pause
    • 1.17 is no longer a supported version. Please update to a supported version to receive support.
    • package com.SkyWarsFun2019.moreblock.init; import java.util.function.Supplier; import com.SkyWarsFun2019.moreblock.RandomFhings; import com.SkyWarsFun2019.moreblock.blockentity.StorageBlockEntity; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class ModBlockEntity { public static DeferredRegister<BlockEntityType<?>> BLOCK_ENTITYS = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, RandomFhings.MOD_ID); public static RegistryObject<BlockEntityType<StorageBlockEntity>> CHEST = register("storage", StorageBlockEntity::new, () -> new Block[] {}); public static void register(IEventBus bus) { BLOCK_ENTITYS.register(bus); } private static <T extends BlockEntity> RegistryObject<BlockEntityType<T>> register(String name, BlockEntityType.BlockEntitySupplier<T> supplier, Supplier<Block[]> validBlocksSupplier) { return BLOCK_ENTITYS.register(name, () -> BlockEntityType.Builder.of(supplier, validBlocksSupplier.get()).build(null)); } } This is my registry class so far however the error reported is as follows. The type StorageBlockEntity does not define StorageBlockEntity(BlockPos, BlocState) that is applicable here package com.SkyWarsFun2019.moreblock.blockentity; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; public class StorageBlockEntity extends StorageBlockEntityBase { public StorageBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) { super(pType, pWorldPosition, pBlockState); } @Override public int getContainerSize() { return 27; } @Override protected Component getDefaultName() { return new TranslatableComponent("container.mbs.storage"); } @Override protected AbstractContainerMenu createMenu(int pContainerId, Inventory pInventory) { return new ChestMenu(MenuType.GENERIC_9x3, pContainerId, pInventory, pInventory, pContainerId); } } That is the BlockEntity Class that im trying to register however its super class is below package com.SkyWarsFun2019.moreblock.blockentity; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.ContainerHelper; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ChestMenu; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; import net.minecraft.world.level.block.state.BlockState; public abstract class StorageBlockEntityBase extends RandomizableContainerBlockEntity { protected NonNullList<ItemStack> items; public StorageBlockEntityBase(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) { super(pType, pWorldPosition, pBlockState); this.items = NonNullList.withSize(getContainerSize(), ItemStack.EMPTY); } public boolean isMatchingContainerMenu(AbstractContainerMenu menu) { return menu instanceof ChestMenu chestMenu && chestMenu.getContainer() == this; } @Override public abstract int getContainerSize(); @Override protected NonNullList<ItemStack> getItems() { return items; } @Override protected void setItems(NonNullList<ItemStack> pItemStacks) { this.items = pItemStacks; } @Override protected abstract Component getDefaultName(); @Override protected abstract AbstractContainerMenu createMenu(int pContainerId, Inventory pInventory); @Override public boolean canPlaceItem(int pIndex, ItemStack pStack) { return true; } public boolean isFull() { for(ItemStack stack : this.items) { if(stack.isEmpty()) { return false; } } return true; } protected boolean addItem(ItemStack stack) { for(int i = 0; i < this.getContainerSize(); i++) { if(this.getItem(i).isEmpty()) { this.setItem(i, stack); return true; } } return false; } //NBT @Override public CompoundTag save(CompoundTag pCompound) { super.save(pCompound); if(!this.trySaveLootTable(pCompound)) { ContainerHelper.saveAllItems(pCompound, this.items); } return pCompound; } @Override public void load(CompoundTag pTag) { super.load(pTag); this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); if(!this.tryLoadLootTable(pTag)) { ContainerHelper.loadAllItems(pTag, this.items); } } } Any help is greatly appreciated.
    • You can use start.bat. Just run it from the command line and post the output.
    • Not sure what version you are referring to. Regardless, IDs should not be used at all. Simply use the Item constants in the Items class for vanilla or your own class for your own items.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.