Jump to content

grossik

Members
  • Posts

    88
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

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

grossik's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. Hi. I'm having trouble rendering my own head. If I place a head that has my skin texture and another one next to it (without texture - completely black) my skin is visible on the second one until the first head disappears from view. How to make the second head always be all black? https://imgur.com/Bd2fNgP https://imgur.com/m04kAWV Code: public class CustomSkullRenderer implements BlockEntityRenderer<CustomSkullBlockEntity> { SkullModelBase headModel; RenderType rendertype; DynamicTexture texture; private int[][] oldTextureMap; public CustomSkullRenderer(BlockEntityRendererProvider.Context context) { headModel = new SkullModel(context.bakeLayer(ClientSetup.HEAD)); rendertype = null; oldTextureMap = new int[16][32]; texture = new DynamicTexture(64, 64, true); } @Override public void render(CustomSkullBlockEntity be, float p_112308_, PoseStack pose, MultiBufferSource buffer, int light, int p_112312_) { try { updateImage(be); if(rendertype == null) { Minecraft.getInstance().getTextureManager().register(be.getLocation(), texture); rendertype = CustomRenderType.createSkullRenderType(be.getLocation()); } } catch(Exception e) { e.printStackTrace(); } BlockState blockstate = be.getBlockState(); boolean flag = blockstate.getBlock() instanceof CustomSkullWall; Direction direction = flag ? blockstate.getValue(CustomSkullWall.FACING) : null; float f1 = 22.5F * (float)(flag ? (2 + direction.get2DDataValue()) * 4 : blockstate.getValue(CustomSkull.ROTATION)); pose.pushPose(); if(direction == null) { pose.translate(0.5D, 0.0D, 0.5D); } else { pose.translate((double)(0.5F - (float)direction.getStepX() * 0.25F), 0.25D, (double)(0.5F - (float)direction.getStepZ() * 0.25F)); } pose.scale(-1.0F, -1.0F, 1.0F); VertexConsumer vertexconsumer = buffer.getBuffer(rendertype); headModel.setupAnim(0, f1, 0); headModel.renderToBuffer(pose, vertexconsumer, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); pose.popPose(); } public void updateImage(CustomSkullBlockEntity be) { boolean update = false; for(int y = 0; y < be.getTextureMap().length; y++) { for(int x = 0; x < be.getTextureMap()[y].length; x++) { if(oldTextureMap[y][x] != be.getTextureMap()[y][x]) { setColorToImage(x, y, be.getTextureMap()[y][x]); update = true; } } } if(update) { texture.upload(); } } public void setColorToImage(int x, int y, int color) { texture.getPixels().setPixelRGBA(x, y, color); oldTextureMap[y][x] = color; } } public static RenderType createSkullRenderType(ResourceLocation location) { RenderType.CompositeState rendertype$compositestate = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_SHADER) .setTextureState(new RenderStateShard.TextureStateShard(location, false, false)) .setTransparencyState(TRANSLUCENT_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP) .setOverlayState(OVERLAY) .createCompositeState(true); return RenderType.create(Main.MODID + "_head", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, rendertype$compositestate); }
  2. Hi I try to get custom entity to a specific position which is located above the diamond block, but the entity stops next to the block and doesn't continue. Where is the problem? How can I get my entity to position above the diamond block? https://imgur.com/6dzbt6J Custom goal: public class TestMoveToPositionGoal extends Goal { protected MiniGolemEntity mob; protected BlockPos blockPos; protected int index; protected int tryTicks; public TestMoveToPositionGoal(MiniGolemEntity entity, int index) { this.mob = entity; this.index = index; this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.JUMP)); blockPos = new BlockPos(8, -60, -19); } @Override public void tick() { super.tick(); if(!blockPos.closerThan(this.mob.position(), 1D)) { this.tryTicks++; if(this.shouldRecalculatePath()) { System.out.println("recalculate"); mob.getNavigation().moveTo(blockPos.getX() + 0.5D, blockPos.getY(), blockPos.getZ() + 0.5D, 1F); } } else { this.tryTicks--; mob.getNavigation().stop(); mob.chanceStatus(index); System.out.println("finish"); } } @Override public void start() { super.start(); tryTicks = 0; } public boolean shouldRecalculatePath() { return this.tryTicks % 40 == 0; } @Override public boolean canUse() { return mob.canUseGoal(index); } } Entity only recalculate path, but doesn't move. I know. I can solve it by increasing the radius, but I don't want to.
  3. Hi. I update my mod from 1.15.2 to 1.16.1 and in 1.16.1 version I see "button" behind my text. I dont know how this solved Screen init: @Override public void func_231160_c_() { super.func_231160_c_(); this.func_230480_a_(new Slider(this.guiLeft + 84, this.guiTop + 26, 85, 10, new StringTextComponent("Red: "), new StringTextComponent(""), 0, 255, this.container.tile.red, false, true, slider -> { })); this.func_230480_a_(new Slider(this.guiLeft + 84, this.guiTop + 38, 85, 10, new StringTextComponent("Green: "), new StringTextComponent(""), 0, 255, this.container.tile.green, false, true, slider -> { })); this.func_230480_a_(new Slider(this.guiLeft + 84, this.guiTop + 50, 85, 10, new StringTextComponent("Blue: "), new StringTextComponent(""), 0, 255, this.container.tile.blue, false, true, slider -> { })); }
  4. Yeah sorry https://github.com/grossik/FarmCraft/blob/master/src/main/resources/assets/farmcraft/models/block/boiling.blend
  5. https://github.com/grossik/FarmCraft/blob/master/src/main/resources/assets/farmcraft/models/block/boiling.obj
  6. I try recalculate outside (Mesh -> Normals -> Recalculate outside) but not work. I also tried to recalculate inside and set from faces but nothing worked.
  7. Hi. I create Blender model, But I don't understand why it's hollow? And JSON is: { "parent": "forge:block/default", "loader": "forge:obj", "model": "farmcraft:models/block/boiling.obj", "flip-v": true, "transform": { "scale": [0.375, 0.375, 0.375], "translation": [0.4, -0.5, 0.4] } } This problem occurs when they start to change model in modeling tab in blender. And if I add a normal cube without changes so it works.
  8. Hi. I need to use more texture layers for my item, but only 5 layers will load. Minecraft minecraft = Minecraft.getInstance(); ItemColors colors = minecraft.getItemColors(); colors.register((p_210242_0_, p_210242_1_) -> { if(p_210242_0_.getItem() == ItemInit.LABEL.get()) { return ((LabelItem) p_210242_0_.getItem()).getColor(p_210242_0_, p_210242_1_); } return -1; }, ItemInit.LABEL.get()); Item json: { "parent": "item/generated", "textures": { "layer0": "realistic_beer_brewing:items/label/layer0", "layer1": "realistic_beer_brewing:items/label/layer1", "layer2": "realistic_beer_brewing:items/label/layer2", "layer3": "realistic_beer_brewing:items/label/layer3", "layer4": "realistic_beer_brewing:items/label/layer4", "layer5": "realistic_beer_brewing:items/label/layer5", "layer6": "realistic_beer_brewing:items/label/layer6", "layer7": "realistic_beer_brewing:items/label/layer7", "layer8": "realistic_beer_brewing:items/label/layer8" } } Is the number of layers limited or why doesn't it work for me?
  9. Hello. I have transferStackInSlot method and use hasRecipe for find if itemstack is present in recipe. @Override public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.inventorySlots.get(index); if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if(index == 2) { if(!this.mergeItemStack(itemstack1, 3, 39, true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if(index != 1 && index != 0) { if(this.hasRecipe(itemstack1)) { if(!this.mergeItemStack(itemstack1, 1, 2, false)) { return ItemStack.EMPTY; } } else if(this.isBucket(itemstack1)) { if(!this.mergeItemStack(itemstack1, 0, 1, false)) { return ItemStack.EMPTY; } } else if(index >= 3 && index < 30) { if(!this.mergeItemStack(itemstack1, 30, 39, false)) { return ItemStack.EMPTY; } } else if(index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return ItemStack.EMPTY; } } else if(!this.mergeItemStack(itemstack1, 3, 39, false)) { return ItemStack.EMPTY; } if(itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if(itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(playerIn, itemstack1); } return itemstack; } protected boolean hasRecipe(ItemStack stack) { return this.world.getRecipeManager().getRecipe(MaltingRecipe.RECIPE_TYPE, new Inventory(stack), world).isPresent(); } But hasRecipe return false for all itemstack, but i have recipe who works. Recipe: { "type": "realistic_beer_brewing:malting", "ingredient": { "item": "realistic_beer_brewing:barley" }, "result": { "item": "realistic_beer_brewing:barley_seed" }, "process_time": 200 } Recipe in this tile entity works.
  10. Oh... sorry Yes. If you use VillagerInit#init then it will work for you.
  11. https://github.com/grossik/FarmCraft/blob/master/src/main/java/cz/grossik/farmcraft/test/TestStructures.java
  12. I wanted it over json, but ok... Any good way to split a model? Or will I have to do it for each file separately?
  13. I use 1.15.2-31.1.63 forge version And the problem was that this obj files is too large and render for all 8 blocks... Can I change the start position from which it will be loading obj model?
×
×
  • Create New...

Important Information

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