1.2.0-UnOffBeta

This commit is contained in:
TheSilentium committed 2015-09-05 23:03:28 +03:00
1 parent be2e78d2e0
commit 3e46e3df5c
41 files changed
+193 -54

No files matched your search

@@ -22,21 +22,26 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tombenpotter.emt.common.commands.CommandOutputs;
import tombenpotter.emt.common.Registry;
import tombenpotter.emt.common.entities.BaseEntityRegistry;
import tombenpotter.emt.common.network.PacketEMTKeys;
import tombenpotter.emt.common.util.*;
import tombenpotter.emt.proxies.CommonProxy;
import static tombenpotter.emt.common.util.TextHelper.localize;
@Mod(modid = ModInformation.modid, name = ModInformation.name, version = ModInformation.version, guiFactory = ModInformation.guiFactory, dependencies = ModInformation.depend)
public class ElectroMagicTools {
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("EMT");
@SidedProxy(clientSide = ModInformation.clientProxy, serverSide = ModInformation.commonProxy)
public static CommonProxy proxy;
@@ -56,6 +61,7 @@ public class ElectroMagicTools {
Registry.register();
EssentiasOutputs.addPrimalOutputs();
EssentiasOutputs.addOutputs();
registerPackets();
ElectroMagicTools.logger.info(localize("console.EMT.preInit.end"));
}
@@ -93,4 +99,8 @@ public class ElectroMagicTools {
public void onFMLServerStart(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandOutputs());
}
public void registerPackets(){
INSTANCE.registerMessage(PacketEMTKeys.class, PacketEMTKeys.class, 0, Side.SERVER);
}
}
@@ -0,0 +1,39 @@
package tombenpotter.emt.client;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.registry.ClientRegistry;
import net.minecraft.client.settings.KeyBinding;
public class EMTKeys{
private static Map<String, KeyBinding> keys = new HashMap<String, KeyBinding>();
public static void addKey(KeyBinding kb, String name){
keys.put(name, kb);
}
public static void registerKeys(){
addKey(new KeyBinding("UnEquip", Keyboard.KEY_Z, "EMT"), "UnEquip");
for(Entry<String, KeyBinding> entry : keys.entrySet()){
ClientRegistry.registerKeyBinding(entry.getValue());
}
}
public static KeyBinding getKey(String name){
for(Entry<String, KeyBinding> entry : keys.entrySet()){
if(name.equals(entry.getKey())){
return entry.getValue();
}
}
return null;
}
}
@@ -19,6 +19,7 @@ import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.api.research.ResearchPage;
import tombenpotter.emt.client.EMTKeys;
import tombenpotter.emt.common.RecipeRegistry;
import tombenpotter.emt.common.blocks.BlockRegistry;
import tombenpotter.emt.common.items.ItemRegistry;
@@ -105,19 +105,19 @@ public class BlockEMTSolars extends BlockBaseContainer {
this.side[0] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[1] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[2] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[3] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[4] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[5] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[6] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[7] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[8] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[9] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[10] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[11] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[12] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[13] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[14] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[15] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[3] = ri.registerIcon(ModInformation.texturePath + ":solars/water/waterside");
this.side[4] = ri.registerIcon(ModInformation.texturePath + ":solars/water/waterside");
this.side[5] = ri.registerIcon(ModInformation.texturePath + ":solars/water/waterside");
this.side[6] = ri.registerIcon(ModInformation.texturePath + ":solars/dark/darkside");
this.side[7] = ri.registerIcon(ModInformation.texturePath + ":solars/dark/darkside");
this.side[8] = ri.registerIcon(ModInformation.texturePath + ":solars/dark/darkside");
this.side[9] = ri.registerIcon(ModInformation.texturePath + ":solars/order/orderside");
this.side[10] = ri.registerIcon(ModInformation.texturePath + ":solars/order/orderside");
this.side[11] = ri.registerIcon(ModInformation.texturePath + ":solars/order/orderside");
this.side[12] = ri.registerIcon(ModInformation.texturePath + ":solars/fire/fireside");
this.side[13] = ri.registerIcon(ModInformation.texturePath + ":solars/fire/fireside");
this.side[14] = ri.registerIcon(ModInformation.texturePath + ":solars/fire/fireside");
this.side[15] = ri.registerIcon(ModInformation.texturePath + ":solars/air/airside");
}
@SideOnly(Side.CLIENT)
@@ -58,11 +58,11 @@ public class BlockEMTSolars2 extends BlockBaseContainer {
this.frontOff[3] = ri.registerIcon(ModInformation.texturePath + ":solars/earth/earthside");
this.frontOff[4] = ri.registerIcon(ModInformation.texturePath + ":solars/earth/earthside");
this.side[0] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[1] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[2] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[3] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[4] = ri.registerIcon(ModInformation.texturePath + ":solars/side");
this.side[0] = ri.registerIcon(ModInformation.texturePath + ":solars/air/airside");
this.side[1] = ri.registerIcon(ModInformation.texturePath + ":solars/air/airside");
this.side[2] = ri.registerIcon(ModInformation.texturePath + ":solars/earth/earthside");
this.side[3] = ri.registerIcon(ModInformation.texturePath + ":solars/earth/earthside");
this.side[4] = ri.registerIcon(ModInformation.texturePath + ":solars/earth/earthside");
}
@SideOnly(Side.CLIENT)
@@ -163,11 +163,17 @@ public class EntityLaser extends Entity implements IProjectile {
if (this.inGround) {
Block j = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3, true);
this.worldObj.createExplosion(this, (int)this.posX, (int)this.posY, (int)this.posZ, 3, true);
this.setDead();
//for(int x = 0; x < 6; x++){
// for(int z = 0; z < 6; z++){
// this.worldObj.setBlockToAir((int)this.posX + x, (int)this.posY, (int)this.posZ + z);
// }
//}
//this.setDead();
if (j == this.inTile && k == this.inData) {
++this.ticksInGround;
if (this.ticksInGround == 1200) {
this.setDead();
}
@@ -184,7 +190,7 @@ public class EntityLaser extends Entity implements IProjectile {
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec31 = Vec3.createVectorHelper(this.posX - 5, this.posY, this.posZ);
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
@@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import tombenpotter.emt.ElectroMagicTools;
import tombenpotter.emt.ModInformation;
@@ -67,10 +68,9 @@ public class ItemEMTQuantum extends ItemArmorElectric {
IIcon icon2;
IIcon icon3;
IIcon icon4;
public int f = 0;
boolean isHolding = false;
Random rnd;
protected static final Map<Integer, Integer> potionRemovalCost = new HashMap();
private float jumpCharge;
public static AudioSource audioSource;
private static boolean lastJetpackUsed = false;
@@ -84,6 +84,7 @@ public class ItemEMTQuantum extends ItemArmorElectric {
potionRemovalCost.put(Integer.valueOf(Potion.poison.id), Integer.valueOf(10000));
potionRemovalCost.put(Integer.valueOf(IC2Potion.radiation.id), Integer.valueOf(10000));
potionRemovalCost.put(Integer.valueOf(Potion.wither.id), Integer.valueOf(25000));
rnd = new Random();
}
@@ -218,7 +219,7 @@ public class ItemEMTQuantum extends ItemArmorElectric {
}
}
if(player.inventory.getCurrentItem() == null && IC2.keyboard.isBoostKeyDown(player) && IC2.keyboard.isSneakKeyDown(player) && toggleTimer == 0 && IC2.platform.isSimulating()){
if(player.inventory.getCurrentItem() == null && nbtData.getBoolean("unequip") && player.isSneaking() && toggleTimer == 0 && IC2.platform.isSimulating()){
toggleTimer = 30;
if(player.inventory.armorInventory[2] == itemStack){
if(player.inventory.getCurrentItem() == null){
@@ -261,6 +262,8 @@ public class ItemEMTQuantum extends ItemArmorElectric {
ElectricItem.manager.charge(charged, 1, 1, true, false);
player.inventory.setInventorySlotContents(player.inventory.currentItem, charged);
}
nbtData.setBoolean("unequip", false);
}
}
}
@@ -343,12 +346,28 @@ public class ItemEMTQuantum extends ItemArmorElectric {
return icon0;
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconFromDamage(int par1)
{
return icon0;
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining){
try{
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
return icon1;
}
if((stack.stackTagCompound.getString("useother")).equals("TW")){
return icon2;
}
if((stack.stackTagCompound.getString("useother")).equals("NW")){
return icon3;
}
if((stack.stackTagCompound.getString("useother")).equals("QW")){
return icon4;
}
}
catch(Exception e){
return icon0;
}
return icon0;
}
@Override
public int getItemEnchantability() {
@@ -394,16 +413,18 @@ public class ItemEMTQuantum extends ItemArmorElectric {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(String.valueOf((int)ElectricItem.manager.getCharge(stack)) + "EU");
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
list.add((stack.stackTagCompound.getInteger("jetpackCharge")) + " EU JETPACK");
}
if((stack.stackTagCompound.getString("useother")).equals("NW")){
list.add((stack.stackTagCompound.getInteger("NWCharge")) + " EU NW");
}
if((stack.stackTagCompound.getString("useother")).equals("QW")){
list.add((stack.stackTagCompound.getInteger("QWCharge")) + " EU QW");
}
try{
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
list.add((stack.stackTagCompound.getInteger("jetpackCharge")) + " EU JETPACK");
}
if((stack.stackTagCompound.getString("useother")).equals("NW")){
list.add((stack.stackTagCompound.getInteger("NWCharge")) + " EU NW");
}
if((stack.stackTagCompound.getString("useother")).equals("QW")){
list.add((stack.stackTagCompound.getInteger("QWCharge")) + " EU QW");
}
}
catch(NullPointerException e){}
}
public boolean useJetpack(EntityPlayer player, boolean hoverMode, ItemStack stack) {
@@ -480,9 +501,14 @@ public class ItemEMTQuantum extends ItemArmorElectric {
else if(nbtData.getBoolean("isHolding")){
nbtData.setBoolean("isHolding", false);
player.motionY = motionY * nbtData.getInteger("f");
player.motionX /= motionXZ;
player.motionZ /= motionXZ;
world.playSoundEffect(player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, "mob.ghast.fireball", 1.0F, 0.7F + 0.3F);
if(player.motionX < 0.7 && player.motionZ < 0.7){
player.motionX /= motionXZ;
player.motionZ /= motionXZ;
}
world.playSoundEffect(player.posX, player.posY, player.posZ, "mob.ghast.fireball", 1, 1);
for(int i = 0; i < 4; i++){
world.spawnParticle("cloud", player.posX - 1 + (rnd.nextInt(100) / 50d), player.posY - 1, player.posZ - 1 + (rnd.nextInt(100) / 50d), 0, -0.5, 0);
}
nbtData.setInteger("f", 0);
}
@@ -1,5 +1,7 @@
package tombenpotter.emt.common.items.armor.wings;
import java.util.Random;
import ic2.core.IC2;
import ic2.core.util.StackUtil;
import cpw.mods.fml.relauncher.Side;
@@ -22,7 +24,7 @@ import tombenpotter.emt.common.util.ConfigHandler;
public class ItemFeatherWing extends ItemArmor {
public int visDiscount = 0;
int f;
Random rnd;
public ItemFeatherWing(ArmorMaterial material, int par3, int par4) {
super(material, par3, par4);
@@ -30,6 +32,7 @@ public class ItemFeatherWing extends ItemArmor {
this.setMaxDamage(120);
this.setCreativeTab(ElectroMagicTools.tabEMT);
this.isDamageable();
rnd = new Random();
}
@SideOnly(Side.CLIENT)
@@ -74,9 +77,14 @@ public class ItemFeatherWing extends ItemArmor {
nbtData.setBoolean("isHolding", false);
player.motionY = motionY * nbtData.getInteger("f");
player.motionX /= motionXZ;
player.motionZ /= motionXZ;
world.playSoundEffect(player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, "mob.ghast.fireball", 1.0F, 0.7F + 0.3F);
if(player.motionX < 0.7 && player.motionZ < 0.7){
player.motionX /= motionXZ;
player.motionZ /= motionXZ;
}
world.playSoundEffect(player.posX, player.posY, player.posZ, "mob.ghast.fireball", 1, 1);
for(int i = 0; i < 4; i++){
world.spawnParticle("cloud", player.posX - 1 + (rnd.nextInt(100) / 50d), player.posY - 1, player.posZ - 1 + (rnd.nextInt(100) / 50d), 0, -0.5, 0);
}
nbtData.setInteger("f", 0);
}
@@ -0,0 +1,31 @@
package tombenpotter.emt.common.network;
import tombenpotter.emt.common.items.ItemRegistry;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
public class PacketEMTKeys implements IMessage, IMessageHandler<PacketEMTKeys, IMessage>{
@Override
public IMessage onMessage(PacketEMTKeys message, MessageContext ctx) {
if(ctx.getServerHandler().playerEntity.inventory.armorInventory[2] != null && ctx.getServerHandler().playerEntity.inventory.armorInventory[2].getItem() == ItemRegistry.quantumArmor){
System.out.println("Odel.");
ctx.getServerHandler().playerEntity.inventory.armorInventory[2].stackTagCompound.setBoolean("unequip", true);
}
System.out.println("Prinyal.");
return null;
}
@Override
public void fromBytes(ByteBuf buf) {
}
@Override
public void toBytes(ByteBuf buf) {
}
}
@@ -15,6 +15,8 @@ package tombenpotter.emt.common.util;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
@@ -23,8 +25,11 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
import thaumcraft.common.entities.monster.EntityTaintChicken;
import tombenpotter.emt.ElectroMagicTools;
import tombenpotter.emt.ModInformation;
import tombenpotter.emt.client.EMTKeys;
import tombenpotter.emt.common.items.ItemRegistry;
import tombenpotter.emt.common.items.ItemShardCarver;
import tombenpotter.emt.common.network.PacketEMTKeys;
import tombenpotter.emt.proxies.ClientProxy;
public class EventHandlerEMT {
@@ -51,8 +56,8 @@ public class EventHandlerEMT {
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
if (eventArgs.modID.equals(ModInformation.modid)) {
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.modID.equals(ModInformation.modid)) {
ConfigHandler.syncConfig();
ElectroMagicTools.logger.info(TextHelper.localize("console.EMT.config.refresh"));
}
@@ -67,4 +72,11 @@ public class EventHandlerEMT {
}
}
}
@SubscribeEvent
public void clientTick(ClientTickEvent e) {
if(EMTKeys.getKey("UnEquip").getIsKeyPressed()){
ElectroMagicTools.INSTANCE.sendToServer(new PacketEMTKeys());
}
}
}
@@ -12,7 +12,12 @@
package tombenpotter.emt.proxies;
import org.lwjgl.input.Keyboard;
import net.minecraft.client.settings.KeyBinding;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import tombenpotter.emt.client.EMTKeys;
import tombenpotter.emt.client.renderer.RenderArcher;
import tombenpotter.emt.client.renderer.RenderLaser;
import tombenpotter.emt.common.entities.EntityArcher;
@@ -23,6 +28,7 @@ public class ClientProxy extends CommonProxy {
@Override
public void load() {
registerRenders();
EMTKeys.registerKeys();
}
public void registerRenders() {