Jump to content

[1.20.4] FallingBlockEntity rotation ?? ??


Recommended Posts

im trying to create a custom door animating it by using a falling block 

the falling block spawns and all is nice but i cannot manage to make it rotate 

 

some dirt code of what i have tryed

Spoiler

				
			FallingBlockEntity fbe = cursor.get_FallingBlock();
		System.out.println( "[" + this.get_real_tick() + "], " + world + " ("+ target_blocks.size() +")" );
		if(fbe != null){
		//fbe.setYHeadRot( fbe.getYHeadRot() + 22.5F );
		
		//fbe.setPos( fbe.position().add(0.1D, 0D , 0.1D ) );
		/*
		fbe.setYRot( fbe.getYRot() + 45.5F );
		fbe.setXRot( fbe.getXRot() + 45.5F );
		fbe.xRotO = fbe.xRotO + 45.5F;
		fbe.yRotO = fbe.yRotO + 45.5F;
		*/
		
		//fbe.turn(90D, 90D);
		//fbe.setYBodyRot(45.0F);
		
		Vec3 ps = this.position();
		
		fbe.lerpTo( ps.x,ps.y + 1, ps.z + (this.tick * 0.05F) , 45.0f, 45.0f, 1 );
		
		CompoundTag NBT = fbe.serializeNBT();
		//System.out.println(NbtUtils.prettyPrint(NBT));
		
		if(NBT.contains("Rotation")){
		
		ListTag listoftags = NBT.getList("Rotation", 2);// blockdata contains pos
		
		
		if(this.tick < 10) {
		
		//listoftags. (0, 45F);
		
		listoftags = new ListTag();
		listoftags.add(FloatTag.valueOf(90.0F));
		listoftags.add(FloatTag.valueOf(90.0F));
		
		System.out.println("alt " + listoftags.getFloat(0) + "," + listoftags.getFloat(1));
		
		NBT.put("Rotation", listoftags);
		//fbe.deserializeNBT(NBT);
		fbe.save(NBT);
		//fbe.load();
		NBT = fbe.serializeNBT();
		
		
		
		}
		else {
		System.out.println( "org " + listoftags.getFloat(0) + "," +listoftags.getFloat(1) );
		}
		
		//System.out.println(NbtUtils.prettyPrint(NBT));
		
		}
		
		/*
		"Rotation" : list<TAG_Float>[2] [
		1456.0f,
		1456.0f
		],
		"Rotation" : list<TAG_Float>[2] [
		240.0f,
		240.0f
		],
		*/
		
		//System.out.println( fbe.getYRot() );
		}else{
		//System.out.println( "{null}" );
		}				
			

so far try some know functions also some other post suggest to modified the NBT data from the falling block entitiy 
in code the system out shows the values changing but visually it dont's rotate the block remains still in the air 


####

some general advice about how to rotate a falling block entity required here 

 




 

 

 

 

Link to comment
Share on other sites

expanding the thing 
 

 

to test the thing a create an entity basically you right click the door block the door block generates the entity and the entity generates the falling block  1up and beging movint it to the south and little more up also every tick is rotating the fallingblock butthis dont affects visualy the entity but in code it says it does 

	tick(){
	String world = (this.warudo.isClientSide())? "Local side" : "Server side";
{
FallingBlockEntity fbe = target_postate.get_FallingBlock();
//System.out.println( world + "[" + this.get_real_tick() + "], " + " ("+ target_blocks.size() +")" );
if(fbe != null){

fbe.setYRot( fbe.getYRot() + 45.5F );

System.out.println( world + "[" + this.get_real_tick() + "], " + " ("+ fbe.getYRot() +")" );
	this.tick ++;
}
	


 

Spoiler


				
			[ Creating ], Mundo Remoto (1)
		MutableBlockPos{x=1810, y=120, z=-875}
		1705581449718
		---------------
		[07:37:29] [Server thread/WARN] [minecraft/PersistentEntitySectionManager]: UUID of added entity already exists: FallingBlockEntity['Puerta de Roble Superior en caída'/525, l='ServerLevel[Mushroom]', x=1810.50, y=121.00, z=-874.50]
		Server side[0],  (45.5)
		[ Creating ], Mundo  Local (1)
		MutableBlockPos{x=1810, y=120, z=-875}
		1705581449718
		---------------
		Local  side[1],  (45.5)
		Server side[1],  (91.0)
		Local  side[2],  (91.0)
		Server side[2],  (136.5)
		Local  side[3],  (136.5)
		Server side[3],  (182.0)
		Local  side[4],  (182.0)
		Server side[4],  (227.5)
		Local  side[5],  (227.5)
		Server side[5],  (273.0)
		Local  side[6],  (273.0)
		Server side[6],  (318.5)
		Local  side[7],  (318.5)
		Server side[7],  (364.0)
		Local  side[8],  (364.0)
		Server side[8],  (409.5)
		Local  side[9],  (409.5)
		Server side[9],  (455.0)
		Local  side[10],  (455.0)
		Server side[10],  (500.5)
		Local  side[11],  (500.5)
		Server side[11],  (546.0)
		Local  side[12],  (546.0)
		Server side[12],  (591.5)
		Local  side[13],  (591.5)
		Server side[13],  (637.0)
		Local  side[14],  (637.0)
		Server side[14],  (682.5)
		Local  side[15],  (682.5)
		Server side[15],  (728.0)
		Local  side[16],  (728.0)
		Server side[16],  (773.5)
		Local  side[17],  (773.5)
		Server side[17],  (819.0)
		Local  side[18],  (819.0)
		Server side[18],  (864.5)
		Local  side[19],  (864.5)
		Server side[19],  (910.0)
		Local  side[20],  (910.0)
		Server side[20],  (955.5)
		Local  side[21],  (955.5)
		Server side[21],  (1001.0)
		Local  side[22],  (-79.65625)
		Server side[22],  (1046.5)
		Server side[23],  (1092.0)
		Local  side[23],  (-34.15625)
		Server side[24],  (1137.5)
		Local  side[24],  (11.34375)
		Server side[25],  (1183.0)
		Local  side[25],  (56.84375)
		Server side[26],  (1228.5)
		Local  side[26],  (102.34375)
		Server side[27],  (1274.0)
		Local  side[27],  (147.84375)
		Server side[28],  (1319.5)
		Local  side[28],  (193.34375)
		Local  side[28],  (238.84375)
		Server side[29],  (1365.0)
		Local  side[30],  (284.34375)
		Server side[30],  (1410.5)
		Local  side[31],  (329.84375)
		Server side[31],  (1456.0)				
			

inside the code the falling block is rotating in both sides but dont doit grafically 

 

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.



×
×
  • Create New...

Important Information

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