Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

fabricmc spawn item

// Spawn an ItemEntity (dropped item) at the specified position in the specified world.
//	World			            	 World  Double Double Double ItemStack				
	world.spawnEntity(new ItemEntity(world, x,     y,     z,     stack))
Comment

fabricmc spawn item


Minecraft instance = Minecraft.getInstance();

if(instance.objectMouseOver.getType() != RayTraceResult.Type.BLOCK){return;}

Vector3d blockVector = instance.objectMouseOver.getHitVec();

double bX = blockVector.getX(); double bY = blockVector.getY(); double bZ = blockVector.getZ();
double pX = instance.player.getPosX(); double pY = instance.player.getPosY(); double pZ = instance.player.getPosZ();

if(bX == Math.floor(bX) && bX <= pX){bX--;}
if(bY == Math.floor(bY) && bY <= pY+1){bY--;} // +1 on Y to get y from player eyes instead of feet
if(bZ == Math.floor(bZ) && bZ <= pZ){bZ--;}

BlockState block = instance.world.getBlockState(new BlockPos(bX, bY, bZ));

Comment

PREVIOUS NEXT
Code Example
Java :: check if object in array java 
Java :: get block player is looking at bukkit 
Java :: main method in java without static keyword 
Java :: jdbc driver servertimezone configuration property 
Java :: java add listent to button 
Java :: error: package androidx.multidex does not exist 
Java :: writing to a text file java 
Java :: how to create a item in minecraft modding 
Java :: glide dependency android java 
Java :: swing enter key 
Java :: java jframe button 
Java :: convert date to calendar java 
Java :: java int length 
Java :: java create inputstream from string 
Java :: java swing timer sleep 
Java :: multiply two strings 
Java :: java days between two dates 
Java :: how to get only current date in java android studio 
Java :: create date java 
Java :: how to reset jframe java swing 
Java :: how-to-check-internet-connection-in-android 
Java :: jagged array java 
Java :: arrays.fill java 
Java :: java get constructor 
Java :: for each java 
Java :: shell sort java 
Java :: import random java 
Java :: Fibonacci Series Program. in java 
Java :: all devisor of a number java 
Java :: get imei programmatically android 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =