Jump to content

Aligatetcolt

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Aligatetcolt

  1. This is kinda what i was thinking of making as a button. only rotating when you hover over it with your mouse. and a more minecraft style border
  2. Greetings, I am trying to make a mod that is basicly a custom wardrobe with hats, shirts, pants, etc. i already have the model show up on the layer with addLayer. The problem that i have right now is that i want to show the model on the button so that the user can easily see what that hat looks like. I do have the player rendered in the GUI just as in the inventory screen. but i cant wrap my head around how to do that for the Tophat. I am able to show the model on the player and turn it of with the click of a button already.
  3. I got it working. I had to still use the Minecraft.getInstance().getEntityModels() And use that in plushRenderer. public class ItemStackRenderer extends BlockEntityWithoutLevelRenderer{ private EntityModelSet entityModelSet; private Map<Plush.Type, PlushModelBase> plushModelBaseMap; public ItemStackRenderer(BlockEntityRenderDispatcher RenderDispatcher, EntityModelSet ModelSet) { super(RenderDispatcher, ModelSet); } @Override public void onResourceManagerReload(ResourceManager resourceManager) { } @Override public void renderByItem(ItemStack stack, ItemTransforms.TransformType transformType, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Item item = stack.getItem(); if (item instanceof BlockItem) { Block block = ((BlockItem) item).getBlock(); if (block instanceof PlushBlock) { GameProfile gameprofile = null; if (stack.hasTag()) { CompoundTag compoundtag = stack.getTag(); if (compoundtag.contains("SkullOwner", 10)) { gameprofile = NbtUtils.readGameProfile(compoundtag.getCompound("SkullOwner")); } else if (compoundtag.contains("SkullOwner", 8) && !StringUtils.isBlank(compoundtag.getString("SkullOwner"))) { gameprofile = new GameProfile(null, compoundtag.getString("SkullOwner")); compoundtag.remove("SkullOwner"); SkullBlockEntity.updateGameprofile(gameprofile, (p_172560_) -> { compoundtag.put("SkullOwner", NbtUtils.writeGameProfile(new CompoundTag(), p_172560_)); }); } } Plush.Type PlushType = ((PlushBlock) block).getType(); this.entityModelSet = Minecraft.getInstance().getEntityModels(); plushModelBaseMap = PlushBlockRenderer.createPlushRenderers(this.entityModelSet);; PlushModelBase modelBase = plushModelBaseMap.get(PlushType); RenderType rendertype = PlushBlockRenderer.getRenderType(PlushType, gameprofile); Furniature.LOGGER.info(gameprofile +" :Gameprofile"); Furniature.LOGGER.info(PlushType+" :Plush Type"); Furniature.LOGGER.info(modelBase+" :Model Base"); PlushBlockRenderer.renderPlush((Direction) null, 180.0F, 0.0F, matrixStackIn, bufferIn, combinedLightIn, modelBase, rendertype); } } } }
  4. It seems like the gameprofile stays null. But still not 100% sure on why there is no item model.
  5. had that still the same thing happened. i removed to test if that was really necessary.
  6. Yeah it seems like i did make a mistake and now it does go to the code. there is still one other problem and that is that the items are invisible. i guess something is wrong with my item render class.
  7. I will make the item models json when i can and report back if it made a difrence
  8. There was and that made no difference. The reason i took them away was because i looked at some references and no one had a model.json
  9. Here is the link to github. https://github.com/DavyVerbogt/Furniature/tree/main/src/main/java/com/colt/furniature
  10. Well i put this (Furniature.LOGGER.info("But does it get here?");) in the BlockEntityWithoutLevelRenderer. But i cant find it in the log. so what i thought was that it never reached that point as you can see in the code i send earlier.
  11. Alright. i was just confused then. but weirdly enough it still does not get past the consumer.accept. at least the logger i put in never is triggered. so its not in the logs. Also sorry i have been on this problem for a few while now and i just completely blank out sometimes.
  12. Alright but it keeps saying Method call expected with Insert New. Even if i do this. @Override public void initializeClient(Consumer<IItemRenderProperties> consumer) { ItemStackRenderer plushItemRender = new ItemStackRenderer(); consumer.accept(new IItemRenderProperties() { @Override public BlockEntityWithoutLevelRenderer getItemStackRenderer() { Furniature.LOGGER.info("But does it get here?"); return plushItemRender; } }); }
  13. I am trying to make custom block that looks like a type of plush of a player and make it work just like the skulls. The block already works but for some reason i cant seem to get past the consumer.accept in the initializeClient The Item class public class PlushItem extends BlockItem { public PlushItem(Block block) { super(block, new Item.Properties().tab(FurniatureItemGroup.FURNIATURE)); } @Override public void initializeClient(Consumer<IItemRenderProperties> consumer) { consumer.accept(new IItemRenderProperties() { @Override public BlockEntityWithoutLevelRenderer getItemStackRenderer() { return new ItemStackRenderer(); } }); } } The item stack renderer public class ItemStackRenderer extends BlockEntityWithoutLevelRenderer { private static HashMap<Plush.Type, PlushModelBase> plushModels; public ItemStackRenderer() { super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels()); } private static void init() { plushModels = new HashMap<>(); for (Plush.Type type : Plush.Types.values()) { PlushModelBase plushModelBase = new PlushModelBase(); plushModels.put(type, plushModelBase); } } @Override public void renderByItem(ItemStack stack, ItemTransforms.TransformType transformType, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { if (plushModels == null) init(); Furniature.LOGGER.info(plushModels + " :Render By Item"); Item[] items = {FurniatureItems.HEATH_PLUSH.get(), FurniatureItems.PLAYER_PLUSH.get()}; for (Item item : items) { if (item instanceof BlockItem) { Block block = ((BlockItem) item).getBlock(); if (block instanceof PlushBlock) { GameProfile gameprofile = null; if (stack.hasTag()) { CompoundTag compoundtag = stack.getTag(); if (compoundtag.contains("SkullOwner", 10)) { gameprofile = NbtUtils.readGameProfile(compoundtag.getCompound("SkullOwner")); } else if (compoundtag.contains("SkullOwner", 8) && !StringUtils.isBlank(compoundtag.getString("SkullOwner"))) { gameprofile = new GameProfile(null, compoundtag.getString("SkullOwner")); compoundtag.remove("SkullOwner"); SkullBlockEntity.updateGameprofile(gameprofile, (p_172560_) -> { compoundtag.put("SkullOwner", NbtUtils.writeGameProfile(new CompoundTag(), p_172560_)); }); } } Plush.Type PlushType = ((PlushBlock) block).getType(); PlushModelBase modelBase = plushModels.get(PlushType); RenderType rendertype = PlushBlockRenderer.getRenderType(PlushType, gameprofile); PlushBlockRenderer.renderPlush((Direction) null, 180.0F, 0.0F, matrixStackIn, bufferIn, combinedLightIn, modelBase, rendertype); } } } } } I am fully aware that is probably still wont work but i am just not sure on how to go further.
  14. I got it working. still thanks for your help. it was still realy helpfull
  15. public class ModColorHandeler { @SubscribeEvent public static void registerItemColourHandlers(final ColorHandlerEvent.Item event) { final BlockColors blockColors = event.getBlockColors(); final ItemColors itemColors = event.getItemColors(); final IItemColor itemColourHandler = (stack, tintIndex) -> { return itemColors.getColor(stack, tintIndex); }; itemColors.register(itemColourHandler, ccamItems.FLOWER_CROWN.get()); } Here you go. i havent changed much yet because i didn't fully understand what i was supposed to change yet.
  16. I am not 100%. i have basically been doing everything by trail and error. and i couldn't figure out on how and what i was supposed to do. and i am not sure on how to check if it is the right color because right now it still give that stackoverflow error.
  17. Yeah the exact same. just like minecraft does with leather. just put the item in the crafting table with dye and then it is colord. it works on the models but still not in the inventory screen i send an pic of what i have right now as the item. idk if i was clear enough but i want to change the white part to the color that it was dyed.
  18. Sorry for my bad habit of naming things. i got used to using unity alot and a new file is called a script. What i meant was, The color data i got from the code snippet earlier. i need to add that then to the nbt data with the ItemStack#getOrCreateChildTag(<your mod ID>) that you send. Right? The only thing i dont really know at the moment is where would i add to the items nbt data. in the place where i register the items or in a new file.
  19. Thanks alot. just to clarify. I will now have to take that data i got from the script i send before and then set that as nbt data into the item that needs that. but is that supposed to be in a different script or in the color manager script i send before.
  20. Alright thanks for the reply. So i deleted the @OnlyIn But as the second part. How would i actually set that color that i get on to the item i want it on. which is in this case the Flower Crown.
  21. Goodday, I am making an armor mod and i want to make some items dyeable just like leather. I already have the dye working on the item models but now i want it also to represent the color on the item. but i cant really figure out how. i saw it had something to do with a item color handler and iitemcolor but i dont realy understand it. does someone maybe have an example on how it should work. this is what i have now and i keep getting a stackoverflow error. @Mod.EventBusSubscriber(modid = ColtCosmeticArmorMod.MOD_ID, bus = Bus.MOD) public class ModColorHandeler { @SubscribeEvent @OnlyIn(Dist.CLIENT) public static void registerItemColourHandlers(final ColorHandlerEvent.Item event) { final BlockColors blockColors = event.getBlockColors(); final ItemColors itemColors = event.getItemColors(); final IItemColor itemColourHandler = (stack, tintIndex) -> { return itemColors.getColor(stack, tintIndex); }; itemColors.register(itemColourHandler, ccamItems.FLOWER_CROWN.get()); } } It is my first time making a minecraft mod. Btw i mostly learn things by example.
×
×
  • Create New...

Important Information

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