Jump to content

AiresNor

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by AiresNor

  1. There is a thing called TileEntityRenderer (TER), that renders tile entities besides the block, so like, you would have the block model with empty spaces and the TER would render another model in that empty spaces. Read the documentation on it, https://mcforge.readthedocs.io/en/1.16.x/tileentities/tesr/, it's somewhat vague, but check other mods that uses it, probably you are gonna also want to search for TESR, which was how this was previously called, but the render method changed, so you have to know how to render stuff. Read this as well, https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e, although it's about porting from earlier version, this guide talks about how stuff is rendered now in 1.15+.
  2. Why don't you cancel the event and open "all" the doors, like the from the event as well, this way perhaps there will be a small delay, but all doors should open at the same time.
  3. Hello Everyone! I am starting a mod where I want items to have their textures changed using property overrides, the catch is, i'm using wavefront .OBJ models. I did try placing a "textures" key in the sword.json and setting values like "#blade":"oversmith:items/iron", but it just wouldn't change. I remember that at least 1.12.2 where i have another mod up and running, i could use it like mentioned above, i mean, using "#[material name]" inside the "textures" key, but it seems that feature isn't there anymore, perhaps it's because it doesn't use blockstates anymore for items. I'm new to properties overrides so if there is an error, please help me out! Anyways, as a side question: would this be the correct approach for having an obj model change it's textures? Because in my head, this would only load the model once instead of loading tons of the same model just changing the material lib. The mod is all on git hub at: Oversmith Repository Key parts for this problem are: OverSmith.java private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); SmithItems.initProperties(); } SmithItems.java public class SmithItems { @MethodsReturnNonnullByDefault public static class SmithItemGroupClass extends ItemGroup { public SmithItemGroupClass(String label) { super(label); } @Override public ItemStack createIcon() { return Items.IRON_INGOT.getDefaultInstance(); } } public static ItemGroup SmithItems = new SmithItemGroupClass("Smith_items"); public static DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, OverSmith.MOD_ID); public static RegistryObject<Item> SWORD = ITEMS.register("sword", ItemSword::new); public static class MaterialGetter implements IItemPropertyGetter { private String part; public MaterialGetter(String part) { this.part = part; } @Override public float call(ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) { CompoundNBT tag = stack.getTag(); if(tag != null) { if (tag.contains(this.part)) { return tag.getFloat(this.part); } } return 0; }; } /** * This is a temporary location, certainly gonna change to a better class */ public static void initProperties() { ItemModelsProperties.registerProperty(SWORD.get(), new ResourceLocation(OverSmith.MOD_ID, "grip"), new MaterialGetter("grip")); ItemModelsProperties.registerProperty(SWORD.get(), new ResourceLocation(OverSmith.MOD_ID, "blade"), new MaterialGetter("blade")); ItemModelsProperties.registerProperty(SWORD.get(), new ResourceLocation(OverSmith.MOD_ID, "pommel"), new MaterialGetter("pommel")); ItemModelsProperties.registerProperty(SWORD.get(), new ResourceLocation(OverSmith.MOD_ID, "guard"), new MaterialGetter("guard")); } } ItemSword.java @MethodsReturnNonnullByDefault public class ItemSword extends ItemWeapon { public ItemSword() { } @Override public ItemStack getDefaultInstance() { ItemStack stack = super.getDefaultInstance(); CompoundNBT tag = stack.getTag(); if(tag == null) tag = new CompoundNBT(); tag.putFloat("blade", 1); tag.putFloat("guard", 1); tag.putFloat("grip", 0); tag.putFloat("pommel", 1); return stack; } } sword.json (model) { "loader": "forge:obj", "model": "oversmith:models/item/sword.obj", "flip-v": true, "display": { "thirdperson_righthand": { "translation": [8,2,-8], "rotation": [0,90,0] }, "firstperson_righthand": { "translation": [8,2,-8], "rotation": [0,90,0] }, "gui": { "translation": [7.5,1,0], "rotation": [0,0,45], "scale": [0.7,0.7,0.7] } }, "overrides": [ { "predicate": {"oversmith:grip": 0},"model":"oversmith:item/sword", "textures": { "#grip": "oversmith:items/wood.png"} }, { "predicate": {"oversmith:grip": 1},"model":"oversmith:item/sword", "textures": { "#grip": "oversmith:items/iron.png"} }, { "predicate": {"oversmith:guard": 0},"model":"oversmith:item/sword", "textures": { "#guard": "oversmith:items/wood.png"} }, { "predicate": {"oversmith:guard": 1},"model":"oversmith:item/sword", "textures": { "#guard": "oversmith:items/iron.png"} }, { "predicate": {"oversmith:pommel": 0},"model":"oversmith:item/sword", "textures": { "#pommel": "oversmith:items/wood.png"} }, { "predicate": {"oversmith:pommel": 1},"model":"oversmith:item/sword", "textures": { "#pommel": "oversmith:items/iron.png"} }, { "predicate": {"oversmith:blade": 0},"model":"oversmith:item/sword", "textures": { "#blade": "oversmith:items/wood.png"} }, { "predicate": {"oversmith:blade": 1},"model":"oversmith:item/sword", "textures": { "#blade": "oversmith:items/iron.png"} } ] }
×
×
  • Create New...

Important Information

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