Work on jetpacks
This commit is contained in:
parent
73c41f7863
commit
a204df448f
12 changed files with 329 additions and 87 deletions
|
@ -9,11 +9,14 @@ import mekanism.common.PacketHandler.Transmission;
|
|||
import mekanism.common.item.ItemConfigurator;
|
||||
import mekanism.common.item.ItemElectricBow;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
import mekanism.common.item.ItemJetpack.JetpackMode;
|
||||
import mekanism.common.item.ItemWalkieTalkie;
|
||||
import mekanism.common.network.PacketConfiguratorState;
|
||||
import mekanism.common.network.PacketElectricBowState;
|
||||
import mekanism.common.network.PacketJetpackData;
|
||||
import mekanism.common.network.PacketJetpackData.PacketType;
|
||||
import mekanism.common.network.PacketWalkieTalkieState;
|
||||
import mekanism.common.util.StackUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -42,11 +45,9 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
{
|
||||
EntityPlayer entityPlayer = (EntityPlayer)tickData[0];
|
||||
|
||||
if(entityPlayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
ItemStack stack = entityPlayer.getCurrentEquippedItem();
|
||||
|
||||
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemConfigurator)
|
||||
if(StackUtils.getItem(entityPlayer.getCurrentEquippedItem()) instanceof ItemConfigurator)
|
||||
{
|
||||
ItemConfigurator item = (ItemConfigurator)entityPlayer.getCurrentEquippedItem().getItem();
|
||||
|
||||
|
@ -64,7 +65,7 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
lastTickUpdate = false;
|
||||
}
|
||||
}
|
||||
else if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemElectricBow)
|
||||
else if(StackUtils.getItem(entityPlayer.getCurrentEquippedItem()) instanceof ItemElectricBow)
|
||||
{
|
||||
ItemElectricBow item = (ItemElectricBow)entityPlayer.getCurrentEquippedItem().getItem();
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
lastTickUpdate = false;
|
||||
}
|
||||
}
|
||||
else if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWalkieTalkie)
|
||||
else if(StackUtils.getItem(entityPlayer.getCurrentEquippedItem()) instanceof ItemWalkieTalkie)
|
||||
{
|
||||
ItemWalkieTalkie item = (ItemWalkieTalkie)entityPlayer.getCurrentEquippedItem().getItem();
|
||||
|
||||
|
@ -101,10 +102,27 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
lastTickUpdate = false;
|
||||
}
|
||||
}
|
||||
else if(entityPlayer.getCurrentItemOrArmor(3) != null && entityPlayer.getCurrentItemOrArmor(3).getItem() instanceof ItemJetpack)
|
||||
{
|
||||
ItemStack jetpack = entityPlayer.getCurrentItemOrArmor(3);
|
||||
|
||||
if(MekanismKeyHandler.modeSwitchKey.pressed)
|
||||
{
|
||||
if(!lastTickUpdate)
|
||||
{
|
||||
((ItemJetpack)jetpack.getItem()).incrementMode(jetpack);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketJetpackData().setParams(PacketType.MODE));
|
||||
Minecraft.getMinecraft().sndManager.playSoundFX("mekanism:etc.Hydraulic", 1.0F, 1.0F);
|
||||
lastTickUpdate = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastTickUpdate = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastTickUpdate = false;
|
||||
}
|
||||
|
||||
if(Mekanism.jetpackOn.contains(entityPlayer) != isJetpackOn(entityPlayer))
|
||||
{
|
||||
|
@ -116,7 +134,7 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
Mekanism.jetpackOn.remove(entityPlayer);
|
||||
}
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketJetpackData().setParams(entityPlayer, isJetpackOn(entityPlayer)));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketJetpackData().setParams(PacketType.UPDATE, entityPlayer, isJetpackOn(entityPlayer)));
|
||||
}
|
||||
|
||||
for(EntityPlayer entry : Mekanism.jetpackOn)
|
||||
|
@ -124,10 +142,20 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
Mekanism.proxy.registerSound(entry);
|
||||
}
|
||||
|
||||
if(isJetpackOn(mc.thePlayer))
|
||||
if(isJetpackOn(entityPlayer))
|
||||
{
|
||||
mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0.5D);
|
||||
mc.thePlayer.fallDistance = 0.0F;
|
||||
ItemJetpack jetpack = (ItemJetpack)entityPlayer.getCurrentItemOrArmor(3).getItem();
|
||||
|
||||
if(jetpack.getMode(entityPlayer.getCurrentItemOrArmor(3)) == JetpackMode.NORMAL)
|
||||
{
|
||||
entityPlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0.5D);
|
||||
entityPlayer.fallDistance = 0.0F;
|
||||
}
|
||||
else if(jetpack.getMode(entityPlayer.getCurrentItemOrArmor(3)) == JetpackMode.HOVER)
|
||||
{
|
||||
entityPlayer.motionY = 0;
|
||||
entityPlayer.fallDistance = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,9 +173,15 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
{
|
||||
if(stack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
if(((ItemJetpack)stack.getItem()).getGas(stack) != null)
|
||||
ItemJetpack jetpack = (ItemJetpack)stack.getItem();
|
||||
|
||||
if(jetpack.getGas(stack) != null)
|
||||
{
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_SPACE))
|
||||
if((Keyboard.isKeyDown(Keyboard.KEY_SPACE) && jetpack.getMode(stack) == JetpackMode.NORMAL))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(jetpack.getMode(stack) == JetpackMode.HOVER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -275,6 +275,7 @@ public class ClientProxy extends CommonProxy
|
|||
MinecraftForgeClient.registerItemRenderer(Mekanism.gasTankID, handler);
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.obsidianTNTID, handler);
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.basicBlockID, handler);
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.Jetpack.itemID, handler);
|
||||
|
||||
//Register block handlers
|
||||
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraftforge.fluids.Fluid;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -203,8 +202,8 @@ public class MekanismRenderer
|
|||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
float glowRatioX = Math.min(((float)glow/15F)*240F + lightmapLastX, 240);
|
||||
float glowRatioY = Math.min(((float)glow/15F)*240F + lightmapLastY, 240);
|
||||
float glowRatioX = Math.min((glow/15F)*240F + lightmapLastX, 240);
|
||||
float glowRatioY = Math.min((glow/15F)*240F + lightmapLastY, 240);
|
||||
|
||||
if(!optifineBreak)
|
||||
{
|
||||
|
@ -302,9 +301,9 @@ public class MekanismRenderer
|
|||
if(renderer.useInventoryTint)
|
||||
{
|
||||
int renderColor = block.getRenderColor(metadata);
|
||||
float red = (float)(renderColor >> 16 & 255) / 255.0F;
|
||||
float green = (float)(renderColor >> 8 & 255) / 255.0F;
|
||||
float blue = (float)(renderColor & 255) / 255.0F;
|
||||
float red = (renderColor >> 16 & 255) / 255.0F;
|
||||
float green = (renderColor >> 8 & 255) / 255.0F;
|
||||
float blue = (renderColor & 255) / 255.0F;
|
||||
GL11.glColor4f(red, green, blue, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -449,6 +448,20 @@ public class MekanismRenderer
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
int zLevel = 0;
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((par1 + 0), (par2 + par6), zLevel, ((par3 + 0) * f), ((par4 + par6) * f1));
|
||||
tessellator.addVertexWithUV((par1 + par5), (par2 + par6), zLevel, ((par3 + par5) * f), ((par4 + par6) * f1));
|
||||
tessellator.addVertexWithUV((par1 + par5), (par2 + 0), zLevel, ((par3 + par5) * f), ((par4 + 0) * f1));
|
||||
tessellator.addVertexWithUV((par1 + 0), (par2 + 0), zLevel, ((par3 + 0) * f), ((par4 + 0) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static ResourceLocation getBlocksTexture()
|
||||
{
|
||||
return TextureMap.locationBlocksTexture;
|
||||
|
|
|
@ -5,9 +5,12 @@ import java.util.Random;
|
|||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -68,6 +71,22 @@ public class RenderTickHandler implements ITickHandler
|
|||
}
|
||||
}
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
if(player.getCurrentItemOrArmor(3) != null && player.getCurrentItemOrArmor(3).getItem() instanceof ItemJetpack)
|
||||
{
|
||||
ItemStack stack = player.getCurrentItemOrArmor(3);
|
||||
ItemJetpack jetpack = (ItemJetpack)stack.getItem();
|
||||
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
int x = scaledresolution.getScaledWidth();
|
||||
int y = scaledresolution.getScaledHeight();
|
||||
|
||||
font.drawStringWithShadow("Mode: " + jetpack.getMode(stack).getName(), 1, y - 20, 0x404040);
|
||||
font.drawStringWithShadow("Hydrogen: " + jetpack.getStored(stack), 1, y - 11, 0x404040);
|
||||
}
|
||||
}
|
||||
|
||||
for(EntityPlayer p : Mekanism.jetpackOn)
|
||||
{
|
||||
if(p.getDistance(player.posX, player.posY, player.posZ) > 40)
|
||||
|
|
|
@ -7,6 +7,7 @@ import mekanism.client.MekanismClient;
|
|||
import mekanism.client.model.ModelEnergyCube;
|
||||
import mekanism.client.model.ModelEnergyCube.ModelEnergyCore;
|
||||
import mekanism.client.model.ModelGasTank;
|
||||
import mekanism.client.model.ModelJetpack;
|
||||
import mekanism.client.model.ModelObsidianTNT;
|
||||
import mekanism.client.model.ModelRobit;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
|
@ -19,6 +20,7 @@ import mekanism.common.block.BlockMachine.MachineType;
|
|||
import mekanism.common.inventory.InventoryBin;
|
||||
import mekanism.common.item.ItemBlockBasic;
|
||||
import mekanism.common.item.ItemBlockMachine;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
import mekanism.common.item.ItemRobit;
|
||||
import mekanism.common.item.ItemWalkieTalkie;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
|
@ -55,6 +57,7 @@ public class ItemRenderingHandler implements IItemRenderer
|
|||
public ModelEnergyCore energyCore = new ModelEnergyCore();
|
||||
public ModelGasTank gasTank = new ModelGasTank();
|
||||
public ModelObsidianTNT obsidianTNT = new ModelObsidianTNT();
|
||||
public ModelJetpack jetpack = new ModelJetpack();
|
||||
|
||||
public RenderBin binRenderer = (RenderBin)TileEntityRenderer.instance.specialRendererMap.get(TileEntityBin.class);
|
||||
private final RenderItem renderItem = (RenderItem)RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
|
@ -303,6 +306,14 @@ public class ItemRenderingHandler implements IItemRenderer
|
|||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Robit.png"));
|
||||
robit.render(0.08F);
|
||||
}
|
||||
else if(item.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
GL11.glRotatef(180, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.2F, -0.35F, 0.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Jetpack.png"));
|
||||
jetpack.render(0.0625F);
|
||||
}
|
||||
else {
|
||||
if(item.getItem() instanceof ItemBlockMachine)
|
||||
{
|
||||
|
|
|
@ -2,8 +2,12 @@ package mekanism.common;
|
|||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
import mekanism.common.item.ItemPortableTeleporter;
|
||||
import mekanism.common.item.ItemJetpack.JetpackMode;
|
||||
import mekanism.common.network.PacketStatusUpdate;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -22,6 +26,7 @@ public class CommonPlayerTickHandler implements ITickHandler
|
|||
if(tickData[0] instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer)tickData[0];
|
||||
|
||||
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemPortableTeleporter)
|
||||
{
|
||||
ItemPortableTeleporter item = (ItemPortableTeleporter)player.getCurrentEquippedItem().getItem();
|
||||
|
@ -79,7 +84,44 @@ public class CommonPlayerTickHandler implements ITickHandler
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(isJetpackOn(player))
|
||||
{
|
||||
ItemJetpack jetpack = (ItemJetpack)player.getCurrentItemOrArmor(3).getItem();
|
||||
|
||||
if(jetpack.getMode(player.getCurrentItemOrArmor(3)) == JetpackMode.NORMAL)
|
||||
{
|
||||
player.motionY = Math.min(player.motionY + 0.15D, 0.5D);
|
||||
player.fallDistance = 0.0F;
|
||||
}
|
||||
else if(jetpack.getMode(player.getCurrentItemOrArmor(3)) == JetpackMode.HOVER)
|
||||
{
|
||||
player.motionY = 0;
|
||||
player.fallDistance = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isJetpackOn(EntityPlayer player)
|
||||
{
|
||||
ItemStack stack = player.inventory.armorInventory[2];
|
||||
|
||||
if(stack != null)
|
||||
{
|
||||
if(stack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
if(((ItemJetpack)stack.getItem()).getGas(stack) != null)
|
||||
{
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_SPACE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.client.render.ModelCustomArmor;
|
||||
import mekanism.client.render.ModelCustomArmor.ArmorModel;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -24,7 +30,23 @@ public class ItemJetpack extends ItemArmor implements IGasItem
|
|||
public ItemJetpack(int id)
|
||||
{
|
||||
super(id, EnumHelper.addArmorMaterial("JETPACK", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
|
||||
//setCreativeTab(Mekanism.tabMekanism);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
GasStack gasStack = getGas(itemstack);
|
||||
|
||||
if(gasStack == null)
|
||||
{
|
||||
list.add("No gas stored.");
|
||||
}
|
||||
else {
|
||||
list.add("Stored " + gasStack.getGas().getLocalizedName() + ": " + gasStack.amount);
|
||||
}
|
||||
|
||||
list.add(EnumColor.GREY + "Mode: " + EnumColor.GREY + getMode(itemstack).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,6 +70,11 @@ public class ItemJetpack extends ItemArmor implements IGasItem
|
|||
return model;
|
||||
}
|
||||
|
||||
public void incrementMode(ItemStack stack)
|
||||
{
|
||||
setMode(stack, getMode(stack).increment());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxGas(Object... data)
|
||||
{
|
||||
|
@ -100,7 +127,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem
|
|||
return new GasStack(type, gasToUse);
|
||||
}
|
||||
|
||||
private int getStored(ItemStack itemstack)
|
||||
public int getStored(ItemStack itemstack)
|
||||
{
|
||||
return getGas(itemstack) != null ? getGas(itemstack).amount : 0;
|
||||
}
|
||||
|
@ -145,6 +172,26 @@ public class ItemJetpack extends ItemArmor implements IGasItem
|
|||
return null;
|
||||
}
|
||||
|
||||
public JetpackMode getMode(ItemStack stack)
|
||||
{
|
||||
if(stack.stackTagCompound == null)
|
||||
{
|
||||
return JetpackMode.NORMAL;
|
||||
}
|
||||
|
||||
return JetpackMode.values()[stack.stackTagCompound.getInteger("mode")];
|
||||
}
|
||||
|
||||
public void setMode(ItemStack stack, JetpackMode mode)
|
||||
{
|
||||
if(stack.stackTagCompound == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
stack.stackTagCompound.setInteger("mode", mode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGas(GasStack stack, Object... data)
|
||||
{
|
||||
|
@ -171,4 +218,30 @@ public class ItemJetpack extends ItemArmor implements IGasItem
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum JetpackMode
|
||||
{
|
||||
NORMAL("tooltip.jetpack.regular", EnumColor.DARK_GREEN),
|
||||
HOVER("tooltip.jetpack.hover", EnumColor.DARK_AQUA),
|
||||
DISABLED("tooltip.jetpack.disabled", EnumColor.DARK_RED);
|
||||
|
||||
private String unlocalized;
|
||||
private EnumColor color;
|
||||
|
||||
private JetpackMode(String s, EnumColor c)
|
||||
{
|
||||
unlocalized = s;
|
||||
color = c;
|
||||
}
|
||||
|
||||
public JetpackMode increment()
|
||||
{
|
||||
return ordinal() < values().length-1 ? values()[ordinal()+1] : values()[0];
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return color + MekanismUtils.localize(unlocalized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,17 @@ import java.io.DataOutputStream;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.item.ItemJetpack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class PacketJetpackData implements IMekanismPacket
|
||||
{
|
||||
public PacketType packetType;
|
||||
|
||||
public EntityPlayer updatePlayer;
|
||||
public boolean value;
|
||||
|
||||
|
@ -24,14 +28,23 @@ public class PacketJetpackData implements IMekanismPacket
|
|||
@Override
|
||||
public IMekanismPacket setParams(Object... data)
|
||||
{
|
||||
updatePlayer = (EntityPlayer)data[0];
|
||||
value = (Boolean)data[1];
|
||||
packetType = (PacketType)data[0];
|
||||
|
||||
if(packetType == PacketType.UPDATE)
|
||||
{
|
||||
updatePlayer = (EntityPlayer)data[1];
|
||||
value = (Boolean)data[2];
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception
|
||||
{
|
||||
packetType = PacketType.values()[dataStream.readInt()];
|
||||
|
||||
if(packetType == PacketType.UPDATE)
|
||||
{
|
||||
String username = dataStream.readUTF();
|
||||
boolean value = dataStream.readBoolean();
|
||||
|
@ -50,15 +63,36 @@ public class PacketJetpackData implements IMekanismPacket
|
|||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketJetpackData().setParams(p, value), world.provider.dimensionId);
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_DIM, new PacketJetpackData().setParams(PacketType.UPDATE, p, value), world.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(packetType == PacketType.MODE)
|
||||
{
|
||||
ItemStack stack = player.getCurrentItemOrArmor(3);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemJetpack)
|
||||
{
|
||||
((ItemJetpack)stack.getItem()).incrementMode(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dataStream) throws Exception
|
||||
{
|
||||
dataStream.writeInt(packetType.ordinal());
|
||||
|
||||
if(packetType == PacketType.UPDATE)
|
||||
{
|
||||
dataStream.writeUTF(updatePlayer.username);
|
||||
dataStream.writeBoolean(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum PacketType
|
||||
{
|
||||
UPDATE,
|
||||
MODE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common.util;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
|
@ -32,6 +33,16 @@ public final class StackUtils
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static Item getItem(ItemStack stack)
|
||||
{
|
||||
if(stack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return stack.getItem();
|
||||
}
|
||||
|
||||
public static boolean diffIgnoreNull(ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
if(stack1 == null || stack2 == null)
|
||||
|
|
|
@ -315,17 +315,17 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
if(type == 0)
|
||||
{
|
||||
outputType = GasRegistry.getGas(dataStream.readInt());
|
||||
return;
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
dumpType = GasRegistry.getGas(dataStream.readInt());
|
||||
return;
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
spawnParticle();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
|
|
@ -243,6 +243,10 @@ tooltip.configurator.noLink=No link
|
|||
tooltip.configurator.linkMsg=Bound to
|
||||
tooltip.configurator.dim=dimension
|
||||
|
||||
tooltip.jetpack.regular=Regular
|
||||
tooltip.jetpack.hover=Hover
|
||||
tooltip.jetpack.disabled=Disabled
|
||||
|
||||
//Redstone control
|
||||
control.disabled=Disabled
|
||||
control.high=High
|
||||
|
|
BIN
resources/assets/mekanism/sound/etc/Hydraulic.ogg
Normal file
BIN
resources/assets/mekanism/sound/etc/Hydraulic.ogg
Normal file
Binary file not shown.
Loading…
Reference in a new issue