2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
2015-05-18 00:12:13 +02:00
|
|
|
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
2014-11-14 12:02:52 +01:00
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
package appeng.client;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Random;
|
|
|
|
|
2014-12-29 21:59:05 +01:00
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderItem;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
|
|
|
import net.minecraft.entity.item.EntityItem;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
|
|
|
import net.minecraft.util.Vec3;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.client.ForgeHooksClient;
|
|
|
|
import net.minecraftforge.client.IItemRenderer;
|
|
|
|
import net.minecraftforge.client.MinecraftForgeClient;
|
|
|
|
import net.minecraftforge.client.event.MouseEvent;
|
|
|
|
import net.minecraftforge.client.event.RenderLivingEvent;
|
|
|
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
|
|
|
2014-12-29 21:59:05 +01:00
|
|
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
|
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
import appeng.api.parts.CableRenderMode;
|
|
|
|
import appeng.api.util.AEColor;
|
|
|
|
import appeng.block.AEBaseBlock;
|
|
|
|
import appeng.client.render.BaseBlockRender;
|
|
|
|
import appeng.client.render.TESRWrapper;
|
|
|
|
import appeng.client.render.WorldRender;
|
|
|
|
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.texture.CableBusTextures;
|
|
|
|
import appeng.client.texture.ExtraBlockTextures;
|
|
|
|
import appeng.client.texture.ExtraItemTextures;
|
|
|
|
import appeng.core.AEConfig;
|
|
|
|
import appeng.core.AELog;
|
|
|
|
import appeng.core.CommonHelper;
|
|
|
|
import appeng.core.sync.network.NetworkHandler;
|
|
|
|
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
|
|
|
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.hooks.TickHandler;
|
|
|
|
import appeng.hooks.TickHandler.PlayerColor;
|
|
|
|
import appeng.server.ServerHelper;
|
|
|
|
import appeng.transformer.MissingCoreMod;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
public class ClientHelper extends ServerHelper
|
|
|
|
{
|
|
|
|
|
2015-01-01 22:13:10 +01:00
|
|
|
private static final RenderItem ITEM_RENDERER = new RenderItem();
|
|
|
|
private static final RenderBlocks BLOCK_RENDERER = new RenderBlocks();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@SubscribeEvent
|
|
|
|
public void postPlayerRender( RenderLivingEvent.Pre p )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.entity.getEntityId() );
|
|
|
|
if( player != null )
|
|
|
|
{
|
|
|
|
AEColor col = player.myColor;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
float r = 0xff & ( col.mediumVariant >> 16 );
|
|
|
|
float g = 0xff & ( col.mediumVariant >> 8 );
|
|
|
|
float b = 0xff & ( col.mediumVariant );
|
|
|
|
GL11.glColor3f( r / 255.0f, g / 255.0f, b / 255.0f );
|
|
|
|
}
|
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@Override
|
|
|
|
public void init()
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.register( this );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public World getWorld()
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( Platform.isClient() )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return Minecraft.getMinecraft().theWorld;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
else
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return super.getWorld();
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@Override
|
|
|
|
public void bindTileEntitySpecialRenderer( Class tile, AEBaseBlock blk )
|
|
|
|
{
|
|
|
|
BaseBlockRender bbr = blk.getRendererInstance().rendererInstance;
|
|
|
|
if( bbr.hasTESR() && tile != null )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@Override
|
|
|
|
public List<EntityPlayer> getPlayers()
|
|
|
|
{
|
|
|
|
if( Platform.isClient() )
|
|
|
|
{
|
|
|
|
List<EntityPlayer> o = new ArrayList<EntityPlayer>();
|
|
|
|
o.add( Minecraft.getMinecraft().thePlayer );
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
else
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return super.getPlayers();
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@Override
|
|
|
|
public void spawnEffect( EffectType effect, World worldObj, double posX, double posY, double posZ, Object o )
|
|
|
|
{
|
|
|
|
if( AEConfig.instance.enableEffects )
|
|
|
|
{
|
|
|
|
switch( effect )
|
|
|
|
{
|
|
|
|
case Assembler:
|
|
|
|
this.spawnAssembler( worldObj, posX, posY, posZ, o );
|
|
|
|
return;
|
|
|
|
case Vibrant:
|
|
|
|
this.spawnVibrant( worldObj, posX, posY, posZ );
|
|
|
|
return;
|
|
|
|
case Crafting:
|
|
|
|
this.spawnCrafting( worldObj, posX, posY, posZ );
|
|
|
|
return;
|
|
|
|
case Energy:
|
|
|
|
this.spawnEnergy( worldObj, posX, posY, posZ );
|
|
|
|
return;
|
|
|
|
case Lightning:
|
|
|
|
this.spawnLightning( worldObj, posX, posY, posZ );
|
|
|
|
return;
|
|
|
|
case LightningArc:
|
|
|
|
this.spawnLightningArc( worldObj, posX, posY, posZ, (Vec3) o );
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
private void spawnAssembler( World worldObj, double posX, double posY, double posZ, Object o )
|
|
|
|
{
|
|
|
|
PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
AssemblerFX fx = new AssemblerFX( Minecraft.getMinecraft().theWorld, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
|
|
|
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
private void spawnVibrant( World w, double x, double y, double z )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
double d0 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
|
|
|
double d1 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
|
|
|
double d2 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
VibrantFX fx = new VibrantFX( w, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D );
|
|
|
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
private void spawnCrafting( World w, double posX, double posY, double posZ )
|
|
|
|
{
|
|
|
|
float x = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
|
|
|
float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
|
|
|
float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
|
|
|
|
|
|
|
CraftingFx fx = new CraftingFx( w, posX + x, posY + y, posZ + z, Items.diamond );
|
|
|
|
|
|
|
|
fx.motionX = -x * 0.2;
|
|
|
|
fx.motionY = -y * 0.2;
|
|
|
|
fx.motionZ = -z * 0.2;
|
|
|
|
|
|
|
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
|
|
|
}
|
|
|
|
|
|
|
|
private void spawnEnergy( World w, double posX, double posY, double posZ )
|
|
|
|
{
|
|
|
|
float x = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
|
|
|
float y = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
|
|
|
float z = (float) ( ( ( Platform.getRandomInt() % 100 ) * 0.01 ) - 0.5 ) * 0.7f;
|
|
|
|
|
|
|
|
EnergyFx fx = new EnergyFx( w, posX + x, posY + y, posZ + z, Items.diamond );
|
|
|
|
|
|
|
|
fx.motionX = -x * 0.1;
|
|
|
|
fx.motionY = -y * 0.1;
|
|
|
|
fx.motionZ = -z * 0.1;
|
|
|
|
|
|
|
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
|
|
|
}
|
|
|
|
|
|
|
|
private void spawnLightning( World worldObj, double posX, double posY, double posZ )
|
|
|
|
{
|
|
|
|
LightningFX fx = new LightningFX( worldObj, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
|
|
|
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
|
|
|
}
|
|
|
|
|
|
|
|
private void spawnLightningArc( World worldObj, double posX, double posY, double posZ, Vec3 second )
|
|
|
|
{
|
|
|
|
LightningFX fx = new LightningArcFX( worldObj, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f );
|
|
|
|
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldAddParticles( Random r )
|
|
|
|
{
|
|
|
|
int setting = Minecraft.getMinecraft().gameSettings.particleSetting;
|
|
|
|
if( setting == 2 )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return false;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
if( setting == 0 )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return true;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
return r.nextInt( 2 * ( setting + 1 ) ) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public MovingObjectPosition getMOP()
|
|
|
|
{
|
|
|
|
return Minecraft.getMinecraft().objectMouseOver;
|
|
|
|
}
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public void doRenderItem( ItemStack itemstack, World w )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( itemstack != null )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
EntityItem entityitem = new EntityItem( w, 0.0D, 0.0D, 0.0D, itemstack );
|
|
|
|
entityitem.getEntityItem().stackSize = 1;
|
|
|
|
|
|
|
|
// set all this stuff and then do shit? meh?
|
|
|
|
entityitem.hoverStart = 0;
|
|
|
|
entityitem.age = 0;
|
|
|
|
entityitem.rotationYaw = 0;
|
|
|
|
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glTranslatef( 0, -0.04F, 0 );
|
|
|
|
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
|
|
|
// GL11.glDisable( GL11.GL_CULL_FACE );
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses() )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
GL11.glTranslatef( 0.0f, -0.05f, -0.25f );
|
|
|
|
GL11.glScalef( 1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f );
|
|
|
|
// GL11.glTranslated( -8.0, -12.2, -10.6 );
|
|
|
|
GL11.glScalef( 1.0f, -1.0f, 0.005f );
|
|
|
|
// GL11.glScalef( 1.0f , -1.0f, 1.0f );
|
|
|
|
|
|
|
|
Block block = Block.getBlockFromItem( itemstack.getItem() );
|
2015-04-03 08:54:31 +02:00
|
|
|
if( ( itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( block.getRenderType() ) ) )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
|
|
|
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
|
|
|
GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f );
|
|
|
|
}
|
|
|
|
|
2015-05-18 00:12:13 +02:00
|
|
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer( itemstack, IItemRenderer.ItemRenderType.ENTITY );
|
2015-04-03 08:54:31 +02:00
|
|
|
if( customRenderer != null && !( itemstack.getItem() instanceof ItemBlock ) )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-05-18 00:12:13 +02:00
|
|
|
if( customRenderer.shouldUseRenderHelper( IItemRenderer.ItemRenderType.ENTITY, itemstack, IItemRenderer.ItemRendererHelper.BLOCK_3D ) )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
GL11.glTranslatef( 0, -0.04F, 0 );
|
|
|
|
GL11.glScalef( 0.7f, 0.7f, 0.7f );
|
|
|
|
GL11.glRotatef( 35, 1, 0, 0 );
|
|
|
|
GL11.glRotatef( 45, 0, 1, 0 );
|
|
|
|
GL11.glRotatef( -90, 0, 1, 0 );
|
|
|
|
}
|
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
else if( itemstack.getItem() instanceof ItemBlock )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
GL11.glTranslatef( 0, -0.04F, 0 );
|
|
|
|
GL11.glScalef( 1.1f, 1.1f, 1.1f );
|
|
|
|
GL11.glRotatef( -90, 0, 1, 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GL11.glTranslatef( 0, -0.14F, 0 );
|
|
|
|
GL11.glScalef( 0.8f, 0.8f, 0.8f );
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderItem.renderInFrame = true;
|
|
|
|
RenderManager.instance.renderEntityWithPosYaw( entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F );
|
|
|
|
RenderItem.renderInFrame = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GL11.glScalef( 1.0f / 42.0f, 1.0f / 42.0f, 1.0f / 42.0f );
|
|
|
|
GL11.glTranslated( -8.0, -10.2, -10.4 );
|
|
|
|
GL11.glScalef( 1.0f, 1.0f, 0.005f );
|
|
|
|
|
|
|
|
RenderItem.renderInFrame = false;
|
|
|
|
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
2015-04-03 08:54:31 +02:00
|
|
|
if( !ForgeHooksClient.renderInventoryItem( BLOCK_RENDERER, Minecraft.getMinecraft().renderEngine, itemstack, true, 0, 0, 0 ) )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-01-01 22:13:10 +01:00
|
|
|
ITEM_RENDERER.renderItemIntoGUI( fr, Minecraft.getMinecraft().renderEngine, itemstack, 0, 0, false );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-09-28 11:47:17 +02:00
|
|
|
public void postInit()
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-01-01 22:13:10 +01:00
|
|
|
RenderingRegistry.registerBlockHandler( WorldRender.INSTANCE );
|
2014-09-24 02:26:27 +02:00
|
|
|
RenderManager.instance.entityRenderMap.put( EntityTinyTNTPrimed.class, new RenderTinyTNTPrimed() );
|
|
|
|
RenderManager.instance.entityRenderMap.put( EntityFloatingItem.class, new RenderFloatingItem() );
|
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
@Override
|
|
|
|
public CableRenderMode getRenderMode()
|
|
|
|
{
|
|
|
|
if( Platform.isServer() )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return super.getRenderMode();
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
|
|
|
|
Minecraft mc = Minecraft.getMinecraft();
|
|
|
|
EntityPlayer player = mc.thePlayer;
|
|
|
|
|
|
|
|
return this.renderModeForPlayer( player );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void triggerUpdates()
|
|
|
|
{
|
|
|
|
Minecraft mc = Minecraft.getMinecraft();
|
|
|
|
if( mc == null || mc.thePlayer == null || mc.theWorld == null )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
|
|
|
|
EntityPlayer player = mc.thePlayer;
|
|
|
|
|
|
|
|
int x = (int) player.posX;
|
|
|
|
int y = (int) player.posY;
|
|
|
|
int z = (int) player.posZ;
|
|
|
|
|
|
|
|
int range = 16 * 16;
|
|
|
|
|
|
|
|
mc.theWorld.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void missingCoreMod()
|
|
|
|
{
|
|
|
|
throw new MissingCoreMod();
|
|
|
|
}
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
@SubscribeEvent
|
2015-04-03 08:54:31 +02:00
|
|
|
public void wheelEvent( MouseEvent me )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( me.isCanceled() || me.dwheel == 0 )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
return;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
Minecraft mc = Minecraft.getMinecraft();
|
|
|
|
EntityPlayer player = mc.thePlayer;
|
|
|
|
ItemStack is = player.getHeldItem();
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( is != null && is.getItem() instanceof IMouseWheelItem && player.isSneaking() )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Item", me.dwheel > 0 ? "WheelUp" : "WheelDown" ) );
|
|
|
|
me.setCanceled( true );
|
|
|
|
}
|
2015-04-03 08:54:31 +02:00
|
|
|
catch( IOException e )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
AELog.error( e );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
2015-04-03 08:54:31 +02:00
|
|
|
public void updateTextureSheet( TextureStitchEvent.Pre ev )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( ev.map.getTextureType() == 1 )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
for( ExtraItemTextures et : ExtraItemTextures.values() )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
et.registerIcon( ev.map );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( ev.map.getTextureType() == 0 )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
for( ExtraBlockTextures et : ExtraBlockTextures.values() )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
et.registerIcon( ev.map );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
for( CableBusTextures cb : CableBusTextures.values() )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
cb.registerIcon( ev.map );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|