mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
Add ItemMapEmpty for diff visibility
This commit is contained in:
parent
45e8919598
commit
f0325da814
34
src/main/java/net/minecraft/server/ItemMapEmpty.java
Normal file
34
src/main/java/net/minecraft/server/ItemMapEmpty.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
public class ItemMapEmpty extends ItemWorldMapBase {
|
||||||
|
|
||||||
|
protected ItemMapEmpty(int i) {
|
||||||
|
super(i);
|
||||||
|
this.a(CreativeModeTab.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
||||||
|
ItemStack itemstack1 = new ItemStack(Item.MAP, 1, world.b("map"));
|
||||||
|
String s = "map_" + itemstack1.getData();
|
||||||
|
WorldMap worldmap = new WorldMap(s);
|
||||||
|
|
||||||
|
world.a(s, (WorldMapBase) worldmap);
|
||||||
|
worldmap.scale = 0;
|
||||||
|
int i = 128 * (1 << worldmap.scale);
|
||||||
|
|
||||||
|
worldmap.centerX = (int) (Math.round(entityhuman.locX / (double) i) * (long) i);
|
||||||
|
worldmap.centerZ = (int) (Math.round(entityhuman.locZ / (double) i) * (long) i);
|
||||||
|
worldmap.map = (byte) world.worldProvider.dimension;
|
||||||
|
worldmap.c();
|
||||||
|
--itemstack.count;
|
||||||
|
if (itemstack.count <= 0) {
|
||||||
|
return itemstack1;
|
||||||
|
} else {
|
||||||
|
if (!entityhuman.inventory.pickup(itemstack1.cloneItemStack())) {
|
||||||
|
entityhuman.drop(itemstack1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user