Jump to content

[Solved] ITickable and TE's not ticking


GooberGunter

Recommended Posts

I created a tile entity and implemented the ITickable interface, overriding the tick method and used a logger to print out a statement to test if it's working and it isn't. I read on another post that the instance (can't remember the correct terminology) of ITickable has to be registered, unless it is for a tile entity which already registers it, so I'm not sure where to go next in fixing the problem. I know that the te is registered because I have no errors when overriding createTileEntity from the block class and the logger is printing that a new TE object was created whenever the block is placed. Am I missing something?

Edited by GooberGunter
Link to comment
Share on other sites

Tile Entity:

Spoiler

public class EnchNexTE extends TileEntity implements ITickable{
	
	@Override
	public void tick() {
		// TODO Auto-generated method stub
		System.out.println("HEY");
		Util.logger.info("hey:");
	}
}

 

Block:

Spoiler

package com.GooberGunter.GrandSorcery.common.block;

import com.GooberGunter.GrandSorcery.GSReferences;
import com.GooberGunter.GrandSorcery.common.block.tileentities.EnchNexTE;
import com.GooberGunter.GrandSorcery.common.utils.Util;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class EnchantingNexus extends Block{

	public EnchantingNexus(String registryName) {
		super(Material.ROCK);
		this.setRegistryName(registryName);
		this.setUnlocalizedName(GSReferences.MODID+"."+registryName);
		this.setHardness(2.0f);
		this.setResistance(6.0f);
		this.setHarvestLevel("pickaxe", 2);
		this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
	}
	
	@Override
	public boolean hasTileEntity(IBlockState state)
    {
        return true;
    }
	
	@Override
	public TileEntity createTileEntity(World world, IBlockState state) {
		Util.logger.info("new te");
		return new EnchNexTE();
	}
	
	
	@Override
	 public EnumBlockRenderType getRenderType(IBlockState state)
	    {
	        return EnumBlockRenderType.MODEL;
	    }
	
	
}

 

 

ModBlocks and Block Registry:

Spoiler

package com.GooberGunter.GrandSorcery.common.block;

import com.GooberGunter.GrandSorcery.common.block.tileentities.EnchNexTE;
import com.GooberGunter.GrandSorcery.common.utils.Util;

import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

public final class ModBlocks {
	public static Block enchantingNexus = new EnchantingNexus("enchanting_nexus");
	public static ItemBlock enchNexusItem = new ItemBlock(enchantingNexus);

	@Mod.EventBusSubscriber
	public static class BlockRegister{
		
		@SubscribeEvent
		public static void registerBlock(RegistryEvent.Register<Block> e) {
			e.getRegistry().registerAll(enchantingNexus);
			enchNexusItem.setRegistryName(enchantingNexus.getRegistryName());
			GameRegistry.registerTileEntity(EnchNexTE.class, "enchanting_nex_te");
			Util.logger.info("BLOCKS REGISTERED");
		}
	}
}

 

 

Link to comment
Share on other sites

You're (probably) using the net.minecraft.client.renderer.texture.ITickable interface, while you should be using the net.minecraft.util.ITickable.

  • Like 1

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.

Announcements



×
×
  • Create New...

Important Information

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