Jump to content

aw_wolfe

Members
  • Posts

    94
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by aw_wolfe

  1. it is just a text file saved as [project]/src/main/resources/assets/[modid]/lang/en_US.lang

     

     

    items are like:

     

    item.[modid].testitem.name=Test Item

     

    blocks are like:

    tile.[modid].testblock.name=Test Block

     

    so sample en_US.lang file

    item.testmod.testitem.name=Test Item
    
    tile.testmod.testblock.name=Test Block

     

  2. That is going to involve several different things.

    1) you will have to determine where you want to trap the tick events. could do in item tick, or elsewhere. Not sure if tick update works on armor or not

    2) trap the key hotkey

    4) prevent player render trap ( RenderPlayerEvent.Pre event), cancel it if player is invisible

    3) prevent mobs from tracking when invisible  get list of current nearby entityliving and see if tracking player, set to null if they are. then trap LivingSetAttackTargetEvent and prevent any new mobs tracking.

     

  3. ok, so not just a rotation, but why doesn't the fence functionality work for you? I guess I don't understand why the multipart doesn't work for what you want. (not saying it should, just that I'm not understanding based on what I think you are trying to do)

     

    here is the json for a fence blockstate

     

    {
        "multipart": [
            {   "apply": { "model": "acacia_fence_post" }},
            {   "when": { "north": "true" },
                "apply": { "model": "acacia_fence_side", "uvlock": true }
            },
            {   "when": { "east": "true" },
                "apply": { "model": "acacia_fence_side", "y": 90, "uvlock": true }
            },
            {   "when": { "south": "true" },
                "apply": { "model": "acacia_fence_side", "y": 180, "uvlock": true }
            },
            {   "when": { "west": "true" },
                "apply": { "model": "acacia_fence_side", "y": 270, "uvlock": true }
            }
        ]
    }

    it has a center (fence post), then applies mulitpart models based on north,east,south,west.  This give you your center, with fences/connections in the different directions base on setting the blockstate PropertyBool (north, south, east, west). Each direction could be a different model.

     

    If you want different images/icons for the item in inventory based on what connections the blockstate had, then I think you need to create a custom Item that holds the data. Can transfer when block breaks into the entityitem.  And then create the proper blockstate upon placement. The item then can set the icon based on the subitem...haven't done that in a while, so not 100% that is best route, but quick search should resovle that.

     

    For the collision boxes, if more than 1 direction possible, then don't use if/else if/else if/else because only 1 will get selected.  Use multiple ifs

    if(north==true) //add north collision

    if(south==true) //add south collision

    etc..

  4. Out of my depth here. But if not possible to change skin directly (never looked into it)....

     

    CarryOn and metamorph (both on github) use models to change how the client renders the player.  So, you could create a custom player model based on image or if not that many, server could return index to prefabs in your mod and simply (morph) player to use that model.

     

     

  5. what are you looking for the bonemeal to do?  If you want growing plants, your have to incorporate an age property.

    Your cangrow..

     

     return blockasphodelplant$enumplanttype != BlockTwoPlant.EnumPlantType.ASPHODELPLANT && blockasphodelplant$enumplanttype != BlockTwoPlant.EnumPlantType.ASPHODELPLANT;

     

    looks like it would always return false if plant type is ASPHODELPLANT, which in your case it would be, so cangrow always returns false, so grow is never called.

     

    I haven't had my coffee yet, but that's how I'm reading it.

    • Like 1
  6. Think either, just a question of proper serialization and deserization of the data when you readNBT and writeNBT in the capabilities.  Personally, I'd go for a single Profession capability that held a map<profession,level> or keep it in a NBTTagList that held NBTTagCompounds (String profession,int level). iterate through list during readNBT, writeNBT.  storing data in NBTList might make reading and writing easy.  Probably create a public on the capability that handles the lookup for you.

     

    public int getProfessionLevel(String profession){

    //find level via map or list and return

    }

  7.  

    1) are you wanting to rotate the model or have multiple connections possible?  Think the variants need to account for each possible, so "north=false,south=false,west=false,east=false"->say center model, "north=true,south=false,west=false,east=false" -> different model., "north=true,south=true,east=false,west=false" -> different model ... so if that is desired, you need to account for all possible combos and point each one at different model.

     

    1) If rotating: use the FACING property in your class, instead of a bool for each direction, unless it was going to have multiple directions possible, but your addcollisionbox function only allows a single direction.

     

    2) you need a conversion for the blockstate metas  (getStateFromMeta(int) & getMetaFromState(IBlockState)

     

    3) if you are just rotating the model, easier, just rotate the model in the y.

     

    here is code from a rope that I made that rotates and moves the collision around

    public class BlockRope extends BlockBase{
    	public static final PropertyDirection FACING = BlockHorizontal.FACING;
    	public static final PropertyBool TOP=PropertyBool.create("top");
    	
    	
    	protected static final AxisAlignedBB BASE_AABB_TOP = new AxisAlignedBB(0, 0.0D, 0D, 1D, 0.25D, 1D);
    	protected static final AxisAlignedBB BASE_AABB_NORTH = new AxisAlignedBB(.4D, 0.0D, 0D, .6D, 1D, .2D);
    	protected static final AxisAlignedBB BASE_AABB_SOUTH = new AxisAlignedBB(.4D, 0.0D, .8D, .6D, 1D, 1D);
    	
    	protected static final AxisAlignedBB BASE_AABB_EAST = new AxisAlignedBB(.8D, 0.0D, .4D, 1D, 1D, .6D);
    	protected static final AxisAlignedBB BASE_AABB_WEST = new AxisAlignedBB(0D, 0.0D, .4D, .2D, 1D, .6D);
    	
    	public BlockRope() {
    		super(Material.CLOTH, "rope",false);
    		this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(TOP, true));
    		
    		this.setHardness(2F);
    		
    	}
    	
    	
    	
    	@Override
    	public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) {
    		if(base_state.getValue(TOP)==true){
    			return false;
    		}
    		
    		return true;
    	}
    
    
    
    	@Override
    	public IBlockState getStateFromMeta(int meta) {
    		int adjust=meta>>1; 
    		EnumFacing enumfacing = EnumFacing.getFront(adjust);
    
    	        if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    	        {
    	            enumfacing = EnumFacing.NORTH;
    	        }
    	        
    	        int top=meta&1;
    	        boolean tb=false;
    	        if(top==1){
    	        	tb=true;
    	        }
    
    	        return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(TOP, tb);
    	}
    	@Override
    	public int getMetaFromState(IBlockState state) {
    		boolean top=state.getValue(TOP);
    		EnumFacing facing=state.getValue(FACING);
    		
    		int meta=((EnumFacing)state.getValue(FACING)).getIndex();
    		meta=meta<<1;
    		if(top){
    			meta+=1;
    		}
    		return meta;
    	}
    	
    	
    
    
    @Override
    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    	if(state.getValue(TOP)==true){
    		return BASE_AABB_TOP;
    	}
    	switch(state.getValue(FACING)){
    	
    	case EAST:
    		return BASE_AABB_EAST;
    		
    	case NORTH:
    		return BASE_AABB_NORTH;
    		
    	case SOUTH:
    		return BASE_AABB_SOUTH;
    		
    	
    	case WEST:
    		return BASE_AABB_WEST;
    		
    	default:
    		break;
    	
    	}
    	return BASE_AABB_TOP;
    }
    
    
    
    
    @Override
    public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
    		List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) {
    	 
    	if(state.getValue(TOP)==true){
    		addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB_TOP);
    	}
    	else{
    		switch(state.getValue(FACING)){
    		case NORTH:
    			addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB_NORTH);
    			break;
    		case SOUTH:
    			addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB_SOUTH);
    			break;
    		case EAST:
    			addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB_EAST);
    			break;
    		case WEST:
    			addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB_WEST);
    		
    		default:
    			break;
    		}
    		
    	}
    	
    	 
    }

     

     

    hope that helps.

    {
        "variants": {
            "facing=north,top=true": { "model": "dadmod:rope_top" },
            "facing=east,top=true":  { "model": "dadmod:rope_top", "y": 90 },
            "facing=south,top=true": { "model": "dadmod:rope_top", "y": 180 },
            "facing=west,top=true":  { "model": "dadmod:rope_top", "y": 270 },
            "facing=north,top=false": { "model": "dadmod:rope_side" },
            "facing=east,top=false":  { "model": "dadmod:rope_side", "y": 90 },
            "facing=south,top=false": { "model": "dadmod:rope_side", "y": 180 },
            "facing=west,top=false":  { "model": "dadmod:rope_side", "y": 270 }
        }
    }

     

  8. Oso,

     

    I agree that you will need some basic java in order to move forward. Too many other issues with coding the forge mods if you don't have a basic understanding of java.  However, if you know how to use github, there are a lot of good examples, tutorials to help you get started.  The proxy issue is there because there are things you want to execute on the server only, client only, or both and setting up the common/client proxy allows you do this easier. This is done by the client proxy extending the common one.

     

    Check out.... lots of starting examples where you can clone the repository, get it to compile/run, then start tweaking.  When the examples are too large to start with, it can be difficult to follow everything, greyghost has some nice simple ones to help get you started.

    https://github.com/TheGreyGhost/MinecraftByExample

     

    Good luck,

     

    p.s. vanilla code is very helpful when trying to figure out stuff. Assuming you've done the gradlew setupDecompWorkspace and eclipse (see readme file from forge download)...should be under you project reference libraries under the forge version.

  9. Well the BlockDoublePlant has a property HALF that tells you if the block represents the UPPER or LOWER block of the 2 block group.  This property is stored in the blockstate.  So when you do a IBlockState state= world.getBlockState(BlockPos);  you can get the  value by  state.getValue(BlockDoublePlant.HALF);

     

    The BlockDoublePlant then traps events such as getItemDropped, etc to determine which blockstate is present (UPPER or LOWER) and do appropriate action. i.e. upper should turn to air if the bottom block is destroyed/harvested

     

    If you create a new class MyBlockDoublePlant and copy all the code over from BlockDoublePlant (extending BlockBush, implements IGrowable, net.minecraftforge.common.IShearable) then get rid of the variants you don't want, create your own EnumPlantTypes and tweak as needed. Should get you were you want to be. The json file for the blockstate would be similar to the double_rose.json, double_fern.json, etc taking note of the variants 'half=lower', 'half=upper'.

     

    In your modblocks, create each variant appropriately with the MyBlockDoublePlant (or whatever you call the class).

     

    You would also have to deal with generation in the biomes that you want, but that is next step if you were wanting auto generating plant.

     

    • Like 1
  10. I think you'd want to use capabilities. The docs have some basic information on it. But basically, you create a custom capability class which handles the readNBT and writeNBT functions to save/load.  Then create a class handler that catches the event attachCapability.  Register handler with the bus to receive events (mod pre-init?). 

     

    A search on github should provide some examples of actual use.

     

     

  11. diesieben07:

     

    Thanks a bunch.  I had the global data save working, but was adding a new LootEntryItem to the pool tables in LootTableLoadEvent instead of creating a new condition and LootEntry.

    @SubscribeEvent
        public void onLootTableLoad(LootTableLoadEvent event)
        {
    		if (event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE))
    		{
    			
    			 LootPool main = event.getTable().getPool("main");
    			 lootpools.add(main);	//ArrayList I was storing to try and change/alter table later in game
    			 
    	            if (main != null)
    	            {
    	                main.addEntry(new LootEntryItem(ModItems.staffBlazeKing, 10, 0, new LootFunction[0], new LootCondition[0], "uniqueitemsmod:staff_blaze_king")); //works, but wrong, can't change the condition or remove chance (how I was doing it)
    	            }
    		}
    		else if(event.getName().equals(LootTableList.GAMEPLAY_FISHING)){
    			LootPool main = event.getTable().getPool("main");
    			
                if (main != null)
                {
                	//as per diesieben07, much better, can tweek the condition to zero (or whatever) at any time after
                	main.addEntry(new UniqueEntry(10,1,new LootCondition[] {new UniqueLoot()},"uniqueitemsmod:uniqueloot")); 
                }

     

×
×
  • Create New...

Important Information

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