Jump to content

Recommended Posts

Posted

I have made an item as a worldstripper to harvest structures with and now I've hit upon a peculiar problem.

 

When I hit a fence any code in world.isRemote does not get evaluated. Is there any reason why world.isRemote does not evaluate when hitting a fence with an item? All other blocks get captured properly when being hit, but the fences just dont evaluate in world.isRemote. if I remove the world.isRemote it works fine, but I don't want that because I want it to be able to execute clientside only.

 

public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int targetSide, float targetX, float targetY, float targetZ)
    {
    	final int metadata = itemstack.getItemDamage();
    	
    	if(metadata == 0) {
	    	if(world.isRemote) {
	    		Block block = world.getBlock(x, y, z);
	    		String name = block.blockRegistry.getNameForObject(block);
	    		int[] store = {world.getBlockMetadata(x, y, z),x,y,z};
	    		MagicCookie.log.warn("Aquired block with worldstripper : "+name + "("+store[0]+")");			    	
			    ItemWorldStripper.blocks.put(x+"/"+y+"/"+z+"="+name, store);
	    		}
		    world.setBlockToAir(x, y, z);
    	}
}

How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood

 

I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar

Posted

I have made an item as a worldstripper to harvest structures with and now I've hit upon a peculiar problem.

 

When I hit a fence any code in world.isRemote does not get evaluated. Is there any reason why world.isRemote does not evaluate when hitting a fence with an item? All other blocks get captured properly when being hit, but the fences just dont evaluate in world.isRemote. if I remove the world.isRemote it works fine, but I don't want that because I want it to be able to execute clientside only.

 

public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int targetSide, float targetX, float targetY, float targetZ)
    {
    	final int metadata = itemstack.getItemDamage();
    	
    	if(metadata == 0) {
	    	if(world.isRemote) {
	    		Block block = world.getBlock(x, y, z);
	    		String name = block.blockRegistry.getNameForObject(block);
	    		int[] store = {world.getBlockMetadata(x, y, z),x,y,z};
	    		MagicCookie.log.warn("Aquired block with worldstripper : "+name + "("+store[0]+")");			    	
			    ItemWorldStripper.blocks.put(x+"/"+y+"/"+z+"="+name, store);
	    		}
		    world.setBlockToAir(x, y, z);
    	}
}

 

world.isRemote is telling you whether it is the client's world or not. Use !world.isRemote (this means the world is the server). NEVER try to make something client-side that isn't textures or something of the like.

Posted

Thats the thing, like i mentioned it, I want it to be clientside only. What i do is add the information to a hashmap and then put it in an output. Prefably i have this running clientside so I can use it on my server without having to dive into the server files.

 

It all works beatifully, except for fences. Walls, torches etc... All get registered, but the fences never trigger on the remote world.

 

Im just interested why that is. Im suspecting the leashing code interfering somehow. But that doesn't explain for me why it does work server side but not clientside.

How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood

 

I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar

Posted

Thats the thing, like i mentioned it, I want it to be clientside only. What i do is add the information to a hashmap and then put it in an output. Prefably i have this running clientside so I can use it on my server without having to dive into the server files.

 

It all works beatifully, except for fences. Walls, torches etc... All get registered, but the fences never trigger on the remote world.

 

Im just interested why that is. Im suspecting the leashing code interfering somehow. But that doesn't explain for me why it does work server side but not clientside.

 

Ok, what exactly are you trying to do? This world.setBlockToAir(x, y, z); can NEVER be run on the client!

Posted

Thats the thing, like i mentioned it, I want it to be clientside only. What i do is add the information to a hashmap and then put it in an output. Prefably i have this running clientside so I can use it on my server without having to dive into the server files.

 

It all works beatifully, except for fences. Walls, torches etc... All get registered, but the fences never trigger on the remote world.

 

Im just interested why that is. Im suspecting the leashing code interfering somehow. But that doesn't explain for me why it does work server side but not clientside.

 

Ok, what exactly are you trying to do? This world.setBlockToAir(x, y, z); can NEVER be run on the client!

He never ran it on the client. He ran it on both sides.

EDIT: That was really dumb.

Maker of the Craft++ mod.

Posted

Thats the thing, like i mentioned it, I want it to be clientside only. What i do is add the information to a hashmap and then put it in an output. Prefably i have this running clientside so I can use it on my server without having to dive into the server files.

 

It all works beatifully, except for fences. Walls, torches etc... All get registered, but the fences never trigger on the remote world.

 

Im just interested why that is. Im suspecting the leashing code interfering somehow. But that doesn't explain for me why it does work server side but not clientside.

 

You are absolutely right, the bracket was farther right than I am used to looking. Shouldn't that method only be run server-side though? I would think that telling both the client and server to remove it would cause issues.

 

Ok, what exactly are you trying to do? This world.setBlockToAir(x, y, z); can NEVER be run on the client!

He never ran it on the client. He ran it on both sides.

Posted

Usefull guys. If I was interested in a discussion about the merit of clientside vs serverside i would have posted a different question.

 

What I'm interested in is why a fence does not trigger the in itemuse when clientside but all other blocks do.

How much wood could a woodchuck chuck if a wood chuck could chuck wood - Guybrush Treepwood

 

I wrote my own mod ish... still a few bugs to fix. http://thaumcraft.duckdns.org/downloads/MagicCookies-1.0.6.4.jar

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

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • 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  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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