Jump to content

Somnn

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Somnn

  1. You made me realize something. When using ItemProperties#register, in the lambda function I returned the base value if the "living" parameter is equals to null, which means it will return the base value if it's not a living entity that is holding it. So removing this condition would fix the issue ? EDIT: It worked, it was a simple condition I had to change but I would not have realized it without your post .
  2. I made an item that changes its texture based on a custom tag on the itemStack, pretty much like the bow. So I managed to make it work however when I drop the item or when it's rendered within a blockentity renderer class it shows the default texture. Is there a way to display the right texture or are item renderers made like this ?
  3. Indeed, it explains it all. I looked at its use in Player.attack() and I got it working, just sending the new packet after setting the deltaMouvement fixed the issue. It was kind of simple in the end, but I would not have got it without you, thanks !
  4. Ok so now I am running into an issue. I made the following code to basically affect every player which is in a certain box around the mob. However, the players are ok, but the setDeltaMouvement() method doesn't make something at all. I also tried player.jumpFromGound(), it doesn't work either. Am I missing something ?? @Override protected void playStepSound(BlockPos pPos, BlockState pState) { int affectedRadius = 8; List<Player> players = this.level.getEntitiesOfClass(Player.class, new AABB( this.getBlockX() + affectedRadius, this.getBlockY() + affectedRadius, this.getBlockZ() + affectedRadius, this.getBlockX() - affectedRadius, this.getBlockY() - affectedRadius, this.getBlockZ() - affectedRadius)); if (!players.isEmpty()) { players.forEach(player -> { Alcamod.LOGGER.info("Affecting " + player.getName()); player.setDeltaMovement(player.getDeltaMovement().with(Direction.Axis.Y, 0.4D)); }); } this.playSound(AlcaSoundEvents.CRYSTAL_GOLEM_STEP.get(), 1.0F, 0.6F); }
  5. Alright, I will take a look at these classes, I think I will find what I want, thanks for your help !!
  6. I was wondering if anyone had an idea on how to make the screen shake. I have a custom entity and I want to make the screen shake when it walks as it's a giant. I think I will handle this inside of the playStepSound() method, however I have no clue on how to perform this shake effect. Does anyone have an idea please ?
  7. Fixed it thanks for your help ! I will just need to make some adjustments with the titles but it will be ok.
  8. The real places of the slots are not where they should be according to the texture. Here is a screenshot, if it makes it more understandable. The texture I am attempting to render is 256x256 px, but the part I want to render is 176x201px And here is the full Screen class : public class RingInfuserScreen extends AbstractContainerScreen<RingInfuserMenu> { private static final ResourceLocation INFUSER_GUI = new ResourceLocation(Alcamod.MODID, "textures/gui/ring_infuser.png"); public RingInfuserScreen(RingInfuserMenu menu, Inventory inv, Component component) { super(menu, inv, component); } @Override protected void init() { super.init(); } @Override protected void renderBg(PoseStack poseStack, float pTick, int pMouseX, int pMouseY) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderTexture(0, INFUSER_GUI); this.imageWidth = 176; this.imageHeight = 201; int x = (width - imageWidth) / 2; int y = (height - imageHeight) / 2; this.blit(poseStack, x, y, 0, 0, imageWidth, imageHeight); this.blit(poseStack, x + 38, y + 24, 0, 201, this.menu.getInfuseProgressionScaled(), 35); this.blit(poseStack, x + 85, y + 73 - this.menu.getHeatProgressionScaled(), 100, 211 - this.menu.getHeatProgressionScaled(), 21, this.menu.getHeatProgressionScaled()); GlStateManager._enableBlend(); GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.value, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value); this.blit(poseStack, x + 79, y + 61 - this.menu.getEssenceLevel(), 121 + this.menu.getEssenceOffset(), 246 - this.menu.getEssenceLevel(), 18, this.menu.getEssenceLevel()); GlStateManager._disableBlend(); } @Override public void render(PoseStack pPoseStack, int pMouseX, int pMouseY, float pPartialTick) { renderBackground(pPoseStack); super.render(pPoseStack, pMouseX, pMouseY, pPartialTick); renderTooltip(pPoseStack, pMouseX, pMouseY); } }
  9. Hi, I am on an issue currently, I am rendering the screen gui as well as the tooltips. However they do not align. Moreover, even when I align them on screen and then try to open the screen on my other monitor which has a different resolution, it removes every alignment. Here is the Menu constructor, with the slots positions : public RingInfuserMenu(int windowId, Inventory inv, BlockEntity be, ContainerData data) { super(AlcaMenuTypes.RING_INFUSER_MENU.get(), windowId); checkContainerSize(inv, 4); this.be = (RingInfuserBlockEntity) be; this.level = inv.player.level; this.data = data; // Forge Inv this.be.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(handler -> { this.addSlot(new RingInfuserRingSlot(handler, 0, 20, 31)); this.addSlot(new RingInfuserInfuserSlot(handler, 1, 65, 75)); this.addSlot(new GenericFuelSlot(handler, 2, 95, 75)); this.addSlot(new GenericOutput(handler, 3, 140, 31)); }); addDataSlots(data); // Player Inv for (int row = 0 ; row < 3 ; row++) { for (int col = 0 ; col < 9 ; col++) { this.addSlot(new Slot(inv, col + row * 9 + 9, 8 + col * 18, 84 + (row * 18))); } } // Player HotBar for (int col = 0 ; col < 9 ; col++) { this.addSlot(new Slot(inv, col, 8 + col * 18, 142)); } } And the Screen RenderBg method : @Override protected void renderBg(PoseStack poseStack, float pTick, int pMouseX, int pMouseY) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderTexture(0, INFUSER_GUI); this.imageWidth = 176; this.imageHeight = 201; int x = (width - imageWidth) / 2; int y = (height - imageHeight) / 2; this.blit(poseStack, x, y, 0, 0, imageWidth, imageHeight); this.blit(poseStack, x + 38, y + 24, 0, 201, this.menu.getInfuseProgressionScaled(), 35); this.blit(poseStack, x + 85, y + 73 - this.menu.getHeatProgressionScaled(), 100, 211 - this.menu.getHeatProgressionScaled(), 21, this.menu.getHeatProgressionScaled()); GlStateManager._enableBlend(); GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.value, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value); this.blit(poseStack, x + 79, y + 61 - this.menu.getEssenceLevel(), 121 + this.menu.getEssenceOffset(), 246 - this.menu.getEssenceLevel(), 18, this.menu.getEssenceLevel()); GlStateManager._disableBlend(); } Thanks for your help
×
×
  • Create New...

Important Information

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