3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 05:20:07 +01:00

Fix formatting.

Dieser Commit ist enthalten in:
Erik Broes 2012-01-14 23:02:10 +01:00
Ursprung 61ec751ca1
Commit a4ce846d07
68 geänderte Dateien mit 322 neuen und 465 gelöschten Zeilen

Datei anzeigen

@ -9,6 +9,7 @@ import java.util.logging.Logger;
import java.util.logging.Handler;
import org.bukkit.craftbukkit.util.ShortConsoleLogFormatter;
import org.bukkit.craftbukkit.util.TerminalConsoleHandler;
// CraftBukkit end
public class ConsoleLogManager {
@ -16,7 +17,8 @@ public class ConsoleLogManager {
public static Logger a = Logger.getLogger("Minecraft");
public static Logger global = Logger.getLogger(""); // CraftBukkit
public ConsoleLogManager() {}
public ConsoleLogManager() {
}
// CraftBukkit - change of method signature!
public static void init(MinecraftServer server) {

Datei anzeigen

@ -3,7 +3,7 @@ package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit End
// CraftBukkit end
public class EntityItem extends Entity {

Datei anzeigen

@ -71,8 +71,7 @@ public class ItemBlock extends Item {
CraftBlockState blockStateBelow = null;
// Toggles whether the normal or the block below is used for the place event
boolean eventUseBlockBelow = false;
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
// Step is placed on step, forms a doublestep replacing the original step, so we need the lower block
eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id;

Datei anzeigen

@ -65,6 +65,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
this.server = minecraftserver.server;
}
private final CraftServer server;
private int lastTick = MinecraftServer.currentTick;
private int lastDropTick = MinecraftServer.currentTick;

Datei anzeigen

@ -18,13 +18,16 @@ public final class SpawnerCreature {
// private static HashMap b = new HashMap(); // CraftBukkit - moved local to spawnEntities
static private class ChunkEntry extends EntryBase {
public boolean spawn;
public ChunkEntry(int x, int z, boolean spawn) {
super(LongHash.toLong(x, z));
this.spawn = spawn;
}
int getX() {
return LongHash.msw(key);
}
int getZ() {
return LongHash.lsw(key);
}

Datei anzeigen

@ -15,6 +15,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
// CraftBukkit start
private int lastTick = (int) (System.currentTimeMillis() / 50);
public ItemStack[] getContents() {
return this.items;
}

Datei anzeigen

@ -864,7 +864,6 @@ public class World implements IBlockAccess {
return this.addEntity(entity, SpawnReason.CUSTOM); // Set reason as Custom by default
}
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
// CraftBukkit end
int i = MathHelper.floor(entity.locX / 16.0D);

Datei anzeigen

@ -5,6 +5,7 @@ import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.block.CraftBlock;
import net.minecraft.server.BiomeBase;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
* Purpose is to allow clean, efficient copy of a chunk data to be made, and then handed off for processing in another thread (e.g. map rendering)
@ -23,9 +24,6 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
private static final int BLOCKLIGHT_OFF = BLOCKDATA_OFF + 16384;
private static final int SKYLIGHT_OFF = BLOCKLIGHT_OFF + 16384;
/**
* Constructor
*/
CraftChunkSnapshot(int x, int z, String wname, long wtime, byte[] buf, byte[] hmap, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
this.x = x;
this.z = z;
@ -38,135 +36,56 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
this.biomeRain = biomeRain;
}
/**
* Gets the X-coordinate of this chunk
*
* @return X-coordinate
*/
public int getX() {
return x;
}
/**
* Gets the Z-coordinate of this chunk
*
* @return Z-coordinate
*/
public int getZ() {
return z;
}
/**
* Gets name of the world containing this chunk
*
* @return Parent World Name
*/
public String getWorldName() {
return worldname;
}
/**
* Get block type for block at corresponding coordinate in the chunk
*
* @param x 0-15
* @param y 0-127
* @param z 0-15
* @return 0-255
*/
public int getBlockTypeId(int x, int y, int z) {
return buf[x << 11 | z << 7 | y] & 255;
}
/**
* Get block data for block at corresponding coordinate in the chunk
*
* @param x 0-15
* @param y 0-127
* @param z 0-15
* @return 0-15
*/
public int getBlockData(int x, int y, int z) {
int off = ((x << 10) | (z << 6) | (y >> 1)) + BLOCKDATA_OFF;
return ((y & 1) == 0) ? (buf[off] & 0xF) : ((buf[off] >> 4) & 0xF);
}
/**
* Get sky light level for block at corresponding coordinate in the chunk
*
* @param x 0-15
* @param y 0-127
* @param z 0-15
* @return 0-15
*/
public int getBlockSkyLight(int x, int y, int z) {
int off = ((x << 10) | (z << 6) | (y >> 1)) + SKYLIGHT_OFF;
return ((y & 1) == 0) ? (buf[off] & 0xF) : ((buf[off] >> 4) & 0xF);
}
/**
* Get light level emitted by block at corresponding coordinate in the chunk
*
* @param x 0-15
* @param y 0-127
* @param z 0-15
* @return 0-15
*/
public int getBlockEmittedLight(int x, int y, int z) {
int off = ((x << 10) | (z << 6) | (y >> 1)) + BLOCKLIGHT_OFF;
return ((y & 1) == 0) ? (buf[off] & 0xF) : ((buf[off] >> 4) & 0xF);
}
/**
* Gets the highest non-air coordinate at the given coordinates
*
* @param x X-coordinate of the blocks
* @param z Z-coordinate of the blocks
* @return Y-coordinate of the highest non-air block
*/
public int getHighestBlockYAt(int x, int z) {
return hmap[z << 4 | x] & 255;
}
/**
* Get biome at given coordinates
*
* @param x X-coordinate
* @param z Z-coordinate
* @return Biome at given coordinate
*/
public Biome getBiome(int x, int z) {
return CraftBlock.biomeBaseToBiome(biome[z << 4 | x]);
}
/**
* Get raw biome temperature (0.0-1.0) at given coordinate
*
* @param x X-coordinate
* @param z Z-coordinate
* @return temperature at given coordinate
*/
public double getRawBiomeTemperature(int x, int z) {
return biomeTemp[z << 4 | x];
}
/**
* Get raw biome rainfall (0.0-1.0) at given coordinate
*
* @param x X-coordinate
* @param z Z-coordinate
* @return rainfall at given coordinate
*/
public double getRawBiomeRainfall(int x, int z) {
return biomeRain[z << 4 | x];
}
/**
* Get world full time when chunk snapshot was captured
* @return time in ticks
*/
public long getCaptureFullTime() {
return captureFulltime;
}

Datei anzeigen

@ -372,7 +372,6 @@ public final class CraftServer implements Server {
return server;
}
// NOTE: Should only be called from MinecraftServer.b()
public boolean dispatchCommand(CommandSender sender, ServerCommand serverCommand) {
return dispatchCommand(sender, serverCommand.command);
@ -918,8 +917,7 @@ public final class CraftServer implements Server {
int spaceLeft = 16 - oldName.length();
if (spaceLeft <= 1) { // We also hit the list name length limit!
entityPlayer.listName = oldName.subSequence(0, oldName.length() - 2 - spaceLeft)
+ String.valueOf(System.currentTimeMillis() % 99);
entityPlayer.listName = oldName.subSequence(0, oldName.length() - 2 - spaceLeft) + String.valueOf(System.currentTimeMillis() % 99);
} else {
entityPlayer.listName = oldName + String.valueOf(System.currentTimeMillis() % 99);
}

Datei anzeigen

@ -221,7 +221,6 @@ public class CraftWorld implements World {
return true;
}
public boolean isChunkInUse(int x, int z) {
Player[] players = server.getOnlinePlayers();
@ -802,7 +801,8 @@ public class CraftWorld implements World {
dir = 2;
break;
case SOUTH:
dir = 3;;
dir = 3;
;
break;
}
entity = new EntityPainting(world, (int) x, (int) y, (int) z, dir);

Datei anzeigen

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit;
import java.io.ByteArrayOutputStream;

Datei anzeigen

@ -137,7 +137,6 @@ public class PortalTravelAgent implements TravelAgent {
public boolean createPortal(Location location) {
net.minecraft.server.World world = ((CraftWorld) location.getWorld()).getHandle();
if (location.getWorld().getEnvironment() == Environment.THE_END) {
int i = MathHelper.floor(location.getBlockX());
int j = MathHelper.floor(location.getBlockY()) - 1;
@ -401,9 +400,6 @@ public class PortalTravelAgent implements TravelAgent {
return true;
}
public TravelAgent setSearchRadius(int radius) {
this.searchRadius = radius;
return this;

Datei anzeigen

@ -1,8 +1,8 @@
package org.bukkit.craftbukkit;
/**
* Credits for this class goes to user aioobe on stackoverflow.com
* Source: http://stackoverflow.com/questions/4454630/j2me-calculate-the-the-distance-between-2-latitude-and-longitude
*
*/
public class TrigMath {

Datei anzeigen

@ -36,56 +36,26 @@ public class CraftBlockState implements BlockState {
return new CraftBlockState(world.getWorld().getBlockAt(x, y, z));
}
/**
* Gets the world which contains this Block
*
* @return World containing this block
*/
public World getWorld() {
return world;
}
/**
* Gets the x-coordinate of this block
*
* @return x-coordinate
*/
public int getX() {
return x;
}
/**
* Gets the y-coordinate of this block
*
* @return y-coordinate
*/
public int getY() {
return y;
}
/**
* Gets the z-coordinate of this block
*
* @return z-coordinate
*/
public int getZ() {
return z;
}
/**
* Gets the chunk which contains this block
*
* @return Containing Chunk
*/
public Chunk getChunk() {
return chunk;
}
/**
* Sets the metadata for this block
*
* @param data New block specific metadata
*/
public void setData(final MaterialData data) {
Material mat = getType();
@ -101,29 +71,14 @@ public class CraftBlockState implements BlockState {
}
}
/**
* Gets the metadata for this block
*
* @return block specific metadata
*/
public MaterialData getData() {
return data;
}
/**
* Sets the type of this block
*
* @param type Material to change this block to
*/
public void setType(final Material type) {
setTypeId(type.getId());
}
/**
* Sets the type-id of this block
*
* @param type Type-Id to change this block to
*/
public boolean setTypeId(final int type) {
this.type = type;
@ -131,29 +86,14 @@ public class CraftBlockState implements BlockState {
return true;
}
/**
* Gets the type of this block
*
* @return block type
*/
public Material getType() {
return Material.getMaterial(getTypeId());
}
/**
* Gets the type-id of this block
*
* @return block type-id
*/
public int getTypeId() {
return type;
}
/**
* Gets the light level between 0-15
*
* @return light level
*/
public byte getLightLevel() {
return light;
}

Datei anzeigen

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityExperienceOrb;

Datei anzeigen

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.entity;
import java.util.Set;

Datei anzeigen

@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityMagmaCube;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.MagmaCube;

Datei anzeigen

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityWeather;

Datei anzeigen

@ -74,6 +74,7 @@ public class CraftWolf extends CraftAnimals implements Wolf {
/**
* The owner's name is how MC knows and persists the Wolf's owner. Since we choose to instead use an AnimalTamer, this functionality
* is used only as a backup. If the animal tamer is a player, we will store their name, otherwise we store an empty string.
*
* @return the owner's name, if they are a player; otherwise, the empty string or null.
*/
String getOwnerName() {
@ -87,6 +88,7 @@ public class CraftWolf extends CraftAnimals implements Wolf {
/**
* Only used internally at the moment, and there to set the path to null (that is stop the thing from running around)
* TODO use this later to extend the API, when we have Path classes in Bukkit
*
* @param pathentity currently the MC defined PathEntity class. Should be replaced with an API interface at some point.
*/
private void setPath(PathEntity pathentity) {
@ -103,8 +105,6 @@ public class CraftWolf extends CraftAnimals implements Wolf {
@Override
public EntityWolf getHandle() {
// It's somewhat easier to override this here, as many internal methods rely on EntityWolf specific methods.
// Doing this has no impact on anything outside this class.
return (EntityWolf) entity;
}

Datei anzeigen

@ -147,6 +147,7 @@ public class CraftEventFactory {
}
return callPlayerInteractEvent(who, action, 0, 255, 0, 0, itemstack);
}
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemstack) {
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
CraftItemStack itemInHand = new CraftItemStack(itemstack);

Datei anzeigen

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.generator;
import net.minecraft.server.IChunkProvider;

Datei anzeigen

@ -33,7 +33,8 @@ public class CraftMapCanvas implements MapCanvas {
}
public void setPixel(int x, int y, byte color) {
if (x < 0 || y < 0 || x >= 128 || y >= 128) return;
if (x < 0 || y < 0 || x >= 128 || y >= 128)
return;
if (buffer[y * 128 + x] != color) {
buffer[y * 128 + x] = color;
mapView.worldMap.flagDirty(x, y, y);
@ -41,12 +42,14 @@ public class CraftMapCanvas implements MapCanvas {
}
public byte getPixel(int x, int y) {
if (x < 0 || y < 0 || x >= 128 || y >= 128) return 0;
if (x < 0 || y < 0 || x >= 128 || y >= 128)
return 0;
return buffer[y * 128 + x];
}
public byte getBasePixel(int x, int y) {
if (x < 0 || y < 0 || x >= 128 || y >= 128) return 0;
if (x < 0 || y < 0 || x >= 128 || y >= 128)
return 0;
return base[y * 128 + x];
}

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.util;
public class EntryBase {
protected long key;
public EntryBase(long key) {
this.key = key;
}

Datei anzeigen

@ -36,6 +36,7 @@ public class LongHashtable<V> extends LongBaseHashtable {
private class Entry extends EntryBase {
V value;
Entry(long k, V v) {
super(k);
this.value = v;

Datei anzeigen

@ -1,4 +1,3 @@
package org.bukkit.craftbukkit.util;
import net.minecraft.server.MinecraftServer;