Normalize line endings

This commit is contained in:
Disasm 2013-07-09 20:38:37 +04:00
parent ad410de5ce
commit abf8b915a1
2 changed files with 126 additions and 126 deletions

View file

@ -1,82 +1,82 @@
/*
* Невесомость и отключение текучести жидкостей
*/
package cr0s.WarpDrive;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.common.ForgeHooks;
/**
* Обработчик событий в мире Space
* @author Cr0s
*/
public class SpaceEventHandler {
@ForgeSubscribe
public void livingUpdate(LivingUpdateEvent event) {
EntityLiving entity = event.entityLiving;
final int HELMET_ID_SKUBA = 30082;
final int HELMET_ID_QUANTUM = 30174;
final int HELMET_ID_ADV_SOLAR = 30832;
final int HELMET_ID_HYB_SOLAR = 30833;
final int HELMET_ID_ULT_SOLAR = 30834;
final int HELMET_HEAD = 397;
// Движение происходит в космическом пространстве
if (entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
if (entity instanceof EntityPlayerMP) {
if (isEntityInVacuum(entity)) {
if (!(entity.getCurrentArmor(3) != null && (entity.getCurrentArmor(3).itemID == HELMET_ID_SKUBA || entity.getCurrentArmor(3).itemID == HELMET_ID_QUANTUM || entity.getCurrentArmor(3).itemID == HELMET_HEAD
|| entity.getCurrentArmor(3).itemID == HELMET_ID_ADV_SOLAR || entity.getCurrentArmor(3).itemID == HELMET_ID_HYB_SOLAR || entity.getCurrentArmor(3).itemID == HELMET_ID_ULT_SOLAR))) {
entity.attackEntityFrom(DamageSource.drown, 3);
}
}
// Отправить назад на Землю
if (entity.posY < -10.0D) {
((EntityPlayerMP)entity).mcServer.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP) entity), 0, new SpaceTeleporter(DimensionManager.getWorld(WarpDrive.instance.spaceDimID), 0, MathHelper.floor_double(entity.posX), 250, MathHelper.floor_double(entity.posZ)));
((EntityPlayerMP)entity).setFire(30);
((EntityPlayerMP)entity).setPositionAndUpdate(entity.posX, 250D, entity.posZ);
}
}
}
}
/**
* Проверка, находится ли Entity в открытом космосе
* @param e
* @return
*/
private boolean isEntityInVacuum(Entity e) {
int x = MathHelper.floor_double(e.posX);
int y = MathHelper.floor_double(e.posY);
int z = MathHelper.floor_double(e.posZ);
final int CHECK_DISTANCE = 10;
if (e.onGround) { return false; }
for (int ny = y; ny > (y - CHECK_DISTANCE); ny--) {
if (!e.worldObj.isAirBlock(x, ny, z)) {
return false;
}
}
if (!e.worldObj.canBlockSeeTheSky(x, y, z) || !e.worldObj.canBlockSeeTheSky(x, y - 1, z) ) {
return false;
}
return true;
}
}
/*
* Невесомость и отключение текучести жидкостей
*/
package cr0s.WarpDrive;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.common.ForgeHooks;
/**
* Обработчик событий в мире Space
* @author Cr0s
*/
public class SpaceEventHandler {
@ForgeSubscribe
public void livingUpdate(LivingUpdateEvent event) {
EntityLiving entity = event.entityLiving;
final int HELMET_ID_SKUBA = 30082;
final int HELMET_ID_QUANTUM = 30174;
final int HELMET_ID_ADV_SOLAR = 30832;
final int HELMET_ID_HYB_SOLAR = 30833;
final int HELMET_ID_ULT_SOLAR = 30834;
final int HELMET_HEAD = 397;
// Движение происходит в космическом пространстве
if (entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
if (entity instanceof EntityPlayerMP) {
if (isEntityInVacuum(entity)) {
if (!(entity.getCurrentArmor(3) != null && (entity.getCurrentArmor(3).itemID == HELMET_ID_SKUBA || entity.getCurrentArmor(3).itemID == HELMET_ID_QUANTUM || entity.getCurrentArmor(3).itemID == HELMET_HEAD
|| entity.getCurrentArmor(3).itemID == HELMET_ID_ADV_SOLAR || entity.getCurrentArmor(3).itemID == HELMET_ID_HYB_SOLAR || entity.getCurrentArmor(3).itemID == HELMET_ID_ULT_SOLAR))) {
entity.attackEntityFrom(DamageSource.drown, 3);
}
}
// Отправить назад на Землю
if (entity.posY < -10.0D) {
((EntityPlayerMP)entity).mcServer.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP) entity), 0, new SpaceTeleporter(DimensionManager.getWorld(WarpDrive.instance.spaceDimID), 0, MathHelper.floor_double(entity.posX), 250, MathHelper.floor_double(entity.posZ)));
((EntityPlayerMP)entity).setFire(30);
((EntityPlayerMP)entity).setPositionAndUpdate(entity.posX, 250D, entity.posZ);
}
}
}
}
/**
* Проверка, находится ли Entity в открытом космосе
* @param e
* @return
*/
private boolean isEntityInVacuum(Entity e) {
int x = MathHelper.floor_double(e.posX);
int y = MathHelper.floor_double(e.posY);
int z = MathHelper.floor_double(e.posZ);
final int CHECK_DISTANCE = 10;
if (e.onGround) { return false; }
for (int ny = y; ny > (y - CHECK_DISTANCE); ny--) {
if (!e.worldObj.isAirBlock(x, ny, z)) {
return false;
}
}
if (!e.worldObj.canBlockSeeTheSky(x, y, z) || !e.worldObj.canBlockSeeTheSky(x, y - 1, z) ) {
return false;
}
return true;
}
}

View file

@ -1,45 +1,45 @@
package cr0s.serverMods;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import net.minecraftforge.common.MinecraftForge;
import cr0s.WarpDrive.SpaceEventHandler;
@Mod(modid="ServerMods", name="ServerMods", version="0.0.1")
@NetworkMod(clientSideRequired = false, serverSideRequired = true, connectionHandler = LoginHookClass.class)
/**
* @author Cr0s
*/
public class ServerMods {
// The instance of your mod that Forge uses.
@Instance("ServerMods")
public static ServerMods instance;
@PreInit
public void preInit(FMLPreInitializationEvent event) {
// Stub Method
}
@Init
public void load(FMLInitializationEvent event) {
// Включить авторизацию (включается автоматически)
//proxy.setupLoginHook();
// Снять урон от падения с джетпаком и крузис-тапками
MinecraftForge.EVENT_BUS.register(new AntiFallDamage());
}
@PostInit
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
package cr0s.serverMods;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import net.minecraftforge.common.MinecraftForge;
import cr0s.WarpDrive.SpaceEventHandler;
@Mod(modid="ServerMods", name="ServerMods", version="0.0.1")
@NetworkMod(clientSideRequired = false, serverSideRequired = true, connectionHandler = LoginHookClass.class)
/**
* @author Cr0s
*/
public class ServerMods {
// The instance of your mod that Forge uses.
@Instance("ServerMods")
public static ServerMods instance;
@PreInit
public void preInit(FMLPreInitializationEvent event) {
// Stub Method
}
@Init
public void load(FMLInitializationEvent event) {
// Включить авторизацию (включается автоматически)
//proxy.setupLoginHook();
// Снять урон от падения с джетпаком и крузис-тапками
MinecraftForge.EVENT_BUS.register(new AntiFallDamage());
}
@PostInit
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
}