Jump to content

Half530

Members
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Half530's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello everyone. I am having an issue with some GUI rendering I am trying to perform in my mod. I want to add a full screen multiple frame effect, and it all works, aside from that the transparent parts of the images are black and obscure vision. I don't actually know much about GUI code, so a lot of this code is straight from the part of Minecraft that renders the pumpkin overlay, with some changes to add the multiple frame effect: public class TimeSkipEffectGUI extends AbstractGui { public static final Minecraft mc = Minecraft.getInstance(); public void renderEffect() { PlayerEntity player = mc.player; if (mc.world == null) return; if (player == null) return; Stand.getLazyOptional(player).ifPresent(props -> { if (props.getTimeSkipEffectTicker() > 0) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.defaultBlendFunc(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation(DiamondIsUncraftable.MOD_ID, "textures/gui/timeskip/time_skip" + (16 - props.getTimeSkipEffectTicker()) + ".png")); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(0.0D, mc.getMainWindow().getScaledHeight(), -90.0D).tex(0.0F, 1.0F).endVertex(); bufferbuilder.pos(mc.getMainWindow().getScaledWidth(), mc.getMainWindow().getScaledHeight(), -90.0D).tex(1.0F, 1.0F).endVertex(); bufferbuilder.pos(mc.getMainWindow().getScaledWidth(), 0.0D, -90.0D).tex(1.0F, 0.0F).endVertex(); bufferbuilder.pos(0.0D, 0.0D, -90.0D).tex(0.0F, 0.0F).endVertex(); tessellator.draw(); RenderSystem.depthMask(false); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } }); } } The images I am using are transparent in all other settings I have tested them in. I am wondering, do I need entirely new rendering code, or can this code be adapted with some setting changes? It confuses me how the pumpkin overlay texture has transparency in it and works yet these images don't.
  2. Thank you for the quick response. I tried to interpret what you said and came out with this: clone = entityIn.getLowestRidingEntity(); clone.writeUnlessPassenger(entityIn.serializeNBT()); EntityType.loadEntityAndExecute(entityIn.serializeNBT(), world, Function.identity()); world.addEntity(clone); However, something feels off about it. First of all, EntityType.func_220335_a wasn't there, so I presumed it was loadEntityAndExecute because it required nbt. That is the first possible mistake on my part. Secondly, I feel like I may have misinterpreted your psuedocode, because I feel as if entityIn.getLowestRidingEntity() is redundant. Could you please elaborate on how these functions are meant to click together? Most of my Minecraft coding so far has been motion and math, so thank you for the help and dealing with me. Edit: clone is defined as a LivingEntity
  3. Hello everyone, I have recently come across the need for a function that gets fed in a LivingEntity and will create another entity of the same type, almost like cloning. I am coding in forge 1.15.2 31.2.36.. The main issue I have is getting the Entity to be the same type without a large if-else statement. I only starting coding with forge about 3 months ago, so this may be something obvious I haven't learned yet. Thank you!
×
×
  • Create New...

Important Information

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