Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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.

  • Author

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);
}
}

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.