Jump to content

[1.8] [SOLVED] TileEntity method updateEntity() doesn't exist?


Ferrettomato

Recommended Posts

I'm attempting to create a TileEntity (for the first time), but apparently the TileEntity class no longer contains the updateEntity() method. I can't find information anywhere on why this is or what I can use in its place. Could anyone shed some light on this? Apologies if it's clearly posted somewhere or if I've made some unnoticeable typo, but I honestly don't know what's going on.

Link to comment
Share on other sites

Okay, I've done that and it seems to like it, but now, when I try to get it to do what it does in the tick method, nothing happens. The method is never called, according to the println at the beginning. I know that other methods, such as "editCounter", are being correctly called, since it prints "Switch" when I right click the block (hence, the entity IS working with the block as intended to that extent), but there's no "Tick". What's wrong this time?

 

TileEntityFerret class:

package com.ferret.myfirstmod;

import net.minecraft.block.Block;
import net.minecraft.block.BlockJukebox;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.tileentity.TileEntityBrewingStand;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.tileentity.TileEntityComparator;
import net.minecraft.tileentity.TileEntityDaylightDetector;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.tileentity.TileEntityEnchantmentTable;
import net.minecraft.tileentity.TileEntityEndPortal;
import net.minecraft.tileentity.TileEntityEnderChest;
import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.tileentity.TileEntityNote;
import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.tileentity.TileEntitySkull;

public class TileEntityFerret extends TileEntity implements ITickable
{
private int counter = 0;
private int metadata;
private IBlockState state;
private boolean counterEnabled = true;

@Override
public void tick() {
	System.out.println("Tick");
	if(counterEnabled)
	{
		counter++;

		if(counter > 20)
		{
			counter = 0;

			metadata = this.getBlockMetadata() + 1;

			if(metadata > 9)
			{
				metadata = 0;
			}

			if(!worldObj.isRemote)
			{
				worldObj.setBlockState(pos, worldObj.getBlockState(pos).getBlock().getStateFromMeta(metadata));
				System.out.println("Block changed!");
			}
		}
	}
}

public void editCounter()
{
	System.out.println("Switch");
	counterEnabled = !counterEnabled;
	markDirty();
	worldObj.markBlockForUpdate(pos);
}

@Override
public void readFromNBT (NBTTagCompound tag)
{
	super.readFromNBT(tag);

	counter = tag.getInteger("counter");
	counterEnabled = tag.getBoolean("counterEnabled");
}

@Override
public void writeToNBT(NBTTagCompound tag)
{
	super.writeToNBT(tag);

	tag.setInteger("counter", counter);
	tag.setBoolean("counterEnabled", counterEnabled);
}

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
	this.readFromNBT(packet.getNbtCompound());
}

@Override
public Packet getDescriptionPacket()
{
	NBTTagCompound var1 = new NBTTagCompound();

	this.writeToNBT(var1);

	return new S35PacketUpdateTileEntity(pos, 1, var1);
}
}

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.