Copied over handlers from other branch.
This commit is contained in:
@@ -20,59 +20,42 @@ package appeng.client;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
|
import appeng.client.render.tesr.InscriberTESR;
|
||||||
|
import appeng.client.render.textures.ParticleTextures;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
import net.minecraft.client.util.InputMappings;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.MouseEvent;
|
import net.minecraftforge.client.event.InputEvent;
|
||||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
|
||||||
import net.minecraftforge.common.ForgeModContainer;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
|
|
||||||
import appeng.api.parts.CableRenderMode;
|
import appeng.api.parts.CableRenderMode;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.render.effects.AssemblerFX;
|
|
||||||
import appeng.client.render.effects.CraftingFx;
|
|
||||||
import appeng.client.render.effects.EnergyFx;
|
|
||||||
import appeng.client.render.effects.LightningArcFX;
|
|
||||||
import appeng.client.render.effects.LightningFX;
|
|
||||||
import appeng.client.render.effects.VibrantFX;
|
|
||||||
import appeng.client.render.model.UVLModelLoader;
|
|
||||||
import appeng.client.render.tesr.InscriberTESR;
|
|
||||||
import appeng.client.render.textures.ParticleTextures;
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.entity.EntityFloatingItem;
|
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
|
||||||
import appeng.entity.RenderFloatingItem;
|
|
||||||
import appeng.entity.RenderTinyTNTPrimed;
|
|
||||||
import appeng.helpers.IMouseWheelItem;
|
import appeng.helpers.IMouseWheelItem;
|
||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.hooks.TickHandler.PlayerColor;
|
import appeng.hooks.TickHandler.PlayerColor;
|
||||||
import appeng.server.ServerHelper;
|
import appeng.server.ServerHelper;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
|
||||||
|
|
||||||
public class ClientHelper extends ServerHelper
|
public class ClientHelper extends ServerHelper
|
||||||
@@ -84,19 +67,20 @@ public class ClientHelper extends ServerHelper
|
|||||||
@Override
|
@Override
|
||||||
public void preinit()
|
public void preinit()
|
||||||
{
|
{
|
||||||
MinecraftForge.EVENT_BUS.register( this );
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientInit);
|
||||||
|
MinecraftForge.EVENT_BUS.addListener(this::postPlayerRender);
|
||||||
|
MinecraftForge.EVENT_BUS.addListener(this::wheelEvent);
|
||||||
// Do not register the Fullbright hacks if Optifine is present or if the Forge lighting is disabled
|
// Do not register the Fullbright hacks if Optifine is present or if the Forge lighting is disabled
|
||||||
if( !FMLClientHandler.instance().hasOptifine() && ForgeModContainer.forgeLightPipelineEnabled )
|
// FIXME if( !FMLClientHandler.instance().hasOptifine() && ForgeModContainer.forgeLightPipelineEnabled )
|
||||||
{
|
// FIXME {
|
||||||
ModelLoaderRegistry.registerLoader( UVLModelLoader.INSTANCE );
|
// FIXME ModelLoaderRegistry.registerLoader( UVLModelLoader.INSTANCE );
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler( EntityTinyTNTPrimed.class, manager -> new RenderTinyTNTPrimed( manager ) );
|
// FIXME RenderingRegistry.registerEntityRenderingHandler( EntityTinyTNTPrimed.class, manager -> new RenderTinyTNTPrimed( manager ) );
|
||||||
RenderingRegistry.registerEntityRenderingHandler( EntityFloatingItem.class, manager -> new RenderFloatingItem( manager ) );
|
// FIXME RenderingRegistry.registerEntityRenderingHandler( EntityFloatingItem.class, manager -> new RenderFloatingItem( manager ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void clientInit(FMLClientSetupEvent event)
|
||||||
public void init()
|
|
||||||
{
|
{
|
||||||
for( ActionKey key : ActionKey.values() )
|
for( ActionKey key : ActionKey.values() )
|
||||||
{
|
{
|
||||||
@@ -126,13 +110,11 @@ public class ClientHelper extends ServerHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayerEntity> getPlayers()
|
public List<? extends PlayerEntity> getPlayers()
|
||||||
{
|
{
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
final List<PlayerEntity> o = new ArrayList<>();
|
return Collections.singletonList(Minecraft.getInstance().player);
|
||||||
o.add( Minecraft.getInstance().player );
|
|
||||||
return o;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,46 +125,45 @@ public class ClientHelper extends ServerHelper
|
|||||||
@Override
|
@Override
|
||||||
public void spawnEffect( final EffectType effect, final World world, final double posX, final double posY, final double posZ, final Object o )
|
public void spawnEffect( final EffectType effect, final World world, final double posX, final double posY, final double posZ, final Object o )
|
||||||
{
|
{
|
||||||
if( AEConfig.instance().isEnableEffects() )
|
// FIXME if( AEConfig.instance().isEnableEffects() )
|
||||||
{
|
// FIXME {
|
||||||
switch( effect )
|
// FIXME switch( effect )
|
||||||
{
|
// FIXME {
|
||||||
case Assembler:
|
// FIXME case Assembler:
|
||||||
this.spawnAssembler( world, posX, posY, posZ, o );
|
// FIXME this.spawnAssembler( world, posX, posY, posZ, o );
|
||||||
return;
|
// FIXME return;
|
||||||
case Vibrant:
|
// FIXME case Vibrant:
|
||||||
this.spawnVibrant( world, posX, posY, posZ );
|
// FIXME this.spawnVibrant( world, posX, posY, posZ );
|
||||||
return;
|
// FIXME return;
|
||||||
case Crafting:
|
// FIXME case Crafting:
|
||||||
this.spawnCrafting( world, posX, posY, posZ );
|
// FIXME this.spawnCrafting( world, posX, posY, posZ );
|
||||||
return;
|
// FIXME return;
|
||||||
case Energy:
|
// FIXME case Energy:
|
||||||
this.spawnEnergy( world, posX, posY, posZ );
|
// FIXME this.spawnEnergy( world, posX, posY, posZ );
|
||||||
return;
|
// FIXME return;
|
||||||
case Lightning:
|
// FIXME case Lightning:
|
||||||
this.spawnLightning( world, posX, posY, posZ );
|
// FIXME this.spawnLightning( world, posX, posY, posZ );
|
||||||
return;
|
// FIXME return;
|
||||||
case LightningArc:
|
// FIXME case LightningArc:
|
||||||
this.spawnLightningArc( world, posX, posY, posZ, (Vec3d) o );
|
// FIXME this.spawnLightningArc( world, posX, posY, posZ, (Vec3d) o );
|
||||||
return;
|
// FIXME return;
|
||||||
default:
|
// FIXME default:
|
||||||
}
|
// FIXME }
|
||||||
}
|
// FIXME }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAddParticles( final Random r )
|
public boolean shouldAddParticles( final Random r )
|
||||||
{
|
{
|
||||||
final int setting = Minecraft.getInstance().gameSettings.particleSetting;
|
switch (Minecraft.getInstance().gameSettings.particles) {
|
||||||
if( setting == 2 )
|
default:
|
||||||
{
|
case ALL:
|
||||||
return false;
|
return true;
|
||||||
|
case DECREASED:
|
||||||
|
return r.nextBoolean();
|
||||||
|
case MINIMAL:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if( setting == 0 )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return r.nextInt( 2 * ( setting + 1 ) ) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -214,24 +195,23 @@ public class ClientHelper extends ServerHelper
|
|||||||
public void triggerUpdates()
|
public void triggerUpdates()
|
||||||
{
|
{
|
||||||
final Minecraft mc = Minecraft.getInstance();
|
final Minecraft mc = Minecraft.getInstance();
|
||||||
if( mc == null || mc.player == null || mc.world == null )
|
if( mc.player == null || mc.world == null )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlayerEntity player = mc.player;
|
final PlayerEntity player = mc.player;
|
||||||
|
|
||||||
final int x = (int) player.posX;
|
final int x = (int) player.getPosX();
|
||||||
final int y = (int) player.posY;
|
final int y = (int) player.getPosY();
|
||||||
final int z = (int) player.posZ;
|
final int z = (int) player.getPosZ();
|
||||||
|
|
||||||
final int range = 16 * 16;
|
final int range = 16 * 16;
|
||||||
|
|
||||||
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
mc.worldRenderer.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
private void postPlayerRender( final RenderLivingEvent.Pre p )
|
||||||
public void postPlayerRender( final RenderLivingEvent.Pre p )
|
|
||||||
{
|
{
|
||||||
final PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.getEntity().getEntityId() );
|
final PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.getEntity().getEntityId() );
|
||||||
if( player != null )
|
if( player != null )
|
||||||
@@ -241,7 +221,8 @@ public class ClientHelper extends ServerHelper
|
|||||||
final float r = 0xff & ( col.mediumVariant >> 16 );
|
final float r = 0xff & ( col.mediumVariant >> 16 );
|
||||||
final float g = 0xff & ( col.mediumVariant >> 8 );
|
final float g = 0xff & ( col.mediumVariant >> 8 );
|
||||||
final float b = 0xff & ( col.mediumVariant );
|
final float b = 0xff & ( col.mediumVariant );
|
||||||
GlStateManager.color( r / 255.0f, g / 255.0f, b / 255.0f );
|
// FIXME: This is most certainly not going to work!
|
||||||
|
GlStateManager.color4f( r / 255.0f, g / 255.0f, b / 255.0f, 1.0f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,8 +230,8 @@ public class ClientHelper extends ServerHelper
|
|||||||
{
|
{
|
||||||
final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
|
final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
|
||||||
|
|
||||||
final AssemblerFX fx = new AssemblerFX( world, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
|
// FIXME final AssemblerFX fx = new AssemblerFX( world, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnVibrant( final World w, final double x, final double y, final double z )
|
private void spawnVibrant( final World w, final double x, final double y, final double z )
|
||||||
@@ -261,8 +242,8 @@ public class ClientHelper extends ServerHelper
|
|||||||
final double d1 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
final double d1 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
||||||
final double d2 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
final double d2 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
||||||
|
|
||||||
final VibrantFX fx = new VibrantFX( w, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D );
|
// FIXME final VibrantFX fx = new VibrantFX( w, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D );
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,13 +253,13 @@ public class ClientHelper extends ServerHelper
|
|||||||
final float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
final float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
||||||
final float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
final float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
||||||
|
|
||||||
final CraftingFx fx = new CraftingFx( w, posX + x, posY + y, posZ + z, Items.DIAMOND );
|
// FIXME final CraftingFx fx = new CraftingFx( w, posX + x, posY + y, posZ + z, Items.DIAMOND );
|
||||||
|
|
||||||
fx.setMotionX( -x * 0.2f );
|
// FIXME fx.setMotionX( -x * 0.2f );
|
||||||
fx.setMotionY( -y * 0.2f );
|
// FIXME fx.setMotionY( -y * 0.2f );
|
||||||
fx.setMotionZ( -z * 0.2f );
|
// FIXME fx.setMotionZ( -z * 0.2f );
|
||||||
|
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnEnergy( final World w, final double posX, final double posY, final double posZ )
|
private void spawnEnergy( final World w, final double posX, final double posY, final double posZ )
|
||||||
@@ -287,38 +268,37 @@ public class ClientHelper extends ServerHelper
|
|||||||
final float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
final float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
||||||
final float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
final float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
||||||
|
|
||||||
final EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Items.DIAMOND );
|
// FIXME final EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Items.DIAMOND );
|
||||||
|
|
||||||
fx.setMotionX( -x * 0.1f );
|
// FIXME fx.setMotionX( -x * 0.1f );
|
||||||
fx.setMotionY( -y * 0.1f );
|
// FIXME fx.setMotionY( -y * 0.1f );
|
||||||
fx.setMotionZ( -z * 0.1f );
|
// FIXME fx.setMotionZ( -z * 0.1f );
|
||||||
|
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnLightning( final World world, final double posX, final double posY, final double posZ )
|
private void spawnLightning( final World world, final double posX, final double posY, final double posZ )
|
||||||
{
|
{
|
||||||
final LightningFX fx = new LightningFX( world, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
|
// FIXME final LightningFX fx = new LightningFX( world, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnLightningArc( final World world, final double posX, final double posY, final double posZ, final Vec3d second )
|
private void spawnLightningArc( final World world, final double posX, final double posY, final double posZ, final Vec3d second )
|
||||||
{
|
{
|
||||||
final LightningFX fx = new LightningArcFX( world, posX, posY, posZ, second.x, second.y, second.z, 0.0f, 0.0f, 0.0f );
|
// FIXME final LightningFX fx = new LightningArcFX( world, posX, posY, posZ, second.x, second.y, second.z, 0.0f, 0.0f, 0.0f );
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
private void wheelEvent( final InputEvent.MouseScrollEvent me )
|
||||||
public void wheelEvent( final MouseEvent me )
|
|
||||||
{
|
{
|
||||||
if( me.getDwheel() == 0 )
|
if( me.getScrollDelta() == 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Minecraft mc = Minecraft.getInstance();
|
final Minecraft mc = Minecraft.getInstance();
|
||||||
final PlayerEntity player = mc.player;
|
final PlayerEntity player = mc.player;
|
||||||
if( player.isShiftKeyDown() )
|
if( player.isCrouching() )
|
||||||
{
|
{
|
||||||
final boolean mainHand = player.getHeldItem( Hand.MAIN_HAND ).getItem() instanceof IMouseWheelItem;
|
final boolean mainHand = player.getHeldItem( Hand.MAIN_HAND ).getItem() instanceof IMouseWheelItem;
|
||||||
final boolean offHand = player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem;
|
final boolean offHand = player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem;
|
||||||
@@ -327,7 +307,7 @@ public class ClientHelper extends ServerHelper
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getDwheel() > 0 ? "WheelUp" : "WheelDown" ) );
|
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getScrollDelta() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||||
me.setCanceled( true );
|
me.setCanceled( true );
|
||||||
}
|
}
|
||||||
catch( final IOException e )
|
catch( final IOException e )
|
||||||
@@ -346,14 +326,8 @@ public class ClientHelper extends ServerHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isKeyPressed( ActionKey key )
|
public boolean isActionKey( ActionKey key, InputMappings.Input pressedKey )
|
||||||
{
|
{
|
||||||
return this.bindings.get( key ).isPressed();
|
return this.bindings.get( key ).isActiveAndMatches( pressedKey );
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActionKey( ActionKey key, int pressedKeyCode )
|
|
||||||
{
|
|
||||||
return this.bindings.get( key ).isActiveAndMatches( pressedKeyCode );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,18 +20,9 @@ package appeng.core;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import appeng.client.ClientHelper;
|
import appeng.client.ClientHelper;
|
||||||
import appeng.server.ServerHelper;
|
import appeng.server.ServerHelper;
|
||||||
import com.google.common.base.Stopwatch;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import net.minecraft.world.biome.Biome;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.CrashReportExtender;
|
import net.minecraftforge.fml.CrashReportExtender;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
@@ -39,29 +30,10 @@ import net.minecraftforge.fml.ModLoadingContext;
|
|||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
||||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
|
||||||
import team.chisel.ctm.CTM;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.core.crash.CrashInfo;
|
import appeng.core.crash.CrashInfo;
|
||||||
import appeng.core.crash.IntegrationCrashEnhancement;
|
|
||||||
import appeng.core.crash.ModCrashEnhancement;
|
import appeng.core.crash.ModCrashEnhancement;
|
||||||
import appeng.core.features.AEFeature;
|
|
||||||
import appeng.core.stats.AdvancementTriggers;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
|
||||||
import appeng.core.worlddata.WorldData;
|
|
||||||
import appeng.hooks.TickHandler;
|
|
||||||
import appeng.integration.IntegrationRegistry;
|
|
||||||
import appeng.integration.IntegrationType;
|
|
||||||
import appeng.server.AECommand;
|
|
||||||
import appeng.services.VersionChecker;
|
|
||||||
import appeng.services.export.ExportConfig;
|
import appeng.services.export.ExportConfig;
|
||||||
import appeng.services.export.ExportProcess;
|
|
||||||
import appeng.services.export.ForgeExportConfig;
|
|
||||||
import appeng.services.version.VersionCheckerConfig;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
|
|
||||||
@Mod(AppEng.MOD_ID)
|
@Mod(AppEng.MOD_ID)
|
||||||
public final class AppEng
|
public final class AppEng
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.client.util.InputMappings;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntityMP;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
@@ -32,7 +33,6 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
|
|
||||||
import appeng.api.parts.CableRenderMode;
|
import appeng.api.parts.CableRenderMode;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
@@ -43,6 +43,7 @@ import appeng.core.sync.AppEngPacket;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.items.tools.ToolNetworkTool;
|
import appeng.items.tools.ToolNetworkTool;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||||
|
|
||||||
|
|
||||||
public class ServerHelper extends CommonHelper
|
public class ServerHelper extends CommonHelper
|
||||||
@@ -56,12 +57,6 @@ public class ServerHelper extends CommonHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getWorld()
|
public World getWorld()
|
||||||
{
|
{
|
||||||
@@ -75,15 +70,15 @@ public class ServerHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayerEntity> getPlayers()
|
public List<? extends PlayerEntity> getPlayers()
|
||||||
{
|
{
|
||||||
if( !Platform.isClient() )
|
if( !Platform.isClient() )
|
||||||
{
|
{
|
||||||
final MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
final MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||||
|
|
||||||
if( server != null )
|
if( server != null )
|
||||||
{
|
{
|
||||||
return (List) server.getPlayerList().getPlayers();
|
return server.getPlayerList().getPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +86,7 @@ public class ServerHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendToAllNearExcept( final PlayerEntity p, final double x, final double y, final double z, final double dist, final World w, final AppEngPacket packet )
|
public void sendToAllNearExcept(final PlayerEntity p, final double x, final double y, final double z, final double dist, final World w, final AppEngPacket packet )
|
||||||
{
|
{
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
@@ -100,17 +95,17 @@ public class ServerHelper extends CommonHelper
|
|||||||
|
|
||||||
for( final PlayerEntity o : this.getPlayers() )
|
for( final PlayerEntity o : this.getPlayers() )
|
||||||
{
|
{
|
||||||
final PlayerEntityMP PlayerEntitymp = (PlayerEntityMP) o;
|
final ServerPlayerEntity entityplayermp = (ServerPlayerEntity) o;
|
||||||
|
|
||||||
if( PlayerEntitymp != p && PlayerEntitymp.world == w )
|
if( entityplayermp != p && entityplayermp.world == w )
|
||||||
{
|
{
|
||||||
final double dX = x - PlayerEntitymp.posX;
|
final double dX = x - entityplayermp.getPosX();
|
||||||
final double dY = y - PlayerEntitymp.posY;
|
final double dY = y - entityplayermp.getPosY();
|
||||||
final double dZ = z - PlayerEntitymp.posZ;
|
final double dZ = z - entityplayermp.getPosZ();
|
||||||
|
|
||||||
if( dX * dX + dY * dY + dZ * dZ < dist * dist )
|
if( dX * dX + dY * dY + dZ * dZ < dist * dist )
|
||||||
{
|
{
|
||||||
NetworkHandler.instance().sendTo( packet, PlayerEntitymp );
|
NetworkHandler.instance().sendTo( packet, entityplayermp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,13 +162,13 @@ public class ServerHelper extends CommonHelper
|
|||||||
{
|
{
|
||||||
if( player != null )
|
if( player != null )
|
||||||
{
|
{
|
||||||
for( int x = 0; x < PlayerInventory.getHotbarSize(); x++ )
|
for(int x = 0; x < PlayerInventory.getHotbarSize(); x++ )
|
||||||
{
|
{
|
||||||
final ItemStack is = player.inventory.getStackInSlot( x );
|
final ItemStack is = player.inventory.getStackInSlot( x );
|
||||||
|
|
||||||
if( !is.isEmpty() && is.getItem() instanceof ToolNetworkTool )
|
if( !is.isEmpty() && is.getItem() instanceof ToolNetworkTool )
|
||||||
{
|
{
|
||||||
final CompoundNBT c = is.getTagCompound();
|
final CompoundNBT c = is.getTag();
|
||||||
if( c != null && c.getBoolean( "hideFacades" ) )
|
if( c != null && c.getBoolean( "hideFacades" ) )
|
||||||
{
|
{
|
||||||
return CableRenderMode.CABLE_VIEW;
|
return CableRenderMode.CABLE_VIEW;
|
||||||
@@ -186,13 +181,7 @@ public class ServerHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isKeyPressed( ActionKey key )
|
public boolean isActionKey( ActionKey key, InputMappings.Input input )
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isActionKey( ActionKey key, int pressedKeyCode )
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user