need some help with my duping mod

Started by Dimensional_Hole on

Topic category: Help with modding (Java Edition)

Last seen on 14:21, 7. Sep 2024
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
need some help with my duping mod

So i made a mod with a duplication device but it seems to be broken in some way.

since i don't know how to share that broken mod here, i can't do that.

Last seen on 00:45, 16. Apr 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
As you didn't add a…
Fri, 03/25/2022 - 19:13

As you didn't add a screenshot, this may not be good advice

 

Maybe you could make it so you put an item into the block or item and then every so often it spawns a gem of the item on the ground, Idk how you'd add nbt data to the gem

Last seen on 13:59, 29. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I made a great bedrock…
Mon, 03/28/2022 - 07:29

I made a great bedrock texture for a ore duplicator!

Last seen on 13:59, 29. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could this be what your…
Mon, 03/28/2022 - 07:43

Could this be what your looking for:

The 200 is how many ticks it takes to run

The 100 is how much power it needs

The 2 is how many per input it makes

The first 1 is the output slot

The other 1 is the amount of items required to duplicate

The 0s are the item to duplicate slot

Last seen on 13:59, 29. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Code generated: package net…
Mon, 03/28/2022 - 07:47

Code generated:

package net.mcreator.ender.procedures;

/* imports omitted */

public class TESTProcedure {
    public static void execute(LevelAccessor world, double x, double y, double z) {
        new Object() {
            private int ticks = 0;
            private float waitTicks;
            private LevelAccessor world;

            public void start(LevelAccessor world, int waitTicks) {
                this.waitTicks = waitTicks;
                MinecraftForge.EVENT_BUS.register(this);
                this.world = world;
            }

            @SubscribeEvent
            public void tick(TickEvent.ServerTickEvent event) {
                if (event.phase == TickEvent.Phase.END) {
                    this.ticks += 1;
                    if (this.ticks >= this.waitTicks)
                        run();
                }
            }

            private void run() {
                if (new Object() {
                    public int extractEnergySimulate(LevelAccessor level, BlockPos pos, int _amount) {
                        AtomicInteger _retval = new AtomicInteger(0);
                        BlockEntity _ent = level.getBlockEntity(pos);
                        if (_ent != null)
                            _ent.getCapability(CapabilityEnergy.ENERGY, null)
                                    .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
                        return _retval.get();
                    }
                }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), 100) == 100) {
                    {
                        BlockEntity _ent = world.getBlockEntity(new BlockPos((int) x, (int) y, (int) z));
                        int _amount = 100;
                        if (_ent != null)
                            _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
                    }
                    {
                        BlockEntity _ent = world.getBlockEntity(new BlockPos((int) x, (int) y, (int) z));
                        if (_ent != null) {
                            final int _sltid = 1;
                            final ItemStack _setstack = (new Object() {
                                public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int sltid) {
                                    AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
                                    BlockEntity _ent = world.getBlockEntity(pos);
                                    if (_ent != null) {
                                        _ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
                                            _retval.set(capability.getStackInSlot(sltid).copy());
                                        });
                                    }
                                    return _retval.get();
                                }
                            }.getItemStack(world, new BlockPos((int) x, (int) y, (int) z), 0));
                            _setstack.setCount(2);
                            _ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
                                if (capability instanceof IItemHandlerModifiable) {
                                    ((IItemHandlerModifiable) capability).setStackInSlot(_sltid, _setstack);
                                }
                            });
                        }
                    }
                    {
                        BlockEntity _ent = world.getBlockEntity(new BlockPos((int) x, (int) y, (int) z));
                        if (_ent != null) {
                            final int _sltid = 0;
                            final int _amount = 1;
                            _ent.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).ifPresent(capability -> {
                                if (capability instanceof IItemHandlerModifiable) {
                                    ItemStack _stk = capability.getStackInSlot(_sltid).copy();
                                    _stk.shrink(_amount);
                                    ((IItemHandlerModifiable) capability).setStackInSlot(_sltid, _stk);
                                }
                            });
                        }
                    }
                } else {
                    EnderMod.LOGGER.info(("Not enough power at " + x + ", " + y + ", " + z));
                }
                MinecraftForge.EVENT_BUS.unregister(this);
            }
        }.start(world, 200);
    }
}

Last seen on 13:59, 29. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
??????????????????????????…
Mon, 03/28/2022 - 07:47

??????????????????????????

Share-x Screen shot failed to send

Last seen on 13:59, 29. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What about this:
Mon, 03/28/2022 - 07:50

What about this: