Bloc Orientable (TileEntity)
-
Si j’en est 2, je ne voit aps le 2e
package eryah.usefulthings.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import eryah.usefulthings.Reference; import eryah.usefulthings.UsefulthingsMod; public class PlateCrafter extends BlockDirectional { public static Block platecrafter; public PlateCrafter() { this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)); } public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } public static void init() { platecrafter = new ResinLog(Material.wood).setUnlocalizedName("platecrafter").setCreativeTab(UsefulthingsMod.UTTab); } public static void register() { GameRegistry.registerBlock(platecrafter, platecrafter.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(platecrafter); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } -
Tu as supprimé le 2ème dans ce dernier code.
-
Oui, mais j’ai toujours le problème
( Mais pas tout à fait le même… Je l’avais au tout debut *Implicit super constructor BlockDirectional() is undefined. Must explicitly invoke another constructor *) -
Car ça devrait être :
public PlateCrafter(Material material) { super(material); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); }Sérieusement apprend le java sinon tu vas mouliner encore longtemps ….
-
J apprend… J apprend. Ce mod me sert à apprendre. Je touche un peu à tout grâce à ce mod. Quand je voudrait faire un truc précis dans un sujet précis, je saurais déjà le faire. Maintenant, si j’ai cette erreur plus tard je saurais que ceci est l’à solution
Envoyé de mon SM-G357FZ en utilisant Tapatalk
-
Erreur, le model de mon bloc disparait
dans les logs il y a marqué :
[09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=east not found
[09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=south not found
[09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=north not found
[09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=west not found -
Dans ton .json, il faut que tu rajoutes un model pour chaque orientation.
-
Pfioouuu… Sérieusement ?
Comment je fait ça ?
Je les empile ?
Comment le jeu va savoir la quelle est pour quelle orientation ?
La Pumpkin ou le four , ils ont pas ça dans leur .json ! -
Si :
{ "parent": "block/orientable", // C'est ici qu'il faut regarder ! "textures": { "top": "blocks/pumpkin_top", "front": "blocks/pumpkin_face_off", "side": "blocks/pumpkin_side" } }Oh tiens, un fichier JSON tout fait pour les développeurs (orientable.json):
{ "parent": "block/cube", "textures": { "particle": "#front", "down": "#top", "up": "#top", "north": "#front", "east": "#side", "south": "#side", "west": "#side" } } -
Oui, mais ça ne m’aide pas… Ou je suis vraiment très con (Ce qui est le cas)
Mon .json n’a pas de “parent”, c’est un .json custom
:::
{
“textures”: {
“0”: “ut:blocks/back”,
“1”: “ut:blocks/sides”,
“2”: “ut:blocks/front”,
“3”: “ut:blocks/cobblestone”,
“4”: “ut:blocks/planks_oak”,
“5”: “ut:blocks/iron_block”
},
“elements”: [
{
“name”: “Base”,
“from”: [
0.0,
0.0,
0.0
],
“to”: [
16.0,
16.0,
16.0
],
“faces”: {
“north”: {
“texture”: “#0”,
“uv”: [
0.0,
0.0,
16.0,
16.0
]
},
“east”: {
“texture”: “#1”,
“uv”: [
0.0,
0.0,
16.0,
16.0
]
},
“south”: {
“texture”: “#2”,
“uv”: [
0.0,
0.0,
16.0,
16.0
]
},
“west”: {
“texture”: “#1”,
“uv”: [
0.0,
0.0,
16.0,
16.0
]
},
“up”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
16.0
]
},
“down”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
16.0,
16.0
]
}
}
},
{
“name”: “Remblais 2”,
“from”: [
0.0,
16.0,
0.0
],
“to”: [
16.0,
19.0,
3.0
],
“faces”: {
“north”: {
“texture”: “#3”,
“uv”: [
0.0,
3.0,
16.0,
6.0
]
},
“east”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
3.0,
3.0
]
},
“south”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
3.0
]
},
“west”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
3.0,
3.0
]
},
“up”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
3.0
]
},
“down”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
3.0
]
}
}
},
{
“name”: “Remblais 1”,
“from”: [
0.0,
19.0,
0.0
],
“to”: [
16.0,
22.0,
2.0
],
“faces”: {
“north”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
3.0
]
},
“east”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
2.0,
3.0
]
},
“south”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
3.0
]
},
“west”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
2.0,
3.0
]
},
“up”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
2.0
]
},
“down”: {
“texture”: “#3”,
“uv”: [
0.0,
0.0,
16.0,
2.0
]
}
}
},
{
“name”: “Manche Marteau”,
“from”: [
7.0,
13.0,
0.0
],
“to”: [
9.0,
18.0,
2.0
],
“rotation”: {
“origin”: [
7.0,
14.0,
8.0
],
“axis”: “x”,
“angle”: 45.0
},
“faces”: {
“north”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
4.0,
11.0
]
},
“east”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
3.0,
11.0
]
},
“south”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
3.0,
11.0
]
},
“west”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
5.0,
11.0
]
},
“up”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
-1.0,
5.0
]
},
“down”: {
“texture”: “#4”,
“uv”: [
0.0,
0.0,
2.0,
2.0
]
}
}
},
{
“name”: “Tête marteau”,
“from”: [
6.0,
18.0,
-1.0
],
“to”: [
10.0,
21.0,
5.0
],
“rotation”: {
“origin”: [
8.0,
15.0,
8.0
],
“axis”: “x”,
“angle”: 45.0
},
“faces”: {
“north”: {
“texture”: “#5”,
“uv”: [
3.0,
3.0,
7.0,
6.0
]
},
“east”: {
“texture”: “#5”,
“uv”: [
8.0,
3.0,
14.0,
6.0
]
},
“south”: {
“texture”: “#5”,
“uv”: [
3.0,
3.0,
7.0,
6.0
]
},
“west”: {
“texture”: “#5”,
“uv”: [
3.0,
3.0,
9.0,
6.0
]
},
“up”: {
“texture”: “#5”,
“uv”: [
3.0,
3.0,
7.0,
9.0
]
},
“down”: {
“texture”: “#5”,
“uv”: [
3.0,
3.0,
7.0,
9.0
]
}
}
}
]
}
:::
Dois-je en ajouter un ? -
Qu’est-ce que ton block représente ?
-
Un bloc normal, avec deux sorte de… Barrières , et un marteau
Screen : ( Sur Modelcreator, car mon Minecraft preend 5 ans a se lancer )
http://www.noelshack.com/2015-24-1433945128-qsdsefrgtyuicaco-p.png -
Il faut faire le model de base (commence par le sens que tu veux) et ensuite recopie le model pour chaque orientation.
PS : je pense que tu devrais pouvoir alléger ton model, les logiciels ne sont pas toujours bien optimisés.
-
Oui, j’avais compris, mais comment je fais pour les stocker ?
J’en crée un qui s’apelle platecrafter, un autre platecrafter_north, un autre platecrafter_south ect ?
EDIT : Je vais tester un truc, je vais voir si c’est concluant
EDIT² : Je ne vais pas tester mon hypothèse 1, mais une autre -
-
Euh… En quoi cela m’aide ? Ça m’apprend juste a faire un Model, mais pas a faire un model ‘rotatif’
-
Tu cherches à faire le fichier json non ?
-
Oui, mais a faire un sorte qu’il puisse être tourné, qu’il soit orientable, il est déjà fait mon .json
-
Apparemment non :
[09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=east not found [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=south not found [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=north not found [09:31:35] [Client thread/ERROR] [FML]: Model definition for location ut:platecrafter#facing=west not found -
Bah il est fait, mais faut faire en sorte qu’il puisse se tourner, et sa, je ne sais pas comment faire
Rappel : Ce n’est pas un .json normal