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.

Featured Replies

Posted

K, so i have a tile that I want to have different effects, but it wont change the variable that selects which effect! I'm using

TileHydroTorch htorch = (TileHydroTorch)icommandsender.getEntityWorld().getTileEntity(x,y,z);
			  if(Integer.parseInt(commands[3]) > 2 || Integer.parseInt(commands[3]) < 0 || Integer.parseInt(commands[3]) != (int)Integer.parseInt(commands[3]))
			  htorch.state = (Integer.parseInt(commands[3]));

to grab the tile from the world and set the variable, but it does nothing. I tried some

System.out.println("did such and such");

's and they say that htorch.state was called. But whenever I check the tile, it isnt changed! HELP!

tile code

package com.rabidfox.syntheticgems;

import java.util.Random;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileHydroTorch extends TileEntity {
public int state;
public int ticksleft;
Random rdm = new Random();
public int getFacing() {
	return 0;

}
public TileHydroTorch(){
	ticksleft = 10;
	state = 0;
}
@Override
public void writeToNBT(NBTTagCompound nbt){
	super.writeToNBT(nbt);
	nbt.setInteger("state", state);
}
@Override
public void readFromNBT(NBTTagCompound nbt){
	super.readFromNBT(nbt);
	state = nbt.getInteger("state");
}

@Override
public void updateEntity(){
	ticksleft--;
	if(state > 2 || state < 0 || state != (int)state){
		System.err.println("The Hydrogen Torch at " + this.xCoord + this.yCoord + this.zCoord +" has an invalid state value of " + state + "! Must be 0(off), 1(spraying hydrogen), 2(spraying fire)! Use the setHydroTorchState command to fix it!");
	}
	if(state == 2){
		worldObj.spawnParticle("flame", xCoord +(rdm.nextFloat()/5) + (0.25F * 1.5), yCoord +0.5F, zCoord +(rdm.nextFloat()/5) + (0.25F * 1.5), 0.0D, -0.5D, 0.0D);
	}
	if(state == 1){
		if(ticksleft == 0){
		worldObj.spawnParticle("cloud", xCoord +(rdm.nextFloat()/2) + (0.25F * 1.5), yCoord +0.5F, zCoord +(rdm.nextFloat()/2) + (0.25F * 1.5), 0.0D, 0.03D, 0.0D);
		ticksleft = 10;

		}
	}

}
}

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.