Create 3D weapons for Minecraft Bedrock

Posted by Ragthor - Tuesday May 1, 2021

In today's video we will see how to change our normal weapon to a 3D version.

Resource folder

player.weapon.animation.json

                   
                     
             
{
	"format_version": "1.8.0",
	"animations": {
		"animation.player.weapon.first_person": {
			"loop": true,
			"bones": {
				"rightitem": {
					"rotation": ["c.is_first_person ? 150 : 0", "c.is_first_person ? 130 : 0","c.is_first_person ? 100 : 0"],
				    "position": [ " c.is_first_person ? 0 : 0", "c.is_first_person ? 4.5 : 0", "c.is_first_person ? 0 : 0"]
				}
			}
		},
		"animation.player.weapon": {
			"loop": true,
			"bones": {
			    "rightitem": {
			        "position": [ 0, -1, -2],
					"rotation": [0, 0, 0]
				}
			}
		}
	}
}

                     

weapon.json

                   
                     
             {
	"format_version": "1.10.0",
	"minecraft:attachable": {
		"description": {
			"identifier": "myaddon:weapon",
			"materials": {
				"default": "entity_alphatest",
				"enchanted": "entity_alphatest_glint"
			},
			"textures": {
				"default": "textures/items/weapon",
				"enchanted": "textures/misc/enchanted_item_glint"
			},
			"geometry": {
				"default": "geometry.player.weapon"
			},
			"animations": {
				"first_person": "animation.player.weapon.first_person",
				"3ra": "animation.player.weapon"
			},
			"scripts": {
				"animate": [
					{
						"first_person": "c.is_first_person && c.item_slot == 'main_hand' && q.get_equipped_item_name == 'weapon'"
					},
					{
						"3ra": "!c.is_first_person && c.item_slot == 'main_hand' && q.get_equipped_item_name == 'weapon'"
					}
				]
			},
			"render_controllers": [
				"controller.render.weapon_models"
			]
		}
	}
}


                     

weapon_models.json

                   
                     
             
{
	"format_version": "1.8.0",
	"render_controllers": {
		"controller.render.weapon_models": {
			"geometry": "Geometry.default",
			"materials": [
				{
					"*": "variable.is_enchanted ? material.enchanted : material.default"
				}
			],
			"textures": [
				"texture.default",
				"texture.enchanted"
			]
		}
	}
}

                     

player.weapon.geo.json

                   
                     
             
{
	"format_version": "1.12.0",
	"minecraft:geometry": [
		{
			"description": {
				"identifier": "geometry.player.weapon",
				"texture_width": 64,
				"texture_height": 64,
				"visible_bounds_width": 8,
				"visible_bounds_height": 13.5,
				"visible_bounds_offset": [0, 6.25, 0]
			},
			"bones": [
				{
					"name": "rightitem",
					"pivot": [-9, 20, 8],
					"rotation": [-30, 0, 0]
				},
				{
					"name": "rightitem2",
					"parent": "rightitem",
					"pivot": [-9, 20, 9],
					"cubes": [
						{"origin": [-15, 14.52949, -24.39749], "size": [12, 12, 17], "uv": [0, 0]},
						{"origin": [-12, 17.52949, -8.39749], "size": [6, 6, 6], "uv": [22, 29]},
						{"origin": [-10, 19.52949, -2.39749], "size": [2, 2, 18], "uv": [0, 29]}
					]
				}
			]
		}
	]
}