• Recently Browsing

    No registered users viewing this page.

  • Posts

    • 1.7 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Hello all, I'm trying to make a block that implements ITickableTileEntity and does something every minute, but tick() doesn't seem to be running at all.   I'm following McJte's tutorial series. The forge documentation mentions using net.minecraft.util.ITickable, but the IDE highlighting seems to suggest this doesn't exist.   // snip imports public class BaitStationTile extends TileEntity implements ITickableTileEntity, INamedContainerProvider { private LazyOptional<IItemHandler> handler = LazyOptional.of(this::createHandler); private int counter; public BaitStationTile() { super(BAIT_STATION_BLOCK_TILE.get()); } @Override public void tick() { // this line is not running LogManager.getLogger().debug("ticking Bait Station, remote: " + world.isRemote + "handler: " + handler.toString()); if (world.isRemote) { return; } handler.ifPresent(h -> { ItemStack stack = h.getStackInSlot(0); // snip functionality }); } private IItemHandler createHandler() { return new ItemStackHandler(1) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return BaitStation.baitEntities.exists(stack.getItem()); } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { // TODO fancy logic or something if (!BaitStation.baitEntities.exists(stack.getItem())) { return stack; } return super.insertItem(slot, stack, simulate); } }; } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return handler.cast(); } return super.getCapability(cap, side); } @Override public ITextComponent getDisplayName() { return new StringTextComponent(getType().getRegistryName().getPath()); } @Nullable @Override public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity playerEntity) { return new BaitStationContainer(i, world, pos, playerInventory, playerEntity); } }  
    • Hi,   What I want to do is to remove a Mob (Ghasts for example) when a world is created. I tried different things, I know how to code in C and I understand most of Java, but I don't understand everything in all the code I read from various topics in different forums. That is why I'm coming here to seek help.    The last thing I tried is this:   I put this method in my Main class and I wanted to test this with the Zombie Pigman. (My Mod loads perfectly for 1.12, I followed a tutorial on YouTube to set this up and create blocks and items. But I want to do something else like remove a specific mobs.)   I thank you in advance for reading this topic and for your help.
  • Topics

  • Who's Online (See full list)