mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
microwave johnson
This commit is contained in:
parent
c6cc0fb735
commit
a4f469fab6
@ -906,7 +906,7 @@ public class ModBlocks {
|
|||||||
public static Block turret_howard;
|
public static Block turret_howard;
|
||||||
public static final int guiID_howard = 112;
|
public static final int guiID_howard = 112;
|
||||||
public static Block turret_maxwell;
|
public static Block turret_maxwell;
|
||||||
public static final int guiID_maxwell = 112;
|
public static final int guiID_maxwell = 120;
|
||||||
|
|
||||||
public static Block rbmk_rod;
|
public static Block rbmk_rod;
|
||||||
public static Block rbmk_control;
|
public static Block rbmk_control;
|
||||||
|
|||||||
@ -29,4 +29,4 @@ public class TurretMaxwell extends TurretBaseNT {
|
|||||||
public void openGUI(World world, EntityPlayer player, int x, int y, int z) {
|
public void openGUI(World world, EntityPlayer player, int x, int y, int z) {
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_maxwell, world, x, y, z);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_maxwell, world, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -834,6 +834,13 @@ public class GUIHandler implements IGuiHandler {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ModBlocks.guiID_maxwell: {
|
||||||
|
if(entity instanceof TileEntityTurretMaxwell) {
|
||||||
|
return new ContainerTurretBase(player.inventory, (TileEntityTurretMaxwell) entity);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// NON-TE CONTAINERS
|
// NON-TE CONTAINERS
|
||||||
|
|
||||||
@ -1655,6 +1662,13 @@ public class GUIHandler implements IGuiHandler {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ModBlocks.guiID_maxwell: {
|
||||||
|
if(entity instanceof TileEntityTurretMaxwell) {
|
||||||
|
return new GUITurretMaxwell(player.inventory, (TileEntityTurretMaxwell) entity);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ITEM GUIS
|
// ITEM GUIS
|
||||||
|
|
||||||
|
|||||||
@ -5,67 +5,73 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
public class HTTPHandler {
|
public class HTTPHandler {
|
||||||
|
|
||||||
public static String capsule = "ERROR ";
|
public static List<String> capsule = new ArrayList();
|
||||||
public static boolean newVersion = false;
|
public static boolean newVersion = false;
|
||||||
public static String versionNumber = "";
|
public static String versionNumber = "";
|
||||||
|
|
||||||
public static void loadStats() {
|
public static void loadStats() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
loadVersion();
|
loadVersion();
|
||||||
loadSoyuz();
|
loadSoyuz();
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch(IOException e) {
|
||||||
MainRegistry.logger.warn("Version checker failed!");
|
MainRegistry.logger.warn("Version checker failed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadVersion() throws IOException {
|
private static void loadVersion() throws IOException {
|
||||||
|
|
||||||
URL github = new URL("https://raw.githubusercontent.com/HbmMods/Hbm-s-Nuclear-Tech-GIT/master/src/main/java/com/hbm/lib/RefStrings.java");
|
URL github = new URL("https://raw.githubusercontent.com/HbmMods/Hbm-s-Nuclear-Tech-GIT/master/src/main/java/com/hbm/lib/RefStrings.java");
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream()));
|
||||||
|
|
||||||
MainRegistry.logger.info("Searching for new versions...");
|
|
||||||
String line;
|
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
|
||||||
|
|
||||||
if(line.contains("String VERSION")) {
|
|
||||||
|
|
||||||
int begin = line.indexOf('"');
|
MainRegistry.logger.info("Searching for new versions...");
|
||||||
int end = line.lastIndexOf('"');
|
String line;
|
||||||
|
|
||||||
String sub = line.substring(begin + 1, end);
|
|
||||||
|
|
||||||
newVersion = !RefStrings.VERSION.equals(sub);
|
|
||||||
versionNumber = sub;
|
|
||||||
MainRegistry.logger.info("Found version " + sub);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainRegistry.logger.info("Version checker ended.");
|
while((line = in.readLine()) != null) {
|
||||||
in.close();
|
|
||||||
|
if(line.contains("String VERSION")) {
|
||||||
|
|
||||||
|
int begin = line.indexOf('"');
|
||||||
|
int end = line.lastIndexOf('"');
|
||||||
|
|
||||||
|
String sub = line.substring(begin + 1, end);
|
||||||
|
|
||||||
|
newVersion = !RefStrings.VERSION.equals(sub);
|
||||||
|
versionNumber = sub;
|
||||||
|
MainRegistry.logger.info("Found version " + sub);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainRegistry.logger.info("Version checker ended.");
|
||||||
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadSoyuz() throws IOException {
|
private static void loadSoyuz() throws IOException {
|
||||||
|
|
||||||
URL github = new URL("https://gist.githubusercontent.com/HbmMods/a1cad71d00b6915945a43961d0037a43/raw/soyuz_holo");
|
URL github = new URL("https://gist.githubusercontent.com/HbmMods/a1cad71d00b6915945a43961d0037a43/raw/soyuz_holo");
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream()));
|
||||||
|
|
||||||
String line = in.readLine();
|
String line;
|
||||||
|
|
||||||
if(line != null)
|
while((line = in.readLine()) != null) {
|
||||||
capsule = line;
|
capsule.add(line);
|
||||||
|
}
|
||||||
in.close();
|
|
||||||
|
if(capsule.isEmpty())
|
||||||
|
capsule.add("I AM ERROR");
|
||||||
|
|
||||||
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
src/main/java/com/hbm/inventory/gui/GUITurretMaxwell.java
Normal file
20
src/main/java/com/hbm/inventory/gui/GUITurretMaxwell.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.tileentity.turret.TileEntityTurretBaseNT;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUITurretMaxwell extends GUITurretBase {
|
||||||
|
|
||||||
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/weapon/gui_turret_maxwell.png");
|
||||||
|
|
||||||
|
public GUITurretMaxwell(InventoryPlayer invPlayer, TileEntityTurretBaseNT tedf) {
|
||||||
|
super(invPlayer, tedf);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ResourceLocation getTexture() {
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,10 +28,13 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
|||||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.entity.effect.*;
|
import com.hbm.entity.effect.*;
|
||||||
@ -1338,6 +1341,29 @@ public class ClientProxy extends ServerProxy {
|
|||||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(world, x, y, z, rand.nextGaussian() * 0.05, 0.05, rand.nextGaussian() * 0.05));
|
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(world, x, y, z, rand.nextGaussian() * 0.05, 0.05, rand.nextGaussian() * 0.05));
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleHadron(man, world, x, y, z));
|
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleHadron(man, world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("vanish".equals(type)) {
|
||||||
|
int ent = data.getInteger("ent");
|
||||||
|
this.vanish(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<Integer, Long> vanished = new HashMap();
|
||||||
|
|
||||||
|
public void vanish(int ent) {
|
||||||
|
vanished.put(ent, System.currentTimeMillis() + 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVanished(Entity e) {
|
||||||
|
|
||||||
|
if(e == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!this.vanished.containsKey(e.getEntityId()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return this.vanished.get(e.getEntityId()) > System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -208,11 +208,16 @@ public class MainRegistry {
|
|||||||
public static int y;
|
public static int y;
|
||||||
public static int z;
|
public static int z;
|
||||||
public static long time;
|
public static long time;
|
||||||
|
|
||||||
|
public static long startupTime = 0;
|
||||||
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PreLoad(FMLPreInitializationEvent PreEvent) {
|
public void PreLoad(FMLPreInitializationEvent PreEvent) {
|
||||||
|
|
||||||
|
startupTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if(logger == null)
|
if(logger == null)
|
||||||
logger = PreEvent.getModLog();
|
logger = PreEvent.getModLog();
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.hbm.main;
|
package com.hbm.main;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
@ -8,11 +9,9 @@ import org.lwjgl.opengl.GL11;
|
|||||||
import com.hbm.entity.mob.EntityHunterChopper;
|
import com.hbm.entity.mob.EntityHunterChopper;
|
||||||
import com.hbm.entity.projectile.EntityChopperMine;
|
import com.hbm.entity.projectile.EntityChopperMine;
|
||||||
import com.hbm.extprop.HbmLivingProps;
|
import com.hbm.extprop.HbmLivingProps;
|
||||||
import com.hbm.extprop.HbmPlayerProps;
|
|
||||||
import com.hbm.handler.ArmorModHandler;
|
import com.hbm.handler.ArmorModHandler;
|
||||||
import com.hbm.handler.HTTPHandler;
|
import com.hbm.handler.HTTPHandler;
|
||||||
import com.hbm.handler.HazmatRegistry;
|
import com.hbm.handler.HazmatRegistry;
|
||||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
|
||||||
import com.hbm.interfaces.IHoldableWeapon;
|
import com.hbm.interfaces.IHoldableWeapon;
|
||||||
import com.hbm.interfaces.IItemHUD;
|
import com.hbm.interfaces.IItemHUD;
|
||||||
import com.hbm.interfaces.Spaghetti;
|
import com.hbm.interfaces.Spaghetti;
|
||||||
@ -28,7 +27,6 @@ import com.hbm.lib.Library;
|
|||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.packet.AuxButtonPacket;
|
import com.hbm.packet.AuxButtonPacket;
|
||||||
import com.hbm.packet.GunButtonPacket;
|
import com.hbm.packet.GunButtonPacket;
|
||||||
import com.hbm.packet.KeybindPacket;
|
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.render.anim.HbmAnimations;
|
import com.hbm.render.anim.HbmAnimations;
|
||||||
import com.hbm.render.anim.HbmAnimations.Animation;
|
import com.hbm.render.anim.HbmAnimations.Animation;
|
||||||
@ -49,6 +47,7 @@ import com.hbm.util.I18nUtil;
|
|||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
|
import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -500,7 +499,8 @@ public class ModEventHandlerClient {
|
|||||||
|
|
||||||
GL11.glRotated(System.currentTimeMillis() * 0.025 % 360, 0, -1, 0);
|
GL11.glRotated(System.currentTimeMillis() * 0.025 % 360, 0, -1, 0);
|
||||||
|
|
||||||
String msg = HTTPHandler.capsule;
|
int rand = new Random(MainRegistry.startupTime).nextInt(HTTPHandler.capsule.size());
|
||||||
|
String msg = HTTPHandler.capsule.get(rand);
|
||||||
|
|
||||||
GL11.glTranslated(0, 3.75, 0);
|
GL11.glTranslated(0, 3.75, 0);
|
||||||
GL11.glRotated(180, 1, 0, 0);
|
GL11.glRotated(180, 1, 0, 0);
|
||||||
@ -545,6 +545,13 @@ public class ModEventHandlerClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
|
public void preRenderEventFirst(RenderLivingEvent.Pre event) {
|
||||||
|
|
||||||
|
if(MainRegistry.proxy.isVanished(event.entity))
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void preRenderEvent(RenderLivingEvent.Pre event) {
|
public void preRenderEvent(RenderLivingEvent.Pre event) {
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.main;
|
|||||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||||
import com.hbm.sound.AudioWrapper;
|
import com.hbm.sound.AudioWrapper;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
@ -34,4 +35,8 @@ public class ServerProxy {
|
|||||||
public EntityPlayer me() {
|
public EntityPlayer me() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVanished(Entity e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -4,8 +4,13 @@ import org.lwjgl.opengl.GL11;
|
|||||||
|
|
||||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||||
import com.hbm.main.ResourceManager;
|
import com.hbm.main.ResourceManager;
|
||||||
|
import com.hbm.render.util.BeamPronter;
|
||||||
|
import com.hbm.render.util.BeamPronter.EnumBeamType;
|
||||||
|
import com.hbm.render.util.BeamPronter.EnumWaveType;
|
||||||
import com.hbm.tileentity.turret.TileEntityTurretMaxwell;
|
import com.hbm.tileentity.turret.TileEntityTurretMaxwell;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
@ -40,6 +45,54 @@ public class RenderTurretMaxwell extends RenderTurretBase {
|
|||||||
bindTexture(ResourceManager.turret_maxwell_tex);
|
bindTexture(ResourceManager.turret_maxwell_tex);
|
||||||
ResourceManager.turret_maxwell.renderPart("Microwave");
|
ResourceManager.turret_maxwell.renderPart("Microwave");
|
||||||
|
|
||||||
|
if(turret.beam > 0) {
|
||||||
|
|
||||||
|
double length = turret.lastDist - turret.getBarrelLength();
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
|
||||||
|
GL11.glTranslated(turret.getBarrelLength(), 2D, 0);
|
||||||
|
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.0F);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
|
||||||
|
Tessellator tess = Tessellator.instance;
|
||||||
|
tess.startDrawingQuads();
|
||||||
|
Vec3 v = Vec3.createVectorHelper(0, 0.375, 0);
|
||||||
|
for(int i = 0; i < 16; i++) {
|
||||||
|
|
||||||
|
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.35F);
|
||||||
|
tess.addVertex(0, v.yCoord, v.zCoord);
|
||||||
|
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0F);
|
||||||
|
tess.addVertex(length, v.yCoord, v.zCoord);
|
||||||
|
v.rotateAroundX((float)Math.PI * 0.25F);
|
||||||
|
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0F);
|
||||||
|
tess.addVertex(length, v.yCoord, v.zCoord);
|
||||||
|
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.35F);
|
||||||
|
tess.addVertex(0, v.yCoord, v.zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
tess.draw();
|
||||||
|
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
|
||||||
|
BeamPronter.prontBeam(Vec3.createVectorHelper(length, 0, 0), EnumWaveType.SPIRAL, EnumBeamType.LINE, 0x0000ff, 0x8080ff, (int)((te.getWorldObj().getTotalWorldTime() + interp) * -50) % 360, (int)((turret.lastDist + 1) * 10), 0.4325F, 0, 0);
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
GL11.glShadeModel(GL11.GL_FLAT);
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import com.hbm.util.EntityDamageUtil;
|
|||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.DamageSource;
|
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
public class TileEntityTurretHoward extends TileEntityTurretBaseNT {
|
public class TileEntityTurretHoward extends TileEntityTurretBaseNT {
|
||||||
|
|||||||
@ -2,29 +2,157 @@ package com.hbm.tileentity.turret;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.lib.ModDamageSource;
|
||||||
|
import com.hbm.packet.AuxParticlePacketNT;
|
||||||
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
import com.hbm.util.EntityDamageUtil;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT {
|
public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getMaxPower() {
|
public String getName() {
|
||||||
// TODO Auto-generated method stub
|
return "container.turretMaxwell";
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateFiringTick() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Integer> getAmmoList() {
|
protected List<Integer> getAmmoList() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getAcceptableInaccuracy() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public double getDecetorGrace() {
|
||||||
// TODO Auto-generated method stub
|
return 5D;
|
||||||
return "container.turretMaxwell";
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getTurretYawSpeed() {
|
||||||
|
return 9D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getTurretPitchSpeed() {
|
||||||
|
return 6D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getTurretElevation() {
|
||||||
|
return 40D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getTurretDepression() {
|
||||||
|
return 35D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDecetorRange() {
|
||||||
|
return 128D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getMaxPower() {
|
||||||
|
return 10000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getConsumption() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getBarrelLength() {
|
||||||
|
return 2.125D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getHeightOffset() {
|
||||||
|
return 2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int beam;
|
||||||
|
public double lastDist;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
|
||||||
|
if(worldObj.isRemote) {
|
||||||
|
|
||||||
|
if(this.tPos != null) {
|
||||||
|
Vec3 pos = this.getTurretPos();
|
||||||
|
double length = Vec3.createVectorHelper(tPos.xCoord - pos.xCoord, tPos.yCoord - pos.yCoord, tPos.zCoord - pos.zCoord).lengthVector();
|
||||||
|
this.lastDist = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(beam > 0)
|
||||||
|
beam--;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.updateEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFiringTick() {
|
||||||
|
|
||||||
|
long demand = this.getConsumption() * 10;
|
||||||
|
|
||||||
|
if(this.target != null && this.getPower() >= demand) {
|
||||||
|
|
||||||
|
EntityDamageUtil.attackEntityFromIgnoreIFrame(this.target, ModDamageSource.shrapnel, 1F);
|
||||||
|
|
||||||
|
for(int i = 1; i <= 10; i *= 10) {
|
||||||
|
|
||||||
|
if(EntityDamageUtil.getLastDamage(this.target) < i * 0.5F)
|
||||||
|
EntityDamageUtil.attackEntityFromIgnoreIFrame(this.target, ModDamageSource.shrapnel, i * 10F);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.target.isEntityAlive()) {
|
||||||
|
float health = this.target instanceof EntityLivingBase ? ((EntityLivingBase)this.target).getMaxHealth() : 20F;
|
||||||
|
int count = Math.min((int)Math.ceil(health / 3D), 250);
|
||||||
|
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setString("type", "vanillaburst");
|
||||||
|
data.setInteger("count", count * 4);
|
||||||
|
data.setDouble("motion", 0.1D);
|
||||||
|
data.setString("mode", "blockdust");
|
||||||
|
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
|
||||||
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, this.target.posX, this.target.posY + this.target.height * 0.5, this.target.posZ), new TargetPoint(this.target.dimension, this.target.posX, this.target.posY + this.target.height * 0.5, this.target.posZ, 50));
|
||||||
|
|
||||||
|
NBTTagCompound vdat = new NBTTagCompound();
|
||||||
|
vdat.setString("type", "vanish");
|
||||||
|
vdat.setInteger("ent", this.target.getEntityId());
|
||||||
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, this.target.posX, this.target.posY + this.target.height * 0.5, this.target.posZ), new TargetPoint(this.target.dimension, this.target.posX, this.target.posY + this.target.height * 0.5, this.target.posZ, 50));
|
||||||
|
|
||||||
|
worldObj.playSoundEffect(this.target.posX, this.target.posY, this.target.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.power -= demand;
|
||||||
|
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setBoolean("shot", true);
|
||||||
|
this.networkPack(data, 250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void networkUnpack(NBTTagCompound nbt) {
|
||||||
|
|
||||||
|
if(nbt.hasKey("shot"))
|
||||||
|
beam = 5;
|
||||||
|
else
|
||||||
|
super.networkUnpack(nbt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,4 +25,15 @@ public class EntityDamageUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getLastDamage(Entity victim) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Field lastDamage = ReflectionHelper.findField(EntityLivingBase.class, "lastDamage", "field_110153_bc");
|
||||||
|
|
||||||
|
return lastDamage.getFloat(victim);
|
||||||
|
} catch(Exception x) {
|
||||||
|
return 0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user