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

LevelBlock

Members
  • Posts

    6
  • Joined

  • Last visited

LevelBlock's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Sorry I'm kinda new on this. I've deleted the implementation. Also I added this: private void clientSetup(final FMLClientSetupEvent event) { OverlayRegistry.registerOverlayTop("custom_effect", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { gui.setupOverlayRenderState(true, false); }); Not sure if it's fine, but it works. Now I have to discover how to show an animation using this.
  2. I used the forge bus and now it works, thanks a lot. If somebody needs it: @Mod.EventBusSubscriber(modid = MYMOD.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class CustomEvents implements IModBusEvent { static Minecraft mc = Minecraft.getInstance(); private static final ResourceLocation IMG_LOCATION = new ResourceLocation(MYMOD.MOD_ID,"textures/scream/img.png"); protected static int screenWidth; protected static int screenHeight; @SubscribeEvent public static void RenderEvent(RenderGameOverlayEvent.Post event) { Player player = Minecraft.getInstance().player; //Options settings = Minecraft.getInstance().options; screenWidth = mc.getWindow().getGuiScaledWidth(); screenHeight = mc.getWindow().getGuiScaledHeight(); assert player != null; if (player.hasEffect(MobEffects.GLOWING)) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.defaultBlendFunc(); RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1F); RenderSystem.setShaderTexture(0, IMG_LOCATION); Tesselator tesselator = Tesselator.getInstance(); BufferBuilder bufferbuilder = tesselator.getBuilder(); bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); bufferbuilder.vertex(0.0D, screenHeight, -90.0D).uv(0.0F, 1.0F).endVertex(); bufferbuilder.vertex(screenWidth, (double) screenHeight, -90.0D).uv(1.0F, 1.0F).endVertex(); bufferbuilder.vertex(screenWidth, 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); tesselator.end(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F); } }}
  3. Hi, I'm trying to make a custom overlay when the player has a potion effect, like in Nausea or the pumpkin. I did some research and I need the RenderGameOverlayEvent. I've declared it but It doesn't work. Maybe i have to declare it in some other place? I actually have it on event/ModEventBus @Mod.EventBusSubscriber(modid = example.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEventBusEvents { Minecraft mc = Minecraft.getInstance(); private static final ResourceLocation IMG_LOCATION = new ResourceLocation("textures/scream/glowing.png"); protected int screenWidth; protected int screenHeight; @SubscribeEvent public void HUGGYSCREAMER(RenderGameOverlayEvent event) { Player player = Minecraft.getInstance().player; //Options settings = Minecraft.getInstance().options; this.screenWidth = this.mc.getWindow().getGuiScaledWidth(); this.screenHeight = this.mc.getWindow().getGuiScaledHeight(); assert player != null; if (player.hasEffect(MobEffects.GLOWING)) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFunc(770, 771); Minecraft.getInstance().getTextureManager().bindForSetup(IMG_LOCATION); GuiComponent.blit(event.getMatrixStack(), 0, 0, 0, 0,screenWidth ,screenHeight, 480, 270); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); } } }
  4. Thanks for the answer, so I should look for an EntityDataAccesor or try with another kind of event like distance between entities?
  5. Hi. I'm looking to display an animation when an entity collides with the Player, I'm using geckolib. I haven't find a properly way to implement this on the "event.getAnimatable()". Somebody can help with a tip? private <E extends Entity & IAnimatable> PlayState predicate(AnimationEvent<E> event) { LivingEntity livingEntity = event.getExtraDataOfType(LivingEntity.class).get(0); if (event.isMoving()) { event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.walk", true)); return PlayState.CONTINUE; } if (event.getAnimatable().horizontalCollision){ event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.attack", true)); return PlayState.CONTINUE; } if(!event.isMoving()) event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.idle", true)); return PlayState.CONTINUE; }
×
×
  • Create New...

Important Information

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