Jump to content

Zemelua

Members
  • Posts

    190
  • Joined

  • Last visited

Everything posted by Zemelua

  1. I was expecting to get a FluidModel with ModelBakeEvent, but apparently this isn't being used. It is the LiquidBlockRenderer class that actually renders the liquid. By rewriting the getLightColor method of this class, my goal was achieved. However, since I'm using a mixin, if anyone has an idea that can do the same within the forge, I'd appreciate it if you could tell me for other modders who saw this as well.
  2. I have implemented a custom liquid and it is working. Now, I want to make it glow like a spider's eye (I know it's not really shining, it's rendered ignoring shadows). I want to make the whole block shine, not just a part like the eyes of a spider. Here is my code. Apply ManaModel to my liquid block with ClientHanlder.onModelBake. ManaModel is an IBakedModel and I believe it can be rendered by overriding getQuads and setting the quads to the maximum light. But it doesn't work. Is it because ManaModel.putLightVertex is not passing the correct value? Or is it not possible to apply the light in the first place? Model is complicated, please help someone.
  3. I'm trying to render a shooting star on the night sky. I succeeded in actually drawing a shooting star, referring to the rendering of the vanilla stars, but for some reason it is only drawn in the northern sky. Is there anyone who can help me? My code is here: https://github.com/Zemelua/UMU-Client/blob/main/src/main/java/io/github/zemelua/umu_client/renderer/world/FallingStarRenderer.java
  4. I would like to leave a bullet hole there when my custom projectile hits a block. I can get BlockHitResult with Projectile#onHitBlock, 1. What should I use to render bullet holes? particle? But it points towards the player's camera. Should I create a bullet hole class, save it to a Map and render it directly? 2. No matter how I render, I need data of the angle of the hit surface and its angle. How do I get this? 3. When the bullet hits a block such as a stone, I would like to reflect it instead. After getting the angle of the surface in 2, how do I calculate the reflected vector from it and the delta movement of the bullet? Please let me know if you have any hints for any of 1, 2 or 3. For reference, my code is here .
  5. My custom entity is spawning, but push is moving only the server side entity. The client remains stationary at the spawned position. Are the coordinates of the entity not automatically synchronized? if (!world.isClientSide()) { WhirlwindEntity whirlwind = ModEntities.WHIRLWIND.get().spawn( (ServerLevel) world, null, null, null, player.blockPosition(), MobSpawnType.TRIGGERED, false, false ); if (whirlwind != null) { Vec3 moveVec = player.getLookAngle().scale(2.0D); whirlwind.push(moveVec.x(), moveVec.y(), moveVec.z()); } }
  6. 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
  7. 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 }
  8. 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 } }
  9. 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.
  10. 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.
  11. 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 ...
  12. 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......
  13. 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?
  14. understood. Will this be available in a future forge version or 1.17 without reflection?
  15. 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 ...
  16. 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.
  17. What is BiomeRegistry.TO_NAME? There are no such methods or fields in the BiomeRegistry class ...
  18. 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.
  19. 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
  20. @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.
  21. 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?
  22. 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 ()?
  23. 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?
  24. 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?
×
×
  • Create New...

Important Information

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