Code cleanup

This commit is contained in:
Unknown 2020-02-12 16:38:01 +01:00 committed by unknown
parent f5b927e403
commit f89135d00a
26 changed files with 93 additions and 100 deletions

View file

@ -12,12 +12,12 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.1.2'
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.1.2"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.matthewprenger.cursegradle"
// define the properties file
ext.configFile = file "build.properties"
@ -55,7 +55,7 @@ minecraft {
}
curseforge {
// get token from gradle.properties (development space) or default to private environment variable (Travis CI & such)
// get token from gradle.properties (development space) or default to private environment variable (Travis CI & such)
if (project.hasProperty('token_curseforge')) {
apiKey = "${token_curseforge}"
} else {
@ -64,7 +64,7 @@ curseforge {
}
repositories {
mavenCentral()
mavenCentral()
maven { // JEI & Tinkers
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
@ -109,7 +109,7 @@ repositories {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
mavenLocal()
mavenLocal()
}
dependencies {
@ -133,7 +133,7 @@ dependencies {
provided "codechicken:CodeChickenLib:${config.CodeChickenLib_version}:universal"
provided "com.builtbroken.icbm-classic:ICBM-classic:${config.ICBMclassic_version}"
provided "li.cil.oc:OpenComputers:${config.OpenComputers_version}"
// compileOnly "mezz.jei:jei_1.10.2:3.13.+"
// compileOnly "mcp.mobius.waila:Waila:1.7.0-B3_1.9.4"
// compileOnly "mcjty.theoneprobe:TheOneProbe:1.10-1.0.13-26"

View file

@ -646,12 +646,12 @@ public class WarpDrive {
@EventHandler
public void onFMLServerStarting(final FMLServerStartingEvent event) {
event.registerServerCommand(new CommandBed());
event.registerServerCommand(new CommandDebug());
event.registerServerCommand(new CommandDump());
event.registerServerCommand(new CommandEntity());
event.registerServerCommand(new CommandFind());
event.registerServerCommand(new CommandGenerate());
event.registerServerCommand(new CommandBed());
event.registerServerCommand(new CommandInvisible());
event.registerServerCommand(new CommandReload());
event.registerServerCommand(new CommandRender());

View file

@ -908,11 +908,10 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractEnergyB
public void onBlockUpdateDetected() {
super.onBlockUpdateDetected();
energy_refreshConnections(null);
energy_refreshConnections();
}
@SuppressWarnings("UnusedParameters")
protected void energy_refreshConnections(final EnumFacing facing) {
protected void energy_refreshConnections() {
if (WarpDriveConfig.isIndustrialCraft2Loaded) {
// IC2 EnergyNet throws a block update during the next world tick following its EnergyTileLoadEvent
// Ignoring this specific block update prevents us to do a constant refresh of the energy net

View file

@ -94,7 +94,7 @@ public abstract class TileEntityAbstractEnergyCoreOrController extends TileEntit
}
protected void doRegisterStarMapEntry(final boolean isDirty) {
if (uuid == null || (uuid.getMostSignificantBits() == 0 && uuid.getLeastSignificantBits() == 0)) {
if (uuid == null || (uuid.getMostSignificantBits() == 0L && uuid.getLeastSignificantBits() == 0L)) {
uuid = UUID.randomUUID();
}
@ -117,13 +117,12 @@ public abstract class TileEntityAbstractEnergyCoreOrController extends TileEntit
name = ((TileEntityAbstractEnergyCoreOrController) multiblockCore).name;
}
@Override
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
uuid = new UUID(tagCompound.getLong(ICoreSignature.UUID_MOST_TAG), tagCompound.getLong(ICoreSignature.UUID_LEAST_TAG));
if (uuid.getMostSignificantBits() == 0 && uuid.getLeastSignificantBits() == 0) {
if (uuid.getMostSignificantBits() == 0L && uuid.getLeastSignificantBits() == 0L) {
uuid = UUID.randomUUID();
}
}
@ -176,7 +175,7 @@ public abstract class TileEntityAbstractEnergyCoreOrController extends TileEntit
@Override
public String toString() {
return String.format("%s \'%s\' %s %s",
return String.format("%s '%s' %s %s",
getClass().getSimpleName(),
name,
Commons.format(world, pos),

View file

@ -303,7 +303,7 @@ public abstract class TileEntityAbstractMachine extends TileEntityAbstractInterf
@Override
public String toString() {
return String.format("%s \'%s\' %s",
return String.format("%s '%s' %s",
getClass().getSimpleName(),
name,
Commons.format(world, pos));

View file

@ -51,10 +51,6 @@ public class TileEntityAirGeneratorTiered extends TileEntityAbstractEnergyConsum
return;
}
if (isInvalid()) {
return;
}
tickUpdate--;
if (tickUpdate >= 0) {
return;

View file

@ -139,7 +139,7 @@ public class TileEntityCapacitor extends TileEntityAbstractEnergy {
void setMode(final EnumFacing facing, final EnumDisabledInputOutput enumDisabledInputOutput) {
modeSide[facing.ordinal()] = enumDisabledInputOutput;
markDirty();
energy_refreshConnections(facing);
energy_refreshConnections();
}
// Forge overrides

View file

@ -221,7 +221,7 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
if (WarpDriveConfig.LOGGING_ENERGY) {
WarpDrive.logger.info(String.format("updateTicks %d releasedThisTick %6d lasersReceived %.5f releasedThisCycle %6d containedEnergy %8d",
updateTicks, releasedThisTick, lasersReceived, releasedThisCycle, containedEnergy));
updateTicks, releasedThisTick, lasersReceived, releasedThisCycle, containedEnergy ));
}
releasedThisTick = 0;
@ -289,7 +289,7 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
pos.getX() + reactorFace.x - reactorFace.facingLaserProperty.getXOffset(),
pos.getY() + reactorFace.y - reactorFace.facingLaserProperty.getYOffset(),
pos.getZ() + reactorFace.z - reactorFace.facingLaserProperty.getZOffset(),
1, false, false);
1.0F, false, false);
}
final double normalisedAmount = Math.min(1.0D, Math.max(0.0D, amount / PR_MAX_LASER_ENERGY)); // 0.0 to 1.0
final double baseLaserEffect = 0.5D + 0.5D * Math.cos( Math.PI * Math.log10(0.1D + 0.9D * normalisedAmount) ); // 0.0 to 1.0
@ -546,8 +546,8 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
textReason.append(Commons.getStyleWarning(), "warpdrive.enan_reactor.status_line.non_air_block",
Commons.format(world, mutableBlockPos) );
isValid = false;
final Vector3 vPosition = new Vector3(mutableBlockPos).translate(0.5D);
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5, vPosition,
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5,
new Vector3(mutableBlockPos.getX() + 0.5D, mutableBlockPos.getY() + 0.5D, mutableBlockPos.getZ() + 0.5D),
new Vector3(0.0D, 0.0D, 0.0D),
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,
@ -568,8 +568,8 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
textReason.append(Commons.getStyleWarning(), "warpdrive.enan_reactor.status_line.missing_stabilization_laser",
Commons.format(world, mutableBlockPos) );
isValid = false;
final Vector3 vPosition = new Vector3(mutableBlockPos).translate(0.5D);
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5, vPosition,
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5,
new Vector3(mutableBlockPos.getX() + 0.5D, mutableBlockPos.getY() + 0.5D, mutableBlockPos.getZ() + 0.5D),
new Vector3(0.0D, 0.0D, 0.0D),
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,

View file

@ -190,19 +190,19 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser implemen
if (laserMedium_direction == null) {
WarpDrive.logger.warn(String.format("ReactorLaser %s on %s side doesn't have a laser medium, unable to stabilize %d",
Commons.format(world, pos), reactorFace.name, energy));
Commons.format(world, pos), reactorFace.name, energy ));
return 0;
}
if (reactorFace == ReactorFace.UNKNOWN) {
WarpDrive.logger.warn(String.format("ReactorLaser %s on %s side doesn't have a core to stabilize %d",
Commons.format(world, pos), reactorFace.name, energy));
Commons.format(world, pos), reactorFace.name, energy ));
return 0;
}
if (energyStabilizationRequest > 0) {
WarpDrive.logger.warn(String.format("%s Stabilization already requested for %s",
this, energy));
this, energy ));
return -energy;
}
energyStabilizationRequest = energy;
@ -212,20 +212,20 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser implemen
private void doStabilize(final int energy) {
if (energy <= 0) {
WarpDrive.logger.error(String.format("ReactorLaser %s on %s side can't stabilize without energy, please report to mod author %d",
Commons.format(world, pos), reactorFace.name, energy));
Commons.format(world, pos), reactorFace.name, energy ));
return;
}
if (laserMedium_direction == null) {
WarpDrive.logger.warn(String.format("ReactorLaser %s on %s side no longer has a laser medium, unable to stabilize %d",
Commons.format(world, pos), reactorFace.name, energy));
Commons.format(world, pos), reactorFace.name, energy ));
return;
}
final TileEntityEnanReactorCore reactorCore = getReactorCore();
if (reactorCore == null) {
WarpDrive.logger.warn(String.format("ReactorLaser %s on %s side no longer has a core to stabilize %d",
Commons.format(world, pos), reactorFace.name, energy));
Commons.format(world, pos), reactorFace.name, energy ));
return;
}
@ -242,7 +242,7 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser implemen
if (WarpDriveConfig.LOGGING_ENERGY && WarpDriveConfig.LOGGING_LUA) {
WarpDrive.logger.info(String.format("ReactorLaser %s on %s side stabilizing %d",
Commons.format(world, pos), reactorFace.name, energy));
Commons.format(world, pos), reactorFace.name, energy ));
}
reactorCore.decreaseInstability(reactorFace, energy);
PacketHandler.sendBeamPacket(world, vLaser, vReactorCore, 0.1F, 0.2F, 1.0F, 25, 50, 100);

View file

@ -42,7 +42,7 @@ public class ItemBlockController extends ItemBlockAbstractBase {
}
final String name = tagCompound.getString(ICoreSignature.NAME_TAG);
final UUID uuid = new UUID(tagCompound.getLong(ICoreSignature.UUID_MOST_TAG), tagCompound.getLong(ICoreSignature.UUID_LEAST_TAG));
if (uuid.getMostSignificantBits() == 0 && uuid.getLeastSignificantBits() == 0) {
if (uuid.getMostSignificantBits() == 0L && uuid.getLeastSignificantBits() == 0L) {
return "";
}
return name;
@ -58,7 +58,7 @@ public class ItemBlockController extends ItemBlockAbstractBase {
return null;
}
final UUID uuid = new UUID(tagCompound.getLong(ICoreSignature.UUID_MOST_TAG), tagCompound.getLong(ICoreSignature.UUID_LEAST_TAG));
if (uuid.getMostSignificantBits() == 0 && uuid.getLeastSignificantBits() == 0) {
if (uuid.getMostSignificantBits() == 0L && uuid.getLeastSignificantBits() == 0L) {
return null;
}
return uuid;

View file

@ -79,8 +79,8 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergyConsume
} else {
// get current status
final boolean isConnected = uuidTransporterCore != null
&& ( uuidTransporterCore.getLeastSignificantBits() != 0
|| uuidTransporterCore.getMostSignificantBits() != 0 );
&& ( uuidTransporterCore.getLeastSignificantBits() != 0L
|| uuidTransporterCore.getMostSignificantBits() != 0L );
final boolean isPowered = energy_consume(WarpDriveConfig.TRANSPORTER_BEACON_ENERGY_PER_TICK, true);
// final boolean isLowPower = energy_getEnergyStored() < WarpDriveConfig.TRANSPORTER_BEACON_ENERGY_PER_TICK * TICK_LOW_POWER;
@ -243,7 +243,7 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergyConsume
nameTransporterCore = tagCompound.getString(ICoreSignature.NAME_TAG);
uuidTransporterCore = new UUID(tagCompound.getLong(ICoreSignature.UUID_MOST_TAG), tagCompound.getLong(ICoreSignature.UUID_LEAST_TAG));
if (uuidTransporterCore.getMostSignificantBits() == 0 && uuidTransporterCore.getLeastSignificantBits() == 0) {
if (uuidTransporterCore.getMostSignificantBits() == 0L && uuidTransporterCore.getLeastSignificantBits() == 0L) {
uuidTransporterCore = null;
nameTransporterCore = "";
}

View file

@ -219,11 +219,12 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
: EnumTransporterState.ENERGIZING); // @TODO add proper mapping
if (isConnected && isEnabled) {
if (isLockRequested && isJammed) {
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5, new Vector3(this).translate(0.5F),
new Vector3(0.0D, 0.0D, 0.0D),
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,
32);
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5,
new Vector3(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D),
new Vector3(0.0D, 0.0D, 0.0D),
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,
32);
}
if ( lockStrengthActual > 0.01F
|| (transporterState == EnumTransporterState.ENERGIZING && tickEnergizing > 0)
@ -1226,7 +1227,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
if (entity instanceof EntityLivingBase) {
entity.attackEntityFrom(WarpDrive.damageTeleportation, (float) damageAmount);
final boolean isCreative = (entity instanceof EntityPlayer) && ((EntityPlayer) entity).capabilities.isCreativeMode;
final boolean isCreative = (entity instanceof EntityPlayer) && ((EntityPlayer) entity).isCreative();
if (!isCreative) {
if (isPreTeleportation) {
// add 1s nausea

View file

@ -188,7 +188,6 @@ D- micdoodle8.mods.galacticraft.planets.mars.BlockTelemetry
private static final int[] rotLighting4 = { 8, 25, 21, 20, 2, 3, 6, 7, 16, 1, 29, 28, 10, 11, 14, 15,
24, 9, 5, 4, 18, 19, 22, 23, 0, 17, 13, 12, 26, 27, 30, 31 };
@SuppressWarnings({"unchecked", "deprecation"})
@Override
public int rotate(final Block block, final int metadata, final NBTTagCompound nbtTileEntity, final ITransformation transformation) {
final byte rotationSteps = transformation.getRotationSteps();

View file

@ -1236,33 +1236,6 @@ public class Recipes {
}
private static void initDetection() {
// Radar is 1 motor, 4 Titanium plate (diamond), 1 Quarztite rod (nether quartz), 1 Computer interface, 1 HV Machine casing, 1 Power interface
final Object oreCloakingPlate = WarpDriveConfig.getOreOrItemStack(
"ore:plateTitanium", 0, // GregTech
"ore:plateEnderium", 0, // ThermalExpansion
"ore:ingotVibrantAlloy", 0, // EnderIO
"ore:plateAlloyIridium", 0, // IndustrialCraft2
"ore:gemQuartz", 0 );
final Object oreAntenna = WarpDriveConfig.getOreOrItemStack(
"ore:stickQuartzite", 0, // GregTech
"ore:ingotSignalum", 0, // ThermalExpansion
"ore:nuggetPulsatingIron", 0, // EnderIO
"minecraft:ghast_tear", 0 );
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockRadar), false, "PAP", "PtP", "pmc",
't', itemStackMotors[2],
'P', oreCloakingPlate,
'A', oreAntenna,
'c', ItemComponent.getItemStack(EnumComponentType.COMPUTER_INTERFACE),
'm', itemStackMachineCasings[2],
'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE)));
// Warp isolation is 1 EV Machine casing (Ti), 4 Titanium plate/Enderium ingot/Vibrant alloy/Iridium plate/quartz
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockWarpIsolation), false, "i i", " m ", "i i",
'i', oreCloakingPlate,
'm', itemStackMachineCasings[3]));
// Camera is 1 Daylight sensor, 2 Motors, 1 Computer interface, 2 Glass panel, 1 Tuning diamond, 1 LV Machine casing
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockCamera), false, "gtd", "zlm", "gt ",
@ -1273,13 +1246,6 @@ public class Recipes {
'l', Blocks.DAYLIGHT_DETECTOR,
'g', "paneGlassColorless"));
// Monitor is 3 Flat screen, 1 Computer interface, 1 Tuning diamond, 1 LV Machine casing
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockMonitor), false, "fd ", "fm ", "f ",
'f', ItemComponent.getItemStack(EnumComponentType.FLAT_SCREEN),
'd', ItemComponent.getItemStack(EnumComponentType.DIAMOND_CRYSTAL),
'm', itemStackMachineCasings[0]));
// Cloaking core is 3 Cloaking coils, 4 Iridium blocks, 1 Ship controller, 1 Power interface
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockCloakingCore), false, "ici", "csc", "ipi",
@ -1317,6 +1283,34 @@ public class Recipes {
'c', oreGoldIngotOrCoil,
'm', itemStackMachineCasings[3] ));
// Monitor is 3 Flat screen, 1 Computer interface, 1 Tuning diamond, 1 LV Machine casing
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockMonitor), false, "fd ", "fm ", "f ",
'f', ItemComponent.getItemStack(EnumComponentType.FLAT_SCREEN),
'd', ItemComponent.getItemStack(EnumComponentType.DIAMOND_CRYSTAL),
'm', itemStackMachineCasings[0]));
// Radar is 1 motor, 4 Titanium plate (diamond), 1 Quarztite rod (nether quartz), 1 Computer interface, 1 HV Machine casing, 1 Power interface
final Object oreRadarDish = WarpDriveConfig.getOreOrItemStack(
"ore:plateTitanium", 0, // GregTech
"ore:plateEnderium", 0, // ThermalExpansion
"ore:ingotVibrantAlloy", 0, // EnderIO
"ore:plateAlloyIridium", 0, // IndustrialCraft2
"ore:gemQuartz", 0 );
final Object oreRadarSensor = WarpDriveConfig.getOreOrItemStack(
"ore:stickQuartzite", 0, // GregTech
"ore:ingotSignalum", 0, // ThermalExpansion
"ore:nuggetPulsatingIron", 0, // EnderIO
"minecraft:ghast_tear", 0 );
WarpDrive.register(new ShapedOreRecipe(groupMachines,
new ItemStack(WarpDrive.blockRadar), false, "PAP", "PtP", "pmc",
't', itemStackMotors[2],
'P', oreRadarDish,
'A', oreRadarSensor,
'c', ItemComponent.getItemStack(EnumComponentType.COMPUTER_INTERFACE),
'm', itemStackMachineCasings[2],
'p', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE)));
// Sirens
WarpDrive.register(new ShapedOreRecipe(groupMachines,
WarpDrive.blockSirenIndustrial[EnumTier.BASIC.getIndex()], "pip", "pNp", "pip",

View file

@ -82,7 +82,7 @@ public class ShipMovementCosts {
public void load(final Configuration config, final String category, final String prefixKey, final String comment) {
final String COMMENT_FACTORS = "\n"
+ "You need to provide exactly 5 values { A, B, C, D, E }. The equation used is A + B * mass + C * distance + D * ln( mass ) * exp( distance / E )\n"
+ "You need to provide exactly 5 values < A B C D E >. The equation used is A + B * mass + C * distance + D * ln( mass ) * exp( distance / E )\n"
+ "Result is rounded up to an integer. Use 0 to ignore that part of the equation.";
maximumDistance = WarpDriveConfig.getDoubleList(config, category, prefixKey + "_max_jump_distance",

View file

@ -33,8 +33,8 @@ public class ChunkData {
private static final int INVALID_DATA_INDEX = 0xFF7F; // central block in chunk top
// persistent properties
private int[][] dataAirSegments = new int[CHUNK_SIZE_SEGMENTS][];
private byte[][] tickAirSegments = new byte[CHUNK_SIZE_SEGMENTS][];
private final int[][] dataAirSegments = new int[CHUNK_SIZE_SEGMENTS][];
private final byte[][] tickAirSegments = new byte[CHUNK_SIZE_SEGMENTS][];
// computed properties
private int tickCurrent = (int) (Math.random() * 4096.0D);

View file

@ -411,7 +411,7 @@ public class JumpShip {
@Override
public String toString() {
return String.format("%s/%d \'%s\' %s",
return String.format("%s/%d '%s' %s",
getClass().getSimpleName(), hashCode(),
shipCore == null ? "~NULL~" : (shipCore.uuid + ":" + shipCore.name),
Commons.format(world, core));

View file

@ -268,7 +268,7 @@ public class StarMapRegistry {
public boolean onBlockUpdating(@Nullable final Entity entity, @Nonnull final World world, @Nonnull final BlockPos blockPos, final IBlockState blockState) {
if (!Commons.isSafeThread()) {
WarpDrive.logger.error(String.format("Non-threadsafe call to StarMapRegistry:onBlockUpdating outside main thread, for %s %s",
blockState, Commons.format(world, blockPos)));
blockState, Commons.format(world, blockPos) ));
return false;
}
final CopyOnWriteArraySet<StarMapRegistryItem> setStarMapRegistryItems = registry.get(world.provider.getDimension());

View file

@ -114,7 +114,7 @@ public class StarMapRegistryItem extends GlobalPosition {
type = EnumStarMapEntryType.getByName(tagCompound.getString("type"));
name = tagCompound.getString(ICoreSignature.NAME_TAG);
UUID uuidLocal = new UUID(tagCompound.getLong(ICoreSignature.UUID_MOST_TAG), tagCompound.getLong(ICoreSignature.UUID_LEAST_TAG));
if (uuidLocal.getMostSignificantBits() == 0 && uuidLocal.getLeastSignificantBits() == 0) {
if (uuidLocal.getMostSignificantBits() == 0L && uuidLocal.getLeastSignificantBits() == 0L) {
uuidLocal = UUID.randomUUID();
}
uuid = uuidLocal;

View file

@ -175,7 +175,7 @@ public class LivingHandler {
// *** air handling
if ( WarpDriveConfig.BREATHING_AIR_AT_ENTITY_DEBUG
&& entityLivingBase.world.getWorldTime() % 20 == 0) {
&& entityLivingBase.world.getWorldTime() % 20 == 0 ) {
StateAir.dumpAroundEntity((EntityPlayer) entityLivingBase);
}
}
@ -238,7 +238,8 @@ public class LivingHandler {
}
}
} else if (celestialObject.isHyperspace() || celestialObject.isSpace()) {
} else if ( celestialObject.isHyperspace()
|| celestialObject.isSpace() ) {
// player is in space or hyperspace, let's roll around
entityLivingBase.setPositionAndUpdate(entityLivingBase.posX, 260.0D, entityLivingBase.posZ);
}

View file

@ -178,7 +178,7 @@ public class WorldHandler {
blockEvent.getClass().getSimpleName(),
blockStatePlaced,
Commons.format(blockEvent.getWorld(), blockEvent.getPos()),
entity));
entity ));
}
}
boolean isAllowed = true;

View file

@ -53,7 +53,8 @@ public class ItemWrench extends ItemAbstractBase implements IWarpTool {
// @TODO: confirm if both are really needed
if ( !entityPlayer.canPlayerEdit(blockPos, facing, itemStackHeld)
|| !world.isBlockModifiable(entityPlayer, blockPos) ) {
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5, vFace,
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5,
vFace,
new Vector3(0.0D, 0.0D, 0.0D),
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,
@ -62,7 +63,8 @@ public class ItemWrench extends ItemAbstractBase implements IWarpTool {
}
if (!blockState.getBlock().rotateBlock(world, blockPos, facing)) {
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5, vFace,
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5,
vFace,
new Vector3(0.0D, 0.0D, 0.0D),
1.0F, 1.0F, 1.0F,
1.0F, 1.0F, 1.0F,

View file

@ -75,6 +75,7 @@ public class PacketHandler {
simpleNetworkManager.sendToAllAround(messageBeamEffect, new TargetPoint(
world.provider.getDimension(), (v3Source.x + v3Target.x) / 2, (v3Source.y + v3Target.y) / 2, (v3Source.z + v3Target.z) / 2, radius));
} else {// large beam are sent from both ends
assert world.getMinecraftServer() != null;
final List<EntityPlayerMP> playerEntityList = world.getMinecraftServer().getPlayerList().getPlayers();
final int dimensionId = world.provider.getDimension();
final int radius_square = radius * radius;
@ -158,6 +159,7 @@ public class PacketHandler {
lockStrength, tickEnergizing, tickCooldown);
// check both ends to send packet
assert world.getMinecraftServer() != null;
final List<EntityPlayerMP> playerEntityList = world.getMinecraftServer().getPlayerList().getPlayers();
final int radius_square = radius * radius;
for (final EntityPlayerMP entityPlayerMP : playerEntityList) {
@ -211,10 +213,10 @@ public class PacketHandler {
simpleNetworkManager.sendTo(messageClientSync, entityPlayerMP);
}
public static Packet getPacketForThisEntity(final Entity entity) {
public static Packet<?> getPacketForThisEntity(final Entity entity) {
final EntityTrackerEntry entry = new EntityTrackerEntry(entity, 0, 0, 0, false);
try {
return (Packet) EntityTrackerEntry_getPacketForThisEntity.invoke(entry);
return (Packet<?>) EntityTrackerEntry_getPacketForThisEntity.invoke(entry);
} catch (final Exception exception) {
exception.printStackTrace(WarpDrive.printStreamError);
}
@ -230,7 +232,7 @@ public class PacketHandler {
entity, entityPlayerMP));
return;
}
final Packet packet = getPacketForThisEntity(entity);
final Packet<?> packet = getPacketForThisEntity(entity);
if (packet == null) {
WarpDrive.logger.error(String.format("Unable to reveal entity %s to player %s: null packet",
entity, entityPlayerMP));
@ -262,7 +264,7 @@ public class PacketHandler {
}
if (entity instanceof EntityLivingBase) {
for (EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values()) {
for (final EntityEquipmentSlot entityequipmentslot : EntityEquipmentSlot.values()) {
final ItemStack itemstack = ((EntityLivingBase) entity).getItemStackFromSlot(entityequipmentslot);
if (!itemstack.isEmpty()) {

View file

@ -123,7 +123,7 @@ public class WorldGenStructure {
public void setHullPlain(final World world, final int x, final int y, final int z) {
if (corrupted && (rand.nextInt(400) == 1)) {
world.newExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 17, false, true);
world.newExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 17.0F, false, true);
} else if (corrupted && (rand.nextInt(10) == 1)) {
world.setBlockState(new BlockPos(x, y, z), Blocks.AIR.getDefaultState(), 2);
} else {

View file

@ -845,7 +845,7 @@ end
local function event_handler(eventName, param)
local needRedraw = false
if eventName == "redstone" then
w.redstone_event(param)
w.event_redstone(param)
elseif eventName == "timer" then
w.event_timer_tick(param)
elseif eventName == "key_up" then
@ -880,7 +880,7 @@ local tblRedstoneState = {-- Remember redstone state on each side
["bottom"] = rs.getInput("bottom"),
}
local function redstone_event()
local function event_redstone()
-- Event only returns nil so we need to check sides manually
local message = ""
for side, state in pairs(tblRedstoneState) do

View file

@ -861,7 +861,7 @@ end
local function event_handler(eventName, param)
local needRedraw = false
if eventName == "redstone" then
-- w.redstone_event(param)
-- w.event_redstone(param)
elseif eventName == "key_up" then
elseif eventName == "touch" then
w.status_showSuccess("Use the keyboard, Luke!")