mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-12 19:30:42 +01:00
Some fixes
This commit is contained in:
parent
29c940b372
commit
406dad1385
@ -40,7 +40,7 @@ public class Main {
|
||||
shapelessRecipe.addIngredient(ingredient);
|
||||
recipeManager.addRecipe(shapelessRecipe);
|
||||
|
||||
MinecraftServer.getBenchmarkManager().enable(new UpdateOption(60 * 1000, TimeUnit.MILLISECOND));
|
||||
MinecraftServer.getBenchmarkManager().enable(new UpdateOption(10 * 1000, TimeUnit.MILLISECOND));
|
||||
|
||||
PlayerInit.init();
|
||||
|
||||
|
@ -15,6 +15,7 @@ import fr.themode.minestom.instance.InstanceContainer;
|
||||
import fr.themode.minestom.inventory.Inventory;
|
||||
import fr.themode.minestom.inventory.InventoryType;
|
||||
import fr.themode.minestom.item.ItemStack;
|
||||
import fr.themode.minestom.item.Material;
|
||||
import fr.themode.minestom.net.ConnectionManager;
|
||||
import fr.themode.minestom.timer.TaskRunnable;
|
||||
import fr.themode.minestom.utils.MathUtils;
|
||||
@ -61,11 +62,11 @@ public class PlayerInit {
|
||||
for (Map.Entry<String, ThreadResult> resultEntry : benchmarkManager.getResultMap().entrySet()) {
|
||||
String name = resultEntry.getKey();
|
||||
ThreadResult result = resultEntry.getValue();
|
||||
benchmarkMessage += name;
|
||||
benchmarkMessage += "&7" + name;
|
||||
benchmarkMessage += ": ";
|
||||
benchmarkMessage += MathUtils.round(result.getCpuPercentage(), 2) + "% CPU ";
|
||||
benchmarkMessage += MathUtils.round(result.getUserPercentage(), 2) + "% USER ";
|
||||
benchmarkMessage += MathUtils.round(result.getBlockedPercentage(), 2) + "% BLOCKED ";
|
||||
benchmarkMessage += "&e" + MathUtils.round(result.getCpuPercentage(), 2) + "% CPU ";
|
||||
benchmarkMessage += "&c" + MathUtils.round(result.getUserPercentage(), 2) + "% USER ";
|
||||
benchmarkMessage += "&d" + MathUtils.round(result.getBlockedPercentage(), 2) + "% BLOCKED ";
|
||||
benchmarkMessage += "\n";
|
||||
}
|
||||
// if (benchmarkMessage.length() > 0)
|
||||
@ -81,7 +82,7 @@ public class PlayerInit {
|
||||
responseData.setName("1.15.2");
|
||||
responseData.setProtocol(578);
|
||||
responseData.setMaxPlayer(100);
|
||||
responseData.setOnline(0);
|
||||
responseData.setOnline(connectionManager.getOnlinePlayers().size());
|
||||
responseData.addPlayer("A name", UUID.randomUUID());
|
||||
responseData.addPlayer("Could be some message", UUID.randomUUID());
|
||||
responseData.setDescription("IP test: " + playerConnection.getRemoteAddress());
|
||||
@ -167,6 +168,7 @@ public class PlayerInit {
|
||||
player.openInventory(inventory);
|
||||
|
||||
player.getInventory().addItemStack(new ItemStack((short) 1, (byte) 100));
|
||||
player.getInventory().addItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, (byte) 1));
|
||||
|
||||
/*TeamManager teamManager = Main.getTeamManager();
|
||||
Team team = teamManager.createTeam(getUsername());
|
||||
|
@ -171,14 +171,14 @@ public class EntityManager {
|
||||
}
|
||||
}
|
||||
|
||||
public UpdateType getUpdateType() {
|
||||
return updateType;
|
||||
}
|
||||
|
||||
public void addWaitingPlayer(Player player) {
|
||||
this.waitingPlayers.add(player);
|
||||
}
|
||||
|
||||
public UpdateType getUpdateType() {
|
||||
return updateType;
|
||||
}
|
||||
|
||||
public void setUpdateType(UpdateType updateType) {
|
||||
this.updateType = updateType;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ public enum Material {
|
||||
}
|
||||
|
||||
public boolean isBlock() {
|
||||
return block != null;
|
||||
return block != null && this != AIR;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
|
@ -58,7 +58,7 @@ public class BlockPlacementListener {
|
||||
|
||||
blockPosition.add(offsetX, offsetY, offsetZ);
|
||||
boolean intersectPlayer = player.getBoundingBox().intersect(blockPosition); // TODO check if collide with nearby players
|
||||
if (!intersectPlayer) {
|
||||
if (material.isBlock() && !intersectPlayer) {
|
||||
PlayerBlockPlaceEvent playerBlockPlaceEvent = new PlayerBlockPlaceEvent((short) 10, blockPosition, packet.hand);
|
||||
playerBlockPlaceEvent.consumeBlock(player.getGameMode() != GameMode.CREATIVE);
|
||||
|
||||
@ -78,12 +78,12 @@ public class BlockPlacementListener {
|
||||
if (playerBlockPlaceEvent.doesConsumeBlock()) {
|
||||
|
||||
StackingRule stackingRule = usedItem.getStackingRule();
|
||||
stackingRule.apply(usedItem, stackingRule.getAmount(usedItem) - 1);
|
||||
ItemStack newUsedItem = stackingRule.apply(usedItem, stackingRule.getAmount(usedItem) - 1);
|
||||
|
||||
if (hand == Player.Hand.OFF) {
|
||||
playerInventory.setItemInOffHand(usedItem);
|
||||
playerInventory.setItemInOffHand(newUsedItem);
|
||||
} else { // Main
|
||||
playerInventory.setItemInMainHand(usedItem);
|
||||
playerInventory.setItemInMainHand(newUsedItem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -25,6 +25,14 @@ public class PlayerInventoryUtils {
|
||||
return CRAFT_SLOT_3 + 1;
|
||||
case 4:
|
||||
return CRAFT_SLOT_4 + 1;
|
||||
case 5:
|
||||
return HELMET_SLOT;
|
||||
case 6:
|
||||
return CHESTPLATE_SLOT;
|
||||
case 7:
|
||||
return LEGGINGS_SLOT;
|
||||
case 8:
|
||||
return BOOTS_SLOT;
|
||||
}
|
||||
//System.out.println("ENTRY: " + slot + " | " + offset);
|
||||
final int rowSize = 9;
|
||||
|
Loading…
Reference in New Issue
Block a user