Выход из космоса, шапки из грависуйта, разное говно и мелкие правки.

This commit is contained in:
ZLOFENIX 2013-06-29 15:58:56 +04:00
parent 409b812061
commit 1543766132
14 changed files with 2474 additions and 2509 deletions

View file

@ -92,13 +92,13 @@ public class BlockProtocol extends BlockContainer {
@SideOnly(Side.SERVER)
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
TileEntityProtocol controller = (TileEntityProtocol)par1World.getBlockTileEntity(par2, par3, par4);
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
return false;
TileEntityProtocol controller = (TileEntityProtocol)par1World.getBlockTileEntity(par2, par3, par4);
if (controller != null){
controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.sendChatToPlayer("[WarpCtrlr] Attached players: " + controller.getAttachedPlayersList());
}
if (controller != null){
controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.sendChatToPlayer("[WarpCtrlr] Attached players: " + controller.getAttachedPlayersList());
}
return true;
}

View file

@ -87,12 +87,12 @@ public class BlockRadar extends BlockContainer {
@SideOnly(Side.SERVER)
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
TileEntityRadar radar = (TileEntityRadar)par1World.getBlockTileEntity(par2, par3, par4);
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
return false;
TileEntityRadar radar = (TileEntityRadar)par1World.getBlockTileEntity(par2, par3, par4);
if (radar != null){
par5EntityPlayer.sendChatToPlayer("[Radar] Energy level: " + radar.getCurrentEnergyValue() + " Eu");
}
if (radar != null){
par5EntityPlayer.sendChatToPlayer("[Radar] Energy level: " + radar.getCurrentEnergyValue() + " Eu");
}
WarpDrive.instance.registry.printRegistry();

View file

@ -84,20 +84,14 @@ public class BlockReactor extends BlockContainer {
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
return false;
}
/**
* Called when the block is clicked by a player. Args: x, y, z, entityPlayer
*/
//@SideOnly(Side.SERVER)
@Override
public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
return false;
TileEntityReactor reactor = (TileEntityReactor)par1World.getBlockTileEntity(par2, par3, par4);
if (reactor != null){
par5EntityPlayer.sendChatToPlayer(reactor.getCoreState());
}
return true;
}
@Override

View file

@ -0,0 +1,10 @@
package cr0s.WarpDrive;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy {
@Override
public void registerRenderers() {
}
}

View file

@ -3,9 +3,8 @@
*/
package cr0s.WarpDrive;
import keepcalm.mods.events.events.LiquidFlowEvent;
import keepcalm.mods.events.events.PlayerMoveEvent;
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;
@ -13,12 +12,15 @@ 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 onBlockFlow(LiquidFlowEvent lfe) {
// В космосе жидкости не текут, так что событие отменяется
@ -28,52 +30,37 @@ public class SpaceEventHandler {
lfe.setCanceled(true);
}
}
*/
@ForgeSubscribe
public void onPlayerMove(PlayerMoveEvent pme) {
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;
//System.out.println("onPlayerMove(): event called.");
// Движение происходит в космическом пространстве
if (pme.entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
if (pme.entity instanceof EntityPlayer) {
if (entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
if (entity instanceof EntityPlayerMP) {
if (isEntityInVacuum(pme.entity)) {
if (!(pme.entityPlayer.getCurrentArmor(3) != null && pme.entityPlayer.getCurrentArmor(3).itemID == HELMET_ID_SKUBA) &&
!(pme.entityPlayer.getCurrentArmor(3) != null && pme.entityPlayer.getCurrentArmor(3).itemID == HELMET_ID_QUANTUM) &&
!(pme.entityPlayer.getCurrentArmor(3) != null && pme.entityPlayer.getCurrentArmor(3).itemID == HELMET_HEAD)) {
pme.entity.attackEntityFrom(DamageSource.drown, 3);
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 (pme.newY < -50.0D) {
((EntityPlayerMP)pme.entityPlayer).mcServer.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP) pme.entityPlayer), 0, new SpaceTeleporter(DimensionManager.getWorld(WarpDrive.instance.spaceDimID), 0, MathHelper.floor_double(pme.newX), 5000, MathHelper.floor_double(pme.newZ)));
((EntityPlayerMP)pme.entityPlayer).setFire(30);
((EntityPlayerMP)pme.entityPlayer).setPositionAndUpdate(pme.newX, 5000D, pme.newZ);
if (entity.posY < -50.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);
return;
}
}
/*
// Если это игрок в режиме Creative, то игнорируем
if (pme.entity instanceof EntityPlayer && ((EntityPlayer)pme.entity).capabilities.isCreativeMode) {
return;
}
//System.out.println("onPlayerMove(): oldY: " + pme.oldY + " newY: " + pme.newY);
// Происходит падение
if (pme.oldY > pme.newY && pme.flying) {
//System.out.println("onPlayerMove(): [blocking falling]");
if (pme.entity instanceof EntityPlayer) {
pme.entityPlayer.setPositionAndUpdate(pme.oldX, pme.oldY, pme.oldZ);
} else {
pme.entity.setPosition(pme.oldX, pme.oldY, pme.oldZ);
}
pme.setCanceled(true); // Предотвращаем падение
}*/
}
}

View file

@ -21,6 +21,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.0.0")
@NetworkMod(clientSideRequired = false, serverSideRequired = true)
@ -59,7 +60,7 @@ public class WarpDrive {
public SpaceWorldGenerator spaceWorldGenerator;
@Instance("WarpDrive")
public static WarpDrive instance;
@SidedProxy(clientSide = "cr0s.WarpDrive.client.ClientProxy", serverSide = "cr0s.WarpDrive.CommonProxy")
@SidedProxy(clientSide = "cr0s.WarpDrive.ClientProxy", serverSide = "cr0s.WarpDrive.CommonProxy")
public static CommonProxy proxy;
public WarpCoresRegistry registry;
@ -87,17 +88,14 @@ public class WarpDrive {
LanguageRegistry.addName(isolationBlock, "Warp-Field Isolation Block");
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
proxy.registerRenderers();
EntityRegistry.registerModEntity(EntitySphereGen.class, "EntitySphereGenerator", 1, WarpDrive.instance, 100, 1, false);
proxy.registerJumpEntity();
//if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
spaceWorldGenerator = new SpaceWorldGenerator();
GameRegistry.registerWorldGenerator(spaceWorldGenerator);
registerSpaceDimension();
//}
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
}
@PostInit

View file

@ -1,13 +0,0 @@
package cr0s.WarpDrive.client;
import cr0s.WarpDrive.CommonProxy;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy {
@Override
public void registerRenderers() {
System.out.println("[WD] Preloading textures...");
MinecraftForgeClient.preloadTexture(CommonProxy.BLOCK_TEXTURE);
}
}

View file

@ -1,8 +0,0 @@
package cr0s.serverMods;
public class CommonProxy {
// some code goes here
public void setupLoginHook() {
}
}

View file

@ -5,12 +5,12 @@ 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.SidedProxy;
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)
@ -24,10 +24,6 @@ public class ServerMods {
@Instance("ServerMods")
public static ServerMods instance;
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="cr0s.serverMods.ClientProxy", serverSide="cr0s.serverMods.CommonProxy")
public static CommonProxy proxy;
@PreInit
public void preInit(FMLPreInitializationEvent event) {
// Stub Method
@ -40,6 +36,7 @@ public class ServerMods {
// Снять урон от падения с джетпаком и крузис-тапками
MinecraftForge.EVENT_BUS.register(new AntiFallDamage());
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
}
@PostInit