Jump to content

How do you render non-living entities


starwarsmace

Recommended Posts

Just like any other entity.

See I tried that but all that came up is a white rectangular prism.

 

Renderer

public class RenderGoldMine extends RenderEntity{
    
protected ModelBase modelMine = new ModelGold_lvl1();
    public static int lvl;
public RenderGoldMine(ModelBase modelMine)
    {
        super();
        
        //this.lvl=lvl;
        
    }


    private static final ResourceLocation Your_Texture = new ResourceLocation("rotten_flesh_mod:textures/entity/tamedZombie_"+lvl+".png");  //refers to:assets/yourmod/textures/entity/yourtexture.png


    @Override
    protected ResourceLocation getEntityTexture(Entity par1Entity)
    {
    	
    	return Your_Texture;
    }
    public void doRender(EntityGoldMine p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
    	this.modelMine.render(p_76986_1_, 0.0F, 0.0F, 0F, 0.0F, 0.0F, 0F);
    }

}

 

Model

public class ModelGold_lvl1 extends ModelBase
{
  //fields
    ModelRenderer minePart1;
    ModelRenderer minePart2;
    ModelRenderer minePart3;
    ModelRenderer minePart4;
    ModelRenderer minePart5;
    ModelRenderer minePart6;
    ModelRenderer minePart7;
    ModelRenderer minePart8;
    ModelRenderer minePart9;
    ModelRenderer minePart10;
    ModelRenderer minePart11;
    ModelRenderer minePart12;
    ModelRenderer minePart13;
    ModelRenderer minePart14;
    ModelRenderer minePart15;
    ModelRenderer minePart16;
    ModelRenderer floor;
    ModelRenderer railPart1;
    ModelRenderer railPart2;
    ModelRenderer railPart3;
    ModelRenderer railPart4;
    ModelRenderer railPart5;
    ModelRenderer railPart6;
    ModelRenderer railPart7;
    ModelRenderer railPart8;
    ModelRenderer railPart9;
    ModelRenderer railPart10;
    ModelRenderer railPart11;
    ModelRenderer railPart12;
    ModelRenderer minecartWheel1;
    ModelRenderer minecratWheel2;
    ModelRenderer minecartWheel3;
    ModelRenderer minecartWheel4;
    ModelRenderer minecartPart1;
    ModelRenderer minecartPart2;
    ModelRenderer minecartPart3;
    ModelRenderer minecartPart4;
    ModelRenderer minecartPart5;
    ModelRenderer minecartPart6;
    ModelRenderer collectingBoxPart1;
    ModelRenderer collectingBoxPart2;
    ModelRenderer collectingBoxPart3;
    ModelRenderer collectingBoxPart4;
  
  public ModelGold_lvl1()
  {
    textureWidth = 512;
    textureHeight = 256;
    
      minePart1 = new ModelRenderer(this, 143, 0);
      minePart1.addBox(0F, 0F, 0F, 1, 5, 28);
      minePart1.setRotationPoint(18F, 19F, -14F);
      minePart1.setTextureSize(64, 32);
      minePart1.mirror = true;
      setRotation(minePart1, 0F, 0F, 0F);
      minePart2 = new ModelRenderer(this, 201, 0);
      minePart2.addBox(0F, 0F, 0F, 28, 5, 2);
      minePart2.setRotationPoint(-9F, 19F, -15F);
      minePart2.setTextureSize(64, 32);
      minePart2.mirror = true;
      setRotation(minePart2, 0F, 0F, 0F);
      minePart3 = new ModelRenderer(this, 201, 7);
      minePart3.addBox(0F, 0F, 0F, 30, 5, 2);
      minePart3.setRotationPoint(-4F, 0F, -15F);
      minePart3.setTextureSize(64, 32);
      minePart3.mirror = true;
      setRotation(minePart3, 0F, 0F, 0.6981317F);
      minePart4 = new ModelRenderer(this, 201, 14);
      minePart4.addBox(0F, 0F, 0F, 20, 5, 2);
      minePart4.setRotationPoint(-4F, 6F, -15F);
      minePart4.setTextureSize(64, 32);
      minePart4.mirror = true;
      setRotation(minePart4, 0F, 0F, 0.6981317F);
      minePart5 = new ModelRenderer(this, 201, 21);
      minePart5.addBox(0F, 0F, 0F, 10, 5, 2);
      minePart5.setRotationPoint(-4F, 13F, -15F);
      minePart5.setTextureSize(64, 32);
      minePart5.mirror = true;
      setRotation(minePart5, 0F, 0F, 0.6981317F);
      minePart6 = new ModelRenderer(this, 265, 0);
      minePart6.addBox(0F, 0F, 0F, 5, 24, 2);
      minePart6.setRotationPoint(-9F, 0F, -15F);
      minePart6.setTextureSize(64, 32);
      minePart6.mirror = true;
      setRotation(minePart6, 0F, 0F, 0F);
      minePart7 = new ModelRenderer(this, 225, 21);
      minePart7.addBox(0F, 0F, 0F, 12, 5, 2);
      minePart7.setRotationPoint(-4F, 12F, -15F);
      minePart7.setTextureSize(64, 32);
      minePart7.mirror = true;
      setRotation(minePart7, 0F, 0F, 0.6981317F);
      minePart8 = new ModelRenderer(this, 279, 0);
      minePart8.addBox(0F, 0F, 0F, 28, 5, 2);
      minePart8.setRotationPoint(-9F, 19F, 13F);
      minePart8.setTextureSize(64, 32);
      minePart8.mirror = true;
      setRotation(minePart8, 0F, 0F, 0F);
      minePart9 = new ModelRenderer(this, 339, 0);
      minePart9.addBox(0F, 0F, 0F, 5, 24, 2);
      minePart9.setRotationPoint(-9F, 0F, 13F);
      minePart9.setTextureSize(64, 32);
      minePart9.mirror = true;
      setRotation(minePart9, 0F, 0F, 0F);
      minePart10 = new ModelRenderer(this, 279, 7);
      minePart10.addBox(0F, 0F, 0F, 10, 5, 2);
      minePart10.setRotationPoint(-4F, 13F, 13F);
      minePart10.setTextureSize(64, 32);
      minePart10.mirror = true;
      setRotation(minePart10, 0F, 0F, 0.6981317F);
      minePart11 = new ModelRenderer(this, 279, 14);
      minePart11.addBox(0F, 0F, 0F, 20, 5, 2);
      minePart11.setRotationPoint(-4F, 6F, 13F);
      minePart11.setTextureSize(64, 32);
      minePart11.mirror = true;
      setRotation(minePart11, 0F, 0F, 0.6981317F);
      minePart12 = new ModelRenderer(this, 353, 0);
      minePart12.addBox(0F, 0F, 0F, 30, 5, 2);
      minePart12.setRotationPoint(-4F, 0F, 13F);
      minePart12.setTextureSize(64, 32);
      minePart12.mirror = true;
      setRotation(minePart12, 0F, 0F, 0.6981317F);
      minePart13 = new ModelRenderer(this, 303, 7);
      minePart13.addBox(0F, 0F, 0F, 12, 5, 2);
      minePart13.setRotationPoint(-4F, 12F, 13F);
      minePart13.setTextureSize(64, 32);
      minePart13.mirror = true;
      setRotation(minePart13, 0F, 0F, 0.6981317F);
      minePart14 = new ModelRenderer(this, 0, 40);
      minePart14.addBox(0F, 0F, 0F, 30, 1, 28);
      minePart14.setRotationPoint(-4F, 0F, -14F);
      minePart14.setTextureSize(64, 32);
      minePart14.mirror = true;
      setRotation(minePart14, 0F, 0F, 0.6981317F);
      minePart15 = new ModelRenderer(this, 0, 69);
      minePart15.addBox(0F, 0F, 0F, 5, 1, 28);
      minePart15.setRotationPoint(-9F, 0F, -14F);
      minePart15.setTextureSize(64, 32);
      minePart15.mirror = true;
      setRotation(minePart15, 0F, 0F, 0F);
      minePart16 = new ModelRenderer(this, 0, 98);
      minePart16.addBox(0F, 0F, 0F, 0, 14, 26);
      minePart16.setRotationPoint(7F, 10F, -13F);
      minePart16.setTextureSize(64, 32);
      minePart16.mirror = true;
      setRotation(minePart16, 0F, 0F, 0F);
      floor = new ModelRenderer(this, 0, 0);
      floor.addBox(0F, 0F, 0F, 43, 0, 28);
      floor.setRotationPoint(-24F, 24F, -13F);
      floor.setTextureSize(64, 32);
      floor.mirror = true;
      setRotation(floor, 0F, 0F, 0F);
      railPart1 = new ModelRenderer(this, 0, 28);
      railPart1.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart1.setRotationPoint(-23F, 23F, -2F);
      railPart1.setTextureSize(64, 32);
      railPart1.mirror = true;
      setRotation(railPart1, 0F, 0F, 0F);
      railPart2 = new ModelRenderer(this, 16, 28);
      railPart2.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart2.setRotationPoint(-20F, 23F, -2F);
      railPart2.setTextureSize(64, 32);
      railPart2.mirror = true;
      setRotation(railPart2, 0F, 0F, 0F);
      railPart3 = new ModelRenderer(this, 32, 28);
      railPart3.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart3.setRotationPoint(-17F, 23F, -2F);
      railPart3.setTextureSize(64, 32);
      railPart3.mirror = true;
      setRotation(railPart3, 0F, 0F, 0F);
      railPart4 = new ModelRenderer(this, 48, 28);
      railPart4.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart4.setRotationPoint(-14F, 23F, -2F);
      railPart4.setTextureSize(64, 32);
      railPart4.mirror = true;
      setRotation(railPart4, 0F, 0F, 0F);
      railPart5 = new ModelRenderer(this, 64, 28);
      railPart5.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart5.setRotationPoint(-11F, 23F, -2F);
      railPart5.setTextureSize(64, 32);
      railPart5.mirror = true;
      setRotation(railPart5, 0F, 0F, 0F);
      railPart6 = new ModelRenderer(this, 80, 28);
      railPart6.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart6.setRotationPoint(-8F, 23F, -2F);
      railPart6.setTextureSize(64, 32);
      railPart6.mirror = true;
      setRotation(railPart6, 0F, 0F, 0F);
      railPart7 = new ModelRenderer(this, 96, 28);
      railPart7.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart7.setRotationPoint(-5F, 23F, -2F);
      railPart7.setTextureSize(64, 32);
      railPart7.mirror = true;
      setRotation(railPart7, 0F, 0F, 0F);
      railPart8 = new ModelRenderer(this, 112, 28);
      railPart8.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart8.setRotationPoint(-2F, 23F, -2F);
      railPart8.setTextureSize(64, 32);
      railPart8.mirror = true;
      setRotation(railPart8, 0F, 0F, 0F);
      railPart9 = new ModelRenderer(this, 127, 36);
      railPart9.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart9.setRotationPoint(1F, 23F, -2F);
      railPart9.setTextureSize(64, 32);
      railPart9.mirror = true;
      setRotation(railPart9, 0F, 0F, 0F);
      railPart10 = new ModelRenderer(this, 127, 44);
      railPart10.addBox(0F, 0F, 0F, 1, 1, 7);
      railPart10.setRotationPoint(4F, 23F, -2F);
      railPart10.setTextureSize(64, 32);
      railPart10.mirror = true;
      setRotation(railPart10, 0F, 0F, 0F);
      railPart11 = new ModelRenderer(this, 0, 36);
      railPart11.addBox(0F, 0F, 0F, 40, 1, 2);
      railPart11.setRotationPoint(-24F, 23F, 4F);
      railPart11.setTextureSize(64, 32);
      railPart11.mirror = true;
      setRotation(railPart11, 0F, 0F, 0F);
      railPart12 = new ModelRenderer(this, 417, 0);
      railPart12.addBox(0F, 0F, 0F, 40, 1, 2);
      railPart12.setRotationPoint(-24F, 23F, -3F);
      railPart12.setTextureSize(64, 32);
      railPart12.mirror = true;
      setRotation(railPart12, 0F, 0F, 0F);
      minecartWheel1 = new ModelRenderer(this, 84, 36);
      minecartWheel1.addBox(0F, 0F, 0F, 3, 3, 1);
      minecartWheel1.setRotationPoint(-18F, 20F, -2.5F);
      minecartWheel1.setTextureSize(64, 32);
      minecartWheel1.mirror = true;
      setRotation(minecartWheel1, 0F, 0F, 0F);
      minecratWheel2 = new ModelRenderer(this, 92, 36);
      minecratWheel2.addBox(0F, 0F, 0F, 3, 3, 1);
      minecratWheel2.setRotationPoint(-18F, 20F, 4.5F);
      minecratWheel2.setTextureSize(64, 32);
      minecratWheel2.mirror = true;
      setRotation(minecratWheel2, 0F, 0F, 0F);
      minecartWheel3 = new ModelRenderer(this, 100, 36);
      minecartWheel3.addBox(0F, 0F, 0F, 3, 3, 1);
      minecartWheel3.setRotationPoint(-23F, 20F, 4.5F);
      minecartWheel3.setTextureSize(64, 32);
      minecartWheel3.mirror = true;
      setRotation(minecartWheel3, 0F, 0F, 0F);
      minecartWheel4 = new ModelRenderer(this, 108, 36);
      minecartWheel4.addBox(0F, 0F, 0F, 3, 3, 1);
      minecartWheel4.setRotationPoint(-23F, 20F, -2.5F);
      minecartWheel4.setTextureSize(64, 32);
      minecartWheel4.mirror = true;
      setRotation(minecartWheel4, 0F, 0F, 0F);
      minecartPart1 = new ModelRenderer(this, 143, 33);
      minecartPart1.addBox(0F, 0F, 0F, 10, 0, 6);
      minecartPart1.setRotationPoint(-24F, 18F, -1.5F);
      minecartPart1.setTextureSize(64, 32);
      minecartPart1.mirror = true;
      setRotation(minecartPart1, 0F, 0F, 0F);
      minecartPart2 = new ModelRenderer(this, 143, 39);
      minecartPart2.addBox(0F, 0F, 0F, 10, 1, 6);
      minecartPart2.setRotationPoint(-24F, 21F, -1.5F);
      minecartPart2.setTextureSize(64, 32);
      minecartPart2.mirror = true;
      setRotation(minecartPart2, 0F, 0F, 0F);
      minecartPart3 = new ModelRenderer(this, 143, 46);
      minecartPart3.addBox(0F, 0F, 0F, 10, 5, 1);
      minecartPart3.setRotationPoint(-24F, 16F, 3.5F);
      minecartPart3.setTextureSize(64, 32);
      minecartPart3.mirror = true;
      setRotation(minecartPart3, 0F, 0F, 0F);
      minecartPart4 = new ModelRenderer(this, 117, 36);
      minecartPart4.addBox(0F, 0F, 0F, 1, 5, 4);
      minecartPart4.setRotationPoint(-24F, 16F, -0.5F);
      minecartPart4.setTextureSize(64, 32);
      minecartPart4.mirror = true;
      setRotation(minecartPart4, 0F, 0F, 0F);
      minecartPart5 = new ModelRenderer(this, 117, 45);
      minecartPart5.addBox(0F, 0F, 0F, 1, 5, 4);
      minecartPart5.setRotationPoint(-15F, 16F, -0.5F);
      minecartPart5.setTextureSize(64, 32);
      minecartPart5.mirror = true;
      setRotation(minecartPart5, 0F, 0F, 0F);
      minecartPart6 = new ModelRenderer(this, 201, 28);
      minecartPart6.addBox(0F, 0F, 0F, 10, 5, 1);
      minecartPart6.setRotationPoint(-24F, 16F, -1.5F);
      minecartPart6.setTextureSize(64, 32);
      minecartPart6.mirror = true;
      setRotation(minecartPart6, 0F, 0F, 0F);
      collectingBoxPart1 = new ModelRenderer(this, 133, 30);
      collectingBoxPart1.addBox(0F, 0F, 0F, 1, 2, 4);
      collectingBoxPart1.setRotationPoint(-23F, 22F, -10F);
      collectingBoxPart1.setTextureSize(64, 32);
      collectingBoxPart1.mirror = true;
      setRotation(collectingBoxPart1, 0F, 0F, 0F);
      collectingBoxPart2 = new ModelRenderer(this, 127, 52);
      collectingBoxPart2.addBox(0F, 0F, 0F, 10, 2, 1);
      collectingBoxPart2.setRotationPoint(-23F, 22F, -6F);
      collectingBoxPart2.setTextureSize(64, 32);
      collectingBoxPart2.mirror = true;
      setRotation(collectingBoxPart2, 0F, 0F, 0F);
      collectingBoxPart3 = new ModelRenderer(this, 245, 14);
      collectingBoxPart3.addBox(0F, 0F, 0F, 1, 2, 4);
      collectingBoxPart3.setRotationPoint(-14F, 22F, -10F);
      collectingBoxPart3.setTextureSize(64, 32);
      collectingBoxPart3.mirror = true;
      setRotation(collectingBoxPart3, 0F, 0F, 0F);
      collectingBoxPart4 = new ModelRenderer(this, 175, 33);
      collectingBoxPart4.addBox(0F, 0F, 0F, 10, 2, 1);
      collectingBoxPart4.setRotationPoint(-23F, 22F, -11F);
      collectingBoxPart4.setTextureSize(64, 32);
      collectingBoxPart4.mirror = true;
      setRotation(collectingBoxPart4, 0F, 0F, 0F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5,entity);
    minePart1.render(f5);
    minePart2.render(f5);
    minePart3.render(f5);
    minePart4.render(f5);
    minePart5.render(f5);
    minePart6.render(f5);
    minePart7.render(f5);
    minePart8.render(f5);
    minePart9.render(f5);
    minePart10.render(f5);
    minePart11.render(f5);
    minePart12.render(f5);
    minePart13.render(f5);
    minePart14.render(f5);
    minePart15.render(f5);
    minePart16.render(f5);
    floor.render(f5);
    railPart1.render(f5);
    railPart2.render(f5);
    railPart3.render(f5);
    railPart4.render(f5);
    railPart5.render(f5);
    railPart6.render(f5);
    railPart7.render(f5);
    railPart8.render(f5);
    railPart9.render(f5);
    railPart10.render(f5);
    railPart11.render(f5);
    railPart12.render(f5);
    minecartWheel1.render(f5);
    minecratWheel2.render(f5);
    minecartWheel3.render(f5);
    minecartWheel4.render(f5);
    minecartPart1.render(f5);
    minecartPart2.render(f5);
    minecartPart3.render(f5);
    minecartPart4.render(f5);
    minecartPart5.render(f5);
    minecartPart6.render(f5);
    collectingBoxPart1.render(f5);
    collectingBoxPart2.render(f5);
    collectingBoxPart3.render(f5);
    collectingBoxPart4.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5,Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5,entity);
  }

}

And yes I registered my entities and I know they are rendering in the client proxy.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

Is it possible to make tile entities more than one block wide. And make it like 3x3x3?

 

Technically.  It's generally considered not a good idea and to create several "technical blocks" that render the remaining portions.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I made a block entity in forge 1.20.1, I want to prevent hopper from taking input slot item, i tried to override the extractItem method, it prevented hopper from taking input slot item, but the player also unable to take/change the item in input slot unless the slot is empty. public class FluidSeparatorBlockEntity extends BlockEntity implements MenuProvider { private static final int INPUT_SLOT = 0; private final CustomItemHandler itemHandler = new CustomItemHandler(3){ @Override protected void onContentsChanged(int slot) { setChanged(); } @Override public boolean isItemValid(int slot, @NotNull ItemStack stack) { return slot == INPUT_SLOT; } @Override public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate) { if (slot == INPUT_SLOT) { return ItemStack.EMPTY; } return super.extractItem(slot, amount, simulate); } }; private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty(); protected final ContainerData data; private int progress = 0; private int maxProgress = 78; public FluidSeparatorBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.FLUID_SEPARATOR_BE.get(), pPos, pBlockState); this.data = new ContainerData() { @Override public int get(int pIndex) { return switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress; default -> 0; }; } @Override public void set(int pIndex, int pValue) { switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress = pValue; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress = pValue; } } @Override public int getCount() { return 3; } }; } @Override public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { if(cap == ForgeCapabilities.ITEM_HANDLER) { return lazyItemHandler.cast(); } return super.getCapability(cap, side); } @Override public void onLoad() { super.onLoad(); lazyItemHandler = LazyOptional.of(() -> itemHandler); } @Override public void invalidateCaps() { super.invalidateCaps(); lazyItemHandler.invalidate(); } public void drops() { SimpleContainer inventory = new SimpleContainer(itemHandler.getSlots()); for(int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, itemHandler.getStackInSlot(i)); } Containers.dropContents(this.level, this.worldPosition, inventory); } @Override public Component getDisplayName() { return Component.translatable("block.chemmaster.fluid_separator"); } @Nullable @Override public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) { return new FluidSeparatorMenu(pContainerId, pPlayerInventory, this, this.data); } @Override protected void saveAdditional(CompoundTag pTag) { pTag.put("inventory", itemHandler.serializeNBT()); pTag.putInt("fluid_separator.progress", progress); super.saveAdditional(pTag); } @Override public void load(CompoundTag pTag) { super.load(pTag); itemHandler.deserializeNBT(pTag.getCompound("inventory")); progress = pTag.getInt("fluid_separator.progress"); } public void tick(Level pLevel, BlockPos pPos, BlockState pState) { ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { resetProgress(); return; } if(hasRecipe()) { increaseCraftingProgress(); setChanged(pLevel, pPos, pState); if(hasProgressFinished()) { craftItem(); resetProgress(); } } else { resetProgress(); } } private void resetProgress() { progress = 0; } private void craftItem() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isPresent()) { List<ItemStack> results = recipe.get().getOutputs(); ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { // If there are not enough items, do not proceed with crafting return; } // Extract the input item from the input slot this.itemHandler.internalExtractItem(INPUT_SLOT, 2, false); // Loop through each result item and find suitable output slots for (ItemStack result : results) { int outputSlot = findSuitableOutputSlot(result); if (outputSlot != -1) { this.itemHandler.setStackInSlot(outputSlot, new ItemStack(result.getItem(), this.itemHandler.getStackInSlot(outputSlot).getCount() + result.getCount())); } else { // Handle the case where no suitable output slot is found // This can be logging an error, throwing an exception, or any other handling logic System.err.println("No suitable output slot found for item: " + result); } } } } private int findSuitableOutputSlot(ItemStack result) { // Implement logic to find a suitable output slot for the given result // Return the slot index or -1 if no suitable slot is found for (int i = 0; i < this.itemHandler.getSlots(); i++) { // Ensure we do not place the output item in the input slot if (i == INPUT_SLOT) { continue; } ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return i; } } return -1; } private boolean hasRecipe() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isEmpty()) { return false; } List<ItemStack> results = recipe.get().getOutputs(); for (ItemStack result : results) { if (!canInsertAmountIntoOutputSlot(result) || !canInsertItemIntoOutputSlot(result.getItem())) { return false; } } return true; } private Optional<FluidSeparatingRecipe> getCurrentRecipe(){ SimpleContainer inventory = new SimpleContainer(this.itemHandler.getSlots()); for (int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, this.itemHandler.getStackInSlot(i)); } return this.level.getRecipeManager().getRecipeFor(FluidSeparatingRecipe.Type.INSTANCE, inventory, level); } private boolean canInsertAmountIntoOutputSlot(ItemStack result) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return true; } } return false; } private boolean canInsertItemIntoOutputSlot(Item item) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || stackInSlot.getItem() == item) { return true; } } return false; } private boolean hasProgressFinished() { return progress >= maxProgress; } private void increaseCraftingProgress() { progress++; } }  
    • No dice. Unfortunately this fix didn't work, thank you though.
    • Maybe you need a rayon mod. https://www.curseforge.com/minecraft/mc-mods/rayon
    • Not sure what's going on the logs are making even less sense than usual to me. Any help would be much appreciated.   https://paste.ee/p/KBHyP#s=0
  • Topics

×
×
  • Create New...

Important Information

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