More fixes. Around 1000 errors now, going to have to leave it to you from here on in @aidancbrady.

This commit is contained in:
Ben Spiers 2014-04-20 22:34:45 +01:00
parent 31938e8b68
commit 3d8c5c8696
22 changed files with 241 additions and 284 deletions

2
.gitignore vendored
View file

@ -2,7 +2,7 @@ build
output
.gradle
.idea
Mekanism.iml
*.iml
Mekanism*.jar
MDK.zip

View file

@ -4,31 +4,30 @@ import java.net.InetAddress;
import mekanism.client.voice.VoiceClient;
import mekanism.common.Mekanism;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClientConnectionHandler implements IConnectionHandler
public class ClientConnectionHandler
{
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {}
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
@SubscribeEvent
public void onConnection(ClientConnectedToServerEvent event)
{
return null;
if(event.isLocal)
{
connectionOpened();
}
else
{
//TODO this is probably wrong
connectionOpened(event.manager.getSocketAddress().toString());
}
}
/* Remote */
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
public void connectionOpened(String server)
{
if(Mekanism.voiceServerEnabled)
{
@ -39,8 +38,7 @@ public class ClientConnectionHandler implements IConnectionHandler
}
/* Integrated */
@Override
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
public void connectionOpened()
{
if(Mekanism.voiceServerEnabled)
{
@ -50,9 +48,4 @@ public class ClientConnectionHandler implements IConnectionHandler
}
}
@Override
public void connectionClosed(INetworkManager manager) {}
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) {}
}

View file

@ -1,27 +1,18 @@
package mekanism.client;
import mekanism.common.Mekanism;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.IPlayerTracker;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClientPlayerTracker implements IPlayerTracker
public class ClientPlayerTracker
{
@Override
public void onPlayerLogin(EntityPlayer player) {}
@Override
public void onPlayerLogout(EntityPlayer player) {}
@Override
public void onPlayerChangedDimension(EntityPlayer player)
@SubscribeEvent
public void onPlayerChangedDimension(PlayerChangedDimensionEvent event)
{
Mekanism.jetpackOn.remove(player);
Mekanism.jetpackOn.remove(event.player);
}
@Override
public void onPlayerRespawn(EntityPlayer player) {}
}

View file

@ -228,7 +228,7 @@ public class ClientProxy extends CommonProxy
@Override
public void openElectricChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z)
{
TileEntityElectricChest tileEntity = (TileEntityElectricChest)entityplayer.getWorldObj().getTileEntity(x, y, z);
TileEntityElectricChest tileEntity = (TileEntityElectricChest)entityplayer.worldObj.getTileEntity(x, y, z);
if(id == 0)
{

View file

@ -1,6 +1,5 @@
package mekanism.client;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -15,7 +14,6 @@ import mekanism.client.sound.JetpackSound;
import mekanism.common.KeySync;
import mekanism.common.Mekanism;
import mekanism.common.ObfuscatedNames;
import mekanism.common.PacketHandler;
import mekanism.common.item.ItemConfigurator;
import mekanism.common.item.ItemElectricBow;
import mekanism.common.item.ItemFreeRunners;
@ -43,8 +41,9 @@ import net.minecraft.util.StringUtils;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -54,7 +53,7 @@ import cpw.mods.fml.relauncher.SideOnly;
*
*/
@SideOnly(Side.CLIENT)
public class ClientTickHandler implements ITickHandler
public class ClientTickHandler
{
public boolean hasNotified = false;
public boolean initHoliday = false;
@ -77,8 +76,21 @@ public class ClientTickHandler implements ITickHandler
public static Set<IClientTicker> tickingSet = new HashSet<IClientTicker>();
@SubscribeEvent
public void onTick(ClientTickEvent event)
{
if(event.phase == Phase.START)
{
tickStart();
}
else if(event.phase == Phase.END)
{
tickEnd();
}
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
public void tickStart()
{
if(!preloadedSounds && mc.sndManager.sndSystem != null && MekanismClient.enableSounds)
{
@ -142,14 +154,14 @@ public class ClientTickHandler implements ITickHandler
if(player != null)
{
if(StringUtils.stripControlCodes(player.username).equals("mikeacttck"))
if(StringUtils.stripControlCodes(player.getCommandSenderName()).equals("mikeacttck"))
{
CapeBufferDownload download = mikeDownload.get(player.username);
CapeBufferDownload download = mikeDownload.get(player.getCommandSenderName());
if(download == null)
{
download = new CapeBufferDownload(player.username, MIKE_CAPE);
mikeDownload.put(player.username, download);
download = new CapeBufferDownload(player.getCommandSenderName(), MIKE_CAPE);
mikeDownload.put(player.getCommandSenderName(), download);
download.start();
}
@ -163,14 +175,14 @@ public class ClientTickHandler implements ITickHandler
MekanismUtils.setPrivateValue(player, download.getResourceLocation(), AbstractClientPlayer.class, ObfuscatedNames.AbstractClientPlayer_locationCape);
}
}
else if(StringUtils.stripControlCodes(player.username).equals("aidancbrady"))
else if(StringUtils.stripControlCodes(player.getCommandSenderName()).equals("aidancbrady"))
{
CapeBufferDownload download = aidanDownload.get(player.username);
CapeBufferDownload download = aidanDownload.get(player.getCommandSenderName());
if(download == null)
{
download = new CapeBufferDownload(player.username, AIDAN_CAPE);
aidanDownload.put(player.username, download);
download = new CapeBufferDownload(player.getCommandSenderName(), AIDAN_CAPE);
aidanDownload.put(player.getCommandSenderName(), download);
download.start();
}
@ -184,14 +196,14 @@ public class ClientTickHandler implements ITickHandler
MekanismUtils.setPrivateValue(player, download.getResourceLocation(), AbstractClientPlayer.class, ObfuscatedNames.AbstractClientPlayer_locationCape);
}
}
else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.username)))
else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.getCommandSenderName())))
{
CapeBufferDownload download = donateDownload.get(player.username);
CapeBufferDownload download = donateDownload.get(player.getCommandSenderName());
if(download == null)
{
download = new CapeBufferDownload(player.username, DONATE_CAPE);
donateDownload.put(player.username, download);
download = new CapeBufferDownload(player.getCommandSenderName(), DONATE_CAPE);
donateDownload.put(player.getCommandSenderName(), download);
download.start();
}
@ -268,9 +280,9 @@ public class ClientTickHandler implements ITickHandler
lastTickUpdate = false;
}
}
else if(mc.thePlayer.getCurrentItemOrArmor(3) != null && mc.thePlayer.getCurrentItemOrArmor(3).getItem() instanceof ItemJetpack)
else if(mc.thePlayer.getEquipmentInSlot(3) != null && mc.thePlayer.getEquipmentInSlot(3).getItem() instanceof ItemJetpack)
{
ItemStack jetpack = mc.thePlayer.getCurrentItemOrArmor(3);
ItemStack jetpack = mc.thePlayer.getEquipmentInSlot(3);
if(MekanismKeyHandler.modeSwitchKey.getIsKeyPressed())
{
@ -286,9 +298,9 @@ public class ClientTickHandler implements ITickHandler
lastTickUpdate = false;
}
}
else if(mc.thePlayer.getCurrentItemOrArmor(3) != null && mc.thePlayer.getCurrentItemOrArmor(3).getItem() instanceof ItemScubaTank)
else if(mc.thePlayer.getEquipmentInSlot(3) != null && mc.thePlayer.getEquipmentInSlot(3).getItem() instanceof ItemScubaTank)
{
ItemStack scubaTank = mc.thePlayer.getCurrentItemOrArmor(3);
ItemStack scubaTank = mc.thePlayer.getEquipmentInSlot(3);
if(MekanismKeyHandler.modeSwitchKey.getIsKeyPressed())
{
@ -309,7 +321,7 @@ public class ClientTickHandler implements ITickHandler
}
}
if(mc.thePlayer.getCurrentItemOrArmor(1) != null && mc.thePlayer.getCurrentItemOrArmor(1).getItem() instanceof ItemFreeRunners)
if(mc.thePlayer.getEquipmentInSlot(1) != null && mc.thePlayer.getEquipmentInSlot(1).getItem() instanceof ItemFreeRunners)
{
mc.thePlayer.stepHeight = 1.002F;
}
@ -320,30 +332,30 @@ public class ClientTickHandler implements ITickHandler
}
}
if(Mekanism.jetpackOn.contains(mc.thePlayer.username) != isJetpackOn(mc.thePlayer))
if(Mekanism.jetpackOn.contains(mc.thePlayer.getCommandSenderName()) != isJetpackOn(mc.thePlayer))
{
if(isJetpackOn(mc.thePlayer))
{
Mekanism.jetpackOn.add(mc.thePlayer.username);
Mekanism.jetpackOn.add(mc.thePlayer.getCommandSenderName());
}
else {
Mekanism.jetpackOn.remove(mc.thePlayer.username);
Mekanism.jetpackOn.remove(mc.thePlayer.getCommandSenderName());
}
Mekanism.packetPipeline.sendToServer(new PacketJetpackData(JetpackPacket.UPDATE, mc.thePlayer.username, isJetpackOn(mc.thePlayer)));
Mekanism.packetPipeline.sendToServer(new PacketJetpackData(JetpackPacket.UPDATE, mc.thePlayer.getCommandSenderName(), isJetpackOn(mc.thePlayer)));
}
if(Mekanism.gasmaskOn.contains(mc.thePlayer.username) != isGasMaskOn(mc.thePlayer))
if(Mekanism.gasmaskOn.contains(mc.thePlayer.getCommandSenderName()) != isGasMaskOn(mc.thePlayer))
{
if(isGasMaskOn(mc.thePlayer) && mc.currentScreen == null)
{
Mekanism.gasmaskOn.add(mc.thePlayer.username);
Mekanism.gasmaskOn.add(mc.thePlayer.getCommandSenderName());
}
else {
Mekanism.gasmaskOn.remove(mc.thePlayer.username);
Mekanism.gasmaskOn.remove(mc.thePlayer.getCommandSenderName());
}
Mekanism.packetPipeline.sendToServer(new PacketScubaTankData(ScubaTankPacket.UPDATE, mc.thePlayer.username, isGasMaskOn(mc.thePlayer)));
Mekanism.packetPipeline.sendToServer(new PacketScubaTankData(ScubaTankPacket.UPDATE, mc.thePlayer.getCommandSenderName(), isGasMaskOn(mc.thePlayer)));
}
if(MekanismClient.audioHandler != null)
@ -371,7 +383,7 @@ public class ClientTickHandler implements ITickHandler
}
}
if(mc.thePlayer.getCurrentItemOrArmor(3) != null && mc.thePlayer.getCurrentItemOrArmor(3).getItem() instanceof ItemJetpack)
if(mc.thePlayer.getEquipmentInSlot(3) != null && mc.thePlayer.getEquipmentInSlot(3).getItem() instanceof ItemJetpack)
{
MekanismClient.updateKey(mc.gameSettings.keyBindJump.getKeyCode(), KeySync.ASCEND);
MekanismClient.updateKey(mc.gameSettings.keyBindSneak.getKeyCode(), KeySync.DESCEND);
@ -379,16 +391,16 @@ public class ClientTickHandler implements ITickHandler
if(isJetpackOn(mc.thePlayer))
{
ItemJetpack jetpack = (ItemJetpack)mc.thePlayer.getCurrentItemOrArmor(3).getItem();
ItemJetpack jetpack = (ItemJetpack)mc.thePlayer.getEquipmentInSlot(3).getItem();
if(jetpack.getMode(mc.thePlayer.getCurrentItemOrArmor(3)) == JetpackMode.NORMAL)
if(jetpack.getMode(mc.thePlayer.getEquipmentInSlot(3)) == JetpackMode.NORMAL)
{
mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0.5D);
mc.thePlayer.fallDistance = 0.0F;
}
else if(jetpack.getMode(mc.thePlayer.getCurrentItemOrArmor(3)) == JetpackMode.HOVER)
else if(jetpack.getMode(mc.thePlayer.getEquipmentInSlot(3)) == JetpackMode.HOVER)
{
if((!Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.keyCode)) || (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.keyCode) && Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.keyCode)) || mc.currentScreen != null)
if((!Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) || (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) || mc.currentScreen != null)
{
if(mc.thePlayer.motionY > 0)
{
@ -413,14 +425,14 @@ public class ClientTickHandler implements ITickHandler
mc.thePlayer.fallDistance = 0.0F;
}
jetpack.useGas(mc.thePlayer.getCurrentItemOrArmor(3));
jetpack.useGas(mc.thePlayer.getEquipmentInSlot(3));
}
if(isGasMaskOn(mc.thePlayer))
{
ItemScubaTank tank = (ItemScubaTank)mc.thePlayer.getCurrentItemOrArmor(3).getItem();
ItemScubaTank tank = (ItemScubaTank)mc.thePlayer.getEquipmentInSlot(3).getItem();
tank.useGas(mc.thePlayer.getCurrentItemOrArmor(3));
tank.useGas(mc.thePlayer.getEquipmentInSlot(3));
mc.thePlayer.setAir(300);
mc.thePlayer.clearActivePotions();
}
@ -442,7 +454,7 @@ public class ClientTickHandler implements ITickHandler
{
if(player != mc.thePlayer)
{
return Mekanism.jetpackOn.contains(player.username);
return Mekanism.jetpackOn.contains(player.getCommandSenderName());
}
ItemStack stack = player.inventory.armorInventory[2];
@ -474,7 +486,7 @@ public class ClientTickHandler implements ITickHandler
{
if(player != mc.thePlayer)
{
return Mekanism.gasmaskOn.contains(player.username);
return Mekanism.gasmaskOn.contains(player.getCommandSenderName());
}
ItemStack tank = player.inventory.armorInventory[2];
@ -499,8 +511,7 @@ public class ClientTickHandler implements ITickHandler
return false;
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
public void tickEnd()
{
if(MekanismClient.audioHandler != null)
{
@ -510,16 +521,4 @@ public class ClientTickHandler implements ITickHandler
}
}
}
@Override
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.CLIENT);
}
@Override
public String getLabel()
{
return "MekanismClient";
}
}

View file

@ -46,24 +46,22 @@ import org.lwjgl.opengl.GL11;
import codechicken.lib.colour.Colour;
import codechicken.lib.colour.ColourRGBA;
import codechicken.lib.lighting.LazyLightMatrix;
import codechicken.lib.lighting.LightMatrix;
import codechicken.lib.lighting.LightModel;
import codechicken.lib.lighting.LightModel.Light;
import codechicken.lib.render.CCModel;
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.ColourMultiplier;
import codechicken.lib.render.IVertexModifier;
import codechicken.lib.render.IIconTransformation;
import codechicken.lib.render.TextureUtils;
import codechicken.lib.render.TextureUtils.IIIconRegister;
import codechicken.lib.render.UV;
import codechicken.lib.render.TextureUtils.IIconSelfRegister;
import codechicken.lib.render.uv.UV;
import codechicken.lib.render.uv.IconTransformation;
import codechicken.lib.vec.Rotation;
import codechicken.lib.vec.Transformation;
import codechicken.lib.vec.Translation;
import codechicken.lib.vec.Vector3;
public class RenderGlowPanel implements IIIconRegister
public class RenderGlowPanel implements IIconSelfRegister
{
public static RenderGlowPanel INSTANCE;
@ -107,35 +105,33 @@ public class RenderGlowPanel implements IIIconRegister
}
}
public void renderStatic(PartGlowPanel panel, LazyLightMatrix olm)
public void renderStatic(PartGlowPanel panel)
{
TextureUtils.bindAtlas(0);
CCRenderState.reset();
CCRenderState.useModelColours(true);
CCRenderState.setBrightness(panel.world(), panel.x(), panel.y(), panel.z());
Colour colour = new ColourRGBA(panel.colour.getColor(0), panel.colour.getColor(1), panel.colour.getColor(2), 1);
int side = panel.side.ordinal();
frameModels[side].render(0, frameModels[side].verts.length, new Translation(panel.x(), panel.y(), panel.z()), new IIconTransformation(icon), null);
frameModels[side].render(0, frameModels[side].verts.length, new Translation(panel.x(), panel.y(), panel.z()), new IconTransformation(icon), null);
lightModels[side].render(0, lightModels[side].verts.length, new Translation(panel.x(), panel.y(), panel.z()), new IIconTransformation(icon), new ColourMultiplier(colour));
lightModels[side].render(0, lightModels[side].verts.length, new Translation(panel.x(), panel.y(), panel.z()), new IconTransformation(icon), new ColourMultiplier(colour.rgba()));
}
public void renderItem(int metadata)
{
TextureUtils.bindAtlas(0);
CCRenderState.reset();
CCRenderState.startDrawing(7);
CCRenderState.useModelColours(true);
CCRenderState.startDrawing();
EnumColor c = EnumColor.DYES[metadata];
Colour colour = new ColourRGBA(c.getColor(0), c.getColor(1), c.getColor(2), 1);
Colour white = new ColourRGBA(1.0, 1.0, 1.0, 1.0);
for(int i=4;i<5;i++){
frameModels[i].render(0, frameModels[i].verts.length, new Translation(0, 0, 0), new IIconTransformation(icon), new ColourMultiplier(white));
lightModels[i].render(0, lightModels[i].verts.length, new Translation(0, 0, 0), new IIconTransformation(icon), new ColourMultiplier(colour));
frameModels[i].render(0, frameModels[i].verts.length, new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(white.rgba()));
lightModels[i].render(0, lightModels[i].verts.length, new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(colour.rgba()));
}
CCRenderState.draw();
}

View file

@ -200,7 +200,7 @@ public class RenderPartTransmitter implements IIconRegister
if(transporter instanceof PartDiversionTransporter)
{
EntityPlayer player = mc.thePlayer;
World world = mc.thePlayer.getWorldObj();
World world = mc.thePlayer.worldObj;
ItemStack itemStack = player.getCurrentEquippedItem();
MovingObjectPosition pos = player.rayTrace(8.0D, 1.0F);

View file

@ -24,29 +24,34 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderTickHandler implements ITickHandler
public class RenderTickHandler
{
public Random rand = new Random();
public Minecraft mc = Minecraft.getMinecraft();
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
@SubscribeEvent
public void onTick(RenderTickEvent event)
{
float partialTick = (Float)tickData[0];
if(event.phase == Phase.END)
{
tickEnd(event.renderTickTime);
}
}
@Override
public void tickEnd(float partialTick)
{
if(mc.thePlayer != null && mc.theWorld != null)
{
EntityPlayer player = mc.thePlayer;
World world = mc.thePlayer.getWorldObj();
World world = mc.thePlayer.worldObj;
FontRenderer font = mc.fontRenderer;
@ -72,7 +77,7 @@ public class RenderTickHandler implements ITickHandler
}
}
font.drawStringWithShadow("Block ID: " + obj.getBlockId(world), 1, 1, 0x404040);
font.drawStringWithShadow("Block: " + obj.getBlock(world).getUnlocalizedName(), 1, 1, 0x404040);
font.drawStringWithShadow("Metadata: " + obj.getMetadata(world), 1, 10, 0x404040);
font.drawStringWithShadow("Location: " + MekanismUtils.getCoordDisplay(obj), 1, 19, 0x404040);
font.drawStringWithShadow("TileEntity: " + tileDisplay, 1, 28, 0x404040);
@ -80,9 +85,9 @@ public class RenderTickHandler implements ITickHandler
}
}
if(player != null && !(mc.currentScreen instanceof GuiChat) && player.getCurrentItemOrArmor(3) != null)
if(player != null && !(mc.currentScreen instanceof GuiChat) && player.getEquipmentInSlot(3) != null)
{
ItemStack stack = player.getCurrentItemOrArmor(3);
ItemStack stack = player.getEquipmentInSlot(3);
ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
@ -184,16 +189,4 @@ public class RenderTickHandler implements ITickHandler
mc.effectRenderer.addEffect(fx);
}
@Override
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.RENDER);
}
@Override
public String getLabel()
{
return "MekanismRender";
}
}

View file

@ -52,7 +52,7 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
TileEntity tileEntity = (TileEntity)configurable;
EntityPlayer player = mc.thePlayer;
World world = mc.thePlayer.getWorldObj();
World world = mc.thePlayer.worldObj;
ItemStack itemStack = player.getCurrentEquippedItem();
MovingObjectPosition pos = player.rayTrace(8.0D, 1.0F);

View file

@ -29,7 +29,7 @@ public abstract class PlayerSound extends Sound
{
return false;
}
else if(player.getWorldObj() != world)
else if(player.worldObj != world)
{
return false;
}

View file

@ -13,68 +13,61 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
public class CommonPlayerTickHandler implements ITickHandler
public class CommonPlayerTickHandler
{
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
@SubscribeEvent
public void onTick(PlayerTickEvent event)
{
if(tickData[0] instanceof EntityPlayer)
if(event.phase == Phase.END)
{
EntityPlayer player = (EntityPlayer)tickData[0];
tickEnd(event.player);
}
}
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemPortableTeleporter)
public void tickEnd(EntityPlayer player)
{
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemPortableTeleporter)
{
ItemPortableTeleporter item = (ItemPortableTeleporter)player.getCurrentEquippedItem().getItem();
ItemStack itemstack = player.getCurrentEquippedItem();
Teleporter.Code teleCode = new Teleporter.Code(item.getDigit(itemstack, 0), item.getDigit(itemstack, 1), item.getDigit(itemstack, 2), item.getDigit(itemstack, 3));
if(Mekanism.teleporters.containsKey(teleCode))
{
ItemPortableTeleporter item = (ItemPortableTeleporter)player.getCurrentEquippedItem().getItem();
ItemStack itemstack = player.getCurrentEquippedItem();
Teleporter.Code teleCode = new Teleporter.Code(item.getDigit(itemstack, 0), item.getDigit(itemstack, 1), item.getDigit(itemstack, 2), item.getDigit(itemstack, 3));
if(Mekanism.teleporters.containsKey(teleCode))
if(Mekanism.teleporters.get(teleCode).size() > 0 && Mekanism.teleporters.get(teleCode).size() <= 2)
{
if(Mekanism.teleporters.get(teleCode).size() > 0 && Mekanism.teleporters.get(teleCode).size() <= 2)
{
int energyNeeded = item.calculateEnergyCost(player, MekanismUtils.getClosestCoords(teleCode, player));
int energyNeeded = item.calculateEnergyCost(player, MekanismUtils.getClosestCoords(teleCode, player));
if(item.getEnergy(itemstack) < energyNeeded)
{
if(item.getStatus(itemstack) != 2)
{
item.setStatus(itemstack, 2);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(2), player);
}
}
else {
if(item.getStatus(itemstack) != 1)
{
item.setStatus(itemstack, 1);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(1), player);
}
}
return;
}
else if(Mekanism.teleporters.get(teleCode).size() > 2)
if(item.getEnergy(itemstack) < energyNeeded)
{
if(item.getStatus(itemstack) != 3)
if(item.getStatus(itemstack) != 2)
{
item.setStatus(itemstack, 3);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(3), player);
item.setStatus(itemstack, 2);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(2), player);
}
return;
}
else {
if(item.getStatus(itemstack) != 4)
if(item.getStatus(itemstack) != 1)
{
item.setStatus(itemstack, 4);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(4), player);
item.setStatus(itemstack, 1);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(1), player);
}
return;
}
return;
}
else if(Mekanism.teleporters.get(teleCode).size() > 2)
{
if(item.getStatus(itemstack) != 3)
{
item.setStatus(itemstack, 3);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(3), player);
}
return;
}
else {
if(item.getStatus(itemstack) != 4)
@ -85,69 +78,77 @@ public class CommonPlayerTickHandler implements ITickHandler
return;
}
}
if(player.getCurrentItemOrArmor(1) != null && player.getCurrentItemOrArmor(1).getItem() instanceof ItemFreeRunners)
{
player.stepHeight = 1.002F;
}
else {
if(player.stepHeight == 1.002F)
if(item.getStatus(itemstack) != 4)
{
player.stepHeight = 0.5F;
item.setStatus(itemstack, 4);
Mekanism.packetPipeline.sendTo(new PacketStatusUpdate(4), player);
}
return;
}
}
if(isJetpackOn(player))
if(player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(1).getItem() instanceof ItemFreeRunners)
{
player.stepHeight = 1.002F;
}
else {
if(player.stepHeight == 1.002F)
{
ItemJetpack jetpack = (ItemJetpack)player.getCurrentItemOrArmor(3).getItem();
player.stepHeight = 0.5F;
}
}
if(jetpack.getMode(player.getCurrentItemOrArmor(3)) == JetpackMode.NORMAL)
if(isJetpackOn(player))
{
ItemJetpack jetpack = (ItemJetpack)player.getEquipmentInSlot(3).getItem();
if(jetpack.getMode(player.getEquipmentInSlot(3)) == JetpackMode.NORMAL)
{
player.motionY = Math.min(player.motionY + 0.15D, 0.5D);
}
else if(jetpack.getMode(player.getEquipmentInSlot(3)) == JetpackMode.HOVER)
{
if((!Mekanism.keyMap.has(player, KeySync.ASCEND) && !Mekanism.keyMap.has(player, KeySync.DESCEND)) || (Mekanism.keyMap.has(player, KeySync.ASCEND) && Mekanism.keyMap.has(player, KeySync.DESCEND)))
{
player.motionY = Math.min(player.motionY + 0.15D, 0.5D);
}
else if(jetpack.getMode(player.getCurrentItemOrArmor(3)) == JetpackMode.HOVER)
{
if((!Mekanism.keyMap.has(player, KeySync.ASCEND) && !Mekanism.keyMap.has(player, KeySync.DESCEND)) || (Mekanism.keyMap.has(player, KeySync.ASCEND) && Mekanism.keyMap.has(player, KeySync.DESCEND)))
if(player.motionY > 0)
{
if(player.motionY > 0)
{
player.motionY = Math.max(player.motionY - 0.15D, 0);
}
else if(player.motionY < 0)
{
player.motionY = Math.min(player.motionY + 0.15D, 0);
}
player.motionY = Math.max(player.motionY - 0.15D, 0);
}
else {
if(Mekanism.keyMap.has(player, KeySync.ASCEND))
{
player.motionY = Math.min(player.motionY + 0.15D, 0.2D);
}
else if(Mekanism.keyMap.has(player, KeySync.DESCEND))
{
player.motionY = Math.max(player.motionY - 0.15D, -0.2D);
}
else if(player.motionY < 0)
{
player.motionY = Math.min(player.motionY + 0.15D, 0);
}
}
player.fallDistance = 0.0F;
if(player instanceof EntityPlayerMP)
{
((EntityPlayerMP)player).playerNetServerHandler.ticksForFloatKick = 0;
else {
if(Mekanism.keyMap.has(player, KeySync.ASCEND))
{
player.motionY = Math.min(player.motionY + 0.15D, 0.2D);
}
else if(Mekanism.keyMap.has(player, KeySync.DESCEND))
{
player.motionY = Math.max(player.motionY - 0.15D, -0.2D);
}
}
jetpack.useGas(player.getCurrentItemOrArmor(3));
}
if(isGasMaskOn(player))
player.fallDistance = 0.0F;
if(player instanceof EntityPlayerMP)
{
ItemScubaTank tank = (ItemScubaTank)player.getCurrentItemOrArmor(3).getItem();
tank.useGas(player.getCurrentItemOrArmor(3));
player.setAir(300);
player.clearActivePotions();
((EntityPlayerMP)player).playerNetServerHandler.ticksForFloatKick = 0;
}
jetpack.useGas(player.getEquipmentInSlot(3));
}
if(isGasMaskOn(player))
{
ItemScubaTank tank = (ItemScubaTank)player.getEquipmentInSlot(3).getItem();
tank.useGas(player.getEquipmentInSlot(3));
player.setAir(300);
player.clearActivePotions();
}
}
@ -201,16 +202,4 @@ public class CommonPlayerTickHandler implements ITickHandler
return false;
}
@Override
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.PLAYER);
}
@Override
public String getLabel()
{
return "MekanismCommonPlayer";
}
}

View file

@ -51,7 +51,7 @@ public class PacketHandler //implements IPacketHandler
}
try {
packetType.read(dataStream, entityplayer, entityplayer.getWorldObj());
packetType.read(dataStream, entityplayer, entityplayer.worldObj);
} catch(Exception e) {
System.err.println("[Mekanism] Error while reading '" + packetType.getName() + "' packet.");
e.printStackTrace();

View file

@ -56,7 +56,7 @@ public class RobitAIFollow extends EntityAIBase
{
return false;
}
else if(theRobit.getWorldObj().provider.dimensionId != player.getWorldObj().provider.dimensionId)
else if(theRobit.getWorldObj().provider.dimensionId != player.worldObj.provider.dimensionId)
{
return false;
}

View file

@ -712,7 +712,7 @@ public class BlockBasic extends Block
}
}
world.markBlockForRenderUpdate(x, y, z);
world.func_147479_m(x, y, z);
world.updateAllLightTypes(x, y, z);
if(!world.isRemote && world.getTileEntity(x, y, z) != null)

View file

@ -250,9 +250,9 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
{
EntityLivingBase base = event.entityLiving;
if(base.getCurrentItemOrArmor(1) != null && base.getCurrentItemOrArmor(1).getItem() instanceof ItemFreeRunners)
if(base.getEquipmentInSlot(1) != null && base.getEquipmentInSlot(1).getItem() instanceof ItemFreeRunners)
{
ItemStack stack = base.getCurrentItemOrArmor(1);
ItemStack stack = base.getEquipmentInSlot(1);
ItemFreeRunners boots = (ItemFreeRunners)stack.getItem();
if(boots.getEnergy(stack) > 0 && event.source == DamageSource.fall)

View file

@ -56,15 +56,15 @@ public class ItemGasMask extends ItemArmor
{
EntityLivingBase base = event.entityLiving;
if(base.getCurrentItemOrArmor(4) != null && base.getCurrentItemOrArmor(4).getItem() instanceof ItemGasMask)
if(base.getEquipmentInSlot(4) != null && base.getEquipmentInSlot(4).getItem() instanceof ItemGasMask)
{
ItemGasMask mask = (ItemGasMask)base.getCurrentItemOrArmor(4).getItem();
ItemGasMask mask = (ItemGasMask)base.getEquipmentInSlot(4).getItem();
if(base.getCurrentItemOrArmor(3) != null && base.getCurrentItemOrArmor(3).getItem() instanceof ItemScubaTank)
if(base.getEquipmentInSlot(3) != null && base.getEquipmentInSlot(3).getItem() instanceof ItemScubaTank)
{
ItemScubaTank tank = (ItemScubaTank)base.getCurrentItemOrArmor(3).getItem();
ItemScubaTank tank = (ItemScubaTank)base.getEquipmentInSlot(3).getItem();
if(tank.getFlowing(base.getCurrentItemOrArmor(3)) && tank.getGas(base.getCurrentItemOrArmor(3)) != null)
if(tank.getFlowing(base.getEquipmentInSlot(3)) && tank.getGas(base.getEquipmentInSlot(3)) != null)
{
if(event.source == DamageSource.magic)
{

View file

@ -65,7 +65,7 @@ public class PacketJetpackData extends MekanismPacket
}
else if(packetType == JetpackPacket.MODE)
{
ItemStack stack = player.getCurrentItemOrArmor(3);
ItemStack stack = player.getEquipmentInSlot(3);
if(stack != null && stack.getItem() instanceof ItemJetpack)
{

View file

@ -65,7 +65,7 @@ public class PacketScubaTankData extends MekanismPacket
}
else if(packetType == ScubaTankPacket.MODE)
{
ItemStack stack = player.getCurrentItemOrArmor(3);
ItemStack stack = player.getEquipmentInSlot(3);
if(stack != null && stack.getItem() instanceof ItemScubaTank)
{

View file

@ -10,14 +10,15 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
public class BinRecipe implements IRecipe, ICraftingHandler
public class BinRecipe implements IRecipe//, ICraftingHandler
{
public BinRecipe()
{
GameRegistry.registerCraftingHandler(this);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
@ -113,18 +114,18 @@ public class BinRecipe implements IRecipe, ICraftingHandler
return null;
}
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
@SubscribeEvent
public void onCrafting(ItemCraftedEvent event) //EntityPlayer player, ItemStack item, IInventory craftMatrix)
{
if(getResult(craftMatrix) != null)
if(getResult(event.craftMatrix) != null)
{
if(!isBin(item))
if(!isBin(event.crafting))
{
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
for(int i = 0; i < event.craftMatrix.getSizeInventory(); i++)
{
if(isBin(craftMatrix.getStackInSlot(i)))
if(isBin(event.craftMatrix.getStackInSlot(i)))
{
ItemStack bin = craftMatrix.getStackInSlot(i);
ItemStack bin = event.craftMatrix.getStackInSlot(i);
InventoryBin inv = new InventoryBin(bin.copy());
int size = inv.getItemCount();
@ -139,20 +140,20 @@ public class BinRecipe implements IRecipe, ICraftingHandler
int bin = -1;
int other = -1;
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
for(int i = 0; i < event.craftMatrix.getSizeInventory(); i++)
{
if(isBin(craftMatrix.getStackInSlot(i)))
if(isBin(event.craftMatrix.getStackInSlot(i)))
{
bin = i;
}
else if(!isBin(craftMatrix.getStackInSlot(i)) && craftMatrix.getStackInSlot(i) != null)
else if(!isBin(event.craftMatrix.getStackInSlot(i)) && event.craftMatrix.getStackInSlot(i) != null)
{
other = i;
}
}
ItemStack binStack = craftMatrix.getStackInSlot(bin);
ItemStack otherStack = craftMatrix.getStackInSlot(other);
ItemStack binStack = event.craftMatrix.getStackInSlot(bin);
ItemStack otherStack = event.craftMatrix.getStackInSlot(other);
ItemStack testRemain = new InventoryBin(binStack.copy()).add(otherStack.copy());
@ -160,17 +161,14 @@ public class BinRecipe implements IRecipe, ICraftingHandler
{
ItemStack proxy = new ItemStack(Mekanism.ItemProxy);
((ItemProxy)proxy.getItem()).setSavedItem(proxy, testRemain.copy());
craftMatrix.setInventorySlotContents(other, proxy);
event.craftMatrix.setInventorySlotContents(other, proxy);
}
else {
craftMatrix.setInventorySlotContents(other, null);
event.craftMatrix.setInventorySlotContents(other, null);
}
craftMatrix.setInventorySlotContents(bin, null);
event.craftMatrix.setInventorySlotContents(bin, null);
}
}
}
@Override
public void onSmelting(EntityPlayer player, ItemStack item) {}
}

View file

@ -688,7 +688,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
if(structured != prev)
{
waterTank.setCapacity(getMaxWater());
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);

View file

@ -298,7 +298,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe
WorldServer oldWorld = server.worldServerForDimension(player.dimension);
player.dimension = coord.dimensionId;
WorldServer newWorld = server.worldServerForDimension(player.dimension);
player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.getWorldObj().difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
oldWorld.removePlayerEntityDangerously(player);
player.isDead = false;

View file

@ -53,7 +53,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.network.packet.Packet3Chat;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MovingObjectPosition;
@ -70,7 +69,6 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.server.FMLServerHandler;
/**
@ -219,7 +217,7 @@ public final class MekanismUtils
/**
* Sends a Packet3Chat packet to the defined player, with the defined message.
* @param player - Player to send packet to.
* @param playerUsername - Player to send packet to.
* @param msg - message sent to player.
*/
public static void sendChatMessageToPlayer(String playerUsername, String msg)
@ -243,7 +241,7 @@ public final class MekanismUtils
return Mekanism.teleporters.get(teleCode).get(0);
}
else {
int dimensionId = player.getWorldObj().provider.dimensionId;
int dimensionId = player.worldObj.provider.dimensionId;
Coord4D coords0 = Mekanism.teleporters.get(teleCode).get(0);
Coord4D coords1 = Mekanism.teleporters.get(teleCode).get(1);
@ -343,7 +341,7 @@ public final class MekanismUtils
*/
public static void doFakeEntityExplosion(EntityPlayer entityplayer)
{
World world = entityplayer.getWorldObj();
World world = entityplayer.worldObj;
world.spawnParticle("hugeexplosion", entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D);
world.playSoundAtEntity(entityplayer, "random.explode", 1.0F, 1.0F);
}
@ -701,7 +699,7 @@ public final class MekanismUtils
{
if(!(world.getTileEntity(x, y, z) instanceof IActiveState) || ((IActiveState)world.getTileEntity(x, y, z)).renderUpdate())
{
world.markBlockForRenderUpdate(x, y, z);
world.func_147479_m(x, y, z);
}
if(!(world.getTileEntity(x, y, z) instanceof IActiveState) || ((IActiveState)world.getTileEntity(x, y, z)).lightUpdate() && Mekanism.machineEffects)
@ -1123,7 +1121,7 @@ public final class MekanismUtils
{
Vec3 vec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
if(!player.getWorldObj().isRemote)
if(!player.worldObj.isRemote)
{
vec.yCoord += player.getEyeHeight();