Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Zemelua

Members
  • Posts

    185
  • Joined

  • Last visited

Everything posted by Zemelua

  1. I just want to draw one block state on the GUI but my code doesn't work. In the case of Either#ifLeft, it is drawn correctly..... what's wrong? https://github.com/Zemelua/UMU-Arcanum/blob/b66a48dd1018390543ebf6a5ede607bf915a508b/src/main/java/io/github/zemelua/umu_arcanum/client/renderer/gui/screen/codex/page/IndexPage.java#L63
  2. It dosent work...... @Override public void renderByItem(ItemStack itemStack, ItemTransforms.TransformType transformType, PoseStack poseStack, MultiBufferSource source, int light, int overlay) { // poseStack.pushPose(); UMUArcanum.LOGGER.info("custom model is rendered."); // Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera(); // poseStack.mulPose(Vector3f.YP.rotationDegrees(180F - camera.getYRot())); // poseStack.mulPose(Vector3f.XP.rotationDegrees(180F - camera.getXRot())); VertexConsumer consumer = source.getBuffer(RenderType.translucentNoCrumbling()); //test sprite TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(new ResourceLocation("minecraft", "block/water_still")); poseStack.mulPose(Minecraft.getInstance().getEntityRenderDispatcher().cameraOrientation()); Matrix4f matrix = poseStack.last().pose(); consumer.vertex(matrix, 0.0F, 1.0F, 0.0F).color(255, 255, 255, 255) .uv(sprite.getU( 0F), sprite.getV( 0F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); consumer.vertex(matrix, 0.0F, 1.0F, 1.0F).color(255, 255, 255, 255) .uv(sprite.getU(16F), sprite.getV( 0F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); consumer.vertex(matrix, 1.0F, 1.0F, 1.0F).color(255, 255, 255, 255) .uv(sprite.getU(16F), sprite.getV(16F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); consumer.vertex(matrix, 1.0F, 1.0F, 0.0F).color(255, 255, 255, 255) .uv(sprite.getU( 0F), sprite.getV(16F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); // poseStack.popPose(); // render Item model }
  3. I'm currently working on rendering a BlockEntityWithoutLevelRenderer. The custom item model is in the shape of a book and I want to draw a page-specific icon on it. This icon, like particles, always points towards the camera and is directly above the book I look from anywhere. What should I do with poseStack to draw this? public class CodexItemStackRenderer extends BlockEntityWithoutLevelRenderer { public CodexItemStackRenderer() { super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels()); } @Override public void renderByItem(ItemStack itemStack, ItemTransforms.TransformType transformType, PoseStack poseStack, MultiBufferSource source, int light, int overlay) { // poseStack.pushPose(); UMUArcanum.LOGGER.info("custom model is rendered."); // Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera(); // poseStack.mulPose(Vector3f.YP.rotationDegrees(180F - camera.getYRot())); // poseStack.mulPose(Vector3f.XP.rotationDegrees(180F - camera.getXRot())); VertexConsumer consumer = source.getBuffer(RenderType.translucentNoCrumbling()); //test sprite TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(new ResourceLocation("minecraft", "block/water_still")); Matrix4f matrix = poseStack.last().pose(); consumer.vertex(matrix, 0.0F, 1.0F, 0.0F).color(255, 255, 255, 255) .uv(sprite.getU( 0F), sprite.getV( 0F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); consumer.vertex(matrix, 0.0F, 1.0F, 1.0F).color(255, 255, 255, 255) .uv(sprite.getU(16F), sprite.getV( 0F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); consumer.vertex(matrix, 1.0F, 1.0F, 1.0F).color(255, 255, 255, 255) .uv(sprite.getU(16F), sprite.getV(16F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); consumer.vertex(matrix, 1.0F, 1.0F, 0.0F).color(255, 255, 255, 255) .uv(sprite.getU( 0F), sprite.getV(16F)).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex(); // poseStack.popPose(); // render Item model } }
  4. I was developing on 1.16.5 until yesterday and moved it to 1.17, but I'm having two issues. 1. Crash when use custom liquid bucket. Displayed ""this.fluid" is null", but I don't think it should be null because the liquid is properly registered ... error log: custom fluid bucket is here : https://github.com/Zemelua/UMU-Arcanum/blob/main/src/main/java/io/github/zemelua/umu_arcanum/item/UMUArcanumItems.java 2. It seems that the biome is not registered. The other day, I encountered a similar error in 1.16.5, and at that time I just forgot to register the deferred register, but the error is displayed even though I registered properly this time. Also, this time the error biome id is -1 instead of 174 (the first index of the mod biome). error log: custom biome register is here : https://github.com/Zemelua/UMU-Arcanum/blob/main/src/main/java/io/github/zemelua/umu_arcanum/world/biome/UMUArcanumBiomes.java and data is here : https://github.com/Zemelua/UMU-Arcanum/blob/main/src/main/resources/data/umu_arcanum/worldgen/biome/dim_forest.json It took me a long time, but I couldn't figure out why this was happening. Help me. PS: Is this a possible 1.17 mapping issue? I'm using the official 1.17 mapping.
  5. ahhh, I was really stupid. I've used Deferred Register many times before, but forgot to register it this time. Luis, diesieben, sorry for the hassle, and thank you. Registering the Deferred Register worked perfectly.
  6. public void onFMLCommonSetup(final FMLCommonSetupEvent event) { try { Field field = BiomeRegistry.class.getDeclaredField("idToKeyMap"); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.PRIVATE & ~Modifier.FINAL); Int2ObjectMap<RegistryKey<Biome>> map = (Int2ObjectMap<RegistryKey<Biome>>) field.get(null); map.put(174, UMUArcanumBiomes.DIM_FOREST); field.set(null, map); LOGGER.warn(field.get(null).toString()); } catch (NoSuchFieldException exception) { exception.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } Is it like this? I still get the error ...
  7. public void onFMLCommonSetup(final FMLCommonSetupEvent event) { try { Field field = BiomeRegistry.class.getDeclaredField("idToKeyMap"); field.setAccessible(true); Int2ObjectMap<RegistryKey<Biome>> map = (Int2ObjectMap<RegistryKey<Biome>>) field.get(null); map.put(174, UMUArcanumBiomes.DIM_FOREST); } catch (NoSuchFieldException exception) { exception.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } I still get the same error. What's wrong......
  8. public UMUArcanum() { UMUArcanumBiomes.initialize(); UMUArcanumDimensions.initialize(); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onFMLCommonSetup); } public void onFMLCommonSetup(final FMLCommonSetupEvent event) { try { Field field = BiomeRegistry.class.getDeclaredField("idToKeyMap"); Int2ObjectMap<RegistryKey<Biome>> map = (Int2ObjectMap<RegistryKey<Biome>>) field.get(null); map.put(174, UMUArcanumBiomes.DIM_FOREST); } catch (NoSuchFieldException exception) { exception.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } Well, I still get the error. What should i do?
  9. understood. Will this be available in a future forge version or 1.17 without reflection?
  10. I found net.minecraft.world.biome.BiomeRegistry.idToKeyMap but it's private access. There are no other methods to access. According to this , registration should be done just by putting the json file. I think I'm putting the json file in the right place, but what's wrong ...
  11. I'm using Intellij IDEA's Minecraft Develoment Plugin, so I'm not sure which map I'm using. Probably mcp. WorldGenRegistrys has a static field Map <ResourceLocation, Supplier<?>> REGISTRY_NAME_TO_DEFAULT, which is private access. It looks like there are no other methods to access.
  12. What is BiomeRegistry.TO_NAME? There are no such methods or fields in the BiomeRegistry class ...
  13. full log: When I registered in data/modid/worldgen/biome/biome.json, I thought that I didn't need to use DeferredRegister, but I got the same error when I didn't use DeferredRegister. No other mods have been introduced.
  14. I implement a custom biome in a custom dimension and it crashes when I try to enter the custom dimension with /execute in umu_arcanum: the_silence run tp 0 0 0 (Unknown biome id emitted by layers: 174). I've referred to some mods that implement custom biomes in custom dimensions, but I'm not sure why this error is occurring. Here is my code: https://github.com/Zemelua/UMU-Arcanum
  15. @Override public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (!worldIn.isRemote()) { if (stack.getItem() != UMUBackpackItems.BACKPACK.get()) return; if (!(entityIn instanceof PlayerEntity)) return; IItemHandler inv = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(RuntimeException::new); int size = BackpackItem.getSizeFromLevel(EnchantmentHelper.getEnchantmentLevel(Enchantments.BACKPACK_CAPACITY, stack)); if (inv.getSlots() == size) return; entityIn.sendMessage(new StringTextComponent("slot:" + inv.getSlots()), null); entityIn.sendMessage(new StringTextComponent("size:" + size), null); NonNullList<ItemStack> oldInv = NonNullList.withSize(inv.getSlots(), ItemStack.EMPTY); for (int i = 0; i < inv.getSlots(); i++) { oldInv.set(i, inv.getStackInSlot(i)); } ((ItemStackHandler) inv).setSize(size); for (int i = 0; i < inv.getSlots(); i++) { if (i < oldInv.size()) { ((ItemStackHandler) inv).setStackInSlot(i, oldInv.get(i)); oldInv.set(i, ItemStack.EMPTY); } } oldInv.forEach((s) -> ((PlayerEntity) entityIn).dropItem(s, true)); } super.inventoryTick(stack, worldIn, entityIn, itemSlot, isSelected); } public static int getSizeFromLevel(int level) { return 9 * (1 + level); } So I want to compare the enchantment level with the current inventory size in Item#inventoryTick and resize the inventory correctly when they don't match. However, whenever I open my backpack inventory, I only see 9 slots. (chat with slot: 9, size: the correct size) I thought that the cause is that the NBT is not updated, but I do not understand the hierarchical structure under ForgeCaps of the NBT in the item stack. Do you think this is due to NBT? Also, if so, please tell me the structure of capabilities up to NBT.
  16. Yes. The itemstack may be in the player's inventory or dropped as an item entity. At least, what's the best way to drop an overflowing item when the enchantment is stripped with a grindstone?
  17. I want to drop the overflowing contents on the spot when the enchantment level is lowered by a whetstone or other means. Is there a way to get the owner's player with getCapability ()?
  18. I'm trying to make a backpack item that inventory size changes depending on a certain enchantment level. For this reason, I would like to resize the inventory of the item stack when enchantments are granted or cleared. Is there an event that is commonly called for them? Is there no choice but to do enchantments by gold floor, enchantment table, command, etc. at each event? Or should I always check the item's enchantment level and inventory size on every tick?
  19. understood. So what should I do in handle of the packet sent in void syncChanges() ? Either way, I think I need to get Player A in handle. Should I put the player UUID in the packet, and get player from the UUID in handle?
  20. Does it mean to send a packet(server-> tracking and self) within the handle of packet(player A-> server)? Then how do I get player A in the handle of the packet(server-> Tracking and self) ?
  21. I think this is a question that has been asked many times, but it is difficult to understand, so I will ask it. I want to update player A's capability when A presses a specific key. In addition, all players A, B, and C get the capability of each player and render them on the screen. The keystrokes, capabilities, and rendering code are all implemented. Then use packets, · Change the capability of A on the server when A pressed key · When the A's capability of the server changes, change the A capability on the A, B, C clients · Gets and renders the capability of all players on the server when rendered on the client. I don't know how to do these, so please help me.
  22. Color4f is my class, but what I'm doing is the same as the code provided. Replacing it didn't change anything. The problem I'm having is the image below ("Name Ta" is the nameplate). 1st picture: If there is water behind, it will be rendered overlapping with the water. The nameplate is darker through the entity, while the texture isn't (it looks a bit darker, because the nameplate background overlaps). 2nd picture: The texture is not darkened through the block.
  23. I know I should refer to FontRenderer#func_238441_a_, but it's complicated to dig deeper the code. This method draws both background and text. The background is probably drawn with TrenderEffect#renderEffect(FontRenderer: L344), but I don't know where the letters are drawn.
  24. The texture became transparent to the background.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.