Jump to content

UserMC123

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by UserMC123

  1. When I am running the setup I get: Starting Gradle Daemon... Gradle Daemon started in 1 s 690 ms > Configure project : Java: 1.8.0_241 JVM: 25.241-b07(Oracle Corporation) Arch: amd64 WARNING: This project is configured to use the official obfuscation mappings provided by Mojang. These mapping fall under their associated license, you should be fully aware of this license. For the latest license text, refer below, or the reference copy here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md, You can hide this warning by running the `hideOfficialWarningUntilChanged` task WARNING: (c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes, but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here. Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available at https://account.mojang.com/documents/minecraft_eula. FAILURE: Build failed with an exception. * What went wrong: org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()Ljava/lang/String; * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org CONFIGURE FAILED in 15s Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
  2. The Slots Move the stacks correctly when I shift click but when I manually move the stack it duplicates and creates ghost items please tell me what I did wrong???? my git repo: https://github.com/User-PARROT/MC-FORGE-1.16-Capability-Testing
  3. My capability works It saves and loads the items in the slots. I need to know how do i get .getStackInSlot(1) in a different class or somthing like it.
  4. Ok please explain how to properly use it.
  5. Its static so I can use it in a different class.
  6. public interface ITESTInv extends IItemHandlerModifiable { } And public class TESTInventory extends ItemStackHandler implements ITESTInv { public static ITESTInv container; public TESTInventory () { super(8); } @Override protected void onContentsChanged(int slot) { super.onContentsChanged(slot); } @Override public CompoundNBT serializeNBT() { return super.serializeNBT(); } @Override public void deserializeNBT(CompoundNBT nbt) { super.deserializeNBT(nbt); } }
  7. Ok I've tried that in @SubscribeEvent public void ClientsTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { if (!(TESTInventory.container.getStackInSlot(1).isEmpty())) { LOGGER.info("Is Not Empty"); } } } And TESTInventory.container get the IItemHandler from the capability and when I load a world I get a java.lang.NullPointerException: null
  8. I have a custom inventory that uses capabilities and it works I just need to know how would I be able to get if ex slot 1 has dirt.
  9. Never mind I fixed the problem I Forgot to register my Capability
  10. I have a custom inventory that saves when i have the world running but when I rejoin the items are not there in the slots.
  11. You Need to Change public static final RegistryObject<Item> COPPER_ORE = ITEMS.register("copper_ore", () -> new Item(new Item.Properties().group(ItemGroup.MISC))); To public static final RegistryObject<Item> COPPER_ORE = ITEMS.register("copper_ore", () -> new BlockItem(BlockList.COPPER_ORE.get(),new Item.Properties().group(ItemGroup.MISC)));
  12. Try This: public class TestChestTile extends LockableLootTileEntity { protected int Size = 36; private NonNullList<ItemStack> chest_items = NonNullList.withSize(Size,ItemStack.EMPTY); protected int numPlayerUsing; private IItemHandlerModifiable items = createHandler(); private LazyOptional<IItemHandlerModifiable> itemHandler = LazyOptional.of(()-> items); public TestChestTile(TileEntityType<?> p_i48284_1_) { super(p_i48284_1_); } public TestChestTile() { this(TileEntityInit.TEST_CHEST_TILE.get()); } @Override public int getSizeInventory() { return Size; } @Override public NonNullList<ItemStack> getItems() { return chest_items; } public void setItems(NonNullList<ItemStack> items) { this.chest_items = items; } @Override protected ITextComponent getDefaultName() { return new TranslationTextComponent("container.test_chest"); } @Override protected Container createMenu(int id, PlayerInventory player) { return new TestChestContainer(id,player,this); } @Override public CompoundNBT write(CompoundNBT compound) { super.write(compound); if (!this.checkLootAndWrite(compound)) { ItemStackHelper.saveAllItems(compound, this.chest_items); } return compound; } @Override public void read(BlockState state,CompoundNBT compound) { super.read(state,compound); this.chest_items = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY); if (!this.checkLootAndRead(compound)) { ItemStackHelper.loadAllItems(compound, this.chest_items); } } @Override public boolean receiveClientEvent(int id, int type) { if(id == 1){ this.numPlayerUsing = type; return true; } else { return super.receiveClientEvent(id, type); } } @Override public void openInventory(PlayerEntity playerEntity) { if(playerEntity.isSpectator()){ if(this.numPlayerUsing < 0){ this.numPlayerUsing = 0; } ++numPlayerUsing; this.openOrClose(); } } @Override public void closeInventory(PlayerEntity playerEntity) { if(!playerEntity.isSpectator()){ --this.numPlayerUsing; this.openOrClose(); } } protected void openOrClose(){ Block block = this.getBlockState().getBlock(); if (block instanceof TestChestBlock) { this.world.addBlockEvent(this.pos, block, 1, this.numPlayerUsing); this.world.notifyNeighborsOfStateChange(this.pos, block); } } public static int getPlayersUsing(IBlockReader reader, BlockPos pos) { BlockState blockstate = reader.getBlockState(pos); if (blockstate.hasTileEntity()) { TileEntity tileentity = reader.getTileEntity(pos); if (tileentity instanceof TestChestTile) { return ((TestChestTile) tileentity).numPlayerUsing; } } return 0; } public static void swapContents(TestChestTile te, TestChestTile otherTe) { NonNullList<ItemStack> list = te.getItems(); te.setItems(otherTe.getItems()); otherTe.setItems(list); } @Override public void updateContainingBlockInfo() { super.updateContainingBlockInfo(); if (this.itemHandler != null) { this.itemHandler.invalidate(); this.itemHandler = null; } } @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nonnull Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return itemHandler.cast(); } return super.getCapability(cap, side); } private IItemHandlerModifiable createHandler() { return new InvWrapper(this); } @Override public void remove() { super.remove(); if(itemHandler != null) { itemHandler.invalidate(); } }
  13. I am trying to make a custom structure by following This Tutorial. And when I add this to my biome to add the structure the game crashes. build.withStructure(FeatureConfig.CONFIGURED_HOUSE)
  14. Fixed it. the problem was I had the wrong version of forge. I needed to have: [[dependencies.test]] modId="forge" mandatory=true versionRange="[35,)" ordering="NONE" side="BOTH" [[dependencies.test]] modId="minecraft" mandatory=true versionRange="[1.16.4,1.17)" ordering="NONE" side="BOTH" I had: [[dependencies.test]] modId="forge" mandatory=true versionRange="[35,)" ordering="NONE" side="BOTH" [[dependencies.test]] modId="minecraft" mandatory=true versionRange="[1.16.4,1.17)" ordering="NONE" side="BOTH"
  15. I tried to use DeferredRegister And they work but when I package my mod in to a .jar file and launch the game with it installed I get this Test Mod (test) encountered an error during the common_setup event phase And in the crash report I see this. ---- Minecraft Crash Report ---- // There are four lights! Time: 12/15/20 3:20 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) [?:?] {re:classloading} at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:508) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft$$Lambda$3860/1126454617.run(Unknown Source) [?:?] {} at net.minecraft.util.Util.func_215077_a(SourceFile:404) [?:?] {re:classloading} at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:504) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft$$Lambda$3572/1610803524.accept(Unknown Source) [?:?] {} at net.minecraft.client.gui.ResourceLoadProgressGui.func_230430_a_(ResourceLoadProgressGui.java:113) [?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:480) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:976) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {} at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.4-35.1.10.jar:35.1] {} at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$426/474933596.call(Unknown Source) [forge-1.16.4-35.1.10.jar:35.1] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.6.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_51] {} -- MOD test -- Details: Mod File: modid-1.0.jar Failure message: Test Mod (test) encountered an error during the common_setup event phase java.lang.NullPointerException: Registry Object not present: test:test_entity Mod Version: 1.0 Mod Issue URL: http://my.issue.tracker/ Exception message: java.lang.NullPointerException: Registry Object not present: test:test_entity Stacktrace: at java.util.Objects.requireNonNull(Objects.java:290) ~[?:1.8.0_51] {} at net.minecraftforge.fml.RegistryObject.get(RegistryObject.java:120) ~[?:?] {re:classloading} at com.test.testMod.util.ForgeEvents.EntityRenderer.registerEntityRenders(EntityRenderer.java:76) ~[?:1.0]
  16. What value should assign to test_entity
  17. Im trying to add my attributes but they are not Registering Main Class: @Mod(test.MOD_ID) @Mod.EventBusSubscriber(modid = test.MOD_ID, bus = Bus.MOD) public class test { public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "test"; public test() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientEvent); MinecraftForge.EVENT_BUS.register(modEventBus); } public void clientEvent(final FMLClientSetupEvent event){ } public static void onRegisterEntities(final RegistryEvent.Register<EntityType<?>> event){ } @SubscribeEvent public static void setup(final FMLCommonSetupEvent event) { DeferredWorkQueue.runLater(()-> { GlobalEntityTypeAttributes.put(EntityInit.test_entity, TestEntity.setAttributes().create()); }); } } ModEntities: @ObjectHolder(test.MOD_ID) @Mod.EventBusSubscriber(modid = "test", bus = Mod.EventBusSubscriber.Bus.MOD) public class EntityInit { public static EntityType<TestEntity> test_entity = null; @SubscribeEvent public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(EntityType.Builder.create(TestEntity::new, EntityClassification.CREATURE).size(1.0f, 2.f).build(new ResourceLocation(test.MOD_ID, "test_entity").toString()).setRegistryName("test_entity")); } } TestEntity: public class TestEntity extends MobEntity { public TestEntity(EntityType<? extends MobEntity> p_i48576_1_, World p_i48576_2_) { super(p_i48576_1_, p_i48576_2_); } public static AttributeModifierMap.MutableAttribute setAttributes() { return MobEntity.func_233666_p_() .createMutableAttribute(Attributes.MAX_HEALTH, 100.0D) .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.25D); } @Nullable @Override protected SoundEvent getDeathSound() { return SoundEvents.BLOCK_ANVIL_DESTROY; } Renderer: public class TestEntityRenderer extends MobRenderer<TestEntity, TestEntityModdel<TestEntity>> { protected static final ResourceLocation TEXTURE = new ResourceLocation(test.MOD_ID,"textures/entity/test_entity.png"); public TestEntityRender(EntityRendererManager renderManagerIn) {super(renderManagerIn, new TestEntityModel(), 1.0f);} @Override public ResourceLocation getEntityTexture(TestEntity entity){return TEXTURE;} }
×
×
  • Create New...

Important Information

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