Jump to content

Recommended Posts

Posted

Hiya! I am trying to work out some tileentity stuff and when I place down the thing and tile entity is created, it goes for both server and client, but when I save and quit and return, only the client one is loaded

 

	public void updateEntity(){
	if (!this.worldObj.isRemote){
		System.out.println("Isn't remote");
	}else{
		System.out.println("Is remote");
	}
	timetick--;
	if (timetick==0){
		this.exWorld = ExtendedWorld.create(this.worldObj);
		if (stem != null){
			this.exWorld.setBlock(this.stem, this.log);
			this.stem.updateNorm();

		}
		this.timetick = RandomFunctions.Int(40, 300);
	}
}

The only message I get is "Is remote" while the "Isn't remote" never pops up after I saved and quit, what could cause this?

Posted

	citrusStump = new NatureStump()
					.setLog(citrusLog)
					.setLeaf(citrusLeaves);
    	GameRegistry.registerBlock(citrusStump,"citrus stump");
    	LanguageRegistry.addName(citrusStump, "Citrus stump");
    	GameRegistry.registerTileEntity(TileEntityTreeBase.class,"TreeStump");

this is the part htat registers it (Yet I am working on custom made trees), it registers without issues when I start up, the tile entity si created upon creation of the block but when reloaded. it's gooooneeee :o

Posted

Yes, here is the entire code for it.

package aerosteam.tileentity.trees;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import aerosteam.blocks.nature.NatureStump;
import aerosteam.functions.ExtendedWorld;
import aerosteam.functions.IntPoint;
import aerosteam.functions.IntVec;
import aerosteam.functions.OmniDirection;
import aerosteam.functions.RandomFunctions;

public class TileEntityTreeBase extends TileEntity{
int Width;
int height;
public IntPoint[] branch = new IntPoint[20];
public IntPoint[] roots = new IntPoint[20];
int nrRoots = 0;
int nrBranches = 0;
public IntPoint stem;
ExtendedWorld exWorld;
public Block log;
public Block leaf;
public int leafSize=1;
int timetick = RandomFunctions.Int(40, 300);


public void updateEntity(){
	if (!this.worldObj.isRemote){
		//System.out.println("Isn't remote");
		timetick--;
		if (timetick==0){
			this.exWorld = ExtendedWorld.create(this.worldObj);
			if (stem != null){
				growth(this.worldObj,this.stem);
				this.stem.updateNorm();
				if (RandomFunctions.BoolInt(3, 5)){
					nrBranches++;
					IntVec placement = IntVec.makeIntVec(OmniDirection.getLevel(RandomFunctions.Int(1, ));
					//this.worldObj.setBlock(this.xCoord+1, this.yCoord+3, this.zCoord+1, this.log);
					placement.sizeSelfTo(1);
					branch[nrBranches-1]=IntPoint.create(this.stem.pos.addVec(placement));
					branch[nrBranches-1].setVel(placement.vecX, placement.vecY+1, placement.vecZ);
				}
				for(int i=0;i<nrBranches;i++){
					growth(this.worldObj,this.branch[i]);
					this.branch[i].updateNorm();
				}

			}
			this.timetick = RandomFunctions.Int(40, 300);
		}
	}else{
		//System.out.println("Is remote");
	}
}
public void growth(World world, IntPoint point){
	removeLeaves(world,point);
	exWorld.setBlock(point, this.log);
	addLeaves(world,point);
}

public void addLeaves(World world, IntPoint point){
	for (int i=-this.leafSize;i<=this.leafSize;i++){
		for (int j=-this.leafSize;j<=this.leafSize;j++){
			for (int k=-this.leafSize;k<=this.leafSize;k++){
				int dist = i*i+j*j+k*k;
				if (dist <=this.leafSize*this.leafSize){
					if (exWorld.isBlock(point.pos.vecX+i, point.pos.vecY+j, point.pos.vecZ+k, Blocks.air)){
						world.setBlock(point.pos.vecX+i, point.pos.vecY+j, point.pos.vecZ+k,this.leaf);							
					}
				}
			}
		}
	}
}

public void removeLeaves(World world, IntPoint point){
	ExtendedWorld exWorld = ExtendedWorld.create(world);
	for (int i=-this.leafSize;i<=this.leafSize;i++){
		for (int j=-this.leafSize;j<=this.leafSize;j++){
			for (int k=-this.leafSize;k<=this.leafSize;k++){
				if (exWorld.isBlock(point.pos.vecX+i, point.pos.vecY+j, point.pos.vecZ+k, this.leaf)){
					world.setBlockToAir(point.pos.vecX+i, point.pos.vecY+j, point.pos.vecZ+k);
				}
			}
		}
	}
}

public void readFromNBT(NBTTagCompound nbt){
	super.readFromNBT(nbt);
	//System.out.println("Read NBT");	;
	//this.slots=new ItemStack[this.getSizeInventory()];
	this.nrBranches = (int)nbt.getShort("NrBranches");
	this.stem=IntPoint.loadIntPointFromNBT(nbt,"Stem");
	for(int i=0; i<this.branch.length;i++){
		this.branch[i]=IntPoint.loadIntPointFromNBT(nbt,"Branch-"+i);
	}
	if (this.log==null)	this.log = ((NatureStump) this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord)).log;
	if (this.leaf==null)this.leaf = ((NatureStump) this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord)).leaf;
}
public void writeToNBT(NBTTagCompound nbt){
	super.writeToNBT(nbt);
	//nbt.setShort("BurnTime",(short)this.burnTime);
	//nbt.setShort("CurrentItemBurnTime",(short)this.currentItemBurnTime);
	this.stem.writeToNBT(nbt, "Stem");
	nbt.setShort("NrBranches",(short)this.nrBranches);
	for(int i=0; i<this.branch.length;i++){
		if(this.branch[i] != null){
			this.branch[i].writeToNBT(nbt, "Branch-" + i);				
		}else{
			break;	
		}
	}
}
}

Posted

Hi

 

So just to be clear:

1) when you place it, you get "is Remote"

2) after you save and quit and reload, you get no console messages at all.

3) you never get any "isn't Remote" at all

 

Is that right?

 

-TGG

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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