Jump to content

How do i test run my new mod?


Drachenbauer

Recommended Posts

Hello

 

I have two mods open in my eclipse workspace.

Now i noticed, no matter, what i try to setup a test run for my new flat-tiles-mod, it tries to run the old Angry-Birds-mod.

How do i tell eclipse, that it should run the new mod now?

Edit:

Now it does not more load the old mod, but it also does not load the new mod into the test-client.

 

Edited by Drachenbauer
Link to comment
Share on other sites

Now i get other errors:

Quote

[m[1;31m[16:03:19] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: Can't use a null-name for the registry, object Block{null}.
    Index: 1
    Listeners:
        0: NORMAL
        1: ASM: class drachenbauer32.flattilesmod.FlatTiles$RegistryEvents registerBlocks(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.NullPointerException: Can't use a null-name for the registry, object Block{null}.
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:314)
    at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:308)
    at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:133)
    at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:180)
    at drachenbauer32.flattilesmod.FlatTiles$RegistryEvents.registerBlocks(FlatTiles.java:78)
    at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerBlocks_Register.invoke(.dynamic)
    at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106)
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source)
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source)
    at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
    at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125)
    at java.util.ArrayList.forEach(Unknown Source)
    at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125)
    at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96)
    at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71)
    at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197)
    at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:964)
    at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189)
    at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97)
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113)
    at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97)
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:393)
    at net.minecraft.client.main.Main.main(SourceFile:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)

But i don´t know, where it means "null-name" My blocks have names: black_concrete_tile_block, blue_concrete_tile_block, and so on.

For the block java file, i use the setup from the carpet-block.

 

Now i noticed, this setup gives o registra name.

How do i add a registry name to this:

    public static void registerBlocks(final RegistryEvent.Register<Block> event)
        {
            event.getRegistry().registerAll(FlatTilesBlocks.black_concrete_tile_block = new ConcreteTileBlock(DyeColor.BLACK,
                                            Block.Properties.create(Material.ROCK, MaterialColor.BLACK).sound(SoundType.STONE).
                                            lightValue(0).hardnessAndResistance(1.8f, 9f).variableOpacity()),
                                            FlatTilesBlocks.blue_concrete_tile_block = new ConcreteTileBlock(DyeColor.BLUE,
                                            Block.Properties.create(Material.ROCK, MaterialColor.BLUE).sound(SoundType.STONE).
                                            lightValue(0).hardnessAndResistance(1.8f, 9f).variableOpacity()),
                                            FlatTilesBlocks.brown_concrete_tile_block = new ConcreteTileBlock(DyeColor.BROWN,
                                            Block.Properties.create(Material.ROCK, MaterialColor.BROWN).sound(SoundType.STONE).
                                            lightValue(0).hardnessAndResistance(1.8f, 9f).variableOpacity()));
        }

theese are three blocks so far.

Link to comment
Share on other sites

This is thr block-registry now:

    public static void registerBlocks(final RegistryEvent.Register<Block> event)
        {
            event.getRegistry().registerAll(FlatTilesBlocks.black_concrete_tile_block = new ConcreteTileBlock("black_concrete_tile_block", DyeColor.BLACK,
                                            Block.Properties.create(Material.ROCK, MaterialColor.BLACK).sound(SoundType.STONE).
                                            lightValue(0).hardnessAndResistance(1.8f, 9f).variableOpacity()),
                                            FlatTilesBlocks.blue_concrete_tile_block = new ConcreteTileBlock("blue_concrete_tile_block", DyeColor.BLUE,
                                            Block.Properties.create(Material.ROCK, MaterialColor.BLUE).sound(SoundType.STONE).
                                            lightValue(0).hardnessAndResistance(1.8f, 9f).variableOpacity()),
                                            FlatTilesBlocks.brown_concrete_tile_block = new ConcreteTileBlock("brown_concrete_tile_block", DyeColor.BROWN,
                                            Block.Properties.create(Material.ROCK, MaterialColor.BROWN).sound(SoundType.STONE).
                                            lightValue(0).hardnessAndResistance(1.8f, 9f).variableOpacity()));
        }

 

The item-registry:

    public static void registerItems(final RegistryEvent.Register<Item> event)
        {
            
            event.getRegistry().registerAll(FlatTilesItems.black_concrete_tile_block = new BlockItem(FlatTilesBlocks.black_concrete_tile_block,
                                            new Item.Properties().defaultMaxDamage(0).group(FLAT_TILES).maxStackSize(64).rarity(Rarity.COMMON).
                                            setNoRepair()).setRegistryName(FlatTilesBlocks.black_concrete_tile_block.getRegistryName()),
                                            FlatTilesItems.blue_concrete_tile_block = new BlockItem(FlatTilesBlocks.blue_concrete_tile_block,
                                            new Item.Properties().defaultMaxDamage(0).group(FLAT_TILES).maxStackSize(64).rarity(Rarity.COMMON).
                                            setNoRepair()).setRegistryName(FlatTilesBlocks.blue_concrete_tile_block.getRegistryName()),
                                            FlatTilesItems.brown_concrete_tile_block = new BlockItem(FlatTilesBlocks.brown_concrete_tile_block,
                                            new Item.Properties().defaultMaxDamage(0).group(FLAT_TILES).maxStackSize(64).rarity(Rarity.COMMON).
                                            setNoRepair()).setRegistryName(FlatTilesBlocks.brown_concrete_tile_block.getRegistryName()));
        }

In the official minecraft files i found no hint, that the carpet uses a special blockitem-class, so i use  instances from the commen blockitem-class for the blockitems of the tiles.

 

and this is the block java:

package drachenbauer32.flattilesmod.blocks;

import drachenbauer32.flattilesmod.util.Reference;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.item.DyeColor;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;

public class ConcreteTileBlock extends Block {
   protected static final VoxelShape SHAPE = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D);
   private final DyeColor color;

   public ConcreteTileBlock(String name, DyeColor p_i48290_1_, Block.Properties properties) {
      super(properties);
      setRegistryName(Reference.MOD_ID, name);
      this.color = p_i48290_1_;
   }

   public DyeColor getColor() {
      return this.color;
   }

   public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
      return SHAPE;
   }

   /**
    * Update the provided state given the provided neighbor facing and neighbor state, returning a new state.
    * For example, fences make their connections to the passed in state if possible, and wet concrete powder immediately
    * returns its solidified counterpart.
    * Note that this method should ideally consider only the specific face passed in.
    */
   public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
      return !stateIn.isValidPosition(worldIn, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
   }

   public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
      return !worldIn.isAirBlock(pos.down());
   }
}

 

I get no more error messages, but the items for the blocks don´t appear in the Creative inventory tab, that i made for them...

 

In the official minecraft files

 

What is not correct now?

Edited by Drachenbauer
Link to comment
Share on other sites

My creativetab is another class, that i just didn´t post here, because in the other mod it worked so far.

 

I took all about it from the other mod.

So i think, the problem is not about the creative tab itself.

 

maybe something about the json's:

base for the flat tiles:

{   "parent": "block/thin_block",
    "elements": [
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 1, 16 ],
            "faces": {
                "down":  { "uv": [ 0,  0, 16, 16 ], "texture": "#material", "cullface": "down" },
                "up":    { "uv": [ 0,  0, 16, 16 ], "texture": "#material" },
                "north": { "uv": [ 0, 15, 16, 16 ], "texture": "#material", "cullface": "north" },
                "south": { "uv": [ 0, 15, 16, 16 ], "texture": "#material", "cullface": "south" },
                "west":  { "uv": [ 0, 15, 16, 16 ], "texture": "#material", "cullface": "west" },
                "east":  { "uv": [ 0, 15, 16, 16 ], "texture": "#material", "cullface": "east" }
            }
        }
    ]
}

 

one specific block:

{
    "parent": "flattilesmod:block/tile",
    "textures": {
        "particle": "block/blue_concrete",
        "material": "block/blue_concrete"
    }
}

 

Blockstates for this block:

{
    "variants": {
        "": { "model": "flattilesmod:block/blue_concrete_tile" }
    }
}

 

Blockitem:

{
    "parent": "flattilesmod:block/blue_concrete_tile"
}

 

Is there some issue?

Edited by Drachenbauer
Link to comment
Share on other sites

Well, given the information I have, I would have to say there's something wrong with it if it's not working.

Just for grins, if you change FLAT_TILES to ItemGroup.MISC does it add your items to the Miscellaneous tab? If that works, then your custom tab is broken.

Link to comment
Share on other sites

Just out of curiosity, what happens if you change the icon in your FlatTilesItemGroup to a vanilla item, instead of one of your modded items? I'm just curious if the issue is arising because your item is not registered yet, therefore does not exist, so your tab isn't getting setup?

Check out https://mcforge.readthedocs.io/en/1.14.x/concepts/registries/#injecting-registry-values-into-fields for info on ObjectHolders.

 

Also. . . . .

15 hours ago, Ugdhar said:

I guess post logs?

 

Link to comment
Share on other sites

If my item is not registered, i wonder, why...

In 1.14.3 this way to register items worked...

 

Edit:

i noticed, that i forgot a "@SubscribeEvent" above the item registry event.

Now my item appears on the tab from my item-group, but not in it´s inventory-slots.

 

Now i try the item sorter again.

 

I noticed, that I forgot "super.fill(itemStacks);" in the fill-method of my item-group.

 

Now it works.

 

And placing the flat blocks on the ground works too.

 

Now i just have to add blocks of all the materials, i want to have in this mod

and add english and german language naming.

Edited by Drachenbauer
Link to comment
Share on other sites

  • 4 weeks later...

If i test run the flat tiles mod, at first it opens a window to choose a main-class, and then a window, to choose the run-type (client, server, ...) and after this, a minecraft test-window opens, where i can play around with the new content of my mod.

 

But if i now test run the new tulips mod, the seccond window does not appear and i get this error instead:

Quote

2020-02-12 19:36:21,395 main WARN Advanced terminal features are not available in this environment
Exception in thread "main" java.lang.IllegalArgumentException: Environment variable target must be set.
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:51)

I choosed the same option in the first window, as in the other mod.

 

to set up this mod, i copyed the flat tiles mod and renamed it (all folders, wich have the name of the mod, and all appearences of the name and id in files like ".project" and "build.gradle")

and i used the commands "gradlew eclipse" and "gradlew genEclipseRuns".

 

Should i use "gradlew clean" and then the other two again?

 

Edit:

after doing this and a refresh in eclipse, it shown the same behavior as the other one.

Now i can test my new tulip.

Edited by Drachenbauer
Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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