SharedConfig & NachoSpigot optimizations

This commit is contained in:
beaness 2022-06-25 16:22:33 +02:00
parent 3763d622fd
commit be7deb2637
121 changed files with 1245 additions and 1504 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -112,7 +112,14 @@ class TimingHandler implements Timing {
start = 0; start = 0;
return; return;
} }
try
{
addDiff(System.nanoTime() - start); addDiff(System.nanoTime() - start);
}
catch (ArrayIndexOutOfBoundsException ex)
{
ex.printStackTrace();
}
start = 0; start = 0;
} }
} }

View File

@ -550,13 +550,6 @@ public final class Bukkit {
return server.createMap(world); return server.createMap(world);
} }
/**
* Reloads the server, refreshing settings and plugin information.
*/
public static void reload() {
server.reload();
}
/** /**
* Returns the primary logger associated with this server instance. * Returns the primary logger associated with this server instance.
* *

View File

@ -452,11 +452,6 @@ public interface Server extends PluginMessageRecipient {
*/ */
MapView createMap(World world); MapView createMap(World world);
/**
* Reloads the server, refreshing settings and plugin information.
*/
void reload();
/** /**
* Returns the primary logger associated with this server instance. * Returns the primary logger associated with this server instance.
* *

View File

@ -30,7 +30,6 @@ public class SimpleCommandMap implements CommandMap {
private void setDefaultCommands() { private void setDefaultCommands() {
register("bukkit", new VersionCommand("version")); register("bukkit", new VersionCommand("version"));
register("bukkit", new ReloadCommand("reload"));
register("bukkit", new PluginsCommand("plugins")); register("bukkit", new PluginsCommand("plugins"));
register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Spigot register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Spigot
} }

View File

@ -1,39 +0,0 @@
package org.bukkit.command.defaults;
import java.util.Arrays;
import java.util.Collections;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class ReloadCommand extends BukkitCommand {
public ReloadCommand(String name) {
super(name);
this.description = "Reloads the server configuration and plugins";
this.usageMessage = "/reload";
this.setPermission("bukkit.command.reload");
this.setAliases(Collections.singletonList("rl"));
}
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins.");
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
Bukkit.reload();
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Reload complete.");
return true;
}
// Spigot Start
@Override
public java.util.List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException
{
return java.util.Collections.emptyList();
}
// Spigot End
}

View File

@ -49,6 +49,7 @@ dependencies {
implementation("com.github.luben:zstd-jni:1.5.2-3") implementation("com.github.luben:zstd-jni:1.5.2-3")
implementation("net.openhft:affinity:3.20.0") implementation("net.openhft:affinity:3.20.0")
implementation("net.jafama:jafama:2.3.2") implementation("net.jafama:jafama:2.3.2")
implementation("com.eatthepath:fast-uuid:0.2.0")
testImplementation("junit:junit:4.11") testImplementation("junit:junit:4.11")

View File

@ -0,0 +1,128 @@
package com.elevatemc.spigot.config;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import java.util.List;
import java.util.Map;
public class BukkitConfig {
public static YamlConfiguration config;
static Map<String, Command> commands;
public static void init()
{
config = SharedConfig.config;
commands = SharedConfig.commands;
SharedConfig.readConfig( BukkitConfig.class, null );
}
private static boolean getBoolean(String path, boolean def)
{
path = "bukkit." + path;
config.addDefault( path, def );
return config.getBoolean( path, config.getBoolean( path ) );
}
private static double getDouble(String path, double def)
{
path = "bukkit." + path;
config.addDefault( path, def );
return config.getDouble( path, config.getDouble( path ) );
}
private static int getInt(String path, int def)
{
path = "bukkit." + path;
config.addDefault( path, def );
return config.getInt( path, config.getInt( path ) );
}
private static <T> List getList(String path, T def)
{
path = "bukkit." + path;
config.addDefault( path, def );
return config.getList( path, config.getList( path ) );
}
private static String getString(String path, String def)
{
path = "bukkit." + path;
config.addDefault( path, def );
return config.getString( path, config.getString( path ) );
}
public static ConfigurationSection getConfigurationSection(String path) {
return config.getConfigurationSection("bukkit." + path);
}
public static boolean allowEnd = true;
public static boolean warnOnOverlaod = true;
public static String permissionsFile = "permissions.yml";
public static String updateFolder = "update";
public static boolean pluginProfiling = false;
public static int connectionThrottle = 4000;
public static boolean queryPlugins = true;
public static String deprecatedVerbose = "default";
public static String shutdownMessage = "Server closed";
public static String permissionMessage = ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.";
public static boolean useExactLoginLocation = false;
public static String worldContainer = ".";
private static void settings() {
allowEnd = getBoolean("settings.allow-end", allowEnd);
warnOnOverlaod = getBoolean("settings.warn-on-overload", warnOnOverlaod);
permissionsFile = getString("settings.update-folder", updateFolder);
pluginProfiling = getBoolean("settings.plugin-profilling", pluginProfiling);
connectionThrottle = getInt("settings.connection-throttle", connectionThrottle);
queryPlugins = getBoolean("settings.query-plugins", queryPlugins);
deprecatedVerbose = getString("settings.deprecated-verbose", deprecatedVerbose);
shutdownMessage = getString("settings.shutdown-message", shutdownMessage);
permissionMessage = getString("settings.permission-message", permissionMessage);
useExactLoginLocation = getBoolean("settings.use-exact-login-location", useExactLoginLocation);
worldContainer = getString("settings.world-container", worldContainer);
}
public static int monsterSpawnLimit = 70;
public static int animalSpawnLimit = 15;
public static int waterAnimalSpawnLimit = 5;
public static int ambientSpawnLimit = 15;
private static void spawnLimits() {
monsterSpawnLimit = getInt("spawn-limits.monsters", monsterSpawnLimit);
animalSpawnLimit = getInt("spawn-limits.animals", animalSpawnLimit);
waterAnimalSpawnLimit = getInt("spawn-limits.water-animals", waterAnimalSpawnLimit);
ambientSpawnLimit = getInt("spawn-limits.ambient", ambientSpawnLimit);
}
public static int chunkGCPeriodInTicks = 600;
public static int chunkGCLoadThreshold = 0;
private static void chunkGC() {
chunkGCPeriodInTicks = getInt("chunk-gc.period-in-ticks", chunkGCPeriodInTicks);
chunkGCLoadThreshold = getInt("chunk-gc.load-threshold", chunkGCLoadThreshold);
}
public static int ticksPerAnimalSpawn = 400;
public static int ticksPerMonsterSpawn = 1;
public static int ticksPerAutosave = 6000;
private static void ticksPer() {
ticksPerAnimalSpawn = getInt("ticks-per.animal-spawns", ticksPerAnimalSpawn);
ticksPerMonsterSpawn = getInt("ticks-per.monster-spawns", ticksPerMonsterSpawn);
ticksPerAutosave = getInt("ticks-per.autosave", ticksPerAutosave);
}
public static String databaseUsername = "bukkit";
public static String databaseIsolation = "SERIALIZABLE";
public static String databaseDriver = "org.sqlite.JDBC";
public static String databasePassword = "walrus";
public static String databaseUrl = "jdbc:sqlite:{DIR}{NAME}.db";
private static void database() {
databaseUsername = getString("database.username", databaseUsername);
databaseIsolation = getString("database.isolation", databaseIsolation);
databaseDriver = getString("database.driver", databaseDriver);
databasePassword = getString("database.password", databasePassword);
databaseUrl = getString("database.url", databaseUrl);
}
}

View File

@ -0,0 +1,90 @@
package com.elevatemc.spigot.config;
import com.google.common.base.Throwables;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.github.paperspigot.PaperSpigotConfig;
import org.github.paperspigot.PaperSpigotWorldConfig;
import org.spigotmc.SpigotConfig;
import org.spigotmc.SpigotWorldConfig;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
public class SharedConfig {
private static File CONFIG_FILE;
private static final String HEADER = "This is the main configuration file for eSpigot.\n"
+ "Command aliases also go in this file, just put what you would normally put in commands.yml under a commands: tag";
/*========================================================================*/
public static YamlConfiguration config;
public static Map<String, Command> commands;
/*========================================================================*/
public static void init(File configFile) {
CONFIG_FILE = configFile;
config = new YamlConfiguration();
try {
config.load (CONFIG_FILE);
} catch (IOException ex) {
} catch (InvalidConfigurationException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Could not load sportpaper.yml, please correct your syntax errors", ex);
throw Throwables.propagate(ex);
}
config.options().header(HEADER);
config.options().copyDefaults(true);
commands = new HashMap<String, Command>();
eSpigotConfig.init();
BukkitConfig.init();
SpigotConfig.init();
PaperSpigotConfig.init();
SpigotWorldConfig.init();
PaperSpigotWorldConfig.init();
}
public static void registerCommands() {
for (Map.Entry<String, Command> entry : commands.entrySet()) {
MinecraftServer.
getServer().
server.
getCommandMap().
register(entry.getKey(), "eSpigot", entry.getValue());
}
}
public static void readConfig(Class<?> clazz, Object instance) {
for (Method method : clazz.getDeclaredMethods()) {
if (Modifier.isPrivate(method.getModifiers())) {
if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
try {
method.setAccessible(true);
method.invoke(instance);
} catch (InvocationTargetException ex) {
throw Throwables.propagate(ex.getCause());
} catch (Exception ex) {
Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
}
}
}
}
try {
config.save(CONFIG_FILE);
} catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
}
}
}

View File

@ -0,0 +1,109 @@
package com.elevatemc.spigot.config;
import java.util.*;
import org.bukkit.command.Command;
import org.bukkit.configuration.file.YamlConfiguration;
public class eSpigotConfig
{
public static YamlConfiguration config;
static Map<String, Command> commands;
public static void init()
{
config = SharedConfig.config;
commands = SharedConfig.commands;
SharedConfig.readConfig( eSpigotConfig.class, null );
}
private static boolean getBoolean(String path, boolean def)
{
path = "espigot." + path;
config.addDefault( path, def );
return config.getBoolean( path, config.getBoolean( path ) );
}
private static double getDouble(String path, double def)
{
path = "espigot." + path;
config.addDefault( path, def );
return config.getDouble( path, config.getDouble( path ) );
}
private static int getInt(String path, int def)
{
path = "espigot." + path;
config.addDefault( path, def );
return config.getInt( path, config.getInt( path ) );
}
private static <T> List getList(String path, T def)
{
path = "espigot." + path;
config.addDefault( path, def );
return config.getList( path, config.getList( path ) );
}
private static String getString(String path, String def)
{
path = "espigot." + path;
config.addDefault( path, def );
return config.getString( path, config.getString( path ) );
}
public static boolean entityCollisions;
private static void entityCollisions()
{
entityCollisions = getBoolean( "settings.entity-collisions", false );
}
public static boolean villageTicking;
private static void villageTicking()
{
villageTicking = getBoolean( "settings.village-ticking", false );
}
public static boolean enchantmentTableTicking;
private static void enchantmentTableTicking()
{
enchantmentTableTicking = getBoolean( "settings.enchantment-table-ticking", false );
}
public static boolean dayLightCycle;
private static void dayLightCycle()
{
dayLightCycle = getBoolean( "settings.day-light-cycle", false );
}
public static boolean naturalMobSpawning;
private static void naterualMobSpawning()
{
naturalMobSpawning = getBoolean( "settings.natural-mob-spawning", false );
}
public static boolean showHiddenPlayersInTab;
private static void showHiddenPlayersInTab()
{
showHiddenPlayersInTab = getBoolean( "settings.show-hidden-players-in-tab", true );
}
public static boolean mobAI;
private static void mobAI()
{
mobAI = getBoolean( "settings.mob-ai", false );
}
public static boolean fixSprintEatExploit;
private static void fixSprintEatExploit()
{
fixSprintEatExploit = getBoolean( "settings.fix-sprint-eat-exploit", true );
}
public static boolean obfuscatePlayerHealth;
private static void obfuscatePlayerHealth()
{
obfuscatePlayerHealth = getBoolean( "settings.obfuscate-player-health", true );
}
}

View File

@ -28,20 +28,16 @@ public class eSpigot {
return instance; return instance;
} }
private final YamlConfig config, knockbackConfig; private final YamlConfig knockbackConfig;
private final KnockbackHandler knockbackHandler; private final KnockbackHandler knockbackHandler;
public eSpigot(CraftServer server) { public eSpigot(CraftServer server) {
// Set instance of the server // Set instance of the server
instance = this; instance = this;
config = new YamlConfig("espigot.yml");
knockbackConfig = new YamlConfig("knockback.yml"); knockbackConfig = new YamlConfig("knockback.yml");
knockbackHandler = new KnockbackHandler(); knockbackHandler = new KnockbackHandler();
for (eSpigotFeature eSpigotFeature : eSpigotFeature.values())
eSpigotFeature.reload(config);
for (Command command : Arrays.asList(new KnockbackCommand(), new TicksPerSecondCommand())) for (Command command : Arrays.asList(new KnockbackCommand(), new TicksPerSecondCommand()))
server.getCommandMap() server.getCommandMap()
.register(command.getLabel(), "eSpigot", command); .register(command.getLabel(), "eSpigot", command);
@ -67,11 +63,6 @@ public class eSpigot {
return this.packetHandlers; return this.packetHandlers;
} }
public YamlConfig getConfig() {
return config;
}
public YamlConfig getKnockbackConfig() { public YamlConfig getKnockbackConfig() {
return knockbackConfig; return knockbackConfig;
} }

View File

@ -1,41 +0,0 @@
package com.elevatemc.spigot;
import org.bukkit.configuration.file.YamlConfiguration;
import com.elevatemc.spigot.util.YamlConfig;
public enum eSpigotFeature {
ENTITY_COLLISION(false),
VILLAGE_TICKING(false),
DAY_LIGHT_CYCLE(false),
NATURAL_MOB_SPAWNING(false),
SHOW_HIDDEN_PLAYERS_IN_TAB(true),
MOB_AI(false),
FIX_SPRINT_EAT_EXPLOIT(true),
OBFUSCATE_HEALTH(true);
private boolean enabled;
eSpigotFeature(boolean enabled) {
this.enabled = enabled;
}
public void reload(YamlConfig yamlConfig) {
yamlConfig.reload();
YamlConfiguration config = yamlConfig.getConfig();
if (config != null) {
enabled = config.getBoolean("features." + name().toLowerCase(), enabled);
config.set("features." + name().toLowerCase(), enabled);
yamlConfig.saveAsync();
}
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}

View File

@ -1,3 +1,4 @@
// Original source: velocity
package com.elevatemc.spigot.network; package com.elevatemc.spigot.network;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

View File

@ -0,0 +1,6 @@
package com.elevatemc.spigot.util;
public class Constants
{
public static final int[] EMPTY_ARRAY = new int[0];
}

View File

@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
public class BlockDragonEgg extends Block { public class BlockDragonEgg extends Block {
@ -87,7 +88,7 @@ public class BlockDragonEgg extends Block {
double d2 = (double) blockposition1.getY() + (double) (blockposition.getY() - blockposition1.getY()) * d0 + world.random.nextDouble() * 1.0D - 0.5D; double d2 = (double) blockposition1.getY() + (double) (blockposition.getY() - blockposition1.getY()) * d0 + world.random.nextDouble() * 1.0D - 0.5D;
double d3 = (double) blockposition1.getZ() + (double) (blockposition.getZ() - blockposition1.getZ()) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D; double d3 = (double) blockposition1.getZ() + (double) (blockposition.getZ() - blockposition1.getZ()) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D;
world.addParticle(EnumParticle.PORTAL, d1, d2, d3, f, f1, f2, new int[0]); world.addParticle(EnumParticle.PORTAL, d1, d2, d3, f, f1, f2, Constants.EMPTY_ARRAY);
} }
} else { } else {
world.setTypeAndData(blockposition1, iblockdata, 2); world.setTypeAndData(blockposition1, iblockdata, 2);

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random; import java.util.Random;
@ -171,7 +173,7 @@ public abstract class BlockFluids extends Block {
world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
world.addParticle(EnumParticle.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -44,7 +44,7 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement {
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
if (world.tacoSpigotConfig.grassIgnoresLight || world.getLightLevel(blockposition.up()) >= 9) { // TacoSpigot - add an option to ignore light if (world.paperSpigotConfig.grassIgnoresLight || world.getLightLevel(blockposition.up()) >= 9) { // TacoSpigot - add an option to ignore light
for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
Block block = world.getType(blockposition1.up()).getBlock(); Block block = world.getType(blockposition1.up()).getBlock();

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.util.List; import java.util.List;
@ -76,7 +77,7 @@ public class BlockNote extends BlockContainer {
float f = (float) Math.pow(2.0D, (double) (j - 12) / 12.0D); float f = (float) Math.pow(2.0D, (double) (j - 12) / 12.0D);
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "note." + this.b(i), 3.0F, f); world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "note." + this.b(i), 3.0F, f);
world.addParticle(EnumParticle.NOTE, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 1.2D, (double) blockposition.getZ() + 0.5D, (double) j / 24.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.NOTE, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 1.2D, (double) blockposition.getZ() + 0.5D, (double) j / 24.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
return true; return true;
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
// CraftBukkit start // CraftBukkit start
@ -65,7 +66,7 @@ public class BlockPumpkin extends BlockDirectional {
blockList.updateList(); blockList.updateList();
for (j = 0; j < 120; ++j) { for (j = 0; j < 120; ++j) {
world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) { for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) {
@ -97,7 +98,7 @@ public class BlockPumpkin extends BlockDirectional {
blockList.updateList(); blockList.updateList();
for (j = 0; j < 120; ++j) { for (j = 0; j < 120; ++j) {
world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
for (j = 0; j < this.getDetectorIronGolem().c(); ++j) { for (j = 0; j < this.getDetectorIronGolem().c(); ++j) {

View File

@ -3,6 +3,7 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.util.Constants;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.entity.EntityInteractEvent;
// CraftBukkit end // CraftBukkit end
@ -147,7 +148,7 @@ public class BlockRedstoneOre extends Block {
} }
if (d1 < (double) blockposition.getX() || d1 > (double) (blockposition.getX() + 1) || d2 < 0.0D || d2 > (double) (blockposition.getY() + 1) || d3 < (double) blockposition.getZ() || d3 > (double) (blockposition.getZ() + 1)) { if (d1 < (double) blockposition.getX() || d1 > (double) (blockposition.getX() + 1) || d2 < 0.0D || d2 > (double) (blockposition.getY() + 1) || d3 < (double) blockposition.getZ() || d3 > (double) (blockposition.getZ() + 1)) {
world.addParticle(EnumParticle.REDSTONE, d1, d2, d3, 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.REDSTONE, d1, d2, d3, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockRedstoneTorch extends BlockTorch { public class BlockRedstoneTorch extends BlockTorch {
@ -152,7 +153,7 @@ public class BlockRedstoneTorch extends BlockTorch {
double d1 = blockposition.getY() + random.nextDouble() * 0.6D + 0.2D; double d1 = blockposition.getY() + random.nextDouble() * 0.6D + 0.2D;
double d2 = blockposition.getZ() + random.nextDouble() * 0.6D + 0.2D; double d2 = blockposition.getZ() + random.nextDouble() * 0.6D + 0.2D;
world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
world.a(blockposition, world.getType(blockposition).getBlock(), 160); world.a(blockposition, world.getType(blockposition).getBlock(), 160);

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random; import java.util.Random;
@ -208,7 +209,7 @@ public class BlockSkull extends BlockContainer {
int k; int k;
for (k = 0; k < 120; ++k) { for (k = 0; k < 120; ++k) {
world.addParticle(EnumParticle.SNOWBALL, (double) blockposition1.getX() + world.random.nextDouble(), (double) (blockposition1.getY() - 2) + world.random.nextDouble() * 3.9D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.SNOWBALL, (double) blockposition1.getX() + world.random.nextDouble(), (double) (blockposition1.getY() - 2) + world.random.nextDouble() * 3.9D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
for (k = 0; k < shapedetector.c(); ++k) { for (k = 0; k < shapedetector.c(); ++k) {

View File

@ -26,7 +26,7 @@ import com.google.common.collect.Table;
import net.techcable.tacospigot.ImmutableArrayMap; import net.techcable.tacospigot.ImmutableArrayMap;
import net.techcable.tacospigot.ImmutableArrayTable; import net.techcable.tacospigot.ImmutableArrayTable;
import net.techcable.tacospigot.TacoSpigotConfig; import org.github.paperspigot.PaperSpigotConfig;
// TacoSpigot end // TacoSpigot end
public class BlockStateList { public class BlockStateList {
@ -126,7 +126,7 @@ public class BlockStateList {
this.a = block; this.a = block;
// TacoSpigot start // TacoSpigot start
this.bAsImmutableMap = immutablemap; this.bAsImmutableMap = immutablemap;
if (TacoSpigotConfig.useArraysForBlockStates) { if (PaperSpigotConfig.useArraysForBlockStates) {
b = new ImmutableArrayMap<>(IBlockState.INDEXER, immutablemap); b = new ImmutableArrayMap<>(IBlockState.INDEXER, immutablemap);
} else { } else {
b = immutablemap; b = immutablemap;
@ -195,7 +195,7 @@ public class BlockStateList {
} }
// TacoSpigot start // TacoSpigot start
if (TacoSpigotConfig.useArraysForBlockStates) { if (PaperSpigotConfig.useArraysForBlockStates) {
this.c = new ImmutableArrayTable<IBlockState, Comparable, IBlockData> ( this.c = new ImmutableArrayTable<IBlockState, Comparable, IBlockData> (
IBlockState.INDEXER, IBlockState.INDEXER,
(IBlockState state, Comparable value) -> state.getValueId(value), (IBlockState state, Comparable value) -> state.getValueId(value),

View File

@ -687,6 +687,44 @@ public class Chunk {
return chunksection == null ? (this.d(blockposition) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.o() ? 0 : chunksection.d(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.e(i, j & 15, k) : enumskyblock.c)); return chunksection == null ? (this.d(blockposition) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.o() ? 0 : chunksection.d(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.e(i, j & 15, k) : enumskyblock.c));
} }
public int getBrightness(EnumSkyBlock enumskyblock, int blockposition_x, int blockposition_y, int blockposition_z) {
int i = blockposition_x & 15;
int j = blockposition_y;
int k = blockposition_z & 15;
ChunkSection chunksection = this.sections[j >> 4];
if(chunksection == null)
{
if(j >= this.heightMap[(k) << 4 | (i)])
{
return enumskyblock.c;
}
}
else
{
if(enumskyblock == EnumSkyBlock.SKY)
{
if(!this.world.worldProvider.o())
{
return chunksection.d(i, j & 15, k);
}
}
else
{
if(enumskyblock == EnumSkyBlock.BLOCK)
{
return chunksection.e(i, j & 15, k);
}
else
{
return enumskyblock.c;
}
}
}
return 0;
}
public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) { public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) {
int j = blockposition.getX() & 15; int j = blockposition.getX() & 15;
int k = blockposition.getY(); int k = blockposition.getY();
@ -838,9 +876,10 @@ public class Chunk {
public boolean isBelowHeightMap(int blockposition_x, int blockposition_y, int blockposition_z) { public boolean isBelowHeightMap(int blockposition_x, int blockposition_y, int blockposition_z) {
int i = blockposition_x & 15; int i = blockposition_x & 15;
int j = blockposition_y;
int k = blockposition_z & 15; int k = blockposition_z & 15;
return blockposition_y >= this.heightMap[k << 4 | i]; return j >= this.heightMap[k << 4 | i];
} }
public TileEntity i(BlockPosition blockposition) { public TileEntity i(BlockPosition blockposition) {

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.common.base.Functions; import com.google.common.base.Functions;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -139,7 +140,7 @@ public abstract class CommandAbstract implements ICommand {
if (entityplayer == null) { if (entityplayer == null) {
try { try {
entityplayer = MinecraftServer.getServer().getPlayerList().a(UUID.fromString(s)); entityplayer = MinecraftServer.getServer().getPlayerList().a(FastUUID.parseUUID(s));
} catch (IllegalArgumentException illegalargumentexception) { } catch (IllegalArgumentException illegalargumentexception) {
; ;
} }
@ -170,7 +171,7 @@ public abstract class CommandAbstract implements ICommand {
if (object == null) { if (object == null) {
try { try {
UUID uuid = UUID.fromString(s); UUID uuid = FastUUID.parseUUID(s);
object = minecraftserver.a(uuid); object = minecraftserver.a(uuid);
if (object == null) { if (object == null) {

View File

@ -475,7 +475,7 @@ public class CommandScoreboard extends CommandAbstract {
for (Object o : list) { for (Object o : list) {
Entity entity = (Entity) o; Entity entity = (Entity) o;
if (!entity.world.tacoSpigotConfig.nonPlayerEntitiesOnScoreboards && !(entity instanceof EntityHuman)) if (!entity.world.paperSpigotConfig.nonPlayerEntitiesOnScoreboards && !(entity instanceof EntityHuman))
continue; // TacoSpigot continue; // TacoSpigot
String s2 = e(icommandlistener, entity.getUniqueID().toString()); String s2 = e(icommandlistener, entity.getUniqueID().toString());

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.config.SharedConfig;
import com.elevatemc.spigot.console.PandaConsole; import com.elevatemc.spigot.console.PandaConsole;
import java.io.File; import java.io.File;
@ -159,9 +160,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
// PandaSpigot - Move SpigotConfig to load earlier, so that we can check IP forwarding status here. // PandaSpigot - Move SpigotConfig to load earlier, so that we can check IP forwarding status here.
// Spigot start // Spigot start
this.a(new DedicatedPlayerList(this)); this.a(new DedicatedPlayerList(this));
org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end // Spigot end
SharedConfig.registerCommands();
java.net.SocketAddress bindAddress; java.net.SocketAddress bindAddress;
if (this.getServerIp().startsWith("unix:")) { if (this.getServerIp().startsWith("unix:")) {
if (!io.netty.channel.epoll.Epoll.isAvailable()) { if (!io.netty.channel.epoll.Epoll.isAvailable()) {
@ -189,12 +190,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
bindAddress = new java.net.InetSocketAddress(inetaddress, this.R()); bindAddress = new java.net.InetSocketAddress(inetaddress, this.R());
} }
// PandaSpigot end
// PaperSpigot start
org.github.paperspigot.PaperSpigotConfig.init((File) options.valueOf("paper-settings"));
org.github.paperspigot.PaperSpigotConfig.registerCommands();
// PaperSpigot end
DedicatedServer.LOGGER.info("Generating keypair"); DedicatedServer.LOGGER.info("Generating keypair");
this.a(MinecraftEncryption.b()); this.a(MinecraftEncryption.b());
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.R()); DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.R());
@ -295,16 +290,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
} }
// CraftBukkit start
if (this.server.getBukkitSpawnRadius() > -1) {
DedicatedServer.LOGGER.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
this.server.removeBukkitSpawnRadius();
this.propertyManager.savePropertiesFile();
}
// CraftBukkit end
if (org.spigotmc.SpigotConfig.lateBind) { if (org.spigotmc.SpigotConfig.lateBind) {
try { try {
this.aq().bind(bindAddress); // PandaSpigot - Unix domain socket support this.aq().bind(bindAddress); // PandaSpigot - Unix domain socket support

View File

@ -4,6 +4,8 @@ import java.util.*;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
// CraftBukkit start // CraftBukkit start
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.util.Constants;
import com.elevatemc.spigot.util.FastRandom; import com.elevatemc.spigot.util.FastRandom;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -557,7 +559,7 @@ public abstract class Entity implements ICommandListener {
double xLength = totalArea.d - totalArea.a; double xLength = totalArea.d - totalArea.a;
double yLength = totalArea.e - totalArea.b; double yLength = totalArea.e - totalArea.b;
double zLength = totalArea.f - totalArea.c; double zLength = totalArea.f - totalArea.c;
boolean axisScan = this.world.tacoSpigotConfig.optimizeTntMovement && xLength * yLength * zLength > 10; boolean axisScan = this.world.paperSpigotConfig.optimizeTntMovement && xLength * yLength * zLength > 10;
List list = this.world.getCubes(this, axisScan ? this.getBoundingBox().a(0, d1, 0) : totalArea); List list = this.world.getCubes(this, axisScan ? this.getBoundingBox().a(0, d1, 0) : totalArea);
// TacoSpigot end // TacoSpigot end
@ -577,7 +579,7 @@ public abstract class Entity implements ICommandListener {
Iterator iterator1; Iterator iterator1;
// eSpigot start - getCubesNoEntities // eSpigot start - getCubesNoEntities
if(this.world.tacoSpigotConfig.fixEastWest && Math.abs(d0) > Math.abs(d2)) { //TacoSpigot - fix east/west cannoning by calculating the z movement before x if the x velocity is greater if(this.world.paperSpigotConfig.fixEastWest && Math.abs(d0) > Math.abs(d2)) { //TacoSpigot - fix east/west cannoning by calculating the z movement before x if the x velocity is greater
if(axisScan) list = this.world.getCubesNoEntities(this, this.getBoundingBox().a(0, 0, d2)); // TacoSpigot - get z axis blocks if(axisScan) list = this.world.getCubesNoEntities(this, this.getBoundingBox().a(0, 0, d2)); // TacoSpigot - get z axis blocks
for (iterator1 = list.iterator(); iterator1.hasNext(); d2 = axisalignedbb2.c(this.getBoundingBox(), d2)) { for (iterator1 = list.iterator(); iterator1.hasNext(); d2 = axisalignedbb2.c(this.getBoundingBox(), d2)) {
@ -1053,13 +1055,13 @@ public abstract class Entity implements ICommandListener {
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) { for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + (double) f2, f1 + 1.0F, this.locZ + (double) f3, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + (double) f2, f1 + 1.0F, this.locZ + (double) f3, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ, Constants.EMPTY_ARRAY);
} }
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) { for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.addParticle(EnumParticle.WATER_SPLASH, this.locX + (double) f2, f1 + 1.0F, this.locZ + (double) f3, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_SPLASH, this.locX + (double) f2, f1 + 1.0F, this.locZ + (double) f3, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
} }
@ -1440,7 +1442,7 @@ public abstract class Entity implements ICommandListener {
if (nbttagcompound.hasKeyOfType("UUIDMost", 4) && nbttagcompound.hasKeyOfType("UUIDLeast", 4)) { if (nbttagcompound.hasKeyOfType("UUIDMost", 4) && nbttagcompound.hasKeyOfType("UUIDLeast", 4)) {
this.uniqueID = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast")); this.uniqueID = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast"));
} else if (nbttagcompound.hasKeyOfType("UUID", 8)) { } else if (nbttagcompound.hasKeyOfType("UUID", 8)) {
this.uniqueID = UUID.fromString(nbttagcompound.getString("UUID")); this.uniqueID = FastUUID.parseUUID(nbttagcompound.getString("UUID"));
} }
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public abstract class EntityAgeable extends EntityCreature { public abstract class EntityAgeable extends EntityCreature {
protected int a; protected int a;
@ -140,7 +142,7 @@ public abstract class EntityAgeable extends EntityCreature {
if (this.world.isClientSide || ageLocked) { // CraftBukkit if (this.world.isClientSide || ageLocked) { // CraftBukkit
if (this.c > 0) { if (this.c > 0) {
if (this.c % 4 == 0) { if (this.c % 4 == 0) {
this.world.addParticle(EnumParticle.VILLAGER_HAPPY, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.VILLAGER_HAPPY, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
--this.c; --this.c;

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public abstract class EntityAnimal extends EntityAgeable implements IAnimal { public abstract class EntityAnimal extends EntityAgeable implements IAnimal {
protected Block bn; protected Block bn;
@ -32,7 +34,7 @@ public abstract class EntityAnimal extends EntityAgeable implements IAnimal {
double d1 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D;
this.world.addParticle(EnumParticle.HEART, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, new int[0]); this.world.addParticle(EnumParticle.HEART, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -714,7 +714,7 @@ public class EntityArmorStand extends EntityLiving {
// TacoSpigot start - add an option to make armor stands not move // TacoSpigot start - add an option to make armor stands not move
@Override @Override
public void move(double motX, double motY, double motZ) { public void move(double motX, double motY, double motZ) {
if (getWorld().tacoSpigotConfig.optimizeArmorStandMovement) return; if (getWorld().paperSpigotConfig.optimizeArmorStandMovement) return;
super.move(motX, motY, motZ); super.move(motX, motY, motZ);
} }
// TacoSpigot end // TacoSpigot end

View File

@ -3,6 +3,7 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.util.Constants;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
@ -342,7 +343,7 @@ public class EntityArrow extends Entity implements IProjectile {
if (this.isCritical()) { if (this.isCritical()) {
for (j = 0; j < 4; ++j) { for (j = 0; j < 4; ++j) {
this.world.addParticle(EnumParticle.CRIT, this.locX + this.motX * (double) j / 4.0D, this.locY + this.motY * (double) j / 4.0D, this.locZ + this.motZ * (double) j / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ, new int[0]); this.world.addParticle(EnumParticle.CRIT, this.locX + this.motX * (double) j / 4.0D, this.locY + this.motY * (double) j / 4.0D, this.locZ + this.motZ * (double) j / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ, Constants.EMPTY_ARRAY);
} }
} }
@ -375,7 +376,7 @@ public class EntityArrow extends Entity implements IProjectile {
if (this.V()) { if (this.V()) {
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
f3 = 0.25F; f3 = 0.25F;
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
f4 = 0.6F; f4 = 0.6F;

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntityBlaze extends EntityMonster { public class EntityBlaze extends EntityMonster {
private float a = 0.5F; private float a = 0.5F;
@ -57,7 +59,7 @@ public class EntityBlaze extends EntityMonster {
} }
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -3,6 +3,7 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.util.Constants;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
@ -200,11 +201,11 @@ public class EntityBoat extends Entity {
if (this.random.nextBoolean()) { if (this.random.nextBoolean()) {
d8 = this.locX - d4 * d6 * 0.8D + d5 * d7; d8 = this.locX - d4 * d6 * 0.8D + d5 * d7;
d9 = this.locZ - d5 * d6 * 0.8D - d4 * d7; d9 = this.locZ - d5 * d6 * 0.8D - d4 * d7;
this.world.addParticle(EnumParticle.WATER_SPLASH, d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_SPLASH, d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} else { } else {
d8 = this.locX + d4 + d5 * d6 * 0.7D; d8 = this.locX + d4 + d5 * d6 * 0.7D;
d9 = this.locZ + d5 - d4 * d6 * 0.7D; d9 = this.locZ + d5 - d4 * d6 * 0.7D;
this.world.addParticle(EnumParticle.WATER_SPLASH, d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_SPLASH, d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
} }
} }

View File

@ -3,6 +3,7 @@ package net.minecraft.server;
import java.util.UUID; import java.util.UUID;
// CraftBukkit start // CraftBukkit start
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.pathsearch.jobs.PathSearchJob; import com.elevatemc.spigot.pathsearch.jobs.PathSearchJob;
import com.elevatemc.spigot.pathsearch.jobs.PathSearchJobEntity; import com.elevatemc.spigot.pathsearch.jobs.PathSearchJobEntity;
import com.elevatemc.spigot.pathsearch.jobs.PathSearchJobPosition; import com.elevatemc.spigot.pathsearch.jobs.PathSearchJobPosition;
@ -12,7 +13,7 @@ import org.bukkit.event.entity.EntityUnleashEvent;
public abstract class EntityCreature extends EntityInsentient { public abstract class EntityCreature extends EntityInsentient {
public static final UUID bk = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); public static final UUID bk = FastUUID.parseUUID("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
public static final AttributeModifier bl = (new AttributeModifier(EntityCreature.bk, "Fleeing speed bonus", 2.0D, 2)).a(false); public static final AttributeModifier bl = (new AttributeModifier(EntityCreature.bk, "Fleeing speed bonus", 2.0D, 2)).a(false);
private BlockPosition a; private BlockPosition a;
private float b; private float b;

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@ -99,7 +100,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
f = (this.random.nextFloat() - 0.5F) * 8.0F; f = (this.random.nextFloat() - 0.5F) * 8.0F;
f1 = (this.random.nextFloat() - 0.5F) * 4.0F; f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
f2 = (this.random.nextFloat() - 0.5F) * 8.0F; f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} else { } else {
this.n(); this.n();
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F); f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
@ -498,7 +499,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat(); double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat(); double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
this.world.addParticle(EnumParticle.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
return flag; return flag;
@ -548,7 +549,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F; float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F; float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
boolean flag = this.world.getGameRules().getBoolean("doMobLoot"); boolean flag = this.world.getGameRules().getBoolean("doMobLoot");

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntityEnderSignal extends Entity { public class EntityEnderSignal extends Entity {
private double a; private double a;
@ -99,10 +101,10 @@ public class EntityEnderSignal extends Entity {
if (this.V()) { if (this.V()) {
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
} else { } else {
this.world.addParticle(EnumParticle.PORTAL, this.locX - this.motX * (double) f3 + this.random.nextDouble() * 0.6D - 0.3D, this.locY - this.motY * (double) f3 - 0.5D, this.locZ - this.motZ * (double) f3 + this.random.nextDouble() * 0.6D - 0.3D, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.PORTAL, this.locX - this.motX * (double) f3 + this.random.nextDouble() * 0.6D - 0.3D, this.locY - this.motY * (double) f3 - 0.5D, this.locZ - this.motZ * (double) f3 + this.random.nextDouble() * 0.6D - 0.3D, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
if (!this.world.isClientSide) { if (!this.world.isClientSide) {

View File

@ -1,8 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -15,7 +16,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
public class EntityEnderman extends EntityMonster { public class EntityEnderman extends EntityMonster {
private static final UUID a = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); private static final UUID a = FastUUID.parseUUID("020E0DFB-87AE-4653-9556-831010E291A0");
private static final AttributeModifier b = (new AttributeModifier(EntityEnderman.a, "Attacking speed boost", 0.15000000596046448D, 0)).a(false); private static final AttributeModifier b = (new AttributeModifier(EntityEnderman.a, "Attacking speed boost", 0.15000000596046448D, 0)).a(false);
private static final Set<Block> c = Sets.newIdentityHashSet(); private static final Set<Block> c = Sets.newIdentityHashSet();
private boolean bm; private boolean bm;
@ -104,7 +105,7 @@ public class EntityEnderman extends EntityMonster {
public void m() { public void m() {
if (this.world.isClientSide) { if (this.world.isClientSide) {
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
this.world.addParticle(EnumParticle.PORTAL, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D, new int[0]); this.world.addParticle(EnumParticle.PORTAL, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D, Constants.EMPTY_ARRAY);
} }
} }
@ -214,7 +215,7 @@ public class EntityEnderman extends EntityMonster {
double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.length; double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.length;
double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D; double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D;
this.world.addParticle(EnumParticle.PORTAL, d7, d8, d9, f, f1, f2, new int[0]); this.world.addParticle(EnumParticle.PORTAL, d7, d8, d9, f, f1, f2, Constants.EMPTY_ARRAY);
} }
this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F); this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntityEndermite extends EntityMonster { public class EntityEndermite extends EntityMonster {
private int a = 0; private int a = 0;
@ -82,7 +84,7 @@ public class EntityEndermite extends EntityMonster {
super.m(); super.m();
if (this.world.isClientSide) { if (this.world.isClientSide) {
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
this.world.addParticle(EnumParticle.PORTAL, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D, new int[0]); this.world.addParticle(EnumParticle.PORTAL, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D, Constants.EMPTY_ARRAY);
} }
} else { } else {
if (!this.isPersistent()) { if (!this.isPersistent()) {

View File

@ -113,7 +113,7 @@ public class EntityFallingBlock extends Entity {
if (this.world.getType(blockposition).getBlock() != Blocks.PISTON_EXTENSION) { if (this.world.getType(blockposition).getBlock() != Blocks.PISTON_EXTENSION) {
this.die(); this.die();
if (!this.e) { if (!this.e) {
if (this.world.a(block, blockposition, true, EnumDirection.UP, null, null) && !BlockFalling.canFall(this.world, blockposition.down()) /* mimic the false conditions of setTypeIdAndData */ && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000 && blockposition.getY() >= 0 && blockposition.getY() < (this.world.tacoSpigotConfig.disableFallingBlockStackingAt256 ? 255 : 256) && this.world.getType(blockposition) != this.block) { if (this.world.a(block, blockposition, true, EnumDirection.UP, null, null) && !BlockFalling.canFall(this.world, blockposition.down()) /* mimic the false conditions of setTypeIdAndData */ && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000 && blockposition.getY() >= 0 && blockposition.getY() < (this.world.paperSpigotConfig.disableFallingBlockStackingAt256 ? 255 : 256) && this.world.getType(blockposition) != this.block) {
if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) { if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) {
return; return;
} }

View File

@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public abstract class EntityFireball extends Entity { public abstract class EntityFireball extends Entity {
@ -166,7 +167,7 @@ public abstract class EntityFireball extends Entity {
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
float f3 = 0.25F; float f3 = 0.25F;
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
f2 = 0.8F; f2 = 0.8F;
@ -178,7 +179,7 @@ public abstract class EntityFireball extends Entity {
this.motX *= f2; this.motX *= f2;
this.motY *= f2; this.motY *= f2;
this.motZ *= f2; this.motZ *= f2;
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
} }
} }

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntityFireworks extends Entity { public class EntityFireworks extends Entity {
private int ticksFlown; private int ticksFlown;
@ -82,7 +84,7 @@ public class EntityFireworks extends Entity {
++this.ticksFlown; ++this.ticksFlown;
if (this.world.isClientSide && this.ticksFlown % 2 < 2) { if (this.world.isClientSide && this.ticksFlown % 2 < 2) {
this.world.addParticle(EnumParticle.FIREWORKS_SPARK, this.locX, this.locY - 0.3D, this.locZ, this.random.nextGaussian() * 0.05D, -this.motY * 0.5D, this.random.nextGaussian() * 0.05D, new int[0]); this.world.addParticle(EnumParticle.FIREWORKS_SPARK, this.locX, this.locY - 0.3D, this.locZ, this.random.nextGaussian() * 0.05D, -this.motY * 0.5D, this.random.nextGaussian() * 0.05D, Constants.EMPTY_ARRAY);
} }
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) { if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {

View File

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.util.Constants;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Fish; import org.bukkit.entity.Fish;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
@ -288,8 +289,8 @@ public class EntityFishingHook extends Entity {
this.motY -= 0.20000000298023224D; this.motY -= 0.20000000298023224D;
this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
f3 = (float) MathHelper.floor(this.getBoundingBox().b); f3 = (float) MathHelper.floor(this.getBoundingBox().b);
worldserver.a(EnumParticle.WATER_BUBBLE, this.locX, f3 + 1.0F, this.locZ, (int) (1.0F + this.width * 20.0F), this.width, 0.0D, this.width, 0.20000000298023224D, new int[0]); worldserver.a(EnumParticle.WATER_BUBBLE, this.locX, f3 + 1.0F, this.locZ, (int) (1.0F + this.width * 20.0F), this.width, 0.0D, this.width, 0.20000000298023224D, Constants.EMPTY_ARRAY);
worldserver.a(EnumParticle.WATER_WAKE, this.locX, f3 + 1.0F, this.locZ, (int) (1.0F + this.width * 20.0F), this.width, 0.0D, this.width, 0.20000000298023224D, new int[0]); worldserver.a(EnumParticle.WATER_WAKE, this.locX, f3 + 1.0F, this.locZ, (int) (1.0F + this.width * 20.0F), this.width, 0.0D, this.width, 0.20000000298023224D, Constants.EMPTY_ARRAY);
this.av = MathHelper.nextInt(this.random, 10, 30); this.av = MathHelper.nextInt(this.random, 10, 30);
} else { } else {
this.ay = (float) ((double) this.ay + this.random.nextGaussian() * 4.0D); this.ay = (float) ((double) this.ay + this.random.nextGaussian() * 4.0D);
@ -302,14 +303,14 @@ public class EntityFishingHook extends Entity {
block = worldserver.getType(new BlockPosition((int) d8, (int) d12 - 1, (int) d11)).getBlock(); block = worldserver.getType(new BlockPosition((int) d8, (int) d12 - 1, (int) d11)).getBlock();
if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) { if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) {
if (this.random.nextFloat() < 0.15F) { if (this.random.nextFloat() < 0.15F) {
worldserver.a(EnumParticle.WATER_BUBBLE, d8, d12 - 0.10000000149011612D, d11, 1, f5, 0.1D, f4, 0.0D, new int[0]); worldserver.a(EnumParticle.WATER_BUBBLE, d8, d12 - 0.10000000149011612D, d11, 1, f5, 0.1D, f4, 0.0D, Constants.EMPTY_ARRAY);
} }
float f6 = f5 * 0.04F; float f6 = f5 * 0.04F;
float f7 = f4 * 0.04F; float f7 = f4 * 0.04F;
worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, f7, 0.01D, -f6, 1.0D, new int[0]); worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, f7, 0.01D, -f6, 1.0D, Constants.EMPTY_ARRAY);
worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, -f7, 0.01D, f6, 1.0D, new int[0]); worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, -f7, 0.01D, f6, 1.0D, Constants.EMPTY_ARRAY);
} }
} }
} else if (this.aw > 0) { } else if (this.aw > 0) {
@ -331,7 +332,7 @@ public class EntityFishingHook extends Entity {
d11 = this.locZ + (double) (MathHelper.cos(f5) * f4 * 0.1F); d11 = this.locZ + (double) (MathHelper.cos(f5) * f4 * 0.1F);
block = worldserver.getType(new BlockPosition((int) d8, (int) d12 - 1, (int) d11)).getBlock(); block = worldserver.getType(new BlockPosition((int) d8, (int) d12 - 1, (int) d11)).getBlock();
if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) { if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) {
worldserver.a(EnumParticle.WATER_SPLASH, d8, d12, d11, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, new int[0]); worldserver.a(EnumParticle.WATER_SPLASH, d8, d12, d11, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -211,7 +212,7 @@ public class EntityGuardian extends EntityMonster {
Vec3D vec3d = this.d(0.0F); Vec3D vec3d = this.d(0.0F);
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width - vec3d.a * 1.5D, this.locY + this.random.nextDouble() * (double) this.length - vec3d.b * 1.5D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width - vec3d.c * 1.5D, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width - vec3d.a * 1.5D, this.locY + this.random.nextDouble() * (double) this.length - vec3d.b * 1.5D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width - vec3d.c * 1.5D, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }
@ -238,7 +239,7 @@ public class EntityGuardian extends EntityMonster {
while (d5 < d4) { while (d5 < d4) {
d5 += 1.8D - d0 + this.random.nextDouble() * (1.7D - d0); d5 += 1.8D - d0 + this.random.nextDouble() * (1.7D - d0);
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + d1 * d5, this.locY + d2 * d5 + (double) this.getHeadHeight(), this.locZ + d3 * d5, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + d1 * d5, this.locY + d2 * d5 + (double) this.getHeadHeight(), this.locZ + d3 * d5, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }
} }

View File

@ -7,6 +7,7 @@ import java.util.UUID;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.pathsearch.AsyncNavigation; import com.elevatemc.spigot.pathsearch.AsyncNavigation;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
@ -184,7 +185,7 @@ public abstract class EntityInsentient extends EntityLiving {
double d2 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D;
double d3 = 10.0D; double d3 = 10.0D;
this.world.addParticle(EnumParticle.EXPLOSION_NORMAL, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.locY + (double) (this.random.nextFloat() * this.length) - d1 * d3, this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_NORMAL, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.locY + (double) (this.random.nextFloat() * this.length) - d1 * d3, this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2, Constants.EMPTY_ARRAY);
} }
} else { } else {
this.world.broadcastEntityEffect(this, (byte) 20); this.world.broadcastEntityEffect(this, (byte) 20);

View File

@ -1,5 +1,8 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.config.eSpigotConfig;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -28,14 +31,13 @@ import org.bukkit.event.vehicle.VehicleExitEvent;
// PaperSpigot start // PaperSpigot start
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import com.elevatemc.spigot.eSpigotFeature;
import com.elevatemc.spigot.eSpigot; import com.elevatemc.spigot.eSpigot;
import org.spigotmc.event.entity.EntityDismountEvent; import org.spigotmc.event.entity.EntityDismountEvent;
// PaperSpigot end // PaperSpigot end
public abstract class EntityLiving extends Entity { public abstract class EntityLiving extends Entity {
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final UUID a = FastUUID.parseUUID("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
private static final AttributeModifier b = (new AttributeModifier(EntityLiving.a, "Sprinting speed boost", 0.30000001192092896D, 2)).a(false); private static final AttributeModifier b = (new AttributeModifier(EntityLiving.a, "Sprinting speed boost", 0.30000001192092896D, 2)).a(false);
private AttributeMapBase c; private AttributeMapBase c;
public CombatTracker combatTracker = new CombatTracker(this); public CombatTracker combatTracker = new CombatTracker(this);
@ -214,7 +216,7 @@ public abstract class EntityLiving extends Entity {
float f1 = this.random.nextFloat() - this.random.nextFloat(); float f1 = this.random.nextFloat() - this.random.nextFloat();
float f2 = this.random.nextFloat() - this.random.nextFloat(); float f2 = this.random.nextFloat() - this.random.nextFloat();
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
this.damageEntity(DamageSource.DROWN, 2.0F); this.damageEntity(DamageSource.DROWN, 2.0F);
@ -315,7 +317,7 @@ public abstract class EntityLiving extends Entity {
double d1 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D;
this.world.addParticle(EnumParticle.EXPLOSION_NORMAL, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_NORMAL, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, Constants.EMPTY_ARRAY);
} }
} }
@ -539,7 +541,7 @@ public abstract class EntityLiving extends Entity {
double d1 = (double) (i >> 8 & 255) / 255.0D; double d1 = (double) (i >> 8 & 255) / 255.0D;
double d2 = (double) (i & 255) / 255.0D; double d2 = (double) (i & 255) / 255.0D;
this.world.addParticle(flag ? EnumParticle.SPELL_MOB_AMBIENT : EnumParticle.SPELL_MOB, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, d0, d1, d2, new int[0]); this.world.addParticle(flag ? EnumParticle.SPELL_MOB_AMBIENT : EnumParticle.SPELL_MOB, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, d0, d1, d2, Constants.EMPTY_ARRAY);
} }
} }
@ -1664,7 +1666,7 @@ public abstract class EntityLiving extends Entity {
this.ba = 0.0F; this.ba = 0.0F;
this.bb = 0.0F; this.bb = 0.0F;
} else if (this.bM()) { } else if (this.bM()) {
if (eSpigotFeature.MOB_AI.isEnabled() || this instanceof EntityHuman) { if (eSpigotConfig.mobAI || this instanceof EntityHuman) {
this.world.methodProfiler.a("newAi"); this.world.methodProfiler.a("newAi");
this.doTick(); this.doTick();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
@ -1704,7 +1706,7 @@ public abstract class EntityLiving extends Entity {
protected void doTick() {} protected void doTick() {}
protected void bL() { protected void bL() {
if (!eSpigotFeature.ENTITY_COLLISION.isEnabled()) if (!eSpigotConfig.entityCollisions)
return; return;
List list = this.world.a(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), Predicates.and(IEntitySelector.d, new Predicate() { List list = this.world.a(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), Predicates.and(IEntitySelector.d, new Predicate() {
@ -1871,7 +1873,7 @@ public abstract class EntityLiving extends Entity {
} }
public ScoreboardTeamBase getScoreboardTeam() { public ScoreboardTeamBase getScoreboardTeam() {
if (!this.world.tacoSpigotConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) return null; // TacoSpigot if (!this.world.paperSpigotConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) return null; // TacoSpigot
return this.world.getScoreboard().getPlayerTeam(this.getUniqueID().toString()); return this.world.getScoreboard().getPlayerTeam(this.getUniqueID().toString());
} }

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntityMinecartFurnace extends EntityMinecartAbstract { public class EntityMinecartFurnace extends EntityMinecartAbstract {
private int c; private int c;
@ -35,7 +37,7 @@ public class EntityMinecartFurnace extends EntityMinecartAbstract {
this.i(this.c > 0); this.i(this.c > 0);
if (this.j() && this.random.nextInt(4) == 0) { if (this.j() && this.random.nextInt(4) == 0) {
this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntityMinecartTNT extends EntityMinecartAbstract { public class EntityMinecartTNT extends EntityMinecartAbstract {
private int a = -1; private int a = -1;
@ -24,7 +26,7 @@ public class EntityMinecartTNT extends EntityMinecartAbstract {
super.t_(); super.t_();
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} else if (this.a == 0) { } else if (this.a == 0) {
this.b(this.motX * this.motX + this.motZ * this.motZ); this.b(this.motX * this.motX + this.motZ * this.motZ);
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.event.player.PlayerShearEntityEvent; // CraftBukkit import org.bukkit.event.player.PlayerShearEntityEvent; // CraftBukkit
public class EntityMushroomCow extends EntityCow { public class EntityMushroomCow extends EntityCow {
@ -35,7 +36,7 @@ public class EntityMushroomCow extends EntityCow {
} }
// CraftBukkit end // CraftBukkit end
this.die(); this.die();
this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
if (!this.world.isClientSide) { if (!this.world.isClientSide) {
EntityCow entitycow = new EntityCow(this.world); EntityCow entitycow = new EntityCow(this.world);

View File

@ -1,10 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import java.util.UUID; import java.util.UUID;
public class EntityPigZombie extends EntityZombie { public class EntityPigZombie extends EntityZombie {
private static final UUID b = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718"); private static final UUID b = FastUUID.parseUUID("49455A49-7EC5-45BA-B886-3B90B23A1718");
private static final AttributeModifier c = (new AttributeModifier(EntityPigZombie.b, "Attacking speed boost", 0.05D, 0)).a(false); private static final AttributeModifier c = (new AttributeModifier(EntityPigZombie.b, "Attacking speed boost", 0.05D, 0)).a(false);
public int angerLevel; public int angerLevel;
private int soundDelay; private int soundDelay;
@ -92,7 +94,7 @@ public class EntityPigZombie extends EntityZombie {
String s = nbttagcompound.getString("HurtBy"); String s = nbttagcompound.getString("HurtBy");
if (s.length() > 0) { if (s.length() > 0) {
this.hurtBy = UUID.fromString(s); this.hurtBy = FastUUID.parseUUID(s);
EntityHuman entityhuman = this.world.b(this.hurtBy); EntityHuman entityhuman = this.world.b(this.hurtBy);
this.b((EntityLiving) entityhuman); this.b((EntityLiving) entityhuman);

View File

@ -8,6 +8,7 @@ import io.netty.buffer.Unpooled;
import java.util.*; import java.util.*;
import com.elevatemc.spigot.eSpigot; import com.elevatemc.spigot.eSpigot;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -192,6 +193,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.bs(), PacketPlayOutCombatEvent.EnumCombatEventType.END_COMBAT)); this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.bs(), PacketPlayOutCombatEvent.EnumCombatEventType.END_COMBAT));
} }
private long chunkToLong(int chunkX, int chunkZ)
{
return (chunkX << 32L) + chunkZ - -2147483648L;
}
public void t_() { public void t_() {
// CraftBukkit start // CraftBukkit start
if (this.joining) { if (this.joining) {
@ -231,49 +237,71 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
if (!this.chunkCoordIntPairQueue.isEmpty()) { if (!this.chunkCoordIntPairQueue.isEmpty()) {
ArrayList arraylist = Lists.newArrayList(); ArrayList<Chunk> chunkList = Lists.newArrayList();
Iterator iterator1 = this.chunkCoordIntPairQueue.iterator(); Iterator<ChunkCoordIntPair> chunksToLoad = this.chunkCoordIntPairQueue.iterator();
ArrayList arraylist1 = Lists.newArrayList(); ArrayList<TileEntity> tileEntities = Lists.newArrayList();
Chunk chunk; Chunk chunk = null;
while (iterator1.hasNext() && arraylist.size() < this.world.spigotConfig.maxBulkChunk) { // Spigot while (chunksToLoad.hasNext() && chunkList.size() < this.world.spigotConfig.maxBulkChunk) { // Spigot
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next(); ChunkCoordIntPair chunkcoordintpair = chunksToLoad.next();
if (chunkcoordintpair != null) { if (chunkcoordintpair != null) {
if (this.world.isLoaded(new BlockPosition(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4))) { if (this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {// [Nacho-0024] Do not create new BlockPosition when loading chunk
chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
if (chunk.isReady()) { if (chunk.isReady()) {
arraylist.add(chunk); chunkList.add(chunk);
arraylist1.addAll(chunk.tileEntities.values()); // CraftBukkit - Get tile entities directly from the chunk instead of the world tileEntities.addAll(chunk.tileEntities.values()); // CraftBukkit - Get tile entities directly from the chunk instead of the world
iterator1.remove(); chunksToLoad.remove();
} }
} }
} else { } else {
iterator1.remove(); chunksToLoad.remove();
} }
} }
if (!arraylist.isEmpty()) { if (!chunkList.isEmpty()) {
if (arraylist.size() == 1) { if (chunkList.size() == 1) {
this.playerConnection.sendPacket(new PacketPlayOutMapChunk((Chunk) arraylist.get(0), true, '\uffff')); this.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunkList.get(0), true, '\uffff'));
} else { } else {
this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist)); this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(chunkList));
} }
Iterator iterator2 = arraylist1.iterator(); Iterator<TileEntity> tileEntitiesIterator = tileEntities.iterator();
while (iterator2.hasNext()) { while (tileEntitiesIterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator2.next(); TileEntity tileentity = tileEntitiesIterator.next();
this.a(tileentity); this.a(tileentity);
} }
iterator2 = arraylist.iterator(); // //Nacho - if there are a lot of entities, we end up scanning the WHOLE list of entities multiple times
// // Which isn't the best if we have 100 players doing that
// So instead of updating all entities by chunk, we update all entities at once with a hashset of chunks
// This means we don't have to pass over the list x chunks
// o(chunk * entityList) => o(entitylist)
while (iterator2.hasNext()) { // Iterator<Chunk> chunkIterator = chunkList.iterator();
chunk = (Chunk) iterator2.next(); // while (chunkIterator.hasNext())
this.u().getTracker().a(this, chunk); // {
// chunk = (Chunk) chunkIterator.next();
// this.u().getTracker().a(this, chunk);
// }
// Nacho - end
LongOpenHashSet chunkPosSet = new LongOpenHashSet(chunkList.size());
for (Chunk newChunk : chunkList)
chunkPosSet.add(this.chunkToLong(newChunk.locX, newChunk.locZ));
Iterator<EntityTrackerEntry> trackerEntryIterator = this.u().getTracker().getEntityTrackerEntries();
while (trackerEntryIterator.hasNext())
{
EntityTrackerEntry entitytrackerentry = trackerEntryIterator.next();
if (entitytrackerentry.tracker != this && chunkPosSet.contains(this.chunkToLong(entitytrackerentry.tracker.ae, entitytrackerentry.tracker.ag)))
{
entitytrackerentry.updatePlayer(this);
}
} }
} }
} }

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import java.util.List; import java.util.List;
@ -207,7 +209,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
float f4 = 0.25F; float f4 = 0.25F;
this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_BUBBLE, this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
f2 = 0.8F; f2 = 0.8F;
@ -268,7 +270,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.shooter = this.world.a(this.shooterName); this.shooter = this.world.a(this.shooterName);
if (this.shooter == null && this.world instanceof WorldServer) { if (this.shooter == null && this.world instanceof WorldServer) {
try { try {
Entity entity = ((WorldServer) this.world).getEntity(UUID.fromString(this.shooterName)); Entity entity = ((WorldServer) this.world).getEntity(FastUUID.parseUUID(this.shooterName));
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
this.shooter = (EntityLiving) entity; this.shooter = (EntityLiving) entity;

View File

@ -1,6 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.util.Constants;
import org.bukkit.event.entity.SlimeSplitEvent; import org.bukkit.event.entity.SlimeSplitEvent;
// CraftBukkit end // CraftBukkit end
@ -88,7 +89,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
double d0 = this.locX + (double) f2; double d0 = this.locX + (double) f2;
double d1 = this.locZ + (double) f3; double d1 = this.locZ + (double) f3;
world.addParticle(enumparticle, d0, this.getBoundingBox().b, d1, 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(enumparticle, d0, this.getBoundingBox().b, d1, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
if (this.cl()) { if (this.cl()) {

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class EntitySnowball extends EntityProjectile { public class EntitySnowball extends EntityProjectile {
public EntitySnowball(World world) { public EntitySnowball(World world) {
@ -26,7 +28,7 @@ public class EntitySnowball extends EntityProjectile {
} }
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
this.world.addParticle(EnumParticle.SNOWBALL, this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SNOWBALL, this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
if (!this.world.isClientSide) { if (!this.world.isClientSide) {

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
public class EntityTNTPrimed extends Entity { public class EntityTNTPrimed extends Entity {
@ -90,7 +91,7 @@ public class EntityTNTPrimed extends Entity {
// CraftBukkit end // CraftBukkit end
} else { } else {
this.W(); this.W();
this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SMOKE_NORMAL, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -1,5 +1,8 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.util.Constants;
import java.util.UUID; import java.util.UUID;
public abstract class EntityTameableAnimal extends EntityAnimal implements EntityOwnable { public abstract class EntityTameableAnimal extends EntityAnimal implements EntityOwnable {
@ -61,7 +64,7 @@ public abstract class EntityTameableAnimal extends EntityAnimal implements Entit
double d1 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D;
this.world.addParticle(enumparticle, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, new int[0]); this.world.addParticle(enumparticle, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2, Constants.EMPTY_ARRAY);
} }
} }
@ -109,7 +112,7 @@ public abstract class EntityTameableAnimal extends EntityAnimal implements Entit
public EntityLiving getOwner() { public EntityLiving getOwner() {
try { try {
UUID uuid = UUID.fromString(this.getOwnerUUID()); UUID uuid = FastUUID.parseUUID(this.getOwnerUUID());
return uuid == null ? null : this.world.b(uuid); return uuid == null ? null : this.world.b(uuid);
} catch (IllegalArgumentException illegalargumentexception) { } catch (IllegalArgumentException illegalargumentexception) {

View File

@ -3,6 +3,7 @@ package net.minecraft.server;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -265,6 +266,11 @@ public class EntityTracker {
else TASK_EXECUTOR.submit(task); else TASK_EXECUTOR.submit(task);
} }
public Iterator<EntityTrackerEntry> getEntityTrackerEntries()
{
return this.c.iterator();
}
public void a(EntityPlayer entityplayer, Chunk chunk) { public void a(EntityPlayer entityplayer, Chunk chunk) {
Task task = executor -> { Task task = executor -> {
for (EntityTrackerEntry entitytrackerentry : this.c) { for (EntityTrackerEntry entitytrackerentry : this.c) {

View File

@ -3,7 +3,7 @@ package net.minecraft.server;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.elevatemc.spigot.eSpigotFeature; import com.elevatemc.spigot.config.eSpigotConfig;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -273,7 +273,7 @@ public class EntityTrackerEntry {
DataWatcher datawatcher = this.tracker.getDataWatcher(); DataWatcher datawatcher = this.tracker.getDataWatcher();
if (datawatcher.a()) { if (datawatcher.a()) {
if (eSpigotFeature.OBFUSCATE_HEALTH.isEnabled() && this.tracker instanceof EntityHuman) { if (eSpigotConfig.obfuscatePlayerHealth && this.tracker instanceof EntityHuman) {
List<DataWatcher.WatchableObject> changedMetadata = datawatcher.c(); List<DataWatcher.WatchableObject> changedMetadata = datawatcher.c();
Iterator<DataWatcher.WatchableObject> iter = changedMetadata.iterator(); Iterator<DataWatcher.WatchableObject> iter = changedMetadata.iterator();
boolean found = false; boolean found = false;

View File

@ -1,12 +1,14 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
public class EntityWitch extends EntityMonster implements IRangedEntity { public class EntityWitch extends EntityMonster implements IRangedEntity {
private static final UUID a = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); private static final UUID a = FastUUID.parseUUID("5CD17E52-A79A-43D3-A529-90FDE04B181E");
private static final AttributeModifier b = (new AttributeModifier(EntityWitch.a, "Drinking speed penalty", -0.25D, 0)).a(false); private static final AttributeModifier b = (new AttributeModifier(EntityWitch.a, "Drinking speed penalty", -0.25D, 0)).a(false);
private static final Item[] c = new Item[] { Items.GLOWSTONE_DUST, Items.SUGAR, Items.REDSTONE, Items.SPIDER_EYE, Items.GLASS_BOTTLE, Items.GUNPOWDER, Items.STICK, Items.STICK}; private static final Item[] c = new Item[] { Items.GLOWSTONE_DUST, Items.SUGAR, Items.REDSTONE, Items.SPIDER_EYE, Items.GLASS_BOTTLE, Items.GUNPOWDER, Items.STICK, Items.STICK};
private int bm; private int bm;

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import java.util.Iterator; import java.util.Iterator;
@ -154,15 +155,15 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
double d9 = this.u(j); double d9 = this.u(j);
double d10 = this.v(j); double d10 = this.v(j);
this.world.addParticle(EnumParticle.SMOKE_NORMAL, d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.SMOKE_NORMAL, d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
if (flag && this.world.random.nextInt(4) == 0) { if (flag && this.world.random.nextInt(4) == 0) {
this.world.addParticle(EnumParticle.SPELL_MOB, d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.699999988079071D, 0.699999988079071D, 0.5D, new int[0]); this.world.addParticle(EnumParticle.SPELL_MOB, d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.699999988079071D, 0.699999988079071D, 0.5D, Constants.EMPTY_ARRAY);
} }
} }
if (this.cl() > 0) { if (this.cl() > 0) {
for (j = 0; j < 3; ++j) { for (j = 0; j < 3; ++j) {
this.world.addParticle(EnumParticle.SPELL_MOB, this.locX + this.random.nextGaussian() * 1.0D, this.locY + (double) (this.random.nextFloat() * 3.3F), this.locZ + this.random.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D, new int[0]); this.world.addParticle(EnumParticle.SPELL_MOB, this.locX + this.random.nextGaussian() * 1.0D, this.locY + (double) (this.random.nextFloat() * 3.3F), this.locZ + this.random.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D, Constants.EMPTY_ARRAY);
} }
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
// CraftBukkit start // CraftBukkit start
@ -183,7 +184,7 @@ public class EntityWolf extends EntityTameableAnimal {
float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
this.world.addParticle(EnumParticle.WATER_SPLASH, this.locX + (double) f1, f + 0.8F, this.locZ + (double) f2, this.motX, this.motY, this.motZ, new int[0]); this.world.addParticle(EnumParticle.WATER_SPLASH, this.locX + (double) f1, f + 0.8F, this.locZ + (double) f2, this.motX, this.motY, this.motZ, Constants.EMPTY_ARRAY);
} }
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
//CraftBukkit start //CraftBukkit start
import com.eatthepath.uuid.FastUUID;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
@ -14,7 +15,7 @@ import org.bukkit.event.entity.EntityTargetEvent;
public class EntityZombie extends EntityMonster { public class EntityZombie extends EntityMonster {
protected static final IAttribute a = (new AttributeRanged(null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); protected static final IAttribute a = (new AttributeRanged(null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); private static final UUID b = FastUUID.parseUUID("B9766B59-9566-4402-BC1F-2EE2A276D836");
private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); // PaperSpigot - Configurable baby zombie movement speed private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); // PaperSpigot - Configurable baby zombie movement speed
private final PathfinderGoalBreakDoor bm = new PathfinderGoalBreakDoor(this); private final PathfinderGoalBreakDoor bm = new PathfinderGoalBreakDoor(this);
private int bn; private int bn;

View File

@ -20,9 +20,10 @@ public enum EnumDirection implements INamable {
private final BaseBlockPosition m; private final BaseBlockPosition m;
private static final EnumDirection[] n = new EnumDirection[6]; private static final EnumDirection[] n = new EnumDirection[6];
private static final EnumDirection[] o = new EnumDirection[4]; private static final EnumDirection[] o = new EnumDirection[4];
private static final EnumDirection[] ALL = EnumDirection.values();
private static final Map<String, EnumDirection> p = Maps.newHashMap(); private static final Map<String, EnumDirection> p = Maps.newHashMap();
private EnumDirection(int i, int j, int k, String s, EnumDirection.EnumAxisDirection enumdirection_enumaxisdirection, EnumDirection.EnumAxis enumdirection_enumaxis, BaseBlockPosition baseblockposition) { EnumDirection(int i, int j, int k, String s, EnumDirection.EnumAxisDirection enumdirection_enumaxisdirection, EnumDirection.EnumAxis enumdirection_enumaxis, BaseBlockPosition baseblockposition) {
this.g = i; this.g = i;
this.i = k; this.i = k;
this.h = j; this.h = j;
@ -45,42 +46,34 @@ public enum EnumDirection implements INamable {
} }
public EnumDirection opposite() { public EnumDirection opposite() {
return fromType1(this.h); return ALL[this.h];
} }
public EnumDirection e() { public EnumDirection e() {
switch (EnumDirection.SyntheticClass_1.b[this.ordinal()]) { switch(this) {
case 1: case NORTH:
return EnumDirection.EAST; return EAST;
case EAST:
case 2: return SOUTH;
return EnumDirection.SOUTH; case SOUTH:
return WEST;
case 3: case WEST:
return EnumDirection.WEST; return NORTH;
case 4:
return EnumDirection.NORTH;
default: default:
throw new IllegalStateException("Unable to get Y-rotated facing of " + this); throw new IllegalStateException("Unable to get Y-rotated facing of " + this);
} }
} }
public EnumDirection f() { public EnumDirection f() {
switch (EnumDirection.SyntheticClass_1.b[this.ordinal()]) { switch(this) {
case 1: case NORTH:
return EnumDirection.WEST; return WEST;
case EAST:
case 2: return NORTH;
return EnumDirection.NORTH; case SOUTH:
return EAST;
case 3: case WEST:
return EnumDirection.EAST; return SOUTH;
case 4:
return EnumDirection.SOUTH;
default: default:
throw new IllegalStateException("Unable to get CCW facing of " + this); throw new IllegalStateException("Unable to get CCW facing of " + this);
} }
@ -119,7 +112,7 @@ public enum EnumDirection implements INamable {
} }
public static EnumDirection a(Random random) { public static EnumDirection a(Random random) {
return values()[random.nextInt(values().length)]; return ALL[random.nextInt(ALL.length)];
} }
public String toString() { public String toString() {
@ -131,11 +124,10 @@ public enum EnumDirection implements INamable {
} }
public static EnumDirection a(EnumDirection.EnumAxisDirection enumdirection_enumaxisdirection, EnumDirection.EnumAxis enumdirection_enumaxis) { public static EnumDirection a(EnumDirection.EnumAxisDirection enumdirection_enumaxisdirection, EnumDirection.EnumAxis enumdirection_enumaxis) {
EnumDirection[] aenumdirection = values(); int i = ALL.length;
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
EnumDirection enumdirection = aenumdirection[j]; EnumDirection enumdirection = ALL[j];
if (enumdirection.c() == enumdirection_enumaxisdirection && enumdirection.k() == enumdirection_enumaxis) { if (enumdirection.c() == enumdirection_enumaxisdirection && enumdirection.k() == enumdirection_enumaxis) {
return enumdirection; return enumdirection;
@ -146,11 +138,10 @@ public enum EnumDirection implements INamable {
} }
static { static {
EnumDirection[] aenumdirection = values(); int i = ALL.length;
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
EnumDirection enumdirection = aenumdirection[j]; EnumDirection enumdirection = ALL[j];
EnumDirection.n[enumdirection.g] = enumdirection; EnumDirection.n[enumdirection.g] = enumdirection;
if (enumdirection.k().c()) { if (enumdirection.k().c()) {
@ -162,102 +153,20 @@ public enum EnumDirection implements INamable {
} }
static class SyntheticClass_1 { public enum EnumDirectionLimit implements Predicate<EnumDirection>, Iterable<EnumDirection> {
static final int[] a;
static final int[] b;
static final int[] c = new int[EnumDirection.EnumDirectionLimit.values().length];
static {
try {
EnumDirection.SyntheticClass_1.c[EnumDirection.EnumDirectionLimit.HORIZONTAL.ordinal()] = 1;
} catch (NoSuchFieldError nosuchfielderror) {
;
}
try {
EnumDirection.SyntheticClass_1.c[EnumDirection.EnumDirectionLimit.VERTICAL.ordinal()] = 2;
} catch (NoSuchFieldError nosuchfielderror1) {
;
}
b = new int[EnumDirection.values().length];
try {
EnumDirection.SyntheticClass_1.b[EnumDirection.NORTH.ordinal()] = 1;
} catch (NoSuchFieldError nosuchfielderror2) {
;
}
try {
EnumDirection.SyntheticClass_1.b[EnumDirection.EAST.ordinal()] = 2;
} catch (NoSuchFieldError nosuchfielderror3) {
;
}
try {
EnumDirection.SyntheticClass_1.b[EnumDirection.SOUTH.ordinal()] = 3;
} catch (NoSuchFieldError nosuchfielderror4) {
;
}
try {
EnumDirection.SyntheticClass_1.b[EnumDirection.WEST.ordinal()] = 4;
} catch (NoSuchFieldError nosuchfielderror5) {
;
}
try {
EnumDirection.SyntheticClass_1.b[EnumDirection.UP.ordinal()] = 5;
} catch (NoSuchFieldError nosuchfielderror6) {
;
}
try {
EnumDirection.SyntheticClass_1.b[EnumDirection.DOWN.ordinal()] = 6;
} catch (NoSuchFieldError nosuchfielderror7) {
;
}
a = new int[EnumDirection.EnumAxis.values().length];
try {
EnumDirection.SyntheticClass_1.a[EnumDirection.EnumAxis.X.ordinal()] = 1;
} catch (NoSuchFieldError nosuchfielderror8) {
;
}
try {
EnumDirection.SyntheticClass_1.a[EnumDirection.EnumAxis.Y.ordinal()] = 2;
} catch (NoSuchFieldError nosuchfielderror9) {
;
}
try {
EnumDirection.SyntheticClass_1.a[EnumDirection.EnumAxis.Z.ordinal()] = 3;
} catch (NoSuchFieldError nosuchfielderror10) {
;
}
}
}
public static enum EnumDirectionLimit implements Predicate<EnumDirection>, Iterable<EnumDirection> {
HORIZONTAL, VERTICAL; HORIZONTAL, VERTICAL;
private EnumDirectionLimit() {} EnumDirectionLimit() {}
public EnumDirection[] a() { public EnumDirection[] a() {
switch (EnumDirection.SyntheticClass_1.c[this.ordinal()]) { switch(this) {
case 1: case HORIZONTAL:
return new EnumDirection[] { EnumDirection.NORTH, EnumDirection.EAST, EnumDirection.SOUTH, EnumDirection.WEST}; return new EnumDirection[]{EnumDirection.NORTH, EnumDirection.EAST, EnumDirection.SOUTH, EnumDirection.WEST};
case VERTICAL:
case 2: return new EnumDirection[]{EnumDirection.UP, EnumDirection.DOWN};
return new EnumDirection[] { EnumDirection.UP, EnumDirection.DOWN};
default: default:
throw new Error("Someone\'s been tampering with the universe!"); throw new Error("Someone's been tampering with the universe!");
} }
} }
@ -280,7 +189,7 @@ public enum EnumDirection implements INamable {
} }
} }
public static enum EnumAxisDirection { public enum EnumAxisDirection {
POSITIVE(1, "Towards positive"), NEGATIVE(-1, "Towards negative"); POSITIVE(1, "Towards positive"), NEGATIVE(-1, "Towards negative");
@ -301,7 +210,7 @@ public enum EnumDirection implements INamable {
} }
} }
public static enum EnumAxis implements Predicate<EnumDirection>, INamable { public enum EnumAxis implements Predicate<EnumDirection>, INamable {
X("x", EnumDirection.EnumDirectionLimit.HORIZONTAL), Y("y", EnumDirection.EnumDirectionLimit.VERTICAL), Z("z", EnumDirection.EnumDirectionLimit.HORIZONTAL); X("x", EnumDirection.EnumDirectionLimit.HORIZONTAL), Y("y", EnumDirection.EnumDirectionLimit.VERTICAL), Z("z", EnumDirection.EnumDirectionLimit.HORIZONTAL);

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.elevatemc.spigot.util.FastRandom; import com.elevatemc.spigot.util.FastRandom;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -58,7 +59,7 @@ public class Explosion {
Block b = world.getChunkAt((int)posX >> 4, (int)posZ >> 4).getBlockData(new BlockPosition(posX, posY, posZ)).getBlock(); // TacoSpigot - get block of the explosion Block b = world.getChunkAt((int)posX >> 4, (int)posZ >> 4).getBlockData(new BlockPosition(posX, posY, posZ)).getBlock(); // TacoSpigot - get block of the explosion
if (!this.world.tacoSpigotConfig.optimizeLiquidExplosions || !b.getMaterial().isLiquid()) { //TacoSpigot - skip calculating what blocks to blow up in water/lava if (!this.world.paperSpigotConfig.optimizeLiquidExplosions || !b.getMaterial().isLiquid()) { //TacoSpigot - skip calculating what blocks to blow up in water/lava
for (int k = 0; k < 16; ++k) { for (int k = 0; k < 16; ++k) {
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
@ -170,9 +171,9 @@ public class Explosion {
this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", volume, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", volume, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
// PaperSpigot end // PaperSpigot end
if (this.size >= 2.0F && this.b) { if (this.size >= 2.0F && this.b) {
this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} else { } else {
this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
Iterator iterator; Iterator iterator;
@ -248,8 +249,8 @@ public class Explosion {
d3 *= d7; d3 *= d7;
d4 *= d7; d4 *= d7;
d5 *= d7; d5 *= d7;
this.world.addParticle(EnumParticle.EXPLOSION_NORMAL, (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5, new int[0]); this.world.addParticle(EnumParticle.EXPLOSION_NORMAL, (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5, Constants.EMPTY_ARRAY);
this.world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); this.world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, Constants.EMPTY_ARRAY);
} }
if (block.getMaterial() != Material.AIR) { if (block.getMaterial() != Material.AIR) {

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import java.util.Date; import java.util.Date;
@ -36,7 +37,7 @@ public class GameProfileBanEntry extends ExpirableListEntry<GameProfile> {
String s = jsonobject.get("uuid").getAsString(); String s = jsonobject.get("uuid").getAsString();
try { try {
uuid = UUID.fromString(s); uuid = FastUUID.parseUUID(s);
} catch (Throwable ignored) { } catch (Throwable ignored) {
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import java.util.Iterator; import java.util.Iterator;
@ -25,7 +26,7 @@ public final class GameProfileSerializer {
UUID uuid; UUID uuid;
try { try {
uuid = UUID.fromString(s1); uuid = FastUUID.parseUUID(s1);
} catch (Throwable throwable) { } catch (Throwable throwable) {
uuid = null; uuid = null;
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -12,7 +13,7 @@ public class Item {
public static final RegistryMaterials<MinecraftKey, Item> REGISTRY = new RegistryMaterials(); public static final RegistryMaterials<MinecraftKey, Item> REGISTRY = new RegistryMaterials();
private static final Map<Block, Item> a = Maps.newHashMap(); private static final Map<Block, Item> a = Maps.newHashMap();
protected static final UUID f = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); protected static final UUID f = FastUUID.parseUUID("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
private CreativeModeTab b; private CreativeModeTab b;
protected static Random g = new Random(); protected static Random g = new Random();
protected int maxStackSize = 64; protected int maxStackSize = 64;

View File

@ -1,6 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
import com.elevatemc.spigot.util.Constants;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
@ -154,7 +155,7 @@ public class ItemBucket extends Item {
world.makeSound((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); world.makeSound((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) { for (int l = 0; l < 8; ++l) {
world.addParticle(EnumParticle.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]); world.addParticle(EnumParticle.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
} }
} else { } else {
if (!world.isClientSide && flag && !material.isLiquid()) { if (!world.isClientSide && flag && !material.isLiquid()) {

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
public class ItemEnderEye extends Item { public class ItemEnderEye extends Item {
public ItemEnderEye() { public ItemEnderEye() {
@ -25,7 +27,7 @@ public class ItemEnderEye extends Item {
double d4 = 0.0D; double d4 = 0.0D;
double d5 = 0.0D; double d5 = 0.0D;
world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, Constants.EMPTY_ARRAY);
} }
EnumDirection enumdirection1 = (EnumDirection) iblockdata.get(BlockEnderPortalFrame.FACING); EnumDirection enumdirection1 = (EnumDirection) iblockdata.get(BlockEnderPortalFrame.FACING);

View File

@ -16,6 +16,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64; import io.netty.handler.codec.base64.Base64;
import io.netty.util.ResourceLeakDetector;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import com.elevatemc.spigot.eSpigot; import com.elevatemc.spigot.eSpigot;
import net.minecrell.terminalconsole.TerminalConsoleAppender; import net.minecrell.terminalconsole.TerminalConsoleAppender;
@ -176,7 +177,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
private final ThreadingManager threadingManager; private final ThreadingManager threadingManager;
public MinecraftServer(OptionSet options, Proxy proxy, File file1) { public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
io.netty.util.ResourceLeakDetector.setEnabled(false); // Spigot - disable io.netty.util.ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // [Nacho-0040] Change deprecated Netty parameter // Spigot - disable
this.e = proxy; this.e = proxy;
this.threadingManager = new ThreadingManager(); this.threadingManager = new ThreadingManager();
MinecraftServer.l = this; MinecraftServer.l = this;

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -194,7 +195,7 @@ public class MobEffectList {
} }
public MobEffectList a(IAttribute iattribute, String s, double d0, int i) { public MobEffectList a(IAttribute iattribute, String s, double d0, int i) {
AttributeModifier attributemodifier = new AttributeModifier(UUID.fromString(s), this.a(), d0, i); AttributeModifier attributemodifier = new AttributeModifier(FastUUID.parseUUID(s), this.a(), d0, i);
this.J.put(iattribute, attributemodifier); this.J.put(iattribute, attributemodifier);
return this; return this;

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -75,8 +76,8 @@ public abstract class MobSpawnerAbstract {
double d2 = (float) blockposition.getY() + this.a().random.nextFloat(); double d2 = (float) blockposition.getY() + this.a().random.nextFloat();
d0 = (float) blockposition.getZ() + this.a().random.nextFloat(); d0 = (float) blockposition.getZ() + this.a().random.nextFloat();
this.a().addParticle(EnumParticle.SMOKE_NORMAL, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]); this.a().addParticle(EnumParticle.SMOKE_NORMAL, d1, d2, d0, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
this.a().addParticle(EnumParticle.FLAME, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]); this.a().addParticle(EnumParticle.FLAME, d1, d2, d0, 0.0D, 0.0D, 0.0D, Constants.EMPTY_ARRAY);
if (this.spawnDelay > 0) { if (this.spawnDelay > 0) {
this.spawnDelay -= tickDelay; // PaperSpigot this.spawnDelay -= tickDelay; // PaperSpigot
} }

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
import java.io.IOException; import java.io.IOException;
@ -201,7 +203,7 @@ public class NBTTagCompound extends NBTBase {
public int[] getIntArray(String s) { public int[] getIntArray(String s) {
try { try {
return !this.hasKeyOfType(s, 11) ? new int[0] : ((NBTTagIntArray) this.map.get(s)).c(); return !this.hasKeyOfType(s, 11) ? Constants.EMPTY_ARRAY : ((NBTTagIntArray) this.map.get(s)).c();
} catch (ClassCastException classcastexception) { } catch (ClassCastException classcastexception) {
throw new ReportedException(this.a(s, 11, classcastexception)); throw new ReportedException(this.a(s, 11, classcastexception));
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
@ -131,9 +132,9 @@ public class NBTTagList extends NBTBase {
if (i >= 0 && i < this.list.size()) { if (i >= 0 && i < this.list.size()) {
NBTBase nbtbase = this.list.get(i); NBTBase nbtbase = this.list.get(i);
return nbtbase.getTypeId() == 11 ? ((NBTTagIntArray) nbtbase).c() : new int[0]; return nbtbase.getTypeId() == 11 ? ((NBTTagIntArray) nbtbase).c() : Constants.EMPTY_ARRAY;
} else { } else {
return new int[0]; return Constants.EMPTY_ARRAY;
} }
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
@ -330,7 +331,7 @@ public class NameReferencingFileConverter {
if (uuid == null) { if (uuid == null) {
throw new NameReferencingFileConverter.FileConversionException("Missing UUID for user profile " + gameprofile.getName(), null); throw new NameReferencingFileConverter.FileConversionException("Missing UUID for user profile " + gameprofile.getName(), null);
} else { } else {
this.a(file, this.a(gameprofile), uuid.toString()); this.a(file, this.a(gameprofile), FastUUID.toString(uuid));
} }
} }

View File

@ -126,16 +126,6 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
super.channelActive(channelhandlercontext); super.channelActive(channelhandlercontext);
this.channel = channelhandlercontext.channel(); this.channel = channelhandlercontext.channel();
this.l = this.channel.remoteAddress(); this.l = this.channel.remoteAddress();
// eSpigot start
ChannelConfig config = this.channel.config();
config.setOption(ChannelOption.SO_KEEPALIVE, true);
config.setOption(ChannelOption.TCP_NODELAY, true);
config.setOption(ChannelOption.TCP_FASTOPEN, 1);
config.setOption(ChannelOption.TCP_FASTOPEN_CONNECT, true);
config.setOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
config.setOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(8 * 1024, 32 * 1024));
config.setOption(ChannelOption.IP_TOS, 0x18);
// eSpigot end
// Spigot Start // Spigot Start
this.preparing = false; this.preparing = false;

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import java.util.UUID; import java.util.UUID;
@ -46,7 +47,7 @@ public class OpListEntry extends JsonListEntry<GameProfile> {
UUID uuid; UUID uuid;
try { try {
uuid = UUID.fromString(s); uuid = FastUUID.parseUUID(s);
} catch (Throwable throwable) { } catch (Throwable throwable) {
return null; return null;
} }

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import java.io.IOException; import java.io.IOException;
import java.util.UUID; import java.util.UUID;
@ -17,7 +18,7 @@ public class PacketLoginOutSuccess implements Packet<PacketLoginOutListener> {
public void a(PacketDataSerializer packetdataserializer) throws IOException { public void a(PacketDataSerializer packetdataserializer) throws IOException {
String s = packetdataserializer.c(36); String s = packetdataserializer.c(36);
String s1 = packetdataserializer.c(16); String s1 = packetdataserializer.c(16);
UUID uuid = UUID.fromString(s); UUID uuid = FastUUID.parseUUID(s);
this.a = new GameProfile(uuid, s1); this.a = new GameProfile(uuid, s1);
} }
@ -25,7 +26,7 @@ public class PacketLoginOutSuccess implements Packet<PacketLoginOutListener> {
public void b(PacketDataSerializer packetdataserializer) throws IOException { public void b(PacketDataSerializer packetdataserializer) throws IOException {
UUID uuid = this.a.getId(); UUID uuid = this.a.getId();
packetdataserializer.a(uuid == null ? "" : uuid.toString()); packetdataserializer.a(uuid == null ? "" : FastUUID.toString(uuid));
packetdataserializer.a(this.a.getName()); packetdataserializer.a(this.a.getName());
} }

View File

@ -14,6 +14,10 @@ public class PacketPlayInCloseWindow implements Packet<PacketListenerPlayIn> {
} }
// CraftBukkit end // CraftBukkit end
public int getId() {
return id;
}
public void a(PacketListenerPlayIn packetlistenerplayin) { public void a(PacketListenerPlayIn packetlistenerplayin) {
packetlistenerplayin.a(this); packetlistenerplayin.a(this);
} }
@ -26,3 +30,4 @@ public class PacketPlayInCloseWindow implements Packet<PacketListenerPlayIn> {
packetdataserializer.writeByte(this.id); packetdataserializer.writeByte(this.id);
} }
} }

View File

@ -19,7 +19,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
this.b = chunk.locZ; this.b = chunk.locZ;
this.d = flag; this.d = flag;
this.c = chunk.getChunkMap(flag, i); // PaperSpigot this.c = chunk.getChunkMap(flag, i); // PaperSpigot
chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world); chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, c.b, c.a, chunk.world);
} }
public void a(PacketDataSerializer packetdataserializer) throws IOException { public void a(PacketDataSerializer packetdataserializer) throws IOException {

View File

@ -23,11 +23,11 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
Chunk chunk = list.get(j); Chunk chunk = list.get(j);
PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = chunk.getChunkMap(true, '\uffff'); // PaperSpigot PacketPlayOutMapChunk.ChunkMap map = chunk.getChunkMap(true, '\uffff'); // PaperSpigot
this.a[j] = chunk.locX; this.a[j] = chunk.locX;
this.b[j] = chunk.locZ; this.b[j] = chunk.locZ;
this.c[j] = packetplayoutmapchunk_chunkmap; this.c[j] = map;
} }
world = list.get(0).getWorld(); // Spigot world = list.get(0).getWorld(); // Spigot

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.util.Constants;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -104,7 +106,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
double d4 = 0.5D + random.nextDouble() * (double) this.d.length; double d4 = 0.5D + random.nextDouble() * (double) this.d.length;
double d5 = random.nextDouble() * (double) this.d.width * 2.0D - (double) this.d.width; double d5 = random.nextDouble() * (double) this.d.width * 2.0D - (double) this.d.width;
this.a.addParticle(EnumParticle.HEART, this.d.locX + d3, this.d.locY + d4, this.d.locZ + d5, d0, d1, d2, new int[0]); this.a.addParticle(EnumParticle.HEART, this.d.locX + d3, this.d.locY + d4, this.d.locZ + d5, d0, d1, d2, Constants.EMPTY_ARRAY);
} }
if (this.a.getGameRules().getBoolean("doMobLoot")) { if (this.a.getGameRules().getBoolean("doMobLoot")) {

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.config.eSpigotConfig;
import com.elevatemc.spigot.eSpigot; import com.elevatemc.spigot.eSpigot;
import com.elevatemc.spigot.handler.MovementHandler; import com.elevatemc.spigot.handler.MovementHandler;
import com.elevatemc.spigot.handler.PacketHandler; import com.elevatemc.spigot.handler.PacketHandler;
@ -67,7 +68,6 @@ import co.aikar.timings.SpigotTimings; // Spigot
// CraftBukkit end // CraftBukkit end
import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot
import com.elevatemc.spigot.eSpigotFeature;
public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox { public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox {
@ -636,7 +636,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
return; return;
case 3: // RELEASE_USE_ITEM case 3: // RELEASE_USE_ITEM
if (eSpigotFeature.FIX_SPRINT_EAT_EXPLOIT.isEnabled()) if (eSpigotConfig.fixSprintEatExploit)
this.player.bU(); // eSpigot - Patch eat while running glitch this.player.bU(); // eSpigot - Patch eat while running glitch
this.player.setSprinting(true); this.player.setSprinting(true);
@ -1541,10 +1541,12 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u());
// Nacho: only fire InventoryCloseEvent if inventory is open
if (packetplayinclosewindow.getId() == player.activeContainer.windowId) {
CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
this.player.p(); this.player.p();
} }
}
public void a(PacketPlayInWindowClick packetplayinwindowclick) { public void a(PacketPlayInWindowClick packetplayinwindowclick) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.elevatemc.spigot.config.eSpigotConfig;
import com.elevatemc.spigot.console.PandaConsoleCommandSender; import com.elevatemc.spigot.console.PandaConsoleCommandSender;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -9,14 +11,8 @@ import io.netty.buffer.Unpooled;
import java.io.File; import java.io.File;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.elevatemc.spigot.eSpigotFeature;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -57,6 +53,7 @@ public abstract class PlayerList {
private final GameProfileBanList k; private final GameProfileBanList k;
private final IpBanList l; private final IpBanList l;
private final OpList operators; private final OpList operators;
private Set<UUID> fastOperator = new HashSet<>();
private final WhiteList whitelist; private final WhiteList whitelist;
private final Map<UUID, ServerStatisticManager> o; private final Map<UUID, ServerStatisticManager> o;
public IPlayerFileData playerFileData; public IPlayerFileData playerFileData;
@ -79,6 +76,9 @@ public abstract class PlayerList {
this.k = new GameProfileBanList(PlayerList.a); this.k = new GameProfileBanList(PlayerList.a);
this.l = new IpBanList(PlayerList.b); this.l = new IpBanList(PlayerList.b);
this.operators = new OpList(PlayerList.c); this.operators = new OpList(PlayerList.c);
for (OpListEntry value : this.operators.getValues()) {
this.fastOperator.add(value.getKey().getId());
}
this.whitelist = new WhiteList(PlayerList.d); this.whitelist = new WhiteList(PlayerList.d);
this.o = Maps.newHashMap(); this.o = Maps.newHashMap();
this.server = minecraftserver; this.server = minecraftserver;
@ -328,11 +328,11 @@ public abstract class PlayerList {
for (EntityPlayer player : this.players) { for (EntityPlayer player : this.players) {
EntityPlayer entityplayer1 = player; EntityPlayer entityplayer1 = player;
if (eSpigotFeature.SHOW_HIDDEN_PLAYERS_IN_TAB.isEnabled() || entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { if (eSpigotConfig.showHiddenPlayersInTab || entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
entityplayer1.playerConnection.sendPacket(packet); entityplayer1.playerConnection.sendPacket(packet);
} }
if (!entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity()) && !eSpigotFeature.SHOW_HIDDEN_PLAYERS_IN_TAB.isEnabled()) { if (!entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity()) && !eSpigotConfig.showHiddenPlayersInTab) {
continue; continue;
} }
@ -1020,6 +1020,7 @@ public abstract class PlayerList {
public void addOp(GameProfile gameprofile) { public void addOp(GameProfile gameprofile) {
this.operators.add(new OpListEntry(gameprofile, this.server.p(), this.operators.b(gameprofile))); this.operators.add(new OpListEntry(gameprofile, this.server.p(), this.operators.b(gameprofile)));
this.fastOperator.add(gameprofile.getId());
// CraftBukkit start // CraftBukkit start
Player player = server.server.getPlayer(gameprofile.getId()); Player player = server.server.getPlayer(gameprofile.getId());
@ -1031,6 +1032,7 @@ public abstract class PlayerList {
public void removeOp(GameProfile gameprofile) { public void removeOp(GameProfile gameprofile) {
this.operators.remove(gameprofile); this.operators.remove(gameprofile);
this.fastOperator.remove(gameprofile.getId());
// CraftBukkit start // CraftBukkit start
Player player = server.server.getPlayer(gameprofile.getId()); Player player = server.server.getPlayer(gameprofile.getId());
@ -1041,11 +1043,11 @@ public abstract class PlayerList {
} }
public boolean isWhitelisted(GameProfile gameprofile) { public boolean isWhitelisted(GameProfile gameprofile) {
return !this.hasWhitelist || this.operators.d(gameprofile) || this.whitelist.d(gameprofile); return !this.hasWhitelist || this.fastOperator.contains(gameprofile.getId()) || this.whitelist.d(gameprofile);
} }
public boolean isOp(GameProfile gameprofile) { public boolean isOp(GameProfile gameprofile) {
return this.operators.d(gameprofile) || this.server.T() && this.server.worlds.get(0).getWorldData().v() && this.server.S().equalsIgnoreCase(gameprofile.getName()) || this.t; // CraftBukkit return this.fastOperator.contains(gameprofile.getId()) || this.server.T() && this.server.worlds.get(0).getWorldData().v() && this.server.S().equalsIgnoreCase(gameprofile.getName()) || this.t; // CraftBukkit
} }
public EntityPlayer getPlayer(String s) { public EntityPlayer getPlayer(String s) {
@ -1057,6 +1059,7 @@ public abstract class PlayerList {
} }
public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) { public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) {
double squared = d3 * d3;
for (EntityPlayer player : this.players) { for (EntityPlayer player : this.players) {
EntityPlayer entityplayer = player; EntityPlayer entityplayer = player;
@ -1071,7 +1074,7 @@ public abstract class PlayerList {
double d5 = d1 - entityplayer.locY; double d5 = d1 - entityplayer.locY;
double d6 = d2 - entityplayer.locZ; double d6 = d2 - entityplayer.locZ;
if (d4 * d4 + d5 * d5 + d6 * d6 < d3 * d3) { if (d4 * d4 + d5 * d5 + d6 * d6 < squared) {
entityplayer.playerConnection.sendPacket(packet); entityplayer.playerConnection.sendPacket(packet);
} }
} }
@ -1249,7 +1252,7 @@ public abstract class PlayerList {
if (serverstatisticmanager == null) { if (serverstatisticmanager == null) {
File file = new File(this.server.getWorldServer(0).getDataManager().getDirectory(), "stats"); File file = new File(this.server.getWorldServer(0).getDataManager().getDirectory(), "stats");
File file1 = new File(file, uuid.toString() + ".json"); File file1 = new File(file, FastUUID.toString(uuid) + ".json");
if (!file1.exists()) { if (!file1.exists()) {
File file2 = new File(file, entityhuman.getName() + ".json"); File file2 = new File(file, entityhuman.getName() + ".json");

View File

@ -4,12 +4,8 @@ import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.velocitypowered.natives.util.Natives; import com.velocitypowered.natives.util.Natives;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel; import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.ChannelException; import io.netty.channel.*;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.Epoll; import io.netty.channel.epoll.Epoll;
import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollServerSocketChannel; import io.netty.channel.epoll.EpollServerSocketChannel;
@ -92,6 +88,7 @@ public class ServerConnection {
Class oclass; Class oclass;
LazyInitVar lazyinitvar; LazyInitVar lazyinitvar;
try {
if (Epoll.isAvailable() && this.f.ai()) { if (Epoll.isAvailable() && this.f.ai()) {
// PandaSpigot start - Unix domain socket support // PandaSpigot start - Unix domain socket support
if (address instanceof io.netty.channel.unix.DomainSocketAddress) { if (address instanceof io.netty.channel.unix.DomainSocketAddress) {
@ -107,6 +104,12 @@ public class ServerConnection {
lazyinitvar = ServerConnection.a; lazyinitvar = ServerConnection.a;
ServerConnection.e.info("Using default channel type"); ServerConnection.e.info("Using default channel type");
} }
} catch (Exception e) {
ServerConnection.e.warn("An error occurred trying to check if Epoll is available, falling back to default channel type.");
oclass = NioServerSocketChannel.class;
lazyinitvar = ServerConnection.a;
ServerConnection.e.info("Using default channel type");
}
// Paper start - indicate Velocity natives in use // Paper start - indicate Velocity natives in use
MinecraftServer.LOGGER.info("Using " + Natives.compress.getLoadedVariant() + " compression from Velocity."); MinecraftServer.LOGGER.info("Using " + Natives.compress.getLoadedVariant() + " compression from Velocity.");
@ -115,11 +118,6 @@ public class ServerConnection {
this.g.add((new ServerBootstrap()).channel(oclass).childHandler(new ChannelInitializer() { this.g.add((new ServerBootstrap()).channel(oclass).childHandler(new ChannelInitializer() {
protected void initChannel(Channel channel) throws Exception { protected void initChannel(Channel channel) throws Exception {
try {
channel.config().setOption(ChannelOption.TCP_NODELAY, Boolean.TRUE);
} catch (ChannelException ignored) {
}
// KigPaper start // KigPaper start
if(PaperSpigotConfig.nettyReadTimeout) channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)); if(PaperSpigotConfig.nettyReadTimeout) channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30));
// KigPaper end // KigPaper end

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer; import com.google.gson.JsonDeserializer;
@ -202,7 +203,7 @@ public class ServerPing {
JsonObject jsonobject1 = ChatDeserializer.l(jsonarray.get(i), "player[" + i + "]"); JsonObject jsonobject1 = ChatDeserializer.l(jsonarray.get(i), "player[" + i + "]");
String s = ChatDeserializer.h(jsonobject1, "id"); String s = ChatDeserializer.h(jsonobject1, "id");
agameprofile[i] = new GameProfile(UUID.fromString(s), ChatDeserializer.h(jsonobject1, "name")); agameprofile[i] = new GameProfile(FastUUID.parseUUID(s), ChatDeserializer.h(jsonobject1, "name"));
} }
serverping_serverpingplayersample.a(agameprofile); serverping_serverpingplayersample.a(agameprofile);
@ -224,7 +225,7 @@ public class ServerPing {
JsonObject jsonobject1 = new JsonObject(); JsonObject jsonobject1 = new JsonObject();
UUID uuid = serverping_serverpingplayersample.c()[i].getId(); UUID uuid = serverping_serverpingplayersample.c()[i].getId();
jsonobject1.addProperty("id", uuid == null ? "" : uuid.toString()); jsonobject1.addProperty("id", uuid == null ? "" : FastUUID.toString(uuid));
jsonobject1.addProperty("name", serverping_serverpingplayersample.c()[i].getName()); jsonobject1.addProperty("name", serverping_serverpingplayersample.c()[i].getName());
jsonarray.add(jsonobject1); jsonarray.add(jsonobject1);
} }

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import org.bukkit.craftbukkit.util.LongHash; import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashSet; import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@ -20,28 +21,40 @@ public final class SpawnerCreature {
// Spigot start - get entity count only from chunks being processed in b // Spigot start - get entity count only from chunks being processed in b
private int getEntityCount(WorldServer server, Class oClass) private int getEntityCount(WorldServer server, Class oClass)
{ {
// NachoSpigot start - remove Steam
int sum = 0;
for (ObjectIterator<Chunk> objectIterator = (server.chunkProviderServer).chunks.values().iterator(); objectIterator.hasNext(); ) {
Chunk c = objectIterator.next();
sum += c.entityCount.get(oClass);
}
return sum;
// NachoSpigot end
// TacoSpigot start - use entire world, not just active chunks. Spigot broke vanilla expectations. // TacoSpigot start - use entire world, not just active chunks. Spigot broke vanilla expectations.
if (true) { // if (true) {
return server //
.chunkProviderServer // server.chunkProviderServer.chunks.values().iterator()
.chunks.values() // return server
.stream() // .chunkProviderServer
.collect(java.util.stream.Collectors.summingInt(c -> c.entityCount.get(oClass))); // .chunks.values()
} // .stream()
// TacoSpigot end // .collect(java.util.stream.Collectors.summingInt(c -> c.entityCount.get(oClass)));
int i = 0; // }
Iterator<Long> it = this.b.iterator(); // // TacoSpigot end
while ( it.hasNext() ) // int i = 0;
{ // Iterator<Long> it = this.b.iterator();
Long coord = it.next(); // while ( it.hasNext() )
int x = LongHash.msw( coord ); // {
int z = LongHash.lsw( coord ); // Long coord = it.next();
if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) ) // int x = LongHash.msw( coord );
{ // int z = LongHash.lsw( coord );
i += server.getChunkAt( x, z ).entityCount.get( oClass ); // if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
} // {
} // i += server.getChunkAt( x, z ).entityCount.get( oClass );
return i; // }
// }
// return i;
} }
// Spigot end // Spigot end

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import com.elevatemc.spigot.config.eSpigotConfig;
import java.util.Random; import java.util.Random;
public class TileEntityEnchantTable extends TileEntity implements IUpdatePlayerListBox, ITileEntityContainer { public class TileEntityEnchantTable extends TileEntity implements IUpdatePlayerListBox, ITileEntityContainer {
@ -36,6 +38,9 @@ public class TileEntityEnchantTable extends TileEntity implements IUpdatePlayerL
} }
public void c() { public void c() {
if (!eSpigotConfig.enchantmentTableTicking) {
return;
}
this.k = this.j; this.k = this.j;
this.m = this.l; this.m = this.l;
EntityHuman entityhuman = this.world.findNearbyPlayer((double) ((float) this.position.getX() + 0.5F), (double) ((float) this.position.getY() + 0.5F), (double) ((float) this.position.getZ() + 0.5F), 3.0D); EntityHuman entityhuman = this.world.findNearbyPlayer((double) ((float) this.position.getX() + 0.5F), (double) ((float) this.position.getY() + 0.5F), (double) ((float) this.position.getZ() + 0.5F), 3.0D);

View File

@ -350,6 +350,8 @@ public class TileEntityFurnace extends TileEntityContainer implements IUpdatePla
} }
} }
if(item == Items.COAL) return 1600;
return item instanceof ItemTool && ((ItemTool) item).h().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).h().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).g().equals("WOOD") ? 200 : (item == Items.STICK ? 100 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item == Item.getItemOf(Blocks.SAPLING) ? 100 : (item == Items.BLAZE_ROD ? 2400 : 0))))))); return item instanceof ItemTool && ((ItemTool) item).h().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).h().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).g().equals("WOOD") ? 200 : (item == Items.STICK ? 100 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item == Item.getItemOf(Blocks.SAPLING) ? 100 : (item == Items.BLAZE_ROD ? 2400 : 0)))))));
} }
} }

View File

@ -202,7 +202,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
} }
} }
// PaperSpigot start // PaperSpigot start
if (world.paperSpigotConfig.useHopperCheck && !world.tacoSpigotConfig.isHopperPushBased && !this.n()) { // TacoSpigot - dont use hopper check in push mode if (world.paperSpigotConfig.useHopperCheck && !world.paperSpigotConfig.isHopperPushBased && !this.n()) { // TacoSpigot - dont use hopper check in push mode
this.d(world.spigotConfig.hopperCheck); this.d(world.spigotConfig.hopperCheck);
} }
// PaperSpigot end // PaperSpigot end
@ -367,7 +367,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
@Deprecated @Deprecated
public static boolean a(IHopper ihopper) { public static boolean a(IHopper ihopper) {
IInventory iinventory; IInventory iinventory;
if (ihopper.getWorld().tacoSpigotConfig.isHopperPushBased && ihopper instanceof TileEntityHopper) { if (ihopper.getWorld().paperSpigotConfig.isHopperPushBased && ihopper instanceof TileEntityHopper) {
BlockPosition pos = ((TileEntityHopper) ihopper).getPosition().up(); // Only pull from a above, because everything else comes to us BlockPosition pos = ((TileEntityHopper) ihopper).getPosition().up(); // Only pull from a above, because everything else comes to us
iinventory = HopperHelper.getInventory(ihopper.getWorld(), pos); iinventory = HopperHelper.getInventory(ihopper.getWorld(), pos);
} else { } else {
@ -403,7 +403,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
} }
} }
} }
} else if (!ihopper.getWorld().tacoSpigotConfig.isHopperPushBased || !(ihopper instanceof TileEntityHopper)) { // TacoSpigot - only search for entities in 'pull mode' } else if (!ihopper.getWorld().paperSpigotConfig.isHopperPushBased || !(ihopper instanceof TileEntityHopper)) { // TacoSpigot - only search for entities in 'pull mode'
for (EntityItem entityitem : a(ihopper.getWorld(), ihopper.A(), ihopper.B() + 1.0D, ihopper.C())) { for (EntityItem entityitem : a(ihopper.getWorld(), ihopper.A(), ihopper.B() + 1.0D, ihopper.C())) {
if (a(ihopper, entityitem)) { if (a(ihopper, entityitem)) {

View File

@ -1,5 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import com.eatthepath.uuid.FastUUID;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -287,7 +288,7 @@ public class UserCache {
jsonobject.addProperty("name", usercache_usercacheentry.a().getName()); jsonobject.addProperty("name", usercache_usercacheentry.a().getName());
UUID uuid = usercache_usercacheentry.a().getId(); UUID uuid = usercache_usercacheentry.a().getId();
jsonobject.addProperty("uuid", uuid == null ? "" : uuid.toString()); jsonobject.addProperty("uuid", uuid == null ? "" : FastUUID.toString(uuid));
jsonobject.addProperty("expiresOn", UserCache.a.format(usercache_usercacheentry.b())); jsonobject.addProperty("expiresOn", UserCache.a.format(usercache_usercacheentry.b()));
return jsonobject; return jsonobject;
} }
@ -316,7 +317,7 @@ public class UserCache {
UUID uuid; UUID uuid;
try { try {
uuid = UUID.fromString(s); uuid = FastUUID.parseUUID(s);
} catch (Throwable throwable) { } catch (Throwable throwable) {
return null; return null;
} }

Some files were not shown because too many files have changed in this diff Show More