Выход из космоса, шапки из грависуйта, разное говно и мелкие правки.
This commit is contained in:
parent
409b812061
commit
1543766132
14 changed files with 2474 additions and 2509 deletions
|
@ -92,13 +92,13 @@ public class BlockProtocol extends BlockContainer {
|
||||||
@SideOnly(Side.SERVER)
|
@SideOnly(Side.SERVER)
|
||||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
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()) {
|
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||||
TileEntityProtocol controller = (TileEntityProtocol)par1World.getBlockTileEntity(par2, par3, par4);
|
return false;
|
||||||
|
TileEntityProtocol controller = (TileEntityProtocol)par1World.getBlockTileEntity(par2, par3, par4);
|
||||||
|
|
||||||
if (controller != null){
|
if (controller != null){
|
||||||
controller.attachPlayer(par5EntityPlayer);
|
controller.attachPlayer(par5EntityPlayer);
|
||||||
par5EntityPlayer.sendChatToPlayer("[WarpCtrlr] Attached players: " + controller.getAttachedPlayersList());
|
par5EntityPlayer.sendChatToPlayer("[WarpCtrlr] Attached players: " + controller.getAttachedPlayersList());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,12 +87,12 @@ public class BlockRadar extends BlockContainer {
|
||||||
@SideOnly(Side.SERVER)
|
@SideOnly(Side.SERVER)
|
||||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
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()) {
|
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||||
TileEntityRadar radar = (TileEntityRadar)par1World.getBlockTileEntity(par2, par3, par4);
|
return false;
|
||||||
|
TileEntityRadar radar = (TileEntityRadar)par1World.getBlockTileEntity(par2, par3, par4);
|
||||||
|
|
||||||
if (radar != null){
|
if (radar != null){
|
||||||
par5EntityPlayer.sendChatToPlayer("[Radar] Energy level: " + radar.getCurrentEnergyValue() + " Eu");
|
par5EntityPlayer.sendChatToPlayer("[Radar] Energy level: " + radar.getCurrentEnergyValue() + " Eu");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WarpDrive.instance.registry.printRegistry();
|
WarpDrive.instance.registry.printRegistry();
|
||||||
|
|
|
@ -84,20 +84,14 @@ public class BlockReactor extends BlockContainer {
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
||||||
{
|
{
|
||||||
return false;
|
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||||
}
|
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) {
|
|
||||||
TileEntityReactor reactor = (TileEntityReactor)par1World.getBlockTileEntity(par2, par3, par4);
|
TileEntityReactor reactor = (TileEntityReactor)par1World.getBlockTileEntity(par2, par3, par4);
|
||||||
|
|
||||||
if (reactor != null){
|
if (reactor != null){
|
||||||
par5EntityPlayer.sendChatToPlayer(reactor.getCoreState());
|
par5EntityPlayer.sendChatToPlayer(reactor.getCoreState());
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
10
src/cr0s/WarpDrive/ClientProxy.java
Normal file
10
src/cr0s/WarpDrive/ClientProxy.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package cr0s.WarpDrive;
|
||||||
|
|
||||||
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
|
|
||||||
|
public class ClientProxy extends CommonProxy {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRenderers() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,9 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package cr0s.WarpDrive;
|
package cr0s.WarpDrive;
|
||||||
|
|
||||||
import keepcalm.mods.events.events.LiquidFlowEvent;
|
|
||||||
import keepcalm.mods.events.events.PlayerMoveEvent;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
|
@ -13,12 +12,15 @@ import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||||
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Обработчик событий в мире Space
|
* Обработчик событий в мире Space
|
||||||
* @author Cr0s
|
* @author Cr0s
|
||||||
*/
|
*/
|
||||||
public class SpaceEventHandler {
|
public class SpaceEventHandler {
|
||||||
|
/*
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onBlockFlow(LiquidFlowEvent lfe) {
|
public void onBlockFlow(LiquidFlowEvent lfe) {
|
||||||
// В космосе жидкости не текут, так что событие отменяется
|
// В космосе жидкости не текут, так что событие отменяется
|
||||||
|
@ -28,52 +30,37 @@ public class SpaceEventHandler {
|
||||||
lfe.setCanceled(true);
|
lfe.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@ForgeSubscribe
|
@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_SKUBA = 30082;
|
||||||
final int HELMET_ID_QUANTUM = 30174;
|
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;
|
final int HELMET_HEAD = 397;
|
||||||
//System.out.println("onPlayerMove(): event called.");
|
|
||||||
|
|
||||||
// Движение происходит в космическом пространстве
|
// Движение происходит в космическом пространстве
|
||||||
if (pme.entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
if (entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||||
if (pme.entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayerMP) {
|
||||||
|
|
||||||
if (isEntityInVacuum(pme.entity)) {
|
if (isEntityInVacuum(entity)) {
|
||||||
if (!(pme.entityPlayer.getCurrentArmor(3) != null && pme.entityPlayer.getCurrentArmor(3).itemID == HELMET_ID_SKUBA) &&
|
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
|
||||||
!(pme.entityPlayer.getCurrentArmor(3) != null && pme.entityPlayer.getCurrentArmor(3).itemID == HELMET_ID_QUANTUM) &&
|
|| entity.getCurrentArmor(3).itemID == HELMET_ID_ADV_SOLAR || entity.getCurrentArmor(3).itemID == HELMET_ID_HYB_SOLAR || entity.getCurrentArmor(3).itemID == HELMET_ID_ULT_SOLAR))) {
|
||||||
!(pme.entityPlayer.getCurrentArmor(3) != null && pme.entityPlayer.getCurrentArmor(3).itemID == HELMET_HEAD)) {
|
entity.attackEntityFrom(DamageSource.drown, 3);
|
||||||
pme.entity.attackEntityFrom(DamageSource.drown, 3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Отправить назад на Землю
|
// Отправить назад на Землю
|
||||||
if (pme.newY < -50.0D) {
|
if (entity.posY < -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)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)pme.entityPlayer).setFire(30);
|
((EntityPlayerMP)entity).setFire(30);
|
||||||
((EntityPlayerMP)pme.entityPlayer).setPositionAndUpdate(pme.newX, 5000D, pme.newZ);
|
((EntityPlayerMP)entity).setPositionAndUpdate(entity.posX, 250D, entity.posZ);
|
||||||
return;
|
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); // Предотвращаем падение
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.0.0")
|
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.0.0")
|
||||||
@NetworkMod(clientSideRequired = false, serverSideRequired = true)
|
@NetworkMod(clientSideRequired = false, serverSideRequired = true)
|
||||||
|
@ -59,7 +60,7 @@ public class WarpDrive {
|
||||||
public SpaceWorldGenerator spaceWorldGenerator;
|
public SpaceWorldGenerator spaceWorldGenerator;
|
||||||
@Instance("WarpDrive")
|
@Instance("WarpDrive")
|
||||||
public static WarpDrive instance;
|
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 static CommonProxy proxy;
|
||||||
|
|
||||||
public WarpCoresRegistry registry;
|
public WarpCoresRegistry registry;
|
||||||
|
@ -87,17 +88,14 @@ public class WarpDrive {
|
||||||
LanguageRegistry.addName(isolationBlock, "Warp-Field Isolation Block");
|
LanguageRegistry.addName(isolationBlock, "Warp-Field Isolation Block");
|
||||||
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
|
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
|
||||||
|
|
||||||
proxy.registerRenderers();
|
|
||||||
|
|
||||||
EntityRegistry.registerModEntity(EntitySphereGen.class, "EntitySphereGenerator", 1, WarpDrive.instance, 100, 1, false);
|
EntityRegistry.registerModEntity(EntitySphereGen.class, "EntitySphereGenerator", 1, WarpDrive.instance, 100, 1, false);
|
||||||
proxy.registerJumpEntity();
|
proxy.registerJumpEntity();
|
||||||
|
|
||||||
//if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
|
||||||
spaceWorldGenerator = new SpaceWorldGenerator();
|
spaceWorldGenerator = new SpaceWorldGenerator();
|
||||||
GameRegistry.registerWorldGenerator(spaceWorldGenerator);
|
GameRegistry.registerWorldGenerator(spaceWorldGenerator);
|
||||||
|
|
||||||
registerSpaceDimension();
|
registerSpaceDimension();
|
||||||
//}
|
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostInit
|
@PostInit
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package cr0s.serverMods;
|
|
||||||
|
|
||||||
public class CommonProxy {
|
|
||||||
// some code goes here
|
|
||||||
public void setupLoginHook() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,12 +5,12 @@ import cpw.mods.fml.common.Mod.Init;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.Mod.PostInit;
|
import cpw.mods.fml.common.Mod.PostInit;
|
||||||
import cpw.mods.fml.common.Mod.PreInit;
|
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.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkMod;
|
import cpw.mods.fml.common.network.NetworkMod;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import cr0s.WarpDrive.SpaceEventHandler;
|
||||||
|
|
||||||
@Mod(modid="ServerMods", name="ServerMods", version="0.0.1")
|
@Mod(modid="ServerMods", name="ServerMods", version="0.0.1")
|
||||||
@NetworkMod(clientSideRequired = false, serverSideRequired = true, connectionHandler = LoginHookClass.class)
|
@NetworkMod(clientSideRequired = false, serverSideRequired = true, connectionHandler = LoginHookClass.class)
|
||||||
|
@ -24,10 +24,6 @@ public class ServerMods {
|
||||||
@Instance("ServerMods")
|
@Instance("ServerMods")
|
||||||
public static ServerMods instance;
|
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
|
@PreInit
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
// Stub Method
|
// Stub Method
|
||||||
|
@ -40,6 +36,7 @@ public class ServerMods {
|
||||||
|
|
||||||
// Снять урон от падения с джетпаком и крузис-тапками
|
// Снять урон от падения с джетпаком и крузис-тапками
|
||||||
MinecraftForge.EVENT_BUS.register(new AntiFallDamage());
|
MinecraftForge.EVENT_BUS.register(new AntiFallDamage());
|
||||||
|
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostInit
|
@PostInit
|
||||||
|
|
Loading…
Reference in a new issue