• 0

    posted a message on [11.16.1 Fabric] Cannot resolve Symbol "EntityContext"

    Thank You, it worked.

     

    Quote from Draylar1 >>

    I just updated the wiki page after reading your post (so you can copy+paste the method if needed now). 

     I didn't see the correct name in the wiki.

    Posted in: Mod Development
  • 0

    posted a message on [11.16.1 Fabric] Cannot resolve Symbol "EntityContext"

    Hello everyone,

    I started to develop a mod for a project in Fabric 1.16.1 with a few blocks like vertikal slabs e.g. I'm new to programming mods, and my IDE (IntelliJ IDEA) gives me an compiler error:

     

    src\main\java\de\bennetr\fp_blocks\fp_blocks.java:29: error: cannot find symbol
    		public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext ctx) {
    		                                                                                  ^
      symbol:   class EntityContext
      location: class wall_slab

     (The ^ is under the EntityContext).

     

    I searched in the internet, but found nothing. I copied the complete code from the FabricMC wiki. I think the page is a bit outdated.

    If I remove the "EntityContext", the mod starts, but in Minecraft the blocks have a full hitbox (like a stone block) -> Attachment.

    Here is my java-file:

    package de.bennetr.fp_blocks;
    
    import net.fabricmc.api.ModInitializer;
    import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
    import net.minecraft.block.*;
    import net.minecraft.item.*;
    import net.minecraft.state.StateManager;
    import net.minecraft.state.property.Properties;
    import net.minecraft.util.Identifier;
    import net.minecraft.util.math.*;
    import net.minecraft.util.registry.Registry;
    import net.minecraft.util.shape.VoxelShape;
    import net.minecraft.util.shape.VoxelShapes;
    import net.minecraft.world.BlockView;
    
    public class fp_blocks implements ModInitializer {
    	public static class wall_slab extends HorizontalFacingBlock {
    
    		public wall_slab(Settings settings) {
    			super(settings);
    			setDefaultState(this.stateManager.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH));
    		}
    
    		@Override
    		protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
    			stateManager.add(Properties.HORIZONTAL_FACING);
    		}
    
    		public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos) {
    			Direction dir = state.get(FACING);
    			switch(dir) {
    				case NORTH:
    					return VoxelShapes.cuboid(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.5f);
    				case SOUTH:
    					return VoxelShapes.cuboid(0.0f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f);
    				case EAST:
    					return VoxelShapes.cuboid(0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
    				case WEST:
    					return VoxelShapes.cuboid(0.0f, 0.0f, 0.0f, 0.5f, 1.0f, 1.0f);
    				default:
    					return VoxelShapes.fullCube();
    			}
    		}
    
    		public BlockState getPlacementState(ItemPlacementContext ctx) {
    			return (BlockState)this.getDefaultState().with(FACING, ctx.getPlayerFacing());
    		}
    
    	}
    
    	public final wall_slab oak_wall_slab_block = new wall_slab(FabricBlockSettings.of(Material.WOOD).hardness(2.0f));
    
    	@Override
    	public void onInitialize() {
    		Registry.register(Registry.BLOCK, new Identifier("fp_blocks", "oak_wall_slab"), oak_wall_slab_block);
    		Registry.register(Registry.ITEM, new Identifier("fp_blocks", "oak_wall_slab"), new BlockItem(oak_wall_slab_block, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS).maxCount(64)));
    	}
    }
    

     

     Thanks in advance

    Posted in: Mod Development
  • To post a comment, please or register a new account.