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

Oen44

Members
  • Posts

    42
  • Joined

  • Last visited

Posts posted by Oen44

  1. 34 minutes ago, Draco18s said:

    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.

  2. [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.

  3. 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.

    • Like 1
  4. 56 minutes ago, oreo said:

    Use the

    
    player.getPitchYaw();
    player.getPosition();

    properties along with the

    
    entity.getPosition();

    vector and do some quick trig to detect if the entity is infront of the camera's view?

    I probably wouldn't be much help with the trig part but I know it's possible. :)

    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?

  5. 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?

  6. 1 hour ago, _Cruelar_ said:

    @Oen44

    Your PacketAddSkillXP is ServerSide but you use Minecraft.getMinecraft() which is annotated as Side=ClientOnly.

    Does this matter?

    Are the SkillXp in every World equall or saved per world?

    Do they stay the same after reload?

    And also I'm interested in the skills the Player gets. later I want to implement custom actions for the player so I I wondered how you made this.

    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 Privacy Policy.