Jump to content

Oen44

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by Oen44

  1. Didn't even notice that &1. Everything works now, time to move on, thank you! Thread can be closed.
  2. Great, added few more methods from your code, had to edit few parts but now it works. #Edit Actually there is one more thing. Looks like whenever I'm rejoining the world, blocks are facing different direction, like its not saving.
  3. [19:17:40] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@9f3d1b9: java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockStateContainer{block=minecraft:air, properties=[]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:221) ~[BlockStateContainer$StateImplementation.class:?] at eu.includespark.rpgmod.blocks.NoticeBoardBlock.<init>(NoticeBoardBlock.java:22) ~[NoticeBoardBlock.class:?] at eu.includespark.rpgmod.blocks.ModBlocks.registerBlocks(ModBlocks.java:26) ~[ModBlocks.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_ModBlocks_registerBlocks_Register.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) ~[EventBus$1.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:847) [GameData.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:514) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:422) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] public class NoticeBoardBlock extends BlockHorizontal { private final AxisAlignedBB BOUNDING_BOX; public NoticeBoardBlock(String name, Material material, AxisAlignedBB bb) { super(material); BOUNDING_BOX = bb; setUnlocalizedName(name); setRegistryName(name); setDefaultState(getBlockState().getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public boolean isFullBlock(IBlockState state) { return false; } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return BOUNDING_BOX; } @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return BOUNDING_BOX; } @Override public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } } @Mod.EventBusSubscriber(modid=RPGMod.MODID) public class ModBlocks { private static Block nbLeft; private static Block nbMiddle; private static Block nbRight; private static Block nbLeg; @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { nbLeft = new NoticeBoardBlock("notice_board_left", Material.WOOD, new AxisAlignedBB(0f, 0f, 0.375f, 1f, 1f, 0.625f)).setCreativeTab(RPGMod.creativeTab); nbLeft.setHarvestLevel("axe", 1); nbMiddle = new NoticeBoardBlock("notice_board_mid", Material.WOOD, new AxisAlignedBB(0f, 0f, 0.375f, 1f, 1f, 0.625f)).setCreativeTab(RPGMod.creativeTab); nbMiddle.setHarvestLevel("axe", 1); nbRight = new NoticeBoardBlock("notice_board_right", Material.WOOD, new AxisAlignedBB(0f, 0f, 0.375f, 1f, 1f, 0.625f)).setCreativeTab(RPGMod.creativeTab); nbRight.setHarvestLevel("axe", 1); nbLeg = new BlockBase("notice_board_leg", Material.WOOD, new AxisAlignedBB(0.375f, 0f, 0.375f, 0.625f, 1f, 0.625f)).setCreativeTab(RPGMod.creativeTab); nbLeg.setHarvestLevel("axe", 1); event.getRegistry().registerAll(nbLeft); event.getRegistry().registerAll(nbMiddle); event.getRegistry().registerAll(nbRight); event.getRegistry().registerAll(nbLeg); } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(new ItemBlock(nbLeft).setRegistryName(nbLeft.getRegistryName())); event.getRegistry().registerAll(new ItemBlock(nbMiddle).setRegistryName(nbMiddle.getRegistryName())); event.getRegistry().registerAll(new ItemBlock(nbRight).setRegistryName(nbRight.getRegistryName())); event.getRegistry().registerAll(new ItemBlock(nbLeg).setRegistryName(nbLeg.getRegistryName())); } @SubscribeEvent public static void registerRenders(ModelRegistryEvent event) { registerRender(Item.getItemFromBlock(nbLeft)); registerRender(Item.getItemFromBlock(nbMiddle)); registerRender(Item.getItemFromBlock(nbRight)); registerRender(Item.getItemFromBlock(nbLeg)); } public static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation( item.getRegistryName(), "inventory")); } } Crash happens on initialization. This line is the issue setDefaultState(getBlockState().getBaseState().withProperty(FACING, EnumFacing.NORTH)); Example blockstate registry JSON { "variants": { "normal": { "model": "rpgmod:notice_board_mid_model" }, "facing=north": {"model": "rpgmod:notice_board_mid_model"}, "facing=south": {"model": "rpgmod:notice_board_mid_model"}, "facing=west": {"model": "rpgmod:notice_board_mid_model"}, "facing=east": {"model": "rpgmod:notice_board_mid_model"} } } I'm trying to make custom block face the player when placed.
  4. How different mods handle custom advancements rendering? This can't be just JSON, there must be something more, but I can't find anything about that. Most of them are allowing to press on one of the advancements and see more details or there are lists of required items in the tooltip. Even something small as positions and custom image for the lines connecting advancements together. Opening different windows with different advancements using items instead of the one with default hotkey "L". Should I look for specific classes and override their methods or what's up with that? #Edit Looks like it's made using Triumph and Better Advancements. Not sure how to add that to my mod as these mods are mostly used in modpacks.
      • 1
      • Like
  5. I don't think that it will ever be 100% complete. It's a big project, bugs are always going to appear (not always big one).
  6. Code-Style #1
  7. At some point I had that, should have pay more attention while tidying code. Thanks for noticing that and help.
  8. So I should extend Client and Sever proxy with Common and register capabilities inside Common?
  9. Should I register that on client AND server proxy? Does it matter?
  10. Why should I prevent client from using capabilities? No need for that.
  11. Open Launch Options in Minecraft Launcher and check if Forge option is configured correctly.
  12. There are MC files.
  13. Your workbench has less slots, right? Use that to compare.
  14. Check InventoryCrafting inv in matches method Return false if it's not yours crafting.
  15. Post details about java version etc.
  16. Oh crap, such thing as Items.XX exists? ? Why, why didn't I try that... Please don't hurt me Close or delete this, I don't know.
  17. Hi, What's the best way to create ItemStack (or Item) from all vanilla items? Looking for something like Item diamond = Items.find(Items.DIAMOND) // by name, id or something
  18. Remove from mods folder?
  19. Awesome! Works like a charm, thank you!
  20. Yeah... That didn't help at all. Anyway, tried using RayCasting, saving surrounding mobs to array every tick, on right-click doing some position checking with every mob in array etc. Something worked in some way but not close to what I need. The worst part is about positioning BETWEEN player position and end position. All depends on player rotation, if player is facing North, leave X, decrease Z etc. I managed to handle this way North, South, West and East. But what about between? That bothers me so much... Anyone knows how to check every position (or block) from Start to End?
  21. Hi, I'm doing special weapon that when right-clicked moves player in short distance and damages all mobs that are in the way. That's what I've tried @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); Vec3d vec = player.getLookVec(); player.setVelocity(vec.x * 2, 0, vec.z * 2); stack.damageItem(15, player); List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(player, player.getEntityBoundingBox().expand(4, 0, 4)); for (Entity entity : entities) { if (entity instanceof IMob) { entity.attackEntityFrom(DamageSource.GENERIC, 5.0f); } } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack); } It's cool and all but getEntitiesWithinAABBExcludingEntity is getting mobs that are around player so I need something completely different. Any tips what to look at and use?
  22. Oen44

    i cant play halp

    Not enough RAM? That's my guess.
  23. Open cmd at the location of your mod project and run gradlew build
  24. I should not commit these changes, just wanted to do some cleaning in code, haven't even tested them... Now it's all fixed and working again.
×
×
  • Create New...

Important Information

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