diff --git a/.gitignore b/.gitignore index 8d16946..bbc8ac8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +.project +.classpath +bin +.settings .gradle .idea build diff --git a/austri3Fix.md b/austri3Fix.md new file mode 100644 index 0000000..e3ddca7 --- /dev/null +++ b/austri3Fix.md @@ -0,0 +1,16 @@ +- glass button doesn't render in inventory +- tons of missing packets (mostly gui stuff) +- can't apply camouflage texture +- turret UI textures completely fürn oasch +- sounds completely fürn oasch +- unable to mount turret afte dismounting +- turret gui kekt +- no electricity in guis +- EMP tower drops nonsense +- no proper update on multiblock destroy +- condensed explosives doesn't break blocks and explodes instantly +- can push explosive entities +- flying blocks dont properly render +- black hole doesn't suck in blocks +- no missiles?? +- remote detonator doesnt work diff --git a/build.gradle b/build.gradle index 7c2d31b..1a56803 100644 --- a/build.gradle +++ b/build.gradle @@ -11,23 +11,43 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.0.+') { + changing = true + } } } apply plugin: 'forge' +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +sourceSets { + api {} +} + version = "1.0" -group= "modgroup" -archivesBaseName = "modid" +group = "universalelectricity" +archivesBaseName = "icbm" + +jar { + manifest { + attributes "FMLAT": "icbm_at.cfg" + } +} minecraft { version = "1.7.10-10.13.4.1614-1.7.10" runDir = "run" } -dependencies { +repositories { + maven { url = "https://maven.tilera.xyz" } +} +dependencies { + implementation "universalelectricity:basiccomponents:1.0.2-dirty:deobf" + implementation "universalelectricity:atomicscience:1.0.1:deobf" } processResources diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4a0bb8..f6a15a7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/atomicscience/api/AtomicScience.java b/src/main/java/atomicscience/api/AtomicScience.java new file mode 100644 index 0000000..1fdc223 --- /dev/null +++ b/src/main/java/atomicscience/api/AtomicScience.java @@ -0,0 +1,17 @@ +package atomicscience.api; + +import cpw.mods.fml.common.Loader; +import net.minecraftforge.common.config.Configuration; + +import java.io.File; + +public class AtomicScience { + + public static final String MAJOR_VERSION = "0"; + public static final String MINOR_VERSION = "6"; + public static final String REVISION_VERSION = "2"; + public static final String BUILD_VERSION = "117"; + public static final String VERSION = "0.6.2"; + public static final String NAME = "Atomic Science"; + public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "AtomicScience.cfg")); +} diff --git a/src/main/java/atomicscience/api/BlockRadioactive.java b/src/main/java/atomicscience/api/BlockRadioactive.java new file mode 100644 index 0000000..e6fcfcc --- /dev/null +++ b/src/main/java/atomicscience/api/BlockRadioactive.java @@ -0,0 +1,144 @@ +package atomicscience.api; + +import atomicscience.api.poison.PoisonRadiation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntitySmokeFX; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class BlockRadioactive extends Block { + public boolean canSpread; + public float radius; + public int amplifier; + public boolean canWalkPoison; + public boolean isRandomlyRadioactive; + private IIcon iconTop; + private IIcon iconBottom; + + public BlockRadioactive(Material material) { + super(material); + this.canSpread = true; + this.radius = 5.0F; + this.amplifier = 2; + this.canWalkPoison = true; + this.isRandomlyRadioactive = true; + this.setTickRandomly(true); + this.setHardness(0.2F); + this.setLightLevel(0.1F); + } + + public BlockRadioactive() { + this(Material.rock); + } + + @Override + public IIcon getIcon(int side, int metadata) { + return side == 1 ? this.iconTop + : (side == 0 ? this.iconBottom : this.blockIcon); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + this.blockIcon = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "")); + this.iconTop = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "_top"); + this.iconBottom = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "_bottom"); + } + + @Override + public void onBlockClicked(World world, int x, int y, int z, + EntityPlayer par5EntityPlayer) { + if ((double) world.rand.nextFloat() > 0.8D) { + this.updateTick(world, x, y, z, world.rand); + } + } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) { + if (!world.isRemote) { + if (this.isRandomlyRadioactive) { + AxisAlignedBB i = AxisAlignedBB.getBoundingBox( + (double) ((float) x - this.radius), (double) ((float) y - this.radius), + (double) ((float) z - this.radius), (double) ((float) x + this.radius), + (double) ((float) y + this.radius), (double) ((float) z + this.radius)); + List newX = world.getEntitiesWithinAABB(EntityLiving.class, i); + + for (EntityLiving newZ : newX) { + PoisonRadiation.INSTANCE.poisonEntity( + new Vector3((double) x, (double) y, (double) z), newZ, + this.amplifier); + } + } + + if (this.canSpread) { + for (int var11 = 0; var11 < 4; ++var11) { + int xOffset = x + rand.nextInt(3) - 1; + int yOffset = y + rand.nextInt(5) - 3; + int zOffset = z + rand.nextInt(3) - 1; + Block block = world.getBlock(xOffset, yOffset, zOffset); + if ((double) rand.nextFloat() > 0.4D && + (block == Blocks.farmland || block == Blocks.grass)) { + world.setBlock(xOffset, yOffset, zOffset, this); + } + } + + if ((double) rand.nextFloat() > 0.85D) { + world.setBlock(x, y, z, Blocks.mycelium); + } + } + } + } + + @Override + public void onEntityWalking(World par1World, int x, int y, int z, + Entity par5Entity) { + if (par5Entity instanceof EntityLiving && this.canWalkPoison) { + PoisonRadiation.INSTANCE.poisonEntity( + new Vector3((double) x, (double) y, (double) z), + (EntityLiving) par5Entity); + } + } + + @Override + public int quantityDropped(Random par1Random) { + return 0; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, + Random par5Random) { + if (Minecraft.getMinecraft().gameSettings.particleSetting == 0) { + byte radius = 3; + + for (int i = 0; i < 2; ++i) { + Vector3 diDian = new Vector3((double) x, (double) y, (double) z); + diDian.x += Math.random() * (double) radius - (double) (radius / 2); + diDian.y += Math.random() * (double) radius - (double) (radius / 2); + diDian.z += Math.random() * (double) radius - (double) (radius / 2); + EntitySmokeFX fx = new EntitySmokeFX( + world, diDian.x, diDian.y, diDian.z, (Math.random() - 0.5D) / 2.0D, + (Math.random() - 0.5D) / 2.0D, (Math.random() - 0.5D) / 2.0D); + fx.setRBGColorF(0.2F, 0.8F, 0.0F); + Minecraft.getMinecraft().effectRenderer.addEffect(fx); + } + } + } +} diff --git a/src/main/java/atomicscience/api/IAntiPoisonArmor.java b/src/main/java/atomicscience/api/IAntiPoisonArmor.java new file mode 100644 index 0000000..fc05b65 --- /dev/null +++ b/src/main/java/atomicscience/api/IAntiPoisonArmor.java @@ -0,0 +1,14 @@ +package atomicscience.api; + +import atomicscience.api.poison.Poison; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public interface IAntiPoisonArmor { + + boolean isProtectedFromPoison(ItemStack var1, EntityLivingBase var2, Poison var3); + + void onProtectFromPoison(ItemStack var1, EntityLivingBase var2, Poison var3); + + Poison.ArmorType getArmorType(); +} diff --git a/src/main/java/atomicscience/api/IAntiPoisonBlock.java b/src/main/java/atomicscience/api/IAntiPoisonBlock.java new file mode 100644 index 0000000..c013b03 --- /dev/null +++ b/src/main/java/atomicscience/api/IAntiPoisonBlock.java @@ -0,0 +1,9 @@ +package atomicscience.api; + +import atomicscience.api.poison.Poison; +import net.minecraft.world.World; + +public interface IAntiPoisonBlock { + + boolean isPoisonPrevention(World var1, int var2, int var3, int var4, Poison var5); +} diff --git a/src/main/java/atomicscience/api/IElectromagnet.java b/src/main/java/atomicscience/api/IElectromagnet.java new file mode 100644 index 0000000..7b92be0 --- /dev/null +++ b/src/main/java/atomicscience/api/IElectromagnet.java @@ -0,0 +1,8 @@ +package atomicscience.api; + +import net.minecraft.world.World; + +public interface IElectromagnet { + + boolean isRunning(World var1, int var2, int var3, int var4); +} diff --git a/src/main/java/atomicscience/api/IFissileMaterial.java b/src/main/java/atomicscience/api/IFissileMaterial.java new file mode 100644 index 0000000..174c7e7 --- /dev/null +++ b/src/main/java/atomicscience/api/IFissileMaterial.java @@ -0,0 +1,8 @@ +package atomicscience.api; + +import atomicscience.api.ITemperature; + +public interface IFissileMaterial { + + int onFissile(ITemperature var1); +} diff --git a/src/main/java/atomicscience/api/IHeatSource.java b/src/main/java/atomicscience/api/IHeatSource.java new file mode 100644 index 0000000..14a3f7d --- /dev/null +++ b/src/main/java/atomicscience/api/IHeatSource.java @@ -0,0 +1,6 @@ +package atomicscience.api; + +import atomicscience.api.ITemperature; + +public interface IHeatSource extends ITemperature { +} diff --git a/src/main/java/atomicscience/api/IReactor.java b/src/main/java/atomicscience/api/IReactor.java new file mode 100644 index 0000000..1e85b0e --- /dev/null +++ b/src/main/java/atomicscience/api/IReactor.java @@ -0,0 +1,7 @@ +package atomicscience.api; + + +public interface IReactor { + + boolean isOverToxic(); +} diff --git a/src/main/java/atomicscience/api/ISteamReceptor.java b/src/main/java/atomicscience/api/ISteamReceptor.java new file mode 100644 index 0000000..057cbed --- /dev/null +++ b/src/main/java/atomicscience/api/ISteamReceptor.java @@ -0,0 +1,7 @@ +package atomicscience.api; + + +public interface ISteamReceptor { + + void onReceiveSteam(int var1); +} diff --git a/src/main/java/atomicscience/api/ITemperature.java b/src/main/java/atomicscience/api/ITemperature.java new file mode 100644 index 0000000..943e2fa --- /dev/null +++ b/src/main/java/atomicscience/api/ITemperature.java @@ -0,0 +1,9 @@ +package atomicscience.api; + + +public interface ITemperature { + + float getTemperature(); + + void setTemperature(float var1); +} diff --git a/src/main/java/atomicscience/api/Plasma.java b/src/main/java/atomicscience/api/Plasma.java new file mode 100644 index 0000000..4505c99 --- /dev/null +++ b/src/main/java/atomicscience/api/Plasma.java @@ -0,0 +1,17 @@ +package atomicscience.api; + +import net.minecraft.world.World; + +public class Plasma { + + public static Plasma.IPlasma blockPlasma; + + + + public interface IPlasma { + + void spawn(World var1, int var2, int var3, int var4, byte var5); + + boolean canPlace(World var1, int var2, int var3, int var4); + } +} diff --git a/src/main/java/atomicscience/api/poison/Poison.java b/src/main/java/atomicscience/api/poison/Poison.java new file mode 100644 index 0000000..81abe27 --- /dev/null +++ b/src/main/java/atomicscience/api/poison/Poison.java @@ -0,0 +1,77 @@ +package atomicscience.api.poison; + +import atomicscience.api.IAntiPoisonArmor; +import java.util.EnumSet; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import universalelectricity.core.vector.Vector3; + +public abstract class Poison { + + public static Poison[] list = new Poison[32]; + protected String name; + protected EnumSet armorRequired; + + public Poison(String name, int id) { + this.armorRequired = EnumSet.range(Poison.ArmorType.HELM, Poison.ArmorType.BOOTS); + this.name = name; + if (list == null) { + list = new Poison[32]; + } + + list[0] = this; + } + + public String getName() { + return this.name; + } + + public EnumSet getArmorRequired() { + return this.armorRequired; + } + + public void poisonEntity(Vector3 emitPosition, EntityLivingBase entity, + int amplifier) { + EnumSet armorWorn = EnumSet.of(Poison.ArmorType.UNKNOWN); + if (entity instanceof EntityPlayer) { + EntityPlayer entityPlayer = (EntityPlayer) entity; + + for (int i = 0; i < entityPlayer.inventory.armorInventory.length; ++i) { + if (entityPlayer.inventory.armorInventory[i] != null && + entityPlayer.inventory.armorInventory[i].getItem() instanceof IAntiPoisonArmor && + ((IAntiPoisonArmor) entityPlayer.inventory.armorInventory[i] + .getItem()) + .isProtectedFromPoison(entityPlayer.inventory.armorInventory[i], + entity, this)) { + ((IAntiPoisonArmor) entityPlayer.inventory.armorInventory[i].getItem()) + .onProtectFromPoison(entityPlayer.inventory.armorInventory[i], + entity, this); + armorWorn.add( + ((IAntiPoisonArmor) entityPlayer.inventory.armorInventory[i] + .getItem()) + .getArmorType()); + } + } + } + + if (!armorWorn.containsAll(this.armorRequired)) { + this.doPoisonEntity(emitPosition, entity, armorWorn, amplifier); + } + } + + public void poisonEntity(Vector3 emitPosition, EntityLivingBase entity) { + this.poisonEntity(emitPosition, entity, 0); + } + + protected abstract void doPoisonEntity(Vector3 var1, EntityLivingBase var2, + EnumSet var3, int var4); + + public static enum ArmorType { + HELM, + BODY, + LEGGINGS, + BOOTS, + UNKNOWN; + } +} diff --git a/src/main/java/atomicscience/api/poison/PoisonRadiation.java b/src/main/java/atomicscience/api/poison/PoisonRadiation.java new file mode 100644 index 0000000..21fc3af --- /dev/null +++ b/src/main/java/atomicscience/api/poison/PoisonRadiation.java @@ -0,0 +1,66 @@ +package atomicscience.api.poison; + +import atomicscience.api.IAntiPoisonBlock; +import java.util.EnumSet; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.CustomDamageSource; +import universalelectricity.prefab.potion.CustomPotionEffect; + +public class PoisonRadiation extends Poison { + + public static final Poison INSTANCE = new PoisonRadiation("radiation", 0); + public static final CustomDamageSource damageSource = (CustomDamageSource) (new CustomDamageSource("radiation")) + .setDamageBypassesArmor(); + public static boolean disabled = false; + + public PoisonRadiation(String name, int id) { + super(name, id); + } + + @Override + protected void doPoisonEntity(Vector3 emitPosition, EntityLivingBase entity, + EnumSet armorWorn, + int amplifier) { + if (!disabled) { + if (emitPosition == null) { + entity.addPotionEffect( + new CustomPotionEffect(PotionRadiation.INSTANCE.getId(), + 300 * (amplifier + 1), amplifier, null)); + return; + } + + if (this.getAntiRadioactiveCount(entity.worldObj, emitPosition, + new Vector3(entity)) <= amplifier) { + entity.addPotionEffect( + new CustomPotionEffect(PotionRadiation.INSTANCE.getId(), + 400 * (amplifier + 1), amplifier, null)); + } + } + } + + public int getAntiRadioactiveCount(World world, Vector3 startingPosition, + Vector3 endingPosition) { + Vector3 delta = Vector3.subtract(endingPosition, startingPosition).normalize(); + Vector3 targetPosition = startingPosition.clone(); + double totalDistance = startingPosition.distanceTo(endingPosition); + int count = 0; + if (totalDistance > 1.0D) { + for (; targetPosition.distanceTo(endingPosition) <= totalDistance; targetPosition.add(delta)) { + Block block = targetPosition.getBlock(world); + if (block != Blocks.air && block instanceof IAntiPoisonBlock && + ((IAntiPoisonBlock) block) + .isPoisonPrevention(world, targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ(), this)) { + ++count; + } + } + } + + return count; + } +} diff --git a/src/main/java/atomicscience/api/poison/PotionRadiation.java b/src/main/java/atomicscience/api/poison/PotionRadiation.java new file mode 100644 index 0000000..416ba3e --- /dev/null +++ b/src/main/java/atomicscience/api/poison/PotionRadiation.java @@ -0,0 +1,38 @@ +package atomicscience.api.poison; + +import atomicscience.api.AtomicScience; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import universalelectricity.prefab.potion.CustomPotion; + +public class PotionRadiation extends CustomPotion { + public static final PotionRadiation INSTANCE; + + public PotionRadiation(int id, boolean isBadEffect, int color, String name) { + super(AtomicScience.CONFIGURATION.get("Potion", name + " potion ID", id) + .getInt(id), + isBadEffect, color, name); + this.setIconIndex(6, 0); + } + + @Override + public void performEffect(EntityLivingBase entity, int amplifier) { + if ((double) entity.worldObj.rand.nextFloat() > 0.9D - (double) amplifier * 0.08D) { + entity.attackEntityFrom(PoisonRadiation.damageSource, 1); + if (entity instanceof EntityPlayer) { + ((EntityPlayer) entity) + .addExhaustion(0.01F * (float) (amplifier + 1)); + } + } + } + + public boolean isReady(int duration, int amplifier) { + return duration % 10 == 0; + } + + static { + AtomicScience.CONFIGURATION.load(); + INSTANCE = new PotionRadiation(21, true, 5149489, "radiation"); + AtomicScience.CONFIGURATION.save(); + } +} diff --git a/src/main/java/calclavia/lib/Calclavia.java b/src/main/java/calclavia/lib/Calclavia.java new file mode 100644 index 0000000..ff6b180 --- /dev/null +++ b/src/main/java/calclavia/lib/Calclavia.java @@ -0,0 +1,32 @@ +package calclavia.lib; + +import java.util.ArrayList; +import java.util.List; + +public class Calclavia { + + public static final String RESOURCE_DIRECTORY = "/mods/calclavia/"; + public static final String TEXTURE_DIRECTORY = "/mods/calclavia/textures/"; + public static final String GUI_DIRECTORY = "/mods/calclavia/textures/gui/"; + public static final String GUI_COMPONENTS = "/mods/calclavia/textures/gui/gui_components.png"; + public static final String GUI_BASE_FILE = "/mods/calclavia/textures/gui/gui_base.png"; + public static final String GUI_EMPTY_FILE = "/mods/calclavia/textures/gui/gui_empty.png"; + + + public static List splitStringPerWord(String string, int wordsPerLine) { + String[] words = string.split(" "); + ArrayList lines = new ArrayList<>(); + + for(int lineCount = 0; (double)lineCount < Math.ceil((double)((float)words.length / (float)wordsPerLine)); ++lineCount) { + String stringInLine = ""; + + for(int i = lineCount * wordsPerLine; i < Math.min(wordsPerLine + lineCount * wordsPerLine, words.length); ++i) { + stringInLine = stringInLine + words[i] + " "; + } + + lines.add(stringInLine.trim()); + } + + return lines; + } +} diff --git a/src/main/java/calclavia/lib/CalculationHelper.java b/src/main/java/calclavia/lib/CalculationHelper.java new file mode 100644 index 0000000..1748b8b --- /dev/null +++ b/src/main/java/calclavia/lib/CalculationHelper.java @@ -0,0 +1,111 @@ +package calclavia.lib; + +import java.util.Iterator; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class CalculationHelper { + + public static void rotateByAngle(Vector3 vector, double yaw) { + double yawRadians = Math.toRadians(yaw); + double x = vector.x; + double z = vector.z; + if(yaw != 0.0D) { + vector.x = x * Math.cos(yawRadians) - z * Math.sin(yawRadians); + vector.z = x * Math.sin(yawRadians) + z * Math.cos(yawRadians); + } + + } + + public static void rotateByAngle(Vector3 vector, double yaw, double pitch) { + rotateByAngle(vector, yaw, pitch, 0.0D); + } + + public static void rotateByAngle(Vector3 vector, double yaw, double pitch, double roll) { + double yawRadians = Math.toRadians(yaw); + double pitchRadians = Math.toRadians(pitch); + double rollRadians = Math.toRadians(roll); + double x = vector.x; + double y = vector.y; + double z = vector.z; + vector.x = x * Math.cos(yawRadians) * Math.cos(pitchRadians) + z * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) - Math.sin(yawRadians) * Math.cos(rollRadians)) + y * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) + Math.sin(yawRadians) * Math.sin(rollRadians)); + vector.z = x * Math.sin(yawRadians) * Math.cos(pitchRadians) + z * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) + Math.cos(yawRadians) * Math.cos(rollRadians)) + y * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) - Math.cos(yawRadians) * Math.sin(rollRadians)); + vector.y = -x * Math.sin(pitchRadians) + z * Math.cos(pitchRadians) * Math.sin(rollRadians) + y * Math.cos(pitchRadians) * Math.cos(rollRadians); + } + + public static Vector3 getDeltaPositionFromRotation(float rotationYaw, float rotationPitch) { + rotationYaw += 90.0F; + rotationPitch = -rotationPitch; + return new Vector3(Math.cos(Math.toRadians((double)rotationYaw)), Math.sin(Math.toRadians((double)rotationPitch)), Math.sin(Math.toRadians((double)rotationYaw))); + } + + public static MovingObjectPosition raytraceEntities(World world, Vector3 startPosition, float rotationYaw, float rotationPitch, boolean collisionFlag, double reachDistance) { + MovingObjectPosition pickedEntity = null; + Vec3 startingPosition = startPosition.toVec3(); + Vec3 look = getDeltaPositionFromRotation(rotationYaw, rotationPitch).toVec3(); + Vec3 reachPoint = Vec3.createVectorHelper(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance); + double playerBorder = 1.1D * reachDistance; + AxisAlignedBB boxToScan = AxisAlignedBB.getBoundingBox(-playerBorder, -playerBorder, -playerBorder, playerBorder, playerBorder, playerBorder); + List entitiesHit = world.getEntitiesWithinAABBExcludingEntity((Entity)null, boxToScan); + double closestEntity = reachDistance; + if(entitiesHit != null && !entitiesHit.isEmpty()) { + Iterator i$ = entitiesHit.iterator(); + + while(i$.hasNext()) { + Entity entityHit = (Entity)i$.next(); + if(entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null) { + float border = entityHit.getCollisionBorderSize(); + AxisAlignedBB aabb = entityHit.boundingBox.expand((double)border, (double)border, (double)border); + MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, reachPoint); + if(hitMOP != null) { + if(aabb.isVecInside(startingPosition)) { + if(0.0D < closestEntity || closestEntity == 0.0D) { + pickedEntity = new MovingObjectPosition(entityHit); + if(pickedEntity != null) { + pickedEntity.hitVec = hitMOP.hitVec; + closestEntity = 0.0D; + } + } + } else { + double distance = startingPosition.distanceTo(hitMOP.hitVec); + if(distance < closestEntity || closestEntity == 0.0D) { + pickedEntity = new MovingObjectPosition(entityHit); + pickedEntity.hitVec = hitMOP.hitVec; + closestEntity = distance; + } + } + } + } + } + + return pickedEntity; + } else { + return null; + } + } + + public static MovingObjectPosition raytraceBlocks(World world, Vector3 startPosition, float rotationYaw, float rotationPitch, boolean collisionFlag, double reachDistance) { + Vector3 lookVector = getDeltaPositionFromRotation(rotationYaw, rotationPitch); + Vector3 reachPoint = Vector3.add(startPosition, Vector3.multiply(lookVector, reachDistance)); + return world.rayTraceBlocks(startPosition.toVec3(), reachPoint.toVec3(), collisionFlag); + } + + public static MovingObjectPosition doCustomRayTrace(World world, Vector3 startPosition, float rotationYaw, float rotationPitch, boolean collisionFlag, double reachDistance) { + MovingObjectPosition pickedBlock = raytraceBlocks(world, startPosition, rotationYaw, rotationPitch, collisionFlag, reachDistance); + MovingObjectPosition pickedEntity = raytraceEntities(world, startPosition, rotationYaw, rotationPitch, collisionFlag, reachDistance); + if(pickedBlock == null) { + return pickedEntity; + } else if(pickedEntity == null) { + return pickedBlock; + } else { + double dBlock = startPosition.distanceTo(new Vector3(pickedBlock.hitVec)); + double dEntity = startPosition.distanceTo(new Vector3(pickedEntity.hitVec)); + return dEntity < dBlock?pickedEntity:pickedBlock; + } + } +} diff --git a/src/main/java/calclavia/lib/IPlayerUsing.java b/src/main/java/calclavia/lib/IPlayerUsing.java new file mode 100644 index 0000000..c7681eb --- /dev/null +++ b/src/main/java/calclavia/lib/IPlayerUsing.java @@ -0,0 +1,8 @@ +package calclavia.lib; + +import java.util.HashSet; + +public interface IPlayerUsing { + + HashSet getPlayersUsing(); +} diff --git a/src/main/java/calclavia/lib/IUniversalEnergyTile.java b/src/main/java/calclavia/lib/IUniversalEnergyTile.java new file mode 100644 index 0000000..ed5452c --- /dev/null +++ b/src/main/java/calclavia/lib/IUniversalEnergyTile.java @@ -0,0 +1,7 @@ +package calclavia.lib; + +import universalelectricity.core.block.IConnector; +import universalelectricity.core.block.IVoltage; + +public interface IUniversalEnergyTile extends IConnector, IVoltage { +} diff --git a/src/main/java/calclavia/lib/TileEntityUniversalProducer.java b/src/main/java/calclavia/lib/TileEntityUniversalProducer.java new file mode 100644 index 0000000..e90c0c9 --- /dev/null +++ b/src/main/java/calclavia/lib/TileEntityUniversalProducer.java @@ -0,0 +1,25 @@ +package calclavia.lib; + +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.electricity.ElectricityNetworkHelper; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.tile.TileEntityElectrical; + +public class TileEntityUniversalProducer extends TileEntityElectrical { + public ElectricityPack produce(double watts) { + ElectricityPack pack = + new ElectricityPack(watts / this.getVoltage(), this.getVoltage()); + ElectricityPack remaining = + ElectricityNetworkHelper.produceFromMultipleSides(this, pack); + + return remaining; + } + + @Override + public boolean canConnect(ForgeDirection direction) { + return this instanceof IRotatable + ? direction.ordinal() == this.getBlockMetadata() + : true; + } +} diff --git a/src/main/java/calclavia/lib/TileEntityUniversalRunnable.java b/src/main/java/calclavia/lib/TileEntityUniversalRunnable.java new file mode 100644 index 0000000..19387fb --- /dev/null +++ b/src/main/java/calclavia/lib/TileEntityUniversalRunnable.java @@ -0,0 +1,28 @@ +package calclavia.lib; + +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.tile.TileEntityElectricityRunnable; + +public abstract class TileEntityUniversalRunnable + extends TileEntityElectricityRunnable implements IUniversalEnergyTile { + @Override + public boolean canConnect(ForgeDirection direction) { + return this instanceof IRotatable + ? direction == ForgeDirection.getOrientation(this.getBlockMetadata()) + .getOpposite() + : true; + } + + public ForgeDirection getDirection(IBlockAccess world, int x, int y, int z) { + return ForgeDirection.getOrientation(this.getBlockMetadata()); + } + + public void setDirection(World world, int x, int y, int z, + ForgeDirection facingDirection) { + this.worldObj.setBlockMetadataWithNotify( + this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 2); + } +} diff --git a/src/main/java/calclavia/lib/TileEntityUniversalStorable.java b/src/main/java/calclavia/lib/TileEntityUniversalStorable.java new file mode 100644 index 0000000..a5a1978 --- /dev/null +++ b/src/main/java/calclavia/lib/TileEntityUniversalStorable.java @@ -0,0 +1,28 @@ +package calclavia.lib; + +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.tile.TileEntityElectricityStorage; + +public abstract class TileEntityUniversalStorable + extends TileEntityElectricityStorage implements IUniversalEnergyTile { + @Override + public boolean canConnect(ForgeDirection direction) { + return this instanceof IRotatable + ? direction == ForgeDirection.getOrientation(this.getBlockMetadata()) + .getOpposite() + : true; + } + + public ForgeDirection getDirection(IBlockAccess world, int x, int y, int z) { + return ForgeDirection.getOrientation(this.getBlockMetadata()); + } + + public void setDirection(World world, int x, int y, int z, + ForgeDirection facingDirection) { + this.worldObj.setBlockMetadataWithNotify( + this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 2); + } +} diff --git a/src/main/java/calclavia/lib/UniversalRecipes.java b/src/main/java/calclavia/lib/UniversalRecipes.java new file mode 100644 index 0000000..198b506 --- /dev/null +++ b/src/main/java/calclavia/lib/UniversalRecipes.java @@ -0,0 +1,102 @@ +package calclavia.lib; + +import cpw.mods.fml.common.FMLLog; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class UniversalRecipes { + public static final String PRIMARY_METAL = "ingotSteel"; + public static final String PRIMARY_PLATE = "plateSteel"; + public static final String SECONDARY_METAL = "ingotBronze"; + public static final String SECONDARY_PLATE = "plateBronze"; + public static final String CIRCUIT_T1 = "calclavia:CIRCUIT_T1"; + public static final String CIRCUIT_T2 = "calclavia:CIRCUIT_T2"; + public static final String CIRCUIT_T3 = "calclavia:CIRCUIT_T3"; + public static String ADVANCED_BATTERY = "calclavia:ADVANCED_BATTERY"; + public static String BATTERY = "calclavia:BATTERY"; + public static String BATTERY_BOX = "calclavia:BATTERY_BOX"; + public static final String WRENCH = "calclavia:WRENCH"; + public static final String WIRE = "calclavia:WIRE"; + public static final String MOTOR = "calclavia:MOTOR"; + public static boolean isInit = false; + + public static void init() { + if (!isInit) { + // TODO: WTF + // register("calclavia:CIRCUIT_T1", new Object[]{"circuitBasic", + // Items.getItem("electronicCircuit"), new + // ItemStack(Blocks.redstone_torch)}); register("calclavia:CIRCUIT_T2", + // new Object[]{"circuitAdvanced", Items.getItem("advancedCircuit"), new + // ItemStack(Items.repeater)}); register("calclavia:CIRCUIT_T3", new + // Object[]{"circuitElite", Items.getItem("iridiumPlate"), new + // ItemStack(Block.field_94346_cn)}); register(ADVANCED_BATTERY, new + // Object[]{"advancedBattery", Items.getItem("energyCrystal"), "battery", + // new ItemStack(Items.repeater)}); register(BATTERY, new + // Object[]{"battery", Items.getItem("reBattery"), new + // ItemStack(Items.repeater)}); + // register(BATTERY_BOX, new Object[]{"batteryBox", + // Items.getItem("batBox"), new ItemStack(Block.field_72105_ah)}); + // register("calclavia:WRENCH", new Object[]{"wrench", + // Items.getItem("wrench"), new ItemStack(Item.field_77708_h)}); + // register("calclavia:WIRE", new Object[]{"copperWire", + // "copperCableBlock", new ItemStack(Item.field_77767_aC)}); + // register("calclavia:MOTOR", new Object[]{"motor", + // Items.getItem("generator"), new ItemStack(Block.field_71963_Z)}); + isInit = true; + } + } + + public static void register(String name, Object... possiblities) { + Object[] arr$ = possiblities; + int len$ = possiblities.length; + + for (int i$ = 0; i$ < len$; ++i$) { + Object possiblity = arr$[i$]; + if (possiblity instanceof ItemStack) { + if (registerItemStacksToDictionary( + name, new ItemStack[] {(ItemStack)possiblity})) { + break; + } + } else if (possiblity instanceof String) { + if (registerItemStacksToDictionary(name, (String)possiblity)) { + break; + } + } else { + FMLLog.severe("Universal Recipes: Error Registering " + name, + new Object[0]); + } + } + } + + public static boolean registerItemStacksToDictionary(String name, + List itemStacks) { + boolean returnValue = false; + if (itemStacks != null && itemStacks.size() > 0) { + Iterator i$ = itemStacks.iterator(); + + while (i$.hasNext()) { + ItemStack stack = (ItemStack)i$.next(); + if (stack != null) { + OreDictionary.registerOre(name, stack); + returnValue = true; + } + } + } + + return returnValue; + } + + public static boolean + registerItemStacksToDictionary(String name, ItemStack... itemStacks) { + return registerItemStacksToDictionary(name, Arrays.asList(itemStacks)); + } + + public static boolean registerItemStacksToDictionary(String name, + String stackName) { + return registerItemStacksToDictionary( + name, (List)OreDictionary.getOres(stackName)); + } +} diff --git a/src/main/java/calclavia/lib/gui/ContainerBase.java b/src/main/java/calclavia/lib/gui/ContainerBase.java new file mode 100644 index 0000000..d2c20d4 --- /dev/null +++ b/src/main/java/calclavia/lib/gui/ContainerBase.java @@ -0,0 +1,96 @@ +package calclavia.lib.gui; + +import calclavia.lib.IPlayerUsing; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerBase extends Container { + + protected int slotCount = 0; + private IInventory inventory; + + + public ContainerBase(IInventory inventory) { + this.inventory = inventory; + this.slotCount = inventory.getSizeInventory(); + } + + public void onContainerClosed(EntityPlayer player) { + if(this.inventory instanceof IPlayerUsing) { + ((IPlayerUsing)this.inventory).getPlayersUsing().remove(player); + } + + } + + public void addPlayerInventory(EntityPlayer player) { + if(this.inventory instanceof IPlayerUsing) { + ((IPlayerUsing)this.inventory).getPlayersUsing().add(player); + } + + int var3; + for(var3 = 0; var3 < 3; ++var3) { + for(int var4 = 0; var4 < 9; ++var4) { + this.addSlotToContainer(new Slot(player.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 135 + var3 * 18)); + } + } + + for(var3 = 0; var3 < 9; ++var3) { + this.addSlotToContainer(new Slot(player.inventory, var3, 8 + var3 * 18, 193)); + } + + } + + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotID) { + ItemStack var2 = null; + Slot var3 = (Slot)super.inventorySlots.get(slotID); + if(var3 != null && var3.getHasStack()) { + ItemStack itemStack = var3.getStack(); + var2 = itemStack.copy(); + if(slotID >= this.slotCount) { + boolean didTry = false; + + for(int i = 0; i < this.slotCount; ++i) { + if(this.getSlot(i).isItemValid(itemStack)) { + didTry = true; + if(this.mergeItemStack(itemStack, i, i + 1, false)) { + break; + } + } + } + + if(!didTry) { + if(slotID < 27 + this.slotCount) { + if(!this.mergeItemStack(itemStack, 27 + this.slotCount, 36 + this.slotCount, false)) { + return null; + } + } else if(slotID >= 27 + this.slotCount && slotID < 36 + this.slotCount && !this.mergeItemStack(itemStack, this.slotCount, 27 + this.slotCount, false)) { + return null; + } + } + } else if(!this.mergeItemStack(itemStack, this.slotCount, 36 + this.slotCount, false)) { + return null; + } + + if(itemStack.stackSize == 0) { + var3.putStack((ItemStack)null); + } else { + var3.onSlotChanged(); + } + + if(itemStack.stackSize == var2.stackSize) { + return null; + } + + var3.onPickupFromSlot(par1EntityPlayer, itemStack); + } + + return var2; + } + + public boolean canInteractWith(EntityPlayer entityplayer) { + return this.inventory.isUseableByPlayer(entityplayer); + } +} diff --git a/src/main/java/calclavia/lib/gui/GuiContainerBase.java b/src/main/java/calclavia/lib/gui/GuiContainerBase.java new file mode 100644 index 0000000..8d2cad3 --- /dev/null +++ b/src/main/java/calclavia/lib/gui/GuiContainerBase.java @@ -0,0 +1,296 @@ +package calclavia.lib.gui; + +import calclavia.lib.Calclavia; +import java.util.HashMap; +import java.util.Map.Entry; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.vector.Vector2; +import universalelectricity.prefab.TranslationHelper; +import universalelectricity.prefab.vector.Region2; + +public class GuiContainerBase extends GuiContainer { + + //private static final int METER_X = 54; + public static final int METER_HEIGHT = 49; + public static final int METER_WIDTH = 14; + public static final int METER_END = 68; + public String tooltip = ""; + protected HashMap tooltips = new HashMap<>(); + protected int containerWidth; + protected int containerHeight; + + public GuiContainerBase(Container container) { + super(container); + this.ySize = 217; + } + + @Override + public void initGui() { + super.initGui(); + } + + @Override + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + super.onGuiClosed(); + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + for (Entry entry : this.tooltips.entrySet()) { + if (((Region2)entry.getKey()) + .isIn(new Vector2((double)(mouseX - this.guiLeft), + (double)(mouseY - this.guiTop)))) { + this.tooltip = (String)entry.getValue(); + break; + } + } + + if (this.tooltip != null && this.tooltip != "") { + this.drawTooltip(mouseX - this.guiLeft, mouseY - this.guiTop, + (String[])Calclavia.splitStringPerWord(this.tooltip, 5) + .toArray(new String[0])); + } + + this.tooltip = ""; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float var1, int x, int y) { + this.containerWidth = (this.width - this.xSize) / 2; + this.containerHeight = (this.height - this.ySize) / 2; + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + this.xSize, this.ySize); + } + + protected void drawBulb(int x, int y, boolean isOn) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if (isOn) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 161, 0, 6, 6); + } else { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 161, 4, 6, 6); + } + } + + protected void drawSlot(int x, int y, ItemStack itemStack) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 0, 0, 18, 18); + this.drawItemStack(itemStack, this.containerWidth + x, + this.containerHeight + y); + } + + protected void drawItemStack(ItemStack itemStack, int x, int y) { + ++x; + ++y; + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + itemRender.renderItemAndEffectIntoGUI( + this.fontRendererObj, this.mc.renderEngine, itemStack, x, y); + } + + protected void drawTextWithTooltip(String textName, String format, int x, + int y, int mouseX, int mouseY) { + this.drawTextWithTooltip(textName, format, x, y, mouseX, mouseY, 4210752); + } + + protected void drawTextWithTooltip(String textName, String format, int x, + int y, int mouseX, int mouseY, int color) { + String name = TranslationHelper.getLocal("gui." + textName + ".name"); + String text = format.replaceAll("%1", name); + this.fontRendererObj.drawString(text, x, y, color); + String tooltip = TranslationHelper.getLocal("gui." + textName + ".tooltip"); + if (tooltip != null && tooltip != "" && + this.func_146978_c(x, y, (int)((double)text.length() * 4.8D), 12, + mouseX, mouseY)) { + this.tooltip = tooltip; + } + } + + protected void drawTextWithTooltip(String textName, int x, int y, int mouseX, + int mouseY) { + this.drawTextWithTooltip(textName, "%1", x, y, mouseX, mouseY); + } + + protected void drawSlot(int x, int y, GuiSlotType type, float r, float g, + float b) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_components.png")); + GL11.glColor4f(r, g, b, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 0, 0, 18, 18); + if (type != GuiSlotType.NONE) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 0, + 18 * type.ordinal(), 18, 18); + } + } + + protected void drawSlot(int x, int y, GuiSlotType type) { + this.drawSlot(x, y, type, 1.0F, 1.0F, 1.0F); + } + + protected void drawSlot(int x, int y) { + this.drawSlot(x, y, GuiSlotType.NONE); + } + + protected void drawBar(int x, int y, float scale) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_components.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 18, 0, 22, 15); + if (scale > 0.0F) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 18, 15, + 22 - (int)(scale * 22.0F), 15); + } + } + + protected void drawForce(int x, int y, float scale) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_components.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 0, 107, 11); + if (scale > 0.0F) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 11, + (int)(scale * 107.0F), 11); + } + } + + protected void drawElectricity(int x, int y, float scale) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_components.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 0, 107, 11); + if (scale > 0.0F) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 22, + (int)(scale * 107.0F), 11); + } + } + + protected void drawMeter(int x, int y, float scale, FluidStack liquidStack) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 40, 0, 14, 49); + this.displayGauge(this.containerWidth + x, this.containerHeight + y, 0, 0, + (int)(48.0F * scale), liquidStack); + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 40, 98, 14, 49); + } + + public void drawTooltip(int x, int y, String... toolTips) { + if (!GuiScreen.isShiftKeyDown()) { + GL11.glDisable('\u803a'); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(2896); + GL11.glDisable(2929); + if (toolTips != null) { + int var5 = 0; + + int var6; + int var7; + for (var6 = 0; var6 < toolTips.length; ++var6) { + var7 = this.fontRendererObj.getStringWidth(toolTips[var6]); + if (var7 > var5) { + var5 = var7; + } + } + + var6 = x + 12; + var7 = y - 12; + int var9 = 8; + if (toolTips.length > 1) { + var9 += 2 + (toolTips.length - 1) * 10; + } + + if (this.guiTop + var7 + var9 + 6 > this.height) { + var7 = this.height - var9 - this.guiTop - 6; + } + + super.zLevel = 300.0F; + int var10 = -267386864; + this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, + var10, var10); + this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, + var7 + var9 + 4, var10, var10); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, + var7 + var9 + 3, var10, var10); + this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, + var10, var10); + this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, + var7 + var9 + 3, var10, var10); + int var11 = 1347420415; + int var12 = (var11 & 16711422) >> 1 | var11 & -16777216; + this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, + var7 + var9 + 3 - 1, var11, var12); + this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, + var7 + var9 + 3 - 1, var11, var12); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, + var11, var11); + this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, + var7 + var9 + 3, var12, var12); + + for (int var13 = 0; var13 < toolTips.length; ++var13) { + String var14 = toolTips[var13]; + this.fontRendererObj.drawStringWithShadow(var14, var6, var7, -1); + var7 += 10; + } + + super.zLevel = 0.0F; + GL11.glEnable(2929); + GL11.glEnable(2896); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable('\u803a'); + } + } + } + + protected void displayGauge(int j, int k, int line, int col, int squaled, + FluidStack liquid) { + if (liquid != null) { + int start = 0; + IIcon liquidIcon = liquid.getFluid().getIcon(); + + int x1; + do { + if (squaled > 16) { + x1 = 16; + squaled -= 16; + } else { + x1 = squaled; + squaled = 0; + } + + this.drawTexturedModelRectFromIcon(j + col, k + line + 58 - x1 - start, + liquidIcon, 16, 16 - (16 - x1)); + start += 16; + } while (x1 != 0 && squaled != 0); + } + } +} diff --git a/src/main/java/calclavia/lib/gui/GuiScreenBase.java b/src/main/java/calclavia/lib/gui/GuiScreenBase.java new file mode 100644 index 0000000..10e570a --- /dev/null +++ b/src/main/java/calclavia/lib/gui/GuiScreenBase.java @@ -0,0 +1,271 @@ +package calclavia.lib.gui; + +import calclavia.lib.Calclavia; +import java.util.HashMap; +import java.util.Map.Entry; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.vector.Vector2; +import universalelectricity.prefab.GuiBase; +import universalelectricity.prefab.TranslationHelper; +import universalelectricity.prefab.vector.Region2; + +public class GuiScreenBase extends GuiBase { + + // private static final int METER_X = 54; + public static final int METER_HEIGHT = 49; + public static final int METER_WIDTH = 14; + public static final int METER_END = 68; + public String tooltip = ""; + protected HashMap tooltips = new HashMap<>(); + protected int containerWidth; + protected int containerHeight; + + public GuiScreenBase() { super.ySize = 217; } + + @Override + protected void drawForegroundLayer(int mouseX, int mouseY, float var1) { + for (Entry entry : this.tooltips.entrySet()) { + if (((Region2)entry.getKey()) + .isIn(new Vector2((double)(mouseX - this.guiLeft), + (double)(mouseY - this.guiTop)))) { + this.tooltip = (String)entry.getValue(); + break; + } + } + + if (this.tooltip != null && this.tooltip != "") { + this.drawTooltip(mouseX - this.guiLeft, mouseY - this.guiTop, + (String[])Calclavia.splitStringPerWord(this.tooltip, 5) + .toArray(new String[0])); + } + + this.tooltip = ""; + } + + @Override + protected void drawBackgroundLayer(int x, int y, float var1) { + this.containerWidth = (this.width - this.xSize) / 2; + this.containerHeight = (this.height - this.ySize) / 2; + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + this.xSize, this.ySize); + } + + protected void drawBulb(int x, int y, boolean isOn) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if (isOn) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 161, 0, 6, 6); + } else { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 161, 4, 6, 6); + } + } + + protected void drawTextWithTooltip(String textName, String format, int x, + int y, int mouseX, int mouseY) { + this.drawTextWithTooltip(textName, format, x, y, mouseX, mouseY, 4210752); + } + + protected void drawTextWithTooltip(String textName, String format, int x, + int y, int mouseX, int mouseY, int color) { + String name = TranslationHelper.getLocal("gui." + textName + ".name"); + String text = format.replaceAll("%1", name); + this.fontRendererObj.drawString(text, x, y, color); + String tooltip = TranslationHelper.getLocal("gui." + textName + ".tooltip"); + if (tooltip != null && tooltip != "" && + this.isPointInRegion(x, y, (int)((double)text.length() * 4.8D), 12, + mouseX, mouseY)) { + this.tooltip = tooltip; + } + } + + protected boolean isPointInRegion(int par1, int par2, int par3, int par4, + int par5, int par6) { + int k1 = super.guiLeft; + int l1 = super.guiTop; + par5 -= k1; + par6 -= l1; + return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && + par6 < par2 + par4 + 1; + } + + protected void drawTextWithTooltip(String textName, int x, int y, int mouseX, + int mouseY) { + this.drawTextWithTooltip(textName, "%1", x, y, mouseX, mouseY); + } + + protected void drawSlot(int x, int y, GuiSlotType type, float r, float g, + float b) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_empty.png")); + GL11.glColor4f(r, g, b, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 0, 0, 18, 18); + if (type != GuiSlotType.NONE) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 0, + 18 * type.ordinal(), 18, 18); + } + } + + protected void drawSlot(int x, int y, GuiSlotType type) { + this.drawSlot(x, y, type, 1.0F, 1.0F, 1.0F); + } + + protected void drawSlot(int x, int y) { + this.drawSlot(x, y, GuiSlotType.NONE); + } + + protected void drawBar(int x, int y, float scale) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 18, 0, 22, 15); + if (scale > 0.0F) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 18, 15, + 22 - (int)(scale * 22.0F), 15); + } + } + + protected void drawForce(int x, int y, float scale) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 0, 107, 11); + if (scale > 0.0F) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 11, + (int)(scale * 107.0F), 11); + } + } + + protected void drawElectricity(int x, int y, float scale) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 0, 107, 11); + if (scale > 0.0F) { + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 54, 22, + (int)(scale * 107.0F), 11); + } + } + + protected void drawMeter(int x, int y, float scale, FluidStack liquidStack) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 40, 0, 14, 49); + this.displayGauge(this.containerWidth + x, this.containerHeight + y, 0, 0, + (int)(48.0F * scale), liquidStack); + this.mc.renderEngine.bindTexture( + new ResourceLocation("calclavia", "textures/gui/gui_empty.png")); + this.drawTexturedModalRect(this.containerWidth + x, + this.containerHeight + y, 40, 98, 14, 49); + } + + public void drawTooltip(int x, int y, String... toolTips) { + if (!GuiScreen.isShiftKeyDown()) { + GL11.glDisable('\u803a'); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(2896); + GL11.glDisable(2929); + if (toolTips != null) { + int var5 = 0; + + int var6; + int var7; + for (var6 = 0; var6 < toolTips.length; ++var6) { + var7 = this.fontRendererObj.getStringWidth(toolTips[var6]); + if (var7 > var5) { + var5 = var7; + } + } + + var6 = x + 12; + var7 = y - 12; + int var9 = 8; + if (toolTips.length > 1) { + var9 += 2 + (toolTips.length - 1) * 10; + } + + if (super.guiTop + var7 + var9 + 6 > this.height) { + var7 = this.height - var9 - super.guiTop - 6; + } + + super.zLevel = 300.0F; + int var10 = -267386864; + this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, + var10, var10); + this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, + var7 + var9 + 4, var10, var10); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, + var7 + var9 + 3, var10, var10); + this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, + var10, var10); + this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, + var7 + var9 + 3, var10, var10); + int var11 = 1347420415; + int var12 = (var11 & 16711422) >> 1 | var11 & -16777216; + this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, + var7 + var9 + 3 - 1, var11, var12); + this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, + var7 + var9 + 3 - 1, var11, var12); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, + var11, var11); + this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, + var7 + var9 + 3, var12, var12); + + for (int var13 = 0; var13 < toolTips.length; ++var13) { + String var14 = toolTips[var13]; + this.fontRendererObj.drawStringWithShadow(var14, var6, var7, -1); + var7 += 10; + } + + super.zLevel = 0.0F; + GL11.glEnable(2929); + GL11.glEnable(2896); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable('\u803a'); + } + } + } + + protected void displayGauge(int j, int k, int line, int col, int squaled, + FluidStack liquid) { + if (liquid != null) { + int start = 0; + IIcon liquidIcon = liquid.getFluid().getIcon(); + + int x1; + do { + if (squaled > 16) { + x1 = 16; + squaled -= 16; + } else { + x1 = squaled; + squaled = 0; + } + + this.drawTexturedModelRectFromIcon(j + col, k + line + 58 - x1 - start, + liquidIcon, 16, 16 - (16 - x1)); + start += 16; + } while (x1 != 0 && squaled != 0); + } + } +} diff --git a/src/main/java/calclavia/lib/gui/GuiSlotType.java b/src/main/java/calclavia/lib/gui/GuiSlotType.java new file mode 100644 index 0000000..02757f0 --- /dev/null +++ b/src/main/java/calclavia/lib/gui/GuiSlotType.java @@ -0,0 +1,23 @@ +package calclavia.lib.gui; + + +public enum GuiSlotType { + + NONE("NONE", 0), + BATTERY("BATTERY", 1), + LIQUID("LIQUID", 2), + ARR_UP("ARR_UP", 3), + ARR_DOWN("ARR_DOWN", 4), + ARR_LEFT("ARR_LEFT", 5), + ARR_RIGHT("ARR_RIGHT", 6), + ARR_UP_RIGHT("ARR_UP_RIGHT", 7), + ARR_UP_LEFT("ARR_UP_LEFT", 8), + ARR_DOWN_LEFT("ARR_DOWN_LEFT", 9), + ARR_DOWN_RIGHT("ARR_DOWN_RIGHT", 10); + // $FF: synthetic field + private static final GuiSlotType[] $VALUES = new GuiSlotType[]{NONE, BATTERY, LIQUID, ARR_UP, ARR_DOWN, ARR_LEFT, ARR_RIGHT, ARR_UP_RIGHT, ARR_UP_LEFT, ARR_DOWN_LEFT, ARR_DOWN_RIGHT}; + + + private GuiSlotType(String var1, int var2) {} + +} diff --git a/src/main/java/calclavia/lib/render/CalclaviaRenderHelper.java b/src/main/java/calclavia/lib/render/CalclaviaRenderHelper.java new file mode 100644 index 0000000..120743d --- /dev/null +++ b/src/main/java/calclavia/lib/render/CalclaviaRenderHelper.java @@ -0,0 +1,111 @@ +package calclavia.lib.render; + +import net.minecraft.block.Block; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderManager; +import org.lwjgl.opengl.GL11; + +public class CalclaviaRenderHelper { + + public static void enableBlending() { + GL11.glShadeModel(7425); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + } + + public static void disableBlending() { + GL11.glShadeModel(7424); + GL11.glDisable(2848); + GL11.glDisable(2881); + GL11.glDisable(3042); + } + + public static void enableLighting() { + RenderHelper.enableStandardItemLighting(); + } + + public static void disableLighting() { + RenderHelper.disableStandardItemLighting(); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); + } + + public static void renderNormalBlockAsItem(Block block, int metadata, RenderBlocks renderer) { + Tessellator tessellator = Tessellator.instance; + block.setBlockBoundsForItemRender(); + renderer.setRenderBoundsFromBlock(block); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); + tessellator.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + public static void renderFloatingText(String text, float x, float y, float z) { + renderFloatingText(text, x, y, z, 16777215); + } + + public static void renderFloatingText(String text, float x, float y, float z, int color) { + RenderManager renderManager = RenderManager.instance; + FontRenderer fontRenderer = renderManager.getFontRenderer(); + float scale = 0.027F; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + GL11.glPushMatrix(); + GL11.glTranslatef(x + 0.0F, y + 2.3F, z); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + GL11.glScalef(-scale, -scale, scale); + GL11.glDisable(2896); + GL11.glDepthMask(false); + GL11.glDisable(2929); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + Tessellator tessellator = Tessellator.instance; + byte yOffset = 0; + GL11.glDisable(3553); + tessellator.startDrawingQuads(); + int stringMiddle = fontRenderer.getStringWidth(text) / 2; + tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.5F); + tessellator.addVertex((double)(-stringMiddle - 1), (double)(-1 + yOffset), 0.0D); + tessellator.addVertex((double)(-stringMiddle - 1), (double)(8 + yOffset), 0.0D); + tessellator.addVertex((double)(stringMiddle + 1), (double)(8 + yOffset), 0.0D); + tessellator.addVertex((double)(stringMiddle + 1), (double)(-1 + yOffset), 0.0D); + tessellator.draw(); + GL11.glEnable(3553); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); + fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color); + GL11.glEnable(2929); + GL11.glDepthMask(true); + fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color); + GL11.glEnable(2896); + GL11.glDisable(3042); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/calclavia/lib/render/ITagRender.java b/src/main/java/calclavia/lib/render/ITagRender.java new file mode 100644 index 0000000..dad2bb7 --- /dev/null +++ b/src/main/java/calclavia/lib/render/ITagRender.java @@ -0,0 +1,9 @@ +package calclavia.lib.render; + +import java.util.HashMap; +import net.minecraft.entity.player.EntityPlayer; + +public interface ITagRender { + + float addInformation(HashMap var1, EntityPlayer var2); +} diff --git a/src/main/java/calclavia/lib/render/RenderTaggedTile.java b/src/main/java/calclavia/lib/render/RenderTaggedTile.java new file mode 100644 index 0000000..bd1c55c --- /dev/null +++ b/src/main/java/calclavia/lib/render/RenderTaggedTile.java @@ -0,0 +1,64 @@ +package calclavia.lib.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; + +@SideOnly(Side.CLIENT) +public abstract class RenderTaggedTile extends TileEntitySpecialRenderer { + @Override + public void renderTileEntityAt(TileEntity t, double x, double y, double z, + float f) { + if (t != null && t instanceof ITagRender && + this.getPlayer().getDistance((double)t.xCoord, (double)t.yCoord, + (double)t.zCoord) <= + (double)RendererLivingEntity.NAME_TAG_RANGE) { + HashMap tags = new HashMap(); + float height = ((ITagRender)t).addInformation(tags, this.getPlayer()); + EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; + if (player.ridingEntity == null) { + MovingObjectPosition objectPosition = player.rayTrace(8.0D, 1.0F); + if (objectPosition != null) { + boolean isLooking = false; + + for (int it = 0; (float)it < height; ++it) { + if (objectPosition.blockX == t.xCoord && + objectPosition.blockY == t.yCoord + it && + objectPosition.blockZ == t.zCoord) { + isLooking = true; + } + } + + if (isLooking) { + Iterator var17 = tags.entrySet().iterator(); + + for (int i = 0; var17.hasNext(); ++i) { + Entry entry = (Entry)var17.next(); + if (entry.getKey() != null) { + CalclaviaRenderHelper.renderFloatingText( + (String)entry.getKey(), (float)x + 0.5F, + (float)y + (float)i * 0.25F - 2.0F + height, + (float)z + 0.5F, ((Integer)entry.getValue()).intValue()); + } + } + } + } + } + } + } + + public EntityPlayer getPlayer() { + EntityLivingBase entity = this.field_147501_a.field_147551_g; + return entity instanceof EntityPlayer ? (EntityPlayer)entity : null; + } +} diff --git a/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java b/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java new file mode 100644 index 0000000..4f84caa --- /dev/null +++ b/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java @@ -0,0 +1,315 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api; + +import dan200.computercraft.api.filesystem.IMount; +import dan200.computercraft.api.filesystem.IWritableMount; +import dan200.computercraft.api.media.IMediaProvider; +import dan200.computercraft.api.peripheral.IPeripheralProvider; +import dan200.computercraft.api.permissions.ITurtlePermissionProvider; +import dan200.computercraft.api.redstone.IBundledRedstoneProvider; +import dan200.computercraft.api.turtle.ITurtleUpgrade; +import net.minecraft.world.World; + +import java.lang.reflect.Method; + +/** + * The static entry point to the ComputerCraft API. + * Members in this class must be called after mod_ComputerCraft has been initialised, + * but may be called before it is fully loaded. + */ +public final class ComputerCraftAPI +{ + public static boolean isInstalled() + { + findCC(); + return computerCraft != null; + } + + public static String getInstalledVersion() + { + findCC(); + if( computerCraft_getVersion != null ) + { + try { + return (String)computerCraft_getVersion.invoke( null ); + } catch (Exception e) { + // It failed + } + } + return ""; + } + + public static String getAPIVersion() + { + return "1.75"; + } + + /** + * Creates a numbered directory in a subfolder of the save directory for a given world, and returns that number.
+ * Use in conjuction with createSaveDirMount() to create a unique place for your peripherals or media items to store files.
+ * @param world The world for which the save dir should be created. This should be the serverside world object. + * @param parentSubPath The folder path within the save directory where the new directory should be created. eg: "computercraft/disk" + * @return The numerical value of the name of the new folder, or -1 if the folder could not be created for some reason.
+ * eg: if createUniqueNumberedSaveDir( world, "computer/disk" ) was called returns 42, then "computer/disk/42" is now available for writing. + * @see #createSaveDirMount(World, String, long) + */ + public static int createUniqueNumberedSaveDir( World world, String parentSubPath ) + { + findCC(); + if( computerCraft_createUniqueNumberedSaveDir != null ) + { + try { + return (Integer)computerCraft_createUniqueNumberedSaveDir.invoke( null, world, parentSubPath ); + } catch (Exception e) { + // It failed + } + } + return -1; + } + + /** + * Creates a file system mount that maps to a subfolder of the save directory for a given world, and returns it.
+ * Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a folder from the + * users save directory onto a computers file system.
+ * @param world The world for which the save dir can be found. This should be the serverside world object. + * @param subPath The folder path within the save directory that the mount should map to. eg: "computer/disk/42".
+ * Use createUniqueNumberedSaveDir() to create a new numbered folder to use. + * @param capacity The ammount of data that can be stored in the directory before it fills up, in bytes. + * @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable() + * to mount this on a Computers' file system. + * @see #createUniqueNumberedSaveDir(World, String) + * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount) + * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount) + * @see dan200.computercraft.api.filesystem.IMount + * @see IWritableMount + */ + public static IWritableMount createSaveDirMount( World world, String subPath, long capacity ) + { + findCC(); + if( computerCraft_createSaveDirMount != null ) + { + try { + return (IWritableMount)computerCraft_createSaveDirMount.invoke( null, world, subPath, capacity ); + } catch (Exception e){ + // It failed + } + } + return null; + } + + /** + * Creates a file system mount to a resource folder, and returns it.
+ * Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a resource folder onto a computers file system.
+ * The files in this mount will be a combination of files in the specified mod jar, and resource packs that contain resources with the same domain and path.
+ * @param modClass A class in whose jar to look first for the resources to mount. Using your main mod class is recommended. eg: MyMod.class + * @param domain The domain under which to look for resources. eg: "mymod" + * @param subPath The domain under which to look for resources. eg: "mymod/lua/myfiles" + * @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable() + * to mount this on a Computers' file system. + * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, dan200.computercraft.api.filesystem.IMount) + * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, IWritableMount) + * @see dan200.computercraft.api.filesystem.IMount + */ + public static IMount createResourceMount( Class modClass, String domain, String subPath ) + { + findCC(); + if( computerCraft_createResourceMount != null ) + { + try { + return (IMount)computerCraft_createResourceMount.invoke( null, modClass, domain, subPath ); + } catch (Exception e){ + // It failed + } + } + return null; + } + + /** + * Registers a peripheral handler to convert blocks into IPeripheral implementations. + * @see dan200.computercraft.api.peripheral.IPeripheral + * @see dan200.computercraft.api.peripheral.IPeripheralProvider + */ + public static void registerPeripheralProvider( IPeripheralProvider handler ) + { + findCC(); + if ( computerCraft_registerPeripheralProvider != null) + { + try { + computerCraft_registerPeripheralProvider.invoke( null, handler ); + } catch (Exception e){ + // It failed + } + } + } + + /** + * Registers a new turtle turtle for use in ComputerCraft. After calling this, + * users should be able to craft Turtles with your new turtle. It is recommended to call + * this during the load() method of your mod. + * @see dan200.computercraft.api.turtle.ITurtleUpgrade + */ + public static void registerTurtleUpgrade( ITurtleUpgrade upgrade ) + { + if( upgrade != null ) + { + findCC(); + if( computerCraft_registerTurtleUpgrade != null ) + { + try { + computerCraft_registerTurtleUpgrade.invoke( null, upgrade ); + } catch( Exception e ) { + // It failed + } + } + } + } + + /** + * Registers a bundled redstone handler to provide bundled redstone output for blocks + * @see dan200.computercraft.api.redstone.IBundledRedstoneProvider + */ + public static void registerBundledRedstoneProvider( IBundledRedstoneProvider handler ) + { + findCC(); + if( computerCraft_registerBundledRedstoneProvider != null ) + { + try { + computerCraft_registerBundledRedstoneProvider.invoke( null, handler ); + } catch (Exception e) { + // It failed + } + } + } + + /** + * If there is a Computer or Turtle at a certain position in the world, get it's bundled redstone output. + * @see dan200.computercraft.api.redstone.IBundledRedstoneProvider + * @return If there is a block capable of emitting bundled redstone at the location, it's signal (0-65535) will be returned. + * If there is no block capable of emitting bundled redstone at the location, -1 will be returned. + */ + public static int getBundledRedstoneOutput( World world, int x, int y, int z, int side ) + { + findCC(); + if( computerCraft_getDefaultBundledRedstoneOutput != null ) + { + try { + return (Integer)computerCraft_getDefaultBundledRedstoneOutput.invoke( null, world, x, y, z, side ); + } catch (Exception e){ + // It failed + } + } + return -1; + } + + /** + * Registers a media handler to provide IMedia implementations for Items + * @see dan200.computercraft.api.media.IMediaProvider + */ + public static void registerMediaProvider( IMediaProvider handler ) + { + findCC(); + if( computerCraft_registerMediaProvider != null ) + { + try { + computerCraft_registerMediaProvider.invoke( null, handler ); + } catch (Exception e){ + // It failed + } + } + } + + /** + * Registers a permission handler to restrict where turtles can move or build + * @see dan200.computercraft.api.permissions.ITurtlePermissionProvider + */ + public static void registerPermissionProvider( ITurtlePermissionProvider handler ) + { + findCC(); + if( computerCraft_registerPermissionProvider != null ) + { + try { + computerCraft_registerPermissionProvider.invoke( null, handler ); + } catch (Exception e) { + // It failed + } + } + } + + // The functions below here are private, and are used to interface with the non-API ComputerCraft classes. + // Reflection is used here so you can develop your mod without decompiling ComputerCraft and including + // it in your solution, and so your mod won't crash if ComputerCraft is installed. + + private static void findCC() + { + if( !ccSearched ) { + try { + computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" ); + computerCraft_getVersion = findCCMethod( "getVersion", new Class[]{ + } ); + computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{ + World.class, String.class + } ); + computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] { + World.class, String.class, Long.TYPE + } ); + computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] { + Class.class, String.class, String.class + } ); + computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] { + IPeripheralProvider.class + } ); + computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] { + ITurtleUpgrade.class + } ); + computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] { + IBundledRedstoneProvider.class + } ); + computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] { + World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE + } ); + computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] { + IMediaProvider.class + } ); + computerCraft_registerPermissionProvider = findCCMethod( "registerPermissionProvider", new Class[] { + ITurtlePermissionProvider.class + } ); + } catch( Exception e ) { + System.out.println( "ComputerCraftAPI: ComputerCraft not found." ); + } finally { + ccSearched = true; + } + } + } + + private static Method findCCMethod( String name, Class[] args ) + { + try { + if( computerCraft != null ) + { + return computerCraft.getMethod( name, args ); + } + return null; + } catch( NoSuchMethodException e ) { + System.out.println( "ComputerCraftAPI: ComputerCraft method " + name + " not found." ); + return null; + } + } + + private static boolean ccSearched = false; + private static Class computerCraft = null; + private static Method computerCraft_getVersion = null; + private static Method computerCraft_createUniqueNumberedSaveDir = null; + private static Method computerCraft_createSaveDirMount = null; + private static Method computerCraft_createResourceMount = null; + private static Method computerCraft_registerPeripheralProvider = null; + private static Method computerCraft_registerTurtleUpgrade = null; + private static Method computerCraft_registerBundledRedstoneProvider = null; + private static Method computerCraft_getDefaultBundledRedstoneOutput = null; + private static Method computerCraft_registerMediaProvider = null; + private static Method computerCraft_registerPermissionProvider = null; +} diff --git a/src/main/java/dan200/computercraft/api/filesystem/IMount.java b/src/main/java/dan200/computercraft/api/filesystem/IMount.java new file mode 100644 index 0000000..cf884d9 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/filesystem/IMount.java @@ -0,0 +1,57 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.filesystem; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +/** + * Represents a read only part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount(). + * Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount() or ComputerCraftAPI.createResourceMount(), or you're free to implement it yourselves! + * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) + * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) + * @see dan200.computercraft.api.peripheral.IComputerAccess#mount(String, IMount) + * @see IWritableMount + */ +public interface IMount +{ + /** + * Returns whether a file with a given path exists or not. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" + * @return true if the file exists, false otherwise + */ + public boolean exists( String path ) throws IOException; + + /** + * Returns whether a file with a given path is a directory or not. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms" + * @return true if the file exists and is a directory, false otherwise + */ + public boolean isDirectory( String path ) throws IOException; + + /** + * Returns the file names of all the files in a directory. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms" + * @param contents A list of strings. Add all the file names to this list + */ + public void list( String path, List contents ) throws IOException; + + /** + * Returns the size of a file with a given path, in bytes + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" + * @return the size of the file, in bytes + */ + public long getSize( String path ) throws IOException; + + /** + * Opens a file with a given path, and returns an inputstream representing it's contents. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" + * @return a stream representing the contents of the file + */ + public InputStream openForRead( String path ) throws IOException; +} diff --git a/src/main/java/dan200/computercraft/api/filesystem/IWritableMount.java b/src/main/java/dan200/computercraft/api/filesystem/IWritableMount.java new file mode 100644 index 0000000..ffe3290 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/filesystem/IWritableMount.java @@ -0,0 +1,52 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.filesystem; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * Represents a part of a virtual filesystem that can be mounted onto a computercraft using IComputerAccess.mount() or IComputerAccess.mountWritable(), that can also be written to. + * Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount(), or you're free to implement it yourselves! + * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) + * @see dan200.computercraft.api.peripheral.IComputerAccess#mountWritable(String, dan200.computercraft.api.filesystem.IMount) + * @see dan200.computercraft.api.filesystem.IMount + */ +public interface IWritableMount extends IMount +{ + /** + * Creates a directory at a given path inside the virtual file system. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/mynewprograms" + */ + public void makeDirectory( String path ) throws IOException; + + /** + * Deletes a directory at a given path inside the virtual file system. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myoldprograms" + */ + public void delete( String path ) throws IOException; + + /** + * Opens a file with a given path, and returns an outputstream for writing to it. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" + * @return a stream for writing to + */ + public OutputStream openForWrite( String path ) throws IOException; + + /** + * Opens a file with a given path, and returns an outputstream for appending to it. + * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" + * @return a stream for writing to + */ + public OutputStream openForAppend( String path ) throws IOException; + + /** + * Get the ammount of free space on the mount, in bytes. You should decrease this value as the user writes to the mount, and write operations should fail once it reaches zero. + * @return The ammount of free space, in bytes. + */ + public long getRemainingSpace() throws IOException; +} diff --git a/src/main/java/dan200/computercraft/api/filesystem/package-info.java b/src/main/java/dan200/computercraft/api/filesystem/package-info.java new file mode 100644 index 0000000..d7a2d59 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/filesystem/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|FileSystem", apiVersion="1.75" ) +package dan200.computercraft.api.filesystem; + +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/dan200/computercraft/api/lua/ILuaContext.java b/src/main/java/dan200/computercraft/api/lua/ILuaContext.java new file mode 100644 index 0000000..1ffbeea --- /dev/null +++ b/src/main/java/dan200/computercraft/api/lua/ILuaContext.java @@ -0,0 +1,58 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.lua; + +/** + * An interface passed to peripherals and ILuaObjects' by computers or turtles, providing methods + * that allow the peripheral call to wait for events before returning, just like in lua. + * This is very useful if you need to signal work to be performed on the main thread, and don't want to return + * until the work has been completed. + */ +public interface ILuaContext +{ + /** + * Wait for an event to occur on the computercraft, suspending the thread until it arises. This method is exactly equivalent to os.pullEvent() in lua. + * @param filter A specific event to wait for, or null to wait for any event + * @return An object array containing the name of the event that occurred, and any event parameters + * @throws Exception If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here. + * Do not attempt to common this exception, unless you wish to prevent termination, which is not recommended. + * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state. + */ + public Object[] pullEvent( String filter ) throws LuaException, InterruptedException; + + /** + * The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua. + * @param filter A specific event to wait for, or null to wait for any event + * @return An object array containing the name of the event that occurred, and any event parameters + * @throws InterruptedException If the user shuts down or reboots the computercraft while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state. + * @see #pullEvent(String) + */ + public Object[] pullEventRaw( String filter ) throws InterruptedException; + + /** + * Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events. + * @param arguments An object array containing the arguments to pass to coroutine.yield() + * @return An object array containing the return values from coroutine.yield() + * @throws InterruptedException If the user shuts down or reboots the computercraft the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computercraft will leak memory and end up in a broken state. + * @see #pullEvent(String) + */ + public Object[] yield( Object[] arguments ) throws InterruptedException; + + /** + * TODO: Document me + * @param task + * @return + */ + public Object[] executeMainThreadTask( ILuaTask task ) throws LuaException, InterruptedException; + + /** + * TODO: Document me + * @param task + * @return + */ + public long issueMainThreadTask( ILuaTask task ) throws LuaException; +} diff --git a/src/main/java/dan200/computercraft/api/lua/ILuaObject.java b/src/main/java/dan200/computercraft/api/lua/ILuaObject.java new file mode 100644 index 0000000..abd8b40 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/lua/ILuaObject.java @@ -0,0 +1,26 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.lua; + +/** + * An interface for representing custom objects returned by IPeripheral.callMethod() calls. + * Return objects implementing this interface to expose objects with methods to lua. + */ +public interface ILuaObject +{ + /** + * Get the names of the methods that this object implements. This works the same as IPeripheral.getMethodNames(). See that method for detailed documentation. + * @see dan200.computercraft.api.peripheral.IPeripheral#getMethodNames() + */ + public String[] getMethodNames(); + + /** + * Called when a user calls one of the methods that this object implements. This works the same as IPeripheral.callMethod(). See that method for detailed documentation. + * @see dan200.computercraft.api.peripheral.IPeripheral#callMethod(dan200.computercraft.api.peripheral.IComputerAccess, ILuaContext, int, Object[]) + */ + public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException; +} diff --git a/src/main/java/dan200/computercraft/api/lua/ILuaTask.java b/src/main/java/dan200/computercraft/api/lua/ILuaTask.java new file mode 100644 index 0000000..45feead --- /dev/null +++ b/src/main/java/dan200/computercraft/api/lua/ILuaTask.java @@ -0,0 +1,12 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.lua; + +public interface ILuaTask +{ + public Object[] execute() throws LuaException; +} diff --git a/src/main/java/dan200/computercraft/api/lua/LuaException.java b/src/main/java/dan200/computercraft/api/lua/LuaException.java new file mode 100644 index 0000000..6683c4b --- /dev/null +++ b/src/main/java/dan200/computercraft/api/lua/LuaException.java @@ -0,0 +1,36 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.lua; + +/** + * An exception representing an error in Lua, like that raised by the error() function + */ +public class LuaException extends Exception +{ + private final int m_level; + + public LuaException() + { + this( "error", 1 ); + } + + public LuaException( String message ) + { + this( message, 1 ); + } + + public LuaException( String message, int level ) + { + super( message ); + m_level = level; + } + + public int getLevel() + { + return m_level; + } +} diff --git a/src/main/java/dan200/computercraft/api/lua/package-info.java b/src/main/java/dan200/computercraft/api/lua/package-info.java new file mode 100644 index 0000000..3ea3d91 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/lua/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|Lua", apiVersion="1.75" ) +package dan200.computercraft.api.lua; + +import cpw.mods.fml.common.API; diff --git a/src/main/java/dan200/computercraft/api/media/IMedia.java b/src/main/java/dan200/computercraft/api/media/IMedia.java new file mode 100644 index 0000000..57ebc08 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/media/IMedia.java @@ -0,0 +1,59 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.media; + +import dan200.computercraft.api.filesystem.IMount; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Represents an item that can be placed in a disk drive and used by a Computer. + * Implement this interface on your Item class to allow it to be used in the drive. + */ +public interface IMedia +{ + /** + * Get a string representing the label of this item. Will be called vi disk.getLabel() in lua. + * @param stack The itemstack to inspect + * @return The label. ie: "Dan's Programs" + */ + public String getLabel( ItemStack stack ); + + /** + * Set a string representing the label of this item. Will be called vi disk.setLabel() in lua. + * @param stack The itemstack to modify. + * @param label The string to set the label to. + * @return true if the label was updated, false if the label may not be modified. + */ + public boolean setLabel( ItemStack stack, String label ); + + /** + * If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathon Coulton - Still Alive" + * @param stack The itemstack to inspect. + * @return The name, or null if this item does not represent an item with audio. + */ + public String getAudioTitle( ItemStack stack ); + + /** + * If this disk represents an item with audio (like a record), get the resource name of the audio track to play. + * @param stack The itemstack to inspect. + * @return The name, or null if this item does not represent an item with audio. + */ + public String getAudioRecordName( ItemStack stack ); + + /** + * If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will be mounted onto the filesystem of the computercraft while the media is in the disk drive. + * @param stack The itemstack to inspect. + * @param world The world in which the item and disk drive reside. + * @return The mount, or null if this item does not represent an item with data. If the IMount returned also implements IWritableMount, it will mounted using mountWritable() + * @see dan200.computercraft.api.filesystem.IMount + * @see dan200.computercraft.api.filesystem.IWritableMount + * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String, long) + * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) + */ + public IMount createDataMount( ItemStack stack, World world ); +} diff --git a/src/main/java/dan200/computercraft/api/media/IMediaProvider.java b/src/main/java/dan200/computercraft/api/media/IMediaProvider.java new file mode 100644 index 0000000..c0aabd5 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/media/IMediaProvider.java @@ -0,0 +1,23 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.media; + +import net.minecraft.item.ItemStack; + +/** + * This interface is used to provide IMedia implementations for ItemStack + * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider) + */ +public interface IMediaProvider +{ + /** + * Produce an IMedia implementation from an ItemStack. + * @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider) + * @return an IMedia implementation, or null if the item is not something you wish to handle + */ + public IMedia getMedia( ItemStack stack ); +} diff --git a/src/main/java/dan200/computercraft/api/media/package-info.java b/src/main/java/dan200/computercraft/api/media/package-info.java new file mode 100644 index 0000000..9e2f507 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/media/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|Media", apiVersion="1.75" ) +package dan200.computercraft.api.media; + +import cpw.mods.fml.common.API; diff --git a/src/main/java/dan200/computercraft/api/package-info.java b/src/main/java/dan200/computercraft/api/package-info.java new file mode 100644 index 0000000..f3a706a --- /dev/null +++ b/src/main/java/dan200/computercraft/api/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API", apiVersion="1.75" ) +package dan200.computercraft.api; + +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/dan200/computercraft/api/peripheral/IComputerAccess.java b/src/main/java/dan200/computercraft/api/peripheral/IComputerAccess.java new file mode 100644 index 0000000..2458c06 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/peripheral/IComputerAccess.java @@ -0,0 +1,102 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.peripheral; + +import dan200.computercraft.api.filesystem.IMount; +import dan200.computercraft.api.filesystem.IWritableMount; + +/** + * The interface passed to peripherals by computers or turtles, providing methods + * that they can call. This should not be implemented by your classes. Do not interact + * with computers except via this interface. + */ +public interface IComputerAccess +{ + /** + * Mount a mount onto the computers' file system in a read only mode.
+ * @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted. + * @param mount The mount object to mount on the computercraft. These can be obtained by calling ComputerCraftAPI.createSaveDirMount(), ComputerCraftAPI.createResourceMount() or by creating your own objects that implement the IMount interface. + * @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later. + * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) + * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) + * @see #mountWritable(String, dan200.computercraft.api.filesystem.IWritableMount) + * @see #unmount(String) + * @see dan200.computercraft.api.filesystem.IMount + */ + public String mount( String desiredLocation, IMount mount ); + + /** + * TODO: Document me + */ + public String mount( String desiredLocation, IMount mount, String driveName ); + + /** + * Mount a mount onto the computers' file system in a writable mode.
+ * @param desiredLocation The location on the computercraft's file system where you would like the mount to be mounted. + * @param mount The mount object to mount on the computercraft. These can be obtained by calling ComputerCraftAPI.createSaveDirMount() or by creating your own objects that implement the IWritableMount interface. + * @return The location on the computercraft's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later. + * @see dan200.computercraft.api.ComputerCraftAPI#createSaveDirMount(World, String) + * @see dan200.computercraft.api.ComputerCraftAPI#createResourceMount(Class, String, String) + * @see #mount(String, IMount) + * @see #unmount(String) + * @see IMount + */ + public String mountWritable( String desiredLocation, IWritableMount mount ); + + /** + * TODO: Document me + */ + public String mountWritable( String desiredLocation, IWritableMount mount, String driveName ); + + /** + * Unmounts a directory previously mounted onto the computers file system by mount() or mountWritable().
+ * When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to + * access it. All directories mounted by a mount or mountWritable are automatically unmounted when the peripheral + * is attached if they have not been explicitly unmounted. + * @param location The desired location in the computers file system of the directory to unmount. + * This must be the location of a directory previously mounted by mount() or mountWritable(), as + * indicated by their return value. + * @see #mount(String, IMount) + * @see #mountWritable(String, IWritableMount) + */ + public void unmount( String location ); + + /** + * Returns the numerical ID of this computercraft.
+ * This is the same number obtained by calling os.getComputerID() or running the "id" program from lua, + * and is guarunteed unique. This number will be positive. + * @return The identifier. + */ + public int getID(); + + /** + * Causes an event to be raised on this computercraft, which the computercraft can respond to by calling + * os.pullEvent(). This can be used to notify the computercraft when things happen in the world or to + * this peripheral. + * @param event A string identifying the type of event that has occurred, this will be + * returned as the first value from os.pullEvent(). It is recommended that you + * you choose a name that is unique, and recognisable as originating from your + * peripheral. eg: If your peripheral type is "button", a suitable event would be + * "button_pressed". + * @param arguments In addition to a name, you may pass an array of extra arguments to the event, that will + * be supplied as extra return values to os.pullEvent(). Objects in the array will be converted + * to lua data types in the same fashion as the return values of IPeripheral.callMethod().
+ * You may supply null to indicate that no arguments are to be supplied. + * @see dan200.computercraft.api.peripheral.IPeripheral#callMethod + */ + public void queueEvent( String event, Object[] arguments ); + + /** + * Get a string, unique to the computercraft, by which the computercraft refers to this peripheral. + * For directly attached peripherals this will be "left","right","front","back",etc, but + * for peripherals attached remotely it will be different. It is good practice to supply + * this string when raising events to the computercraft, so that the computercraft knows from + * which peripheral the event came. + * @return A string unique to the computercraft, but not globally. + */ + public String getAttachmentName(); +} diff --git a/src/main/java/dan200/computercraft/api/peripheral/IPeripheral.java b/src/main/java/dan200/computercraft/api/peripheral/IPeripheral.java new file mode 100644 index 0000000..a28d656 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/peripheral/IPeripheral.java @@ -0,0 +1,100 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.peripheral; + +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.lua.LuaException; + +/** + * The interface that defines a peripheral. This should be implemented by the + * TileEntity of any common that you wish to be interacted with by + * computercraft or turtle. + */ +public interface IPeripheral +{ + /** + * Should return a string that uniquely identifies this type of peripheral. + * This can be queried from lua by calling peripheral.getType() + * @return A string identifying the type of peripheral. + */ + public String getType(); + + /** + * Should return an array of strings that identify the methods that this + * peripheral exposes to Lua. This will be called once before each attachment, + * and should not change when called multiple times. + * @return An array of strings representing method names. + * @see #callMethod + */ + public String[] getMethodNames(); + + /** + * This is called when a lua program on an attached computercraft calls peripheral.call() with + * one of the methods exposed by getMethodNames().
+ *
+ * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe + * when interacting with minecraft objects. + * @param computer The interface to the computercraft that is making the call. Remember that multiple + * computers can be attached to a peripheral at once. + * @param context The context of the currently running lua thread. This can be used to wait for events + * or otherwise yield. + * @param method An integer identifying which of the methods from getMethodNames() the computercraft + * wishes to call. The integer indicates the index into the getMethodNames() table + * that corresponds to the string passed into peripheral.call() + * @param arguments An array of objects, representing the arguments passed into peripheral.call().
+ * Lua values of type "string" will be represented by Object type String.
+ * Lua values of type "number" will be represented by Object type Double.
+ * Lua values of type "boolean" will be represented by Object type Boolean.
+ * Lua values of any other type will be represented by a null object.
+ * This array will be empty if no arguments are passed. + * @return An array of objects, representing values you wish to return to the lua program.
+ * Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
+ * All other types will be converted to nil.
+ * You may return null to indicate no values should be returned. + * @throws Exception If you throw any exception from this function, a lua error will be raised with the + * same message as your exception. Use this to throw appropriate errors if the wrong + * arguments are supplied to your method. + * @see #getMethodNames + */ + public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException; + + /** + * Is called when canAttachToSide has returned true, and a computercraft is attaching to the peripheral. + * This will occur when a peripheral is placed next to an active computercraft, when a computercraft is turned on next to a peripheral, + * or when a turtle travels into a square next to a peripheral. + * Between calls to attach() and detach(), the attached computercraft can make method calls on the peripheral using peripheral.call(). + * This method can be used to keep track of which computers are attached to the peripheral, or to take action when attachment + * occurs.
+ *
+ * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe + * when interacting with minecraft objects. + * @param computer The interface to the computercraft that is being attached. Remember that multiple + * computers can be attached to a peripheral at once. + * @see #detach + */ + public void attach( IComputerAccess computer ); + + /** + * Is called when a computercraft is detaching from the peripheral. + * This will occur when a computercraft shuts down, when the peripheral is removed while attached to computers, + * or when a turtle moves away from a square attached to a peripheral. + * This method can be used to keep track of which computers are attached to the peripheral, or to take action when detachment + * occurs.
+ *
+ * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe + * when interacting with minecraft objects. + * @param computer The interface to the computercraft that is being detached. Remember that multiple + * computers can be attached to a peripheral at once. + * @see #detach + */ + public void detach( IComputerAccess computer ); + + /** + * TODO: Document me + */ + public boolean equals( IPeripheral other ); +} diff --git a/src/main/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java b/src/main/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java new file mode 100644 index 0000000..a2775f9 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java @@ -0,0 +1,23 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.peripheral; + +import net.minecraft.world.World; + +/** + * This interface is used to create peripheral implementations for blocks + * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider) + */ +public interface IPeripheralProvider +{ + /** + * Produce an peripheral implementation from a block location. + * @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider) + * @return a peripheral, or null if there is not a peripheral here you'd like to handle. + */ + public IPeripheral getPeripheral( World world, int x, int y, int z, int side ); +} diff --git a/src/main/java/dan200/computercraft/api/peripheral/package-info.java b/src/main/java/dan200/computercraft/api/peripheral/package-info.java new file mode 100644 index 0000000..10ea4da --- /dev/null +++ b/src/main/java/dan200/computercraft/api/peripheral/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|Peripheral", apiVersion="1.75" ) +package dan200.computercraft.api.peripheral; + +import cpw.mods.fml.common.API; diff --git a/src/main/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java b/src/main/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java new file mode 100644 index 0000000..476b4fc --- /dev/null +++ b/src/main/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java @@ -0,0 +1,19 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.permissions; + +import net.minecraft.world.World; + +/** + * This interface is used to restrict where turtles can move or build + * @see dan200.computercraft.api.ComputerCraftAPI#registerPermissionProvider(ITurtlePermissionProvider) + */ +public interface ITurtlePermissionProvider +{ + public boolean isBlockEnterable( World world, int x, int y, int z ); + public boolean isBlockEditable( World world, int x, int y, int z ); +} diff --git a/src/main/java/dan200/computercraft/api/permissions/package-info.java b/src/main/java/dan200/computercraft/api/permissions/package-info.java new file mode 100644 index 0000000..a51e7ec --- /dev/null +++ b/src/main/java/dan200/computercraft/api/permissions/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|Permissions", apiVersion="1.75" ) +package dan200.computercraft.api.permissions; + +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java b/src/main/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java new file mode 100644 index 0000000..b85f2ef --- /dev/null +++ b/src/main/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java @@ -0,0 +1,23 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.redstone; + +import net.minecraft.world.World; + +/** + * This interface is used to provide bundled redstone output for blocks + * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider) + */ +public interface IBundledRedstoneProvider +{ + /** + * Produce an bundled redstone output from a block location. + * @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider) + * @return a number in the range 0-65535 to indicate this block is providing output, or -1 if you do not wish to handle this block + */ + public int getBundledRedstoneOutput( World world, int x, int y, int z, int side ); +} diff --git a/src/main/java/dan200/computercraft/api/redstone/package-info.java b/src/main/java/dan200/computercraft/api/redstone/package-info.java new file mode 100644 index 0000000..e01c623 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/redstone/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|Redstone", apiVersion="1.75" ) +package dan200.computercraft.api.redstone; + +import cpw.mods.fml.common.API; diff --git a/src/main/java/dan200/computercraft/api/turtle/ITurtleAccess.java b/src/main/java/dan200/computercraft/api/turtle/ITurtleAccess.java new file mode 100644 index 0000000..96c6159 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/ITurtleAccess.java @@ -0,0 +1,168 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.lua.LuaException; +import dan200.computercraft.api.peripheral.IPeripheral; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +/** + * The interface passed to turtle by turtles, providing methods that they can call. + * This should not be implemented by your classes. Do not interact with turtles except via this interface and ITurtleUpgrade. + */ +public interface ITurtleAccess +{ + /** + * Returns the world in which the turtle resides. + * @return the world in which the turtle resides. + */ + public World getWorld(); + + /** + * Returns a vector containing the integer co-ordinates at which the turtle resides. + * @return a vector containing the integer co-ordinates at which the turtle resides. + */ + public ChunkCoordinates getPosition(); + + /** + * TODO: Document me + */ + public boolean teleportTo( World world, int x, int y, int z ); + + /** + * Returns a vector containing the floating point co-ordinates at which the turtle is rendered. + * This will shift when the turtle is moving. + * @param f The subframe fraction + * @return a vector containing the floating point co-ordinates at which the turtle resides. + */ + public Vec3 getVisualPosition( float f ); + + /** + * TODO: Document me + */ + public float getVisualYaw( float f ); + + /** + * Returns the world direction the turtle is currently facing. + * @return the world direction the turtle is currently facing. + */ + public int getDirection(); + + /** + * TODO: Document me + */ + public void setDirection( int dir ); + + /** + * TODO: Document me + */ + public int getSelectedSlot(); + + /** + * TODO: Document me + */ + public void setSelectedSlot( int slot ); + + /** + * Sets the colour of the turtle, as if the player had dyed it with a dye item. + * @param dyeColour 0-15 to dye the turtle one of the 16 standard minecraft colours, or -1 to remove the dye from the turtle. + */ + public void setDyeColour( int dyeColour ); + + /** + * Gets the colour the turtle has been dyed. + * @return 0-15 if the turtle has been dyed one of the 16 standard minecraft colours, -1 if the turtle is clean. + */ + public int getDyeColour(); + + /** + * TODO: Document me + */ + public IInventory getInventory(); + + /** + * TODO: Document me + */ + public boolean isFuelNeeded(); + + /** + * TODO: Document me + */ + public int getFuelLevel(); + + /** + * TODO: Document me + */ + public void setFuelLevel( int fuel ); + + /** + * TODO: Document me + */ + public int getFuelLimit(); + + /** + * Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle. + * @return Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number + * greater than the current fuel level of the turtle. + */ + public boolean consumeFuel( int fuel ); + + /** + * TODO: Document me + */ + public void addFuel( int fuel ); + + /** + * Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed + * on the main thread, so are guaranteed to be able to access Minecraft objects safely, and will be queued up + * with the turtles standard movement and tool commands. An issued command will return an unique integer, which will + * be supplied as a parameter to a "turtle_response" event issued to the turtle after the command has completed. Look at the + * lua source code for "rom/apis/turtle" for how to build a lua wrapper around this functionality. + * @param command an object which will execute the custom command when its point in the queue is reached + * @return the objects the command returned when executed. you should probably return these to the player + * unchanged if called from a peripheral method. + * @see ITurtleCommand + */ + public Object[] executeCommand( ILuaContext context, ITurtleCommand command ) throws LuaException, InterruptedException; + + /** + * TODO: Document me + */ + public void playAnimation( TurtleAnimation animation ); + + /** + * Returns the turtle on the specified side of the turtle, if there is one. + * @return the turtle on the specified side of the turtle, if there is one. + */ + public ITurtleUpgrade getUpgrade( TurtleSide side ); + + /** + * TODO: Document me + */ + public void setUpgrade( TurtleSide side, ITurtleUpgrade upgrade ); + + /** + * Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one. + * @return the peripheral created by the upgrade on the specified side of the turtle, if there is one. + */ + public IPeripheral getPeripheral( TurtleSide side ); + + /** + * TODO: Document me + */ + public NBTTagCompound getUpgradeNBTData( TurtleSide side ); + + /** + * TODO: Document me + */ + public void updateUpgradeNBTData( TurtleSide side ); +} diff --git a/src/main/java/dan200/computercraft/api/turtle/ITurtleCommand.java b/src/main/java/dan200/computercraft/api/turtle/ITurtleCommand.java new file mode 100644 index 0000000..17d113e --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/ITurtleCommand.java @@ -0,0 +1,25 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +/** + * An interface for objects executing custom turtle commands, used with ITurtleAccess.issueCommand + * @see ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext,ITurtleCommand) + */ +public interface ITurtleCommand +{ + /** + * Will be called by the turtle on the main thread when it is time to execute the custom command. + * The handler should either perform the work of the command, and return success, or return + * failure with an error message to indicate the command cannot be executed at this time. + * @param turtle access to the turtle for whom the command was issued + * @return TurtleCommandResult.success() or TurtleCommandResult.failure( errorMessage ) + * @see ITurtleAccess#executeCommand(dan200.computercraft.api.lua.ILuaContext,ITurtleCommand) + * @see dan200.computercraft.api.turtle.TurtleCommandResult + */ + public TurtleCommandResult execute( ITurtleAccess turtle ); +} diff --git a/src/main/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java b/src/main/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java new file mode 100644 index 0000000..0dcc6e6 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java @@ -0,0 +1,94 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +import dan200.computercraft.api.peripheral.IPeripheral; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +/** + * The primary interface for defining an turtle for Turtles. A turtle turtle + * can either be a new tool, or a new peripheral. + * @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( dan200.computercraft.api.turtle.ITurtleUpgrade ) + */ +public interface ITurtleUpgrade +{ + /** + * Gets a unique numerical identifier representing this type of turtle turtle. + * Like Minecraft common and item IDs, you should strive to make this number unique + * among all turtle turtle that have been released for ComputerCraft. + * The ID must be in the range 64 to 255, as the ID is stored as an 8-bit value, + * and 0-64 is reserved for future use by ComputerCraft. The turtle will + * fail registration if an already used ID is specified. + * @see dan200.computercraft.api.ComputerCraftAPI#registerTurtleUpgrade( dan200.computercraft.api.turtle.ITurtleUpgrade ) + */ + public int getUpgradeID(); + + /** + * Return a String to describe this type of turtle in turtle item names. + * Examples of built-in adjectives are "Wireless", "Mining" and "Crafty". + */ + public String getUnlocalisedAdjective(); + + /** + * Return whether this turtle adds a tool or a peripheral to the turtle. + * Currently, turtle crafting is restricted to one tool & one peripheral per turtle. + * @see TurtleUpgradeType for the differences between the two. + */ + public TurtleUpgradeType getType(); + + /** + * Return an item stack representing the type of item that a turtle must be crafted + * with to create a turtle which holds this turtle. + * Currently, turtle crafting is restricted to one tool & one peripheral per turtle. + */ + public ItemStack getCraftingItem(); + + /** + * Will only be called for Peripheral turtle. Creates a peripheral for a turtle + * being placed using this turtle. The peripheral created will be stored + * for the lifetime of the turtle, will have update() called once-per-tick, and will be + * attach'd detach'd and have methods called in the same manner as a Computer peripheral. + * + * @param turtle Access to the turtle that the peripheral is being created for. + * @param side Which side of the turtle (left or right) that the turtle resides on. + * @return The newly created peripheral. You may return null if this turtle is a Tool + * and this method is not expected to be called. + */ + public IPeripheral createPeripheral( ITurtleAccess turtle, TurtleSide side ); + + /** + * Will only be called for Tool turtle. Called when turtle.dig() or turtle.attack() is called + * by the turtle, and the tool is required to do some work. + * @param turtle Access to the turtle that the tool resides on. + * @param side Which side of the turtle (left or right) the tool resides on. + * @param verb Which action (dig or attack) the turtle is being called on to perform. + * @param direction Which world direction the action should be performed in, relative to the turtles + * position. This will either be up, down, or the direction the turtle is facing, depending on + * whether dig, digUp or digDown was called. + * @return Whether the turtle was able to perform the action, and hence whether the turtle.dig() + * or turtle.attack() lua method should return true. If true is returned, the tool will perform + * a swinging animation. You may return null if this turtle is a Peripheral + * and this method is not expected to be called. + */ + public TurtleCommandResult useTool( ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction ); + + /** + * Called to obtain the IIcon to be used when rendering a turtle peripheral. Needs to be a "common" + * type IIcon for now, as there is no way to determine which texture sheet an IIcon is from by the + * IIcon itself. + * @param turtle Access to the turtle that the peripheral resides on. + * @param side Which side of the turtle (left or right) the peripheral resides on. + * @return The IIcon that you wish to be used to render your turtle peripheral. + */ + public IIcon getIcon( ITurtleAccess turtle, TurtleSide side ); + + /** + * TODO: Document me + */ + public void update( ITurtleAccess turtle, TurtleSide side ); +} diff --git a/src/main/java/dan200/computercraft/api/turtle/TurtleAnimation.java b/src/main/java/dan200/computercraft/api/turtle/TurtleAnimation.java new file mode 100644 index 0000000..abb4134 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/TurtleAnimation.java @@ -0,0 +1,22 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +public enum TurtleAnimation +{ + None, + MoveForward, + MoveBack, + MoveUp, + MoveDown, + TurnLeft, + TurnRight, + SwingLeftTool, + SwingRightTool, + Wait, + ShortWait, +} diff --git a/src/main/java/dan200/computercraft/api/turtle/TurtleCommandResult.java b/src/main/java/dan200/computercraft/api/turtle/TurtleCommandResult.java new file mode 100644 index 0000000..67046bd --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/TurtleCommandResult.java @@ -0,0 +1,73 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +public final class TurtleCommandResult +{ + private static final TurtleCommandResult s_success = new TurtleCommandResult( true, null, null ); + private static final TurtleCommandResult s_emptyFailure = new TurtleCommandResult( false, null, null ); + + public static TurtleCommandResult success() + { + return success( null ); + } + + public static TurtleCommandResult success( Object[] results ) + { + if( results == null || results.length == 0 ) + { + return s_success; + } + else + { + return new TurtleCommandResult( true, null, results ); + } + } + + public static TurtleCommandResult failure() + { + return failure( null ); + } + + public static TurtleCommandResult failure( String errorMessage ) + { + if( errorMessage == null ) + { + return s_emptyFailure; + } + else + { + return new TurtleCommandResult( false, errorMessage, null ); + } + } + + private final boolean m_success; + private final String m_errorMessage; + private final Object[] m_results; + + private TurtleCommandResult( boolean success, String errorMessage, Object[] results ) + { + m_success = success; + m_errorMessage = errorMessage; + m_results = results; + } + + public boolean isSuccess() + { + return m_success; + } + + public String getErrorMessage() + { + return m_errorMessage; + } + + public Object[] getResults() + { + return m_results; + } +} diff --git a/src/main/java/dan200/computercraft/api/turtle/TurtleSide.java b/src/main/java/dan200/computercraft/api/turtle/TurtleSide.java new file mode 100644 index 0000000..5fc7c61 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/TurtleSide.java @@ -0,0 +1,23 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +/** + * An enum representing the two sides of the turtle that a turtle turtle might reside. + */ +public enum TurtleSide +{ + /** + * The turtles left side (where the pickaxe usually is on a Wireless Mining Turtle) + */ + Left, + + /** + * The turtles right side (where the modem usually is on a Wireless Mining Turtle) + */ + Right, +} diff --git a/src/main/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java b/src/main/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java new file mode 100644 index 0000000..e5fd1af --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/TurtleUpgradeType.java @@ -0,0 +1,27 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +/** + * An enum representing the two different types of turtle that an ITurtleUpgrade + * implementation can add to a turtle. + * @see ITurtleUpgrade + */ +public enum TurtleUpgradeType +{ + /** + * A tool is rendered as an item on the side of the turtle, and responds to the turtle.dig() + * and turtle.attack() methods (Such as pickaxe or sword on Mining and Melee turtles). + */ + Tool, + + /** + * A peripheral adds a special peripheral which is attached to the side of the turtle, + * and can be interacted with the peripheral API (Such as the modem on Wireless Turtles). + */ + Peripheral, +} diff --git a/src/main/java/dan200/computercraft/api/turtle/TurtleVerb.java b/src/main/java/dan200/computercraft/api/turtle/TurtleVerb.java new file mode 100644 index 0000000..566fa48 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/TurtleVerb.java @@ -0,0 +1,26 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +package dan200.computercraft.api.turtle; + +/** + * An enum representing the two different actions that an ITurtleUpgrade of type + * Tool may be called on to perform by a turtle. + * @see ITurtleUpgrade + * @see ITurtleUpgrade#useTool + */ +public enum TurtleVerb +{ + /** + * The turtle called turtle.dig(), turtle.digUp() or turtle.digDown() + */ + Dig, + + /** + * The turtle called turtle.attack(), turtle.attackUp() or turtle.attackDown() + */ + Attack, +} diff --git a/src/main/java/dan200/computercraft/api/turtle/package-info.java b/src/main/java/dan200/computercraft/api/turtle/package-info.java new file mode 100644 index 0000000..7825971 --- /dev/null +++ b/src/main/java/dan200/computercraft/api/turtle/package-info.java @@ -0,0 +1,10 @@ +/** + * This file is part of the public ComputerCraft API - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2015. This API may be redistributed unmodified and in full only. + * For help using the API, and posting your mods, visit the forums at computercraft.info. + */ + +@API( owner="ComputerCraft", provides="ComputerCraft|API|Turtle", apiVersion="1.75" ) +package dan200.computercraft.api.turtle; + +import cpw.mods.fml.common.API; diff --git a/src/main/java/icbm/api/IAmmunition.java b/src/main/java/icbm/api/IAmmunition.java new file mode 100644 index 0000000..34b3071 --- /dev/null +++ b/src/main/java/icbm/api/IAmmunition.java @@ -0,0 +1,10 @@ +package icbm.api; + +import net.minecraft.item.ItemStack; + +public interface IAmmunition { + + boolean hasAmmunition(ItemStack var1); + + boolean useAmmunition(ItemStack var1); +} diff --git a/src/main/java/icbm/api/IBlockFrequency.java b/src/main/java/icbm/api/IBlockFrequency.java new file mode 100644 index 0000000..d831270 --- /dev/null +++ b/src/main/java/icbm/api/IBlockFrequency.java @@ -0,0 +1,9 @@ +package icbm.api; + + +public interface IBlockFrequency { + + int getFrequency(); + + void setFrequency(int var1); +} diff --git a/src/main/java/icbm/api/ICBM.java b/src/main/java/icbm/api/ICBM.java new file mode 100644 index 0000000..5e8e014 --- /dev/null +++ b/src/main/java/icbm/api/ICBM.java @@ -0,0 +1,41 @@ +package icbm.api; + +import icbm.api.explosion.IExplosive; +import java.lang.reflect.Method; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; + +public class ICBM { + + public static final String NAME = "ICBM"; + public static final String VERSION = "1.1.1"; + public static final int BLOCK_ID_PREFIX = 3880; + public static final int ITEM_ID_PREFIX = 3900; + public static Class explosionManager; + + + public static void createExplosion(World worldObj, double x, double y, double z, Entity entity, int explosiveID) { + try { + Method e = explosionManager.getMethod("createExplosion", new Class[]{World.class, Double.class, Double.class, Double.class, Entity.class, Integer.class}); + e.invoke((Object)null, new Object[]{worldObj, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z), entity, Integer.valueOf(explosiveID)}); + } catch (Exception var10) { + System.out.println("ICBM: Failed to create an ICBM explosion with the ID: " + explosiveID); + var10.printStackTrace(); + } + + } + + public static IExplosive getExplosive(String name) { + if(name != null) { + try { + Method e = explosionManager.getMethod("getExplosiveByName", new Class[]{String.class}); + return (IExplosive)e.invoke((Object)null, new Object[]{name}); + } catch (Exception var2) { + System.out.println("ICBM: Failed to get explosive with the name: " + name); + var2.printStackTrace(); + } + } + + return null; + } +} diff --git a/src/main/java/icbm/api/ICBMFlags.java b/src/main/java/icbm/api/ICBMFlags.java new file mode 100644 index 0000000..5ee39df --- /dev/null +++ b/src/main/java/icbm/api/ICBMFlags.java @@ -0,0 +1,11 @@ +package icbm.api; + +import universalelectricity.prefab.flag.FlagRegistry; + +public class ICBMFlags { + public static final String FLAG_BAN_GLOBAL = FlagRegistry.registerFlag("ban_icbm"); + public static final String FLAG_BAN_EXPLOSIVE = FlagRegistry.registerFlag("ban_explosive"); + public static final String FLAG_BAN_GRENADE = FlagRegistry.registerFlag("ban_grenade"); + public static final String FLAG_BAN_MISSILE = FlagRegistry.registerFlag("ban_missile"); + public static final String FLAG_BAN_MINECART = FlagRegistry.registerFlag("ban_minecart"); +} diff --git a/src/main/java/icbm/api/ICamouflageMaterial.java b/src/main/java/icbm/api/ICamouflageMaterial.java new file mode 100644 index 0000000..d47aebb --- /dev/null +++ b/src/main/java/icbm/api/ICamouflageMaterial.java @@ -0,0 +1,5 @@ +package icbm.api; + + +public interface ICamouflageMaterial { +} diff --git a/src/main/java/icbm/api/IHackable.java b/src/main/java/icbm/api/IHackable.java new file mode 100644 index 0000000..63d4909 --- /dev/null +++ b/src/main/java/icbm/api/IHackable.java @@ -0,0 +1,10 @@ +package icbm.api; + +import net.minecraft.entity.player.EntityPlayer; + +public interface IHackable { + + void generateNewKey(); + + boolean tryForAccess(EntityPlayer var1, String var2); +} diff --git a/src/main/java/icbm/api/IItemFrequency.java b/src/main/java/icbm/api/IItemFrequency.java new file mode 100644 index 0000000..3ac4618 --- /dev/null +++ b/src/main/java/icbm/api/IItemFrequency.java @@ -0,0 +1,10 @@ +package icbm.api; + +import net.minecraft.item.ItemStack; + +public interface IItemFrequency { + + int getFrequency(ItemStack var1); + + void setFrequency(int var1, ItemStack var2); +} diff --git a/src/main/java/icbm/api/ILauncherContainer.java b/src/main/java/icbm/api/ILauncherContainer.java new file mode 100644 index 0000000..a462a3b --- /dev/null +++ b/src/main/java/icbm/api/ILauncherContainer.java @@ -0,0 +1,13 @@ +package icbm.api; + +import icbm.api.ILauncherController; +import icbm.api.IMissile; + +public interface ILauncherContainer { + + IMissile getContainingMissile(); + + void setContainingMissile(IMissile var1); + + ILauncherController getController(); +} diff --git a/src/main/java/icbm/api/ILauncherController.java b/src/main/java/icbm/api/ILauncherController.java new file mode 100644 index 0000000..cdb9bb0 --- /dev/null +++ b/src/main/java/icbm/api/ILauncherController.java @@ -0,0 +1,28 @@ +package icbm.api; + +import icbm.api.IBlockFrequency; +import icbm.api.IMissile; +import icbm.api.LauncherType; +import net.minecraft.item.ItemStack; +import universalelectricity.core.block.IElectricityStorage; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRedstoneReceptor; + +public interface ILauncherController extends IElectricityStorage, IRedstoneReceptor, IBlockFrequency { + + LauncherType getLauncherType(); + + void launch(); + + boolean canLaunch(); + + String getStatus(); + + Vector3 getTarget(); + + void setTarget(Vector3 var1); + + void placeMissile(ItemStack var1); + + IMissile getMissile(); +} diff --git a/src/main/java/icbm/api/IMissile.java b/src/main/java/icbm/api/IMissile.java new file mode 100644 index 0000000..6ea09cd --- /dev/null +++ b/src/main/java/icbm/api/IMissile.java @@ -0,0 +1,26 @@ +package icbm.api; + +import icbm.api.ILauncherContainer; +import icbm.api.explosion.IExplosiveContainer; +import universalelectricity.core.vector.Vector3; + +public interface IMissile extends IExplosiveContainer { + + void explode(); + + void setExplode(); + + void normalExplode(); + + void setNormalExplode(); + + void dropMissileAsItem(); + + int getTicksInAir(); + + ILauncherContainer getLauncher(); + + void launch(Vector3 var1); + + void launch(Vector3 var1, int var2); +} diff --git a/src/main/java/icbm/api/IMissileLockable.java b/src/main/java/icbm/api/IMissileLockable.java new file mode 100644 index 0000000..4474c02 --- /dev/null +++ b/src/main/java/icbm/api/IMissileLockable.java @@ -0,0 +1,11 @@ +package icbm.api; + +import icbm.api.IMissile; +import universalelectricity.core.vector.Vector3; + +public interface IMissileLockable { + + boolean canLock(IMissile var1); + + Vector3 getPredictedPosition(int var1); +} diff --git a/src/main/java/icbm/api/ITracker.java b/src/main/java/icbm/api/ITracker.java new file mode 100644 index 0000000..a3a8b6d --- /dev/null +++ b/src/main/java/icbm/api/ITracker.java @@ -0,0 +1,11 @@ +package icbm.api; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface ITracker { + void setTrackingEntity(final ItemStack p0, final Entity p1); + + Entity getTrackingEntity(final World p0, final ItemStack p1); +} diff --git a/src/main/java/icbm/api/LauncherType.java b/src/main/java/icbm/api/LauncherType.java new file mode 100644 index 0000000..1c8d1c3 --- /dev/null +++ b/src/main/java/icbm/api/LauncherType.java @@ -0,0 +1,14 @@ +package icbm.api; + + +public enum LauncherType { + + TRADITIONAL("TRADITIONAL", 0), + CRUISE("CRUISE", 1); + // $FF: synthetic field + private static final LauncherType[] $VALUES = new LauncherType[]{TRADITIONAL, CRUISE}; + + + private LauncherType(String var1, int var2) {} + +} diff --git a/src/main/java/icbm/api/RadarRegistry.java b/src/main/java/icbm/api/RadarRegistry.java new file mode 100644 index 0000000..83b2bb9 --- /dev/null +++ b/src/main/java/icbm/api/RadarRegistry.java @@ -0,0 +1,110 @@ +package icbm.api; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import universalelectricity.core.vector.Vector2; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.vector.Region2; + +public class RadarRegistry { + private static Set detectableTileEntities = new HashSet<>(); + private static Set detectableEntities = new HashSet<>(); + + public static void register(TileEntity tileEntity) { + if (!detectableTileEntities.contains(tileEntity)) { + detectableTileEntities.add(tileEntity); + } + } + + public static void unregister(TileEntity tileEntity) { + if (detectableTileEntities.contains(tileEntity)) { + detectableTileEntities.remove(tileEntity); + } + } + + public static void register(Entity entity) { + if (!detectableEntities.contains(entity)) { + detectableEntities.add(entity); + } + } + + public static void unregister(Entity entity) { + if (detectableEntities.contains(entity)) { + detectableEntities.remove(entity); + } + } + + public static List getTileEntitiesInArea(Vector2 minVector, + Vector2 maxVector) { + ArrayList returnArray = new ArrayList<>(); + cleanUpArray(); + for (TileEntity tileEntity : detectableTileEntities) { + if ((new Region2(minVector, maxVector)) + .isIn((new Vector3(tileEntity)).toVector2())) { + returnArray.add(tileEntity); + } + } + + return returnArray; + } + + public static List getEntitiesWithinRadius(Vector2 vector, + int radius) { + cleanUpArray(); + ArrayList returnArray = new ArrayList<>(); + for (Entity entity : detectableEntities) { + if (Vector2.distance(vector, (new Vector3(entity)).toVector2()) <= + (double)radius) { + returnArray.add(entity); + } + } + + return returnArray; + } + + public static Set getTileEntities() { + cleanUpArray(); + return detectableTileEntities; + } + + public static Set getEntities() { + cleanUpArray(); + return detectableEntities; + } + + public static void cleanUpArray() { + try { + Iterator e = detectableTileEntities.iterator(); + + while (e.hasNext()) { + TileEntity it2 = e.next(); + if (it2 == null) { + e.remove(); + } else if (it2.isInvalid()) { + e.remove(); + } else if (it2.getWorldObj().getTileEntity(it2.xCoord, it2.yCoord, + it2.zCoord) != it2) { + e.remove(); + } + } + + Iterator it21 = detectableEntities.iterator(); + while (it21.hasNext()) { + Entity entity = (Entity)it21.next(); + if (entity == null) { + it21.remove(); + } else if (entity.isDead) { + it21.remove(); + } + } + } catch (Exception var3) { + System.out.println("Failed to clean up radar list properly."); + var3.printStackTrace(); + } + } +} diff --git a/src/main/java/icbm/api/explosion/ExplosionEvent.java b/src/main/java/icbm/api/explosion/ExplosionEvent.java new file mode 100644 index 0000000..b3fd936 --- /dev/null +++ b/src/main/java/icbm/api/explosion/ExplosionEvent.java @@ -0,0 +1,36 @@ +package icbm.api.explosion; + +import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.world.World; + +public class ExplosionEvent extends Event { + + public final World world; + public final double x; + public final double y; + public final double z; + public IExplosive explosive; + + + public ExplosionEvent(World world, double x, double y, double z, IExplosive explosive) { + this.world = world; + this.x = x; + this.y = y; + this.z = z; + this.explosive = explosive; + } + + public static class PostExplosionEvent extends ExplosionEvent { + + public PostExplosionEvent(World world, double x, double y, double z, IExplosive explosive) { + super(world, x, y, z, explosive); + } + } + + public static class PreExplosionEvent extends ExplosionEvent { + + public PreExplosionEvent(World world, double x, double y, double z, IExplosive explosive) { + super(world, x, y, z, explosive); + } + } +} diff --git a/src/main/java/icbm/api/explosion/IEMPBlock.java b/src/main/java/icbm/api/explosion/IEMPBlock.java new file mode 100644 index 0000000..c74d838 --- /dev/null +++ b/src/main/java/icbm/api/explosion/IEMPBlock.java @@ -0,0 +1,10 @@ +package icbm.api.explosion; + +import icbm.api.explosion.IExplosive; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public interface IEMPBlock { + + void onEMP(World var1, Vector3 var2, IExplosive var3); +} diff --git a/src/main/java/icbm/api/explosion/IEMPItem.java b/src/main/java/icbm/api/explosion/IEMPItem.java new file mode 100644 index 0000000..32b4e4a --- /dev/null +++ b/src/main/java/icbm/api/explosion/IEMPItem.java @@ -0,0 +1,11 @@ +package icbm.api.explosion; + +import icbm.api.explosion.IExplosive; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import universalelectricity.core.item.IItemElectric; + +public interface IEMPItem extends IItemElectric { + + void onEMP(ItemStack var1, Entity var2, IExplosive var3); +} diff --git a/src/main/java/icbm/api/explosion/IExplosive.java b/src/main/java/icbm/api/explosion/IExplosive.java new file mode 100644 index 0000000..d923615 --- /dev/null +++ b/src/main/java/icbm/api/explosion/IExplosive.java @@ -0,0 +1,23 @@ +package icbm.api.explosion; + + +public interface IExplosive { + + int getID(); + + String getUnlocalizedName(); + + String getExplosiveName(); + + String getGrenadeName(); + + String getMissileName(); + + String getMinecartName(); + + float getRadius(); + + int getTier(); + + double getEnergy(); +} diff --git a/src/main/java/icbm/api/explosion/IExplosiveContainer.java b/src/main/java/icbm/api/explosion/IExplosiveContainer.java new file mode 100644 index 0000000..72f54b6 --- /dev/null +++ b/src/main/java/icbm/api/explosion/IExplosiveContainer.java @@ -0,0 +1,8 @@ +package icbm.api.explosion; + +import icbm.api.explosion.IExplosive; + +public interface IExplosiveContainer { + + IExplosive getExplosiveType(); +} diff --git a/src/main/java/icbm/api/explosion/IExplosiveIgnore.java b/src/main/java/icbm/api/explosion/IExplosiveIgnore.java new file mode 100644 index 0000000..093a592 --- /dev/null +++ b/src/main/java/icbm/api/explosion/IExplosiveIgnore.java @@ -0,0 +1,8 @@ +package icbm.api.explosion; + +import icbm.api.explosion.ExplosionEvent; + +public interface IExplosiveIgnore { + + boolean canIgnore(ExplosionEvent var1); +} diff --git a/src/main/java/icbm/api/sentry/IAATarget.java b/src/main/java/icbm/api/sentry/IAATarget.java new file mode 100644 index 0000000..95ccf40 --- /dev/null +++ b/src/main/java/icbm/api/sentry/IAATarget.java @@ -0,0 +1,13 @@ +// +// Decompiled by Procyon v0.6.0 +// + +package icbm.api.sentry; + +public interface IAATarget { + void destroyCraft(); + + int doDamage(final int p0); + + boolean canBeTargeted(final Object p0); +} diff --git a/src/main/java/icbm/core/BSulfurOre.java b/src/main/java/icbm/core/BSulfurOre.java new file mode 100644 index 0000000..135623d --- /dev/null +++ b/src/main/java/icbm/core/BSulfurOre.java @@ -0,0 +1,38 @@ +package icbm.core; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class BSulfurOre extends Block { + public BSulfurOre() { + super(Material.rock); + this.setBlockName("icbm:oreSulfur"); + this.setHardness(3.0f); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + } + + @Override + public void registerBlockIcons(IIconRegister p_149651_1_) { + this.blockIcon = p_149651_1_.registerIcon("icbm:oreSulfur"); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, + int p_149650_3_) { + return MainBase.itSulfur; + } + + @Override + public int quantityDropped(final Random par1Random) { + return 3 + par1Random.nextInt(3); + } + + @Override + public int quantityDroppedWithBonus(final int par1, final Random par2Random) { + return this.quantityDropped(par2Random) + par2Random.nextInt(par1 + 1); + } +} diff --git a/src/main/java/icbm/core/GenSulfur.java b/src/main/java/icbm/core/GenSulfur.java new file mode 100644 index 0000000..7d6d8cc --- /dev/null +++ b/src/main/java/icbm/core/GenSulfur.java @@ -0,0 +1,97 @@ +package icbm.core; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.ore.OreGenReplace; + +public class GenSulfur extends OreGenReplace { + public GenSulfur(final String name, final String oreDiectionaryName, + final ItemStack stack, final Block replaceID, + final int minGenerateLevel, final int maxGenerateLevel, + final int amountPerChunk, final int amountPerBranch, + final String harvestTool, final int harvestLevel) { + super(name, oreDiectionaryName, stack, replaceID, minGenerateLevel, + maxGenerateLevel, amountPerChunk, amountPerBranch, harvestTool, + harvestLevel); + } + + public GenSulfur(final String name, final String oreDiectionaryName, + final ItemStack stack, final Block replaceID, + final int maxGenerateLevel, final int amountPerChunk, + final int amountPerBranch) { + this(name, oreDiectionaryName, stack, replaceID, 0, maxGenerateLevel, + amountPerChunk, amountPerBranch, "pickaxe", 1); + } + + @Override + public void generate(final World world, final Random random, final int varX, + final int varZ) { + for (int y = super.minGenerateLevel; y < super.maxGenerateLevel; ++y) { + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + this.generateReplace(world, random, varX + x, y, varZ + z); + } + } + } + } + + @Override + public boolean generateReplace(final World world, final Random rand, + final int x, final int y, final int z) { + if (this.nearLava(world, x, y, z)) { + this.placeOre(world, rand, x, y, z); + return true; + } + return false; + } + + private void placeOre(final World world, final Random rand, final int x, + final int y, final int z) { + final Vector3 position = new Vector3(x, y, z); + for (int amount = 0; amount < super.amountPerBranch; ++amount) { + final Block block = world.getBlock(x, y, z); + //TODO: WTF + if (block != null /*&& + block.isGenMineableReplaceable(world, x, y, z, + Blocks.stone)*/) { + world.setBlock(x, y, z, super.oreID, super.oreMeta, 2); + } + final ForgeDirection dir = ForgeDirection.values()[rand.nextInt(6)]; + position.modifyPositionFromSide(dir); + } + } + + private boolean nearLava(final World world, final int x, final int y, + final int z) { + for (int side = 2; side < 6; ++side) { + final Vector3 position = new Vector3(x, y, z); + final ForgeDirection s = ForgeDirection.values()[side]; + position.modifyPositionFromSide(s); + if (world.blockExists(position.intX(), position.intY(), + position.intZ())) { + final Block id = world.getBlock(position.intX(), position.intY(), + position.intZ()); + if (id == Blocks.lava || + id == Blocks.flowing_lava) { + return true; + } + } + } + for (int j = 0; j < 4; ++j) { + final Block id2 = world.getBlock(x, y - j, z); + if (id2 == Blocks.lava || + id2 == Blocks.flowing_lava) { + return true; + } + if (id2 != Blocks.air) { + return false; + } + } + return false; + } +} diff --git a/src/main/java/icbm/core/HaoMa.java b/src/main/java/icbm/core/HaoMa.java new file mode 100644 index 0000000..b897ebb --- /dev/null +++ b/src/main/java/icbm/core/HaoMa.java @@ -0,0 +1,26 @@ +package icbm.core; + +import java.util.HashMap; + +public class HaoMa +{ + private static final HashMap IDS; + + public static int getID(final String name, final int defaultID) { + int id = defaultID; + if (HaoMa.IDS.containsKey(name)) { + id = HaoMa.IDS.get(name); + ++id; + } + HaoMa.IDS.put(name, id); + return id; + } + + public static int getID(final String name) { + return getID(name, 0); + } + + static { + IDS = new HashMap<>(); + } +} diff --git a/src/main/java/icbm/core/ICBMTab.java b/src/main/java/icbm/core/ICBMTab.java new file mode 100644 index 0000000..e5cf0d8 --- /dev/null +++ b/src/main/java/icbm/core/ICBMTab.java @@ -0,0 +1,31 @@ +package icbm.core; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class ICBMTab extends CreativeTabs { + public static final ICBMTab INSTANCE; + public static ItemStack itemStack; + + public ICBMTab() { super(CreativeTabs.getNextID(), "ICBM"); } + + @Override + public Item getTabIconItem() { + if (ICBMTab.itemStack == null) { + return Item.getItemFromBlock(Blocks.tnt); + } + + return ICBMTab.itemStack.getItem(); + } + + public ItemStack getIconItemStack() { + if (ICBMTab.itemStack == null) { + ICBMTab.itemStack = new ItemStack(Blocks.tnt); + } + return ICBMTab.itemStack; + } + + static { INSTANCE = new ICBMTab(); } +} diff --git a/src/main/java/icbm/core/MainBase.java b/src/main/java/icbm/core/MainBase.java new file mode 100644 index 0000000..db3402f --- /dev/null +++ b/src/main/java/icbm/core/MainBase.java @@ -0,0 +1,182 @@ +package icbm.core; + +import atomicscience.api.poison.PotionRadiation; +import calclavia.lib.UniversalRecipes; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.ModMetadata; +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.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import icbm.core.di.ItICBM; +import java.io.File; +import java.util.Arrays; +import java.util.logging.Logger; +import net.minecraft.block.Block; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandManager; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.flag.CommandFlag; +import universalelectricity.prefab.flag.FlagRegistry; +import universalelectricity.prefab.flag.ModFlag; +import universalelectricity.prefab.flag.NBTFileLoader; +import universalelectricity.prefab.multiblock.BlockMulti; +import universalelectricity.prefab.multiblock.TileEntityMulti; +import universalelectricity.prefab.ore.OreGenBase; +import universalelectricity.prefab.ore.OreGenerator; + +public class MainBase { + public static final MainBase INSTANCE; + public static boolean ZAI_KUAI; + public static Block bLiu; + public static BlockMulti bJia; + public static Item itSulfur; + public static Item itDu; + public static OreGenBase liuGenData; + public static final String PREFIX = "icbm:"; + public static final String RESOURCE_PATH = "/mods/icbm/"; + public static final String TEXTURE_PATH = "/mods/icbm/textures/"; + public static final String GUI_PATH = "/mods/icbm/textures/gui/"; + public static final String MODEL_PATH = "/mods/icbm/textures/models/"; + public static final String SMINE_TEXTURE = "/mods/icbm/textures/models/s-mine.png"; + public static final String BLOCK_PATH = "/mods/icbm/textures/blocks/"; + public static final String ITEM_PATH = "/mods/icbm/textures/items/"; + public static final String YU_YAN_PATH = "/mods/icbm/yuyan/"; + public static int DAO_DAN_ZUI_YUAN; + public static final int GUI_XIA_FA_SHE_QI = 1; + public static final int GUI_FA_SHE_SHI_MUO = 2; + public static final int GUI_LEI_DA_TAI = 3; + public static final int GUI_YIN_GAN_QI = 4; + public static final int GUI_SHENG_BUO = 5; + public static final int GUI_DIAN_CI_QI = 6; + public static final int GUI_FA_SHE_DI = 7; + private static boolean isPreInit; + private static boolean isPostInit; + public static final Configuration CONFIGURATION; + public static final Logger LOGGER; + + @Mod.EventHandler + public void preInit(final FMLPreInitializationEvent event) { + if (!MainBase.isPreInit) { + MinecraftForge.EVENT_BUS.register((Object) MainBase.INSTANCE); + MainBase.CONFIGURATION.load(); + PotionRadiation.INSTANCE.getId(); + MainBase.ZAI_KUAI = MainBase.CONFIGURATION.get("general", "Allow Chunk Loading", true) + .getBoolean(true); + MainBase.DAO_DAN_ZUI_YUAN = MainBase.CONFIGURATION + .get("general", "Max Missile Distance", MainBase.DAO_DAN_ZUI_YUAN) + .getInt(MainBase.DAO_DAN_ZUI_YUAN); + MainBase.bLiu = (Block) new BSulfurOre(); + MainBase.bJia = new BlockMulti() + .setTextureName("icbm:machine") + .setChannel(this.getChannel()); + MainBase.itDu = new ItICBM("poisonPowder"); + MainBase.itSulfur = new ItICBM("sulfur"); + GameRegistry.registerBlock(MainBase.bLiu, "bLiu"); + GameRegistry.registerBlock((Block) MainBase.bJia, "bJia"); + MainBase.liuGenData = new GenSulfur("Sulfur Ore", "oreSulfur", new ItemStack(MainBase.bLiu), + Blocks.air, 40, 20, 4) + .enable(MainBase.CONFIGURATION); + + MainBase.CONFIGURATION.save(); + OreDictionary.registerOre("dustSulfur", MainBase.itSulfur); + OreGenerator.addOre(MainBase.liuGenData); + GameRegistry.registerTileEntity(TileEntityMulti.class, "ICBMMulti"); + MainBase.isPreInit = true; + } + } + + @Mod.EventHandler + public void postInit(final FMLPostInitializationEvent event) { + if (!MainBase.isPostInit) { + UniversalRecipes.init(); + GameRegistry.addSmelting(MainBase.bLiu, + new ItemStack(MainBase.itSulfur, 4), 0.8f); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(Items.gunpowder, 3), + new Object[] { "@@@", "@?@", "@@@", '@', "dustSulfur", '?', + Items.coal })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(Items.gunpowder, 3), + new Object[] { "@@@", "@?@", "@@@", '@', "dustSulfur", '?', + new ItemStack(Items.coal, 1, 1) })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + Blocks.tnt, new Object[] { "@@@", "@R@", "@@@", '@', Items.gunpowder, + 'R', Items.redstone })); + GameRegistry.addRecipe((IRecipe) new ShapelessOreRecipe( + new ItemStack(MainBase.itDu, 3), + new Object[] { Items.spider_eye, Items.rotten_flesh })); + MainBase.isPostInit = true; + } + } + + @Mod.EventHandler + public void serverStarting(final FMLServerStartingEvent event) { + FlagRegistry.registerModFlag( + "ModFlags", new ModFlag(NBTFileLoader.loadData("ModFlags"))); + final ICommandManager commandManager = FMLCommonHandler.instance() + .getMinecraftServerInstance() + .getCommandManager(); + final ServerCommandManager serverCommandManager = (ServerCommandManager) commandManager; + serverCommandManager.registerCommand( + (ICommand) new CommandFlag(FlagRegistry.getModFlag("ModFlags"))); + } + + @SubscribeEvent + public void worldSave(final WorldEvent.Save evt) { + if (!((WorldEvent) evt).world.isRemote) { + NBTFileLoader.saveData("ModFlags", + FlagRegistry.getModFlag("ModFlags").getNBT()); + } + } + + public static Vector3 getLook(final float rotationYaw, + final float rotationPitch) { + final float var2 = MathHelper.cos(-rotationYaw * 0.017453292f - 3.1415927f); + final float var3 = MathHelper.sin(-rotationYaw * 0.017453292f - 3.1415927f); + final float var4 = -MathHelper.cos(-rotationPitch * 0.017453292f); + final float var5 = MathHelper.sin(-rotationPitch * 0.017453292f); + return new Vector3(var3 * var4, var5, var2 * var4); + } + + public static void setModMetadata(final String id, + final ModMetadata metadata) { + metadata.modId = id; + metadata.name = "ICBM"; + metadata.description = "ICBM is a Minecraft Mod that introduces intercontinental ballistic missiles to Minecraft. But the fun doesn't end there! This mod also features many different explosives, missiles and machines classified in three different tiers. If strategic warfare, carefully coordinated airstrikes, messing with matter and general destruction are up your alley, then this mod is for you!"; + metadata.url = "http://www.universalelectricity.com/icbm/"; + metadata.logoFile = "/icbm_logo.png"; + metadata.version = "1.2.1"; + metadata.authorList = Arrays.asList("Calclavia"); + metadata.credits = "Please visit the website."; + metadata.autogenerated = false; + } + + protected String getChannel() { + return null; + } + + static { + INSTANCE = new MainBase(); + MainBase.DAO_DAN_ZUI_YUAN = 10000; + CONFIGURATION = new Configuration( + new File(Loader.instance().getConfigDir(), "ICBM.cfg")); + LOGGER = Logger.getLogger("ICBM"); + } +} diff --git a/src/main/java/icbm/core/Pair.java b/src/main/java/icbm/core/Pair.java new file mode 100644 index 0000000..83a32ac --- /dev/null +++ b/src/main/java/icbm/core/Pair.java @@ -0,0 +1,33 @@ +package icbm.core; + +public class Pair { + private final T left; + private final T right; + + public Pair(final T left, final T right) { + this.left = left; + this.right = right; + } + + public T getKey() { return this.left; } + + public T getValue() { return this.right; } + + @Override + public int hashCode() { + return this.left.hashCode() ^ this.right.hashCode(); + } + + @Override + public boolean equals(final Object o) { + if (o == null) { + return false; + } + if (!(o instanceof Pair)) { + return false; + } + final Pair pairo = (Pair)o; + return this.left.equals(pairo.getKey()) && + this.right.equals(pairo.getValue()); + } +} diff --git a/src/main/java/icbm/core/di/BICBM.java b/src/main/java/icbm/core/di/BICBM.java new file mode 100644 index 0000000..e5f5cdc --- /dev/null +++ b/src/main/java/icbm/core/di/BICBM.java @@ -0,0 +1,75 @@ +package icbm.core.di; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.ICBMTab; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.prefab.block.BlockAdvanced; +import universalelectricity.prefab.implement.IRedstoneProvider; + +public abstract class BICBM extends BlockAdvanced { + protected IIcon iconTop; + protected IIcon iconSide; + protected IIcon iconBottom; + protected boolean requireSidedTextures; + + public BICBM(final String name, final Material material) { + super(material); + this.requireSidedTextures = false; + this.setBlockName("icbm:" + name); + this.setCreativeTab((CreativeTabs)ICBMTab.INSTANCE); + } + + @Override + public int damageDropped(final int metadata) { + return metadata; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + if (this.requireSidedTextures) { + this.iconTop = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "_top"); + this.iconSide = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "_side"); + this.iconBottom = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "_bottom"); + } + } + + @Override + public int isProvidingStrongPower(final IBlockAccess par1IBlockAccess, + final int x, final int y, final int z, + final int side) { + final TileEntity tileEntity = par1IBlockAccess.getTileEntity(x, y, z); + if (tileEntity instanceof IRedstoneProvider) { + return ((IRedstoneProvider)tileEntity) + .isPoweringTo(ForgeDirection.getOrientation(side)) + ? 15 + : 0; + } + return 0; + } + + @Override + public int isProvidingWeakPower(final IBlockAccess par1IBlockAccess, + final int x, final int y, final int z, + final int side) { + final TileEntity tileEntity = par1IBlockAccess.getTileEntity(x, y, z); + if (tileEntity instanceof IRedstoneProvider) { + return ((IRedstoneProvider)tileEntity) + .isIndirectlyPoweringTo(ForgeDirection.getOrientation(side)) + ? 15 + : 0; + } + return 0; + } +} diff --git a/src/main/java/icbm/core/di/ItElectricICBM.java b/src/main/java/icbm/core/di/ItElectricICBM.java new file mode 100644 index 0000000..17c5dad --- /dev/null +++ b/src/main/java/icbm/core/di/ItElectricICBM.java @@ -0,0 +1,13 @@ +package icbm.core.di; + +import icbm.core.ICBMTab; +import net.minecraft.creativetab.CreativeTabs; +import universalelectricity.core.item.ItemElectric; + +public abstract class ItElectricICBM extends ItemElectric { + public ItElectricICBM(final String name) { + super(); + this.setUnlocalizedName("icbm:" + name); + this.setCreativeTab((CreativeTabs)ICBMTab.INSTANCE); + } +} diff --git a/src/main/java/icbm/core/di/ItICBM.java b/src/main/java/icbm/core/di/ItICBM.java new file mode 100644 index 0000000..0a62cb7 --- /dev/null +++ b/src/main/java/icbm/core/di/ItICBM.java @@ -0,0 +1,13 @@ +package icbm.core.di; + +import icbm.core.ICBMTab; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class ItICBM extends Item { + public ItICBM(final String name) { + super(); + this.setUnlocalizedName("icbm:" + name); + this.setCreativeTab((CreativeTabs)ICBMTab.INSTANCE); + } +} diff --git a/src/main/java/icbm/core/di/MICBM.java b/src/main/java/icbm/core/di/MICBM.java new file mode 100644 index 0000000..13e0309 --- /dev/null +++ b/src/main/java/icbm/core/di/MICBM.java @@ -0,0 +1,10 @@ +package icbm.core.di; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; + +@SideOnly(Side.CLIENT) +public abstract class MICBM extends ModelBase { + public void render(final float f5) {} +} diff --git a/src/main/java/icbm/gangshao/ClientProxy.java b/src/main/java/icbm/gangshao/ClientProxy.java new file mode 100644 index 0000000..265a762 --- /dev/null +++ b/src/main/java/icbm/gangshao/ClientProxy.java @@ -0,0 +1,86 @@ +// +// Decompiled by Procyon v0.6.0 +// + +package icbm.gangshao; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.render.BlockRenderingHandler; +import icbm.gangshao.render.FXBeam; +import icbm.gangshao.render.RAATurret; +import icbm.gangshao.render.RESeat; +import icbm.gangshao.render.RGunTurret; +import icbm.gangshao.render.RLaserTurret; +import icbm.gangshao.render.RRailgun; +import icbm.gangshao.shimian.GuiPlatformAccess; +import icbm.gangshao.shimian.GuiPlatformSlots; +import icbm.gangshao.shimian.GuiPlatformTerminal; +import icbm.gangshao.turret.mount.ESeat; +import icbm.gangshao.turret.mount.TRailgunTurret; +import icbm.gangshao.turret.sentries.TAATurret; +import icbm.gangshao.turret.sentries.TLaserTurret; +import icbm.gangshao.turret.sentries.TMachineGunTurret; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ClientProxy extends CommonProxy { + @Override + public void preInit() { + super.preInit(); + } + + @Override + public void init() { + super.init(); + ClientRegistry.bindTileEntitySpecialRenderer( + TMachineGunTurret.class, (TileEntitySpecialRenderer) new RGunTurret()); + ClientRegistry.bindTileEntitySpecialRenderer( + TAATurret.class, (TileEntitySpecialRenderer) new RAATurret()); + ClientRegistry.bindTileEntitySpecialRenderer( + TRailgunTurret.class, (TileEntitySpecialRenderer) new RRailgun()); + ClientRegistry.bindTileEntitySpecialRenderer( + TLaserTurret.class, (TileEntitySpecialRenderer) new RLaserTurret()); + RenderingRegistry.registerEntityRenderingHandler(ESeat.class, + (Render) new RESeat()); + RenderingRegistry.registerBlockHandler( + (ISimpleBlockRenderingHandler) new BlockRenderingHandler()); + } + + @Override + public Object getClientGuiElement(final int ID, final EntityPlayer player, + final World world, final int x, final int y, + final int z) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + switch (ID) { + case 0: { + return new GuiPlatformSlots(player.inventory, (TPlatform) tileEntity); + } + case 1: { + return new GuiPlatformTerminal(player, (TPlatform) tileEntity); + } + case 2: { + return new GuiPlatformAccess(player, (TPlatform) tileEntity); + } + } + } + return null; + } + + @Override + public void renderBeam(final World world, final Vector3 position, + final Vector3 target, final float red, + final float green, final float blue, final int age) { + FMLClientHandler.instance().getClient().effectRenderer.addEffect( + (EntityFX) new FXBeam(world, position, target, red, green, blue, age)); + } +} diff --git a/src/main/java/icbm/gangshao/CommonProxy.java b/src/main/java/icbm/gangshao/CommonProxy.java new file mode 100644 index 0000000..ce720fc --- /dev/null +++ b/src/main/java/icbm/gangshao/CommonProxy.java @@ -0,0 +1,63 @@ +package icbm.gangshao; + +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import icbm.gangshao.container.ContainerTurretPlatform; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.turret.mount.TRailgunTurret; +import icbm.gangshao.turret.sentries.TAATurret; +import icbm.gangshao.turret.sentries.TLaserTurret; +import icbm.gangshao.turret.sentries.TMachineGunTurret; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.multiblock.TileEntityMulti; + +public class CommonProxy implements IGuiHandler { + public static final int GUI_PLATFORM_ID = 0; + public static final int GUI_PLATFORM_TERMINAL_ID = 1; + public static final int GUI_PLATFORM_ACCESS_ID = 2; + + public void init() { + GameRegistry.registerTileEntity(TMachineGunTurret.class, "ICBMGunTurret"); + GameRegistry.registerTileEntity(TAATurret.class, "ICBMAATurret"); + GameRegistry.registerTileEntity(TRailgunTurret.class, "ICBMRailgun"); + GameRegistry.registerTileEntity(TLaserTurret.class, "ICBMLeiSheF"); + GameRegistry.registerTileEntity(TPlatform.class, "ICBMPlatform"); + GameRegistry.registerTileEntity(TileEntityMulti.class, "ICBMMultiblock"); + } + + public void preInit() { + } + + public Object getServerGuiElement(final int ID, final EntityPlayer player, + final World world, final int x, final int y, + final int z) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + switch (ID) { + case 0: { + return new ContainerTurretPlatform(player.inventory, + (TPlatform) tileEntity); + } + } + } + return null; + } + + public Object getClientGuiElement(final int ID, final EntityPlayer player, + final World world, final int x, final int y, + final int z) { + return null; + } + + public void renderTracer(final World world, final Vector3 position, + final Vector3 target) { + } + + public void renderBeam(final World world, final Vector3 position, + final Vector3 target, final float red, + final float green, final float blue, final int age) { + } +} diff --git a/src/main/java/icbm/gangshao/IAmmunition.java b/src/main/java/icbm/gangshao/IAmmunition.java new file mode 100644 index 0000000..168c90d --- /dev/null +++ b/src/main/java/icbm/gangshao/IAmmunition.java @@ -0,0 +1,13 @@ +package icbm.gangshao; + +import net.minecraft.item.ItemStack; + +public interface IAmmunition { + boolean canDrop(final int p0); + + ItemStack onDroppedIntoWorld(final ItemStack p0); + + ProjectileType getType(final ItemStack p0); + + int getDamage(); +} diff --git a/src/main/java/icbm/gangshao/IAutoSentry.java b/src/main/java/icbm/gangshao/IAutoSentry.java new file mode 100644 index 0000000..dc4448c --- /dev/null +++ b/src/main/java/icbm/gangshao/IAutoSentry.java @@ -0,0 +1,16 @@ +package icbm.gangshao; + +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; + +public interface IAutoSentry extends ISentry { + AxisAlignedBB getTargetingBox(); + + Entity getTarget(); + + void setTarget(final Entity p0); + + boolean isValidTarget(final Entity p0); + + double getDetectRange(); +} diff --git a/src/main/java/icbm/gangshao/ICBMSentry.java b/src/main/java/icbm/gangshao/ICBMSentry.java new file mode 100644 index 0000000..533e9a6 --- /dev/null +++ b/src/main/java/icbm/gangshao/ICBMSentry.java @@ -0,0 +1,230 @@ +package icbm.gangshao; + +import calclavia.lib.UniversalRecipes; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.ModMetadata; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +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.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import icbm.api.ICBMFlags; +import icbm.core.ICBMTab; +import icbm.core.MainBase; +import icbm.gangshao.damage.EntityTileDamagable; +import icbm.gangshao.packet.PacketHandlerTurret; +import icbm.gangshao.packet.PacketTurret; +import icbm.gangshao.platform.BlockTurretPlatform; +import icbm.gangshao.terminal.command.CommandAccess; +import icbm.gangshao.terminal.command.CommandDestroy; +import icbm.gangshao.terminal.command.CommandGet; +import icbm.gangshao.terminal.command.CommandHelp; +import icbm.gangshao.terminal.command.CommandRegistry; +import icbm.gangshao.terminal.command.CommandTarget; +import icbm.gangshao.terminal.command.CommandUser; +import icbm.gangshao.turret.BlockTurret; +import icbm.gangshao.turret.ItemAmmo; +import icbm.gangshao.turret.ItemBlockTurret; +import icbm.gangshao.turret.mount.ESeat; +import icbm.gangshao.turret.upgrades.ItPaoTaiUpgrades; +import net.minecraft.block.Block; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandManager; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.flag.CommandFlag; +import universalelectricity.prefab.flag.FlagRegistry; +import universalelectricity.prefab.flag.ModFlag; +import universalelectricity.prefab.flag.NBTFileLoader; + +@Mod(modid = "ICBM|Sentry", name = "ICBM|Sentry", version = "1.2.1", useMetadata = true) +public class ICBMSentry extends MainBase { + public static final String NAME = "ICBM|Sentry"; + public static final String CHANNEL = "ICBM"; + @SidedProxy(clientSide = "icbm.gangshao.ClientProxy", serverSide = "icbm.gangshao.CommonProxy") + public static CommonProxy proxy; + @Mod.Instance("ICBM|Sentry") + public static ICBMSentry instance; + @Mod.Metadata("ICBM|Sentry") + public static ModMetadata metadata; + public static final int BLOCK_ID_PREFIX = 3517; + public static final int ITEM_ID_PREFIX = 20948; + public static final int ENTITY_ID_PREFIX = 50; + public static Block blockTurret; + public static Block blockPlatform; + public static Item itemAmmo; + public static Item itemUpgrade; + public static ItemStack conventionalBullet; + public static ItemStack railgunBullet; + public static ItemStack antimatterBullet; + public static ItemStack bulletShell; + public static final String FLAG_RAILGUN; + public static SimpleNetworkWrapper channel; + + @Mod.EventHandler + @Override + public void preInit(final FMLPreInitializationEvent event) { + super.preInit(event); + NetworkRegistry.INSTANCE.registerGuiHandler((Object) this, + (IGuiHandler) ICBMSentry.proxy); + MinecraftForge.EVENT_BUS.register((Object) this); + MainBase.CONFIGURATION.load(); + ICBMSentry.blockTurret = (Block) new BlockTurret(); + ICBMSentry.blockPlatform = (Block) new BlockTurretPlatform(); + ICBMSentry.itemAmmo = new ItemAmmo(); + ICBMSentry.itemUpgrade = new ItPaoTaiUpgrades(); + MainBase.CONFIGURATION.save(); + ICBMSentry.bulletShell = new ItemStack(ICBMSentry.itemAmmo, 1, 0); + ICBMSentry.conventionalBullet = new ItemStack(ICBMSentry.itemAmmo, 1, 1); + ICBMSentry.railgunBullet = new ItemStack(ICBMSentry.itemAmmo, 1, 2); + ICBMSentry.antimatterBullet = new ItemStack(ICBMSentry.itemAmmo, 1, 3); + GameRegistry.registerBlock(ICBMSentry.blockTurret, ItemBlockTurret.class, + "ICBMTurret"); + GameRegistry.registerBlock(ICBMSentry.blockPlatform, "ICBMPlatform"); + EntityRegistry.registerGlobalEntityID( + ESeat.class, "ICBMFake", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerModEntity(ESeat.class, "ICBMFake", 57, (Object) this, + 50, 5, true); + EntityRegistry.registerGlobalEntityID( + EntityTileDamagable.class, "ICBMFakeTile", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerModEntity(EntityTileDamagable.class, "ICBMFakeTile", + 58, (Object) this, 50, 5, true); + + GameRegistry.registerItem(itemAmmo, "icbm:itemAmmo"); + GameRegistry.registerItem(itemUpgrade, "icbm:itemUpgrade"); + + ICBMTab.itemStack = new ItemStack(ICBMSentry.blockTurret); + + ICBMSentry.proxy.preInit(); + + channel = NetworkRegistry.INSTANCE.newSimpleChannel("icbm_sentry"); + int pktId = 0; + + channel.registerMessage(PacketHandlerTurret.class, PacketTurret.class, + pktId++, Side.CLIENT); + } + + @Mod.EventHandler + public void init(final FMLInitializationEvent event) { + MainBase.setModMetadata("ICBM|Sentry", ICBMSentry.metadata); + } + + @Mod.EventHandler + @Override + public void postInit(final FMLPostInitializationEvent event) { + super.postInit(event); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.itemAmmo, 16, 0), + new Object[] { "T", "T", 'T', "ingotTin" })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.itemAmmo, 16, 1), + new Object[] { "SBS", "SGS", "SSS", 'B', Items.iron_ingot, 'G', + Items.gunpowder, 'S', ICBMSentry.bulletShell.copy() })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.itemAmmo, 2, 2), + new Object[] { "D", "B", "B", 'D', Items.diamond, 'B', + ICBMSentry.conventionalBullet })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + ICBMSentry.antimatterBullet, + new Object[] { "A", "B", 'A', "antimatterGram", 'B', + ICBMSentry.railgunBullet })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + ICBMSentry.blockPlatform, + new Object[] { "SPS", "CBC", "SAS", 'P', Blocks.piston, 'A', + UniversalRecipes.BATTERY, 'S', "plateSteel", 'C', + Blocks.chest, 'B', "calclavia:CIRCUIT_T1" })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.blockTurret, 1, 0), + new Object[] { "SSS", "CS ", 'C', "calclavia:CIRCUIT_T1", 'S', + "ingotSteel" })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.blockTurret, 1, 1), + new Object[] { "DDD", "CS ", "GS ", 'D', Items.diamond, 'S', + "plateSteel", 'C', "calclavia:CIRCUIT_T3", 'G', + new ItemStack(ICBMSentry.blockTurret, 1, 0) })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.blockTurret, 1, 2), + new Object[] { "DDS", "CS ", "GS ", 'D', "plateBronze", 'S', + "plateSteel", 'C', "calclavia:CIRCUIT_T2", 'G', + new ItemStack(ICBMSentry.blockTurret, 1, 0) })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.blockTurret, 1, 3), + new Object[] { "DDG", "CS ", "GS ", 'D', "plateBronze", 'S', + "plateSteel", 'C', "calclavia:CIRCUIT_T1", 'D', + Blocks.glass, 'G', Blocks.glass })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.itemUpgrade, 3, + ItPaoTaiUpgrades.TurretUpgradeType.RANGE.ordinal()), + new Object[] { "B", "I", 'B', Items.bow, 'I', Items.iron_ingot })); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMSentry.itemUpgrade, 1, + ItPaoTaiUpgrades.TurretUpgradeType.COLLECTOR.ordinal()), + new Object[] { "BBB", " I ", "BBB", 'B', Items.bucket, 'I', + Items.bowl })); + CommandRegistry.register(new CommandAccess()); + CommandRegistry.register(new CommandDestroy()); + CommandRegistry.register(new CommandUser()); + CommandRegistry.register(new CommandHelp()); + CommandRegistry.register(new CommandGet()); + CommandRegistry.register(new CommandTarget()); + ICBMSentry.proxy.init(); + } + + public static boolean isProtected(final World world, final Vector3 diDian, + final String banFlag) { + return FlagRegistry.getModFlag("ModFlags") != null && + (FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_GLOBAL, "true", diDian) || + FlagRegistry.getModFlag("ModFlags") + .containsValue(world, banFlag, "true", diDian)); + } + + @Mod.EventHandler + @Override + public void serverStarting(final FMLServerStartingEvent event) { + FlagRegistry.registerModFlag( + "ModFlags", new ModFlag(NBTFileLoader.loadData("ModFlags"))); + final ICommandManager commandManager = FMLCommonHandler.instance() + .getMinecraftServerInstance() + .getCommandManager(); + final ServerCommandManager serverCommandManager = (ServerCommandManager) commandManager; + serverCommandManager.registerCommand( + (ICommand) new CommandFlag(FlagRegistry.getModFlag("ModFlags"))); + } + + @SubscribeEvent + @Override + public void worldSave(final WorldEvent.Save evt) { + if (!((WorldEvent) evt).world.isRemote) { + NBTFileLoader.saveData("ModFlags", + FlagRegistry.getModFlag("ModFlags").getNBT()); + } + } + + @Override + protected String getChannel() { + return "ICBM"; + } + + static { + FLAG_RAILGUN = FlagRegistry.registerFlag("ban_railgun"); + } +} diff --git a/src/main/java/icbm/gangshao/ISentry.java b/src/main/java/icbm/gangshao/ISentry.java new file mode 100644 index 0000000..df7b6dc --- /dev/null +++ b/src/main/java/icbm/gangshao/ISentry.java @@ -0,0 +1,18 @@ +package icbm.gangshao; + +import net.minecraft.tileentity.TileEntity; +import universalelectricity.core.vector.Vector3; + +public interface ISentry { + void setRotation(final float p0, final float p1); + + Vector3 getMuzzle(); + + void onWeaponActivated(); + + boolean canActivateWeapon(); + + TileEntity getPlatform(); + + String getName(); +} diff --git a/src/main/java/icbm/gangshao/ISpecialAccess.java b/src/main/java/icbm/gangshao/ISpecialAccess.java new file mode 100644 index 0000000..a27e3f2 --- /dev/null +++ b/src/main/java/icbm/gangshao/ISpecialAccess.java @@ -0,0 +1,18 @@ +package icbm.gangshao; + +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.access.UserAccess; +import java.util.List; + +public interface ISpecialAccess { + AccessLevel getUserAccess(final String p0); + + List getUsers(); + + boolean addUserAccess(final String p0, final AccessLevel p1, + final boolean p2); + + boolean removeUserAccess(final String p0); + + List getUsersWithAcess(final AccessLevel p0); +} diff --git a/src/main/java/icbm/gangshao/ITurretUpgrade.java b/src/main/java/icbm/gangshao/ITurretUpgrade.java new file mode 100644 index 0000000..8ad25f6 --- /dev/null +++ b/src/main/java/icbm/gangshao/ITurretUpgrade.java @@ -0,0 +1,8 @@ +package icbm.gangshao; + +import icbm.gangshao.turret.upgrades.ItPaoTaiUpgrades; +import net.minecraft.item.ItemStack; + +public interface ITurretUpgrade { + ItPaoTaiUpgrades.TurretUpgradeType getType(final ItemStack p0); +} diff --git a/src/main/java/icbm/gangshao/ProjectileType.java b/src/main/java/icbm/gangshao/ProjectileType.java new file mode 100644 index 0000000..68301cc --- /dev/null +++ b/src/main/java/icbm/gangshao/ProjectileType.java @@ -0,0 +1,9 @@ +package icbm.gangshao; + +public enum ProjectileType { + UNKNOWN, + CONVENTIONAL, + RAILGUN, + MISSILE, + EXPLOSIVE; +} diff --git a/src/main/java/icbm/gangshao/SlotTurret.java b/src/main/java/icbm/gangshao/SlotTurret.java new file mode 100644 index 0000000..2329130 --- /dev/null +++ b/src/main/java/icbm/gangshao/SlotTurret.java @@ -0,0 +1,22 @@ +package icbm.gangshao; + +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.terminal.ITerminal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import universalelectricity.prefab.SlotSpecific; + +public class SlotTurret extends SlotSpecific { + public SlotTurret(final IInventory par2iInventory, final int par3, + final int par4, final int par5, + final Class... validClasses) { + super(par2iInventory, par3, par4, par5, validClasses); + } + + public boolean canTakeStack(final EntityPlayer entityPlayer) { + return super.inventory instanceof ITerminal && + ((ITerminal) super.inventory) + .getUserAccess(entityPlayer.getDisplayName()) + .ordinal() > AccessLevel.NONE.ordinal(); + } +} diff --git a/src/main/java/icbm/gangshao/access/AccessLevel.java b/src/main/java/icbm/gangshao/access/AccessLevel.java new file mode 100644 index 0000000..5162a5c --- /dev/null +++ b/src/main/java/icbm/gangshao/access/AccessLevel.java @@ -0,0 +1,30 @@ +package icbm.gangshao.access; + +public enum AccessLevel { + NONE("None"), + USER("User"), + ADMIN("Admin"), + OWNER("Owner"); + + public String displayName; + + private AccessLevel(final String name) { this.displayName = name; } + + public static AccessLevel get(final Object ob) { + if (ob instanceof String) { + for (final AccessLevel access : values()) { + if (access.displayName.equalsIgnoreCase((String)ob) || + access.name().equalsIgnoreCase((String)ob)) { + return access; + } + } + } + if (ob instanceof Integer) { + final int i = (int)ob % values().length; + if (i >= 0 && i < values().length) { + return values()[i]; + } + } + return AccessLevel.NONE; + } +} diff --git a/src/main/java/icbm/gangshao/access/GlobalAccessLoader.java b/src/main/java/icbm/gangshao/access/GlobalAccessLoader.java new file mode 100644 index 0000000..8d120f9 --- /dev/null +++ b/src/main/java/icbm/gangshao/access/GlobalAccessLoader.java @@ -0,0 +1,50 @@ +package icbm.gangshao.access; + +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import icbm.gangshao.saving.INbtSave; +import icbm.gangshao.saving.SaveManager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.MinecraftForge; + +public class GlobalAccessLoader implements INbtSave { + public static boolean isInitialized; + public static GlobalAccessLoader intance; + public static final String SAVE_NAME = "Global_Access_List"; + + public void initiate() { + if (!GlobalAccessLoader.isInitialized) { + MinecraftForge.EVENT_BUS.register((Object)this); + SaveManager.intance.registerNbtSave(this); + GlobalAccessLoader.isInitialized = true; + } + } + + @Mod.EventHandler + public void serverStarting(final FMLServerStartingEvent event) { + if (!GlobalAccessManager.hasLoaded) { + GlobalAccessManager.getMasterSaveFile(); + } + } + + @Override + public String saveFileName() { + return "global-access-list"; + } + + @Override + public NBTTagCompound getSaveData() { + return GlobalAccessManager.getMasterSaveFile(); + } + + @Override + public boolean shouldSave(final boolean isServer) { + return isServer && GlobalAccessManager.hasLoaded && + !GlobalAccessManager.loading; + } + + static { + GlobalAccessLoader.isInitialized = false; + GlobalAccessLoader.intance = new GlobalAccessLoader(); + } +} diff --git a/src/main/java/icbm/gangshao/access/GlobalAccessManager.java b/src/main/java/icbm/gangshao/access/GlobalAccessManager.java new file mode 100644 index 0000000..9db3c30 --- /dev/null +++ b/src/main/java/icbm/gangshao/access/GlobalAccessManager.java @@ -0,0 +1,135 @@ +package icbm.gangshao.access; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.minecraft.nbt.NBTTagCompound; +import universalelectricity.prefab.flag.NBTFileLoader; + +public class GlobalAccessManager { + private static Map> globalUserLists; + private static NBTTagCompound masterSaveNbt; + public static boolean loading; + public static boolean hasLoaded; + public static boolean needsSaving; + + public static List getOrCreateList(final String name, + final String owner) { + if (name.toCharArray().length < 5 || owner.isEmpty() || + name.startsWith("Default#")) { + return null; + } + List list = getList(name); + if (list == null) { + list = createList(name, owner); + } + return list; + } + + public static List getUsersLists(final String username) { + final List lists = new ArrayList<>(); + for (final Map.Entry> entry : + GlobalAccessManager.globalUserLists.entrySet()) { + final List list = entry.getValue(); + for (final UserAccess access : list) { + if (access.username.equalsIgnoreCase(username) && + access.level.ordinal() >= AccessLevel.ADMIN.ordinal()) { + lists.add(entry.getKey()); + break; + } + } + } + return lists; + } + + public static List createList(final String name, + final String owner) { + final List list = new ArrayList<>(); + list.add(new UserAccess(owner, AccessLevel.OWNER, true)); + GlobalAccessManager.globalUserLists.put(name, list); + saveList(name, list); + GlobalAccessManager.needsSaving = true; + return list; + } + + public static List getList(final String name) { + if (GlobalAccessManager.globalUserLists.containsKey(name)) { + return GlobalAccessManager.globalUserLists.get(name); + } + final List list = loadList(name); + if (list != null) { + GlobalAccessManager.globalUserLists.put(name, list); + } + return list; + } + + public boolean addUser(final String listName, final UserAccess user) { + if (user == null) { + return false; + } + List userList = getList(listName); + if (userList != null) { + if (userList.contains(user)) { + userList = UserAccess.removeUserAccess(user.username, userList); + } + if (userList.add(user)) { + GlobalAccessManager.globalUserLists.put(listName, userList); + saveList(listName, userList); + return GlobalAccessManager.needsSaving = true; + } + } + return false; + } + + public boolean removeUser(final String listName, final UserAccess user) { + if (user == null) { + return false; + } + List userList = getList(listName); + if (userList != null && userList.contains(user)) { + userList = UserAccess.removeUserAccess(user.username, userList); + GlobalAccessManager.globalUserLists.put(listName, userList); + saveList(listName, userList); + return GlobalAccessManager.needsSaving = true; + } + return false; + } + + private static List loadList(final String name) { + final NBTTagCompound masterSave = getMasterSaveFile(); + if (masterSave != null && masterSave.hasKey(name)) { + final NBTTagCompound accessSave = masterSave.getCompoundTag(name); + return UserAccess.readListFromNBT(accessSave, "Users"); + } + return null; + } + + private static void saveList(final String name, final List list) { + final NBTTagCompound masterSave = getMasterSaveFile(); + if (masterSave != null) { + final NBTTagCompound accessSave = masterSave.getCompoundTag(name); + UserAccess.writeListToNBT(accessSave, list); + masterSave.setTag(name, accessSave); + } + } + + public static NBTTagCompound getMasterSaveFile() { + if (GlobalAccessManager.masterSaveNbt.hasNoTags() && + !GlobalAccessManager.loading) { + GlobalAccessManager.hasLoaded = true; + GlobalAccessManager.loading = true; + NBTFileLoader.loadData("Global_Access_List"); + GlobalAccessManager.loading = false; + } + return GlobalAccessManager.masterSaveNbt; + } + + static { + GlobalAccessManager.globalUserLists = new HashMap<>(); + GlobalAccessManager.masterSaveNbt = new NBTTagCompound(); + GlobalAccessManager.loading = false; + GlobalAccessManager.hasLoaded = false; + GlobalAccessManager.needsSaving = false; + } +} diff --git a/src/main/java/icbm/gangshao/access/UserAccess.java b/src/main/java/icbm/gangshao/access/UserAccess.java new file mode 100644 index 0000000..a6252ae --- /dev/null +++ b/src/main/java/icbm/gangshao/access/UserAccess.java @@ -0,0 +1,78 @@ +package icbm.gangshao.access; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class UserAccess { + public String username; + public AccessLevel level; + public boolean shouldSave; + + public UserAccess(final String user, final AccessLevel level, + final boolean save) { + this.username = user; + this.level = level; + this.shouldSave = save; + } + + public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { + nbt.setString("username", this.username); + nbt.setInteger("ID", this.level.ordinal()); + return nbt; + } + + public void readFromNBT(final NBTTagCompound nbt) { + this.username = nbt.getString("username"); + this.level = AccessLevel.get(nbt.getInteger("ID")); + } + + public static UserAccess loadFromNBT(final NBTTagCompound nbt) { + final UserAccess access = new UserAccess("", AccessLevel.NONE, true); + access.readFromNBT(nbt); + return access; + } + + public static List readListFromNBT(final NBTTagCompound nbt, + final String tagName) { + final NBTTagList userList = nbt.getTagList(tagName, 10); + final List users = new ArrayList<>(); + for (int i = 0; i < userList.tagCount(); ++i) { + final NBTTagCompound var4 = (NBTTagCompound)userList.getCompoundTagAt(i); + users.add(loadFromNBT(var4)); + } + return users; + } + + public static void writeListToNBT(final NBTTagCompound save, + final List users) { + final NBTTagList usersTag = new NBTTagList(); + for (int player = 0; player < users.size(); ++player) { + final UserAccess access = users.get(player); + if (access != null && access.shouldSave) { + final NBTTagCompound accessData = new NBTTagCompound(); + access.writeToNBT(accessData); + usersTag.appendTag((NBTBase)accessData); + } + } + save.setTag("Users", (NBTBase)usersTag); + } + + public static List + removeUserAccess(final String player, final List users) { + final List removeList = new ArrayList(); + final List returnList = users; + for (int i = 0; i < users.size(); ++i) { + final UserAccess ref = (UserAccess)users.get(i); + if (ref.username.equalsIgnoreCase(player)) { + removeList.add(ref); + } + } + if (removeList != null && removeList.size() > 0) { + returnList.removeAll(removeList); + } + return returnList; + } +} diff --git a/src/main/java/icbm/gangshao/container/ContainerTerminal.java b/src/main/java/icbm/gangshao/container/ContainerTerminal.java new file mode 100644 index 0000000..8a8173a --- /dev/null +++ b/src/main/java/icbm/gangshao/container/ContainerTerminal.java @@ -0,0 +1,26 @@ +package icbm.gangshao.container; + +import net.minecraft.inventory.IInventory; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import icbm.gangshao.terminal.TileEntityTerminal; +import net.minecraft.inventory.Container; + +public abstract class ContainerTerminal extends Container +{ + private TileEntityTerminal tileEntity; + + public ContainerTerminal(final InventoryPlayer inventoryPlayer, final TileEntityTerminal tileEntity) { + this.tileEntity = tileEntity; + this.tileEntity.playersUsing.add(inventoryPlayer.player); + } + + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { + this.tileEntity.playersUsing.remove(par1EntityPlayer); + super.onContainerClosed(par1EntityPlayer); + } + + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + return !(this.tileEntity instanceof IInventory) || ((IInventory)this.tileEntity).isUseableByPlayer(par1EntityPlayer); + } +} diff --git a/src/main/java/icbm/gangshao/container/ContainerTurretPlatform.java b/src/main/java/icbm/gangshao/container/ContainerTurretPlatform.java new file mode 100644 index 0000000..f6b2e30 --- /dev/null +++ b/src/main/java/icbm/gangshao/container/ContainerTurretPlatform.java @@ -0,0 +1,98 @@ +package icbm.gangshao.container; + +import icbm.gangshao.IAmmunition; +import icbm.gangshao.ITurretUpgrade; +import icbm.gangshao.SlotTurret; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.turret.ItemAmmo; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import universalelectricity.core.item.IItemElectric; + +public class ContainerTurretPlatform extends ContainerTerminal { + private TPlatform tileEntity; + + public ContainerTurretPlatform(final InventoryPlayer inventoryPlayer, + final TPlatform tileEntity) { + super(inventoryPlayer, tileEntity); + this.tileEntity = tileEntity; + for (int row = 0; row < 3; ++row) { + for (int column = 0; column < 4; ++column) { + this.addSlotToContainer((Slot) new SlotTurret( + (IInventory)tileEntity, column + row * 4, 8 + column * 18, + 40 + row * 18, + new Class[] {IAmmunition.class, IItemElectric.class})); + } + } + for (int i = 0; i < 4; ++i) { + this.addSlotToContainer( + (Slot) new SlotTurret((IInventory)tileEntity, i + 12, 89 + i * 18, 77, + new Class[] {ITurretUpgrade.class})); + } + for (int row = 0; row < 3; ++row) { + for (int slot = 0; slot < 9; ++slot) { + this.addSlotToContainer(new Slot((IInventory)inventoryPlayer, + slot + row * 9 + 9, 8 + slot * 18, + 97 + row * 18)); + } + } + for (int row = 0; row < 9; ++row) { + this.addSlotToContainer( + new Slot((IInventory)inventoryPlayer, row, 8 + row * 18, 155)); + } + } + + public ItemStack transferStackInSlot(final EntityPlayer entityPlayer, + final int slotID) { + ItemStack var2 = null; + final Slot slot = (Slot) super.inventorySlots.get(slotID); + if (slot != null && slot.getHasStack()) { + final ItemStack itemStack = slot.getStack(); + var2 = itemStack.copy(); + if (slotID > this.tileEntity.containingItems.length - 1) { + if (this.tileEntity.getUserAccess(entityPlayer.getDisplayName()) + .ordinal() > AccessLevel.NONE.ordinal()) { + if (itemStack.getItem() instanceof ItemAmmo || + itemStack.getItem() instanceof IItemElectric) { + if (!this.mergeItemStack(itemStack, 0, 12, false)) { + return null; + } + } else if (itemStack.getItem() instanceof ITurretUpgrade && + !this.mergeItemStack( + itemStack, 12, this.tileEntity.containingItems.length, + false)) { + return null; + } + } else if (slotID < this.tileEntity.containingItems.length + 27) { + if (!this.mergeItemStack( + itemStack, this.tileEntity.containingItems.length + 27, + this.tileEntity.containingItems.length + 36, false)) { + return null; + } + } else if (!this.mergeItemStack( + itemStack, this.tileEntity.containingItems.length, + this.tileEntity.containingItems.length + 27, false)) { + return null; + } + } else if (!this.mergeItemStack( + itemStack, this.tileEntity.containingItems.length, + 36 + this.tileEntity.containingItems.length, false)) { + return null; + } + if (itemStack.stackSize == 0) { + slot.putStack((ItemStack)null); + } else { + slot.onSlotChanged(); + } + if (itemStack.stackSize == var2.stackSize) { + return null; + } + slot.onPickupFromSlot(entityPlayer, itemStack); + } + return var2; + } +} diff --git a/src/main/java/icbm/gangshao/damage/EntityTileDamagable.java b/src/main/java/icbm/gangshao/damage/EntityTileDamagable.java new file mode 100644 index 0000000..4efb721 --- /dev/null +++ b/src/main/java/icbm/gangshao/damage/EntityTileDamagable.java @@ -0,0 +1,189 @@ +package icbm.gangshao.damage; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.turret.TTurretBase; +import io.netty.buffer.ByteBuf; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + +public class EntityTileDamagable + extends EntityLiving implements IEntityAdditionalSpawnData { + private TTurretBase host; + + public EntityTileDamagable(final World par1World) { + super(par1World); + this.isImmuneToFire = true; + this.setSize(1.1f, 1.1f); + } + + public EntityTileDamagable(final TTurretBase host) { + this(host.getWorldObj()); + this.setPosition(host.xCoord + 0.5, (double)host.yCoord, host.zCoord + 0.5); + this.host = host; + } + + @Override + public boolean attackEntityFrom(final DamageSource source, + final float amount) { + return !(this.host instanceof IHealthTile) || + this.host.onDamageTaken(source, (int)amount); + } + + @Override + public boolean isPotionApplicable(final PotionEffect par1PotionEffect) { + return par1PotionEffect != null && this.host instanceof IHealthTile && + this.host.canApplyPotion(par1PotionEffect); + } + + // public void addPotionEffect(final PotionEffect par1PotionEffect) { + // if (this.isPotionApplicable(par1PotionEffect)) { + // if (this.isPotionActive(par1PotionEffect.getPotionID())) { + // //((PotionEffect)this.activePotionsMap.get( + // // par1PotionEffect.getPotionID())) + // // .combine(par1PotionEffect); + // //this.func_70695_b((PotionEffect)this.activePotionsMap.get( + // // par1PotionEffect.getPotionID())); + // } else { + // ((EntityLivingBase)this) + // .activePotionsMap.put(par1PotionEffect.getPotionID(), + // par1PotionEffect); + // this.onNewPotionEffect(par1PotionEffect); + // } + // } + // } + + @Override + public String getCustomNameTag() { + if (this.host == null) { + return "EntityTileTarget"; + } + if (this.host.getPlatform() != null) { + return this.host.getPlatform().getInventoryName(); + } + return this.host.getName(); + } + + @Override + public void writeSpawnData(final ByteBuf data) { + if (this.host != null) { + data.writeInt(this.host.xCoord); + data.writeInt(this.host.yCoord); + data.writeInt(this.host.zCoord); + } + } + + @Override + public void readSpawnData(final ByteBuf data) { + try { + final TileEntity tileEntity = + ((Entity)this) + .worldObj.getTileEntity(data.readInt(), data.readInt(), + data.readInt()); + if (tileEntity instanceof TTurretBase) { + this.host = (TTurretBase)tileEntity; + } + } catch (final Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onUpdate() { + if (!((Entity)this).worldObj.isRemote) { + if (this.host == null || this.host.isInvalid()) { + this.setDead(); + } else if (this.host instanceof IHealthTile && !this.host.isAlive()) { + this.setDead(); + } else { + this.updatePotionEffects(); + this.setPosition(this.host.xCoord + 0.5, (double)this.host.yCoord, + this.host.zCoord + 0.5); + } + } + } + + @Override + public void readEntityFromNBT(final NBTTagCompound nbttagcompound) {} + + @Override + public void moveEntity(final double par1, final double par3, + final double par5) {} + + @Override + public void writeEntityToNBT(final NBTTagCompound nbttagcompound) {} + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + public AxisAlignedBB getCollisionBox(final Entity par1Entity) { + return AxisAlignedBB.getBoundingBox( + ((Entity)this).posX - 0.6, ((Entity)this).posY - 0.6, + ((Entity)this).posZ - 0.6, ((Entity)this).posX + 0.6, + ((Entity)this).posY + 0.6, ((Entity)this).posZ + 0.6); + } + + @Override + public boolean canBeCollidedWith() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRender3d(double x, double y, double z) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(final double par1) { + return false; + } + + @Override + + public void setVelocity(final double par1, final double par3, + final double par5) {} + + @Override + public boolean isInsideOfMaterial(final Material par1Material) { + return false; + } + + @Override + public boolean interact(final EntityPlayer player) { + if (this.host != null && player != null) { + final Block block = + ((Entity)this) + .worldObj.getBlock(this.host.xCoord, this.host.yCoord, + this.host.zCoord); + if (block != null) { + return block.onBlockActivated(((Entity)this).worldObj, this.host.xCoord, + this.host.yCoord, this.host.zCoord, + player, 0, 0.0f, 0.0f, 0.0f); + } + } + return false; + } + + // TODO: WTF + // @Override + // public float getMaxHealth() { + // return (this.host != null && this.host instanceof IHealthTile) + // ? this.host.getMaxHealth() + // : 100; + // } +} diff --git a/src/main/java/icbm/gangshao/damage/IHealthTile.java b/src/main/java/icbm/gangshao/damage/IHealthTile.java new file mode 100644 index 0000000..64af432 --- /dev/null +++ b/src/main/java/icbm/gangshao/damage/IHealthTile.java @@ -0,0 +1,18 @@ +package icbm.gangshao.damage; + +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; + +public interface IHealthTile { + boolean onDamageTaken(final DamageSource p0, final int p1); + + boolean isAlive(); + + int getHealth(); + + void setHealth(final int p0, final boolean p1); + + int getMaxHealth(); + + boolean canApplyPotion(final PotionEffect p0); +} diff --git a/src/main/java/icbm/gangshao/damage/TileDamageSource.java b/src/main/java/icbm/gangshao/damage/TileDamageSource.java new file mode 100644 index 0000000..9848509 --- /dev/null +++ b/src/main/java/icbm/gangshao/damage/TileDamageSource.java @@ -0,0 +1,28 @@ +package icbm.gangshao.damage; + +import icbm.gangshao.turret.TTurretBase; +import net.minecraft.entity.Entity; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSource; + +public class TileDamageSource extends EntityDamageSource { + public TileDamageSource(final String damageName, + final TTurretBase tileEntity) { + super(damageName, (Entity)tileEntity.getDamageEntity()); + } + + public static TileDamageSource doBulletDamage(final TTurretBase tileEntity) { + return (TileDamageSource) new TileDamageSource("bullet", tileEntity) + .setProjectile(); + } + + public static TileDamageSource doLaserDamage(final TTurretBase tileEntity) { + return (TileDamageSource) new TileDamageSource("laser", tileEntity) + .setDamageBypassesArmor() + .setProjectile(); + } + + public DamageSource setDamageBypassesArmor() { + return super.setDamageBypassesArmor(); + } +} diff --git a/src/main/java/icbm/gangshao/muoxing/MLeiShe.java b/src/main/java/icbm/gangshao/muoxing/MLeiShe.java new file mode 100644 index 0000000..8302278 --- /dev/null +++ b/src/main/java/icbm/gangshao/muoxing/MLeiShe.java @@ -0,0 +1,329 @@ +package icbm.gangshao.muoxing; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class MLeiShe extends ModelBase { + ModelRenderer basePlate; + ModelRenderer leftMount; + ModelRenderer rightMount; + ModelRenderer body; + ModelRenderer bodyTop; + ModelRenderer bodyRight; + ModelRenderer bodyLeft; + ModelRenderer leftBarrel; + ModelRenderer rightBarrel; + ModelRenderer l1; + ModelRenderer l2; + ModelRenderer l3; + ModelRenderer l4; + ModelRenderer l5; + ModelRenderer r1; + ModelRenderer r2; + ModelRenderer r3; + ModelRenderer r4; + ModelRenderer r5; + ModelRenderer lCap; + ModelRenderer rCap; + ModelRenderer Hat; + ModelRenderer LowerHat; + ModelRenderer BatteryPack; + ModelRenderer MiddleWire; + ModelRenderer BatWire; + ModelRenderer HatWire; + ModelRenderer Details; + ModelRenderer RightFootStrength; + ModelRenderer LeftFootStrength; + ModelRenderer FrontDetail; + ModelRenderer LeftFootBase; + ModelRenderer RightFootBase; + ModelRenderer lEar1; + ModelRenderer lEar2; + ModelRenderer rEar1; + ModelRenderer rEar2; + + public MLeiShe() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.basePlate = new ModelRenderer((ModelBase) this, 0, 67)) + .addBox(-5.5f, 0.0f, -5.5f, 11, 1, 11); + this.basePlate.setRotationPoint(0.0f, 23.0f, 0.0f); + this.basePlate.setTextureSize(128, 128); + this.basePlate.mirror = true; + this.setRotation(this.basePlate, 0.0f, 0.0f, 0.0f); + (this.leftMount = new ModelRenderer((ModelBase) this, 0, 53)) + .addBox(4.0f, -8.0f, -2.0f, 1, 8, 4); + this.leftMount.setRotationPoint(0.0f, 23.0f, 0.0f); + this.leftMount.setTextureSize(128, 128); + this.leftMount.mirror = true; + this.setRotation(this.leftMount, 0.0f, 0.0f, 0.0f); + (this.rightMount = new ModelRenderer((ModelBase) this, 11, 53)) + .addBox(-5.0f, -8.0f, -2.0f, 1, 8, 4); + this.rightMount.setRotationPoint(0.0f, 23.0f, 0.0f); + this.rightMount.setTextureSize(128, 128); + this.rightMount.mirror = true; + this.setRotation(this.rightMount, 0.0f, 0.0f, 0.0f); + (this.body = new ModelRenderer((ModelBase) this, 0, 37)) + .addBox(-3.0f, -2.8f, -4.0f, 6, 5, 9); + this.body.setRotationPoint(0.0f, 17.0f, 0.0f); + this.body.setTextureSize(128, 128); + this.body.mirror = true; + this.setRotation(this.body, 0.0f, 0.0f, 0.0f); + (this.bodyTop = new ModelRenderer((ModelBase) this, 36, 51)) + .addBox(-2.0f, -4.0f, -3.0f, 4, 2, 7); + this.bodyTop.setRotationPoint(0.0f, 17.0f, 0.0f); + this.bodyTop.setTextureSize(128, 128); + this.bodyTop.mirror = true; + this.setRotation(this.bodyTop, 0.0f, 0.0f, 0.0f); + (this.bodyRight = new ModelRenderer((ModelBase) this, 31, 37)) + .addBox(-4.0f, -2.5f, -3.0f, 1, 4, 7); + this.bodyRight.setRotationPoint(0.0f, 17.0f, 0.0f); + this.bodyRight.setTextureSize(128, 128); + this.bodyRight.mirror = true; + this.setRotation(this.bodyRight, 0.0f, 0.0f, 0.0f); + (this.bodyLeft = new ModelRenderer((ModelBase) this, 48, 37)) + .addBox(3.0f, -2.5f, -3.0f, 1, 4, 7); + this.bodyLeft.setRotationPoint(0.0f, 17.0f, 0.0f); + this.bodyLeft.setTextureSize(128, 128); + this.bodyLeft.mirror = true; + this.setRotation(this.bodyLeft, 0.0f, 0.0f, 0.0f); + (this.leftBarrel = new ModelRenderer((ModelBase) this, 29, 81)) + .addBox(2.0f, -1.0f, -17.0f, 1, 1, 13); + this.leftBarrel.setRotationPoint(0.0f, 17.0f, 0.0f); + this.leftBarrel.setTextureSize(128, 128); + this.leftBarrel.mirror = true; + this.setRotation(this.leftBarrel, 0.0f, 0.0f, 0.0f); + (this.rightBarrel = new ModelRenderer((ModelBase) this, 0, 81)) + .addBox(-3.0f, -1.0f, -17.0f, 1, 1, 13); + this.rightBarrel.setRotationPoint(0.0f, 17.0f, 0.0f); + this.rightBarrel.setTextureSize(128, 128); + this.rightBarrel.mirror = true; + this.setRotation(this.rightBarrel, 0.0f, 0.0f, 0.0f); + (this.l1 = new ModelRenderer((ModelBase) this, 1, 14)) + .addBox(0.9f, -2.0f, -6.0f, 3, 3, 3); + this.l1.setRotationPoint(0.0f, 17.0f, 0.0f); + this.l1.setTextureSize(128, 128); + this.l1.mirror = true; + this.setRotation(this.l1, 0.0f, 0.0f, 0.0f); + (this.l2 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, 0.0f, 3, 3, 1); + this.l2.setRotationPoint(2.5f, 16.5f, -8.0f); + this.l2.setTextureSize(128, 128); + this.l2.mirror = true; + this.setRotation(this.l2, 0.0f, 0.0f, 0.0f); + (this.l3 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, 0.0f, 3, 3, 1); + this.l3.setRotationPoint(2.5f, 16.5f, -10.0f); + this.l3.setTextureSize(128, 128); + this.l3.mirror = true; + this.setRotation(this.l3, 0.0f, 0.0f, 0.0f); + (this.l4 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, 0.0f, 3, 3, 1); + this.l4.setRotationPoint(2.5f, 16.5f, -12.0f); + this.l4.setTextureSize(128, 128); + this.l4.mirror = true; + this.setRotation(this.l4, 0.0f, 0.0f, 0.0f); + (this.l5 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, 0.0f, 3, 3, 1); + this.l5.setRotationPoint(2.5f, 16.5f, -14.0f); + this.l5.setTextureSize(128, 128); + this.l5.mirror = true; + this.setRotation(this.l5, 0.0f, 0.0f, 0.0f); + (this.r1 = new ModelRenderer((ModelBase) this, 14, 14)) + .addBox(-3.9f, -2.0f, -6.0f, 3, 3, 3); + this.r1.setRotationPoint(0.0f, 17.0f, 0.0f); + this.r1.setTextureSize(128, 128); + this.r1.mirror = true; + this.setRotation(this.r1, 0.0f, 0.0f, 0.0f); + (this.r2 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, 0.0f, 3, 3, 1); + this.r2.setRotationPoint(-2.5f, 16.5f, -8.0f); + this.r2.setTextureSize(128, 128); + this.r2.mirror = true; + this.setRotation(this.r2, 0.0f, 0.0f, 0.0f); + (this.r3 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, -2.0f, 3, 3, 1); + this.r3.setRotationPoint(-2.5f, 16.5f, -8.0f); + this.r3.setTextureSize(128, 128); + this.r3.mirror = true; + this.setRotation(this.r3, 0.0f, 0.0f, 0.0f); + (this.r4 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, -4.0f, 3, 3, 1); + this.r4.setRotationPoint(-2.5f, 16.5f, -8.0f); + this.r4.setTextureSize(128, 128); + this.r4.mirror = true; + this.setRotation(this.r4, 0.0f, 0.0f, 0.0f); + (this.r5 = new ModelRenderer((ModelBase) this, 9, 28)) + .addBox(-1.5f, -1.5f, -6.0f, 3, 3, 1); + this.r5.setRotationPoint(-2.5f, 16.5f, -8.0f); + this.r5.setTextureSize(128, 128); + this.r5.mirror = true; + this.setRotation(this.r5, 0.0f, 0.0f, 0.0f); + (this.lCap = new ModelRenderer((ModelBase) this, 33, 25)) + .addBox(1.0f, -2.0f, -20.0f, 3, 3, 4); + this.lCap.setRotationPoint(0.0f, 17.0f, 0.0f); + this.lCap.setTextureSize(128, 128); + this.lCap.mirror = true; + this.setRotation(this.lCap, 0.0f, 0.0f, 0.0f); + (this.rCap = new ModelRenderer((ModelBase) this, 18, 25)) + .addBox(-4.0f, -2.0f, -20.0f, 3, 3, 4); + this.rCap.setRotationPoint(0.0f, 17.0f, 0.0f); + this.rCap.setTextureSize(128, 128); + this.rCap.mirror = true; + this.setRotation(this.rCap, 0.0f, 0.0f, 0.0f); + (this.Hat = new ModelRenderer((ModelBase) this, 28, 0)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 7); + this.Hat.setRotationPoint(-1.5f, 12.0f, -2.0f); + this.Hat.setTextureSize(128, 128); + this.Hat.mirror = true; + this.setRotation(this.Hat, 0.0f, 0.0f, 0.0f); + (this.LowerHat = new ModelRenderer((ModelBase) this, 50, 0)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 1); + this.LowerHat.setRotationPoint(-1.5f, 13.0f, 4.0f); + this.LowerHat.setTextureSize(128, 128); + this.LowerHat.mirror = true; + this.setRotation(this.LowerHat, 0.0f, 0.0f, 0.0f); + (this.BatteryPack = new ModelRenderer((ModelBase) this, 50, 3)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 1); + this.BatteryPack.setRotationPoint(-2.0f, 15.0f, 5.0f); + this.BatteryPack.setTextureSize(128, 128); + this.BatteryPack.mirror = true; + this.setRotation(this.BatteryPack, 0.0f, 0.0f, 0.0f); + (this.MiddleWire = new ModelRenderer((ModelBase) this, 64, 0)) + .addBox(0.0f, 0.0f, 0.0f, 1, 4, 1); + this.MiddleWire.setRotationPoint(-0.5f, 13.0f, 7.0f); + this.MiddleWire.setTextureSize(128, 128); + this.MiddleWire.mirror = true; + this.setRotation(this.MiddleWire, 0.0f, 0.0f, 0.0f); + (this.BatWire = new ModelRenderer((ModelBase) this, 64, 6)) + .addBox(0.0f, 0.0f, 0.0f, 1, 1, 1); + this.BatWire.setRotationPoint(-0.5f, 16.0f, 6.0f); + this.BatWire.setTextureSize(128, 128); + this.BatWire.mirror = true; + this.setRotation(this.BatWire, 0.0f, 0.0f, 0.0f); + (this.HatWire = new ModelRenderer((ModelBase) this, 69, 0)) + .addBox(0.0f, 0.0f, 0.0f, 1, 1, 2); + this.HatWire.setRotationPoint(-0.5f, 13.0f, 5.0f); + this.HatWire.setTextureSize(128, 128); + this.HatWire.mirror = true; + this.setRotation(this.HatWire, 0.0f, 0.0f, 0.0f); + (this.Details = new ModelRenderer((ModelBase) this, 28, 10)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 1); + this.Details.setRotationPoint(-1.5f, 22.0f, -5.5f); + this.Details.setTextureSize(128, 128); + this.Details.mirror = true; + this.setRotation(this.Details, 0.0f, 0.0f, 0.0f); + (this.RightFootStrength = new ModelRenderer((ModelBase) this, 28, 14)) + .addBox(0.0f, 0.0f, 0.0f, 1, 2, 4); + this.RightFootStrength.setRotationPoint(3.0f, 20.0f, -2.0f); + this.RightFootStrength.setTextureSize(128, 128); + this.RightFootStrength.mirror = true; + this.setRotation(this.RightFootStrength, 0.0f, 0.0f, 0.0f); + (this.LeftFootStrength = new ModelRenderer((ModelBase) this, 28, 14)) + .addBox(0.0f, 0.0f, 0.0f, 1, 2, 4); + this.LeftFootStrength.setRotationPoint(-4.0f, 20.0f, -2.0f); + this.LeftFootStrength.setTextureSize(128, 128); + this.LeftFootStrength.mirror = true; + this.setRotation(this.LeftFootStrength, 0.0f, 0.0f, 0.0f); + (this.FrontDetail = new ModelRenderer((ModelBase) this, 40, 10)) + .addBox(0.0f, 0.0f, 0.0f, 3, 3, 1); + this.FrontDetail.setRotationPoint(-1.5f, 21.0f, -6.5f); + this.FrontDetail.setTextureSize(128, 128); + this.FrontDetail.mirror = true; + this.setRotation(this.FrontDetail, 0.0f, 0.0f, 0.0f); + (this.LeftFootBase = new ModelRenderer((ModelBase) this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 6); + this.LeftFootBase.setRotationPoint(-5.5f, 22.0f, -3.0f); + this.LeftFootBase.setTextureSize(128, 128); + this.LeftFootBase.mirror = true; + this.setRotation(this.LeftFootBase, 0.0f, 0.0f, 0.0f); + (this.RightFootBase = new ModelRenderer((ModelBase) this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 6); + this.RightFootBase.setRotationPoint(2.5f, 22.0f, -3.0f); + this.RightFootBase.setTextureSize(128, 128); + this.RightFootBase.mirror = true; + this.setRotation(this.RightFootBase, 0.0f, 0.0f, 0.0f); + (this.lEar1 = new ModelRenderer((ModelBase) this, 28, 56)) + .addBox(2.0f, -5.0f, -4.0f, 1, 5, 1); + this.lEar1.setRotationPoint(0.0f, 17.0f, 5.0f); + this.lEar1.setTextureSize(128, 128); + this.lEar1.mirror = true; + this.setRotation(this.lEar1, -0.6632251f, 0.0f, 0.0f); + (this.lEar2 = new ModelRenderer((ModelBase) this, 28, 56)) + .addBox(2.0f, -5.0f, -4.0f, 1, 5, 1); + this.lEar2.setRotationPoint(0.0f, 17.0f, 0.0f); + this.lEar2.setTextureSize(128, 128); + this.lEar2.mirror = true; + this.setRotation(this.lEar2, -0.6632251f, 0.0f, 0.0f); + (this.rEar1 = new ModelRenderer((ModelBase) this, 23, 56)) + .addBox(-3.0f, -5.0f, -4.0f, 1, 5, 1); + this.rEar1.setRotationPoint(0.0f, 17.0f, 5.0f); + this.rEar1.setTextureSize(128, 128); + this.rEar1.mirror = true; + this.setRotation(this.rEar1, -0.6632251f, 0.0f, 0.0f); + (this.rEar2 = new ModelRenderer((ModelBase) this, 23, 56)) + .addBox(-3.0f, -5.0f, -4.0f, 1, 5, 1); + this.rEar2.setRotationPoint(0.0f, 17.0f, 0.0f); + this.rEar2.setTextureSize(128, 128); + this.rEar2.mirror = true; + this.setRotation(this.rEar2, -0.6632251f, 0.0f, 0.0f); + } + + public void renderYaw(final float f5) { + this.basePlate.render(f5); + this.leftMount.render(f5); + this.rightMount.render(f5); + this.Details.render(f5); + this.FrontDetail.render(f5); + this.RightFootStrength.render(f5); + this.LeftFootStrength.render(f5); + this.LeftFootBase.render(f5); + this.RightFootBase.render(f5); + } + + public void renderYawPitch(final float f5, final float rotation) { + this.body.render(f5); + this.bodyTop.render(f5); + this.bodyRight.render(f5); + this.bodyLeft.render(f5); + this.leftBarrel.render(f5); + this.rightBarrel.render(f5); + this.l1.render(f5); + this.r1.render(f5); + this.l2.rotateAngleZ = -rotation; + this.l2.render(f5); + this.l3.rotateAngleZ = -rotation; + this.l3.render(f5); + this.l4.rotateAngleZ = -rotation; + this.l4.render(f5); + this.l5.rotateAngleZ = -rotation; + this.l5.render(f5); + this.r2.rotateAngleZ = rotation; + this.r2.render(f5); + this.r3.rotateAngleZ = rotation; + this.r3.render(f5); + this.r4.rotateAngleZ = rotation; + this.r4.render(f5); + this.r5.rotateAngleZ = rotation; + this.r5.render(f5); + this.lCap.render(f5); + this.rCap.render(f5); + this.Hat.render(f5); + this.LowerHat.render(f5); + this.BatteryPack.render(f5); + this.MiddleWire.render(f5); + this.BatWire.render(f5); + this.HatWire.render(f5); + this.lEar1.render(f5); + this.lEar2.render(f5); + this.rEar1.render(f5); + this.rEar2.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/gangshao/muoxing/ModelAATurret.java b/src/main/java/icbm/gangshao/muoxing/ModelAATurret.java new file mode 100644 index 0000000..bc91003 --- /dev/null +++ b/src/main/java/icbm/gangshao/muoxing/ModelAATurret.java @@ -0,0 +1,371 @@ +package icbm.gangshao.muoxing; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class ModelAATurret extends ModelBase { + ModelRenderer rot1; + ModelRenderer radarNeck; + ModelRenderer radarBase; + ModelRenderer radarBack; + ModelRenderer radarRight; + ModelRenderer radarLeft; + ModelRenderer baseEdge4; + ModelRenderer base; + ModelRenderer baseEdge3; + ModelRenderer baseEdge1; + ModelRenderer baseEdge2; + ModelRenderer body; + ModelRenderer bodyFace; + ModelRenderer bodyTop; + ModelRenderer bodyEdge; + ModelRenderer bodyArmRight; + ModelRenderer bodyBack; + ModelRenderer bodyBubble; + ModelRenderer bodyArmLeft; + ModelRenderer cannonRight; + ModelRenderer cannonFaceRight; + ModelRenderer cannonBarrelTopRight; + ModelRenderer cannonBarrelBotRight; + ModelRenderer cannonCapTopRight; + ModelRenderer cannonCapBotRight; + ModelRenderer cannonInFaceRight; + ModelRenderer cannonBarrelCouple; + ModelRenderer cannonBarrelNeck; + ModelRenderer cannonCapBotLeft; + ModelRenderer cannonCapTopLeft; + ModelRenderer cannonFaceLeft; + ModelRenderer cannonLeft; + ModelRenderer cannonInFaceLeft; + ModelRenderer cannonBarrelNeckLeft; + ModelRenderer cannonBarrelBotLeft; + ModelRenderer cannonBarrelCoupleLeft; + ModelRenderer cannonBarrelTopLeft; + + public ModelAATurret() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.rot1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-8.0f, 0.0f, -8.0f, 16, 2, 18); + this.rot1.setRotationPoint(0.0f, 19.0f, 0.0f); + this.rot1.setTextureSize(128, 128); + this.rot1.mirror = true; + this.setRotation(this.rot1, 0.0f, 0.0f, 0.0f); + (this.radarNeck = new ModelRenderer((ModelBase)this, 69, 0)) + .addBox(-1.5f, -1.0f, -0.5f, 3, 3, 2); + this.radarNeck.setRotationPoint(0.0f, -3.0f, 2.0f); + this.radarNeck.setTextureSize(128, 128); + this.radarNeck.mirror = true; + this.setRotation(this.radarNeck, 0.0f, 0.0f, 0.0f); + (this.radarBase = new ModelRenderer((ModelBase)this, 81, 0)) + .addBox(-3.0f, -1.0f, -3.0f, 6, 1, 6); + this.radarBase.setRotationPoint(0.0f, 0.0f, 2.0f); + this.radarBase.setTextureSize(128, 128); + this.radarBase.mirror = true; + this.setRotation(this.radarBase, 0.0f, 0.0f, 0.0f); + (this.radarBack = new ModelRenderer((ModelBase)this, 68, 6)) + .addBox(-2.5f, -1.0f, -0.5f, 5, 3, 1); + this.radarBack.setRotationPoint(0.0f, -4.0f, 2.0f); + this.radarBack.setTextureSize(128, 128); + this.radarBack.mirror = true; + this.setRotation(this.radarBack, 0.0f, 0.0f, 0.0f); + (this.radarRight = new ModelRenderer((ModelBase)this, 68, 6)) + .addBox(0.5f, -1.0f, 1.5f, 5, 3, 1); + this.radarRight.setRotationPoint(0.0f, -4.0f, 2.0f); + this.radarRight.setTextureSize(128, 128); + this.radarRight.mirror = true; + this.setRotation(this.radarRight, 0.0f, 0.7853982f, 0.0f); + this.radarRight.mirror = false; + (this.radarLeft = new ModelRenderer((ModelBase)this, 68, 6)) + .addBox(-5.5f, -1.0f, 1.5f, 5, 3, 1); + this.radarLeft.setRotationPoint(0.0f, -4.0f, 2.0f); + this.radarLeft.setTextureSize(128, 128); + this.radarLeft.mirror = true; + this.setRotation(this.radarLeft, 0.0f, -0.7853982f, 0.0f); + (this.baseEdge4 = new ModelRenderer((ModelBase)this, 73, 70)) + .addBox(-7.0f, 0.0f, -11.0f, 14, 3, 2); + this.baseEdge4.setRotationPoint(0.0f, 21.0f, 0.0f); + this.baseEdge4.setTextureSize(128, 128); + this.baseEdge4.mirror = true; + this.setRotation(this.baseEdge4, 0.0f, 3.141593f, 0.0f); + (this.base = new ModelRenderer((ModelBase)this, 0, 70)) + .addBox(-9.0f, 0.0f, -9.0f, 18, 3, 18); + this.base.setRotationPoint(0.0f, 21.0f, 0.0f); + this.base.setTextureSize(128, 128); + this.base.mirror = true; + this.setRotation(this.base, 0.0f, 0.0f, 0.0f); + (this.baseEdge3 = new ModelRenderer((ModelBase)this, 73, 70)) + .addBox(-7.0f, 0.0f, -11.0f, 14, 3, 2); + this.baseEdge3.setRotationPoint(0.0f, 21.0f, 0.0f); + this.baseEdge3.setTextureSize(128, 128); + this.baseEdge3.mirror = true; + this.setRotation(this.baseEdge3, 0.0f, -1.570796f, 0.0f); + (this.baseEdge1 = new ModelRenderer((ModelBase)this, 73, 70)) + .addBox(-7.0f, 0.0f, -11.0f, 14, 3, 2); + this.baseEdge1.setRotationPoint(0.0f, 21.0f, 0.0f); + this.baseEdge1.setTextureSize(128, 128); + this.baseEdge1.mirror = true; + this.setRotation(this.baseEdge1, 0.0f, 0.0f, 0.0f); + (this.baseEdge2 = new ModelRenderer((ModelBase)this, 73, 70)) + .addBox(-7.0f, 0.0f, -11.0f, 14, 3, 2); + this.baseEdge2.setRotationPoint(0.0f, 21.0f, 0.0f); + this.baseEdge2.setTextureSize(128, 128); + this.baseEdge2.mirror = true; + this.setRotation(this.baseEdge2, 0.0f, 1.570796f, 0.0f); + (this.body = new ModelRenderer((ModelBase)this, 0, 92)) + .addBox(-7.0f, 0.0f, -6.0f, 14, 17, 16); + this.body.setRotationPoint(0.0f, 2.0f, 0.0f); + this.body.setTextureSize(128, 128); + this.body.mirror = true; + this.setRotation(this.body, 0.0f, 0.0f, 0.0f); + (this.bodyFace = new ModelRenderer((ModelBase)this, 61, 106)) + .addBox(-5.0f, 0.0f, -8.0f, 10, 17, 2); + this.bodyFace.setRotationPoint(0.0f, 2.0f, 0.0f); + this.bodyFace.setTextureSize(128, 128); + this.bodyFace.mirror = true; + this.setRotation(this.bodyFace, 0.0f, 0.0f, 0.0f); + (this.bodyTop = new ModelRenderer((ModelBase)this, 73, 85)) + .addBox(-5.0f, -2.0f, -7.0f, 10, 2, 16); + this.bodyTop.setRotationPoint(0.0f, 2.0f, 0.0f); + this.bodyTop.setTextureSize(128, 128); + this.bodyTop.mirror = true; + this.setRotation(this.bodyTop, 0.0f, 0.0f, 0.0f); + (this.bodyEdge = new ModelRenderer((ModelBase)this, 65, 126)) + .addBox(-4.5f, -1.0f, -7.0f, 9, 1, 1); + this.bodyEdge.setRotationPoint(0.0f, 2.0f, 0.0f); + this.bodyEdge.setTextureSize(128, 128); + this.bodyEdge.mirror = true; + this.setRotation(this.bodyEdge, 0.0f, 0.0f, 0.0f); + (this.bodyArmRight = new ModelRenderer((ModelBase)this, 86, 104)) + .addBox(-1.0f, -3.5f, -3.5f, 2, 16, 7); + this.bodyArmRight.setRotationPoint(-8.0f, 6.0f, 1.0f); + this.bodyArmRight.setTextureSize(128, 128); + this.bodyArmRight.mirror = true; + this.setRotation(this.bodyArmRight, 0.0f, 0.0f, 0.0f); + (this.bodyBack = new ModelRenderer((ModelBase)this, 61, 104)) + .addBox(-5.0f, 0.0f, 10.0f, 10, 19, 2); + this.bodyBack.setRotationPoint(0.0f, 2.0f, 0.0f); + this.bodyBack.setTextureSize(128, 128); + this.bodyBack.mirror = true; + this.setRotation(this.bodyBack, 0.0f, 0.0f, 0.0f); + (this.bodyBubble = new ModelRenderer((ModelBase)this, 105, 106)) + .addBox(-4.0f, 3.0f, -10.0f, 8, 8, 2); + this.bodyBubble.setRotationPoint(0.0f, 2.0f, 0.0f); + this.bodyBubble.setTextureSize(128, 128); + this.bodyBubble.mirror = true; + this.setRotation(this.bodyBubble, 0.0f, 0.0f, 0.0f); + (this.bodyArmLeft = new ModelRenderer((ModelBase)this, 86, 104)) + .addBox(-1.0f, -3.5f, -3.5f, 2, 16, 7); + this.bodyArmLeft.setRotationPoint(8.0f, 6.0f, 1.0f); + this.bodyArmLeft.setTextureSize(128, 128); + this.bodyArmLeft.mirror = true; + this.setRotation(this.bodyArmLeft, 0.0f, 0.0f, 0.0f); + (this.cannonRight = new ModelRenderer((ModelBase)this, 69, 11)) + .addBox(-4.0f, -5.5f, -10.5f, 4, 11, 20); + this.cannonRight.setRotationPoint(-10.0f, 7.0f, 1.0f); + this.cannonRight.setTextureSize(128, 128); + this.cannonRight.mirror = true; + this.setRotation(this.cannonRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonFaceRight = new ModelRenderer((ModelBase)this, 0, 43)) + .addBox(-5.0f, -4.0f, -9.5f, 1, 8, 18); + this.cannonFaceRight.setRotationPoint(-5.0f, 7.0f, 1.0f); + this.cannonFaceRight.setTextureSize(128, 128); + this.cannonFaceRight.mirror = true; + this.setRotation(this.cannonFaceRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelTopRight = new ModelRenderer((ModelBase)this, 42, 52)) + .addBox(-3.0f, -4.0f, -25.5f, 2, 2, 15); + this.cannonBarrelTopRight.setRotationPoint(-10.0f, 7.0f, 1.0f); + this.cannonBarrelTopRight.setTextureSize(128, 128); + this.cannonBarrelTopRight.mirror = true; + this.setRotation(this.cannonBarrelTopRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelBotRight = new ModelRenderer((ModelBase)this, 42, 52)) + .addBox(-3.0f, 1.0f, -25.5f, 2, 2, 15); + this.cannonBarrelBotRight.setRotationPoint(-10.0f, 7.0f, 1.0f); + this.cannonBarrelBotRight.setTextureSize(128, 128); + this.cannonBarrelBotRight.mirror = true; + this.setRotation(this.cannonBarrelBotRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonCapTopRight = new ModelRenderer((ModelBase)this, 73, 77)) + .addBox(-3.5f, -4.5f, -29.5f, 3, 3, 4); + this.cannonCapTopRight.setRotationPoint(-10.0f, 7.0f, 1.0f); + this.cannonCapTopRight.setTextureSize(128, 128); + this.cannonCapTopRight.mirror = true; + this.setRotation(this.cannonCapTopRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonCapBotRight = new ModelRenderer((ModelBase)this, 73, 77)) + .addBox(-3.5f, 0.5f, -29.5f, 3, 3, 4); + this.cannonCapBotRight.setRotationPoint(-10.0f, 7.0f, 1.0f); + this.cannonCapBotRight.setTextureSize(128, 128); + this.cannonCapBotRight.mirror = true; + this.setRotation(this.cannonCapBotRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonInFaceRight = new ModelRenderer((ModelBase)this, 77, 43)) + .addBox(-5.0f, -4.0f, -9.5f, 1, 8, 18); + this.cannonInFaceRight.setRotationPoint(-10.0f, 7.0f, 1.0f); + this.cannonInFaceRight.setTextureSize(128, 128); + this.cannonInFaceRight.mirror = true; + this.setRotation(this.cannonInFaceRight, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelCouple = new ModelRenderer((ModelBase)this, 89, 77)) + .addBox(-2.5f, -4.0f, -14.5f, 1, 4, 3); + this.cannonBarrelCouple.setRotationPoint(-10.0f, 9.0f, 1.0f); + this.cannonBarrelCouple.setTextureSize(128, 128); + this.cannonBarrelCouple.mirror = true; + this.setRotation(this.cannonBarrelCouple, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelNeck = new ModelRenderer((ModelBase)this, 106, 70)) + .addBox(-3.5f, -6.0f, -13.3f, 3, 8, 2); + this.cannonBarrelNeck.setRotationPoint(-10.0f, 9.0f, 1.0f); + this.cannonBarrelNeck.setTextureSize(128, 128); + this.cannonBarrelNeck.mirror = true; + this.setRotation(this.cannonBarrelNeck, -0.6108652f, 0.0f, 0.0f); + (this.cannonCapBotLeft = new ModelRenderer((ModelBase)this, 73, 77)) + .addBox(0.5f, 0.5f, -29.5f, 3, 3, 4); + this.cannonCapBotLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonCapBotLeft.setTextureSize(128, 128); + this.cannonCapBotLeft.mirror = true; + this.setRotation(this.cannonCapBotLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonCapTopLeft = new ModelRenderer((ModelBase)this, 73, 77)) + .addBox(0.7f, -4.5f, -29.5f, 3, 3, 4); + this.cannonCapTopLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonCapTopLeft.setTextureSize(128, 128); + this.cannonCapTopLeft.mirror = true; + this.setRotation(this.cannonCapTopLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonFaceLeft = new ModelRenderer((ModelBase)this, 0, 43)) + .addBox(-1.0f, -4.0f, -9.5f, 1, 8, 18); + this.cannonFaceLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonFaceLeft.setTextureSize(128, 128); + this.cannonFaceLeft.mirror = true; + this.setRotation(this.cannonFaceLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonLeft = new ModelRenderer((ModelBase)this, 69, 11)) + .addBox(0.0f, -5.5f, -10.5f, 4, 11, 20); + this.cannonLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonLeft.setTextureSize(128, 128); + this.cannonLeft.mirror = true; + this.setRotation(this.cannonLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonInFaceLeft = new ModelRenderer((ModelBase)this, 77, 43)) + .addBox(4.0f, -4.0f, -9.5f, 1, 8, 18); + this.cannonInFaceLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonInFaceLeft.setTextureSize(128, 128); + this.cannonInFaceLeft.mirror = true; + this.setRotation(this.cannonInFaceLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelNeckLeft = new ModelRenderer((ModelBase)this, 106, 70)) + .addBox(0.5f, -6.0f, -13.3f, 3, 8, 2); + this.cannonBarrelNeckLeft.setRotationPoint(10.0f, 9.0f, 1.0f); + this.cannonBarrelNeckLeft.setTextureSize(128, 128); + this.cannonBarrelNeckLeft.mirror = true; + this.setRotation(this.cannonBarrelNeckLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelBotLeft = new ModelRenderer((ModelBase)this, 42, 52)) + .addBox(1.0f, 1.0f, -25.5f, 2, 2, 15); + this.cannonBarrelBotLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonBarrelBotLeft.setTextureSize(128, 128); + this.cannonBarrelBotLeft.mirror = true; + this.setRotation(this.cannonBarrelBotLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelCoupleLeft = new ModelRenderer((ModelBase)this, 89, 77)) + .addBox(1.5f, -4.0f, -14.5f, 1, 4, 3); + this.cannonBarrelCoupleLeft.setRotationPoint(10.0f, 9.0f, 1.0f); + this.cannonBarrelCoupleLeft.setTextureSize(128, 128); + this.cannonBarrelCoupleLeft.mirror = true; + this.setRotation(this.cannonBarrelCoupleLeft, -0.6108652f, 0.0f, 0.0f); + (this.cannonBarrelTopLeft = new ModelRenderer((ModelBase)this, 42, 52)) + .addBox(1.0f, -4.0f, -25.5f, 2, 2, 15); + this.cannonBarrelTopLeft.setRotationPoint(10.0f, 7.0f, 1.0f); + this.cannonBarrelTopLeft.setTextureSize(128, 128); + this.cannonBarrelTopLeft.mirror = true; + this.setRotation(this.cannonBarrelTopLeft, -0.6108652f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.rot1.render(f5); + this.radarNeck.render(f5); + this.radarBase.render(f5); + this.radarBack.render(f5); + this.radarRight.render(f5); + this.radarLeft.render(f5); + this.baseEdge4.render(f5); + this.base.render(f5); + this.baseEdge3.render(f5); + this.baseEdge1.render(f5); + this.baseEdge2.render(f5); + this.body.render(f5); + this.bodyFace.render(f5); + this.bodyTop.render(f5); + this.bodyEdge.render(f5); + this.bodyArmRight.render(f5); + this.bodyBack.render(f5); + this.bodyBubble.render(f5); + this.bodyArmLeft.render(f5); + this.cannonRight.render(f5); + this.cannonFaceRight.render(f5); + this.cannonBarrelTopRight.render(f5); + this.cannonBarrelBotRight.render(f5); + this.cannonCapTopRight.render(f5); + this.cannonCapBotRight.render(f5); + this.cannonInFaceRight.render(f5); + this.cannonBarrelCouple.render(f5); + this.cannonBarrelNeck.render(f5); + this.cannonCapBotLeft.render(f5); + this.cannonCapTopLeft.render(f5); + this.cannonFaceLeft.render(f5); + this.cannonLeft.render(f5); + this.cannonInFaceLeft.render(f5); + this.cannonBarrelNeckLeft.render(f5); + this.cannonBarrelBotLeft.render(f5); + this.cannonBarrelCoupleLeft.render(f5); + this.cannonBarrelTopLeft.render(f5); + } + + public void renderBody(final float f5) { + this.rot1.render(f5); + this.baseEdge4.render(f5); + this.base.render(f5); + this.baseEdge3.render(f5); + this.baseEdge1.render(f5); + this.baseEdge2.render(f5); + this.body.render(f5); + this.bodyFace.render(f5); + this.bodyTop.render(f5); + this.bodyEdge.render(f5); + this.bodyArmRight.render(f5); + this.bodyBack.render(f5); + this.bodyBubble.render(f5); + this.bodyArmLeft.render(f5); + this.radarBase.render(f5); + } + + public void renderCannon(final float f5, final float rot) { + final ModelRenderer[] cannon = {this.cannonRight, + this.cannonFaceRight, + this.cannonBarrelTopRight, + this.cannonBarrelBotRight, + this.cannonCapTopRight, + this.cannonCapBotRight, + this.cannonInFaceRight, + this.cannonBarrelCouple, + this.cannonBarrelNeck, + this.cannonCapBotLeft, + this.cannonCapTopLeft, + this.cannonFaceLeft, + this.cannonLeft, + this.cannonInFaceLeft, + this.cannonBarrelNeckLeft, + this.cannonBarrelBotLeft, + this.cannonBarrelCoupleLeft, + this.cannonBarrelTopLeft}; + for (int i = 0; i < cannon.length; ++i) { + cannon[i].rotateAngleX = rot; + } + for (int i = 0; i < cannon.length; ++i) { + cannon[i].render(f5); + } + } + + public void renderRadar(final float f5) { + this.radarNeck.render(f5); + this.radarBack.render(f5); + this.radarRight.render(f5); + this.radarLeft.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/gangshao/muoxing/ModelGunTurret.java b/src/main/java/icbm/gangshao/muoxing/ModelGunTurret.java new file mode 100644 index 0000000..93a3570 --- /dev/null +++ b/src/main/java/icbm/gangshao/muoxing/ModelGunTurret.java @@ -0,0 +1,338 @@ +package icbm.gangshao.muoxing; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class ModelGunTurret extends ModelBase { + ModelRenderer BasePlate; + ModelRenderer neck; + ModelRenderer neck2; + ModelRenderer neck3; + ModelRenderer neck4; + ModelRenderer Base; + ModelRenderer LeftSide; + ModelRenderer LeftSideB; + ModelRenderer RightSide; + ModelRenderer RightSideB; + ModelRenderer CannonBackStoper; + ModelRenderer CannonBarrelBrace; + ModelRenderer CannonS1; + ModelRenderer CannonS2; + ModelRenderer CannonS3; + ModelRenderer CannonS4; + ModelRenderer CannonBarrel; + ModelRenderer CannonBrace; + ModelRenderer CannonLBeam; + ModelRenderer CannonRBeam; + ModelRenderer CannonBody; + ModelRenderer AmmoCase; + ModelRenderer AmmoB1; + ModelRenderer AmmoB2; + ModelRenderer AmmoB3; + ModelRenderer AmmoB3B; + ModelRenderer AmmoB2B; + ModelRenderer AmmoB1B; + ModelRenderer Shell1Tip; + ModelRenderer Shell1Body; + ModelRenderer Shell1Tip2; + ModelRenderer Shell1Body2; + ModelRenderer Shell1Tip3; + ModelRenderer Shell1Body3; + ModelRenderer Shell1Tip4; + ModelRenderer Shell1Body4; + ModelRenderer Shell1Tip5; + ModelRenderer Shell1Body5; + ModelRenderer AmmoCaseT; + + public ModelGunTurret() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.BasePlate = new ModelRenderer((ModelBase)this, 0, 113)) + .addBox(-7.5f, 3.0f, -6.5f, 15, 2, 13); + this.BasePlate.setRotationPoint(0.0f, 20.0f, 0.0f); + this.BasePlate.setTextureSize(128, 128); + this.BasePlate.mirror = true; + this.setRotation(this.BasePlate, 0.0f, 0.0f, 0.0f); + (this.neck = new ModelRenderer((ModelBase)this, 19, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 5, 8); + this.neck.setRotationPoint(0.0f, 19.0f, 0.0f); + this.neck.setTextureSize(128, 128); + this.neck.mirror = true; + this.setRotation(this.neck, 0.0f, 0.3926991f, 0.0f); + (this.neck2 = new ModelRenderer((ModelBase)this, 19, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 5, 8); + this.neck2.setRotationPoint(0.0f, 19.0f, 0.0f); + this.neck2.setTextureSize(128, 128); + this.neck2.mirror = true; + this.setRotation(this.neck2, 0.0f, 0.0f, 0.0f); + (this.neck3 = new ModelRenderer((ModelBase)this, 19, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 5, 8); + this.neck3.setRotationPoint(0.0f, 19.0f, 0.0f); + this.neck3.setTextureSize(128, 128); + this.neck3.mirror = true; + this.setRotation(this.neck3, 0.0f, 1.178097f, 0.0f); + (this.neck4 = new ModelRenderer((ModelBase)this, 19, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 5, 8); + this.neck4.setRotationPoint(0.0f, 19.0f, 0.0f); + this.neck4.setTextureSize(128, 128); + this.neck4.mirror = true; + this.setRotation(this.neck4, 0.0f, 0.7853982f, 0.0f); + (this.Base = new ModelRenderer((ModelBase)this, 0, 97)) + .addBox(-7.5f, -2.0f, -6.5f, 15, 2, 13); + this.Base.setRotationPoint(0.0f, 19.0f, 0.0f); + this.Base.setTextureSize(128, 128); + this.Base.mirror = true; + this.setRotation(this.Base, 0.0f, 0.0f, 0.0f); + (this.LeftSide = new ModelRenderer((ModelBase)this, 0, 59)) + .addBox(5.5f, -13.0f, -5.5f, 2, 2, 11); + this.LeftSide.setRotationPoint(0.0f, 19.0f, 0.0f); + this.LeftSide.setTextureSize(128, 128); + this.LeftSide.mirror = true; + this.setRotation(this.LeftSide, 0.0f, 0.0f, 0.0f); + (this.LeftSideB = new ModelRenderer((ModelBase)this, 0, 73)) + .addBox(5.5f, -11.0f, -6.5f, 2, 9, 13); + this.LeftSideB.setRotationPoint(0.0f, 19.0f, 0.0f); + this.LeftSideB.setTextureSize(128, 128); + this.LeftSideB.mirror = true; + this.setRotation(this.LeftSideB, 0.0f, 0.0f, 0.0f); + (this.RightSide = new ModelRenderer((ModelBase)this, 26, 59)) + .addBox(-5.5f, -13.0f, -5.5f, 2, 2, 11); + this.RightSide.setRotationPoint(0.0f, 19.0f, 0.0f); + this.RightSide.setTextureSize(128, 128); + this.RightSide.mirror = true; + this.setRotation(this.RightSide, 0.0f, 0.0f, 0.0f); + (this.RightSideB = new ModelRenderer((ModelBase)this, 31, 73)) + .addBox(-5.5f, -11.0f, -6.5f, 2, 9, 13); + this.RightSideB.setRotationPoint(0.0f, 19.0f, 0.0f); + this.RightSideB.setTextureSize(128, 128); + this.RightSideB.mirror = true; + this.setRotation(this.RightSideB, 0.0f, 0.0f, 0.0f); + (this.CannonBackStoper = new ModelRenderer((ModelBase)this, 0, 22)) + .addBox(-2.5f, -3.0f, 7.5f, 7, 7, 4); + this.CannonBackStoper.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonBackStoper.setTextureSize(128, 128); + this.CannonBackStoper.mirror = true; + this.setRotation(this.CannonBackStoper, -0.1745329f, 0.0f, 0.0f); + (this.CannonBarrelBrace = new ModelRenderer((ModelBase)this, 63, 61)) + .addBox(0.0f, 2.5f, -16.5f, 2, 2, 13); + this.CannonBarrelBrace.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonBarrelBrace.setTextureSize(128, 128); + this.CannonBarrelBrace.mirror = true; + this.setRotation(this.CannonBarrelBrace, -0.1745329f, 0.0f, 0.0f); + (this.CannonS1 = new ModelRenderer((ModelBase)this, 101, 44)) + .addBox(2.5f, -2.5f, -19.5f, 2, 5, 3); + this.CannonS1.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonS1.setTextureSize(128, 128); + this.CannonS1.mirror = true; + this.setRotation(this.CannonS1, -0.1745329f, 0.0f, 0.0f); + (this.CannonS2 = new ModelRenderer((ModelBase)this, 92, 53)) + .addBox(-1.5f, 1.5f, -19.5f, 5, 2, 3); + this.CannonS2.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonS2.setTextureSize(128, 128); + this.CannonS2.mirror = true; + this.setRotation(this.CannonS2, -0.1745329f, 0.0f, 0.0f); + (this.CannonS3 = new ModelRenderer((ModelBase)this, 89, 44)) + .addBox(-2.5f, -2.5f, -19.5f, 2, 5, 3); + this.CannonS3.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonS3.setTextureSize(128, 128); + this.CannonS3.mirror = true; + this.setRotation(this.CannonS3, -0.1745329f, 0.0f, 0.0f); + (this.CannonS4 = new ModelRenderer((ModelBase)this, 92, 38)) + .addBox(-1.5f, -3.5f, -19.5f, 5, 2, 3); + this.CannonS4.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonS4.setTextureSize(128, 128); + this.CannonS4.mirror = true; + this.setRotation(this.CannonS4, -0.1745329f, 0.0f, 0.0f); + (this.CannonBarrel = new ModelRenderer((ModelBase)this, 53, 45)) + .addBox(-1.5f, -2.5f, -16.5f, 5, 5, 8); + this.CannonBarrel.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonBarrel.setTextureSize(128, 128); + this.CannonBarrel.mirror = true; + this.setRotation(this.CannonBarrel, -0.1745329f, 0.0f, 0.0f); + (this.CannonBrace = new ModelRenderer((ModelBase)this, 43, 34)) + .addBox(-2.0f, -3.0f, -8.5f, 6, 6, 4); + this.CannonBrace.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonBrace.setTextureSize(128, 128); + this.CannonBrace.mirror = true; + this.setRotation(this.CannonBrace, -0.1745329f, 0.0f, 0.0f); + (this.CannonLBeam = new ModelRenderer((ModelBase)this, 66, 34)) + .addBox(5.0f, -2.0f, -2.0f, 2, 4, 4); + this.CannonLBeam.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonLBeam.setTextureSize(128, 128); + this.CannonLBeam.mirror = true; + this.setRotation(this.CannonLBeam, -0.1745329f, 0.0f, 0.0f); + (this.CannonRBeam = new ModelRenderer((ModelBase)this, 66, 34)) + .addBox(-4.0f, -2.0f, -2.0f, 2, 4, 4); + this.CannonRBeam.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonRBeam.setTextureSize(128, 128); + this.CannonRBeam.mirror = true; + this.setRotation(this.CannonRBeam, -0.1745329f, 0.0f, 0.0f); + (this.CannonBody = new ModelRenderer((ModelBase)this, 0, 34)) + .addBox(-3.0f, -4.0f, -4.5f, 8, 9, 12); + this.CannonBody.setRotationPoint(0.0f, 10.0f, 0.0f); + this.CannonBody.setTextureSize(128, 128); + this.CannonBody.mirror = true; + this.setRotation(this.CannonBody, -0.1745329f, 0.0f, 0.0f); + (this.AmmoCase = new ModelRenderer((ModelBase)this, 91, 105)) + .addBox(-10.5f, -5.0f, -6.5f, 5, 9, 14); + this.AmmoCase.setRotationPoint(0.0f, 20.0f, 0.0f); + this.AmmoCase.setTextureSize(128, 128); + this.AmmoCase.mirror = true; + this.setRotation(this.AmmoCase, 0.0f, 0.0f, 0.0f); + (this.AmmoB1 = new ModelRenderer((ModelBase)this, 114, 98)) + .addBox(-0.5f, -7.0f, -3.5f, 3, 5, 1); + this.AmmoB1.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoB1.setTextureSize(128, 128); + this.AmmoB1.mirror = true; + this.setRotation(this.AmmoB1, -0.1745329f, 0.0f, 0.0f); + (this.AmmoB2 = new ModelRenderer((ModelBase)this, 96, 93)) + .addBox(-8.5f, -9.0f, -3.5f, 10, 3, 1); + this.AmmoB2.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoB2.setTextureSize(128, 128); + this.AmmoB2.mirror = true; + this.setRotation(this.AmmoB2, -0.1745329f, 0.0f, 0.0f); + (this.AmmoB3 = new ModelRenderer((ModelBase)this, 91, 98)) + .addBox(-9.5f, -7.0f, -3.5f, 3, 5, 1); + this.AmmoB3.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoB3.setTextureSize(128, 128); + this.AmmoB3.mirror = true; + this.setRotation(this.AmmoB3, -0.1745329f, 0.0f, 0.0f); + (this.AmmoB3B = new ModelRenderer((ModelBase)this, 91, 98)) + .addBox(-9.5f, -7.0f, 6.5f, 3, 5, 1); + this.AmmoB3B.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoB3B.setTextureSize(128, 128); + this.AmmoB3B.mirror = true; + this.setRotation(this.AmmoB3B, -0.1745329f, 0.0f, 0.0f); + (this.AmmoB2B = new ModelRenderer((ModelBase)this, 96, 93)) + .addBox(-8.5f, -9.0f, 6.5f, 10, 3, 1); + this.AmmoB2B.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoB2B.setTextureSize(128, 128); + this.AmmoB2B.mirror = true; + this.setRotation(this.AmmoB2B, -0.1745329f, 0.0f, 0.0f); + (this.AmmoB1B = new ModelRenderer((ModelBase)this, 114, 98)) + .addBox(-0.5f, -7.0f, 6.5f, 3, 5, 1); + this.AmmoB1B.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoB1B.setTextureSize(128, 128); + this.AmmoB1B.mirror = true; + this.setRotation(this.AmmoB1B, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Tip = new ModelRenderer((ModelBase)this, 112, 82)) + .addBox(-9.0f, -6.5f, -2.5f, 2, 2, 2); + this.Shell1Tip.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Tip.setTextureSize(128, 128); + this.Shell1Tip.mirror = true; + this.setRotation(this.Shell1Tip, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Body = new ModelRenderer((ModelBase)this, 91, 82)) + .addBox(-9.5f, -7.0f, -0.5f, 3, 3, 7); + this.Shell1Body.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Body.setTextureSize(128, 128); + this.Shell1Body.mirror = true; + this.setRotation(this.Shell1Body, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Tip2 = new ModelRenderer((ModelBase)this, 112, 82)) + .addBox(-8.0f, -9.5f, -2.5f, 2, 2, 2); + this.Shell1Tip2.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Tip2.setTextureSize(128, 128); + this.Shell1Tip2.mirror = true; + this.setRotation(this.Shell1Tip2, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Body2 = new ModelRenderer((ModelBase)this, 91, 82)) + .addBox(-8.5f, -10.0f, -0.5f, 3, 3, 7); + this.Shell1Body2.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Body2.setTextureSize(128, 128); + this.Shell1Body2.mirror = true; + this.setRotation(this.Shell1Body2, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Tip3 = new ModelRenderer((ModelBase)this, 112, 82)) + .addBox(-4.5f, -9.5f, -2.5f, 2, 2, 2); + this.Shell1Tip3.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Tip3.setTextureSize(128, 128); + this.Shell1Tip3.mirror = true; + this.setRotation(this.Shell1Tip3, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Body3 = new ModelRenderer((ModelBase)this, 91, 82)) + .addBox(-5.0f, -10.0f, -0.5f, 3, 3, 7); + this.Shell1Body3.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Body3.setTextureSize(128, 128); + this.Shell1Body3.mirror = true; + this.setRotation(this.Shell1Body3, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Tip4 = new ModelRenderer((ModelBase)this, 112, 82)) + .addBox(-1.0f, -9.5f, -2.5f, 2, 2, 2); + this.Shell1Tip4.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Tip4.setTextureSize(128, 128); + this.Shell1Tip4.mirror = true; + this.setRotation(this.Shell1Tip4, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Body4 = new ModelRenderer((ModelBase)this, 91, 82)) + .addBox(-1.5f, -10.0f, -0.5f, 3, 3, 7); + this.Shell1Body4.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Body4.setTextureSize(128, 128); + this.Shell1Body4.mirror = true; + this.setRotation(this.Shell1Body4, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Tip5 = new ModelRenderer((ModelBase)this, 112, 82)) + .addBox(0.0f, -6.5f, -2.5f, 2, 2, 2); + this.Shell1Tip5.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Tip5.setTextureSize(128, 128); + this.Shell1Tip5.mirror = true; + this.setRotation(this.Shell1Tip5, -0.1745329f, 0.0f, 0.0f); + (this.Shell1Body5 = new ModelRenderer((ModelBase)this, 91, 82)) + .addBox(-0.5f, -7.0f, -0.5f, 3, 3, 7); + this.Shell1Body5.setRotationPoint(0.0f, 10.0f, 0.0f); + this.Shell1Body5.setTextureSize(128, 128); + this.Shell1Body5.mirror = true; + this.setRotation(this.Shell1Body5, -0.1745329f, 0.0f, 0.0f); + (this.AmmoCaseT = new ModelRenderer((ModelBase)this, 55, 0)) + .addBox(-10.5f, -2.0f, -4.5f, 5, 9, 13); + this.AmmoCaseT.setRotationPoint(0.0f, 9.0f, 0.0f); + this.AmmoCaseT.setTextureSize(128, 128); + this.AmmoCaseT.mirror = true; + this.setRotation(this.AmmoCaseT, -0.1745329f, 0.0f, 0.0f); + } + + public void render(final float f5) { this.BasePlate.render(f5); } + + public void renderBody(final float f5) { + this.neck.render(f5); + this.neck2.render(f5); + this.neck3.render(f5); + this.neck4.render(f5); + this.Base.render(f5); + this.LeftSide.render(f5); + this.LeftSideB.render(f5); + this.RightSide.render(f5); + this.RightSideB.render(f5); + this.AmmoCase.render(f5); + } + + public void renderCannon(final float f5) { + this.CannonBackStoper.render(f5); + this.CannonBarrelBrace.render(f5); + this.CannonS1.render(f5); + this.CannonS2.render(f5); + this.CannonS3.render(f5); + this.CannonS4.render(f5); + this.CannonBarrel.render(f5); + this.CannonBrace.render(f5); + this.CannonLBeam.render(f5); + this.CannonRBeam.render(f5); + this.CannonBody.render(f5); + this.AmmoB1.render(f5); + this.AmmoB2.render(f5); + this.AmmoB3.render(f5); + this.AmmoB3B.render(f5); + this.AmmoB2B.render(f5); + this.AmmoB1B.render(f5); + this.Shell1Tip.render(f5); + this.Shell1Body.render(f5); + this.Shell1Tip2.render(f5); + this.Shell1Body2.render(f5); + this.Shell1Tip3.render(f5); + this.Shell1Body3.render(f5); + this.Shell1Tip4.render(f5); + this.Shell1Body4.render(f5); + this.Shell1Tip5.render(f5); + this.Shell1Body5.render(f5); + this.AmmoCaseT.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/gangshao/muoxing/ModelRailgun.java b/src/main/java/icbm/gangshao/muoxing/ModelRailgun.java new file mode 100644 index 0000000..d41f020 --- /dev/null +++ b/src/main/java/icbm/gangshao/muoxing/ModelRailgun.java @@ -0,0 +1,109 @@ +package icbm.gangshao.muoxing; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class ModelRailgun extends ModelBase { + ModelRenderer BASE; + ModelRenderer NECK; + ModelRenderer SUPPORT_1_ROTATES; + ModelRenderer MAIN_TURRET_ROTATES; + ModelRenderer BATTERY_PACK_ROTATES; + ModelRenderer MAIN_CANNON_ROTATES; + ModelRenderer NOZZLE_ROTATES; + ModelRenderer SUPPORT_2_ROTATES; + ModelRenderer SUPPORT_PLATFORM_ROTATES; + + public ModelRailgun() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.BASE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 10, 4, 10); + this.BASE.setRotationPoint(-5.0f, 20.0f, -5.0f); + this.BASE.setTextureSize(128, 128); + this.BASE.mirror = true; + this.setRotation(this.BASE, 0.0f, 0.0f, 0.0f); + (this.NECK = new ModelRenderer((ModelBase)this, 0, 19)) + .addBox(0.0f, 0.0f, 0.0f, 6, 2, 6); + this.NECK.setRotationPoint(-3.0f, 18.0f, -3.0f); + this.NECK.setTextureSize(128, 128); + this.NECK.mirror = true; + this.setRotation(this.NECK, 0.0f, 0.0f, 0.0f); + (this.SUPPORT_1_ROTATES = new ModelRenderer((ModelBase)this, 41, 10)) + .addBox(3.0f, 0.0f, -2.0f, 1, 7, 4); + this.SUPPORT_1_ROTATES.setRotationPoint(0.0f, 10.0f, 0.0f); + this.SUPPORT_1_ROTATES.setTextureSize(128, 128); + this.SUPPORT_1_ROTATES.mirror = true; + this.setRotation(this.SUPPORT_1_ROTATES, 0.0f, 0.0f, 0.0f); + (this.MAIN_TURRET_ROTATES = new ModelRenderer((ModelBase)this, 75, 0)) + .addBox(-3.0f, -3.0f, -5.0f, 6, 6, 12); + this.MAIN_TURRET_ROTATES.setRotationPoint(0.0f, 10.0f, 0.0f); + this.MAIN_TURRET_ROTATES.setTextureSize(128, 128); + this.MAIN_TURRET_ROTATES.mirror = true; + this.setRotation(this.MAIN_TURRET_ROTATES, 0.0f, 0.0f, 0.0f); + (this.BATTERY_PACK_ROTATES = new ModelRenderer((ModelBase)this, 53, 10)) + .addBox(-4.0f, -4.0f, 2.0f, 4, 4, 6); + this.BATTERY_PACK_ROTATES.setRotationPoint(0.0f, 10.0f, 0.0f); + this.BATTERY_PACK_ROTATES.setTextureSize(128, 128); + this.BATTERY_PACK_ROTATES.mirror = true; + this.setRotation(this.BATTERY_PACK_ROTATES, 0.0f, 0.0f, 0.0f); + (this.MAIN_CANNON_ROTATES = new ModelRenderer((ModelBase)this, 41, 22)) + .addBox(-1.0f, -2.0f, -15.0f, 2, 2, 10); + this.MAIN_CANNON_ROTATES.setRotationPoint(0.0f, 10.0f, 0.0f); + this.MAIN_CANNON_ROTATES.setTextureSize(128, 128); + this.MAIN_CANNON_ROTATES.mirror = true; + this.setRotation(this.MAIN_CANNON_ROTATES, 0.0f, 0.0f, 0.0f); + (this.NOZZLE_ROTATES = new ModelRenderer((ModelBase)this, 66, 22)) + .addBox(-1.0f, -2.0f, -19.0f, 2, 3, 4); + this.NOZZLE_ROTATES.setRotationPoint(0.0f, 10.0f, 0.0f); + this.NOZZLE_ROTATES.setTextureSize(128, 128); + this.NOZZLE_ROTATES.mirror = true; + this.setRotation(this.NOZZLE_ROTATES, 0.0f, 0.0f, 0.0f); + (this.SUPPORT_2_ROTATES = new ModelRenderer((ModelBase)this, 41, 10)) + .addBox(-4.0f, 0.0f, -2.0f, 1, 7, 4); + this.SUPPORT_2_ROTATES.setRotationPoint(0.0f, 10.0f, 0.0f); + this.SUPPORT_2_ROTATES.setTextureSize(128, 128); + this.SUPPORT_2_ROTATES.mirror = true; + this.setRotation(this.SUPPORT_2_ROTATES, 0.0f, 0.0f, 0.0f); + (this.SUPPORT_PLATFORM_ROTATES = new ModelRenderer((ModelBase)this, 41, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 1, 8); + this.SUPPORT_PLATFORM_ROTATES.setRotationPoint(0.0f, 17.0f, 0.0f); + this.SUPPORT_PLATFORM_ROTATES.setTextureSize(128, 128); + this.SUPPORT_PLATFORM_ROTATES.mirror = true; + this.setRotation(this.SUPPORT_PLATFORM_ROTATES, 0.0f, 0.0f, 0.0f); + } + + public void render(final float rotationYaw, final float rotationPitch, + final float f5) { + this.BASE.render(f5); + this.NECK.render(f5); + this.SUPPORT_1_ROTATES.rotateAngleY = rotationYaw; + this.SUPPORT_1_ROTATES.render(f5); + this.SUPPORT_2_ROTATES.rotateAngleY = rotationYaw; + this.SUPPORT_2_ROTATES.render(f5); + this.SUPPORT_PLATFORM_ROTATES.rotateAngleY = rotationYaw; + this.SUPPORT_PLATFORM_ROTATES.render(f5); + this.MAIN_TURRET_ROTATES.rotateAngleY = rotationYaw; + this.MAIN_TURRET_ROTATES.rotateAngleX = rotationPitch; + this.MAIN_TURRET_ROTATES.render(f5); + this.BATTERY_PACK_ROTATES.rotateAngleY = rotationYaw; + this.BATTERY_PACK_ROTATES.rotateAngleX = rotationPitch; + this.BATTERY_PACK_ROTATES.render(f5); + this.MAIN_CANNON_ROTATES.rotateAngleY = rotationYaw; + this.MAIN_CANNON_ROTATES.rotateAngleX = rotationPitch; + this.MAIN_CANNON_ROTATES.render(f5); + this.NOZZLE_ROTATES.rotateAngleY = rotationYaw; + this.NOZZLE_ROTATES.rotateAngleX = rotationPitch; + this.NOZZLE_ROTATES.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/gangshao/muoxing/ModelSentryCannon.java b/src/main/java/icbm/gangshao/muoxing/ModelSentryCannon.java new file mode 100644 index 0000000..2b9c684 --- /dev/null +++ b/src/main/java/icbm/gangshao/muoxing/ModelSentryCannon.java @@ -0,0 +1,209 @@ +package icbm.gangshao.muoxing; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class ModelSentryCannon extends ModelBase { + ModelRenderer BaseYawR; + ModelRenderer BaseYawRPlate; + ModelRenderer RightBrace; + ModelRenderer RightBraceF; + ModelRenderer RightBraceF2; + ModelRenderer LeftBrace; + ModelRenderer LeftBraceF; + ModelRenderer LeftBraceF2; + ModelRenderer FrontPlate; + ModelRenderer SideDecor; + ModelRenderer midPlate; + ModelRenderer AmmoBox; + ModelRenderer rod; + ModelRenderer radioIntena; + ModelRenderer Camera; + ModelRenderer Camera2; + ModelRenderer Camera3; + ModelRenderer CannonBody; + ModelRenderer CannonBody2; + ModelRenderer CannonBody3; + ModelRenderer CannonBody4; + ModelRenderer Barrel; + ModelRenderer BarrelCap; + + public ModelSentryCannon() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.BaseYawR = new ModelRenderer((ModelBase)this, 0, 119)) + .addBox(-3.0f, -3.0f, -3.0f, 6, 3, 6); + this.BaseYawR.setRotationPoint(0.0f, 24.0f, 0.0f); + this.BaseYawR.setTextureSize(128, 128); + this.BaseYawR.mirror = true; + this.setRotation(this.BaseYawR, 0.0f, 0.0f, 0.0f); + (this.BaseYawRPlate = new ModelRenderer((ModelBase)this, 0, 104)) + .addBox(-5.0f, -3.0f, -5.0f, 10, 4, 10); + this.BaseYawRPlate.setRotationPoint(0.0f, 20.0f, 0.0f); + this.BaseYawRPlate.setTextureSize(128, 128); + this.BaseYawRPlate.mirror = true; + this.setRotation(this.BaseYawRPlate, 0.0f, 0.0f, 0.0f); + (this.RightBrace = new ModelRenderer((ModelBase)this, 0, 77)) + .addBox(-5.0f, -3.0f, -3.0f, 1, 8, 8); + this.RightBrace.setRotationPoint(0.0f, 12.0f, 0.0f); + this.RightBrace.setTextureSize(128, 128); + this.RightBrace.mirror = true; + this.setRotation(this.RightBrace, 0.0f, 0.0f, 0.0f); + (this.RightBraceF = new ModelRenderer((ModelBase)this, 19, 85)) + .addBox(-5.0f, -2.0f, -4.0f, 1, 7, 1); + this.RightBraceF.setRotationPoint(0.0f, 12.0f, 0.0f); + this.RightBraceF.setTextureSize(128, 128); + this.RightBraceF.mirror = true; + this.setRotation(this.RightBraceF, 0.0f, 0.0f, 0.0f); + (this.RightBraceF2 = new ModelRenderer((ModelBase)this, 24, 86)) + .addBox(-5.0f, -1.0f, -5.0f, 1, 6, 1); + this.RightBraceF2.setRotationPoint(0.0f, 12.0f, 0.0f); + this.RightBraceF2.setTextureSize(128, 128); + this.RightBraceF2.mirror = true; + this.setRotation(this.RightBraceF2, 0.0f, 0.0f, 0.0f); + (this.LeftBrace = new ModelRenderer((ModelBase)this, 41, 77)) + .addBox(4.0f, -3.0f, -3.0f, 1, 8, 8); + this.LeftBrace.setRotationPoint(0.0f, 12.0f, 0.0f); + this.LeftBrace.setTextureSize(128, 128); + this.LeftBrace.mirror = true; + this.setRotation(this.LeftBrace, 0.0f, 0.0f, 0.0f); + (this.LeftBraceF = new ModelRenderer((ModelBase)this, 35, 85)) + .addBox(4.0f, -2.0f, -4.0f, 1, 7, 1); + this.LeftBraceF.setRotationPoint(0.0f, 12.0f, 0.0f); + this.LeftBraceF.setTextureSize(128, 128); + this.LeftBraceF.mirror = true; + this.setRotation(this.LeftBraceF, 0.0f, 0.0f, 0.0f); + (this.LeftBraceF2 = new ModelRenderer((ModelBase)this, 30, 86)) + .addBox(4.0f, -1.0f, -5.0f, 1, 6, 1); + this.LeftBraceF2.setRotationPoint(0.0f, 12.0f, 0.0f); + this.LeftBraceF2.setTextureSize(128, 128); + this.LeftBraceF2.mirror = true; + this.setRotation(this.LeftBraceF2, 0.0f, 0.0f, 0.0f); + (this.FrontPlate = new ModelRenderer((ModelBase)this, 42, 108)) + .addBox(-4.0f, -2.0f, -6.0f, 8, 4, 1); + this.FrontPlate.setRotationPoint(0.0f, 20.0f, 0.0f); + this.FrontPlate.setTextureSize(128, 128); + this.FrontPlate.mirror = true; + this.setRotation(this.FrontPlate, 0.0f, 0.0f, 0.0f); + (this.SideDecor = new ModelRenderer((ModelBase)this, 61, 92)) + .addBox(-6.0f, -3.0f, -3.0f, 1, 4, 7); + this.SideDecor.setRotationPoint(0.0f, 20.0f, 0.0f); + this.SideDecor.setTextureSize(128, 128); + this.SideDecor.mirror = true; + this.setRotation(this.SideDecor, 0.0f, 0.0f, 0.0f); + (this.midPlate = new ModelRenderer((ModelBase)this, 0, 94)) + .addBox(-4.0f, -4.0f, -4.0f, 8, 1, 8); + this.midPlate.setRotationPoint(0.0f, 20.0f, 0.0f); + this.midPlate.setTextureSize(128, 128); + this.midPlate.mirror = true; + this.setRotation(this.midPlate, 0.0f, 0.0f, 0.0f); + (this.AmmoBox = new ModelRenderer((ModelBase)this, 61, 79)) + .addBox(5.0f, -5.0f, -3.0f, 3, 5, 7); + this.AmmoBox.setRotationPoint(0.0f, 20.0f, 0.0f); + this.AmmoBox.setTextureSize(128, 128); + this.AmmoBox.mirror = true; + this.setRotation(this.AmmoBox, 0.0f, 0.0f, 0.0f); + (this.rod = new ModelRenderer((ModelBase)this, 33, 34)) + .addBox(-6.0f, -1.5f, -1.5f, 12, 3, 3); + this.rod.setRotationPoint(0.0f, 12.0f, 1.0f); + this.rod.setTextureSize(128, 128); + this.rod.mirror = true; + this.setRotation(this.rod, 0.0f, 0.0f, 0.0f); + (this.radioIntena = new ModelRenderer((ModelBase)this, 66, 43)) + .addBox(2.0f, -8.0f, 6.0f, 1, 6, 1); + this.radioIntena.setRotationPoint(0.0f, 12.0f, 0.0f); + this.radioIntena.setTextureSize(128, 128); + this.radioIntena.mirror = true; + this.setRotation(this.radioIntena, 0.0f, 0.0f, 0.0f); + (this.Camera = new ModelRenderer((ModelBase)this, 41, 16)) + .addBox(-9.5f, -2.5f, -2.0f, 4, 4, 4); + this.Camera.setRotationPoint(0.0f, 12.0f, 1.0f); + this.Camera.setTextureSize(128, 128); + this.Camera.mirror = true; + this.setRotation(this.Camera, 0.0f, 0.0f, 0.0f); + (this.Camera2 = new ModelRenderer((ModelBase)this, 41, 11)) + .addBox(-9.0f, -1.5f, -2.5f, 3, 2, 1); + this.Camera2.setRotationPoint(0.0f, 12.0f, 1.0f); + this.Camera2.setTextureSize(128, 128); + this.Camera2.mirror = true; + this.setRotation(this.Camera2, 0.0f, 0.0f, 0.0f); + (this.Camera3 = new ModelRenderer((ModelBase)this, 59, 18)) + .addBox(-9.0f, 1.5f, -2.0f, 3, 1, 4); + this.Camera3.setRotationPoint(0.0f, 12.0f, 1.0f); + this.Camera3.setTextureSize(128, 128); + this.Camera3.mirror = true; + this.setRotation(this.Camera3, 0.0f, 0.0f, 0.0f); + (this.CannonBody = new ModelRenderer((ModelBase)this, 0, 31)) + .addBox(-3.5f, -2.5f, -1.5f, 7, 5, 9); + this.CannonBody.setRotationPoint(0.0f, 12.0f, 0.0f); + this.CannonBody.setTextureSize(128, 128); + this.CannonBody.mirror = true; + this.setRotation(this.CannonBody, 0.0f, 0.0f, 0.0f); + (this.CannonBody2 = new ModelRenderer((ModelBase)this, 19, 46)) + .addBox(-2.5f, -1.5f, -6.5f, 5, 3, 5); + this.CannonBody2.setRotationPoint(0.0f, 12.0f, 0.0f); + this.CannonBody2.setTextureSize(128, 128); + this.CannonBody2.mirror = true; + this.setRotation(this.CannonBody2, 0.0f, 0.0f, 0.0f); + (this.CannonBody3 = new ModelRenderer((ModelBase)this, 0, 47)) + .addBox(-2.0f, -2.1f, -6.5f, 4, 1, 5); + this.CannonBody3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.CannonBody3.setTextureSize(128, 128); + this.CannonBody3.mirror = true; + this.setRotation(this.CannonBody3, 0.0f, 0.0f, 0.0f); + (this.CannonBody4 = new ModelRenderer((ModelBase)this, 40, 47)) + .addBox(-2.0f, 1.0f, -6.5f, 4, 1, 5); + this.CannonBody4.setRotationPoint(0.0f, 12.0f, 0.0f); + this.CannonBody4.setTextureSize(128, 128); + this.CannonBody4.mirror = true; + this.setRotation(this.CannonBody4, 0.0f, 0.0f, 0.0f); + (this.Barrel = new ModelRenderer((ModelBase)this, 10, 55)) + .addBox(-1.0f, -1.0f, -14.5f, 2, 2, 8); + this.Barrel.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Barrel.setTextureSize(128, 128); + this.Barrel.mirror = true; + this.setRotation(this.Barrel, 0.0f, 0.0f, 0.0f); + (this.BarrelCap = new ModelRenderer((ModelBase)this, 32, 56)) + .addBox(-1.5f, -1.5f, -16.5f, 3, 3, 2); + this.BarrelCap.setRotationPoint(0.0f, 12.0f, 0.0f); + this.BarrelCap.setTextureSize(128, 128); + this.BarrelCap.mirror = true; + this.setRotation(this.BarrelCap, 0.0f, 0.0f, 0.0f); + } + + public void renderYaw(final float f5) { + this.BaseYawR.render(f5); + this.BaseYawRPlate.render(f5); + this.RightBrace.render(f5); + this.RightBraceF.render(f5); + this.RightBraceF2.render(f5); + this.LeftBrace.render(f5); + this.LeftBraceF.render(f5); + this.LeftBraceF2.render(f5); + this.FrontPlate.render(f5); + this.SideDecor.render(f5); + this.midPlate.render(f5); + this.AmmoBox.render(f5); + } + + public void renderYawPitch(final float f5) { + this.rod.render(f5); + this.radioIntena.render(f5); + this.Camera.render(f5); + this.Camera2.render(f5); + this.Camera3.render(f5); + this.CannonBody.render(f5); + this.CannonBody2.render(f5); + this.CannonBody3.render(f5); + this.CannonBody4.render(f5); + this.Barrel.render(f5); + this.BarrelCap.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/gangshao/muoxing/ModelTurretMed.java b/src/main/java/icbm/gangshao/muoxing/ModelTurretMed.java new file mode 100644 index 0000000..c97ac40 --- /dev/null +++ b/src/main/java/icbm/gangshao/muoxing/ModelTurretMed.java @@ -0,0 +1,224 @@ +package icbm.gangshao.muoxing; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class ModelTurretMed extends ModelBase { + ModelRenderer Center; + ModelRenderer FRBrace; + ModelRenderer BRBrace; + ModelRenderer FLBrace; + ModelRenderer BLBrace; + ModelRenderer FLBrace2; + ModelRenderer FLBrace3; + ModelRenderer FRBrace2; + ModelRenderer FRBrace3; + ModelRenderer BRBrace2; + ModelRenderer BRBrace3; + ModelRenderer BLBrace3; + ModelRenderer BLBrace2; + ModelRenderer neck; + ModelRenderer LeftFace; + ModelRenderer RightFace; + ModelRenderer Head; + ModelRenderer Barrel; + ModelRenderer Center2; + ModelRenderer BarrelBrace; + ModelRenderer BarrelCap; + + public ModelTurretMed() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Center = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 5, 4); + this.Center.setRotationPoint(0.0f, 14.0f, 0.0f); + this.Center.setTextureSize(128, 128); + this.Center.mirror = true; + this.setRotation(this.Center, 0.0f, 0.7853982f, 0.0f); + (this.FRBrace = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 14.5f, -8.5f, 2, 3, 6); + this.FRBrace.setRotationPoint(0.0f, 0.0f, 0.0f); + this.FRBrace.setTextureSize(128, 128); + this.FRBrace.mirror = true; + this.setRotation(this.FRBrace, 0.1745329f, 0.7853982f, 0.0f); + (this.BRBrace = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 14.5f, -8.5f, 2, 3, 6); + this.BRBrace.setRotationPoint(0.0f, 0.0f, 0.0f); + this.BRBrace.setTextureSize(128, 128); + this.BRBrace.mirror = true; + this.setRotation(this.BRBrace, 0.1745329f, -3.926991f, 0.0f); + (this.FLBrace = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 14.5f, -8.5f, 2, 3, 6); + this.FLBrace.setRotationPoint(0.0f, 0.0f, 0.0f); + this.FLBrace.setTextureSize(128, 128); + this.FLBrace.mirror = true; + this.setRotation(this.FLBrace, 0.1745329f, -0.7853982f, 0.0f); + (this.BLBrace = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 14.5f, -8.5f, 2, 3, 6); + this.BLBrace.setRotationPoint(0.0f, 0.0f, 0.0f); + this.BLBrace.setTextureSize(128, 128); + this.BLBrace.mirror = true; + this.setRotation(this.BLBrace, 0.1745329f, -2.356194f, 0.0f); + (this.FLBrace2 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 7.0f, -21.0f, 2, 3, 6); + this.FLBrace2.setRotationPoint(0.0f, 0.0f, 0.0f); + this.FLBrace2.setTextureSize(128, 128); + this.FLBrace2.mirror = true; + this.setRotation(this.FLBrace2, 0.7853982f, -0.7853982f, 0.0f); + (this.FLBrace3 = new ModelRenderer((ModelBase)this, 20, 20)) + .addBox(-2.0f, -10.0f, -24.0f, 4, 3, 4); + this.FLBrace3.setRotationPoint(0.0f, 0.0f, 0.0f); + this.FLBrace3.setTextureSize(128, 128); + this.FLBrace3.mirror = true; + this.setRotation(this.FLBrace3, 1.570796f, -0.7853982f, 0.0f); + (this.FRBrace2 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 7.0f, -21.0f, 2, 3, 6); + this.FRBrace2.setRotationPoint(0.0f, 0.0f, 0.0f); + this.FRBrace2.setTextureSize(128, 128); + this.FRBrace2.mirror = true; + this.setRotation(this.FRBrace2, 0.7853982f, 0.7853982f, 0.0f); + (this.FRBrace3 = new ModelRenderer((ModelBase)this, 20, 20)) + .addBox(-2.0f, -10.03333f, -24.0f, 4, 3, 4); + this.FRBrace3.setRotationPoint(0.0f, 0.0f, 0.0f); + this.FRBrace3.setTextureSize(128, 128); + this.FRBrace3.mirror = true; + this.setRotation(this.FRBrace3, 1.570796f, 0.7853982f, 0.0f); + (this.BRBrace2 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 7.0f, -21.0f, 2, 3, 6); + this.BRBrace2.setRotationPoint(0.0f, 0.0f, 0.0f); + this.BRBrace2.setTextureSize(128, 128); + this.BRBrace2.mirror = true; + this.setRotation(this.BRBrace2, 0.7853982f, -3.926991f, 0.0f); + (this.BRBrace3 = new ModelRenderer((ModelBase)this, 20, 20)) + .addBox(-2.0f, -10.0f, -24.0f, 4, 3, 4); + this.BRBrace3.setRotationPoint(0.0f, 0.0f, 0.0f); + this.BRBrace3.setTextureSize(128, 128); + this.BRBrace3.mirror = true; + this.setRotation(this.BRBrace3, 1.570796f, -3.926991f, 0.0f); + (this.BLBrace3 = new ModelRenderer((ModelBase)this, 20, 20)) + .addBox(-2.0f, -10.0f, -24.0f, 4, 3, 4); + this.BLBrace3.setRotationPoint(0.0f, 0.0f, 0.0f); + this.BLBrace3.setTextureSize(128, 128); + this.BLBrace3.mirror = true; + this.setRotation(this.BLBrace3, 1.570796f, -2.356194f, 0.0f); + (this.BLBrace2 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(-1.0f, 7.0f, -21.0f, 2, 3, 6); + this.BLBrace2.setRotationPoint(0.0f, 0.0f, 0.0f); + this.BLBrace2.setTextureSize(128, 128); + this.BLBrace2.mirror = true; + this.setRotation(this.BLBrace2, 0.7853982f, -2.356194f, 0.0f); + (this.neck = new ModelRenderer((ModelBase)this, 19, 0)) + .addBox(-1.5f, 0.0f, -1.5f, 3, 5, 3); + this.neck.setRotationPoint(0.0f, 11.0f, 0.0f); + this.neck.setTextureSize(128, 128); + this.neck.mirror = true; + this.setRotation(this.neck, 0.0f, 0.0f, 0.0f); + (this.LeftFace = new ModelRenderer((ModelBase)this, 17, 69)) + .addBox(3.0f, -1.0f, -1.0f, 2, 2, 6); + this.LeftFace.setRotationPoint(0.0f, 11.0f, 0.0f); + this.LeftFace.setTextureSize(128, 128); + this.LeftFace.mirror = true; + this.setRotation(this.LeftFace, 0.0f, 0.0f, 0.0f); + (this.RightFace = new ModelRenderer((ModelBase)this, 0, 69)) + .addBox(-5.0f, -1.0f, -1.0f, 2, 2, 6); + this.RightFace.setRotationPoint(0.0f, 11.0f, 0.0f); + this.RightFace.setTextureSize(128, 128); + this.RightFace.mirror = true; + this.setRotation(this.RightFace, 0.0f, 0.0f, 0.0f); + (this.Head = new ModelRenderer((ModelBase)this, 0, 55)) + .addBox(-3.0f, -2.0f, -2.0f, 6, 4, 8); + this.Head.setRotationPoint(0.0f, 11.0f, 0.0f); + this.Head.setTextureSize(128, 128); + this.Head.mirror = true; + this.setRotation(this.Head, 0.0f, 0.0f, 0.0f); + (this.Barrel = new ModelRenderer((ModelBase)this, 0, 42)) + .addBox(-1.0f, -1.0f, -6.0f, 2, 2, 2); + this.Barrel.setRotationPoint(0.0f, 11.0f, 0.0f); + this.Barrel.setTextureSize(128, 128); + this.Barrel.mirror = true; + this.setRotation(this.Barrel, 0.0f, 0.0f, 0.0f); + (this.Center2 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 5, 4); + this.Center2.setRotationPoint(0.0f, 14.0f, 0.0f); + this.Center2.setTextureSize(128, 128); + this.Center2.mirror = true; + this.setRotation(this.Center2, 0.0f, 0.0f, 0.0f); + (this.BarrelBrace = new ModelRenderer((ModelBase)this, 0, 36)) + .addBox(-2.0f, -1.5f, -4.0f, 4, 3, 2); + this.BarrelBrace.setRotationPoint(0.0f, 11.0f, 0.0f); + this.BarrelBrace.setTextureSize(128, 128); + this.BarrelBrace.mirror = true; + this.setRotation(this.BarrelBrace, 0.0f, 0.0f, 0.0f); + (this.BarrelCap = new ModelRenderer((ModelBase)this, 0, 47)) + .addBox(-1.5f, -1.5f, -7.0f, 3, 3, 2); + this.BarrelCap.setRotationPoint(0.0f, 11.0f, 0.0f); + this.BarrelCap.setTextureSize(128, 128); + this.BarrelCap.mirror = true; + this.setRotation(this.BarrelCap, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity par1Entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + this.setRotationAngles(f, f1, f2, f3, f4, f5); + this.LeftFace.render(f5); + this.RightFace.render(f5); + this.Head.render(f5); + this.Barrel.render(f5); + this.BarrelBrace.render(f5); + this.BarrelCap.render(f5); + } + + public void renderLegs(final float f5) { + this.FRBrace.render(f5); + this.BRBrace.render(f5); + this.FLBrace.render(f5); + this.BLBrace.render(f5); + this.FLBrace2.render(f5); + this.FLBrace3.render(f5); + this.FRBrace2.render(f5); + this.FRBrace3.render(f5); + this.BRBrace2.render(f5); + this.BRBrace3.render(f5); + this.BLBrace3.render(f5); + this.BLBrace2.render(f5); + this.neck.render(f5); + this.Center.render(f5); + this.Center2.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(final float par1, final float par2, + final float par3, final float par4, + final float par5, final float par6) { + final ModelRenderer[] Body = {this.Center, this.FRBrace, this.BRBrace, + this.FLBrace, this.BLBrace, this.FLBrace2, + this.FLBrace3, this.FRBrace2, this.FRBrace3, + this.BRBrace2, this.BRBrace3, this.BLBrace3, + this.BLBrace2, this.neck}; + for (int i = 0; i < Body.length; ++i) { + } + this.LeftFace.rotateAngleY = par4 / 57.295776f; + this.LeftFace.rotateAngleX = par5 / 57.295776f; + this.RightFace.rotateAngleY = par4 / 57.295776f; + this.RightFace.rotateAngleX = par5 / 57.295776f; + this.Head.rotateAngleY = par4 / 57.295776f; + this.Head.rotateAngleX = par5 / 57.295776f; + this.Barrel.rotateAngleY = par4 / 57.295776f; + this.Barrel.rotateAngleX = par5 / 57.295776f; + this.BarrelBrace.rotateAngleY = par4 / 57.295776f; + this.BarrelBrace.rotateAngleX = par5 / 57.295776f; + this.BarrelCap.rotateAngleY = par4 / 57.295776f; + this.BarrelCap.rotateAngleX = par5 / 57.295776f; + } +} diff --git a/src/main/java/icbm/gangshao/packet/PacketHandlerTurret.java b/src/main/java/icbm/gangshao/packet/PacketHandlerTurret.java new file mode 100644 index 0000000..e985d7f --- /dev/null +++ b/src/main/java/icbm/gangshao/packet/PacketHandlerTurret.java @@ -0,0 +1,26 @@ +package icbm.gangshao.packet; + +import cpw.mods.fml.client.FMLClientHandler; +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 icbm.gangshao.turret.TTurretBase; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class PacketHandlerTurret + implements IMessageHandler { + + @Override + public IMessage onMessage(PacketTurret message, MessageContext ctx) { + World world = FMLClientHandler.instance().getWorldClient(); + + TileEntity te = message.turretPos.getTileEntity(world); + + if (te instanceof TTurretBase) { + ((TTurretBase) te).onTurretPacket(message.type, message.data); + } + + return null; + } +} diff --git a/src/main/java/icbm/gangshao/packet/PacketTurret.java b/src/main/java/icbm/gangshao/packet/PacketTurret.java new file mode 100644 index 0000000..13c7171 --- /dev/null +++ b/src/main/java/icbm/gangshao/packet/PacketTurret.java @@ -0,0 +1,92 @@ +package icbm.gangshao.packet; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import universalelectricity.core.vector.Vector3; + +public class PacketTurret implements IMessage { + Type type; + Vector3 turretPos; + NBTTagCompound data; + + public PacketTurret() { + this(null, null, null); + } + + public PacketTurret(Vector3 turretPos, Type type, NBTTagCompound data) { + this.type = type; + this.data = data; + this.turretPos = turretPos; + } + + public static PacketTurret rotation(Vector3 turretPos, float yaw, + float pitch) { + NBTTagCompound data = new NBTTagCompound(); + + data.setFloat("yaw", yaw); + data.setFloat("pitch", pitch); + + return new PacketTurret(turretPos, Type.ROTATION, data); + } + + public static PacketTurret shot(Vector3 turretPos, Vector3 target, float yaw, + float pitch) { + NBTTagCompound data = new NBTTagCompound(); + + data.setTag("target", target.writeToNBT(new NBTTagCompound())); + data.setFloat("yaw", yaw); + data.setFloat("pitch", pitch); + + return new PacketTurret(turretPos, Type.SHOT, data); + } + + public static PacketTurret stats(Vector3 turretPos, int health) { + NBTTagCompound data = new NBTTagCompound(); + + data.setInteger("health", health); + + return new PacketTurret(turretPos, Type.STATS, data); + } + + @Override + public void fromBytes(ByteBuf buf) { + try { + this.data = CompressedStreamTools.readCompressed( + new DataInputStream(new ByteBufInputStream(buf))); + + this.turretPos = Vector3.readFromNBT(this.data); + + if (this.data.getInteger("type") >= Type.values().length) + throw new IllegalArgumentException("Type out of bounds"); + this.type = Type.values()[this.data.getInteger("type")]; + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void toBytes(ByteBuf buf) { + this.data.setInteger("type", this.type.ordinal()); + this.turretPos.writeToNBT(this.data); + + try { + CompressedStreamTools.writeCompressed( + this.data, new DataOutputStream(new ByteBufOutputStream(buf))); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static enum Type { + ROTATION, + SHOT, + STATS; + } +} diff --git a/src/main/java/icbm/gangshao/platform/BlockTurretPlatform.java b/src/main/java/icbm/gangshao/platform/BlockTurretPlatform.java new file mode 100644 index 0000000..926c967 --- /dev/null +++ b/src/main/java/icbm/gangshao/platform/BlockTurretPlatform.java @@ -0,0 +1,130 @@ +package icbm.gangshao.platform; + +import icbm.core.ICBMTab; +import icbm.core.di.BICBM; +import icbm.gangshao.IAmmunition; +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.access.AccessLevel; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import universalelectricity.core.UniversalElectricity; + +public class BlockTurretPlatform extends BICBM { + public BlockTurretPlatform() { + super("turretPlatform", UniversalElectricity.machine); + this.setHardness(100.0f); + this.setResistance(50.0f); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + super.requireSidedTextures = true; + } + + @Override + public IIcon getIcon(final int side, final int metadata) { + return (side == 0) ? super.iconBottom + : ((side == 1) ? super.iconTop : super.iconSide); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, + final int z, final EntityLivingBase entity, + final ItemStack itemStack) { + if (entity instanceof EntityPlayer && !world.isRemote) { + final TileEntity ent = world.getTileEntity(x, y, z); + if (ent instanceof ISpecialAccess) { + ((ISpecialAccess) ent) + .addUserAccess(((EntityPlayer) entity).getDisplayName(), + AccessLevel.OWNER, true); + } + } + } + + @Override + public boolean onMachineActivated(final World world, final int x, final int y, + final int z, final EntityPlayer player, + final int side, final float hitX, + final float hitY, final float hitZ) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (!(tileEntity instanceof TPlatform)) { + return false; + } + if (player.getCurrentEquippedItem() != null && + side == ((TPlatform) tileEntity).deployDirection.ordinal() && + player.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(ICBMSentry.blockTurret)) { + return false; + } + if (((TPlatform) tileEntity).getTurret(false) != null && !world.isRemote) { + player.openGui((Object) ICBMSentry.instance, 0, world, x, y, z); + } + return true; + } + + @Override + public TileEntity createNewTileEntity(final World var1, int meta) { + return new TPlatform(); + } + + @Override + public void dropEntireInventory(final World world, final int x, final int y, + final int z, final Block par5, + final int par6) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null && tileEntity instanceof IInventory) { + final IInventory inventory = (IInventory) tileEntity; + for (int slot = 0; slot < inventory.getSizeInventory(); ++slot) { + ItemStack itemStack = inventory.getStackInSlot(slot); + if (itemStack != null) { + boolean flag = true; + final Item item = itemStack.getItem(); + if (item instanceof IAmmunition) { + if (((IAmmunition) item).canDrop(itemStack.getItemDamage())) { + flag = true; + itemStack = ((IAmmunition) item).onDroppedIntoWorld(itemStack.copy()); + } else { + flag = false; + } + } + if (flag) { + final Random random = new Random(); + final float var8 = random.nextFloat() * 0.8f + 0.1f; + final float var9 = random.nextFloat() * 0.8f + 0.1f; + final float var10 = random.nextFloat() * 0.8f + 0.1f; + while (itemStack.stackSize > 0) { + int var11 = random.nextInt(21) + 10; + if (var11 > itemStack.stackSize) { + var11 = itemStack.stackSize; + } + final ItemStack itemStack2 = itemStack; + itemStack2.stackSize -= var11; + final EntityItem var12 = new EntityItem(world, (double) (x + var8), (double) (y + var9), + (double) (z + var10), + new ItemStack(itemStack.getItem(), var11, + itemStack.getItemDamage())); + if (itemStack.hasTagCompound()) { + var12.getEntityItem().setTagCompound( + (NBTTagCompound) itemStack.getTagCompound().copy()); + } + final float var13 = 0.05f; + ((Entity) var12).motionX = (float) random.nextGaussian() * var13; + ((Entity) var12).motionY = (float) random.nextGaussian() * var13 + 0.2f; + ((Entity) var12).motionZ = (float) random.nextGaussian() * var13; + world.spawnEntityInWorld((Entity) var12); + } + } + } + } + } + } +} diff --git a/src/main/java/icbm/gangshao/platform/TPlatform.java b/src/main/java/icbm/gangshao/platform/TPlatform.java new file mode 100644 index 0000000..a4facc3 --- /dev/null +++ b/src/main/java/icbm/gangshao/platform/TPlatform.java @@ -0,0 +1,347 @@ +package icbm.gangshao.platform; + +import icbm.gangshao.IAmmunition; +import icbm.gangshao.ITurretUpgrade; +import icbm.gangshao.ProjectileType; +import icbm.gangshao.damage.IHealthTile; +import icbm.gangshao.terminal.TileEntityTerminal; +import icbm.gangshao.turret.ItemAmmo; +import icbm.gangshao.turret.TTurretBase; +import icbm.gangshao.turret.upgrades.ItPaoTaiUpgrades; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.DamageSource; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.UniversalElectricity; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.item.ElectricItemHelper; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.CustomDamageSource; + +public class TPlatform extends TileEntityTerminal implements IInventory { + private TTurretBase turret; + public ForgeDirection deployDirection; + public static final int UPGRADE_START_INDEX = 12; + private static final int TURRET_UPGADE_SLOTS = 3; + public ItemStack[] containingItems; + + public TPlatform() { + this.turret = null; + this.deployDirection = ForgeDirection.UP; + this.containingItems = new ItemStack[16]; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (super.prevWatts != super.wattsReceived) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + if (!this.worldObj.isRemote) { + for (int i = 0; i < 12; ++i) { + if (super.wattsReceived >= this.getRequest().getWatts()) { + break; + } + super.wattsReceived += ElectricItemHelper.dechargeItem( + this.getStackInSlot(i), Math.ceil(this.getRequest().getWatts()), + this.getVoltage()); + } + } + } + + @Override + public void onReceive(final ElectricityPack electricityPack) { + if (UniversalElectricity.isVoltageSensitive && + electricityPack.voltage > this.getVoltage()) { + final TTurretBase turret = this.getTurret(false); + if (turret != null && turret instanceof IHealthTile) { + this.turret.onDamageTaken(CustomDamageSource.electrocution, + Integer.MAX_VALUE); + } + return; + } + super.wattsReceived = Math.min( + super.wattsReceived + electricityPack.getWatts(), this.getWattBuffer()); + if (super.prevWatts <= this.getRequest().getWatts() && + super.wattsReceived >= this.getRequest().getWatts() && + super.prevWatts != super.wattsReceived) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + + @Override + public ElectricityPack getRequest() { + if (this.getTurret(false) != null && + super.wattsReceived < this.getTurret(false).getFiringRequest()) { + return ElectricityPack.getFromWatts( + Math.max(this.turret.getFiringRequest(), 0.0), + this.getTurret(false).getVoltage()); + } + return new ElectricityPack(); + } + + @Override + public double getWattBuffer() { + if (this.getTurret(false) != null) { + return new ElectricityPack( + Math.max(this.turret.getFiringRequest() / + this.getTurret(false).getVoltage(), + 0.0), + this.getTurret(false).getVoltage()) + .getWatts() * + 2.0; + } + return 0.0; + } + + public TTurretBase getTurret(final boolean getNew) { + final Vector3 position = new Vector3(this); + if (getNew || this.turret == null || this.turret.isInvalid() || + !new Vector3(this.turret) + .equals(position.clone().modifyPositionFromSide( + this.deployDirection))) { + final TileEntity tileEntity = position.clone() + .modifyPositionFromSide(this.deployDirection) + .getTileEntity((IBlockAccess) this.worldObj); + if (tileEntity instanceof TTurretBase) { + this.turret = (TTurretBase) tileEntity; + } else { + this.turret = null; + } + } + return this.turret; + } + + public boolean destroyTurret() { + final TileEntity ent = this.worldObj.getTileEntity(this.xCoord + this.deployDirection.offsetX, + this.yCoord + this.deployDirection.offsetY, + this.zCoord + this.deployDirection.offsetZ); + if (ent instanceof TTurretBase) { + this.turret = null; + ((TTurretBase) ent).destroy(false); + return true; + } + return false; + } + + public boolean destroy(final boolean doExplosion) { + if (doExplosion) { + this.worldObj.createExplosion((Entity) null, (double) this.xCoord, + (double) this.yCoord, (double) this.zCoord, + 2.0f, true); + } + if (!this.worldObj.isRemote) { + this.getBlockType().dropBlockAsItem(this.worldObj, this.xCoord, + this.yCoord, this.zCoord, + this.getBlockMetadata(), 0); + } + return this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord); + } + + @Override + public String getInventoryName() { + return this.getBlockType().getLocalizedName(); + } + + public boolean isRunning() { + return !this.isDisabled() && this.getTurret(false) != null && + super.wattsReceived >= this.getTurret(false).getFiringRequest(); + } + + public ItemStack hasAmmunition(final ProjectileType projectileType) { + for (int i = 0; i < 12; ++i) { + final ItemStack itemStack = this.containingItems[i]; + if (itemStack != null) { + final Item item = itemStack.getItem(); + if (item instanceof IAmmunition && + ((IAmmunition) item).getType(itemStack) == projectileType) { + return itemStack; + } + } + } + return null; + } + + public boolean useAmmunition(final ItemStack ammoStack) { + if (ammoStack != null) { + if (ammoStack.getItemDamage() == ItemAmmo.AmmoType.BULLETINF.ordinal()) { + return true; + } + for (int i = 0; i < 12; ++i) { + final ItemStack itemStack = this.containingItems[i]; + if (itemStack != null && itemStack.isItemEqual(ammoStack)) { + this.decrStackSize(i, 1); + return true; + } + } + } + return false; + } + + public int getUpgradeCount(final ItPaoTaiUpgrades.TurretUpgradeType type) { + int count = 0; + for (int i = 12; i < 15; ++i) { + final ItemStack itemStack = this.getStackInSlot(i); + if (itemStack != null && itemStack.getItem() instanceof ITurretUpgrade && + ((ITurretUpgrade) itemStack.getItem()).getType(itemStack) == type) { + ++count; + } + } + return count; + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + super.wattsReceived = nbt.getDouble("wattsReceived"); + final NBTTagList var2 = nbt.getTagList("Items", 10); + this.containingItems = new ItemStack[this.getSizeInventory()]; + for (int var3 = 0; var3 < var2.tagCount(); ++var3) { + final NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); + final byte var5 = var4.getByte("Slot"); + if (var5 >= 0 && var5 < this.containingItems.length) { + this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setDouble("wattsReceived", super.wattsReceived); + final NBTTagList itemTag = new NBTTagList(); + for (int slots = 0; slots < this.containingItems.length; ++slots) { + if (this.containingItems[slots] != null) { + final NBTTagCompound itemNbtData = new NBTTagCompound(); + itemNbtData.setByte("Slot", (byte) slots); + this.containingItems[slots].writeToNBT(itemNbtData); + itemTag.appendTag((NBTBase) itemNbtData); + } + } + nbt.setTag("Items", (NBTBase) itemTag); + } + + @Override + public int getSizeInventory() { + return this.containingItems.length; + } + + @Override + public ItemStack getStackInSlot(final int par1) { + return this.containingItems[par1]; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int par1) { + if (this.containingItems[par1] != null) { + final ItemStack var2 = this.containingItems[par1]; + this.containingItems[par1] = null; + return var2; + } + return null; + } + + @Override + public ItemStack decrStackSize(final int par1, final int par2) { + if (this.containingItems[par1] == null) { + return null; + } + if (this.containingItems[par1].stackSize <= par2) { + final ItemStack var3 = this.containingItems[par1]; + this.containingItems[par1] = null; + return var3; + } + final ItemStack var3 = this.containingItems[par1].splitStack(par2); + if (this.containingItems[par1].stackSize == 0) { + this.containingItems[par1] = null; + } + return var3; + } + + @Override + public void setInventorySlotContents(final int par1, + final ItemStack par2ItemStack) { + this.containingItems[par1] = par2ItemStack; + if (par2ItemStack != null && + par2ItemStack.stackSize > this.getInventoryStackLimit()) { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer par1EntityPlayer) { + return true; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean canConnect(final ForgeDirection direction) { + return true; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public boolean isItemValidForSlot(final int slotID, + final ItemStack itemStack) { + return slotID < 12 && itemStack.getItem() instanceof IAmmunition; + } + + @Override + public void markDirty() { + super.markDirty(); + } + + @Override + public String getChannel() { + return "ICBM"; + } + + //TODO: WTF + //@Override + public boolean addStackToInventory(final ItemStack itemStack) { + for (int i = 0; i < 12; ++i) { + final ItemStack checkStack = this.getStackInSlot(i); + if (itemStack.stackSize <= 0) { + return true; + } + if (checkStack == null) { + this.setInventorySlotContents(i, itemStack); + return true; + } + if (checkStack.isItemEqual(itemStack)) { + final int inputStack = Math.min(checkStack.stackSize + itemStack.stackSize, + checkStack.getMaxStackSize()) - + checkStack.stackSize; + itemStack.stackSize -= inputStack; + final ItemStack itemStack2 = checkStack; + itemStack2.stackSize += inputStack; + this.setInventorySlotContents(i, checkStack); + } + } + return false; + } +} diff --git a/src/main/java/icbm/gangshao/render/BlockRenderingHandler.java b/src/main/java/icbm/gangshao/render/BlockRenderingHandler.java new file mode 100644 index 0000000..4dd1534 --- /dev/null +++ b/src/main/java/icbm/gangshao/render/BlockRenderingHandler.java @@ -0,0 +1,77 @@ +package icbm.gangshao.render; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.turret.BlockTurret; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class BlockRenderingHandler implements ISimpleBlockRenderingHandler { + public static final int ID; + + @Override + public void renderInventoryBlock(final Block block, final int metadata, + final int modelID, + final RenderBlocks renderer) { + if (modelID == BlockRenderingHandler.ID) { + GL11.glPushMatrix(); + if (metadata == BlockTurret.TurretType.GUN.ordinal()) { + GL11.glTranslatef(0.1f, 1.0f, 0.0f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", + "textures/models/gun_turret_neutral.png")); + RGunTurret.render(0.0f, 0.0f); + } + if (metadata == BlockTurret.TurretType.LASER.ordinal()) { + GL11.glTranslatef(0.4f, 1.4f, 0.0f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", + "textures/models/laser_turret_neutral.png")); + RLaserTurret.render(0.0f, 0.0f); + } else if (metadata == BlockTurret.TurretType.AA.ordinal()) { + GL11.glTranslatef(0.2f, 0.3f, 0.0f); + GL11.glScalef(0.45f, 0.45f, 0.45f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", + "textures/models/aa_turret_neutral.png")); + RAATurret.render(0.0f, 0.0f); + } else if (metadata == BlockTurret.TurretType.RAILGUN.ordinal()) { + GL11.glTranslatef(0.0f, 0.9f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/models/railgun.png")); + RRailgun.MODEL.render(90.0f, 0.0f, 0.0625f); + } + GL11.glPopMatrix(); + } + } + + @Override + public boolean renderWorldBlock(final IBlockAccess iBlockAccess, final int x, + final int y, final int z, final Block block, + final int modelID, + final RenderBlocks renderer) { + return false; + } + + @Override + public boolean shouldRender3DInInventory(int id) { + return true; + } + + @Override + public int getRenderId() { + return BlockRenderingHandler.ID; + } + + static { + ID = RenderingRegistry.getNextAvailableRenderId(); + } +} diff --git a/src/main/java/icbm/gangshao/render/FXBeam.java b/src/main/java/icbm/gangshao/render/FXBeam.java new file mode 100644 index 0000000..d7daa4b --- /dev/null +++ b/src/main/java/icbm/gangshao/render/FXBeam.java @@ -0,0 +1,182 @@ +package icbm.gangshao.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.vector.Vector3; + +@SideOnly(Side.CLIENT) +public class FXBeam extends EntityFX { + double movX; + double movY; + double movZ; + private float length; + private float rotYaw; + private float rotPitch; + private float prevYaw; + private float prevPitch; + private Vector3 target; + private float endModifier; + private boolean reverse; + private boolean pulse; + private int rotationSpeed; + private float prevSize; + + public FXBeam(final World par1World, final Vector3 position, + final Vector3 target, final float red, final float green, + final float blue, final int age) { + super(par1World, position.x, position.y, position.z, 0.0, 0.0, 0.0); + this.movX = 0.0; + this.movY = 0.0; + this.movZ = 0.0; + this.length = 0.0f; + this.rotYaw = 0.0f; + this.rotPitch = 0.0f; + this.prevYaw = 0.0f; + this.prevPitch = 0.0f; + this.target = new Vector3(); + this.endModifier = 1.0f; + this.reverse = false; + this.pulse = true; + this.rotationSpeed = 20; + this.prevSize = 0.0f; + this.setRGB(red, green, blue); + this.setSize(0.02f, 0.02f); + ((Entity) this).noClip = true; + ((Entity) this).motionX = 0.0; + ((Entity) this).motionY = 0.0; + ((Entity) this).motionZ = 0.0; + this.target = target; + final float xd = (float) (((Entity) this).posX - this.target.x); + final float yd = (float) (((Entity) this).posY - this.target.y); + final float zd = (float) (((Entity) this).posZ - this.target.z); + this.length = (float) new Vector3((Entity) this).distanceTo(this.target); + final double var7 = MathHelper.sqrt_double((double) (xd * xd + zd * zd)); + this.rotYaw = (float) (Math.atan2(xd, zd) * 180.0 / 3.141592653589793); + this.rotPitch = (float) (Math.atan2(yd, var7) * 180.0 / 3.141592653589793); + this.prevYaw = this.rotYaw; + this.prevPitch = this.rotPitch; + super.particleMaxAge = age; + final EntityLivingBase renderentity = Minecraft.getMinecraft().renderViewEntity; + int visibleDistance = 50; + if (!Minecraft.getMinecraft().gameSettings.fancyGraphics) { + visibleDistance = 25; + } + if (renderentity.getDistance(((Entity) this).posX, ((Entity) this).posY, + ((Entity) this).posZ) > visibleDistance) { + super.particleMaxAge = 0; + } + } + + public void onUpdate() { + ((Entity) this).prevPosX = ((Entity) this).posX; + ((Entity) this).prevPosY = ((Entity) this).posY; + ((Entity) this).prevPosZ = ((Entity) this).posZ; + this.prevYaw = this.rotYaw; + this.prevPitch = this.rotPitch; + final float xd = (float) (((Entity) this).posX - this.target.x); + final float yd = (float) (((Entity) this).posY - this.target.y); + final float zd = (float) (((Entity) this).posZ - this.target.z); + this.length = MathHelper.sqrt_float(xd * xd + yd * yd + zd * zd); + final double var7 = MathHelper.sqrt_double((double) (xd * xd + zd * zd)); + this.rotYaw = (float) (Math.atan2(xd, zd) * 180.0 / 3.141592653589793); + this.rotPitch = (float) (Math.atan2(yd, var7) * 180.0 / 3.141592653589793); + if (super.particleAge++ >= super.particleMaxAge) { + this.setDead(); + } + } + + public void setRGB(final float r, final float g, final float b) { + super.particleRed = r; + super.particleGreen = g; + super.particleBlue = b; + } + + public void renderParticle(final Tessellator tessellator, final float f, + final float f1, final float f2, final float f3, + final float f4, final float f5) { + tessellator.draw(); + GL11.glPushMatrix(); + final float var9 = 1.0f; + final float slide = (float) ((Entity) this).worldObj.getTotalWorldTime(); + final float rot = ((Entity) this).worldObj.provider.getWorldTime() % + (360 / this.rotationSpeed) * this.rotationSpeed + + this.rotationSpeed * f; + float size = 1.0f; + if (this.pulse) { + size = Math.min(super.particleAge / 4.0f, 1.0f); + size = this.prevSize + (size - this.prevSize) * f; + } + float op = 0.5f; + if (this.pulse && super.particleMaxAge - super.particleAge <= 4) { + op = 0.5f - (4 - (super.particleMaxAge - super.particleAge)) * 0.1f; + } + Minecraft.getMinecraft().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/noise.png")); + GL11.glTexParameterf(3553, 10242, 10497.0f); + GL11.glTexParameterf(3553, 10243, 10497.0f); + GL11.glDisable(2884); + float var10 = slide + f; + if (this.reverse) { + var10 *= -1.0f; + } + final float var11 = -var10 * 0.2f - MathHelper.floor_float(-var10 * 0.1f); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + GL11.glDepthMask(false); + final float xx = (float) (((Entity) this).prevPosX + + (((Entity) this).posX - ((Entity) this).prevPosX) * f - + EntityFX.interpPosX); + final float yy = (float) (((Entity) this).prevPosY + + (((Entity) this).posY - ((Entity) this).prevPosY) * f - + EntityFX.interpPosY); + final float zz = (float) (((Entity) this).prevPosZ + + (((Entity) this).posZ - ((Entity) this).prevPosZ) * f - + EntityFX.interpPosZ); + GL11.glTranslated((double) xx, (double) yy, (double) zz); + final float ry = this.prevYaw + (this.rotYaw - this.prevYaw) * f; + final float rp = this.prevPitch + (this.rotPitch - this.prevPitch) * f; + GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + GL11.glRotatef(180.0f + ry, 0.0f, 0.0f, -1.0f); + GL11.glRotatef(rp, 1.0f, 0.0f, 0.0f); + final double var12 = -0.15 * size; + final double var13 = 0.15 * size; + final double var44b = -0.15 * size * this.endModifier; + final double var17b = 0.15 * size * this.endModifier; + GL11.glRotatef(rot, 0.0f, 1.0f, 0.0f); + for (int t = 0; t < 3; ++t) { + final double var14 = this.length * size * var9; + final double var15 = 0.0; + final double var16 = 1.0; + final double var17 = -1.0f + var11 + t / 3.0f; + final double var18 = this.length * size * var9 + var17; + GL11.glRotatef(60.0f, 0.0f, 1.0f, 0.0f); + tessellator.startDrawingQuads(); + tessellator.setBrightness(200); + tessellator.setColorRGBA_F(super.particleRed, super.particleGreen, + super.particleBlue, op); + tessellator.addVertexWithUV(var44b, var14, 0.0, var16, var18); + tessellator.addVertexWithUV(var12, 0.0, 0.0, var16, var17); + tessellator.addVertexWithUV(var13, 0.0, 0.0, var15, var17); + tessellator.addVertexWithUV(var17b, var14, 0.0, var15, var18); + tessellator.draw(); + } + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GL11.glDepthMask(true); + GL11.glDisable(3042); + GL11.glEnable(2884); + GL11.glPopMatrix(); + tessellator.startDrawingQuads(); + this.prevSize = size; + Minecraft.getMinecraft().renderEngine.bindTexture( + new ResourceLocation("particles/particles.png")); + } +} diff --git a/src/main/java/icbm/gangshao/render/RAATurret.java b/src/main/java/icbm/gangshao/render/RAATurret.java new file mode 100644 index 0000000..c690784 --- /dev/null +++ b/src/main/java/icbm/gangshao/render/RAATurret.java @@ -0,0 +1,68 @@ +package icbm.gangshao.render; + +import calclavia.lib.render.RenderTaggedTile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.muoxing.ModelAATurret; +import icbm.gangshao.turret.TTurretBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RAATurret extends RenderTaggedTile { + public static final String TEXTURE_FILE = "aa_turret_neutral.png"; + public static final String TEXTURE_FILE_FRIENDLY = "aa_turret_friendly.png"; + public static final String TEXTURE_FILE_HOSTILE = "aa_turret_hostile.png"; + public static final ModelAATurret MODEL; + + @Override + public void renderTileEntityAt(final TileEntity t, final double x, + final double y, final double z, + final float f) { + super.renderTileEntityAt(t, x, y, z, f); + if (t instanceof TTurretBase) { + final TTurretBase tileEntity = (TTurretBase) t; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.0f, (float) z + 0.5f); + GL11.glScalef(0.7f, 0.7f, 0.7f); + this.setTextureBaseOnState(tileEntity); + render(tileEntity.currentRotationYaw, tileEntity.currentRotationPitch); + GL11.glPopMatrix(); + } + } + + public static void render(final float renderYaw, final float renderPitch) { + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(renderYaw, 0.0f, 1.0f, 0.0f); + RAATurret.MODEL.renderBody(0.0625f); + RAATurret.MODEL.renderRadar(0.0625f); + RAATurret.MODEL.renderCannon(0.0625f, (float) Math.toRadians(renderPitch)); + } + + public void setTextureBaseOnState(final TTurretBase tileEntity) { + final EntityPlayer player = this.getPlayer(); + if (tileEntity.getPlatform() != null) { + final AccessLevel level = tileEntity.getPlatform().getUserAccess(player.getDisplayName()); + if (level == AccessLevel.ADMIN) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/aa_turret_neutral.png")); + return; + } + if (level.ordinal() >= AccessLevel.USER.ordinal()) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/aa_turret_friendly.png")); + return; + } + } + this.bindTexture( + new ResourceLocation("icbm", "textures/models/aa_turret_hostile.png")); + } + + static { + MODEL = new ModelAATurret(); + } +} diff --git a/src/main/java/icbm/gangshao/render/RESeat.java b/src/main/java/icbm/gangshao/render/RESeat.java new file mode 100644 index 0000000..949ab55 --- /dev/null +++ b/src/main/java/icbm/gangshao/render/RESeat.java @@ -0,0 +1,16 @@ +package icbm.gangshao.render; + +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class RESeat extends Render { + public void doRender(final Entity var1, final double var2, final double var4, + final double var6, final float var8, final float var9) { + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return null; + } +} diff --git a/src/main/java/icbm/gangshao/render/RGunTurret.java b/src/main/java/icbm/gangshao/render/RGunTurret.java new file mode 100644 index 0000000..df961a5 --- /dev/null +++ b/src/main/java/icbm/gangshao/render/RGunTurret.java @@ -0,0 +1,67 @@ +package icbm.gangshao.render; + +import calclavia.lib.render.RenderTaggedTile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.muoxing.ModelSentryCannon; +import icbm.gangshao.turret.TTurretBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RGunTurret extends RenderTaggedTile { + public static final String TEXTURE_FILE = "gun_turret_neutral.png"; + public static final String TEXTURE_FILE_FRIENDLY = "gun_turret_friendly.png"; + public static final String TEXTURE_FILE_HOSTILE = "gun_turret_hostile.png"; + public static final ModelSentryCannon MODEL; + + @Override + public void renderTileEntityAt(final TileEntity t, final double x, + final double y, final double z, + final float f) { + super.renderTileEntityAt(t, x, y, z, f); + if (t instanceof TTurretBase) { + final TTurretBase tileEntity = (TTurretBase) t; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + this.setTextureBaseOnState(tileEntity); + render(tileEntity.currentRotationYaw, tileEntity.currentRotationPitch); + GL11.glPopMatrix(); + } + } + + public static void render(final float renderYaw, final float renderPitch) { + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(renderYaw, 0.0f, 1.0f, 0.0f); + RGunTurret.MODEL.renderYaw(0.0625f); + GL11.glRotatef(renderPitch, 1.0f, 0.0f, 0.0f); + RGunTurret.MODEL.renderYawPitch(0.0625f); + } + + public void setTextureBaseOnState(final TTurretBase tileEntity) { + final EntityPlayer player = this.getPlayer(); + if (tileEntity.getPlatform() != null) { + final AccessLevel level = tileEntity.getPlatform().getUserAccess(player.getDisplayName()); + if (level == AccessLevel.ADMIN) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/gun_turret_neutral.png")); + return; + } + if (level.ordinal() >= AccessLevel.USER.ordinal()) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/gun_turret_friendly.png")); + return; + } + } + this.bindTexture( + new ResourceLocation("icbm", "textures/models/gun_turret_hostile.png")); + } + + static { + MODEL = new ModelSentryCannon(); + } +} diff --git a/src/main/java/icbm/gangshao/render/RLaserTurret.java b/src/main/java/icbm/gangshao/render/RLaserTurret.java new file mode 100644 index 0000000..0805a3e --- /dev/null +++ b/src/main/java/icbm/gangshao/render/RLaserTurret.java @@ -0,0 +1,74 @@ +package icbm.gangshao.render; + +import calclavia.lib.render.RenderTaggedTile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.muoxing.MLeiShe; +import icbm.gangshao.turret.TTurretBase; +import icbm.gangshao.turret.sentries.TLaserTurret; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RLaserTurret extends RenderTaggedTile { + public static final String TEXTURE_FILE = "laser_turret_neutral.png"; + public static final String TEXTURE_FILE_FRIENDLY = "laser_turret_friendly.png"; + public static final String TEXTURE_FILE_HOSTILE = "laser_turret_hostile.png"; + public static final MLeiShe MODEL; + + @Override + public void renderTileEntityAt(final TileEntity t, final double x, + final double y, final double z, + final float f) { + super.renderTileEntityAt(t, x, y, z, f); + if (t instanceof TLaserTurret) { + final TLaserTurret tileEntity = (TLaserTurret) t; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + this.setTextureBaseOnState(tileEntity); + render(tileEntity.currentRotationYaw, tileEntity.currentRotationPitch, + tileEntity.barrelRotation); + GL11.glPopMatrix(); + } + } + + public static void render(final float renderYaw, final float renderPitch) { + render(renderYaw, renderPitch, 0.0f); + } + + public static void render(final float renderYaw, final float renderPitch, + final float barrelRotation) { + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(renderYaw, 0.0f, 1.0f, 0.0f); + RLaserTurret.MODEL.renderYaw(0.0625f); + GL11.glRotatef(renderPitch, 1.0f, 0.0f, 0.0f); + RLaserTurret.MODEL.renderYawPitch(0.0625f, barrelRotation); + } + + public void setTextureBaseOnState(final TTurretBase tileEntity) { + final EntityPlayer player = this.getPlayer(); + if (tileEntity.getPlatform() != null) { + final AccessLevel level = tileEntity.getPlatform().getUserAccess(player.getDisplayName()); + if (level == AccessLevel.ADMIN) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/laser_turret_neutral.png")); + return; + } + if (level.ordinal() >= AccessLevel.USER.ordinal()) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/laser_turret_friendly.png")); + return; + } + } + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/laser_turret_hostile.png")); + } + + static { + MODEL = new MLeiShe(); + } +} diff --git a/src/main/java/icbm/gangshao/render/RRailgun.java b/src/main/java/icbm/gangshao/render/RRailgun.java new file mode 100644 index 0000000..b574088 --- /dev/null +++ b/src/main/java/icbm/gangshao/render/RRailgun.java @@ -0,0 +1,41 @@ +package icbm.gangshao.render; + +import calclavia.lib.render.RenderTaggedTile; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.muoxing.ModelRailgun; +import icbm.gangshao.turret.mount.TRailgunTurret; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RRailgun extends RenderTaggedTile { + public static final String TEXTURE_FILE = "railgun.png"; + public static final ModelRailgun MODEL; + + @Override + public void renderTileEntityAt(final TileEntity t, final double x, + final double y, final double z, + final float f) { + super.renderTileEntityAt(t, x, y, z, f); + if (t instanceof TRailgunTurret) { + final TRailgunTurret tileEntity = (TRailgunTurret) t; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 2.2f, (float) z + 0.5f); + GL11.glScalef(1.5f, 1.5f, 1.5f); + this.bindTexture( + new ResourceLocation("icbm", "textures/models/railgun.png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + RRailgun.MODEL.render( + (float) Math.toRadians(tileEntity.currentRotationYaw), + (float) Math.toRadians(tileEntity.currentRotationPitch), 0.0625f); + GL11.glPopMatrix(); + } + } + + static { + MODEL = new ModelRailgun(); + } +} diff --git a/src/main/java/icbm/gangshao/saving/INbtSave.java b/src/main/java/icbm/gangshao/saving/INbtSave.java new file mode 100644 index 0000000..4b1711a --- /dev/null +++ b/src/main/java/icbm/gangshao/saving/INbtSave.java @@ -0,0 +1,11 @@ +package icbm.gangshao.saving; + +import net.minecraft.nbt.NBTTagCompound; + +public interface INbtSave { + String saveFileName(); + + NBTTagCompound getSaveData(); + + boolean shouldSave(final boolean p0); +} diff --git a/src/main/java/icbm/gangshao/saving/SaveManager.java b/src/main/java/icbm/gangshao/saving/SaveManager.java new file mode 100644 index 0000000..2a6b55e --- /dev/null +++ b/src/main/java/icbm/gangshao/saving/SaveManager.java @@ -0,0 +1,50 @@ +package icbm.gangshao.saving; + +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.event.FMLServerStoppingEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import java.util.ArrayList; +import java.util.List; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; +import universalelectricity.prefab.flag.NBTFileLoader; + +public class SaveManager { + public static List nbtSaveList; + public static boolean isInitialized; + public static SaveManager intance; + + public void registerNbtSave(final INbtSave saveClass) { + if (!SaveManager.isInitialized) { + MinecraftForge.EVENT_BUS.register((Object) this); + SaveManager.isInitialized = true; + } + if (saveClass != null && !SaveManager.nbtSaveList.contains(saveClass)) { + SaveManager.nbtSaveList.add(saveClass); + } + } + + @SubscribeEvent + public void onWorldSave(final WorldEvent.Save event) { + this.save(!((WorldEvent) event).world.isRemote); + } + + @Mod.EventHandler + public void serverStopping(final FMLServerStoppingEvent event) { + this.save(true); + } + + public void save(final boolean isServer) { + for (final INbtSave save : SaveManager.nbtSaveList) { + if (save.shouldSave(isServer)) { + NBTFileLoader.saveData(save.saveFileName(), save.getSaveData()); + } + } + } + + static { + SaveManager.nbtSaveList = new ArrayList<>(); + SaveManager.isInitialized = false; + SaveManager.intance = new SaveManager(); + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiButtonArrow.java b/src/main/java/icbm/gangshao/shimian/GuiButtonArrow.java new file mode 100644 index 0000000..7ec1481 --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiButtonArrow.java @@ -0,0 +1,44 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiButtonArrow extends GuiButton { + boolean isLeft; + + public GuiButtonArrow(final int par1, final int par2, final int par3, + final boolean left) { + super(par1, par2, par3, 10, 10, ""); + this.isLeft = false; + this.isLeft = left; + } + + @Override + public void drawButton(final Minecraft par1Minecraft, final int width, + final int hight) { + // TODO: WTF + // if (this.drawButton) { + par1Minecraft.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui@.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final boolean var4 = width >= this.xPosition && hight >= this.yPosition && + width < this.xPosition + this.width && + hight < this.yPosition + this.height; + int var5 = 126; + int varWid = 20; + if (this.isLeft) { + varWid += 10; + } + if (var4) { + var5 += this.height; + } + this.drawTexturedModalRect(this.xPosition, this.yPosition, varWid, var5, + this.width, this.height); + // } + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiButtonImage.java b/src/main/java/icbm/gangshao/shimian/GuiButtonImage.java new file mode 100644 index 0000000..fabb39f --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiButtonImage.java @@ -0,0 +1,61 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiButtonImage extends GuiButton { + private int type; + + public GuiButtonImage(final int par1, final int par2, final int par3, + final int type) { + super(par1, par2, par3, 20, 20, ""); + this.type = 0; + this.type = type; + } + + public void func_73737_a(final Minecraft par1Minecraft, final int width, + final int hight) { + // TODO: WTf + // if (this.drawButton) { + par1Minecraft.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui@.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final boolean var4 = width >= this.xPosition && hight >= this.yPosition && + width < this.xPosition + this.width && + hight < this.yPosition + this.height; + int var5 = 106; + int var6 = 0; + if (var4) { + var5 += this.height; + } + switch (this.type) { + case 0: { + var5 += 40; + break; + } + case 1: { + var5 += 40; + var6 += 20; + break; + } + case 2: { + var5 += 40; + var6 += 40; + break; + } + } + this.drawTexturedModalRect(this.xPosition, this.yPosition, var6, var5, + this.width, this.height); + // } + } + + public boolean isIntersect(final int x, final int y) { + return x >= this.xPosition && y >= this.yPosition && + x < this.xPosition + this.width && y < this.yPosition + this.height; + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiPlatformAccess.java b/src/main/java/icbm/gangshao/shimian/GuiPlatformAccess.java new file mode 100644 index 0000000..b1d9b60 --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiPlatformAccess.java @@ -0,0 +1,202 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.access.UserAccess; +import icbm.gangshao.platform.TPlatform; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.vector.Vector2; +import universalelectricity.prefab.vector.Region2; + +@SideOnly(Side.CLIENT) +public class GuiPlatformAccess extends GuiPlatformBase implements IScroll { + private GuiTextField commandLine; + private int scroll; + private final HashMap outputMap; + + public GuiPlatformAccess(final EntityPlayer entityPlayer, + final TPlatform tileEntity) { + super(entityPlayer, tileEntity); + this.scroll = 0; + this.outputMap = new HashMap<>(); + } + + @Override + public void initGui() { + super.initGui(); + final int width = (this.width - super.xSize) / 2; + final int height = (this.height - super.ySize) / 2; + (this.commandLine = new GuiTextField(this.fontRendererObj, width + 12, + height + 165, 135, 11)) + .setMaxStringLength(30); + this.buttonList.add(new GuiButtonArrow(4, width + 151, height + 21, false)); + this.buttonList.add(new GuiButtonArrow(5, width + 151, height + 152, true)); + Keyboard.enableRepeatEvents(true); + } + + @Override + public void onGuiClosed() { + super.onGuiClosed(); + Keyboard.enableRepeatEvents(false); + } + + @Override + public void updateScreen() { + super.updateScreen(); + this.commandLine.setFocused(true); + } + + @Override + public void handleMouseInput() { + super.handleMouseInput(); + final int wheel = Mouse.getEventDWheel(); + if (wheel > 0) { + this.scroll(-2); + } else if (wheel < 0) { + this.scroll(2); + } + } + + @Override + protected void actionPerformed(final GuiButton button) { + super.actionPerformed(button); + switch (button.id) { + case 4: { + this.scroll(-1); + break; + } + case 5: { + this.scroll(1); + break; + } + } + } + + @Override + protected void keyTyped(final char character, final int keycode) { + if (keycode == 1) { + this.mc.thePlayer.closeScreen(); + } else if (keycode == 200) { + this.scroll(-1); + } else if (keycode == 208) { + this.scroll(1); + } else if (keycode == 28) { + String command = "users add"; + final String username = this.commandLine.getText(); + for (final UserAccess access : super.tileEntity.getUsers()) { + if (access.username.equalsIgnoreCase(username)) { + command = "users remove"; + break; + } + } + // TODO: WTF + // super.tileEntity.sendCommandToServer(super.entityPlayer, + // command + " " + username); + this.commandLine.setText(""); + } else { + this.commandLine.textboxKeyTyped(character, keycode); + } + } + + protected void mouseClicked(final int x, final int y, final int type) { + super.mouseClicked(x, y, type); + if (type == 0) { + for (final Map.Entry entry : this.outputMap.entrySet()) { + final Vector2 vector2; + final Vector2 minPos = vector2 = entry.getValue(); + vector2.x -= 2.0; + final Vector2 vector3 = minPos; + vector3.y -= 2.0; + final Vector2 clone; + final Vector2 maxPos = clone = minPos.clone(); + clone.x += 132.0; + final Vector2 vector4 = maxPos; + vector4.y += 12.0; + if (new Region2(minPos, maxPos) + .isIn(new Vector2(x - super.guiLeft, y - super.guiTop))) { + final UserAccess access = entry.getKey(); + int newLevelOrdinal = access.level.ordinal() + 1; + if (newLevelOrdinal >= AccessLevel.values().length) { + newLevelOrdinal -= AccessLevel.values().length; + } + if (newLevelOrdinal <= 0) { + newLevelOrdinal = 1; + } + final AccessLevel newLevel = AccessLevel.get(newLevelOrdinal); + // TODO: WTF + // super.tileEntity.sendCommandToServer(super.entityPlayer, + // "access set " + access.username + + // " " + newLevel.displayName); + break; + } + } + } + this.commandLine.mouseClicked(x, y, type); + } + + @Override + protected void drawForegroundLayer(final int x, final int y, + final float var1) { + final String title = "User Access"; + this.fontRendererObj.drawString( + "§7" + title, super.xSize / 2 - title.length() * 3, 4, 4210752); + this.drawConsole(15, 25, 15); + super.drawForegroundLayer(x, y, var1); + } + + public void drawConsole(final int x, final int y, final int lines) { + final int color = 14737632; + this.outputMap.clear(); + for (int i = 0; i < lines; ++i) { + final int currentLine = i + this.getScroll(); + if (currentLine < super.tileEntity.getUsers().size() && + currentLine >= 0) { + final UserAccess accesInfo = super.tileEntity.getUsers().get(currentLine); + final String line = accesInfo.username + " (" + accesInfo.level.displayName + ")"; + if (line != null && line != "") { + final Vector2 drawPosition = new Vector2(x, 10 * i + y); + this.outputMap.put(accesInfo, drawPosition); + this.fontRendererObj.drawString(line, drawPosition.intX(), + drawPosition.intY(), color); + } + } + } + } + + @Override + protected void drawBackgroundLayer(final int x, final int y, + final float var1) { + super.drawBackgroundLayer(x, y, var1); + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_platform_terminal.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final int var2 = (this.width - super.xSize) / 2; + final int var3 = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(var2, var3, 0, 0, super.xSize, super.ySize); + this.commandLine.drawTextBox(); + } + + @Override + public void scroll(final int amount) { + this.setScroll(this.scroll + amount); + } + + @Override + public void setScroll(final int length) { + this.scroll = Math.max(Math.min(length, super.tileEntity.getUsers().size()), 0); + } + + @Override + public int getScroll() { + return this.scroll; + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiPlatformBase.java b/src/main/java/icbm/gangshao/shimian/GuiPlatformBase.java new file mode 100644 index 0000000..ba828ea --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiPlatformBase.java @@ -0,0 +1,174 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.platform.TPlatform; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import universalelectricity.prefab.GuiBase; + +@SideOnly(Side.CLIENT) +public abstract class GuiPlatformBase extends GuiBase { + protected static final int MAX_BUTTON_ID = 3; + protected TPlatform tileEntity; + protected EntityPlayer entityPlayer; + + public GuiPlatformBase(final EntityPlayer player, + final TPlatform tileEntity) { + this.tileEntity = tileEntity; + this.entityPlayer = player; + super.ySize = 190; + } + + @Override + public void initGui() { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add( + new GuiButtonImage(0, (this.width - super.xSize) / 2 - 22, + (this.height - super.ySize) / 2 + 0, 3)); + this.buttonList.add( + new GuiButtonImage(1, (this.width - super.xSize) / 2 - 22, + (this.height - super.ySize) / 2 + 22, 0)); + this.buttonList.add( + new GuiButtonImage(2, (this.width - super.xSize) / 2 - 22, + (this.height - super.ySize) / 2 + 44, 2)); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM", this.tileEntity, + // TileEntityTerminal.TerminalPacketType.GUI_EVENT.ordinal(), + // true)); + } + + @Override + public void updateScreen() { + super.updateScreen(); + if (this.tileEntity.getTurret(false) == null) { + this.mc.thePlayer.closeScreen(); + } + } + + @Override + protected void actionPerformed(final GuiButton button) { + if (this.tileEntity.getTurret(false) != null) { + switch (button.id) { + case 0: { + this.entityPlayer.openGui( + (Object) ICBMSentry.instance, 1, this.tileEntity.getWorldObj(), + this.tileEntity.xCoord, this.tileEntity.yCoord, + this.tileEntity.zCoord); + break; + } + case 1: { + this.entityPlayer.openGui( + (Object) ICBMSentry.instance, 2, this.tileEntity.getWorldObj(), + this.tileEntity.xCoord, this.tileEntity.yCoord, + this.tileEntity.zCoord); + break; + } + case 2: { + this.entityPlayer.openGui( + (Object) ICBMSentry.instance, 0, this.tileEntity.getWorldObj(), + this.tileEntity.xCoord, this.tileEntity.yCoord, + this.tileEntity.zCoord); + break; + } + } + } + } + + @Override + public void onGuiClosed() { + super.onGuiClosed(); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM", this.tileEntity, + // TileEntityTerminal.TerminalPacketType.GUI_EVENT.ordinal(), + // false)); + } + + @Override + protected void drawForegroundLayer(final int x, final int y, + final float var1) { + if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y)) { + this.drawTooltip(x - super.guiLeft, y - super.guiTop + 10, "Terminal"); + } else if (((GuiButtonImage) this.buttonList.get(1)).isIntersect(x, y)) { + this.drawTooltip(x - super.guiLeft, y - super.guiTop + 10, "Access"); + } else if (((GuiButtonImage) this.buttonList.get(2)).isIntersect(x, y)) { + this.drawTooltip(x - super.guiLeft, y - super.guiTop + 10, "Ammunition"); + } + } + + @Override + protected void drawBackgroundLayer(final int x, final int y, + final float var1) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final int containerWidth = (this.width - super.xSize) / 2; + final int containerHeight = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, + super.xSize, super.ySize); + } + + @Override + public void drawTooltip(final int x, final int y, final String... toolTips) { + GL11.glDisable(32826); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(2896); + GL11.glDisable(2929); + if (toolTips != null) { + int var5 = 0; + for (int var6 = 0; var6 < toolTips.length; ++var6) { + final int var7 = this.fontRendererObj.getStringWidth(toolTips[var6]); + if (var7 > var5) { + var5 = var7; + } + } + int var6 = x + 12; + int var7 = y - 12; + int var8 = 8; + if (toolTips.length > 1) { + var8 += 2 + (toolTips.length - 1) * 10; + } + if (super.guiTop + var7 + var8 + 6 > this.height) { + var7 = this.height - var8 - super.guiTop - 6; + } + this.zLevel = 300.0f; + final int var9 = -267386864; + this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var9, + var9); + this.drawGradientRect(var6 - 3, var7 + var8 + 3, var6 + var5 + 3, + var7 + var8 + 4, var9, var9); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, + var7 + var8 + 3, var9, var9); + this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var8 + 3, var9, + var9); + this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, + var7 + var8 + 3, var9, var9); + final int var10 = 1347420415; + final int var11 = (var10 & 0xFEFEFE) >> 1 | (var10 & 0xFF000000); + this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, + var7 + var8 + 3 - 1, var10, var11); + this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, + var7 + var8 + 3 - 1, var10, var11); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, + var10, var10); + this.drawGradientRect(var6 - 3, var7 + var8 + 2, var6 + var5 + 3, + var7 + var8 + 3, var11, var11); + for (int var12 = 0; var12 < toolTips.length; ++var12) { + final String var13 = "§7" + toolTips[var12]; + this.fontRendererObj.drawStringWithShadow(var13, var6, var7, -1); + if (var12 == 0) { + var7 += 2; + } + var7 += 10; + } + this.zLevel = 0.0f; + } + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiPlatformContainer.java b/src/main/java/icbm/gangshao/shimian/GuiPlatformContainer.java new file mode 100644 index 0000000..9985e86 --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiPlatformContainer.java @@ -0,0 +1,161 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.container.ContainerTurretPlatform; +import icbm.gangshao.platform.TPlatform; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public abstract class GuiPlatformContainer extends GuiContainer { + protected static final int MAX_BUTTON_ID = 3; + protected TPlatform tileEntity; + protected EntityPlayer entityPlayer; + + public GuiPlatformContainer(final InventoryPlayer inventoryPlayer, + final TPlatform tileEntity) { + super((Container) new ContainerTurretPlatform(inventoryPlayer, tileEntity)); + this.tileEntity = tileEntity; + this.entityPlayer = inventoryPlayer.player; + this.ySize = 190; + } + + public void initGui() { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add( + new GuiButtonImage(0, (this.width - this.xSize) / 2 - 22, + (this.height - this.ySize) / 2 + 0, 3)); + this.buttonList.add( + new GuiButtonImage(1, (this.width - this.xSize) / 2 - 22, + (this.height - this.ySize) / 2 + 22, 0)); + this.buttonList.add( + new GuiButtonImage(2, (this.width - this.xSize) / 2 - 22, + (this.height - this.ySize) / 2 + 44, 2)); + } + + public void updateScreen() { + super.updateScreen(); + if (this.tileEntity.getTurret(false) == null) { + this.mc.thePlayer.closeScreen(); + } + } + + protected void func_73875_a(final GuiButton button) { + if (this.tileEntity.getTurret(false) != null) { + switch (button.id) { + case 0: { + this.entityPlayer.openGui( + (Object) ICBMSentry.instance, 1, this.tileEntity.getWorldObj(), + this.tileEntity.xCoord, this.tileEntity.yCoord, + this.tileEntity.zCoord); + break; + } + case 1: { + this.entityPlayer.openGui( + (Object) ICBMSentry.instance, 2, this.tileEntity.getWorldObj(), + this.tileEntity.xCoord, this.tileEntity.yCoord, + this.tileEntity.zCoord); + break; + } + case 2: { + this.entityPlayer.openGui( + (Object) ICBMSentry.instance, 0, this.tileEntity.getWorldObj(), + this.tileEntity.xCoord, this.tileEntity.yCoord, + this.tileEntity.zCoord); + break; + } + } + } + } + + protected void func_74189_g(final int x, final int y) { + if (this.tileEntity.getTurret(false) != null) { + final String title = this.tileEntity.getTurret(false).getName(); + this.fontRendererObj.drawString( + "§7" + title, (int) (this.xSize / 2 - title.length() * 2.5), 4, + 4210752); + if (((GuiButtonImage) this.buttonList.get(0)).isIntersect(x, y)) { + this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Terminal"); + } else if (((GuiButtonImage) this.buttonList.get(1)).isIntersect(x, y)) { + this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Access"); + } else if (((GuiButtonImage) this.buttonList.get(2)).isIntersect(x, y)) { + this.drawTooltip(x - this.guiLeft, y - this.guiTop + 10, "Ammunition"); + } + } + } + + protected void func_74185_a(final float par1, final int x, final int y) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_base.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final int containerWidth = (this.width - this.xSize) / 2; + final int containerHeight = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, + this.xSize, this.ySize); + } + + public void drawTooltip(final int x, final int y, final String... toolTips) { + GL11.glDisable(32826); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(2896); + GL11.glDisable(2929); + if (toolTips != null) { + int var5 = 0; + for (int var6 = 0; var6 < toolTips.length; ++var6) { + final int var7 = this.fontRendererObj.getStringWidth(toolTips[var6]); + if (var7 > var5) { + var5 = var7; + } + } + int var6 = x + 12; + int var7 = y - 12; + int var8 = 8; + if (toolTips.length > 1) { + var8 += 2 + (toolTips.length - 1) * 10; + } + if (this.guiTop + var7 + var8 + 6 > this.height) { + var7 = this.height - var8 - this.guiTop - 6; + } + this.zLevel = 300.0f; + final int var9 = -267386864; + this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var9, + var9); + this.drawGradientRect(var6 - 3, var7 + var8 + 3, var6 + var5 + 3, + var7 + var8 + 4, var9, var9); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, + var7 + var8 + 3, var9, var9); + this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var8 + 3, var9, + var9); + this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, + var7 + var8 + 3, var9, var9); + final int var10 = 1347420415; + final int var11 = (var10 & 0xFEFEFE) >> 1 | (var10 & 0xFF000000); + this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, + var7 + var8 + 3 - 1, var10, var11); + this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, + var7 + var8 + 3 - 1, var10, var11); + this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, + var10, var10); + this.drawGradientRect(var6 - 3, var7 + var8 + 2, var6 + var5 + 3, + var7 + var8 + 3, var11, var11); + for (int var12 = 0; var12 < toolTips.length; ++var12) { + final String var13 = "§7" + toolTips[var12]; + this.fontRendererObj.drawStringWithShadow(var13, var6, var7, -1); + if (var12 == 0) { + var7 += 2; + } + var7 += 10; + } + this.zLevel = 0.0f; + } + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiPlatformSlots.java b/src/main/java/icbm/gangshao/shimian/GuiPlatformSlots.java new file mode 100644 index 0000000..ab00043 --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiPlatformSlots.java @@ -0,0 +1,58 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.turret.TTurretBase; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricityDisplay; + +@SideOnly(Side.CLIENT) +public class GuiPlatformSlots extends GuiPlatformContainer { + public GuiPlatformSlots(final InventoryPlayer inventoryPlayer, + final TPlatform tileEntity) { + super(inventoryPlayer, tileEntity); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int x, final int y) { + this.fontRendererObj.drawString("Ammunition", 8, 30, 4210752); + final TTurretBase turret = super.tileEntity.getTurret(false); + if (turret != null && turret.getFiringRequest() > 0.0) { + String color = "§4"; + if (super.tileEntity.isRunning()) { + color = "§a"; + } + this.fontRendererObj.drawString("Energy Per Shot", 85, 33, 4210752); + this.fontRendererObj.drawString( + color + ElectricityDisplay.getDisplayShort( + Math.min(super.tileEntity.wattsReceived, + turret.getFiringRequest()), + ElectricityDisplay.ElectricUnit.JOULES), + 87, 43, 4210752); + this.fontRendererObj.drawString( + color + "of " + + ElectricityDisplay.getDisplayShort( + super.tileEntity.getTurret(false).getFiringRequest(), + ElectricityDisplay.ElectricUnit.JOULES), + 87, 53, 4210752); + } + this.fontRendererObj.drawString("Upgrades", 87, 66, 4210752); + super.drawGuiContainerForegroundLayer(x, y); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int x, + final int y) { + // super.drawGuiContainerBackgroundLayer(par1, x, y); + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_platform_slot.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final int containerWidth = (this.width - this.xSize) / 2; + final int containerHeight = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, + this.xSize, this.ySize); + } +} diff --git a/src/main/java/icbm/gangshao/shimian/GuiPlatformTerminal.java b/src/main/java/icbm/gangshao/shimian/GuiPlatformTerminal.java new file mode 100644 index 0000000..d9273b6 --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/GuiPlatformTerminal.java @@ -0,0 +1,141 @@ +package icbm.gangshao.shimian; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.terminal.TileEntityTerminal; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class GuiPlatformTerminal extends GuiPlatformBase { + private TileEntityTerminal tileEntity; + private GuiTextField commandLine; + + public GuiPlatformTerminal(final EntityPlayer entityPlayer, + final TPlatform tileEntity) { + super(entityPlayer, tileEntity); + this.tileEntity = tileEntity; + } + + @Override + public void initGui() { + super.initGui(); + final int width = (this.width - super.xSize) / 2; + final int height = (this.height - super.ySize) / 2; + (this.commandLine = new GuiTextField(this.fontRendererObj, width + 12, + height + 165, 135, 11)) + .setMaxStringLength(30); + this.buttonList.add(new GuiButtonArrow(4, width + 151, height + 21, false)); + this.buttonList.add(new GuiButtonArrow(5, width + 151, height + 152, true)); + Keyboard.enableRepeatEvents(true); + } + + @Override + public void onGuiClosed() { + super.onGuiClosed(); + Keyboard.enableRepeatEvents(false); + } + + @Override + public void updateScreen() { + super.updateScreen(); + this.commandLine.setFocused(true); + } + + public void handleMouseInput() { + super.handleMouseInput(); + final int wheel = Mouse.getEventDWheel(); + if (wheel > 0) { + this.tileEntity.scroll(-2); + } else if (wheel < 0) { + this.tileEntity.scroll(2); + } + } + + @Override + protected void actionPerformed(final GuiButton button) { + super.actionPerformed(button); + switch (button.id) { + case 4: { + this.tileEntity.scroll(-1); + break; + } + case 5: { + this.tileEntity.scroll(1); + break; + } + } + } + + @Override + protected void keyTyped(final char character, final int keycode) { + if (keycode == 1) { + this.mc.thePlayer.closeScreen(); + } else if (keycode == 200) { + this.tileEntity.scroll(-1); + } else if (keycode == 208) { + this.tileEntity.scroll(1); + } else if (keycode == 28) { + //TODO: WTF + //this.tileEntity.sendCommandToServer(super.entityPlayer, + // this.commandLine.getText()); + this.commandLine.setText(""); + } else { + this.commandLine.textboxKeyTyped(character, keycode); + } + } + + protected void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.commandLine.mouseClicked(par1, par2, par3); + } + + @Override + protected void drawForegroundLayer(final int x, final int y, + final float var1) { + final String title = "Terminal"; + this.fontRendererObj.drawString( + "§7" + title, (int) (super.xSize / 2 - title.length() * 2.5), 4, + 4210752); + this.drawConsole(25, 16, 15); + super.drawForegroundLayer(x, y, var1); + } + + public void drawConsole(final int x, final int y, final int lines) { + final int spacing = 10; + final int color = 14737632; + GL11.glPushMatrix(); + final float scale = 0.92f; + GL11.glScalef(scale, scale, scale); + for (int i = 0; i < lines; ++i) { + final int currentLine = i + this.tileEntity.getScroll(); + if (currentLine < this.tileEntity.getTerminalOuput().size() && + currentLine >= 0) { + final String line = this.tileEntity.getTerminalOuput().get(currentLine); + if (line != null && line != "") { + this.fontRendererObj.drawString(line, y, spacing * i + x, color); + } + } + } + GL11.glPopMatrix(); + } + + @Override + protected void drawBackgroundLayer(final int x, final int y, + final float var1) { + super.drawBackgroundLayer(x, y, var1); + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_platform_terminal.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + final int var2 = (this.width - super.xSize) / 2; + final int var3 = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(var2, var3, 0, 0, super.xSize, super.ySize); + this.commandLine.drawTextBox(); + } +} diff --git a/src/main/java/icbm/gangshao/shimian/IScroll.java b/src/main/java/icbm/gangshao/shimian/IScroll.java new file mode 100644 index 0000000..29b2f40 --- /dev/null +++ b/src/main/java/icbm/gangshao/shimian/IScroll.java @@ -0,0 +1,9 @@ +package icbm.gangshao.shimian; + +public interface IScroll { + void scroll(final int p0); + + void setScroll(final int p0); + + int getScroll(); +} diff --git a/src/main/java/icbm/gangshao/task/LookHelper.java b/src/main/java/icbm/gangshao/task/LookHelper.java new file mode 100644 index 0000000..2d7c7a1 --- /dev/null +++ b/src/main/java/icbm/gangshao/task/LookHelper.java @@ -0,0 +1,78 @@ +package icbm.gangshao.task; + +import icbm.gangshao.turret.TTurretBase; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import universalelectricity.core.vector.Vector3; + +public class LookHelper { + public static final int PITCH_DISPLACEMENT = 0; + TTurretBase sentry; + + public LookHelper(final TTurretBase turret) { + this.sentry = turret; + } + + public void lookAt(final Vector3 target) { + this.sentry.rotateTo(getYaw(this.sentry.getMuzzle(), target), + getPitch(this.sentry.getMuzzle(), target)); + } + + public float[] getDeltaRotations(final Vector3 target) { + return new float[] { getYaw(this.sentry.getMuzzle(), target), + getPitch(this.sentry.getMuzzle(), target) }; + } + + public void lookAtEntity(final Entity entity) { + this.lookAt(Vector3.add(new Vector3(entity), + new Vector3(0.0, entity.getEyeHeight(), 0.0))); + } + + public boolean isLookingAt(final Vector3 target, final float allowedError) { + final float yaw = getYaw(this.sentry.getCenter(), target); + final float pitch = getPitch(this.sentry.getCenter(), target); + return Math.abs(getAngleDif(this.sentry.currentRotationYaw, yaw)) <= allowedError && + Math.abs(getAngleDif(this.sentry.currentRotationPitch, pitch)) <= allowedError; + } + + public boolean isLookingAt(final Entity entity, final float allowedError) { + return this.isLookingAt(new Vector3(entity.posX, + entity.posY + entity.getEyeHeight(), + entity.posZ), + allowedError); + } + + public static float getPitch(final Vector3 position, final Vector3 target) { + final Vector3 difference = Vector3.subtract(target, position); + final double verticleDistance = MathHelper.sqrt_double( + difference.x * difference.x + difference.z * difference.z); + return -MathHelper.wrapAngleTo180_float( + (float) (Math.atan2(difference.y, verticleDistance) * 180.0 / + 3.141592653589793) + + 0.0f); + } + + public static float getYaw(final Vector3 position, final Vector3 target) { + final Vector3 difference = Vector3.subtract(target, position); + return MathHelper.wrapAngleTo180_float( + (float) (Math.atan2(difference.z, difference.x) * 180.0 / + 3.141592653589793) - + 90.0f); + } + + public static float getAngleDif(final float angleOne, final float angleTwo) { + final double dif = Math.max(angleOne, angleTwo) - Math.min(angleOne, angleTwo); + return MathHelper.wrapAngleTo180_float((float) dif); + } + + public boolean canPositionBeSeen(final Vector3 target) { + return this.sentry.getWorldObj().rayTraceBlocks( + this.sentry.getMuzzle().toVec3(), target.toVec3()) == null; + } + + public boolean canEntityBeSeen(final Entity entity) { + final Vector3 target = Vector3.add( + new Vector3(entity), new Vector3(0.0, entity.getEyeHeight(), 0.0)); + return this.canPositionBeSeen(target); + } +} diff --git a/src/main/java/icbm/gangshao/task/Task.java b/src/main/java/icbm/gangshao/task/Task.java new file mode 100644 index 0000000..a524bac --- /dev/null +++ b/src/main/java/icbm/gangshao/task/Task.java @@ -0,0 +1,30 @@ +package icbm.gangshao.task; + +import icbm.gangshao.turret.sentries.TAutomaticTurret; +import net.minecraft.world.World; + +public abstract class Task { + protected int ticks; + public World world; + public TAutomaticTurret tileEntity; + public TaskManager taskManager; + + public Task() { + this.ticks = 0; + } + + protected boolean onUpdateTask() { + ++this.ticks; + return false; + } + + public void onTaskStart() { + } + + public void onTaskEnd() { + } + + public int getTickInterval() { + return 1; + } +} diff --git a/src/main/java/icbm/gangshao/task/TaskKillTarget.java b/src/main/java/icbm/gangshao/task/TaskKillTarget.java new file mode 100644 index 0000000..aa84d33 --- /dev/null +++ b/src/main/java/icbm/gangshao/task/TaskKillTarget.java @@ -0,0 +1,25 @@ +package icbm.gangshao.task; + +import icbm.gangshao.IAutoSentry; + +public class TaskKillTarget extends TaskSearchTarget { + @Override + protected boolean onUpdateTask() { + super.onUpdateTask(); + if (super.tileEntity instanceof IAutoSentry) { + if (!super.tileEntity.isValidTarget(super.tileEntity.getTarget())) { + super.tileEntity.setTarget(null); + super.tileEntity.cancelRotation(); + return false; + } + if (super.tileEntity.canActivateWeapon()) { + super.tileEntity.onWeaponActivated(); + } else { + final float[] rotations = super.tileEntity.lookHelper.getDeltaRotations( + super.tileEntity.getTargetPosition()); + super.tileEntity.rotateTo(rotations[0], rotations[1]); + } + } + return true; + } +} diff --git a/src/main/java/icbm/gangshao/task/TaskManager.java b/src/main/java/icbm/gangshao/task/TaskManager.java new file mode 100644 index 0000000..cc0a193 --- /dev/null +++ b/src/main/java/icbm/gangshao/task/TaskManager.java @@ -0,0 +1,55 @@ +package icbm.gangshao.task; + +import icbm.core.MainBase; +import icbm.gangshao.turret.sentries.TAutomaticTurret; +import java.util.ArrayList; +import java.util.List; + +public class TaskManager { + private final List tasks; + public TAutomaticTurret tileEntity; + + public TaskManager(final TAutomaticTurret tileEntity) { + this.tasks = new ArrayList<>(); + this.tileEntity = tileEntity; + } + + public void onUpdate() { + try { + if (this.tasks.size() > 0) { + final int taskIndex = 0; + final Task currentTask = this.tasks.get(taskIndex); + if (currentTask != null && !currentTask.onUpdateTask()) { + currentTask.onTaskEnd(); + this.tasks.remove(taskIndex); + } + } + } catch (final Exception e) { + MainBase.LOGGER.severe("Failed to execute AI tasks!"); + e.printStackTrace(); + } + } + + public void addTask(final Task task) { + task.taskManager = this; + task.world = this.tileEntity.getWorldObj(); + task.tileEntity = this.tileEntity; + this.tasks.add(task); + } + + public boolean hasTasks() { + return this.tasks.size() > 0; + } + + public List getTasks() { + return this.tasks; + } + + public void clear() { + this.tasks.clear(); + } + + public int getTaskCount() { + return this.tasks.size(); + } +} diff --git a/src/main/java/icbm/gangshao/task/TaskSearchTarget.java b/src/main/java/icbm/gangshao/task/TaskSearchTarget.java new file mode 100644 index 0000000..49da39e --- /dev/null +++ b/src/main/java/icbm/gangshao/task/TaskSearchTarget.java @@ -0,0 +1,66 @@ +package icbm.gangshao.task; + +import icbm.gangshao.IAutoSentry; +import icbm.gangshao.access.AccessLevel; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import universalelectricity.core.vector.Vector3; + +public class TaskSearchTarget extends Task { + @Override + protected boolean onUpdateTask() { + super.onUpdateTask(); + if (super.tileEntity instanceof IAutoSentry) { + final IAutoSentry sentry = super.tileEntity; + if (sentry.getTarget() == null || + !sentry.isValidTarget(sentry.getTarget())) { + final AxisAlignedBB bounds = sentry.getTargetingBox(); + final List entities = super.tileEntity.getWorldObj().getEntitiesWithinAABB(Entity.class, + bounds); + Entity currentTarget = null; + for (final Entity entity : entities) { + if (entity instanceof EntityPlayer) { + final EntityPlayer player = (EntityPlayer) entity; + final AccessLevel level = super.tileEntity.getPlatform().getUserAccess( + player.getDisplayName()); + if (level.ordinal() >= AccessLevel.USER.ordinal() && + player.getLastAttacker() != null && + sentry.isValidTarget((Entity) player.getLastAttacker()) && + !((Entity) player.getLastAttacker()).isDead) { + currentTarget = (Entity) player.getLastAttacker(); + break; + } + continue; + } + } + if (currentTarget == null) { + double smallestDis = sentry.getDetectRange(); + for (final Entity entity2 : entities) { + final double distance = super.tileEntity.getCenter().distanceTo(new Vector3(entity2)); + if (sentry.isValidTarget(entity2) && distance <= smallestDis) { + currentTarget = entity2; + smallestDis = distance; + } + } + } + if (currentTarget != null) { + super.tileEntity.cancelRotation(); + super.taskManager.addTask(new TaskKillTarget()); + sentry.setTarget(currentTarget); + return false; + } + if (super.tileEntity.lastRotateTick > super.world.rand.nextInt(30) + 10) { + super.tileEntity.rotateTo( + (float) (super.world.rand.nextInt(360) - 180), + (float) (super.world.rand.nextInt(30) - 10)); + } + return true; + } else { + super.taskManager.addTask(new TaskKillTarget()); + } + } + return false; + } +} diff --git a/src/main/java/icbm/gangshao/terminal/ITerminal.java b/src/main/java/icbm/gangshao/terminal/ITerminal.java new file mode 100644 index 0000000..c75b308 --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/ITerminal.java @@ -0,0 +1,11 @@ +package icbm.gangshao.terminal; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.shimian.IScroll; +import java.util.List; + +public interface ITerminal extends ISpecialAccess, IScroll { + List getTerminalOuput(); + + boolean addToConsole(final String p0); +} diff --git a/src/main/java/icbm/gangshao/terminal/TerminalCommand.java b/src/main/java/icbm/gangshao/terminal/TerminalCommand.java new file mode 100644 index 0000000..4bdccb1 --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/TerminalCommand.java @@ -0,0 +1,23 @@ +package icbm.gangshao.terminal; + +import icbm.gangshao.ISpecialAccess; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public abstract class TerminalCommand { + public abstract String getCommandPrefix(); + + public abstract boolean processCommand(final EntityPlayer p0, + final ITerminal p1, final String[] p2); + + public abstract boolean canPlayerUse(final EntityPlayer p0, + final ISpecialAccess p1); + + public abstract boolean showOnHelp(final EntityPlayer p0, + final ISpecialAccess p1); + + public abstract List getCmdUses(final EntityPlayer p0, + final ISpecialAccess p1); + + public abstract boolean canMachineUse(final ISpecialAccess p0); +} diff --git a/src/main/java/icbm/gangshao/terminal/TileEntityTerminal.java b/src/main/java/icbm/gangshao/terminal/TileEntityTerminal.java new file mode 100644 index 0000000..6613f47 --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/TileEntityTerminal.java @@ -0,0 +1,270 @@ +package icbm.gangshao.terminal; + +import calclavia.lib.TileEntityUniversalRunnable; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.access.UserAccess; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; + +public abstract class TileEntityTerminal + extends TileEntityUniversalRunnable implements ITerminal { + private final List terminalOutput; + private final List users; + public static final int SCROLL_SIZE = 15; + private int scroll; + public final Set playersUsing; + + public TileEntityTerminal() { + this.terminalOutput = new ArrayList<>(); + this.users = new ArrayList<>(); + this.scroll = 0; + this.playersUsing = new HashSet<>(); + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.worldObj.isRemote && super.ticks % 3L == 0L) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + + public abstract String getChannel(); + + @Override + public Packet getDescriptionPacket() { + final NBTTagCompound nbt = new NBTTagCompound(); + this.writeToNBT(nbt); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + public void sendTerminalOutputToClients() { + // TODO: WTF + // final List data = new ArrayList(); + // data.add(TerminalPacketType.TERMINAL_OUTPUT.ordinal()); + // data.add(this.getTerminalOuput().size()); + // data.addAll(this.getTerminalOuput()); + // final Packet packet = PacketManager.getPacket(this.getChannel(), this, + // data.toArray()); for (final EntityPlayer player : this.playersUsing) { + // PacketDispatcher.sendPacketToPlayer(packet, (Player) player); + // } + } + + // TODO: WTF + // public void sendCommandToServer(final EntityPlayer entityPlayer, + // final String cmdInput) { + // if (this.worldObj.isRemote) { + // final Packet packet = PacketManager.getPacket( + // this.getChannel(), this, + // TerminalPacketType.GUI_COMMAND.ordinal(), + // entityPlayer.getDisplayName(), cmdInput); + // PacketDispatcher.sendPacketToServer(packet); + // } + // } + + // TODO: WHAT THE ACTUAL FUCK! + // @Override + // public void handlePacketData(final INetworkManager network, + // final int packetID, + // final Packet250CustomPayload packet, + // final EntityPlayer player, + // final ByteArrayDataInput dataStream) { + // try { + // final TerminalPacketType packetType = + // TerminalPacketType.values()[dataStream.readInt()]; switch + // (packetType) { + // case DESCRIPTION_DATA: { + // if (this.worldObj.isRemote) { + // final short size = dataStream.readShort(); + // if (size > 0) { + // final byte[] byteCode = new byte[size]; + // dataStream.readFully(byteCode); + // this.func_70307_a(CompressedStreamTools.func_74792_a(byteCode)); + // } + // break; + // } + // break; + // } + // case GUI_COMMAND: { + // if (!this.field_70331_k.isRemote) { + // CommandRegistry.onCommand( + // this.field_70331_k.getPlayerEntityByName(dataStream.readUTF()), + // this, dataStream.readUTF()); + // this.sendTerminalOutputToClients(); + // break; + // } + // break; + // } + // case GUI_EVENT: { + // if (this.field_70331_k.isRemote) { + // break; + // } + // if (dataStream.readBoolean()) { + // this.playersUsing.add(player); + // this.sendTerminalOutputToClients(); + // break; + // } + // this.playersUsing.remove(player); + // break; + // } + // case TERMINAL_OUTPUT: { + // if (this.field_70331_k.isRemote) { + // final int size2 = dataStream.readInt(); + // final List oldTerminalOutput = new + // ArrayList(this.terminalOutput); + // this.terminalOutput.clear(); + // for (int i = 0; i < size2; ++i) { + // this.terminalOutput.add(dataStream.readUTF()); + // } + // if (!this.terminalOutput.equals(oldTerminalOutput) && + // this.terminalOutput.size() != + // oldTerminalOutput.size()) { + // this.setScroll(this.getTerminalOuput().size() - + // 15); + // } + // break; + // } + // break; + // } + // } + // } catch (final Exception e) { + // ZhuYaoBase.LOGGER.severe("Terminal error: " + this.toString()); + // e.printStackTrace(); + // } + // } + + @Override + public AccessLevel getUserAccess(final String username) { + for (int i = 0; i < this.users.size(); ++i) { + if (this.users.get(i).username.equalsIgnoreCase(username)) { + return this.users.get(i).level; + } + } + return AccessLevel.NONE; + } + + public boolean canUserAccess(final String username) { + return this.getUserAccess(username).ordinal() >= AccessLevel.USER.ordinal(); + } + + @Override + public List getUsers() { + return this.users; + } + + @Override + public List getUsersWithAcess(final AccessLevel level) { + final List players = new ArrayList<>(); + for (int i = 0; i < this.users.size(); ++i) { + final UserAccess ref = this.users.get(i); + if (ref.level == level) { + players.add(ref); + } + } + return players; + } + + @Override + public boolean addUserAccess(final String player, final AccessLevel lvl, + final boolean save) { + this.removeUserAccess(player); + final boolean bool = this.users.add(new UserAccess(player, lvl, save)); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return bool; + } + + @Override + public boolean removeUserAccess(final String player) { + final List removeList = new ArrayList<>(); + for (int i = 0; i < this.users.size(); ++i) { + final UserAccess ref = this.users.get(i); + if (ref.username.equalsIgnoreCase(player)) { + removeList.add(ref); + } + } + if (removeList != null && removeList.size() > 0) { + final boolean bool = this.users.removeAll(removeList); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return bool; + } + return false; + } + + @Override + public List getTerminalOuput() { + return this.terminalOutput; + } + + @Override + public boolean addToConsole(String msg) { + if (!this.worldObj.isRemote) { + msg.trim(); + if (msg.length() > 23) { + msg = msg.substring(0, 22); + } + this.getTerminalOuput().add(msg); + this.sendTerminalOutputToClients(); + return true; + } + return false; + } + + @Override + public void scroll(final int amount) { + this.setScroll(this.scroll + amount); + } + + @Override + public void setScroll(final int length) { + this.scroll = Math.max(Math.min(length, this.getTerminalOuput().size()), 0); + } + + @Override + public int getScroll() { + return this.scroll; + } + + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.users.clear(); + final NBTTagList userList = nbt.getTagList("Users", 10); + for (int i = 0; i < userList.tagCount(); ++i) { + final NBTTagCompound var4 = (NBTTagCompound) userList.getCompoundTagAt(i); + this.users.add(UserAccess.loadFromNBT(var4)); + } + } + + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + final NBTTagList usersTag = new NBTTagList(); + for (int player = 0; player < this.users.size(); ++player) { + final UserAccess access = this.users.get(player); + if (access != null && access.shouldSave) { + final NBTTagCompound accessData = new NBTTagCompound(); + access.writeToNBT(accessData); + usersTag.appendTag((NBTBase) accessData); + } + } + nbt.setTag("Users", (NBTBase) usersTag); + } + + public enum TerminalPacketType { + GUI_EVENT("GUI_EVENT", 0), + GUI_COMMAND("GUI_COMMAND", 1), + TERMINAL_OUTPUT("TERMINAL_OUTPUT", 2), + DESCRIPTION_DATA("DESCRIPTION_DATA", 3); + + private TerminalPacketType(final String name, final int ordinal) { + } + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandAccess.java b/src/main/java/icbm/gangshao/terminal/command/CommandAccess.java new file mode 100644 index 0000000..818086e --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandAccess.java @@ -0,0 +1,87 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandAccess extends TerminalCommand { + @Override + public String getCommandPrefix() { + return "access"; + } + + @Override + public boolean processCommand(final EntityPlayer player, + final ITerminal terminal, final String[] args) { + if (args[0].equalsIgnoreCase("access") && args.length > 1 && + args[1] != null && terminal instanceof TPlatform) { + final TPlatform platform = (TPlatform) terminal; + final AccessLevel userAccess = terminal.getUserAccess(player.getDisplayName()); + if (args[1].equalsIgnoreCase("?")) { + terminal.addToConsole( + "Access Level: " + + platform.getUserAccess(player.getDisplayName()).displayName); + return true; + } + if (args[1].equalsIgnoreCase("set") && args.length > 3 && + userAccess.ordinal() >= AccessLevel.ADMIN.ordinal()) { + final String username = args[2]; + final AccessLevel currentAccess = terminal.getUserAccess(username); + final AccessLevel playerAccess = terminal.getUserAccess(player.getDisplayName()); + if (playerAccess.ordinal() < AccessLevel.ADMIN.ordinal() || + playerAccess.ordinal() < currentAccess.ordinal() || + (player.getDisplayName().equalsIgnoreCase(username) && + playerAccess != AccessLevel.OWNER)) { + terminal.addToConsole("Access denied!"); + return true; + } + if (currentAccess != AccessLevel.NONE) { + final AccessLevel newAccess = AccessLevel.get(args[3]); + if ((currentAccess != AccessLevel.OWNER || + platform.getUsersWithAcess(AccessLevel.OWNER).size() > 1) && + newAccess != AccessLevel.NONE && + terminal.addUserAccess(username, newAccess, true)) { + terminal.addToConsole(username + " set to " + + newAccess.displayName); + platform.getWorldObj().markBlockForUpdate( + platform.xCoord, platform.yCoord, platform.zCoord); + return true; + } + } + } + } + return false; + } + + @Override + public boolean canPlayerUse(final EntityPlayer var1, + final ISpecialAccess mm) { + return mm.getUserAccess(var1.getDisplayName()).ordinal() >= AccessLevel.USER.ordinal() || + var1.capabilities.isCreativeMode; + } + + @Override + public boolean showOnHelp(final EntityPlayer player, + final ISpecialAccess mm) { + return this.canPlayerUse(player, mm); + } + + @Override + public List getCmdUses(final EntityPlayer player, + final ISpecialAccess mm) { + final List cmds = new ArrayList<>(); + cmds.add("access set username level"); + cmds.add("access ?"); + return cmds; + } + + @Override + public boolean canMachineUse(final ISpecialAccess mm) { + return mm instanceof TPlatform; + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandDestroy.java b/src/main/java/icbm/gangshao/terminal/command/CommandDestroy.java new file mode 100644 index 0000000..f508378 --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandDestroy.java @@ -0,0 +1,59 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandDestroy extends TerminalCommand { + @Override + public String getCommandPrefix() { + return "destroy"; + } + + @Override + public boolean processCommand(final EntityPlayer player, + final ITerminal terminal, final String[] args) { + if (!(terminal instanceof TPlatform)) { + return false; + } + final TPlatform turret = (TPlatform) terminal; + if (args.length > 1) { + turret.destroyTurret(); + terminal.addToConsole("Destroyed Turret"); + return true; + } + turret.destroy(false); + return true; + } + + @Override + public boolean canPlayerUse(final EntityPlayer var1, + final ISpecialAccess mm) { + return mm.getUserAccess(var1.getDisplayName()).ordinal() >= AccessLevel.ADMIN.ordinal(); + } + + @Override + public boolean showOnHelp(final EntityPlayer player, + final ISpecialAccess mm) { + return this.canPlayerUse(player, mm); + } + + @Override + public List getCmdUses(final EntityPlayer player, + final ISpecialAccess mm) { + final List cmds = new ArrayList<>(); + cmds.add("destroy"); + cmds.add("destroy turret"); + return cmds; + } + + @Override + public boolean canMachineUse(final ISpecialAccess mm) { + return mm instanceof TPlatform; + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandGet.java b/src/main/java/icbm/gangshao/terminal/command/CommandGet.java new file mode 100644 index 0000000..30d02f6 --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandGet.java @@ -0,0 +1,74 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.access.UserAccess; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandGet extends TerminalCommand { + @Override + public String getCommandPrefix() { + return "get"; + } + + @Override + public boolean processCommand(final EntityPlayer player, final ITerminal TE, + final String[] args) { + if (args[0].equalsIgnoreCase("get") && args.length > 1 && args[1] != null && + TE instanceof TPlatform) { + final TPlatform turret = (TPlatform) TE; + if (args[1].equalsIgnoreCase("owner")) { + final List userList = turret.getUsersWithAcess(AccessLevel.OWNER); + if (userList.size() > 0) { + for (final UserAccess access : userList) { + TE.addToConsole("" + access.username); + } + } else { + TE.addToConsole("No owners"); + } + return true; + } + if (args[1].equalsIgnoreCase("position")) { + TE.addToConsole("position: " + turret.xCoord + "x " + + turret.yCoord + "y " + turret.zCoord + + "z "); + return true; + } + if (args[1].equalsIgnoreCase("kills")) { + TE.addToConsole("Not yet useable"); + return true; + } + } + return false; + } + + @Override + public boolean canPlayerUse(final EntityPlayer var1, + final ISpecialAccess mm) { + return true; + } + + @Override + public boolean showOnHelp(final EntityPlayer player, + final ISpecialAccess mm) { + return true; + } + + @Override + public List getCmdUses(final EntityPlayer player, final ISpecialAccess mm) { + final List cmds = new ArrayList<>(); + cmds.add("get owner"); + cmds.add("get position"); + return cmds; + } + + @Override + public boolean canMachineUse(final ISpecialAccess mm) { + return mm instanceof TPlatform; + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandHelp.java b/src/main/java/icbm/gangshao/terminal/command/CommandHelp.java new file mode 100644 index 0000000..246a06f --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandHelp.java @@ -0,0 +1,77 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandHelp extends TerminalCommand { + @Override + public String getCommandPrefix() { + return "help"; + } + + @Override + public boolean processCommand(final EntityPlayer player, final ITerminal te, + final String[] args) { + if (args.length > 1) { + final List displayed = new ArrayList<>(); + for (final TerminalCommand cc : CommandRegistry.COMMANDS) { + if (cc.getCommandPrefix().equalsIgnoreCase(args[1]) && + cc.showOnHelp(player, te) && cc.canMachineUse(te)) { + te.addToConsole("----------------------"); + te.addToConsole(args[1] + " commands"); + te.addToConsole("----------------------"); + final List ccList = cc.getCmdUses(player, te); + for (final String cm : ccList) { + if (!displayed.contains(cm.toLowerCase())) { + te.addToConsole(cm); + displayed.add(cm.toLowerCase()); + } + } + te.addToConsole("----------------------"); + } + } + return true; + } + te.addToConsole("----------------------"); + te.addToConsole("Listing commands"); + te.addToConsole("----------------------"); + te.addToConsole("Help command"); + for (final TerminalCommand cc2 : CommandRegistry.COMMANDS) { + if (cc2.showOnHelp(player, te) && cc2.canMachineUse(te)) { + final List ccList2 = cc2.getCmdUses(player, te); + for (final String cm2 : ccList2) { + te.addToConsole(cm2); + } + } + } + te.addToConsole("-----------------------"); + return true; + } + + @Override + public boolean canPlayerUse(final EntityPlayer var1, + final ISpecialAccess mm) { + return true; + } + + @Override + public boolean showOnHelp(final EntityPlayer player, + final ISpecialAccess mm) { + return false; + } + + @Override + public List getCmdUses(final EntityPlayer player, + final ISpecialAccess mm) { + return null; + } + + @Override + public boolean canMachineUse(final ISpecialAccess mm) { + return true; + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandRegistry.java b/src/main/java/icbm/gangshao/terminal/command/CommandRegistry.java new file mode 100644 index 0000000..397f847 --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandRegistry.java @@ -0,0 +1,48 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandRegistry { + public static final List COMMANDS; + + public static void register(final TerminalCommand cmd) { + if (!CommandRegistry.COMMANDS.contains(cmd)) { + CommandRegistry.COMMANDS.add(cmd); + } + } + + public static void onCommand(final EntityPlayer player, + final ITerminal terminal, final String cmd) { + if (cmd != null && cmd != "") { + final String[] args = cmd.split(" "); + terminal.addToConsole("§A" + player.getDisplayName() + ": " + cmd); + if (args[0] != null) { + for (final TerminalCommand command : CommandRegistry.COMMANDS) { + if (command.getCommandPrefix().equalsIgnoreCase(args[0])) { + if (!command.canMachineUse(terminal)) { + terminal.addToConsole("N/A"); + return; + } + if (!command.canPlayerUse(player, terminal)) { + terminal.addToConsole("Access Denied."); + return; + } + if (command.processCommand(player, terminal, args)) { + return; + } + continue; + } + } + } + terminal.addToConsole("Unknown Command."); + } + } + + static { + COMMANDS = new ArrayList<>(); + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandTarget.java b/src/main/java/icbm/gangshao/terminal/command/CommandTarget.java new file mode 100644 index 0000000..4c55a5b --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandTarget.java @@ -0,0 +1,99 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import icbm.gangshao.turret.sentries.TAutomaticTurret; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandTarget extends TerminalCommand { + @Override + public String getCommandPrefix() { + return "target"; + } + + @Override + public boolean processCommand(final EntityPlayer player, + final ITerminal terminal, final String[] args) { + if (terminal instanceof TPlatform) { + final TPlatform turret = (TPlatform) terminal; + if (turret.getTurret(false) instanceof TAutomaticTurret) { + final TAutomaticTurret sentry = (TAutomaticTurret) turret.getTurret(false); + if (args.length > 1) { + final String obj = args[1]; + String bool = ""; + boolean change = false; + if (args.length > 2) { + bool = args[2]; + change = Boolean.getBoolean(bool); + } + if (obj.equalsIgnoreCase("player")) { + if (!bool.isEmpty()) { + sentry.targetPlayers = change; + } else { + sentry.targetPlayers = !sentry.targetPlayers; + } + return true; + } + if (obj.equalsIgnoreCase("hostile")) { + if (!bool.isEmpty()) { + sentry.targetHostile = change; + } else { + sentry.targetHostile = !sentry.targetHostile; + } + return true; + } + if (obj.equalsIgnoreCase("friendly")) { + if (!bool.isEmpty()) { + sentry.targetFriendly = change; + } else { + sentry.targetFriendly = !sentry.targetFriendly; + } + return true; + } + if (obj.equalsIgnoreCase("air")) { + if (!bool.isEmpty()) { + sentry.targetAir = change; + } else { + sentry.targetAir = !sentry.targetAir; + } + return true; + } + } + terminal.addToConsole("[player|hostile|friendly|air] [true|false]"); + return false; + } + } + return false; + } + + @Override + public boolean canPlayerUse(final EntityPlayer var1, + final ISpecialAccess mm) { + return mm.getUserAccess(var1.getDisplayName()).ordinal() >= AccessLevel.ADMIN.ordinal() || + var1.capabilities.isCreativeMode; + } + + @Override + public boolean showOnHelp(final EntityPlayer player, + final ISpecialAccess mm) { + return this.canPlayerUse(player, mm); + } + + @Override + public List getCmdUses(final EntityPlayer player, + final ISpecialAccess mm) { + final List cmds = new ArrayList<>(); + cmds.add("target [bool]"); + return cmds; + } + + @Override + public boolean canMachineUse(final ISpecialAccess mm) { + return mm instanceof TPlatform && ((TPlatform) mm).getTurret(false) instanceof TAutomaticTurret; + } +} diff --git a/src/main/java/icbm/gangshao/terminal/command/CommandUser.java b/src/main/java/icbm/gangshao/terminal/command/CommandUser.java new file mode 100644 index 0000000..92c3acb --- /dev/null +++ b/src/main/java/icbm/gangshao/terminal/command/CommandUser.java @@ -0,0 +1,89 @@ +package icbm.gangshao.terminal.command; + +import icbm.gangshao.ISpecialAccess; +import icbm.gangshao.access.AccessLevel; +import icbm.gangshao.terminal.ITerminal; +import icbm.gangshao.terminal.TerminalCommand; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandUser extends TerminalCommand { + @Override + public String getCommandPrefix() { + return "users"; + } + + @Override + public boolean processCommand(final EntityPlayer player, + final ITerminal terminal, final String[] args) { + if (!args[0].equalsIgnoreCase("users") || args.length <= 1 || + args[1] == null || !(terminal instanceof ISpecialAccess)) { + return false; + } + final ISpecialAccess turret = terminal; + if (args[1].equalsIgnoreCase("List")) { + terminal.addToConsole(""); + terminal.addToConsole("Listing Users"); + for (int i = 0; i < turret.getUsers().size(); ++i) { + terminal.addToConsole(" " + i + ") " + + turret.getUsers().get(i).username); + } + return true; + } + if (args[1].equalsIgnoreCase("remove") && args.length > 2) { + if (args[2] == null) { + terminal.addToConsole("Invalid username."); + return true; + } + if (turret.removeUserAccess(args[2])) { + terminal.addToConsole("Removed: " + args[2]); + return true; + } + terminal.addToConsole(" User not found."); + return true; + } else { + if (!args[1].equalsIgnoreCase("add") || args.length <= 2) { + return false; + } + if (args[2] == null) { + terminal.addToConsole("Invalid username."); + return true; + } + if (turret.addUserAccess(args[2], AccessLevel.USER, true)) { + terminal.addToConsole("Added: " + args[2]); + return true; + } + terminal.addToConsole("User already exists."); + return true; + } + } + + @Override + public boolean canPlayerUse(final EntityPlayer var1, + final ISpecialAccess mm) { + return mm.getUsers().size() <= 0 || + mm.getUserAccess(var1.getDisplayName()).ordinal() >= AccessLevel.ADMIN.ordinal(); + } + + @Override + public boolean showOnHelp(final EntityPlayer player, + final ISpecialAccess mm) { + return this.canPlayerUse(player, mm); + } + + @Override + public List getCmdUses(final EntityPlayer player, + final ISpecialAccess mm) { + final List cmds = new ArrayList<>(); + cmds.add("users list"); + cmds.add("users add [player]"); + cmds.add("users remove [player]"); + return cmds; + } + + @Override + public boolean canMachineUse(final ISpecialAccess mm) { + return mm instanceof ISpecialAccess; + } +} diff --git a/src/main/java/icbm/gangshao/turret/BlockTurret.java b/src/main/java/icbm/gangshao/turret/BlockTurret.java new file mode 100644 index 0000000..366ab10 --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/BlockTurret.java @@ -0,0 +1,229 @@ +package icbm.gangshao.turret; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.ICBMTab; +import icbm.core.di.BICBM; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.damage.EntityTileDamagable; +import icbm.gangshao.render.BlockRenderingHandler; +import icbm.gangshao.turret.mount.TRailgunTurret; +import icbm.gangshao.turret.sentries.TAATurret; +import icbm.gangshao.turret.sentries.TLaserTurret; +import icbm.gangshao.turret.sentries.TMachineGunTurret; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.UniversalElectricity; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.block.BlockAdvanced; +import universalelectricity.prefab.implement.IRedstoneReceptor; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.multiblock.IBlockActivate; +import universalelectricity.prefab.multiblock.IMultiBlock; + +public class BlockTurret extends BICBM { + public BlockTurret() { + super("turret", UniversalElectricity.machine); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + this.setHardness(100.0f); + this.setResistance(50.0f); + } + + @Override + public void setBlockBoundsBasedOnState(final IBlockAccess world, final int x, + final int y, final int z) { + final TileEntity ent = world.getTileEntity(x, y, z); + if (ent instanceof TTurretBase) { + final EntityTileDamagable dEnt = ((TTurretBase) ent).getDamageEntity(); + if (dEnt != null) { + this.setBlockBounds(0.2f, 0.0f, 0.2f, 0.8f, 0.4f, 0.8f); + } else { + this.setBlockBounds(0.2f, 0.0f, 0.2f, 0.8f, 0.8f, 0.8f); + } + } + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(final IIconRegister iconRegister) { + this.blockIcon = iconRegister.registerIcon("icbm:machine"); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, + final int z, + final EntityLivingBase par5EntityLiving, + final ItemStack itemStack) { + final int angle = MathHelper.floor_double( + ((Entity) par5EntityLiving).rotationYaw * 4.0f / 360.0f + 0.5) & + 0x3; + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity instanceof IRotatable) { + final IRotatable rotatableEntity = (IRotatable) tileEntity; + switch (angle) { + case 0: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(3)); + break; + } + case 1: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(4)); + break; + } + case 2: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(2)); + break; + } + case 3: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(5)); + break; + } + } + } + if (tileEntity instanceof IMultiBlock) { + ((IMultiBlock) tileEntity).onCreate(new Vector3(x, y, z)); + } + } + + @Override + public boolean onUseWrench(final World world, final int x, final int y, + final int z, final EntityPlayer entityPlayer, + final int side, final float hitX, final float hitY, + final float hitZ) { + final TileEntity ent = world.getTileEntity(x, y, z); + if (ent instanceof TTurretBase) { + final Random random = new Random(); + ((TTurretBase) ent).setHealth(5 + random.nextInt(7), true); + return true; + } + return false; + } + + @Override + public boolean onMachineActivated(final World world, final int x, final int y, final int z, + final EntityPlayer entityPlayer, final int side, + final float hitX, final float hitY, final float hitZ) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity instanceof IBlockActivate) { + return ((IBlockActivate) tileEntity).onActivated(entityPlayer); + } + final Block block = world.getBlock(x, y - 1, z); + return block instanceof BlockAdvanced && + ((BlockAdvanced) block) + .onMachineActivated(world, x, y - 1, z, entityPlayer, side, hitX, + hitY, hitZ); + } + + @Override + public void onNeighborBlockChange(final World world, final int x, final int y, + final int z, Block block) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity instanceof TTurretBase) { + if (this.canBlockStay(world, x, y, z)) { + if (tileEntity instanceof IRedstoneReceptor) { + if (world.isBlockIndirectlyGettingPowered(x, y, z)) { + ((IRedstoneReceptor) tileEntity).onPowerOn(); + } else { + ((IRedstoneReceptor) tileEntity).onPowerOff(); + } + } + } else if (tileEntity != null) { + ((TTurretBase) tileEntity).destroy(false); + } + } + } + + @Override + public void breakBlock(final World par1World, final int x, final int y, + final int z, final Block par5, final int par6) { + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + if (tileEntity instanceof IMultiBlock) { + ((IMultiBlock) tileEntity).onDestroy(tileEntity); + } + super.breakBlock(par1World, x, y, z, par5, par6); + } + + @Override + public TileEntity createNewTileEntity(final World world, final int meta) { + if (meta < TurretType.values().length) { + try { + return TurretType.values()[meta].tileEntity.newInstance(); + } catch (final Exception e) { + e.printStackTrace(); + } + } + return null; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public int damageDropped(final int metadata) { + return metadata; + } + + @Override + public boolean canPlaceBlockAt(final World world, final int x, final int y, + final int z) { + return super.canPlaceBlockAt(world, x, y, z) && + this.canBlockStay(world, x, y, z); + } + + @Override + public boolean canBlockStay(final World world, final int x, final int y, + final int z) { + return world.getBlock(x, y - 1, z) == ICBMSentry.blockPlatform; + } + + @Override + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, + final List list) { + for (int i = 0; i < TurretType.values().length; ++i) { + list.add(new ItemStack(par1, 1, i)); + } + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderType() { + return BlockRenderingHandler.ID; + } + + public enum TurretType { + GUN(TMachineGunTurret.class), + RAILGUN(TRailgunTurret.class), + AA(TAATurret.class), + LASER(TLaserTurret.class); + + public Class tileEntity; + + private TurretType(final Class tile) { + this.tileEntity = tile; + } + } +} diff --git a/src/main/java/icbm/gangshao/turret/ItemAmmo.java b/src/main/java/icbm/gangshao/turret/ItemAmmo.java new file mode 100644 index 0000000..979089f --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/ItemAmmo.java @@ -0,0 +1,113 @@ +package icbm.gangshao.turret; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.ItICBM; +import icbm.gangshao.IAmmunition; +import icbm.gangshao.ProjectileType; +import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ItemAmmo extends ItICBM implements IAmmunition { + public static final IIcon[] ICONS; + + public ItemAmmo() { + super("ammunition"); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public int getMetadata(final int damage) { + return damage; + } + + @Override + public String getUnlocalizedName(final ItemStack itemStack) { + return "item.icbm:" + AmmoType.values()[itemStack.getItemDamage()].iconName; + } + + @Override + public IIcon getIconFromDamage(final int i) { + return ItemAmmo.ICONS[i]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister iconRegister) { + for (int i = 0; i < AmmoType.values().length; ++i) { + ItemAmmo.ICONS[i] = iconRegister.registerIcon("icbm:" + AmmoType.values()[i].iconName); + } + } + + @Override + public ProjectileType getType(final ItemStack itemStack) { + if (itemStack.getItemDamage() < AmmoType.values().length) { + return AmmoType.values()[itemStack.getItemDamage()].type; + } + return null; + } + + @Override + public boolean canDrop(final int meta) { + return meta != AmmoType.BULLETINF.ordinal(); + } + + @Override + public ItemStack onDroppedIntoWorld(final ItemStack stack) { + return stack; + } + + @Override + public int getEntityLifespan(final ItemStack itemStack, final World world) { + if (itemStack != null && + itemStack.getItemDamage() == AmmoType.BULLETINF.ordinal()) { + return 40; + } + return super.getEntityLifespan(itemStack, world); + } + + @Override + public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < AmmoType.values().length; ++i) { + par3List.add(new ItemStack((Item) this, 1, i)); + } + } + + @Override + public int getDamage() { + return 8; + } + + static { + ICONS = new IIcon[AmmoType.values().length]; + } + + public enum AmmoType { + SHELL("SHELL", 0, "bulletShell", ProjectileType.UNKNOWN, true), + BULLET("BULLET", 1, "bullet", ProjectileType.CONVENTIONAL, true), + BULLETRAIL("BULLETRAIL", 2, "bulletRailgun", ProjectileType.RAILGUN, true), + BULLETANTI("BULLETANTI", 3, "bulletAntimatter", ProjectileType.RAILGUN, + true), + BULLETINF("BULLETINF", 4, "bulletInfinite", ProjectileType.CONVENTIONAL, + false); + + public String iconName; + public ProjectileType type; + public boolean consume; + + private AmmoType(final String name, final int ordinal, + final String iconName, final ProjectileType type, + final boolean consume) { + this.iconName = iconName; + this.type = type; + this.consume = consume; + } + } +} diff --git a/src/main/java/icbm/gangshao/turret/ItemBlockTurret.java b/src/main/java/icbm/gangshao/turret/ItemBlockTurret.java new file mode 100644 index 0000000..1053696 --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/ItemBlockTurret.java @@ -0,0 +1,21 @@ +package icbm.gangshao.turret; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockTurret extends ItemBlock { + public ItemBlockTurret(final Block par1) { + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getMetadata(final int par1) { + return par1; + } + + public String getUnlocalizedName(final ItemStack par1ItemStack) { + return this.getUnlocalizedName() + "." + par1ItemStack.getItemDamage(); + } +} diff --git a/src/main/java/icbm/gangshao/turret/TTurretBase.java b/src/main/java/icbm/gangshao/turret/TTurretBase.java new file mode 100644 index 0000000..3e31901 --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/TTurretBase.java @@ -0,0 +1,381 @@ +package icbm.gangshao.turret; + +import calclavia.lib.CalculationHelper; +import calclavia.lib.render.ITagRender; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.ISentry; +import icbm.gangshao.damage.EntityTileDamagable; +import icbm.gangshao.damage.IHealthTile; +import icbm.gangshao.packet.PacketTurret; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.task.LookHelper; +import java.util.HashMap; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.block.IVoltage; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.tile.TileEntityAdvanced; + +public abstract class TTurretBase extends TileEntityAdvanced + implements ITagRender, IVoltage, ISentry, IHealthTile { + public float maxPitch; + public float minPitch; + protected boolean allowFreePitch; + private ForgeDirection platformDirection; + public LookHelper lookHelper; + protected boolean speedUpRotation; + public int health; + public int baseFiringDelay; + public int tickSinceFired; + public int minFiringDelay; + private EntityTileDamagable damageEntity; + public float wantedRotationYaw; + public float wantedRotationPitch; + public float currentRotationYaw; + public float currentRotationPitch; + public int lastRotateTick; + + public TTurretBase() { + this.maxPitch = 35.0f; + this.minPitch = -35.0f; + this.allowFreePitch = false; + this.platformDirection = ForgeDirection.DOWN; + this.lookHelper = new LookHelper(this); + this.speedUpRotation = false; + this.health = -1; + this.baseFiringDelay = 10; + this.tickSinceFired = 0; + this.minFiringDelay = 5; + this.wantedRotationPitch = 0.0f; + this.currentRotationPitch = 0.0f; + this.lastRotateTick = 0; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (this.tickSinceFired > 0) { + --this.tickSinceFired; + } + if (!this.worldObj.isRemote && !this.isInvul() && + this.getDamageEntity() == null && this.getHealth() > 0) { + this.setDamageEntity(new EntityTileDamagable(this)); + this.worldObj.spawnEntityInWorld((Entity) this.getDamageEntity()); + } + this.updateRotation(); + } + + public void onTurretPacket(PacketTurret.Type type, NBTTagCompound data) { + if (type == PacketTurret.Type.ROTATION) { + this.setRotation(data.getFloat("yaw"), data.getFloat("pitch")); + } else if (type == PacketTurret.Type.STATS) { + this.health = data.getInteger("health"); + } + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.readFromNBT(nbt); + } + + public PacketTurret getStatsPacket() { + return PacketTurret.stats(new Vector3(this), this.health); + } + + public PacketTurret getRotationPacket() { + return PacketTurret.rotation(new Vector3(this), this.wantedRotationYaw, + this.wantedRotationPitch); + } + + @Override + public Packet getDescriptionPacket() { + final NBTTagCompound nbt = new NBTTagCompound(); + this.writeToNBT(nbt); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setFloat("yaw", this.wantedRotationYaw); + nbt.setFloat("pitch", this.wantedRotationPitch); + nbt.setFloat("cYaw", this.currentRotationYaw); + nbt.setFloat("cPitch", this.currentRotationPitch); + nbt.setInteger("dir", this.platformDirection.ordinal()); + nbt.setInteger("health", this.getHealth()); + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.wantedRotationYaw = nbt.getFloat("yaw"); + this.wantedRotationPitch = nbt.getFloat("pitch"); + this.currentRotationYaw = nbt.getFloat("cYaw"); + this.currentRotationPitch = nbt.getFloat("cPitch"); + this.platformDirection = ForgeDirection.getOrientation(nbt.getInteger("dir")); + if (nbt.hasKey("health")) { + this.health = nbt.getInteger("health"); + } + } + + public abstract double getFiringRequest(); + + public boolean isRunning() { + return this.getPlatform() != null && this.getPlatform().isRunning() && + this.isAlive(); + } + + public TPlatform getPlatform() { + final TileEntity tileEntity = this.worldObj.getTileEntity( + this.xCoord + this.platformDirection.offsetX, + this.yCoord + this.platformDirection.offsetY, + this.zCoord + this.platformDirection.offsetZ); + if (tileEntity instanceof TPlatform) { + return (TPlatform) tileEntity; + } + return null; + } + + public void destroy(final boolean doExplosion) { + if (doExplosion) { + if (!this.isInvalid()) { + this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord); + this.worldObj.createExplosion((Entity) this.getDamageEntity(), + (double) this.xCoord, (double) this.yCoord, + (double) this.zCoord, 2.0f, true); + } else { + this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord); + } + } else if (!this.worldObj.isRemote) { + this.getBlockType().dropBlockAsItem(this.worldObj, this.xCoord, + this.yCoord, this.zCoord, + this.getBlockMetadata(), 0); + this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord); + } + } + + public int getBarrels() { + return 1; + } + + public void setDeploySide(final ForgeDirection side) { + this.platformDirection = side.getOpposite(); + } + + @Override + public float addInformation(final HashMap map, final EntityPlayer player) { + map.put(this.getName(), 8978312); + return 1.0f; + } + + @Override + public String getName() { + return new ItemStack(this.getBlockType(), 1, this.getBlockMetadata()) + .getDisplayName() + + " " + this.getHealth() + "/" + this.getMaxHealth(); + } + + @Override + public Vector3 getMuzzle() { + return this.getCenter().add(Vector3.multiply( + CalculationHelper.getDeltaPositionFromRotation( + this.currentRotationYaw, this.currentRotationPitch), + 1.0)); + } + + @Override + public void onWeaponActivated() { + this.tickSinceFired += this.getFireDelay(); + } + + public int getFireDelay() { + return this.baseFiringDelay; + } + + public abstract int getMaxHealth(); + + public boolean isInvul() { + return false; + } + + @Override + public int getHealth() { + if (this.health == -1) { + this.health = this.getMaxHealth(); + } + return this.health; + } + + @Override + public void setHealth(int i, final boolean increase) { + if (increase) { + i += this.health; + } + this.health = Math.min(Math.max(i, 0), this.getMaxHealth()); + if (!this.worldObj.isRemote) { + ICBMSentry.channel.sendToAllAround( + this.getStatsPacket(), + new TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, + this.yCoord, this.zCoord, 100.0)); + } + } + + @Override + public boolean isAlive() { + return this.getHealth() > 0 || this.isInvul(); + } + + @Override + public boolean onDamageTaken(final DamageSource source, final int amount) { + if (this.isInvul()) { + return false; + } + if (source != null && source.equals(DamageSource.onFire)) { + return true; + } + this.health -= amount; + if (this.health <= 0) { + this.destroy(true); + } else { + ICBMSentry.channel.sendToAllAround( + this.getStatsPacket(), + new TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, + this.yCoord, this.zCoord, 100.0)); + } + return true; + } + + public EntityTileDamagable getDamageEntity() { + return this.damageEntity; + } + + public void setDamageEntity(final EntityTileDamagable damageEntity) { + this.damageEntity = damageEntity; + } + + public void updateRotation() { + final float yawDifference = Math.abs(LookHelper.getAngleDif( + this.currentRotationYaw, this.wantedRotationYaw)); + if (yawDifference > 0.001f) { + final float speedYaw = Math.min(this.getRotationSpeed(), yawDifference); + if (this.currentRotationYaw > this.wantedRotationYaw) { + this.currentRotationYaw -= speedYaw; + } else { + this.currentRotationYaw += speedYaw; + } + if (Math.abs(this.currentRotationYaw - this.wantedRotationYaw) <= speedYaw + 0.1) { + this.currentRotationYaw = this.wantedRotationYaw; + } + } + final float pitchDifference = Math.abs(LookHelper.getAngleDif( + this.currentRotationPitch, this.wantedRotationPitch)); + if (pitchDifference > 0.001f) { + final float speedPitch = Math.min(this.getRotationSpeed(), pitchDifference); + if (this.currentRotationPitch > this.wantedRotationPitch) { + this.currentRotationPitch -= speedPitch; + } else { + this.currentRotationPitch += speedPitch; + } + if (Math.abs(this.currentRotationPitch - this.wantedRotationPitch) <= speedPitch + 0.1) { + this.currentRotationPitch = this.wantedRotationPitch; + } + } + if (Math.abs(this.currentRotationPitch - this.wantedRotationPitch) <= 0.001f && + Math.abs(this.currentRotationYaw - this.wantedRotationYaw) <= 0.001f) { + ++this.lastRotateTick; + } + this.currentRotationPitch = MathHelper.wrapAngleTo180_float(this.currentRotationPitch); + this.wantedRotationYaw = MathHelper.wrapAngleTo180_float(this.wantedRotationYaw); + this.wantedRotationPitch = MathHelper.wrapAngleTo180_float(this.wantedRotationPitch); + } + + public float getRotationSpeed() { + return Float.MAX_VALUE; + } + + @Override + public void setRotation(final float yaw, final float pitch) { + this.wantedRotationYaw = MathHelper.wrapAngleTo180_float(yaw); + if (!this.allowFreePitch) { + this.wantedRotationPitch = Math.max( + Math.min(MathHelper.wrapAngleTo180_float(pitch), this.maxPitch), + this.minPitch); + } else { + this.wantedRotationPitch = MathHelper.wrapAngleTo180_float(pitch); + } + } + + public void rotateTo(final float wantedRotationYaw, + final float wantedRotationPitch) { + if (!this.worldObj.isRemote && this.lastRotateTick > 0 && + (this.wantedRotationYaw != wantedRotationYaw || + this.wantedRotationPitch != wantedRotationPitch)) { + this.setRotation(wantedRotationYaw, wantedRotationPitch); + this.lastRotateTick = 0; + if (!this.worldObj.isRemote) { + ICBMSentry.channel.sendToAllAround( + this.getRotationPacket(), + new TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, + this.yCoord, this.zCoord, 50.0)); + } + } + } + + public void cancelRotation() { + this.setRotation(this.currentRotationYaw, this.currentRotationPitch); + } + + public void drawParticleStreamTo(final Vector3 endPosition) { + if (this.worldObj.isRemote) { + final Vector3 startPosition = this.getMuzzle(); + final Vector3 direction = CalculationHelper.getDeltaPositionFromRotation( + this.currentRotationYaw, this.currentRotationPitch); + final double xoffset = 0.0; + final double yoffset = 0.0; + final double zoffset = 0.0; + Vector3 horzdir = direction.normalize(); + horzdir.y = 0.0; + horzdir = horzdir.normalize(); + for (double cx = startPosition.x + direction.x * xoffset - + direction.y * horzdir.x * yoffset - horzdir.z * zoffset, + cy = startPosition.y + direction.y * xoffset + + (1.0 - Math.abs(direction.y)) * yoffset, + cz = startPosition.z + direction.x * xoffset - + direction.y * horzdir.x * yoffset + horzdir.x * zoffset, + dx = endPosition.x - cx, dy = endPosition.y - cy, + dz = endPosition.z - cz, + ratio = Math.sqrt(dx * dx + dy * dy + dz * dz); Math.abs(cx - endPosition.x) > Math + .abs(dx / ratio); cx += dx * 0.1 / ratio, cy += dy * 0.1 / ratio, cz += dz * 0.1 / ratio) { + this.worldObj.spawnParticle("townaura", cx, cy, cz, 0.0, 0.0, 0.0); + } + } + } + + public abstract void renderShot(final Vector3 p0); + + public abstract void playFiringSound(); + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } + + public Vector3 getCenter() { + return new Vector3(this).add(0.5); + } +} diff --git a/src/main/java/icbm/gangshao/turret/mount/ESeat.java b/src/main/java/icbm/gangshao/turret/mount/ESeat.java new file mode 100644 index 0000000..ed51332 --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/mount/ESeat.java @@ -0,0 +1,108 @@ +package icbm.gangshao.turret.mount; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.core.MainBase; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ESeat extends Entity implements IEntityAdditionalSpawnData { + private TileEntity controller; + private boolean shouldSit; + + public ESeat(final World par1World) { + super(par1World); + this.shouldSit = false; + this.setSize(1.0f, 1.0f); + super.noClip = true; + } + + public ESeat(final World par1World, final Vector3 position, + final TileEntity controller, final boolean sit) { + this(par1World); + super.isImmuneToFire = true; + this.setPosition(position.x, position.y, position.z); + this.controller = controller; + this.shouldSit = sit; + } + + // TODO: WTF + // @Override + public String getEntityName() { + return "Seat"; + } + + @Override + public void writeSpawnData(final ByteBuf data) { + if (this.controller != null) { + data.writeInt(this.controller.xCoord); + data.writeInt(this.controller.yCoord); + data.writeInt(this.controller.zCoord); + } else { + MainBase.LOGGER.severe("Failed to send ridable turret packet!"); + } + data.writeBoolean(this.shouldSit); + } + + @Override + public void readSpawnData(final ByteBuf data) { + try { + this.controller = super.worldObj.getTileEntity( + data.readInt(), data.readInt(), data.readInt()); + this.shouldSit = data.readBoolean(); + } catch (final Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onUpdate() { + if (this.controller == null) { + this.setDead(); + return; + } + if (this.controller.isInvalid()) { + this.setDead(); + return; + } + if (this.controller instanceof TPaoTaiQi) { + ((TPaoTaiQi) this.controller).entityFake = this; + } + if (super.worldObj.isRemote && super.riddenByEntity != null) { + super.riddenByEntity.updateRiderPosition(); + } + super.posY = this.controller.yCoord + 1.2; + } + + @Override + public double getMountedYOffset() { + return -0.5; + } + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + public boolean shouldRiderSit() { + return this.shouldSit; + } + + @Override + protected void entityInit() { + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound nbt) { + this.shouldSit = nbt.getBoolean("shouldSit"); + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound nbt) { + nbt.setBoolean("shouldSit", this.shouldSit); + } +} diff --git a/src/main/java/icbm/gangshao/turret/mount/TPaoTaiQi.java b/src/main/java/icbm/gangshao/turret/mount/TPaoTaiQi.java new file mode 100644 index 0000000..999170c --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/mount/TPaoTaiQi.java @@ -0,0 +1,97 @@ +package icbm.gangshao.turret.mount; + +import calclavia.lib.CalculationHelper; +import icbm.gangshao.turret.TTurretBase; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MovingObjectPosition; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.multiblock.IMultiBlock; + +public abstract class TPaoTaiQi extends TTurretBase implements IMultiBlock { + protected ESeat entityFake; + + public TPaoTaiQi() { + this.entityFake = null; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (this.entityFake != null && this.entityFake.riddenByEntity instanceof EntityPlayer) { + final EntityPlayer mountedPlayer = (EntityPlayer) this.entityFake.riddenByEntity; + if (((Entity) mountedPlayer).rotationPitch > super.maxPitch) { + ((Entity) mountedPlayer).rotationPitch = super.maxPitch; + } + if (((Entity) mountedPlayer).rotationPitch < super.minPitch) { + ((Entity) mountedPlayer).rotationPitch = super.minPitch; + } + final float rotationPitch = ((Entity) mountedPlayer).rotationPitch; + super.wantedRotationPitch = rotationPitch; + super.currentRotationPitch = rotationPitch; + final float rotationYaw = ((Entity) mountedPlayer).rotationYaw; + super.wantedRotationYaw = rotationYaw; + super.currentRotationYaw = rotationYaw; + } + } + + public MovingObjectPosition rayTrace(final double distance) { + return CalculationHelper.doCustomRayTrace( + this.worldObj, this.getMuzzle(), super.wantedRotationYaw, + super.wantedRotationPitch, true, distance); + } + + @Override + public boolean onActivated(final EntityPlayer entityPlayer) { + if (entityPlayer.isSneaking()) { + this.tryActivateWeapon(); + } else { + if (this.entityFake != null) { + if (this.entityFake.riddenByEntity instanceof EntityPlayer) { + final EntityPlayer mountedPlayer = (EntityPlayer) this.entityFake.riddenByEntity; + if (entityPlayer == mountedPlayer) { + if (!this.worldObj.isRemote) { + // TODO: WTF + // PacketManager.sendPacketToClients(this.getRotationPacket()); + } + // TODO: WTF + // entityPlayer.unmountEntity((Entity) this.entityFake); + this.entityFake.setDead(); + this.entityFake = null; + return true; + } + } + return false; + } + this.mount(entityPlayer); + } + return true; + } + + public void mount(final EntityPlayer entityPlayer) { + if (!this.worldObj.isRemote) { + if (this.entityFake == null) { + this.entityFake = new ESeat(this.worldObj, + new Vector3(this.xCoord + 0.5, this.yCoord + 1.2, + this.zCoord + 0.5), + this, true); + this.worldObj.spawnEntityInWorld((Entity) this.entityFake); + } + ((Entity) entityPlayer).rotationYaw = super.currentRotationYaw; + ((Entity) entityPlayer).rotationPitch = super.currentRotationPitch; + entityPlayer.mountEntity((Entity) this.entityFake); + } + } + + public void tryActivateWeapon() { + if (this.canActivateWeapon()) { + this.onWeaponActivated(); + } + } + + @Override + public boolean canApplyPotion(final PotionEffect par1PotionEffect) { + return false; + } +} diff --git a/src/main/java/icbm/gangshao/turret/mount/TRailgunTurret.java b/src/main/java/icbm/gangshao/turret/mount/TRailgunTurret.java new file mode 100644 index 0000000..1448abe --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/mount/TRailgunTurret.java @@ -0,0 +1,224 @@ +package icbm.gangshao.turret.mount; + +import calclavia.lib.CalculationHelper; +import icbm.api.explosion.IExplosive; +import icbm.core.MainBase; +import icbm.gangshao.ProjectileType; +import icbm.gangshao.ICBMSentry; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.IBlockAccess; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRedstoneReceptor; +import universalelectricity.prefab.multiblock.IMultiBlock; +import universalelectricity.prefab.multiblock.TileEntityMulti; + +public class TRailgunTurret extends TPaoTaiQi implements IRedstoneReceptor { + private int gunChargingTicks; + private boolean redstonePowerOn; + private boolean isAntimatter; + private float explosionSize; + private int explosionDepth; + private int endTicks; + + public TRailgunTurret() { + this.gunChargingTicks = 0; + this.redstonePowerOn = false; + this.endTicks = 0; + super.baseFiringDelay = 80; + super.minFiringDelay = 50; + super.maxPitch = 60.0f; + super.minPitch = -60.0f; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (this.getPlatform() != null) { + if (this.redstonePowerOn) { + this.tryActivateWeapon(); + } + if (this.gunChargingTicks > 0) { + ++this.gunChargingTicks; + if (this.gunChargingTicks >= this.getFireDelay()) { + this.onFire(); + this.gunChargingTicks = 0; + } + } + if (this.worldObj.isRemote && this.endTicks-- > 0) { + final MovingObjectPosition objectMouseOver = this.rayTrace(2000.0); + if (objectMouseOver != null && objectMouseOver.hitVec != null) { + this.drawParticleStreamTo(new Vector3(objectMouseOver.hitVec)); + } + } + } + } + + @Override + public void tryActivateWeapon() { + if (this.canActivateWeapon() && this.gunChargingTicks == 0) { + this.onWeaponActivated(); + } + } + + public void onFire() { + if (!this.worldObj.isRemote) { + while (this.explosionDepth > 0) { + final MovingObjectPosition objectMouseOver = this.rayTrace(2000.0); + if (objectMouseOver != null && + !ICBMSentry.isProtected(this.worldObj, + new Vector3(objectMouseOver), + ICBMSentry.FLAG_RAILGUN)) { + if (this.isAntimatter) { + final int radius = 50; + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + (double) (objectMouseOver.blockX - radius), + (double) (objectMouseOver.blockY - radius), + (double) (objectMouseOver.blockZ - radius), + (double) (objectMouseOver.blockX + radius), + (double) (objectMouseOver.blockY + radius), + (double) (objectMouseOver.blockZ + radius)); + final List missilesNearby = this.worldObj.getEntitiesWithinAABB(Entity.class, bounds); + for (final Entity entity : missilesNearby) { + if (entity instanceof IExplosive) { + entity.setDead(); + } + } + } + final Vector3 blockPosition = new Vector3(objectMouseOver.hitVec); + final Block block = blockPosition.getBlock((IBlockAccess) this.worldObj); + if (block != null && + block.getBlockHardness(this.worldObj, blockPosition.intX(), + blockPosition.intY(), + blockPosition.intZ()) != -1.0f) { + this.worldObj.setBlock(objectMouseOver.blockX, + objectMouseOver.blockY, + objectMouseOver.blockZ, Blocks.air, 0, 2); + } + final Entity responsibleEntity = (super.entityFake != null) + ? super.entityFake.riddenByEntity + : null; + this.worldObj.newExplosion(responsibleEntity, blockPosition.x, + blockPosition.y, blockPosition.z, + this.explosionSize, true, true); + } + --this.explosionDepth; + } + } + } + + @Override + public void renderShot(final Vector3 target) { + this.endTicks = 20; + } + + @Override + public void playFiringSound() { + this.worldObj.playSoundEffect((double) this.xCoord, (double) this.yCoord, + (double) this.zCoord, "icbm.railgun", 5.0f, + 1.0f); + } + + @Override + public double getVoltage() { + return 220.0; + } + + @Override + public void onDestroy(final TileEntity callingBlock) { + this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord); + this.worldObj.setBlockToAir(this.xCoord, this.yCoord + 1, this.zCoord); + } + + @Override + public void onCreate(final Vector3 position) { + this.worldObj.setBlock(position.intX(), position.intY() + 1, + position.intZ(), + MainBase.bJia, 0, 2); + ((TileEntityMulti) this.worldObj.getTileEntity( + position.intX(), position.intY() + 1, position.intZ())) + .setMainBlock(position); + } + + @Override + public Vector3 getCenter() { + return new Vector3(this).add(new Vector3(0.5, 1.5, 0.5)); + } + + @Override + public Vector3 getMuzzle() { + return this.getCenter().add(Vector3.multiply( + CalculationHelper.getDeltaPositionFromRotation( + super.currentRotationYaw, super.currentRotationPitch), + 1.6)); + } + + @Override + public void onPowerOn() { + this.redstonePowerOn = true; + } + + @Override + public void onPowerOff() { + this.redstonePowerOn = false; + } + + @Override + public double getFiringRequest() { + return 1000000.0; + } + + @Override + public void onWeaponActivated() { + super.onWeaponActivated(); + this.gunChargingTicks = 1; + this.redstonePowerOn = false; + this.isAntimatter = false; + final ItemStack ammoStack = this.getPlatform().hasAmmunition(ProjectileType.RAILGUN); + if (ammoStack != null) { + if (ammoStack.equals(ICBMSentry.antimatterBullet) && + this.getPlatform().useAmmunition(ammoStack)) { + this.isAntimatter = true; + } else { + this.getPlatform().useAmmunition(ammoStack); + } + } + this.getPlatform().wattsReceived = 0.0; + this.explosionSize = 5.0f; + this.explosionDepth = 5; + if (this.isAntimatter) { + this.explosionSize = 8.0f; + this.explosionDepth = 10; + } + this.worldObj.playSoundEffect( + (double) this.xCoord, (double) this.yCoord, + (double) this.zCoord, "icbm.railgun", 5.0f, 1.0f); + } + + @Override + public boolean canActivateWeapon() { + return this.getPlatform() != null && + this.getPlatform().hasAmmunition(ProjectileType.RAILGUN) != null && + this.getPlatform().wattsReceived >= this.getFiringRequest(); + } + + @Override + public float addInformation(final HashMap map, final EntityPlayer player) { + super.addInformation(map, player); + return 2.0f; + } + + @Override + public int getMaxHealth() { + return 450; + } +} diff --git a/src/main/java/icbm/gangshao/turret/sentries/TAATurret.java b/src/main/java/icbm/gangshao/turret/sentries/TAATurret.java new file mode 100644 index 0000000..28a5fcb --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/sentries/TAATurret.java @@ -0,0 +1,89 @@ +package icbm.gangshao.turret.sentries; + +import calclavia.lib.CalculationHelper; +import icbm.gangshao.ICBMSentry; +import net.minecraft.util.AxisAlignedBB; +import universalelectricity.core.vector.Vector3; + +public class TAATurret extends TAutomaticTurret { + public TAATurret() { + super.targetAir = true; + super.canTargetAir = true; + super.baseTargetRange = 80; + super.maxTargetRange = 120; + super.rotationSpeed = 9.0f; + super.minFiringDelay = 8; + super.baseFiringDelay = 15; + super.minPitch = 40.0f; + super.maxPitch = 90.0f; + super.allowFreePitch = true; + } + + @Override + public AxisAlignedBB getTargetingBox() { + return AxisAlignedBB.getBoundingBox(this.xCoord - this.getDetectRange(), + this.yCoord - this.getDetectRange(), + this.zCoord - this.getDetectRange(), + this.xCoord + this.getDetectRange(), + this.yCoord + this.getDetectRange(), + this.zCoord + this.getDetectRange()); + } + + @Override + public double getVoltage() { + return 240.0; + } + + @Override + public double getFiringRequest() { + return 8000.0; + } + + @Override + public int getMaxHealth() { + return 180; + } + + @Override + public void playFiringSound() { + this.worldObj.playSoundEffect((double) this.xCoord, (double) this.yCoord, + (double) this.zCoord, "icbm.aagun", 5.0f, + 1.0f); + } + + @Override + public void renderShot(final Vector3 target) { + final Vector3 center = this.getCenter(); + ICBMSentry.proxy.renderBeam( + this.worldObj, + Vector3.add(center, CalculationHelper + .getDeltaPositionFromRotation( + super.currentRotationYaw - 25.0f, + super.currentRotationPitch * 1.4f) + .multiply(1.15)), + target, 1.0f, 1.0f, 1.0f, 5); + ICBMSentry.proxy.renderBeam( + this.worldObj, + Vector3.add(center, CalculationHelper + .getDeltaPositionFromRotation( + super.currentRotationYaw + 25.0f, + super.currentRotationPitch * 1.4f) + .multiply(1.15)), + target, 1.0f, 1.0f, 1.0f, 5); + } + + @Override + public Vector3 getCenter() { + return new Vector3(this).add(new Vector3(0.5, 0.75, 0.5)); + } + + @Override + public Vector3 getMuzzle() { + return new Vector3(this) + .add(new Vector3(0.5, 0.75, 0.5)) + .add(CalculationHelper + .getDeltaPositionFromRotation(super.currentRotationYaw, + super.currentRotationPitch) + .multiply(1.0)); + } +} diff --git a/src/main/java/icbm/gangshao/turret/sentries/TAutomaticTurret.java b/src/main/java/icbm/gangshao/turret/sentries/TAutomaticTurret.java new file mode 100644 index 0000000..8ddd465 --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/sentries/TAutomaticTurret.java @@ -0,0 +1,296 @@ +package icbm.gangshao.turret.sentries; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import icbm.api.sentry.IAATarget; +import icbm.gangshao.IAmmunition; +import icbm.gangshao.IAutoSentry; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.ProjectileType; +import icbm.gangshao.damage.TileDamageSource; +import icbm.gangshao.packet.PacketTurret; +import icbm.gangshao.packet.PacketTurret.Type; +import icbm.gangshao.platform.TPlatform; +import icbm.gangshao.task.TaskManager; +import icbm.gangshao.task.TaskSearchTarget; +import icbm.gangshao.turret.TTurretBase; +import icbm.gangshao.turret.upgrades.ItPaoTaiUpgrades; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityFlying; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.INpc; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.IAnimals; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import universalelectricity.core.vector.Vector3; + +public abstract class TAutomaticTurret + extends TTurretBase implements IAutoSentry { + public Entity target; + public boolean targetPlayers; + public boolean targetAir; + public boolean targetHostile; + public boolean targetFriendly; + public boolean canTargetAir; + public final TaskManager taskManager; + public int baseTargetRange; + public int maxTargetRange; + public float rotationSpeed; + public ProjectileType projectileType; + + public TAutomaticTurret() { + this.targetPlayers = false; + this.targetAir = false; + this.targetHostile = false; + this.targetFriendly = false; + this.canTargetAir = false; + this.taskManager = new TaskManager(this); + this.baseTargetRange = 20; + this.maxTargetRange = 90; + this.rotationSpeed = 3.0f; + this.projectileType = ProjectileType.CONVENTIONAL; + } + + @Override + public void onTurretPacket(Type type, NBTTagCompound data) { + super.onTurretPacket(type, data); + if (type == PacketTurret.Type.SHOT) { + Vector3 target = Vector3.readFromNBT(data.getCompoundTag("target")); + + this.renderShot(target); + + super.currentRotationYaw = data.getFloat("yaw"); + super.currentRotationPitch = data.getFloat("pitch"); + + this.playFiringSound(); + } + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.worldObj.isRemote && this.isRunning()) { + this.taskManager.onUpdate(); + if (!this.taskManager.hasTasks()) { + this.taskManager.addTask(new TaskSearchTarget()); + } + } + } + + @Override + public float getRotationSpeed() { + return this.rotationSpeed; + } + + @Override + public AxisAlignedBB getTargetingBox() { + return AxisAlignedBB.getBoundingBox( + this.xCoord - this.getDetectRange(), (double) (this.yCoord - 5), + this.zCoord - this.getDetectRange(), + this.xCoord + this.getDetectRange(), (double) (this.yCoord + 5), + this.zCoord + this.getDetectRange()); + } + + @Override + public Entity getTarget() { + return this.target; + } + + @Override + public void setTarget(final Entity target) { + this.target = target; + } + + @Override + public boolean isValidTarget(final Entity entity) { + if (entity != null && !entity.isDead && !entity.isEntityInvulnerable() && + this.getCenter().distanceTo(new Vector3(entity)) <= this.getDetectRange()) { + final float[] rotations = super.lookHelper.getDeltaRotations(new Vector3(entity).add( + new Vector3(0.0, entity.getEyeHeight(), 0.0))); + if (((rotations[1] <= super.maxPitch && rotations[1] >= super.minPitch) || + super.allowFreePitch) && + super.lookHelper.canEntityBeSeen(entity)) { + if (this.targetAir && this.canTargetAir && this.isAir(entity)) { + return true; + } + if (this.targetPlayers && + (entity instanceof EntityPlayer || entity.riddenByEntity instanceof EntityPlayer)) { + EntityPlayer player; + if (entity.riddenByEntity instanceof EntityPlayer) { + player = (EntityPlayer) entity.riddenByEntity; + } else { + player = (EntityPlayer) entity; + } + if (!player.capabilities.isCreativeMode && + this.getPlatform() != null && + !this.getPlatform().canUserAccess(player.getDisplayName())) { + return true; + } + } + if (this.targetHostile && entity instanceof IMob && + !this.isAir(entity)) { + return true; + } + if (this.targetFriendly && + (entity instanceof IAnimals || entity instanceof INpc || + entity instanceof IMerchant) + && + !this.isAir(entity)) { + return true; + } + } + } + return false; + } + + protected boolean isAir(final Entity entity) { + return (entity instanceof IMob && entity instanceof EntityFlying) || + (entity instanceof IAATarget && + ((IAATarget) entity).canBeTargeted(this)) + || + entity instanceof EntityWither || entity instanceof EntityDragon; + } + + @Override + public boolean canActivateWeapon() { + return this.isValidTarget(this.target) && this.getPlatform() != null && + super.lookHelper.isLookingAt(this.target, 5.0f) && + super.tickSinceFired == 0 && + this.getPlatform().wattsReceived >= this.getFiringRequest() && + (this.getPlatform().hasAmmunition(this.projectileType) != null || + this.projectileType == ProjectileType.UNKNOWN); + } + + public void sendShotToClient(final Vector3 position) { + ICBMSentry.channel.sendToAllAround( + PacketTurret.shot(new Vector3(this), position, super.currentRotationYaw, + super.currentRotationPitch), + new TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, + this.yCoord, this.zCoord, 40.0)); + } + + @Override + public void onWeaponActivated() { + super.onWeaponActivated(); + if (!this.worldObj.isRemote && this.onFire()) { + this.sendShotToClient(this.getTargetPosition()); + this.playFiringSound(); + this.getPlatform().wattsReceived = Math.max( + this.getPlatform().wattsReceived - this.getFiringRequest(), 0.0); + } + } + + @Override + public void renderShot(final Vector3 target) { + this.drawParticleStreamTo(target); + } + + protected boolean onFire() { + if (!this.worldObj.isRemote) { + final ItemStack ammoStack = this.getPlatform().hasAmmunition(this.projectileType); + if (this.getPlatform() != null && ammoStack != null) { + boolean fired = false; + final IAmmunition bullet = (IAmmunition) ammoStack.getItem(); + if (this.target instanceof EntityLiving) { + final TPlatform platform = this.getPlatform(); + platform.wattsReceived -= this.getFiringRequest(); + if (bullet.getType(ammoStack) == ProjectileType.CONVENTIONAL) { + this.target.attackEntityFrom( + (DamageSource) TileDamageSource.doBulletDamage(this), + bullet.getDamage()); + } + fired = true; + } else if (this.target instanceof IAATarget) { + if (this.worldObj.rand.nextFloat() > 0.2) { + final int damage = ((IAATarget) this.target).doDamage(8); + if (damage == -1 && this.worldObj.rand.nextFloat() > 0.7) { + ((IAATarget) this.target).destroyCraft(); + } else if (damage <= 0) { + ((IAATarget) this.target).destroyCraft(); + } + } + fired = true; + } + if (fired && this.projectileType != ProjectileType.UNKNOWN && + this.getPlatform().useAmmunition(ammoStack)) { + boolean drop = true; + if (this.getPlatform().getUpgradeCount( + ItPaoTaiUpgrades.TurretUpgradeType.COLLECTOR) > 0 && + this.getPlatform().addStackToInventory( + ICBMSentry.bulletShell.copy())) { + drop = false; + } + if (drop && this.worldObj.rand.nextFloat() < 0.9) { + final Vector3 spawnPos = this.getMuzzle(); + final EntityItem entityShell = new EntityItem(this.worldObj, spawnPos.x, spawnPos.y, + spawnPos.z, ICBMSentry.bulletShell.copy()); + entityShell.delayBeforeCanPickup = 20; + this.worldObj.spawnEntityInWorld((Entity) entityShell); + } + } + return fired; + } + } + return false; + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setBoolean("targetPlayers", this.targetPlayers); + nbt.setBoolean("targetAir", this.targetAir); + nbt.setBoolean("targetHostile", this.targetHostile); + nbt.setBoolean("targetFriendly", this.targetFriendly); + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + if (nbt.hasKey("targetPlayers")) { + this.targetPlayers = nbt.getBoolean("targetPlayers"); + } + if (nbt.hasKey("targetAir")) { + this.targetAir = nbt.getBoolean("targetAir"); + } + if (nbt.hasKey("targetHostile")) { + this.targetHostile = nbt.getBoolean("targetHostile"); + } + if (nbt.hasKey("targetFriendly")) { + this.targetFriendly = nbt.getBoolean("targetFriendly"); + } + } + + @Override + public double getDetectRange() { + if (this.getPlatform() != null) { + return Math.min(this.baseTargetRange + + (this.maxTargetRange - this.baseTargetRange) * + (this.getPlatform().getUpgradeCount( + ItPaoTaiUpgrades.TurretUpgradeType.RANGE) / + 64.0f), + (float) this.maxTargetRange); + } + return this.baseTargetRange; + } + + @Override + public boolean canApplyPotion(final PotionEffect par1PotionEffect) { + return false; + } + + public Vector3 getTargetPosition() { + if (this.getTarget() != null) { + return new Vector3(this.getTarget()) + .add(new Vector3(0.0, this.getTarget().getEyeHeight(), 0.0)); + } + return null; + } +} diff --git a/src/main/java/icbm/gangshao/turret/sentries/TLaserTurret.java b/src/main/java/icbm/gangshao/turret/sentries/TLaserTurret.java new file mode 100644 index 0000000..cb81d9b --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/sentries/TLaserTurret.java @@ -0,0 +1,108 @@ +package icbm.gangshao.turret.sentries; + +import calclavia.lib.CalculationHelper; +import icbm.api.sentry.IAATarget; +import icbm.gangshao.ProjectileType; +import icbm.gangshao.ICBMSentry; +import icbm.gangshao.damage.TileDamageSource; +import icbm.gangshao.platform.TPlatform; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import universalelectricity.core.vector.Vector3; + +public class TLaserTurret extends TAutomaticTurret { + public float barrelRotation; + public float barrelRotationVelocity; + + public TLaserTurret() { + super.targetPlayers = true; + super.targetHostile = true; + super.baseTargetRange = 20; + super.maxTargetRange = 35; + super.rotationSpeed = 3.0f; + super.baseFiringDelay = 12; + super.minFiringDelay = 5; + super.projectileType = ProjectileType.UNKNOWN; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (this.worldObj.isRemote) { + this.barrelRotation = MathHelper.wrapAngleTo180_float( + this.barrelRotation + this.barrelRotationVelocity); + this.barrelRotationVelocity = Math.max(this.barrelRotationVelocity - 0.1f, 0.0f); + } + } + + @Override + public double getFiringRequest() { + return 20000.0; + } + + @Override + public double getVoltage() { + return 480.0; + } + + @Override + public int getMaxHealth() { + return 130; + } + + @Override + public void playFiringSound() { + this.worldObj.playSoundEffect((double) this.xCoord, (double) this.yCoord, + (double) this.zCoord, "icbm.lasershot", 5.0f, + 1.0f - this.worldObj.rand.nextFloat() * 0.2f); + } + + @Override + public void renderShot(final Vector3 target) { + final Vector3 center = this.getCenter(); + ICBMSentry.proxy.renderBeam( + this.worldObj, + Vector3.add(center, CalculationHelper + .getDeltaPositionFromRotation( + super.currentRotationYaw - 6.0f, + super.currentRotationPitch * 1.4f) + .multiply(1.2)), + target, 1.0f, 0.4f, 0.4f, 5); + ICBMSentry.proxy.renderBeam( + this.worldObj, + Vector3.add(center, CalculationHelper + .getDeltaPositionFromRotation( + super.currentRotationYaw + 6.0f, + super.currentRotationPitch * 1.4f) + .multiply(1.2)), + target, 1.0f, 0.4f, 0.4f, 5); + ++this.barrelRotationVelocity; + } + + @Override + protected boolean onFire() { + if (!this.worldObj.isRemote && this.getPlatform() != null) { + if (super.target instanceof EntityLiving) { + final TPlatform platform = this.getPlatform(); + platform.wattsReceived -= this.getFiringRequest(); + super.target.attackEntityFrom( + (DamageSource) TileDamageSource.doLaserDamage(this), 2); + super.target.setFire(3); + return true; + } + if (super.target instanceof IAATarget) { + if (this.worldObj.rand.nextFloat() > 0.2) { + final int damage = ((IAATarget) super.target).doDamage(10); + if (damage == -1 && this.worldObj.rand.nextFloat() > 0.7) { + ((IAATarget) super.target).destroyCraft(); + } else if (damage <= 0) { + ((IAATarget) super.target).destroyCraft(); + } + } + return true; + } + } + return false; + } +} diff --git a/src/main/java/icbm/gangshao/turret/sentries/TMachineGunTurret.java b/src/main/java/icbm/gangshao/turret/sentries/TMachineGunTurret.java new file mode 100644 index 0000000..97ba930 --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/sentries/TMachineGunTurret.java @@ -0,0 +1,51 @@ +package icbm.gangshao.turret.sentries; + +import calclavia.lib.CalculationHelper; +import universalelectricity.core.vector.Vector3; + +public class TMachineGunTurret extends TAutomaticTurret { + public TMachineGunTurret() { + super.targetPlayers = true; + super.targetHostile = true; + super.baseTargetRange = 13; + super.maxTargetRange = 25; + super.rotationSpeed = 2.0f; + super.baseFiringDelay = 18; + super.minFiringDelay = 10; + } + + @Override + public double getVoltage() { + return 240.0; + } + + @Override + public int getMaxHealth() { + return 200; + } + + @Override + public double getFiringRequest() { + return 1000.0; + } + + @Override + public void playFiringSound() { + this.worldObj.playSoundEffect((double) this.xCoord, (double) this.yCoord, + (double) this.zCoord, "icbm.machinegun", 5.0f, + 1.0f); + } + + @Override + public Vector3 getMuzzle() { + return this.getCenter().add(Vector3.multiply( + CalculationHelper.getDeltaPositionFromRotation( + super.currentRotationYaw, super.currentRotationPitch), + 1.0)); + } + + @Override + public Vector3 getCenter() { + return new Vector3(this).add(new Vector3(0.5, 0.65, 0.5)); + } +} diff --git a/src/main/java/icbm/gangshao/turret/upgrades/ItPaoTaiUpgrades.java b/src/main/java/icbm/gangshao/turret/upgrades/ItPaoTaiUpgrades.java new file mode 100644 index 0000000..8e6d1bb --- /dev/null +++ b/src/main/java/icbm/gangshao/turret/upgrades/ItPaoTaiUpgrades.java @@ -0,0 +1,76 @@ +package icbm.gangshao.turret.upgrades; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.ItICBM; +import icbm.gangshao.ITurretUpgrade; +import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItPaoTaiUpgrades extends ItICBM implements ITurretUpgrade { + public static final IIcon[] ICONS; + + public ItPaoTaiUpgrades() { + super("turretUpgrades"); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public int getMetadata(final int damage) { + return damage; + } + + @Override + public String getUnlocalizedName(final ItemStack itemStack) { + return "item.icbm:" + + TurretUpgradeType.values()[itemStack.getItemDamage()].iconName; + } + + @Override + public IIcon getIconFromDamage(final int i) { + return ItPaoTaiUpgrades.ICONS[i]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister iconRegister) { + for (int i = 0; i < TurretUpgradeType.values().length; ++i) { + ItPaoTaiUpgrades.ICONS[i] = iconRegister.registerIcon( + "icbm:" + TurretUpgradeType.values()[i].iconName); + } + } + + @Override + public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < TurretUpgradeType.values().length; ++i) { + par3List.add(new ItemStack((Item) this, 1, i)); + } + } + + @Override + public TurretUpgradeType getType(final ItemStack itemstack) { + return TurretUpgradeType.values()[itemstack.getItemDamage()]; + } + + static { + ICONS = new IIcon[TurretUpgradeType.values().length]; + } + + public enum TurretUpgradeType { + RANGE("RANGE", 0, "targetCard"), + COLLECTOR("COLLECTOR", 1, "shellCollector"); + + String iconName; + + private TurretUpgradeType(final String name2, final int ordinal, + final String name) { + this.iconName = name; + } + } +} diff --git a/src/main/java/icbm/wanyi/ClientProxy.java b/src/main/java/icbm/wanyi/ClientProxy.java new file mode 100644 index 0000000..8257992 --- /dev/null +++ b/src/main/java/icbm/wanyi/ClientProxy.java @@ -0,0 +1,37 @@ +package icbm.wanyi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.wanyi.b.TProximityDetector; +import icbm.wanyi.gui.GSignalDisrupter; +import icbm.wanyi.gui.GProximityDetector; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +@SideOnly(Side.CLIENT) +public class ClientProxy extends CommonProxy { + @Override + public void preInit() { + super.preInit(); + } + + @Override + public Object getClientGuiElement(final int ID, + final EntityPlayer entityPlayer, + final World world, final int x, final int y, + final int z) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null || ID == 5) { + switch (ID) { + case 4: { + return new GProximityDetector((TProximityDetector)tileEntity); + } + case 5: { + return new GSignalDisrupter(entityPlayer.inventory.getCurrentItem()); + } + } + } + return null; + } +} diff --git a/src/main/java/icbm/wanyi/CommonProxy.java b/src/main/java/icbm/wanyi/CommonProxy.java new file mode 100644 index 0000000..0884b20 --- /dev/null +++ b/src/main/java/icbm/wanyi/CommonProxy.java @@ -0,0 +1,31 @@ +// +// Decompiled by Procyon v0.6.0 +// + +package icbm.wanyi; + +import net.minecraft.world.World; +import net.minecraft.entity.player.EntityPlayer; +import icbm.wanyi.b.TProximityDetector; +import cpw.mods.fml.common.registry.GameRegistry; +import icbm.wanyi.b.TCamouflage; +import cpw.mods.fml.common.network.IGuiHandler; + +public class CommonProxy implements IGuiHandler +{ + public void preInit() { + } + + public void init() { + GameRegistry.registerTileEntity((Class)TCamouflage.class, "ICBMYinXin"); + GameRegistry.registerTileEntity((Class)TProximityDetector.class, "ICBMYinGanQi"); + } + + public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) { + return null; + } + + public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) { + return null; + } +} diff --git a/src/main/java/icbm/wanyi/IBSpikes.java b/src/main/java/icbm/wanyi/IBSpikes.java new file mode 100644 index 0000000..614a968 --- /dev/null +++ b/src/main/java/icbm/wanyi/IBSpikes.java @@ -0,0 +1,25 @@ +package icbm.wanyi; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class IBSpikes extends ItemBlock { + public IBSpikes(Block block) { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getMetadata(final int damage) { + return damage; + } + + public String getUnlocalizedName(final ItemStack itemstack) { + return this.getUnlocalizedName() + "." + itemstack.getItemDamage(); + } + + public String getUnlocalizedName() { + return "tile.icbm:spikes"; + } +} diff --git a/src/main/java/icbm/wanyi/ICBMContraption.java b/src/main/java/icbm/wanyi/ICBMContraption.java new file mode 100644 index 0000000..5036fba --- /dev/null +++ b/src/main/java/icbm/wanyi/ICBMContraption.java @@ -0,0 +1,195 @@ +package icbm.wanyi; + +import calclavia.lib.UniversalRecipes; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.ModMetadata; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import icbm.core.ICBMTab; +import icbm.core.MainBase; +import icbm.wanyi.b.BCamouflage; +import icbm.wanyi.b.BConcrete; +import icbm.wanyi.b.BGlassButton; +import icbm.wanyi.b.BGlassPressurePlate; +import icbm.wanyi.b.BGlassReinforced; +import icbm.wanyi.b.BProximityDetector; +import icbm.wanyi.b.BSpikes; +import icbm.wanyi.b.IBConcrete; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.item.ElectricItemHelper; +import universalelectricity.core.item.ItemElectric; + +@Mod(modid = "ICBM|Contraption", name = "ICBM|Contraption", version = "1.2.1", + dependencies = "required-after:AtomicScience", useMetadata = true) +public class ICBMContraption extends MainBase { + public static final String NAME = "ICBM|Contraption"; + public static final String CHANNEL = "ICBM|C"; + @Mod.Instance("ICBM|Contraption") public static ICBMContraption instance; + @Mod.Metadata("ICBM|Contraption") public static ModMetadata metadata; + @SidedProxy(clientSide = "icbm.wanyi.ClientProxy", + serverSide = "icbm.wanyi.CommonProxy") + public static CommonProxy proxy; + public static Block bGlassPressurePlate; + public static Block bGlassButton; + public static Block bProximityDetector; + public static Block bSpikes; + public static Block bCamouflage; + public static Block bConcrete; + public static Block bGlassReinforced; + public static Item itAntidote; + public static ItemElectric itSignalDisrupter; + public static ItemElectric itTracker; + + public static SimpleNetworkWrapper channel; + + @Mod.EventHandler + @Override + public void preInit(final FMLPreInitializationEvent event) { + super.preInit(event); + NetworkRegistry.INSTANCE.registerGuiHandler( + (Object)this, (IGuiHandler)ICBMContraption.proxy); + MainBase.CONFIGURATION.load(); + ICBMContraption.bGlassPressurePlate = (Block) new BGlassPressurePlate(); + ICBMContraption.bGlassButton = (Block) new BGlassButton(); + ICBMContraption.bProximityDetector = (Block) new BProximityDetector(); + ICBMContraption.bSpikes = (Block) new BSpikes(); + ICBMContraption.bCamouflage = (Block) new BCamouflage(); + ICBMContraption.bConcrete = (Block) new BConcrete(); + ICBMContraption.bGlassReinforced = (Block) new BGlassReinforced(); + ICBMContraption.itAntidote = new ItAntidote(); + ICBMContraption.itSignalDisrupter = new ItSignalDisrupter(); + ICBMContraption.itTracker = new ItTracker(); + MainBase.CONFIGURATION.save(); + + GameRegistry.registerBlock(ICBMContraption.bGlassPressurePlate, + "bGlassPressurePlate"); + GameRegistry.registerBlock(ICBMContraption.bGlassButton, "bGlassButton"); + GameRegistry.registerBlock(ICBMContraption.bProximityDetector, + "bProximityDetector"); + GameRegistry.registerBlock(ICBMContraption.bCamouflage, "bCamouflage"); + GameRegistry.registerBlock(ICBMContraption.bGlassReinforced, + "bGlassReinforced"); + GameRegistry.registerBlock(ICBMContraption.bSpikes, IBSpikes.class, + "bSpikes"); + GameRegistry.registerBlock(ICBMContraption.bConcrete, IBConcrete.class, + "bConcrete"); + + GameRegistry.registerItem(ICBMContraption.itAntidote, "itAntidote"); + GameRegistry.registerItem(ICBMContraption.itSignalDisrupter, + "itSignalDisrupter"); + GameRegistry.registerItem(ICBMContraption.itTracker, "itTracker"); + + ICBMTab.itemStack = new ItemStack(ICBMContraption.bProximityDetector); + ICBMContraption.proxy.preInit(); + + channel = NetworkRegistry.INSTANCE.newSimpleChannel("icbm_contraption"); + int pktId = 0; + channel.registerMessage(SetSignalDisrupterFrequencyPacketHandler.class, + SetSignalDisrupterFrequencyPacket.class, pktId++, + Side.SERVER); + channel.registerMessage(ProximityDetectorModePacketHandler.class, + ProximityDetectorModePacket.class, pktId++, + Side.SERVER); + } + + @Mod.EventHandler + public void load(final FMLInitializationEvent evt) { + MainBase.setModMetadata("ICBM|Contraption", ICBMContraption.metadata); + } + + @Mod.EventHandler + @Override + public void postInit(final FMLPostInitializationEvent event) { + super.postInit(event); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bSpikes, 6), + new Object[] {"CCC", "BBB", 'C', Blocks.cactus, 'B', "ingotBronze"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bSpikes, 6), + new Object[] {"CCC", "BBB", 'C', Blocks.cactus, 'B', + Items.iron_ingot})); + GameRegistry.addRecipe(new ItemStack(ICBMContraption.bSpikes, 1, 1), + new Object[] {"E", "S", 'E', MainBase.itDu, 'S', + ICBMContraption.bSpikes}); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bSpikes, 1, 2), + new Object[] {"E", "S", 'E', "dustSulfur", 'S', + ICBMContraption.bSpikes})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bCamouflage, 12), + new Object[] {"WGW", "GCG", "WGW", 'C', "calclavia:CIRCUIT_T1", 'G', + Blocks.glass, 'W', + new ItemStack(Blocks.wool, 1, 32767)})); + if (OreDictionary.getOres(UniversalRecipes.BATTERY).size() > 0) { + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack((Item)ICBMContraption.itTracker), + new Object[] { + " Z ", "SBS", "SCS", 'Z', Items.compass, 'C', + "calclavia:CIRCUIT_T1", 'B', + ElectricItemHelper.getUncharged( + OreDictionary.getOres(UniversalRecipes.BATTERY).get(0)), + 'S', "ingotSteel"})); + } + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bGlassPressurePlate, 1, 0), + new Object[] {"##", '#', Blocks.glass})); + GameRegistry.addRecipe(new ItemStack(ICBMContraption.bGlassButton, 2), + new Object[] {"G", "G", 'G', Blocks.glass}); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + ICBMContraption.bProximityDetector, + new Object[] { + "SSS", "S?S", "SSS", 'S', "ingotSteel", '?', + ElectricItemHelper.getUncharged(ICBMContraption.itTracker)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + (Item)ICBMContraption.itSignalDisrupter, + new Object[] {"WWW", "SCS", "SSS", 'S', "ingotSteel", 'C', + "calclavia:CIRCUIT_T1", 'W', "calclavia:WIRE"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.itAntidote, 6), + new Object[] {"@@@", "@@@", "@@@", '@', Items.pumpkin_seeds})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.itAntidote, 6), + new Object[] {"@@@", "@@@", "@@@", '@', Items.melon_seeds})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.itAntidote), + new Object[] {"@@@", "@@@", "@@@", '@', Items.wheat_seeds})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bConcrete, 8, 0), + new Object[] {"SGS", "GWG", "SGS", 'G', Blocks.gravel, 'S', Blocks.sand, + 'W', Items.water_bucket})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bConcrete, 8, 1), + new Object[] {"COC", "OCO", "COC", 'C', + new ItemStack(ICBMContraption.bConcrete, 1, 0), 'O', + Blocks.obsidian})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bConcrete, 8, 2), + new Object[] {"COC", "OCO", "COC", 'C', + new ItemStack(ICBMContraption.bConcrete, 1, 1), 'O', + "ingotSteel"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMContraption.bGlassReinforced, 8), + new Object[] {"IGI", "GIG", "IGI", 'G', Blocks.glass, 'I', + Items.iron_ingot})); + ICBMContraption.proxy.init(); + } + + @Override + protected String getChannel() { + return "ICBM|C"; + } +} diff --git a/src/main/java/icbm/wanyi/ItAntidote.java b/src/main/java/icbm/wanyi/ItAntidote.java new file mode 100644 index 0000000..1332bd9 --- /dev/null +++ b/src/main/java/icbm/wanyi/ItAntidote.java @@ -0,0 +1,37 @@ +package icbm.wanyi; + +import icbm.core.di.ItICBM; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItAntidote extends ItICBM { + public ItAntidote() { + super("antidote"); + this.setTextureName("icbm:antidote"); + } + + public ItemStack onEaten(final ItemStack par1ItemStack, final World par2World, + final EntityPlayer par3EntityPlayer) { + --par1ItemStack.stackSize; + if (!par2World.isRemote) { + par3EntityPlayer.clearActivePotions(); + } + return par1ItemStack; + } + + public int getMaxItemUseDuration(final ItemStack par1ItemStack) { return 32; } + + public EnumAction getItemUseAction(final ItemStack par1ItemStack) { + return EnumAction.eat; + } + + public ItemStack onItemRightClick(final ItemStack par1ItemStack, + final World par2World, + final EntityPlayer par3EntityPlayer) { + par3EntityPlayer.setItemInUse(par1ItemStack, + this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } +} diff --git a/src/main/java/icbm/wanyi/ItSignalDisrupter.java b/src/main/java/icbm/wanyi/ItSignalDisrupter.java new file mode 100644 index 0000000..03eb5b0 --- /dev/null +++ b/src/main/java/icbm/wanyi/ItSignalDisrupter.java @@ -0,0 +1,63 @@ +package icbm.wanyi; + +import universalelectricity.core.electricity.ElectricityPack; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import net.minecraft.nbt.NBTTagCompound; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import icbm.api.IItemFrequency; +import icbm.core.di.ItElectricICBM; + +public class ItSignalDisrupter extends ItElectricICBM implements IItemFrequency +{ + public ItSignalDisrupter() { + super("signalDisrupter"); + this.setTextureName("icbm:signalDisrupter"); + } + + @Override + public void addInformation(final ItemStack itemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) { + super.addInformation(itemStack, par2EntityPlayer, par3List, par4); + par3List.add("Frequency: " + this.getFrequency(itemStack)); + } + + @Override + public int getFrequency(final ItemStack itemStack) { + if (itemStack.stackTagCompound == null) { + return 0; + } + return itemStack.stackTagCompound.getInteger("frequency"); + } + + @Override + public void setFrequency(final int frequency, final ItemStack itemStack) { + if (itemStack.stackTagCompound == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + itemStack.stackTagCompound.setInteger("frequency", frequency); + } + + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { + if (!par2World.isRemote) { + super.onUpdate(itemStack, par2World, par3Entity, par4, par5); + if (this.getJoules(itemStack) > 1.0) { + this.onProvide(ElectricityPack.getFromWatts(1.0, this.getJoules(itemStack)), itemStack); + } + } + } + + public ItemStack onItemRightClick(final ItemStack par1ItemStack, final World par2World, final EntityPlayer par3EntityPlayer) { + par3EntityPlayer.openGui((Object)ICBMContraption.instance, 5, par2World, (int)((Entity)par3EntityPlayer).posX, (int)((Entity)par3EntityPlayer).posY, (int)((Entity)par3EntityPlayer).posZ); + return par1ItemStack; + } + + public double getVoltage(final ItemStack itemStack) { + return 25.0; + } + + public double getMaxJoules(final ItemStack itemStack) { + return 80000.0; + } +} diff --git a/src/main/java/icbm/wanyi/ItTracker.java b/src/main/java/icbm/wanyi/ItTracker.java new file mode 100644 index 0000000..4f7d5c9 --- /dev/null +++ b/src/main/java/icbm/wanyi/ItTracker.java @@ -0,0 +1,122 @@ +package icbm.wanyi; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.api.ITracker; +import icbm.core.di.ItElectricICBM; +import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import universalelectricity.core.electricity.ElectricityPack; + +public class ItTracker extends ItElectricICBM implements ITracker { + public ItTracker() { + super("tracker"); + this.setTextureName("icbm:tracker"); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister par1IconRegister) { + if (par1IconRegister instanceof TextureMap) { + ((TextureMap) par1IconRegister) + .setTextureEntry(this.getUnlocalizedName().replace("item.", ""), + new TextureTracker()); + this.itemIcon = ((TextureMap) par1IconRegister) + .getTextureExtry(this.getUnlocalizedName().replace("item.", "")); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void addInformation(final ItemStack itemStack, + final EntityPlayer par2EntityPlayer, + final List par3List, final boolean par4) { + super.addInformation(itemStack, par2EntityPlayer, par3List, par4); + final Entity trackingEntity = this.getTrackingEntity( + (World) FMLClientHandler.instance().getClient().theWorld, itemStack); + if (trackingEntity != null) { + par3List.add("Tracking: " + trackingEntity.getCommandSenderName()); + } + } + + @Override + public void setTrackingEntity(final ItemStack itemStack, + final Entity entity) { + if (itemStack.stackTagCompound == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + if (entity != null) { + itemStack.stackTagCompound.setInteger("trackingEntity", + entity.getEntityId()); + } + } + + @Override + public Entity getTrackingEntity(final World worldObj, + final ItemStack itemStack) { + if (worldObj != null && itemStack.stackTagCompound != null) { + final int trackingID = itemStack.stackTagCompound.getInteger("trackingEntity"); + return worldObj.getEntityByID(trackingID); + } + return null; + } + + @Override + public void onCreated(final ItemStack par1ItemStack, final World par2World, + final EntityPlayer par3EntityPlayer) { + super.onCreated(par1ItemStack, par2World, par3EntityPlayer); + this.setTrackingEntity(par1ItemStack, (Entity) par3EntityPlayer); + } + + public void onUpdate(final ItemStack itemStack, final World par2World, + final Entity par3Entity, final int par4, + final boolean par5) { + super.onUpdate(itemStack, par2World, par3Entity, par4, par5); + if (par3Entity instanceof EntityPlayer) { + final EntityPlayer player = (EntityPlayer) par3Entity; + if (player.inventory.getCurrentItem() != null && + player.inventory.getCurrentItem().getItem() == this) { + final Entity trackingEntity = this.getTrackingEntity(par2World, itemStack); + if (trackingEntity != null) { + this.onProvide(ElectricityPack.getFromWatts( + 0.10000000149011612, this.getVoltage(itemStack)), + itemStack); + if (this.getJoules(itemStack) < 0.10000000149011612) { + this.setTrackingEntity(itemStack, null); + } + } + } + } + } + + public boolean onLeftClickEntity(final ItemStack itemStack, + final EntityPlayer player, + final Entity entity) { + if (!((Entity) player).worldObj.isRemote) { + if (this.getJoules(itemStack) > 0.10000000149011612) { + this.setTrackingEntity(itemStack, entity); + player.addChatMessage(new ChatComponentText( + "Now tracking: " + entity.getCommandSenderName())); + return true; + } + player.addChatMessage( + new ChatComponentText("Tracker out of electricity!")); + } + return false; + } + + public double getVoltage(final ItemStack itemStack) { + return 20.0; + } + + public double getMaxJoules(final ItemStack itemStack) { + return 100000.0; + } +} diff --git a/src/main/java/icbm/wanyi/ItemTracker.java b/src/main/java/icbm/wanyi/ItemTracker.java new file mode 100644 index 0000000..08fa34c --- /dev/null +++ b/src/main/java/icbm/wanyi/ItemTracker.java @@ -0,0 +1,6 @@ +package icbm.wanyi; + +public class ItemTracker { + +} + diff --git a/src/main/java/icbm/wanyi/ProximityDetectorModePacket.java b/src/main/java/icbm/wanyi/ProximityDetectorModePacket.java new file mode 100644 index 0000000..94be380 --- /dev/null +++ b/src/main/java/icbm/wanyi/ProximityDetectorModePacket.java @@ -0,0 +1,110 @@ +package icbm.wanyi; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import io.netty.buffer.ByteBuf; +import java.util.Optional; +import universalelectricity.core.vector.Vector3; + +public class ProximityDetectorModePacket implements IMessage { + Vector3 pos; + + public Optional mode; + public Optional frequency; + public Optional minCoord; + public Optional maxCoord; + + public ProximityDetectorModePacket() { this(null); } + + public ProximityDetectorModePacket(Vector3 pos) { + this.pos = pos; + + this.mode = Optional.empty(); + this.frequency = Optional.empty(); + this.minCoord = Optional.empty(); + this.maxCoord = Optional.empty(); + } + + @Override + public void fromBytes(ByteBuf buf) { + this.pos = new Vector3(buf.readInt(), buf.readInt(), buf.readInt()); + + int ordinal = buf.readInt(); + if (ordinal < 0 || ordinal >= Type.values().length) + return; + + switch (Type.values()[ordinal]) { + case MODE: + this.mode = Optional.of(buf.readByte()); + break; + + case FREQUENCY: + this.frequency = Optional.of(buf.readShort()); + break; + + case MIN_COORD: + this.minCoord = Optional.of(new Vector3(clampCoord(buf.readInt()), + clampCoord(buf.readInt()), + clampCoord(buf.readInt()))); + break; + + case MAX_COORD: + this.maxCoord = Optional.of(new Vector3(clampCoord(buf.readInt()), + clampCoord(buf.readInt()), + clampCoord(buf.readInt()))); + break; + } + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(this.pos.intX()); + buf.writeInt(this.pos.intY()); + buf.writeInt(this.pos.intZ()); + + Type type = this.mode.isPresent() ? Type.MODE + : this.frequency.isPresent() ? Type.FREQUENCY + : this.minCoord.isPresent() ? Type.MIN_COORD + : this.maxCoord.isPresent() ? Type.MAX_COORD + : null; + + if (type == null) + throw new IllegalArgumentException("No field set!"); + + buf.writeInt(type.ordinal()); + + switch (type) { + case MODE: + buf.writeByte(this.mode.get()); + break; + + case FREQUENCY: + buf.writeShort(this.frequency.get()); + break; + + case MIN_COORD: { + Vector3 v = this.minCoord.get(); + buf.writeInt(v.intX()); + buf.writeInt(v.intY()); + buf.writeInt(v.intZ()); + break; + } + + case MAX_COORD: { + Vector3 v = this.maxCoord.get(); + buf.writeInt(v.intX()); + buf.writeInt(v.intY()); + buf.writeInt(v.intZ()); + break; + } + } + } + + static int clampCoord(int coord) { return Math.min(30, Math.max(0, coord)); } + + public static enum Type { + MODE, + FREQUENCY, + MIN_COORD, + MAX_COORD, + } +} diff --git a/src/main/java/icbm/wanyi/ProximityDetectorModePacketHandler.java b/src/main/java/icbm/wanyi/ProximityDetectorModePacketHandler.java new file mode 100644 index 0000000..4614301 --- /dev/null +++ b/src/main/java/icbm/wanyi/ProximityDetectorModePacketHandler.java @@ -0,0 +1,26 @@ +package icbm.wanyi; + +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 icbm.wanyi.b.TProximityDetector; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class ProximityDetectorModePacketHandler + implements IMessageHandler { + + @Override + public IMessage onMessage(ProximityDetectorModePacket message, + MessageContext ctx) { + World world = ctx.getServerHandler().playerEntity.worldObj; + + TileEntity te = message.pos.getTileEntity(world); + + if (te instanceof TProximityDetector) { + ((TProximityDetector)te).onModePacket(message); + } + + return null; + } +} diff --git a/src/main/java/icbm/wanyi/SetSignalDisrupterFrequencyPacket.java b/src/main/java/icbm/wanyi/SetSignalDisrupterFrequencyPacket.java new file mode 100644 index 0000000..ea22130 --- /dev/null +++ b/src/main/java/icbm/wanyi/SetSignalDisrupterFrequencyPacket.java @@ -0,0 +1,22 @@ +package icbm.wanyi; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import io.netty.buffer.ByteBuf; + +public class SetSignalDisrupterFrequencyPacket implements IMessage { + int freq; + + public SetSignalDisrupterFrequencyPacket() { this(0); } + + public SetSignalDisrupterFrequencyPacket(int freq) { this.freq = freq; } + + @Override + public void fromBytes(ByteBuf buf) { + this.freq = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(freq); + } +} diff --git a/src/main/java/icbm/wanyi/SetSignalDisrupterFrequencyPacketHandler.java b/src/main/java/icbm/wanyi/SetSignalDisrupterFrequencyPacketHandler.java new file mode 100644 index 0000000..1a46c67 --- /dev/null +++ b/src/main/java/icbm/wanyi/SetSignalDisrupterFrequencyPacketHandler.java @@ -0,0 +1,24 @@ +package icbm.wanyi; + +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 net.minecraft.item.ItemStack; + +public class SetSignalDisrupterFrequencyPacketHandler + implements IMessageHandler { + + @Override + public IMessage onMessage(SetSignalDisrupterFrequencyPacket message, + MessageContext ctx) { + ItemStack handStack = + ctx.getServerHandler().playerEntity.getCurrentEquippedItem(); + + if (handStack.getItem() instanceof ItSignalDisrupter) { + ((ItSignalDisrupter)handStack.getItem()) + .setFrequency(message.freq, handStack); + } + + return null; + } +} diff --git a/src/main/java/icbm/wanyi/TextureTracker.java b/src/main/java/icbm/wanyi/TextureTracker.java new file mode 100644 index 0000000..b387ba8 --- /dev/null +++ b/src/main/java/icbm/wanyi/TextureTracker.java @@ -0,0 +1,96 @@ +package icbm.wanyi; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +@SideOnly(Side.CLIENT) +public class TextureTracker extends TextureAtlasSprite { + public double currentAngle; + public double angleDelta; + + public TextureTracker() { + super(ICBMContraption.itTracker.getUnlocalizedName().replace("item.", "")); + } + + @Override + public void updateAnimation() { + Minecraft minecraft = Minecraft.getMinecraft(); + World world = minecraft.theWorld; + EntityPlayer player = minecraft.thePlayer; + + double angel = 0; + + if (world != null) { + double xDifference = 0; + double zDifference = 0; + + ItemStack itemStack = player.getCurrentEquippedItem(); + + if (itemStack != null) { + if (itemStack.getItem() instanceof ItTracker) { + Entity trackingEntity = + ((ItTracker)itemStack.getItem()) + .getTrackingEntity( + FMLClientHandler.instance().getClient().theWorld, + itemStack); + + if (trackingEntity != null) { + xDifference = trackingEntity.posX - player.posX; + zDifference = trackingEntity.posZ - player.posZ; + } + } + } + + player.rotationYaw %= 360.0D; + angel = -((player.rotationYaw - 90.0D) * Math.PI / 180.0D - + Math.atan2(zDifference, xDifference)); + } + + double d6; + + for (d6 = angel - this.currentAngle; d6 < -Math.PI; d6 += (Math.PI * 2D)) { + ; + } + + while (d6 >= Math.PI) { + d6 -= (Math.PI * 2D); + } + + if (d6 < -1.0D) { + d6 = -1.0D; + } + + if (d6 > 1.0D) { + d6 = 1.0D; + } + + this.angleDelta += d6 * 0.1D; + this.angleDelta *= 0.8D; + this.currentAngle += this.angleDelta; + + int i; + + for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * + this.framesTextureData.size()) % + this.framesTextureData.size(); + i < 0; i = (i + this.framesTextureData.size()) % + this.framesTextureData.size()) { + ; + } + + if (i != this.frameCounter) { + this.frameCounter = i; + TextureUtil.uploadTextureMipmap( + (int[][])this.framesTextureData.get(this.frameCounter), this.width, + this.height, this.originX, this.originY, false, false); + } + } +} diff --git a/src/main/java/icbm/wanyi/b/BCamouflage.java b/src/main/java/icbm/wanyi/b/BCamouflage.java new file mode 100644 index 0000000..d6bf89a --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BCamouflage.java @@ -0,0 +1,179 @@ +package icbm.wanyi.b; + +import icbm.api.ICamouflageMaterial; +import icbm.api.explosion.IEMPBlock; +import icbm.api.explosion.IExplosive; +import icbm.core.ICBMTab; +import icbm.core.di.BICBM; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; + +public class BCamouflage extends BICBM implements IEMPBlock { + public BCamouflage() { + super("camouflage", Material.cloth); + this.setHardness(0.3f); + this.setResistance(1.0f); + this.setStepSound(Block.soundTypeCloth); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + } + + @Override + public void onEMP(final World world, final Vector3 position, + final IExplosive empExplosive) { + final TileEntity tileEntity = position.getTileEntity((IBlockAccess) world); + if (tileEntity instanceof TCamouflage) { + ((TCamouflage) tileEntity).setCamoBlock(Blocks.air, 0); + ((TCamouflage) tileEntity).setTransparent(false); + world.markBlockRangeForRenderUpdate(position.intX(), position.intY(), + position.intZ(), position.intX(), + position.intY(), position.intZ()); + } + } + + @Override + public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int x, + final int y, final int z, final int side) { + final TileEntity t = par1IBlockAccess.getTileEntity(x, y, z); + if (t != null && t instanceof TCamouflage) { + final TCamouflage tileEntity = (TCamouflage) t; + if (tileEntity.getTransparent(ForgeDirection.getOrientation(side))) { + return Blocks.glass.getBlockTextureFromSide(side); + } + final Block block = tileEntity.getCamoBlock(); + if (block != null) { + try { + final IIcon blockIcon = tileEntity.getCamoBlock().getIcon( + side, tileEntity.getJiaMetadata()); + if (blockIcon != null) { + return blockIcon; + } + } catch (final Exception e) { + e.printStackTrace(); + } + } + } + return this.blockIcon; + } + + @Override + public boolean onMachineActivated(final World par1World, final int x, + final int y, final int z, + final EntityPlayer par5EntityPlayer, + final int side, final float hitX, + final float hitY, final float hitZ) { + try { + if (par5EntityPlayer.getCurrentEquippedItem() != null) { + final Item item = par5EntityPlayer.getCurrentEquippedItem().getItem(); + final Block block = Block.getBlockFromItem(item); + if (block != Blocks.air && block != this && + (block instanceof ICamouflageMaterial || + (block.isNormalCube() && + (block.getRenderType() == 0 || block.getRenderType() == 31)))) { + ((TCamouflage) par1World.getTileEntity(x, y, z)) + .setCamoBlock( + block, + par5EntityPlayer.getCurrentEquippedItem().getItemDamage()); + par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + return true; + } + } + } catch (final Exception e) { + e.printStackTrace(); + } + return false; + } + + @Override + public boolean onUseWrench(final World par1World, final int x, final int y, + final int z, final EntityPlayer par5EntityPlayer, + final int side, final float hitX, final float hitY, + final float hitZ) { + final TileEntity t = par1World.getTileEntity(x, y, z); + if (t != null && t instanceof TCamouflage) { + ((TCamouflage) par1World.getTileEntity(x, y, z)) + .setTransparent(ForgeDirection.getOrientation(side)); + par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + } + return true; + } + + @Override + public boolean onSneakUseWrench(final World par1World, final int x, final int y, final int z, + final EntityPlayer par5EntityPlayer, final int side, + final float hitX, final float hitY, final float hitZ) { + final TileEntity t = par1World.getTileEntity(x, y, z); + if (t != null && t instanceof TCamouflage) { + ((TCamouflage) par1World.getTileEntity(x, y, z)).setSolid(); + } + return true; + } + + @Override + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int x, + final int y, final int z) { + try { + final TileEntity tileEntity = par1IBlockAccess.getTileEntity(x, y, z); + if (tileEntity instanceof TCamouflage) { + final Block block = ((TCamouflage) tileEntity).getCamoBlock(); + if (block != null) { + return block.colorMultiplier(par1IBlockAccess, x, y, x); + } + } + } catch (final Exception e) { + e.printStackTrace(); + } + return 16777215; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, + final int x, final int y, + final int z) { + final TileEntity t = par1World.getTileEntity(x, y, z); + if (t != null && t instanceof TCamouflage && ((TCamouflage) t).getSolid()) { + return super.getCollisionBoundingBoxFromPool(par1World, x, y, z); + } + return null; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean shouldSideBeRendered(final IBlockAccess par1IBlockAccess, + final int par2, final int par3, + final int par4, final int par5) { + final Block var6 = par1IBlockAccess.getBlock(par2, par3, par4); + return var6 != this && + super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + + @Override + public TileEntity createNewTileEntity(final World var1, int meta) { + return new TCamouflage(); + } + + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + this.blockIcon = iconRegister.registerIcon("icbm:camouflage"); + } +} diff --git a/src/main/java/icbm/wanyi/b/BConcrete.java b/src/main/java/icbm/wanyi/b/BConcrete.java new file mode 100644 index 0000000..b285409 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BConcrete.java @@ -0,0 +1,99 @@ +package icbm.wanyi.b; + +import atomicscience.api.IAntiPoisonBlock; +import atomicscience.api.poison.Poison; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.BICBM; +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class BConcrete extends BICBM implements IAntiPoisonBlock { + private IIcon iconCompact; + private IIcon iconReinforced; + + public BConcrete() { + super("concrete", Material.rock); + this.setBlockTextureName("icbm:concrete"); + this.setHardness(3.8f); + this.setResistance(50.0f); + this.setStepSound(BConcrete.soundTypeMetal); + } + + @Override + public IIcon getIcon(final int side, final int metadata) { + switch (metadata) { + case 1: { + return this.iconCompact; + } + case 2: { + return this.iconReinforced; + } + default: { + return this.blockIcon; + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + this.iconCompact = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "Compact"); + this.iconReinforced = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "Reinforced"); + } + + @Override + public float getExplosionResistance(final Entity par1Entity, final World world, + final int x, final int y, final int z, + final double explosionX, final double explosionY, + final double explosionZ) { + final int metadata = world.getBlockMetadata(x, y, z); + switch (metadata) { + case 1: { + return 38.0f; + } + case 2: { + return 48.0f; + } + default: { + return this.getExplosionResistance(par1Entity); + } + } + } + + @Override + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < 3; ++i) { + par3List.add(new ItemStack(par1, 1, i)); + } + } + + @Override + public boolean isPoisonPrevention(final World par1World, final int x, + final int y, final int z, + final Poison type) { + return true; + } + + @Override + public boolean hasTileEntity(final int metadata) { + return false; + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return null; + } +} diff --git a/src/main/java/icbm/wanyi/b/BGlassButton.java b/src/main/java/icbm/wanyi/b/BGlassButton.java new file mode 100644 index 0000000..9537ee4 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BGlassButton.java @@ -0,0 +1,36 @@ +package icbm.wanyi.b; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.ICBMTab; +import java.util.Random; +import net.minecraft.block.BlockButton; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; + +public class BGlassButton extends BlockButton { + public BGlassButton() { + super(true); + this.setTickRandomly(true); + this.setBlockName("icbm:glassButton"); + this.setStepSound(BGlassButton.soundTypeGlass); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister par1IconRegister) { + this.blockIcon = par1IconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "")); + } + + @Override + public int quantityDropped(final Random par1Random) { + return 0; + } + + @Override + public boolean isOpaqueCube() { + return false; + } +} diff --git a/src/main/java/icbm/wanyi/b/BGlassPressurePlate.java b/src/main/java/icbm/wanyi/b/BGlassPressurePlate.java new file mode 100644 index 0000000..6a2aa00 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BGlassPressurePlate.java @@ -0,0 +1,64 @@ +package icbm.wanyi.b; + +import icbm.core.ICBMTab; +import java.util.Random; +import net.minecraft.block.BlockPressurePlate; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.world.World; + +public class BGlassPressurePlate extends BlockPressurePlate { + public BGlassPressurePlate() { + super("icbm:glassPressurePlate", Material.glass, + BlockPressurePlate.Sensitivity.everything); + this.setTickRandomly(true); + this.setResistance(1.0f); + this.setHardness(0.3f); + this.setStepSound(BGlassPressurePlate.soundTypeGlass); + this.setBlockName("icbm:glassPressurePlate"); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + } + + @Override + protected void func_150062_a(final World par1World, final int par2, + final int par3, final int par4, final int par5) { + super.func_150062_a(par1World, par2, par3, par4, par5); + final int i1 = this.func_150065_e(par1World, par2, par3, par4); + final boolean flag2 = i1 > 0; + if (par5 != i1) { + par1World.setBlockMetadataWithNotify(par2, par3, par4, + this.func_150066_d(i1), 2); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, + par4); + } + if (flag2) { + par1World.scheduleBlockUpdate(par2, par3, par4, this, + this.tickRate(par1World)); + } + } + + @Override + public int tickRate(final World world) { + return 10; + } + + @Override + public int quantityDropped(final Random par1Random) { + return 0; + } + + @Override + public int getRenderBlockPass() { + return 1; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public int getMobilityFlag() { + return 1; + } +} diff --git a/src/main/java/icbm/wanyi/b/BGlassReinforced.java b/src/main/java/icbm/wanyi/b/BGlassReinforced.java new file mode 100644 index 0000000..b428e50 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BGlassReinforced.java @@ -0,0 +1,71 @@ +package icbm.wanyi.b; + +import atomicscience.api.IAntiPoisonBlock; +import atomicscience.api.poison.Poison; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.ICBMTab; +import icbm.core.di.BICBM; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BGlassReinforced extends BICBM implements IAntiPoisonBlock { + public BGlassReinforced() { + super("glassReinforced", Material.glass); + this.setBlockTextureName("icbm:glassReinforced"); + this.setResistance(48.0f); + this.setCreativeTab((CreativeTabs)ICBMTab.INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 0; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(final IBlockAccess par1IBlockAccess, + final int par2, final int par3, + final int par4, final int par5) { + final Block i1 = par1IBlockAccess.getBlock(par2, par3, par4); + return i1 != this && + super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + protected boolean canSilkHarvest() { + return true; + } + + @Override + public boolean isPoisonPrevention(final World par1World, final int x, + final int y, final int z, + final Poison type) { + return true; + } + + @Override + public boolean hasTileEntity(final int metadata) { + return false; + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return null; + } +} diff --git a/src/main/java/icbm/wanyi/b/BProximityDetector.java b/src/main/java/icbm/wanyi/b/BProximityDetector.java new file mode 100644 index 0000000..9a3b841 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BProximityDetector.java @@ -0,0 +1,61 @@ +package icbm.wanyi.b; + +import icbm.core.di.BICBM; +import icbm.wanyi.ICBMContraption; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import universalelectricity.core.UniversalElectricity; + +public class BProximityDetector extends BICBM { + public BProximityDetector() { + super("proximityDetector", UniversalElectricity.machine); + super.requireSidedTextures = true; + } + + @Override + public IIcon getIcon(final int side, final int metadata) { + return (side == 0) ? super.iconBottom + : ((side == 1) ? super.iconTop : super.iconSide); + } + + @Override + public boolean onMachineActivated(final World par1World, final int x, + final int y, final int z, + final EntityPlayer par5EntityPlayer, + final int side, final float hitX, + final float hitY, final float hitZ) { + par5EntityPlayer.openGui((Object) ICBMContraption.instance, 4, par1World, x, y, + z); + return true; + } + + @Override + public boolean onUseWrench(final World par1World, final int x, final int y, + final int z, final EntityPlayer par5EntityPlayer, + final int side, final float hitX, final float hitY, + final float hitZ) { + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + if (tileEntity instanceof TProximityDetector) { + ((TProximityDetector) tileEntity).isInverted = !((TProximityDetector) tileEntity).isInverted; + return true; + } + return false; + } + + @Override + public boolean canProvidePower() { + return true; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public TileEntity createNewTileEntity(final World world, int meta) { + return new TProximityDetector(); + } +} diff --git a/src/main/java/icbm/wanyi/b/BSpikes.java b/src/main/java/icbm/wanyi/b/BSpikes.java new file mode 100644 index 0000000..57dce28 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/BSpikes.java @@ -0,0 +1,177 @@ +package icbm.wanyi.b; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.ICBMTab; +import icbm.core.di.BICBM; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BSpikes extends BICBM { + private IIcon iconPoison; + private IIcon iconFlammable; + + public BSpikes() { + super("spikes", Material.cactus); + this.setBlockTextureName("icbm:spikes"); + this.setHardness(1.0f); + this.setCreativeTab((CreativeTabs) ICBMTab.INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + this.iconPoison = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "Poison"); + this.iconFlammable = iconRegister.registerIcon( + this.getUnlocalizedName().replace("tile.", "") + "Flammable"); + } + + @Override + public AxisAlignedBB getSelectedBoundingBoxFromPool(final World par1World, + final int x, final int y, + final int z) { + return AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, + (double) (x + 1), (double) (y + 0.5f), + (double) (z + 1)); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, + final int par3, final int par4) { + return null; + } + + @Override + public IIcon getIcon(final int par1, final int metadata) { + if (metadata == 2) { + return this.iconFlammable; + } + if (metadata == 1) { + return this.iconPoison; + } + return this.blockIcon; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public int getRenderType() { + return 1; + } + + @Override + public int getMobilityFlag() { + return 0; + } + + @Override + public boolean canPlaceBlockAt(final World par1World, final int par2, + final int par3, final int par4) { + return this.canBlockStay(par1World, par2, par3, par4); + } + + @Override + public void onNeighborBlockChange(final World par1World, final int par2, + final int par3, final int par4, + final Block par5) { + if (!this.canBlockStay(par1World, par2, par3, par4)) { + this.dropBlockAsItem(par1World, par2, par3, par4, + par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlock(par2, par3, par4, Blocks.air, 0, 2); + } + } + + @Override + public boolean canBlockStay(final World par1World, final int par2, + final int par3, final int par4) { + return par1World.isSideSolid(par2 - 1, par3, par4, + ForgeDirection.getOrientation(5)) || + par1World.isSideSolid(par2 + 1, par3, par4, + ForgeDirection.getOrientation(4)) + || + par1World.isSideSolid(par2, par3, par4 - 1, + ForgeDirection.getOrientation(3)) + || + par1World.isSideSolid(par2, par3, par4 + 1, + ForgeDirection.getOrientation(2)) + || + par1World.isSideSolid(par2, par3 + 1, par4, + ForgeDirection.getOrientation(1)) + || + par1World.isSideSolid(par2, par3 - 1, par4, + ForgeDirection.getOrientation(0)) + || + par1World.getBlock(par2 - 1, par3, par4) == Blocks.piston_head || + par1World.getBlock(par2 + 1, par3, par4) == Blocks.piston_head || + par1World.getBlock(par2, par3, par4 - 1) == Blocks.piston_head || + par1World.getBlock(par2, par3, par4 + 1) == Blocks.piston_head || + par1World.getBlock(par2, par3 + 1, par4) == Blocks.piston_head || + par1World.getBlock(par2, par3 - 1, par4) == Blocks.piston_head || + par1World.getBlock(par2 - 1, par3, par4) == Blocks.piston || + par1World.getBlock(par2 + 1, par3, par4) == Blocks.piston || + par1World.getBlock(par2, par3, par4 - 1) == Blocks.piston || + par1World.getBlock(par2, par3, par4 + 1) == Blocks.piston || + par1World.getBlock(par2, par3 + 1, par4) == Blocks.piston || + par1World.getBlock(par2, par3 - 1, par4) == Blocks.piston || + par1World.getBlock(par2 - 1, par3, par4) == Blocks.sticky_piston || + par1World.getBlock(par2 + 1, par3, par4) == Blocks.sticky_piston || + par1World.getBlock(par2, par3, par4 - 1) == Blocks.sticky_piston || + par1World.getBlock(par2, par3, par4 + 1) == Blocks.sticky_piston || + par1World.getBlock(par2, par3 + 1, par4) == Blocks.sticky_piston || + par1World.getBlock(par2, par3 - 1, par4) == Blocks.sticky_piston; + } + + @Override + public void onEntityCollidedWithBlock(final World par1World, final int par2, + final int par3, final int par4, + final Entity par5Entity) { + if (par5Entity instanceof EntityLiving) { + par5Entity.attackEntityFrom(DamageSource.cactus, 1); + if (par1World.getBlockMetadata(par2, par3, par4) == 1) { + ((EntityLiving) par5Entity) + .addPotionEffect(new PotionEffect(Potion.poison.id, 140, 0)); + } else if (par1World.getBlockMetadata(par2, par3, par4) == 2) { + ((EntityLiving) par5Entity).setFire(7); + } + } + } + + @Override + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < 3; ++i) { + par3List.add(new ItemStack((Block) this, 1, i)); + } + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return null; + } +} diff --git a/src/main/java/icbm/wanyi/b/IBConcrete.java b/src/main/java/icbm/wanyi/b/IBConcrete.java new file mode 100644 index 0000000..b1375ba --- /dev/null +++ b/src/main/java/icbm/wanyi/b/IBConcrete.java @@ -0,0 +1,31 @@ +package icbm.wanyi.b; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class IBConcrete extends ItemBlock { + public IBConcrete(Block block) { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getMetadata(final int damage) { + return damage; + } + + public String getUnlocalizedName(final ItemStack itemstack) { + switch (itemstack.getItemDamage()) { + case 1: { + return this.getUnlocalizedName() + "Compact"; + } + case 2: { + return this.getUnlocalizedName() + "Reinforced"; + } + default: { + return this.getUnlocalizedName(); + } + } + } +} diff --git a/src/main/java/icbm/wanyi/b/TCamouflage.java b/src/main/java/icbm/wanyi/b/TCamouflage.java new file mode 100644 index 0000000..c10ccae --- /dev/null +++ b/src/main/java/icbm/wanyi/b/TCamouflage.java @@ -0,0 +1,139 @@ +package icbm.wanyi.b; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public class TCamouflage extends TileEntity { + private Block camoBlock; + private int camoMetadata; + private boolean isSolid; + private final boolean[] transparentSides; + + public TCamouflage() { + this.camoBlock = Blocks.air; + this.camoMetadata = 0; + this.isSolid = true; + this.transparentSides = new boolean[] { false, false, false, false, false, false }; + } + + public boolean canUpdate() { + return false; + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.setCamoBlock(Block.getBlockById(nbt.getInteger("camoId")), + nbt.getInteger("camoMeta")); + this.isSolid = nbt.getBoolean("isSolid"); + + for (int i = 0; i < this.transparentSides.length; i++) { + this.transparentSides[i] = nbt.getBoolean("transparent" + i); + } + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setInteger("camoId", Block.getIdFromBlock(this.camoBlock)); + nbt.setInteger("camoMeta", this.camoMetadata); + nbt.setBoolean("isSolid", this.isSolid); + + for (int i = 0; i < this.transparentSides.length; i++) { + nbt.setBoolean("transparent" + i, this.transparentSides[i]); + } + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + public boolean getSolid() { + return this.isSolid; + } + + public void setSolid(final boolean isSolid) { + this.isSolid = isSolid; + if (!this.worldObj.isRemote) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + + public void setSolid() { + this.setSolid(!this.isSolid); + } + + public Block getCamoBlock() { + return this.camoBlock; + } + + public int getJiaMetadata() { + return this.camoMetadata; + } + + public void setCamoBlock(final Block block, final int metadata) { + if (this.camoBlock != block || this.camoMetadata != metadata) { + this.camoBlock = block; + this.camoMetadata = Math.max(metadata, 0); + if (!this.worldObj.isRemote) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + } + + public boolean getTransparent(final ForgeDirection direction) { + return direction.ordinal() < this.transparentSides.length && + this.transparentSides[direction.ordinal()]; + } + + public void setTransparent(final ForgeDirection direction, + final boolean isTransparent) { + if (direction.ordinal() < this.transparentSides.length) { + this.transparentSides[direction.ordinal()] = isTransparent; + if (!this.worldObj.isRemote) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + } + + public void setTransparent(final ForgeDirection direction) { + this.setTransparent(direction, !this.getTransparent(direction)); + } + + public void setTransparent(final boolean isTransparent) { + for (int i = 0; i < this.transparentSides.length; ++i) { + this.setTransparent(ForgeDirection.getOrientation(i), isTransparent); + } + } + + @Override + public void readFromNBT(final NBTTagCompound par1NBTTagCompound) { + super.readFromNBT(par1NBTTagCompound); + this.camoBlock = Block.getBlockById(par1NBTTagCompound.getInteger("camoBlock")); + this.camoMetadata = par1NBTTagCompound.getInteger("camoMetadata"); + for (int i = 0; i < this.transparentSides.length; ++i) { + this.transparentSides[i] = par1NBTTagCompound.getBoolean("transparent" + i); + } + this.isSolid = par1NBTTagCompound.getBoolean("isSolid"); + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("camoBlock", + Block.getIdFromBlock(this.camoBlock)); + par1NBTTagCompound.setInteger("camoMetadata", this.camoMetadata); + for (int i = 0; i < this.transparentSides.length; ++i) { + par1NBTTagCompound.setBoolean("transparent" + i, + this.transparentSides[i]); + } + par1NBTTagCompound.setBoolean("isSolid", this.isSolid); + } +} diff --git a/src/main/java/icbm/wanyi/b/TProximityDetector.java b/src/main/java/icbm/wanyi/b/TProximityDetector.java new file mode 100644 index 0000000..3843f23 --- /dev/null +++ b/src/main/java/icbm/wanyi/b/TProximityDetector.java @@ -0,0 +1,178 @@ +package icbm.wanyi.b; + +import calclavia.lib.TileEntityUniversalRunnable; +import icbm.wanyi.ItSignalDisrupter; +import icbm.wanyi.ProximityDetectorModePacket; +import java.util.List; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRedstoneProvider; + +public class TProximityDetector + extends TileEntityUniversalRunnable implements IRedstoneProvider { + public short frequency; + public boolean isDetect; + public Vector3 minCoord; + public Vector3 maxCoord; + public byte mode; + public boolean isInverted; + + public TProximityDetector() { + this.frequency = 0; + this.isDetect = false; + this.minCoord = new Vector3(9.0, 9.0, 9.0); + this.maxCoord = new Vector3(9.0, 9.0, 9.0); + this.mode = 0; + this.isInverted = false; + } + + @Override + public void initiate() { + super.initiate(); + this.worldObj.notifyBlocksOfNeighborChange( + this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.worldObj.isRemote && super.ticks % 20L == 0L) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + if (!this.isDisabled()) { + boolean isDetectThisCheck = false; + if (super.wattsReceived >= this.getRequest().getWatts()) { + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + this.xCoord - this.minCoord.x, this.yCoord - this.minCoord.y, + this.zCoord - this.minCoord.z, + this.xCoord + this.maxCoord.x + 1.0, + this.yCoord + this.maxCoord.y + 1.0, + this.zCoord + this.maxCoord.z + 1.0); + final List entitiesNearby = + this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, + bounds); + for (final EntityLivingBase entity : entitiesNearby) { + if (entity instanceof EntityPlayer && + (this.mode == 0 || this.mode == 1)) { + boolean gotDisrupter = false; + for (final ItemStack inventory : + ((EntityPlayer)entity).inventory.mainInventory) { + if (inventory != null && + inventory.getItem() instanceof ItSignalDisrupter && + ((ItSignalDisrupter)inventory.getItem()) + .getFrequency(inventory) == this.frequency) { + gotDisrupter = true; + break; + } + } + if (gotDisrupter) { + if (this.isInverted) { + isDetectThisCheck = true; + break; + } + continue; + } else { + if (this.isInverted) { + continue; + } + isDetectThisCheck = true; + } + } else { + if (!this.isInverted && !(entity instanceof EntityPlayer) && + (this.mode == 0 || this.mode == 2)) { + isDetectThisCheck = true; + break; + } + continue; + } + } + if (!this.worldObj.isRemote) { + super.wattsReceived = 0.0; + } + } + if (isDetectThisCheck != this.isDetect) { + this.isDetect = isDetectThisCheck; + this.worldObj.notifyBlocksOfNeighborChange( + this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + } + } + } + } + + public void onModePacket(ProximityDetectorModePacket pkt) { + pkt.mode.ifPresent(x -> this.mode = x); + pkt.frequency.ifPresent(x -> this.frequency = x); + pkt.minCoord.ifPresent(x -> this.minCoord = x); + pkt.maxCoord.ifPresent(x -> this.maxCoord = x); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setDouble("wattsReceived", super.wattsReceived); + nbt.setShort("frequency", this.frequency); + nbt.setByte("mode", this.mode); + nbt.setBoolean("isInverted", this.isInverted); + nbt.setTag("minCoord", this.minCoord.writeToNBT(new NBTTagCompound())); + nbt.setTag("maxCoord", this.maxCoord.writeToNBT(new NBTTagCompound())); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + super.wattsReceived = nbt.getDouble("wattsReceived"); + this.frequency = nbt.getShort("frequency"); + this.mode = nbt.getByte("mode"); + this.isInverted = nbt.getBoolean("isInverted"); + this.minCoord = Vector3.readFromNBT(nbt.getCompoundTag("minCoord")); + this.maxCoord = Vector3.readFromNBT(nbt.getCompoundTag("maxCoord")); + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.mode = nbt.getByte("mode"); + this.frequency = nbt.getShort("frequency"); + this.isInverted = nbt.getBoolean("isInverted"); + this.minCoord = Vector3.readFromNBT(nbt.getCompoundTag("minCoord")); + this.maxCoord = Vector3.readFromNBT(nbt.getCompoundTag("maxCoord")); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setShort("frequency", this.frequency); + nbt.setByte("mode", this.mode); + nbt.setBoolean("isInverted", this.isInverted); + nbt.setTag("minCoord", this.minCoord.writeToNBT(new NBTTagCompound())); + nbt.setTag("maxCoord", this.maxCoord.writeToNBT(new NBTTagCompound())); + } + + @Override + public boolean isPoweringTo(final ForgeDirection side) { + return this.isDetect; + } + + @Override + public boolean isIndirectlyPoweringTo(final ForgeDirection side) { + return this.isDetect; + } + + @Override + public ElectricityPack getRequest() { + return new ElectricityPack(8.0 / this.getVoltage(), this.getVoltage()); + } +} diff --git a/src/main/java/icbm/wanyi/gui/GProximityDetector.java b/src/main/java/icbm/wanyi/gui/GProximityDetector.java new file mode 100644 index 0000000..c1a6deb --- /dev/null +++ b/src/main/java/icbm/wanyi/gui/GProximityDetector.java @@ -0,0 +1,251 @@ +package icbm.wanyi.gui; + +import icbm.wanyi.ICBMContraption; +import icbm.wanyi.ProximityDetectorModePacket; +import icbm.wanyi.b.TProximityDetector; +import java.util.Optional; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricityDisplay; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.GuiBase; + +public class GProximityDetector extends GuiBase { + private TProximityDetector tileEntity; + private int containerWidth; + private int containerHeight; + private GuiTextField textFieldFreq; + private GuiTextField textFieldminX; + private GuiTextField textFieldminY; + private GuiTextField textFieldminZ; + private GuiTextField textFieldmaxX; + private GuiTextField textFieldmaxY; + private GuiTextField textFieldmaxZ; + + public GProximityDetector(final TProximityDetector tileEntity) { + this.tileEntity = tileEntity; + } + + @Override + public void initGui() { + super.initGui(); + this.buttonList.clear(); + String mode = "All"; + if (this.tileEntity.mode == 1) { + mode = "Players"; + } else if (this.tileEntity.mode == 2) { + mode = "Mobs"; + } + this.buttonList.add(new GuiButton(0, this.width / 2 - 15, + this.height / 2 + 32, 45, 20, mode)); + (this.textFieldFreq = + new GuiTextField(this.fontRendererObj, 75, 100, 40, 12)) + .setMaxStringLength(4); + this.textFieldFreq.setText(this.tileEntity.frequency + ""); + (this.textFieldminX = + new GuiTextField(this.fontRendererObj, 75, 50, 20, 12)) + .setMaxStringLength(2); + this.textFieldminX.setText(this.tileEntity.minCoord.intX() + ""); + (this.textFieldminY = + new GuiTextField(this.fontRendererObj, 75, 67, 20, 12)) + .setMaxStringLength(2); + this.textFieldminY.setText(this.tileEntity.minCoord.intY() + ""); + (this.textFieldminZ = + new GuiTextField(this.fontRendererObj, 75, 82, 20, 12)) + .setMaxStringLength(2); + this.textFieldminZ.setText(this.tileEntity.minCoord.intZ() + ""); + (this.textFieldmaxX = + new GuiTextField(this.fontRendererObj, 130, 50, 20, 12)) + .setMaxStringLength(2); + this.textFieldmaxX.setText(this.tileEntity.maxCoord.intX() + ""); + (this.textFieldmaxY = + new GuiTextField(this.fontRendererObj, 130, 67, 20, 12)) + .setMaxStringLength(2); + this.textFieldmaxY.setText(this.tileEntity.maxCoord.intY() + ""); + (this.textFieldmaxZ = + new GuiTextField(this.fontRendererObj, 130, 82, 20, 12)) + .setMaxStringLength(2); + this.textFieldmaxZ.setText(this.tileEntity.maxCoord.intZ() + ""); + } + + @Override + protected void actionPerformed(final GuiButton par1GuiButton) { + if (par1GuiButton.id == 0) { + final TProximityDetector tileEntity = this.tileEntity; + ++tileEntity.mode; + if (this.tileEntity.mode > 2) { + this.tileEntity.mode = 0; + } + + ProximityDetectorModePacket pkt = + new ProximityDetectorModePacket(new Vector3(this.tileEntity)); + + pkt.mode = Optional.of(this.tileEntity.mode); + + ICBMContraption.channel.sendToServer(pkt); + } + } + + @Override + public void keyTyped(final char par1, final int par2) { + super.keyTyped(par1, par2); + this.textFieldminX.textboxKeyTyped(par1, par2); + this.textFieldminY.textboxKeyTyped(par1, par2); + this.textFieldminZ.textboxKeyTyped(par1, par2); + this.textFieldmaxX.textboxKeyTyped(par1, par2); + this.textFieldmaxY.textboxKeyTyped(par1, par2); + this.textFieldmaxZ.textboxKeyTyped(par1, par2); + this.textFieldFreq.textboxKeyTyped(par1, par2); + try { + final Vector3 newMinCoord = + new Vector3(Integer.parseInt(this.textFieldminX.getText()), + Integer.parseInt(this.textFieldminY.getText()), + Integer.parseInt(this.textFieldminZ.getText())); + this.tileEntity.minCoord = newMinCoord; + ProximityDetectorModePacket pkt = + new ProximityDetectorModePacket(new Vector3(this.tileEntity)); + pkt.minCoord = Optional.of(this.tileEntity.minCoord); + ICBMContraption.channel.sendToServer(pkt); + } catch (final Exception ex) { + } + try { + final Vector3 newMaxCoord = + new Vector3(Integer.parseInt(this.textFieldmaxX.getText()), + Integer.parseInt(this.textFieldmaxY.getText()), + Integer.parseInt(this.textFieldmaxZ.getText())); + this.tileEntity.maxCoord = newMaxCoord; + + ProximityDetectorModePacket pkt = + new ProximityDetectorModePacket(new Vector3(this.tileEntity)); + pkt.maxCoord = Optional.of(this.tileEntity.maxCoord); + ICBMContraption.channel.sendToServer(pkt); + } catch (final Exception ex2) { + } + try { + final short newFrequency = (short)Math.max( + 0, Short.parseShort(this.textFieldFreq.getText())); + this.tileEntity.frequency = newFrequency; + + ProximityDetectorModePacket pkt = + new ProximityDetectorModePacket(new Vector3(this.tileEntity)); + pkt.frequency = Optional.of(this.tileEntity.frequency); + ICBMContraption.channel.sendToServer(pkt); + } catch (final Exception ex3) { + } + } + + @Override + public void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.textFieldminX.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldminY.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldminZ.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldmaxX.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldmaxY.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldmaxZ.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldFreq.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + } + + @Override + protected void drawForegroundLayer(final int var2, final int var3, + final float var1) { + this.fontRendererObj.drawString("§7Proximity Detector", 48, 6, 4210752); + this.fontRendererObj.drawString("Detection Range", 12, 25, 4210752); + this.fontRendererObj.drawString("Min", 75, 40, 4210752); + this.fontRendererObj.drawString("Max", 130, 40, 4210752); + this.fontRendererObj.drawString("X-Coord:", 15, 51, 4210752); + this.fontRendererObj.drawString("Y-Coord:", 15, 68, 4210752); + this.fontRendererObj.drawString("Z-Coord:", 15, 83, 4210752); + this.textFieldminX.drawTextBox(); + this.textFieldminY.drawTextBox(); + this.textFieldminZ.drawTextBox(); + this.textFieldmaxX.drawTextBox(); + this.textFieldmaxY.drawTextBox(); + this.textFieldmaxZ.drawTextBox(); + this.fontRendererObj.drawString("Frequency:", 15, 102, 4210752); + if (!this.tileEntity.isInverted) { + this.fontRendererObj.drawString("Exclude", 120, 102, 4210752); + } else { + this.fontRendererObj.drawString("Include", 120, 102, 4210752); + } + this.fontRendererObj.drawString("Target:", 15, 120, 4210752); + this.textFieldFreq.drawTextBox(); + String color = "§4"; + String status = "Idle"; + if (this.tileEntity.isDisabled()) { + status = "Disabled"; + } else if (this.tileEntity.prevWatts < + this.tileEntity.getRequest().getWatts()) { + status = "Insufficient electricity!"; + } else { + color = "§2"; + status = "On"; + } + this.fontRendererObj.drawString(color + "Status: " + status, 12, 138, + 4210752); + this.fontRendererObj.drawString( + ElectricityDisplay.getDisplay(this.tileEntity.getRequest().getWatts() * + 20.0, + ElectricityDisplay.ElectricUnit.WATT) + + " " + + ElectricityDisplay.getDisplay( + this.tileEntity.getVoltage(), + ElectricityDisplay.ElectricUnit.VOLTAGE), + 12, 150, 4210752); + } + + @Override + protected void drawBackgroundLayer(final int var2, final int var3, + final float var1) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerWidth = (this.width - super.xSize) / 2; + this.containerHeight = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + super.xSize, super.ySize); + } + + @Override + public void updateScreen() { + super.updateScreen(); + String mode = "All"; + if (this.tileEntity.mode == 1) { + mode = "Players"; + } else if (this.tileEntity.mode == 2) { + mode = "Mobs"; + } + ((GuiButton)this.buttonList.get(0)).displayString = mode; + if (!this.textFieldminX.isFocused()) { + this.textFieldminX.setText(this.tileEntity.minCoord.intX() + ""); + } + if (!this.textFieldminY.isFocused()) { + this.textFieldminY.setText(this.tileEntity.minCoord.intY() + ""); + } + if (!this.textFieldminZ.isFocused()) { + this.textFieldminZ.setText(this.tileEntity.minCoord.intZ() + ""); + } + if (!this.textFieldmaxX.isFocused()) { + this.textFieldmaxX.setText(this.tileEntity.maxCoord.intX() + ""); + } + if (!this.textFieldmaxY.isFocused()) { + this.textFieldmaxY.setText(this.tileEntity.maxCoord.intY() + ""); + } + if (!this.textFieldmaxZ.isFocused()) { + this.textFieldmaxZ.setText(this.tileEntity.maxCoord.intZ() + ""); + } + if (!this.textFieldFreq.isFocused()) { + this.textFieldFreq.setText(this.tileEntity.frequency + ""); + } + } +} diff --git a/src/main/java/icbm/wanyi/gui/GSignalDisrupter.java b/src/main/java/icbm/wanyi/gui/GSignalDisrupter.java new file mode 100644 index 0000000..5b15a61 --- /dev/null +++ b/src/main/java/icbm/wanyi/gui/GSignalDisrupter.java @@ -0,0 +1,76 @@ +package icbm.wanyi.gui; + +import icbm.api.IItemFrequency; +import icbm.wanyi.ICBMContraption; +import icbm.wanyi.SetSignalDisrupterFrequencyPacket; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import universalelectricity.prefab.GuiBase; + +public class GSignalDisrupter extends GuiBase { + private ItemStack itemStack; + private GuiTextField textFieldFrequency; + private int containerWidth; + private int containerHeight; + + public GSignalDisrupter(final ItemStack par1ItemStack) { + this.itemStack = par1ItemStack; + } + + @Override + public void initGui() { + super.initGui(); + (this.textFieldFrequency = + new GuiTextField(this.fontRendererObj, 80, 50, 40, 12)) + .setMaxStringLength(4); + this.textFieldFrequency.setText(((IItemFrequency)this.itemStack.getItem()) + .getFrequency(this.itemStack) + + ""); + } + + public void keyTyped(final char par1, final int par2) { + super.keyTyped(par1, par2); + this.textFieldFrequency.textboxKeyTyped(par1, par2); + try { + final short newFrequency = (short)Math.max( + 0, Short.parseShort(this.textFieldFrequency.getText())); + this.textFieldFrequency.setText(newFrequency + ""); + if (((IItemFrequency)this.itemStack.getItem()) + .getFrequency(this.itemStack) != newFrequency) { + ((IItemFrequency)this.itemStack.getItem()) + .setFrequency(newFrequency, this.itemStack); + ICBMContraption.channel.sendToServer( + new SetSignalDisrupterFrequencyPacket(newFrequency)); + } + } catch (final NumberFormatException ex) { + } + } + + public void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.textFieldFrequency.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + } + + @Override + protected void drawForegroundLayer(final int var2, final int var3, + final float var1) { + this.fontRendererObj.drawString("§7Frequency", 62, 6, 4210752); + this.fontRendererObj.drawString("Frequency:", 15, 52, 4210752); + this.textFieldFrequency.drawTextBox(); + } + + @Override + protected void drawBackgroundLayer(final int var2, final int var3, + final float var1) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerWidth = (this.width - super.xSize) / 2; + this.containerHeight = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + super.xSize, super.ySize); + } +} diff --git a/src/main/java/icbm/zhapin/ClientProxy.java b/src/main/java/icbm/zhapin/ClientProxy.java new file mode 100644 index 0000000..e93e429 --- /dev/null +++ b/src/main/java/icbm/zhapin/ClientProxy.java @@ -0,0 +1,203 @@ +package icbm.zhapin; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.cart.ECart; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.fx.FXAntimatter; +import icbm.zhapin.fx.FXPortal; +import icbm.zhapin.fx.FXShockwave; +import icbm.zhapin.fx.FXSmoke; +import icbm.zhapin.gui.GEmpTower; +import icbm.zhapin.gui.GFaSheDi; +import icbm.zhapin.gui.GMissileLauncher; +import icbm.zhapin.gui.GRadarTower; +import icbm.zhapin.gui.GXiaoFaSheQi; +import icbm.zhapin.jiqi.TCruiseLauncher; +import icbm.zhapin.jiqi.TEmpTower; +import icbm.zhapin.jiqi.TLauncher; +import icbm.zhapin.jiqi.TLauncherPlatform; +import icbm.zhapin.jiqi.TMissileCoordinator; +import icbm.zhapin.jiqi.TLauncherControlPanel; +import icbm.zhapin.jiqi.TRadarTower; +import icbm.zhapin.render.REZhaDan; +import icbm.zhapin.render.REmpTower; +import icbm.zhapin.render.RFaSheDi; +import icbm.zhapin.render.RFaSheJia; +import icbm.zhapin.render.RLauncherControlPanel; +import icbm.zhapin.render.RFeiBlock; +import icbm.zhapin.render.RGuangBang; +import icbm.zhapin.render.RHJiQi; +import icbm.zhapin.render.RHZhaPin; +import icbm.zhapin.render.RItDaoDan; +import icbm.zhapin.render.RItRocketLauncher; +import icbm.zhapin.render.RMissile; +import icbm.zhapin.render.RRadarTower; +import icbm.zhapin.render.RShouLiuDan; +import icbm.zhapin.render.RSuiPian; +import icbm.zhapin.render.RXiaoFaSheQi; +import icbm.zhapin.render.RYinDaoQi; +import icbm.zhapin.render.RSMine; +import icbm.zhapin.render.RZhaPin; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.EExplosive; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.TExplosive; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityDiggingFX; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderMinecart; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.gui.IUpdatePlayerListBox; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; +import universalelectricity.core.vector.Vector3; + +@SideOnly(Side.CLIENT) +public class ClientProxy extends CommonProxy { + @Override + public void preInit() { + FMLCommonHandler.instance().bus().register(new TickHandler()); + } + + @Override + public void init() { + super.init(); + MinecraftForgeClient.registerItemRenderer( + ICBMExplosion.itFaSheQi, (IItemRenderer) new RItRocketLauncher()); + MinecraftForgeClient.registerItemRenderer(ICBMExplosion.itDaoDan, + (IItemRenderer) new RItDaoDan()); + MinecraftForgeClient.registerItemRenderer(ICBMExplosion.itTeBieDaoDan, + (IItemRenderer) new RItDaoDan()); + RenderingRegistry.registerBlockHandler( + (ISimpleBlockRenderingHandler) new RHZhaPin()); + RenderingRegistry.registerBlockHandler( + (ISimpleBlockRenderingHandler) new RHJiQi()); + RenderingRegistry.registerEntityRenderingHandler(EExplosive.class, + (Render) new REZhaDan()); + RenderingRegistry.registerEntityRenderingHandler( + EMissile.class, (Render) new RMissile(0.5f)); + RenderingRegistry.registerEntityRenderingHandler(EExplosion.class, + (Render) new RZhaPin()); + RenderingRegistry.registerEntityRenderingHandler(EGravityBlock.class, + (Render) new RFeiBlock()); + RenderingRegistry.registerEntityRenderingHandler(ELightBeam.class, + (Render) new RGuangBang()); + RenderingRegistry.registerEntityRenderingHandler(ESuiPian.class, + (Render) new RSuiPian()); + RenderingRegistry.registerEntityRenderingHandler( + EGrenade.class, (Render) new RShouLiuDan()); + RenderingRegistry.registerEntityRenderingHandler( + ECart.class, (Render) new RenderMinecart()); + ClientRegistry.bindTileEntitySpecialRenderer( + TCruiseLauncher.class, (TileEntitySpecialRenderer) new RXiaoFaSheQi()); + ClientRegistry.bindTileEntitySpecialRenderer( + TLauncherPlatform.class, (TileEntitySpecialRenderer) new RFaSheDi()); + ClientRegistry.bindTileEntitySpecialRenderer( + TLauncherControlPanel.class, (TileEntitySpecialRenderer) new RLauncherControlPanel()); + ClientRegistry.bindTileEntitySpecialRenderer( + TLauncher.class, (TileEntitySpecialRenderer) new RFaSheJia()); + ClientRegistry.bindTileEntitySpecialRenderer( + TRadarTower.class, (TileEntitySpecialRenderer) new RRadarTower()); + ClientRegistry.bindTileEntitySpecialRenderer( + TEmpTower.class, (TileEntitySpecialRenderer) new REmpTower()); + ClientRegistry.bindTileEntitySpecialRenderer( + TExplosive.class, (TileEntitySpecialRenderer) new RSMine()); + ClientRegistry.bindTileEntitySpecialRenderer( + TMissileCoordinator.class, (TileEntitySpecialRenderer) new RYinDaoQi()); + } + + @Override + public Object getClientGuiElement(final int ID, + final EntityPlayer entityPlayer, + final World world, final int x, final int y, + final int z) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null || ID == 5) { + switch (ID) { + case 1: { + return new GXiaoFaSheQi(entityPlayer.inventory, + (TCruiseLauncher) tileEntity); + } + case 2: { + return new GMissileLauncher((TLauncherControlPanel) tileEntity); + } + case 3: { + return new GRadarTower((TRadarTower) tileEntity); + } + case 6: { + return new GEmpTower((TEmpTower) tileEntity); + } + case 7: { + return new GFaSheDi(entityPlayer.inventory, + (TLauncherPlatform) tileEntity); + } + } + } + return null; + } + + @Override + public boolean isGaoQing() { + return Minecraft.getMinecraft().gameSettings.fancyGraphics; + } + + @Override + public int getParticleSetting() { + return Minecraft.getMinecraft().gameSettings.particleSetting; + } + + @Override + public void spawnParticle(final String name, final World world, final Vector3 position, + final double motionX, final double motionY, + final double motionZ, final float red, final float green, + final float blue, final float scale, final double distance) { + EntityFX fx = null; + if (name == "smoke") { + fx = (EntityFX) new FXSmoke(world, position, red, green, blue, scale, + distance); + } else if (name == "missile_smoke") { + fx = (EntityFX) new FXSmoke(world, position, red, green, blue, scale, + distance) + .setAge(100); + } else if (name == "portal") { + fx = (EntityFX) new FXPortal(world, position, red, green, blue, scale, + distance); + } else if (name == "antimatter") { + fx = new FXAntimatter(world, position, red, green, blue, scale, distance); + } else if (name == "digging") { + fx = (EntityFX) new EntityDiggingFX( + world, position.x, position.y, position.z, motionX, motionY, motionZ, + Block.getBlockById((int) red), 0, (int) green); + fx.multipleParticleScaleBy(blue); + } else if (name == "shockwave") { + fx = new FXShockwave(world, position, red, green, blue, scale, distance); + } + if (fx != null) { + ((Entity) fx).motionX = motionX; + ((Entity) fx).motionY = motionY; + ((Entity) fx).motionZ = motionZ; + FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx); + } + } + + @Override + public IUpdatePlayerListBox getDaoDanShengYin(final EMissile eDaoDan) { + // return (IUpdatePlayerListBox) new MissileSound( + // Minecraft.getMinecraft().sndManager, eDaoDan, + // (EntityPlayerSP)Minecraft.getMinecraft().thePlayer); + + return null; + } +} diff --git a/src/main/java/icbm/zhapin/CommonProxy.java b/src/main/java/icbm/zhapin/CommonProxy.java new file mode 100644 index 0000000..3bcb556 --- /dev/null +++ b/src/main/java/icbm/zhapin/CommonProxy.java @@ -0,0 +1,97 @@ +package icbm.zhapin; + +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.jiqi.TCruiseLauncher; +import icbm.zhapin.jiqi.TEmpTower; +import icbm.zhapin.jiqi.TLauncher; +import icbm.zhapin.jiqi.TLauncherPlatform; +import icbm.zhapin.jiqi.TMissileCoordinator; +import icbm.zhapin.jiqi.TLauncherControlPanel; +import icbm.zhapin.jiqi.TRadarTower; +import icbm.zhapin.rongqi.CFaShiDi; +import icbm.zhapin.rongqi.CXiaoFaSheQi; +import icbm.zhapin.zhapin.TExplosive; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.gui.IUpdatePlayerListBox; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class CommonProxy implements IGuiHandler { + public void preInit() { + } + + public void init() { + GameRegistry.registerTileEntity(TCruiseLauncher.class, + "ICBMCruiseLauncher"); + GameRegistry.registerTileEntity(TLauncherPlatform.class, + "ICBMLauncherPlatform"); + GameRegistry.registerTileEntity(TLauncherControlPanel.class, + "ICBMMissileLauncher"); + GameRegistry.registerTileEntity(TLauncher.class, "ICBMLauncher"); + GameRegistry.registerTileEntity(TRadarTower.class, "ICBMRadarTower"); + GameRegistry.registerTileEntity(TEmpTower.class, "ICBMEmpTower"); + GameRegistry.registerTileEntity(TMissileCoordinator.class, + "ICBMMissileCoordinator"); + GameRegistry.registerTileEntity(TExplosive.class, "ICBMExplosive"); + } + + public Object getClientGuiElement(final int ID, final EntityPlayer player, + final World world, final int x, final int y, + final int z) { + return null; + } + + public Object getServerGuiElement(final int ID, final EntityPlayer player, + final World world, final int x, final int y, + final int z) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + switch (ID) { + case 1: { + return new CXiaoFaSheQi(player.inventory, (TCruiseLauncher) tileEntity); + } + case 7: { + return new CFaShiDi(player.inventory, (TLauncherPlatform) tileEntity); + } + } + } + return null; + } + + public boolean isGaoQing() { + return false; + } + + public void spawnParticle(final String name, final World world, + final Vector3 position, final float scale, + final double distance) { + this.spawnParticle(name, world, position, 0.0, 0.0, 0.0, scale, distance); + } + + public void spawnParticle(final String name, final World world, + final Vector3 position, final double motionX, + final double motionY, final double motionZ, + final float scale, final double distance) { + this.spawnParticle(name, world, position, motionX, motionY, motionZ, 1.0f, + 1.0f, 1.0f, scale, distance); + } + + public void spawnParticle(final String name, final World world, + final Vector3 position, final double motionX, + final double motionY, final double motionZ, + final float red, final float green, + final float blue, final float scale, + final double distance) { + } + + public IUpdatePlayerListBox getDaoDanShengYin(final EMissile eDaoDan) { + return null; + } + + public int getParticleSetting() { + return -1; + } +} diff --git a/src/main/java/icbm/zhapin/Du.java b/src/main/java/icbm/zhapin/Du.java new file mode 100644 index 0000000..77488c0 --- /dev/null +++ b/src/main/java/icbm/zhapin/Du.java @@ -0,0 +1,44 @@ +package icbm.zhapin; + +import atomicscience.api.poison.Poison; +import icbm.zhapin.po.PChuanRanDu; +import icbm.zhapin.po.PDaDu; +import java.util.EnumSet; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.potion.CustomPotionEffect; + +public class Du extends Poison { + private boolean isContagious; + + public Du(final String name, final int id, final boolean isContagious) { + super(name, id); + this.isContagious = isContagious; + } + + @Override + protected void doPoisonEntity(final Vector3 emitPosition, + final EntityLivingBase entity, + final EnumSet armorWorn, + final int amplifier) { + if (this.isContagious) { + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + PChuanRanDu.INSTANCE.getId(), 900, amplifier, null)); + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.blindness.id, 300, amplifier)); + } else { + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + PDaDu.INSTANCE.getId(), 600, amplifier, null)); + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.confusion.id, 600, amplifier)); + } + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.hunger.id, 600, amplifier)); + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.weakness.id, 700, amplifier)); + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.digSlowdown.id, 1200, amplifier)); + } +} diff --git a/src/main/java/icbm/zhapin/EGravityBlock.java b/src/main/java/icbm/zhapin/EGravityBlock.java new file mode 100644 index 0000000..14fb3b9 --- /dev/null +++ b/src/main/java/icbm/zhapin/EGravityBlock.java @@ -0,0 +1,175 @@ +package icbm.zhapin; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.core.MainBase; +import io.netty.buffer.ByteBuf; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class EGravityBlock + extends Entity implements IEntityAdditionalSpawnData { + public Block block; + public int metadata; + public float yawChange; + public float pitchChange; + public float gravity; + + public EGravityBlock(final World world) { + super(world); + this.block = Blocks.air; + this.metadata = 0; + this.yawChange = 0.0f; + this.pitchChange = 0.0f; + this.gravity = 0.045f; + super.ticksExisted = 0; + super.preventEntitySpawning = true; + super.isImmuneToFire = true; + this.setSize(1.0f, 1.0f); + } + + public EGravityBlock(final World world, final Vector3 position, + final Block block, final int metadata) { + super(world); + this.yawChange = 0.0f; + this.pitchChange = 0.0f; + this.gravity = 0.045f; + super.isImmuneToFire = true; + super.ticksExisted = 0; + this.setSize(0.98f, 0.98f); + super.yOffset = super.height / 2.0f; + this.setPosition(position.x + 0.5, position.y, position.z + 0.5); + super.motionX = 0.0; + super.motionY = 0.0; + super.motionZ = 0.0; + this.block = block; + this.metadata = metadata; + } + + public EGravityBlock(final World world, final Vector3 position, + final Block block, final int metadata, + final float gravity) { + this(world, position, block, metadata); + this.gravity = gravity; + } + + @Override + public String getCommandSenderName() { + return "Flying Block"; + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeInt(Block.getIdFromBlock(this.block)); + data.writeInt(this.metadata); + data.writeFloat(this.gravity); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.block = Block.getBlockById(data.readInt()); + this.metadata = data.readInt(); + this.gravity = data.readFloat(); + } + + @Override + protected void entityInit() { + } + + @Override + public void onUpdate() { + if (super.posY > 400.0 || this.block == null || + this.block == MainBase.bJia || this.block == Blocks.piston_head || + this.block == Blocks.flowing_water || + this.block == Blocks.flowing_lava) { + this.setDead(); + return; + } + super.motionY -= this.gravity; + if (super.isCollided) { + this.func_145771_j( + super.posX, (super.boundingBox.minY + super.boundingBox.maxY) / 2.0, + super.posZ); + } + this.moveEntity(super.motionX, super.motionY, super.motionZ); + if (this.yawChange > 0.0f) { + super.rotationYaw += this.yawChange; + this.yawChange -= 2.0f; + } + if (this.pitchChange > 0.0f) { + super.rotationPitch += this.pitchChange; + this.pitchChange -= 2.0f; + } + if ((super.onGround && super.ticksExisted > 20) || + super.ticksExisted > 2400) { + this.setBlock(); + return; + } + ++super.ticksExisted; + } + + public void setBlock() { + if (!super.worldObj.isRemote) { + final int i = MathHelper.floor_double(super.posX); + final int j = MathHelper.floor_double(super.posY); + final int k = MathHelper.floor_double(super.posZ); + super.worldObj.setBlock(i, j, k, this.block, this.metadata, 2); + } + this.setDead(); + } + + @Override + public AxisAlignedBB getCollisionBox(final Entity par1Entity) { + if (par1Entity instanceof EntityLiving && this.block != null && + !(this.block instanceof BlockLiquid) && + (super.motionX > 2.0 || super.motionY > 2.0 || super.motionZ > 2.0)) { + final int damage = (int) (1.2 * (Math.abs(super.motionX) + Math.abs(super.motionY) + + Math.abs(super.motionZ))); + ((EntityLiving) par1Entity) + .attackEntityFrom(DamageSource.fallingBlock, damage); + } + return null; + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("metadata", this.metadata); + nbttagcompound.setInteger("blockID", Block.getIdFromBlock(this.block)); + nbttagcompound.setFloat("gravity", this.gravity); + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound nbttagcompound) { + this.metadata = nbttagcompound.getInteger("metadata"); + this.block = Block.getBlockById(nbttagcompound.getInteger("blockID")); + this.gravity = nbttagcompound.getFloat("gravity"); + } + + @Override + public float getShadowSize() { + return 0.5f; + } + + @Override + public boolean canBePushed() { + return true; + } + + @Override + protected boolean canTriggerWalking() { + return true; + } + + @Override + public boolean canBeCollidedWith() { + return true; + } +} diff --git a/src/main/java/icbm/zhapin/ELightBeam.java b/src/main/java/icbm/zhapin/ELightBeam.java new file mode 100644 index 0000000..411f620 --- /dev/null +++ b/src/main/java/icbm/zhapin/ELightBeam.java @@ -0,0 +1,92 @@ +package icbm.zhapin; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ELightBeam extends Entity implements IEntityAdditionalSpawnData { + private int life; + public float red; + public float green; + public float blue; + + public ELightBeam(final World world) { + super(world); + this.setSize(1.0f, 1.0f); + super.preventEntitySpawning = true; + super.ignoreFrustumCheck = true; + super.renderDistanceWeight = 3.0; + } + + public ELightBeam(final World world, final Vector3 position, final int life, + final float red, final float green, final float blue) { + super(world); + this.setPosition(position.x, position.y, position.z); + this.red = red; + this.green = green; + this.blue = blue; + this.life = life; + } + + @Override + public String getCommandSenderName() { + return "Light Beam"; + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeInt(this.life); + data.writeFloat(this.red); + data.writeFloat(this.green); + data.writeFloat(this.blue); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.life = data.readInt(); + this.red = data.readFloat(); + this.green = data.readFloat(); + this.blue = data.readFloat(); + } + + @Override + protected void entityInit() {} + + @Override + public void onUpdate() { + if (this.life > 0) { + --this.life; + } else { + this.setDead(); + } + } + + @Override + public float getShadowSize() { + return 0.0f; + } + + @Override + public boolean canBePushed() { + return false; + } + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + public boolean canBeCollidedWith() { + return false; + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound var1) {} + + @Override + protected void writeEntityToNBT(final NBTTagCompound var1) {} +} diff --git a/src/main/java/icbm/zhapin/ESuiPian.java b/src/main/java/icbm/zhapin/ESuiPian.java new file mode 100644 index 0000000..aa27c74 --- /dev/null +++ b/src/main/java/icbm/zhapin/ESuiPian.java @@ -0,0 +1,426 @@ +package icbm.zhapin; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import io.netty.buffer.ByteBuf; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class ESuiPian + extends EntityArrow implements IEntityAdditionalSpawnData { + private int xTile; + private int yTile; + private int zTile; + private Block inTile; + private int inData; + private boolean inGround; + public boolean doesArrowBelongToPlayer; + public boolean isExplosive; + public boolean isAnvil; + private boolean isExploding; + public int arrowShake; + private int ticksInAir; + private int knowBackStrength; + public boolean arrowCritical; + public float explosionSize; + + public ESuiPian(final World par1World) { + super(par1World); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.inTile = Blocks.air; + this.inData = 0; + this.inGround = false; + this.doesArrowBelongToPlayer = false; + this.isExploding = false; + this.arrowShake = 0; + this.ticksInAir = 0; + this.arrowCritical = false; + this.explosionSize = 1.5f; + this.setSize(0.5f, 0.5f); + } + + public ESuiPian(final World par1World, final double x, final double y, + final double z, final boolean isExplosive, + final boolean isAnvil) { + super(par1World); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.inTile = Blocks.air; + this.inData = 0; + this.inGround = false; + this.doesArrowBelongToPlayer = false; + this.isExploding = false; + this.arrowShake = 0; + this.ticksInAir = 0; + this.arrowCritical = false; + this.explosionSize = 1.5f; + this.setPosition(x, y, z); + super.yOffset = 0.0f; + this.isExplosive = isExplosive; + this.isAnvil = isAnvil; + if (this.isAnvil) { + this.setSize(1.0f, 1.0f); + } else { + this.setSize(0.5f, 0.5f); + } + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeBoolean(this.isExplosive); + data.writeBoolean(this.isAnvil); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.isExplosive = data.readBoolean(); + this.isAnvil = data.readBoolean(); + } + + @Override + protected void entityInit() { + } + + @Override + public String getCommandSenderName() { + return "Fragments"; + } + + @Override + public void setThrowableHeading(double par1, double par3, double par5, + final float par7, final float par8) { + final float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + par1 /= var9; + par3 /= var9; + par5 /= var9; + par1 += super.rand.nextGaussian() * 0.007499999832361937 * par8; + par3 += super.rand.nextGaussian() * 0.007499999832361937 * par8; + par5 += super.rand.nextGaussian() * 0.007499999832361937 * par8; + par1 *= par7; + par3 *= par7; + par5 *= par7; + super.motionX = par1; + super.motionY = par3; + super.motionZ = par5; + final float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + final float n = (float) (Math.atan2(par1, par5) * 180.0 / 3.141592653589793); + super.rotationYaw = n; + super.prevRotationYaw = n; + final float n2 = (float) (Math.atan2(par3, var10) * 180.0 / 3.141592653589793); + super.rotationPitch = n2; + super.prevRotationPitch = n2; + } + + @Override + public void setVelocity(final double par1, final double par3, + final double par5) { + super.motionX = par1; + super.motionY = par3; + super.motionZ = par5; + if (super.prevRotationPitch == 0.0f && super.prevRotationYaw == 0.0f) { + final float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + final float n = (float) (Math.atan2(par1, par5) * 180.0 / 3.141592653589793); + super.rotationYaw = n; + super.prevRotationYaw = n; + final float n2 = (float) (Math.atan2(par3, var7) * 180.0 / 3.141592653589793); + super.rotationPitch = n2; + super.prevRotationPitch = n2; + super.prevRotationPitch = super.rotationPitch; + super.prevRotationYaw = super.rotationYaw; + this.setLocationAndAngles(super.posX, super.posY, super.posZ, + super.rotationYaw, super.rotationPitch); + } + } + + private void explode() { + if (!this.isExploding && !super.worldObj.isRemote) { + this.isExploding = true; + super.worldObj.createExplosion((Entity) this, (double) this.xTile, + (double) this.yTile, (double) this.zTile, + this.explosionSize, true); + this.setDead(); + } + } + + @Override + public void onUpdate() { + //super.onUpdate(); + if (this.isAnvil) { + final ArrayList entities = new ArrayList<>(super.worldObj.getEntitiesWithinAABBExcludingEntity( + this, super.boundingBox)); + for (final Entity entity : entities) { + entity.attackEntityFrom(DamageSource.anvil, 15); + } + } + if (super.prevRotationPitch == 0.0f && super.prevRotationYaw == 0.0f) { + final float var6 = MathHelper.sqrt_double(super.motionX * super.motionX + + super.motionZ * super.motionZ); + final float n = (float) (Math.atan2(super.motionX, super.motionZ) * 180.0 / + 3.141592653589793); + super.rotationYaw = n; + super.prevRotationYaw = n; + final float n2 = (float) (Math.atan2(super.motionY, var6) * 180.0 / 3.141592653589793); + super.rotationPitch = n2; + super.prevRotationPitch = n2; + } + Block var7 = super.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + if (var7 != Blocks.air) { + var7.setBlockBoundsBasedOnState((IBlockAccess) super.worldObj, this.xTile, + this.yTile, this.zTile); + final AxisAlignedBB var8 = var7.getCollisionBoundingBoxFromPool( + super.worldObj, this.xTile, this.yTile, this.zTile); + if (var8 != null && var8.isVecInside(Vec3.createVectorHelper( + super.posX, super.posY, super.posZ))) { + this.inGround = true; + } + } + if (this.arrowShake > 0) { + --this.arrowShake; + } + if (this.inGround) { + var7 = super.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + final int var9 = super.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + if (var7 == this.inTile && var9 == this.inData) { + if (this.isExplosive) { + this.explode(); + } else { + if (this.isAnvil && super.worldObj.rand.nextFloat() > 0.5f) { + super.worldObj.playAuxSFX(1022, (int) super.posX, (int) super.posY, + (int) super.posZ, 0); + } + this.setDead(); + } + } else { + this.inGround = false; + super.motionX *= super.rand.nextFloat() * 0.2f; + super.motionY *= super.rand.nextFloat() * 0.2f; + super.motionZ *= super.rand.nextFloat() * 0.2f; + this.ticksInAir = 0; + } + } else { + ++this.ticksInAir; + Vec3 var10 = Vec3.createVectorHelper(super.posX, super.posY, super.posZ); + Vec3 var11 = Vec3.createVectorHelper(super.posX + super.motionX, + super.posY + super.motionY, + super.posZ + super.motionZ); + // TODO: false? true? + MovingObjectPosition movingObjPos = super.worldObj.rayTraceBlocks(var10, var11, false); + var10 = Vec3.createVectorHelper(super.posX, super.posY, super.posZ); + var11 = Vec3.createVectorHelper(super.posX + super.motionX, + super.posY + super.motionY, + super.posZ + super.motionZ); + if (movingObjPos != null) { + var11 = Vec3.createVectorHelper(movingObjPos.hitVec.xCoord, + movingObjPos.hitVec.yCoord, + movingObjPos.hitVec.zCoord); + } + Entity var12 = null; + final List var13 = super.worldObj.getEntitiesWithinAABBExcludingEntity( + (Entity) this, + super.boundingBox + .addCoord(super.motionX, super.motionY, super.motionZ) + .expand(1.0, 1.0, 1.0)); + double var14 = 0.0; + for (int var15 = 0; var15 < var13.size(); ++var15) { + final Entity var16 = var13.get(var15); + if (var16.canBeCollidedWith() && this.ticksInAir >= 5) { + final float var17 = 0.3f; + final AxisAlignedBB var18 = var16.boundingBox.expand( + (double) var17, (double) var17, (double) var17); + final MovingObjectPosition var19 = var18.calculateIntercept(var10, var11); + if (var19 != null) { + final double var20 = var10.distanceTo(var19.hitVec); + if (var20 < var14 || var14 == 0.0) { + var12 = var16; + var14 = var20; + } + } + } + } + if (var12 != null) { + movingObjPos = new MovingObjectPosition(var12); + } + if (movingObjPos != null) { + if (movingObjPos.entityHit != null) { + final float sqrt_double; + final float speed = sqrt_double = MathHelper.sqrt_double( + super.motionX * super.motionX + super.motionY * super.motionY + + super.motionZ * super.motionZ); + this.getClass(); + int damage = (int) Math.ceil(sqrt_double * 11.0f); + if (this.arrowCritical) { + damage += super.rand.nextInt(damage / 2 + 2); + } + final DamageSource damageSource = new EntityDamageSourceIndirect("arrow", (Entity) this, + (Entity) this) + .setProjectile(); + if (this.isBurning()) { + movingObjPos.entityHit.setFire(5); + } + if (movingObjPos.entityHit.attackEntityFrom(damageSource, damage)) { + if (movingObjPos.entityHit instanceof EntityLiving) { + final EntityLiving var21 = (EntityLiving) movingObjPos.entityHit; + if (!super.worldObj.isRemote) { + var21.setArrowCountInEntity(var21.getArrowCountInEntity() + 1); + } + if (this.knowBackStrength > 0) { + final float var22 = MathHelper.sqrt_double(super.motionX * super.motionX + + super.motionZ * super.motionZ); + if (var22 > 0.0f) { + movingObjPos.entityHit.addVelocity( + super.motionX * this.knowBackStrength * + 0.6000000238418579 / var22, + 0.1, + super.motionZ * this.knowBackStrength * + 0.6000000238418579 / var22); + } + } + } + super.worldObj.playSoundAtEntity( + (Entity) this, "random.bowhit", 1.0f, + 1.2f / (super.rand.nextFloat() * 0.2f + 0.9f)); + this.setDead(); + } else { + super.motionX *= -0.10000000149011612; + super.motionY *= -0.10000000149011612; + super.motionZ *= -0.10000000149011612; + super.rotationYaw += 180.0f; + super.prevRotationYaw += 180.0f; + this.ticksInAir = 0; + } + } else { + this.xTile = movingObjPos.blockX; + this.yTile = movingObjPos.blockY; + this.zTile = movingObjPos.blockZ; + this.inTile = super.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + this.inData = super.worldObj.getBlockMetadata(this.xTile, this.yTile, + this.zTile); + super.motionX = (float) (movingObjPos.hitVec.xCoord - super.posX); + super.motionY = (float) (movingObjPos.hitVec.yCoord - super.posY); + super.motionZ = (float) (movingObjPos.hitVec.zCoord - super.posZ); + final float speed = MathHelper.sqrt_double( + super.motionX * super.motionX + super.motionY * super.motionY + + super.motionZ * super.motionZ); + super.posX -= super.motionX / speed * 0.05000000074505806; + super.posY -= super.motionY / speed * 0.05000000074505806; + super.posZ -= super.motionZ / speed * 0.05000000074505806; + super.worldObj.playSoundAtEntity( + (Entity) this, "random.bowhit", 1.0f, + 1.2f / (super.rand.nextFloat() * 0.2f + 0.9f)); + this.inGround = true; + this.arrowShake = 7; + this.arrowCritical = false; + } + } + if (this.arrowCritical) { + for (int var15 = 0; var15 < 4; ++var15) { + super.worldObj.spawnParticle( + "crit", super.posX + super.motionX * var15 / 4.0, + super.posY + super.motionY * var15 / 4.0, + super.posZ + super.motionZ * var15 / 4.0, -super.motionX, + -super.motionY + 0.2, -super.motionZ); + } + } + super.posX += super.motionX; + super.posY += super.motionY; + super.posZ += super.motionZ; + final float speed = MathHelper.sqrt_double(super.motionX * super.motionX + + super.motionZ * super.motionZ); + super.rotationYaw = (float) (Math.atan2(super.motionX, super.motionZ) * + 180.0 / 3.141592653589793); + super.rotationPitch = (float) (Math.atan2(super.motionY, speed) * 180.0 / 3.141592653589793); + while (super.rotationPitch - super.prevRotationPitch < -180.0f) { + super.prevRotationPitch -= 360.0f; + } + while (super.rotationPitch - super.prevRotationPitch >= 180.0f) { + super.prevRotationPitch += 360.0f; + } + while (super.rotationYaw - super.prevRotationYaw < -180.0f) { + super.prevRotationYaw -= 360.0f; + } + while (super.rotationYaw - super.prevRotationYaw >= 180.0f) { + super.prevRotationYaw += 360.0f; + } + super.rotationPitch = super.prevRotationPitch + + (super.rotationPitch - super.prevRotationPitch) * 0.2f; + super.rotationYaw = super.prevRotationYaw + + (super.rotationYaw - super.prevRotationYaw) * 0.2f; + float var23 = 0.99f; + final float var17 = 0.05f; + if (this.isInWater()) { + for (int var24 = 0; var24 < 4; ++var24) { + final float var25 = 0.25f; + super.worldObj.spawnParticle( + "bubble", super.posX - super.motionX * var25, + super.posY - super.motionY * var25, + super.posZ - super.motionZ * var25, super.motionX, super.motionY, + super.motionZ); + } + var23 = 0.8f; + } + super.motionX *= var23; + super.motionY *= var23; + super.motionZ *= var23; + super.motionY -= var17; + this.setPosition(super.posX, super.posY, super.posZ); + } + } + + @Override + public void writeEntityToNBT(final NBTTagCompound par1NBTTagCompound) { + par1NBTTagCompound.setShort("xTile", (short) this.xTile); + par1NBTTagCompound.setShort("yTile", (short) this.yTile); + par1NBTTagCompound.setShort("zTile", (short) this.zTile); + par1NBTTagCompound.setInteger("inTile", Block.getIdFromBlock(this.inTile)); + par1NBTTagCompound.setByte("inData", (byte) this.inData); + par1NBTTagCompound.setByte("shake", (byte) this.arrowShake); + par1NBTTagCompound.setByte("inGround", (byte) (byte) (this.inGround ? 1 : 0)); + par1NBTTagCompound.setBoolean("isExplosive", this.isExplosive); + } + + @Override + public void readEntityFromNBT(final NBTTagCompound par1NBTTagCompound) { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = Block.getBlockById(par1NBTTagCompound.getInteger("inTile")); + this.inData = (par1NBTTagCompound.getByte("inData") & 0xFF); + this.arrowShake = (par1NBTTagCompound.getByte("shake") & 0xFF); + this.inGround = (par1NBTTagCompound.getByte("inGround") == 1); + this.isExplosive = par1NBTTagCompound.getBoolean("isExplosive"); + } + + @Override + public void applyEntityCollision(final Entity par1Entity) { + super.applyEntityCollision(par1Entity); + if (this.isExplosive && super.ticksExisted < 40) { + this.explode(); + } + } + + @Override + public float getShadowSize() { + return 0.0f; + } + + @Override + public boolean canAttackWithItem() { + return false; + } +} diff --git a/src/main/java/icbm/zhapin/ICBMCommand.java b/src/main/java/icbm/zhapin/ICBMCommand.java new file mode 100644 index 0000000..a08e96c --- /dev/null +++ b/src/main/java/icbm/zhapin/ICBMCommand.java @@ -0,0 +1,73 @@ +package icbm.zhapin; + +import icbm.zhapin.zhapin.EExplosion; +import java.util.Iterator; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentText; + +public class ICBMCommand extends CommandBase { + @Override + public String getCommandName() { + return "icbm"; + } + + @Override + public String getCommandUsage(final ICommandSender par1ICommandSender) { + return "/icbm lag "; + } + + @Override + public void processCommand(final ICommandSender sender, final String[] args) { + try { + final EntityPlayer entityPlayer = (EntityPlayer) sender; + final int dimension = ((Entity) entityPlayer).worldObj.getWorldInfo().getVanillaDimension(); + if (args[0].equalsIgnoreCase("lag")) { + final int radius = parseInt(sender, args[1]); + if (radius > 0 && radius < Integer.MAX_VALUE) { + final EntityPlayer player = (EntityPlayer) sender; + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + ((Entity) player).posX - radius, ((Entity) player).posY - radius, + ((Entity) player).posZ - radius, ((Entity) player).posX + radius, + ((Entity) player).posY + radius, ((Entity) player).posZ + radius); + final List entitiesNearby = player.worldObj.getEntitiesWithinAABB(Entity.class, bounds); + for (final Entity entity : entitiesNearby) { + if (entity instanceof EGravityBlock) { + ((EGravityBlock) entity).setBlock(); + } else { + if (!(entity instanceof EExplosion)) { + continue; + } + entity.setDead(); + } + } + sender.addChatMessage(new ChatComponentText( + "Removed all ICBM lag sources within " + radius + " radius.")); + return; + } + throw new WrongUsageException("Radius not within range.", + new Object[0]); + } + } catch (final Exception ex) { + } + throw new WrongUsageException(this.getCommandUsage(sender), new Object[0]); + } + + @Override + public int getRequiredPermissionLevel() { + return 2; + } + + @Override + public List addTabCompletionOptions(final ICommandSender sender, + final String[] args) { + return (args.length == 1) + ? getListOfStringsMatchingLastWord(args, new String[] { "lag" }) + : null; + } +} diff --git a/src/main/java/icbm/zhapin/ICBMExplosion.java b/src/main/java/icbm/zhapin/ICBMExplosion.java new file mode 100644 index 0000000..4280e2e --- /dev/null +++ b/src/main/java/icbm/zhapin/ICBMExplosion.java @@ -0,0 +1,554 @@ +package icbm.zhapin; + +import calclavia.lib.UniversalRecipes; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.ModMetadata; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +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.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import icbm.api.ICBM; +import icbm.api.ICBMFlags; +import icbm.core.ICBMTab; +import icbm.core.MainBase; +import icbm.zhapin.cart.ECart; +import icbm.zhapin.cart.ItCart; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.daodan.ItMissile; +import icbm.zhapin.daodan.ItModuleMissile; +import icbm.zhapin.daodan.MissileBase; +import icbm.zhapin.dianqi.ItDefuser; +import icbm.zhapin.dianqi.ItLaserDesignator; +import icbm.zhapin.dianqi.ItRadarGun; +import icbm.zhapin.dianqi.ItRemoteDetonator; +import icbm.zhapin.dianqi.ItRocketLauncher; +import icbm.zhapin.jiqi.BMachine; +import icbm.zhapin.jiqi.IBMachine; +import icbm.zhapin.po.PChuanRanDu; +import icbm.zhapin.po.PDaDu; +import icbm.zhapin.po.PDongShang; +import icbm.zhapin.zhapin.BExplosives; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.EExplosive; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.IBExplosive; +import icbm.zhapin.zhapin.ItGrenade; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDispenser; +import net.minecraft.block.BlockRailBase; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandManager; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; +import universalelectricity.core.item.ElectricItemHelper; +import universalelectricity.core.item.ItemElectric; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; +import universalelectricity.prefab.flag.FlagRegistry; + +@Mod(modid = "ICBM|Explosion", name = "ICBM|Explosion", version = "1.2.1", + dependencies = "after:ICBM|Sentry;required-after:AtomicScience", useMetadata = true) +public class ICBMExplosion extends MainBase { + public static final String NAME = "ICBM|Explosion"; + public static final String CHANNEL = "ICBM|E"; + @Mod.Instance("ICBM|Explosion") public static ICBMExplosion instance; + @Mod.Metadata("ICBM|Explosion") public static ModMetadata metadata; + @SidedProxy(clientSide = "icbm.zhapin.ClientProxy", + serverSide = "icbm.zhapin.CommonProxy") + public static CommonProxy proxy; + public static Item Du; + public static final int ENTITY_ID_PREFIX = 50; + public static Block bExplosives; + public static Block bJiQi; + public static Item itDaoDan; + public static Item itTeBieDaoDan; + public static ItemElectric itJieJa; + public static ItemElectric itLeiDaQiang; + public static ItemElectric itYaoKong; + public static ItemElectric itLeiSheZhiBiao; + public static ItemElectric itFaSheQi; + public static Item itShouLiuDan; + public static Item itChe; + public static final Du DU_DU; + public static final Du DU_CHUAN_RAN; + public static boolean USE_FUEL; + public static SimpleNetworkWrapper channel; + + @Mod.EventHandler + @Override + public void preInit(final FMLPreInitializationEvent event) { + super.preInit(event); + NetworkRegistry.INSTANCE.registerGuiHandler( + (Object)this, (IGuiHandler)ICBMExplosion.proxy); + MainBase.CONFIGURATION.load(); + ICBMExplosion.USE_FUEL = + MainBase.CONFIGURATION + .get("general", "Use Fuel", ICBMExplosion.USE_FUEL) + .getBoolean(ICBMExplosion.USE_FUEL); + ICBMExplosion.bExplosives = (Block) new BExplosives(); + ICBMExplosion.bJiQi = (Block) new BMachine(); + ICBMExplosion.itDaoDan = new ItMissile("missile"); + ICBMExplosion.itTeBieDaoDan = new ItModuleMissile(); + ICBMExplosion.itJieJa = new ItDefuser(); + ICBMExplosion.itLeiDaQiang = new ItRadarGun(); + ICBMExplosion.itYaoKong = new ItRemoteDetonator(); + ICBMExplosion.itLeiSheZhiBiao = new ItLaserDesignator(); + ICBMExplosion.itFaSheQi = new ItRocketLauncher(); + ICBMExplosion.itShouLiuDan = new ItGrenade(); + ICBMExplosion.itChe = new ItCart(); + PDaDu.INSTANCE = new PDaDu(22, true, 5149489, "toxin"); + PChuanRanDu.INSTANCE = new PChuanRanDu(23, false, 5149489, "virus"); + PDongShang.INSTANCE = new PDongShang(24, false, 5149489, "frostBite"); + MainBase.CONFIGURATION.save(); + BlockDispenser.dispenseBehaviorRegistry.putObject( + (Object)ICBMExplosion.itShouLiuDan, + (Object) new IBehaviorDispenseItem() { + public ItemStack dispense(final IBlockSource blockSource, + final ItemStack itemStack) { + final World world = blockSource.getWorld(); + if (!world.isRemote) { + final int x = blockSource.getXInt(); + final int y = blockSource.getYInt(); + final int z = blockSource.getZInt(); + final EnumFacing enumFacing = + EnumFacing.getFront(blockSource.getBlockMetadata()); + final EGrenade entity = new EGrenade(world, new Vector3(x, y, z), + itemStack.getItemDamage()); + entity.setThrowableHeading( + enumFacing.getFrontOffsetX(), 0.10000000149011612, + enumFacing.getFrontOffsetZ(), 0.5f, 1.0f); + world.spawnEntityInWorld((Entity)entity); + } + --itemStack.stackSize; + return itemStack; + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject( + (Object)ICBMExplosion.itChe, (Object) new IBehaviorDispenseItem() { + private final BehaviorDefaultDispenseItem + defaultItemDispenseBehavior = new BehaviorDefaultDispenseItem(); + + public ItemStack dispense(final IBlockSource blockSource, + final ItemStack itemStack) { + final World world = blockSource.getWorld(); + if (!world.isRemote) { + final int x = blockSource.getXInt(); + final int y = blockSource.getYInt(); + final int z = blockSource.getZInt(); + final EnumFacing var3 = + EnumFacing.getFront(blockSource.getBlockMetadata()); + final World var4 = blockSource.getWorld(); + final double var5 = + blockSource.getX() + var3.getFrontOffsetX() * 1.125f; + final double var6 = blockSource.getY(); + final double var7 = + blockSource.getZ() + var3.getFrontOffsetZ() * 1.125f; + final int var8 = blockSource.getXInt() + var3.getFrontOffsetX(); + final int var9 = blockSource.getYInt(); + final int var10 = blockSource.getZInt() + var3.getFrontOffsetZ(); + final Block var11 = var4.getBlock(var8, var9, var10); + double var12; + if (BlockRailBase.func_150051_a(var11)) { + var12 = 0.0; + } else { + if (var11 != Blocks.air || + !BlockRailBase.func_150051_a( + var4.getBlock(var8, var9 - 1, var10))) { + return this.defaultItemDispenseBehavior.dispense(blockSource, + itemStack); + } + var12 = -1.0; + } + final ECart var13 = new ECart(world, var5, var6 + var12, var7, + itemStack.getItemDamage()); + world.spawnEntityInWorld((Entity)var13); + world.playAuxSFX(1000, x, y, z, 0); + } + --itemStack.stackSize; + return itemStack; + } + }); + GameRegistry.registerBlock(ICBMExplosion.bExplosives, IBExplosive.class, + "bExplosives"); + GameRegistry.registerBlock(ICBMExplosion.bJiQi, IBMachine.class, "bJiQi"); + ForgeChunkManager.setForcedChunkLoadingCallback( + (Object)this, + (ForgeChunkManager.LoadingCallback) new ForgeChunkManager + .LoadingCallback() { + public void ticketsLoaded(final List tickets, + final World world) { + for (final ForgeChunkManager.Ticket ticket : tickets) { + if (ticket.getEntity() != null) { + ((EMissile)ticket.getEntity()).daoDanInit(ticket); + } + } + } + }); + + GameRegistry.registerItem(itDaoDan, "icbm:itDaoDan"); + GameRegistry.registerItem(itTeBieDaoDan, "icbm:itTeBieDaoDan"); + GameRegistry.registerItem(itJieJa, "icbm:itJieJa"); + GameRegistry.registerItem(itLeiDaQiang, "icbm:itLeiDaQiang"); + GameRegistry.registerItem(itYaoKong, "icbm:itYaoKong"); + GameRegistry.registerItem(itLeiSheZhiBiao, "icbm:itLeiSheZhiBiao"); + GameRegistry.registerItem(itFaSheQi, "icbm:itFaSheQi"); + GameRegistry.registerItem(itShouLiuDan, "icbm:itShouLiuDan"); + GameRegistry.registerItem(itChe, "icbm:itChe"); + + ICBMTab.itemStack = new ItemStack(ICBMExplosion.bExplosives); + + ICBM.explosionManager = ZhaPin.class; + ICBMExplosion.proxy.preInit(); + + channel = NetworkRegistry.INSTANCE.newSimpleChannel("icbm_explosion"); + int pktId = 0; + channel.registerMessage(ItemUsePacketHandler.class, ItemUsePacket.class, + pktId++, Side.SERVER); + } + + @Mod.EventHandler + public void load(final FMLInitializationEvent evt) { + MainBase.setModMetadata("ICBM|Explosion", ICBMExplosion.metadata); + } + + @Mod.EventHandler + @Override + public void postInit(final FMLPostInitializationEvent event) { + super.postInit(event); + for (int i = 0; i < ZhaPin.list.length; ++i) { + if (ZhaPin.list[i] != null) { + ZhaPin.list[i].init(); + } + } + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + (Item)ICBMExplosion.itFaSheQi, + new Object[] {"SCR", "SB ", 'R', ICBMExplosion.itLeiDaQiang, 'C', + new ItemStack(ICBMExplosion.bJiQi, 1, + BMachine.JiQi.XiaoFaSheQi.ordinal() + 6), + 'B', Blocks.stone_button, 'S', "ingotSteel"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack((Item)ICBMExplosion.itLeiDaQiang), + new Object[] {"@#!", " $!", " !", '@', Blocks.glass, '!', "ingotSteel", + '#', "calclavia:CIRCUIT_T1", '$', Blocks.stone_button})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack((Item)ICBMExplosion.itYaoKong), + new Object[] {"?@@", "@#$", "@@@", '@', "ingotSteel", '?', + Items.redstone, '#', "calclavia:CIRCUIT_T2", '$', + Blocks.stone_button})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack((Item)ICBMExplosion.itLeiSheZhiBiao), + new Object[] { + "! ", " ? ", " @", '@', + ElectricItemHelper.getUncharged(ICBMExplosion.itYaoKong), '?', + "calclavia:CIRCUIT_T3", '!', + ElectricItemHelper.getUncharged(ICBMExplosion.itLeiDaQiang)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack((Item)ICBMExplosion.itJieJa), + new Object[] {"I ", " W ", " C", 'C', "calclavia:CIRCUIT_T2", 'W', + "calclavia:WRENCH", 'I', "calclavia:WIRE"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 0), + new Object[] {"! !", "!C!", "!!!", '!', "ingotBronze", 'C', + "calclavia:CIRCUIT_T1"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 1), + new Object[] {"! !", "!C!", "!@!", '@', + new ItemStack(ICBMExplosion.bJiQi, 1, 0), '!', + "ingotSteel", 'C', "calclavia:CIRCUIT_T2"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 2), + new Object[] {"! !", "!C!", "!@!", '@', + new ItemStack(ICBMExplosion.bJiQi, 1, 1), '!', + "plateSteel", 'C', "calclavia:CIRCUIT_T3"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 3), + new Object[] {"!!!", "!#!", "!?!", '#', "calclavia:CIRCUIT_T1", '!', + Blocks.glass, '?', "calclavia:WIRE"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 4), + new Object[] {"!$!", "!#!", "!?!", '#', "calclavia:CIRCUIT_T2", '!', + "ingotSteel", '?', "calclavia:WIRE", '$', + new ItemStack(ICBMExplosion.bJiQi, 1, 3)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 5), + new Object[] {"!$!", "!#!", "!?!", '#', "calclavia:CIRCUIT_T3", '!', + Items.gold_ingot, '?', "calclavia:WIRE", '$', + new ItemStack(ICBMExplosion.bJiQi, 1, 4)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 6), + new Object[] {"! !", "!!!", "! !", '!', "ingotBronze"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 7), + new Object[] {"! !", "!@!", "! !", '!', "ingotSteel", '@', + new ItemStack(ICBMExplosion.bJiQi, 1, 6)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 8), + new Object[] {"! !", "!@!", "! !", '!', "plateSteel", '@', + new ItemStack(ICBMExplosion.bJiQi, 1, 7)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 9), + new Object[] { + "?@?", " ! ", "!#!", '@', + ElectricItemHelper.getUncharged(ICBMExplosion.itLeiDaQiang), '!', + "plateSteel", '#', "calclavia:CIRCUIT_T1", '?', Items.gold_ingot})); + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 10), + new Object[] {"?W?", "@!@", "?#?", '?', "plateSteel", '!', + "calclavia:CIRCUIT_T3", '@', + UniversalRecipes.BATTERY_BOX, '#', "calclavia:MOTOR", + 'W', "calclavia:WIRE"}), + "EMP Tower", MainBase.CONFIGURATION, true); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.bJiQi, 1, 11), + new Object[] {"?! ", "@@@", '@', "plateSteel", '!', + new ItemStack(ICBMExplosion.bJiQi, 1, 2), '?', + new ItemStack(ICBMExplosion.bJiQi, 1, 8)})); + // TODO: WTF + // try { + // if (FluidRegistry.getFluid("fuel") != null && + // ICBMExplosion.USE_FUEL) { + // for (final FluidContainerData data : + // FluidContainerRegistry.getRegisteredFluidContainerData()) { + // if (data.fluid != null && + // data.fluid.isLiquidEqual( + // FluidRegistry.getFluid("Fuel"))) { + // GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + // new ItemStack(ICBMExplosion.itTeBieDaoDan), + // new Object[] { " @ ", "@#@", "@?@", '@', + // "ingotSteel", '?', + // data.filled, '#', "calclavia:CIRCUIT_T1" + // })); + // } + // } + // } else if (LiquidDictionary.getLiquid("Oil", 1) != null && + // ICBMExplosion.USE_FUEL) { + // for (final LiquidContainerData data : + // LiquidContainerRegistry.getRegisteredLiquidContainerData()) { + // if (data.stillLiquid != null && + // data.stillLiquid.isLiquidEqual( + // LiquidDictionary.getLiquid("Oil", 1))) { + // GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + // new ItemStack(ICBMExplosion.itTeBieDaoDan), + // new Object[] { " @ ", "@#@", "@?@", '@', + // "ingotSteel", '?', + // data.filled, '#', "calclavia:CIRCUIT_T1" + // })); + // } + // } + // } else { + // } + // } catch (final Exception e) { + // FMLLog.severe("Failed to add missile module recipe!", new Object[0]); + // e.printStackTrace(); + // } + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itTeBieDaoDan), + new Object[] {" @ ", "@#@", "@?@", '@', "ingotSteel", '?', Items.coal, + '#', "calclavia:CIRCUIT_T1"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 1), + new Object[] {" B ", " C ", "BMB", 'M', + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 0), 'C', + "calclavia:CIRCUIT_T1", 'B', "ingotBronze"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 2), + new Object[] {"!", "?", "@", '@', + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 0), '?', + new ItemStack(ICBMExplosion.bExplosives, 1, 0), '!', + "calclavia:CIRCUIT_T1"})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 3), + new Object[] { + " ! ", " ? ", "!@!", '@', + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 0), '?', + MissileBase.list[ZhaPin.fragmentation.getID()].getItemStack(), '!', + new ItemStack(ICBMExplosion.itDaoDan, 1, 0)})); + GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 4), + new Object[] {" N ", "NCN", 'C', + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 3), 'N', + ZhaPin.nuclear.getItemStack()})); + for (int i = 0; i < ZhaPin.E_SI_ID; ++i) { + RecipeHelper.addRecipe( + (IRecipe) new ShapelessOreRecipe( + new ItemStack(ICBMExplosion.itDaoDan, 1, i), + new Object[] {new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, 0), + new ItemStack(ICBMExplosion.bExplosives, 1, i)}), + ZhaPin.list[i].getUnlocalizedName() + " Missile", + MainBase.CONFIGURATION, true); + if (i < ZhaPin.E_YI_ID) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itShouLiuDan, 1, i), + new Object[] {"?", "@", '@', + new ItemStack(ICBMExplosion.bExplosives, 1, i), + '?', Items.string}), + ZhaPin.list[i].getUnlocalizedName() + " Grenade", + MainBase.CONFIGURATION, true); + } + if (i < ZhaPin.E_ER_ID) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + new ItemStack(ICBMExplosion.itChe, 1, i), + new Object[] {"?", "@", '?', + new ItemStack(ICBMExplosion.bExplosives, 1, i), + '@', Items.minecart}), + ZhaPin.list[i].getUnlocalizedName() + " Minecart", + MainBase.CONFIGURATION, true); + } + } + EntityRegistry.registerGlobalEntityID( + EExplosive.class, "ICBMExplosive", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + EMissile.class, "ICBMMissile", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + EExplosion.class, "ICBMProceduralExplosion", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + EGravityBlock.class, "ICBMGravityBlock", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + ELightBeam.class, "ICBMLightBeam", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + ESuiPian.class, "ICBMFragment", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + EGrenade.class, "ICBMGrenade", + EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID( + ECart.class, "ICBMChe", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerModEntity(EExplosive.class, "ICBMExplosive", 50, + (Object)this, 50, 5, true); + EntityRegistry.registerModEntity(EMissile.class, "ICBMMissile", 51, + (Object)this, 500, 1, true); + EntityRegistry.registerModEntity(EExplosion.class, + "ICBMProceduralExplosion", 52, + (Object)this, 100, 5, true); + EntityRegistry.registerModEntity(EGravityBlock.class, "ICBMGravityBlock", + 53, (Object)this, 50, 15, true); + EntityRegistry.registerModEntity(ELightBeam.class, "ICBMLightBeam", 54, + (Object)this, 80, 5, true); + EntityRegistry.registerModEntity(ESuiPian.class, "ICBMFragment", 55, + (Object)this, 40, 8, true); + EntityRegistry.registerModEntity(EGrenade.class, "ICBMGrenade", 56, + (Object)this, 50, 5, true); + EntityRegistry.registerModEntity(ECart.class, "ICBMChe", 58, (Object)this, + 50, 4, true); + ICBMExplosion.proxy.init(); + } + + public static boolean shiBaoHu(final World world, final Vector3 diDian, + final ZhaPin.ZhaPinType type, + final ZhaPin zhaPin) { + if (FlagRegistry.getModFlag("ModFlags") == null) { + return false; + } + if (FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_GLOBAL, "true", diDian)) { + return true; + } + boolean baoHu = false; + switch (type) { + case QUAN_BU: { + baoHu = (FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_MINECART, "true", + diDian) || + FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_MISSILE, "true", + diDian) || + FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_GRENADE, "true", + diDian) || + FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_EXPLOSIVE, "true", + diDian)); + break; + } + case CHE: { + baoHu = FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_MINECART, "true", + diDian); + break; + } + case DAO_DAN: { + baoHu = + FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_MISSILE, "true", diDian); + break; + } + case SHOU_LIU_DAN: { + baoHu = + FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_GRENADE, "true", diDian); + break; + } + case ZHA_DAN: { + baoHu = FlagRegistry.getModFlag("ModFlags") + .containsValue(world, ICBMFlags.FLAG_BAN_EXPLOSIVE, "true", + diDian); + break; + } + } + return FlagRegistry.getModFlag("ModFlags") + .containsValue(world, zhaPin.qiZi, "true", diDian) || + baoHu; + } + + public static boolean shiBaoHu(final World world, final Vector3 diDian, + final ZhaPin.ZhaPinType type, + final int zhaPinID) { + return zhaPinID < ZhaPin.list.length && zhaPinID >= 0 && + shiBaoHu(world, diDian, type, ZhaPin.list[zhaPinID]); + } + + @Mod.EventHandler + @Override + public void serverStarting(final FMLServerStartingEvent event) { + super.serverStarting(event); + final ICommandManager commandManager = FMLCommonHandler.instance() + .getMinecraftServerInstance() + .getCommandManager(); + final ServerCommandManager serverCommandManager = + (ServerCommandManager)commandManager; + serverCommandManager.registerCommand((ICommand) new ICBMCommand()); + } + + @Override + protected String getChannel() { + return "ICBM|E"; + } + + static { + DU_DU = new Du("Chemical", 1, false); + DU_CHUAN_RAN = new Du("Contagious", 1, true); + ICBMExplosion.USE_FUEL = true; + } +} diff --git a/src/main/java/icbm/zhapin/ItemUsePacket.java b/src/main/java/icbm/zhapin/ItemUsePacket.java new file mode 100644 index 0000000..3ca3291 --- /dev/null +++ b/src/main/java/icbm/zhapin/ItemUsePacket.java @@ -0,0 +1,46 @@ +package icbm.zhapin; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import io.netty.buffer.ByteBuf; +import universalelectricity.core.vector.Vector3; + +public class ItemUsePacket implements IMessage { + Type type; + Vector3 pos; + + public ItemUsePacket(Type type, Vector3 pos) { + this.type = type; + this.pos = pos; + } + + public ItemUsePacket() { + } + + @Override + public void fromBytes(ByteBuf buf) { + this.type = Type.get(buf.readInt()); + this.pos = new Vector3(buf.readInt(), buf.readInt(), buf.readInt()); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(this.type.ordinal()); + buf.writeInt(this.pos.intX()); + buf.writeInt(this.pos.intY()); + buf.writeInt(this.pos.intZ()); + } + + public enum Type { + UNSPECIFIED, + RADAR_GUN, + LASER_DESIGNATOR, + REMOTE; + + public static Type get(final int id) { + if (id >= 0 && id < values().length) { + return values()[id]; + } + return Type.UNSPECIFIED; + } + } +} diff --git a/src/main/java/icbm/zhapin/ItemUsePacketHandler.java b/src/main/java/icbm/zhapin/ItemUsePacketHandler.java new file mode 100644 index 0000000..a96d63e --- /dev/null +++ b/src/main/java/icbm/zhapin/ItemUsePacketHandler.java @@ -0,0 +1,66 @@ +package icbm.zhapin; + +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 icbm.zhapin.dianqi.ItLaserDesignator; +import icbm.zhapin.dianqi.ItRadarGun; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.vector.Vector3; + +public class ItemUsePacketHandler + implements IMessageHandler { + + @Override + public IMessage onMessage(ItemUsePacket message, MessageContext ctx) { + EntityPlayer player = ctx.getServerHandler().playerEntity; + + if (message.type == ItemUsePacket.Type.RADAR_GUN) { + if (player.inventory.getCurrentItem().getItem() instanceof ItRadarGun) { + final ItemStack itemStack = player.inventory.getCurrentItem(); + if (itemStack.stackTagCompound == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + itemStack.stackTagCompound.setInteger("x", message.pos.intX()); + itemStack.stackTagCompound.setInteger("y", message.pos.intY()); + itemStack.stackTagCompound.setInteger("z", message.pos.intZ()); + ICBMExplosion.itLeiDaQiang.onProvide( + ElectricityPack.getFromWatts( + 1000.0, ICBMExplosion.itLeiDaQiang.getVoltage(itemStack)), + itemStack); + } + } else if (message.type == ItemUsePacket.Type.LASER_DESIGNATOR) { + if (player.inventory.getCurrentItem().getItem() instanceof ItLaserDesignator) { + final ItemStack itemStack = player.inventory.getCurrentItem(); + final Vector3 position = message.pos; + ((ItLaserDesignator) ICBMExplosion.itLeiSheZhiBiao) + .setLauncherCountDown(itemStack, 119); + player.worldObj.playSoundEffect( + position.intX(), + player.worldObj.getHeightValue(position.intX(), position.intZ()), + position.intZ(), "icbm.airstrike", 5.0f, + (1.0f + (player.worldObj.rand.nextFloat() - + player.worldObj.rand.nextFloat()) * + 0.2f) * + 0.7f); + player.worldObj.spawnEntityInWorld( + new ELightBeam(player.worldObj, position, 100, 0.0f, 1.0f, 0.0f)); + ICBMExplosion.itLeiDaQiang.onProvide( + ElectricityPack.getFromWatts( + 6000.0, ICBMExplosion.itLeiDaQiang.getVoltage(itemStack)), + itemStack); + } + } else if (message.type == ItemUsePacket.Type.REMOTE) { + final ItemStack itemStack = player.inventory.getCurrentItem(); + ICBMExplosion.itYaoKong.onProvide( + ElectricityPack.getFromWatts( + 1500.0, ICBMExplosion.itYaoKong.getVoltage(itemStack)), + itemStack); + } + + return null; + } +} diff --git a/src/main/java/icbm/zhapin/TickHandler.java b/src/main/java/icbm/zhapin/TickHandler.java new file mode 100644 index 0000000..a433a25 --- /dev/null +++ b/src/main/java/icbm/zhapin/TickHandler.java @@ -0,0 +1,33 @@ +package icbm.zhapin; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class TickHandler { + @SubscribeEvent + public void onTick(PlayerTickEvent ev) { + if (ev.phase == TickEvent.Phase.START) + tickStart(ev.player); + } + + public void tickStart(final EntityPlayer player) { + try { + final ItemStack currentItem = player.getCurrentEquippedItem(); + if (currentItem != null && + (player != Minecraft.getMinecraft().renderViewEntity || + Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) + && + currentItem.getItem() == ICBMExplosion.itFaSheQi && + player.getItemInUseCount() <= 0) { + player.setItemInUse(currentItem, Integer.MAX_VALUE); + } + } catch (final Exception e) { + System.out.println("ICBM|Explosion failed to tick properly."); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/icbm/zhapin/cart/ECart.java b/src/main/java/icbm/zhapin/cart/ECart.java new file mode 100644 index 0000000..a7eec29 --- /dev/null +++ b/src/main/java/icbm/zhapin/cart/ECart.java @@ -0,0 +1,109 @@ +package icbm.zhapin.cart; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.api.explosion.IExplosive; +import icbm.api.explosion.IExplosiveContainer; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import io.netty.buffer.ByteBuf; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityMinecartTNT; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ECart extends EntityMinecartTNT + implements IExplosiveContainer, IEntityAdditionalSpawnData { + public int haoMa; + + public ECart(final World par1World) { + super(par1World); + this.haoMa = 0; + } + + public ECart(final World par1World, final double x, final double y, + final double z, final int explosiveID) { + super(par1World, x, y, z); + this.haoMa = 0; + this.haoMa = explosiveID; + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeInt(this.haoMa); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.haoMa = data.readInt(); + } + + @Override + protected void explodeCart(final double par1) { + ((Entity)this) + .worldObj.spawnParticle("hugeexplosion", ((Entity)this).posX, + ((Entity)this).posY, ((Entity)this).posZ, 0.0, + 0.0, 0.0); + ZhaPin.createExplosion(((Entity)this).worldObj, new Vector3((Entity)this), + (Entity)this, this.haoMa); + this.setDead(); + } + + @Override + public void killMinecart(final DamageSource par1DamageSource) { + this.setDead(); + final ItemStack itemstack = new ItemStack(Items.minecart, 1); + if (((EntityMinecart)this).getCommandSenderName() != null) { + itemstack.setStackDisplayName( + ((EntityMinecart)this).getCommandSenderName()); + } + this.entityDropItem(itemstack, 0.0f); + final double d0 = ((Entity)this).motionX * ((Entity)this).motionX + + ((Entity)this).motionZ * ((Entity)this).motionZ; + if (!par1DamageSource.isExplosion()) { + this.entityDropItem(new ItemStack(ICBMExplosion.bExplosives, 1, this.haoMa), + 0.0f); + } + if (par1DamageSource.isFireDamage() || par1DamageSource.isExplosion() || + d0 >= 0.009999999776482582) { + this.explodeCart(d0); + } + } + + @Override + public ItemStack getCartItem() { + return new ItemStack(ICBMExplosion.itChe, 1, this.haoMa); + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("haoMa", this.haoMa); + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound par1NBTTagCompound) { + super.readEntityFromNBT(par1NBTTagCompound); + this.haoMa = par1NBTTagCompound.getInteger("haoMa"); + } + + @Override + public IExplosive getExplosiveType() { + return ZhaPin.list[this.haoMa]; + } + + @Override + public Block func_145817_o() { + return ICBMExplosion.bExplosives; + } + + @Override + public int getDefaultDisplayTileData() { + return this.haoMa; + } +} diff --git a/src/main/java/icbm/zhapin/cart/ItCart.java b/src/main/java/icbm/zhapin/cart/ItCart.java new file mode 100644 index 0000000..c230e90 --- /dev/null +++ b/src/main/java/icbm/zhapin/cart/ItCart.java @@ -0,0 +1,69 @@ +package icbm.zhapin.cart; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.ItICBM; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockRailBase; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItCart extends ItICBM { + public ItCart() { + super("minecart"); + this.setMaxStackSize(1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public boolean onItemUse(final ItemStack par1ItemStack, + final EntityPlayer par2EntityPlayer, + final World par3World, final int x, final int y, + final int z, final int par7, final float par8, + final float par9, final float par10) { + final Block var11 = par3World.getBlock(x, y, z); + if (BlockRailBase.func_150051_a(var11)) { + if (!par3World.isRemote) { + par3World.spawnEntityInWorld( + (Entity) new ECart(par3World, x + 0.5f, y + 0.5f, z + 0.5f, + par1ItemStack.getItemDamage())); + } + --par1ItemStack.stackSize; + return true; + } + return false; + } + + @Override + public int getMetadata(final int damage) { + return damage; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("minecart_tnt"); + } + + @Override + public String getUnlocalizedName(final ItemStack itemstack) { + return "icbm.minecart." + + ZhaPin.list[itemstack.getItemDamage()].getUnlocalizedName(); + } + + @Override + public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int metadata = 0; metadata < ZhaPin.E_ER_ID; ++metadata) { + par3List.add(new ItemStack(par1, 1, metadata)); + } + } +} diff --git a/src/main/java/icbm/zhapin/daodan/DAntiBallistic.java b/src/main/java/icbm/zhapin/daodan/DAntiBallistic.java new file mode 100644 index 0000000..1111f81 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/DAntiBallistic.java @@ -0,0 +1,81 @@ +package icbm.zhapin.daodan; + +import icbm.api.IMissileLockable; +import icbm.api.explosion.ExplosionEvent; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.MinecraftForge; +import universalelectricity.core.vector.Vector3; + +public class DAntiBallistic extends MissileBase { + public static final int ABMRange = 30; + + protected DAntiBallistic(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void update(final EMissile missileObj) { + if (missileObj.lockedTarget == null) { + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + missileObj.posX - 30.0, missileObj.posY - 30.0, + missileObj.posZ - 30.0, missileObj.posX + 30.0, + missileObj.posY + 30.0, missileObj.posZ + 30.0); + final Entity nearestEntity = + missileObj.worldObj.findNearestEntityWithinAABB( + IMissileLockable.class, bounds, (Entity)missileObj); + if (nearestEntity instanceof IMissileLockable) { + if (((IMissileLockable)nearestEntity).canLock(missileObj)) { + missileObj.lockedTarget = nearestEntity; + missileObj.didTargetLockBefore = true; + missileObj.worldObj.playSoundAtEntity( + (Entity)missileObj, "icbm.targetlocked", 5.0f, 0.9f); + } + } else { + missileObj.motionX = missileObj.xDiff / missileObj.flightDuration; + missileObj.motionZ = missileObj.zDiff / missileObj.flightDuration; + if (missileObj.didTargetLockBefore) { + missileObj.explode(); + } + } + return; + } + Vector3 guJiDiDian = new Vector3(missileObj.lockedTarget); + if (missileObj.lockedTarget.isDead) { + missileObj.explode(); + return; + } + if (missileObj.lockedTarget instanceof IMissileLockable) { + guJiDiDian = + ((IMissileLockable)missileObj.lockedTarget).getPredictedPosition(4); + } + missileObj.motionX = (guJiDiDian.x - missileObj.posX) * 0.30000001192092896; + missileObj.motionY = (guJiDiDian.y - missileObj.posY) * 0.30000001192092896; + missileObj.motionZ = (guJiDiDian.z - missileObj.posZ) * 0.30000001192092896; + } + + @Override + public void onExplode(final EMissile missileObj) { + missileObj.worldObj.createExplosion((Entity)missileObj, missileObj.posX, + missileObj.posY, missileObj.posZ, 6.0f, + true); + MinecraftForge.EVENT_BUS.post(new ExplosionEvent.PostExplosionEvent( + missileObj.worldObj, missileObj.posX, missileObj.posY, missileObj.posZ, + this)); + } + + @Override + public float getRadius() { + return 6.0f; + } + + @Override + public double getEnergy() { + return 100.0; + } + + @Override + public boolean isCruise() { + return true; + } +} diff --git a/src/main/java/icbm/zhapin/daodan/DCluster.java b/src/main/java/icbm/zhapin/daodan/DCluster.java new file mode 100644 index 0000000..38122f1 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/DCluster.java @@ -0,0 +1,49 @@ +package icbm.zhapin.daodan; + +import net.minecraft.entity.Entity; +import universalelectricity.core.vector.Vector3; + +public class DCluster extends MissileBase { + public static final int MAX_CLUSTER = 12; + + protected DCluster(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void update(final EMissile missileObj) { + if (missileObj.motionY < -0.5) { + if (missileObj.missileCount < 12) { + if (!missileObj.worldObj.isRemote) { + final Vector3 position = new Vector3(missileObj); + final EMissile clusterMissile = new EMissile( + missileObj.worldObj, position, new Vector3(missileObj), 0); + clusterMissile.missileType = EMissile.MissileType.SMALL_MISSILE; + clusterMissile.protectionTicks = 20; + clusterMissile.launch(Vector3.add( + missileObj.target, + new Vector3((missileObj.missileCount - 6) * Math.random() * 6.0, + (missileObj.missileCount - 6) * Math.random() * 6.0, + (missileObj.missileCount - 6) * Math.random() * 6.0))); + missileObj.worldObj.spawnEntityInWorld((Entity)clusterMissile); + } + missileObj.protectionTicks = 20; + ++missileObj.missileCount; + } else { + missileObj.setDead(); + } + } + } + + @Override + public void onExplode(final EMissile missileObj) { + missileObj.worldObj.createExplosion((Entity)missileObj, missileObj.posX, + missileObj.posY, missileObj.posZ, 6.0f, + true); + } + + @Override + public boolean isCruise() { + return false; + } +} diff --git a/src/main/java/icbm/zhapin/daodan/DHoming.java b/src/main/java/icbm/zhapin/daodan/DHoming.java new file mode 100644 index 0000000..8d9c092 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/DHoming.java @@ -0,0 +1,109 @@ +package icbm.zhapin.daodan; + +import icbm.api.ITracker; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.WorldServer; +import universalelectricity.core.vector.Vector2; +import universalelectricity.core.vector.Vector3; + +public class DHoming extends MissileBase { + protected DHoming(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void launch(final EMissile missileObj) { + if (!missileObj.worldObj.isRemote) { + final WorldServer worldServer = (WorldServer)missileObj.worldObj; + final Entity trackingEntity = + worldServer.getEntityByID(missileObj.targetEntityId); + if (trackingEntity != null) { + if (trackingEntity == missileObj) { + missileObj.setExplode(); + } + missileObj.target = new Vector3(trackingEntity); + } + } + } + + @Override + public void update(final EMissile missileObj) { + if (missileObj.flyingTicks > missileObj.flightDuration / 2.0f && + missileObj.missileType == EMissile.MissileType.MISSILE) { + final WorldServer worldServer = (WorldServer)missileObj.worldObj; + final Entity trackingEntity = + worldServer.getEntityByID(missileObj.targetEntityId); + if (trackingEntity != null) { + if (trackingEntity == missileObj) { + missileObj.setExplode(); + } + missileObj.target = new Vector3(trackingEntity); + missileObj.missileType = EMissile.MissileType.SMALL_MISSILE; + missileObj.xDiff = missileObj.target.x - missileObj.posX; + missileObj.yDiff = missileObj.target.y - missileObj.posY; + missileObj.zDiff = missileObj.target.z - missileObj.posZ; + missileObj.targetDistance = Vector2.distance( + missileObj.origin.toVector2(), missileObj.target.toVector2()); + missileObj.skyHeight = 150 + (int)(missileObj.targetDistance * 1.8); + missileObj.flightDuration = + (float)Math.max(100.0, 2.4 * missileObj.targetDistance); + missileObj.acceleration = + missileObj.skyHeight * 2.0f / + (missileObj.flightDuration * missileObj.flightDuration); + if (missileObj.smallMissileMotion.equals(new Vector3()) || + missileObj.smallMissileMotion == null) { + final float suDu = 0.3f; + missileObj.smallMissileMotion = new Vector3(); + missileObj.smallMissileMotion.x = + missileObj.xDiff / (missileObj.flightDuration * suDu); + missileObj.smallMissileMotion.y = + missileObj.yDiff / (missileObj.flightDuration * suDu); + missileObj.smallMissileMotion.z = + missileObj.zDiff / (missileObj.flightDuration * suDu); + } + } + } + } + + @Override + public boolean onInteract(final EMissile missileObj, + final EntityPlayer entityPlayer) { + if (!missileObj.worldObj.isRemote && missileObj.flyingTicks <= 0 && + entityPlayer.getCurrentEquippedItem() != null && + entityPlayer.getCurrentEquippedItem().getItem() instanceof ITracker) { + final Entity trackingEntity = + ((ITracker)entityPlayer.getCurrentEquippedItem().getItem()) + .getTrackingEntity(missileObj.worldObj, + entityPlayer.getCurrentEquippedItem()); + if (trackingEntity != null && + missileObj.targetEntityId != trackingEntity.getEntityId()) { + missileObj.targetEntityId = trackingEntity.getEntityId(); + entityPlayer.addChatMessage( + new ChatComponentText("Missile target locked to: " + + trackingEntity.getCommandSenderName())); + if (missileObj.getLauncher() != null && + missileObj.getLauncher().getController() != null) { + final Vector3 newTarget = new Vector3(trackingEntity); + newTarget.y = 0.0; + missileObj.getLauncher().getController().setTarget(newTarget); + } + return true; + } + } + return false; + } + + @Override + public void onExplode(final EMissile missileObj) { + missileObj.worldObj.createExplosion((Entity)missileObj, missileObj.posX, + missileObj.posY, missileObj.posZ, 6.0f, + true); + } + + @Override + public boolean isCruise() { + return false; + } +} diff --git a/src/main/java/icbm/zhapin/daodan/DModule.java b/src/main/java/icbm/zhapin/daodan/DModule.java new file mode 100644 index 0000000..a1b48b4 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/DModule.java @@ -0,0 +1,13 @@ +package icbm.zhapin.daodan; + +public class DModule extends MissileBase +{ + public DModule(final String name, final int id, final int tier) { + super(name, id, tier); + } + + @Override + public void onExplode(final EMissile missileObj) { + missileObj.dropMissileAsItem(); + } +} diff --git a/src/main/java/icbm/zhapin/daodan/DNuclearCluster.java b/src/main/java/icbm/zhapin/daodan/DNuclearCluster.java new file mode 100644 index 0000000..675b95f --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/DNuclearCluster.java @@ -0,0 +1,51 @@ +package icbm.zhapin.daodan; + +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import universalelectricity.core.vector.Vector3; + +public class DNuclearCluster extends DCluster { + public static final int MAX_CLUSTER = 4; + + protected DNuclearCluster(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void update(final EMissile missileObj) { + if (missileObj.motionY < -0.5) { + if (missileObj.missileCount < 4) { + if (!missileObj.worldObj.isRemote) { + final Vector3 position = new Vector3(missileObj); + final EMissile clusterMissile = + new EMissile(missileObj.worldObj, position, + new Vector3(missileObj), ZhaPin.nuclear.getID()); + missileObj.worldObj.spawnEntityInWorld((Entity)clusterMissile); + clusterMissile.missileType = EMissile.MissileType.SMALL_MISSILE; + clusterMissile.protectionTicks = 20; + clusterMissile.launch(Vector3.add( + missileObj.target, + new Vector3((missileObj.missileCount - 2) * Math.random() * 30.0, + (missileObj.missileCount - 2) * Math.random() * 30.0, + (missileObj.missileCount - 2) * Math.random() * + 30.0))); + } + missileObj.protectionTicks = 20; + ++missileObj.missileCount; + } else { + missileObj.setDead(); + } + } + } + + @Override + public void onExplode(final EMissile missileObj) { + ZhaPin.createExplosion(missileObj.worldObj, new Vector3(missileObj), + missileObj, ZhaPin.nuclear.getID()); + } + + @Override + public boolean isCruise() { + return false; + } +} diff --git a/src/main/java/icbm/zhapin/daodan/EMissile.java b/src/main/java/icbm/zhapin/daodan/EMissile.java new file mode 100644 index 0000000..567f8a1 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/EMissile.java @@ -0,0 +1,619 @@ +package icbm.zhapin.daodan; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.api.ILauncherContainer; +import icbm.api.IMissile; +import icbm.api.IMissileLockable; +import icbm.api.RadarRegistry; +import icbm.api.explosion.IExplosive; +import icbm.api.sentry.IAATarget; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.jiqi.TCruiseLauncher; +import icbm.zhapin.zhapin.ZhaPin; +import io.netty.buffer.ByteBuf; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.gui.IUpdatePlayerListBox; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeChunkManager; +import universalelectricity.core.vector.Vector2; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.TranslationHelper; + +public class EMissile extends Entity implements IMissileLockable, + IEntityAdditionalSpawnData, + IMissile, IAATarget { + public static final float THRUST = 0.012f; + public int missileId; + public int skyHeight; + public Vector3 target; + public Vector3 origin; + public Vector3 launcherPos; + public boolean exploded; + public int explosionHeight; + public int flyingTicks; + public double xDiff; + public double yDiff; + public double zDiff; + public double targetDistance; + public float flightDuration; + public float acceleration; + public int protectionTicks; + private ForgeChunkManager.Ticket chunkTicket; + public Entity lockedTarget; + public boolean didTargetLockBefore; + public int targetEntityId; + public int missileCount; + public double missileHeight; + private boolean setExplode; + private boolean setNormalExplode; + public MissileType missileType; + public Vector3 smallMissileMotion; + private double startHeight; + protected final IUpdatePlayerListBox sound; + + public EMissile(final World par1World) { + super(par1World); + this.missileId = 0; + this.skyHeight = 200; + this.target = null; + this.origin = null; + this.launcherPos = null; + this.exploded = false; + this.explosionHeight = 0; + this.flyingTicks = -1; + this.protectionTicks = 2; + this.didTargetLockBefore = false; + this.targetEntityId = -1; + this.missileCount = 0; + this.missileHeight = 2.0; + this.missileType = MissileType.MISSILE; + this.smallMissileMotion = new Vector3(); + this.startHeight = 3.0; + this.setSize(1.0f, 1.0f); + super.renderDistanceWeight = 3.0; + super.isImmuneToFire = true; + super.ignoreFrustumCheck = true; + this.sound = + ((super.worldObj != null) ? ICBMExplosion.proxy.getDaoDanShengYin(this) + : null); + } + + public EMissile(final World par1World, final Vector3 diDian, + final Vector3 faSheQiDiDian, final int missileId) { + this(par1World); + this.missileId = missileId; + this.origin = diDian; + this.launcherPos = faSheQiDiDian; + this.setPosition(this.origin.x, this.origin.y, this.origin.z); + this.setRotation(0.0f, 90.0f); + } + + public EMissile(final World par1World, final Vector3 diDian, final int haoMa, + final float yaw, final float pitch) { + this(par1World); + this.missileId = haoMa; + this.origin = diDian; + this.launcherPos = diDian; + this.missileType = MissileType.ROCKET; + this.protectionTicks = 10; + this.setPosition(this.origin.x, this.origin.y, this.origin.z); + this.setRotation(yaw, pitch); + } + + @Override + public String getCommandSenderName() { + if (this.missileId >= 100) { + return TranslationHelper.getLocal( + "icbm.missile." + + MissileBase.list[this.missileId].getUnlocalizedName() + ".name"); + } + return TranslationHelper.getLocal( + "icbm.missile." + ZhaPin.list[this.missileId].getUnlocalizedName() + + ".name"); + } + + @Override + public void writeSpawnData(final ByteBuf data) { + try { + data.writeInt(this.missileId); + data.writeInt(this.missileType.ordinal()); + data.writeDouble(this.origin.x); + data.writeDouble(this.origin.y); + data.writeDouble(this.origin.z); + data.writeInt(this.launcherPos.intX()); + data.writeInt(this.launcherPos.intY()); + data.writeInt(this.launcherPos.intZ()); + } catch (final Exception e) { + e.printStackTrace(); + } + } + + @Override + public void readSpawnData(final ByteBuf data) { + try { + this.missileId = data.readInt(); + this.missileType = MissileType.values()[data.readInt()]; + this.origin = + new Vector3(data.readDouble(), data.readDouble(), data.readDouble()); + this.launcherPos = + new Vector3(data.readInt(), data.readInt(), data.readInt()); + } catch (final Exception e) { + e.printStackTrace(); + } + } + + public void launch(final Vector3 target) { + this.origin = new Vector3(this); + this.target = target; + this.explosionHeight = this.target.intY(); + MissileBase.list[this.missileId].launch(this); + this.flyingTicks = 0; + this.jiSuan(); + super.worldObj.playSoundAtEntity((Entity)this, "icbm.missilelaunch", 4.0f, + (1.0f + (super.worldObj.rand.nextFloat() - + super.worldObj.rand.nextFloat()) * + 0.2f) * + 0.7f); + RadarRegistry.register(this); + MainBase.LOGGER.info("Launching " + this.getCommandSenderName() + " from " + + this.origin.intX() + ", " + this.origin.intY() + ", " + + this.origin.intZ() + " to " + this.target.intX() + + ", " + this.target.intY() + ", " + this.target.intZ()); + } + + public void launch(final Vector3 target, final int height) { + this.startHeight = height; + this.launch(target); + } + + public void jiSuan() { + if (this.target != null) { + this.xDiff = this.target.x - this.origin.x; + this.yDiff = this.target.y - this.origin.y; + this.zDiff = this.target.z - this.origin.z; + this.targetDistance = + Vector2.distance(this.origin.toVector2(), this.target.toVector2()); + this.skyHeight = 160 + (int)(this.targetDistance * 3.0); + this.flightDuration = + (float)Math.max(100.0, 2.0 * this.targetDistance) - this.flyingTicks; + this.acceleration = + this.skyHeight * 2.0f / (this.flightDuration * this.flightDuration); + } + } + + @Override + public void entityInit() { + super.dataWatcher.addObject(16, (Object)(-1)); + this.daoDanInit(ForgeChunkManager.requestTicket( + (Object)ICBMExplosion.instance, super.worldObj, + ForgeChunkManager.Type.ENTITY)); + } + + public void daoDanInit(final ForgeChunkManager.Ticket ticket) { + if (ticket != null) { + if (this.chunkTicket == null) { + (this.chunkTicket = ticket).bindEntity((Entity)this); + this.chunkTicket.getModData(); + } + ForgeChunkManager.forceChunk( + this.chunkTicket, + new ChunkCoordIntPair(super.chunkCoordX, super.chunkCoordZ)); + } + } + + public void updateLoadChunk(final int newChunkX, final int newChunkZ) { + if (!super.worldObj.isRemote && MainBase.ZAI_KUAI && + this.chunkTicket != null) { + for (int x = -2; x <= 2; ++x) { + for (int z = -2; z <= 2; ++z) { + super.worldObj.getChunkFromChunkCoords(newChunkX + x, newChunkZ + z); + } + } + for (int x = -1; x <= 1; ++x) { + for (int z = -1; z <= 1; ++z) { + ForgeChunkManager.forceChunk( + this.chunkTicket, + new ChunkCoordIntPair(newChunkX + x, newChunkZ + z)); + } + } + } + } + + @Override + public boolean canBeCollidedWith() { + return true; + } + + @Override + public void onUpdate() { + if (this.sound != null) { + this.sound.update(); + } + if (!super.worldObj.isRemote && + ICBMExplosion.shiBaoHu(super.worldObj, new Vector3(this), + ZhaPin.ZhaPinType.DAO_DAN, this.missileId)) { + if (this.flyingTicks >= 0) { + this.dropMissileAsItem(); + } + this.setDead(); + return; + } + if (this.setNormalExplode) { + this.normalExplode(); + return; + } + if (this.setExplode) { + this.explode(); + return; + } + try { + if (super.worldObj.isRemote) { + this.flyingTicks = super.dataWatcher.getWatchableObjectInt(16); + } else { + super.dataWatcher.updateObject(16, (Object)this.flyingTicks); + } + } catch (final Exception e) { + e.printStackTrace(); + } + this.updateLoadChunk(super.chunkCoordX, super.chunkCoordZ); + if (this.flyingTicks >= 0) { + RadarRegistry.register(this); + if (!super.worldObj.isRemote) { + if (this.missileType == MissileType.SMALL_MISSILE || + this.missileType == MissileType.ROCKET) { + if (this.flyingTicks == 0 && this.smallMissileMotion != null) { + this.smallMissileMotion = + new Vector3(this.xDiff / (this.flightDuration * 0.3), + this.yDiff / (this.flightDuration * 0.3), + this.zDiff / (this.flightDuration * 0.3)); + } + super.motionX = this.smallMissileMotion.x; + super.motionY = this.smallMissileMotion.y; + super.motionZ = this.smallMissileMotion.z; + super.rotationPitch = + (float)(Math.atan(super.motionY / + Math.sqrt(super.motionX * super.motionX + + super.motionZ * super.motionZ)) * + 180.0 / 3.141592653589793); + super.rotationYaw = (float)(Math.atan2(super.motionX, super.motionZ) * + 180.0 / 3.141592653589793); + MissileBase.list[this.missileId].update(this); + final Block block = super.worldObj.getBlock( + (int)super.posX, (int)super.posY, (int)super.posZ); + if (this.protectionTicks <= 0 && + ((block != Blocks.air && !(block instanceof BlockLiquid)) || + super.posY > 1000.0 || super.isCollided || + this.flyingTicks > 20000 || + (super.motionX == 0.0 && super.motionY == 0.0 && + super.motionZ == 0.0))) { + this.explode(); + return; + } + this.moveEntity(super.motionX, super.motionY, super.motionZ); + } else if (this.startHeight > 0.0) { + super.motionY = 0.012f * this.flyingTicks * (this.flyingTicks / 2); + super.motionX = 0.0; + super.motionZ = 0.0; + this.startHeight -= super.motionY; + this.moveEntity(super.motionX, super.motionY, super.motionZ); + if (this.startHeight <= 0.0) { + super.motionY = this.acceleration * (this.flightDuration / 2.0f); + super.motionX = this.xDiff / this.flightDuration; + super.motionZ = this.zDiff / this.flightDuration; + } + } else { + super.motionY -= this.acceleration; + super.rotationPitch = + (float)(Math.atan(super.motionY / + Math.sqrt(super.motionX * super.motionX + + super.motionZ * super.motionZ)) * + 180.0 / 3.141592653589793); + super.rotationYaw = (float)(Math.atan2(super.motionX, super.motionZ) * + 180.0 / 3.141592653589793); + MissileBase.list[this.missileId].update(this); + this.moveEntity(super.motionX, super.motionY, super.motionZ); + if (super.isCollided) { + this.explode(); + } + if (this.explosionHeight > 0 && super.motionY < 0.0) { + final Block blockBelow = super.worldObj.getBlock( + (int)super.posX, (int)super.posY - this.explosionHeight, + (int)super.posZ); + + if (blockBelow != Blocks.air) { + this.explosionHeight = 0; + this.explode(); + } + } + } + } else { + super.rotationPitch = + (float)(Math.atan(super.motionY / + Math.sqrt(super.motionX * super.motionX + + super.motionZ * super.motionZ)) * + 180.0 / 3.141592653589793); + super.rotationYaw = (float)(Math.atan2(super.motionX, super.motionZ) * + 180.0 / 3.141592653589793); + } + super.lastTickPosX = super.posX; + super.lastTickPosY = super.posY; + super.lastTickPosZ = super.posZ; + this.spawnMissileSmoke(); + --this.protectionTicks; + ++this.flyingTicks; + } else if (this.missileType != MissileType.ROCKET) { + final ILauncherContainer launcher = this.getLauncher(); + if (launcher != null) { + launcher.setContainingMissile(this); + if (launcher instanceof TCruiseLauncher) { + this.missileType = MissileType.SMALL_MISSILE; + super.noClip = true; + if (super.worldObj.isRemote) { + super.rotationYaw = -((TCruiseLauncher)launcher).rotationYaw + 90.0f; + super.rotationPitch = ((TCruiseLauncher)launcher).rotationPitch; + } + super.posY = ((TCruiseLauncher)launcher).yCoord + 1; + } + } else { + this.setDead(); + } + } + super.onUpdate(); + } + + public ILauncherContainer getLauncher() { + if (this.launcherPos != null) { + final TileEntity tileEntity = + this.launcherPos.getTileEntity((IBlockAccess)super.worldObj); + if (tileEntity != null && tileEntity instanceof ILauncherContainer && + !tileEntity.isInvalid()) { + return (ILauncherContainer)tileEntity; + } + } + return null; + } + + @Override + public boolean interactFirst(final EntityPlayer entityPlayer) { + if (MissileBase.list[this.missileId] != null && + MissileBase.list[this.missileId].onInteract(this, entityPlayer)) { + return true; + } + if (!super.worldObj.isRemote && (super.riddenByEntity == null || + super.riddenByEntity == entityPlayer)) { + entityPlayer.mountEntity((Entity)this); + return true; + } + return false; + } + + @Override + public double getMountedYOffset() { + if (this.flightDuration <= 0.0f && this.missileType == MissileType.MISSILE) { + return super.height; + } + if (this.missileType == MissileType.SMALL_MISSILE) { + return super.height * 0.1; + } + return super.height / 2.0f + super.motionY; + } + + private void spawnMissileSmoke() { + if (super.worldObj.isRemote) { + final Vector3 position = new Vector3(this); + final double distance = -this.missileHeight - 0.20000000298023224; + final Vector3 delta = new Vector3(); + delta.y = Math.sin(Math.toRadians(super.rotationPitch)) * distance; + final double dH = + Math.cos(Math.toRadians(super.rotationPitch)) * distance; + delta.x = Math.sin(Math.toRadians(super.rotationYaw)) * dH; + delta.z = Math.cos(Math.toRadians(super.rotationYaw)) * dH; + position.add(delta); + super.worldObj.spawnParticle("flame", position.x, position.y, position.z, + 0.0, 0.0, 0.0); + ICBMExplosion.proxy.spawnParticle("missile_smoke", super.worldObj, + position, 4.0f, 2.0); + position.multiply(1.0 - 0.001 * Math.random()); + ICBMExplosion.proxy.spawnParticle("missile_smoke", super.worldObj, + position, 4.0f, 2.0); + position.multiply(1.0 - 0.001 * Math.random()); + ICBMExplosion.proxy.spawnParticle("missile_smoke", super.worldObj, + position, 4.0f, 2.0); + position.multiply(1.0 - 0.001 * Math.random()); + ICBMExplosion.proxy.spawnParticle("missile_smoke", super.worldObj, + position, 4.0f, 2.0); + } + } + + @Override + public AxisAlignedBB getCollisionBox(final Entity entity) { + if (!(entity instanceof EntityItem) && entity != super.riddenByEntity && + this.protectionTicks <= 0) { + if (entity instanceof EMissile) { + ((EMissile)entity).setNormalExplode(); + } + this.setExplode(); + } + return null; + } + + public Vector3 getPredictedPosition(final int t) { + final Vector3 guJiDiDian = new Vector3(this); + double tempMotionY = super.motionY; + if (this.flyingTicks > 20) { + for (int i = 0; i < t; ++i) { + if (this.missileType == MissileType.SMALL_MISSILE || + this.missileType == MissileType.ROCKET) { + final Vector3 vector3 = guJiDiDian; + vector3.x += this.smallMissileMotion.x; + final Vector3 vector4 = guJiDiDian; + vector4.y += this.smallMissileMotion.y; + final Vector3 vector5 = guJiDiDian; + vector5.z += this.smallMissileMotion.z; + } else { + final Vector3 vector6 = guJiDiDian; + vector6.x += super.motionX; + final Vector3 vector7 = guJiDiDian; + vector7.y += tempMotionY; + final Vector3 vector8 = guJiDiDian; + vector8.z += super.motionZ; + tempMotionY -= this.acceleration; + } + } + } + return guJiDiDian; + } + + public void setNormalExplode() { this.setNormalExplode = true; } + + public void setExplode() { this.setExplode = true; } + + @Override + public void setDead() { + RadarRegistry.unregister(this); + if (this.chunkTicket != null) { + ForgeChunkManager.releaseTicket(this.chunkTicket); + } + super.setDead(); + if (this.sound != null) { + this.sound.update(); + } + } + + public void explode() { + try { + if (!this.exploded) { + if (this.missileId == 0) { + if (!super.worldObj.isRemote) { + super.worldObj.createExplosion((Entity)this, super.posX, super.posY, + super.posZ, 5.0f, true); + } + } else { + MissileBase.list[this.missileId].onExplode(this); + } + this.exploded = true; + MainBase.LOGGER.info(this.getCommandSenderName() + " exploded in " + + (int)super.posX + ", " + (int)super.posY + ", " + + (int)super.posZ); + } + this.setDead(); + } catch (final Exception e) { + MainBase.LOGGER.severe( + "Missile failed to explode properly. Report this to the developers."); + e.printStackTrace(); + } + } + + public void normalExplode() { + if (!this.exploded) { + this.exploded = true; + if (!super.worldObj.isRemote) { + super.worldObj.createExplosion((Entity)this, super.posX, super.posY, + super.posZ, 5.0f, true); + } + this.setDead(); + } + } + + public void dropMissileAsItem() { + if (!this.exploded && !super.worldObj.isRemote) { + EntityItem entityItem; + if (this.missileId >= 100) { + entityItem = new EntityItem( + super.worldObj, super.posX, super.posY, super.posZ, + new ItemStack(ICBMExplosion.itTeBieDaoDan, 1, this.missileId - 100)); + } else { + entityItem = new EntityItem( + super.worldObj, super.posX, super.posY, super.posZ, + new ItemStack(ICBMExplosion.itDaoDan, 1, this.missileId)); + } + final float var13 = 0.05f; + final Random random = new Random(); + ((Entity)entityItem).motionX = (float)random.nextGaussian() * var13; + ((Entity)entityItem).motionY = + (float)random.nextGaussian() * var13 + 0.2f; + ((Entity)entityItem).motionZ = (float)random.nextGaussian() * var13; + super.worldObj.spawnEntityInWorld((Entity)entityItem); + } + this.setDead(); + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound nbt) { + this.origin = Vector3.readFromNBT(nbt.getCompoundTag("kaiShi")); + this.target = Vector3.readFromNBT(nbt.getCompoundTag("muBiao")); + this.launcherPos = Vector3.readFromNBT(nbt.getCompoundTag("faSheQi")); + this.acceleration = nbt.getFloat("jiaSu"); + this.explosionHeight = nbt.getInteger("baoZhaGaoDu"); + this.missileId = nbt.getInteger("haoMa"); + this.flyingTicks = nbt.getInteger("feiXingTick"); + this.startHeight = nbt.getDouble("qiFeiGaoDu"); + this.missileType = MissileType.values()[nbt.getInteger("xingShi")]; + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound nbt) { + nbt.setTag("kaiShi", this.origin.writeToNBT(new NBTTagCompound())); + if (this.target != null) { + nbt.setTag("muBiao", this.target.writeToNBT(new NBTTagCompound())); + } + if (this.launcherPos != null) { + nbt.setTag("faSheQi", this.launcherPos.writeToNBT(new NBTTagCompound())); + } + nbt.setFloat("jiaSu", this.acceleration); + nbt.setInteger("haoMa", this.missileId); + nbt.setInteger("baoZhaGaoDu", this.explosionHeight); + nbt.setInteger("feiXingTick", this.flyingTicks); + nbt.setDouble("qiFeiGaoDu", this.startHeight); + nbt.setInteger("xingShi", this.missileType.ordinal()); + } + + @Override + public float getShadowSize() { + return 1.0f; + } + + @Override + public int getTicksInAir() { + return this.flyingTicks; + } + + public IExplosive getExplosiveType() { + if (this.missileId > ZhaPin.list.length) { + return MissileBase.list[this.missileId]; + } + return ZhaPin.list[this.missileId]; + } + + public boolean canLock(final IMissile missile) { + return this.flyingTicks > 0; + } + + public void destroyCraft() { this.normalExplode(); } + + public int doDamage(final int damage) { return -1; } + + @Override + public boolean canBeTargeted(final Object turret) { + return this.getTicksInAir() > 0; + } + + public enum MissileType { + MISSILE, + SMALL_MISSILE, + ROCKET; + } +} diff --git a/src/main/java/icbm/zhapin/daodan/ItMissile.java b/src/main/java/icbm/zhapin/daodan/ItMissile.java new file mode 100644 index 0000000..ded704d --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/ItMissile.java @@ -0,0 +1,36 @@ +package icbm.zhapin.daodan; + +import icbm.core.di.ItICBM; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class ItMissile extends ItICBM { + public ItMissile(final String name) { + super(name); + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.setMaxStackSize(1); + } + + public int getMetadata(final int damage) { return damage; } + + public String getUnlocalizedName(final ItemStack itemStack) { + if (itemStack.getItemDamage() < ZhaPin.list.length) { + return this.getUnlocalizedName() + "." + + ZhaPin.list[itemStack.getItemDamage()].getUnlocalizedName(); + } + return ""; + } + + public String getUnlocalizedName() { return "icbm.missile"; } + + public void getSubItems(final int par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < ZhaPin.E_SI_ID; ++i) { + par3List.add(new ItemStack((Item)this, 1, i)); + } + } +} diff --git a/src/main/java/icbm/zhapin/daodan/ItModuleMissile.java b/src/main/java/icbm/zhapin/daodan/ItModuleMissile.java new file mode 100644 index 0000000..cc355bc --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/ItModuleMissile.java @@ -0,0 +1,43 @@ +package icbm.zhapin.daodan; + +import net.minecraft.item.Item; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.ItemStack; + +public class ItModuleMissile extends ItMissile +{ + public ItModuleMissile() { + super("specialMissile"); + } + + @Override + public String getUnlocalizedName(final ItemStack itemstack) { + if (itemstack.getItemDamage() == 0) { + return this.getUnlocalizedName() + ".missileModule"; + } + return this.getUnlocalizedName() + "." + MissileBase.list[itemstack.getItemDamage() + 100].getUnlocalizedName(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister iconRegister) { + this.itemIcon = iconRegister.registerIcon("icbm:missileModule"); + } + + @Override + public String getUnlocalizedName() { + return "icbm.missile"; + } + + @Override + public void getSubItems(final int par1, final CreativeTabs par2CreativeTabs, final List par3List) { + for (int i = 0; i < 5; ++i) { + par3List.add(new ItemStack((Item)this, 1, i)); + } + } +} diff --git a/src/main/java/icbm/zhapin/daodan/MissileBase.java b/src/main/java/icbm/zhapin/daodan/MissileBase.java new file mode 100644 index 0000000..a530a16 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/MissileBase.java @@ -0,0 +1,117 @@ +package icbm.zhapin.daodan; + +import icbm.api.explosion.IExplosive; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.TranslationHelper; +import universalelectricity.prefab.implement.ITier; + +public class MissileBase implements ITier, IExplosive { + public static final MissileBase missileModule; + public static final MissileBase homing; + public static final MissileBase antiBallistic; + public static final MissileBase cluster; + public static final MissileBase nuclearCluster; + public static final int MAX_DAO_DAN = 4; + public static MissileBase[] list; + private String mingZi; + private int ID; + private int tier; + + public MissileBase(final String name, final int ID, final int tier) { + if (MissileBase.list == null) { + MissileBase.list = new MissileBase[256]; + } + if (MissileBase.list[ID] != null) { + throw new IllegalArgumentException( + "Missile " + ID + " is already occupied when adding " + this + "!"); + } + MissileBase.list[ID] = this; + this.mingZi = name; + this.tier = tier; + this.ID = ID; + } + + @Override + public int getID() { + return this.ID; + } + + @Override + public String getUnlocalizedName() { + return this.mingZi; + } + + public String getTranslatedMing() { + return TranslationHelper.getLocal("icbm.missile." + this.mingZi); + } + + @Override + public int getTier() { + return this.tier; + } + + @Override + public void setTier(final int tier) {} + + public void launch(final EMissile missileObj) {} + + public void update(final EMissile missileObj) {} + + public boolean onInteract(final EMissile missileObj, + final EntityPlayer par1EntityPlayer) { + return false; + } + + public void onExplode(final EMissile missileObj) { + ZhaPin.createExplosion(missileObj.worldObj, new Vector3(missileObj), + missileObj, missileObj.missileId); + } + + public ItemStack getItemStack() { + return new ItemStack(ICBMExplosion.itDaoDan, 1, this.getID()); + } + + public boolean isCruise() { return true; } + + @Override + public String getExplosiveName() { + return this.getTranslatedMing(); + } + + @Override + public String getGrenadeName() { + return this.getTranslatedMing(); + } + + @Override + public String getMissileName() { + return this.getTranslatedMing(); + } + + @Override + public String getMinecartName() { + return this.getTranslatedMing(); + } + + @Override + public float getRadius() { + return 0.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } + + static { + missileModule = new DModule("missileModule", 100, 1); + homing = new DHoming("homing", 101, 1); + antiBallistic = new DAntiBallistic("antiBallistic", 102, 2); + cluster = new DCluster("cluster", 103, 2); + nuclearCluster = new DNuclearCluster("nuclearCluster", 104, 3); + } +} diff --git a/src/main/java/icbm/zhapin/daodan/MissileSound.java b/src/main/java/icbm/zhapin/daodan/MissileSound.java new file mode 100644 index 0000000..7d6d7b1 --- /dev/null +++ b/src/main/java/icbm/zhapin/daodan/MissileSound.java @@ -0,0 +1,124 @@ +package icbm.zhapin.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.audio.SoundManager; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.server.gui.IUpdatePlayerListBox; +import net.minecraft.util.MathHelper; + +@SideOnly(Side.CLIENT) +public class MissileSound implements IUpdatePlayerListBox { + private final SoundManager theSoundManager; + private final EMissile entity; + private final EntityPlayerSP thePlayer; + private boolean playerSPRidingMinecart; + private boolean minecartIsDead; + private boolean minecartIsMoving; + private boolean silent; + private float minecartSoundPitch; + private float minecartMoveSoundVolume; + private float minecartRideSoundVolume; + private double minecartSpeed; + + public MissileSound(final SoundManager par1SoundManager, + final EMissile entity, + final EntityPlayerSP par3EntityPlayerSP) { + this.playerSPRidingMinecart = false; + this.minecartIsDead = false; + this.minecartIsMoving = false; + this.silent = false; + this.minecartSoundPitch = 0.0f; + this.minecartMoveSoundVolume = 0.0f; + this.minecartRideSoundVolume = 0.0f; + this.minecartSpeed = 0.0; + this.theSoundManager = par1SoundManager; + this.entity = entity; + this.thePlayer = par3EntityPlayerSP; + } + + @Override + public void update() { + boolean var1 = false; + final boolean var2 = this.playerSPRidingMinecart; + final boolean var3 = this.minecartIsDead; + final boolean var4 = this.minecartIsMoving; + final float var5 = this.minecartMoveSoundVolume; + final float var6 = this.minecartSoundPitch; + final float var7 = this.minecartRideSoundVolume; + this.playerSPRidingMinecart = (this.thePlayer != null && + this.entity.riddenByEntity == this.thePlayer); + this.minecartIsDead = this.entity.isDead; + this.minecartSpeed = 20.0; + this.minecartIsMoving = (this.minecartSpeed >= 0.01); + if (var2 && !this.playerSPRidingMinecart) { + // TODO: WTF + // this.theSoundManager.stopEntitySound((Entity)this.thePlayer); + } + if (this.minecartIsDead || + (!this.silent && this.minecartMoveSoundVolume == 0.0f && + this.minecartRideSoundVolume == 0.0f)) { + // TODO: WTF + // if (!var3) { + // this.theSoundManager.stopEntitySound((Entity)this.entity); + // if (var2 || this.playerSPRidingMinecart) { + // this.theSoundManager.stopEntitySound((Entity)this.thePlayer); + // } + // } + this.silent = true; + if (this.minecartIsDead) { + return; + } + } + if (this.theSoundManager != null && this.entity != null && + this.minecartMoveSoundVolume > 0.0f) { + //TODO: WTF + //this.theSoundManager.playEntitySound("icbm.missileinair", + // (Entity) this.entity, 7.0f, + // this.minecartSoundPitch, true); + this.silent = false; + var1 = true; + } + if (this.entity.getTicksInAir() > 0) { + if (this.minecartSoundPitch < 1.0f) { + this.minecartSoundPitch += 0.0025f; + } + if (this.minecartSoundPitch > 1.0f) { + this.minecartSoundPitch = 1.0f; + } + float var8 = MathHelper.clamp_float((float) this.minecartSpeed, 0.0f, 4.0f) / 4.0f; + this.minecartRideSoundVolume = 0.0f + var8 * 0.75f; + var8 = MathHelper.clamp_float(var8 * 2.0f, 0.0f, 1.0f); + this.minecartMoveSoundVolume = 0.0f + var8 * 6.7f; + if (this.entity.posY > 1000.0) { + this.minecartMoveSoundVolume = 0.0f; + this.minecartRideSoundVolume = 0.0f; + } + } else if (var4) { + this.minecartMoveSoundVolume = 0.0f; + this.minecartSoundPitch = 0.0f; + this.minecartRideSoundVolume = 0.0f; + } + if (!this.silent) { + if (this.minecartSoundPitch != var6) { + //this.theSoundManager.setEntitySoundPitch((Entity) this.entity, + // this.minecartSoundPitch); + } + if (this.minecartMoveSoundVolume != var5) { + //this.theSoundManager.setEntitySoundVolume((Entity) this.entity, + // this.minecartMoveSoundVolume); + } + if (this.minecartRideSoundVolume != var7) { + //this.theSoundManager.setEntitySoundVolume((Entity) this.thePlayer, + // this.minecartRideSoundVolume); + } + } + if (!var1) { + //this.theSoundManager.updateSoundLocation((Entity) this.entity); + if (this.playerSPRidingMinecart) { + //this.theSoundManager.updateSoundLocation((Entity) this.thePlayer, + // (Entity) this.entity); + } + } + } +} diff --git a/src/main/java/icbm/zhapin/dianqi/ItDefuser.java b/src/main/java/icbm/zhapin/dianqi/ItDefuser.java new file mode 100644 index 0000000..09f2a97 --- /dev/null +++ b/src/main/java/icbm/zhapin/dianqi/ItDefuser.java @@ -0,0 +1,72 @@ +package icbm.zhapin.dianqi; + +import icbm.core.di.ItElectricICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.cart.ECart; +import icbm.zhapin.zhapin.EExplosive; +import java.util.Random; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.DamageSource; +import universalelectricity.core.electricity.ElectricityPack; + +public class ItDefuser extends ItElectricICBM { + public ItDefuser() { + super("defuser"); + this.setTextureName("icbm:defuser"); + } + + public boolean onLeftClickEntity(final ItemStack itemStack, + final EntityPlayer player, + final Entity entity) { + if (this.getJoules(itemStack) > 2000.0) { + if (entity instanceof EExplosive) { + if (!entity.worldObj.isRemote) { + final EExplosive entityTNT = (EExplosive)entity; + final EntityItem entityItem = new EntityItem( + entity.worldObj, entity.posX, entity.posY, entity.posZ, + new ItemStack(ICBMExplosion.bExplosives, 1, entityTNT.haoMa)); + final float var13 = 0.05f; + final Random random = new Random(); + ((Entity)entityItem).motionX = (float)random.nextGaussian() * var13; + ((Entity)entityItem).motionY = + (float)random.nextGaussian() * var13 + 0.2f; + ((Entity)entityItem).motionZ = (float)random.nextGaussian() * var13; + entity.worldObj.spawnEntityInWorld((Entity)entityItem); + } + entity.setDead(); + } else if (entity instanceof EntityTNTPrimed) { + if (!entity.worldObj.isRemote) { + final EntityItem entityItem2 = + new EntityItem(entity.worldObj, entity.posX, entity.posY, + entity.posZ, new ItemStack(Blocks.tnt)); + final float var14 = 0.05f; + final Random random2 = new Random(); + ((Entity)entityItem2).motionX = (float)random2.nextGaussian() * var14; + ((Entity)entityItem2).motionY = + (float)random2.nextGaussian() * var14 + 0.2f; + ((Entity)entityItem2).motionZ = (float)random2.nextGaussian() * var14; + entity.worldObj.spawnEntityInWorld((Entity)entityItem2); + } + entity.setDead(); + } else if (entity instanceof ECart) { + ((ECart)entity).killMinecart(DamageSource.generic); + } + this.onProvide( + ElectricityPack.getFromWatts(2000.0, this.getJoules(itemStack)), + itemStack); + return true; + } + player.addChatMessage(new ChatComponentText("Defuser out of electricity!")); + return false; + } + + public double getVoltage(final ItemStack itemStack) { return 20.0; } + + public double getMaxJoules(final ItemStack itemStack) { return 80000.0; } +} diff --git a/src/main/java/icbm/zhapin/dianqi/ItLaserDesignator.java b/src/main/java/icbm/zhapin/dianqi/ItLaserDesignator.java new file mode 100644 index 0000000..3e95840 --- /dev/null +++ b/src/main/java/icbm/zhapin/dianqi/ItLaserDesignator.java @@ -0,0 +1,287 @@ +package icbm.zhapin.dianqi; + +import icbm.api.IItemFrequency; +import icbm.core.MainBase; +import icbm.core.di.ItElectricICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.ItemUsePacket; +import icbm.zhapin.jiqi.LauncherManager; +import icbm.zhapin.jiqi.TLauncherController; +import icbm.zhapin.jiqi.TCruiseLauncher; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector2; +import universalelectricity.core.vector.Vector3; + +public class ItLaserDesignator + extends ItElectricICBM implements IItemFrequency { + public static final int BAN_JING; + public static final int YONG_DIAN_LIANG = 6000; + + public ItLaserDesignator() { + super("laserDesignator"); + this.setTextureName("icbm:laserDesignator"); + } + + @Override + public void addInformation(final ItemStack itemStack, + final EntityPlayer par2EntityPlayer, + final List par3List, final boolean par4) { + super.addInformation(itemStack, par2EntityPlayer, par3List, par4); + if (this.getFrequency(itemStack) > 0) { + par3List.add("Frequency: " + this.getFrequency(itemStack)); + } else { + par3List.add("Frequency: Not Set"); + } + } + + @Override + public int getFrequency(final ItemStack itemStack) { + if (itemStack.stackTagCompound == null) { + return 0; + } + return itemStack.stackTagCompound.getInteger("frequency"); + } + + @Override + public void setFrequency(final int frequency, final ItemStack itemStack) { + if (itemStack.stackTagCompound == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + itemStack.stackTagCompound.setInteger("frequency", frequency); + } + + public int getLauncherCountDown(final ItemStack par1ItemStack) { + if (par1ItemStack.stackTagCompound == null) { + return -1; + } + return par1ItemStack.stackTagCompound.getInteger("countDown"); + } + + public void setLauncherCountDown(final ItemStack par1ItemStack, + final int value) { + if (par1ItemStack.stackTagCompound == null) { + par1ItemStack.setTagCompound(new NBTTagCompound()); + } + par1ItemStack.stackTagCompound.setInteger("countDown", value); + } + + public int getLauncherCount(final ItemStack par1ItemStack) { + if (par1ItemStack.stackTagCompound == null) { + return 0; + } + return par1ItemStack.stackTagCompound.getInteger("launcherCount"); + } + + public void setLauncherCount(final ItemStack par1ItemStack, final int value) { + if (par1ItemStack.stackTagCompound == null) { + par1ItemStack.setTagCompound(new NBTTagCompound()); + } + par1ItemStack.stackTagCompound.setInteger("launcherCount", value); + } + + public int getLauncherDelay(final ItemStack par1ItemStack) { + if (par1ItemStack.stackTagCompound == null) { + return 0; + } + return par1ItemStack.stackTagCompound.getInteger("launcherDelay"); + } + + public void setLauncherDelay(final ItemStack par1ItemStack, final int value) { + if (par1ItemStack.stackTagCompound == null) { + par1ItemStack.setTagCompound(new NBTTagCompound()); + } + par1ItemStack.stackTagCompound.setInteger("launcherDelay", value); + } + + public void onUpdate(final ItemStack par1ItemStack, final World par2World, + final Entity par3Entity, final int par4, + final boolean par5) { + super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); + if (!par2World.isRemote) { + final List connectedLaunchers = new ArrayList<>(); + if (this.getLauncherCountDown(par1ItemStack) > 0 || + this.getLauncherCount(par1ItemStack) > 0) { + final Vector3 position = new Vector3(par3Entity.posX, par3Entity.posY, par3Entity.posZ); + final List launchers = LauncherManager.launchersInArea( + new Vector2(position.x - ItLaserDesignator.BAN_JING, + position.z - ItLaserDesignator.BAN_JING), + new Vector2(position.x + ItLaserDesignator.BAN_JING, + position.z + ItLaserDesignator.BAN_JING)); + for (final TLauncherController missileLauncher : launchers) { + if (missileLauncher != null && + missileLauncher.getFrequency() == this.getFrequency(par1ItemStack) && + missileLauncher.canLaunch()) { + connectedLaunchers.add(missileLauncher); + } + } + } + if (this.getLauncherCountDown(par1ItemStack) > 0 && + connectedLaunchers.size() > 0) { + if (this.getLauncherCountDown(par1ItemStack) % 20 == 0) { + ((EntityPlayer) par3Entity) + .addChatMessage(new ChatComponentText( + "Calling air strike in: " + + (int) Math.floor(this.getLauncherCountDown(par1ItemStack) / + 20))); + } + if (this.getLauncherCountDown(par1ItemStack) == 1) { + this.setLauncherCount(par1ItemStack, connectedLaunchers.size()); + this.setLauncherDelay(par1ItemStack, 0); + ((EntityPlayer) par3Entity) + .addChatMessage(new ChatComponentText("Incoming air strike!")); + } + this.setLauncherCountDown(par1ItemStack, + this.getLauncherCountDown(par1ItemStack) - 1); + } + if (this.getLauncherCount(par1ItemStack) > 0 && + this.getLauncherCount(par1ItemStack) <= connectedLaunchers.size() && + connectedLaunchers.size() > 0) { + if (this.getLauncherDelay(par1ItemStack) % 40 == 0) { + connectedLaunchers.get(this.getLauncherCount(par1ItemStack) - 1) + .launch(); + this.setLauncherCount(par1ItemStack, + this.getLauncherCount(par1ItemStack) - 1); + } + if (this.getLauncherCount(par1ItemStack) == 0) { + this.setLauncherDelay(par1ItemStack, 0); + connectedLaunchers.clear(); + } + this.setLauncherDelay(par1ItemStack, + this.getLauncherDelay(par1ItemStack) + 1); + } + } + } + + public boolean onItemUse(final ItemStack par1ItemStack, + final EntityPlayer par2EntityPlayer, + final World par3World, final int x, final int y, + final int z, final int par7, final float par8, + final float par9, final float par10) { + if (!par3World.isRemote) { + final TileEntity tileEntity = par3World.getTileEntity(x, y, z); + if (tileEntity != null && tileEntity instanceof TLauncherController) { + final TLauncherController missileLauncher = (TLauncherController) tileEntity; + if (missileLauncher.getFrequency() > 0) { + this.setFrequency(missileLauncher.getFrequency(), par1ItemStack); + par2EntityPlayer.addChatMessage( + new ChatComponentText("Laser designator frequency Set: " + + this.getFrequency(par1ItemStack))); + } else { + par2EntityPlayer.addChatMessage( + new ChatComponentText("Frequency must be greater than zero.")); + } + } + } + return false; + } + + public ItemStack onItemRightClick(final ItemStack par1ItemStack, + final World par2World, + final EntityPlayer par3EntityPlayer) { + if (par2World.isRemote) { + final MovingObjectPosition objectMouseOver = par3EntityPlayer.rayTrace( + (double) (ItLaserDesignator.BAN_JING * 2), 1.0f); + if (objectMouseOver != null && + objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { + final Block block = par2World.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ); + final int blockMetadata = par2World.getBlockMetadata( + objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ); + if (this.getLauncherCountDown(par1ItemStack) > 0) { + return par1ItemStack; + } + if (block == ICBMExplosion.bJiQi) { + return par1ItemStack; + } + final int airStrikeFreq = this.getFrequency(par1ItemStack); + if (airStrikeFreq > 0) { + if (this.getJoules(par1ItemStack) > 6000.0) { + final Vector3 position = new Vector3(((Entity) par3EntityPlayer).posX, + ((Entity) par3EntityPlayer).posY, + ((Entity) par3EntityPlayer).posZ); + final List launchers = LauncherManager.launchersInArea( + new Vector2(position.x - ItLaserDesignator.BAN_JING, + position.z - ItLaserDesignator.BAN_JING), + new Vector2(position.x + ItLaserDesignator.BAN_JING, + position.z + ItLaserDesignator.BAN_JING)); + boolean doAirStrike = false; + int errorCount = 0; + for (final TLauncherController missileLauncher : launchers) { + if (missileLauncher != null && + missileLauncher.getFrequency() == airStrikeFreq) { + if (missileLauncher instanceof TCruiseLauncher) { + missileLauncher.setTarget(new Vector3( + objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ)); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM", missileLauncher, 2, + // missileLauncher.getTarget().x, + // missileLauncher.getTarget().y, + // missileLauncher.getTarget().z)); + } else { + double previousY = 0.0; + if (missileLauncher.getTarget() != null) { + previousY = missileLauncher.getTarget().y; + } + missileLauncher.setTarget( + new Vector3(objectMouseOver.blockX, previousY, + objectMouseOver.blockZ)); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM", missileLauncher, 2, + // missileLauncher.getTarget().x, + // missileLauncher.getTarget().y, + // missileLauncher.getTarget().z)); + } + if (missileLauncher.canLaunch()) { + doAirStrike = true; + } else { + ++errorCount; + } + } + } + if (doAirStrike && this.getLauncherCountDown(par1ItemStack) >= 0) { + ICBMExplosion.channel.sendToServer(new ItemUsePacket( + ItemUsePacket.Type.LASER_DESIGNATOR, + new Vector3(objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ))); + par3EntityPlayer.addChatMessage( + new ChatComponentText("Calling air strike into designated position!")); + } + } else { + par3EntityPlayer.addChatMessage( + new ChatComponentText("Laser designator out of electricity!")); + } + } else { + par3EntityPlayer.addChatMessage(new ChatComponentText("Laser designator frequency not set!")); + } + } + } + return par1ItemStack; + } + + public double getVoltage(final ItemStack itemStack) { + return 30.0; + } + + public double getMaxJoules(final ItemStack itemStack) { + return 80000.0; + } + + static { + BAN_JING = MainBase.DAO_DAN_ZUI_YUAN; + } +} diff --git a/src/main/java/icbm/zhapin/dianqi/ItRadarGun.java b/src/main/java/icbm/zhapin/dianqi/ItRadarGun.java new file mode 100644 index 0000000..80d89b9 --- /dev/null +++ b/src/main/java/icbm/zhapin/dianqi/ItRadarGun.java @@ -0,0 +1,144 @@ +package icbm.zhapin.dianqi; + +import icbm.core.di.ItElectricICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.ItemUsePacket; +import icbm.zhapin.jiqi.TLauncherController; +import icbm.zhapin.jiqi.TLauncherControlPanel; +import icbm.zhapin.jiqi.TCruiseLauncher; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.vector.Vector3; + +public class ItRadarGun extends ItElectricICBM { + public static final int USED_ENERGY = 1000; + public static final int DISTANCE = 1000; + + public ItRadarGun() { + super("radarGun"); + this.setTextureName("icbm:radarGun"); + } + + @Override + public void addInformation(final ItemStack itemStack, + final EntityPlayer par2EntityPlayer, + final List par3List, final boolean par4) { + super.addInformation(itemStack, par2EntityPlayer, par3List, par4); + final Vector3 coord = this.getSavedCoord(itemStack); + par3List.add("\uaa74Saved Coordinates:"); + par3List.add("X: " + (int) coord.x + ", Y: " + (int) coord.y + + ", Z: " + (int) coord.z); + } + + public ItemStack onItemRightClick(final ItemStack itemStack, + final World par2World, + final EntityPlayer par3EntityPlayer) { + if (par2World.isRemote) { + final MovingObjectPosition objectMouseOver = par3EntityPlayer.rayTrace(1000.0, 1.0f); + if (objectMouseOver != null) { + final TileEntity tileEntity = par2World.getTileEntity( + objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ); + if (!(tileEntity instanceof TLauncherController)) { + if (this.getJoules(itemStack) > 1000.0) { + ICBMExplosion.channel.sendToServer(new ItemUsePacket( + ItemUsePacket.Type.RADAR_GUN, + new Vector3(objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ))); + this.onProvide( + ElectricityPack.getFromWatts(1000.0, this.getJoules(itemStack)), + itemStack); + par3EntityPlayer.addChatMessage(new ChatComponentText( + "Scanned Coordinates: X:" + objectMouseOver.blockX + ", Y:" + + objectMouseOver.blockY + ", Z:" + objectMouseOver.blockZ)); + } else { + par3EntityPlayer.addChatMessage( + new ChatComponentText("Radar gun out of electricity!")); + } + } + } + } + return itemStack; + } + + public boolean onItemUse(final ItemStack par1ItemStack, + final EntityPlayer par2EntityPlayer, + final World par3World, final int x, final int y, + final int z, final int par7, final float par8, + final float par9, final float par10) { + final Block blockId = par3World.getBlock(x, y, z); + if (blockId == ICBMExplosion.bJiQi) { + final TileEntity tileEntity = par3World.getTileEntity(x, y, z); + if (tileEntity != null) { + if (tileEntity instanceof TLauncherControlPanel) { + final TLauncherControlPanel missileLauncher = (TLauncherControlPanel) tileEntity; + final Vector3 savedCords = this.getSavedCoord(par1ItemStack); + if (!savedCords.equals(new Vector3())) { + if (missileLauncher.getTarget() == null) { + missileLauncher.setTarget(new Vector3()); + } + missileLauncher.getTarget().x = (int) savedCords.x; + missileLauncher.getTarget().z = (int) savedCords.z; + if (par3World.isRemote) { + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", missileLauncher, 2, savedCords.x, + // missileLauncher.getTarget().y, savedCords.z)); + par2EntityPlayer.addChatMessage( + new ChatComponentText("Coordinate information transfered!")); + } + } else if (par3World.isRemote) { + par2EntityPlayer.addChatMessage( + new ChatComponentText("You must scan a coordinate!")); + } + } else if (tileEntity instanceof TCruiseLauncher) { + final TCruiseLauncher missileLauncher2 = (TCruiseLauncher) tileEntity; + final Vector3 savedCords = this.getSavedCoord(par1ItemStack); + if (!savedCords.equals(new Vector3())) { + if (missileLauncher2.getTarget() == null) { + missileLauncher2.setTarget(new Vector3()); + } + missileLauncher2.setTarget( + new Vector3(savedCords.x, savedCords.y, savedCords.z)); + if (par3World.isRemote) { + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", missileLauncher2, 2, savedCords.x, + // savedCords.y, savedCords.z)); + par2EntityPlayer.addChatMessage( + new ChatComponentText("Coordinate information transfered!")); + } + } else if (par3World.isRemote) { + par2EntityPlayer.addChatMessage( + new ChatComponentText("You must scan a coordinate!")); + } + } + } + } + return false; + } + + public Vector3 getSavedCoord(final ItemStack par1ItemStack) { + if (par1ItemStack.stackTagCompound == null) { + return new Vector3(); + } + return new Vector3(par1ItemStack.stackTagCompound.getInteger("x"), + par1ItemStack.stackTagCompound.getInteger("y"), + par1ItemStack.stackTagCompound.getInteger("z")); + } + + public double getVoltage(final ItemStack itemStack) { + return 20.0; + } + + public double getMaxJoules(final ItemStack itemStack) { + return 80000.0; + } +} diff --git a/src/main/java/icbm/zhapin/dianqi/ItRemoteDetonator.java b/src/main/java/icbm/zhapin/dianqi/ItRemoteDetonator.java new file mode 100644 index 0000000..c4630e4 --- /dev/null +++ b/src/main/java/icbm/zhapin/dianqi/ItRemoteDetonator.java @@ -0,0 +1,159 @@ +package icbm.zhapin.dianqi; + +import icbm.core.di.ItElectricICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.ItemUsePacket; +import icbm.zhapin.zhapin.TExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.vector.Vector3; + +public class ItRemoteDetonator extends ItElectricICBM { + public static final int RADIUS = 100; + public static final int ENERGY_USED = 1500; + + public ItRemoteDetonator() { + super("remoteDetonator"); + this.setTextureName("icbm:remoteDetonator"); + } + + @Override + public void addInformation(final ItemStack itemStack, + final EntityPlayer player, final List par3List, + final boolean par4) { + super.addInformation(itemStack, player, par3List, par4); + final Vector3 coord = this.getSavedCoord(itemStack); + if (this.nengZha( + coord.getTileEntity((IBlockAccess) ((Entity) player).worldObj))) { + par3List.add("\uaa74Linked Explosive:"); + par3List.add("X: " + (int) coord.x + ", Y: " + (int) coord.y + + ", Z: " + (int) coord.z); + } else { + par3List.add("§4No Linked Explosive"); + } + } + + @Override + public boolean onItemUse(final ItemStack itemStack, + final EntityPlayer entityPlayer, final World world, + final int x, final int y, final int z, + final int par7, final float par8, final float par9, + final float par10) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (entityPlayer.isSneaking() && tileEntity != null && + this.nengZha(tileEntity)) { + if (this.getJoules(itemStack) > 1500.0) { + this.setSavedCoords(itemStack, new Vector3(x, y, z)); + this.onProvide( + ElectricityPack.getFromWatts(1500.0, this.getJoules(itemStack)), + itemStack); + if (world.isRemote) { + entityPlayer.addChatMessage(new ChatComponentText( + "Remote Locked to: X:" + x + ", Y:" + y + ", Z:" + z)); + } + } else if (world.isRemote) { + entityPlayer.addChatMessage( + new ChatComponentText("Remote out of electricity!")); + } + return true; + } + return false; + } + + @Override + public ItemStack onItemRightClick(final ItemStack itemStack, + final World world, + final EntityPlayer entityPlayer) { + if (world.isRemote) { + if (!entityPlayer.isSneaking()) { + final MovingObjectPosition objectMouseOver = entityPlayer.rayTrace(100.0, 1.0f); + if (objectMouseOver != null && + objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { + final TileEntity tileEntity = world.getTileEntity( + objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ); + final Block blockID = world.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, + objectMouseOver.blockZ); + final TileEntity tile = world.getTileEntity(objectMouseOver.blockX, + objectMouseOver.blockY, + objectMouseOver.blockZ); + if (tile != null && tile instanceof TExplosive) { + if (blockID == ICBMExplosion.bJiQi) { + return itemStack; + } + if (this.nengZha(tileEntity)) { + if (this.getJoules(itemStack) > 1500.0) { + // TODO: WTF + //PacketDispatcher.sendPacketToServer( + // PacketManager.getPacket("ICBM|E", tileEntity, 2)); + return itemStack; + } + entityPlayer.addChatMessage( + new ChatComponentText("Remote out of electricity!")); + } + } + } + } else if (this.getJoules(itemStack) > 1500.0) { + final TileEntity tileEntity2 = this.getSavedCoord(itemStack).getTileEntity((IBlockAccess) world); + if (this.nengZha(tileEntity2)) { + // TODO: WTF + //PacketDispatcher.sendPacketToServer( + // PacketManager.getPacket("ICBM|E", tileEntity2, 2)); + ICBMExplosion.channel.sendToServer( + new ItemUsePacket(ItemUsePacket.Type.REMOTE, new Vector3())); + } + } else { + entityPlayer.addChatMessage(new ChatComponentText("Remote out of electricity!")); + } + } + return itemStack; + } + + public boolean nengZha(final TileEntity tileEntity) { + return tileEntity != null && tileEntity instanceof TExplosive && + (((TExplosive) tileEntity).explosiveId == ZhaPin.condensed.getID() || + ((TExplosive) tileEntity).explosiveId == ZhaPin.breaching.getID() || + ((TExplosive) tileEntity).explosiveId == ZhaPin.sMine.getID()); + } + + public void setSavedCoords(final ItemStack itemStack, + final Vector3 position) { + if (itemStack.stackTagCompound == null) { + itemStack.setTagCompound(new NBTTagCompound()); + } + itemStack.stackTagCompound.setInteger("x", position.intX()); + itemStack.stackTagCompound.setInteger("y", position.intY()); + itemStack.stackTagCompound.setInteger("z", position.intZ()); + } + + public Vector3 getSavedCoord(final ItemStack par1ItemStack) { + if (par1ItemStack.stackTagCompound == null) { + return new Vector3(); + } + return new Vector3(par1ItemStack.stackTagCompound.getInteger("x"), + par1ItemStack.stackTagCompound.getInteger("y"), + par1ItemStack.stackTagCompound.getInteger("z")); + } + + @Override + public double getVoltage(final ItemStack itemStack) { + return 20.0; + } + + @Override + public double getMaxJoules(final ItemStack itemStack) { + return 50000.0; + } +} diff --git a/src/main/java/icbm/zhapin/dianqi/ItRocketLauncher.java b/src/main/java/icbm/zhapin/dianqi/ItRocketLauncher.java new file mode 100644 index 0000000..3113992 --- /dev/null +++ b/src/main/java/icbm/zhapin/dianqi/ItRocketLauncher.java @@ -0,0 +1,79 @@ +package icbm.zhapin.dianqi; + +import icbm.core.di.ItElectricICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.daodan.ItMissile; +import icbm.zhapin.daodan.ItModuleMissile; +import icbm.zhapin.daodan.MissileBase; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.vector.Vector3; + +public class ItRocketLauncher extends ItElectricICBM { + public ItRocketLauncher() { + super("rocketLauncher"); + } + + public EnumAction getItemUseAction(final ItemStack par1ItemStack) { + return EnumAction.bow; + } + + public ItemStack onItemRightClick(final ItemStack itemStack, + final World world, + final EntityPlayer player) { + if (!world.isRemote && this.getJoules(itemStack) >= 5000.0) { + for (int i = 0; i < player.inventory.getSizeInventory(); ++i) { + final ItemStack inventoryStack = player.inventory.getStackInSlot(i); + if (inventoryStack != null && inventoryStack.getItem() instanceof ItMissile) { + int haoMa = inventoryStack.getItemDamage(); + if (inventoryStack.getItem() instanceof ItModuleMissile) { + haoMa += 100; + } + final MissileBase daoDan = MissileBase.list[haoMa]; + if (daoDan != null && + !ICBMExplosion.shiBaoHu(world, new Vector3((Entity) player), + ZhaPin.ZhaPinType.DAO_DAN, haoMa)) { + if (daoDan.getTier() <= 2 && daoDan.isCruise()) { + final Vector3 diDian = Vector3.add(new Vector3((Entity) player), + new Vector3(0.0, 0.5, 0.0)); + final Vector3 kan = new Vector3(player.getLook(1.0f)); + final Vector3 kaiShiDiDian = Vector3.add(diDian, Vector3.multiply(kan, 1.1)); + final Vector3 muBiao = Vector3.add(diDian, Vector3.multiply(kan, 100.0)); + final EMissile eDaoDan = new EMissile( + world, kaiShiDiDian, daoDan.getID(), + ((Entity) player).rotationYaw, ((Entity) player).rotationPitch); + world.spawnEntityInWorld((Entity) eDaoDan); + eDaoDan.launch(muBiao); + if (!player.capabilities.isCreativeMode) { + player.inventory.setInventorySlotContents(i, (ItemStack) null); + } + this.onProvide(ElectricityPack.getFromWatts( + 5000.0, this.getJoules(itemStack)), + itemStack); + return itemStack; + } + } else { + player.addChatMessage( + new ChatComponentText("Region being is protected.")); + } + } + } + } + return itemStack; + } + + public double getVoltage(final ItemStack itemStack) { + return 25.0; + } + + public double getMaxJoules(final ItemStack itemStack) { + return 100000.0; + } +} diff --git a/src/main/java/icbm/zhapin/fx/FXAntimatter.java b/src/main/java/icbm/zhapin/fx/FXAntimatter.java new file mode 100644 index 0000000..c28b165 --- /dev/null +++ b/src/main/java/icbm/zhapin/fx/FXAntimatter.java @@ -0,0 +1,109 @@ +package icbm.zhapin.fx; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.vector.Vector3; + +@SideOnly(Side.CLIENT) +public class FXAntimatter extends EntityFX { + float antimatterParticleScale; + + public FXAntimatter(final World par1World, final Vector3 position, + final double par8, final double par10, final double par12, + final double distance) { + this(par1World, position, par8, par10, par12, 1.0f, distance); + } + + public FXAntimatter(final World par1World, final Vector3 position, + final double par8, final double par10, final double par12, + final float par14, final double distance) { + super(par1World, position.x, position.y, position.z, 0.0, 0.0, 0.0); + ((Entity) this).motionX *= 0.10000000149011612; + ((Entity) this).motionY *= 0.10000000149011612; + ((Entity) this).motionZ *= 0.10000000149011612; + ((Entity) this).motionX += par8; + ((Entity) this).motionY += par10; + ((Entity) this).motionZ += par12; + final float particleRed = (float) (Math.random() * 0.30000001192092896); + super.particleBlue = particleRed; + super.particleGreen = particleRed; + super.particleRed = particleRed; + super.particleScale *= 0.75f; + super.particleScale *= par14; + this.antimatterParticleScale = super.particleScale; + super.particleMaxAge = (int) (10.0 / (Math.random() * 0.8 + 0.2)); + super.particleMaxAge *= (int) par14; + ((Entity) this).renderDistanceWeight = distance; + ((Entity) this).noClip = false; + } + + public void renderParticle(final Tessellator tessellator, final float par2, + final float par3, final float par4, + final float par5, final float par6, + final float par7) { + float agescale = 0.0f; + agescale = (float) (super.particleAge / (super.particleMaxAge / 2)); + if (agescale > 1.0f) { + agescale = 2.0f - agescale; + } + super.particleScale = this.antimatterParticleScale * agescale; + tessellator.draw(); + GL11.glPushMatrix(); + GL11.glDepthMask(false); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + Minecraft.getMinecraft().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/antimatter.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.75f); + final float f10 = 0.5f * super.particleScale; + final float f11 = (float) (((Entity) this).prevPosX + + (((Entity) this).posX - ((Entity) this).prevPosX) * par2 - + EntityFX.interpPosX); + final float f12 = (float) (((Entity) this).prevPosY + + (((Entity) this).posY - ((Entity) this).prevPosY) * par2 - + EntityFX.interpPosY); + final float f13 = (float) (((Entity) this).prevPosZ + + (((Entity) this).posZ - ((Entity) this).prevPosZ) * par2 - + EntityFX.interpPosZ); + tessellator.startDrawingQuads(); + tessellator.setBrightness(240); + tessellator.setColorRGBA_F(super.particleRed, super.particleGreen, + super.particleBlue, 0.5f); + tessellator.addVertexWithUV( + (double) (f11 - par3 * f10 - par5 * f10), (double) (f12 - par4 * f10), + (double) (f13 - par5 * f10 - par7 * f10), 0.0, 1.0); + tessellator.addVertexWithUV( + (double) (f11 - par3 * f10 + par5 * f10), (double) (f12 + par4 * f10), + (double) (f13 - par5 * f10 + par7 * f10), 1.0, 1.0); + tessellator.addVertexWithUV( + (double) (f11 + par3 * f10 + par5 * f10), (double) (f12 + par4 * f10), + (double) (f13 + par5 * f10 + par7 * f10), 1.0, 0.0); + tessellator.addVertexWithUV( + (double) (f11 + par3 * f10 - par5 * f10), (double) (f12 - par4 * f10), + (double) (f13 + par5 * f10 - par7 * f10), 0.0, 0.0); + tessellator.draw(); + GL11.glDisable(3042); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/antimatter.png")); + tessellator.startDrawingQuads(); + } + + public void onUpdate() { + ((Entity) this).prevPosX = ((Entity) this).posX; + ((Entity) this).prevPosY = ((Entity) this).posY; + ((Entity) this).prevPosZ = ((Entity) this).posZ; + if (super.particleAge++ >= super.particleMaxAge) { + this.setDead(); + } + } +} diff --git a/src/main/java/icbm/zhapin/fx/FXPortal.java b/src/main/java/icbm/zhapin/fx/FXPortal.java new file mode 100644 index 0000000..3d5baa6 --- /dev/null +++ b/src/main/java/icbm/zhapin/fx/FXPortal.java @@ -0,0 +1,23 @@ +package icbm.zhapin.fx; + +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.EntityPortalFX; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +@SideOnly(Side.CLIENT) +public class FXPortal extends EntityPortalFX { + public FXPortal(final World par1World, final Vector3 position, final float red, + final float green, final float blue, final float scale, + final double distance) { + super(par1World, position.x, position.y, position.z, 0.0, 0.0, 0.0); + this.particleScale = scale; + this.portalParticleScale = scale; + ((Entity) this).renderDistanceWeight = distance; + } +} diff --git a/src/main/java/icbm/zhapin/fx/FXShockwave.java b/src/main/java/icbm/zhapin/fx/FXShockwave.java new file mode 100644 index 0000000..2b0e834 --- /dev/null +++ b/src/main/java/icbm/zhapin/fx/FXShockwave.java @@ -0,0 +1,65 @@ +package icbm.zhapin.fx; + +import calclavia.lib.render.CalclaviaRenderHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.Sphere; +import universalelectricity.core.vector.Vector3; + +@SideOnly(Side.CLIENT) +public class FXShockwave extends EntityFX { + public FXShockwave(final World par1World, final Vector3 position, + final float par8, final float par10, final float par12, + final double distance) { + this(par1World, position, par8, par10, par12, 1.0f, distance); + } + + public FXShockwave(final World par1World, final Vector3 position, final float r, + final float g, final float b, final float size, + final double distance) { + super(par1World, position.x, position.y, position.z, 0.0, 0.0, 0.0); + super.particleRed = r; + super.particleGreen = g; + super.particleBlue = b; + super.particleScale = size; + super.particleMaxAge = (int) (10.0 / (Math.random() * 0.8 + 0.2)); + super.particleMaxAge *= (int) size; + ((Entity) this).renderDistanceWeight = distance; + ((Entity) this).noClip = false; + } + + @Override + public void renderParticle(final Tessellator tessellator, final float par2, + final float par3, final float par4, + final float par5, final float par6, + final float par7) { + GL11.glPushMatrix(); + GL11.glTranslated(((Entity) this).posX, ((Entity) this).posY, + ((Entity) this).posZ); + CalclaviaRenderHelper.enableBlending(); + CalclaviaRenderHelper.disableLighting(); + GL11.glColor4f(super.particleRed / 255.0f, super.particleGreen / 255.0f, + super.particleBlue / 255.0f, 0.5f); + final Sphere sphere = new Sphere(); + sphere.draw(super.particleScale, 32, 32); + CalclaviaRenderHelper.enableLighting(); + CalclaviaRenderHelper.disableBlending(); + GL11.glPopMatrix(); + } + + @Override + public void onUpdate() { + ((Entity) this).prevPosX = ((Entity) this).posX; + ((Entity) this).prevPosY = ((Entity) this).posY; + ((Entity) this).prevPosZ = ((Entity) this).posZ; + ++super.particleScale; + if (super.particleAge++ >= super.particleMaxAge) { + this.setDead(); + } + } +} diff --git a/src/main/java/icbm/zhapin/fx/FXSmoke.java b/src/main/java/icbm/zhapin/fx/FXSmoke.java new file mode 100644 index 0000000..1789e36 --- /dev/null +++ b/src/main/java/icbm/zhapin/fx/FXSmoke.java @@ -0,0 +1,30 @@ +package icbm.zhapin.fx; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.particle.EntitySmokeFX; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +@SideOnly(Side.CLIENT) +public class FXSmoke extends EntitySmokeFX { + public FXSmoke(final World par1World, final Vector3 position, final float red, + final float green, final float blue, final float scale, + final double distance) { + super(par1World, position.x, position.y, position.z, 0.0, 0.0, 0.0, scale); + ((Entity) this).renderDistanceWeight = distance; + this.particleRed = red; + this.particleBlue = blue; + this.particleGreen = green; + final float colorVarient = (float) (Math.random() * 0.9000000119209289); + this.particleRed *= colorVarient; + this.particleBlue *= colorVarient; + this.particleGreen *= colorVarient; + } + + public FXSmoke setAge(final int age) { + this.particleMaxAge = age; + return this; + } +} diff --git a/src/main/java/icbm/zhapin/gui/GEmpTower.java b/src/main/java/icbm/zhapin/gui/GEmpTower.java new file mode 100644 index 0000000..8e8cf5a --- /dev/null +++ b/src/main/java/icbm/zhapin/gui/GEmpTower.java @@ -0,0 +1,149 @@ +package icbm.zhapin.gui; + +import icbm.zhapin.jiqi.TEmpTower; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricityDisplay; +import universalelectricity.prefab.GuiBase; + +public class GEmpTower extends GuiBase { + private TEmpTower tileEntity; + private GuiTextField textFieldBanJing; + private int containerWidth; + private int containerHeight; + + public GEmpTower(final TEmpTower tileEntity) { + this.tileEntity = tileEntity; + } + + @Override + public void initGui() { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add(new GuiButton( + 0, this.width / 2 - 77, this.height / 2 - 10, 50, 20, "Missiles")); + this.buttonList.add(new GuiButton( + 1, this.width / 2 - 25, this.height / 2 - 10, 65, 20, "Electricity")); + this.buttonList.add(new GuiButton(2, this.width / 2 + 43, + this.height / 2 - 10, 35, 20, "Both")); + (this.textFieldBanJing = new GuiTextField(this.fontRendererObj, 72, 28, 30, 12)) + .setMaxStringLength(3); + this.textFieldBanJing.setText(this.tileEntity.radius + ""); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket("ICBM|E", + // this.tileEntity, -1, true)); + } + + @Override + public void onGuiClosed() { + super.onGuiClosed(); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket("ICBM|E", + // this.tileEntity, -1, false)); + } + + @Override + protected void actionPerformed(final GuiButton par1GuiButton) { + switch (par1GuiButton.id) { + case 0: { + this.tileEntity.holzOhJa = 1; + break; + } + case 1: { + this.tileEntity.holzOhJa = 2; + break; + } + case 2: { + this.tileEntity.holzOhJa = 0; + break; + } + } + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket("ICBM|E", + // this.tileEntity, 3, this.tileEntity.muoShi)); + } + + @Override + public void keyTyped(final char par1, final int par2) { + super.keyTyped(par1, par2); + this.textFieldBanJing.textboxKeyTyped(par1, par2); + try { + final int radius = Math.min( + Math.max(Integer.parseInt(this.textFieldBanJing.getText()), 10), 150); + this.tileEntity.radius = radius; + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket("ICBM|E", + // this.tileEntity, 2, this.tileEntity.banJing)); + } catch (final NumberFormatException ex) { + } + } + + @Override + public void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.textFieldBanJing.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + } + + @Override + protected void drawForegroundLayer(final int var2, final int var3, + final float var1) { + this.fontRendererObj.drawString("§7EMP Tower", 65, 6, 4210752); + this.fontRendererObj.drawString("EMP Radius: blocks", 12, 30, + 4210752); + this.textFieldBanJing.drawTextBox(); + this.fontRendererObj.drawString("EMP Effect:", 12, 55, 4210752); + String mode = "Debilitate Electronics"; + if (this.tileEntity.holzOhJa == 1) { + mode = "Disrupt Missiles"; + } else if (this.tileEntity.holzOhJa == 2) { + mode = "Deplete Electricity"; + } + this.fontRendererObj.drawString("Mode: " + mode, 12, 105, 4210752); + String color = "§4"; + String status = "Idle"; + if (this.tileEntity.isDisabled()) { + status = "Disabled"; + } else if (this.tileEntity.getJoules() < this.tileEntity.getMaxJoules()) { + status = "Insufficient electricity!"; + } else { + color = "§2"; + status = "Ready to blast!"; + } + this.fontRendererObj.drawString(color + "Status: " + status, 12, 120, + 4210752); + this.fontRendererObj.drawString( + "Voltage: " + this.tileEntity.getVoltage() + "v", 12, 135, 4210752); + this.fontRendererObj.drawString( + ElectricityDisplay.getDisplayShort( + this.tileEntity.getJoules(), + ElectricityDisplay.ElectricUnit.JOULES) + + "/" + + ElectricityDisplay.getDisplayShort( + this.tileEntity.getMaxJoules(), + ElectricityDisplay.ElectricUnit.JOULES), + 12, 150, 4210752); + } + + @Override + protected void drawBackgroundLayer(final int var2, final int var3, + final float var1) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerWidth = (this.width - super.xSize) / 2; + this.containerHeight = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + super.xSize, super.ySize); + } + + @Override + public void updateScreen() { + super.updateScreen(); + if (!this.textFieldBanJing.isFocused()) { + this.textFieldBanJing.setText(this.tileEntity.radius + ""); + } + } +} diff --git a/src/main/java/icbm/zhapin/gui/GFaSheDi.java b/src/main/java/icbm/zhapin/gui/GFaSheDi.java new file mode 100644 index 0000000..be4a297 --- /dev/null +++ b/src/main/java/icbm/zhapin/gui/GFaSheDi.java @@ -0,0 +1,46 @@ +package icbm.zhapin.gui; + +import icbm.zhapin.jiqi.TLauncherPlatform; +import icbm.zhapin.rongqi.CFaShiDi; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +public class GFaSheDi extends GuiContainer { + private TLauncherPlatform tileEntity; + private int containerWidth; + private int containerHeight; + + public GFaSheDi(final InventoryPlayer par1InventoryPlayer, + final TLauncherPlatform tileEntity) { + super((Container) new CFaShiDi(par1InventoryPlayer, tileEntity)); + this.tileEntity = tileEntity; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, + final int par2) { + this.fontRendererObj.drawString("§7" + this.tileEntity.getInventoryName(), 48, + 6, 4210752); + this.fontRendererObj.drawString("Place Missile", 63, 28, 4210752); + this.fontRendererObj.drawString( + StatCollector.translateToLocal("container.inventory"), 8, + this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, + final int par2, + final int par3) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_launcher.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerWidth = (this.width - this.xSize) / 2; + this.containerHeight = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + this.xSize, this.ySize); + } +} diff --git a/src/main/java/icbm/zhapin/gui/GMissileLauncher.java b/src/main/java/icbm/zhapin/gui/GMissileLauncher.java new file mode 100644 index 0000000..7fb1cf4 --- /dev/null +++ b/src/main/java/icbm/zhapin/gui/GMissileLauncher.java @@ -0,0 +1,186 @@ +package icbm.zhapin.gui; + +import icbm.zhapin.jiqi.TLauncherControlPanel; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricityDisplay; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.GuiBase; + +public class GMissileLauncher extends GuiBase { + private TLauncherControlPanel tileEntity; + private GuiTextField tFX; + private GuiTextField tFY; + private GuiTextField tFZ; + private GuiTextField tFFreq; + private GuiTextField tFGaoDu; + private int containerWidth; + private int containerHeight; + + public GMissileLauncher( + final TLauncherControlPanel par2ICBMTileEntityMissileLauncher) { + this.tileEntity = par2ICBMTileEntityMissileLauncher; + } + + @Override + public void initGui() { + super.initGui(); + this.tFX = new GuiTextField(this.fontRendererObj, 110, 37, 45, 12); + this.tFZ = new GuiTextField(this.fontRendererObj, 110, 52, 45, 12); + this.tFY = new GuiTextField(this.fontRendererObj, 110, 67, 45, 12); + this.tFGaoDu = new GuiTextField(this.fontRendererObj, 110, 82, 45, 12); + (this.tFFreq = new GuiTextField(this.fontRendererObj, 110, 97, 45, 12)) + .setMaxStringLength(4); + this.tFX.setMaxStringLength(6); + this.tFZ.setMaxStringLength(6); + this.tFY.setMaxStringLength(2); + this.tFGaoDu.setMaxStringLength(2); + this.tFFreq.setText(this.tileEntity.getFrequency() + ""); + this.tFGaoDu.setText(this.tileEntity.height + ""); + if (this.tileEntity.getTarget() == null) { + this.tFX.setText(Math.round((float) this.tileEntity.xCoord) + ""); + this.tFZ.setText(Math.round((float) this.tileEntity.zCoord) + ""); + this.tFY.setText("0"); + } else { + this.tFX.setText(Math.round(this.tileEntity.getTarget().x) + ""); + this.tFZ.setText(Math.round(this.tileEntity.getTarget().z) + ""); + this.tFY.setText(Math.round(this.tileEntity.getTarget().y) + ""); + } + } + + @Override + public void keyTyped(final char par1, final int par2) { + super.keyTyped(par1, par2); + this.tFX.textboxKeyTyped(par1, par2); + this.tFZ.textboxKeyTyped(par1, par2); + if (this.tileEntity.getTier() >= 1) { + this.tFY.textboxKeyTyped(par1, par2); + this.tFGaoDu.textboxKeyTyped(par1, par2); + if (this.tileEntity.getTier() > 1) { + this.tFFreq.textboxKeyTyped(par1, par2); + } + } + try { + final Vector3 newTarget = new Vector3(Integer.parseInt(this.tFX.getText()), + Math.max(Integer.parseInt(this.tFY.getText()), 0), + Integer.parseInt(this.tFZ.getText())); + this.tileEntity.setTarget(newTarget); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 2, this.tileEntity.getTarget().x, + // this.tileEntity.getTarget().y, this.tileEntity.getTarget().z)); + } catch (final NumberFormatException ex) { + } + try { + final short newFrequency = (short) Math.max(Short.parseShort(this.tFFreq.getText()), 0); + this.tileEntity.setFrequency(newFrequency); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 1, this.tileEntity.getFrequency())); + } catch (final NumberFormatException ex2) { + } + try { + final short newGaoDu = (short) Math.max( + Math.min(Short.parseShort(this.tFGaoDu.getText()), 99), 3); + this.tileEntity.height = newGaoDu; + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 3, this.tileEntity.gaoDu)); + } catch (final NumberFormatException ex3) { + } + } + + @Override + public void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.tFX.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.tFZ.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + if (this.tileEntity.getTier() >= 1) { + this.tFY.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.tFGaoDu.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + if (this.tileEntity.getTier() > 1) { + this.tFFreq.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + } + } + } + + @Override + public void drawForegroundLayer(final int var2, final int var3, + final float var1) { + this.tFX.drawTextBox(); + this.tFZ.drawTextBox(); + if (this.tileEntity.getTier() >= 1) { + this.tFY.drawTextBox(); + this.fontRendererObj.drawString("Detonation Height:", 12, 68, 4210752); + this.tFGaoDu.drawTextBox(); + this.fontRendererObj.drawString("Lock Height:", 12, 83, 4210752); + if (this.tileEntity.getTier() > 1) { + this.tFFreq.drawTextBox(); + this.fontRendererObj.drawString("Frequency:", 12, 98, 4210752); + } + } + this.fontRendererObj.drawString("", 45, 6, 4210752); + this.fontRendererObj.drawString("§7Launcher Control Panel", 30, 6, 4210752); + this.fontRendererObj.drawString("Missile Target", 12, 25, 4210752); + this.fontRendererObj.drawString("X-Coord:", 25, 40, 4210752); + this.fontRendererObj.drawString("Z-Coord:", 25, 55, 4210752); + int inaccuracy = 30; + if (this.tileEntity.faSheDi != null && + this.tileEntity.faSheDi.jiaZi != null) { + inaccuracy = this.tileEntity.faSheDi.jiaZi.getInaccuracy(); + } + this.fontRendererObj.drawString("Inaccuracy: " + inaccuracy + " blocks", 12, + 113, 4210752); + this.fontRendererObj.drawString("Status: " + this.tileEntity.getStatus(), + 12, 125, 4210752); + this.fontRendererObj.drawString( + "Voltage: " + this.tileEntity.getVoltage() + "v", 12, 137, 4210752); + this.fontRendererObj.drawString( + ElectricityDisplay.getDisplayShort( + this.tileEntity.getJoules(), + ElectricityDisplay.ElectricUnit.JOULES) + + "/" + + ElectricityDisplay.getDisplayShort( + this.tileEntity.getMaxJoules(), + ElectricityDisplay.ElectricUnit.JOULES), + 12, 150, 4210752); + } + + @Override + protected void drawBackgroundLayer(final int var2, final int var3, + final float var1) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_empty.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerWidth = (this.width - super.xSize) / 2; + this.containerHeight = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + super.xSize, super.ySize); + } + + @Override + public void updateScreen() { + super.updateScreen(); + if (!this.tFX.isFocused()) { + this.tFX.setText(Math.round(this.tileEntity.getTarget().x) + ""); + } + if (!this.tFZ.isFocused()) { + this.tFZ.setText(Math.round(this.tileEntity.getTarget().z) + ""); + } + if (!this.tFY.isFocused()) { + this.tFY.setText(Math.round(this.tileEntity.getTarget().y) + ""); + } + if (!this.tFGaoDu.isFocused()) { + this.tFGaoDu.setText(this.tileEntity.height + ""); + } + if (!this.tFFreq.isFocused()) { + this.tFFreq.setText(this.tileEntity.getFrequency() + ""); + } + } +} diff --git a/src/main/java/icbm/zhapin/gui/GRadarTower.java b/src/main/java/icbm/zhapin/gui/GRadarTower.java new file mode 100644 index 0000000..ec1e382 --- /dev/null +++ b/src/main/java/icbm/zhapin/gui/GRadarTower.java @@ -0,0 +1,244 @@ +package icbm.zhapin.gui; + +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.jiqi.BMachine; +import icbm.zhapin.jiqi.TRadarTower; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricityDisplay; +import universalelectricity.core.vector.Vector2; +import universalelectricity.prefab.GuiBase; +import universalelectricity.prefab.TranslationHelper; +import universalelectricity.prefab.vector.Region2; + +public class GRadarTower extends GuiBase { + private TRadarTower tileEntity; + private int containerPosX; + private int containerPosY; + private GuiTextField textFieldAlarmRange; + private GuiTextField textFieldSafetyZone; + private Vector2 mouseOverCoords; + private Vector2 mousePosition; + private Vector2 radarCenter; + private float radarMapRadius; + private String info; + private String info2; + + public GRadarTower(final TRadarTower tileEntity) { + this.mouseOverCoords = new Vector2(); + this.mousePosition = new Vector2(); + this.info = ""; + this.tileEntity = tileEntity; + this.mouseOverCoords = new Vector2(this.tileEntity.xCoord, this.tileEntity.zCoord); + super.xSize = 256; + this.radarCenter = new Vector2(this.containerPosX + super.xSize / 3 - 14, + this.containerPosY + super.ySize / 2 + 4); + this.radarMapRadius = 7.836991f; + } + + @Override + public void initGui() { + super.initGui(); + (this.textFieldSafetyZone = new GuiTextField(this.fontRendererObj, 155, 83, 30, 12)) + .setMaxStringLength(3); + this.textFieldSafetyZone.setText(this.tileEntity.safetyRadius + ""); + (this.textFieldAlarmRange = new GuiTextField(this.fontRendererObj, 155, 110, 30, 12)) + .setMaxStringLength(3); + this.textFieldAlarmRange.setText(this.tileEntity.alarmRadius + ""); + } + + @Override + public void keyTyped(final char par1, final int par2) { + super.keyTyped(par1, par2); + this.textFieldSafetyZone.textboxKeyTyped(par1, par2); + this.textFieldAlarmRange.textboxKeyTyped(par1, par2); + try { + final int newSafetyRadius = Math.min( + 500, + Math.max(0, Integer.parseInt(this.textFieldSafetyZone.getText()))); + this.tileEntity.safetyRadius = newSafetyRadius; + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 2, this.tileEntity.safetyBanJing)); + } catch (final NumberFormatException ex) { + } + try { + final int newAlarmRadius = Math.min( + 500, + Math.max(0, Integer.parseInt(this.textFieldAlarmRange.getText()))); + this.tileEntity.alarmRadius = newAlarmRadius; + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 3, this.tileEntity.alarmBanJing)); + } catch (final NumberFormatException ex2) { + } + } + + @Override + public void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.textFieldAlarmRange.mouseClicked(par1 - this.containerPosX, + par2 - this.containerPosY, par3); + this.textFieldSafetyZone.mouseClicked(par1 - this.containerPosX, + par2 - this.containerPosY, par3); + } + + @Override + protected void drawForegroundLayer(final int var2, final int var3, + final float var1) { + this.fontRendererObj.drawString( + "§7" + TranslationHelper.getLocal("icbm.machine.9.name"), + super.xSize / 2 - 30, 6, 4210752); + this.fontRendererObj.drawString("Coordinates:", 155, 18, 4210752); + this.fontRendererObj.drawString( + "X: " + (int) Math.round(this.mouseOverCoords.x) + + " Z: " + (int) Math.round(this.mouseOverCoords.y), + 155, 30, 4210752); + this.fontRendererObj.drawString("§6" + this.info, 155, 42, 4210752); + this.fontRendererObj.drawString("§4" + this.info2, 155, 54, 4210752); + this.fontRendererObj.drawString("Safe Zone:", 155, 70, 4210752); + this.textFieldSafetyZone.drawTextBox(); + this.fontRendererObj.drawString("Blocks", 190, 85, 4210752); + this.fontRendererObj.drawString("Alarm Range:", 155, 98, 4210752); + this.textFieldAlarmRange.drawTextBox(); + this.fontRendererObj.drawString("Blocks", 190, 112, 4210752); + this.fontRendererObj.drawString( + ElectricityDisplay.getDisplay(this.tileEntity.getRequest().getWatts() * + 20.0, + ElectricityDisplay.ElectricUnit.WATT), + 155, 128, 4210752); + this.fontRendererObj.drawString( + ElectricityDisplay.getDisplay(this.tileEntity.getVoltage(), + ElectricityDisplay.ElectricUnit.VOLTAGE), + 155, 138, 4210752); + String color = "§4"; + String status = "Idle"; + if (this.tileEntity.isDisabled()) { + status = "Disabled!"; + } else if (this.tileEntity.prevWatts >= this.tileEntity.getRequest().getWatts()) { + color = "§2"; + status = "Radar On!"; + } else { + status = "No Electricity!"; + } + this.fontRendererObj.drawString(color + status, 155, 150, 4210752); + } + + @Override + protected void drawBackgroundLayer(final int var2, final int var3, + final float var1) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_radar.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerPosX = (this.width - super.xSize) / 2; + this.containerPosY = (this.height - super.ySize) / 2; + this.drawTexturedModalRect(this.containerPosX, this.containerPosY, 0, 0, + super.xSize, super.ySize); + this.radarCenter = new Vector2(this.containerPosX + super.xSize / 3 - 10, + this.containerPosY + super.ySize / 2 + 4); + this.radarMapRadius = 7.0422535f; + this.info = ""; + this.info2 = ""; + if (this.tileEntity.prevWatts >= this.tileEntity.getRequest().getWatts()) { + int range = 4; + for (final Entity entity : this.tileEntity.xunZhaoEntity) { + final Vector2 position = new Vector2( + this.radarCenter.x + + (entity.posX - this.tileEntity.xCoord) / this.radarMapRadius, + this.radarCenter.y - + (entity.posZ - this.tileEntity.zCoord) / this.radarMapRadius); + if (entity instanceof EMissile) { + if (this.tileEntity.isWeiXianDaoDan((EMissile) entity)) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/reddot.png")); + } else { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/yellowdot.png")); + } + } else { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/yellowdot.png")); + } + this.drawTexturedModalRect(position.intX(), position.intY(), 0, 0, 2, + 2); + final Vector2 minPosition = position.clone(); + minPosition.add(-range); + final Vector2 maxPosition = position.clone(); + maxPosition.add(range); + if (new Region2(minPosition, maxPosition).isIn(this.mousePosition)) { + this.info = entity.getCommandSenderName(); + if (entity instanceof EntityPlayer) { + this.info = "§1" + this.info; + } + if (!(entity instanceof EMissile) || + ((EMissile) entity).target == null) { + continue; + } + this.info2 = "(" + ((EMissile) entity).target.intX() + ", " + + ((EMissile) entity).target.intZ() + ")"; + } + } + range = 2; + for (final TileEntity jiQi : this.tileEntity.xunZhaoJiQi) { + final Vector2 position = new Vector2( + this.radarCenter.x + + (jiQi.xCoord - this.tileEntity.xCoord) / this.radarMapRadius, + this.radarCenter.y - + (jiQi.zCoord - this.tileEntity.zCoord) / this.radarMapRadius); + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/whitedot.png")); + this.drawTexturedModalRect(position.intX(), position.intY(), 0, 0, 2, + 2); + final Vector2 minPosition = position.clone(); + minPosition.add(-range); + final Vector2 maxPosition = position.clone(); + maxPosition.add(range); + if (new Region2(minPosition, maxPosition).isIn(this.mousePosition) && + jiQi.getBlockType() != null) { + if (jiQi.getBlockType() instanceof BMachine) { + this.info = BMachine.getMachineName(jiQi); + } else { + this.info = jiQi.getBlockType().getLocalizedName(); + } + } + } + } + } + + @Override + public void updateScreen() { + super.updateScreen(); + if (Mouse.isInsideWindow() && Mouse.getEventButton() == -1) { + this.mousePosition = new Vector2( + Mouse.getEventX() * this.width / this.mc.displayWidth, + this.height - + Mouse.getEventY() * this.height / this.mc.displayHeight - 1); + final float difference = 500.0f / this.radarMapRadius; + if (this.mousePosition.x > this.radarCenter.x - difference && + this.mousePosition.x < this.radarCenter.x + + difference + && this.mousePosition.y > this.radarCenter.y - + difference + && + this.mousePosition.y < this.radarCenter.y + difference) { + final int xDifference = (int) (this.mousePosition.x - this.radarCenter.x); + final int yDifference = (int) (this.mousePosition.y - this.radarCenter.y); + final int xBlockDistance = (int) (xDifference * this.radarMapRadius); + final int yBlockDistance = (int) (yDifference * this.radarMapRadius); + this.mouseOverCoords = new Vector2(this.tileEntity.xCoord + xBlockDistance, + this.tileEntity.zCoord - yBlockDistance); + } + } + if (!this.textFieldSafetyZone.isFocused()) { + this.textFieldSafetyZone.setText(this.tileEntity.safetyRadius + ""); + } + if (!this.textFieldAlarmRange.isFocused()) { + this.textFieldAlarmRange.setText(this.tileEntity.alarmRadius + ""); + } + } +} diff --git a/src/main/java/icbm/zhapin/gui/GXiaoFaSheQi.java b/src/main/java/icbm/zhapin/gui/GXiaoFaSheQi.java new file mode 100644 index 0000000..64c2b3f --- /dev/null +++ b/src/main/java/icbm/zhapin/gui/GXiaoFaSheQi.java @@ -0,0 +1,154 @@ +package icbm.zhapin.gui; + +import icbm.zhapin.jiqi.TCruiseLauncher; +import icbm.zhapin.rongqi.CXiaoFaSheQi; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; +import universalelectricity.core.electricity.ElectricityDisplay; +import universalelectricity.core.vector.Vector3; + +public class GXiaoFaSheQi extends GuiContainer { + private TCruiseLauncher tileEntity; + private GuiTextField textFieldX; + private GuiTextField textFieldZ; + private GuiTextField textFieldY; + private GuiTextField textFieldFreq; + private int containerWidth; + private int containerHeight; + + public GXiaoFaSheQi(final InventoryPlayer par1InventoryPlayer, + final TCruiseLauncher tileEntity) { + super((Container) new CXiaoFaSheQi(par1InventoryPlayer, tileEntity)); + this.tileEntity = tileEntity; + } + + @Override + public void initGui() { + super.initGui(); + this.textFieldX = new GuiTextField(this.fontRendererObj, 20, 21, 35, 12); + this.textFieldY = new GuiTextField(this.fontRendererObj, 20, 37, 35, 12); + this.textFieldZ = new GuiTextField(this.fontRendererObj, 20, 52, 35, 12); + (this.textFieldFreq = new GuiTextField(this.fontRendererObj, 70, 33, 35, 12)) + .setMaxStringLength(4); + this.textFieldX.setMaxStringLength(6); + this.textFieldZ.setMaxStringLength(6); + this.textFieldY.setMaxStringLength(6); + this.textFieldFreq.setText(this.tileEntity.getFrequency() + ""); + if (this.tileEntity.getTarget() == null) { + this.textFieldX.setText(Math.round((float) this.tileEntity.xCoord) + ""); + this.textFieldZ.setText(Math.round((float) this.tileEntity.zCoord) + ""); + this.textFieldY.setText(Math.round((float) this.tileEntity.yCoord) + ""); + } else { + this.textFieldX.setText(Math.round(this.tileEntity.getTarget().x) + ""); + this.textFieldZ.setText(Math.round(this.tileEntity.getTarget().z) + ""); + this.textFieldY.setText(Math.round(this.tileEntity.getTarget().y) + ""); + } + } + + @Override + public void keyTyped(final char par1, final int par2) { + super.keyTyped(par1, par2); + this.textFieldX.textboxKeyTyped(par1, par2); + this.textFieldZ.textboxKeyTyped(par1, par2); + this.textFieldY.textboxKeyTyped(par1, par2); + this.textFieldFreq.textboxKeyTyped(par1, par2); + try { + final Vector3 newTarget = new Vector3(Integer.parseInt(this.textFieldX.getText()), + Integer.parseInt(this.textFieldY.getText()), + Integer.parseInt(this.textFieldZ.getText())); + this.tileEntity.setTarget(newTarget); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 2, this.tileEntity.getTarget().x, + // this.tileEntity.getTarget().y, this.tileEntity.getTarget().z)); + } catch (final NumberFormatException ex) { + } + try { + final short newFrequency = (short) Math.max(Short.parseShort(this.textFieldFreq.getText()), 0); + this.tileEntity.setFrequency(newFrequency); + // TODO: WTF + // PacketDispatcher.sendPacketToServer(PacketManager.getPacket( + // "ICBM|E", this.tileEntity, 1, this.tileEntity.getFrequency())); + } catch (final NumberFormatException ex2) { + } + } + + @Override + public void mouseClicked(final int par1, final int par2, final int par3) { + super.mouseClicked(par1, par2, par3); + this.textFieldX.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldZ.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldY.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + this.textFieldFreq.mouseClicked(par1 - this.containerWidth, + par2 - this.containerHeight, par3); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, + final int par2) { + this.fontRendererObj.drawString("§7" + this.tileEntity.getInventoryName(), 52, + 6, 4210752); + this.fontRendererObj.drawString("X:", 8, 23, 4210752); + this.fontRendererObj.drawString("Y:", 8, 39, 4210752); + this.fontRendererObj.drawString("Z:", 8, 54, 4210752); + this.fontRendererObj.drawString("Frequency:", 70, 20, 4210752); + this.textFieldX.drawTextBox(); + this.textFieldZ.drawTextBox(); + this.textFieldY.drawTextBox(); + this.textFieldFreq.drawTextBox(); + this.fontRendererObj.drawString(this.tileEntity.getStatus(), 70, 50, + 4210752); + this.fontRendererObj.drawString(this.tileEntity.getVoltage() + "v", 70, 60, + 4210752); + this.fontRendererObj.drawString( + ElectricityDisplay.getDisplayShort( + this.tileEntity.getJoules(), + ElectricityDisplay.ElectricUnit.JOULES) + + "/" + + ElectricityDisplay.getDisplayShort( + this.tileEntity.getMaxJoules(), + ElectricityDisplay.ElectricUnit.JOULES), + 70, 70, 4210752); + this.fontRendererObj.drawString( + StatCollector.translateToLocal("container.inventory"), 8, + this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, + final int par2, + final int par3) { + this.mc.renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/gui/gui_cruise_launcher.png")); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.containerWidth = (this.width - this.xSize) / 2; + this.containerHeight = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, + this.xSize, this.ySize); + } + + @Override + public void updateScreen() { + super.updateScreen(); + if (!this.textFieldX.isFocused()) { + this.textFieldX.setText(Math.round(this.tileEntity.getTarget().x) + ""); + } + if (!this.textFieldZ.isFocused()) { + this.textFieldZ.setText(Math.round(this.tileEntity.getTarget().z) + ""); + } + if (!this.textFieldY.isFocused()) { + this.textFieldY.setText(Math.round(this.tileEntity.getTarget().y) + ""); + } + if (!this.textFieldFreq.isFocused()) { + this.textFieldFreq.setText(this.tileEntity.getFrequency() + ""); + } + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/BMachine.java b/src/main/java/icbm/zhapin/jiqi/BMachine.java new file mode 100644 index 0000000..af02cdc --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/BMachine.java @@ -0,0 +1,331 @@ +package icbm.zhapin.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.BICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.render.RHJiQi; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.UniversalElectricity; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.TranslationHelper; +import universalelectricity.prefab.implement.IRedstoneReceptor; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.implement.ITier; +import universalelectricity.prefab.multiblock.IBlockActivate; +import universalelectricity.prefab.multiblock.IMultiBlock; + +public class BMachine extends BICBM { + public BMachine() { + super("machine", UniversalElectricity.machine); + } + + @Override + public boolean canProvidePower() { + return true; + } + + @Override + public void onBlockAdded(final World par1World, final int x, final int y, + final int z) { + this.isBeingPowered(par1World, x, y, z); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, + final int z, + final EntityLivingBase par5EntityLiving, + final ItemStack itemStack) { + final int angle = MathHelper.floor_double( + ((Entity) par5EntityLiving).rotationYaw * 4.0f / 360.0f + 0.5) & + 0x3; + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity instanceof IRotatable) { + final IRotatable rotatableEntity = (IRotatable) tileEntity; + switch (angle) { + case 0: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(3)); + break; + } + case 1: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(4)); + break; + } + case 2: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(2)); + break; + } + case 3: { + rotatableEntity.setDirection(world, x, y, z, + ForgeDirection.getOrientation(5)); + break; + } + } + } + if (tileEntity instanceof IMultiBlock) { + ((IMultiBlock) tileEntity).onCreate(new Vector3(x, y, z)); + } + } + + // TODO: WTF + // @Override + public static boolean canBePlacedAt(final World world, final int x, + final int y, final int z, + final int metadata, final int direction) { + switch (metadata) { + case 0: { + if (direction == 0 || direction == 2) { + return world.getBlock(x, y, z) == Blocks.air && + world.getBlock(x + 1, y, z) == Blocks.air && + world.getBlock(x + 1, y + 1, z) == Blocks.air && + world.getBlock(x + 1, y + 2, z) == Blocks.air && + world.getBlock(x - 1, y, z) == Blocks.air && + world.getBlock(x - 1, y + 1, z) == Blocks.air && + world.getBlock(x - 1, y + 2, z) == Blocks.air; + } + if (direction == 1 || direction == 3) { + return world.getBlock(x, y, z) == Blocks.air && + world.getBlock(x, y, z + 1) == Blocks.air && + world.getBlock(x, y + 1, z + 1) == Blocks.air && + world.getBlock(x, y + 2, z + 1) == Blocks.air && + world.getBlock(x, y, z - 1) == Blocks.air && + world.getBlock(x, y + 1, z - 1) == Blocks.air && + world.getBlock(x, y + 2, z - 1) == Blocks.air; + } + return world.getBlock(x, y - 1, z).getMaterial().isSolid() && + world.getBlock(x, y, z) == Blocks.air && + world.getBlock(x, y + 1, z) == Blocks.air && + world.getBlock(x, y + 2, z) == Blocks.air; + } + case 2: { + return world.getBlock(x, y - 1, z).getMaterial().isSolid() && + world.getBlock(x, y, z) == Blocks.air && + world.getBlock(x, y + 1, z) == Blocks.air && + world.getBlock(x, y + 2, z) == Blocks.air; + } + case 3: { + return world.getBlock(x, y - 1, z).getMaterial().isSolid() && + world.getBlock(x, y, z) == Blocks.air && + world.getBlock(x, y + 1, z) == Blocks.air && + world.getBlock(x + 1, y + 1, z) == Blocks.air && + world.getBlock(x - 1, y + 1, z) == Blocks.air && + world.getBlock(x, y + 1, z + 1) == Blocks.air && + world.getBlock(x, y + 1, z - 1) == Blocks.air && + world.getBlock(x + 1, y + 1, z + 1) == Blocks.air && + world.getBlock(x - 1, y + 1, z - 1) == Blocks.air && + world.getBlock(x + 1, y + 1, z - 1) == Blocks.air && + world.getBlock(x - 1, y + 1, z + 1) == Blocks.air; + } + case 4: { + return world.getBlock(x, y, z) == Blocks.air && + world.getBlock(x, y + 1, z) == Blocks.air; + } + default: { + return world.getBlock(x, y - 1, z).getMaterial().isSolid(); + } + } + } + + @Override + public boolean canBlockStay(final World world, final int x, final int y, + final int z) { + int direction = 0; + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity instanceof IRotatable) { + direction = ((IRotatable) tileEntity) + .getDirection((IBlockAccess) world, x, y, z) + .ordinal(); + } + return canBePlacedAt(world, x, y, z, world.getBlockMetadata(x, y, z), + direction); + } + + @Override + public void onNeighborBlockChange(final World par1World, final int x, + final int y, final int z, + final Block par5) { + this.isBeingPowered(par1World, x, y, z); + } + + @Override + public boolean onMachineActivated(final World par1World, final int x, + final int y, final int z, + final EntityPlayer par5EntityPlayer, + final int side, final float hitX, + final float hitY, final float hitZ) { + if (par5EntityPlayer.inventory.getCurrentItem() != null) { + if (par5EntityPlayer.inventory.getCurrentItem().getItem() == ICBMExplosion.itLeiSheZhiBiao) { + return false; + } + if (par5EntityPlayer.inventory.getCurrentItem().getItem() == ICBMExplosion.itLeiDaQiang) { + return false; + } + } + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + return tileEntity != null && tileEntity instanceof IBlockActivate && + ((IBlockActivate) tileEntity).onActivated(par5EntityPlayer); + } + + @Override + public boolean onUseWrench(final World par1World, final int x, final int y, + final int z, final EntityPlayer par5EntityPlayer, + final int side, final float hitX, final float hitY, + final float hitZ) { + return this.onMachineActivated(par1World, x, y, z, par5EntityPlayer, side, + hitX, hitY, hitZ); + } + + public void isBeingPowered(final World par1World, final int x, final int y, + final int z) { + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + if (tileEntity instanceof IRedstoneReceptor) { + if (par1World.isBlockIndirectlyGettingPowered(x, y, z)) { + ((IRedstoneReceptor) tileEntity).onPowerOn(); + } else { + ((IRedstoneReceptor) tileEntity).onPowerOff(); + } + } + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public void breakBlock(final World par1World, final int x, final int y, + final int z, final Block par5, final int par6) { + final int metadata = par1World.getBlockMetadata(x, y, z); + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + if (tileEntity != null) { + int itemMetadata = 0; + if (tileEntity instanceof ITier) { + itemMetadata = ((ITier) tileEntity).getTier() + metadata * 3; + } else { + itemMetadata = 9 + metadata - 3; + } + this.dropBlockAsItem(par1World, x, y, z, + new ItemStack(ICBMExplosion.bJiQi, 1, itemMetadata)); + if (tileEntity instanceof IMultiBlock) { + ((IMultiBlock) tileEntity).onDestroy(tileEntity); + } + } + super.breakBlock(par1World, x, y, z, par5, par6); + } + + @Override + public TileEntity createNewTileEntity(final World var1, final int metadata) { + if (JiQi.get(metadata) != null) { + try { + return JiQi.get(metadata).tileEntity.newInstance(); + } catch (final InstantiationException e) { + e.printStackTrace(); + } catch (final IllegalAccessException e2) { + e2.printStackTrace(); + } + } + return null; + } + + @Override + public int quantityDropped(final Random par1Random) { + return 0; + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderType() { + return RHJiQi.ID; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < JiQi.values().length + 6; ++i) { + par3List.add(new ItemStack((Block) this, 1, i)); + } + } + + @Override + public ItemStack getPickBlock(final MovingObjectPosition target, + final World par1World, final int x, final int y, + final int z) { + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + return new ItemStack(ICBMExplosion.bJiQi, 1, getMachineId(tileEntity)); + } + + @Override + public int damageDropped(final int metadata) { + return metadata; + } + + public static int getMachineId(final TileEntity tileEntity) { + int itemMetadata = 0; + if (tileEntity != null) { + final int metadata = tileEntity.getBlockMetadata(); + if (tileEntity instanceof ITier) { + itemMetadata = ((ITier) tileEntity).getTier() + metadata * 3; + } else { + itemMetadata = 9 + metadata - 3; + } + } + return itemMetadata; + } + + public static String getMachineName(final TileEntity tileEntity) { + return TranslationHelper.getLocal("icbm.machine." + + getMachineId(tileEntity) + ".name"); + } + + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + } + + public enum JiQi { + FaSheDi("FaSheDi", 0, TLauncherPlatform.class), + FaSheShiMuo("FaSheShiMuo", 1, TLauncherControlPanel.class), + FaSheJia("FaSheJia", 2, TLauncher.class), + LeiDaTai("LeiDaTai", 3, TRadarTower.class), + DianCiQi("DianCiQi", 4, TEmpTower.class), + XiaoFaSheQi("XiaoFaSheQi", 5, TCruiseLauncher.class), + YinDaoQi("YinDaoQi", 6, TMissileCoordinator.class); + + public Class tileEntity; + + private JiQi(final String name, final int ordinal, + final Class tileEntity) { + this.tileEntity = tileEntity; + } + + public static JiQi get(final int id) { + if (id < values().length && id >= 0) { + return values()[id]; + } + return null; + } + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/IBMachine.java b/src/main/java/icbm/zhapin/jiqi/IBMachine.java new file mode 100644 index 0000000..9d518dd --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/IBMachine.java @@ -0,0 +1,75 @@ +package icbm.zhapin.jiqi; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import universalelectricity.prefab.implement.ITier; + +public class IBMachine extends ItemBlock { + public IBMachine(final Block block) { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public int getMetadata(final int damage) { + return damage; + } + + @Override + public String getUnlocalizedName(final ItemStack itemstack) { + return this.getUnlocalizedName() + "." + itemstack.getItemDamage(); + } + + @Override + public String getUnlocalizedName() { + return "icbm.machine"; + } + + @Override + public boolean placeBlockAt(final ItemStack itemStack, final EntityPlayer entityPlayer, + final World world, final int x, final int y, final int z, + final int side, final float hitX, final float hitY, + final float hitZ, final int metadata) { + int jiQiMetadata; + if (itemStack.getItemDamage() < 3) { + jiQiMetadata = 0; + } else if (itemStack.getItemDamage() < 6) { + jiQiMetadata = 1; + } else if (itemStack.getItemDamage() < 9) { + jiQiMetadata = 2; + } else { + jiQiMetadata = itemStack.getItemDamage() - 6; + } + final int direction = MathHelper.floor_double( + ((Entity) entityPlayer).rotationYaw * 4.0f / 360.0f + 0.5) & + 0x3; + if (BMachine.canBePlacedAt(world, x, y, z, jiQiMetadata, direction)) { + if (world.setBlock(x, y, z, this.field_150939_a, jiQiMetadata, 3)) { + if (world.getBlock(x, y, z) == this.field_150939_a) { + if (itemStack.getItemDamage() < 9) { + final ITier tileEntity = (ITier) world.getTileEntity(x, y, z); + if (tileEntity != null) { + if (itemStack.getItemDamage() < 3) { + tileEntity.setTier(itemStack.getItemDamage()); + } else if (itemStack.getItemDamage() < 6) { + tileEntity.setTier(itemStack.getItemDamage() - 3); + } else if (itemStack.getItemDamage() < 9) { + tileEntity.setTier(itemStack.getItemDamage() - 6); + } + } + } + this.field_150939_a.onBlockPlacedBy(world, x, y, z, entityPlayer, + itemStack); + } + return true; + } + } + return false; + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/LauncherManager.java b/src/main/java/icbm/zhapin/jiqi/LauncherManager.java new file mode 100644 index 0000000..a39a78e --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/LauncherManager.java @@ -0,0 +1,48 @@ +package icbm.zhapin.jiqi; + +import java.util.ArrayList; +import java.util.List; +import universalelectricity.core.vector.Vector2; + +public class LauncherManager { + private static List launchers; + + public static void addLauncher(final TLauncherController launcher) { + findLaunchers(); + if (!LauncherManager.launchers.contains(launcher)) { + LauncherManager.launchers.add(launcher); + } + } + + public static List launchersInArea(final Vector2 minVector, + final Vector2 maxVector) { + findLaunchers(); + final List returnArray = new ArrayList<>(); + for (final TLauncherController launcher : LauncherManager.launchers) { + if (launcher.xCoord > minVector.x && launcher.xCoord < maxVector.x && + launcher.zCoord > minVector.y && launcher.zCoord < maxVector.y) { + returnArray.add(launcher); + } + } + return returnArray; + } + + public static List getLaunchers() { + findLaunchers(); + return LauncherManager.launchers; + } + + public static void findLaunchers() { + for (int i = 0; i < LauncherManager.launchers.size(); ++i) { + if (LauncherManager.launchers.get(i) == null) { + LauncherManager.launchers.remove(i); + } else if (LauncherManager.launchers.get(i).isInvalid()) { + LauncherManager.launchers.remove(i); + } + } + } + + static { + LauncherManager.launchers = new ArrayList<>(); + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TCruiseLauncher.java b/src/main/java/icbm/zhapin/jiqi/TCruiseLauncher.java new file mode 100644 index 0000000..7c5dbe1 --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TCruiseLauncher.java @@ -0,0 +1,393 @@ +package icbm.zhapin.jiqi; + +import dan200.computercraft.api.peripheral.IPeripheral; +import icbm.api.ILauncherContainer; +import icbm.api.ILauncherController; +import icbm.api.IMissile; +import icbm.api.LauncherType; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.daodan.ItMissile; +import icbm.zhapin.daodan.ItModuleMissile; +import icbm.zhapin.daodan.MissileBase; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.item.ElectricItemHelper; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.multiblock.IBlockActivate; + +public class TCruiseLauncher + extends TLauncherController implements IBlockActivate, IInventory, ILauncherContainer { + public IMissile missile; + public float rotationYaw; + public float rotationPitch; + private ItemStack[] containingItems; + private boolean isPowered; + + public TCruiseLauncher() { + this.missile = null; + this.rotationYaw = 0.0f; + this.rotationPitch = 0.0f; + this.containingItems = new ItemStack[2]; + this.isPowered = false; + super.target = new Vector3(); + } + + @Override + public int getSizeInventory() { + return this.containingItems.length; + } + + @Override + public ItemStack getStackInSlot(final int par1) { + return this.containingItems[par1]; + } + + @Override + public ItemStack decrStackSize(final int par1, final int par2) { + if (this.containingItems[par1] == null) { + return null; + } + if (this.containingItems[par1].stackSize <= par2) { + final ItemStack var3 = this.containingItems[par1]; + this.containingItems[par1] = null; + return var3; + } + final ItemStack var3 = this.containingItems[par1].splitStack(par2); + if (this.containingItems[par1].stackSize == 0) { + this.containingItems[par1] = null; + } + return var3; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int par1) { + if (this.containingItems[par1] != null) { + final ItemStack var2 = this.containingItems[par1]; + this.containingItems[par1] = null; + return var2; + } + return null; + } + + @Override + public void setInventorySlotContents(final int par1, + final ItemStack par2ItemStack) { + this.containingItems[par1] = par2ItemStack; + if (par2ItemStack != null && + par2ItemStack.stackSize > this.getInventoryStackLimit()) { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + } + + @Override + public String getStatus() { + String color = "§4"; + String status = "Idle"; + if (this.isDisabled()) { + status = "Disabled"; + } else if (this.getJoules() < this.getMaxJoules()) { + status = "No Power!"; + } else if (this.missile == null) { + status = "Silo Empty!"; + } else if (super.target == null) { + status = "Invalid Target!"; + } else { + color = "§2"; + status = "Ready!"; + } + return color + status; + } + + @Override + public String getInventoryName() { + return "Cruise Launcher"; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.isDisabled()) { + this.onReceive(ElectricityPack.getFromWatts( + ElectricItemHelper.dechargeItem(this.containingItems[1], + this.getRequest().getWatts(), + this.getVoltage()), + this.getVoltage())); + if (this.getYawFromTarget() - this.rotationYaw != 0.0f) { + this.rotationYaw += + (float)((this.getYawFromTarget() - this.rotationYaw) * 0.1); + } + if (this.getPitchFromTarget() - this.rotationPitch != 0.0f) { + this.rotationPitch += + (float)((this.getPitchFromTarget() - this.rotationPitch) * 0.1); + } + if (!this.worldObj.isRemote) { + this.setMissile(); + if (this.isPowered) { + this.launch(); + this.isPowered = false; + } + } + if (!this.worldObj.isRemote && super.ticks % 3L == 0L) { + if (super.target == null) { + super.target = new Vector3(this.xCoord, this.yCoord, this.zCoord); + } + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setDouble("joules", this.getJoules()); + nbt.setInteger("frequency", super.frequency); + nbt.setInteger("disabledTicks", super.disabledTicks); + nbt.setTag("target", super.target.writeToNBT(new NBTTagCompound())); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public void placeMissile(final ItemStack itemStack) { + this.containingItems[0] = itemStack; + } + + public void setMissile() { + if (this.containingItems[0] != null && this.containingItems[0].getItem() + instanceof ItMissile) { + int haoMa = this.containingItems[0].getItemDamage(); + if (this.containingItems[0].getItem() instanceof ItModuleMissile) { + haoMa += 100; + } + if (!ICBMExplosion.shiBaoHu(this.worldObj, new Vector3(this), + ZhaPin.ZhaPinType.DAO_DAN, haoMa)) { + if (this.missile == null && MissileBase.list[haoMa].isCruise() && + MissileBase.list[haoMa].getTier() <= 3) { + final Vector3 startingPosition = new Vector3( + this.xCoord + 0.5f, this.yCoord + 0.2f, this.zCoord + 0.5f); + this.missile = new EMissile(this.worldObj, startingPosition, + new Vector3(this), haoMa); + this.worldObj.spawnEntityInWorld((Entity)this.missile); + return; + } + if (this.missile != null && + this.missile.getExplosiveType().getID() == haoMa) { + return; + } + } + } + if (this.missile != null) { + ((Entity)this.missile).setDead(); + } + this.missile = null; + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.setJoules(nbt.getDouble("joules")); + super.frequency = nbt.getInteger("frequency"); + super.disabledTicks = nbt.getInteger("disabledTicks"); + super.target = Vector3.readFromNBT(nbt.getCompoundTag("target")); + } + + // TODO: WTF + // if (!this.worldObj.isRemote) { + // this.setFrequency(dataStream.readInt()); + // } + + private float getPitchFromTarget() { + final double distance = Math.sqrt( + (super.target.x - this.xCoord) * (super.target.x - this.xCoord) + + (super.target.z - this.zCoord) * (super.target.z - this.zCoord)); + return (float)Math.toDegrees( + Math.atan((super.target.y - (this.yCoord + 0.5f)) / distance)); + } + + private float getYawFromTarget() { + final double xDifference = super.target.x - (this.xCoord + 0.5f); + final double yDifference = super.target.z - (this.zCoord + 0.5f); + return (float)Math.toDegrees(Math.atan2(yDifference, xDifference)); + } + + @Override + public boolean canLaunch() { + if (this.missile != null && this.containingItems[0] != null) { + final MissileBase missile = + MissileBase.list[this.containingItems[0].getItemDamage()]; + int haoMa = this.missile.getExplosiveType().getID(); + if (this.missile.getExplosiveType().getID() >= 100) { + haoMa -= 100; + } + if (missile != null && missile.getID() == haoMa && missile.isCruise() && + missile.getTier() <= 3 && this.getJoules() >= this.getMaxJoules() && + !this.isTooClose(super.target)) { + return true; + } + } + return false; + } + + @Override + public void launch() { + if (this.canLaunch()) { + this.decrStackSize(0, 1); + this.setJoules(0.0); + this.missile.launch(super.target); + this.missile = null; + } + } + + public boolean isTooClose(final Vector3 target) { + return Vector3.distance(new Vector3(this.xCoord, 0.0, this.zCoord), + new Vector3(target.x, 0.0, target.z)) < 8.0; + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + final NBTTagList var2 = nbt.getTagList("Items", 10); + this.containingItems = new ItemStack[this.getSizeInventory()]; + for (int var3 = 0; var3 < var2.tagCount(); ++var3) { + final NBTTagCompound var4 = var2.getCompoundTagAt(var3); + final byte var5 = var4.getByte("Slot"); + if (var5 >= 0 && var5 < this.containingItems.length) { + this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + final NBTTagList var2 = new NBTTagList(); + for (int var3 = 0; var3 < this.containingItems.length; ++var3) { + if (this.containingItems[var3] != null) { + final NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.containingItems[var3].writeToNBT(var4); + var2.appendTag((NBTBase)var4); + } + } + par1NBTTagCompound.setTag("Items", (NBTBase)var2); + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer par1EntityPlayer) { + return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == + this && + par1EntityPlayer.getDistanceSq(this.xCoord + 0.5, this.yCoord + 0.5, + this.zCoord + 0.5) <= 64.0; + } + + @Override + public void onPowerOn() { + this.isPowered = true; + } + + @Override + public void onPowerOff() { + this.isPowered = false; + } + + @Override + public double getMaxJoules() { + return 800000.0; + } + + @Override + public boolean onActivated(final EntityPlayer entityPlayer) { + if (this.isItemValidForSlot(0, entityPlayer.inventory.getCurrentItem())) { + this.setInventorySlotContents(0, entityPlayer.inventory.getCurrentItem()); + entityPlayer.inventory.setInventorySlotContents( + entityPlayer.inventory.currentItem, (ItemStack)null); + return true; + } + entityPlayer.openGui((Object)ICBMExplosion.instance, 1, this.worldObj, + this.xCoord, this.yCoord, this.zCoord); + return true; + } + + @Override + public LauncherType getLauncherType() { + return LauncherType.CRUISE; + } + + @Override + public boolean canConnect(final ForgeDirection direction) { + return true; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public boolean isItemValidForSlot(final int slotID, + final ItemStack itemStack) { + return itemStack != null && itemStack.getItem() instanceof ItMissile && + this.getStackInSlot(slotID) == null && + MissileBase.list[itemStack.getItemDamage()] != null && + MissileBase.list[itemStack.getItemDamage()].isCruise() && + MissileBase.list[itemStack.getItemDamage()].getTier() <= 3; + } + + @Override + public void setContainingMissile(final IMissile missile) { + this.missile = missile; + } + + @Override + public ILauncherController getController() { + return this; + } + + @Override + public IMissile getMissile() { + return this.missile; + } + + @Override + public IMissile getContainingMissile() { + return this.missile; + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean equals(IPeripheral other) { + return this == other; + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TEmpTower.java b/src/main/java/icbm/zhapin/jiqi/TEmpTower.java new file mode 100644 index 0000000..3a4713a --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TEmpTower.java @@ -0,0 +1,166 @@ +package icbm.zhapin.jiqi; + +import calclavia.lib.TileEntityUniversalStorable; +import icbm.api.RadarRegistry; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRedstoneReceptor; +import universalelectricity.prefab.multiblock.IMultiBlock; + +public class TEmpTower extends TileEntityUniversalStorable + implements IMultiBlock, IRedstoneReceptor { + public static final int MAX_RADIUS = 150; + public float xuanZhuan; + private float xuanZhuanLu; + public byte holzOhJa; + public int radius; + + public TEmpTower() { + this.xuanZhuan = 0.0f; + this.holzOhJa = 0; + this.radius = 60; + RadarRegistry.register(this); + } + + @Override + public void invalidate() { + RadarRegistry.unregister(this); + super.invalidate(); + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.isDisabled()) { + if (super.ticks % 20L == 0L && this.getJoules() > 0.0) { + this.worldObj.playSoundEffect( + (double) this.xCoord, (double) this.yCoord, (double) this.zCoord, + "icbm.machinehum", 0.5f, + (float) (0.8500000238418579 * this.getJoules() / + this.getMaxJoules())); + } + this.xuanZhuanLu = (float) (Math.pow(this.getJoules() / this.getMaxJoules(), 2.0) * 0.5); + this.xuanZhuan += this.xuanZhuanLu; + if (this.xuanZhuan > 360.0f) { + this.xuanZhuan = 0.0f; + } + } + if (!this.worldObj.isRemote) { + if (super.ticks % 10L == 0L) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.setJoules(nbt.getDouble("joules")); + super.disabledTicks = nbt.getInteger("disabledTicks"); + this.radius = nbt.getInteger("radius"); + this.holzOhJa = nbt.getByte("holzOhJa"); + } + + // TODO: WTF + // else if (ID == 2) { + // this.radius = dataStream.readInt(); + // } else if (ID == 3) { + // this.holzOhJa = dataStream.readByte(); + // } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setDouble("joules", this.getJoules()); + nbt.setInteger("disabledTicks", super.disabledTicks); + nbt.setInteger("radius", this.radius); + nbt.setByte("holzOhJa", this.holzOhJa); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public double getVoltage() { + return 240.0; + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.radius = nbt.getInteger("radius"); + this.holzOhJa = nbt.getByte("holzOhJa"); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("radius", this.radius); + nbt.setByte("holzOhJa", this.holzOhJa); + } + + @Override + public void onPowerOn() { + if (this.getJoules() >= this.getMaxJoules()) { + if (this.holzOhJa == 0 || this.holzOhJa == 1) { + ZhaPin.empSignal.doBaoZha( + this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord), + null, this.radius, -1); + } + if (this.holzOhJa == 0 || this.holzOhJa == 2) { + ZhaPin.empWave.doBaoZha( + this.worldObj, new Vector3(this.xCoord, this.yCoord, this.zCoord), + null, this.radius, -1); + } + this.setJoules(0.0); + } + } + + @Override + public void onPowerOff() { + } + + @Override + public void onDestroy(final TileEntity callingBlock) { + this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.air, 0, + 2); + this.worldObj.setBlock(this.xCoord, this.yCoord + 1, this.zCoord, + Blocks.air, 0, 2); + } + + @Override + public boolean onActivated(final EntityPlayer entityPlayer) { + entityPlayer.openGui((Object) ICBMExplosion.instance, 6, this.worldObj, + this.xCoord, this.yCoord, this.zCoord); + return true; + } + + @Override + public void onCreate(final Vector3 position) { + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 1.0, 0.0)), + new Vector3(this)); + } + + @Override + public double getMaxJoules() { + return Math.max(2000000.0f * (this.radius / 150.0f), 1000000.0f); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TLauncher.java b/src/main/java/icbm/zhapin/jiqi/TLauncher.java new file mode 100644 index 0000000..ce300c4 --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TLauncher.java @@ -0,0 +1,137 @@ +package icbm.zhapin.jiqi; + +import icbm.core.MainBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.implement.ITier; +import universalelectricity.prefab.multiblock.IMultiBlock; +import universalelectricity.prefab.multiblock.TileEntityMulti; +import universalelectricity.prefab.tile.TileEntityAdvanced; + +public class TLauncher + extends TileEntityAdvanced implements ITier, IMultiBlock, IRotatable { + private int tier; + private byte orientation; + + public TLauncher() { + this.tier = 0; + this.orientation = 3; + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.orientation = nbt.getByte("orientation"); + this.tier = nbt.getInteger("tier"); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setByte("orientation", this.orientation); + nbt.setInteger("tier", this.tier); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + public int getInaccuracy() { + switch (this.tier) { + default: { + return 15; + } + case 1: { + return 7; + } + case 2: { + return 0; + } + } + } + + @Override + public boolean canUpdate() { + return false; + } + + @Override + public void readFromNBT(final NBTTagCompound par1NBTTagCompound) { + super.readFromNBT(par1NBTTagCompound); + this.tier = par1NBTTagCompound.getInteger("tier"); + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("tier", this.tier); + } + + @Override + public int getTier() { + return this.tier; + } + + @Override + public void setTier(final int tier) { + this.tier = tier; + } + + @Override + public void onDestroy(final TileEntity callingBlock) { + this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.air, 0, + 2); + this.worldObj.setBlock(this.xCoord, this.yCoord + 1, this.zCoord, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord, this.yCoord + 2, this.zCoord, + Blocks.air, 0, 2); + } + + @Override + public boolean onActivated(final EntityPlayer par5EntityPlayer) { + return false; + } + + @Override + public void onCreate(final Vector3 position) { + this.worldObj.setBlock(position.intX(), position.intY() + 1, + position.intZ(), MainBase.bJia, 0, 2); + ((TileEntityMulti) this.worldObj.getTileEntity( + position.intX(), position.intY() + 1, position.intZ())) + .setMainBlock(position); + this.worldObj.setBlock(position.intX(), position.intY() + 2, + position.intZ(), MainBase.bJia, 0, 2); + ((TileEntityMulti) this.worldObj.getTileEntity( + position.intX(), position.intY() + 2, position.intZ())) + .setMainBlock(position); + } + + @Override + public ForgeDirection getDirection(final IBlockAccess world, final int x, + final int y, final int z) { + return ForgeDirection.getOrientation((int) this.orientation); + } + + @Override + public void setDirection(final World world, final int x, final int y, + final int z, final ForgeDirection facingDirection) { + this.orientation = (byte) facingDirection.ordinal(); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TLauncherControlPanel.java b/src/main/java/icbm/zhapin/jiqi/TLauncherControlPanel.java new file mode 100644 index 0000000..ac1d1b8 --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TLauncherControlPanel.java @@ -0,0 +1,267 @@ +package icbm.zhapin.jiqi; + +import dan200.computercraft.api.peripheral.IPeripheral; +import icbm.api.IMissile; +import icbm.api.LauncherType; +import icbm.zhapin.ICBMExplosion; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.implement.ITier; +import universalelectricity.prefab.multiblock.IBlockActivate; + +public class TLauncherControlPanel + extends TLauncherController implements IBlockActivate, ITier, IRotatable { + private boolean isPowered; + private byte direction; + private int tier; + public TLauncherPlatform faSheDi; + public short height; + + public TLauncherControlPanel() { + this.isPowered = false; + this.direction = 3; + this.tier = 0; + this.faSheDi = null; + this.height = 3; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.isDisabled()) { + if (this.faSheDi == null) { + for (byte i = 2; i < 6; ++i) { + final Vector3 position = new Vector3(this.xCoord, this.yCoord, this.zCoord); + position.modifyPositionFromSide( + ForgeDirection.getOrientation((int) i)); + final TileEntity tileEntity = this.worldObj.getTileEntity( + position.intX(), position.intY(), position.intZ()); + if (tileEntity != null && tileEntity instanceof TLauncherPlatform) { + this.faSheDi = (TLauncherPlatform) tileEntity; + this.direction = i; + } + } + } else if (this.faSheDi.isInvalid()) { + this.faSheDi = null; + } + if (this.isPowered) { + this.isPowered = false; + this.launch(); + } + } + if (!this.worldObj.isRemote) { + if (super.ticks % 10L == 0L) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setDouble("joules", this.getJoules()); + nbt.setByte("direction", this.direction); + nbt.setInteger("tier", this.tier); + nbt.setInteger("frequency", this.getFrequency()); + nbt.setShort("height", this.height); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public void placeMissile(final ItemStack itemStack) { + if (this.faSheDi != null && !this.faSheDi.isInvalid()) { + this.faSheDi.setInventorySlotContents(0, itemStack); + } + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.setJoules(nbt.getDouble("joules")); + this.direction = nbt.getByte("direction"); + this.tier = nbt.getInteger("tier"); + this.setFrequency(nbt.getInteger("frequency")); + this.height = nbt.getShort("height"); + } + + // TODO: WTF + // } else if (!this.worldObj.isRemote) { + // if (ID == 1) { + // this.setFrequency(dataStream.readInt()); + // } else if (ID == 2) { + // super.target = new Vector3(dataStream.readDouble(), + // dataStream.readDouble(), + // dataStream.readDouble()); + // if (this.getTier() < 2) { + // super.target.y = 0.0; + // } + // } else if (ID == 3) { + // this.height = (short) Math.max(Math.min(dataStream.readShort(), 99), + // 3); + // } + // } else if (ID == 3 && this.worldObj.isRemote) { + // this.setJoules(dataStream.readDouble()); + // super.disabledTicks = dataStream.readInt(); + // super.target = new Vector3(dataStream.readDouble(), + // dataStream.readDouble(), + // dataStream.readDouble()); + // } + + @Override + public boolean canLaunch() { + return this.faSheDi != null && !this.isDisabled() && + this.faSheDi.daoDan != null && + this.getJoules() >= this.getMaxJoules() && + this.faSheDi.isInRange(super.target); + } + + @Override + public void launch() { + if (this.canLaunch()) { + this.setJoules(0.0); + this.faSheDi.launchMissile(super.target.clone(), this.height); + } + } + + @Override + public String getStatus() { + String color = "§4"; + String status = "Idle"; + if (this.isDisabled()) { + status = "Disabled"; + } else if (this.faSheDi == null) { + status = "Not connected!"; + } else if (this.getJoules() < this.getMaxJoules()) { + status = "Insufficient electricity!"; + } else if (this.faSheDi.daoDan == null) { + status = "Missile silo is empty!"; + } else if (super.target == null) { + status = "Target is invalid!"; + } else if (this.faSheDi.shiTaiJin(super.target)) { + status = "Target too close!"; + } else if (this.faSheDi.shiTaiYuan(super.target)) { + status = "Target too far!"; + } else { + color = "§2"; + status = "Ready to launch!"; + } + return color + status; + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.tier = nbt.getInteger("tier"); + this.direction = nbt.getByte("facingDirection"); + this.height = nbt.getShort("height"); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("tier", this.tier); + nbt.setByte("facingDirection", this.direction); + nbt.setShort("height", this.height); + } + + @Override + public double getVoltage() { + switch (this.getTier()) { + default: { + return 120.0; + } + case 1: { + return 240.0; + } + case 2: { + return 480.0; + } + } + } + + @Override + public void onPowerOn() { + this.isPowered = true; + } + + @Override + public void onPowerOff() { + this.isPowered = false; + } + + @Override + public int getTier() { + return this.tier; + } + + @Override + public void setTier(final int tier) { + this.tier = tier; + } + + @Override + public ForgeDirection getDirection(final IBlockAccess world, final int x, + final int y, final int z) { + return ForgeDirection.getOrientation((int) this.direction); + } + + @Override + public void setDirection(final World world, final int x, final int y, + final int z, final ForgeDirection facingDirection) { + this.direction = (byte) facingDirection.ordinal(); + } + + @Override + public double getMaxJoules() { + switch (this.getTier()) { + case 0: { + return 400000.0; + } + case 1: { + return 60000.0; + } + default: { + return 800000.0; + } + } + } + + @Override + public boolean onActivated(final EntityPlayer entityPlayer) { + entityPlayer.openGui((Object) ICBMExplosion.instance, 2, this.worldObj, + this.xCoord, this.yCoord, this.zCoord); + return true; + } + + @Override + public LauncherType getLauncherType() { + return LauncherType.TRADITIONAL; + } + + @Override + public IMissile getMissile() { + if (this.faSheDi != null) { + return this.faSheDi.getContainingMissile(); + } + return null; + } + + @Override + public boolean equals(IPeripheral other) { + return this == other; + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TLauncherController.java b/src/main/java/icbm/zhapin/jiqi/TLauncherController.java new file mode 100644 index 0000000..104ac2e --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TLauncherController.java @@ -0,0 +1,149 @@ +package icbm.zhapin.jiqi; + +import calclavia.lib.TileEntityUniversalStorable; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.lua.LuaException; +import dan200.computercraft.api.peripheral.IComputerAccess; +import dan200.computercraft.api.peripheral.IPeripheral; +import icbm.api.ILauncherController; +import icbm.api.LauncherType; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; + +public abstract class TLauncherController extends TileEntityUniversalStorable + implements ILauncherController, IPeripheral { + protected Vector3 target; + protected int frequency; + + public TLauncherController() { + this.target = null; + this.frequency = 0; + LauncherManager.addLauncher(this); + } + + @Override + public boolean canConnect(final ForgeDirection direction) { + return true; + } + + @Override + public Vector3 getTarget() { + if (this.target == null) { + if (this.getLauncherType() == LauncherType.CRUISE) { + this.target = new Vector3(this.xCoord, this.yCoord, this.zCoord); + } else { + this.target = new Vector3(this.xCoord, 0.0, this.zCoord); + } + } + return this.target; + } + + @Override + public void setTarget(final Vector3 target) { + this.target = target.floor(); + } + + @Override + public int getFrequency() { + return this.frequency; + } + + @Override + public void setFrequency(final int frequency) { + this.frequency = frequency; + } + + @Override + public String getType() { + return "ICBMLauncher"; + } + + @Override + public String[] getMethodNames() { + return new String[] { "launch", "getTarget", "setTarget", + "canLaunch", "setFrequency", "getFrequency", + "getMissile" }; + } + + @Override + public Object[] callMethod(final IComputerAccess computer, ILuaContext ctx, final int method, + final Object[] arguments) throws LuaException { + switch (method) { + case 0: { + this.launch(); + return null; + } + case 1: { + return new Object[] { this.getTarget().x, this.getTarget().y, + this.getTarget().z }; + } + case 2: { + if (arguments[0] != null && arguments[1] != null && + arguments[2] != null) { + try { + this.setTarget(new Vector3((double) arguments[0], (double) arguments[1], + (double) arguments[2])); + } catch (final Exception e) { + e.printStackTrace(); + throw new LuaException("Target Parameter is Invalid."); + } + } + return null; + } + case 3: { + return new Object[] { this.canLaunch() }; + } + case 4: { + if (arguments[0] != null) { + try { + double arg = (double) arguments[0]; + arg = Math.max(Math.min(arg, 32767.0), -32768.0); + this.setFrequency((short) arg); + } catch (final Exception e) { + e.printStackTrace(); + throw new LuaException("Frequency Parameter is Invalid."); + } + } + return null; + } + case 5: { + return new Object[] { this.getFrequency() }; + } + case 6: { + if (this.getMissile() != null) { + return new Object[] { + this.getMissile().getExplosiveType().getMissileName() }; + } + return null; + } + default: { + throw new LuaException("Invalid ICBM Launcher Function."); + } + } + } + + @Override + public void attach(final IComputerAccess computer) { + } + + @Override + public void detach(final IComputerAccess computer) { + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.setFrequency(nbt.getInteger("frequency")); + this.target = Vector3.readFromNBT(nbt.getCompoundTag("target")); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("frequency", this.getFrequency()); + if (this.target != null) { + nbt.setTag("target", this.target.writeToNBT(new NBTTagCompound())); + } + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TLauncherPlatform.java b/src/main/java/icbm/zhapin/jiqi/TLauncherPlatform.java new file mode 100644 index 0000000..71f708a --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TLauncherPlatform.java @@ -0,0 +1,441 @@ +package icbm.zhapin.jiqi; + +import icbm.api.ILauncherContainer; +import icbm.api.ILauncherController; +import icbm.api.IMissile; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.daodan.ItMissile; +import icbm.zhapin.daodan.ItModuleMissile; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.core.vector.VectorHelper; +import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.implement.ITier; +import universalelectricity.prefab.multiblock.IMultiBlock; +import universalelectricity.prefab.tile.TileEntityAdvanced; + +public class TLauncherPlatform extends TileEntityAdvanced + implements ILauncherContainer, IRotatable, ITier, IMultiBlock, IInventory { + public IMissile daoDan; + public TLauncher jiaZi; + private ItemStack[] containingItems; + private int tier; + private byte orientation; + private boolean packetGengXin; + + public TLauncherPlatform() { + this.daoDan = null; + this.jiaZi = null; + this.containingItems = new ItemStack[1]; + this.tier = 0; + this.orientation = 3; + this.packetGengXin = true; + } + + @Override + public int getSizeInventory() { + return this.containingItems.length; + } + + @Override + public ItemStack getStackInSlot(final int par1) { + return this.containingItems[par1]; + } + + @Override + public ItemStack decrStackSize(final int par1, final int par2) { + if (this.containingItems[par1] == null) { + return null; + } + if (this.containingItems[par1].stackSize <= par2) { + final ItemStack var3 = this.containingItems[par1]; + this.containingItems[par1] = null; + return var3; + } + final ItemStack var3 = this.containingItems[par1].splitStack(par2); + if (this.containingItems[par1].stackSize == 0) { + this.containingItems[par1] = null; + } + return var3; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int par1) { + if (this.containingItems[par1] != null) { + final ItemStack var2 = this.containingItems[par1]; + this.containingItems[par1] = null; + return var2; + } + return null; + } + + @Override + public void setInventorySlotContents(final int par1, + final ItemStack par2ItemStack) { + this.containingItems[par1] = par2ItemStack; + if (par2ItemStack != null && + par2ItemStack.stackSize > this.getInventoryStackLimit()) { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + } + + @Override + public String getInventoryName() { + return "Launcher Platform"; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (this.jiaZi == null) { + for (byte i = 2; i < 6; ++i) { + final Vector3 position = new Vector3(this.xCoord, this.yCoord, this.zCoord); + position.modifyPositionFromSide(ForgeDirection.getOrientation((int) i)); + final TileEntity tileEntity = this.worldObj.getTileEntity( + position.intX(), position.intY(), position.intZ()); + if (tileEntity instanceof TLauncher) { + (this.jiaZi = (TLauncher) tileEntity) + .setDirection(this.worldObj, this.xCoord, this.yCoord, + this.zCoord, + VectorHelper.getOrientationFromSide( + ForgeDirection.getOrientation((int) i), + ForgeDirection.NORTH)); + } + } + } else if (this.jiaZi.isInvalid()) { + this.jiaZi = null; + } else if (this.packetGengXin || + (super.ticks % 600L == 0L && this.jiaZi != null && + !this.worldObj.isRemote)) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + if (!this.worldObj.isRemote) { + this.setMissile(); + if (this.packetGengXin || super.ticks % 600L == 0L) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.packetGengXin = false; + } + } + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setByte("orientation", this.orientation); + nbt.setInteger("tier", this.tier); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.orientation = nbt.getByte("orientation"); + this.tier = nbt.getInteger("tier"); + } + + private void setMissile() { + if (!this.worldObj.isRemote) { + if (this.containingItems[0] != null && this.containingItems[0].getItem() instanceof ItMissile) { + int haoMa = this.containingItems[0].getItemDamage(); + if (!ICBMExplosion.shiBaoHu(this.worldObj, new Vector3(this), + ZhaPin.ZhaPinType.DAO_DAN, haoMa)) { + if (this.containingItems[0].getItem() instanceof ItModuleMissile) { + haoMa += 100; + } + if (this.daoDan == null) { + final Vector3 position = new Vector3( + this.xCoord + 0.5f, this.yCoord + 2, this.zCoord + 0.5f); + this.daoDan = new EMissile(this.worldObj, position, new Vector3(this), haoMa); + this.worldObj.spawnEntityInWorld((Entity) this.daoDan); + return; + } + if (this.daoDan.getExplosiveType() != null && + this.daoDan.getExplosiveType().getID() == haoMa) { + return; + } + } + } + if (this.daoDan != null) { + ((Entity) this.daoDan).setDead(); + } + this.daoDan = null; + } + } + + public void launchMissile(final Vector3 target, final int gaoDu) { + float inaccuracy; + if (this.jiaZi != null) { + inaccuracy = (float) this.jiaZi.getInaccuracy(); + } else { + inaccuracy = 30.0f; + } + inaccuracy *= (float) Math.random() * 2.0f - 1.0f; + target.x += inaccuracy; + target.z += inaccuracy; + this.decrStackSize(0, 1); + this.daoDan.launch(target, gaoDu); + this.daoDan = null; + } + + public boolean isInRange(final Vector3 target) { + return target != null && !this.shiTaiYuan(target) && + !this.shiTaiJin(target); + } + + public boolean shiTaiJin(final Vector3 target) { + return Vector3.distance(new Vector3(this.xCoord, 0.0, this.zCoord), + new Vector3(target.x, 0.0, target.z)) < 10.0; + } + + public boolean shiTaiYuan(final Vector3 target) { + if (this.tier == 0) { + if (Vector3.distance(new Vector3(this.xCoord, 0.0, this.zCoord), + new Vector3(target.x, 0.0, target.z)) < MainBase.DAO_DAN_ZUI_YUAN / 10) { + return false; + } + } else if (this.tier == 1) { + if (Vector3.distance(new Vector3(this.xCoord, 0.0, this.zCoord), + new Vector3(target.x, 0.0, target.z)) < MainBase.DAO_DAN_ZUI_YUAN / 5) { + return false; + } + } else if (this.tier == 2 && + Vector3.distance(new Vector3(this.xCoord, 0.0, this.zCoord), + new Vector3(target.x, 0.0, target.z)) < MainBase.DAO_DAN_ZUI_YUAN) { + return false; + } + return true; + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + final NBTTagList var2 = nbt.getTagList("Items", 10); + this.tier = nbt.getInteger("tier"); + this.orientation = nbt.getByte("facingDirection"); + this.containingItems = new ItemStack[this.getSizeInventory()]; + for (int var3 = 0; var3 < var2.tagCount(); ++var3) { + final NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); + final byte var5 = var4.getByte("Slot"); + if (var5 >= 0 && var5 < this.containingItems.length) { + this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("tier", this.tier); + nbt.setByte("facingDirection", this.orientation); + final NBTTagList var2 = new NBTTagList(); + for (int var3 = 0; var3 < this.containingItems.length; ++var3) { + if (this.containingItems[var3] != null) { + final NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte) var3); + this.containingItems[var3].writeToNBT(var4); + var2.appendTag((NBTBase) var4); + } + } + nbt.setTag("Items", (NBTBase) var2); + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer par1EntityPlayer) { + return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && + par1EntityPlayer.getDistanceSq(this.xCoord + 0.5, this.yCoord + 0.5, + this.zCoord + 0.5) <= 64.0; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public int getTier() { + return this.tier; + } + + @Override + public void setTier(final int tier) { + this.tier = tier; + } + + @Override + public boolean onActivated(final EntityPlayer entityPlayer) { + if (entityPlayer.inventory.getCurrentItem() != null && + this.getStackInSlot(0) == null && + entityPlayer.inventory.getCurrentItem().getItem() instanceof ItMissile) { + this.setInventorySlotContents(0, entityPlayer.inventory.getCurrentItem()); + entityPlayer.inventory.setInventorySlotContents( + entityPlayer.inventory.currentItem, (ItemStack) null); + return true; + } + entityPlayer.openGui((Object) ICBMExplosion.instance, 7, this.worldObj, + this.xCoord, this.yCoord, this.zCoord); + return true; + } + + @Override + public void onCreate(final Vector3 position) { + if (this.orientation == 3 || this.orientation == 2) { + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(1.0, 0.0, 0.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(1.0, 1.0, 0.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(1.0, 2.0, 0.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(-1.0, 0.0, 0.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(-1.0, 1.0, 0.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(-1.0, 2.0, 0.0)), + new Vector3(this)); + } else { + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 0.0, 1.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 1.0, 1.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 2.0, 1.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 0.0, -1.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 1.0, -1.0)), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(position, new Vector3(0.0, 2.0, -1.0)), + new Vector3(this)); + } + } + + @Override + public void onDestroy(final TileEntity callingBlock) { + final Vector3 position = new Vector3(this.xCoord, this.yCoord, this.zCoord); + if (this.orientation == 3 || this.orientation == 2) { + this.worldObj.setBlock((int) position.x, (int) position.y, (int) position.z, + Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x + 1, (int) position.y, + (int) position.z, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x + 1, (int) position.y + 1, + (int) position.z, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x + 1, (int) position.y + 2, + (int) position.z, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x - 1, (int) position.y, + (int) position.z, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x - 1, (int) position.y + 1, + (int) position.z, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x - 1, (int) position.y + 2, + (int) position.z, Blocks.air, 0, 2); + } else { + this.worldObj.setBlock((int) position.x, (int) position.y, (int) position.z, + Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x, (int) position.y, + (int) position.z + 1, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x, (int) position.y + 1, + (int) position.z + 1, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x, (int) position.y + 2, + (int) position.z + 1, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x, (int) position.y, + (int) position.z - 1, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x, (int) position.y + 1, + (int) position.z - 1, Blocks.air, 0, 2); + this.worldObj.setBlock((int) position.x, (int) position.y + 2, + (int) position.z - 1, Blocks.air, 0, 2); + } + if (this.daoDan != null) { + ((Entity) this.daoDan).setDead(); + } + } + + @Override + public ForgeDirection getDirection(final IBlockAccess world, final int x, + final int y, final int z) { + return ForgeDirection.getOrientation((int) this.orientation); + } + + @Override + public void setDirection(final World world, final int x, final int y, + final int z, final ForgeDirection facingDirection) { + this.orientation = (byte) facingDirection.ordinal(); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public boolean isItemValidForSlot(final int slotID, + final ItemStack itemStack) { + return itemStack.getItem() instanceof ItMissile; + } + + @Override + public IMissile getContainingMissile() { + return this.daoDan; + } + + @Override + public void setContainingMissile(final IMissile missile) { + this.daoDan = missile; + } + + @Override + public ILauncherController getController() { + for (byte i = 2; i < 6; ++i) { + final Vector3 position = new Vector3(this).modifyPositionFromSide( + ForgeDirection.getOrientation((int) i)); + final TileEntity tileEntity = position.getTileEntity((IBlockAccess) this.worldObj); + if (tileEntity instanceof ILauncherController) { + return (ILauncherController) tileEntity; + } + } + return null; + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TMissileCoordinator.java b/src/main/java/icbm/zhapin/jiqi/TMissileCoordinator.java new file mode 100644 index 0000000..5c58317 --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TMissileCoordinator.java @@ -0,0 +1,41 @@ +package icbm.zhapin.jiqi; + +import calclavia.lib.TileEntityUniversalRunnable; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.prefab.implement.IRotatable; + +public class TMissileCoordinator + extends TileEntityUniversalRunnable implements IRotatable { + private byte facingDirection; + + public TMissileCoordinator() { this.facingDirection = 3; } + + // TODO: WTF: nix data packet? + + @Override + public void readFromNBT(final NBTTagCompound par1NBTTagCompound) { + super.readFromNBT(par1NBTTagCompound); + this.facingDirection = par1NBTTagCompound.getByte("facingDirection"); + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setByte("facingDirection", this.facingDirection); + } + + @Override + public ForgeDirection getDirection(final IBlockAccess world, final int x, + final int y, final int z) { + return ForgeDirection.getOrientation((int)this.facingDirection); + } + + @Override + public void setDirection(final World world, final int x, final int y, + final int z, final ForgeDirection facingDirection) { + this.facingDirection = (byte)facingDirection.ordinal(); + } +} diff --git a/src/main/java/icbm/zhapin/jiqi/TRadarTower.java b/src/main/java/icbm/zhapin/jiqi/TRadarTower.java new file mode 100644 index 0000000..ba57c3f --- /dev/null +++ b/src/main/java/icbm/zhapin/jiqi/TRadarTower.java @@ -0,0 +1,426 @@ +package icbm.zhapin.jiqi; + +import calclavia.lib.TileEntityUniversalRunnable; +import dan200.computercraft.api.lua.ILuaContext; +import dan200.computercraft.api.lua.LuaException; +import dan200.computercraft.api.peripheral.IComputerAccess; +import dan200.computercraft.api.peripheral.IPeripheral; +import icbm.api.IItemFrequency; +import icbm.api.RadarRegistry; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.core.vector.Vector2; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.block.BlockAdvanced; +import universalelectricity.prefab.implement.IRedstoneProvider; +import universalelectricity.prefab.multiblock.IMultiBlock; + +public class TRadarTower extends TileEntityUniversalRunnable + implements IRedstoneProvider, IMultiBlock, IPeripheral { + public static final int MAX_BIAN_JING = 500; + public float xuanZhuan; + public int alarmRadius; + public int safetyRadius; + private List missilesInRange; + public List xunZhaoEntity; + public List xunZhaoJiQi; + public boolean emitAll; + private ForgeChunkManager.Ticket ticket; + + public TRadarTower() { + this.xuanZhuan = 0.0f; + this.alarmRadius = 100; + this.safetyRadius = 50; + this.missilesInRange = new ArrayList<>(); + this.xunZhaoEntity = new ArrayList<>(); + this.xunZhaoJiQi = new ArrayList<>(); + this.emitAll = true; + RadarRegistry.register(this); + } + + @Override + public void initiate() { + if (this.worldObj != null) { + this.worldObj.notifyBlocksOfNeighborChange( + this.xCoord, this.yCoord, this.zCoord, + this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord)); + } + if (this.ticket == null) { + this.ticket = ForgeChunkManager.requestTicket( + (Object)ICBMExplosion.instance, this.worldObj, + ForgeChunkManager.Type.NORMAL); + if (this.ticket != null) { + this.ticket.getModData(); + } + } + ForgeChunkManager.forceChunk( + this.ticket, new ChunkCoordIntPair(this.xCoord >> 4, this.zCoord >> 4)); + } + + @Override + public void updateEntity() { + super.updateEntity(); + try { + if (!this.worldObj.isRemote) { + if (super.ticks % 40L == 0L) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, + this.zCoord); + } + } + if (!this.isDisabled()) { + if (super.wattsReceived >= this.getRequest().getWatts()) { + this.xuanZhuan += 0.05f; + if (this.xuanZhuan > 360.0f) { + this.xuanZhuan = 0.0f; + } + if (!this.worldObj.isRemote) { + super.wattsReceived = Math.max( + super.wattsReceived - this.getRequest().getWatts(), 0.0); + } + final int prevShuMu = this.xunZhaoEntity.size(); + this.doScan(); + if (prevShuMu != this.xunZhaoEntity.size()) { + this.worldObj.notifyBlocksOfNeighborChange( + this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + } + } else { + if (this.xunZhaoEntity.size() > 0) { + this.worldObj.notifyBlocksOfNeighborChange( + this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + } + this.xunZhaoEntity.clear(); + this.xunZhaoJiQi.clear(); + } + } + if (super.ticks % 40L == 0L) { + this.worldObj.notifyBlocksOfNeighborChange( + this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + } + } catch (final Exception e) { + e.printStackTrace(); + } + } + + private void doScan() { + this.missilesInRange.clear(); + this.xunZhaoEntity.clear(); + this.xunZhaoJiQi.clear(); + final List entities = RadarRegistry.getEntitiesWithinRadius( + new Vector3(this).toVector2(), 500); + for (final Entity entity : entities) { + if (entity instanceof EMissile) { + if (((EMissile)entity).flyingTicks <= -1) { + continue; + } + if (!this.xunZhaoEntity.contains(entity)) { + this.xunZhaoEntity.add(entity); + } + if (!this.isWeiXianDaoDan((EMissile)entity)) { + continue; + } + this.missilesInRange.add((EMissile)entity); + } else { + this.xunZhaoEntity.add(entity); + } + } + final List players = this.worldObj.getEntitiesWithinAABB( + (Class)EntityPlayer.class, + AxisAlignedBB.getBoundingBox( + (double)(this.xCoord - 500), (double)(this.yCoord - 500), + (double)(this.zCoord - 500), (double)(this.xCoord + 500), + (double)(this.yCoord + 500), (double)(this.zCoord + 500))); + for (final EntityPlayer player : players) { + if (player != null) { + boolean youHuoLuan = false; + for (int i = 0; i < player.inventory.getSizeInventory(); ++i) { + final ItemStack itemStack = player.inventory.getStackInSlot(i); + if (itemStack != null && itemStack.getItem() instanceof + IItemFrequency) { + youHuoLuan = true; + break; + } + } + if (youHuoLuan) { + continue; + } + this.xunZhaoEntity.add(player); + } + } + for (final TileEntity jiQi : RadarRegistry.getTileEntitiesInArea( + new Vector2(this.xCoord - 500, this.zCoord - 500), + new Vector2(this.xCoord + 500, this.zCoord + 500))) { + if (jiQi instanceof TRadarTower) { + if (((TRadarTower)jiQi).isDisabled() || + ((TRadarTower)jiQi).prevWatts <= 0.0) { + continue; + } + this.xunZhaoJiQi.add(jiQi); + } else { + this.xunZhaoJiQi.add(jiQi); + } + } + } + + public boolean isWeiXianDaoDan(final EMissile daoDan) { + return daoDan != null && daoDan.target != null && + Vector2.distance(new Vector3(daoDan).toVector2(), + new Vector2(this.xCoord, this.zCoord)) < + this.alarmRadius && + Vector2.distance(daoDan.target.toVector2(), + new Vector2(this.xCoord, this.zCoord)) < + this.safetyRadius; + } + + // TODO: WTF + // private Packet getDescriptionPacket2() { + // return PacketManager.getPacket("ICBM|E", this, 1, this.alarmRadius, + // this.safetyBanJing); + // } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setDouble("wattsReceived", super.wattsReceived); + nbt.setInteger("disabledTicks", this.disabledTicks); + nbt.setInteger("safetyRadius", this.safetyRadius); + nbt.setInteger("alarmRadius", this.alarmRadius); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + super.wattsReceived = nbt.getDouble("wattsReceived"); + this.disabledTicks = nbt.getInteger("disabledTicks"); + this.safetyRadius = nbt.getInteger("safetyRadius"); + this.alarmRadius = nbt.getInteger("alarmRadius"); + } + + @Override + public boolean isPoweringTo(final ForgeDirection side) { + if ((super.prevWatts > 0.0 || super.wattsReceived > 0.0) && + this.missilesInRange.size() > 0) { + if (this.emitAll) { + return true; + } + + // This detects which direction a missile is coming from, and emits + // redstone on the other side. + for (final EMissile missile : this.missilesInRange) { + final Vector2 position = new Vector3(missile).toVector2(); + ForgeDirection missileSide = ForgeDirection.UNKNOWN; + double closest = -1.0; + for (int i = 2; i < 6; ++i) { + final double dist = Vector2.distance( + position, + new Vector2( + this.xCoord + ForgeDirection.getOrientation(i).offsetX, + this.zCoord + ForgeDirection.getOrientation(i).offsetZ)); + if (dist < closest || closest < 0.0) { + missileSide = ForgeDirection.getOrientation(i); + closest = dist; + } + } + if (missileSide.getOpposite() == side) { + return true; + } + } + } + return false; + } + + @Override + public boolean isIndirectlyPoweringTo(final ForgeDirection side) { + return this.isPoweringTo(side); + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.safetyRadius = nbt.getInteger("safetyRadius"); + this.alarmRadius = nbt.getInteger("alarmRadius"); + this.emitAll = nbt.getBoolean("emitAll"); + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("safetyRadius", this.safetyRadius); + par1NBTTagCompound.setInteger("alarmRadius", this.alarmRadius); + par1NBTTagCompound.setBoolean("emitAll", this.emitAll); + } + + @Override + public void onDestroy(final TileEntity callingBlock) { + this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.air, 0, + 2); + this.worldObj.setBlock(this.xCoord, this.yCoord + 1, this.zCoord, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord, this.yCoord + 1, this.zCoord + 1, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord, this.yCoord + 1, this.zCoord - 1, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 1, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 1, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 1, + Blocks.air, 0, 2); + this.worldObj.setBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 1, + Blocks.air, 0, 2); + } + + @Override + public boolean onActivated(final EntityPlayer entityPlayer) { + if (entityPlayer.inventory.getCurrentItem() != null && + ((BlockAdvanced)this.getBlockType()) + .isUsableWrench(entityPlayer, + entityPlayer.inventory.getCurrentItem(), + this.xCoord, this.yCoord, this.zCoord)) { + if (!this.worldObj.isRemote) { + this.emitAll = !this.emitAll; + entityPlayer.addChatMessage(new ChatComponentText( + "Radar redstone all side emission: " + this.emitAll)); + } + return true; + } + entityPlayer.openGui((Object)ICBMExplosion.instance, 3, this.worldObj, + this.xCoord, this.yCoord, this.zCoord); + return true; + } + + @Override + public void onCreate(final Vector3 position) { + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(0.0, 1.0, 0.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(1.0, 1.0, 0.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(-1.0, 1.0, 0.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(0.0, 1.0, 1.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(0.0, 1.0, -1.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(1.0, 1.0, -1.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(-1.0, 1.0, 1.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(1.0, 1.0, 1.0), position), + new Vector3(this)); + MainBase.bJia.makeFakeBlock( + this.worldObj, Vector3.add(new Vector3(-1.0, 1.0, -1.0), position), + new Vector3(this)); + } + + @Override + public String getType() { + return "ICBMRadar"; + } + + @Override + public String[] getMethodNames() { + return new String[] {"getEntities", "getBlocks"}; + } + + @Override + public Object[] callMethod(final IComputerAccess computer, ILuaContext ctx, + final int method, final Object[] arguments) + throws LuaException { + if (super.wattsReceived < this.getRequest().getWatts()) { + throw new LuaException("Radar has insufficient electricity!"); + } + final HashMap returnArray = new HashMap<>(); + int count = 0; + switch (method) { + case 0: { + final List entities = RadarRegistry.getEntitiesWithinRadius( + new Vector3(this).toVector2(), this.alarmRadius); + for (final Entity entity : entities) { + // TODO: completely retarded lua API + returnArray.put("x_" + count, entity.posX); + returnArray.put("y_" + count, entity.posY); + returnArray.put("z_" + count, entity.posZ); + ++count; + } + return new Object[] {returnArray}; + } + case 1: { + for (final TileEntity jiQi : RadarRegistry.getTileEntitiesInArea( + new Vector2(this.xCoord - 500, this.zCoord - 500), + new Vector2(this.xCoord + 500, this.zCoord + 500))) { + returnArray.put("x_" + count, (double)jiQi.xCoord); + returnArray.put("y_" + count, (double)jiQi.yCoord); + returnArray.put("z_" + count, (double)jiQi.zCoord); + ++count; + } + return new Object[] {returnArray}; + } + default: { + throw new LuaException("Invalid ICBM Radar Function."); + } + } + } + + @Override + public void invalidate() { + ForgeChunkManager.releaseTicket(this.ticket); + RadarRegistry.unregister(this); + super.invalidate(); + } + + @Override + public void attach(final IComputerAccess computer) {} + + @Override + public void detach(final IComputerAccess computer) {} + + @Override + public ElectricityPack getRequest() { + return new ElectricityPack(15.0 / this.getVoltage(), this.getVoltage()); + } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return TileEntity.INFINITE_EXTENT_AABB; + } + + @Override + public boolean equals(IPeripheral other) { + return this == other; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMBingDan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMBingDan.java new file mode 100644 index 0000000..22447f4 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMBingDan.java @@ -0,0 +1,260 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMBingDan extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE_1; + ModelRenderer MOTOR_MODULE_2; + ModelRenderer MOTOR_MODULE_3; + ModelRenderer MOTOR_MODULE_4; + ModelRenderer C1; + ModelRenderer C2; + ModelRenderer C3; + ModelRenderer C4; + ModelRenderer T1; + ModelRenderer T2; + ModelRenderer T3; + ModelRenderer T4; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_1B; + ModelRenderer WING_2B; + ModelRenderer WING_3A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_4A; + ModelRenderer TOP; + ModelRenderer Shape1; + ModelRenderer Shape1a; + ModelRenderer Shape1b; + ModelRenderer Shape1c; + ModelRenderer Shape1d; + ModelRenderer Shape1e; + + public MMBingDan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 70, 8); + this.MAIN_MODULE.setRotationPoint(-4.0f, -63.0f, -4.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_1 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_1.setRotationPoint(-8.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_1.setTextureSize(128, 128); + this.MOTOR_MODULE_1.mirror = true; + this.setRotation(this.MOTOR_MODULE_1, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_2 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_2.setRotationPoint(-8.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_2.setTextureSize(128, 128); + this.MOTOR_MODULE_2.mirror = true; + this.setRotation(this.MOTOR_MODULE_2, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_3 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_3.setRotationPoint(2.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_3.setTextureSize(128, 128); + this.MOTOR_MODULE_3.mirror = true; + this.setRotation(this.MOTOR_MODULE_3, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_4 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_4.setRotationPoint(2.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_4.setTextureSize(128, 128); + this.MOTOR_MODULE_4.mirror = true; + this.setRotation(this.MOTOR_MODULE_4, 0.0f, 0.0f, 0.0f); + (this.C1 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C1.setRotationPoint(-6.0f, 20.0f, -6.0f); + this.C1.setTextureSize(128, 128); + this.C1.mirror = true; + this.setRotation(this.C1, 0.0f, 0.0f, 0.0f); + (this.C2 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C2.setRotationPoint(-6.0f, 20.0f, 4.0f); + this.C2.setTextureSize(128, 128); + this.C2.mirror = true; + this.setRotation(this.C2, 0.0f, 0.0f, 0.0f); + (this.C3 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C3.setRotationPoint(4.0f, 20.0f, -6.0f); + this.C3.setTextureSize(128, 128); + this.C3.mirror = true; + this.setRotation(this.C3, 0.0f, 0.0f, 0.0f); + (this.C4 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C4.setRotationPoint(4.0f, 20.0f, 4.0f); + this.C4.setTextureSize(128, 128); + this.C4.mirror = true; + this.setRotation(this.C4, 0.0f, 0.0f, 0.0f); + (this.T1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T1.setRotationPoint(-7.0f, 21.0f, -7.0f); + this.T1.setTextureSize(128, 128); + this.T1.mirror = true; + this.setRotation(this.T1, 0.0f, 0.0f, 0.0f); + (this.T2 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T2.setRotationPoint(-7.0f, 21.0f, 3.0f); + this.T2.setTextureSize(128, 128); + this.T2.mirror = true; + this.setRotation(this.T2, 0.0f, 0.0f, 0.0f); + (this.T3 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T3.setRotationPoint(3.0f, 21.0f, -7.0f); + this.T3.setTextureSize(128, 128); + this.T3.mirror = true; + this.setRotation(this.T3, 0.0f, 0.0f, 0.0f); + (this.T4 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T4.setRotationPoint(3.0f, 21.0f, 3.0f); + this.T4.setTextureSize(128, 128); + this.T4.mirror = true; + this.setRotation(this.T4, 0.0f, 0.0f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 43, 15)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 12, 12); + this.WING_1A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, -0.7853982f, 0.0f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 43, 0)) + .addBox(0.0f, 0.0f, -1.0f, 12, 12, 2); + this.WING_2A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, 0.0f, 0.7853982f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 72, 28)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 25, 16); + this.WING_1B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, 0.0f, 0.0f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 25, 2); + this.WING_2B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, 0.0f, 0.0f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 34, 55)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 10, 16); + this.WING_3A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.0f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 34, 82)) + .addBox(-1.0f, -6.0f, -6.0f, 2, 12, 12); + this.WING_3B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, 0.7853982f, 0.0f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 34, 41)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 10, 2); + this.WING_4B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, 0.0f, 0.0f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 34, 107)) + .addBox(-6.0f, -6.0f, -1.0f, 12, 12, 2); + this.WING_4A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, 0.0f, -0.7853982f); + (this.TOP = new ModelRenderer((ModelBase)this, 72, 70)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.TOP.setRotationPoint(-5.0f, -64.0f, -5.0f); + this.TOP.setTextureSize(128, 128); + this.TOP.mirror = true; + this.setRotation(this.TOP, 0.0f, 0.0f, 0.0f); + (this.Shape1 = new ModelRenderer((ModelBase)this, 108, 92)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape1.setRotationPoint(-4.0f, -70.0f, -4.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape1a = new ModelRenderer((ModelBase)this, 108, 92)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape1a.setRotationPoint(-4.0f, -70.0f, 2.0f); + this.Shape1a.setTextureSize(128, 128); + this.Shape1a.mirror = true; + this.setRotation(this.Shape1a, 0.0f, 0.0f, 0.0f); + (this.Shape1b = new ModelRenderer((ModelBase)this, 108, 92)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape1b.setRotationPoint(2.0f, -70.0f, -4.0f); + this.Shape1b.setTextureSize(128, 128); + this.Shape1b.mirror = true; + this.setRotation(this.Shape1b, 0.0f, 0.0f, 0.0f); + (this.Shape1c = new ModelRenderer((ModelBase)this, 108, 92)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape1c.setRotationPoint(2.0f, -70.0f, 2.0f); + this.Shape1c.setTextureSize(128, 128); + this.Shape1c.mirror = true; + this.setRotation(this.Shape1c, 0.0f, 0.0f, 0.0f); + (this.Shape1d = new ModelRenderer((ModelBase)this, 64, 92)) + .addBox(0.0f, 0.0f, 0.0f, 6, 10, 6); + this.Shape1d.setRotationPoint(-3.0f, -74.0f, -3.0f); + this.Shape1d.setTextureSize(128, 128); + this.Shape1d.mirror = true; + this.setRotation(this.Shape1d, 0.0f, 0.0f, 0.0f); + (this.Shape1e = new ModelRenderer((ModelBase)this, 90, 92)) + .addBox(0.0f, 0.0f, 0.0f, 4, 6, 4); + this.Shape1e.setRotationPoint(-2.0f, -80.0f, -2.0f); + this.Shape1e.setTextureSize(128, 128); + this.Shape1e.mirror = true; + this.setRotation(this.Shape1e, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE_1.render(f5); + this.MOTOR_MODULE_2.render(f5); + this.MOTOR_MODULE_3.render(f5); + this.MOTOR_MODULE_4.render(f5); + this.C1.render(f5); + this.C2.render(f5); + this.C3.render(f5); + this.C4.render(f5); + this.T1.render(f5); + this.T2.render(f5); + this.T3.render(f5); + this.T4.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_1B.render(f5); + this.WING_2B.render(f5); + this.WING_3A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_4A.render(f5); + this.TOP.render(f5); + this.Shape1.render(f5); + this.Shape1a.render(f5); + this.Shape1b.render(f5); + this.Shape1c.render(f5); + this.Shape1d.render(f5); + this.Shape1e.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMChaoShengBuo.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMChaoShengBuo.java new file mode 100644 index 0000000..e538dd8 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMChaoShengBuo.java @@ -0,0 +1,297 @@ +package icbm.zhapin.muoxing.daodan; + +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class MMChaoShengBuo extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE_1; + ModelRenderer MOTOR_MODULE_2; + ModelRenderer MOTOR_MODULE_3; + ModelRenderer MOTOR_MODULE_4; + ModelRenderer C1; + ModelRenderer C2; + ModelRenderer C3; + ModelRenderer C4; + ModelRenderer T1; + ModelRenderer T2; + ModelRenderer T3; + ModelRenderer T4; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_1B; + ModelRenderer WING_2B; + ModelRenderer WING_3A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_4A; + ModelRenderer TOP; + ModelRenderer VOX_1; + ModelRenderer VOX_2; + ModelRenderer VOX3; + ModelRenderer VOX4; + ModelRenderer A; + ModelRenderer B; + ModelRenderer C; + ModelRenderer D; + ModelRenderer E; + ModelRenderer F; + ModelRenderer G; + + public MMChaoShengBuo() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 70, 8); + this.MAIN_MODULE.setRotationPoint(-4.0f, -63.0f, -4.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_1 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_1.setRotationPoint(-8.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_1.setTextureSize(128, 128); + this.MOTOR_MODULE_1.mirror = true; + this.setRotation(this.MOTOR_MODULE_1, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_2 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_2.setRotationPoint(-8.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_2.setTextureSize(128, 128); + this.MOTOR_MODULE_2.mirror = true; + this.setRotation(this.MOTOR_MODULE_2, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_3 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_3.setRotationPoint(2.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_3.setTextureSize(128, 128); + this.MOTOR_MODULE_3.mirror = true; + this.setRotation(this.MOTOR_MODULE_3, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_4 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_4.setRotationPoint(2.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_4.setTextureSize(128, 128); + this.MOTOR_MODULE_4.mirror = true; + this.setRotation(this.MOTOR_MODULE_4, 0.0f, 0.0f, 0.0f); + (this.C1 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C1.setRotationPoint(-6.0f, 20.0f, -6.0f); + this.C1.setTextureSize(128, 128); + this.C1.mirror = true; + this.setRotation(this.C1, 0.0f, 0.0f, 0.0f); + (this.C2 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C2.setRotationPoint(-6.0f, 20.0f, 4.0f); + this.C2.setTextureSize(128, 128); + this.C2.mirror = true; + this.setRotation(this.C2, 0.0f, 0.0f, 0.0f); + (this.C3 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C3.setRotationPoint(4.0f, 20.0f, -6.0f); + this.C3.setTextureSize(128, 128); + this.C3.mirror = true; + this.setRotation(this.C3, 0.0f, 0.0f, 0.0f); + (this.C4 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C4.setRotationPoint(4.0f, 20.0f, 4.0f); + this.C4.setTextureSize(128, 128); + this.C4.mirror = true; + this.setRotation(this.C4, 0.0f, 0.0f, 0.0f); + (this.T1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T1.setRotationPoint(-7.0f, 21.0f, -7.0f); + this.T1.setTextureSize(128, 128); + this.T1.mirror = true; + this.setRotation(this.T1, 0.0f, 0.0f, 0.0f); + (this.T2 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T2.setRotationPoint(-7.0f, 21.0f, 3.0f); + this.T2.setTextureSize(128, 128); + this.T2.mirror = true; + this.setRotation(this.T2, 0.0f, 0.0f, 0.0f); + (this.T3 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T3.setRotationPoint(3.0f, 21.0f, -7.0f); + this.T3.setTextureSize(128, 128); + this.T3.mirror = true; + this.setRotation(this.T3, 0.0f, 0.0f, 0.0f); + (this.T4 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T4.setRotationPoint(3.0f, 21.0f, 3.0f); + this.T4.setTextureSize(128, 128); + this.T4.mirror = true; + this.setRotation(this.T4, 0.0f, 0.0f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 43, 15)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 12, 12); + this.WING_1A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, -0.7853982f, 0.0f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 43, 0)) + .addBox(0.0f, 0.0f, -1.0f, 12, 12, 2); + this.WING_2A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, 0.0f, 0.7853982f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 72, 28)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 25, 16); + this.WING_1B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, 0.0f, 0.0f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 25, 2); + this.WING_2B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, 0.0f, 0.0f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 34, 55)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 10, 16); + this.WING_3A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.0f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 34, 82)) + .addBox(-1.0f, -6.0f, -6.0f, 2, 12, 12); + this.WING_3B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, 0.7853982f, 0.0f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 34, 41)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 10, 2); + this.WING_4B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, 0.0f, 0.0f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 34, 107)) + .addBox(-6.0f, -6.0f, -1.0f, 12, 12, 2); + this.WING_4A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, 0.0f, -0.7853982f); + (this.TOP = new ModelRenderer((ModelBase)this, 72, 70)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.TOP.setRotationPoint(-5.0f, -64.0f, -5.0f); + this.TOP.setTextureSize(128, 128); + this.TOP.mirror = true; + this.setRotation(this.TOP, 0.0f, 0.0f, 0.0f); + (this.VOX_1 = new ModelRenderer((ModelBase)this, 113, 99)) + .addBox(-3.0f, -3.0f, 5.0f, 6, 6, 1); + this.VOX_1.setRotationPoint(0.0f, -59.0f, 0.0f); + this.VOX_1.setTextureSize(128, 128); + this.VOX_1.mirror = true; + this.setRotation(this.VOX_1, 0.0f, 0.0f, 0.0f); + (this.VOX_2 = new ModelRenderer((ModelBase)this, 113, 99)) + .addBox(-3.0f, -3.0f, 5.0f, 6, 6, 1); + this.VOX_2.setRotationPoint(0.0f, -59.0f, 0.0f); + this.VOX_2.setTextureSize(128, 128); + this.VOX_2.mirror = true; + this.setRotation(this.VOX_2, 0.0f, 1.570796f, 0.0f); + (this.VOX3 = new ModelRenderer((ModelBase)this, 113, 99)) + .addBox(-3.0f, -3.0f, 5.0f, 6, 6, 1); + this.VOX3.setRotationPoint(0.0f, -59.0f, 0.0f); + this.VOX3.setTextureSize(128, 128); + this.VOX3.mirror = true; + this.setRotation(this.VOX3, 0.0f, -1.570796f, 0.0f); + (this.VOX4 = new ModelRenderer((ModelBase)this, 113, 99)) + .addBox(-3.0f, -3.0f, -6.0f, 6, 6, 1); + this.VOX4.setRotationPoint(0.0f, -59.0f, 0.0f); + this.VOX4.setTextureSize(128, 128); + this.VOX4.mirror = true; + this.setRotation(this.VOX4, 0.0f, 0.0f, 0.0f); + (this.A = new ModelRenderer((ModelBase)this, 79, 92)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 6, 8); + this.A.setRotationPoint(0.0f, -70.0f, 0.0f); + this.A.setTextureSize(128, 128); + this.A.mirror = true; + this.setRotation(this.A, 0.0f, 0.0f, 0.0f); + (this.B = new ModelRenderer((ModelBase)this, 79, 108)) + .addBox(-3.0f, 0.0f, -3.0f, 6, 6, 6); + this.B.setRotationPoint(0.0f, -76.0f, 0.0f); + this.B.setTextureSize(128, 128); + this.B.mirror = true; + this.setRotation(this.B, 0.0f, 0.0f, 0.0f); + (this.C = new ModelRenderer((ModelBase)this, 106, 108)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 6, 4); + this.C.setRotationPoint(0.0f, -82.0f, 0.0f); + this.C.setTextureSize(128, 128); + this.C.mirror = true; + this.setRotation(this.C, 0.0f, 0.0f, 0.0f); + (this.D = new ModelRenderer((ModelBase)this, 65, 92)) + .addBox(-1.0f, 0.0f, -2.0f, 2, 18, 4); + this.D.setRotationPoint(0.0f, -81.0f, 0.0f); + this.D.setTextureSize(128, 128); + this.D.mirror = true; + this.setRotation(this.D, -0.2094395f, 0.0f, 0.0f); + (this.E = new ModelRenderer((ModelBase)this, 65, 92)) + .addBox(-1.0f, 0.0f, -2.0f, 2, 18, 4); + this.E.setRotationPoint(0.0f, -81.0f, 0.0f); + this.E.setTextureSize(128, 128); + this.E.mirror = true; + this.setRotation(this.E, -0.2094395f, 1.570796f, 0.0f); + (this.F = new ModelRenderer((ModelBase)this, 65, 92)) + .addBox(-1.0f, 0.0f, -2.0f, 2, 18, 4); + this.F.setRotationPoint(0.0f, -81.0f, 0.0f); + this.F.setTextureSize(128, 128); + this.F.mirror = true; + this.setRotation(this.F, -0.2094395f, -1.570796f, 0.0f); + (this.G = new ModelRenderer((ModelBase)this, 65, 92)) + .addBox(-1.0f, 0.0f, -2.0f, 2, 18, 4); + this.G.setRotationPoint(0.0f, -81.0f, 0.0f); + this.G.setTextureSize(128, 128); + this.G.mirror = true; + this.setRotation(this.G, 0.2094395f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE_1.render(f5); + this.MOTOR_MODULE_2.render(f5); + this.MOTOR_MODULE_3.render(f5); + this.MOTOR_MODULE_4.render(f5); + this.C1.render(f5); + this.C2.render(f5); + this.C3.render(f5); + this.C4.render(f5); + this.T1.render(f5); + this.T2.render(f5); + this.T3.render(f5); + this.T4.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_1B.render(f5); + this.WING_2B.render(f5); + this.WING_3A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_4A.render(f5); + this.TOP.render(f5); + this.VOX_1.render(f5); + this.VOX_2.render(f5); + this.VOX3.render(f5); + this.VOX4.render(f5); + this.A.render(f5); + this.B.render(f5); + this.C.render(f5); + this.D.render(f5); + this.E.render(f5); + this.F.render(f5); + this.G.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMDianCi.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMDianCi.java new file mode 100644 index 0000000..ad56777 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMDianCi.java @@ -0,0 +1,268 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMDianCi extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE_1; + ModelRenderer MOTOR_MODULE_2; + ModelRenderer MOTOR_MODULE_3; + ModelRenderer MOTOR_MODULE_4; + ModelRenderer C1; + ModelRenderer C2; + ModelRenderer C3; + ModelRenderer C4; + ModelRenderer T1; + ModelRenderer T2; + ModelRenderer T3; + ModelRenderer T4; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_1B; + ModelRenderer WING_2B; + ModelRenderer WING_3A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_4A; + ModelRenderer TOP; + ModelRenderer BASE; + ModelRenderer MAIN_COIL; + ModelRenderer COIL_1; + ModelRenderer COIL_2; + ModelRenderer COIL_3; + ModelRenderer COIL_4; + ModelRenderer WARHEAD; + + public MMDianCi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 70, 8); + this.MAIN_MODULE.setRotationPoint(-4.0f, -63.0f, -4.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_1 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_1.setRotationPoint(-8.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_1.setTextureSize(128, 128); + this.MOTOR_MODULE_1.mirror = true; + this.setRotation(this.MOTOR_MODULE_1, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_2 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_2.setRotationPoint(-8.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_2.setTextureSize(128, 128); + this.MOTOR_MODULE_2.mirror = true; + this.setRotation(this.MOTOR_MODULE_2, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_3 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_3.setRotationPoint(2.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_3.setTextureSize(128, 128); + this.MOTOR_MODULE_3.mirror = true; + this.setRotation(this.MOTOR_MODULE_3, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_4 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_4.setRotationPoint(2.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_4.setTextureSize(128, 128); + this.MOTOR_MODULE_4.mirror = true; + this.setRotation(this.MOTOR_MODULE_4, 0.0f, 0.0f, 0.0f); + (this.C1 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C1.setRotationPoint(-6.0f, 20.0f, -6.0f); + this.C1.setTextureSize(128, 128); + this.C1.mirror = true; + this.setRotation(this.C1, 0.0f, 0.0f, 0.0f); + (this.C2 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C2.setRotationPoint(-6.0f, 20.0f, 4.0f); + this.C2.setTextureSize(128, 128); + this.C2.mirror = true; + this.setRotation(this.C2, 0.0f, 0.0f, 0.0f); + (this.C3 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C3.setRotationPoint(4.0f, 20.0f, -6.0f); + this.C3.setTextureSize(128, 128); + this.C3.mirror = true; + this.setRotation(this.C3, 0.0f, 0.0f, 0.0f); + (this.C4 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C4.setRotationPoint(4.0f, 20.0f, 4.0f); + this.C4.setTextureSize(128, 128); + this.C4.mirror = true; + this.setRotation(this.C4, 0.0f, 0.0f, 0.0f); + (this.T1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T1.setRotationPoint(-7.0f, 21.0f, -7.0f); + this.T1.setTextureSize(128, 128); + this.T1.mirror = true; + this.setRotation(this.T1, 0.0f, 0.0f, 0.0f); + (this.T2 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T2.setRotationPoint(-7.0f, 21.0f, 3.0f); + this.T2.setTextureSize(128, 128); + this.T2.mirror = true; + this.setRotation(this.T2, 0.0f, 0.0f, 0.0f); + (this.T3 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T3.setRotationPoint(3.0f, 21.0f, -7.0f); + this.T3.setTextureSize(128, 128); + this.T3.mirror = true; + this.setRotation(this.T3, 0.0f, 0.0f, 0.0f); + (this.T4 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T4.setRotationPoint(3.0f, 21.0f, 3.0f); + this.T4.setTextureSize(128, 128); + this.T4.mirror = true; + this.setRotation(this.T4, 0.0f, 0.0f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 43, 15)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 12, 12); + this.WING_1A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, -0.7853982f, 0.0f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 43, 0)) + .addBox(0.0f, 0.0f, -1.0f, 12, 12, 2); + this.WING_2A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, 0.0f, 0.7853982f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 72, 28)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 25, 16); + this.WING_1B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, 0.0f, 0.0f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 25, 2); + this.WING_2B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, 0.0f, 0.0f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 34, 55)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 10, 16); + this.WING_3A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.0f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 34, 82)) + .addBox(-1.0f, -6.0f, -6.0f, 2, 12, 12); + this.WING_3B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, 0.7853982f, 0.0f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 34, 41)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 10, 2); + this.WING_4B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, 0.0f, 0.0f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 34, 107)) + .addBox(-6.0f, -6.0f, -1.0f, 12, 12, 2); + this.WING_4A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, 0.0f, -0.7853982f); + (this.TOP = new ModelRenderer((ModelBase)this, 72, 70)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.TOP.setRotationPoint(-5.0f, -64.0f, -5.0f); + this.TOP.setTextureSize(128, 128); + this.TOP.mirror = true; + this.setRotation(this.TOP, 0.0f, 0.0f, 0.0f); + (this.BASE = new ModelRenderer((ModelBase)this, 64, 92)) + .addBox(-6.0f, 0.0f, -6.0f, 12, 1, 12); + this.BASE.setRotationPoint(0.0f, -65.0f, 0.0f); + this.BASE.setTextureSize(128, 128); + this.BASE.mirror = true; + this.setRotation(this.BASE, 0.0f, 0.0f, 0.0f); + (this.MAIN_COIL = new ModelRenderer((ModelBase)this, 64, 107)) + .addBox(-3.0f, 0.0f, -3.0f, 6, 10, 6); + this.MAIN_COIL.setRotationPoint(0.0f, -75.0f, 0.0f); + this.MAIN_COIL.setTextureSize(128, 128); + this.MAIN_COIL.mirror = true; + this.setRotation(this.MAIN_COIL, 0.0f, 0.0f, 0.0f); + (this.COIL_1 = new ModelRenderer((ModelBase)this, 90, 107)) + .addBox(3.0f, 0.0f, -5.0f, 2, 8, 2); + this.COIL_1.setRotationPoint(0.0f, -73.0f, 0.0f); + this.COIL_1.setTextureSize(128, 128); + this.COIL_1.mirror = true; + this.setRotation(this.COIL_1, 0.0f, 0.0f, 0.0f); + (this.COIL_2 = new ModelRenderer((ModelBase)this, 90, 107)) + .addBox(-5.0f, 0.0f, 3.0f, 2, 8, 2); + this.COIL_2.setRotationPoint(0.0f, -73.0f, 0.0f); + this.COIL_2.setTextureSize(128, 128); + this.COIL_2.mirror = true; + this.setRotation(this.COIL_2, 0.0f, 0.0f, 0.0f); + (this.COIL_3 = new ModelRenderer((ModelBase)this, 90, 107)) + .addBox(-5.0f, 0.0f, -5.0f, 2, 8, 2); + this.COIL_3.setRotationPoint(0.0f, -73.0f, 0.0f); + this.COIL_3.setTextureSize(128, 128); + this.COIL_3.mirror = true; + this.setRotation(this.COIL_3, 0.0f, 0.0f, 0.0f); + (this.COIL_4 = new ModelRenderer((ModelBase)this, 90, 107)) + .addBox(3.0f, 0.0f, 3.0f, 2, 8, 2); + this.COIL_4.setRotationPoint(0.0f, -73.0f, 0.0f); + this.COIL_4.setTextureSize(128, 128); + this.COIL_4.mirror = true; + this.setRotation(this.COIL_4, 0.0f, 0.0f, 0.0f); + (this.WARHEAD = new ModelRenderer((ModelBase)this, 100, 107)) + .addBox(-1.0f, -4.0f, -1.0f, 2, 4, 2); + this.WARHEAD.setRotationPoint(0.0f, -75.0f, 0.0f); + this.WARHEAD.setTextureSize(128, 128); + this.WARHEAD.mirror = true; + this.setRotation(this.WARHEAD, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE_1.render(f5); + this.MOTOR_MODULE_2.render(f5); + this.MOTOR_MODULE_3.render(f5); + this.MOTOR_MODULE_4.render(f5); + this.C1.render(f5); + this.C2.render(f5); + this.C3.render(f5); + this.C4.render(f5); + this.T1.render(f5); + this.T2.render(f5); + this.T3.render(f5); + this.T4.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_1B.render(f5); + this.WING_2B.render(f5); + this.WING_3A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_4A.render(f5); + this.TOP.render(f5); + this.BASE.render(f5); + this.MAIN_COIL.render(f5); + this.COIL_1.render(f5); + this.COIL_2.render(f5); + this.COIL_3.render(f5); + this.COIL_4.render(f5); + this.WARHEAD.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMDuQi.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMDuQi.java new file mode 100644 index 0000000..344f6f7 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMDuQi.java @@ -0,0 +1,132 @@ +package icbm.zhapin.muoxing.daodan; + +import net.minecraft.entity.Entity; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; + +@SideOnly(Side.CLIENT) +public class MMDuQi extends MICBM +{ + ModelRenderer MAIN_MISSILE_MODULE; + ModelRenderer MOTOR_MODULE; + ModelRenderer WING_B_A_1; + ModelRenderer WING_B_B_1; + ModelRenderer WING_T_B_1; + ModelRenderer WING_T_A_1; + ModelRenderer WING_T_B_2; + ModelRenderer WING_T_A_2; + ModelRenderer WING_B_B_2; + ModelRenderer WING_B_A_2; + ModelRenderer CHEMICAL_CONTROL_MODULE; + ModelRenderer CHEMICAL_CONDUCT; + ModelRenderer CHEM_WARHEAD_1; + ModelRenderer CHEM_WARHEAD_2; + + public MMDuQi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MISSILE_MODULE = new ModelRenderer((ModelBase)this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.MAIN_MISSILE_MODULE.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.MAIN_MISSILE_MODULE.setTextureSize(128, 128); + this.MAIN_MISSILE_MODULE.mirror = true; + this.setRotation(this.MAIN_MISSILE_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE = new ModelRenderer((ModelBase)this, 0, 57)).addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.MOTOR_MODULE.setRotationPoint(0.0f, 8.0f, 0.0f); + this.MOTOR_MODULE.setTextureSize(128, 128); + this.MOTOR_MODULE.mirror = true; + this.setRotation(this.MOTOR_MODULE, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_A_1 = new ModelRenderer((ModelBase)this, 59, 26)).addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_A_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_A_1.setTextureSize(128, 128); + this.WING_B_A_1.mirror = true; + this.setRotation(this.WING_B_A_1, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_B_1 = new ModelRenderer((ModelBase)this, 59, 26)).addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_B_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_B_1.setTextureSize(128, 128); + this.WING_B_B_1.mirror = true; + this.setRotation(this.WING_B_B_1, 0.0f, -0.7853982f, 0.0f); + (this.WING_T_B_1 = new ModelRenderer((ModelBase)this, 59, 0)).addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_B_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_B_1.setTextureSize(128, 128); + this.WING_T_B_1.mirror = true; + this.setRotation(this.WING_T_B_1, -0.7853982f, 0.7853982f, 0.0f); + (this.WING_T_A_1 = new ModelRenderer((ModelBase)this, 59, 0)).addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_A_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_A_1.setTextureSize(128, 128); + this.WING_T_A_1.mirror = true; + this.setRotation(this.WING_T_A_1, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_T_B_2 = new ModelRenderer((ModelBase)this, 25, 0)).addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_B_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_B_2.setTextureSize(128, 128); + this.WING_T_B_2.mirror = true; + this.setRotation(this.WING_T_B_2, 0.0f, 0.7853982f, 0.0f); + (this.WING_T_A_2 = new ModelRenderer((ModelBase)this, 25, 0)).addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_A_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_A_2.setTextureSize(128, 128); + this.WING_T_A_2.mirror = true; + this.setRotation(this.WING_T_A_2, 0.0f, -0.7853982f, 0.0f); + (this.WING_B_B_2 = new ModelRenderer((ModelBase)this, 25, 26)).addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_B_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_B_2.setTextureSize(128, 128); + this.WING_B_B_2.mirror = true; + this.setRotation(this.WING_B_B_2, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_B_A_2 = new ModelRenderer((ModelBase)this, 25, 26)).addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_A_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_A_2.setTextureSize(128, 128); + this.WING_B_A_2.mirror = true; + this.setRotation(this.WING_B_A_2, -0.7853982f, 0.7853982f, 0.0f); + (this.CHEMICAL_CONTROL_MODULE = new ModelRenderer((ModelBase)this, 0, 86)).addBox(-4.0f, 0.0f, -4.0f, 8, 8, 8); + this.CHEMICAL_CONTROL_MODULE.setRotationPoint(0.0f, -4.0f, 0.0f); + this.CHEMICAL_CONTROL_MODULE.setTextureSize(128, 128); + this.CHEMICAL_CONTROL_MODULE.mirror = true; + this.setRotation(this.CHEMICAL_CONTROL_MODULE, 0.0f, 0.0f, 0.0f); + (this.CHEMICAL_CONDUCT = new ModelRenderer((ModelBase)this, 34, 86)).addBox(0.0f, 0.0f, 0.0f, 1, 24, 1); + this.CHEMICAL_CONDUCT.setRotationPoint(0.0f, -28.0f, -4.0f); + this.CHEMICAL_CONDUCT.setTextureSize(128, 128); + this.CHEMICAL_CONDUCT.mirror = true; + this.setRotation(this.CHEMICAL_CONDUCT, 0.0f, 0.0f, 0.0f); + (this.CHEM_WARHEAD_1 = new ModelRenderer((ModelBase)this, 0, 103)).addBox(-4.0f, 0.0f, -4.0f, 8, 5, 8); + this.CHEM_WARHEAD_1.setRotationPoint(0.0f, -31.0f, 0.0f); + this.CHEM_WARHEAD_1.setTextureSize(128, 128); + this.CHEM_WARHEAD_1.mirror = true; + this.setRotation(this.CHEM_WARHEAD_1, 0.0f, 0.7853982f, 0.0f); + (this.CHEM_WARHEAD_2 = new ModelRenderer((ModelBase)this, 40, 86)).addBox(-3.0f, 0.0f, -3.0f, 6, 5, 6); + this.CHEM_WARHEAD_2.setRotationPoint(0.0f, -36.0f, 0.0f); + this.CHEM_WARHEAD_2.setTextureSize(128, 128); + this.CHEM_WARHEAD_2.mirror = true; + this.setRotation(this.CHEM_WARHEAD_2, 0.0f, 0.7853982f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MISSILE_MODULE.render(f5); + this.MOTOR_MODULE.render(f5); + this.WING_B_A_1.render(f5); + this.WING_B_B_1.render(f5); + this.WING_T_B_1.render(f5); + this.WING_T_A_1.render(f5); + this.WING_T_B_2.render(f5); + this.WING_T_A_2.render(f5); + this.WING_B_B_2.render(f5); + this.WING_B_A_2.render(f5); + this.CHEMICAL_CONTROL_MODULE.render(f5); + this.CHEMICAL_CONDUCT.render(f5); + this.CHEM_WARHEAD_1.render(f5); + this.CHEM_WARHEAD_2.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMFanDan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMFanDan.java new file mode 100644 index 0000000..ec227d1 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMFanDan.java @@ -0,0 +1,260 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMFanDan extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2a; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape3d; + ModelRenderer Shape3; + ModelRenderer Shape3a; + ModelRenderer Shape3b; + ModelRenderer Shape4; + ModelRenderer Shape4a; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape5; + ModelRenderer Shape5a; + ModelRenderer Shape4d; + ModelRenderer Shape4e; + ModelRenderer Shape4f; + ModelRenderer Shape4g; + ModelRenderer Shape6; + ModelRenderer Shape6a; + ModelRenderer Shape7a; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape8a; + ModelRenderer Shape8b; + ModelRenderer Shape8c; + ModelRenderer Shape8d; + + public MMFanDan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.Shape1.setRotationPoint(0.0f, -40.0f, 0.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape2a = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2a.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Shape2a.setTextureSize(128, 128); + this.Shape2a.mirror = true; + this.setRotation(this.Shape2a, 0.0f, 0.0f, 0.0f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2b.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.0f, 0.0f, 0.0f); + (this.Shape2c = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2c.setRotationPoint(6.0f, 14.0f, -6.0f); + this.Shape2c.setTextureSize(128, 128); + this.Shape2c.mirror = true; + this.setRotation(this.Shape2c, 0.0f, 0.0f, 0.0f); + (this.Shape3d = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3d.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3d.setTextureSize(128, 128); + this.Shape3d.mirror = true; + this.setRotation(this.Shape3d, 0.0f, 0.7853982f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, -0.7853982f, 0.0f); + (this.Shape3a = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3a.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3a.setTextureSize(128, 128); + this.Shape3a.mirror = true; + this.setRotation(this.Shape3a, 0.0f, 0.7853982f, 0.7853982f); + (this.Shape3b = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3b.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3b.setTextureSize(128, 128); + this.Shape3b.mirror = true; + this.setRotation(this.Shape3b, 0.0f, -0.7853982f, 0.7853982f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.Shape4.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, -0.5235988f, 0.0f, 0.0f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.Shape4a.setRotationPoint(4.0f, -23.0f, -1.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, 0.0f, 0.0f, 0.5235988f); + (this.Shape4b = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4b.setRotationPoint(0.0f, -35.0f, -4.0f); + this.Shape4b.setTextureSize(128, 128); + this.Shape4b.mirror = true; + this.setRotation(this.Shape4b, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4c = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.Shape4c.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.Shape4c.setTextureSize(128, 128); + this.Shape4c.mirror = true; + this.setRotation(this.Shape4c, 0.0f, 3.141593f, 0.5235988f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5a.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 1.570796f, 0.0f); + (this.Shape4d = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.Shape4d.setRotationPoint(0.0f, -23.0f, -4.0f); + this.Shape4d.setTextureSize(128, 128); + this.Shape4d.mirror = true; + this.setRotation(this.Shape4d, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4e = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4e.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Shape4e.setTextureSize(128, 128); + this.Shape4e.mirror = true; + this.setRotation(this.Shape4e, -0.5235988f, 0.0f, 0.0f); + (this.Shape4f = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.Shape4f.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.Shape4f.setTextureSize(128, 128); + this.Shape4f.mirror = true; + this.setRotation(this.Shape4f, 0.0f, 3.141593f, 0.5235988f); + (this.Shape4g = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.Shape4g.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape4g.setTextureSize(128, 128); + this.Shape4g.mirror = true; + this.setRotation(this.Shape4g, 0.0f, 0.0f, 0.5235988f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6a.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape7a = new ModelRenderer((ModelBase)this, 72, 29)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Shape7a.setRotationPoint(-4.0f, -45.0f, -4.0f); + this.Shape7a.setTextureSize(128, 128); + this.Shape7a.mirror = true; + this.setRotation(this.Shape7a, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 72, 43)) + .addBox(0.0f, 0.0f, 0.0f, 6, 2, 6); + this.Shape7.setRotationPoint(-3.0f, -47.0f, -3.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 63, 33)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 2); + this.Shape8.setRotationPoint(2.0f, -46.0f, -1.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, -0.7853982f); + (this.Shape8a = new ModelRenderer((ModelBase)this, 63, 33)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 2); + this.Shape8a.setRotationPoint(-5.0f, -46.0f, -1.0f); + this.Shape8a.setTextureSize(128, 128); + this.Shape8a.mirror = true; + this.setRotation(this.Shape8a, 0.0f, 0.0f, -0.7853982f); + (this.Shape8b = new ModelRenderer((ModelBase)this, 63, 33)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 2); + this.Shape8b.setRotationPoint(-1.0f, -46.0f, 2.0f); + this.Shape8b.setTextureSize(128, 128); + this.Shape8b.mirror = true; + this.setRotation(this.Shape8b, 0.7853982f, 0.0f, 0.0f); + (this.Shape8c = new ModelRenderer((ModelBase)this, 63, 33)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 2); + this.Shape8c.setRotationPoint(-1.0f, -46.0f, -5.0f); + this.Shape8c.setTextureSize(128, 128); + this.Shape8c.mirror = true; + this.setRotation(this.Shape8c, 0.7853982f, 0.0f, 0.0f); + (this.Shape8d = new ModelRenderer((ModelBase)this, 72, 53)) + .addBox(0.0f, 0.0f, 0.0f, 4, 2, 4); + this.Shape8d.setRotationPoint(-2.0f, -49.0f, -2.0f); + this.Shape8d.setTextureSize(128, 128); + this.Shape8d.mirror = true; + this.setRotation(this.Shape8d, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape2a.render(f5); + this.Shape2b.render(f5); + this.Shape2c.render(f5); + this.Shape3d.render(f5); + this.Shape3.render(f5); + this.Shape3a.render(f5); + this.Shape3b.render(f5); + this.Shape4.render(f5); + this.Shape4a.render(f5); + this.Shape4b.render(f5); + this.Shape4c.render(f5); + this.Shape5.render(f5); + this.Shape5a.render(f5); + this.Shape4d.render(f5); + this.Shape4e.render(f5); + this.Shape4f.render(f5); + this.Shape4g.render(f5); + this.Shape6.render(f5); + this.Shape6a.render(f5); + this.Shape7a.render(f5); + this.Shape7.render(f5); + this.Shape8.render(f5); + this.Shape8a.render(f5); + this.Shape8b.render(f5); + this.Shape8c.render(f5); + this.Shape8d.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMFanWuSu.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMFanWuSu.java new file mode 100644 index 0000000..c32cd3f --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMFanWuSu.java @@ -0,0 +1,260 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMFanWuSu extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape36; + ModelRenderer Shape4a; + ModelRenderer Shape5a; + ModelRenderer Shape6a; + ModelRenderer Shape6b; + ModelRenderer Shape6c; + ModelRenderer Shape6d; + ModelRenderer Shape6e; + ModelRenderer Shape6f; + ModelRenderer Shape6g; + ModelRenderer Shape6h; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10a; + ModelRenderer Shape10b; + ModelRenderer Shape10c; + ModelRenderer Shape10d; + ModelRenderer Shape11a; + ModelRenderer Shape11b; + ModelRenderer Shape2e; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + + public MMFanWuSu() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 27, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 10, 14); + this.Shape1.setRotationPoint(-8.0f, 14.0f, -2.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.7853982f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 27, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 10, 14); + this.Shape2.setRotationPoint(2.0f, 14.0f, -8.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, -0.7853982f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 36, 47)) + .addBox(0.0f, 0.0f, 0.0f, 21, 11, 2); + this.Shape3.setRotationPoint(-8.0f, 13.0f, 7.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.7853982f, 0.0f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 36, 47)) + .addBox(0.0f, 0.0f, 0.0f, 21, 11, 2); + this.Shape4.setRotationPoint(-7.0f, 13.0f, -8.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, 0.0f, -0.7853982f, 0.0f); + (this.Shape36 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 40, 6); + this.Shape36.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.Shape36.setTextureSize(128, 128); + this.Shape36.mirror = true; + this.setRotation(this.Shape36, 0.0f, 0.0f, 0.0f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 27, 25)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.Shape4a.setRotationPoint(-5.0f, 4.0f, -5.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, 0.0f, 0.0f, 0.0f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 72, 31)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Shape5a.setRotationPoint(-4.0f, -30.0f, -4.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 89, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 5, 1); + this.Shape6a.setRotationPoint(-1.0f, -35.0f, 3.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape6b = new ModelRenderer((ModelBase)this, 89, 8)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 2); + this.Shape6b.setRotationPoint(3.0f, -35.0f, -1.0f); + this.Shape6b.setTextureSize(128, 128); + this.Shape6b.mirror = true; + this.setRotation(this.Shape6b, 0.0f, 0.0f, 0.0f); + (this.Shape6c = new ModelRenderer((ModelBase)this, 89, 8)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 2); + this.Shape6c.setRotationPoint(-4.0f, -35.0f, -1.0f); + this.Shape6c.setTextureSize(128, 128); + this.Shape6c.mirror = true; + this.setRotation(this.Shape6c, 0.0f, 0.0f, 0.0f); + (this.Shape6d = new ModelRenderer((ModelBase)this, 89, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 5, 1); + this.Shape6d.setRotationPoint(-1.0f, -35.0f, -4.0f); + this.Shape6d.setTextureSize(128, 128); + this.Shape6d.mirror = true; + this.setRotation(this.Shape6d, 0.0f, 0.0f, 0.0f); + (this.Shape6e = new ModelRenderer((ModelBase)this, 103, 8)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 2); + this.Shape6e.setRotationPoint(-2.0f, -39.0f, -1.0f); + this.Shape6e.setTextureSize(128, 128); + this.Shape6e.mirror = true; + this.setRotation(this.Shape6e, 0.0f, 0.0f, 0.4014257f); + (this.Shape6f = new ModelRenderer((ModelBase)this, 103, 8)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 2); + this.Shape6f.setRotationPoint(1.0f, -39.0f, -1.0f); + this.Shape6f.setTextureSize(128, 128); + this.Shape6f.mirror = true; + this.setRotation(this.Shape6f, 0.0f, 0.0f, -0.4014257f); + (this.Shape6g = new ModelRenderer((ModelBase)this, 96, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 5, 1); + this.Shape6g.setRotationPoint(-1.0f, -39.0f, -2.0f); + this.Shape6g.setTextureSize(128, 128); + this.Shape6g.mirror = true; + this.setRotation(this.Shape6g, -0.4014257f, 0.0f, 0.0f); + (this.Shape6h = new ModelRenderer((ModelBase)this, 96, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 5, 1); + this.Shape6h.setRotationPoint(-1.0f, -39.0f, 1.0f); + this.Shape6h.setTextureSize(128, 128); + this.Shape6h.mirror = true; + this.setRotation(this.Shape6h, 0.4014257f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 110, 0)) + .addBox(0.0f, 0.0f, 0.0f, 4, 1, 4); + this.Shape7.setRotationPoint(-2.0f, -40.0f, -2.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 110, 19)) + .addBox(0.0f, 0.0f, 0.0f, 4, 5, 4); + this.Shape8.setRotationPoint(-2.0f, -35.0f, -2.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + (this.Shape9 = new ModelRenderer((ModelBase)this, 110, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 8, 2); + this.Shape9.setRotationPoint(-1.0f, -43.0f, -1.0f); + this.Shape9.setTextureSize(128, 128); + this.Shape9.mirror = true; + this.setRotation(this.Shape9, 0.0f, 0.0f, 0.0f); + (this.Shape10a = new ModelRenderer((ModelBase)this, 72, 8)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 2); + this.Shape10a.setRotationPoint(8.0f, -23.0f, 1.0f); + this.Shape10a.setTextureSize(128, 128); + this.Shape10a.mirror = true; + this.setRotation(this.Shape10a, 0.0f, -3.141593f, -0.7853982f); + (this.Shape10b = new ModelRenderer((ModelBase)this, 72, 17)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 6); + this.Shape10b.setRotationPoint(-1.0f, -23.0f, -8.0f); + this.Shape10b.setTextureSize(128, 128); + this.Shape10b.mirror = true; + this.setRotation(this.Shape10b, 0.7853982f, 0.0f, 0.0f); + (this.Shape10c = new ModelRenderer((ModelBase)this, 72, 8)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 2); + this.Shape10c.setRotationPoint(-8.0f, -23.0f, -1.0f); + this.Shape10c.setTextureSize(128, 128); + this.Shape10c.mirror = true; + this.setRotation(this.Shape10c, 0.0f, 0.0f, -0.7853982f); + (this.Shape10d = new ModelRenderer((ModelBase)this, 72, 8)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 2); + this.Shape10d.setRotationPoint(-1.0f, -23.0f, 8.0f); + this.Shape10d.setTextureSize(128, 128); + this.Shape10d.mirror = true; + this.setRotation(this.Shape10d, 0.0f, 1.570796f, -0.7853982f); + (this.Shape11a = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(0.0f, 0.0f, 0.0f, 16, 5, 2); + this.Shape11a.setRotationPoint(-8.0f, -23.0f, -1.0f); + this.Shape11a.setTextureSize(128, 128); + this.Shape11a.mirror = true; + this.setRotation(this.Shape11a, 0.0f, 0.0f, 0.0f); + (this.Shape11b = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(0.0f, 0.0f, 0.0f, 16, 5, 2); + this.Shape11b.setRotationPoint(-1.0f, -23.0f, 8.0f); + this.Shape11b.setTextureSize(128, 128); + this.Shape11b.mirror = true; + this.setRotation(this.Shape11b, 0.0f, 1.570796f, 0.0f); + (this.Shape2e = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 16, 10, 4); + this.Shape2e.setRotationPoint(-8.0f, 14.0f, -2.0f); + this.Shape2e.setTextureSize(128, 128); + this.Shape2e.mirror = true; + this.setRotation(this.Shape2e, 0.0f, 0.0f, 0.0f); + (this.Shape12 = new ModelRenderer((ModelBase)this, 0, 76)) + .addBox(0.0f, 0.0f, 0.0f, 4, 10, 16); + this.Shape12.setRotationPoint(-2.0f, 14.0f, -8.0f); + this.Shape12.setTextureSize(128, 128); + this.Shape12.mirror = true; + this.setRotation(this.Shape12, 0.0f, 0.0f, 0.0f); + (this.Shape13 = new ModelRenderer((ModelBase)this, 0, 47)) + .addBox(0.0f, 0.0f, 0.0f, 3, 14, 14); + this.Shape13.setRotationPoint(6.0f, 13.0f, -8.0f); + this.Shape13.setTextureSize(128, 128); + this.Shape13.mirror = true; + this.setRotation(this.Shape13, 0.7853982f, -0.7853982f, 0.0f); + (this.Shape14 = new ModelRenderer((ModelBase)this, 0, 47)) + .addBox(0.0f, 0.0f, 0.0f, 3, 14, 14); + this.Shape14.setRotationPoint(8.0f, 13.0f, 6.0f); + this.Shape14.setTextureSize(128, 128); + this.Shape14.mirror = true; + this.setRotation(this.Shape14, 0.7853982f, -2.356194f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape3.render(f5); + this.Shape4.render(f5); + this.Shape36.render(f5); + this.Shape4a.render(f5); + this.Shape5a.render(f5); + this.Shape6a.render(f5); + this.Shape6b.render(f5); + this.Shape6c.render(f5); + this.Shape6d.render(f5); + this.Shape6e.render(f5); + this.Shape6f.render(f5); + this.Shape6g.render(f5); + this.Shape6h.render(f5); + this.Shape7.render(f5); + this.Shape8.render(f5); + this.Shape9.render(f5); + this.Shape10a.render(f5); + this.Shape10b.render(f5); + this.Shape10c.render(f5); + this.Shape10d.render(f5); + this.Shape11a.render(f5); + this.Shape11b.render(f5); + this.Shape2e.render(f5); + this.Shape12.render(f5); + this.Shape13.render(f5); + this.Shape14.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMFenZiDan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMFenZiDan.java new file mode 100644 index 0000000..1e9f447 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMFenZiDan.java @@ -0,0 +1,284 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMFenZiDan extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2a; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape3a; + ModelRenderer Shape3; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape4; + ModelRenderer Shape4a; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape5a; + ModelRenderer Shape5; + ModelRenderer Shape4d; + ModelRenderer Shape4e; + ModelRenderer Shape4f; + ModelRenderer Shape4g; + ModelRenderer Shape6; + ModelRenderer Shape6a; + ModelRenderer Shape7; + ModelRenderer Shape7a; + ModelRenderer Shape7b; + ModelRenderer Shape7c; + ModelRenderer Shape7d; + ModelRenderer Shape7e; + ModelRenderer Shape7f; + ModelRenderer Shape7g; + ModelRenderer Shape8a; + ModelRenderer Shape8; + + public MMFenZiDan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.Shape1.setRotationPoint(0.0f, -40.0f, 0.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 62, 48)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape2a = new ModelRenderer((ModelBase)this, 62, 48)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2a.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Shape2a.setTextureSize(128, 128); + this.Shape2a.mirror = true; + this.setRotation(this.Shape2a, 0.0f, 0.0f, 0.0f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 34, 48)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2b.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.0f, 0.0f, 0.0f); + (this.Shape2c = new ModelRenderer((ModelBase)this, 34, 48)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2c.setRotationPoint(6.0f, 14.0f, -6.0f); + this.Shape2c.setTextureSize(128, 128); + this.Shape2c.mirror = true; + this.setRotation(this.Shape2c, 0.0f, 0.0f, 0.0f); + (this.Shape3a = new ModelRenderer((ModelBase)this, 34, 33)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3a.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3a.setTextureSize(128, 128); + this.Shape3a.mirror = true; + this.setRotation(this.Shape3a, 0.0f, 0.7853982f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 34, 33)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, -0.7853982f, 0.0f); + (this.Shape3b = new ModelRenderer((ModelBase)this, 34, 13)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3b.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3b.setTextureSize(128, 128); + this.Shape3b.mirror = true; + this.setRotation(this.Shape3b, 0.0f, 0.7853982f, 0.7853982f); + (this.Shape3c = new ModelRenderer((ModelBase)this, 34, 13)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3c.setTextureSize(128, 128); + this.Shape3c.mirror = true; + this.setRotation(this.Shape3c, 0.0f, -0.7853982f, 0.7853982f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 16, 114)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.Shape4.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, -0.5235988f, 0.0f, 0.0f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 0, 114)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.Shape4a.setRotationPoint(4.0f, -23.0f, -1.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, 0.0f, 0.0f, 0.5235988f); + (this.Shape4b = new ModelRenderer((ModelBase)this, 15, 104)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4b.setRotationPoint(0.0f, -35.0f, -4.0f); + this.Shape4b.setTextureSize(128, 128); + this.Shape4b.mirror = true; + this.setRotation(this.Shape4b, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4c = new ModelRenderer((ModelBase)this, 0, 114)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.Shape4c.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.Shape4c.setTextureSize(128, 128); + this.Shape4c.mirror = true; + this.setRotation(this.Shape4c, 0.0f, 3.141593f, 0.5235988f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5a.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 0.0f, 0.0f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 1.570796f, 0.0f); + (this.Shape4d = new ModelRenderer((ModelBase)this, 16, 114)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.Shape4d.setRotationPoint(0.0f, -23.0f, -4.0f); + this.Shape4d.setTextureSize(128, 128); + this.Shape4d.mirror = true; + this.setRotation(this.Shape4d, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4e = new ModelRenderer((ModelBase)this, 15, 104)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4e.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Shape4e.setTextureSize(128, 128); + this.Shape4e.mirror = true; + this.setRotation(this.Shape4e, -0.5235988f, 0.0f, 0.0f); + (this.Shape4f = new ModelRenderer((ModelBase)this, 0, 104)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.Shape4f.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.Shape4f.setTextureSize(128, 128); + this.Shape4f.mirror = true; + this.setRotation(this.Shape4f, 0.0f, 3.141593f, 0.5235988f); + (this.Shape4g = new ModelRenderer((ModelBase)this, 0, 104)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.Shape4g.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape4g.setTextureSize(128, 128); + this.Shape4g.mirror = true; + this.setRotation(this.Shape4g, 0.0f, 0.0f, 0.5235988f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6a.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 39, 74)) + .addBox(0.0f, 0.0f, 0.0f, 6, 22, 6); + this.Shape7.setRotationPoint(-3.0f, 2.0f, 4.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape7a = new ModelRenderer((ModelBase)this, 65, 74)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 4); + this.Shape7a.setRotationPoint(-2.0f, -2.0f, 5.0f); + this.Shape7a.setTextureSize(128, 128); + this.Shape7a.mirror = true; + this.setRotation(this.Shape7a, 0.0f, 0.0f, 0.0f); + (this.Shape7b = new ModelRenderer((ModelBase)this, 65, 74)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 4); + this.Shape7b.setRotationPoint(-2.0f, -2.0f, -9.0f); + this.Shape7b.setTextureSize(128, 128); + this.Shape7b.mirror = true; + this.setRotation(this.Shape7b, 0.0f, 0.0f, 0.0f); + (this.Shape7c = new ModelRenderer((ModelBase)this, 39, 74)) + .addBox(0.0f, 0.0f, 0.0f, 6, 22, 6); + this.Shape7c.setRotationPoint(-3.0f, 2.0f, -10.0f); + this.Shape7c.setTextureSize(128, 128); + this.Shape7c.mirror = true; + this.setRotation(this.Shape7c, 0.0f, 0.0f, 0.0f); + (this.Shape7d = new ModelRenderer((ModelBase)this, 65, 74)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 4); + this.Shape7d.setRotationPoint(-9.0f, -2.0f, -2.0f); + this.Shape7d.setTextureSize(128, 128); + this.Shape7d.mirror = true; + this.setRotation(this.Shape7d, 0.0f, 0.0f, 0.0f); + (this.Shape7e = new ModelRenderer((ModelBase)this, 39, 74)) + .addBox(0.0f, 0.0f, 0.0f, 6, 22, 6); + this.Shape7e.setRotationPoint(-10.0f, 2.0f, -3.0f); + this.Shape7e.setTextureSize(128, 128); + this.Shape7e.mirror = true; + this.setRotation(this.Shape7e, 0.0f, 0.0f, 0.0f); + (this.Shape7f = new ModelRenderer((ModelBase)this, 65, 74)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 4); + this.Shape7f.setRotationPoint(5.0f, -2.0f, -2.0f); + this.Shape7f.setTextureSize(128, 128); + this.Shape7f.mirror = true; + this.setRotation(this.Shape7f, 0.0f, 0.0f, 0.0f); + (this.Shape7g = new ModelRenderer((ModelBase)this, 39, 74)) + .addBox(0.0f, 0.0f, 0.0f, 6, 22, 6); + this.Shape7g.setRotationPoint(4.0f, 2.0f, -3.0f); + this.Shape7g.setTextureSize(128, 128); + this.Shape7g.mirror = true; + this.setRotation(this.Shape7g, 0.0f, 0.0f, 0.0f); + (this.Shape8a = new ModelRenderer((ModelBase)this, 78, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 5, 8); + this.Shape8a.setRotationPoint(-4.0f, -46.0f, -4.0f); + this.Shape8a.setTextureSize(128, 128); + this.Shape8a.mirror = true; + this.setRotation(this.Shape8a, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 78, 15)) + .addBox(0.0f, 0.0f, 0.0f, 6, 2, 6); + this.Shape8.setRotationPoint(-3.0f, -48.0f, -3.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape2a.render(f5); + this.Shape2b.render(f5); + this.Shape2c.render(f5); + this.Shape3a.render(f5); + this.Shape3.render(f5); + this.Shape3b.render(f5); + this.Shape3c.render(f5); + this.Shape4.render(f5); + this.Shape4a.render(f5); + this.Shape4b.render(f5); + this.Shape4c.render(f5); + this.Shape5a.render(f5); + this.Shape5.render(f5); + this.Shape4d.render(f5); + this.Shape4e.render(f5); + this.Shape4f.render(f5); + this.Shape4g.render(f5); + this.Shape6.render(f5); + this.Shape6a.render(f5); + this.Shape7.render(f5); + this.Shape7a.render(f5); + this.Shape7b.render(f5); + this.Shape7c.render(f5); + this.Shape7d.render(f5); + this.Shape7e.render(f5); + this.Shape7f.render(f5); + this.Shape7g.render(f5); + this.Shape8a.render(f5); + this.Shape8.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMGanRanDu.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMGanRanDu.java new file mode 100644 index 0000000..7b84958 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMGanRanDu.java @@ -0,0 +1,276 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMGanRanDu extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2a; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape3a; + ModelRenderer Shape3; + ModelRenderer Shape3c; + ModelRenderer Shape3b; + ModelRenderer Shape4a; + ModelRenderer Shape4; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape5; + ModelRenderer Shape5a; + ModelRenderer Shape4g; + ModelRenderer Shape4e; + ModelRenderer Shape4f; + ModelRenderer Shape4h; + ModelRenderer Shape6a; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape7a; + ModelRenderer Shape7b; + ModelRenderer Shape8; + ModelRenderer Shape8a; + ModelRenderer Shape8b; + ModelRenderer Shape8c; + ModelRenderer Shape8d; + ModelRenderer Shape8e; + + public MMGanRanDu() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.Shape1.setRotationPoint(0.0f, -40.0f, 0.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape2a = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2a.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Shape2a.setTextureSize(128, 128); + this.Shape2a.mirror = true; + this.setRotation(this.Shape2a, 0.0f, 0.0f, 0.0f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2b.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.0f, 0.0f, 0.0f); + (this.Shape2c = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2c.setRotationPoint(6.0f, 14.0f, -6.0f); + this.Shape2c.setTextureSize(128, 128); + this.Shape2c.mirror = true; + this.setRotation(this.Shape2c, 0.0f, 0.0f, 0.0f); + (this.Shape3a = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3a.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3a.setTextureSize(128, 128); + this.Shape3a.mirror = true; + this.setRotation(this.Shape3a, 0.0f, 0.7853982f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, -0.7853982f, 0.0f); + (this.Shape3c = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3c.setTextureSize(128, 128); + this.Shape3c.mirror = true; + this.setRotation(this.Shape3c, 0.0f, 0.7853982f, 0.7853982f); + (this.Shape3b = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3b.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3b.setTextureSize(128, 128); + this.Shape3b.mirror = true; + this.setRotation(this.Shape3b, 0.0f, -0.7853982f, 0.7853982f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.Shape4a.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, -0.5235988f, 0.0f, 0.0f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.Shape4.setRotationPoint(4.0f, -23.0f, -1.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, 0.0f, 0.0f, 0.5235988f); + (this.Shape4b = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4b.setRotationPoint(0.0f, -35.0f, -4.0f); + this.Shape4b.setTextureSize(128, 128); + this.Shape4b.mirror = true; + this.setRotation(this.Shape4b, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4c = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.Shape4c.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.Shape4c.setTextureSize(128, 128); + this.Shape4c.mirror = true; + this.setRotation(this.Shape4c, 0.0f, 3.141593f, 0.5235988f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5a.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 1.570796f, 0.0f); + (this.Shape4g = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.Shape4g.setRotationPoint(0.0f, -23.0f, -4.0f); + this.Shape4g.setTextureSize(128, 128); + this.Shape4g.mirror = true; + this.setRotation(this.Shape4g, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4e = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4e.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Shape4e.setTextureSize(128, 128); + this.Shape4e.mirror = true; + this.setRotation(this.Shape4e, -0.5235988f, 0.0f, 0.0f); + (this.Shape4f = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.Shape4f.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.Shape4f.setTextureSize(128, 128); + this.Shape4f.mirror = true; + this.setRotation(this.Shape4f, 0.0f, 3.141593f, 0.5235988f); + (this.Shape4h = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.Shape4h.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape4h.setTextureSize(128, 128); + this.Shape4h.mirror = true; + this.setRotation(this.Shape4h, 0.0f, 0.0f, 0.5235988f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6a.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 61, 31)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Shape7.setRotationPoint(-4.0f, -45.0f, -4.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape7a = new ModelRenderer((ModelBase)this, 61, 47)) + .addBox(0.0f, 0.0f, 0.0f, 6, 4, 6); + this.Shape7a.setRotationPoint(-3.0f, -49.0f, -3.0f); + this.Shape7a.setTextureSize(128, 128); + this.Shape7a.mirror = true; + this.setRotation(this.Shape7a, 0.0f, 0.0f, 0.0f); + (this.Shape7b = new ModelRenderer((ModelBase)this, 61, 61)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 4); + this.Shape7b.setRotationPoint(-2.0f, -53.0f, -2.0f); + this.Shape7b.setTextureSize(128, 128); + this.Shape7b.mirror = true; + this.setRotation(this.Shape7b, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 95, 31)) + .addBox(-1.0f, -1.0f, -6.0f, 2, 2, 12); + this.Shape8.setRotationPoint(0.0f, -43.0f, 0.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + (this.Shape8a = new ModelRenderer((ModelBase)this, 95, 31)) + .addBox(-1.0f, -1.0f, -6.0f, 2, 2, 12); + this.Shape8a.setRotationPoint(0.0f, -43.0f, 0.0f); + this.Shape8a.setTextureSize(128, 128); + this.Shape8a.mirror = true; + this.setRotation(this.Shape8a, 0.0f, 1.570796f, 0.0f); + (this.Shape8b = new ModelRenderer((ModelBase)this, 87, 47)) + .addBox(-1.0f, -1.0f, -5.0f, 2, 2, 10); + this.Shape8b.setRotationPoint(0.0f, -47.0f, 0.0f); + this.Shape8b.setTextureSize(128, 128); + this.Shape8b.mirror = true; + this.setRotation(this.Shape8b, 0.0f, 0.0f, 0.0f); + (this.Shape8c = new ModelRenderer((ModelBase)this, 87, 47)) + .addBox(-1.0f, -1.0f, -5.0f, 2, 2, 10); + this.Shape8c.setRotationPoint(0.0f, -47.0f, 0.0f); + this.Shape8c.setTextureSize(128, 128); + this.Shape8c.mirror = true; + this.setRotation(this.Shape8c, 0.0f, 1.570796f, 0.0f); + (this.Shape8d = new ModelRenderer((ModelBase)this, 79, 61)) + .addBox(-1.0f, -1.0f, -4.0f, 2, 2, 8); + this.Shape8d.setRotationPoint(0.0f, -51.0f, 0.0f); + this.Shape8d.setTextureSize(128, 128); + this.Shape8d.mirror = true; + this.setRotation(this.Shape8d, 0.0f, 0.0f, 0.0f); + (this.Shape8e = new ModelRenderer((ModelBase)this, 79, 61)) + .addBox(-1.0f, -1.0f, -4.0f, 2, 2, 8); + this.Shape8e.setRotationPoint(0.0f, -51.0f, 0.0f); + this.Shape8e.setTextureSize(128, 128); + this.Shape8e.mirror = true; + this.setRotation(this.Shape8e, 0.0f, 1.570796f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape2a.render(f5); + this.Shape2b.render(f5); + this.Shape2c.render(f5); + this.Shape3a.render(f5); + this.Shape3.render(f5); + this.Shape3c.render(f5); + this.Shape3b.render(f5); + this.Shape4a.render(f5); + this.Shape4.render(f5); + this.Shape4b.render(f5); + this.Shape4c.render(f5); + this.Shape5.render(f5); + this.Shape5a.render(f5); + this.Shape4g.render(f5); + this.Shape4e.render(f5); + this.Shape4f.render(f5); + this.Shape4h.render(f5); + this.Shape6a.render(f5); + this.Shape6.render(f5); + this.Shape7.render(f5); + this.Shape7a.render(f5); + this.Shape7b.render(f5); + this.Shape8.render(f5); + this.Shape8a.render(f5); + this.Shape8b.render(f5); + this.Shape8c.render(f5); + this.Shape8d.render(f5); + this.Shape8e.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMHongSu.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMHongSu.java new file mode 100644 index 0000000..57ede59 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMHongSu.java @@ -0,0 +1,260 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMHongSu extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape1a; + ModelRenderer Shape2; + ModelRenderer Shape2a; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape6a; + ModelRenderer Shape6b; + ModelRenderer Shape6c; + ModelRenderer Shape6d; + ModelRenderer Shape6e; + ModelRenderer Shape6f; + ModelRenderer Shape6g; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape10a; + ModelRenderer Shape10b; + ModelRenderer Shape10c; + ModelRenderer Shape11d; + ModelRenderer Shape11e; + ModelRenderer Shape2z; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + + public MMHongSu() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 27, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 10, 14); + this.Shape1.setRotationPoint(-8.0f, 14.0f, -2.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.7853982f, 0.0f); + (this.Shape1a = new ModelRenderer((ModelBase)this, 27, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 10, 14); + this.Shape1a.setRotationPoint(2.0f, 14.0f, -8.0f); + this.Shape1a.setTextureSize(128, 128); + this.Shape1a.mirror = true; + this.setRotation(this.Shape1a, 0.0f, -0.7853982f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 36, 47)) + .addBox(0.0f, 0.0f, 0.0f, 21, 11, 2); + this.Shape2.setRotationPoint(-8.0f, 13.0f, 7.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.7853982f, 0.0f); + (this.Shape2a = new ModelRenderer((ModelBase)this, 36, 47)) + .addBox(0.0f, 0.0f, 0.0f, 21, 11, 2); + this.Shape2a.setRotationPoint(-7.0f, 13.0f, -8.0f); + this.Shape2a.setTextureSize(128, 128); + this.Shape2a.mirror = true; + this.setRotation(this.Shape2a, 0.0f, -0.7853982f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 40, 6); + this.Shape3.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.0f, 0.0f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 27, 25)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.Shape4.setRotationPoint(-5.0f, 4.0f, -5.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, 0.0f, 0.0f, 0.0f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 72, 31)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Shape5.setRotationPoint(-4.0f, -30.0f, -4.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 89, 17)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape6.setRotationPoint(-1.0f, -35.0f, 4.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 89, 17)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape6a.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape6b = new ModelRenderer((ModelBase)this, 89, 17)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape6b.setRotationPoint(-6.0f, -35.0f, -1.0f); + this.Shape6b.setTextureSize(128, 128); + this.Shape6b.mirror = true; + this.setRotation(this.Shape6b, 0.0f, 0.0f, 0.0f); + (this.Shape6c = new ModelRenderer((ModelBase)this, 89, 17)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Shape6c.setRotationPoint(-1.0f, -35.0f, -6.0f); + this.Shape6c.setTextureSize(128, 128); + this.Shape6c.mirror = true; + this.setRotation(this.Shape6c, 0.0f, 0.0f, 0.0f); + (this.Shape6d = new ModelRenderer((ModelBase)this, 103, 8)) + .addBox(0.0f, 0.0f, 0.0f, 1, 6, 2); + this.Shape6d.setRotationPoint(-2.0f, -39.0f, -1.0f); + this.Shape6d.setTextureSize(128, 128); + this.Shape6d.mirror = true; + this.setRotation(this.Shape6d, 0.0f, 0.0f, 0.6108652f); + (this.Shape6e = new ModelRenderer((ModelBase)this, 103, 8)) + .addBox(0.0f, 0.0f, 0.0f, 1, 6, 2); + this.Shape6e.setRotationPoint(1.0f, -39.0f, -1.0f); + this.Shape6e.setTextureSize(128, 128); + this.Shape6e.mirror = true; + this.setRotation(this.Shape6e, 0.0f, 0.0f, -0.6108652f); + (this.Shape6f = new ModelRenderer((ModelBase)this, 96, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 1); + this.Shape6f.setRotationPoint(-1.0f, -39.0f, -2.0f); + this.Shape6f.setTextureSize(128, 128); + this.Shape6f.mirror = true; + this.setRotation(this.Shape6f, -0.6108652f, 0.0f, 0.0f); + (this.Shape6g = new ModelRenderer((ModelBase)this, 96, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 1); + this.Shape6g.setRotationPoint(-1.0f, -39.0f, 1.0f); + this.Shape6g.setTextureSize(128, 128); + this.Shape6g.mirror = true; + this.setRotation(this.Shape6g, 0.6108652f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 110, 0)) + .addBox(0.0f, 0.0f, 0.0f, 4, 2, 4); + this.Shape7.setRotationPoint(-2.0f, -40.0f, -2.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 84, 46)) + .addBox(0.0f, 0.0f, 0.0f, 10, 5, 10); + this.Shape8.setRotationPoint(-5.0f, -34.0f, -5.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + (this.Shape9 = new ModelRenderer((ModelBase)this, 110, 8)) + .addBox(0.0f, 0.0f, 0.0f, 2, 8, 2); + this.Shape9.setRotationPoint(-1.0f, -42.0f, -1.0f); + this.Shape9.setTextureSize(128, 128); + this.Shape9.mirror = true; + this.setRotation(this.Shape9, 0.0f, 0.0f, 0.0f); + (this.Shape10 = new ModelRenderer((ModelBase)this, 72, 8)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 2); + this.Shape10.setRotationPoint(8.0f, -23.0f, 1.0f); + this.Shape10.setTextureSize(128, 128); + this.Shape10.mirror = false; + this.setRotation(this.Shape10, 0.0f, -3.141593f, -0.7853982f); + (this.Shape10a = new ModelRenderer((ModelBase)this, 72, 17)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 6); + this.Shape10a.setRotationPoint(-1.0f, -23.0f, -8.0f); + this.Shape10a.setTextureSize(128, 128); + this.Shape10a.mirror = false; + this.setRotation(this.Shape10a, 0.7853982f, 0.0f, 0.0f); + (this.Shape10b = new ModelRenderer((ModelBase)this, 72, 8)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 2); + this.Shape10b.setRotationPoint(-8.0f, -23.0f, -1.0f); + this.Shape10b.setTextureSize(128, 128); + this.Shape10b.mirror = false; + this.setRotation(this.Shape10b, 0.0f, 0.0f, -0.7853982f); + (this.Shape10c = new ModelRenderer((ModelBase)this, 72, 8)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 2); + this.Shape10c.setRotationPoint(-1.0f, -23.0f, 8.0f); + this.Shape10c.setTextureSize(128, 128); + this.Shape10c.mirror = false; + this.setRotation(this.Shape10c, 0.0f, 1.570796f, -0.7853982f); + (this.Shape11d = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(0.0f, 0.0f, 0.0f, 16, 5, 2); + this.Shape11d.setRotationPoint(-8.0f, -23.0f, -1.0f); + this.Shape11d.setTextureSize(128, 128); + this.Shape11d.mirror = true; + this.setRotation(this.Shape11d, 0.0f, 0.0f, 0.0f); + (this.Shape11e = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(0.0f, 0.0f, 0.0f, 16, 5, 2); + this.Shape11e.setRotationPoint(-1.0f, -23.0f, 8.0f); + this.Shape11e.setTextureSize(128, 128); + this.Shape11e.mirror = true; + this.setRotation(this.Shape11e, 0.0f, 1.570796f, 0.0f); + (this.Shape2z = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 16, 10, 4); + this.Shape2z.setRotationPoint(-8.0f, 14.0f, -2.0f); + this.Shape2z.setTextureSize(128, 128); + this.Shape2z.mirror = true; + this.setRotation(this.Shape2z, 0.0f, 0.0f, 0.0f); + (this.Shape12 = new ModelRenderer((ModelBase)this, 0, 76)) + .addBox(0.0f, 0.0f, 0.0f, 4, 10, 16); + this.Shape12.setRotationPoint(-2.0f, 14.0f, -8.0f); + this.Shape12.setTextureSize(128, 128); + this.Shape12.mirror = true; + this.setRotation(this.Shape12, 0.0f, 0.0f, 0.0f); + (this.Shape13 = new ModelRenderer((ModelBase)this, 0, 47)) + .addBox(0.0f, 0.0f, 0.0f, 3, 14, 14); + this.Shape13.setRotationPoint(6.0f, 13.0f, -8.0f); + this.Shape13.setTextureSize(128, 128); + this.Shape13.mirror = true; + this.setRotation(this.Shape13, 0.7853982f, -0.7853982f, 0.0f); + (this.Shape14 = new ModelRenderer((ModelBase)this, 0, 47)) + .addBox(0.0f, 0.0f, 0.0f, 3, 14, 14); + this.Shape14.setRotationPoint(8.0f, 13.0f, 6.0f); + this.Shape14.setTextureSize(128, 128); + this.Shape14.mirror = true; + this.setRotation(this.Shape14, 0.7853982f, -2.356194f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape1a.render(f5); + this.Shape2.render(f5); + this.Shape2a.render(f5); + this.Shape3.render(f5); + this.Shape4.render(f5); + this.Shape5.render(f5); + this.Shape6.render(f5); + this.Shape6a.render(f5); + this.Shape6b.render(f5); + this.Shape6c.render(f5); + this.Shape6d.render(f5); + this.Shape6e.render(f5); + this.Shape6f.render(f5); + this.Shape6g.render(f5); + this.Shape7.render(f5); + this.Shape8.render(f5); + this.Shape9.render(f5); + this.Shape10.render(f5); + this.Shape10a.render(f5); + this.Shape10b.render(f5); + this.Shape10c.render(f5); + this.Shape11d.render(f5); + this.Shape11e.render(f5); + this.Shape2z.render(f5); + this.Shape12.render(f5); + this.Shape13.render(f5); + this.Shape14.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMHuanYuan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMHuanYuan.java new file mode 100644 index 0000000..95c2016 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMHuanYuan.java @@ -0,0 +1,284 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMHuanYuan extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer WING_B1; + ModelRenderer WING_B2; + ModelRenderer WING_B3; + ModelRenderer WING_B4; + ModelRenderer WING_BA1; + ModelRenderer WING_BB1; + ModelRenderer WING_BA2; + ModelRenderer WING_BB2; + ModelRenderer WING_TA1; + ModelRenderer WING_TB1; + ModelRenderer WING_TC3; + ModelRenderer WING_TD1; + ModelRenderer WING_TAC2; + ModelRenderer WING_TBD2; + ModelRenderer WING_TC1; + ModelRenderer WING_TA3; + ModelRenderer WING_TD3; + ModelRenderer WING_TB3; + ModelRenderer T_SUPPORT_1; + ModelRenderer T_SUPPORT_2; + ModelRenderer WARHEAD_SUPPORT_A1; + ModelRenderer WARHEAD_SUPPORT_B1; + ModelRenderer WARHEAD_SUPPORT_C1; + ModelRenderer WRHEAD_SUPPORT_D1; + ModelRenderer WARHEAD_SUPPORT_A2; + ModelRenderer WARHEAD_SUPPORT_C2; + ModelRenderer WARHEAD_SUPPORT_D2; + ModelRenderer WARHEAD_SUPPORT_B2; + ModelRenderer Shape8; + ModelRenderer Shape9; + + public MMHuanYuan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.MAIN_MODULE.setRotationPoint(0.0f, -40.0f, 0.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.WING_B1 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.WING_B1.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.WING_B1.setTextureSize(128, 128); + this.WING_B1.mirror = true; + this.setRotation(this.WING_B1, 0.0f, 0.0f, 0.0f); + (this.WING_B2 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.WING_B2.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.WING_B2.setTextureSize(128, 128); + this.WING_B2.mirror = true; + this.setRotation(this.WING_B2, 0.0f, 0.0f, 0.0f); + (this.WING_B3 = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.WING_B3.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.WING_B3.setTextureSize(128, 128); + this.WING_B3.mirror = true; + this.setRotation(this.WING_B3, 0.0f, 0.0f, 0.0f); + (this.WING_B4 = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.WING_B4.setRotationPoint(6.0f, 14.0f, -6.0f); + this.WING_B4.setTextureSize(128, 128); + this.WING_B4.mirror = true; + this.setRotation(this.WING_B4, 0.0f, 0.0f, 0.0f); + (this.WING_BA1 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.WING_BA1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_BA1.setTextureSize(128, 128); + this.WING_BA1.mirror = true; + this.setRotation(this.WING_BA1, 0.0f, 0.7853982f, 0.0f); + (this.WING_BB1 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.WING_BB1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_BB1.setTextureSize(128, 128); + this.WING_BB1.mirror = true; + this.setRotation(this.WING_BB1, 0.0f, -0.7853982f, 0.0f); + (this.WING_BA2 = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.WING_BA2.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_BA2.setTextureSize(128, 128); + this.WING_BA2.mirror = true; + this.setRotation(this.WING_BA2, 0.0f, 0.7853982f, 0.7853982f); + (this.WING_BB2 = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.WING_BB2.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_BB2.setTextureSize(128, 128); + this.WING_BB2.mirror = true; + this.setRotation(this.WING_BB2, 0.0f, -0.7853982f, 0.7853982f); + (this.WING_TA1 = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.WING_TA1.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.WING_TA1.setTextureSize(128, 128); + this.WING_TA1.mirror = true; + this.setRotation(this.WING_TA1, -0.5235988f, 0.0f, 0.0f); + (this.WING_TB1 = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.WING_TB1.setRotationPoint(4.0f, -23.0f, -1.0f); + this.WING_TB1.setTextureSize(128, 128); + this.WING_TB1.mirror = true; + this.setRotation(this.WING_TB1, 0.0f, 0.0f, 0.5235988f); + (this.WING_TC3 = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.WING_TC3.setRotationPoint(0.0f, -35.0f, -4.0f); + this.WING_TC3.setTextureSize(128, 128); + this.WING_TC3.mirror = true; + this.setRotation(this.WING_TC3, -0.5235988f, 3.141593f, 0.0f); + (this.WING_TD1 = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.WING_TD1.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.WING_TD1.setTextureSize(128, 128); + this.WING_TD1.mirror = true; + this.setRotation(this.WING_TD1, 0.0f, 3.141593f, 0.5235988f); + (this.WING_TAC2 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.WING_TAC2.setRotationPoint(0.0f, -32.0f, 0.0f); + this.WING_TAC2.setTextureSize(128, 128); + this.WING_TAC2.mirror = true; + this.setRotation(this.WING_TAC2, 0.0f, 0.0f, 0.0f); + (this.WING_TBD2 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.WING_TBD2.setRotationPoint(0.0f, -32.0f, 0.0f); + this.WING_TBD2.setTextureSize(128, 128); + this.WING_TBD2.mirror = true; + this.setRotation(this.WING_TBD2, 0.0f, 1.570796f, 0.0f); + (this.WING_TC1 = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.WING_TC1.setRotationPoint(0.0f, -23.0f, -4.0f); + this.WING_TC1.setTextureSize(128, 128); + this.WING_TC1.mirror = true; + this.setRotation(this.WING_TC1, -0.5235988f, 3.141593f, 0.0f); + (this.WING_TA3 = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.WING_TA3.setRotationPoint(0.0f, -35.0f, 4.0f); + this.WING_TA3.setTextureSize(128, 128); + this.WING_TA3.mirror = true; + this.setRotation(this.WING_TA3, -0.5235988f, 0.0f, 0.0f); + (this.WING_TD3 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.WING_TD3.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.WING_TD3.setTextureSize(128, 128); + this.WING_TD3.mirror = true; + this.setRotation(this.WING_TD3, 0.0f, 3.141593f, 0.5235988f); + (this.WING_TB3 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.WING_TB3.setRotationPoint(4.0f, -35.0f, -1.0f); + this.WING_TB3.setTextureSize(128, 128); + this.WING_TB3.mirror = true; + this.setRotation(this.WING_TB3, 0.0f, 0.0f, 0.5235988f); + (this.T_SUPPORT_1 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.T_SUPPORT_1.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.T_SUPPORT_1.setTextureSize(128, 128); + this.T_SUPPORT_1.mirror = true; + this.setRotation(this.T_SUPPORT_1, 0.0f, 0.0f, 0.0f); + (this.T_SUPPORT_2 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.T_SUPPORT_2.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.T_SUPPORT_2.setTextureSize(128, 128); + this.T_SUPPORT_2.mirror = true; + this.setRotation(this.T_SUPPORT_2, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_SUPPORT_A1 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_A1.setRotationPoint(-5.0f, -47.0f, -1.0f); + this.WARHEAD_SUPPORT_A1.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_A1.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_A1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_SUPPORT_B1 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_B1.setRotationPoint(-1.0f, -47.0f, 3.0f); + this.WARHEAD_SUPPORT_B1.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_B1.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_B1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_SUPPORT_C1 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_C1.setRotationPoint(3.0f, -47.0f, -1.0f); + this.WARHEAD_SUPPORT_C1.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_C1.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_C1, 0.0f, 0.0f, 0.0f); + (this.WRHEAD_SUPPORT_D1 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.WRHEAD_SUPPORT_D1.setRotationPoint(-1.0f, -47.0f, -5.0f); + this.WRHEAD_SUPPORT_D1.setTextureSize(128, 128); + this.WRHEAD_SUPPORT_D1.mirror = true; + this.setRotation(this.WRHEAD_SUPPORT_D1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_SUPPORT_A2 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, -6.0f, 0.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_A2.setRotationPoint(-5.0f, -47.0f, -1.0f); + this.WARHEAD_SUPPORT_A2.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_A2.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_A2, 0.0f, 0.0f, 0.5235988f); + (this.WARHEAD_SUPPORT_C2 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(-2.0f, -6.0f, 0.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_C2.setRotationPoint(5.0f, -47.0f, -1.0f); + this.WARHEAD_SUPPORT_C2.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_C2.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_C2, 0.0f, 0.0f, -0.5235988f); + (this.WARHEAD_SUPPORT_D2 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, -6.0f, 0.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_D2.setRotationPoint(-1.0f, -47.0f, -5.0f); + this.WARHEAD_SUPPORT_D2.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_D2.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_D2, -0.5235988f, 0.0f, 0.0f); + (this.WARHEAD_SUPPORT_B2 = new ModelRenderer((ModelBase)this, 90, 38)) + .addBox(0.0f, -6.0f, -2.0f, 2, 6, 2); + this.WARHEAD_SUPPORT_B2.setRotationPoint(-1.0f, -47.0f, 5.0f); + this.WARHEAD_SUPPORT_B2.setTextureSize(128, 128); + this.WARHEAD_SUPPORT_B2.mirror = true; + this.setRotation(this.WARHEAD_SUPPORT_B2, 0.5235988f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 72, 32)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 4, 4); + this.Shape8.setRotationPoint(0.0f, -45.0f, 0.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + (this.Shape9 = new ModelRenderer((ModelBase)this, 90, 32)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 2, 2); + this.Shape9.setRotationPoint(0.0f, -48.0f, 0.0f); + this.Shape9.setTextureSize(128, 128); + this.Shape9.mirror = true; + this.setRotation(this.Shape9, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.WING_B1.render(f5); + this.WING_B2.render(f5); + this.WING_B3.render(f5); + this.WING_B4.render(f5); + this.WING_BA1.render(f5); + this.WING_BB1.render(f5); + this.WING_BA2.render(f5); + this.WING_BB2.render(f5); + this.WING_TA1.render(f5); + this.WING_TB1.render(f5); + this.WING_TC3.render(f5); + this.WING_TD1.render(f5); + this.WING_TAC2.render(f5); + this.WING_TBD2.render(f5); + this.WING_TC1.render(f5); + this.WING_TA3.render(f5); + this.WING_TD3.render(f5); + this.WING_TB3.render(f5); + this.T_SUPPORT_1.render(f5); + this.T_SUPPORT_2.render(f5); + this.WARHEAD_SUPPORT_A1.render(f5); + this.WARHEAD_SUPPORT_B1.render(f5); + this.WARHEAD_SUPPORT_C1.render(f5); + this.WRHEAD_SUPPORT_D1.render(f5); + this.WARHEAD_SUPPORT_A2.render(f5); + this.WARHEAD_SUPPORT_C2.render(f5); + this.WARHEAD_SUPPORT_D2.render(f5); + this.WARHEAD_SUPPORT_B2.render(f5); + this.Shape8.render(f5); + this.Shape9.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMHuo.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMHuo.java new file mode 100644 index 0000000..518c0fe --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMHuo.java @@ -0,0 +1,164 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMHuo extends MICBM { + ModelRenderer MAIN_MISSILE_MODULE; + ModelRenderer PROPULSOR_MODULE; + ModelRenderer WING_B_A_1; + ModelRenderer WING_B_B_1; + ModelRenderer WING_T_A_1; + ModelRenderer WING_T_B_1; + ModelRenderer WING_T_A_2; + ModelRenderer WING_T_B_2; + ModelRenderer WING_B_B_2; + ModelRenderer WING_B_A_2; + ModelRenderer WARHEAD_1; + ModelRenderer WARHEAD_2; + ModelRenderer WARHEAD_3; + ModelRenderer WARHEAD_4; + ModelRenderer WARHEAD_5; + ModelRenderer WARHEAD_6; + + public MMHuo() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MISSILE_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.MAIN_MISSILE_MODULE.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.MAIN_MISSILE_MODULE.setTextureSize(128, 128); + this.MAIN_MISSILE_MODULE.mirror = true; + this.setRotation(this.MAIN_MISSILE_MODULE, 0.0f, 0.0f, 0.0f); + (this.PROPULSOR_MODULE = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.PROPULSOR_MODULE.setRotationPoint(0.0f, 8.0f, 0.0f); + this.PROPULSOR_MODULE.setTextureSize(128, 128); + this.PROPULSOR_MODULE.mirror = true; + this.setRotation(this.PROPULSOR_MODULE, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_A_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_A_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_A_1.setTextureSize(128, 128); + this.WING_B_A_1.mirror = true; + this.setRotation(this.WING_B_A_1, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_B_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_B_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_B_1.setTextureSize(128, 128); + this.WING_B_B_1.mirror = true; + this.setRotation(this.WING_B_B_1, 0.0f, -0.7853982f, 0.0f); + (this.WING_T_A_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_A_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_A_1.setTextureSize(128, 128); + this.WING_T_A_1.mirror = true; + this.setRotation(this.WING_T_A_1, -0.7853982f, 0.7853982f, 0.0f); + (this.WING_T_B_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_B_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_B_1.setTextureSize(128, 128); + this.WING_T_B_1.mirror = true; + this.setRotation(this.WING_T_B_1, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_T_A_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_A_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_A_2.setTextureSize(128, 128); + this.WING_T_A_2.mirror = true; + this.setRotation(this.WING_T_A_2, 0.0f, 0.7853982f, 0.0f); + (this.WING_T_B_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_B_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_B_2.setTextureSize(128, 128); + this.WING_T_B_2.mirror = true; + this.setRotation(this.WING_T_B_2, 0.0f, -0.7853982f, 0.0f); + (this.WING_B_B_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_B_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_B_2.setTextureSize(128, 128); + this.WING_B_B_2.mirror = true; + this.setRotation(this.WING_B_B_2, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_B_A_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_A_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_A_2.setTextureSize(128, 128); + this.WING_B_A_2.mirror = true; + this.setRotation(this.WING_B_A_2, -0.7853982f, 0.7853982f, 0.0f); + (this.WARHEAD_1 = new ModelRenderer((ModelBase)this, 0, 85)) + .addBox(0.0f, 0.0f, 0.0f, 6, 7, 6); + this.WARHEAD_1.setRotationPoint(-3.0f, -33.0f, -3.0f); + this.WARHEAD_1.setTextureSize(128, 128); + this.WARHEAD_1.mirror = true; + this.setRotation(this.WARHEAD_1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_2 = new ModelRenderer((ModelBase)this, 26, 101)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.WARHEAD_2.setRotationPoint(-1.0f, -39.0f, -1.0f); + this.WARHEAD_2.setTextureSize(128, 128); + this.WARHEAD_2.mirror = true; + this.setRotation(this.WARHEAD_2, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_3 = new ModelRenderer((ModelBase)this, 26, 85)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 7, 7); + this.WARHEAD_3.setRotationPoint(0.0f, -39.0f, 0.0f); + this.WARHEAD_3.setTextureSize(128, 128); + this.WARHEAD_3.mirror = true; + this.setRotation(this.WARHEAD_3, -0.7853982f, 0.7853982f, 0.0f); + (this.WARHEAD_4 = new ModelRenderer((ModelBase)this, 26, 85)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 7, 7); + this.WARHEAD_4.setRotationPoint(0.0f, -39.0f, 0.0f); + this.WARHEAD_4.setTextureSize(128, 128); + this.WARHEAD_4.mirror = true; + this.setRotation(this.WARHEAD_4, -0.7853982f, -0.7853982f, 0.0f); + (this.WARHEAD_5 = new ModelRenderer((ModelBase)this, 0, 101)) + .addBox(-1.0f, 0.0f, -5.0f, 2, 7, 10); + this.WARHEAD_5.setRotationPoint(0.0f, -34.0f, 0.0f); + this.WARHEAD_5.setTextureSize(128, 128); + this.WARHEAD_5.mirror = true; + this.setRotation(this.WARHEAD_5, 0.0f, 0.7853982f, 0.0f); + (this.WARHEAD_6 = new ModelRenderer((ModelBase)this, 0, 101)) + .addBox(-1.0f, 0.0f, -5.0f, 2, 7, 10); + this.WARHEAD_6.setRotationPoint(0.0f, -34.0f, 0.0f); + this.WARHEAD_6.setTextureSize(128, 128); + this.WARHEAD_6.mirror = true; + this.setRotation(this.WARHEAD_6, 0.0f, -0.7853982f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MISSILE_MODULE.render(f5); + this.PROPULSOR_MODULE.render(f5); + this.WING_B_A_1.render(f5); + this.WING_B_B_1.render(f5); + this.WING_T_A_1.render(f5); + this.WING_T_B_1.render(f5); + this.WING_T_A_2.render(f5); + this.WING_T_B_2.render(f5); + this.WING_B_B_2.render(f5); + this.WING_B_A_2.render(f5); + this.WARHEAD_1.render(f5); + this.WARHEAD_2.render(f5); + this.WARHEAD_3.render(f5); + this.WARHEAD_4.render(f5); + this.WARHEAD_5.render(f5); + this.WARHEAD_6.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMLa.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMLa.java new file mode 100644 index 0000000..3fcfad4 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMLa.java @@ -0,0 +1,164 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMLa extends MICBM { + ModelRenderer a; + ModelRenderer b; + ModelRenderer c; + ModelRenderer d; + ModelRenderer e; + ModelRenderer f; + ModelRenderer g; + ModelRenderer h; + ModelRenderer i; + ModelRenderer j; + ModelRenderer k; + ModelRenderer l; + ModelRenderer m; + ModelRenderer n; + ModelRenderer o; + ModelRenderer p; + + public MMLa() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.a = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.a.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.a.setTextureSize(128, 128); + this.a.mirror = true; + this.setRotation(this.a, 0.0f, 0.0f, 0.0f); + (this.b = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.b.setRotationPoint(0.0f, 8.0f, 0.0f); + this.b.setTextureSize(128, 128); + this.b.mirror = true; + this.setRotation(this.b, 0.0f, 0.7853982f, 0.0f); + (this.c = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.c.setTextureSize(128, 128); + this.c.mirror = true; + this.setRotation(this.c, 0.0f, 0.7853982f, 0.0f); + (this.d = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.d.setRotationPoint(0.0f, 12.0f, 0.0f); + this.d.setTextureSize(128, 128); + this.d.mirror = true; + this.setRotation(this.d, 0.0f, -0.7853982f, 0.0f); + (this.e = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.e.setRotationPoint(0.0f, -24.0f, 0.0f); + this.e.setTextureSize(128, 128); + this.e.mirror = true; + this.setRotation(this.e, -0.7853982f, 0.7853982f, 0.0f); + (this.f = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.f.setRotationPoint(0.0f, -24.0f, 0.0f); + this.f.setTextureSize(128, 128); + this.f.mirror = true; + this.setRotation(this.f, -0.7853982f, -0.7853982f, 0.0f); + (this.g = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.g.setRotationPoint(0.0f, -17.0f, 0.0f); + this.g.setTextureSize(128, 128); + this.g.mirror = true; + this.setRotation(this.g, 0.0f, 0.7853982f, 0.0f); + (this.h = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.h.setRotationPoint(0.0f, -17.0f, 0.0f); + this.h.setTextureSize(128, 128); + this.h.mirror = true; + this.setRotation(this.h, 0.0f, -0.7853982f, 0.0f); + (this.i = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.i.setRotationPoint(0.0f, 3.0f, 0.0f); + this.i.setTextureSize(128, 128); + this.i.mirror = true; + this.setRotation(this.i, -0.7853982f, -0.7853982f, 0.0f); + (this.j = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.j.setRotationPoint(0.0f, 3.0f, 0.0f); + this.j.setTextureSize(128, 128); + this.j.mirror = true; + this.setRotation(this.j, -0.7853982f, 0.7853982f, 0.0f); + (this.k = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.k.setRotationPoint(0.0f, -29.0f, 0.0f); + this.k.setTextureSize(128, 128); + this.k.mirror = true; + this.setRotation(this.k, 0.0f, 0.0f, 0.0f); + (this.l = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.l.setRotationPoint(0.0f, -29.0f, 0.0f); + this.l.setTextureSize(128, 128); + this.l.mirror = true; + this.setRotation(this.l, 0.0f, 1.570796f, 0.0f); + (this.m = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.m.setRotationPoint(0.0f, -29.0f, 0.0f); + this.m.setTextureSize(128, 128); + this.m.mirror = true; + this.setRotation(this.m, 0.0f, 3.141593f, 0.0f); + (this.n = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.n.setRotationPoint(0.0f, -29.0f, 0.0f); + this.n.setTextureSize(128, 128); + this.n.mirror = true; + this.setRotation(this.n, 0.0f, -1.570796f, 0.0f); + (this.o = new ModelRenderer((ModelBase)this, 10, 86)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 6, 4); + this.o.setRotationPoint(0.0f, -32.0f, 0.0f); + this.o.setTextureSize(128, 128); + this.o.mirror = true; + this.setRotation(this.o, 0.0f, 0.0f, 0.0f); + (this.p = new ModelRenderer((ModelBase)this, 28, 86)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 6, 2); + this.p.setRotationPoint(0.0f, -38.0f, 0.0f); + this.p.setTextureSize(128, 128); + this.p.mirror = true; + this.setRotation(this.p, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float x, final float y, + final float z, final float f3, final float f4, + final float f5) { + super.render(entity, x, y, z, f3, f4, f5); + this.setRotationAngles(x, y, z, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.a.render(f5); + this.b.render(f5); + this.c.render(f5); + this.d.render(f5); + this.e.render(f5); + this.f.render(f5); + this.g.render(f5); + this.h.render(f5); + this.i.render(f5); + this.j.render(f5); + this.k.render(f5); + this.l.render(f5); + this.m.render(f5); + this.n.render(f5); + this.o.render(f5); + this.p.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMLiZi.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMLiZi.java new file mode 100644 index 0000000..3b094a3 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMLiZi.java @@ -0,0 +1,332 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMLiZi extends MICBM { + ModelRenderer A; + ModelRenderer B; + ModelRenderer C; + ModelRenderer D; + ModelRenderer E; + ModelRenderer F; + ModelRenderer G; + ModelRenderer H; + ModelRenderer I; + ModelRenderer J; + ModelRenderer K; + ModelRenderer L; + ModelRenderer M; + ModelRenderer N; + ModelRenderer O; + ModelRenderer P; + ModelRenderer Q; + ModelRenderer R; + ModelRenderer S; + ModelRenderer T; + ModelRenderer U; + ModelRenderer V; + ModelRenderer W; + ModelRenderer X; + ModelRenderer Y; + ModelRenderer Z; + ModelRenderer AA; + ModelRenderer AB; + ModelRenderer AC; + ModelRenderer AD; + ModelRenderer AE; + ModelRenderer AF; + ModelRenderer AG; + ModelRenderer AH; + ModelRenderer AI; + ModelRenderer AJ; + ModelRenderer AK; + + public MMLiZi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.A = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.A.setRotationPoint(0.0f, -40.0f, 0.0f); + this.A.setTextureSize(128, 128); + this.A.mirror = true; + this.setRotation(this.A, 0.0f, 0.0f, 0.0f); + (this.B = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.B.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.B.setTextureSize(128, 128); + this.B.mirror = true; + this.setRotation(this.B, 0.0f, 0.0f, 0.0f); + (this.C = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.C.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.C.setTextureSize(128, 128); + this.C.mirror = true; + this.setRotation(this.C, 0.0f, 0.0f, 0.0f); + (this.D = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.D.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.D.setTextureSize(128, 128); + this.D.mirror = true; + this.setRotation(this.D, 0.0f, 0.0f, 0.0f); + (this.E = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.E.setRotationPoint(6.0f, 14.0f, -6.0f); + this.E.setTextureSize(128, 128); + this.E.mirror = true; + this.setRotation(this.E, 0.0f, 0.0f, 0.0f); + (this.F = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.F.setRotationPoint(0.0f, 12.0f, 0.0f); + this.F.setTextureSize(128, 128); + this.F.mirror = true; + this.setRotation(this.F, 0.0f, 0.7853982f, 0.0f); + (this.G = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.G.setRotationPoint(0.0f, 12.0f, 0.0f); + this.G.setTextureSize(128, 128); + this.G.mirror = true; + this.setRotation(this.G, 0.0f, -0.7853982f, 0.0f); + (this.H = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.H.setRotationPoint(0.0f, 12.0f, 0.0f); + this.H.setTextureSize(128, 128); + this.H.mirror = true; + this.setRotation(this.H, 0.0f, 0.7853982f, 0.7853982f); + (this.I = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.I.setRotationPoint(0.0f, 12.0f, 0.0f); + this.I.setTextureSize(128, 128); + this.I.mirror = true; + this.setRotation(this.I, 0.0f, -0.7853982f, 0.7853982f); + (this.J = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.J.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.J.setTextureSize(128, 128); + this.J.mirror = true; + this.setRotation(this.J, -0.5235988f, 0.0f, 0.0f); + (this.K = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.K.setRotationPoint(4.0f, -23.0f, -1.0f); + this.K.setTextureSize(128, 128); + this.K.mirror = true; + this.setRotation(this.K, 0.0f, 0.0f, 0.5235988f); + (this.L = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.L.setRotationPoint(0.0f, -35.0f, -4.0f); + this.L.setTextureSize(128, 128); + this.L.mirror = true; + this.setRotation(this.L, -0.5235988f, 3.141593f, 0.0f); + (this.M = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.M.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.M.setTextureSize(128, 128); + this.M.mirror = true; + this.setRotation(this.M, 0.0f, 3.141593f, 0.5235988f); + (this.N = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.N.setRotationPoint(0.0f, -32.0f, 0.0f); + this.N.setTextureSize(128, 128); + this.N.mirror = true; + this.setRotation(this.N, 0.0f, 0.0f, 0.0f); + (this.O = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.O.setRotationPoint(0.0f, -32.0f, 0.0f); + this.O.setTextureSize(128, 128); + this.O.mirror = true; + this.setRotation(this.O, 0.0f, 1.570796f, 0.0f); + (this.P = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.P.setRotationPoint(0.0f, -23.0f, -4.0f); + this.P.setTextureSize(128, 128); + this.P.mirror = true; + this.setRotation(this.P, -0.5235988f, 3.141593f, 0.0f); + (this.Q = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Q.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Q.setTextureSize(128, 128); + this.Q.mirror = true; + this.setRotation(this.Q, -0.5235988f, 0.0f, 0.0f); + (this.R = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.R.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.R.setTextureSize(128, 128); + this.R.mirror = true; + this.setRotation(this.R, 0.0f, 3.141593f, 0.5235988f); + (this.S = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.S.setRotationPoint(4.0f, -35.0f, -1.0f); + this.S.setTextureSize(128, 128); + this.S.mirror = true; + this.setRotation(this.S, 0.0f, 0.0f, 0.5235988f); + (this.T = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.T.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.T.setTextureSize(128, 128); + this.T.mirror = true; + this.setRotation(this.T, 0.0f, 0.0f, 0.0f); + (this.U = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.U.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.U.setTextureSize(128, 128); + this.U.mirror = true; + this.setRotation(this.U, 0.0f, 0.0f, 0.0f); + (this.V = new ModelRenderer((ModelBase)this, 72, 113)) + .addBox(1.0f, 0.0f, -2.0f, 3, 6, 4); + this.V.setRotationPoint(0.0f, -47.0f, 0.0f); + this.V.setTextureSize(128, 128); + this.V.mirror = true; + this.setRotation(this.V, 0.0f, 0.0f, 0.0f); + (this.W = new ModelRenderer((ModelBase)this, 72, 113)) + .addBox(1.0f, 0.0f, -2.0f, 3, 6, 4); + this.W.setRotationPoint(0.0f, -47.0f, 0.0f); + this.W.setTextureSize(128, 128); + this.W.mirror = true; + this.setRotation(this.W, 0.0f, 2.094395f, 0.0f); + (this.X = new ModelRenderer((ModelBase)this, 72, 113)) + .addBox(1.0f, 0.0f, -2.0f, 3, 6, 4); + this.X.setRotationPoint(0.0f, -47.0f, 0.0f); + this.X.setTextureSize(128, 128); + this.X.mirror = true; + this.setRotation(this.X, 0.0f, 1.047198f, 0.0f); + (this.Y = new ModelRenderer((ModelBase)this, 72, 113)) + .addBox(1.0f, 0.0f, -2.0f, 3, 6, 4); + this.Y.setRotationPoint(0.0f, -47.0f, 0.0f); + this.Y.setTextureSize(128, 128); + this.Y.mirror = true; + this.setRotation(this.Y, 0.0f, 3.141593f, 0.0f); + (this.Z = new ModelRenderer((ModelBase)this, 72, 113)) + .addBox(1.0f, 0.0f, -2.0f, 3, 6, 4); + this.Z.setRotationPoint(0.0f, -47.0f, 0.0f); + this.Z.setTextureSize(128, 128); + this.Z.mirror = true; + this.setRotation(this.Z, 0.0f, -1.047198f, 0.0f); + (this.AA = new ModelRenderer((ModelBase)this, 72, 113)) + .addBox(1.0f, 0.0f, -2.0f, 3, 6, 4); + this.AA.setRotationPoint(0.0f, -47.0f, 0.0f); + this.AA.setTextureSize(128, 128); + this.AA.mirror = true; + this.setRotation(this.AA, 0.0f, -2.094395f, 0.0f); + (this.AB = new ModelRenderer((ModelBase)this, 72, 102)) + .addBox(-6.0f, 0.0f, -1.0f, 12, 6, 2); + this.AB.setRotationPoint(0.0f, -47.0f, 0.0f); + this.AB.setTextureSize(128, 128); + this.AB.mirror = true; + this.setRotation(this.AB, 0.0f, -2.094395f, 0.0f); + (this.AC = new ModelRenderer((ModelBase)this, 72, 102)) + .addBox(-6.0f, 0.0f, -1.0f, 12, 6, 2); + this.AC.setRotationPoint(0.0f, -47.0f, 0.0f); + this.AC.setTextureSize(128, 128); + this.AC.mirror = true; + this.setRotation(this.AC, 0.0f, 0.0f, 0.0f); + (this.AD = new ModelRenderer((ModelBase)this, 72, 102)) + .addBox(-6.0f, 0.0f, -1.0f, 12, 6, 2); + this.AD.setRotationPoint(0.0f, -47.0f, 0.0f); + this.AD.setTextureSize(128, 128); + this.AD.mirror = true; + this.setRotation(this.AD, 0.0f, -1.047198f, 0.0f); + (this.AE = new ModelRenderer((ModelBase)this, 89, 113)) + .addBox(-5.0f, 0.0f, -1.0f, 2, 6, 2); + this.AE.setRotationPoint(0.0f, -51.0f, 0.0f); + this.AE.setTextureSize(128, 128); + this.AE.mirror = true; + this.setRotation(this.AE, 0.0f, -2.094395f, 0.2617994f); + (this.AF = new ModelRenderer((ModelBase)this, 89, 113)) + .addBox(-5.0f, 0.0f, -1.0f, 2, 6, 2); + this.AF.setRotationPoint(0.0f, -51.0f, 0.0f); + this.AF.setTextureSize(128, 128); + this.AF.mirror = true; + this.setRotation(this.AF, 0.0f, 0.0f, 0.2617994f); + (this.AG = new ModelRenderer((ModelBase)this, 89, 113)) + .addBox(-5.0f, 0.0f, -1.0f, 2, 6, 2); + this.AG.setRotationPoint(0.0f, -51.0f, 0.0f); + this.AG.setTextureSize(128, 128); + this.AG.mirror = true; + this.setRotation(this.AG, 0.0f, -1.047198f, 0.2617994f); + (this.AH = new ModelRenderer((ModelBase)this, 89, 113)) + .addBox(-5.0f, 0.0f, -1.0f, 2, 6, 2); + this.AH.setRotationPoint(0.0f, -51.0f, 0.0f); + this.AH.setTextureSize(128, 128); + this.AH.mirror = true; + this.setRotation(this.AH, 0.0f, 1.047198f, 0.2617994f); + (this.AI = new ModelRenderer((ModelBase)this, 89, 113)) + .addBox(-5.0f, 0.0f, -1.0f, 2, 6, 2); + this.AI.setRotationPoint(0.0f, -51.0f, 0.0f); + this.AI.setTextureSize(128, 128); + this.AI.mirror = true; + this.setRotation(this.AI, 0.0f, 2.094395f, 0.2617994f); + (this.AJ = new ModelRenderer((ModelBase)this, 89, 113)) + .addBox(-5.0f, 0.0f, -1.0f, 2, 6, 2); + this.AJ.setRotationPoint(0.0f, -51.0f, 0.0f); + this.AJ.setTextureSize(128, 128); + this.AJ.mirror = true; + this.setRotation(this.AJ, 0.0f, 3.141593f, 0.2617994f); + (this.AK = new ModelRenderer((ModelBase)this, 51, 106)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 11, 4); + this.AK.setRotationPoint(0.0f, -58.0f, 0.0f); + this.AK.setTextureSize(128, 128); + this.AK.mirror = true; + this.setRotation(this.AK, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.A.render(f5); + this.B.render(f5); + this.C.render(f5); + this.D.render(f5); + this.E.render(f5); + this.F.render(f5); + this.G.render(f5); + this.H.render(f5); + this.I.render(f5); + this.J.render(f5); + this.K.render(f5); + this.L.render(f5); + this.M.render(f5); + this.N.render(f5); + this.O.render(f5); + this.P.render(f5); + this.Q.render(f5); + this.R.render(f5); + this.S.render(f5); + this.T.render(f5); + this.U.render(f5); + this.V.render(f5); + this.W.render(f5); + this.X.render(f5); + this.Y.render(f5); + this.Z.render(f5); + this.AA.render(f5); + this.AB.render(f5); + this.AC.render(f5); + this.AD.render(f5); + this.AE.render(f5); + this.AF.render(f5); + this.AG.render(f5); + this.AH.render(f5); + this.AI.render(f5); + this.AJ.render(f5); + this.AK.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMPiaoFu.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMPiaoFu.java new file mode 100644 index 0000000..64c6d2b --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMPiaoFu.java @@ -0,0 +1,108 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMPiaoFu extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + + public MMPiaoFu() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 70, 6); + this.Shape1.setRotationPoint(-3.0f, -46.0f, -3.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 5, 18); + this.Shape2.setRotationPoint(-1.0f, 19.0f, -9.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 25, 25)) + .addBox(0.0f, 0.0f, 0.0f, 18, 5, 2); + this.Shape3.setRotationPoint(-9.0f, 19.0f, -1.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.0f, 0.0f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 25, 65)) + .addBox(0.0f, 0.0f, 0.0f, 12, 12, 2); + this.Shape4.setRotationPoint(-6.0f, -40.0f, -1.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, 0.0f, 0.0f, 0.0f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 25, 40)) + .addBox(0.0f, 0.0f, 0.0f, 2, 12, 12); + this.Shape5.setRotationPoint(-1.0f, -40.0f, -6.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 0, 80)) + .addBox(0.0f, 0.0f, 0.0f, 10, 15, 10); + this.Shape6.setRotationPoint(-5.0f, 9.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 8, 7, 8); + this.Shape7.setRotationPoint(-4.0f, -53.0f, -4.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 70, 0)) + .addBox(0.0f, 0.0f, 0.0f, 4, 4, 4); + this.Shape8.setRotationPoint(0.0f, -54.0f, 0.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, -0.7853982f, 0.0f, 0.6108652f); + (this.Shape9 = new ModelRenderer((ModelBase)this, 70, 10)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 5, 2); + this.Shape9.setRotationPoint(0.0f, -55.0f, 0.0f); + this.Shape9.setTextureSize(128, 128); + this.Shape9.mirror = true; + this.setRotation(this.Shape9, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape3.render(f5); + this.Shape4.render(f5); + this.Shape5.render(f5); + this.Shape6.render(f5); + this.Shape7.render(f5); + this.Shape8.render(f5); + this.Shape9.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMQi.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMQi.java new file mode 100644 index 0000000..13a5629 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMQi.java @@ -0,0 +1,188 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMQi extends MICBM { + ModelRenderer MAIN_MISSILE_MODULE; + ModelRenderer PROPULSOR_MODULE; + ModelRenderer WING_B_A_1; + ModelRenderer WING_B_B_1; + ModelRenderer WING_T_A_1; + ModelRenderer WING_T_B_1; + ModelRenderer WING_T_A_2; + ModelRenderer WING_T_B_2; + ModelRenderer WING_B_B_2; + ModelRenderer WING_B_A_2; + ModelRenderer WARHEAD_1; + ModelRenderer WARHEAD_2; + ModelRenderer WARHEAD_3; + ModelRenderer WARHEAD_4; + ModelRenderer WARHEAD_5; + ModelRenderer SCREEN; + ModelRenderer POLEDEPTH; + ModelRenderer POLEWIDTH; + ModelRenderer WINGTWIDTH; + + public MMQi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MISSILE_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.MAIN_MISSILE_MODULE.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.MAIN_MISSILE_MODULE.setTextureSize(128, 128); + this.MAIN_MISSILE_MODULE.mirror = true; + this.setRotation(this.MAIN_MISSILE_MODULE, 0.0f, 0.0f, 0.0f); + (this.PROPULSOR_MODULE = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.PROPULSOR_MODULE.setRotationPoint(0.0f, 8.0f, 0.0f); + this.PROPULSOR_MODULE.setTextureSize(128, 128); + this.PROPULSOR_MODULE.mirror = true; + this.setRotation(this.PROPULSOR_MODULE, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_A_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_A_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_A_1.setTextureSize(128, 128); + this.WING_B_A_1.mirror = true; + this.setRotation(this.WING_B_A_1, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_B_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_B_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_B_1.setTextureSize(128, 128); + this.WING_B_B_1.mirror = true; + this.setRotation(this.WING_B_B_1, 0.0f, -0.7853982f, 0.0f); + (this.WING_T_A_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_A_1.setRotationPoint(0.0f, -26.0f, 0.0f); + this.WING_T_A_1.setTextureSize(128, 128); + this.WING_T_A_1.mirror = true; + this.setRotation(this.WING_T_A_1, -0.7853982f, 0.7853982f, 0.0f); + (this.WING_T_B_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_B_1.setRotationPoint(0.0f, -26.0f, 0.0f); + this.WING_T_B_1.setTextureSize(128, 128); + this.WING_T_B_1.mirror = true; + this.setRotation(this.WING_T_B_1, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_T_A_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 12, 14); + this.WING_T_A_2.setRotationPoint(0.0f, -19.0f, 0.0f); + this.WING_T_A_2.setTextureSize(128, 128); + this.WING_T_A_2.mirror = true; + this.setRotation(this.WING_T_A_2, 0.0f, 0.7853982f, 0.0f); + (this.WING_T_B_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 12, 14); + this.WING_T_B_2.setRotationPoint(0.0f, -19.0f, 0.0f); + this.WING_T_B_2.setTextureSize(128, 128); + this.WING_T_B_2.mirror = true; + this.setRotation(this.WING_T_B_2, 0.0f, -0.7853982f, 0.0f); + (this.WING_B_B_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_B_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_B_2.setTextureSize(128, 128); + this.WING_B_B_2.mirror = true; + this.setRotation(this.WING_B_B_2, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_B_A_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_A_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_A_2.setTextureSize(128, 128); + this.WING_B_A_2.mirror = true; + this.setRotation(this.WING_B_A_2, -0.7853982f, 0.7853982f, 0.0f); + (this.WARHEAD_1 = new ModelRenderer((ModelBase)this, 0, 85)) + .addBox(-4.0f, 0.0f, -4.0f, 7, 7, 7); + this.WARHEAD_1.setRotationPoint(0.5f, -29.0f, 0.5f); + this.WARHEAD_1.setTextureSize(128, 128); + this.WARHEAD_1.mirror = true; + this.setRotation(this.WARHEAD_1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_2 = new ModelRenderer((ModelBase)this, 33, 85)) + .addBox(-3.0f, 0.0f, -3.0f, 5, 3, 5); + this.WARHEAD_2.setRotationPoint(0.5f, -32.0f, 0.5f); + this.WARHEAD_2.setTextureSize(128, 128); + this.WARHEAD_2.mirror = true; + this.setRotation(this.WARHEAD_2, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_3 = new ModelRenderer((ModelBase)this, 59, 85)) + .addBox(-2.0f, 0.0f, -2.0f, 3, 3, 3); + this.WARHEAD_3.setRotationPoint(0.5f, -35.0f, 0.5f); + this.WARHEAD_3.setTextureSize(128, 128); + this.WARHEAD_3.mirror = true; + this.setRotation(this.WARHEAD_3, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_4 = new ModelRenderer((ModelBase)this, 78, 85)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 3, 2); + this.WARHEAD_4.setRotationPoint(0.0f, -38.0f, 0.0f); + this.WARHEAD_4.setTextureSize(128, 128); + this.WARHEAD_4.mirror = true; + this.setRotation(this.WARHEAD_4, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_5 = new ModelRenderer((ModelBase)this, 89, 85)) + .addBox(0.0f, 0.0f, 0.0f, 1, 3, 1); + this.WARHEAD_5.setRotationPoint(-0.5f, -41.0f, -0.5f); + this.WARHEAD_5.setTextureSize(128, 128); + this.WARHEAD_5.mirror = true; + this.setRotation(this.WARHEAD_5, 0.0f, 0.0f, 0.0f); + (this.SCREEN = new ModelRenderer((ModelBase)this, 97, 0)) + .addBox(0.0f, 0.0f, 0.0f, 4, 10, 8); + this.SCREEN.setRotationPoint(-2.0f, -6.0f, -4.0f); + this.SCREEN.setTextureSize(128, 128); + this.SCREEN.mirror = true; + this.setRotation(this.SCREEN, 0.0f, 0.0f, 0.0f); + (this.POLEDEPTH = new ModelRenderer((ModelBase)this, 45, 59)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 10); + this.POLEDEPTH.setRotationPoint(-1.0f, -31.0f, -5.0f); + this.POLEDEPTH.setTextureSize(128, 128); + this.POLEDEPTH.mirror = true; + this.setRotation(this.POLEDEPTH, 0.0f, 0.0f, 0.0f); + (this.POLEWIDTH = new ModelRenderer((ModelBase)this, 45, 73)) + .addBox(0.0f, 0.0f, 0.0f, 10, 2, 2); + this.POLEWIDTH.setRotationPoint(-5.0f, -31.0f, -1.0f); + this.POLEWIDTH.setTextureSize(128, 128); + this.POLEWIDTH.mirror = true; + this.setRotation(this.POLEWIDTH, 0.0f, 0.0f, 0.0f); + (this.WINGTWIDTH = new ModelRenderer((ModelBase)this, 70, 57)) + .addBox(0.0f, 0.0f, 0.0f, 14, 12, 2); + this.WINGTWIDTH.setRotationPoint(-7.0f, -19.0f, -1.0f); + this.WINGTWIDTH.setTextureSize(128, 128); + this.WINGTWIDTH.mirror = true; + this.setRotation(this.WINGTWIDTH, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MISSILE_MODULE.render(f5); + this.PROPULSOR_MODULE.render(f5); + this.WING_B_A_1.render(f5); + this.WING_B_B_1.render(f5); + this.WING_T_A_1.render(f5); + this.WING_T_B_1.render(f5); + this.WING_T_A_2.render(f5); + this.WING_T_B_2.render(f5); + this.WING_B_B_2.render(f5); + this.WING_B_A_2.render(f5); + this.WARHEAD_1.render(f5); + this.WARHEAD_2.render(f5); + this.WARHEAD_3.render(f5); + this.WARHEAD_4.render(f5); + this.WARHEAD_5.render(f5); + this.SCREEN.render(f5); + this.POLEDEPTH.render(f5); + this.POLEWIDTH.render(f5); + this.WINGTWIDTH.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMQunDan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMQunDan.java new file mode 100644 index 0000000..7b261cf --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMQunDan.java @@ -0,0 +1,284 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMQunDan extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2a; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape3; + ModelRenderer Shape3a; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape4; + ModelRenderer Shape4a; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape5; + ModelRenderer Shape5a; + ModelRenderer Shape4d; + ModelRenderer Shape4e; + ModelRenderer Shape4f; + ModelRenderer Shape4g; + ModelRenderer Shape6; + ModelRenderer Shape6a; + ModelRenderer Shape7; + ModelRenderer Shape7a; + ModelRenderer Shape7b; + ModelRenderer Shape7c; + ModelRenderer Shape7d; + ModelRenderer Shape7e; + ModelRenderer Shape7f; + ModelRenderer Shape7g; + ModelRenderer Shape7h; + ModelRenderer Shape7i; + + public MMQunDan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.Shape1.setRotationPoint(0.0f, -40.0f, 0.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape2a = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2a.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Shape2a.setTextureSize(128, 128); + this.Shape2a.mirror = true; + this.setRotation(this.Shape2a, 0.0f, 0.0f, 0.0f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2b.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.0f, 0.0f, 0.0f); + (this.Shape2c = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2c.setRotationPoint(6.0f, 14.0f, -6.0f); + this.Shape2c.setTextureSize(128, 128); + this.Shape2c.mirror = true; + this.setRotation(this.Shape2c, 0.0f, 0.0f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.7853982f, 0.0f); + (this.Shape3a = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3a.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3a.setTextureSize(128, 128); + this.Shape3a.mirror = true; + this.setRotation(this.Shape3a, 0.0f, -0.7853982f, 0.0f); + (this.Shape3b = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3b.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3b.setTextureSize(128, 128); + this.Shape3b.mirror = true; + this.setRotation(this.Shape3b, 0.0f, 0.7853982f, 0.7853982f); + (this.Shape3c = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3c.setTextureSize(128, 128); + this.Shape3c.mirror = true; + this.setRotation(this.Shape3c, 0.0f, -0.7853982f, 0.7853982f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.Shape4.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, -0.5235988f, 0.0f, 0.0f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.Shape4a.setRotationPoint(4.0f, -23.0f, -1.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, 0.0f, 0.0f, 0.5235988f); + (this.Shape4b = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4b.setRotationPoint(0.0f, -35.0f, -4.0f); + this.Shape4b.setTextureSize(128, 128); + this.Shape4b.mirror = true; + this.setRotation(this.Shape4b, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4c = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.Shape4c.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.Shape4c.setTextureSize(128, 128); + this.Shape4c.mirror = true; + this.setRotation(this.Shape4c, 0.0f, 3.141593f, 0.5235988f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5a.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 1.570796f, 0.0f); + (this.Shape4d = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.Shape4d.setRotationPoint(0.0f, -23.0f, -4.0f); + this.Shape4d.setTextureSize(128, 128); + this.Shape4d.mirror = true; + this.setRotation(this.Shape4d, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4e = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4e.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Shape4e.setTextureSize(128, 128); + this.Shape4e.mirror = true; + this.setRotation(this.Shape4e, -0.5235988f, 0.0f, 0.0f); + (this.Shape4f = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.Shape4f.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.Shape4f.setTextureSize(128, 128); + this.Shape4f.mirror = true; + this.setRotation(this.Shape4f, 0.0f, 3.141593f, 0.5235988f); + (this.Shape4g = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.Shape4g.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape4g.setTextureSize(128, 128); + this.Shape4g.mirror = true; + this.setRotation(this.Shape4g, 0.0f, 0.0f, 0.5235988f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6a.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 80, 111)) + .addBox(0.0f, 0.0f, 0.0f, 12, 4, 12); + this.Shape7.setRotationPoint(-6.0f, -45.0f, -6.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape7a = new ModelRenderer((ModelBase)this, 88, 95)) + .addBox(0.0f, 0.0f, 0.0f, 10, 4, 10); + this.Shape7a.setRotationPoint(-5.0f, -49.0f, -5.0f); + this.Shape7a.setTextureSize(128, 128); + this.Shape7a.mirror = true; + this.setRotation(this.Shape7a, 0.0f, 0.0f, 0.0f); + (this.Shape7b = new ModelRenderer((ModelBase)this, 48, 109)) + .addBox(0.0f, 0.0f, 0.0f, 1, 4, 14); + this.Shape7b.setRotationPoint(-4.0f, -45.0f, -7.0f); + this.Shape7b.setTextureSize(128, 128); + this.Shape7b.mirror = true; + this.setRotation(this.Shape7b, 0.0f, 0.0f, 0.0f); + (this.Shape7c = new ModelRenderer((ModelBase)this, 48, 109)) + .addBox(0.0f, 0.0f, 0.0f, 1, 4, 14); + this.Shape7c.setRotationPoint(3.0f, -45.0f, -7.0f); + this.Shape7c.setTextureSize(128, 128); + this.Shape7c.mirror = true; + this.setRotation(this.Shape7c, 0.0f, 0.0f, 0.0f); + (this.Shape7d = new ModelRenderer((ModelBase)this, 48, 109)) + .addBox(0.0f, 0.0f, 0.0f, 1, 4, 14); + this.Shape7d.setRotationPoint(-7.0f, -45.0f, -3.0f); + this.Shape7d.setTextureSize(128, 128); + this.Shape7d.mirror = true; + this.setRotation(this.Shape7d, 0.0f, 1.570796f, 0.0f); + (this.Shape7e = new ModelRenderer((ModelBase)this, 48, 109)) + .addBox(0.0f, 0.0f, 0.0f, 1, 4, 14); + this.Shape7e.setRotationPoint(-7.0f, -45.0f, 4.0f); + this.Shape7e.setTextureSize(128, 128); + this.Shape7e.mirror = true; + this.setRotation(this.Shape7e, 0.0f, 1.570796f, 0.0f); + (this.Shape7f = new ModelRenderer((ModelBase)this, 52, 91)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 12); + this.Shape7f.setRotationPoint(-6.0f, -50.0f, -1.0f); + this.Shape7f.setTextureSize(128, 128); + this.Shape7f.mirror = true; + this.setRotation(this.Shape7f, 0.0f, 1.570796f, 0.0f); + (this.Shape7g = new ModelRenderer((ModelBase)this, 52, 91)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 12); + this.Shape7g.setRotationPoint(-6.0f, -50.0f, 2.0f); + this.Shape7g.setTextureSize(128, 128); + this.Shape7g.mirror = true; + this.setRotation(this.Shape7g, 0.0f, 1.570796f, 0.0f); + (this.Shape7h = new ModelRenderer((ModelBase)this, 52, 91)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 12); + this.Shape7h.setRotationPoint(1.0f, -50.0f, -6.0f); + this.Shape7h.setTextureSize(128, 128); + this.Shape7h.mirror = true; + this.setRotation(this.Shape7h, 0.0f, 0.0f, 0.0f); + (this.Shape7i = new ModelRenderer((ModelBase)this, 52, 91)) + .addBox(0.0f, 0.0f, 0.0f, 1, 5, 12); + this.Shape7i.setRotationPoint(-2.0f, -50.0f, -6.0f); + this.Shape7i.setTextureSize(128, 128); + this.Shape7i.mirror = true; + this.setRotation(this.Shape7i, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape2a.render(f5); + this.Shape2b.render(f5); + this.Shape2c.render(f5); + this.Shape3.render(f5); + this.Shape3a.render(f5); + this.Shape3b.render(f5); + this.Shape3c.render(f5); + this.Shape4.render(f5); + this.Shape4a.render(f5); + this.Shape4b.render(f5); + this.Shape4c.render(f5); + this.Shape5.render(f5); + this.Shape5a.render(f5); + this.Shape4d.render(f5); + this.Shape4e.render(f5); + this.Shape4f.render(f5); + this.Shape4g.render(f5); + this.Shape6.render(f5); + this.Shape6a.render(f5); + this.Shape7.render(f5); + this.Shape7a.render(f5); + this.Shape7b.render(f5); + this.Shape7c.render(f5); + this.Shape7d.render(f5); + this.Shape7e.render(f5); + this.Shape7f.render(f5); + this.Shape7g.render(f5); + this.Shape7h.render(f5); + this.Shape7i.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMShengBuo.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMShengBuo.java new file mode 100644 index 0000000..2afab4b --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMShengBuo.java @@ -0,0 +1,236 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMShengBuo extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2a; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape3; + ModelRenderer Shape3a; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape4; + ModelRenderer Shape4a; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape5; + ModelRenderer Shape5a; + ModelRenderer Shape4d; + ModelRenderer Shape4e; + ModelRenderer Shape4f; + ModelRenderer Shape4g; + ModelRenderer Shape6; + ModelRenderer Shape6a; + ModelRenderer Shape7a; + ModelRenderer Shape7; + ModelRenderer Shape7b; + ModelRenderer Shape7c; + + public MMShengBuo() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.Shape1.setRotationPoint(0.0f, -40.0f, 0.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape2a = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2a.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Shape2a.setTextureSize(128, 128); + this.Shape2a.mirror = true; + this.setRotation(this.Shape2a, 0.0f, 0.0f, 0.0f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2b.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.0f, 0.0f, 0.0f); + (this.Shape2c = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2c.setRotationPoint(6.0f, 14.0f, -6.0f); + this.Shape2c.setTextureSize(128, 128); + this.Shape2c.mirror = true; + this.setRotation(this.Shape2c, 0.0f, 0.0f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.7853982f, 0.0f); + (this.Shape3a = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3a.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3a.setTextureSize(128, 128); + this.Shape3a.mirror = true; + this.setRotation(this.Shape3a, 0.0f, -0.7853982f, 0.0f); + (this.Shape3b = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3b.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3b.setTextureSize(128, 128); + this.Shape3b.mirror = true; + this.setRotation(this.Shape3b, 0.0f, 0.7853982f, 0.7853982f); + (this.Shape3c = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3c.setTextureSize(128, 128); + this.Shape3c.mirror = true; + this.setRotation(this.Shape3c, 0.0f, -0.7853982f, 0.7853982f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.Shape4.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, -0.5235988f, 0.0f, 0.0f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.Shape4a.setRotationPoint(4.0f, -23.0f, -1.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, 0.0f, 0.0f, 0.5235988f); + (this.Shape4b = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4b.setRotationPoint(0.0f, -35.0f, -4.0f); + this.Shape4b.setTextureSize(128, 128); + this.Shape4b.mirror = true; + this.setRotation(this.Shape4b, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4c = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.Shape4c.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.Shape4c.setTextureSize(128, 128); + this.Shape4c.mirror = true; + this.setRotation(this.Shape4c, 0.0f, 3.141593f, 0.5235988f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5a.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 1.570796f, 0.0f); + (this.Shape4d = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.Shape4d.setRotationPoint(0.0f, -23.0f, -4.0f); + this.Shape4d.setTextureSize(128, 128); + this.Shape4d.mirror = true; + this.setRotation(this.Shape4d, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4e = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4e.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Shape4e.setTextureSize(128, 128); + this.Shape4e.mirror = true; + this.setRotation(this.Shape4e, -0.5235988f, 0.0f, 0.0f); + (this.Shape4f = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.Shape4f.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.Shape4f.setTextureSize(128, 128); + this.Shape4f.mirror = true; + this.setRotation(this.Shape4f, 0.0f, 3.141593f, 0.5235988f); + (this.Shape4g = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.Shape4g.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape4g.setTextureSize(128, 128); + this.Shape4g.mirror = true; + this.setRotation(this.Shape4g, 0.0f, 0.0f, 0.5235988f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6a.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape7a = new ModelRenderer((ModelBase)this, 95, 115)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Shape7a.setRotationPoint(-4.0f, -45.0f, -4.0f); + this.Shape7a.setTextureSize(128, 128); + this.Shape7a.mirror = true; + this.setRotation(this.Shape7a, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 95, 103)) + .addBox(0.0f, 0.0f, 0.0f, 6, 4, 6); + this.Shape7.setRotationPoint(-3.0f, -49.0f, -3.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape7b = new ModelRenderer((ModelBase)this, 69, 109)) + .addBox(-1.0f, 0.0f, -5.0f, 2, 8, 10); + this.Shape7b.setRotationPoint(0.0f, -48.0f, 0.0f); + this.Shape7b.setTextureSize(128, 128); + this.Shape7b.mirror = true; + this.setRotation(this.Shape7b, 0.0f, 0.7853982f, 0.0f); + (this.Shape7c = new ModelRenderer((ModelBase)this, 69, 109)) + .addBox(-1.0f, 0.0f, -5.0f, 2, 8, 10); + this.Shape7c.setRotationPoint(0.0f, -48.0f, 0.0f); + this.Shape7c.setTextureSize(128, 128); + this.Shape7c.mirror = true; + this.setRotation(this.Shape7c, 0.0f, -0.7853982f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape2a.render(f5); + this.Shape2b.render(f5); + this.Shape2c.render(f5); + this.Shape3.render(f5); + this.Shape3a.render(f5); + this.Shape3b.render(f5); + this.Shape3c.render(f5); + this.Shape4.render(f5); + this.Shape4a.render(f5); + this.Shape4b.render(f5); + this.Shape4c.render(f5); + this.Shape5.render(f5); + this.Shape5a.render(f5); + this.Shape4d.render(f5); + this.Shape4e.render(f5); + this.Shape4f.render(f5); + this.Shape4g.render(f5); + this.Shape6.render(f5); + this.Shape6a.render(f5); + this.Shape7a.render(f5); + this.Shape7.render(f5); + this.Shape7b.render(f5); + this.Shape7c.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMTaiYang.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMTaiYang.java new file mode 100644 index 0000000..df98a55 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMTaiYang.java @@ -0,0 +1,252 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMTaiYang extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE_1; + ModelRenderer MOTOR_MODULE_2; + ModelRenderer MOTOR_MODULE_3; + ModelRenderer MOTOR_MODULE_4; + ModelRenderer C1; + ModelRenderer C2; + ModelRenderer C3; + ModelRenderer C4; + ModelRenderer T1; + ModelRenderer T2; + ModelRenderer T3; + ModelRenderer T4; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_1B; + ModelRenderer WING_2B; + ModelRenderer WING_3A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_4A; + ModelRenderer TOP; + ModelRenderer Shape1; + ModelRenderer Shape1a; + ModelRenderer Shape2b; + ModelRenderer Shape1c; + ModelRenderer Shape1d; + + public MMTaiYang() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 70, 8); + this.MAIN_MODULE.setRotationPoint(-4.0f, -63.0f, -4.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_1 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_1.setRotationPoint(-8.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_1.setTextureSize(128, 128); + this.MOTOR_MODULE_1.mirror = true; + this.setRotation(this.MOTOR_MODULE_1, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_2 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_2.setRotationPoint(-8.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_2.setTextureSize(128, 128); + this.MOTOR_MODULE_2.mirror = true; + this.setRotation(this.MOTOR_MODULE_2, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_3 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_3.setRotationPoint(2.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_3.setTextureSize(128, 128); + this.MOTOR_MODULE_3.mirror = true; + this.setRotation(this.MOTOR_MODULE_3, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_4 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_4.setRotationPoint(2.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_4.setTextureSize(128, 128); + this.MOTOR_MODULE_4.mirror = true; + this.setRotation(this.MOTOR_MODULE_4, 0.0f, 0.0f, 0.0f); + (this.C1 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C1.setRotationPoint(-6.0f, 20.0f, -6.0f); + this.C1.setTextureSize(128, 128); + this.C1.mirror = true; + this.setRotation(this.C1, 0.0f, 0.0f, 0.0f); + (this.C2 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C2.setRotationPoint(-6.0f, 20.0f, 4.0f); + this.C2.setTextureSize(128, 128); + this.C2.mirror = true; + this.setRotation(this.C2, 0.0f, 0.0f, 0.0f); + (this.C3 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C3.setRotationPoint(4.0f, 20.0f, -6.0f); + this.C3.setTextureSize(128, 128); + this.C3.mirror = true; + this.setRotation(this.C3, 0.0f, 0.0f, 0.0f); + (this.C4 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C4.setRotationPoint(4.0f, 20.0f, 4.0f); + this.C4.setTextureSize(128, 128); + this.C4.mirror = true; + this.setRotation(this.C4, 0.0f, 0.0f, 0.0f); + (this.T1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T1.setRotationPoint(-7.0f, 21.0f, -7.0f); + this.T1.setTextureSize(128, 128); + this.T1.mirror = true; + this.setRotation(this.T1, 0.0f, 0.0f, 0.0f); + (this.T2 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T2.setRotationPoint(-7.0f, 21.0f, 3.0f); + this.T2.setTextureSize(128, 128); + this.T2.mirror = true; + this.setRotation(this.T2, 0.0f, 0.0f, 0.0f); + (this.T3 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T3.setRotationPoint(3.0f, 21.0f, -7.0f); + this.T3.setTextureSize(128, 128); + this.T3.mirror = true; + this.setRotation(this.T3, 0.0f, 0.0f, 0.0f); + (this.T4 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T4.setRotationPoint(3.0f, 21.0f, 3.0f); + this.T4.setTextureSize(128, 128); + this.T4.mirror = true; + this.setRotation(this.T4, 0.0f, 0.0f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 43, 15)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 12, 12); + this.WING_1A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, -0.7853982f, 0.0f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 43, 0)) + .addBox(0.0f, 0.0f, -1.0f, 12, 12, 2); + this.WING_2A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, 0.0f, 0.7853982f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 72, 28)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 25, 16); + this.WING_1B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, 0.0f, 0.0f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 25, 2); + this.WING_2B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, 0.0f, 0.0f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 34, 55)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 10, 16); + this.WING_3A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.0f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 34, 82)) + .addBox(-1.0f, -6.0f, -6.0f, 2, 12, 12); + this.WING_3B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, 0.7853982f, 0.0f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 34, 41)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 10, 2); + this.WING_4B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, 0.0f, 0.0f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 34, 107)) + .addBox(-6.0f, -6.0f, -1.0f, 12, 12, 2); + this.WING_4A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, 0.0f, -0.7853982f); + (this.TOP = new ModelRenderer((ModelBase)this, 72, 70)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.TOP.setRotationPoint(-5.0f, -64.0f, -5.0f); + this.TOP.setTextureSize(128, 128); + this.TOP.mirror = true; + this.setRotation(this.TOP, 0.0f, 0.0f, 0.0f); + (this.Shape1 = new ModelRenderer((ModelBase)this, 98, 92)) + .addBox(0.0f, 0.0f, 0.0f, 2, 15, 2); + this.Shape1.setRotationPoint(-1.0f, -79.0f, -1.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape1a = new ModelRenderer((ModelBase)this, 65, 92)) + .addBox(0.0f, 0.0f, 0.0f, 1, 14, 6); + this.Shape1a.setRotationPoint(2.0f, -77.0f, -3.0f); + this.Shape1a.setTextureSize(128, 128); + this.Shape1a.mirror = true; + this.setRotation(this.Shape1a, 0.0f, 0.0f, -0.1396263f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 81, 92)) + .addBox(0.0f, 0.0f, 0.0f, 6, 14, 1); + this.Shape2b.setRotationPoint(-3.0f, -77.0f, 2.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.1396263f, 0.0f, 0.0f); + (this.Shape1c = new ModelRenderer((ModelBase)this, 65, 92)) + .addBox(0.0f, 0.0f, 0.0f, 1, 14, 6); + this.Shape1c.setRotationPoint(-3.0f, -77.0f, -3.0f); + this.Shape1c.setTextureSize(128, 128); + this.Shape1c.mirror = true; + this.setRotation(this.Shape1c, 0.0f, 0.0f, 0.1396263f); + (this.Shape1d = new ModelRenderer((ModelBase)this, 81, 92)) + .addBox(0.0f, 0.0f, 0.0f, 6, 14, 1); + this.Shape1d.setRotationPoint(-3.0f, -77.0f, -3.0f); + this.Shape1d.setTextureSize(128, 128); + this.Shape1d.mirror = true; + this.setRotation(this.Shape1d, -0.1396263f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE_1.render(f5); + this.MOTOR_MODULE_2.render(f5); + this.MOTOR_MODULE_3.render(f5); + this.MOTOR_MODULE_4.render(f5); + this.C1.render(f5); + this.C2.render(f5); + this.C3.render(f5); + this.C4.render(f5); + this.T1.render(f5); + this.T2.render(f5); + this.T3.render(f5); + this.T4.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_1B.render(f5); + this.WING_2B.render(f5); + this.WING_3A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_4A.render(f5); + this.TOP.render(f5); + this.Shape1.render(f5); + this.Shape1a.render(f5); + this.Shape2b.render(f5); + this.Shape1c.render(f5); + this.Shape1d.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMTuPuo.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMTuPuo.java new file mode 100644 index 0000000..71c92f8 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMTuPuo.java @@ -0,0 +1,228 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMTuPuo extends MICBM { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape2b; + ModelRenderer Shape2c; + ModelRenderer Shape2d; + ModelRenderer Shape3; + ModelRenderer Shape3a; + ModelRenderer Shape3b; + ModelRenderer Shape3c; + ModelRenderer Shape4; + ModelRenderer Shape4a; + ModelRenderer Shape4b; + ModelRenderer Shape4c; + ModelRenderer Shape5; + ModelRenderer Shape5a; + ModelRenderer Shape4d; + ModelRenderer Shape4e; + ModelRenderer Shape4f; + ModelRenderer Shape4g; + ModelRenderer Shape6; + ModelRenderer Shape6a; + ModelRenderer Shape7; + ModelRenderer Shape7a; + ModelRenderer Shape7b; + + public MMTuPuo() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 64, 8); + this.Shape1.setRotationPoint(0.0f, -40.0f, 0.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2.setRotationPoint(-7.0f, 14.0f, 6.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape2b = new ModelRenderer((ModelBase)this, 34, 19)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 1); + this.Shape2b.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Shape2b.setTextureSize(128, 128); + this.Shape2b.mirror = true; + this.setRotation(this.Shape2b, 0.0f, 0.0f, 0.0f); + (this.Shape2c = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2c.setRotationPoint(-7.0f, 14.0f, -6.0f); + this.Shape2c.setTextureSize(128, 128); + this.Shape2c.mirror = true; + this.setRotation(this.Shape2c, 0.0f, 0.0f, 0.0f); + (this.Shape2d = new ModelRenderer((ModelBase)this, 34, 31)) + .addBox(0.0f, 0.0f, 0.0f, 1, 10, 12); + this.Shape2d.setRotationPoint(6.0f, 14.0f, -6.0f); + this.Shape2d.setTextureSize(128, 128); + this.Shape2d.mirror = true; + this.setRotation(this.Shape2d, 0.0f, 0.0f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.7853982f, 0.0f); + (this.Shape3a = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-11.0f, 0.0f, -1.0f, 22, 12, 2); + this.Shape3a.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3a.setTextureSize(128, 128); + this.Shape3a.mirror = true; + this.setRotation(this.Shape3a, 0.0f, -0.7853982f, 0.0f); + (this.Shape3b = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3b.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3b.setTextureSize(128, 128); + this.Shape3b.mirror = true; + this.setRotation(this.Shape3b, 0.0f, 0.7853982f, 0.7853982f); + (this.Shape3c = new ModelRenderer((ModelBase)this, 34, 0)) + .addBox(-8.0f, -8.0f, -1.0f, 16, 16, 2); + this.Shape3c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.Shape3c.setTextureSize(128, 128); + this.Shape3c.mirror = true; + this.setRotation(this.Shape3c, 0.0f, -0.7853982f, 0.7853982f); + (this.Shape4 = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(0.0f, 0.0f, 0.0f, 2, 7, 5); + this.Shape4.setRotationPoint(-1.0f, -23.0f, 4.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, -0.5235988f, 0.0f, 0.0f); + (this.Shape4a = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, 0.0f, 5, 8, 2); + this.Shape4a.setRotationPoint(4.0f, -23.0f, -1.0f); + this.Shape4a.setTextureSize(128, 128); + this.Shape4a.mirror = true; + this.setRotation(this.Shape4a, 0.0f, 0.0f, 0.5235988f); + (this.Shape4b = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4b.setRotationPoint(0.0f, -35.0f, -4.0f); + this.Shape4b.setTextureSize(128, 128); + this.Shape4b.mirror = true; + this.setRotation(this.Shape4b, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4c = new ModelRenderer((ModelBase)this, 0, 103)) + .addBox(0.0f, 0.0f, -1.0f, 5, 8, 2); + this.Shape4c.setRotationPoint(-4.0f, -23.0f, 0.0f); + this.Shape4c.setTextureSize(128, 128); + this.Shape4c.mirror = true; + this.setRotation(this.Shape4c, 0.0f, 3.141593f, 0.5235988f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.0f, 0.0f, 0.0f); + (this.Shape5a = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 12, 16); + this.Shape5a.setRotationPoint(0.0f, -32.0f, 0.0f); + this.Shape5a.setTextureSize(128, 128); + this.Shape5a.mirror = true; + this.setRotation(this.Shape5a, 0.0f, 1.570796f, 0.0f); + (this.Shape4d = new ModelRenderer((ModelBase)this, 22, 74)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 8, 5); + this.Shape4d.setRotationPoint(0.0f, -23.0f, -4.0f); + this.Shape4d.setTextureSize(128, 128); + this.Shape4d.mirror = true; + this.setRotation(this.Shape4d, -0.5235988f, 3.141593f, 0.0f); + (this.Shape4e = new ModelRenderer((ModelBase)this, 0, 81)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 5); + this.Shape4e.setRotationPoint(0.0f, -35.0f, 4.0f); + this.Shape4e.setTextureSize(128, 128); + this.Shape4e.mirror = true; + this.setRotation(this.Shape4e, -0.5235988f, 0.0f, 0.0f); + (this.Shape4f = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, -1.0f, 5, 4, 2); + this.Shape4f.setRotationPoint(-4.0f, -35.0f, 0.0f); + this.Shape4f.setTextureSize(128, 128); + this.Shape4f.mirror = true; + this.setRotation(this.Shape4f, 0.0f, 3.141593f, 0.5235988f); + (this.Shape4g = new ModelRenderer((ModelBase)this, 0, 74)) + .addBox(0.0f, 0.0f, 0.0f, 5, 4, 2); + this.Shape4g.setRotationPoint(4.0f, -35.0f, -1.0f); + this.Shape4g.setTextureSize(128, 128); + this.Shape4g.mirror = true; + this.setRotation(this.Shape4g, 0.0f, 0.0f, 0.5235988f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6.setRotationPoint(-5.0f, -37.0f, -5.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape6a = new ModelRenderer((ModelBase)this, 72, 16)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 10); + this.Shape6a.setRotationPoint(-5.0f, -41.0f, -5.0f); + this.Shape6a.setTextureSize(128, 128); + this.Shape6a.mirror = true; + this.setRotation(this.Shape6a, 0.0f, 0.0f, 0.0f); + (this.Shape7 = new ModelRenderer((ModelBase)this, 96, 115)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Shape7.setRotationPoint(-4.0f, -45.0f, -4.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape7a = new ModelRenderer((ModelBase)this, 79, 109)) + .addBox(0.0f, 0.0f, 0.0f, 4, 14, 4); + this.Shape7a.setRotationPoint(-2.0f, -59.0f, -2.0f); + this.Shape7a.setTextureSize(128, 128); + this.Shape7a.mirror = true; + this.setRotation(this.Shape7a, 0.0f, 0.0f, 0.0f); + (this.Shape7b = new ModelRenderer((ModelBase)this, 96, 110)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 2); + this.Shape7b.setRotationPoint(-1.0f, -61.0f, -1.0f); + this.Shape7b.setTextureSize(128, 128); + this.Shape7b.mirror = true; + this.setRotation(this.Shape7b, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape2.render(f5); + this.Shape2b.render(f5); + this.Shape2c.render(f5); + this.Shape2d.render(f5); + this.Shape3.render(f5); + this.Shape3a.render(f5); + this.Shape3b.render(f5); + this.Shape3c.render(f5); + this.Shape4.render(f5); + this.Shape4a.render(f5); + this.Shape4b.render(f5); + this.Shape4c.render(f5); + this.Shape5.render(f5); + this.Shape5a.render(f5); + this.Shape4d.render(f5); + this.Shape4e.render(f5); + this.Shape4f.render(f5); + this.Shape4g.render(f5); + this.Shape6.render(f5); + this.Shape6a.render(f5); + this.Shape7.render(f5); + this.Shape7a.render(f5); + this.Shape7b.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMTui.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMTui.java new file mode 100644 index 0000000..09cbdd7 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMTui.java @@ -0,0 +1,164 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMTui extends MICBM { + ModelRenderer a; + ModelRenderer b; + ModelRenderer c; + ModelRenderer d; + ModelRenderer e; + ModelRenderer f; + ModelRenderer g; + ModelRenderer h; + ModelRenderer i; + ModelRenderer j; + ModelRenderer k; + ModelRenderer l; + ModelRenderer m; + ModelRenderer n; + ModelRenderer o; + ModelRenderer p; + + public MMTui() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.a = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.a.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.a.setTextureSize(128, 128); + this.a.mirror = true; + this.setRotation(this.a, 0.0f, 0.0f, 0.0f); + (this.b = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.b.setRotationPoint(0.0f, 8.0f, 0.0f); + this.b.setTextureSize(128, 128); + this.b.mirror = true; + this.setRotation(this.b, 0.0f, 0.7853982f, 0.0f); + (this.c = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.c.setRotationPoint(0.0f, 12.0f, 0.0f); + this.c.setTextureSize(128, 128); + this.c.mirror = true; + this.setRotation(this.c, 0.0f, 0.7853982f, 0.0f); + (this.d = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.d.setRotationPoint(0.0f, 12.0f, 0.0f); + this.d.setTextureSize(128, 128); + this.d.mirror = true; + this.setRotation(this.d, 0.0f, -0.7853982f, 0.0f); + (this.e = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.e.setRotationPoint(0.0f, -24.0f, 0.0f); + this.e.setTextureSize(128, 128); + this.e.mirror = true; + this.setRotation(this.e, -0.7853982f, 0.7853982f, 0.0f); + (this.f = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.f.setRotationPoint(0.0f, -24.0f, 0.0f); + this.f.setTextureSize(128, 128); + this.f.mirror = true; + this.setRotation(this.f, -0.7853982f, -0.7853982f, 0.0f); + (this.g = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.g.setRotationPoint(0.0f, -17.0f, 0.0f); + this.g.setTextureSize(128, 128); + this.g.mirror = true; + this.setRotation(this.g, 0.0f, 0.7853982f, 0.0f); + (this.h = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.h.setRotationPoint(0.0f, -17.0f, 0.0f); + this.h.setTextureSize(128, 128); + this.h.mirror = true; + this.setRotation(this.h, 0.0f, -0.7853982f, 0.0f); + (this.i = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.i.setRotationPoint(0.0f, 3.0f, 0.0f); + this.i.setTextureSize(128, 128); + this.i.mirror = true; + this.setRotation(this.i, -0.7853982f, -0.7853982f, 0.0f); + (this.j = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.j.setRotationPoint(0.0f, 3.0f, 0.0f); + this.j.setTextureSize(128, 128); + this.j.mirror = true; + this.setRotation(this.j, -0.7853982f, 0.7853982f, 0.0f); + (this.k = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.k.setRotationPoint(0.0f, -29.0f, 0.0f); + this.k.setTextureSize(128, 128); + this.k.mirror = true; + this.setRotation(this.k, 0.0f, 0.0f, 0.0f); + (this.l = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.l.setRotationPoint(0.0f, -29.0f, 0.0f); + this.l.setTextureSize(128, 128); + this.l.mirror = true; + this.setRotation(this.l, 0.0f, 1.570796f, 0.0f); + (this.m = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.m.setRotationPoint(0.0f, -29.0f, 0.0f); + this.m.setTextureSize(128, 128); + this.m.mirror = true; + this.setRotation(this.m, 0.0f, 3.141593f, 0.0f); + (this.n = new ModelRenderer((ModelBase)this, 0, 86)) + .addBox(2.0f, 0.0f, 2.0f, 2, 8, 2); + this.n.setRotationPoint(0.0f, -29.0f, 0.0f); + this.n.setTextureSize(128, 128); + this.n.mirror = true; + this.setRotation(this.n, 0.0f, -1.570796f, 0.0f); + (this.o = new ModelRenderer((ModelBase)this, 10, 86)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 6, 4); + this.o.setRotationPoint(0.0f, -32.0f, 0.0f); + this.o.setTextureSize(128, 128); + this.o.mirror = true; + this.setRotation(this.o, 0.0f, 0.0f, 0.0f); + (this.p = new ModelRenderer((ModelBase)this, 28, 86)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 6, 2); + this.p.setRotationPoint(0.0f, -38.0f, 0.0f); + this.p.setTextureSize(128, 128); + this.p.mirror = true; + this.setRotation(this.p, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float x, final float y, + final float z, final float f3, final float f4, + final float f5) { + super.render(entity, x, y, z, f3, f4, f5); + this.setRotationAngles(x, y, z, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.a.render(f5); + this.b.render(f5); + this.c.render(f5); + this.d.render(f5); + this.e.render(f5); + this.f.render(f5); + this.g.render(f5); + this.h.render(f5); + this.i.render(f5); + this.j.render(f5); + this.k.render(f5); + this.l.render(f5); + this.m.render(f5); + this.n.render(f5); + this.o.render(f5); + this.p.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMWan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMWan.java new file mode 100644 index 0000000..6f9f0a3 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMWan.java @@ -0,0 +1,300 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMWan extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE_1; + ModelRenderer MOTOR_MODULE_2; + ModelRenderer MOTOR_MODULE_3; + ModelRenderer MOTOR_MODULE_4; + ModelRenderer C1; + ModelRenderer C2; + ModelRenderer C3; + ModelRenderer C4; + ModelRenderer T1; + ModelRenderer T2; + ModelRenderer T3; + ModelRenderer T4; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_1B; + ModelRenderer WING_2B; + ModelRenderer WING_3A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_4A; + ModelRenderer TOP; + ModelRenderer TOP_WINGS_1; + ModelRenderer TOP_WINGS_2; + ModelRenderer TOP_SUPPORT_1; + ModelRenderer TOP_SUPPORT_2; + ModelRenderer TOP_SUPPORT_3; + ModelRenderer TOP_SUPPORT_4; + ModelRenderer TOP_WINGS_A; + ModelRenderer TOP_WINGS_B; + ModelRenderer TOP_WINGS_C; + ModelRenderer TOP_WINGS_D; + ModelRenderer PORTAL_CORE_ROT; + + public MMWan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 70, 8); + this.MAIN_MODULE.setRotationPoint(-4.0f, -63.0f, -4.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_1 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_1.setRotationPoint(-8.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_1.setTextureSize(128, 128); + this.MOTOR_MODULE_1.mirror = true; + this.setRotation(this.MOTOR_MODULE_1, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_2 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_2.setRotationPoint(-8.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_2.setTextureSize(128, 128); + this.MOTOR_MODULE_2.mirror = true; + this.setRotation(this.MOTOR_MODULE_2, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_3 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_3.setRotationPoint(2.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_3.setTextureSize(128, 128); + this.MOTOR_MODULE_3.mirror = true; + this.setRotation(this.MOTOR_MODULE_3, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_4 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_4.setRotationPoint(2.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_4.setTextureSize(128, 128); + this.MOTOR_MODULE_4.mirror = true; + this.setRotation(this.MOTOR_MODULE_4, 0.0f, 0.0f, 0.0f); + (this.C1 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C1.setRotationPoint(-6.0f, 20.0f, -6.0f); + this.C1.setTextureSize(128, 128); + this.C1.mirror = true; + this.setRotation(this.C1, 0.0f, 0.0f, 0.0f); + (this.C2 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C2.setRotationPoint(-6.0f, 20.0f, 4.0f); + this.C2.setTextureSize(128, 128); + this.C2.mirror = true; + this.setRotation(this.C2, 0.0f, 0.0f, 0.0f); + (this.C3 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C3.setRotationPoint(4.0f, 20.0f, -6.0f); + this.C3.setTextureSize(128, 128); + this.C3.mirror = true; + this.setRotation(this.C3, 0.0f, 0.0f, 0.0f); + (this.C4 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C4.setRotationPoint(4.0f, 20.0f, 4.0f); + this.C4.setTextureSize(128, 128); + this.C4.mirror = true; + this.setRotation(this.C4, 0.0f, 0.0f, 0.0f); + (this.T1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T1.setRotationPoint(-7.0f, 21.0f, -7.0f); + this.T1.setTextureSize(128, 128); + this.T1.mirror = true; + this.setRotation(this.T1, 0.0f, 0.0f, 0.0f); + (this.T2 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T2.setRotationPoint(-7.0f, 21.0f, 3.0f); + this.T2.setTextureSize(128, 128); + this.T2.mirror = true; + this.setRotation(this.T2, 0.0f, 0.0f, 0.0f); + (this.T3 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T3.setRotationPoint(3.0f, 21.0f, -7.0f); + this.T3.setTextureSize(128, 128); + this.T3.mirror = true; + this.setRotation(this.T3, 0.0f, 0.0f, 0.0f); + (this.T4 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T4.setRotationPoint(3.0f, 21.0f, 3.0f); + this.T4.setTextureSize(128, 128); + this.T4.mirror = true; + this.setRotation(this.T4, 0.0f, 0.0f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 43, 15)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 12, 12); + this.WING_1A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, -0.7853982f, 0.0f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 43, 0)) + .addBox(0.0f, 0.0f, -1.0f, 12, 12, 2); + this.WING_2A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, 0.0f, 0.7853982f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 72, 28)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 25, 16); + this.WING_1B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, 0.0f, 0.0f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 25, 2); + this.WING_2B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, 0.0f, 0.0f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 34, 55)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 10, 16); + this.WING_3A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.0f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 34, 82)) + .addBox(-1.0f, -6.0f, -6.0f, 2, 12, 12); + this.WING_3B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, 0.7853982f, 0.0f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 34, 41)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 10, 2); + this.WING_4B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, 0.0f, 0.0f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 34, 107)) + .addBox(-6.0f, -6.0f, -1.0f, 12, 12, 2); + this.WING_4A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, 0.0f, -0.7853982f); + (this.TOP = new ModelRenderer((ModelBase)this, 72, 70)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.TOP.setRotationPoint(-5.0f, -64.0f, -5.0f); + this.TOP.setTextureSize(128, 128); + this.TOP.mirror = true; + this.setRotation(this.TOP, 0.0f, 0.0f, 0.0f); + (this.TOP_WINGS_1 = new ModelRenderer((ModelBase)this, 87, 92)) + .addBox(0.0f, 0.0f, 0.0f, 14, 12, 2); + this.TOP_WINGS_1.setRotationPoint(-7.0f, -64.0f, -1.0f); + this.TOP_WINGS_1.setTextureSize(128, 128); + this.TOP_WINGS_1.mirror = true; + this.setRotation(this.TOP_WINGS_1, 0.0f, 0.0f, 0.0f); + (this.TOP_WINGS_2 = new ModelRenderer((ModelBase)this, 65, 101)) + .addBox(0.0f, 0.0f, 0.0f, 2, 12, 14); + this.TOP_WINGS_2.setRotationPoint(-1.0f, -64.0f, -7.0f); + this.TOP_WINGS_2.setTextureSize(128, 128); + this.TOP_WINGS_2.mirror = true; + this.setRotation(this.TOP_WINGS_2, 0.0f, 0.0f, 0.0f); + (this.TOP_SUPPORT_1 = new ModelRenderer((ModelBase)this, 74, 91)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.TOP_SUPPORT_1.setRotationPoint(-5.0f, -70.0f, -1.0f); + this.TOP_SUPPORT_1.setTextureSize(128, 128); + this.TOP_SUPPORT_1.mirror = true; + this.setRotation(this.TOP_SUPPORT_1, 0.0f, 0.0f, 0.0f); + (this.TOP_SUPPORT_2 = new ModelRenderer((ModelBase)this, 74, 91)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.TOP_SUPPORT_2.setRotationPoint(-1.0f, -70.0f, 3.0f); + this.TOP_SUPPORT_2.setTextureSize(128, 128); + this.TOP_SUPPORT_2.mirror = true; + this.setRotation(this.TOP_SUPPORT_2, 0.0f, 0.0f, 0.0f); + (this.TOP_SUPPORT_3 = new ModelRenderer((ModelBase)this, 74, 91)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.TOP_SUPPORT_3.setRotationPoint(3.0f, -70.0f, -1.0f); + this.TOP_SUPPORT_3.setTextureSize(128, 128); + this.TOP_SUPPORT_3.mirror = true; + this.setRotation(this.TOP_SUPPORT_3, 0.0f, 0.0f, 0.0f); + (this.TOP_SUPPORT_4 = new ModelRenderer((ModelBase)this, 74, 91)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.TOP_SUPPORT_4.setRotationPoint(-1.0f, -70.0f, -5.0f); + this.TOP_SUPPORT_4.setTextureSize(128, 128); + this.TOP_SUPPORT_4.mirror = true; + this.setRotation(this.TOP_SUPPORT_4, 0.0f, 0.0f, 0.0f); + (this.TOP_WINGS_A = new ModelRenderer((ModelBase)this, 64, 91)) + .addBox(0.0f, 0.0f, 0.0f, 2, 3, 2); + this.TOP_WINGS_A.setRotationPoint(-5.0f, -66.0f, -1.0f); + this.TOP_WINGS_A.setTextureSize(128, 128); + this.TOP_WINGS_A.mirror = true; + this.setRotation(this.TOP_WINGS_A, 0.0f, 0.0f, 0.7853982f); + (this.TOP_WINGS_B = new ModelRenderer((ModelBase)this, 64, 91)) + .addBox(0.0f, 0.0f, -2.0f, 2, 3, 2); + this.TOP_WINGS_B.setRotationPoint(-1.0f, -66.0f, 5.0f); + this.TOP_WINGS_B.setTextureSize(128, 128); + this.TOP_WINGS_B.mirror = true; + this.setRotation(this.TOP_WINGS_B, 0.7853982f, 0.0f, 0.0f); + (this.TOP_WINGS_C = new ModelRenderer((ModelBase)this, 64, 91)) + .addBox(-2.0f, 0.0f, 0.0f, 2, 3, 2); + this.TOP_WINGS_C.setRotationPoint(5.0f, -66.0f, -1.0f); + this.TOP_WINGS_C.setTextureSize(128, 128); + this.TOP_WINGS_C.mirror = true; + this.setRotation(this.TOP_WINGS_C, 0.0f, 0.0f, -0.7853982f); + (this.TOP_WINGS_D = new ModelRenderer((ModelBase)this, 64, 91)) + .addBox(0.0f, 0.0f, 0.0f, 2, 3, 2); + this.TOP_WINGS_D.setRotationPoint(-1.0f, -66.0f, -5.0f); + this.TOP_WINGS_D.setTextureSize(128, 128); + this.TOP_WINGS_D.mirror = true; + this.setRotation(this.TOP_WINGS_D, -0.7853982f, 0.0f, 0.0f); + (this.PORTAL_CORE_ROT = new ModelRenderer((ModelBase)this, 99, 107)) + .addBox(-3.0f, -3.0f, -3.0f, 6, 6, 6); + this.PORTAL_CORE_ROT.setRotationPoint(0.0f, -74.0f, 0.0f); + this.PORTAL_CORE_ROT.setTextureSize(128, 128); + this.PORTAL_CORE_ROT.mirror = true; + this.setRotation(this.PORTAL_CORE_ROT, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE_1.render(f5); + this.MOTOR_MODULE_2.render(f5); + this.MOTOR_MODULE_3.render(f5); + this.MOTOR_MODULE_4.render(f5); + this.C1.render(f5); + this.C2.render(f5); + this.C3.render(f5); + this.C4.render(f5); + this.T1.render(f5); + this.T2.render(f5); + this.T3.render(f5); + this.T4.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_1B.render(f5); + this.WING_2B.render(f5); + this.WING_3A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_4A.render(f5); + this.TOP.render(f5); + this.TOP_WINGS_1.render(f5); + this.TOP_WINGS_2.render(f5); + this.TOP_SUPPORT_1.render(f5); + this.TOP_SUPPORT_2.render(f5); + this.TOP_SUPPORT_3.render(f5); + this.TOP_SUPPORT_4.render(f5); + this.TOP_WINGS_A.render(f5); + this.TOP_WINGS_B.render(f5); + this.TOP_WINGS_C.render(f5); + this.TOP_WINGS_D.render(f5); + this.PORTAL_CORE_ROT.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMXiaoQunDan.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMXiaoQunDan.java new file mode 100644 index 0000000..dc6242b --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMXiaoQunDan.java @@ -0,0 +1,164 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMXiaoQunDan extends MICBM { + ModelRenderer MAIN_MISSILE_MODULE; + ModelRenderer MOTOR_MODULE; + ModelRenderer WING_B_A_1; + ModelRenderer WING_B_B_1; + ModelRenderer WING_T_A_1; + ModelRenderer WING_T_B_1; + ModelRenderer WING_T_A_2; + ModelRenderer WING_T_B_2; + ModelRenderer WING_B_B_2; + ModelRenderer WING_B_A_2; + ModelRenderer WARHEAD_1; + ModelRenderer WARHEAD_2; + ModelRenderer SHRAPNEL_PIECE_1; + ModelRenderer SHRAPNEL_PIECE_2; + ModelRenderer SHRAPNEL_PIECE_3; + ModelRenderer SHRAPNEL_PIECE_4; + + public MMXiaoQunDan() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MISSILE_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.MAIN_MISSILE_MODULE.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.MAIN_MISSILE_MODULE.setTextureSize(128, 128); + this.MAIN_MISSILE_MODULE.mirror = true; + this.setRotation(this.MAIN_MISSILE_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.MOTOR_MODULE.setRotationPoint(0.0f, 8.0f, 0.0f); + this.MOTOR_MODULE.setTextureSize(128, 128); + this.MOTOR_MODULE.mirror = true; + this.setRotation(this.MOTOR_MODULE, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_A_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_A_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_A_1.setTextureSize(128, 128); + this.WING_B_A_1.mirror = true; + this.setRotation(this.WING_B_A_1, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_B_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_B_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_B_1.setTextureSize(128, 128); + this.WING_B_B_1.mirror = true; + this.setRotation(this.WING_B_B_1, 0.0f, -0.7853982f, 0.0f); + (this.WING_T_A_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_A_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_A_1.setTextureSize(128, 128); + this.WING_T_A_1.mirror = true; + this.setRotation(this.WING_T_A_1, -0.7853982f, 0.7853982f, 0.0f); + (this.WING_T_B_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_B_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_B_1.setTextureSize(128, 128); + this.WING_T_B_1.mirror = true; + this.setRotation(this.WING_T_B_1, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_T_A_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_A_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_A_2.setTextureSize(128, 128); + this.WING_T_A_2.mirror = true; + this.setRotation(this.WING_T_A_2, 0.0f, 0.7853982f, 0.0f); + (this.WING_T_B_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_B_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_B_2.setTextureSize(128, 128); + this.WING_T_B_2.mirror = true; + this.setRotation(this.WING_T_B_2, 0.0f, -0.7853982f, 0.0f); + (this.WING_B_B_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_B_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_B_2.setTextureSize(128, 128); + this.WING_B_B_2.mirror = true; + this.setRotation(this.WING_B_B_2, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_B_A_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_A_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_A_2.setTextureSize(128, 128); + this.WING_B_A_2.mirror = true; + this.setRotation(this.WING_B_A_2, -0.7853982f, 0.7853982f, 0.0f); + (this.WARHEAD_1 = new ModelRenderer((ModelBase)this, 0, 87)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.WARHEAD_1.setRotationPoint(-4.0f, -30.0f, -4.0f); + this.WARHEAD_1.setTextureSize(128, 128); + this.WARHEAD_1.mirror = true; + this.setRotation(this.WARHEAD_1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_2 = new ModelRenderer((ModelBase)this, 0, 101)) + .addBox(0.0f, 0.0f, 0.0f, 6, 4, 6); + this.WARHEAD_2.setRotationPoint(-3.0f, -34.0f, -3.0f); + this.WARHEAD_2.setTextureSize(128, 128); + this.WARHEAD_2.mirror = true; + this.setRotation(this.WARHEAD_2, 0.0f, 0.0f, 0.0f); + (this.SHRAPNEL_PIECE_1 = new ModelRenderer((ModelBase)this, 0, 112)) + .addBox(0.0f, 0.0f, 0.0f, 10, 2, 2); + this.SHRAPNEL_PIECE_1.setRotationPoint(-5.0f, -29.0f, -1.0f); + this.SHRAPNEL_PIECE_1.setTextureSize(128, 128); + this.SHRAPNEL_PIECE_1.mirror = true; + this.setRotation(this.SHRAPNEL_PIECE_1, 0.0f, 0.0f, 0.0f); + (this.SHRAPNEL_PIECE_2 = new ModelRenderer((ModelBase)this, 27, 112)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 10); + this.SHRAPNEL_PIECE_2.setRotationPoint(-1.0f, -29.0f, -5.0f); + this.SHRAPNEL_PIECE_2.setTextureSize(128, 128); + this.SHRAPNEL_PIECE_2.mirror = true; + this.setRotation(this.SHRAPNEL_PIECE_2, 0.0f, 0.0f, 0.0f); + (this.SHRAPNEL_PIECE_3 = new ModelRenderer((ModelBase)this, 0, 119)) + .addBox(0.0f, 0.0f, 0.0f, 8, 2, 2); + this.SHRAPNEL_PIECE_3.setRotationPoint(-4.0f, -33.0f, -1.0f); + this.SHRAPNEL_PIECE_3.setTextureSize(128, 128); + this.SHRAPNEL_PIECE_3.mirror = true; + this.setRotation(this.SHRAPNEL_PIECE_3, 0.0f, 0.0f, 0.0f); + (this.SHRAPNEL_PIECE_4 = new ModelRenderer((ModelBase)this, 53, 112)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 8); + this.SHRAPNEL_PIECE_4.setRotationPoint(-1.0f, -33.0f, -4.0f); + this.SHRAPNEL_PIECE_4.setTextureSize(128, 128); + this.SHRAPNEL_PIECE_4.mirror = true; + this.setRotation(this.SHRAPNEL_PIECE_4, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MISSILE_MODULE.render(f5); + this.MOTOR_MODULE.render(f5); + this.WING_B_A_1.render(f5); + this.WING_B_B_1.render(f5); + this.WING_T_A_1.render(f5); + this.WING_T_B_1.render(f5); + this.WING_T_A_2.render(f5); + this.WING_T_B_2.render(f5); + this.WING_B_B_2.render(f5); + this.WING_B_A_2.render(f5); + this.WARHEAD_1.render(f5); + this.WARHEAD_2.render(f5); + this.SHRAPNEL_PIECE_1.render(f5); + this.SHRAPNEL_PIECE_2.render(f5); + this.SHRAPNEL_PIECE_3.render(f5); + this.SHRAPNEL_PIECE_4.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMYaSuo.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMYaSuo.java new file mode 100644 index 0000000..9ecc52f --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMYaSuo.java @@ -0,0 +1,148 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMYaSuo extends MICBM { + ModelRenderer MAIN_MISSILE_MODULE; + ModelRenderer PROPULSOR_MODULE; + ModelRenderer WING_B_A_1; + ModelRenderer WING_B_B_1; + ModelRenderer WING_T_A_1; + ModelRenderer WING_T_B_1; + ModelRenderer WING_T_A_2; + ModelRenderer WING_T_B_2; + ModelRenderer WING_B_B_2; + ModelRenderer WING_B_A_2; + ModelRenderer WARHEAD_1; + ModelRenderer WARHEAD_2; + ModelRenderer WARHEAD_3; + ModelRenderer WARHEAD_4; + + public MMYaSuo() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MISSILE_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.MAIN_MISSILE_MODULE.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.MAIN_MISSILE_MODULE.setTextureSize(128, 128); + this.MAIN_MISSILE_MODULE.mirror = true; + this.setRotation(this.MAIN_MISSILE_MODULE, 0.0f, 0.0f, 0.0f); + (this.PROPULSOR_MODULE = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.PROPULSOR_MODULE.setRotationPoint(0.0f, 8.0f, 0.0f); + this.PROPULSOR_MODULE.setTextureSize(128, 128); + this.PROPULSOR_MODULE.mirror = true; + this.setRotation(this.PROPULSOR_MODULE, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_A_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_A_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_A_1.setTextureSize(128, 128); + this.WING_B_A_1.mirror = true; + this.setRotation(this.WING_B_A_1, 0.0f, 0.7853982f, 0.0f); + (this.WING_B_B_1 = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_B_B_1.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_B_B_1.setTextureSize(128, 128); + this.WING_B_B_1.mirror = true; + this.setRotation(this.WING_B_B_1, 0.0f, -0.7853982f, 0.0f); + (this.WING_T_A_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_A_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_A_1.setTextureSize(128, 128); + this.WING_T_A_1.mirror = true; + this.setRotation(this.WING_T_A_1, -0.7853982f, 0.7853982f, 0.0f); + (this.WING_T_B_1 = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_T_B_1.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_T_B_1.setTextureSize(128, 128); + this.WING_T_B_1.mirror = true; + this.setRotation(this.WING_T_B_1, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_T_A_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_A_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_A_2.setTextureSize(128, 128); + this.WING_T_A_2.mirror = true; + this.setRotation(this.WING_T_A_2, 0.0f, 0.7853982f, 0.0f); + (this.WING_T_B_2 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_T_B_2.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_T_B_2.setTextureSize(128, 128); + this.WING_T_B_2.mirror = true; + this.setRotation(this.WING_T_B_2, 0.0f, -0.7853982f, 0.0f); + (this.WING_B_B_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_B_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_B_2.setTextureSize(128, 128); + this.WING_B_B_2.mirror = true; + this.setRotation(this.WING_B_B_2, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_B_A_2 = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_B_A_2.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_B_A_2.setTextureSize(128, 128); + this.WING_B_A_2.mirror = true; + this.setRotation(this.WING_B_A_2, -0.7853982f, 0.7853982f, 0.0f); + (this.WARHEAD_1 = new ModelRenderer((ModelBase)this, 0, 85)) + .addBox(-4.0f, 0.0f, -4.0f, 8, 4, 8); + this.WARHEAD_1.setRotationPoint(0.0f, -27.0f, 0.0f); + this.WARHEAD_1.setTextureSize(128, 128); + this.WARHEAD_1.mirror = true; + this.setRotation(this.WARHEAD_1, 0.0f, 0.7853982f, 0.0f); + (this.WARHEAD_2 = new ModelRenderer((ModelBase)this, 33, 85)) + .addBox(-3.0f, 0.0f, -3.0f, 6, 2, 6); + this.WARHEAD_2.setRotationPoint(0.0f, -29.0f, 0.0f); + this.WARHEAD_2.setTextureSize(128, 128); + this.WARHEAD_2.mirror = true; + this.setRotation(this.WARHEAD_2, 0.0f, 0.7853982f, 0.0f); + (this.WARHEAD_3 = new ModelRenderer((ModelBase)this, 59, 85)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 2, 4); + this.WARHEAD_3.setRotationPoint(0.0f, -31.0f, 0.0f); + this.WARHEAD_3.setTextureSize(128, 128); + this.WARHEAD_3.mirror = true; + this.setRotation(this.WARHEAD_3, 0.0f, 0.7853982f, 0.0f); + (this.WARHEAD_4 = new ModelRenderer((ModelBase)this, 9, 87)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 1, 2); + this.WARHEAD_4.setRotationPoint(0.0f, -32.0f, 0.0f); + this.WARHEAD_4.setTextureSize(128, 128); + this.WARHEAD_4.mirror = true; + this.setRotation(this.WARHEAD_4, 0.0f, 0.7853982f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MISSILE_MODULE.render(f5); + this.PROPULSOR_MODULE.render(f5); + this.WING_B_A_1.render(f5); + this.WING_B_B_1.render(f5); + this.WING_T_A_1.render(f5); + this.WING_T_B_1.render(f5); + this.WING_T_A_2.render(f5); + this.WING_T_B_2.render(f5); + this.WING_B_B_2.render(f5); + this.WING_B_A_2.render(f5); + this.WARHEAD_1.render(f5); + this.WARHEAD_2.render(f5); + this.WARHEAD_3.render(f5); + this.WARHEAD_4.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMYuanZi.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMYuanZi.java new file mode 100644 index 0000000..754eeb3 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMYuanZi.java @@ -0,0 +1,236 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMYuanZi extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE_1; + ModelRenderer MOTOR_MODULE_2; + ModelRenderer MOTOR_MODULE_3; + ModelRenderer MOTOR_MODULE_4; + ModelRenderer C1; + ModelRenderer C2; + ModelRenderer C3; + ModelRenderer C4; + ModelRenderer T1; + ModelRenderer T2; + ModelRenderer T3; + ModelRenderer T4; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_1B; + ModelRenderer WING_2B; + ModelRenderer WING_3A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_4A; + ModelRenderer TOP; + ModelRenderer WARHEAD_1; + ModelRenderer WARHEAD_2; + ModelRenderer WARHEAD_3; + + public MMYuanZi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 70, 8); + this.MAIN_MODULE.setRotationPoint(-4.0f, -63.0f, -4.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_1 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_1.setRotationPoint(-8.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_1.setTextureSize(128, 128); + this.MOTOR_MODULE_1.mirror = true; + this.setRotation(this.MOTOR_MODULE_1, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_2 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_2.setRotationPoint(-8.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_2.setTextureSize(128, 128); + this.MOTOR_MODULE_2.mirror = true; + this.setRotation(this.MOTOR_MODULE_2, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_3 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_3.setRotationPoint(2.0f, 0.0f, -8.0f); + this.MOTOR_MODULE_3.setTextureSize(128, 128); + this.MOTOR_MODULE_3.mirror = true; + this.setRotation(this.MOTOR_MODULE_3, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE_4 = new ModelRenderer((ModelBase)this, 0, 79)) + .addBox(0.0f, 0.0f, 0.0f, 6, 20, 6); + this.MOTOR_MODULE_4.setRotationPoint(2.0f, 0.0f, 2.0f); + this.MOTOR_MODULE_4.setTextureSize(128, 128); + this.MOTOR_MODULE_4.mirror = true; + this.setRotation(this.MOTOR_MODULE_4, 0.0f, 0.0f, 0.0f); + (this.C1 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C1.setRotationPoint(-6.0f, 20.0f, -6.0f); + this.C1.setTextureSize(128, 128); + this.C1.mirror = true; + this.setRotation(this.C1, 0.0f, 0.0f, 0.0f); + (this.C2 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C2.setRotationPoint(-6.0f, 20.0f, 4.0f); + this.C2.setTextureSize(128, 128); + this.C2.mirror = true; + this.setRotation(this.C2, 0.0f, 0.0f, 0.0f); + (this.C3 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C3.setRotationPoint(4.0f, 20.0f, -6.0f); + this.C3.setTextureSize(128, 128); + this.C3.mirror = true; + this.setRotation(this.C3, 0.0f, 0.0f, 0.0f); + (this.C4 = new ModelRenderer((ModelBase)this, 0, 106)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 2); + this.C4.setRotationPoint(4.0f, 20.0f, 4.0f); + this.C4.setTextureSize(128, 128); + this.C4.mirror = true; + this.setRotation(this.C4, 0.0f, 0.0f, 0.0f); + (this.T1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T1.setRotationPoint(-7.0f, 21.0f, -7.0f); + this.T1.setTextureSize(128, 128); + this.T1.mirror = true; + this.setRotation(this.T1, 0.0f, 0.0f, 0.0f); + (this.T2 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T2.setRotationPoint(-7.0f, 21.0f, 3.0f); + this.T2.setTextureSize(128, 128); + this.T2.mirror = true; + this.setRotation(this.T2, 0.0f, 0.0f, 0.0f); + (this.T3 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T3.setRotationPoint(3.0f, 21.0f, -7.0f); + this.T3.setTextureSize(128, 128); + this.T3.mirror = true; + this.setRotation(this.T3, 0.0f, 0.0f, 0.0f); + (this.T4 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.T4.setRotationPoint(3.0f, 21.0f, 3.0f); + this.T4.setTextureSize(128, 128); + this.T4.mirror = true; + this.setRotation(this.T4, 0.0f, 0.0f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 43, 15)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 12, 12); + this.WING_1A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, -0.7853982f, 0.0f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 43, 0)) + .addBox(0.0f, 0.0f, -1.0f, 12, 12, 2); + this.WING_2A.setRotationPoint(0.0f, -10.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, 0.0f, 0.7853982f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 72, 28)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 25, 16); + this.WING_1B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, 0.0f, 0.0f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 72, 0)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 25, 2); + this.WING_2B.setRotationPoint(0.0f, -2.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, 0.0f, 0.0f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 34, 55)) + .addBox(-1.0f, 0.0f, -8.0f, 2, 10, 16); + this.WING_3A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.0f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 34, 82)) + .addBox(-1.0f, -6.0f, -6.0f, 2, 12, 12); + this.WING_3B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, 0.7853982f, 0.0f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 34, 41)) + .addBox(-8.0f, 0.0f, -1.0f, 16, 10, 2); + this.WING_4B.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, 0.0f, 0.0f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 34, 107)) + .addBox(-6.0f, -6.0f, -1.0f, 12, 12, 2); + this.WING_4A.setRotationPoint(0.0f, -41.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, 0.0f, -0.7853982f); + (this.TOP = new ModelRenderer((ModelBase)this, 72, 70)) + .addBox(0.0f, 0.0f, 0.0f, 10, 10, 10); + this.TOP.setRotationPoint(-5.0f, -64.0f, -5.0f); + this.TOP.setTextureSize(128, 128); + this.TOP.mirror = true; + this.setRotation(this.TOP, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_1 = new ModelRenderer((ModelBase)this, 72, 91)) + .addBox(0.0f, 0.0f, 0.0f, 8, 6, 8); + this.WARHEAD_1.setRotationPoint(-4.0f, -70.0f, -4.0f); + this.WARHEAD_1.setTextureSize(128, 128); + this.WARHEAD_1.mirror = true; + this.setRotation(this.WARHEAD_1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_2 = new ModelRenderer((ModelBase)this, 72, 106)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 6); + this.WARHEAD_2.setRotationPoint(-3.0f, -76.0f, -3.0f); + this.WARHEAD_2.setTextureSize(128, 128); + this.WARHEAD_2.mirror = true; + this.setRotation(this.WARHEAD_2, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_3 = new ModelRenderer((ModelBase)this, 110, 91)) + .addBox(0.0f, 0.0f, 0.0f, 4, 6, 4); + this.WARHEAD_3.setRotationPoint(-2.0f, -82.0f, -2.0f); + this.WARHEAD_3.setTextureSize(128, 128); + this.WARHEAD_3.mirror = true; + this.setRotation(this.WARHEAD_3, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE_1.render(f5); + this.MOTOR_MODULE_2.render(f5); + this.MOTOR_MODULE_3.render(f5); + this.MOTOR_MODULE_4.render(f5); + this.C1.render(f5); + this.C2.render(f5); + this.C3.render(f5); + this.C4.render(f5); + this.T1.render(f5); + this.T2.render(f5); + this.T3.render(f5); + this.T4.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_1B.render(f5); + this.WING_2B.render(f5); + this.WING_3A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_4A.render(f5); + this.TOP.render(f5); + this.WARHEAD_1.render(f5); + this.WARHEAD_2.render(f5); + this.WARHEAD_3.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMZhen.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMZhen.java new file mode 100644 index 0000000..343a16f --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMZhen.java @@ -0,0 +1,188 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMZhen extends MICBM { + ModelRenderer A; + ModelRenderer B; + ModelRenderer C; + ModelRenderer D; + ModelRenderer E; + ModelRenderer F; + ModelRenderer G; + ModelRenderer H; + ModelRenderer I; + ModelRenderer J; + ModelRenderer K; + ModelRenderer L; + ModelRenderer M; + ModelRenderer N; + ModelRenderer O; + ModelRenderer P; + ModelRenderer Q; + ModelRenderer R; + ModelRenderer S; + + public MMZhen() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.A = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.A.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.A.setTextureSize(128, 128); + this.A.mirror = true; + this.setRotation(this.A, 0.0f, 0.0f, 0.0f); + (this.B = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.B.setRotationPoint(0.0f, 8.0f, 0.0f); + this.B.setTextureSize(128, 128); + this.B.mirror = true; + this.setRotation(this.B, 0.0f, 0.7853982f, 0.0f); + (this.C = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.C.setRotationPoint(0.0f, 12.0f, 0.0f); + this.C.setTextureSize(128, 128); + this.C.mirror = true; + this.setRotation(this.C, 0.0f, 0.7853982f, 0.0f); + (this.D = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.D.setRotationPoint(0.0f, 12.0f, 0.0f); + this.D.setTextureSize(128, 128); + this.D.mirror = true; + this.setRotation(this.D, 0.0f, -0.7853982f, 0.0f); + (this.E = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.E.setRotationPoint(0.0f, -24.0f, 0.0f); + this.E.setTextureSize(128, 128); + this.E.mirror = true; + this.setRotation(this.E, -0.7853982f, 0.7853982f, 0.0f); + (this.F = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.F.setRotationPoint(0.0f, -24.0f, 0.0f); + this.F.setTextureSize(128, 128); + this.F.mirror = true; + this.setRotation(this.F, -0.7853982f, -0.7853982f, 0.0f); + (this.G = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.G.setRotationPoint(0.0f, -17.0f, 0.0f); + this.G.setTextureSize(128, 128); + this.G.mirror = true; + this.setRotation(this.G, 0.0f, 0.7853982f, 0.0f); + (this.H = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.H.setRotationPoint(0.0f, -17.0f, 0.0f); + this.H.setTextureSize(128, 128); + this.H.mirror = true; + this.setRotation(this.H, 0.0f, -0.7853982f, 0.0f); + (this.I = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.I.setRotationPoint(0.0f, 3.0f, 0.0f); + this.I.setTextureSize(128, 128); + this.I.mirror = true; + this.setRotation(this.I, -0.7853982f, -0.7853982f, 0.0f); + (this.J = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.J.setRotationPoint(0.0f, 3.0f, 0.0f); + this.J.setTextureSize(128, 128); + this.J.mirror = true; + this.setRotation(this.J, -0.7853982f, 0.7853982f, 0.0f); + (this.K = new ModelRenderer((ModelBase)this, 44, 62)) + .addBox(0.0f, 0.0f, 0.0f, 8, 2, 8); + this.K.setRotationPoint(-4.0f, -28.0f, -4.0f); + this.K.setTextureSize(128, 128); + this.K.mirror = true; + this.setRotation(this.K, 0.0f, 0.0f, 0.0f); + (this.L = new ModelRenderer((ModelBase)this, 72, 62)) + .addBox(0.0f, 0.0f, 0.0f, 8, 1, 2); + this.L.setRotationPoint(-3.0f, -28.0f, -1.0f); + this.L.setTextureSize(128, 128); + this.L.mirror = true; + this.setRotation(this.L, 0.0f, 0.0f, -0.9773844f); + (this.M = new ModelRenderer((ModelBase)this, 72, 62)) + .addBox(0.0f, 0.0f, 0.0f, 8, 1, 2); + this.M.setRotationPoint(3.0f, -28.0f, 1.0f); + this.M.setTextureSize(128, 128); + this.M.mirror = true; + this.setRotation(this.M, 0.0f, 3.141593f, -0.9773844f); + (this.N = new ModelRenderer((ModelBase)this, 44, 74)) + .addBox(0.0f, 0.0f, 0.0f, 6, 2, 6); + this.N.setRotationPoint(-3.0f, -35.0f, -3.0f); + this.N.setTextureSize(128, 128); + this.N.mirror = true; + this.setRotation(this.N, 0.0f, 0.0f, 0.0f); + (this.O = new ModelRenderer((ModelBase)this, 44, 85)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 8); + this.O.setRotationPoint(-4.0f, -41.0f, -4.0f); + this.O.setTextureSize(128, 128); + this.O.mirror = true; + this.setRotation(this.O, 0.0f, 0.0f, 0.0f); + (this.P = new ModelRenderer((ModelBase)this, 75, 92)) + .addBox(0.0f, 0.0f, 0.0f, 7, 2, 8); + this.P.setRotationPoint(-4.0f, -41.0f, -4.0f); + this.P.setTextureSize(128, 128); + this.P.mirror = true; + this.setRotation(this.P, 0.0f, 0.0f, -0.1745329f); + (this.Q = new ModelRenderer((ModelBase)this, 44, 101)) + .addBox(0.0f, 0.0f, 0.0f, 5, 2, 8); + this.Q.setRotationPoint(3.0f, -42.0f, -4.0f); + this.Q.setTextureSize(128, 128); + this.Q.mirror = true; + this.setRotation(this.Q, 0.0f, 0.0f, 1.186824f); + (this.R = new ModelRenderer((ModelBase)this, 73, 85)) + .addBox(0.0f, 0.0f, 0.0f, 6, 2, 2); + this.R.setRotationPoint(-3.0f, -39.0f, -6.0f); + this.R.setTextureSize(128, 128); + this.R.mirror = true; + this.setRotation(this.R, 0.0f, 0.0f, 0.2094395f); + (this.S = new ModelRenderer((ModelBase)this, 92, 83)) + .addBox(4.0f, 0.0f, 0.0f, 2, 2, 4); + this.S.setRotationPoint(-3.0f, -39.0f, -6.0f); + this.S.setTextureSize(128, 128); + this.S.mirror = true; + this.setRotation(this.S, 0.0f, 0.0f, 0.2094395f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.A.render(f5); + this.B.render(f5); + this.C.render(f5); + this.D.render(f5); + this.E.render(f5); + this.F.render(f5); + this.G.render(f5); + this.H.render(f5); + this.I.render(f5); + this.J.render(f5); + this.K.render(f5); + this.L.render(f5); + this.M.render(f5); + this.N.render(f5); + this.O.render(f5); + this.P.render(f5); + this.Q.render(f5); + this.R.render(f5); + this.S.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/daodan/MMZhuiZhong.java b/src/main/java/icbm/zhapin/muoxing/daodan/MMZhuiZhong.java new file mode 100644 index 0000000..9ccd489 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/daodan/MMZhuiZhong.java @@ -0,0 +1,148 @@ +package icbm.zhapin.muoxing.daodan; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MMZhuiZhong extends MICBM { + ModelRenderer MAIN_MODULE; + ModelRenderer MOTOR_MODULE; + ModelRenderer WING_1A; + ModelRenderer WING_2A; + ModelRenderer WING_3B; + ModelRenderer WING_4B; + ModelRenderer WING_3A; + ModelRenderer WING_4A; + ModelRenderer WING_2B; + ModelRenderer WING_1B; + ModelRenderer WARHEAD_1; + ModelRenderer WARHEAD_2; + ModelRenderer WARHEAD_3; + ModelRenderer WARHEAD_4; + + public MMZhuiZhong() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.MAIN_MODULE = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 6, 50, 6); + this.MAIN_MODULE.setRotationPoint(-3.0f, -26.0f, -3.0f); + this.MAIN_MODULE.setTextureSize(128, 128); + this.MAIN_MODULE.mirror = true; + this.setRotation(this.MAIN_MODULE, 0.0f, 0.0f, 0.0f); + (this.MOTOR_MODULE = new ModelRenderer((ModelBase)this, 0, 57)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 16, 10); + this.MOTOR_MODULE.setRotationPoint(0.0f, 8.0f, 0.0f); + this.MOTOR_MODULE.setTextureSize(128, 128); + this.MOTOR_MODULE.mirror = true; + this.setRotation(this.MOTOR_MODULE, 0.0f, 0.7853982f, 0.0f); + (this.WING_1A = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_1A.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_1A.setTextureSize(128, 128); + this.WING_1A.mirror = true; + this.setRotation(this.WING_1A, 0.0f, 0.7853982f, 0.0f); + (this.WING_2A = new ModelRenderer((ModelBase)this, 59, 26)) + .addBox(-1.0f, 0.0f, -9.0f, 2, 12, 18); + this.WING_2A.setRotationPoint(0.0f, 12.0f, 0.0f); + this.WING_2A.setTextureSize(128, 128); + this.WING_2A.mirror = true; + this.setRotation(this.WING_2A, 0.0f, -0.7853982f, 0.0f); + (this.WING_3B = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_3B.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_3B.setTextureSize(128, 128); + this.WING_3B.mirror = true; + this.setRotation(this.WING_3B, -0.7853982f, 0.7853982f, 0.0f); + (this.WING_4B = new ModelRenderer((ModelBase)this, 59, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 10, 10); + this.WING_4B.setRotationPoint(0.0f, -24.0f, 0.0f); + this.WING_4B.setTextureSize(128, 128); + this.WING_4B.mirror = true; + this.setRotation(this.WING_4B, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_3A = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_3A.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_3A.setTextureSize(128, 128); + this.WING_3A.mirror = true; + this.setRotation(this.WING_3A, 0.0f, 0.7853982f, 0.0f); + (this.WING_4A = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(-1.0f, 0.0f, -7.0f, 2, 10, 14); + this.WING_4A.setRotationPoint(0.0f, -17.0f, 0.0f); + this.WING_4A.setTextureSize(128, 128); + this.WING_4A.mirror = true; + this.setRotation(this.WING_4A, 0.0f, -0.7853982f, 0.0f); + (this.WING_2B = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_2B.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_2B.setTextureSize(128, 128); + this.WING_2B.mirror = true; + this.setRotation(this.WING_2B, -0.7853982f, -0.7853982f, 0.0f); + (this.WING_1B = new ModelRenderer((ModelBase)this, 25, 26)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 13, 13); + this.WING_1B.setRotationPoint(0.0f, 3.0f, 0.0f); + this.WING_1B.setTextureSize(128, 128); + this.WING_1B.mirror = true; + this.setRotation(this.WING_1B, -0.7853982f, 0.7853982f, 0.0f); + (this.WARHEAD_1 = new ModelRenderer((ModelBase)this, 0, 85)) + .addBox(0.0f, 0.0f, 0.0f, 4, 6, 4); + this.WARHEAD_1.setRotationPoint(-2.0f, -32.0f, -2.0f); + this.WARHEAD_1.setTextureSize(128, 128); + this.WARHEAD_1.mirror = true; + this.setRotation(this.WARHEAD_1, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_2 = new ModelRenderer((ModelBase)this, 0, 97)) + .addBox(0.0f, 0.0f, 0.0f, 6, 6, 6); + this.WARHEAD_2.setRotationPoint(-3.0f, -38.0f, -3.0f); + this.WARHEAD_2.setTextureSize(128, 128); + this.WARHEAD_2.mirror = true; + this.setRotation(this.WARHEAD_2, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_3 = new ModelRenderer((ModelBase)this, 26, 97)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.WARHEAD_3.setRotationPoint(-2.0f, -41.0f, -2.0f); + this.WARHEAD_3.setTextureSize(128, 128); + this.WARHEAD_3.mirror = true; + this.setRotation(this.WARHEAD_3, 0.0f, 0.0f, 0.0f); + (this.WARHEAD_4 = new ModelRenderer((ModelBase)this, 26, 105)) + .addBox(0.0f, 0.0f, 0.0f, 2, 3, 2); + this.WARHEAD_4.setRotationPoint(-1.0f, -44.0f, -1.0f); + this.WARHEAD_4.setTextureSize(128, 128); + this.WARHEAD_4.mirror = true; + this.setRotation(this.WARHEAD_4, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.render(f5); + } + + @Override + public void render(final float f5) { + this.MAIN_MODULE.render(f5); + this.MOTOR_MODULE.render(f5); + this.WING_1A.render(f5); + this.WING_2A.render(f5); + this.WING_3B.render(f5); + this.WING_4B.render(f5); + this.WING_3A.render(f5); + this.WING_4A.render(f5); + this.WING_2B.render(f5); + this.WING_1B.render(f5); + this.WARHEAD_1.render(f5); + this.WARHEAD_2.render(f5); + this.WARHEAD_3.render(f5); + this.WARHEAD_4.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MDianCiQi.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MDianCiQi.java new file mode 100644 index 0000000..b2acc4f --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MDianCiQi.java @@ -0,0 +1,119 @@ +package icbm.zhapin.muoxing.jiqi; + +import net.minecraft.client.model.ModelRenderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; + +@SideOnly(Side.CLIENT) +public class MDianCiQi extends ModelBase +{ + ModelRenderer Base; + ModelRenderer Support; + ModelRenderer Turret_Support; + ModelRenderer Main_Coil; + ModelRenderer Support_Beam_A1; + ModelRenderer Support_Beam_B1; + ModelRenderer Support_Beam_C1; + ModelRenderer Support_Beam_D1; + ModelRenderer Support_Beam_DB1; + ModelRenderer Support_Beam_CA1; + ModelRenderer Support_Beam_CA2; + ModelRenderer Support_Beam_DB2; + + public MDianCiQi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Base = new ModelRenderer((ModelBase)this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 16, 6, 16); + this.Base.setRotationPoint(-8.0f, 18.0f, -8.0f); + this.Base.setTextureSize(128, 128); + this.Base.mirror = true; + this.setRotation(this.Base, 0.0f, 0.0f, 0.0f); + (this.Support = new ModelRenderer((ModelBase)this, 0, 24)).addBox(0.0f, 0.0f, 0.0f, 10, 8, 10); + this.Support.setRotationPoint(-5.0f, 10.0f, -5.0f); + this.Support.setTextureSize(128, 128); + this.Support.mirror = true; + this.setRotation(this.Support, 0.0f, 0.0f, 0.0f); + (this.Turret_Support = new ModelRenderer((ModelBase)this, 0, 44)).addBox(-7.0f, 0.0f, -7.0f, 14, 1, 14); + this.Turret_Support.setRotationPoint(0.0f, 9.0f, 0.0f); + this.Turret_Support.setTextureSize(128, 128); + this.Turret_Support.mirror = true; + this.setRotation(this.Turret_Support, 0.0f, 0.7853982f, 0.0f); + (this.Main_Coil = new ModelRenderer((ModelBase)this, 66, 0)).addBox(-2.0f, 0.0f, -2.0f, 4, 11, 4); + this.Main_Coil.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Main_Coil.setTextureSize(128, 128); + this.Main_Coil.mirror = true; + this.setRotation(this.Main_Coil, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_A1 = new ModelRenderer((ModelBase)this, 66, 16)).addBox(8.0f, 0.0f, -1.0f, 1, 18, 2); + this.Support_Beam_A1.setRotationPoint(0.0f, -8.0f, 0.0f); + this.Support_Beam_A1.setTextureSize(128, 128); + this.Support_Beam_A1.mirror = true; + this.setRotation(this.Support_Beam_A1, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_B1 = new ModelRenderer((ModelBase)this, 73, 16)).addBox(-1.0f, 0.0f, -9.0f, 2, 18, 1); + this.Support_Beam_B1.setRotationPoint(0.0f, -8.0f, 0.0f); + this.Support_Beam_B1.setTextureSize(128, 128); + this.Support_Beam_B1.mirror = true; + this.setRotation(this.Support_Beam_B1, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_C1 = new ModelRenderer((ModelBase)this, 66, 16)).addBox(-9.0f, 0.0f, -1.0f, 1, 18, 2); + this.Support_Beam_C1.setRotationPoint(0.0f, -8.0f, 0.0f); + this.Support_Beam_C1.setTextureSize(128, 128); + this.Support_Beam_C1.mirror = true; + this.setRotation(this.Support_Beam_C1, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_D1 = new ModelRenderer((ModelBase)this, 73, 16)).addBox(-1.0f, 0.0f, 8.0f, 2, 18, 1); + this.Support_Beam_D1.setRotationPoint(0.0f, -8.0f, 0.0f); + this.Support_Beam_D1.setTextureSize(128, 128); + this.Support_Beam_D1.mirror = true; + this.setRotation(this.Support_Beam_D1, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_DB1 = new ModelRenderer((ModelBase)this, 85, 0)).addBox(-1.0f, 0.0f, -8.0f, 2, 1, 16); + this.Support_Beam_DB1.setRotationPoint(0.0f, 3.0f, 0.0f); + this.Support_Beam_DB1.setTextureSize(128, 128); + this.Support_Beam_DB1.mirror = true; + this.setRotation(this.Support_Beam_DB1, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_CA1 = new ModelRenderer((ModelBase)this, 85, 19)).addBox(-8.0f, 0.0f, -1.0f, 16, 1, 2); + this.Support_Beam_CA1.setRotationPoint(0.0f, 3.0f, 0.0f); + this.Support_Beam_CA1.setTextureSize(128, 128); + this.Support_Beam_CA1.mirror = true; + this.setRotation(this.Support_Beam_CA1, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_CA2 = new ModelRenderer((ModelBase)this, 85, 19)).addBox(-8.0f, 0.0f, -1.0f, 16, 1, 2); + this.Support_Beam_CA2.setRotationPoint(0.0f, -3.0f, 0.0f); + this.Support_Beam_CA2.setTextureSize(128, 128); + this.Support_Beam_CA2.mirror = true; + this.setRotation(this.Support_Beam_CA2, 0.0f, 0.0f, 0.0f); + (this.Support_Beam_DB2 = new ModelRenderer((ModelBase)this, 85, 0)).addBox(-1.0f, 0.0f, -8.0f, 2, 1, 16); + this.Support_Beam_DB2.setRotationPoint(0.0f, -3.0f, 0.0f); + this.Support_Beam_DB2.setTextureSize(128, 128); + this.Support_Beam_DB2.mirror = true; + this.setRotation(this.Support_Beam_DB2, 0.0f, 0.0f, 0.0f); + } + + public void render(final float rotation, final float f5) { + this.Base.render(f5); + this.Support.render(f5); + this.Turret_Support.rotateAngleY = -rotation; + this.Turret_Support.render(f5); + this.Main_Coil.rotateAngleY = -rotation; + this.Main_Coil.render(f5); + this.Support_Beam_A1.rotateAngleY = rotation; + this.Support_Beam_A1.render(f5); + this.Support_Beam_B1.rotateAngleY = rotation; + this.Support_Beam_B1.render(f5); + this.Support_Beam_C1.rotateAngleY = rotation; + this.Support_Beam_C1.render(f5); + this.Support_Beam_D1.rotateAngleY = rotation; + this.Support_Beam_D1.render(f5); + this.Support_Beam_DB1.rotateAngleY = rotation; + this.Support_Beam_DB1.render(f5); + this.Support_Beam_CA1.rotateAngleY = rotation; + this.Support_Beam_CA1.render(f5); + this.Support_Beam_CA2.rotateAngleY = rotation; + this.Support_Beam_CA2.render(f5); + this.Support_Beam_DB2.rotateAngleY = rotation; + this.Support_Beam_DB2.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi0.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi0.java new file mode 100644 index 0000000..f4aab8b --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi0.java @@ -0,0 +1,57 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheDi0 extends ModelBase { + ModelRenderer Shape1; + ModelRenderer Shape6; + ModelRenderer Shape8; + ModelRenderer Shape13; + + public MFaSheDi0() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 16, 1, 16); + this.Shape1.setRotationPoint(-8.0f, 23.0f, -8.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 16, 1, 16); + this.Shape6.setRotationPoint(-8.0f, 19.0f, -8.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(0.0f, 0.0f, 0.0f, 2, 12, 2); + this.Shape8.setRotationPoint(6.0f, 11.0f, -1.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + (this.Shape13 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(0.0f, 0.0f, 0.0f, 2, 12, 2); + this.Shape13.setRotationPoint(-7.0f, 11.0f, -1.0f); + this.Shape13.setTextureSize(128, 128); + this.Shape13.mirror = true; + this.setRotation(this.Shape13, 0.0f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape6.render(f5); + this.Shape8.render(f5); + this.Shape13.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi1.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi1.java new file mode 100644 index 0000000..b0a3a88 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi1.java @@ -0,0 +1,57 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheDi1 extends ModelBase { + ModelRenderer Shape1; + ModelRenderer Shape6; + ModelRenderer Shape2; + ModelRenderer Shape3; + + public MFaSheDi1() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape1 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 16, 1, 16); + this.Shape1.setRotationPoint(-8.0f, 23.0f, -8.0f); + this.Shape1.setTextureSize(128, 128); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape6 = new ModelRenderer((ModelBase)this, 0, 111)) + .addBox(0.0f, 0.0f, 0.0f, 16, 1, 16); + this.Shape6.setRotationPoint(-8.0f, 19.0f, -8.0f); + this.Shape6.setTextureSize(128, 128); + this.Shape6.mirror = true; + this.setRotation(this.Shape6, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase)this, 63, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 4, 2); + this.Shape2.setRotationPoint(-8.0f, 20.0f, -1.0f); + this.Shape2.setTextureSize(128, 128); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Shape3 = new ModelRenderer((ModelBase)this, 63, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 4, 2); + this.Shape3.setRotationPoint(6.0f, 20.0f, -1.0f); + this.Shape3.setTextureSize(128, 128); + this.Shape3.mirror = true; + this.setRotation(this.Shape3, 0.0f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape1.render(f5); + this.Shape6.render(f5); + this.Shape2.render(f5); + this.Shape3.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi2.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi2.java new file mode 100644 index 0000000..22a9e14 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDi2.java @@ -0,0 +1,41 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheDi2 extends ModelBase { + ModelRenderer Shape12; + ModelRenderer Shape13; + + public MFaSheDi2() { + super.textureWidth = 256; + super.textureHeight = 256; + (this.Shape12 = new ModelRenderer((ModelBase)this, 0, 80)) + .addBox(0.0f, 0.0f, 0.0f, 11, 6, 6); + this.Shape12.setRotationPoint(-5.0f, 18.0f, -6.0f); + this.Shape12.setTextureSize(256, 256); + this.Shape12.mirror = true; + this.setRotation(this.Shape12, 0.0f, 0.0f, 0.0f); + (this.Shape13 = new ModelRenderer((ModelBase)this, 0, 80)) + .addBox(0.0f, 0.0f, 0.0f, 11, 6, 6); + this.Shape13.setRotationPoint(-5.0f, 18.0f, 1.0f); + this.Shape13.setTextureSize(256, 256); + this.Shape13.mirror = true; + this.setRotation(this.Shape13, 0.0f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape12.render(f5); + this.Shape13.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail0.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail0.java new file mode 100644 index 0000000..34c4fd4 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail0.java @@ -0,0 +1,113 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheDiRail0 extends ModelBase { + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + + public MFaSheDiRail0() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape7 = new ModelRenderer((ModelBase)this, 35, 52)) + .addBox(0.0f, 0.0f, 0.0f, 1, 41, 4); + this.Shape7.setRotationPoint(8.0f, -24.0f, -2.0f); + this.Shape7.setTextureSize(128, 128); + this.Shape7.mirror = true; + this.setRotation(this.Shape7, 0.0f, 0.0f, 0.0f); + (this.Shape8 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(0.0f, 0.0f, 0.0f, 2, 12, 2); + this.Shape8.setRotationPoint(6.0f, 11.0f, -1.0f); + this.Shape8.setTextureSize(128, 128); + this.Shape8.mirror = true; + this.setRotation(this.Shape8, 0.0f, 0.0f, 0.0f); + (this.Shape9 = new ModelRenderer((ModelBase)this, 46, 52)) + .addBox(0.0f, 0.0f, 0.0f, 3, 19, 2); + this.Shape9.setRotationPoint(9.0f, -2.0f, -1.0f); + this.Shape9.setTextureSize(128, 128); + this.Shape9.mirror = true; + this.setRotation(this.Shape9, 0.0f, 0.0f, 0.0f); + (this.Shape10 = new ModelRenderer((ModelBase)this, 0, 10)) + .addBox(0.0f, 0.0f, 0.0f, 2, 4, 2); + this.Shape10.setRotationPoint(7.0f, -28.0f, -1.0f); + this.Shape10.setTextureSize(128, 128); + this.Shape10.mirror = true; + this.setRotation(this.Shape10, 0.0f, 0.0f, 0.0f); + (this.Shape11 = new ModelRenderer((ModelBase)this, 35, 52)) + .addBox(0.0f, 0.0f, 0.0f, 1, 41, 4); + this.Shape11.setRotationPoint(-8.0f, -24.0f, -2.0f); + this.Shape11.setTextureSize(128, 128); + this.Shape11.mirror = true; + this.setRotation(this.Shape11, 0.0f, 0.0f, 0.0f); + (this.Shape12 = new ModelRenderer((ModelBase)this, 46, 52)) + .addBox(0.0f, 0.0f, 0.0f, 3, 19, 2); + this.Shape12.setRotationPoint(-11.0f, -2.0f, -1.0f); + this.Shape12.setTextureSize(128, 128); + this.Shape12.mirror = true; + this.setRotation(this.Shape12, 0.0f, 0.0f, 0.0f); + (this.Shape13 = new ModelRenderer((ModelBase)this, 0, 20)) + .addBox(0.0f, 0.0f, 0.0f, 2, 12, 2); + this.Shape13.setRotationPoint(-7.0f, 11.0f, -1.0f); + this.Shape13.setTextureSize(128, 128); + this.Shape13.mirror = true; + this.setRotation(this.Shape13, 0.0f, 0.0f, 0.0f); + (this.Shape14 = new ModelRenderer((ModelBase)this, 0, 10)) + .addBox(0.0f, 0.0f, 0.0f, 2, 4, 2); + this.Shape14.setRotationPoint(-8.0f, -28.0f, -1.0f); + this.Shape14.setTextureSize(128, 128); + this.Shape14.mirror = true; + this.setRotation(this.Shape14, 0.0f, 0.0f, 0.0f); + (this.Shape15 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 48, 1, 8); + this.Shape15.setRotationPoint(-24.0f, 23.0f, -4.0f); + this.Shape15.setTextureSize(128, 128); + this.Shape15.mirror = true; + this.setRotation(this.Shape15, 0.0f, 0.0f, 0.0f); + (this.Shape16 = new ModelRenderer((ModelBase)this, 57, 52)) + .addBox(0.0f, 0.0f, 0.0f, 9, 6, 6); + this.Shape16.setRotationPoint(-16.0f, 17.0f, -3.0f); + this.Shape16.setTextureSize(128, 128); + this.Shape16.mirror = true; + this.setRotation(this.Shape16, 0.0f, 0.0f, 0.0f); + (this.Shape17 = new ModelRenderer((ModelBase)this, 57, 52)) + .addBox(0.0f, 0.0f, 0.0f, 9, 6, 6); + this.Shape17.setRotationPoint(8.0f, 17.0f, -3.0f); + this.Shape17.setTextureSize(128, 128); + this.Shape17.mirror = true; + this.setRotation(this.Shape17, 0.0f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape7.render(f5); + this.Shape8.render(f5); + this.Shape9.render(f5); + this.Shape10.render(f5); + this.Shape11.render(f5); + this.Shape12.render(f5); + this.Shape13.render(f5); + this.Shape14.render(f5); + this.Shape15.render(f5); + this.Shape16.render(f5); + this.Shape17.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail1.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail1.java new file mode 100644 index 0000000..a5eed74 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail1.java @@ -0,0 +1,135 @@ +package icbm.zhapin.muoxing.jiqi; + +import net.minecraft.entity.Entity; +import net.minecraft.client.model.ModelRenderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; + +@SideOnly(Side.CLIENT) +public class MFaSheDiRail1 extends ModelBase { + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape20; + ModelRenderer Shape22; + ModelRenderer Shape23; + ModelRenderer Shape24; + ModelRenderer Shape25; + ModelRenderer Shape28; + ModelRenderer Shape29; + + public MFaSheDiRail1() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape11 = new ModelRenderer((ModelBase) this, 35, 52)).addBox(0.0f, 0.0f, 0.0f, 1, 41, 4); + this.Shape11.setRotationPoint(-16.0f, -23.0f, -2.0f); + this.Shape11.setTextureSize(128, 128); + this.Shape11.mirror = true; + this.setRotation(this.Shape11, 0.0f, -0.7853982f, 0.0f); + (this.Shape12 = new ModelRenderer((ModelBase) this, 46, 52)).addBox(0.0f, 0.0f, 0.0f, 3, 19, 2); + this.Shape12.setRotationPoint(-18.0f, -1.0f, -3.0f); + this.Shape12.setTextureSize(128, 128); + this.Shape12.mirror = true; + this.setRotation(this.Shape12, 0.0f, -0.7853982f, 0.0f); + (this.Shape13 = new ModelRenderer((ModelBase) this, 0, 20)).addBox(0.0f, 0.0f, 0.0f, 2, 12, 2); + this.Shape13.setRotationPoint(-16.0f, 12.0f, -1.0f); + this.Shape13.setTextureSize(128, 128); + this.Shape13.mirror = true; + this.setRotation(this.Shape13, 0.0f, -0.7853982f, 0.0f); + (this.Shape14 = new ModelRenderer((ModelBase) this, 0, 10)).addBox(0.0f, 0.0f, 0.0f, 2, 4, 1); + this.Shape14.setRotationPoint(-16.0f, -27.0f, -2.0f); + this.Shape14.setTextureSize(128, 128); + this.Shape14.mirror = true; + this.setRotation(this.Shape14, 0.0f, -0.7853982f, 0.0f); + (this.Shape15 = new ModelRenderer((ModelBase) this, 0, 0)).addBox(0.0f, 0.0f, 0.0f, 16, 1, 8); + this.Shape15.setRotationPoint(-24.0f, 23.0f, 0.0f); + this.Shape15.setTextureSize(128, 128); + this.Shape15.mirror = true; + this.setRotation(this.Shape15, 0.0f, 0.0f, 0.0f); + (this.Shape16 = new ModelRenderer((ModelBase) this, 57, 52)).addBox(0.0f, 0.0f, 0.0f, 11, 6, 6); + this.Shape16.setRotationPoint(-20.0f, 18.0f, -8.0f); + this.Shape16.setTextureSize(128, 128); + this.Shape16.mirror = true; + this.setRotation(this.Shape16, 0.0f, -0.7853982f, 0.0f); + (this.Shape20 = new ModelRenderer((ModelBase) this, 0, 10)).addBox(0.0f, 0.0f, 0.0f, 2, 4, 1); + this.Shape20.setRotationPoint(-18.0f, -27.0f, 0.0f); + this.Shape20.setTextureSize(128, 128); + this.Shape20.mirror = true; + this.setRotation(this.Shape20, 0.0f, -0.7853982f, 0.0f); + (this.Shape22 = new ModelRenderer((ModelBase) this, 8, 10)).addBox(0.0f, 0.0f, 0.0f, 9, 1, 1); + this.Shape22.setRotationPoint(-17.0f, 5.0f, -1.0f); + this.Shape22.setTextureSize(128, 128); + this.Shape22.mirror = true; + this.setRotation(this.Shape22, 0.0f, 0.0f, 0.0f); + (this.Shape23 = new ModelRenderer((ModelBase) this, 8, 10)).addBox(0.0f, 0.0f, 0.0f, 9, 1, 1); + this.Shape23.setRotationPoint(-17.0f, -10.0f, -1.0f); + this.Shape23.setTextureSize(128, 128); + this.Shape23.mirror = true; + this.setRotation(this.Shape23, 0.0f, 0.0f, 0.0f); + (this.Shape24 = new ModelRenderer((ModelBase) this, 15, 20)).addBox(0.0f, 0.0f, 0.0f, 6, 1, 1); + this.Shape24.setRotationPoint(-21.0f, 5.0f, 6.0f); + this.Shape24.setTextureSize(128, 128); + this.Shape24.mirror = true; + this.setRotation(this.Shape24, 0.0f, 1.134464f, 0.0f); + (this.Shape25 = new ModelRenderer((ModelBase) this, 15, 20)).addBox(0.0f, 0.0f, 0.0f, 6, 1, 1); + this.Shape25.setRotationPoint(-20.0f, 5.0f, 6.0f); + this.Shape25.setTextureSize(128, 128); + this.Shape25.mirror = true; + this.setRotation(this.Shape25, 0.0f, -1.047198f, 0.0f); + (this.Shape28 = new ModelRenderer((ModelBase) this, 15, 19)).addBox(0.0f, 0.0f, 0.0f, 6, 1, 1); + this.Shape28.setRotationPoint(-20.0f, -10.0f, 6.0f); + this.Shape28.setTextureSize(128, 128); + this.Shape28.mirror = true; + this.setRotation(this.Shape28, 0.0f, -1.047198f, 0.0f); + (this.Shape29 = new ModelRenderer((ModelBase) this, 15, 19)).addBox(0.0f, 0.0f, 0.0f, 6, 1, 1); + this.Shape29.setRotationPoint(-21.0f, -10.0f, 6.0f); + this.Shape29.setTextureSize(128, 128); + this.Shape29.mirror = true; + this.setRotation(this.Shape29, 0.0f, 1.047198f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, final float f2, final float f3, + final float f4, final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.Shape11.render(f5); + this.Shape12.render(f5); + this.Shape13.render(f5); + this.Shape14.render(f5); + this.Shape15.render(f5); + this.Shape16.render(f5); + this.Shape20.render(f5); + this.Shape22.render(f5); + this.Shape23.render(f5); + this.Shape24.render(f5); + this.Shape25.render(f5); + this.Shape28.render(f5); + this.Shape29.render(f5); + } + + public void render(final float f5) { + this.Shape11.render(f5); + this.Shape12.render(f5); + this.Shape13.render(f5); + this.Shape14.render(f5); + this.Shape15.render(f5); + this.Shape16.render(f5); + this.Shape20.render(f5); + this.Shape22.render(f5); + this.Shape23.render(f5); + this.Shape24.render(f5); + this.Shape25.render(f5); + this.Shape28.render(f5); + this.Shape29.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail2.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail2.java new file mode 100644 index 0000000..ad73960 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheDiRail2.java @@ -0,0 +1,69 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MFaSheDiRail2 extends ModelBase { + ModelRenderer Shape9; + ModelRenderer Shape20; + ModelRenderer Shape21; + ModelRenderer Shape16; + + public MFaSheDiRail2() { + super.textureWidth = 256; + super.textureHeight = 256; + (this.Shape9 = new ModelRenderer((ModelBase)this, 170, 0)) + .addBox(0.0f, 0.0f, 0.0f, 10, 37, 10); + this.Shape9.setRotationPoint(-22.0f, -19.0f, -5.0f); + this.Shape9.setTextureSize(256, 256); + this.Shape9.mirror = true; + this.setRotation(this.Shape9, 0.0f, 0.0f, 0.0f); + (this.Shape20 = new ModelRenderer((ModelBase)this, 170, 50)) + .addBox(0.0f, 0.0f, 0.0f, 1, 40, 2); + this.Shape20.setRotationPoint(-19.0f, -22.0f, -6.0f); + this.Shape20.setTextureSize(256, 256); + this.Shape20.mirror = true; + this.setRotation(this.Shape20, 0.0f, 0.0f, 0.0f); + (this.Shape21 = new ModelRenderer((ModelBase)this, 100, 0)) + .addBox(0.0f, 0.0f, 0.0f, 16, 6, 14); + this.Shape21.setRotationPoint(-25.0f, 18.0f, -7.0f); + this.Shape21.setTextureSize(256, 256); + this.Shape21.mirror = true; + this.setRotation(this.Shape21, 0.0f, 0.0f, 0.0f); + (this.Shape16 = new ModelRenderer((ModelBase)this, 170, 50)) + .addBox(0.0f, 0.0f, 0.0f, 1, 40, 2); + this.Shape16.setRotationPoint(-16.0f, -22.0f, -6.0f); + this.Shape16.setTextureSize(256, 256); + this.Shape16.mirror = true; + this.setRotation(this.Shape16, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.Shape9.render(f5); + this.Shape20.render(f5); + this.Shape21.render(f5); + this.Shape16.render(f5); + } + + public void render(final float f5) { + this.Shape9.render(f5); + this.Shape20.render(f5); + this.Shape21.render(f5); + this.Shape16.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheJia.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheJia.java new file mode 100644 index 0000000..00a5056 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheJia.java @@ -0,0 +1,41 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheJia extends ModelBase { + ModelRenderer Shape18; + ModelRenderer Shape19; + + public MFaSheJia() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape18 = new ModelRenderer((ModelBase)this, 57, 65)) + .addBox(0.0f, 0.0f, 0.0f, 16, 6, 8); + this.Shape18.setRotationPoint(-8.0f, 18.0f, -4.0f); + this.Shape18.setTextureSize(128, 128); + this.Shape18.mirror = true; + this.setRotation(this.Shape18, 0.0f, 0.0f, 0.0f); + (this.Shape19 = new ModelRenderer((ModelBase)this, 0, 52)) + .addBox(0.0f, 0.0f, 0.0f, 8, 50, 8); + this.Shape19.setRotationPoint(-4.0f, -32.0f, -4.0f); + this.Shape19.setTextureSize(128, 128); + this.Shape19.mirror = true; + this.setRotation(this.Shape19, 0.0f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape18.render(f5); + this.Shape19.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo0.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo0.java new file mode 100644 index 0000000..3adab1e --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo0.java @@ -0,0 +1,41 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheShiMuo0 extends ModelBase { + ModelRenderer Shape4; + ModelRenderer Shape5; + + public MFaSheShiMuo0() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape4 = new ModelRenderer((ModelBase)this, 0, 35)) + .addBox(0.0f, 0.0f, 0.0f, 2, 8, 1); + this.Shape4.setRotationPoint(-1.0f, 16.0f, 0.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, 0.0f, 0.0f, 0.0f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 15, 30)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 5); + this.Shape5.setRotationPoint(-5.0f, 17.0f, -2.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.5235988f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape4.render(f5); + this.Shape5.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo1.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo1.java new file mode 100644 index 0000000..0c45f2b --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo1.java @@ -0,0 +1,41 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheShiMuo1 extends ModelBase { + ModelRenderer Shape4; + ModelRenderer Shape5; + + public MFaSheShiMuo1() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Shape4 = new ModelRenderer((ModelBase)this, 0, 35)) + .addBox(0.0f, 0.0f, 0.0f, 2, 8, 1); + this.Shape4.setRotationPoint(-1.0f, 16.0f, 0.0f); + this.Shape4.setTextureSize(128, 128); + this.Shape4.mirror = true; + this.setRotation(this.Shape4, 0.0f, 0.0f, 0.0f); + (this.Shape5 = new ModelRenderer((ModelBase)this, 15, 30)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 5); + this.Shape5.setRotationPoint(-5.0f, 17.0f, -2.0f); + this.Shape5.setTextureSize(128, 128); + this.Shape5.mirror = true; + this.setRotation(this.Shape5, 0.5235988f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape4.render(f5); + this.Shape5.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo2.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo2.java new file mode 100644 index 0000000..dd73485 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MFaSheShiMuo2.java @@ -0,0 +1,57 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MFaSheShiMuo2 extends ModelBase { + ModelRenderer Shape27; + ModelRenderer Shape29; + ModelRenderer Shape30; + ModelRenderer Shape31; + + public MFaSheShiMuo2() { + super.textureWidth = 256; + super.textureHeight = 256; + (this.Shape27 = new ModelRenderer((ModelBase)this, 0, 30)) + .addBox(0.0f, 0.0f, 0.0f, 8, 9, 3); + this.Shape27.setRotationPoint(-4.0f, 15.0f, -2.0f); + this.Shape27.setTextureSize(256, 256); + this.Shape27.mirror = true; + this.setRotation(this.Shape27, 0.0f, 0.0f, 0.0f); + (this.Shape29 = new ModelRenderer((ModelBase)this, 0, 19)) + .addBox(0.0f, 0.0f, 0.0f, 10, 1, 8); + this.Shape29.setRotationPoint(-5.0f, 16.0f, -6.0f); + this.Shape29.setTextureSize(256, 256); + this.Shape29.mirror = true; + this.setRotation(this.Shape29, 0.3141593f, 0.0f, 0.0f); + (this.Shape30 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 10, 8, 1); + this.Shape30.setRotationPoint(-5.0f, 6.0f, 5.0f); + this.Shape30.setTextureSize(256, 256); + this.Shape30.mirror = true; + this.setRotation(this.Shape30, -0.4363323f, 0.0f, 0.0f); + (this.Shape31 = new ModelRenderer((ModelBase)this, 25, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 10, 1); + this.Shape31.setRotationPoint(-1.0f, 10.0f, 4.0f); + this.Shape31.setTextureSize(256, 256); + this.Shape31.mirror = true; + this.setRotation(this.Shape31, -0.4363323f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.Shape27.render(f5); + this.Shape29.render(f5); + this.Shape30.render(f5); + this.Shape31.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiDa.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiDa.java new file mode 100644 index 0000000..19c40d2 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiDa.java @@ -0,0 +1,146 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class MLeiDa extends ModelBase { + ModelRenderer Main_Base; + ModelRenderer Main_Base_Outer_Layer; + ModelRenderer Pivot_Support_1; + ModelRenderer Pivot_Support_2; + ModelRenderer Pivot_Support_3; + ModelRenderer Pivot_Point; + ModelRenderer Dish_Support; + ModelRenderer Focus_Support_1; + ModelRenderer Focus_Support_2; + ModelRenderer Focus_Point; + ModelRenderer Main_Dish_Support; + ModelRenderer Main_Dish_Piece; + ModelRenderer Secondary_Dish_Piece_1; + ModelRenderer Secondary_Dish_Piece_2; + + public MLeiDa() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Main_Base = new ModelRenderer((ModelBase)this, 0, 29)) + .addBox(0.0f, 0.0f, 0.0f, 14, 10, 14); + this.Main_Base.setRotationPoint(-7.0f, 14.0f, -7.0f); + this.Main_Base.setTextureSize(128, 128); + this.Main_Base.mirror = true; + this.setRotation(this.Main_Base, 0.0f, 0.0f, 0.0f); + (this.Main_Base_Outer_Layer = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 16, 4, 16); + this.Main_Base_Outer_Layer.setRotationPoint(-8.0f, 20.0f, -8.0f); + this.Main_Base_Outer_Layer.setTextureSize(128, 128); + this.Main_Base_Outer_Layer.mirror = true; + this.setRotation(this.Main_Base_Outer_Layer, 0.0f, 0.0f, 0.0f); + (this.Pivot_Support_1 = new ModelRenderer((ModelBase)this, 0, 63)) + .addBox(0.0f, 0.0f, 0.0f, 12, 1, 12); + this.Pivot_Support_1.setRotationPoint(-6.0f, 13.0f, -6.0f); + this.Pivot_Support_1.setTextureSize(128, 128); + this.Pivot_Support_1.mirror = true; + this.setRotation(this.Pivot_Support_1, 0.0f, 0.0f, 0.0f); + (this.Pivot_Support_2 = new ModelRenderer((ModelBase)this, 87, 63)) + .addBox(-2.0f, 0.0f, -1.0f, 10, 1, 10); + this.Pivot_Support_2.setRotationPoint(-5.0f, 13.0f, 0.0f); + this.Pivot_Support_2.setTextureSize(128, 128); + this.Pivot_Support_2.mirror = true; + this.setRotation(this.Pivot_Support_2, 0.0f, 0.7853982f, 0.0f); + (this.Pivot_Support_3 = new ModelRenderer((ModelBase)this, 0, 78)) + .addBox(0.0f, 0.0f, 0.0f, 8, 2, 8); + this.Pivot_Support_3.setRotationPoint(-4.0f, 11.0f, -4.0f); + this.Pivot_Support_3.setTextureSize(128, 128); + this.Pivot_Support_3.mirror = true; + this.setRotation(this.Pivot_Support_3, 0.0f, 0.0f, 0.0f); + (this.Pivot_Point = new ModelRenderer((ModelBase)this, 0, 89)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 6, 4); + this.Pivot_Point.setRotationPoint(0.0f, 5.0f, 0.0f); + this.Pivot_Point.setTextureSize(128, 128); + this.Pivot_Point.mirror = true; + this.setRotation(this.Pivot_Point, 0.0f, 0.0f, 0.0f); + (this.Dish_Support = new ModelRenderer((ModelBase)this, 17, 89)) + .addBox(-1.0f, 0.0f, -4.0f, 2, 2, 8); + this.Dish_Support.setRotationPoint(0.0f, 5.0f, 0.0f); + this.Dish_Support.setTextureSize(128, 128); + this.Dish_Support.mirror = true; + this.setRotation(this.Dish_Support, 0.0f, 0.0f, 0.0f); + (this.Focus_Support_1 = new ModelRenderer((ModelBase)this, 0, 100)) + .addBox(-15.0f, 0.0f, 3.0f, 19, 2, 1); + this.Focus_Support_1.setRotationPoint(0.0f, 5.0f, 0.0f); + this.Focus_Support_1.setTextureSize(128, 128); + this.Focus_Support_1.mirror = true; + this.setRotation(this.Focus_Support_1, 0.0f, -0.2094395f, 0.0f); + (this.Focus_Support_2 = new ModelRenderer((ModelBase)this, 0, 100)) + .addBox(-15.0f, 0.0f, -4.0f, 19, 2, 1); + this.Focus_Support_2.setRotationPoint(0.0f, 5.0f, 0.0f); + this.Focus_Support_2.setTextureSize(128, 128); + this.Focus_Support_2.mirror = true; + this.setRotation(this.Focus_Support_2, 0.0f, 0.2094395f, 0.0f); + (this.Focus_Point = new ModelRenderer((ModelBase)this, 41, 100)) + .addBox(-16.0f, 0.0f, -1.0f, 1, 4, 2); + this.Focus_Point.setRotationPoint(0.0f, 3.0f, 0.0f); + this.Focus_Point.setTextureSize(128, 128); + this.Focus_Point.mirror = true; + this.setRotation(this.Focus_Point, 0.0f, 0.0f, 0.0f); + (this.Main_Dish_Support = new ModelRenderer((ModelBase)this, 0, 105)) + .addBox(3.0f, 0.0f, -6.0f, 2, 2, 12); + this.Main_Dish_Support.setRotationPoint(0.0f, 5.0f, 0.0f); + this.Main_Dish_Support.setTextureSize(128, 128); + this.Main_Dish_Support.mirror = true; + this.setRotation(this.Main_Dish_Support, 0.0f, 0.0f, 0.0f); + (this.Main_Dish_Piece = new ModelRenderer((ModelBase)this, 51, 95)) + .addBox(4.0f, 0.0f, -9.0f, 1, 15, 18); + this.Main_Dish_Piece.setRotationPoint(0.0f, -10.0f, 0.0f); + this.Main_Dish_Piece.setTextureSize(128, 128); + this.Main_Dish_Piece.mirror = true; + this.setRotation(this.Main_Dish_Piece, 0.0f, 0.0f, 0.0f); + (this.Secondary_Dish_Piece_1 = new ModelRenderer((ModelBase)this, 51, 63)) + .addBox(8.0f, 0.0f, 4.0f, 1, 15, 16); + this.Secondary_Dish_Piece_1.setRotationPoint(0.0f, -10.0f, 0.0f); + this.Secondary_Dish_Piece_1.setTextureSize(128, 128); + this.Secondary_Dish_Piece_1.mirror = true; + this.setRotation(this.Secondary_Dish_Piece_1, 0.0f, -0.6108652f, 0.0f); + (this.Secondary_Dish_Piece_2 = new ModelRenderer((ModelBase)this, 51, 63)) + .addBox(8.0f, 0.0f, -20.0f, 1, 15, 16); + this.Secondary_Dish_Piece_2.setRotationPoint(0.0f, -10.0f, 0.0f); + this.Secondary_Dish_Piece_2.setTextureSize(128, 128); + this.Secondary_Dish_Piece_2.mirror = true; + this.setRotation(this.Secondary_Dish_Piece_2, 0.0f, 0.6108652f, 0.0f); + } + + public void render(final float rotation, final float f5) { + this.Main_Base.render(f5); + this.Main_Base_Outer_Layer.render(f5); + this.Pivot_Support_1.render(f5); + this.Pivot_Support_2.render(f5); + this.Pivot_Support_3.render(f5); + this.Pivot_Point.rotateAngleY = rotation; + this.Pivot_Point.render(f5); + this.Dish_Support.rotateAngleY = rotation; + this.Dish_Support.render(f5); + this.Focus_Support_1.rotateAngleY = rotation - 0.15f; + this.Focus_Support_1.render(f5); + this.Focus_Support_2.rotateAngleY = rotation + 0.15f; + this.Focus_Support_2.render(f5); + this.Focus_Point.rotateAngleY = rotation; + this.Focus_Point.render(f5); + this.Main_Dish_Support.rotateAngleY = rotation; + this.Main_Dish_Support.render(f5); + this.Main_Dish_Piece.rotateAngleY = rotation; + this.Main_Dish_Piece.render(f5); + this.Secondary_Dish_Piece_1.rotateAngleY = rotation - 0.6f; + this.Secondary_Dish_Piece_1.render(f5); + this.Secondary_Dish_Piece_2.rotateAngleY = rotation + 0.6f; + this.Secondary_Dish_Piece_2.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiShePao.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiShePao.java new file mode 100644 index 0000000..13a222f --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiShePao.java @@ -0,0 +1,96 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MLeiShePao extends ModelBase { + ModelRenderer Turret_Base; + ModelRenderer Support_1; + ModelRenderer Support_2; + ModelRenderer Support_3; + ModelRenderer Support_4; + ModelRenderer Turret_Neck; + ModelRenderer Turret_Body; + + public MLeiShePao() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Turret_Base = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 14, 14, 14); + this.Turret_Base.setRotationPoint(-7.0f, 10.0f, -7.0f); + this.Turret_Base.setTextureSize(128, 128); + this.Turret_Base.mirror = true; + this.setRotation(this.Turret_Base, 0.0f, 0.0f, 0.0f); + (this.Support_1 = new ModelRenderer((ModelBase)this, 0, 60)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Support_1.setRotationPoint(6.0f, 18.0f, 6.0f); + this.Support_1.setTextureSize(128, 128); + this.Support_1.mirror = true; + this.setRotation(this.Support_1, 0.0f, 0.0f, 0.0f); + (this.Support_2 = new ModelRenderer((ModelBase)this, 0, 60)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Support_2.setRotationPoint(6.0f, 18.0f, -8.0f); + this.Support_2.setTextureSize(128, 128); + this.Support_2.mirror = true; + this.setRotation(this.Support_2, 0.0f, 0.0f, 0.0f); + (this.Support_3 = new ModelRenderer((ModelBase)this, 0, 60)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Support_3.setRotationPoint(-8.0f, 18.0f, -8.0f); + this.Support_3.setTextureSize(128, 128); + this.Support_3.mirror = true; + this.setRotation(this.Support_3, 0.0f, 0.0f, 0.0f); + (this.Support_4 = new ModelRenderer((ModelBase)this, 0, 60)) + .addBox(0.0f, 0.0f, 0.0f, 2, 6, 2); + this.Support_4.setRotationPoint(-8.0f, 18.0f, 6.0f); + this.Support_4.setTextureSize(128, 128); + this.Support_4.mirror = true; + this.setRotation(this.Support_4, 0.0f, 0.0f, 0.0f); + (this.Turret_Neck = new ModelRenderer((ModelBase)this, 10, 60)) + .addBox(-1.0f, 0.0f, -1.0f, 2, 1, 2); + this.Turret_Neck.setRotationPoint(0.0f, -1.0f, 0.0f); + this.Turret_Neck.setTextureSize(128, 128); + this.Turret_Neck.mirror = true; + this.setRotation(this.Turret_Neck, 0.0f, 0.0f, 0.0f); + (this.Turret_Body = new ModelRenderer((ModelBase)this, 0, 30)) + .addBox(0.0f, 0.0f, 0.0f, 10, 11, 10); + this.Turret_Body.setRotationPoint(-5.0f, 0.0f, -5.0f); + this.Turret_Body.setTextureSize(128, 128); + this.Turret_Body.mirror = true; + this.setRotation(this.Turret_Body, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.Turret_Base.render(f5); + this.Support_1.render(f5); + this.Support_2.render(f5); + this.Support_3.render(f5); + this.Support_4.render(f5); + this.Turret_Neck.render(f5); + this.Turret_Body.render(f5); + } + + public void render(final float f5) { + this.Turret_Body.render(f5); + this.Turret_Base.render(f5); + this.Support_1.render(f5); + this.Support_2.render(f5); + this.Support_3.render(f5); + this.Support_4.render(f5); + this.Turret_Neck.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiShePao2.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiShePao2.java new file mode 100644 index 0000000..9cd90fe --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MLeiShePao2.java @@ -0,0 +1,132 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MLeiShePao2 extends ModelBase { + ModelRenderer Main_Turret_MOVES; + ModelRenderer Back_Armor_MOVES; + ModelRenderer Armor_1_MOVES; + ModelRenderer Armor_2_MOVES; + ModelRenderer Armor_3_MOVES; + ModelRenderer Armor_4_MOVES; + ModelRenderer Armor_5_MOVES; + ModelRenderer Armor_6_MOVES; + ModelRenderer Front_Armor_1_MOVES; + ModelRenderer Front_Armor_2_MOVES; + ModelRenderer Cannon_MOVES; + + public MLeiShePao2() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.Main_Turret_MOVES = new ModelRenderer((ModelBase)this, 60, 10)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 4, 14); + this.Main_Turret_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Main_Turret_MOVES.setTextureSize(128, 128); + this.Main_Turret_MOVES.mirror = true; + this.setRotation(this.Main_Turret_MOVES, 0.0f, 0.0f, 0.0f); + (this.Back_Armor_MOVES = new ModelRenderer((ModelBase)this, 60, 0)) + .addBox(-5.0f, 5.0f, 5.0f, 10, 3, 3); + this.Back_Armor_MOVES.setRotationPoint(0.0f, -3.0f, 0.0f); + this.Back_Armor_MOVES.setTextureSize(128, 128); + this.Back_Armor_MOVES.mirror = true; + this.setRotation(this.Back_Armor_MOVES, 0.7853982f, 0.0f, 0.0f); + (this.Armor_1_MOVES = new ModelRenderer((ModelBase)this, 90, 0)) + .addBox(3.0f, 0.0f, 0.0f, 4, 4, 3); + this.Armor_1_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Armor_1_MOVES.setTextureSize(128, 128); + this.Armor_1_MOVES.mirror = true; + this.setRotation(this.Armor_1_MOVES, 0.0f, 0.7504916f, 0.0f); + (this.Armor_2_MOVES = new ModelRenderer((ModelBase)this, 60, 30)) + .addBox(4.0f, 0.0f, -2.0f, 4, 4, 8); + this.Armor_2_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Armor_2_MOVES.setTextureSize(128, 128); + this.Armor_2_MOVES.mirror = true; + this.setRotation(this.Armor_2_MOVES, 0.0f, -0.4363323f, 0.0f); + (this.Armor_3_MOVES = new ModelRenderer((ModelBase)this, 90, 30)) + .addBox(4.0f, 0.0f, -1.0f, 4, 4, 4); + this.Armor_3_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Armor_3_MOVES.setTextureSize(128, 128); + this.Armor_3_MOVES.mirror = true; + this.setRotation(this.Armor_3_MOVES, 0.0f, 0.1919862f, 0.0f); + (this.Armor_4_MOVES = new ModelRenderer((ModelBase)this, 90, 0)) + .addBox(3.0f, 0.0f, -3.0f, 4, 4, 3); + this.Armor_4_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Armor_4_MOVES.setTextureSize(128, 128); + this.Armor_4_MOVES.mirror = true; + this.setRotation(this.Armor_4_MOVES, 0.0f, 2.391101f, 0.0f); + (this.Armor_5_MOVES = new ModelRenderer((ModelBase)this, 90, 30)) + .addBox(-1.0f, 0.0f, 4.0f, 4, 4, 4); + this.Armor_5_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Armor_5_MOVES.setTextureSize(128, 128); + this.Armor_5_MOVES.mirror = true; + this.setRotation(this.Armor_5_MOVES, 0.0f, -1.780236f, 0.0f); + (this.Armor_6_MOVES = new ModelRenderer((ModelBase)this, 60, 30)) + .addBox(-8.0f, 0.0f, -2.0f, 4, 4, 8); + this.Armor_6_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Armor_6_MOVES.setTextureSize(128, 128); + this.Armor_6_MOVES.mirror = true; + this.setRotation(this.Armor_6_MOVES, 0.0f, 0.4363323f, 0.0f); + (this.Front_Armor_1_MOVES = new ModelRenderer((ModelBase)this, 110, 0)) + .addBox(-5.0f, 3.0f, -4.0f, 4, 4, 2); + this.Front_Armor_1_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Front_Armor_1_MOVES.setTextureSize(128, 128); + this.Front_Armor_1_MOVES.mirror = true; + this.setRotation(this.Front_Armor_1_MOVES, -0.6457718f, 0.0f, 0.0f); + (this.Front_Armor_2_MOVES = new ModelRenderer((ModelBase)this, 110, 0)) + .addBox(1.0f, 3.0f, -4.0f, 4, 4, 2); + this.Front_Armor_2_MOVES.setRotationPoint(0.0f, -5.0f, 0.0f); + this.Front_Armor_2_MOVES.setTextureSize(128, 128); + this.Front_Armor_2_MOVES.mirror = true; + this.setRotation(this.Front_Armor_2_MOVES, -0.6457718f, 0.0f, 0.0f); + (this.Cannon_MOVES = new ModelRenderer((ModelBase)this, 60, 50)) + .addBox(-1.0f, 0.0f, -22.0f, 2, 2, 17); + this.Cannon_MOVES.setRotationPoint(0.0f, -4.0f, 0.0f); + this.Cannon_MOVES.setTextureSize(128, 128); + this.Cannon_MOVES.mirror = true; + this.setRotation(this.Cannon_MOVES, 0.0f, 0.0f, 0.0f); + } + + public void render(final Entity entity, final float f, final float f1, + final float f2, final float f3, final float f4, + final float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.Main_Turret_MOVES.render(f5); + this.Back_Armor_MOVES.render(f5); + this.Armor_1_MOVES.render(f5); + this.Armor_2_MOVES.render(f5); + this.Armor_3_MOVES.render(f5); + this.Armor_4_MOVES.render(f5); + this.Armor_5_MOVES.render(f5); + this.Armor_6_MOVES.render(f5); + this.Front_Armor_1_MOVES.render(f5); + this.Front_Armor_2_MOVES.render(f5); + this.Cannon_MOVES.render(f5); + } + + public void render(final float f5) { + this.Main_Turret_MOVES.render(f5); + this.Back_Armor_MOVES.render(f5); + this.Armor_1_MOVES.render(f5); + this.Armor_2_MOVES.render(f5); + this.Armor_3_MOVES.render(f5); + this.Armor_4_MOVES.render(f5); + this.Armor_5_MOVES.render(f5); + this.Armor_6_MOVES.render(f5); + this.Front_Armor_1_MOVES.render(f5); + this.Front_Armor_2_MOVES.render(f5); + this.Cannon_MOVES.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MSMine.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MSMine.java new file mode 100644 index 0000000..ef6fe0a --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MSMine.java @@ -0,0 +1,63 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MSMine extends MICBM { + public static final MSMine INSTANCE; + ModelRenderer A; + ModelRenderer B; + ModelRenderer C; + + public MSMine() { + super.textureWidth = 45; + super.textureHeight = 26; + (this.A = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-5.0f, 0.0f, -5.0f, 10, 2, 10); + this.A.setRotationPoint(0.0f, 22.0f, 0.0f); + this.A.setTextureSize(45, 26); + this.A.mirror = true; + this.setRotation(this.A, 0.0f, 0.7853982f, 0.0f); + (this.B = new ModelRenderer((ModelBase)this, 0, 14)) + .addBox(-8.0f, 0.0f, -2.0f, 16, 1, 4); + this.B.setRotationPoint(0.0f, 23.0f, 0.0f); + this.B.setTextureSize(45, 26); + this.B.mirror = true; + this.setRotation(this.B, 0.0f, 0.7853982f, 0.0f); + (this.C = new ModelRenderer((ModelBase)this, 0, 14)) + .addBox(-8.0f, 0.0f, -2.0f, 16, 1, 4); + this.C.setRotationPoint(0.0f, 23.0f, 0.0f); + this.C.setTextureSize(45, 26); + this.C.mirror = true; + this.setRotation(this.C, 0.0f, 2.356194f, 0.0f); + } + + @Override + public void render(final float f5) { + this.A.render(f5); + this.B.render(f5); + this.C.render(f5); + } + + public void render(final Entity entity, final float x, final float y, + final float z, final float f1, final float f2, + final float f3) { + super.render(entity, x, y, z, f1, f2, f3); + this.setRotationAngles(x, y, z, f1, f2, f3, entity); + this.render(f3); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + static { INSTANCE = new MSMine(); } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MShouFaSheQi.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MShouFaSheQi.java new file mode 100644 index 0000000..6630cf4 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MShouFaSheQi.java @@ -0,0 +1,222 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MShouFaSheQi extends ModelBase { + ModelRenderer a; + ModelRenderer b; + ModelRenderer c; + ModelRenderer d; + ModelRenderer e; + ModelRenderer f; + ModelRenderer g; + ModelRenderer h; + ModelRenderer i; + ModelRenderer j; + ModelRenderer k; + ModelRenderer l; + ModelRenderer m; + ModelRenderer n; + ModelRenderer o; + ModelRenderer p; + ModelRenderer q; + ModelRenderer r; + ModelRenderer s; + ModelRenderer t; + ModelRenderer u; + + public MShouFaSheQi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.a = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-2.0f, -2.0f, -16.0f, 4, 4, 34); + this.a.setRotationPoint(0.0f, 19.0f, 0.0f); + this.a.setTextureSize(128, 128); + this.a.mirror = true; + this.setRotation(this.a, 0.0f, 0.0f, 0.0f); + (this.b = new ModelRenderer((ModelBase)this, 0, 7)) + .addBox(0.0f, 0.0f, 0.0f, 1, 3, 2); + this.b.setRotationPoint(0.0f, 21.0f, -10.0f); + this.b.setTextureSize(128, 128); + this.b.mirror = true; + this.setRotation(this.b, 0.2792527f, 0.0f, 0.0f); + (this.c = new ModelRenderer((ModelBase)this, 7, 6)) + .addBox(0.0f, 0.0f, 0.0f, 1, 4, 2); + this.c.setRotationPoint(0.0f, 21.0f, 2.0f); + this.c.setTextureSize(128, 128); + this.c.mirror = true; + this.setRotation(this.c, 0.0f, 0.0f, 0.0f); + (this.d = new ModelRenderer((ModelBase)this, 14, 3)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 4, 0); + this.d.setRotationPoint(0.0f, 11.0f, -14.0f); + this.d.setTextureSize(128, 128); + this.d.mirror = true; + this.setRotation(this.d, 0.0f, 0.0f, 0.0f); + (this.e = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-1.0f, 0.0f, 0.0f, 2, 1, 4); + this.e.setRotationPoint(0.0f, 16.0f, -15.0f); + this.e.setTextureSize(128, 128); + this.e.mirror = true; + this.setRotation(this.e, 0.0f, 0.0f, 0.0f); + (this.f = new ModelRenderer((ModelBase)this, 14, 0)) + .addBox(-2.0f, 0.0f, 0.0f, 4, 2, 0); + this.f.setRotationPoint(0.0f, 15.0f, -14.0f); + this.f.setTextureSize(128, 128); + this.f.mirror = true; + this.setRotation(this.f, 0.0f, 0.0f, 0.0f); + (this.g = new ModelRenderer((ModelBase)this, 0, 40)) + .addBox(0.0f, -1.0f, 0.0f, 3, 1, 12); + this.g.setRotationPoint(-3.0f, 20.0f, 9.0f); + this.g.setTextureSize(128, 128); + this.g.mirror = true; + this.setRotation(this.g, 0.0f, 0.0f, 0.7853982f); + (this.h = new ModelRenderer((ModelBase)this, 0, 53)) + .addBox(-3.0f, 0.0f, 0.0f, 3, 1, 8); + this.h.setRotationPoint(-1.0f, 16.0f, 11.0f); + this.h.setTextureSize(128, 128); + this.h.mirror = true; + this.setRotation(this.h, 0.0f, 0.0f, -0.7853982f); + (this.i = new ModelRenderer((ModelBase)this, 31, 40)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 12); + this.i.setRotationPoint(-1.0f, 21.0f, 9.0f); + this.i.setTextureSize(128, 128); + this.i.mirror = true; + this.setRotation(this.i, 0.0f, 0.0f, 0.0f); + (this.j = new ModelRenderer((ModelBase)this, 23, 53)) + .addBox(0.0f, 0.0f, 0.0f, 2, 1, 8); + this.j.setRotationPoint(-1.0f, 16.0f, 11.0f); + this.j.setTextureSize(128, 128); + this.j.mirror = true; + this.setRotation(this.j, 0.0f, 0.0f, 0.0f); + (this.k = new ModelRenderer((ModelBase)this, 0, 53)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 8); + this.k.setRotationPoint(1.0f, 16.0f, 11.0f); + this.k.setTextureSize(128, 128); + this.k.mirror = true; + this.setRotation(this.k, 0.0f, 0.0f, 0.7853982f); + (this.l = new ModelRenderer((ModelBase)this, 0, 40)) + .addBox(0.0f, -1.0f, 0.0f, 3, 1, 12); + this.l.setRotationPoint(1.0f, 22.0f, 9.0f); + this.l.setTextureSize(128, 128); + this.l.mirror = true; + this.setRotation(this.l, 0.0f, 0.0f, -0.7853982f); + (this.m = new ModelRenderer((ModelBase)this, 47, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 2, 6); + this.m.setRotationPoint(2.0f, 15.0f, -10.0f); + this.m.setTextureSize(128, 128); + this.m.mirror = true; + this.setRotation(this.m, 0.0f, 0.0f, 0.0f); + (this.n = new ModelRenderer((ModelBase)this, 47, 10)) + .addBox(0.0f, 0.0f, 0.0f, 2, 3, 1); + this.n.setRotationPoint(2.0f, 15.0f, -9.0f); + this.n.setTextureSize(128, 128); + this.n.mirror = true; + this.setRotation(this.n, 0.0f, 0.0f, 0.7853982f); + (this.o = new ModelRenderer((ModelBase)this, 47, 10)) + .addBox(0.0f, 0.0f, 0.0f, 2, 3, 1); + this.o.setRotationPoint(2.0f, 15.0f, -6.0f); + this.o.setTextureSize(128, 128); + this.o.mirror = true; + this.setRotation(this.o, 0.0f, 0.0f, 0.7853982f); + (this.p = new ModelRenderer((ModelBase)this, 0, 14)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 4); + this.p.setRotationPoint(1.0f, 16.0f, -17.0f); + this.p.setTextureSize(128, 128); + this.p.mirror = true; + this.setRotation(this.p, 0.0f, 0.0f, 0.7853982f); + (this.q = new ModelRenderer((ModelBase)this, 0, 14)) + .addBox(0.0f, -1.0f, 0.0f, 3, 1, 4); + this.q.setRotationPoint(1.0f, 22.0f, -17.0f); + this.q.setTextureSize(128, 128); + this.q.mirror = true; + this.setRotation(this.q, 0.0f, 0.0f, -0.7853982f); + (this.r = new ModelRenderer((ModelBase)this, 0, 21)) + .addBox(-1.0f, 0.0f, 0.0f, 1, 2, 4); + this.r.setRotationPoint(3.0f, 18.0f, -17.0f); + this.r.setTextureSize(128, 128); + this.r.mirror = true; + this.setRotation(this.r, 0.0f, 0.0f, 0.0f); + (this.s = new ModelRenderer((ModelBase)this, 0, 14)) + .addBox(0.0f, 0.0f, 0.0f, 3, 1, 4); + this.s.setRotationPoint(-3.0f, 18.0f, -17.0f); + this.s.setTextureSize(128, 128); + this.s.mirror = true; + this.setRotation(this.s, 0.0f, 0.0f, -0.7853982f); + (this.t = new ModelRenderer((ModelBase)this, 0, 21)) + .addBox(0.0f, -1.0f, 0.0f, 1, 2, 4); + this.t.setRotationPoint(-3.0f, 19.0f, -17.0f); + this.t.setTextureSize(128, 128); + this.t.mirror = true; + this.setRotation(this.t, 0.0f, 0.0f, 0.0f); + (this.u = new ModelRenderer((ModelBase)this, 0, 14)) + .addBox(0.0f, -1.0f, 0.0f, 3, 1, 4); + this.u.setRotationPoint(-3.0f, 20.0f, -17.0f); + this.u.setTextureSize(128, 128); + this.u.mirror = true; + this.setRotation(this.u, 0.0f, 0.0f, 0.7853982f); + } + + public void render(final Entity entity, final float x, final float y, + final float z, final float f3, final float f4, + final float f5) { + super.render(entity, x, y, z, f3, f4, f5); + this.setRotationAngles(x, y, z, f3, f4, f5, entity); + this.a.render(f5); + this.b.render(f5); + this.c.render(f5); + this.d.render(f5); + this.e.render(f5); + this.f.render(f5); + this.g.render(f5); + this.h.render(f5); + this.i.render(f5); + this.j.render(f5); + this.k.render(f5); + this.l.render(f5); + this.m.render(f5); + this.n.render(f5); + this.o.render(f5); + this.p.render(f5); + this.q.render(f5); + this.r.render(f5); + this.s.render(f5); + this.t.render(f5); + this.u.render(f5); + } + + public void render(final float f5) { + this.a.render(f5); + this.b.render(f5); + this.c.render(f5); + this.d.render(f5); + this.e.render(f5); + this.f.render(f5); + this.g.render(f5); + this.h.render(f5); + this.i.render(f5); + this.j.render(f5); + this.k.render(f5); + this.l.render(f5); + this.m.render(f5); + this.n.render(f5); + this.o.render(f5); + this.p.render(f5); + this.q.render(f5); + this.r.render(f5); + this.s.render(f5); + this.t.render(f5); + this.u.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MXiaoFaSheQi.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MXiaoFaSheQi.java new file mode 100644 index 0000000..b62df59 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MXiaoFaSheQi.java @@ -0,0 +1,104 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MXiaoFaSheQi extends ModelBase { + ModelRenderer SUPPORT_1; + ModelRenderer SUPPORT_2; + ModelRenderer SUPPORT_3; + ModelRenderer SUPPORT_4; + ModelRenderer SUPPORT_5; + ModelRenderer SUPPORT_6; + ModelRenderer MAIN_BODY; + ModelRenderer MAIN_SUPPORT; + ModelRenderer TORQUE_ROT; + + public MXiaoFaSheQi() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.SUPPORT_1 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-1.0f, 0.0f, -21.0f, 2, 1, 42); + this.SUPPORT_1.setRotationPoint(0.0f, 21.0f, 0.0f); + this.SUPPORT_1.setTextureSize(128, 128); + this.SUPPORT_1.mirror = true; + this.setRotation(this.SUPPORT_1, 0.0f, 0.7853982f, 0.0f); + (this.SUPPORT_2 = new ModelRenderer((ModelBase)this, 0, 0)) + .addBox(-1.0f, 0.0f, -21.0f, 2, 1, 42); + this.SUPPORT_2.setRotationPoint(0.0f, 21.0f, 0.0f); + this.SUPPORT_2.setTextureSize(128, 128); + this.SUPPORT_2.mirror = true; + this.setRotation(this.SUPPORT_2, 0.0f, 2.356194f, 0.0f); + (this.SUPPORT_3 = new ModelRenderer((ModelBase)this, 0, 28)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.SUPPORT_3.setRotationPoint(-16.0f, 21.0f, -16.0f); + this.SUPPORT_3.setTextureSize(128, 128); + this.SUPPORT_3.mirror = true; + this.setRotation(this.SUPPORT_3, 0.0f, 0.0f, 0.0f); + (this.SUPPORT_4 = new ModelRenderer((ModelBase)this, 0, 28)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.SUPPORT_4.setRotationPoint(12.0f, 21.0f, -16.0f); + this.SUPPORT_4.setTextureSize(128, 128); + this.SUPPORT_4.mirror = true; + this.setRotation(this.SUPPORT_4, 0.0f, 0.0f, 0.0f); + (this.SUPPORT_5 = new ModelRenderer((ModelBase)this, 0, 28)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.SUPPORT_5.setRotationPoint(12.0f, 21.0f, 12.0f); + this.SUPPORT_5.setTextureSize(128, 128); + this.SUPPORT_5.mirror = true; + this.setRotation(this.SUPPORT_5, 0.0f, 0.0f, 0.0f); + (this.SUPPORT_6 = new ModelRenderer((ModelBase)this, 0, 28)) + .addBox(0.0f, 0.0f, 0.0f, 4, 3, 4); + this.SUPPORT_6.setRotationPoint(-16.0f, 21.0f, 12.0f); + this.SUPPORT_6.setTextureSize(128, 128); + this.SUPPORT_6.mirror = true; + this.setRotation(this.SUPPORT_6, 0.0f, 0.0f, 0.0f); + (this.MAIN_BODY = new ModelRenderer((ModelBase)this, 0, 46)) + .addBox(0.0f, 0.0f, 0.0f, 6, 4, 6); + this.MAIN_BODY.setRotationPoint(-3.0f, 20.0f, -3.0f); + this.MAIN_BODY.setTextureSize(128, 128); + this.MAIN_BODY.mirror = true; + this.setRotation(this.MAIN_BODY, 0.0f, 0.0f, 0.0f); + (this.MAIN_SUPPORT = new ModelRenderer((ModelBase)this, 0, 59)) + .addBox(0.0f, 0.0f, 0.0f, 4, 2, 4); + this.MAIN_SUPPORT.setRotationPoint(-2.0f, 18.0f, -2.0f); + this.MAIN_SUPPORT.setTextureSize(128, 128); + this.MAIN_SUPPORT.mirror = true; + this.setRotation(this.MAIN_SUPPORT, 0.0f, 0.0f, 0.0f); + (this.TORQUE_ROT = new ModelRenderer((ModelBase)this, 0, 68)) + .addBox(-1.0f, -4.0f, -1.0f, 2, 4, 2); + this.TORQUE_ROT.setRotationPoint(0.0f, 18.0f, 0.0f); + this.TORQUE_ROT.setTextureSize(128, 128); + this.TORQUE_ROT.mirror = true; + this.setRotation(this.TORQUE_ROT, 0.0f, 0.7853982f, 0.0f); + } + + public void render(final float f5) { + this.SUPPORT_1.render(f5); + this.SUPPORT_2.render(f5); + this.SUPPORT_3.render(f5); + this.SUPPORT_4.render(f5); + this.SUPPORT_5.render(f5); + this.SUPPORT_6.render(f5); + this.MAIN_BODY.render(f5); + this.MAIN_SUPPORT.render(f5); + this.TORQUE_ROT.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(final float f, final float f1, final float f2, + final float f3, final float f4, final float f5, + final Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MXiaoFaSheQiJia.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MXiaoFaSheQiJia.java new file mode 100644 index 0000000..83b3b78 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MXiaoFaSheQiJia.java @@ -0,0 +1,88 @@ +package icbm.zhapin.muoxing.jiqi; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +@SideOnly(Side.CLIENT) +public class MXiaoFaSheQiJia extends ModelBase { + ModelRenderer CLAMP_1_ROT; + ModelRenderer CLAMP_2_ROT; + ModelRenderer COUNTERBALANCE_1_ROT; + ModelRenderer COUNTERBALANCE_2_ROT; + ModelRenderer RAIL_1_ROT; + ModelRenderer RAIL_2_ROT; + ModelRenderer TORQUE_SUPPORT_ROT; + + public MXiaoFaSheQiJia() { + super.textureWidth = 128; + super.textureHeight = 128; + (this.CLAMP_1_ROT = new ModelRenderer((ModelBase)this, 20, 0)) + .addBox(-1.0f, -1.0f, -17.0f, 6, 6, 1); + this.CLAMP_1_ROT.setRotationPoint(0.0f, 13.0f, 0.0f); + this.CLAMP_1_ROT.setTextureSize(128, 128); + this.CLAMP_1_ROT.mirror = true; + this.setRotation(this.CLAMP_1_ROT, 0.0f, 0.0f, -2.356194f); + (this.CLAMP_2_ROT = new ModelRenderer((ModelBase)this, 20, 0)) + .addBox(-1.0f, -1.0f, 0.0f, 6, 6, 1); + this.CLAMP_2_ROT.setRotationPoint(0.0f, 13.0f, 0.0f); + this.CLAMP_2_ROT.setTextureSize(128, 128); + this.CLAMP_2_ROT.mirror = true; + this.setRotation(this.CLAMP_2_ROT, 0.0f, 0.0f, -2.356194f); + (this.COUNTERBALANCE_1_ROT = new ModelRenderer((ModelBase)this, 84, 0)) + .addBox(1.0f, -4.0f, 1.0f, 4, 4, 8); + this.COUNTERBALANCE_1_ROT.setRotationPoint(0.0f, 14.0f, 0.0f); + this.COUNTERBALANCE_1_ROT.setTextureSize(128, 128); + this.COUNTERBALANCE_1_ROT.mirror = true; + this.setRotation(this.COUNTERBALANCE_1_ROT, 0.0f, 0.0f, 0.0f); + (this.COUNTERBALANCE_2_ROT = new ModelRenderer((ModelBase)this, 84, 0)) + .addBox(-5.0f, -4.0f, 1.0f, 4, 4, 8); + this.COUNTERBALANCE_2_ROT.setRotationPoint(0.0f, 14.0f, 0.0f); + this.COUNTERBALANCE_2_ROT.setTextureSize(128, 128); + this.COUNTERBALANCE_2_ROT.mirror = true; + this.setRotation(this.COUNTERBALANCE_2_ROT, 0.0f, 0.0f, 0.0f); + (this.RAIL_1_ROT = new ModelRenderer((ModelBase)this, 65, 13)) + .addBox(-5.0f, -1.0f, -17.0f, 4, 1, 18); + this.RAIL_1_ROT.setRotationPoint(0.0f, 14.0f, 0.0f); + this.RAIL_1_ROT.setTextureSize(128, 128); + this.RAIL_1_ROT.mirror = true; + this.setRotation(this.RAIL_1_ROT, 0.0f, 0.0f, 0.7853982f); + (this.RAIL_2_ROT = new ModelRenderer((ModelBase)this, 65, 13)) + .addBox(-5.0f, 0.0f, -17.0f, 4, 1, 18); + this.RAIL_2_ROT.setRotationPoint(0.0f, 14.0f, 0.0f); + this.RAIL_2_ROT.setTextureSize(128, 128); + this.RAIL_2_ROT.mirror = true; + this.setRotation(this.RAIL_2_ROT, 0.0f, 0.0f, 2.356194f); + (this.TORQUE_SUPPORT_ROT = new ModelRenderer((ModelBase)this, 47, 17)) + .addBox(-2.0f, 0.0f, -2.0f, 4, 2, 4); + this.TORQUE_SUPPORT_ROT.setRotationPoint(0.0f, 13.0f, 0.0f); + this.TORQUE_SUPPORT_ROT.setTextureSize(128, 128); + this.TORQUE_SUPPORT_ROT.mirror = true; + this.setRotation(this.TORQUE_SUPPORT_ROT, 0.0f, 0.0f, 0.0f); + } + + public void render(final float f5) { + this.CLAMP_1_ROT.render(f5); + this.CLAMP_2_ROT.render(f5); + this.COUNTERBALANCE_1_ROT.render(f5); + this.COUNTERBALANCE_2_ROT.render(f5); + this.RAIL_1_ROT.render(f5); + this.RAIL_2_ROT.render(f5); + this.TORQUE_SUPPORT_ROT.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(final float f, final float f1, final float f2, + final float f3, final float f4, final float f5, + final Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } +} diff --git a/src/main/java/icbm/zhapin/muoxing/jiqi/MYinDaoQi.java b/src/main/java/icbm/zhapin/muoxing/jiqi/MYinDaoQi.java new file mode 100644 index 0000000..6806a67 --- /dev/null +++ b/src/main/java/icbm/zhapin/muoxing/jiqi/MYinDaoQi.java @@ -0,0 +1,303 @@ +package icbm.zhapin.muoxing.jiqi; + +import icbm.core.di.MICBM; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class MYinDaoQi extends MICBM { + ModelRenderer Stand2; + ModelRenderer Stand1; + ModelRenderer Console6; + ModelRenderer Stand3; + ModelRenderer Console1; + ModelRenderer Console3; + ModelRenderer Screen1; + ModelRenderer Screen2; + ModelRenderer Radio1; + ModelRenderer Radio_Cable2; + ModelRenderer Radio_Antennae; + ModelRenderer Radio2; + ModelRenderer Radio_Antennae2; + ModelRenderer Keyboard; + ModelRenderer Button5; + ModelRenderer Button4; + ModelRenderer Button14; + ModelRenderer Button15; + ModelRenderer Button13; + ModelRenderer Console5; + ModelRenderer Console4; + ModelRenderer Button8; + ModelRenderer Button2; + ModelRenderer Button7; + ModelRenderer Button1; + ModelRenderer Button11; + ModelRenderer Button12; + ModelRenderer Button10; + ModelRenderer Button16; + ModelRenderer Button17; + ModelRenderer Button18; + ModelRenderer Standend2; + ModelRenderer Standend1; + ModelRenderer Console2; + ModelRenderer Radio_Cable; + + public MYinDaoQi() { + super.textureWidth = 64; + super.textureHeight = 32; + (this.Stand2 = new ModelRenderer((ModelBase)this, 0, 9)) + .addBox(-1.0f, 0.0f, -10.0f, 2, 1, 17); + this.Stand2.setRotationPoint(0.0f, 23.0f, 0.0f); + this.Stand2.setTextureSize(64, 32); + this.Stand2.mirror = true; + this.setRotation(this.Stand2, 0.0f, 0.7853982f, 0.0f); + (this.Stand1 = new ModelRenderer((ModelBase)this, 0, 9)) + .addBox(-1.0f, 0.0f, -10.0f, 2, 1, 17); + this.Stand1.setRotationPoint(0.0f, 23.0f, 0.0f); + this.Stand1.setTextureSize(64, 32); + this.Stand1.mirror = true; + this.setRotation(this.Stand1, 0.0f, -0.7853982f, 0.0f); + (this.Console6 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(0.75f, -1.1f, 0.8f, 1, 1, 1); + this.Console6.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Console6.setTextureSize(64, 32); + this.Console6.mirror = true; + this.setRotation(this.Console6, 0.1396263f, 0.0f, 0.0f); + (this.Stand3 = new ModelRenderer((ModelBase)this, 56, 15)) + .addBox(-1.0f, -5.0f, -1.0f, 2, 6, 2); + this.Stand3.setRotationPoint(0.0f, 23.0f, 0.0f); + this.Stand3.setTextureSize(64, 32); + this.Stand3.mirror = true; + this.setRotation(this.Stand3, -0.7853982f, 0.0f, 0.0f); + (this.Console1 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(0.8f, -1.1f, 0.8f, 1, 1, 1); + this.Console1.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Console1.setTextureSize(64, 32); + this.Console1.mirror = true; + this.setRotation(this.Console1, 0.1396263f, -0.7853982f, 0.0f); + (this.Console3 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(0.8f, -1.1f, 0.8f, 1, 1, 1); + this.Console3.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Console3.setTextureSize(64, 32); + this.Console3.mirror = true; + this.setRotation(this.Console3, 0.1396263f, 0.7853982f, 0.0f); + (this.Screen1 = new ModelRenderer((ModelBase)this, 0, 27)) + .addBox(-7.0f, -3.0f, 0.0f, 6, 5, 0); + this.Screen1.setRotationPoint(0.0f, 15.0f, 4.0f); + this.Screen1.setTextureSize(64, 32); + this.Screen1.mirror = true; + this.setRotation(this.Screen1, 0.0f, -0.2792527f, 0.0f); + (this.Screen2 = new ModelRenderer((ModelBase)this, 0, 27)) + .addBox(1.0f, -3.0f, 0.0f, 6, 5, 0); + this.Screen2.setRotationPoint(0.0f, 15.0f, 4.0f); + this.Screen2.setTextureSize(64, 32); + this.Screen2.mirror = true; + this.setRotation(this.Screen2, 0.0f, 0.2792527f, 0.0f); + (this.Radio1 = new ModelRenderer((ModelBase)this, 50, 23)) + .addBox(-1.0f, 0.0f, -1.0f, 4, 6, 3); + this.Radio1.setRotationPoint(-4.0f, 24.0f, 5.0f); + this.Radio1.setTextureSize(64, 32); + this.Radio1.mirror = true; + this.setRotation(this.Radio1, 0.0f, 0.0f, 3.141593f); + (this.Radio_Cable2 = new ModelRenderer((ModelBase)this, 12, 20)) + .addBox(-0.5f, 0.0f, -0.5f, 1, 5, 1); + this.Radio_Cable2.setRotationPoint(-3.5f, 22.0f, 5.0f); + this.Radio_Cable2.setTextureSize(64, 32); + this.Radio_Cable2.mirror = true; + this.setRotation(this.Radio_Cable2, -1.570796f, -0.7853982f, 3.141593f); + (this.Radio_Antennae = new ModelRenderer((ModelBase)this, 46, 27)) + .addBox(-0.5f, 0.0f, -0.5f, 1, 4, 1); + this.Radio_Antennae.setRotationPoint(-6.0f, 18.0f, 5.5f); + this.Radio_Antennae.setTextureSize(64, 32); + this.Radio_Antennae.mirror = true; + this.setRotation(this.Radio_Antennae, 0.0f, 0.0f, 3.141593f); + (this.Radio2 = new ModelRenderer((ModelBase)this, 50, 23)) + .addBox(-1.0f, 0.0f, -1.0f, 4, 6, 3); + this.Radio2.setRotationPoint(6.0f, 24.0f, 5.0f); + this.Radio2.setTextureSize(64, 32); + this.Radio2.mirror = true; + this.setRotation(this.Radio2, 0.0f, 0.0f, 3.141593f); + (this.Radio_Antennae2 = new ModelRenderer((ModelBase)this, 46, 27)) + .addBox(-0.5f, 0.0f, -0.5f, 1, 4, 1); + this.Radio_Antennae2.setRotationPoint(5.75f, 18.0f, 5.5f); + this.Radio_Antennae2.setTextureSize(64, 32); + this.Radio_Antennae2.mirror = true; + this.setRotation(this.Radio_Antennae2, 0.0f, 0.0f, 3.141593f); + (this.Keyboard = new ModelRenderer((ModelBase)this, 21, 23)) + .addBox(-4.0f, -1.0f, 0.0f, 8, 1, 2); + this.Keyboard.setRotationPoint(0.0f, 20.0f, 0.0f); + this.Keyboard.setTextureSize(64, 32); + this.Keyboard.mirror = true; + this.setRotation(this.Keyboard, 3.141593f, 0.0f, 0.0f); + (this.Button5 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-0.5f, -1.1f, 0.8f, 1, 1, 1); + this.Button5.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Button5.setTextureSize(64, 32); + this.Button5.mirror = true; + this.setRotation(this.Button5, 0.1396263f, 0.0f, 0.0f); + (this.Button4 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-1.8f, -1.1f, 0.8f, 1, 1, 1); + this.Button4.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Button4.setTextureSize(64, 32); + this.Button4.mirror = true; + this.setRotation(this.Button4, 0.1396263f, 0.0f, 0.0f); + (this.Button14 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-0.5f, -1.1f, -0.5f, 1, 1, 1); + this.Button14.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Button14.setTextureSize(64, 32); + this.Button14.mirror = true; + this.setRotation(this.Button14, 0.1396263f, 0.0f, 0.0f); + (this.Button15 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(0.75f, -1.1f, -0.5f, 1, 1, 1); + this.Button15.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Button15.setTextureSize(64, 32); + this.Button15.mirror = true; + this.setRotation(this.Button15, 0.1396263f, 0.0f, 0.0f); + (this.Button13 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-1.8f, -1.1f, -0.5f, 1, 1, 1); + this.Button13.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Button13.setTextureSize(64, 32); + this.Button13.mirror = true; + this.setRotation(this.Button13, 0.1396263f, 0.0f, 0.0f); + (this.Console5 = new ModelRenderer((ModelBase)this, 16, 28)) + .addBox(-3.0f, -1.0f, -1.0f, 6, 1, 3); + this.Console5.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Console5.setTextureSize(64, 32); + this.Console5.mirror = true; + this.setRotation(this.Console5, 0.1396263f, 0.7853982f, 0.0f); + (this.Console4 = new ModelRenderer((ModelBase)this, 16, 28)) + .addBox(-3.0f, -1.0f, -1.0f, 6, 1, 3); + this.Console4.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Console4.setTextureSize(64, 32); + this.Console4.mirror = true; + this.setRotation(this.Console4, 0.1396263f, -0.7853982f, 0.0f); + (this.Button8 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-0.5f, -1.1f, 0.8f, 1, 1, 1); + this.Button8.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Button8.setTextureSize(64, 32); + this.Button8.mirror = true; + this.setRotation(this.Button8, 0.1396263f, 0.7853982f, 0.0f); + (this.Button2 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-0.5f, -1.1f, 0.8f, 1, 1, 1); + this.Button2.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Button2.setTextureSize(64, 32); + this.Button2.mirror = true; + this.setRotation(this.Button2, 0.1396263f, -0.7853982f, 0.0f); + (this.Button7 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-1.8f, -1.1f, 0.8f, 1, 1, 1); + this.Button7.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Button7.setTextureSize(64, 32); + this.Button7.mirror = true; + this.setRotation(this.Button7, 0.1396263f, 0.7853982f, 0.0f); + (this.Button1 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-1.8f, -1.1f, 0.8f, 1, 1, 1); + this.Button1.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Button1.setTextureSize(64, 32); + this.Button1.mirror = true; + this.setRotation(this.Button1, 0.1396263f, -0.7853982f, 0.0f); + (this.Button11 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-0.5f, -1.1f, -0.5f, 1, 1, 1); + this.Button11.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Button11.setTextureSize(64, 32); + this.Button11.mirror = true; + this.setRotation(this.Button11, 0.1396263f, -0.7853982f, 0.0f); + (this.Button12 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(0.8f, -1.1f, -0.5f, 1, 1, 1); + this.Button12.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Button12.setTextureSize(64, 32); + this.Button12.mirror = true; + this.setRotation(this.Button12, 0.1396263f, -0.7853982f, 0.0f); + (this.Button10 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-1.8f, -1.1f, -0.5f, 1, 1, 1); + this.Button10.setRotationPoint(-3.8f, 20.0f, -0.6f); + this.Button10.setTextureSize(64, 32); + this.Button10.mirror = true; + this.setRotation(this.Button10, 0.1396263f, -0.7853982f, 0.0f); + (this.Button16 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-1.8f, -1.1f, -0.5f, 1, 1, 1); + this.Button16.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Button16.setTextureSize(64, 32); + this.Button16.mirror = true; + this.setRotation(this.Button16, 0.1396263f, 0.7853982f, 0.0f); + (this.Button17 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(-0.5f, -1.1f, -0.5f, 1, 1, 1); + this.Button17.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Button17.setTextureSize(64, 32); + this.Button17.mirror = true; + this.setRotation(this.Button17, 0.1396263f, 0.7853982f, 0.0f); + (this.Button18 = new ModelRenderer((ModelBase)this, 12, 30)) + .addBox(0.8f, -1.1f, -0.5f, 1, 1, 1); + this.Button18.setRotationPoint(3.85f, 20.0f, -0.6f); + this.Button18.setTextureSize(64, 32); + this.Button18.mirror = true; + this.setRotation(this.Button18, 0.1396263f, 0.7853982f, 0.0f); + (this.Standend2 = new ModelRenderer((ModelBase)this, 0, 21)) + .addBox(0.0f, 0.0f, 0.0f, 3, 2, 3); + this.Standend2.setRotationPoint(4.9f, 22.9f, -7.9f); + this.Standend2.setTextureSize(64, 32); + this.Standend2.mirror = true; + this.setRotation(this.Standend2, 0.0f, 0.0f, 0.0f); + (this.Standend1 = new ModelRenderer((ModelBase)this, 0, 21)) + .addBox(0.0f, 0.0f, 0.0f, 3, 2, 3); + this.Standend1.setRotationPoint(-7.9f, 22.9f, -7.9f); + this.Standend1.setTextureSize(64, 32); + this.Standend1.mirror = true; + this.setRotation(this.Standend1, 0.0f, 0.0f, 0.0f); + (this.Console2 = new ModelRenderer((ModelBase)this, 16, 28)) + .addBox(-3.0f, -1.0f, -1.0f, 6, 1, 3); + this.Console2.setRotationPoint(0.0f, 20.0f, 1.0f); + this.Console2.setTextureSize(64, 32); + this.Console2.mirror = true; + this.setRotation(this.Console2, 0.1396263f, 0.0f, 0.0f); + (this.Radio_Cable = new ModelRenderer((ModelBase)this, 12, 20)) + .addBox(-0.5f, 0.0f, -0.5f, 1, 5, 1); + this.Radio_Cable.setRotationPoint(3.5f, 22.0f, 5.0f); + this.Radio_Cable.setTextureSize(64, 32); + this.Radio_Cable.mirror = true; + this.setRotation(this.Radio_Cable, -1.570796f, 0.7853982f, 3.141593f); + } + + public void render(final float rotation, final float f5) { + this.Stand2.render(f5); + this.Stand1.render(f5); + this.Console6.render(f5); + this.Stand3.render(f5); + this.Console1.render(f5); + this.Console3.render(f5); + this.Screen1.render(f5); + this.Screen2.render(f5); + this.Radio1.render(f5); + this.Radio_Cable2.render(f5); + this.Radio_Antennae.render(f5); + this.Radio2.render(f5); + this.Radio_Antennae2.render(f5); + this.Keyboard.render(f5); + this.Button5.render(f5); + this.Button4.render(f5); + this.Button14.render(f5); + this.Button15.render(f5); + this.Button13.render(f5); + this.Console5.render(f5); + this.Console4.render(f5); + this.Button8.render(f5); + this.Button2.render(f5); + this.Button7.render(f5); + this.Button1.render(f5); + this.Button11.render(f5); + this.Button12.render(f5); + this.Button10.render(f5); + this.Button16.render(f5); + this.Button17.render(f5); + this.Button18.render(f5); + this.Standend2.render(f5); + this.Standend1.render(f5); + this.Console2.render(f5); + this.Radio_Cable.render(f5); + } + + private void setRotation(final ModelRenderer model, final float x, + final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/icbm/zhapin/po/PChuanRanDu.java b/src/main/java/icbm/zhapin/po/PChuanRanDu.java new file mode 100644 index 0000000..a7cd9e9 --- /dev/null +++ b/src/main/java/icbm/zhapin/po/PChuanRanDu.java @@ -0,0 +1,76 @@ +package icbm.zhapin.po; + +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import universalelectricity.core.vector.Vector3; + +public class PChuanRanDu extends PICBM { + public static PChuanRanDu INSTANCE; + + public PChuanRanDu(final int id, final boolean isBadEffect, final int color, + final String name) { + super(id, isBadEffect, color, name); + this.setIconIndex(6, 0); + } + + @Override + public void performEffect(final EntityLivingBase entityLiving, + final int amplifier) { + if (!(entityLiving instanceof EntityZombie) && + !(entityLiving instanceof EntityPigZombie)) { + entityLiving.attackEntityFrom(DamageSource.magic, 1); + } + if (!ICBMExplosion.shiBaoHu(((Entity)entityLiving).worldObj, + new Vector3((Entity)entityLiving), + ZhaPin.ZhaPinType.QUAN_BU, ZhaPin.chemical)) { + final int r = 13; + final AxisAlignedBB entitySurroundings = AxisAlignedBB.getBoundingBox( + ((Entity)entityLiving).posX - r, ((Entity)entityLiving).posY - r, + ((Entity)entityLiving).posZ - r, ((Entity)entityLiving).posX + r, + ((Entity)entityLiving).posY + r, ((Entity)entityLiving).posZ + r); + final List entities = + entityLiving + .worldObj.getEntitiesWithinAABB(EntityLivingBase.class, + entitySurroundings); + for (final EntityLivingBase entity : entities) { + if (entity != null) { + if (entity instanceof EntityPig) { + final EntityPigZombie var2 = + new EntityPigZombie(((Entity)entity).worldObj); + var2.setLocationAndAngles( + ((Entity)entity).posX, ((Entity)entity).posY, + ((Entity)entity).posZ, ((Entity)entity).rotationYaw, + ((Entity)entity).rotationPitch); + ((Entity)entity).worldObj.spawnEntityInWorld((Entity)var2); + entity.setDead(); + } else if (entity instanceof EntityVillager) { + final EntityZombie var3 = + new EntityZombie(((Entity)entity).worldObj); + var3.setLocationAndAngles( + ((Entity)entity).posX, ((Entity)entity).posY, + ((Entity)entity).posZ, ((Entity)entity).rotationYaw, + ((Entity)entity).rotationPitch); + ((Entity)entity).worldObj.spawnEntityInWorld((Entity)var3); + entity.setDead(); + } + ICBMExplosion.DU_CHUAN_RAN.poisonEntity( + new Vector3((Entity)entityLiving), entity); + } + } + } + } + + @Override + public boolean isReady(final int duration, final int amplifier) { + return duration % 40 == 0; + } +} diff --git a/src/main/java/icbm/zhapin/po/PDaDu.java b/src/main/java/icbm/zhapin/po/PDaDu.java new file mode 100644 index 0000000..b4f7a2c --- /dev/null +++ b/src/main/java/icbm/zhapin/po/PDaDu.java @@ -0,0 +1,30 @@ +package icbm.zhapin.po; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.util.DamageSource; + +public class PDaDu extends PICBM { + public static PDaDu INSTANCE; + + public PDaDu(final int id, final boolean isBadEffect, final int color, + final String name) { + super(id, isBadEffect, color, name); + this.setIconIndex(6, 0); + } + + @Override + public void performEffect(final EntityLivingBase par1EntityLiving, + final int amplifier) { + if (!(par1EntityLiving instanceof EntityZombie) && + !(par1EntityLiving instanceof EntityPigZombie)) { + par1EntityLiving.attackEntityFrom(DamageSource.magic, 1); + } + } + + @Override + public boolean isReady(final int duration, final int amplifier) { + return duration % 40 == 0; + } +} diff --git a/src/main/java/icbm/zhapin/po/PDongShang.java b/src/main/java/icbm/zhapin/po/PDongShang.java new file mode 100644 index 0000000..ea74367 --- /dev/null +++ b/src/main/java/icbm/zhapin/po/PDongShang.java @@ -0,0 +1,46 @@ +package icbm.zhapin.po; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; + +public class PDongShang extends PICBM { + public static PDongShang INSTANCE; + + public PDongShang(final int id, final boolean isBadEffect, final int color, + final String name) { + super(id, isBadEffect, color, name); + this.setIconIndex(6, 0); + } + + @Override + public void performEffect(final EntityLivingBase par1EntityLiving, + final int amplifier) { + if (par1EntityLiving instanceof EntityPlayer) { + ((EntityPlayer)par1EntityLiving).addExhaustion(3.0f * (amplifier + 1)); + } + if (par1EntityLiving.isBurning()) { + par1EntityLiving.extinguish(); + par1EntityLiving.removePotionEffect(super.id); + } + if (((Entity)par1EntityLiving) + .worldObj.getBlock( + MathHelper.floor_double(((Entity)par1EntityLiving).posX), + MathHelper.floor_double(((Entity)par1EntityLiving).posY) - 1, + MathHelper.floor_double(((Entity)par1EntityLiving).posZ)) == + Blocks.ice) { + par1EntityLiving.attackEntityFrom(DamageSource.magic, 2); + } + if (par1EntityLiving.getHealth() < 6) { + par1EntityLiving.attackEntityFrom(DamageSource.magic, 999999999); + } + } + + @Override + public boolean isReady(final int duration, final int amplifier) { + return duration % 20 == 0; + } +} diff --git a/src/main/java/icbm/zhapin/po/PICBM.java b/src/main/java/icbm/zhapin/po/PICBM.java new file mode 100644 index 0000000..a266216 --- /dev/null +++ b/src/main/java/icbm/zhapin/po/PICBM.java @@ -0,0 +1,12 @@ +package icbm.zhapin.po; + +import icbm.core.MainBase; +import universalelectricity.prefab.potion.CustomPotion; + +public abstract class PICBM extends CustomPotion { + public PICBM(final int id, final boolean isBadEffect, final int color, + final String name) { + super(MainBase.CONFIGURATION.get("Potion", name, id).getInt(id), + isBadEffect, color, name); + } +} diff --git a/src/main/java/icbm/zhapin/render/REZhaDan.java b/src/main/java/icbm/zhapin/render/REZhaDan.java new file mode 100644 index 0000000..09d852e --- /dev/null +++ b/src/main/java/icbm/zhapin/render/REZhaDan.java @@ -0,0 +1,82 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class REZhaDan extends Render { + private RenderBlocks blockRenderer; + + public REZhaDan() { + this.blockRenderer = new RenderBlocks(); + super.shadowSize = 0.5f; + } + + @Override + public void doRender(final Entity par1Entity, final double x, final double y, + final double z, final float par8, final float par9) { + final EExplosive entityExplosive = (EExplosive)par1Entity; + final Object[] data = ZhaPin.list[entityExplosive.haoMa].getRenderData(); + if (data != null) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)x, (float)y + 1.0f, (float)z); + this.bindTexture((ResourceLocation)data[1]); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + ((MICBM)data[0]) + .render((Entity)entityExplosive, (float)x, (float)y, (float)z, par8, + par9, 0.0625f); + GL11.glPopMatrix(); + } else { + GL11.glPushMatrix(); + GL11.glTranslatef((float)x, (float)y, (float)z); + if (entityExplosive.fuse - par9 + 1.0f < 10.0f) { + float f2 = 1.0f - (entityExplosive.fuse - par9 + 1.0f) / 10.0f; + if (f2 < 0.0f) { + f2 = 0.0f; + } + if (f2 > 1.0f) { + f2 = 1.0f; + } + f2 *= f2; + f2 *= f2; + final float f3 = 1.0f + f2 * 0.3f; + GL11.glScalef(f3, f3, f3); + } + float f2 = (1.0f - (entityExplosive.fuse - par9 + 1.0f) / 100.0f) * 0.8f; + // TODO: this is the wrong ResourceLocation name + this.bindTexture(new ResourceLocation("textures/terrain.png")); + this.blockRenderer.renderBlockAsItem(ICBMExplosion.bExplosives, + entityExplosive.haoMa, + entityExplosive.getBrightness(par9)); + if (entityExplosive.fuse / 5 % 2 == 0) { + GL11.glDisable(3553); + GL11.glDisable(2896); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 772); + GL11.glColor4f(1.0f, 1.0f, 1.0f, f2); + this.blockRenderer.renderBlockAsItem(Blocks.tnt, 0, 1.0f); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GL11.glDisable(3042); + GL11.glEnable(2896); + GL11.glEnable(3553); + } + GL11.glPopMatrix(); + } + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; + } +} diff --git a/src/main/java/icbm/zhapin/render/REmpTower.java b/src/main/java/icbm/zhapin/render/REmpTower.java new file mode 100644 index 0000000..4e3a929 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/REmpTower.java @@ -0,0 +1,36 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TEmpTower; +import icbm.zhapin.muoxing.jiqi.MDianCiQi; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class REmpTower extends TileEntitySpecialRenderer { + public static final MDianCiQi MODEL; + public static final String TEXTURE_FILE = "emp_tower.png"; + + public void renderAModelAt(final TEmpTower tileEntity, final double x, + final double y, final double z, final float f) { + GL11.glPushMatrix(); + GL11.glTranslatef((float)x + 0.5f, (float)y + 1.5f, (float)z + 0.5f); + this.bindTexture( + new ResourceLocation("icbm", "textures/models/emp_tower.png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + REmpTower.MODEL.render(tileEntity.xuanZhuan, 0.0625f); + GL11.glPopMatrix(); + } + + @Override + public void renderTileEntityAt(final TileEntity tileentity, final double x, + final double y, final double z, + final float f) { + this.renderAModelAt((TEmpTower)tileentity, x, y, z, f); + } + + static { MODEL = new MDianCiQi(); } +} diff --git a/src/main/java/icbm/zhapin/render/RFaSheDi.java b/src/main/java/icbm/zhapin/render/RFaSheDi.java new file mode 100644 index 0000000..8080909 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RFaSheDi.java @@ -0,0 +1,69 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TLauncherPlatform; +import icbm.zhapin.muoxing.jiqi.MFaSheDi0; +import icbm.zhapin.muoxing.jiqi.MFaSheDi1; +import icbm.zhapin.muoxing.jiqi.MFaSheDi2; +import icbm.zhapin.muoxing.jiqi.MFaSheDiRail0; +import icbm.zhapin.muoxing.jiqi.MFaSheDiRail1; +import icbm.zhapin.muoxing.jiqi.MFaSheDiRail2; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RFaSheDi extends TileEntitySpecialRenderer { + public static final MFaSheDi0 modelBase0; + public static final MFaSheDiRail0 modelRail0; + public static final MFaSheDi1 modelBase1; + public static final MFaSheDiRail1 modelRail1; + public static final MFaSheDi2 modelBase2; + public static final MFaSheDiRail2 modelRail2; + + @Override + public void renderTileEntityAt(final TileEntity tileentity, final double x, + final double y, final double z, + final float f) { + final TLauncherPlatform tileEntity = (TLauncherPlatform) tileentity; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/launcher_" + tileEntity.getTier() + ".png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + if (tileEntity.getDirection((IBlockAccess) tileEntity.getWorldObj(), (int) x, + (int) y, (int) z) != ForgeDirection.NORTH && + tileEntity.getDirection((IBlockAccess) tileEntity.getWorldObj(), (int) x, + (int) y, (int) z) != ForgeDirection.SOUTH) { + GL11.glRotatef(90.0f, 0.0f, 180.0f, 1.0f); + } + if (tileEntity.getTier() == 0) { + RFaSheDi.modelBase0.render(0.0625f); + RFaSheDi.modelRail0.render(0.0625f); + } else if (tileEntity.getTier() == 1) { + RFaSheDi.modelBase1.render(0.0625f); + RFaSheDi.modelRail1.render(0.0625f); + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + RFaSheDi.modelRail1.render(0.0625f); + } else if (tileEntity.getTier() == 2) { + RFaSheDi.modelBase2.render(0.0625f); + RFaSheDi.modelRail2.render(0.0625f); + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + RFaSheDi.modelRail2.render(0.0625f); + } + GL11.glPopMatrix(); + } + + static { + modelBase0 = new MFaSheDi0(); + modelRail0 = new MFaSheDiRail0(); + modelBase1 = new MFaSheDi1(); + modelRail1 = new MFaSheDiRail1(); + modelBase2 = new MFaSheDi2(); + modelRail2 = new MFaSheDiRail2(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RFaSheJia.java b/src/main/java/icbm/zhapin/render/RFaSheJia.java new file mode 100644 index 0000000..aa7edc6 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RFaSheJia.java @@ -0,0 +1,46 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TLauncher; +import icbm.zhapin.muoxing.jiqi.MFaSheJia; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RFaSheJia extends TileEntitySpecialRenderer { + public static final MFaSheJia MODEL; + + @Override + public void renderTileEntityAt(final TileEntity var1, final double x, + final double y, final double z, + final float var8) { + final TLauncher tileEntity = (TLauncher) var1; + if (tileEntity != null && tileEntity.getWorldObj() != null) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.25f, (float) z + 0.5f); + GL11.glScalef(1.0f, 0.85f, 1.0f); + this.bindTexture( + new ResourceLocation("icbm", "textures/models/launcher_0.png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + if (tileEntity.getDirection((IBlockAccess) tileEntity.getWorldObj(), + (int) x, (int) y, + (int) z) != ForgeDirection.NORTH && + tileEntity.getDirection((IBlockAccess) tileEntity.getWorldObj(), + (int) x, (int) y, + (int) z) != ForgeDirection.SOUTH) { + GL11.glRotatef(90.0f, 0.0f, 180.0f, 1.0f); + } + RFaSheJia.MODEL.render(0.0625f); + GL11.glPopMatrix(); + } + } + + static { + MODEL = new MFaSheJia(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RFeiBlock.java b/src/main/java/icbm/zhapin/render/RFeiBlock.java new file mode 100644 index 0000000..421fac9 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RFeiBlock.java @@ -0,0 +1,113 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.EGravityBlock; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RFeiBlock extends Render { + public RFeiBlock() { + super.shadowSize = 0.5f; + } + + public void doRenderGravityBlock(final EGravityBlock entity, final double x, + final double y, final double z, + final float par8, final float par9) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y, (float) z); + // TODO: wrong resourceloc + this.bindTexture(new ResourceLocation("minecraft", "textures/terrain.png")); + final Block block = entity.block; + final World world = entity.worldObj; + GL11.glDisable(2896); + GL11.glRotatef(entity.rotationPitch, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(entity.rotationYaw, 0.0f, 1.0f, 0.0f); + this.field_147909_c.blockAccess = (IBlockAccess) world; + + // TODO: looks as shit as vanilla furnace fuel impl + if (block == Blocks.dragon_egg || block == Blocks.grass || + block == Blocks.fence || block == Blocks.wheat || + block == Blocks.leaves || block == Blocks.redstone_torch || + block == Blocks.torch || block == Blocks.tallgrass || + block == Blocks.vine || block == Blocks.log || + block == Blocks.bookshelf || block == Blocks.pumpkin) { + final Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setTranslation( + (double) (-MathHelper.floor_double(entity.posX) - 0.5f), + (double) (-MathHelper.floor_double(entity.posY) - 0.5f), + (double) (-MathHelper.floor_double(entity.posZ) - 0.5f)); + this.field_147909_c.renderBlockByRenderType( + block, MathHelper.floor_double(entity.posX), + MathHelper.floor_double(entity.posY), + MathHelper.floor_double(entity.posZ)); + tessellator.setTranslation(0.0, 0.0, 0.0); + tessellator.draw(); + } else { + this.renderBlockGravity(block, entity.metadata, this.field_147909_c); + } + GL11.glEnable(2896); + GL11.glPopMatrix(); + } + + public void renderBlockGravity(final Block block, final int metadata, + final RenderBlocks renderer) { + final float var6 = 0.5f; + final float var7 = 1.0f; + final float var8 = 0.8f; + final float var9 = 0.6f; + final Tessellator tess = Tessellator.instance; + tess.startDrawingQuads(); + final float var10 = 1.0f; + tess.setColorOpaque_F(var6 * var10, var6 * var10, var6 * var10); + renderer.renderFaceYNeg( + block, -0.5, -0.5, -0.5, + renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); + tess.setColorOpaque_F(var7 * var10, var7 * var10, var7 * var10); + renderer.renderFaceYPos( + block, -0.5, -0.5, -0.5, + renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); + tess.setColorOpaque_F(var8 * var10, var8 * var10, var8 * var10); + renderer.renderFaceZNeg( + block, -0.5, -0.5, -0.5, + renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); + tess.setColorOpaque_F(var8 * var10, var8 * var10, var8 * var10); + renderer.renderFaceZPos( + block, -0.5, -0.5, -0.5, + renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); + tess.setColorOpaque_F(var9 * var10, var9 * var10, var9 * var10); + renderer.renderFaceXNeg( + block, -0.5, -0.5, -0.5, + renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); + tess.setColorOpaque_F(var9 * var10, var9 * var10, var9 * var10); + renderer.renderFaceXPos( + block, -0.5, -0.5, -0.5, + renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); + tess.draw(); + } + + @Override + public void doRender(final Entity par1Entity, final double par2, + final double par4, final double par6, final float par8, + final float par9) { + this.doRenderGravityBlock((EGravityBlock) par1Entity, par2, par4, par6, par8, + par9); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; + } +} diff --git a/src/main/java/icbm/zhapin/render/RGuangBang.java b/src/main/java/icbm/zhapin/render/RGuangBang.java new file mode 100644 index 0000000..2cc4318 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RGuangBang.java @@ -0,0 +1,95 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.ELightBeam; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RGuangBang extends Render { + @Override + public void doRender(final Entity par1Entity, final double x, final double y, + final double z, final float f, final float f1) { + if (super.renderManager == null) { + this.setRenderManager(RenderManager.instance); + } + final ELightBeam entity = (ELightBeam) par1Entity; + final Tessellator tessellator = Tessellator.instance; + GL11.glDisable(3553); + GL11.glDisable(2896); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + final double[] ad = new double[80]; + final double[] ad2 = new double[80]; + final double d3 = 0.0; + final double d4 = 0.0; + for (int j = 7; j >= 0; --j) { + ad[j] = d3; + ad2[j] = d4; + } + for (int i = 0; i < 4; ++i) { + for (int ii = 0; ii < 3; ++ii) { + int l = 7; + int i2 = 0; + if (ii > 0) { + l = 7 - ii; + } + if (ii > 0) { + i2 = l - 2; + } + final double d5 = ad[l] - d3; + final double d6 = ad2[l] - d4; + for (int iii = l; iii >= i2; --iii) { + final double d7 = d5; + final double d8 = d6; + tessellator.startDrawing(5); + tessellator.setColorRGBA_F(entity.red, entity.green, entity.blue, + 10.0f); + double d9 = 0.1 + i * 0.2; + if (ii == 0) { + d9 *= iii * 0.1 + 1.0; + } + double d10 = 0.1 + i * 0.2; + if (ii == 0) { + d10 *= (iii - 1) * 0.1 + 1.0; + } + for (int iiii = 0; iiii < 5; ++iiii) { + double d11 = x + 0.5 - d9; + double d12 = z + 0.5 - d9; + if (iiii == 1 || iiii == 2) { + d11 += d9 * 2.0; + } + if (iiii == 2 || iiii == 3) { + d12 += d9 * 2.0; + } + double d13 = x + 0.5 - d10; + double d14 = z + 0.5 - d10; + if (iiii == 1 || iiii == 2) { + d13 += d10 * 2.0; + } + if (iiii == 2 || iiii == 3) { + d14 += d10 * 2.0; + } + tessellator.addVertex(d13 + d5, y + iii * 16, d14 + d6); + tessellator.addVertex(d11 + d7, y + (iii + 1) * 16, d12 + d8); + } + tessellator.draw(); + } + } + } + GL11.glDisable(3042); + GL11.glEnable(2896); + GL11.glEnable(3553); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; + } +} diff --git a/src/main/java/icbm/zhapin/render/RHJiQi.java b/src/main/java/icbm/zhapin/render/RHJiQi.java new file mode 100644 index 0000000..45f57a6 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RHJiQi.java @@ -0,0 +1,125 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.BMachine; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RHJiQi implements ISimpleBlockRenderingHandler { + public static final int ID; + + @Override + public void renderInventoryBlock(final Block block, final int metadata, + final int modelID, + final RenderBlocks renderer) { + if (modelID == RHJiQi.ID) { + GL11.glPushMatrix(); + if (metadata < BMachine.JiQi.FaSheDi.ordinal() * 3 + 3) { + final int tier = metadata; + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glScalef(0.4f, 0.4f, 0.4f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", + "textures/models/launcher_" + tier + ".png")); + if (tier == 0) { + RFaSheDi.modelBase0.render(0.0625f); + RFaSheDi.modelRail0.render(0.0625f); + } else if (tier == 1) { + RFaSheDi.modelBase1.render(0.0625f); + RFaSheDi.modelRail1.render(0.0625f); + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + RFaSheDi.modelRail1.render(0.0625f); + } else if (tier == 2) { + RFaSheDi.modelBase2.render(0.0625f); + RFaSheDi.modelRail2.render(0.0625f); + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + RFaSheDi.modelRail2.render(0.0625f); + } + } else if (metadata < BMachine.JiQi.FaSheShiMuo.ordinal() * 3 + 3) { + final int tier = metadata - 3; + GL11.glTranslatef(0.0f, 0.9f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", + "textures/models/launcher_" + tier + ".png")); + if (tier == 0) { + RLauncherControlPanel.model0.render(0.0625f); + } else if (tier == 1) { + RLauncherControlPanel.model1.render(0.0625f); + } else if (tier == 2) { + RLauncherControlPanel.model2.render(0.0625f); + } + } else if (metadata < BMachine.JiQi.FaSheJia.ordinal() * 3 + 3) { + GL11.glTranslatef(0.0f, -0.1f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glScalef(0.8f, 0.4f, 0.8f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/models/launcher_0.png")); + RFaSheJia.MODEL.render(0.0625f); + } else if (metadata == BMachine.JiQi.LeiDaTai.ordinal() + 6) { + GL11.glTranslatef(0.0f, 0.2f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glScalef(0.55f, 0.6f, 0.55f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/models/radar.png")); + RRadarTower.MODEL.render(1.2f, 0.0625f); + } else if (metadata == BMachine.JiQi.DianCiQi.ordinal() + 6) { + GL11.glTranslatef(0.0f, 0.3f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glScalef(0.6f, 0.6f, 0.6f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/models/emp_tower.png")); + REmpTower.MODEL.render(0.0f, 0.0625f); + } else if (metadata == BMachine.JiQi.XiaoFaSheQi.ordinal() + 6) { + GL11.glTranslatef(0.0f, 0.4f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glScalef(0.55f, 0.5f, 0.55f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", + "textures/models/cruise_launcher.png")); + RXiaoFaSheQi.MODEL0.render(0.0625f); + RXiaoFaSheQi.MODEL1.render(0.0625f); + } else if (metadata == BMachine.JiQi.YinDaoQi.ordinal() + 6) { + GL11.glTranslatef(0.0f, 1.1f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation( + "icbm", "textures/models/missile_coordinator_off.png")); + RYinDaoQi.MODEL.render(0.0f, 0.0625f); + } + GL11.glPopMatrix(); + } + } + + @Override + public boolean renderWorldBlock(final IBlockAccess iBlockAccess, final int x, + final int y, final int z, final Block block, + final int modelID, + final RenderBlocks renderer) { + return false; + } + + @Override + public boolean shouldRender3DInInventory(int meta) { + return true; + } + + @Override + public int getRenderId() { + return RHJiQi.ID; + } + + static { + ID = RenderingRegistry.getNextAvailableRenderId(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RHZhaPin.java b/src/main/java/icbm/zhapin/render/RHZhaPin.java new file mode 100644 index 0000000..ef3b503 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RHZhaPin.java @@ -0,0 +1,77 @@ +package icbm.zhapin.render; + +import calclavia.lib.render.CalclaviaRenderHelper; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.MainBase; +import icbm.zhapin.muoxing.jiqi.MSMine; +import icbm.zhapin.zhapin.TExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RHZhaPin implements ISimpleBlockRenderingHandler { + public static final int ID; + + @Override + public void renderInventoryBlock(final Block block, final int metadata, + final int modelID, + final RenderBlocks renderer) { + if (modelID == RHZhaPin.ID) { + if (metadata == ZhaPin.sMine.getID()) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.0f, 1.5f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/models/s-mine.png")); + MSMine.INSTANCE.render(0.0625f); + GL11.glPopMatrix(); + } else { + try { + CalclaviaRenderHelper.renderNormalBlockAsItem(block, metadata, + renderer); + } catch (final Exception e) { + MainBase.LOGGER.severe("ICBM Explosive Rendering Crash with: " + + block + " and metadata: " + metadata); + e.printStackTrace(); + } + } + } + } + + @Override + public boolean renderWorldBlock(final IBlockAccess iBlockAccess, final int x, + final int y, final int z, final Block block, + final int modelID, + final RenderBlocks renderer) { + if (modelID != RHZhaPin.ID) { + return false; + } + if (((TExplosive) iBlockAccess.getTileEntity(x, y, z)).explosiveId == ZhaPin.sMine.getID()) { + return false; + } + renderer.renderStandardBlock(block, x, y, z); + return true; + } + + @Override + public boolean shouldRender3DInInventory(int meta) { + return true; + } + + @Override + public int getRenderId() { + return RHZhaPin.ID; + } + + static { + ID = RenderingRegistry.getNextAvailableRenderId(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RItDaoDan.java b/src/main/java/icbm/zhapin/render/RItDaoDan.java new file mode 100644 index 0000000..fde3b01 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RItDaoDan.java @@ -0,0 +1,80 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.ItMissile; +import icbm.zhapin.daodan.MissileBase; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RItDaoDan implements IItemRenderer { + public boolean handleRenderType(final ItemStack item, + final IItemRenderer.ItemRenderType type) { + return this.shouldUseRenderHelper(type, item, null); + } + + public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, + final ItemStack item, + final IItemRenderer.ItemRendererHelper helper) { + return item.getItem() instanceof ItMissile; + } + + public void renderItem(final IItemRenderer.ItemRenderType type, + final ItemStack item, final Object... data) { + if (this.shouldUseRenderHelper(type, item, null)) { + float scale = 0.7f; + float right = 0.0f; + if (type == IItemRenderer.ItemRenderType.INVENTORY) { + scale = 0.4f; + right = 0.15f; + if (ZhaPin.list[item.getItemDamage()].getTier() == 2 || + item.getItem() == ICBMExplosion.itTeBieDaoDan) { + scale /= 1.5f; + } else if (ZhaPin.list[item.getItemDamage()].getTier() == 3) { + scale /= 1.7f; + right = 0.5f; + } else if (ZhaPin.list[item.getItemDamage()].getTier() == 4) { + scale /= 1.4f; + right = 0.2f; + } + GL11.glTranslatef(right, 0.0f, 0.0f); + } + if (type == IItemRenderer.ItemRenderType.EQUIPPED) { + GL11.glTranslatef(1.15f, 1.0f, 0.5f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + } else { + GL11.glRotatef(-90.0f, 0.0f, 0.0f, 1.0f); + } + if (type == IItemRenderer.ItemRenderType.ENTITY) { + scale /= 1.5f; + } + GL11.glScalef(scale, scale, scale); + if (item.getItem() == ICBMExplosion.itTeBieDaoDan) { + if (item.getItemDamage() < RMissile.SPECIAL_MODELS.length) { + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation( + "icbm", "textures/models/missile_" + + MissileBase.list[item.getItemDamage() + 100] + .getUnlocalizedName() + + + ".png")); + RMissile.SPECIAL_MODELS[item.getItemDamage()].render(0.0625f); + } + } else { + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation( + "icbm", + "textures/models/missile_" + + ZhaPin.list[item.getItemDamage()].getUnlocalizedName() + + ".png")); + RMissile.MODELS[item.getItemDamage()].render(0.0625f); + } + } + } +} diff --git a/src/main/java/icbm/zhapin/render/RItRocketLauncher.java b/src/main/java/icbm/zhapin/render/RItRocketLauncher.java new file mode 100644 index 0000000..02f022c --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RItRocketLauncher.java @@ -0,0 +1,64 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.muoxing.jiqi.MShouFaSheQi; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RItRocketLauncher implements IItemRenderer { + public static final MShouFaSheQi MODEL; + + public boolean handleRenderType(final ItemStack item, + final IItemRenderer.ItemRenderType type) { + return item.getItem() == ICBMExplosion.itFaSheQi; + } + + public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, + final ItemStack item, + final IItemRenderer.ItemRendererHelper helper) { + return item.getItem() == ICBMExplosion.itFaSheQi; + } + + public void renderItem(final IItemRenderer.ItemRenderType type, + final ItemStack item, final Object... data) { + GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/models/rocket_launcher.png")); + if (type == IItemRenderer.ItemRenderType.INVENTORY) { + GL11.glTranslatef(0.0f, 1.5f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glScalef(0.8f, 1.0f, 0.8f); + GL11.glTranslatef(0.0f, 0.3f, 0.0f); + } else if (type == IItemRenderer.ItemRenderType.EQUIPPED) { + boolean isThisEntity = false; + final boolean isFirstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; + if (data != null && data.length >= 2) { + isThisEntity = (data[1] == Minecraft.getMinecraft().renderViewEntity); + } + if (isThisEntity && isFirstPerson) { + GL11.glTranslatef(0.0f, 2.0f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(20.0f, 0.0f, 1.0f, 0.0f); + } else { + final float scale = 2.0f; + GL11.glScalef(scale, scale, scale); + GL11.glRotatef(-105.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(-75.0f, 0.0f, 1.0f, 0.0f); + GL11.glTranslatef(0.1f, -0.9f, 0.6f); + } + } + RItRocketLauncher.MODEL.render(0.0625f); + GL11.glPopMatrix(); + } + + static { + MODEL = new MShouFaSheQi(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RLauncherControlPanel.java b/src/main/java/icbm/zhapin/render/RLauncherControlPanel.java new file mode 100644 index 0000000..c005338 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RLauncherControlPanel.java @@ -0,0 +1,71 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TLauncherControlPanel; +import icbm.zhapin.muoxing.jiqi.MFaSheShiMuo0; +import icbm.zhapin.muoxing.jiqi.MFaSheShiMuo1; +import icbm.zhapin.muoxing.jiqi.MFaSheShiMuo2; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RLauncherControlPanel extends TileEntitySpecialRenderer { + public static final MFaSheShiMuo0 model0; + public static final MFaSheShiMuo1 model1; + public static final MFaSheShiMuo2 model2; + + @Override + public void renderTileEntityAt(final TileEntity var1, final double x, + final double y, final double z, + final float var8) { + final TLauncherControlPanel tileEntity = (TLauncherControlPanel) var1; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + this.bindTexture( + new ResourceLocation("icbm", "textures/models/launcher_" + + tileEntity.getTier() + ".png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + switch (tileEntity + .getDirection((IBlockAccess) tileEntity.getWorldObj(), (int) x, + (int) y, (int) z) + .ordinal()) { + case 2: { + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + break; + } + case 4: { + GL11.glRotatef(90.0f, 0.0f, 180.0f, 1.0f); + break; + } + case 5: { + GL11.glRotatef(-90.0f, 0.0f, 180.0f, 1.0f); + break; + } + } + switch (tileEntity.getTier()) { + case 0: { + RLauncherControlPanel.model0.render(0.0625f); + break; + } + case 1: { + RLauncherControlPanel.model1.render(0.0625f); + break; + } + case 2: { + RLauncherControlPanel.model2.render(0.0625f); + break; + } + } + GL11.glPopMatrix(); + } + + static { + model0 = new MFaSheShiMuo0(); + model1 = new MFaSheShiMuo1(); + model2 = new MFaSheShiMuo2(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RMissile.java b/src/main/java/icbm/zhapin/render/RMissile.java new file mode 100644 index 0000000..1dcbbad --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RMissile.java @@ -0,0 +1,108 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.daodan.MissileBase; +import icbm.zhapin.muoxing.daodan.MMBingDan; +import icbm.zhapin.muoxing.daodan.MMChaoShengBuo; +import icbm.zhapin.muoxing.daodan.MMDianCi; +import icbm.zhapin.muoxing.daodan.MMDuQi; +import icbm.zhapin.muoxing.daodan.MMFanDan; +import icbm.zhapin.muoxing.daodan.MMFanWuSu; +import icbm.zhapin.muoxing.daodan.MMFenZiDan; +import icbm.zhapin.muoxing.daodan.MMGanRanDu; +import icbm.zhapin.muoxing.daodan.MMHongSu; +import icbm.zhapin.muoxing.daodan.MMHuanYuan; +import icbm.zhapin.muoxing.daodan.MMHuo; +import icbm.zhapin.muoxing.daodan.MMLa; +import icbm.zhapin.muoxing.daodan.MMLiZi; +import icbm.zhapin.muoxing.daodan.MMPiaoFu; +import icbm.zhapin.muoxing.daodan.MMQi; +import icbm.zhapin.muoxing.daodan.MMQunDan; +import icbm.zhapin.muoxing.daodan.MMShengBuo; +import icbm.zhapin.muoxing.daodan.MMTaiYang; +import icbm.zhapin.muoxing.daodan.MMTuPuo; +import icbm.zhapin.muoxing.daodan.MMTui; +import icbm.zhapin.muoxing.daodan.MMWan; +import icbm.zhapin.muoxing.daodan.MMXiaoQunDan; +import icbm.zhapin.muoxing.daodan.MMYaSuo; +import icbm.zhapin.muoxing.daodan.MMYuanZi; +import icbm.zhapin.muoxing.daodan.MMZhen; +import icbm.zhapin.muoxing.daodan.MMZhuiZhong; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RMissile extends Render { + public static final MICBM[] MODELS; + public static MICBM[] SPECIAL_MODELS; + + public RMissile(final float f) { super.shadowSize = f; } + + @Override + public void doRender(final Entity entity, final double x, final double y, + final double z, final float f, final float f1) { + final EMissile entityMissile = (EMissile)entity; + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + GL11.glRotatef( + entityMissile.prevRotationYaw + + (entityMissile.rotationYaw - entityMissile.prevRotationYaw) * f1 - + 90.0f, + 0.0f, 1.0f, 0.0f); + GL11.glRotatef( + entityMissile.prevRotationPitch + + (entityMissile.rotationPitch - entityMissile.prevRotationPitch) * + f1 + + 90.0f, + 0.0f, 0.0f, 1.0f); + if (entityMissile.missileType == EMissile.MissileType.SMALL_MISSILE) { + GL11.glScalef(0.5f, 0.5f, 0.5f); + } + if (entityMissile.missileId >= 100) { + // TODO: WTF loadTexture -> bindTexture + this.bindTexture(new ResourceLocation( + "icbm", + "textures/models/missile_" + + MissileBase.list[entityMissile.missileId].getUnlocalizedName() + + ".png")); + RMissile.SPECIAL_MODELS[entityMissile.missileId - 100].render( + (Entity)entityMissile, (float)x, (float)y, (float)z, f, f1, 0.0625f); + } else { + this.bindTexture(new ResourceLocation( + "icbm", + "textures/models/missile_" + + ZhaPin.list[entityMissile.missileId].getUnlocalizedName() + + ".png")); + RMissile.MODELS[entityMissile.missileId].render( + (Entity)entityMissile, (float)x, (float)y, (float)z, f, f1, 0.0625f); + } + GL11.glPopMatrix(); + } + +@Override +protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; +} + + static { + MODELS = + new MICBM[] {new MMYaSuo(), new MMXiaoQunDan(), new MMHuo(), + new MMQi(), new MMDuQi(), new MMZhen(), + new MMTui(), new MMLa(), new MMQunDan(), + new MMGanRanDu(), new MMShengBuo(), new MMTuPuo(), + new MMHuanYuan(), new MMLiZi(), new MMYuanZi(), + new MMDianCi(), new MMTaiYang(), new MMBingDan(), + new MMPiaoFu(), new MMWan(), new MMChaoShengBuo(), + new MMFanWuSu(), new MMHongSu()}; + RMissile.SPECIAL_MODELS = + new MICBM[] {new MMYaSuo(), new MMZhuiZhong(), new MMFanDan(), + new MMFenZiDan(), new MMFenZiDan()}; + } +} diff --git a/src/main/java/icbm/zhapin/render/RRadarTower.java b/src/main/java/icbm/zhapin/render/RRadarTower.java new file mode 100644 index 0000000..9affc01 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RRadarTower.java @@ -0,0 +1,36 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TRadarTower; +import icbm.zhapin.muoxing.jiqi.MLeiDa; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RRadarTower extends TileEntitySpecialRenderer { + public static final MLeiDa MODEL; + + public void renderAModelAt(final TRadarTower tileEntity, final double x, + final double y, final double z, final float f) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + this.bindTexture(new ResourceLocation("icbm", "textures/models/radar.png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + RRadarTower.MODEL.render(tileEntity.xuanZhuan, 0.0625f); + GL11.glPopMatrix(); + } + + @Override + public void renderTileEntityAt(final TileEntity tileentity, final double d, + final double d1, final double d2, + final float f) { + this.renderAModelAt((TRadarTower) tileentity, d, d1, d2, f); + } + + static { + MODEL = new MLeiDa(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RSMine.java b/src/main/java/icbm/zhapin/render/RSMine.java new file mode 100644 index 0000000..1918b61 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RSMine.java @@ -0,0 +1,30 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import icbm.zhapin.zhapin.TExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RSMine extends TileEntitySpecialRenderer { + @Override + public void renderTileEntityAt(final TileEntity var1, final double x, + final double y, final double z, final float var8) { + final TExplosive tileEntity = (TExplosive) var1; + final Object[] data = ZhaPin.list[tileEntity.explosiveId].getRenderData(); + if (data != null) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + this.bindTexture((ResourceLocation) data[1]); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + ((MICBM) data[0]).render(0.0625f); + GL11.glPopMatrix(); + } + } +} diff --git a/src/main/java/icbm/zhapin/render/RShouLiuDan.java b/src/main/java/icbm/zhapin/render/RShouLiuDan.java new file mode 100644 index 0000000..a9e0f7d --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RShouLiuDan.java @@ -0,0 +1,61 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EGrenade; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RShouLiuDan extends Render { + @Override + public void doRender(final Entity entity, final double x, final double y, + final double z, final float par8, final float par9) { + final IIcon icon = ICBMExplosion.itShouLiuDan.getIconFromDamage( + ((EGrenade) entity).haoMa); + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y + 0.4f, (float) z); + GL11.glEnable(32826); + GL11.glScalef(0.6f, 0.6f, 0.6f); + // TODO: wrong resourceloc + this.bindTexture(new ResourceLocation("gui/items.png")); + final Tessellator tessellator = Tessellator.instance; + this.renderIcon(tessellator, icon); + GL11.glDisable(32826); + GL11.glPopMatrix(); + } + + private void renderIcon(final Tessellator par1Tessellator, final IIcon icon) { + final float f = icon.getMinU(); + final float f2 = icon.getMaxU(); + final float f3 = icon.getMinV(); + final float f4 = icon.getMaxV(); + final float f5 = 1.0f; + final float f6 = 0.5f; + final float f7 = 0.25f; + GL11.glRotatef(180.0f - super.renderManager.playerViewY, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(-super.renderManager.playerViewX, 1.0f, 0.0f, 0.0f); + par1Tessellator.startDrawingQuads(); + par1Tessellator.setNormal(0.0f, 1.0f, 0.0f); + par1Tessellator.addVertexWithUV((double) (0.0f - f6), (double) (0.0f - f7), + 0.0, (double) f, (double) f4); + par1Tessellator.addVertexWithUV((double) (f5 - f6), (double) (0.0f - f7), 0.0, + (double) f2, (double) f4); + par1Tessellator.addVertexWithUV((double) (f5 - f6), (double) (f5 - f7), 0.0, + (double) f2, (double) f3); + par1Tessellator.addVertexWithUV((double) (0.0f - f6), (double) (f5 - f7), 0.0, + (double) f, (double) f3); + par1Tessellator.draw(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; + } +} diff --git a/src/main/java/icbm/zhapin/render/RSuiPian.java b/src/main/java/icbm/zhapin/render/RSuiPian.java new file mode 100644 index 0000000..bc849c8 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RSuiPian.java @@ -0,0 +1,120 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.ESuiPian; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RSuiPian extends Render { + public void renderArrow(final ESuiPian suiPian, final double par2, + final double par4, final double par6, + final float par8, final float par9) { + if (suiPian.isAnvil) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); + // TODO: wrong resourceloc + this.bindTexture( + new ResourceLocation("minecraft", "textures/terrain.png")); + // yay anvilcraft + final Block block = Blocks.anvil; + final World world = suiPian.worldObj; + GL11.glDisable(2896); + this.field_147909_c.blockAccess = (IBlockAccess) world; + final Tessellator var12 = Tessellator.instance; + var12.startDrawingQuads(); + var12.setTranslation( + (double) (-MathHelper.floor_double(suiPian.posX) - 0.5f), + (double) (-MathHelper.floor_double(suiPian.posY) - 0.5f), + (double) (-MathHelper.floor_double(suiPian.posZ) - 0.5f)); + this.field_147909_c.renderBlockByRenderType( + block, MathHelper.floor_double(suiPian.posX), + MathHelper.floor_double(suiPian.posY), + MathHelper.floor_double(suiPian.posZ)); + var12.setTranslation(0.0, 0.0, 0.0); + var12.draw(); + GL11.glEnable(2896); + GL11.glPopMatrix(); + } else { + this.bindTexture( + new ResourceLocation("icbm", "textures/models/fragment.png")); + GL11.glPushMatrix(); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); + GL11.glRotatef( + suiPian.prevRotationYaw + + (suiPian.rotationYaw - suiPian.prevRotationYaw) * par9 - 90.0f, + 0.0f, 1.0f, 0.0f); + GL11.glRotatef(suiPian.prevRotationPitch + + (suiPian.rotationPitch - suiPian.prevRotationPitch) * + par9, + 0.0f, 0.0f, 1.0f); + final Tessellator var13 = Tessellator.instance; + final byte var14 = 0; + final float var15 = 0.0f; + final float var16 = 0.5f; + final float var17 = (0 + var14 * 10) / 32.0f; + final float var18 = (5 + var14 * 10) / 32.0f; + final float var19 = 0.0f; + final float var20 = 0.15625f; + final float var21 = (5 + var14 * 10) / 32.0f; + final float var22 = (10 + var14 * 10) / 32.0f; + final float var23 = 0.05625f; + GL11.glEnable(32826); + final float var24 = suiPian.arrowShake - par9; + if (var24 > 0.0f) { + final float var25 = -MathHelper.sin(var24 * 3.0f) * var24; + GL11.glRotatef(var25, 0.0f, 0.0f, 1.0f); + } + GL11.glRotatef(45.0f, 1.0f, 0.0f, 0.0f); + GL11.glScalef(var23, var23, var23); + GL11.glTranslatef(-4.0f, 0.0f, 0.0f); + GL11.glNormal3f(var23, 0.0f, 0.0f); + var13.startDrawingQuads(); + var13.addVertexWithUV(-7.0, -2.0, -2.0, (double) var19, (double) var21); + var13.addVertexWithUV(-7.0, -2.0, 2.0, (double) var20, (double) var21); + var13.addVertexWithUV(-7.0, 2.0, 2.0, (double) var20, (double) var22); + var13.addVertexWithUV(-7.0, 2.0, -2.0, (double) var19, (double) var22); + var13.draw(); + GL11.glNormal3f(-var23, 0.0f, 0.0f); + var13.startDrawingQuads(); + var13.addVertexWithUV(-7.0, 2.0, -2.0, (double) var19, (double) var21); + var13.addVertexWithUV(-7.0, 2.0, 2.0, (double) var20, (double) var21); + var13.addVertexWithUV(-7.0, -2.0, 2.0, (double) var20, (double) var22); + var13.addVertexWithUV(-7.0, -2.0, -2.0, (double) var19, (double) var22); + var13.draw(); + for (int var26 = 0; var26 < 4; ++var26) { + GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); + GL11.glNormal3f(0.0f, 0.0f, var23); + var13.startDrawingQuads(); + var13.addVertexWithUV(-8.0, -2.0, 0.0, (double) var15, (double) var17); + var13.addVertexWithUV(8.0, -2.0, 0.0, (double) var16, (double) var17); + var13.addVertexWithUV(8.0, 2.0, 0.0, (double) var16, (double) var18); + var13.addVertexWithUV(-8.0, 2.0, 0.0, (double) var15, (double) var18); + var13.draw(); + } + GL11.glDisable(32826); + GL11.glPopMatrix(); + } + } + + public void doRender(final Entity par1Entity, final double par2, + final double par4, final double par6, final float par8, + final float par9) { + this.renderArrow((ESuiPian) par1Entity, par2, par4, par6, par8, par9); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; + } +} diff --git a/src/main/java/icbm/zhapin/render/RXiaoFaSheQi.java b/src/main/java/icbm/zhapin/render/RXiaoFaSheQi.java new file mode 100644 index 0000000..bc129a6 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RXiaoFaSheQi.java @@ -0,0 +1,43 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TCruiseLauncher; +import icbm.zhapin.muoxing.jiqi.MXiaoFaSheQi; +import icbm.zhapin.muoxing.jiqi.MXiaoFaSheQiJia; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RXiaoFaSheQi extends TileEntitySpecialRenderer { + public static final MXiaoFaSheQi MODEL0; + public static final MXiaoFaSheQiJia MODEL1; + + public void renderModelAt(final TCruiseLauncher tileEntity, final double d, + final double d1, final double d2, final float f) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) d + 0.5f, (float) d1 + 1.5f, (float) d2 + 0.5f); + this.bindTexture( + new ResourceLocation("icbm", "textures/models/cruise_launcher.png")); + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + RXiaoFaSheQi.MODEL0.render(0.0625f); + GL11.glRotatef(tileEntity.rotationYaw + 90.0f, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(-tileEntity.rotationPitch, 1.0f, 0.0f, 0.0f); + RXiaoFaSheQi.MODEL1.render(0.0625f); + GL11.glPopMatrix(); + } + + @Override + public void renderTileEntityAt(final TileEntity tileentity, final double d, + final double d1, final double d2, + final float f) { + this.renderModelAt((TCruiseLauncher) tileentity, d, d1, d2, f); + } + + static { + MODEL0 = new MXiaoFaSheQi(); + MODEL1 = new MXiaoFaSheQiJia(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RYinDaoQi.java b/src/main/java/icbm/zhapin/render/RYinDaoQi.java new file mode 100644 index 0000000..1eed336 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RYinDaoQi.java @@ -0,0 +1,71 @@ +package icbm.zhapin.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.zhapin.jiqi.TMissileCoordinator; +import icbm.zhapin.muoxing.jiqi.MYinDaoQi; +import java.util.List; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class RYinDaoQi extends TileEntitySpecialRenderer { + public static final MYinDaoQi MODEL; + + public void renderModelAt(final TMissileCoordinator tileEntity, final double x, + final double y, final double z, final float f) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f); + final int radius = 2; + final List players = tileEntity.getWorldObj().getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox((double) (tileEntity.xCoord - radius), + (double) (tileEntity.yCoord - radius), + (double) (tileEntity.zCoord - radius), + (double) (tileEntity.xCoord + radius), + (double) (tileEntity.yCoord + radius), + (double) (tileEntity.zCoord + radius))); + if (players.size() > 0) { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/missile_coordinator_on.png")); + } else { + this.bindTexture(new ResourceLocation( + "icbm", "textures/models/missile_coordinator_off.png")); + } + GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); + switch (tileEntity + .getDirection((IBlockAccess) tileEntity.getWorldObj(), (int) x, + (int) y, (int) z) + .ordinal()) { + case 2: { + GL11.glRotatef(180.0f, 0.0f, 180.0f, 1.0f); + break; + } + case 4: { + GL11.glRotatef(90.0f, 0.0f, 180.0f, 1.0f); + break; + } + case 5: { + GL11.glRotatef(-90.0f, 0.0f, 180.0f, 1.0f); + break; + } + } + RYinDaoQi.MODEL.render(0.0f, 0.0625f); + GL11.glPopMatrix(); + } + + public void renderTileEntityAt(final TileEntity tileentity, final double d, + final double d1, final double d2, + final float f) { + this.renderModelAt((TMissileCoordinator) tileentity, d, d1, d2, f); + } + + static { + MODEL = new MYinDaoQi(); + } +} diff --git a/src/main/java/icbm/zhapin/render/RZhaPin.java b/src/main/java/icbm/zhapin/render/RZhaPin.java new file mode 100644 index 0000000..69df058 --- /dev/null +++ b/src/main/java/icbm/zhapin/render/RZhaPin.java @@ -0,0 +1,161 @@ +package icbm.zhapin.render; + +import calclavia.lib.render.CalclaviaRenderHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.MICBM; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.Random; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.Sphere; + +@SideOnly(Side.CLIENT) +public class RZhaPin extends Render { + public Random random; + + public RZhaPin() { + this.random = new Random(); + } + + public void doRender(final Entity entity, final double x, final double y, + final double z, final float par8, final float par9) { + final EExplosion eZhaPin = (EExplosion) entity; + if (eZhaPin.haoMa == ZhaPin.redMatter.getID()) { + final Tessellator tessellator = Tessellator.instance; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y, (float) z); + CalclaviaRenderHelper.enableBlending(); + CalclaviaRenderHelper.disableLighting(); + GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.9f); + final Sphere sphere = new Sphere(); + sphere.draw(5.0f, 32, 32); + CalclaviaRenderHelper.enableLighting(); + CalclaviaRenderHelper.disableBlending(); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glDepthMask(false); + CalclaviaRenderHelper.enableBlending(); + CalclaviaRenderHelper.disableLighting(); + GL11.glTranslated(x, y, z); + GL11.glRotatef((float) entity.ticksExisted, 0.0f, 1.0f, 0.0f); + final float size = 10.0f; + final int textureSize = 50; + final float size2 = size * 5.0f; + final float float_sizeMinus0_01 = textureSize - 0.01f; + final float x2 = (textureSize + 0.0f) / size2; + final float x3 = (textureSize + float_sizeMinus0_01) / size2; + final float x4 = (textureSize + 0.0f) / size2; + final float x5 = (textureSize + float_sizeMinus0_01) / size2; + Minecraft.getMinecraft().renderEngine.bindTexture( + new ResourceLocation("icbm", "textures/blackhole.png")); + tessellator.startDrawingQuads(); + tessellator.setBrightness(240); + tessellator.setColorRGBA_F(1.0f, 1.0f, 1.0f, 1.0f); + tessellator.addVertexWithUV((double) (-size), 0.0, (double) (-size), + (double) x3, (double) x5); + tessellator.addVertexWithUV((double) (-size), 0.0, (double) size, + (double) x3, (double) x4); + tessellator.addVertexWithUV((double) size, 0.0, (double) size, (double) x2, + (double) x4); + tessellator.addVertexWithUV((double) size, 0.0, (double) (-size), + (double) x2, (double) x5); + tessellator.draw(); + CalclaviaRenderHelper.enableLighting(); + CalclaviaRenderHelper.disableBlending(); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + float par10; + for (par10 = (float) entity.ticksExisted; par10 > 200.0f; par10 -= 100.0f) { + } + RenderHelper.disableStandardItemLighting(); + final float var41 = (5.0f + par10) / 200.0f; + float var42 = 0.0f; + if (var41 > 0.8f) { + var42 = (var41 - 0.8f) / 0.2f; + } + final Random rand = new Random(432L); + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glDisable(3553); + GL11.glShadeModel(7425); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 1); + GL11.glDisable(3008); + GL11.glEnable(2884); + GL11.glDepthMask(false); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0f, -1.0f, -2.0f); + for (int i1 = 0; i1 < (var41 + var41 * var41) / 2.0f * 60.0f; ++i1) { + GL11.glRotatef(rand.nextFloat() * 360.0f, 1.0f, 0.0f, 0.0f); + GL11.glRotatef(rand.nextFloat() * 360.0f, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(rand.nextFloat() * 360.0f, 0.0f, 0.0f, 1.0f); + GL11.glRotatef(rand.nextFloat() * 360.0f, 1.0f, 0.0f, 0.0f); + GL11.glRotatef(rand.nextFloat() * 360.0f, 0.0f, 1.0f, 0.0f); + GL11.glRotatef(rand.nextFloat() * 360.0f + var41 * 90.0f, 0.0f, 0.0f, + 1.0f); + tessellator.startDrawing(6); + final float var43 = rand.nextFloat() * 20.0f + 5.0f + var42 * 10.0f; + final float var44 = rand.nextFloat() * 2.0f + 1.0f + var42 * 2.0f; + tessellator.setColorRGBA_I(16777215, (int) (255.0f * (1.0f - var42))); + tessellator.addVertex(0.0, 0.0, 0.0); + tessellator.setColorRGBA_I(0, 0); + tessellator.addVertex(-0.866 * var44, (double) var43, + (double) (-0.5f * var44)); + tessellator.addVertex(0.866 * var44, (double) var43, + (double) (-0.5f * var44)); + tessellator.addVertex(0.0, (double) var43, (double) (1.0f * var44)); + tessellator.addVertex(-0.866 * var44, (double) var43, + (double) (-0.5f * var44)); + tessellator.draw(); + } + GL11.glPopMatrix(); + GL11.glDepthMask(true); + GL11.glDisable(2884); + GL11.glDisable(3042); + GL11.glShadeModel(7424); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GL11.glEnable(3553); + GL11.glEnable(3008); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + } else { + final Object[] data = ZhaPin.list[eZhaPin.haoMa].getRenderData(); + if (data != null) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y + 1.0f, (float) z); + GL11.glRotatef(eZhaPin.rotationPitch, 0.0f, 0.0f, 1.0f); + this.bindTexture((ResourceLocation) data[1]); + ((MICBM) data[0]) + .render((Entity) eZhaPin, (float) x, (float) y, (float) z, par8, par9, + 0.0625f); + GL11.glPopMatrix(); + } + } + } + + public void drawCircle(final double x, final double y, final double radius, + final double accuracy) { + GL11.glDisable(3553); + final double da = Math.min(2.0 * Math.asin(1.0 / radius) / accuracy, 10000.0); + GL11.glBegin(6); + GL11.glVertex2d(x, y); + for (double a = 0.0; a <= 6.283185307179586; a += da) { + GL11.glVertex2d(x + Math.cos(a) * radius, y + Math.sin(a) * radius); + } + GL11.glVertex2d(x + radius, y); + GL11.glEnd(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + // TODO: WTF + return null; + } +} diff --git a/src/main/java/icbm/zhapin/rongqi/CFaShiDi.java b/src/main/java/icbm/zhapin/rongqi/CFaShiDi.java new file mode 100644 index 0000000..7448069 --- /dev/null +++ b/src/main/java/icbm/zhapin/rongqi/CFaShiDi.java @@ -0,0 +1,67 @@ +package icbm.zhapin.rongqi; + +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.jiqi.TLauncherPlatform; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import universalelectricity.prefab.SlotSpecific; + +public class CFaShiDi extends Container { + private TLauncherPlatform missileLauncher; + + public CFaShiDi(final InventoryPlayer par1InventoryPlayer, + final TLauncherPlatform tileEntity) { + this.missileLauncher = tileEntity; + this.addSlotToContainer((Slot) new SlotSpecific( + (IInventory) tileEntity, 0, 84, 47, + new ItemStack[] { new ItemStack(ICBMExplosion.itDaoDan), + new ItemStack(ICBMExplosion.itTeBieDaoDan) })); + for (int var3 = 0; var3 < 3; ++var3) { + for (int var4 = 0; var4 < 9; ++var4) { + this.addSlotToContainer(new Slot((IInventory) par1InventoryPlayer, + var4 + var3 * 9 + 9, 8 + var4 * 18, + 84 + var3 * 18)); + } + } + for (int var3 = 0; var3 < 9; ++var3) { + this.addSlotToContainer( + new Slot((IInventory) par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + } + + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + return this.missileLauncher.isUseableByPlayer(par1EntityPlayer); + } + + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, + final int par1) { + ItemStack var2 = null; + final Slot var3 = (Slot) super.inventorySlots.get(par1); + if (var3 != null && var3.getHasStack()) { + final ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + if (par1 != 0) { + if (this.getSlot(0).isItemValid(var4) && + !this.mergeItemStack(var4, 0, 1, false)) { + return null; + } + } else if (!this.mergeItemStack(var4, 3, 37, false)) { + return null; + } + if (var4.stackSize == 0) { + var3.putStack((ItemStack) null); + } else { + var3.onSlotChanged(); + } + if (var4.stackSize == var2.stackSize) { + return null; + } + var3.onPickupFromSlot(par1EntityPlayer, var4); + } + return var2; + } +} diff --git a/src/main/java/icbm/zhapin/rongqi/CXiaoFaSheQi.java b/src/main/java/icbm/zhapin/rongqi/CXiaoFaSheQi.java new file mode 100644 index 0000000..7bec8ca --- /dev/null +++ b/src/main/java/icbm/zhapin/rongqi/CXiaoFaSheQi.java @@ -0,0 +1,78 @@ +package icbm.zhapin.rongqi; + +import icbm.zhapin.daodan.ItMissile; +import icbm.zhapin.jiqi.TCruiseLauncher; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import universalelectricity.core.item.IItemElectric; +import universalelectricity.prefab.SlotSpecific; + +public class CXiaoFaSheQi extends Container { + private TCruiseLauncher tileEntity; + + public CXiaoFaSheQi(final InventoryPlayer par1InventoryPlayer, + final TCruiseLauncher tileEntity) { + this.tileEntity = tileEntity; + this.addSlotToContainer((Slot) new SlotSpecific( + (IInventory) tileEntity, 0, 151, 23, new Class[] { ItMissile.class })); + this.addSlotToContainer((Slot) new SlotSpecific( + (IInventory) tileEntity, 1, 151, 47, new Class[] { IItemElectric.class })); + for (int var3 = 0; var3 < 3; ++var3) { + for (int var4 = 0; var4 < 9; ++var4) { + this.addSlotToContainer(new Slot((IInventory) par1InventoryPlayer, + var4 + var3 * 9 + 9, 8 + var4 * 18, + 84 + var3 * 18)); + } + } + for (int var3 = 0; var3 < 9; ++var3) { + this.addSlotToContainer( + new Slot((IInventory) par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + tileEntity.openInventory(); + } + + public void onContainerClosed(final EntityPlayer entityplayer) { + super.onContainerClosed(entityplayer); + this.tileEntity.closeInventory(); + } + + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + return this.tileEntity.isUseableByPlayer(par1EntityPlayer); + } + + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, + final int par1) { + ItemStack var2 = null; + final Slot var3 = (Slot) super.inventorySlots.get(par1); + if (var3 != null && var3.getHasStack()) { + final ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + if (par1 > 1) { + if (this.getSlot(0).isItemValid(var4)) { + if (!this.mergeItemStack(var4, 0, 1, false)) { + return null; + } + } else if (this.getSlot(1).isItemValid(var4) && + !this.mergeItemStack(var4, 1, 2, false)) { + return null; + } + } else if (!this.mergeItemStack(var4, 2, 38, false)) { + return null; + } + if (var4.stackSize == 0) { + var3.putStack((ItemStack) null); + } else { + var3.onSlotChanged(); + } + if (var4.stackSize == var2.stackSize) { + return null; + } + var3.onPickupFromSlot(par1EntityPlayer, var4); + } + return var2; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/BExplosives.java b/src/main/java/icbm/zhapin/zhapin/BExplosives.java new file mode 100644 index 0000000..f2aa261 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/BExplosives.java @@ -0,0 +1,372 @@ +package icbm.zhapin.zhapin; + +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.api.ICamouflageMaterial; +import icbm.core.ICBMTab; +import icbm.core.di.BICBM; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.render.RHZhaPin; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.core.vector.VectorHelper; + +public class BExplosives extends BICBM implements ICamouflageMaterial { + public static final IIcon[] ICON_TOP; + public static final IIcon[] ICON_SIDE; + public static final IIcon[] ICON_BOTTOM; + + public BExplosives() { + super("explosives", Material.tnt); + this.setHardness(0.0f); + this.setStepSound(BExplosives.soundTypeGrass); + this.setCreativeTab((CreativeTabs)ICBMTab.INSTANCE); + } + + private static byte + determineOrientation(final World world, final int x, final int y, final int z, + final EntityLivingBase entityLiving) { + if (entityLiving != null) { + if (MathHelper.abs((float)((Entity)entityLiving).posX - x) < 2.0f && + MathHelper.abs((float)((Entity)entityLiving).posZ - z) < 2.0f) { + final double var5 = + ((Entity)entityLiving).posY + 1.82 - ((Entity)entityLiving).yOffset; + if (var5 - y > 2.0) { + return 1; + } + if (y - var5 > 0.0) { + return 0; + } + } + final int rotation = + MathHelper.floor_double( + ((Entity)entityLiving).rotationYaw * 4.0f / 360.0f + 0.5) & + 0x3; + return ( + byte)((rotation == 0) + ? 2 + : ((rotation == 1) + ? 5 + : ((rotation == 2) ? 3 + : ((rotation == 3) ? 4 : 0)))); + } + return 0; + } + + @Override + public void setBlockBoundsBasedOnState(final IBlockAccess par1IBlockAccess, + final int x, final int y, + final int z) { + final TileEntity tileEntity = par1IBlockAccess.getTileEntity(x, y, z); + if (tileEntity != null && tileEntity instanceof TExplosive && + ((TExplosive)tileEntity).explosiveId == ZhaPin.sMine.getID()) { + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.2f, 1.0f); + return; + } + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + } + + @Override + public void setBlockBoundsForItemRender() { + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, + final int x, final int y, + final int z) { + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + if (tileEntity != null && tileEntity instanceof TExplosive && + ((TExplosive)tileEntity).explosiveId == ZhaPin.sMine.getID()) { + return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, + z + this.minZ, x + this.maxX, y + 0.2, + z + this.maxZ); + } + return super.getCollisionBoundingBoxFromPool(par1World, x, y, z); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, + final int z, final EntityLivingBase entityLiving, + final ItemStack itemStack) { + final int explosiveID = + ((TExplosive)world.getTileEntity(x, y, z)).explosiveId; + if (!world.isRemote && + ICBMExplosion.shiBaoHu(world, new Vector3(x, y, z), + ZhaPin.ZhaPinType.ZHA_DAN, explosiveID)) { + this.dropBlockAsItem(world, x, y, z, explosiveID, 0); + world.setBlock(x, y, z, Blocks.air, 0, 2); + return; + } + world.setBlockMetadataWithNotify( + x, y, z, + VectorHelper + .getOrientationFromSide( + ForgeDirection.getOrientation( + (int)determineOrientation(world, x, y, z, entityLiving)), + ForgeDirection.NORTH) + .ordinal(), + 2); + if (world.isBlockIndirectlyGettingPowered(x, y, z)) { + yinZha(world, x, y, z, explosiveID, 0); + } + for (byte i = 0; i < 6; ++i) { + final Vector3 position = new Vector3(x, y, z); + position.modifyPositionFromSide(ForgeDirection.getOrientation((int)i)); + final Block block = position.getBlock((IBlockAccess)world); + if (block == Blocks.fire || block == Blocks.flowing_lava || + block == Blocks.lava) { + yinZha(world, x, y, z, explosiveID, 2); + } + } + if (entityLiving != null) { + FMLLog.fine(entityLiving.getCommandSenderName() + " placed " + + ZhaPin.list[explosiveID].getExplosiveName() + + " in: " + x + ", " + y + ", " + z + ".", + new Object[0]); + } + } + + @Override + public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int x, + final int y, final int z, final int side) { + final int explosiveID = + ((TExplosive)par1IBlockAccess.getTileEntity(x, y, z)).explosiveId; + return this.getIcon(side, explosiveID); + } + + @Override + public IIcon getIcon(final int side, final int explosiveID) { + if (side == 0) { + return BExplosives.ICON_BOTTOM[ZhaPin.list[explosiveID].getTier() - 1]; + } + if (side == 1) { + return BExplosives.ICON_TOP[explosiveID]; + } + return BExplosives.ICON_SIDE[explosiveID]; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(final IIconRegister iconRegister) { + for (int i = 0; i < ZhaPin.E_SI_ID; ++i) { + BExplosives.ICON_TOP[i] = iconRegister.registerIcon( + "icbm:explosive_" + ZhaPin.list[i].getUnlocalizedName() + "_top"); + BExplosives.ICON_SIDE[i] = iconRegister.registerIcon( + "icbm:explosive_" + ZhaPin.list[i].getUnlocalizedName() + "_side"); + } + + for (int tier = 0; tier < 4; ++tier) { + BExplosives.ICON_BOTTOM[tier] = + iconRegister.registerIcon("icbm:explosive_bottom_" + (tier + 1)); + } + } + + // TODO: WTF + // public IIcon getIcon(final IIconRegister iconRegister, final int i, + // final String suffix) { + // final ITexturePack itexturepack = + // Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); final + // String iconName = "explosive_" + ZhaPin.list[i].getUnlocalizedName() + + // suffix; final String path = "/mods/" + // + "icbm:".replace(":", "") + "/textures/blocks/" + + // iconName + ".png"; + // try { + // final BufferedImage bufferedimage = + // ImageIO.read(itexturepack.getResourceAsStream(path)); return + // iconRegister.registerIcon("icbm:" + iconName); + // } catch (final Exception e) { + // if (suffix.equals("_bottom")) { + // return iconRegister.registerIcon("icbm:explosive_bottom_" + + // ZhaPin.list[i].getTier()); + // } + // return iconRegister.registerIcon("icbm:explosive_base_" + + // ZhaPin.list[i].getTier()); + // } + // } + + @Override + public void onBlockAdded(final World par1World, final int x, final int y, + final int z) { + super.onBlockAdded(par1World, x, y, z); + par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + } + + @Override + public void onNeighborBlockChange(final World world, final int x, final int y, + final int z, final Block block) { + final int explosiveID = + ((TExplosive)world.getTileEntity(x, y, z)).explosiveId; + if (world.isBlockIndirectlyGettingPowered(x, y, z)) { + yinZha(world, x, y, z, explosiveID, 0); + } else if (block == Blocks.fire || block == Blocks.flowing_lava || + block == Blocks.lava) { + yinZha(world, x, y, z, explosiveID, 2); + } + } + + public static void yinZha(final World world, final int x, final int y, + final int z, final int explosiveID, + final int causeOfExplosion) { + if (!world.isRemote && + !ICBMExplosion.shiBaoHu(world, new Vector3(x, y, z), + ZhaPin.ZhaPinType.ZHA_DAN, explosiveID)) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null && tileEntity instanceof TExplosive) { + ((TExplosive)tileEntity).exploding = true; + ZhaPin.list[explosiveID].spawnZhaDan( + world, new Vector3(x, y, z), + ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)), + (byte)causeOfExplosion); + world.setBlock(x, y, z, Blocks.air, 0, 2); + } + } + } + + @Override + public void onBlockDestroyedByExplosion(final World par1World, final int x, + final int y, final int z, + final Explosion explosion) { + if (par1World.getTileEntity(x, y, z) != null) { + final int explosiveID = + ((TExplosive)par1World.getTileEntity(x, y, z)).explosiveId; + yinZha(par1World, x, y, z, explosiveID, 1); + } + } + + @Override + public boolean + onBlockActivated(final World par1World, final int x, final int y, final int z, + final EntityPlayer par5EntityPlayer, final int par6, + final float par7, final float par8, final float par9) { + final TileEntity tileEntity = par1World.getTileEntity(x, y, z); + if (par5EntityPlayer.getCurrentEquippedItem() != null) { + if (par5EntityPlayer.getCurrentEquippedItem().getItem() == + Items.flint_and_steel) { + final int explosiveID = ((TExplosive)tileEntity).explosiveId; + yinZha(par1World, x, y, z, explosiveID, 0); + return true; + } + if (this.isUsableWrench(par5EntityPlayer, + par5EntityPlayer.getCurrentEquippedItem(), x, y, + z)) { + byte change = 3; + switch (par1World.getBlockMetadata(x, y, z)) { + case 0: { + change = 2; + break; + } + case 2: { + change = 5; + break; + } + case 5: { + change = 3; + break; + } + case 3: { + change = 4; + break; + } + case 4: { + change = 1; + break; + } + case 1: { + change = 0; + break; + } + } + par1World.setBlockMetadataWithNotify( + x, y, z, ForgeDirection.getOrientation((int)change).ordinal(), 3); + par1World.notifyBlockChange(x, y, z, this); + return true; + } + } + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderType() { + return RHZhaPin.ID; + } + + @Override + public ItemStack getPickBlock(final MovingObjectPosition target, + final World world, final int x, final int y, + final int z) { + if (world.getTileEntity(x, y, z) != null) { + final int explosiveID = + ((TExplosive)world.getTileEntity(x, y, z)).explosiveId; + return new ItemStack(this, 1, explosiveID); + } + return null; + } + + @Override + public void breakBlock(final World world, final int x, final int y, + final int z, final Block par5, final int par6) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null && tileEntity instanceof TExplosive && + !((TExplosive)tileEntity).exploding) { + final int explosiveID = ((TExplosive)tileEntity).explosiveId; + final Item id = + this.getItemDropped(world.getBlockMetadata(x, y, z), world.rand, 0); + this.dropBlockAsItem(world, x, y, z, new ItemStack(id, 1, explosiveID)); + } + super.breakBlock(world, x, y, z, par5, par6); + } + + @Override + public int quantityDropped(final Random par1Random) { + return 0; + } + + @Override + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < ZhaPin.E_SI_ID; ++i) { + par3List.add(new ItemStack((Block)this, 1, i)); + } + par3List.add(new ItemStack((Block)this, 1, ZhaPin.sMine.getID())); + } + + @Override + public TileEntity createNewTileEntity(final World var1, int meta) { + return new TExplosive(); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + static { + ICON_TOP = new IIcon[ZhaPin.list.length]; + ICON_SIDE = new IIcon[ZhaPin.list.length]; + ICON_BOTTOM = new IIcon[4]; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/EExplosion.java b/src/main/java/icbm/zhapin/zhapin/EExplosion.java new file mode 100644 index 0000000..1f01a3d --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/EExplosion.java @@ -0,0 +1,154 @@ +package icbm.zhapin.zhapin; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.zhapin.ICBMExplosion; +import io.netty.buffer.ByteBuf; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class EExplosion extends Entity implements IEntityAdditionalSpawnData { + public int haoMa; + public int jiaoShuMu; + public int tickCallCounter; + private int metadata; + private boolean endExplosion; + public List entityList; + public List dataList1; + public List dataList2; + private boolean isMobile; + + public EExplosion(final World par1World) { + super(par1World); + this.metadata = -1; + this.endExplosion = false; + this.entityList = new ArrayList<>(); + this.dataList1 = new ArrayList<>(); + this.dataList2 = new ArrayList<>(); + this.isMobile = false; + super.preventEntitySpawning = true; + this.setSize(0.98f, 0.98f); + super.yOffset = super.height / 2.0f; + super.renderDistanceWeight = 2.0; + super.ignoreFrustumCheck = true; + } + + public EExplosion(final World par1World, final Vector3 position, + final int explosionID, final boolean isMobile) { + this(par1World); + this.jiaoShuMu = 0; + this.haoMa = explosionID; + this.isMobile = isMobile; + this.setPosition(position.x, position.y, position.z); + } + + public EExplosion(final World par1World, final Vector3 position, + final int explosionID, final boolean isMobile, + final int metadata) { + this(par1World, position, explosionID, isMobile); + this.metadata = metadata; + } + + @Override + public String getCommandSenderName() { + return "Explosion"; + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeBoolean(this.isMobile); + data.writeInt(this.haoMa); + data.writeInt(this.metadata); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.isMobile = data.readBoolean(); + this.haoMa = data.readInt(); + this.metadata = data.readInt(); + } + + @Override + protected void entityInit() { + } + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + public boolean canBeCollidedWith() { + return false; + } + + @Override + public void onUpdate() { + if (!super.worldObj.isRemote && + ICBMExplosion.shiBaoHu(super.worldObj, new Vector3(this), + ZhaPin.ZhaPinType.ZHA_DAN, this.haoMa)) { + this.setDead(); + return; + } + if (this.isMobile && (super.motionX != 0.0 || super.motionY != 0.0 || + super.motionZ != 0.0)) { + this.moveEntity(super.motionX, super.motionY, super.motionZ); + } + if (super.ticksExisted == 1) { + ZhaPin.list[this.haoMa].baoZhaQian(super.worldObj, new Vector3(this), + this); + } + if (this.tickCallCounter >= ZhaPin.list[this.haoMa].proceduralInterval( + super.worldObj, this.jiaoShuMu)) { + if (!this.endExplosion && + ZhaPin.list[this.haoMa].doBaoZha( + super.worldObj, new Vector3(super.posX, super.posY, super.posZ), + this, this.metadata, this.jiaoShuMu)) { + this.jiaoShuMu += ZhaPin.list[this.haoMa].countIncrement(); + this.tickCallCounter = 0; + } else { + ZhaPin.list[this.haoMa].baoZhaHou( + super.worldObj, new Vector3(super.posX, super.posY, super.posZ), + this); + this.setDead(); + } + } + ++this.tickCallCounter; + ZhaPin.list[this.haoMa].gengXin( + super.worldObj, new Vector3(super.posX, super.posY, super.posZ), + super.ticksExisted); + ++super.ticksExisted; + } + + public void endExplosion() { + this.endExplosion = true; + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound par1NBTTagCompound) { + this.isMobile = par1NBTTagCompound.getBoolean("isMobile"); + this.haoMa = par1NBTTagCompound.getInteger("explosionID"); + this.jiaoShuMu = par1NBTTagCompound.getInteger("callCounter"); + super.ticksExisted = par1NBTTagCompound.getInteger("ticksExisted"); + this.metadata = par1NBTTagCompound.getInteger("metadata"); + this.tickCallCounter = par1NBTTagCompound.getInteger("tickCallCounter"); + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound par1NBTTagCompound) { + par1NBTTagCompound.setBoolean("isMobile", this.isMobile); + par1NBTTagCompound.setInteger("explosionID", this.haoMa); + par1NBTTagCompound.setInteger("callCounter", this.jiaoShuMu); + par1NBTTagCompound.setInteger("ticksExisted", super.ticksExisted); + par1NBTTagCompound.setInteger("metadata", this.metadata); + par1NBTTagCompound.setInteger("tickCallCounter", this.tickCallCounter); + } + + @Override + public float getShadowSize() { + return 0.0f; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/EExplosive.java b/src/main/java/icbm/zhapin/zhapin/EExplosive.java new file mode 100644 index 0000000..17d601c --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/EExplosive.java @@ -0,0 +1,167 @@ +package icbm.zhapin.zhapin; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.zhapin.ICBMExplosion; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRotatable; + +public class EExplosive + extends Entity implements IRotatable, IEntityAdditionalSpawnData { + public int fuse; + public int haoMa; + private int metadata; + private byte orientation; + + public EExplosive(final World par1World) { + super(par1World); + this.fuse = 90; + this.haoMa = 0; + this.metadata = -1; + this.orientation = 3; + this.fuse = 0; + super.preventEntitySpawning = true; + this.setSize(0.98f, 0.98f); + super.yOffset = super.height / 2.0f; + } + + public EExplosive(final World par1World, final Vector3 position, + final byte orientation, final int explosiveID) { + this(par1World); + this.setPosition(position.x, position.y, position.z); + final float var8 = (float) (Math.random() * 3.141592653589793 * 2.0); + super.motionX = -(float) Math.sin(var8) * 0.02f; + super.motionY = 0.20000000298023224; + super.motionZ = -(float) Math.cos(var8) * 0.02f; + super.prevPosX = position.x; + super.prevPosY = position.y; + super.prevPosZ = position.z; + this.haoMa = explosiveID; + this.fuse = ZhaPin.list[explosiveID].getYinXin(); + this.orientation = orientation; + ZhaPin.list[explosiveID].yinZhaQian(par1World, this); + } + + public EExplosive(final World par1World, final Vector3 position, + final int explosiveID, final byte orientation, + final int metadata) { + this(par1World, position, orientation, explosiveID); + this.metadata = metadata; + } + + @Override + public String getCommandSenderName() { + return "Explosives"; + } + + @Override + public void onUpdate() { + if (!super.worldObj.isRemote && + ICBMExplosion.shiBaoHu(super.worldObj, new Vector3(this), + ZhaPin.ZhaPinType.ZHA_DAN, this.haoMa)) { + ICBMExplosion.bExplosives.dropBlockAsItem(super.worldObj, (int) super.posX, + (int) super.posY, (int) super.posZ, + this.haoMa, 0); + this.setDead(); + return; + } + super.prevPosX = super.posX; + super.prevPosY = super.posY; + super.prevPosZ = super.posZ; + super.motionX *= 0.95; + super.motionY -= 0.045; + super.motionZ *= 0.95; + this.moveEntity(super.motionX, super.motionY, super.motionZ); + if (this.fuse < 1) { + this.explode(); + } else { + ZhaPin.list[this.haoMa].onYinZha( + super.worldObj, new Vector3(super.posX, super.posY, super.posZ), + this.fuse); + } + --this.fuse; + super.onUpdate(); + } + + public void explode() { + super.worldObj.spawnParticle("hugeexplosion", super.posX, super.posY, + super.posZ, 0.0, 0.0, 0.0); + ZhaPin.createExplosion(super.worldObj, new Vector3(this), this, this.haoMa); + this.setDead(); + } + + public void destroyedByExplosion() { + this.fuse = ZhaPin.list[this.haoMa].onBeiZha(); + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound par1NBTTagCompound) { + this.fuse = par1NBTTagCompound.getByte("Fuse"); + this.metadata = par1NBTTagCompound.getInteger("metadata"); + this.haoMa = par1NBTTagCompound.getInteger("explosiveID"); + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound par1NBTTagCompound) { + par1NBTTagCompound.setByte("Fuse", (byte) this.fuse); + par1NBTTagCompound.setInteger("metadata", this.metadata); + par1NBTTagCompound.setInteger("explosiveID", this.haoMa); + } + + @Override + public float getShadowSize() { + return 0.5f; + } + + @Override + protected void entityInit() { + } + + @Override + protected boolean canTriggerWalking() { + return true; + } + + @Override + public boolean canBeCollidedWith() { + return true; + } + + @Override + public boolean canBePushed() { + return true; + } + + @Override + public ForgeDirection getDirection(final IBlockAccess world, final int x, + final int y, final int z) { + return ForgeDirection.getOrientation((int) this.orientation); + } + + @Override + public void setDirection(final World world, final int x, final int y, + final int z, final ForgeDirection facingDirection) { + this.orientation = (byte) facingDirection.ordinal(); + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeInt(this.haoMa); + data.writeInt(this.fuse); + data.writeByte((int) this.orientation); + data.writeInt(this.metadata); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.haoMa = data.readInt(); + this.fuse = data.readInt(); + this.orientation = data.readByte(); + this.metadata = data.readInt(); + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/EGrenade.java b/src/main/java/icbm/zhapin/zhapin/EGrenade.java new file mode 100644 index 0000000..ad94ae8 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/EGrenade.java @@ -0,0 +1,244 @@ +package icbm.zhapin.zhapin; + +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; +import icbm.api.explosion.IExplosive; +import icbm.api.explosion.IExplosiveContainer; +import icbm.zhapin.ICBMExplosion; +import io.netty.buffer.ByteBuf; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class EGrenade + extends Entity implements IExplosiveContainer, IEntityAdditionalSpawnData { + protected EntityLivingBase thrower; + public int haoMa; + + public EGrenade(final World par1World) { + super(par1World); + this.setSize(0.3f, 0.3f); + super.renderDistanceWeight = 10.0; + } + + public EGrenade(final World par1World, final Vector3 position, + final int explosiveID) { + this(par1World); + this.setPosition(position.x, position.y, position.z); + this.haoMa = explosiveID; + } + + public EGrenade(final World par1World, final EntityLivingBase par2EntityLiving, + final int explosiveID, final float nengLiang) { + this(par1World); + this.thrower = par2EntityLiving; + this.setSize(0.25f, 0.25f); + this.setLocationAndAngles( + ((Entity) par2EntityLiving).posX, + ((Entity) par2EntityLiving).posY + par2EntityLiving.getEyeHeight(), + ((Entity) par2EntityLiving).posZ, ((Entity) par2EntityLiving).rotationYaw, + ((Entity) par2EntityLiving).rotationPitch); + super.posX -= MathHelper.cos(super.rotationYaw / 180.0f * 3.1415927f) * 0.16f; + super.posY -= 0.10000000149011612; + super.posZ -= MathHelper.sin(super.rotationYaw / 180.0f * 3.1415927f) * 0.16f; + this.setPosition(super.posX, super.posY, super.posZ); + super.yOffset = 0.0f; + final float var3 = 0.4f; + super.motionX = -MathHelper.sin(super.rotationYaw / 180.0f * 3.1415927f) * + MathHelper.cos(super.rotationPitch / 180.0f * 3.1415927f) * + var3; + super.motionZ = MathHelper.cos(super.rotationYaw / 180.0f * 3.1415927f) * + MathHelper.cos(super.rotationPitch / 180.0f * 3.1415927f) * + var3; + super.motionY = -MathHelper.sin(super.rotationPitch / 180.0f * 3.1415927f) * var3; + this.setThrowableHeading(super.motionX, super.motionY, super.motionZ, + 1.8f * nengLiang, 1.0f); + this.haoMa = explosiveID; + } + + @Override + public String getCommandSenderName() { + return "Grenade"; + } + + @Override + public void writeSpawnData(final ByteBuf data) { + data.writeInt(this.haoMa); + } + + @Override + public void readSpawnData(final ByteBuf data) { + this.haoMa = data.readInt(); + } + + public void setThrowableHeading(double par1, double par3, double par5, + final float par7, final float par8) { + final float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + par1 /= var9; + par3 /= var9; + par5 /= var9; + par1 += super.rand.nextGaussian() * 0.007499999832361937 * par8; + par3 += super.rand.nextGaussian() * 0.007499999832361937 * par8; + par5 += super.rand.nextGaussian() * 0.007499999832361937 * par8; + par1 *= par7; + par3 *= par7; + par5 *= par7; + super.motionX = par1; + super.motionY = par3; + super.motionZ = par5; + final float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + final float n = (float) (Math.atan2(par1, par5) * 180.0 / 3.141592653589793); + super.rotationYaw = n; + super.prevRotationYaw = n; + final float n2 = (float) (Math.atan2(par3, var10) * 180.0 / 3.141592653589793); + super.rotationPitch = n2; + super.prevRotationPitch = n2; + } + + @Override + public void setVelocity(final double par1, final double par3, + final double par5) { + super.motionX = par1; + super.motionY = par3; + super.motionZ = par5; + if (super.prevRotationPitch == 0.0f && super.prevRotationYaw == 0.0f) { + final float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + final float n = (float) (Math.atan2(par1, par5) * 180.0 / 3.141592653589793); + super.rotationYaw = n; + super.prevRotationYaw = n; + final float n2 = (float) (Math.atan2(par3, var7) * 180.0 / 3.141592653589793); + super.rotationPitch = n2; + super.prevRotationPitch = n2; + } + } + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + protected void entityInit() { + } + + @Override + public void onUpdate() { + if (!super.worldObj.isRemote && + ICBMExplosion.shiBaoHu(super.worldObj, new Vector3(this), + ZhaPin.ZhaPinType.SHOU_LIU_DAN, this.haoMa)) { + final float var6 = 0.7f; + final double var7 = super.worldObj.rand.nextFloat() * var6 + (1.0f - var6) * 0.5; + final double var8 = super.worldObj.rand.nextFloat() * var6 + (1.0f - var6) * 0.5; + final double var9 = super.worldObj.rand.nextFloat() * var6 + (1.0f - var6) * 0.5; + final EntityItem var10 = new EntityItem( + super.worldObj, super.posX + var7, super.posY + var8, + super.posZ + var9, + new ItemStack(ICBMExplosion.itShouLiuDan, this.haoMa, 1)); + var10.delayBeforeCanPickup = 10; + super.worldObj.spawnEntityInWorld((Entity) var10); + this.setDead(); + return; + } + super.lastTickPosX = super.posX; + super.lastTickPosY = super.posY; + super.lastTickPosZ = super.posZ; + super.onUpdate(); + this.moveEntity(super.motionX, super.motionY, super.motionZ); + final float var11 = MathHelper.sqrt_double(super.motionX * super.motionX + + super.motionZ * super.motionZ); + super.rotationYaw = (float) (Math.atan2(super.motionX, super.motionZ) * + 180.0 / 3.141592653589793); + super.rotationPitch = (float) (Math.atan2(super.motionY, var11) * 180.0 / 3.141592653589793); + while (super.rotationPitch - super.prevRotationPitch < -180.0f) { + super.prevRotationPitch -= 360.0f; + } + while (super.rotationPitch - super.prevRotationPitch >= 180.0f) { + super.prevRotationPitch += 360.0f; + } + while (super.rotationYaw - super.prevRotationYaw < -180.0f) { + super.prevRotationYaw -= 360.0f; + } + while (super.rotationYaw - super.prevRotationYaw >= 180.0f) { + super.prevRotationYaw += 360.0f; + } + super.rotationPitch = super.prevRotationPitch + + (super.rotationPitch - super.prevRotationPitch) * 0.2f; + super.rotationYaw = super.prevRotationYaw + + (super.rotationYaw - super.prevRotationYaw) * 0.2f; + float var12 = 0.98f; + final float gravity = 0.03f; + if (this.isInWater()) { + for (int var13 = 0; var13 < 4; ++var13) { + final float var14 = 0.25f; + super.worldObj.spawnParticle( + "bubble", super.posX - super.motionX * var14, + super.posY - super.motionY * var14, + super.posZ - super.motionZ * var14, super.motionX, super.motionY, + super.motionZ); + } + var12 = 0.8f; + } + super.motionX *= var12; + super.motionY *= var12; + super.motionZ *= var12; + if (super.onGround) { + super.motionX *= 0.5; + super.motionZ *= 0.5; + super.motionY *= 0.5; + } else { + super.motionY -= gravity; + // TODO: is this pushOutOfBlocks? + this.func_145771_j( + super.posX, (super.boundingBox.minY + super.boundingBox.maxY) / 2.0, + super.posZ); + } + if (super.ticksExisted > Math.max(60, ZhaPin.list[this.haoMa].getYinXin())) { + super.worldObj.spawnParticle("hugeexplosion", super.posX, super.posY, + super.posZ, 0.0, 0.0, 0.0); + ZhaPin.createExplosion(super.worldObj, + new Vector3(super.posX, super.posY, super.posZ), + this, this.haoMa); + this.setDead(); + } else { + ZhaPin.list[this.haoMa].onYinZha( + super.worldObj, new Vector3(super.posX, super.posY + 0.5, super.posZ), + super.ticksExisted); + } + } + + @Override + public boolean handleWaterMovement() { + return super.worldObj.handleMaterialAcceleration( + super.boundingBox, Material.water, (Entity) this); + } + + @Override + public boolean canBeCollidedWith() { + return true; + } + + @Override + public boolean canBePushed() { + return true; + } + + @Override + protected void readEntityFromNBT(final NBTTagCompound par1NBTTagCompound) { + this.haoMa = par1NBTTagCompound.getInteger("haoMa"); + } + + @Override + protected void writeEntityToNBT(final NBTTagCompound par1NBTTagCompound) { + par1NBTTagCompound.setInteger("haoMa", this.haoMa); + } + + @Override + public IExplosive getExplosiveType() { + return ZhaPin.list[this.haoMa]; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/IBExplosive.java b/src/main/java/icbm/zhapin/zhapin/IBExplosive.java new file mode 100644 index 0000000..86b5e79 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/IBExplosive.java @@ -0,0 +1,45 @@ +package icbm.zhapin.zhapin; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class IBExplosive extends ItemBlock { + public IBExplosive(final Block id) { + super(id); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public boolean placeBlockAt(final ItemStack itemStack, + final EntityPlayer player, final World world, + final int x, final int y, final int z, + final int side, final float hitX, + final float hitY, final float hitZ, + final int metadata) { + if (!world.setBlock(x, y, z, this.field_150939_a, 0, 3)) { + return false; + } + if (world.getBlock(x, y, z) == this.field_150939_a) { + ((TExplosive) world.getTileEntity(x, y, z)).explosiveId = itemStack.getItemDamage(); + this.field_150939_a.onBlockPlacedBy(world, x, y, z, player, itemStack); + this.field_150939_a.onPostBlockPlaced(world, x, y, z, metadata); + } + return true; + } + + public int getMetadata(final int damage) { + return damage; + } + + public String getUnlocalizedName(final ItemStack itemstack) { + return this.getUnlocalizedName() + "." + + ZhaPin.list[itemstack.getItemDamage()].getUnlocalizedName(); + } + + public String getUnlocalizedName() { + return "icbm.explosive"; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ItGrenade.java b/src/main/java/icbm/zhapin/zhapin/ItGrenade.java new file mode 100644 index 0000000..f23cd17 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ItGrenade.java @@ -0,0 +1,134 @@ +package icbm.zhapin.zhapin; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.di.ItICBM; +import icbm.zhapin.ICBMExplosion; +import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ItGrenade extends ItICBM { + public static final IIcon[] ICONS; + + public ItGrenade() { + super("grenade"); + this.setMaxStackSize(16); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public ItemStack onEaten(final ItemStack par1ItemStack, final World par2World, + final EntityPlayer par3EntityPlayer) { + return par1ItemStack; + } + + @Override + public EnumAction getItemUseAction(final ItemStack par1ItemStack) { + return EnumAction.bow; + } + + @Override + public int getMaxItemUseDuration(final ItemStack par1ItemStack) { + return 60; + } + + @Override + public ItemStack onItemRightClick(final ItemStack itemStack, + final World world, + final EntityPlayer entityPlayer) { + if (itemStack != null) { + final int haoMa = ZhaPin.list[itemStack.getItemDamage()].getID(); + if (!ICBMExplosion.shiBaoHu(world, new Vector3((Entity) entityPlayer), + ZhaPin.ZhaPinType.SHOU_LIU_DAN, haoMa)) { + entityPlayer.setItemInUse(itemStack, + this.getMaxItemUseDuration(itemStack)); + } else { + entityPlayer.addChatMessage( + new ChatComponentText("Grenades are banned in this region.")); + } + } + return itemStack; + } + + @Override + public void onPlayerStoppedUsing(final ItemStack itemStack, final World world, + final EntityPlayer entityPlayer, + final int nengLiang) { + if (!world.isRemote) { + final int haoMa = ZhaPin.list[itemStack.getItemDamage()].getID(); + if (!ICBMExplosion.shiBaoHu(world, new Vector3((Entity) entityPlayer), + ZhaPin.ZhaPinType.SHOU_LIU_DAN, haoMa)) { + if (!entityPlayer.capabilities.isCreativeMode) { + --itemStack.stackSize; + if (itemStack.stackSize <= 0) { + entityPlayer.inventory.setInventorySlotContents( + entityPlayer.inventory.currentItem, (ItemStack) null); + } + } + world.playSoundAtEntity(entityPlayer, "random.fuse", 0.5f, + 0.4f / + (Item.itemRand.nextFloat() * 0.4f + 0.8f)); + world.spawnEntityInWorld( + new EGrenade(world, entityPlayer, haoMa, + (this.getMaxItemUseDuration(itemStack) - nengLiang) / + (float) this.getMaxItemUseDuration(itemStack))); + } else { + entityPlayer.addChatMessage( + new ChatComponentText("Grenades are banned in this region.")); + } + } + } + + @Override + public int getMetadata(final int damage) { + return damage; + } + + @Override + public String getUnlocalizedName(final ItemStack itemstack) { + return this.getUnlocalizedName() + "." + + ZhaPin.list[itemstack.getItemDamage()].getUnlocalizedName(); + } + + @Override + public String getUnlocalizedName() { + return "icbm.grenade"; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister iconRegister) { + for (int i = 0; i < ZhaPin.E_YI_ID; ++i) { + ItGrenade.ICONS[i] = iconRegister.registerIcon( + "icbm:grenade_" + ZhaPin.list[i].getUnlocalizedName()); + } + } + + @Override + public IIcon getIconFromDamage(final int i) { + return ItGrenade.ICONS[i]; + } + + @Override + public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, + final List par3List) { + for (int i = 0; i < ZhaPin.E_YI_ID; ++i) { + par3List.add(new ItemStack((Item) this, 1, i)); + } + } + + static { + ICONS = new IIcon[256]; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/TExplosive.java b/src/main/java/icbm/zhapin/zhapin/TExplosive.java new file mode 100644 index 0000000..7eef8a2 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/TExplosive.java @@ -0,0 +1,86 @@ +package icbm.zhapin.zhapin; + +import icbm.api.explosion.IExplosive; +import icbm.api.explosion.IExplosiveContainer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.prefab.implement.IRotatable; + +public class TExplosive + extends TileEntity implements IExplosiveContainer, IRotatable { + public boolean exploding; + public int explosiveId; + + public TExplosive() { + this.exploding = false; + this.explosiveId = 0; + } + + @Override + public boolean canUpdate() { + return false; + } + + @Override + public void readFromNBT(final NBTTagCompound par1NBTTagCompound) { + super.readFromNBT(par1NBTTagCompound); + this.explosiveId = par1NBTTagCompound.getInteger("explosiveID"); + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("explosiveID", this.explosiveId); + } + + // TODO: WTF + // else if (ID == 2 && !this.worldObj.isRemote && + // player.inventory.getCurrentItem().getItem() instanceof ItRemoteDetonator) { + // final ItemStack itemStack = player.inventory.getCurrentItem(); + // BExplosives.yinZha(this.worldObj, this.xCoord, this.yCoord, + // this.zCoord, this.haoMa, 0); + // ICBMExplosion.itYaoKong.onProvide(ElectricityPack.getFromWatts(1500.0, + // ICBMExplosion.itYaoKong.getVoltage(itemStack)), itemStack); + // } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound nbt = pkt.func_148857_g(); + + this.explosiveId = nbt.getInteger("explosiveID"); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + nbt.setInteger("explosiveID", this.explosiveId); + + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, + this.getBlockMetadata(), nbt); + } + + @Override + public ForgeDirection getDirection(final IBlockAccess world, final int x, + final int y, final int z) { + return ForgeDirection.getOrientation(this.getBlockMetadata()); + } + + @Override + public void setDirection(final World world, final int x, final int y, + final int z, final ForgeDirection facingDirection) { + this.worldObj.setBlockMetadataWithNotify( + this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 2); + } + + @Override + public IExplosive getExplosiveType() { + return ZhaPin.list[this.explosiveId]; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ZhaPin.java b/src/main/java/icbm/zhapin/zhapin/ZhaPin.java new file mode 100644 index 0000000..6669a85 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ZhaPin.java @@ -0,0 +1,444 @@ +package icbm.zhapin.zhapin; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.api.explosion.ExplosionEvent; +import icbm.api.explosion.IExplosive; +import icbm.core.HaoMa; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.daodan.MissileBase; +import icbm.zhapin.zhapin.ex.ExAntiGravitational; +import icbm.zhapin.zhapin.ex.ExAntimatter; +import icbm.zhapin.zhapin.ex.ExBreaching; +import icbm.zhapin.zhapin.ex.ExChemical; +import icbm.zhapin.zhapin.ex.ExCondensed; +import icbm.zhapin.zhapin.ex.ExDebilitation; +import icbm.zhapin.zhapin.ex.ExDecayLand; +import icbm.zhapin.zhapin.ex.ExEmp; +import icbm.zhapin.zhapin.ex.ExEmpSignal; +import icbm.zhapin.zhapin.ex.ExEmpWave; +import icbm.zhapin.zhapin.ex.ExEnder; +import icbm.zhapin.zhapin.ex.ExEndothermic; +import icbm.zhapin.zhapin.ex.ExEndothermic2; +import icbm.zhapin.zhapin.ex.ExExothermic; +import icbm.zhapin.zhapin.ex.ExExothermic2; +import icbm.zhapin.zhapin.ex.ExHypersonic; +import icbm.zhapin.zhapin.ex.ExIncendiary; +import icbm.zhapin.zhapin.ex.ExMutateLiving; +import icbm.zhapin.zhapin.ex.ExNuclear; +import icbm.zhapin.zhapin.ex.ExPushPull; +import icbm.zhapin.zhapin.ex.ExRedMatter; +import icbm.zhapin.zhapin.ex.ExRejuvenation; +import icbm.zhapin.zhapin.ex.ExSMine; +import icbm.zhapin.zhapin.ex.ExShrapnel; +import icbm.zhapin.zhapin.ex.ExSonic; +import icbm.zhapin.zhapin.ex.ExThermobaric; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.TranslationHelper; +import universalelectricity.prefab.flag.FlagRegistry; +import universalelectricity.prefab.implement.ITier; + +public abstract class ZhaPin implements ITier, IExplosive { + public static final ZhaPin condensed; + public static final ZhaPin shrapnel; + public static final ZhaPin indenciary; + public static final ZhaPin debilitation; + public static final ZhaPin chemical; + public static final ZhaPin anvil; + public static final ZhaPin repulsive; + public static final ZhaPin attractive; + public static final int E_YI_ID; + public static final ZhaPin fragmentation; + public static final ZhaPin contagious; + public static final ZhaPin sonic; + public static final ZhaPin breaching; + public static final ZhaPin rejuvenation; + public static final ZhaPin thermobaric; + public static final int E_ER_ID; + public static final ZhaPin nuclear; + public static final ZhaPin emp; + public static final ZhaPin exothermic; + public static final ZhaPin endothermic; + public static final ZhaPin antiGravitational; + public static final ZhaPin ender; + public static final ZhaPin hypersonic; + public static final int E_SAN_ID; + public static final ZhaPin antimatter; + public static final ZhaPin redMatter; + public static final int E_SI_ID; + public static final ZhaPin sMine; + public static final ZhaPin empWave; + public static final ZhaPin empSignal; + public static final ZhaPin exothermic2; + public static final ZhaPin decayLand; + public static final ZhaPin mutateLiving; + public static final ZhaPin endothermic2; + public static ZhaPin[] list; + private String name; + private int ID; + private int tier; + private int yinXin; + public MissileBase daoDan; + public final String qiZi; + protected boolean isDisabled; + protected boolean isMobile; + + protected ZhaPin(final String name, final int ID, final int tier) { + this.isMobile = false; + if (ZhaPin.list == null) { + ZhaPin.list = new ZhaPin[32]; + } + if (ZhaPin.list[ID] != null) { + throw new IllegalArgumentException( + "Explosive " + ID + " is already occupied by " + + ZhaPin.list[ID].getClass().getSimpleName() + "!"); + } + ZhaPin.list[ID] = this; + this.name = name; + this.tier = tier; + this.yinXin = 100; + this.ID = ID; + this.daoDan = new MissileBase(name, ID, tier); + this.qiZi = FlagRegistry.registerFlag("ban_" + this.name); + MainBase.CONFIGURATION.load(); + this.isDisabled = MainBase.CONFIGURATION + .get("Disable_Explosives", "Disable " + this.name, false) + .getBoolean(false); + MainBase.CONFIGURATION.save(); + } + + @Override + public int getID() { + return this.ID; + } + + @Override + public String getUnlocalizedName() { + return this.name; + } + + @Override + public String getExplosiveName() { + return TranslationHelper.getLocal("icbm.explosive." + this.name + ".name"); + } + + @Override + public String getGrenadeName() { + return TranslationHelper.getLocal("icbm.grenade." + this.name + ".name"); + } + + @Override + public String getMissileName() { + return TranslationHelper.getLocal("icbm.missile." + this.name + ".name"); + } + + @Override + public String getMinecartName() { + return TranslationHelper.getLocal("icbm.minecart." + this.name + ".name"); + } + + @Override + public int getTier() { + return this.tier; + } + + @Override + public void setTier(final int tier) { + this.tier = tier; + } + + public void setFuse(final int fuse) { + this.yinXin = fuse; + } + + public int getYinXin() { + return this.yinXin; + } + + public void yinZhaQian(final World worldObj, final Entity entity) { + worldObj.playSoundAtEntity(entity, "random.fuse", 1.0f, 1.0f); + } + + public void onYinZha(final World worldObj, final Vector3 position, + final int fuseTicks) { + worldObj.spawnParticle("smoke", position.x, position.y + 0.5, position.z, + 0.0, 0.0, 0.0); + } + + public int onBeiZha() { + return (int) (this.yinXin / 2 + Math.random() * this.yinXin / 4.0); + } + + protected int proceduralInterval() { + return -1; + } + + public int proceduralInterval(final World worldObj, final int callCounts) { + return this.proceduralInterval(); + } + + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + MinecraftForge.EVENT_BUS.post(new ExplosionEvent.PreExplosionEvent( + worldObj, position.x, position.y, position.z, this)); + } + + // TODO: WTF + // dynamic typing 2.0 + @SideOnly(Side.CLIENT) + public Object[] getRenderData() { + return null; + } + + public void doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource) { + } + + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int callCount) { + this.doBaoZha(worldObj, position, explosionSource); + return false; + } + + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int metadata, + final int callCount) { + return this.doBaoZha(worldObj, position, explosionSource, callCount); + } + + public void gengXin(final World worldObj, final Vector3 position, + final int ticksExisted) { + } + + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + MinecraftForge.EVENT_BUS.post(new ExplosionEvent.PostExplosionEvent( + worldObj, position.x, position.y, position.z, this)); + } + + public int countIncrement() { + return 1; + } + + public void spawnZhaDan(final World worldObj, final Vector3 position, + final ForgeDirection orientation, final byte cause) { + if (!this.isDisabled) { + position.add(0.5); + final EExplosive eZhaDan = new EExplosive( + worldObj, position, (byte) orientation.ordinal(), this.getID()); + switch (cause) { + case 1: { + eZhaDan.destroyedByExplosion(); + break; + } + case 2: { + eZhaDan.setFire(10); + break; + } + } + worldObj.spawnEntityInWorld((Entity) eZhaDan); + } + } + + public void spawnZhaDan(final World worldObj, final Vector3 position, + final byte orientation) { + this.spawnZhaDan(worldObj, position, + ForgeDirection.getOrientation((int) orientation), (byte) 0); + } + + public void init() { + } + + public ItemStack getItemStack() { + return new ItemStack(ICBMExplosion.bExplosives, 1, this.getID()); + } + + public ItemStack getItemStack(final int amount) { + return new ItemStack(ICBMExplosion.bExplosives, amount, this.getID()); + } + + public static IExplosive getExplosiveByName(final String name) { + for (final IExplosive explosive : ZhaPin.list) { + if (explosive.getUnlocalizedName().equalsIgnoreCase(name)) { + return explosive; + } + } + return null; + } + + public static void createExplosion(final World worldObj, final Double x, + final Double y, final Double z, + final Entity entity, + final Integer explosiveID) { + createExplosion(worldObj, new Vector3(x, y, z), entity, explosiveID); + } + + public static void createExplosion(final World worldObj, + final Vector3 position, + final Entity entity, + final int explosiveID) { + if (!ZhaPin.list[explosiveID].isDisabled) { + if (ZhaPin.list[explosiveID].proceduralInterval(worldObj, -1) > 0) { + if (!worldObj.isRemote) { + worldObj.spawnEntityInWorld( + (Entity) new EExplosion(worldObj, position.clone(), explosiveID, + ZhaPin.list[explosiveID].isMobile)); + } + } else { + ZhaPin.list[explosiveID].baoZhaQian(worldObj, position.clone(), entity); + ZhaPin.list[explosiveID].doBaoZha(worldObj, position.clone(), entity, + explosiveID, -1); + ZhaPin.list[explosiveID].baoZhaHou(worldObj, position.clone(), entity); + } + } + } + + public void doDamageEntities(final World worldObj, final Vector3 position, + final float radius, final float power) { + this.doDamageEntities(worldObj, position, radius, power, true); + } + + public void doDamageEntities(final World worldObj, final Vector3 position, + float radius, final float power, + final boolean destroyItem) { + radius *= 2.0f; + final Vector3 minCoord = position.clone(); + minCoord.add(-radius - 1.0f); + final Vector3 maxCoord = position.clone(); + maxCoord.add(radius + 1.0f); + final List allEntities = worldObj.getEntitiesWithinAABB( + Entity.class, AxisAlignedBB.getBoundingBox( + (double) minCoord.intX(), (double) minCoord.intY(), + (double) minCoord.intZ(), (double) maxCoord.intX(), + (double) maxCoord.intY(), (double) maxCoord.intZ())); + final Vec3 var31 = Vec3.createVectorHelper(position.x, position.y, position.z); + for (int i = 0; i < allEntities.size(); ++i) { + final Entity entity = allEntities.get(i); + if (!this.onDamageEntity(entity)) { + if (entity instanceof EMissile) { + ((EMissile) entity).setExplode(); + } else if (!(entity instanceof EntityItem) || destroyItem) { + final double distance = entity.getDistance(position.x, position.y, position.z) / radius; + if (distance <= 1.0) { + double xDifference = entity.posX - position.x; + double yDifference = entity.posY - position.y; + double zDifference = entity.posZ - position.z; + final double var32 = MathHelper.sqrt_double( + xDifference * xDifference + yDifference * yDifference + + zDifference * zDifference); + xDifference /= var32; + yDifference /= var32; + zDifference /= var32; + final double var33 = worldObj.getBlockDensity(var31, entity.boundingBox); + final double var34 = (1.0 - distance) * var33; + int damage = 0; + damage = (int) ((var34 * var34 + var34) / 2.0 * 8.0 * power + 1.0); + entity.attackEntityFrom( + DamageSource.setExplosionSource((Explosion) null), damage); + final Entity entity2 = entity; + entity2.motionX += xDifference * var34; + final Entity entity3 = entity; + entity3.motionY += yDifference * var34; + final Entity entity4 = entity; + entity4.motionZ += zDifference * var34; + } + } + } + } + } + + protected boolean onDamageEntity(final Entity entity) { + return false; + } + + static { + condensed = new ExCondensed("condensed", + HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + shrapnel = new ExShrapnel("shrapnel", + HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + indenciary = new ExIncendiary("incendiary", + HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + debilitation = new ExDebilitation( + "debilitation", HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + chemical = new ExChemical("chemical", + HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + anvil = new ExShrapnel("anvil", HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + repulsive = new ExPushPull("repulsive", + HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + attractive = new ExPushPull("attractive", + HaoMa.getID(ZhaPin.class.getSimpleName()), 1); + E_YI_ID = ZhaPin.attractive.getID() + 1; + fragmentation = new ExShrapnel( + "fragmentation", HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + contagious = new ExChemical("contagious", + HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + sonic = new ExSonic("sonic", HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + breaching = new ExBreaching("breaching", + HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + rejuvenation = new ExRejuvenation( + "rejuvenation", HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + thermobaric = new ExThermobaric( + "thermobaric", HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + E_ER_ID = ZhaPin.thermobaric.getID() + 1; + nuclear = new ExNuclear("nuclear", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + emp = new ExEmp("emp", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + exothermic = new ExExothermic("exothermic", + HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + endothermic = new ExEndothermic( + "endothermic", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + antiGravitational = new ExAntiGravitational( + "antiGravitational", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + ender = new ExEnder("ender", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + hypersonic = new ExHypersonic("hypersonic", + HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + E_SAN_ID = ZhaPin.hypersonic.getID() + 1; + antimatter = new ExAntimatter("antimatter", + HaoMa.getID(ZhaPin.class.getSimpleName()), 4); + redMatter = new ExRedMatter("redMatter", + HaoMa.getID(ZhaPin.class.getSimpleName()), 4); + E_SI_ID = ZhaPin.redMatter.getID() + 1; + sMine = new ExSMine("sMine", HaoMa.getID(ZhaPin.class.getSimpleName()), 2); + empWave = new ExEmpWave("emp", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + empSignal = new ExEmpSignal("emp", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + exothermic2 = new ExExothermic2( + "exothermic", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + decayLand = new ExDecayLand("decayLand", + HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + mutateLiving = new ExMutateLiving( + "mutateLiving", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + endothermic2 = new ExEndothermic2( + "endothermic", HaoMa.getID(ZhaPin.class.getSimpleName()), 3); + } + + public enum ZhaPinType { + QUAN_BU("QUAN_BU", 0), + ZHA_DAN("ZHA_DAN", 1), + SHOU_LIU_DAN("SHOU_LIU_DAN", 2), + DAO_DAN("DAO_DAN", 3), + CHE("CHE", 4); + + private ZhaPinType(final String name, final int ordinal) { + } + + public static ZhaPinType get(final int id) { + if (id >= 0 && id < values().length) { + return values()[id]; + } + return null; + } + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExAntiGravitational.java b/src/main/java/icbm/zhapin/zhapin/ex/ExAntiGravitational.java new file mode 100644 index 0000000..9e4e9fb --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExAntiGravitational.java @@ -0,0 +1,178 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.EGravityBlock; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import mffs.api.IForceFieldBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExAntiGravitational extends ZhaPin { + public ExAntiGravitational(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + for (int x = 0; x < this.getRadius(); ++x) { + for (int y = 0; y < this.getRadius(); ++y) { + for (int z = 0; z < this.getRadius(); ++z) { + if (x == 0 || x == this.getRadius() - 1.0f || y == 0 || + y == this.getRadius() - 1.0f || z == 0 || + z == this.getRadius() - 1.0f) { + double xStep = x / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double yStep = y / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double zStep = z / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float power = this.getRadius() * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; power > 0.0f; power -= var18 * 0.75f) { + final Vector3 targetPosition = new Vector3(var15, var16, var17); + final Block block = worldObj.getBlock(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (block != Blocks.air) { + float resistance = 0.0f; + if (block == Blocks.bedrock) { + break; + } + if (block instanceof BlockLiquid) { + resistance = 1.0f; + } else { + resistance = (block.getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + power -= resistance; + } + if (power > 0.0f) { + source.dataList1.add(targetPosition.clone()); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.antigravity", 6.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + final EExplosion source = (EExplosion) explosionSource; + final int r = callCount; + if (!worldObj.isRemote) { + int blocksToTake = 20; + for (final Object obj : source.dataList1) { + final Vector3 targetPosition = (Vector3) obj; + final double distance = Vector3.distance(targetPosition, position); + if (distance <= r && distance >= r - 2) { + if (blocksToTake <= 0) { + continue; + } + final Block block = worldObj.getBlock(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (block == Blocks.air || block == Blocks.bedrock) { + continue; + } + if (block == Blocks.obsidian) { + continue; + } + if (block instanceof IForceFieldBlock) { + continue; + } + final int metadata = worldObj.getBlockMetadata(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (distance >= r - 1 && worldObj.rand.nextInt(3) <= 0) { + continue; + } + worldObj.setBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ(), Blocks.air, 0, 2); + targetPosition.add(0.5); + if (worldObj.rand.nextFloat() < 0.3 * (this.getRadius() - r)) { + final EGravityBlock entity = new EGravityBlock( + worldObj, targetPosition, block, metadata, 0.0f); + worldObj.spawnEntityInWorld((Entity) entity); + entity.yawChange = 50.0f * worldObj.rand.nextFloat(); + entity.pitchChange = 100.0f * worldObj.rand.nextFloat(); + final EGravityBlock eFeiBlock = entity; + eFeiBlock.motionY += Math.max(0.15 * worldObj.rand.nextFloat(), 0.1); + } + --blocksToTake; + } + } + } + final int radius = (int) this.getRadius(); + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, 100.0, position.z + radius); + final List allEntities = worldObj.getEntitiesWithinAABB(Entity.class, bounds); + for (final Entity entity2 : allEntities) { + if (!(entity2 instanceof EGravityBlock) && + entity2.posY < 100.0 + position.y && entity2.motionY < 0.4) { + final Entity entity3 = entity2; + entity3.motionY += 0.15; + } + } + return callCount <= 2400; + } + + public int proceduralInterval() { + return 1; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe(this.getItemStack(), + new Object[] { "EEE", "ETE", "EEE", 'T', + ZhaPin.repulsive.getItemStack(), + 'E', Items.ender_eye }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 15.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExAntimatter.java b/src/main/java/icbm/zhapin/zhapin/ex/ExAntimatter.java new file mode 100644 index 0000000..0f9b9a2 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExAntimatter.java @@ -0,0 +1,122 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExAntimatter extends ZhaPin { + public boolean destroyBedrock; + + public ExAntimatter(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.destroyBedrock = true; + this.setFuse(300); + MainBase.CONFIGURATION.load(); + this.destroyBedrock = MainBase.CONFIGURATION + .get("general", "Antimatter Destroy Bedrock", this.destroyBedrock) + .getBoolean(this.destroyBedrock); + MainBase.CONFIGURATION.save(); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.antimatter", 7.0f, + (float) (worldObj.rand.nextFloat() * 0.1 + 0.8999999761581421)); + explosionSource.posY += 5.0; + this.doDamageEntities(worldObj, position, this.getRadius() * 2.0f, + 2.1474836E9f); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int callCount) { + if (!worldObj.isRemote && callCount == 1) { + for (int x = (int) (-this.getRadius()); x < this.getRadius(); ++x) { + for (int y = (int) (-this.getRadius()); y < this.getRadius(); ++y) { + for (int z = (int) (-this.getRadius()); z < this.getRadius(); ++z) { + final Vector3 targetPosition = Vector3.add(position, new Vector3(x, y, z)); + final double dist = position.distanceTo(targetPosition); + if (dist < this.getRadius()) { + final Block block = targetPosition.getBlock((IBlockAccess) worldObj); + if (block != Blocks.air) { + if (block != Blocks.bedrock || this.destroyBedrock) { + if (dist < this.getRadius() - 1.0f || + worldObj.rand.nextFloat() > 0.7) { + targetPosition.setBlock(worldObj, Blocks.air); + } + } + } + } + } + } + } + return false; + } + return callCount <= this.getRadius(); + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + this.doDamageEntities(worldObj, position, this.getRadius() * 2.0f, + 2.1474836E9f); + } + + @Override + protected boolean onDamageEntity(final Entity entity) { + if (entity instanceof EExplosion && + ((EExplosion) entity).haoMa == ZhaPin.redMatter.getID()) { + entity.setDead(); + return true; + } + return false; + } + + @Override + public void onYinZha(final World worldObj, final Vector3 position, + final int fuseTicks) { + super.onYinZha(worldObj, position, fuseTicks); + if (fuseTicks % 25 == 0) { + worldObj.playSoundEffect(position.x, position.y, position.z, "icbm.alarm", + 4.0f, 1.0f); + } + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "AAA", "AEA", "AAA", 'E', + ZhaPin.nuclear.getItemStack(), 'A', "antimatterGram" }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + protected int proceduralInterval() { + return 1; + } + + @Override + public float getRadius() { + return 40.0f; + } + + @Override + public double getEnergy() { + return 1000000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExBreaching.java b/src/main/java/icbm/zhapin/zhapin/ex/ExBreaching.java new file mode 100644 index 0000000..3c1c0fe --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExBreaching.java @@ -0,0 +1,166 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.ArrayList; +import java.util.List; +import mffs.api.IForceFieldBlock; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; +import universalelectricity.prefab.implement.IRotatable; + +public class ExBreaching extends ZhaPin { + public ExBreaching(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.setFuse(10); + } + + @Override + public void doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + final Vector3 difference = new Vector3(); + if (explosionSource instanceof IRotatable) { + difference.modifyPositionFromSide( + ((IRotatable) explosionSource) + .getDirection((IBlockAccess) worldObj, position.intX(), + position.intY(), position.intZ())); + } else { + difference.modifyPositionFromSide(ForgeDirection.DOWN); + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "random.explode", 5.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + final Vector3 targetPosition = position.clone(); + for (int i = 0; i < 8; ++i) { + if (targetPosition.getBlock((IBlockAccess) worldObj) != null) { + if (targetPosition.getBlock((IBlockAccess) worldObj) + .getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), position.x, + position.y, position.z) > Blocks.obsidian.getExplosionResistance(explosionSource)) { + break; + } + if (targetPosition.getBlock((IBlockAccess) worldObj) instanceof IForceFieldBlock) { + break; + } + } + final List blownBlocks = new ArrayList<>(); + for (int x = 0; x < 16; ++x) { + for (int y = 0; y < 16; ++y) { + for (int z = 0; z < 16; ++z) { + if (x == 0 || x == 15 || y == 0 || y == 15 || z == 0 || z == 15) { + double xStep = x / 15.0f * 2.0f - 1.0f; + double yStep = y / 15.0f * 2.0f - 1.0f; + double zStep = z / 15.0f * 2.0f - 1.0f; + final double diagonalDistance = Math + .sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float var14 = 2.0f * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = targetPosition.x; + double var16 = targetPosition.y; + double var17 = targetPosition.z; + for (float var18 = 0.3f; var14 > 0.0f; var14 -= var18 * 0.75f) { + final int var19 = MathHelper.floor_double(var15); + final int var20 = MathHelper.floor_double(var16); + final int var21 = MathHelper.floor_double(var17); + final Block var22 = worldObj.getBlock(var19, var20, var21); + if (var22 == Blocks.air) { + var14 -= (var22.getExplosionResistance( + explosionSource, worldObj, var19, var20, + var21, (double) targetPosition.intX(), + (double) targetPosition.intY(), + (double) targetPosition.intZ()) + + 0.3f) * + var18; + } + if (var14 > 0.0f) { + blownBlocks.add(new ChunkPosition(var19, var20, var21)); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + this.doDamageEntities(worldObj, targetPosition, 2.0f, 3.5f, false); + for (int var23 = blownBlocks.size() - 1; var23 >= 0; --var23) { + final ChunkPosition var24 = blownBlocks.get(var23); + final int var25 = var24.chunkPosX; + final int var26 = var24.chunkPosY; + final int var27 = var24.chunkPosZ; + final Block block = worldObj.getBlock(var25, var26, var27); + final double var28 = var25 + worldObj.rand.nextFloat(); + final double var29 = var26 + worldObj.rand.nextFloat(); + final double var30 = var27 + worldObj.rand.nextFloat(); + double var31 = var28 - targetPosition.y; + double var32 = var29 - targetPosition.y; + double var33 = var30 - targetPosition.z; + final double var34 = MathHelper.sqrt_double( + var31 * var31 + var32 * var32 + var33 * var33); + var31 /= var34; + var32 /= var34; + var33 /= var34; + double var35 = 0.5 / (var34 / 2.0 + 0.1); + var35 *= worldObj.rand.nextFloat() * worldObj.rand.nextFloat() + 0.3f; + var31 *= var35; + var32 *= var35; + var33 *= var35; + worldObj.spawnParticle( + "explode", (var28 + targetPosition.x * 1.0) / 2.0, + (var29 + targetPosition.y * 1.0) / 2.0, + (var30 + targetPosition.z * 1.0) / 2.0, var31, var32, var33); + worldObj.spawnParticle("smoke", var28, var29, var30, var31, var32, + var33); + if (block != Blocks.air) { + block.dropBlockAsItemWithChance( + worldObj, var25, var26, var27, + worldObj.getBlockMetadata(var25, var26, var27), 1.0f, 0); + block.onBlockDestroyedByExplosion(worldObj, var25, var26, var27, + (Explosion) null); + worldObj.setBlock(var25, var26, var27, Blocks.air, 0, 2); + } + } + targetPosition.add(difference); + } + } + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe(this.getItemStack(2), + new Object[] { "GCG", "GCG", "GCG", 'C', + ZhaPin.condensed.getItemStack(), + 'G', Items.gunpowder }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 6.0f; + } + + @Override + public double getEnergy() { + return 6000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExChemical.java b/src/main/java/icbm/zhapin/zhapin/ex/ExChemical.java new file mode 100644 index 0000000..9ac317a --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExChemical.java @@ -0,0 +1,112 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExChemical extends ZhaPin { + public ExChemical(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + final int duration = 60 / this.proceduralInterval(); + final boolean isContagious = this.getTier() == 2; + float radius = this.getRadius(); + if (explosionSource instanceof EGrenade) { + radius /= 2.0f; + } + if (worldObj.isRemote) { + float red = 0.8f; + float green = 0.8f; + float blue = 0.0f; + if (isContagious) { + red = 0.3f; + green = 0.8f; + blue = 0.0f; + } + for (int i = 0; i < 200; ++i) { + final Vector3 diDian = new Vector3(); + diDian.x = Math.random() * this.getRadius() / 2.0 - this.getRadius() / 4.0f; + diDian.y = Math.random() * this.getRadius() / 2.0 - this.getRadius() / 4.0f; + diDian.z = Math.random() * this.getRadius() / 2.0 - this.getRadius() / 4.0f; + diDian.multiply(Math.min(this.getRadius(), (float) callCount) / 10.0f); + if (diDian.getMagnitude() <= this.getRadius()) { + diDian.add(new Vector3(explosionSource)); + ICBMExplosion.proxy.spawnParticle( + "smoke", explosionSource.worldObj, diDian, + (Math.random() - 0.5) / 2.0, (Math.random() - 0.5) / 2.0, + (Math.random() - 0.5) / 2.0, red, green, blue, 4.0f, 8.0); + } + } + } + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List entitiesNearby = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bounds); + for (final EntityLivingBase entity : entitiesNearby) { + if (isContagious) { + ICBMExplosion.DU_CHUAN_RAN.poisonEntity(position, entity); + } else { + ICBMExplosion.DU_DU.poisonEntity(position, entity); + } + } + worldObj.playSoundEffect( + position.x + 0.5, position.y + 0.5, position.z + 0.5, "icbm.gasleak", + 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 1.0f); + if (isContagious) { + ZhaPin.mutateLiving.doBaoZha(worldObj, position, null, (int) radius, -1); + } + return callCount <= duration; + } + + public int proceduralInterval() { + return 5; + } + + @Override + public void init() { + if (this.getTier() == 1) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "@@@", "@?@", "@@@", '@', MainBase.itDu, '?', + ZhaPin.debilitation.getItemStack() }), + "Chemical", MainBase.CONFIGURATION, true); + } else if (this.getTier() == 2) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(2), + new Object[] { " @ ", "@?@", " @ ", '?', Items.rotten_flesh, '@', + ZhaPin.chemical.getItemStack() }), + "Contagious", MainBase.CONFIGURATION, true); + } + } + + @Override + public float getRadius() { + return (this.getTier() == 2) ? 22.0f : 15.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExCondensed.java b/src/main/java/icbm/zhapin/zhapin/ex/ExCondensed.java new file mode 100644 index 0000000..660832c --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExCondensed.java @@ -0,0 +1,171 @@ +package icbm.zhapin.zhapin.ex; + +import cpw.mods.fml.common.registry.LanguageRegistry; +import icbm.core.MainBase; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockTNT; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExCondensed extends ZhaPin { + public ExCondensed(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.setFuse(1); + } + + @Override + public void doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource) { + final List blownBlocks = new ArrayList<>(); + if (!worldObj.isRemote) { + for (int x = 0; x < 16; ++x) { + for (int y = 0; y < 16; ++y) { + for (int z = 0; z < 16; ++z) { + if (x == 0 || x == 15 || y == 0 || y == 15 || z == 0 || z == 15) { + double xStep = x / 15.0f * 2.0f - 1.0f; + double yStep = y / 15.0f * 2.0f - 1.0f; + double zStep = z / 15.0f * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float var14 = 2.0f * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; var14 > 0.0f; var14 -= var18 * 0.75f) { + final int var19 = MathHelper.floor_double(var15); + final int var20 = MathHelper.floor_double(var16); + final int var21 = MathHelper.floor_double(var17); + final Block block = worldObj.getBlock(var19, var20, var21); + if (block == Blocks.air) { + var14 -= (block.getExplosionResistance( + explosionSource, worldObj, var19, var20, var21, + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + if (var14 > 0.0f) { + blownBlocks.add(new ChunkPosition(var19, var20, var21)); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "random.explode", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + this.doDamageEntities(worldObj, position, 2.0f, 10.0f, false); + if (!worldObj.isRemote) { + for (int var23 = blownBlocks.size() - 1; var23 >= 0; --var23) { + final ChunkPosition var24 = blownBlocks.get(var23); + final int var25 = var24.chunkPosX; + final int var26 = var24.chunkPosY; + final int var27 = var24.chunkPosZ; + final Block block = worldObj.getBlock(var25, var26, var27); + final double var28 = var25 + worldObj.rand.nextFloat(); + final double var29 = var26 + worldObj.rand.nextFloat(); + final double var30 = var27 + worldObj.rand.nextFloat(); + double var31 = var28 - position.y; + double var32 = var29 - position.y; + double var33 = var30 - position.z; + final double var34 = MathHelper.sqrt_double( + var31 * var31 + var32 * var32 + var33 * var33); + var31 /= var34; + var32 /= var34; + var33 /= var34; + double var35 = 0.5 / (var34 / 2.0 + 0.1); + var35 *= worldObj.rand.nextFloat() * worldObj.rand.nextFloat() + 0.3f; + var31 *= var35; + var32 *= var35; + var33 *= var35; + worldObj.spawnParticle("explode", (var28 + position.x * 1.0) / 2.0, + (var29 + position.y * 1.0) / 2.0, + (var30 + position.z * 1.0) / 2.0, var31, var32, + var33); + worldObj.spawnParticle("smoke", var28, var29, var30, var31, var32, + var33); + if (block == Blocks.air) { + try { + if (block.canDropFromExplosion((Explosion) null)) { + block.dropBlockAsItemWithChance( + worldObj, var25, var26, var27, + worldObj.getBlockMetadata(var25, var26, var27), 1.0f, 0); + } + if (block instanceof BlockTNT) { + worldObj.setBlockToAir(var25, var26, var27); + if (!worldObj.isRemote) { + final EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldObj, var25 + 0.5, + var26 + 0.5, + var27 + 0.5, (EntityLiving) null); + entitytntprimed.fuse = worldObj.rand.nextInt(entitytntprimed.fuse / 4) + + entitytntprimed.fuse / 8; + worldObj.spawnEntityInWorld((Entity) entitytntprimed); + } + } else { + block.onBlockExploded(worldObj, var25, var26, var27, + (Explosion) null); + } + } catch (final Exception e) { + e.printStackTrace(); + } + } + } + } + } + + @Override + public String getMissileName() { + return LanguageRegistry.instance().getStringLocalization( + "icbm.explosive.conventional") + + " " + LanguageRegistry.instance().getStringLocalization("icbm.missile"); + } + + @Override + public String getMinecartName() { + return LanguageRegistry.instance().getStringLocalization("icbm.explosive") + + " " + + LanguageRegistry.instance().getStringLocalization("item.minecart.name"); + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(3), + new Object[] { "@?@", '@', Blocks.tnt, '?', Items.redstone }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 2.0f; + } + + @Override + public double getEnergy() { + return 4000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExDebilitation.java b/src/main/java/icbm/zhapin/zhapin/ex/ExDebilitation.java new file mode 100644 index 0000000..398ed88 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExDebilitation.java @@ -0,0 +1,99 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; +import universalelectricity.prefab.potion.CustomPotionEffect; + +public class ExDebilitation extends ZhaPin { + public ExDebilitation(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.debilitation", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + float radius = this.getRadius(); + if (explosionSource instanceof EGrenade) { + radius /= 2.0f; + } + final int duration = 600 / this.proceduralInterval(); + if (worldObj.isRemote) { + for (int i = 0; i < 200; ++i) { + final Vector3 diDian = new Vector3(); + diDian.x = Math.random() * radius / 2.0 - radius / 4.0f; + diDian.y = Math.random() * radius / 2.0 - radius / 4.0f; + diDian.z = Math.random() * radius / 2.0 - radius / 4.0f; + diDian.multiply(Math.min(radius, (float) callCount) / 10.0f); + if (diDian.getMagnitude() <= radius) { + diDian.add(new Vector3(explosionSource)); + ICBMExplosion.proxy.spawnParticle( + "smoke", explosionSource.worldObj, diDian, + (Math.random() - 0.5) / 2.0, (Math.random() - 0.5) / 2.0, + (Math.random() - 0.5) / 2.0, 1.0f, 1.0f, 1.0f, 7.0f, 8.0); + } + } + } + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List allEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bounds); + for (final EntityLivingBase entity : allEntities) { + entity.addPotionEffect( + (PotionEffect) new CustomPotionEffect(Potion.confusion.id, 360, 0)); + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.digSlowdown.id, 1200, 0)); + entity.addPotionEffect((PotionEffect) new CustomPotionEffect( + Potion.moveSlowdown.id, 1200, 2)); + } + return callCount <= duration; + } + + public int proceduralInterval() { + return 5; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(3), + new Object[] { "SSS", "WRW", "SSS", 'R', ZhaPin.repulsive.getItemStack(), + 'W', Items.water_bucket, 'S', "dustSulfur" }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 20.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExDecayLand.java b/src/main/java/icbm/zhapin/zhapin/ex/ExDecayLand.java new file mode 100644 index 0000000..82dbddb --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExDecayLand.java @@ -0,0 +1,77 @@ +package icbm.zhapin.zhapin.ex; + +import atomicscience.AtomicScience; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ExDecayLand extends ExThr { + public ExDecayLand(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + final ThrSheXian thread = new ThrSheXian(worldObj, position, (int) ZhaPin.nuclear.getRadius(), + 200, explosionSource); + thread.run(); + ((EExplosion) explosionSource).dataList1.add(thread); + } + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + final EExplosion source = (EExplosion) explosionSource; + if (!worldObj.isRemote && source.dataList1.size() > 0 && + source.dataList1.get(0) instanceof ThrSheXian) { + final ThrSheXian thread = (ThrSheXian) source.dataList1.get(0); + for (final Vector3 targetPosition : thread.destroyed) { + final Block block = targetPosition.getBlock((IBlockAccess) worldObj); + if (block != Blocks.air) { + if ((block == Blocks.grass || block == Blocks.sand) && + worldObj.rand.nextFloat() > 0.96) { + targetPosition.setBlock(worldObj, AtomicScience.blockRadioactive); + } + if (block == Blocks.stone) + if (worldObj.rand.nextFloat() <= 0.99) { + continue; + } + targetPosition.setBlock(worldObj, AtomicScience.blockRadioactive); + } else if (block == Blocks.leaves) { + targetPosition.setBlock(worldObj, Blocks.air); + } else if (block == Blocks.tallgrass) { + if (Math.random() * 100.0 > 50.0) { + targetPosition.setBlock(worldObj, Blocks.cobblestone); + } else { + targetPosition.setBlock(worldObj, Blocks.air); + } + } else { + if (block != Blocks.farmland) { + continue; + } + targetPosition.setBlock(worldObj, AtomicScience.blockRadioactive); + } + } + } + } + + @Override + public float getRadius() { + return 50.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExEmp.java b/src/main/java/icbm/zhapin/zhapin/ex/ExEmp.java new file mode 100644 index 0000000..90a4f5e --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExEmp.java @@ -0,0 +1,62 @@ +package icbm.zhapin.zhapin.ex; + +import calclavia.lib.UniversalRecipes; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.item.ElectricItemHelper; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExEmp extends ZhaPin { + public ExEmp(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, int radius, + final int callCount) { + if (radius < 0) { + radius = (int) this.getRadius(); + } + ZhaPin.empSignal.doBaoZha(worldObj, position, explosionSource, radius, + callCount); + ZhaPin.empWave.doBaoZha(worldObj, position, explosionSource, radius, + callCount); + ICBMExplosion.proxy.spawnParticle("shockwave", worldObj, position, 0.0, 0.0, + 0.0, 0.0f, 0.0f, 255.0f, 10.0f, 3.0); + return false; + } + + @Override + public void init() { + if (OreDictionary.getOres(UniversalRecipes.BATTERY).size() > 0) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { + "RBR", "BTB", "RBR", 'T', ZhaPin.repulsive.getItemStack(), 'R', + Blocks.redstone_block, 'B', + ElectricItemHelper.getUncharged( + OreDictionary.getOres(UniversalRecipes.BATTERY).get(0)) }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + } + + @Override + public float getRadius() { + return 50.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExEmpSignal.java b/src/main/java/icbm/zhapin/zhapin/ex/ExEmpSignal.java new file mode 100644 index 0000000..4585cf2 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExEmpSignal.java @@ -0,0 +1,85 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.api.IMissile; +import icbm.api.RadarRegistry; +import icbm.api.explosion.IEMPItem; +import icbm.zhapin.zhapin.EExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import universalelectricity.core.item.IItemElectric; +import universalelectricity.core.vector.Vector3; + +public class ExEmpSignal extends ZhaPin { + public ExEmpSignal(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int radius, + final int callCount) { + final List entitiesNearby = RadarRegistry.getEntitiesWithinRadius(position.toVector2(), radius); + for (final Entity entity : entitiesNearby) { + if (entity instanceof IMissile && + !entity.isEntityEqual(explosionSource) && + ((IMissile) entity).getTicksInAir() > -1) { + ((IMissile) entity).dropMissileAsItem(); + } + } + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List entities = worldObj.getEntitiesWithinAABB(Entity.class, bounds); + for (final Entity entity2 : entities) { + if (entity2 instanceof EntityPlayer) { + final IInventory inventory = (IInventory) ((EntityPlayer) entity2).inventory; + for (int i = 0; i < inventory.getSizeInventory(); ++i) { + final ItemStack itemStack = inventory.getStackInSlot(i); + if (itemStack != null) { + if (itemStack.getItem() instanceof IEMPItem) { + ((IEMPItem) itemStack.getItem()) + .onEMP(itemStack, entity2, ZhaPin.emp); + } else if (itemStack.getItem() instanceof IItemElectric) { + ((IItemElectric) itemStack.getItem()).setJoules(0.0, itemStack); + } + // TODO: WTF: IC2 + // else if (itemStack.getItem() instanceof ICustomElectricItem) { + // ((ICustomElectricItem) itemStack.getItem()) + // .discharge(itemStack, + // ((ICustomElectricItem) itemStack.getItem()) + // .getMaxCharge(itemStack), + // 0, true, false); + // } + } + } + } else { + if (!(entity2 instanceof EExplosive)) { + continue; + } + entity2.setDead(); + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.emp", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + return false; + } + + @Override + public float getRadius() { + return 50.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExEmpWave.java b/src/main/java/icbm/zhapin/zhapin/ex/ExEmpWave.java new file mode 100644 index 0000000..7070121 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExEmpWave.java @@ -0,0 +1,93 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.api.explosion.IEMPBlock; +import icbm.zhapin.zhapin.ZhaPin; +import mffs.api.IForceFieldBlock; +import mffs.api.fortron.IFortronStorage; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import universalelectricity.core.block.IElectricityStorage; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IDisableable; +import universalelectricity.prefab.tile.TileEntityElectricityRunnable; + +public class ExEmpWave extends ZhaPin { + public ExEmpWave(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int radius, + final int callCount) { + for (int r = radius, x = -r; x < r; ++x) { + for (int y = -r; y < r; ++y) { + for (int z = -r; z < r; ++z) { + final double dist = MathHelper.sqrt_double((double) (x * x + y * y + z * z)); + final Vector3 searchPosition = Vector3.add(position, new Vector3(x, y, z)); + if (dist <= r) { + if (Math.round(position.x + y) == position.intY()) { + worldObj.spawnParticle("largesmoke", searchPosition.x, + searchPosition.y, searchPosition.z, 0.0, + 0.0, 0.0); + } + final Block block = searchPosition.getBlock((IBlockAccess) worldObj); + final TileEntity tileEntity = searchPosition.getTileEntity((IBlockAccess) worldObj); + if (block != null) { + if (block instanceof IForceFieldBlock) { + ((IForceFieldBlock) block) + .weakenForceField(worldObj, searchPosition.intX(), + searchPosition.intY(), + searchPosition.intZ(), 1000); + } else if (block instanceof IEMPBlock) { + ((IEMPBlock) block) + .onEMP(worldObj, searchPosition, ZhaPin.emp); + } else if (tileEntity != null) { + if (tileEntity instanceof IElectricityStorage) { + ((IElectricityStorage) tileEntity).setJoules(0.0); + } + if (tileEntity instanceof IDisableable) { + ((IDisableable) tileEntity).onDisable(400); + } + if (tileEntity instanceof IFortronStorage) { + ((IFortronStorage) tileEntity) + .provideFortron((int) worldObj.rand.nextFloat() * + ((IFortronStorage) tileEntity) + .getFortronCapacity(), + true); + } + // TODO: WTF: IC2 + // if (tileEntity instanceof IEnergyStorage) { + // ((IEnergyStorage) tileEntity).setStored(0); + // } + if (tileEntity instanceof TileEntityElectricityRunnable) { + ((TileEntityElectricityRunnable) tileEntity).wattsReceived = 0.0; + } + } + } + } + } + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.emp", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + return false; + } + + @Override + public float getRadius() { + return 50.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExEnder.java b/src/main/java/icbm/zhapin/zhapin/ex/ExEnder.java new file mode 100644 index 0000000..d204748 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExEnder.java @@ -0,0 +1,156 @@ +package icbm.zhapin.zhapin.ex; + +import cpw.mods.fml.common.FMLLog; +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExEnder extends ZhaPin { + public static final int SHI_JIAN = 160; + + public ExEnder(final String name, final int ID, final int tier) { + super(name, ID, tier); + super.isMobile = true; + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + worldObj.createExplosion(explosionSource, position.x, position.y, + position.z, 5.0f, true); + } + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + if (worldObj.isRemote) { + for (int r = (int) (this.getRadius() - + callCount / 160.0 * this.getRadius()), + x = -r; x < r; ++x) { + for (int z = -r; z < r; ++z) { + for (int y = -r; y < r; ++y) { + final Vector3 targetPosition = Vector3.add(position, new Vector3(x, y, z)); + final double distance = targetPosition.distanceTo(position); + if (distance < r && distance > r - 1) { + if (targetPosition.getBlock((IBlockAccess) worldObj) == Blocks.air) { + if (worldObj.rand.nextFloat() < Math.max(0.001 * r, 0.01)) { + final float velX = (float) ((targetPosition.x - position.x) * 0.5); + final float velY = (float) ((targetPosition.y - position.y) * 0.5); + final float velZ = (float) ((targetPosition.z - position.z) * 0.5); + ICBMExplosion.proxy.spawnParticle("portal", worldObj, + targetPosition, velX, velY, + velZ, 5.0f, 1.0); + } + } + } + } + } + } + } + final int radius = (int) this.getRadius(); + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List allEntities = worldObj.getEntitiesWithinAABB(Entity.class, bounds); + boolean explosionCreated = false; + for (final Entity entity : allEntities) { + if (entity == explosionSource) { + continue; + } + final double xDifference = entity.posX - position.x; + final double yDifference = entity.posY - position.y; + final double zDifference = entity.posZ - position.z; + int r2 = (int) this.getRadius(); + if (xDifference < 0.0) { + r2 = (int) (-this.getRadius()); + } + final Entity entity2 = entity; + entity2.motionX -= (r2 - xDifference) * Math.abs(xDifference) * 6.0E-4; + r2 = (int) this.getRadius(); + if (entity.posY > position.y) { + r2 = (int) (-this.getRadius()); + } + final Entity entity3 = entity; + entity3.motionY += (r2 - yDifference) * Math.abs(yDifference) * 0.0011; + r2 = (int) this.getRadius(); + if (zDifference < 0.0) { + r2 = (int) (-this.getRadius()); + } + final Entity entity4 = entity; + entity4.motionZ -= (r2 - zDifference) * Math.abs(zDifference) * 6.0E-4; + if (Vector3.distance(new Vector3(entity.posX, entity.posY, entity.posZ), + position) >= 4.0) { + continue; + } + if (!explosionCreated && callCount % 5 == 0) { + worldObj.spawnParticle("hugeexplosion", entity.posX, entity.posY, + entity.posZ, 0.0, 0.0, 0.0); + explosionCreated = true; + } + try { + if (entity.worldObj.provider.dimensionId == 1) { + entity.travelToDimension(0); + } else { + entity.travelToDimension(1); + } + } catch (final Exception e) { + FMLLog.severe("Failed to teleport entity to the End.", new Object[0]); + } + } + worldObj.playSound(position.x, position.y, position.z, "portal.portal", + 2.0f, worldObj.rand.nextFloat() * 0.4f + 0.8f, false); + return callCount <= 160; + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + if (!explosionSource.worldObj.isRemote) { + for (int i = 0; i < 20; ++i) { + final EntityEnderman enderman = new EntityEnderman(worldObj); + enderman.setPosition(position.x, position.y, position.z); + explosionSource.worldObj.spawnEntityInWorld((Entity) enderman); + } + } + } + + public int proceduralInterval() { + return 1; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "EPE", "ETE", "EPE", 'P', Items.ender_pearl, 'E', + Blocks.end_stone, 'T', ZhaPin.attractive.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 20.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExEndothermic.java b/src/main/java/icbm/zhapin/zhapin/ex/ExEndothermic.java new file mode 100644 index 0000000..5e55735 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExEndothermic.java @@ -0,0 +1,212 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.EGravityBlock; +import icbm.zhapin.ELightBeam; +import icbm.zhapin.po.PDongShang; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; +import universalelectricity.prefab.potion.CustomPotionEffect; + +public class ExEndothermic extends ZhaPin { + public ExEndothermic(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + final ELightBeam lightBeam = new ELightBeam(worldObj, position, 400, 0.0f, 0.3f, 0.7f); + worldObj.spawnEntityInWorld((Entity) lightBeam); + ((EExplosion) explosionSource).entityList.add(0, lightBeam); + worldObj.createExplosion((Entity) null, position.x, position.y, position.z, + 4.0f, true); + } + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int callCount) { + List gravityBlocks = new ArrayList<>(); + this.getClass(); + int radius = 5; + if (explosionSource instanceof EGrenade) { + radius /= 2; + } + if (this.canFocusBeam(worldObj, position)) { + if (!worldObj.isRemote) { + for (int r = radius, x = -r; x < r; ++x) { + for (int y = -r; y < r; ++y) { + for (int z = -r; z < r; ++z) { + final double dist = MathHelper.sqrt_double((double) (x * x + y * y + z * z)); + if (dist <= r) { + if (dist >= r - 3) { + final Vector3 currentPos = new Vector3( + position.x + x, position.y + y, position.z + z); + final Block blockID = worldObj.getBlock( + currentPos.intX(), currentPos.intY(), currentPos.intZ()); + if (blockID != Blocks.air && blockID != Blocks.bedrock) { + if (blockID != Blocks.obsidian) { + final int metadata = worldObj.getBlockMetadata( + currentPos.intX(), currentPos.intY(), + currentPos.intZ()); + if (worldObj.rand.nextInt(3) > 0) { + worldObj.setBlock(currentPos.intX(), currentPos.intY(), + currentPos.intZ(), Blocks.air, 0, 2); + currentPos.add(0.5); + final EGravityBlock entity = new EGravityBlock( + worldObj, currentPos, blockID, metadata); + worldObj.spawnEntityInWorld((Entity) entity); + gravityBlocks.add(entity); + entity.pitchChange = 50.0f * worldObj.rand.nextFloat(); + } + } + } + } + } + } + } + } + ((EExplosion) explosionSource).entityList.addAll(gravityBlocks); + } + gravityBlocks = ((EExplosion) explosionSource).entityList; + for (final Entity unspecifiedEntity : gravityBlocks) { + if (unspecifiedEntity instanceof EGravityBlock) { + final EGravityBlock entity2 = (EGravityBlock) unspecifiedEntity; + final double xDifference = entity2.posX - position.x; + final double zDifference = entity2.posZ - position.z; + int r2 = radius; + if (xDifference < 0.0) { + r2 = -radius; + } + if (xDifference > 4.0) { + final EGravityBlock eFeiBlock = entity2; + eFeiBlock.motionX += (r2 - xDifference) * -0.02 * worldObj.rand.nextFloat(); + } + if (entity2.posY < position.y + 15.0) { + final EGravityBlock eFeiBlock2 = entity2; + eFeiBlock2.motionY += 0.5 + 0.6 * worldObj.rand.nextFloat(); + if (entity2.posY < position.y + 3.0) { + final EGravityBlock eFeiBlock3 = entity2; + eFeiBlock3.motionY += 1.5; + } + } + r2 = radius; + if (zDifference < 0.0) { + r2 = -radius; + } + if (zDifference > 4.0) { + final EGravityBlock eFeiBlock4 = entity2; + eFeiBlock4.motionZ += (r2 - zDifference) * -0.02 * worldObj.rand.nextFloat(); + } + final EGravityBlock eFeiBlock5 = entity2; + eFeiBlock5.yawChange += 3.0f * worldObj.rand.nextFloat(); + } + } + worldObj.playSoundEffect(position.x, position.y, position.z, + "icbm.redmatter", 4.0f, 0.8f); + return callCount <= 35; + } + return false; + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + ((EExplosion) explosionSource).entityList.get(0).setDead(); + if (this.canFocusBeam(worldObj, position)) { + for (final Entity entity : ((EExplosion) explosionSource).entityList) { + if (!(entity instanceof ELightBeam)) { + final double xDifference = entity.posX - position.x; + final double zDifference = entity.posZ - position.z; + int m = 1; + if (xDifference < 0.0) { + m = -1; + } + final Entity entity3 = entity; + entity3.motionX += m * 5 * worldObj.rand.nextFloat(); + m = 1; + if (zDifference < 0.0) { + m = -1; + } + final Entity entity4 = entity; + entity4.motionZ += m * 5 * worldObj.rand.nextFloat(); + } + } + ((EExplosion) explosionSource).entityList.clear(); + final List livingEntities = worldObj.getEntitiesWithinAABB( + EntityLivingBase.class, + AxisAlignedBB.getBoundingBox(position.x - this.getRadius(), + position.y - this.getRadius(), + position.z - this.getRadius(), + position.x + this.getRadius(), + position.y + this.getRadius(), + position.z + this.getRadius())); + for (final EntityLivingBase entity2 : livingEntities) { + entity2.addPotionEffect((PotionEffect) new CustomPotionEffect( + PDongShang.INSTANCE.getId(), 1200, 1, null)); + entity2.addPotionEffect( + new PotionEffect(Potion.confusion.id, 200, 2)); + entity2.addPotionEffect( + new PotionEffect(Potion.digSlowdown.id, 2400, 2)); + entity2.addPotionEffect( + new PotionEffect(Potion.moveSlowdown.id, 2400, 4)); + } + ZhaPin.createExplosion(worldObj, position, explosionSource, + ZhaPin.endothermic2.getID()); + } + } + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "?!?", "!@!", "?!?", '@', ZhaPin.attractive.getItemStack(), + '?', Blocks.ice, '!', Blocks.snow }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + public boolean canFocusBeam(final World worldObj, final Vector3 position) { + long worldTime; + for (worldTime = worldObj.getWorldTime(); worldTime > 23999L; worldTime -= 23999L) { + } + return worldTime > 12000L && + worldObj.canBlockSeeTheSky(position.intX(), position.intY() + 1, + position.intZ()); + } + + public int proceduralInterval() { + return 5; + } + + @Override + public float getRadius() { + return 40.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExEndothermic2.java b/src/main/java/icbm/zhapin/zhapin/ex/ExEndothermic2.java new file mode 100644 index 0000000..a8e8abd --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExEndothermic2.java @@ -0,0 +1,149 @@ +package icbm.zhapin.zhapin.ex; + +import cpw.mods.fml.common.FMLLog; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ExEndothermic2 extends ZhaPin { + public ExEndothermic2(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.setFuse(1); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + for (int x = 0; x < this.getRadius(); ++x) { + for (int y = 0; y < this.getRadius(); ++y) { + for (int z = 0; z < this.getRadius(); ++z) { + if (x == 0 || x == this.getRadius() - 1.0f || y == 0 || + y == this.getRadius() - 1.0f || z == 0 || + z == this.getRadius() - 1.0f) { + double xStep = x / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double yStep = y / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double zStep = z / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float power = this.getRadius() * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; power > 0.0f; power -= var18 * 0.75f) { + final Vector3 targetPosition = new Vector3(var15, var16, var17); + final Block block = worldObj.getBlock(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (block != Blocks.air) { + float resistance = 0.0f; + if (block == Blocks.bedrock) { + break; + } + if (block instanceof BlockLiquid) { + resistance = 1.0f; + } else { + resistance = (block.getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + power -= resistance; + } + if (power > 0.0f) { + source.dataList1.add(targetPosition.clone()); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int metadata, + final int callCount) { + try { + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + final int radius = callCount; + for (final Object obj : source.dataList1) { + final Vector3 targetPosition = (Vector3) obj; + final double distance = Vector3.distance(targetPosition, position); + final double distanceFromCenter = position.distanceTo(targetPosition); + if (distanceFromCenter <= radius) { + if (distanceFromCenter < radius - 2) { + continue; + } + final double chance = radius - Math.random() * distanceFromCenter; + if (chance <= distanceFromCenter * 0.55) { + continue; + } + final Block blockID = worldObj.getBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z); + if (blockID == Blocks.fire || blockID == Blocks.lava || + blockID == Blocks.flowing_lava) { + worldObj.setBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, Blocks.snow_layer, 0, 2); + } else { + if (blockID != Blocks.air || + worldObj.getBlock((int) targetPosition.x, + (int) targetPosition.y - 1, + (int) targetPosition.z) == Blocks.ice + || + worldObj.getBlock((int) targetPosition.x, + (int) targetPosition.y - 1, + (int) targetPosition.z) == Blocks.air) { + continue; + } + worldObj.setBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, Blocks.ice, 0, 2); + } + } + } + } + worldObj.playSoundEffect( + position.x + 0.5, position.y + 0.5, position.z + 0.5, + "icbm.redmatter", 6.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 1.0f); + } catch (final Exception e) { + FMLLog.severe("Endothermic Explosives Failure!", new Object[0]); + e.printStackTrace(); + } + return callCount <= this.getRadius(); + } + + @Override + public int proceduralInterval() { + return 3; + } + + @Override + public float getRadius() { + return 40.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExExothermic.java b/src/main/java/icbm/zhapin/zhapin/ex/ExExothermic.java new file mode 100644 index 0000000..81bf56a --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExExothermic.java @@ -0,0 +1,195 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.EGravityBlock; +import icbm.zhapin.ELightBeam; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExExothermic extends ZhaPin { + public ExExothermic(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void onYinZha(final World worldObj, final Vector3 position, + final int fuseTicks) { + super.onYinZha(worldObj, position, fuseTicks); + worldObj.spawnParticle("lava", position.x, position.y + 0.5, position.z, + 0.0, 0.0, 0.0); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + final ELightBeam lightBeam = new ELightBeam(worldObj, position, 400, 0.7f, 0.3f, 0.0f); + worldObj.spawnEntityInWorld((Entity) lightBeam); + ((EExplosion) explosionSource).entityList.add(0, lightBeam); + worldObj.createExplosion((Entity) null, position.x, position.y, position.z, + 4.0f, true); + } + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int callCount) { + List gravityBlocks = new ArrayList<>(); + this.getClass(); + final int radius = 5; + if (!worldObj.isRemote) { + if (this.canFocusBeam(worldObj, position)) { + for (int r = radius, x = -r; x < r; ++x) { + for (int y = -r; y < r; ++y) { + for (int z = -r; z < r; ++z) { + final double dist = MathHelper.sqrt_double((double) (x * x + y * y + z * z)); + if (dist <= r) { + if (dist >= r - 3) { + final Vector3 currentPos = new Vector3( + position.x + x, position.y + y, position.z + z); + final Block block = worldObj.getBlock( + currentPos.intX(), currentPos.intY(), currentPos.intZ()); + if (block != Blocks.air && block != Blocks.bedrock) { + if (block != Blocks.obsidian) { + final int metadata = worldObj.getBlockMetadata( + currentPos.intX(), currentPos.intY(), + currentPos.intZ()); + if (worldObj.rand.nextInt(3) > 0) { + worldObj.setBlock(currentPos.intX(), currentPos.intY(), + currentPos.intZ(), Blocks.air, 0, 2); + currentPos.add(0.5); + final EGravityBlock entity = new EGravityBlock( + worldObj, currentPos, block, metadata); + worldObj.spawnEntityInWorld((Entity) entity); + gravityBlocks.add(entity); + entity.pitchChange = 50.0f * worldObj.rand.nextFloat(); + } + } + } + } + } + } + } + ((EExplosion) explosionSource).entityList.addAll(gravityBlocks); + } + } + gravityBlocks = ((EExplosion) explosionSource).entityList; + for (final Entity unspecifiedEntity : gravityBlocks) { + if (unspecifiedEntity instanceof EGravityBlock) { + final EGravityBlock entity2 = (EGravityBlock) unspecifiedEntity; + final double xDifference = entity2.posX - position.x; + final double zDifference = entity2.posZ - position.z; + int r2 = radius; + if (xDifference < 0.0) { + r2 = -radius; + } + if (xDifference > 4.0) { + final EGravityBlock eFeiBlock = entity2; + eFeiBlock.motionX += (r2 - xDifference) * -0.02 * worldObj.rand.nextFloat(); + } + if (entity2.posY < position.y + 15.0) { + final EGravityBlock eFeiBlock2 = entity2; + eFeiBlock2.motionY += 0.5 + 0.6 * worldObj.rand.nextFloat(); + if (entity2.posY < position.y + 3.0) { + final EGravityBlock eFeiBlock3 = entity2; + eFeiBlock3.motionY += 1.5; + } + } + r2 = radius; + if (zDifference < 0.0) { + r2 = -radius; + } + if (zDifference > 4.0) { + final EGravityBlock eFeiBlock4 = entity2; + eFeiBlock4.motionZ += (r2 - zDifference) * -0.02 * worldObj.rand.nextFloat(); + } + final EGravityBlock eFeiBlock5 = entity2; + eFeiBlock5.yawChange += 3.0f * worldObj.rand.nextFloat(); + } + } + worldObj.playSoundEffect(position.x, position.y, position.z, + "icbm.beamcharging", 4.0f, 0.8f); + return callCount <= 35; + } + return false; + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + ((EExplosion) explosionSource).entityList.get(0).setDead(); + worldObj.playSoundEffect(position.x, position.y, position.z, + "icbm.powerdown", 4.0f, 0.8f); + if (this.canFocusBeam(worldObj, position)) { + for (final Entity entity : ((EExplosion) explosionSource).entityList) { + if (!(entity instanceof ELightBeam)) { + final double xDifference = entity.posX - position.x; + final double zDifference = entity.posZ - position.z; + int m = 1; + if (xDifference < 0.0) { + m = -1; + } + final Entity entity2 = entity; + entity2.motionX += m * 5 * worldObj.rand.nextFloat(); + m = 1; + if (zDifference < 0.0) { + m = -1; + } + final Entity entity3 = entity; + entity3.motionZ += m * 5 * worldObj.rand.nextFloat(); + } + } + ZhaPin.createExplosion(worldObj, position, explosionSource, + ZhaPin.exothermic2.getID()); + } + } + } + + public boolean canFocusBeam(final World worldObj, final Vector3 position) { + long worldTime; + for (worldTime = worldObj.getWorldTime(); worldTime > 23999L; worldTime -= 23999L) { + } + return worldTime < 12000L && + worldObj.canBlockSeeTheSky(position.intX(), position.intY() + 1, + position.intZ()) + && + !worldObj.isRaining(); + } + + public int proceduralInterval() { + return 5; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe(this.getItemStack(), + new Object[] { "!!!", "!@!", "!!!", '@', + Blocks.glass, '!', + ZhaPin.indenciary.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 5.0f; + } + + @Override + public double getEnergy() { + return 1000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExExothermic2.java b/src/main/java/icbm/zhapin/zhapin/ex/ExExothermic2.java new file mode 100644 index 0000000..00662fc --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExExothermic2.java @@ -0,0 +1,188 @@ +package icbm.zhapin.zhapin.ex; + +import cpw.mods.fml.common.FMLLog; +import icbm.core.MainBase; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ExExothermic2 extends ZhaPin { + public boolean createNetherrack; + + public ExExothermic2(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.createNetherrack = true; + this.setFuse(1); + MainBase.CONFIGURATION.load(); + this.createNetherrack = MainBase.CONFIGURATION + .get("general", "Create Netherrack", this.createNetherrack) + .getBoolean(this.createNetherrack); + MainBase.CONFIGURATION.save(); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + for (int x = 0; x < this.getRadius(); ++x) { + for (int y = 0; y < this.getRadius(); ++y) { + for (int z = 0; z < this.getRadius(); ++z) { + if (x == 0 || x == this.getRadius() - 1.0f || y == 0 || + y == this.getRadius() - 1.0f || z == 0 || + z == this.getRadius() - 1.0f) { + double xStep = x / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double yStep = y / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double zStep = z / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float power = this.getRadius() * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; power > 0.0f; power -= var18 * 0.75f) { + final Vector3 targetPosition = new Vector3(var15, var16, var17); + final Block block = worldObj.getBlock(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (block != Blocks.air) { + float resistance = 0.0f; + if (block == Blocks.bedrock) { + break; + } + if (block instanceof BlockLiquid) { + resistance = 1.0f; + } else { + resistance = (block.getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + power -= resistance; + } + if (power > 0.0f) { + source.dataList1.add(targetPosition.clone()); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int metadata, + final int callCount) { + try { + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + final int radius = callCount; + for (final Object obj : source.dataList1) { + final Vector3 targetPosition = (Vector3) obj; + final double distanceFromCenter = position.distanceTo(targetPosition); + if (distanceFromCenter <= radius) { + if (distanceFromCenter < radius - 2) { + continue; + } + final double chance = radius - Math.random() * distanceFromCenter; + if (chance <= distanceFromCenter * 0.55) { + continue; + } + Block blockID = worldObj.getBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z); + if (blockID == Blocks.water || blockID == Blocks.flowing_water || + blockID == Blocks.ice) { + worldObj.setBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, Blocks.air, 0, 2); + } + if ((blockID == Blocks.air || blockID == Blocks.snow_layer) && + worldObj + .getBlock((int) targetPosition.x, (int) targetPosition.y - 1, + (int) targetPosition.z) + .getMaterial() + .isSolid()) { + if (worldObj.rand.nextFloat() > 0.999) { + worldObj.setBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, Blocks.flowing_lava, 0, + 2); + } else { + worldObj.setBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, Blocks.fire, 0, 2); + blockID = worldObj.getBlock((int) targetPosition.x, + (int) targetPosition.y - 1, + (int) targetPosition.z); + if (!this.createNetherrack || + (blockID != Blocks.stone && blockID != Blocks.grass && + blockID != Blocks.dirt) + || + worldObj.rand.nextFloat() <= 0.75) { + continue; + } + worldObj.setBlock( + (int) targetPosition.x, (int) targetPosition.y - 1, + (int) targetPosition.z, Blocks.netherrack, 0, 2); + } + } else { + if (blockID != Blocks.ice) { + continue; + } + worldObj.setBlock((int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, Blocks.air, 0, 2); + } + } + } + } + worldObj.playSoundEffect( + position.x + 0.5, position.y + 0.5, position.z + 0.5, + "icbm.explosionfire", 6.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 1.0f); + } catch (final Exception e) { + FMLLog.severe("Conflagration explosive failed!", new Object[0]); + e.printStackTrace(); + } + return callCount <= this.getRadius(); + } + + public int proceduralInterval() { + return 2; + } + + @Override + public void gengXin(final World worldObj, final Vector3 position, + final int ticksExisted) { + long worldTime; + for (worldTime = worldObj.getWorldTime(); worldTime > 23999L; worldTime -= 23999L) { + } + if (worldTime < 18000L) { + worldObj.setWorldTime(worldObj.getWorldTime() + 150L); + } + } + + @Override + public float getRadius() { + return 50.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExHypersonic.java b/src/main/java/icbm/zhapin/zhapin/ex/ExHypersonic.java new file mode 100644 index 0000000..bb3aab7 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExHypersonic.java @@ -0,0 +1,225 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.EGravityBlock; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.zhapin.BExplosives; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.TExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import mffs.api.IForceFieldBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExHypersonic extends ZhaPin { + public ExHypersonic(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + for (int x = (int) (-this.getRadius() * 2.0f); x < this.getRadius() * 2.0f; ++x) { + for (int y = (int) (-this.getRadius() * 2.0f); y < this.getRadius() * 2.0f; ++y) { + for (int z = (int) (-this.getRadius() * 2.0f); z < this.getRadius() * 2.0f; ++z) { + final Vector3 targetPosition = Vector3.add(position, new Vector3(x, y, z)); + final Block block = worldObj.getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()); + if (block != Blocks.air) { + final Material material = worldObj + .getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()) + .getMaterial(); + if (block != Blocks.bedrock && !(block instanceof BlockLiquid) && + (block.getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) > 70.0f || + material == Material.glass)) { + targetPosition.setBlock(worldObj, Blocks.air); + } + } + } + } + } + for (int x = 0; x < this.getRadius(); ++x) { + for (int y = 0; y < this.getRadius(); ++y) { + for (int z = 0; z < this.getRadius(); ++z) { + if (x == 0 || x == this.getRadius() - 1.0f || y == 0 || + y == this.getRadius() - 1.0f || z == 0 || + z == this.getRadius() - 1.0f) { + double xStep = x / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double yStep = y / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double zStep = z / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float power = 70.0f * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; power > 0.0f; power -= var18 * 0.75f) { + final Vector3 targetPosition2 = new Vector3(var15, var16, var17); + final Block block2 = worldObj.getBlock(targetPosition2.intX(), + targetPosition2.intY(), + targetPosition2.intZ()); + if (block2 != Blocks.air) { + float resistance = 0.0f; + if (block2 == Blocks.bedrock) { + break; + } + if (block2 instanceof BlockLiquid) { + resistance = 2.0f; + } else { + resistance = (block2.getExplosionResistance( + explosionSource, worldObj, targetPosition2.intX(), + targetPosition2.intY(), targetPosition2.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + power -= resistance; + } + if (power > 0.0f) { + source.dataList1.add(targetPosition2.clone()); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.hypersonic", 6.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.1f) * + 0.9f); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + final EExplosion source = (EExplosion) explosionSource; + int r = callCount; + if (!worldObj.isRemote) { + for (final Object obj : source.dataList1) { + final Vector3 targetPosition = (Vector3) obj; + final double distance = Vector3.distance(targetPosition, position); + if (distance <= r) { + if (distance < r - 3) { + continue; + } + final Block block = worldObj.getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()); + if (block == Blocks.air || block == Blocks.bedrock) { + continue; + } + if (block == Blocks.obsidian) { + continue; + } + if (block instanceof IForceFieldBlock) { + continue; + } + final int metadata = worldObj.getBlockMetadata(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (distance >= r - 1 && worldObj.rand.nextInt(3) <= 0) { + continue; + } + if (block == ICBMExplosion.bExplosives) { + BExplosives.yinZha(worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + ((TExplosive) worldObj.getTileEntity( + targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ())).explosiveId, + 1); + } else { + worldObj.setBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ(), Blocks.air, 0, 2); + } + targetPosition.add(0.5); + if (worldObj.rand.nextFloat() >= 0.2 * (this.getRadius() - r)) { + continue; + } + final EGravityBlock entity = new EGravityBlock(worldObj, targetPosition, block, metadata); + worldObj.spawnEntityInWorld((Entity) entity); + entity.yawChange = 50.0f * worldObj.rand.nextFloat(); + entity.pitchChange = 100.0f * worldObj.rand.nextFloat(); + } + } + } + final int radius = 2 * callCount; + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List allEntities = worldObj.getEntitiesWithinAABB(Entity.class, bounds); + synchronized (allEntities) { + for (final Entity entity2 : allEntities) { + if (entity2 instanceof EMissile) { + ((EMissile) entity2).setExplode(); + break; + } + final double xDifference = entity2.posX - position.x; + final double zDifference = entity2.posZ - position.z; + r = (int) this.getRadius(); + if (xDifference < 0.0) { + r = (int) (-this.getRadius()); + } + final Entity entity3 = entity2; + entity3.motionX += (r - xDifference) * 0.02 * worldObj.rand.nextFloat(); + final Entity entity4 = entity2; + entity4.motionY += 4.0f * worldObj.rand.nextFloat(); + r = (int) this.getRadius(); + if (zDifference < 0.0) { + r = (int) (-this.getRadius()); + } + final Entity entity5 = entity2; + entity5.motionZ += (r - zDifference) * 0.02 * worldObj.rand.nextFloat(); + } + } + return callCount <= this.getRadius(); + } + + public int proceduralInterval() { + return 4; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), new Object[] { " S ", "S S", " S ", 'S', + ZhaPin.sonic.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 12.0f; + } + + @Override + public double getEnergy() { + return 500.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExIncendiary.java b/src/main/java/icbm/zhapin/zhapin/ex/ExIncendiary.java new file mode 100644 index 0000000..b248aed --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExIncendiary.java @@ -0,0 +1,127 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExIncendiary extends ZhaPin { + public ExIncendiary(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void onYinZha(final World worldObj, final Vector3 position, + final int fuseTicks) { + super.onYinZha(worldObj, position, fuseTicks); + worldObj.spawnParticle("lava", position.x, position.y + 0.5, position.z, + 0.0, 0.0, 0.0); + } + + @Override + public void doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource) { + int radius = (int) this.getRadius(); + if (explosionSource instanceof EGrenade) { + radius /= 2; + } + for (int x = 0; x < radius; ++x) { + for (int y = 0; y < radius; ++y) { + for (int z = 0; z < radius; ++z) { + if (x == 0 || x == radius - 1 || y == 0 || y == radius - 1 || + z == 0 || z == radius - 1) { + double xStep = x / (radius - 1.0f) * 2.0f - 1.0f; + double yStep = y / (radius - 1.0f) * 2.0f - 1.0f; + double zStep = z / (radius - 1.0f) * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float var14 = radius * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; var14 > 0.0f; var14 -= var18 * 0.75f) { + final Vector3 targetPosition = new Vector3(var15, var16, var17); + final double distanceFromCenter = position.distanceTo(targetPosition); + final Block var19 = worldObj.getBlock(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (var19 != Blocks.air) { + var14 -= (var19.getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + if (var14 > 0.0f) { + final double chance = radius - Math.random() * distanceFromCenter; + if (chance > distanceFromCenter * 0.55) { + final Block block = worldObj.getBlock( + (int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z); + if ((block == Blocks.air || + block == Blocks.snow_layer) && + worldObj + .getBlock((int) targetPosition.x, + (int) targetPosition.y - 1, + (int) targetPosition.z) + .getMaterial() + .isSolid()) { + worldObj.setBlock( + (int) targetPosition.x, (int) targetPosition.y, + (int) targetPosition.z, + Blocks.fire, 0, 2); + } else if (block == Blocks.ice) { + worldObj.setBlock((int) targetPosition.x, + (int) targetPosition.y, + (int) targetPosition.z, Blocks.air, 0, 2); + } + } + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + worldObj.playSoundEffect( + position.x + 0.5, position.y + 0.5, position.z + 0.5, + "icbm.explosionfire", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 1.0f); + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "@@@", "@?@", "@!@", '@', "dustSulfur", '?', + ZhaPin.repulsive.getItemStack(), '!', Items.lava_bucket }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 14.0f; + } + + @Override + public double getEnergy() { + return 1000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExMutateLiving.java b/src/main/java/icbm/zhapin/zhapin/ex/ExMutateLiving.java new file mode 100644 index 0000000..74a7b1d --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExMutateLiving.java @@ -0,0 +1,61 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ExMutateLiving extends ZhaPin { + public ExMutateLiving(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int radius, + final int callCount) { + if (!worldObj.isRemote) { + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List entitiesNearby = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, + bounds); + for (final EntityLivingBase entity : entitiesNearby) { + if (entity instanceof EntityPig) { + final EntityPigZombie newEntity = new EntityPigZombie(worldObj); + ((Entity) newEntity).preventEntitySpawning = true; + newEntity.setPosition(((Entity) entity).posX, ((Entity) entity).posY, + ((Entity) entity).posZ); + entity.setDead(); + } else { + if (!(entity instanceof EntityVillager)) { + continue; + } + final EntityZombie newEntity2 = new EntityZombie(worldObj); + ((Entity) newEntity2).preventEntitySpawning = true; + newEntity2.setPosition(((Entity) entity).posX, ((Entity) entity).posY, + ((Entity) entity).posZ); + entity.setDead(); + } + } + } + return false; + } + + @Override + public float getRadius() { + return 0.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExNuclear.java b/src/main/java/icbm/zhapin/zhapin/ex/ExNuclear.java new file mode 100644 index 0000000..0f49526 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExNuclear.java @@ -0,0 +1,147 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExNuclear extends ExThr { + public static final int BAN_JING = 45; + public static final int NENG_LIANG = 200; + + public ExNuclear(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.setFuse(200); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + final ThrSheXian thread = new ThrSheXian(worldObj, position, 45, 200, explosionSource); + thread.run(); + ((EExplosion) explosionSource).dataList1.add(thread); + } else if (ICBMExplosion.proxy.isGaoQing()) { + for (int y = 0; y < 26; ++y) { + int r = 4; + if (y < 8) { + r = Math.max(Math.min((8 - y) * 2, 10), 4); + } else if (y > 15) { + r = Math.max(Math.min((y - 15) * 2, 15), 5); + } + for (int x = -r; x < r; ++x) { + for (int z = -r; z < r; ++z) { + final double distance = MathHelper.sqrt_double((double) (x * x + z * z)); + if (r > distance && r - 3 < distance) { + final Vector3 spawnPosition = Vector3.add(position, new Vector3(x * 2, (y - 2) * 2, z * 2)); + final float xDiff = (float) (spawnPosition.x - position.x); + final float zDiff = (float) (spawnPosition.z - position.z); + ICBMExplosion.proxy.spawnParticle( + "smoke", worldObj, spawnPosition, + xDiff * 0.3 * worldObj.rand.nextFloat(), + -worldObj.rand.nextFloat(), + zDiff * 0.3 * worldObj.rand.nextFloat(), + (float) (distance / 45.0) * worldObj.rand.nextFloat(), 0.0f, + 0.0f, 8.0f, 1.2000000476837158); + } + } + } + } + } + this.doDamageEntities(worldObj, position, 45.0f, 200000.0f); + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.explosion", 7.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + final EExplosion source = (EExplosion) explosionSource; + try { + if (!worldObj.isRemote && source.dataList1.size() > 0 && + source.dataList1.get(0) instanceof ThrSheXian) { + final ThrSheXian thread = (ThrSheXian) source.dataList1.get(0); + for (final Vector3 targetPosition : thread.destroyed) { + final Block block = worldObj.getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()); + if (block == Blocks.air) { + targetPosition.setBlock(worldObj, Blocks.air); + block.onBlockDestroyedByExplosion( + thread.world, targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ(), (Explosion) null); + } + } + } + } catch (final Exception e) { + MainBase.LOGGER.severe("Detonation Failed!"); + e.printStackTrace(); + } + this.doDamageEntities(worldObj, position, 45.0f, 200000.0f); + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.explosion", 10.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + ZhaPin.createExplosion(worldObj, position, explosionSource, + ZhaPin.decayLand.getID()); + ZhaPin.mutateLiving.doBaoZha(worldObj, position, null, 65, -1); + if (worldObj.rand.nextInt(3) == 0) { + worldObj.getWorldInfo().setRaining(!worldObj.getWorldInfo().isRaining()); + } + } + + @Override + public void onYinZha(final World worldObj, final Vector3 position, + final int fuseTicks) { + super.onYinZha(worldObj, position, fuseTicks); + if (fuseTicks % 25 == 0) { + worldObj.playSoundEffect((double) (int) position.x, (double) (int) position.y, + (double) (int) position.z, "icbm.alarm", 4.0f, + 1.0f); + } + } + + @Override + public void init() { + if (OreDictionary.getOres("ingotUranium").size() > 0) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "UUU", "UEU", "UUU", 'E', + ZhaPin.thermobaric.getItemStack(), 'U', "ingotUranium" }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } else { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), new Object[] { "EEE", "EEE", "EEE", 'E', + ZhaPin.thermobaric.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + } + + @Override + public float getRadius() { + return 45.0f; + } + + @Override + public double getEnergy() { + return 100000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExPushPull.java b/src/main/java/icbm/zhapin/zhapin/ex/ExPushPull.java new file mode 100644 index 0000000..6ca6bf8 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExPushPull.java @@ -0,0 +1,187 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; +import universalelectricity.prefab.vector.Region3; + +public class ExPushPull extends ZhaPin { + public ExPushPull(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.setFuse(120); + } + + @Override + public void doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource) { + final List blownBlocks = new ArrayList<>(); + if (!worldObj.isRemote) { + for (int x = 0; x < 16; ++x) { + for (int y = 0; y < 16; ++y) { + for (int z = 0; z < 16; ++z) { + if (x == 0 || x == 15 || y == 0 || y == 15 || z == 0 || z == 15) { + double xStep = x / 15.0f * 2.0f - 1.0f; + double yStep = y / 15.0f * 2.0f - 1.0f; + double zStep = z / 15.0f * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float var14 = 2.0f * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; var14 > 0.0f; var14 -= var18 * 0.75f) { + final int var19 = MathHelper.floor_double(var15); + final int var20 = MathHelper.floor_double(var16); + final int var21 = MathHelper.floor_double(var17); + final Block var22 = worldObj.getBlock(var19, var20, var21); + if (var22 != Blocks.air) { + var14 -= (var22.getExplosionResistance( + explosionSource, worldObj, var19, var20, var21, + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + if (var14 > 0.0f) { + blownBlocks.add(new ChunkPosition(var19, var20, var21)); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "random.explode", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + this.pushEntities(worldObj, position, 20.0f); + if (!worldObj.isRemote) { + for (int var23 = blownBlocks.size() - 1; var23 >= 0; --var23) { + final ChunkPosition var24 = blownBlocks.get(var23); + final int var25 = var24.chunkPosX; + final int var26 = var24.chunkPosY; + final int var27 = var24.chunkPosY; + final Block block = worldObj.getBlock(var25, var26, var27); + final double var28 = var25 + worldObj.rand.nextFloat(); + final double var29 = var26 + worldObj.rand.nextFloat(); + final double var30 = var27 + worldObj.rand.nextFloat(); + double var31 = var28 - position.y; + double var32 = var29 - position.y; + double var33 = var30 - position.z; + final double var34 = MathHelper.sqrt_double( + var31 * var31 + var32 * var32 + var33 * var33); + var31 /= var34; + var32 /= var34; + var33 /= var34; + double var35 = 0.5 / (var34 / 2.0 + 0.1); + var35 *= worldObj.rand.nextFloat() * worldObj.rand.nextFloat() + 0.3f; + var31 *= var35; + var32 *= var35; + var33 *= var35; + worldObj.spawnParticle("explode", (var28 + position.x * 1.0) / 2.0, + (var29 + position.y * 1.0) / 2.0, + (var30 + position.z * 1.0) / 2.0, var31, var32, + var33); + worldObj.spawnParticle("smoke", var28, var29, var30, var31, var32, + var33); + if (block == Blocks.air) { + block.onBlockDestroyedByExplosion(worldObj, var25, var26, var27, + (Explosion) null); + block.dropBlockAsItemWithChance( + worldObj, var25, var26, var27, + worldObj.getBlockMetadata(var25, var26, var27), 1.0f, 0); + worldObj.setBlock(var25, var26, var27, Blocks.air, 0, 2); + } + } + } + } + + public void pushEntities(final World worldObj, final Vector3 position, + final float radius) { + final Vector3 minCoord = position.clone(); + minCoord.add(-radius - 1.0f); + final Vector3 maxCoord = position.clone(); + maxCoord.add(radius + 1.0f); + final Region3 region = new Region3(minCoord, maxCoord); + final List entities = region.getEntities(worldObj, Entity.class); + for (final Entity entity : entities) { + final double var13 = entity.getDistance(position.x, position.y, position.z) / radius; + if (var13 <= 1.0) { + double xDifference = entity.posX - position.x; + double yDifference = entity.posY - position.y; + double zDifference = entity.posZ - position.z; + final double var14 = MathHelper.sqrt_double(xDifference * xDifference + + yDifference * yDifference + + zDifference * zDifference); + xDifference /= var14; + yDifference /= var14; + zDifference /= var14; + if (this.getID() == ZhaPin.attractive.getID()) { + final double modifier = var13 * 4.0; + final Entity entity2 = entity; + entity2.motionX -= xDifference * modifier; + final Entity entity3 = entity; + entity3.motionY -= yDifference * modifier; + final Entity entity4 = entity; + entity4.motionZ -= zDifference * modifier; + entity.isAirBorne = true; + } else { + final double modifier = (1.0 - var13) * 3.0; + final Entity entity5 = entity; + entity5.motionX += xDifference * modifier; + final Entity entity6 = entity; + entity6.motionY += yDifference * modifier; + final Entity entity7 = entity; + entity7.motionZ += zDifference * modifier; + entity.isAirBorne = true; + } + } + } + } + + @Override + public void init() { + if (this.getID() == ZhaPin.attractive.getID()) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "YY", 'Y', ZhaPin.condensed.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } else { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "Y", "Y", 'Y', ZhaPin.condensed.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + } + + @Override + public float getRadius() { + return 16.0f; + } + + @Override + public double getEnergy() { + return 2000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExRedMatter.java b/src/main/java/icbm/zhapin/zhapin/ex/ExRedMatter.java new file mode 100644 index 0000000..8c2f427 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExRedMatter.java @@ -0,0 +1,224 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.api.explosion.ExplosionEvent; +import icbm.api.explosion.IExplosiveIgnore; +import icbm.core.MainBase; +import icbm.zhapin.EGravityBlock; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.EExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import mffs.api.IForceFieldBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExRedMatter extends ZhaPin { + public ExRedMatter(final String name, final int ID, final int tier) { + super(name, ID, tier); + super.isMobile = true; + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + worldObj.createExplosion(explosionSource, position.x, position.y, + position.z, 5.0f, true); + } + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + Label_0434: { + if (!worldObj.isRemote) { + int takenBlocks = 0; + for (int r = 1; r < this.getRadius(); ++r) { + for (int x = -r; x < r; ++x) { + for (int y = -r; y < r; ++y) { + for (int z = -r; z < r; ++z) { + final double dist = MathHelper.sqrt_double((double) (x * x + y * y + z * z)); + if (dist <= r) { + if (dist >= r - 2) { + final Vector3 currentPos = new Vector3( + position.x + x, position.y + y, position.z + z); + final Block block = worldObj.getBlock( + currentPos.intX(), currentPos.intY(), currentPos.intZ()); + if (block != null) { + if (block instanceof IForceFieldBlock) { + ((IForceFieldBlock) block) + .weakenForceField(worldObj, currentPos.intX(), + currentPos.intY(), + currentPos.intZ(), 50); + } else if (block.getBlockHardness( + worldObj, currentPos.intX(), + currentPos.intY(), + currentPos.intZ()) > -1.0f) { + final int metadata = worldObj.getBlockMetadata( + currentPos.intX(), currentPos.intY(), + currentPos.intZ()); + int notify = 2; + if (block instanceof BlockLiquid) { + notify = 0; + } + worldObj.setBlock(currentPos.intX(), currentPos.intY(), + currentPos.intZ(), Blocks.air, 0, + notify); + if (!(block instanceof BlockLiquid)) { + currentPos.add(0.5); + if (worldObj.rand.nextFloat() > 0.8) { + final EGravityBlock entity = new EGravityBlock( + worldObj, currentPos, block, metadata); + worldObj.spawnEntityInWorld((Entity) entity); + entity.yawChange = 50.0f * worldObj.rand.nextFloat(); + entity.pitchChange = 50.0f * worldObj.rand.nextFloat(); + } + if (++takenBlocks > 5) { + break Label_0434; + } + } + } + } + } + } + } + } + } + } + } + } + final float radius = this.getRadius() + this.getRadius() / 2.0f; + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List allEntities = worldObj.getEntitiesWithinAABB(Entity.class, bounds); + boolean explosionCreated = false; + for (final Entity entity2 : allEntities) { + if (entity2 == explosionSource) { + continue; + } + if (entity2 instanceof IExplosiveIgnore && + ((IExplosiveIgnore) entity2) + .canIgnore(new ExplosionEvent(worldObj, position.x, position.y, + position.z, this))) { + continue; + } + if (entity2 instanceof EntityPlayer && + ((EntityPlayer) entity2).capabilities.isCreativeMode) { + continue; + } + final double xDifference = entity2.posX - position.x; + final double yDifference = entity2.posY - position.y; + final double zDifference = entity2.posZ - position.z; + float r2 = radius; + if (xDifference < 0.0) { + r2 = (float) (int) (-radius); + } + final Entity entity3 = entity2; + entity3.motionX -= (r2 - xDifference) * 0.002; + r2 = radius; + if (yDifference < 0.0) { + r2 = (float) (int) (-radius); + } + final Entity entity4 = entity2; + entity4.motionY -= (r2 - yDifference) * 0.005; + r2 = radius; + if (zDifference < 0.0) { + r2 = -radius; + } + final Entity entity5 = entity2; + entity5.motionZ -= (r2 - zDifference) * 0.002; + if (entity2 instanceof EGravityBlock && worldObj.isRemote && + ICBMExplosion.proxy.getParticleSetting() == 0 && + worldObj.rand.nextInt(5) == 0) { + ICBMExplosion.proxy.spawnParticle( + "digging", worldObj, new Vector3(entity2), -xDifference, + -yDifference + 10.0, -zDifference, + (float) Block.getIdFromBlock(((EGravityBlock) entity2).block), 0.0f, + (float) ((EGravityBlock) entity2).metadata, 2.0f, 1.0); + } + if (Vector3.distance( + new Vector3(entity2.posX, entity2.posY, entity2.posZ), + position) >= 4.0) { + continue; + } + if (!explosionCreated && callCount % 5 == 0) { + worldObj.createExplosion(explosionSource, entity2.posX, entity2.posY, + entity2.posZ, 3.0f, true); + explosionCreated = true; + } + if (entity2 instanceof EntityLiving) { + entity2.fallDistance = 0.0f; + } else if (entity2 instanceof EExplosion) { + if (((EExplosion) entity2).haoMa != ZhaPin.antimatter.getID()) { + continue; + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.explosion", 7.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + if (worldObj.rand.nextFloat() > 0.85 && !worldObj.isRemote) { + entity2.setDead(); + return false; + } + continue; + } else if (entity2 instanceof EExplosive) { + ((EExplosive) entity2).explode(); + } else { + entity2.setDead(); + } + } + if (worldObj.rand.nextInt(10) == 0) { + worldObj.playSoundEffect(position.x + (Math.random() - 0.5) * radius, + position.y + (Math.random() - 0.5) * radius, + position.z + (Math.random() - 0.5) * radius, + "icbm.collapse", + 6.0f - worldObj.rand.nextFloat(), + 1.0f - worldObj.rand.nextFloat() * 0.4f); + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.redmatter", 3.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 1.0f); + return true; + } + + public int proceduralInterval() { + return 1; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), new Object[] { "AAA", "AEA", "AAA", 'E', + ZhaPin.antimatter.getItemStack(), + 'A', "strangeMatter" }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 35.0f; + } + + @Override + public double getEnergy() { + return 4000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExRejuvenation.java b/src/main/java/icbm/zhapin/zhapin/ex/ExRejuvenation.java new file mode 100644 index 0000000..86817e0 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExRejuvenation.java @@ -0,0 +1,91 @@ +package icbm.zhapin.zhapin.ex; + +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import icbm.core.MainBase; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExRejuvenation extends ZhaPin { + public ExRejuvenation(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + if (!worldObj.isRemote) { + try { + final Chunk oldChunk = worldObj.getChunkFromBlockCoords(position.intX(), position.intZ()); + if (worldObj instanceof WorldServer) { + final WorldServer worldServer = (WorldServer) worldObj; + final ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer; + // TODO: WTF!! + final IChunkProvider chunkProviderGenerate = (IChunkProvider) ObfuscationReflectionHelper + .getPrivateValue( + (Class) ChunkProviderServer.class, (Object) chunkProviderServer, + new String[] { "currentChunkProvider", "d", "field_73246_d" }); + final Chunk newChunk = chunkProviderGenerate.provideChunk( + oldChunk.xPosition, oldChunk.zPosition); + for (int x = 0; x < 16; ++x) { + for (int z = 0; z < 16; ++z) { + for (int y = 0; y < worldObj.getHeight(); ++y) { + final Block block = newChunk.getBlock(x, y, z); + final int metadata = newChunk.getBlockMetadata(x, y, z); + worldServer.setBlock(x + oldChunk.xPosition * 16, y, + z + oldChunk.zPosition * 16, block, + metadata, 2); + final TileEntity tileEntity = newChunk.getTileEntityUnsafe(x, y, z); + if (tileEntity != null) { + worldServer.setTileEntity(x + oldChunk.xPosition * 16, y, + z + oldChunk.zPosition * 16, + tileEntity); + } + } + } + } + oldChunk.isTerrainPopulated = false; + chunkProviderGenerate.populate( + chunkProviderGenerate, oldChunk.xPosition, oldChunk.zPosition); + } + } catch (final Exception e) { + System.out.println("ICBM Rejuvenation Failed!"); + e.printStackTrace(); + } + } + return false; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "ICI", "CDC", "ICI", 'D', Blocks.diamond_block, 'C', + Items.clock, 'I', Blocks.iron_block }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 16.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExSMine.java b/src/main/java/icbm/zhapin/zhapin/ex/ExSMine.java new file mode 100644 index 0000000..d8bdf48 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExSMine.java @@ -0,0 +1,119 @@ +package icbm.zhapin.zhapin.ex; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import icbm.core.MainBase; +import icbm.zhapin.ESuiPian; +import icbm.zhapin.muoxing.jiqi.MSMine; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExSMine extends ZhaPin { + public ExSMine(final String name, final int ID, final int tier) { + super(name, ID, tier); + super.isMobile = true; + this.setFuse(40); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + worldObj.createExplosion(explosionSource, position.x, position.y, + position.z, 1.5f, true); + } + explosionSource.motionX = -0.125 + 0.25 * worldObj.rand.nextFloat(); + explosionSource.motionY = 0.6 + 0.3 * worldObj.rand.nextFloat(); + explosionSource.motionZ = -0.125 + 0.25 * worldObj.rand.nextFloat(); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + explosionSource.motionY -= 0.03; + explosionSource.rotationPitch += 1.0f * worldObj.rand.nextFloat(); + if (callCount < 40 && !explosionSource.isCollided) { + return true; + } + if (callCount >= 40 && callCount % 2 == 0 && !worldObj.isRemote) { + final int amount = 5; + final float amountToRotate = (float) (360 / amount); + for (int i = 0; i < amount; ++i) { + final float rotationYaw = 0.0f + amountToRotate * i; + for (int ii = 0; ii < amount; ++ii) { + final ESuiPian arrow = new ESuiPian(worldObj, position.x, position.y, + position.z, true, false); + arrow.arrowCritical = true; + arrow.setFire(60); + final float rotationPitch = 0.0f + amountToRotate * ii; + arrow.setLocationAndAngles(position.x, position.y, position.z, + rotationYaw, rotationPitch); + final ESuiPian eSuiPian = arrow; + eSuiPian.posX -= MathHelper.cos(rotationYaw / 180.0f * 3.1415927f) * 0.16f; + final ESuiPian eSuiPian2 = arrow; + eSuiPian2.posY -= 0.10000000149011612; + final ESuiPian eSuiPian3 = arrow; + eSuiPian3.posZ -= MathHelper.sin(rotationYaw / 180.0f * 3.1415927f) * 0.16f; + arrow.setPosition(arrow.posX, arrow.posY, arrow.posZ); + arrow.yOffset = 0.0f; + arrow.motionX = -MathHelper.sin(rotationYaw / 180.0f * 3.1415927f) * + MathHelper.cos(rotationPitch / 180.0f * 3.1415927f); + arrow.motionZ = MathHelper.cos(rotationYaw / 180.0f * 3.1415927f) * + MathHelper.cos(rotationPitch / 180.0f * 3.1415927f); + arrow.motionY = -MathHelper.sin(rotationPitch / 180.0f * 3.1415927f); + arrow.setThrowableHeading(arrow.motionX * worldObj.rand.nextFloat(), + arrow.motionY * worldObj.rand.nextFloat(), + arrow.motionZ * worldObj.rand.nextFloat(), + 1.5f + 0.7f * worldObj.rand.nextFloat(), 2.0f); + worldObj.spawnEntityInWorld((Entity) arrow); + } + } + } + return callCount < 60; + } + + public int proceduralInterval() { + return 1; + } + + @Override + public void onYinZha(final World worldObj, final Vector3 position, + final int fuseTicks) { + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "S", "L", "R", 'S', ZhaPin.fragmentation.getItemStack(), 'L', + ZhaPin.attractive.getItemStack(), 'R', + ZhaPin.repulsive.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @SideOnly(Side.CLIENT) + @Override + public Object[] getRenderData() { + return new Object[] { MSMine.INSTANCE, + new ResourceLocation("icbm", "textures/models/s-mine.png") }; + } + + @Override + public float getRadius() { + return 20.0f; + } + + @Override + public double getEnergy() { + return 2000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExShrapnel.java b/src/main/java/icbm/zhapin/zhapin/ex/ExShrapnel.java new file mode 100644 index 0000000..6c21483 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExShrapnel.java @@ -0,0 +1,110 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.ESuiPian; +import icbm.zhapin.zhapin.EGrenade; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExShrapnel extends ZhaPin { + public ExShrapnel(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int metadata, + final int callCount) { + if (!worldObj.isRemote) { + int amount = 30; + if (this.getTier() == 2) { + amount = 15; + } else if (this.getID() == ZhaPin.anvil.getID()) { + amount = 25; + } + if (explosionSource instanceof EGrenade) { + amount /= 2; + position.y += 0.5; + } + final float amountToRotate = (float) (360 / amount); + for (int i = 0; i < amount; ++i) { + final float rotationYaw = 0.0f + amountToRotate * i; + for (int ii = 0; ii < amount; ++ii) { + final ESuiPian arrow = new ESuiPian( + worldObj, position.x, position.y, position.z, this.getTier() == 2, + this.getID() == ZhaPin.anvil.getID()); + if (this.getID() != ZhaPin.anvil.getID()) { + arrow.arrowCritical = true; + arrow.setFire(100); + } + final float rotationPitch = 0.0f + amountToRotate * ii; + arrow.setLocationAndAngles(position.x, position.y, position.z, + rotationYaw, rotationPitch); + final ESuiPian eSuiPian = arrow; + eSuiPian.posX -= MathHelper.cos(rotationYaw / 180.0f * 3.1415927f) * 0.16f; + final ESuiPian eSuiPian2 = arrow; + eSuiPian2.posY -= 0.10000000149011612; + final ESuiPian eSuiPian3 = arrow; + eSuiPian3.posZ -= MathHelper.sin(rotationYaw / 180.0f * 3.1415927f) * 0.16f; + arrow.setPosition(arrow.posX, arrow.posY, arrow.posZ); + arrow.yOffset = 0.0f; + arrow.motionX = -MathHelper.sin(rotationYaw / 180.0f * 3.1415927f) * + MathHelper.cos(rotationPitch / 180.0f * 3.1415927f); + arrow.motionZ = MathHelper.cos(rotationYaw / 180.0f * 3.1415927f) * + MathHelper.cos(rotationPitch / 180.0f * 3.1415927f); + arrow.motionY = -MathHelper.sin(rotationPitch / 180.0f * 3.1415927f); + arrow.setThrowableHeading(arrow.motionX * worldObj.rand.nextFloat(), + arrow.motionY * worldObj.rand.nextFloat(), + arrow.motionZ * worldObj.rand.nextFloat(), + 0.5f + 0.7f * worldObj.rand.nextFloat(), 1.0f); + worldObj.spawnEntityInWorld((Entity) arrow); + } + } + } + return false; + } + + @Override + public void init() { + if (this.getID() == ZhaPin.shrapnel.getID()) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe(this.getItemStack(), + new Object[] { "???", "?@?", "???", '@', + ZhaPin.repulsive.getItemStack(), + '?', Items.arrow }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } else if (this.getID() == ZhaPin.anvil.getID()) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(10), + new Object[] { "SSS", "SAS", "SSS", 'A', Blocks.anvil, 'S', + ZhaPin.shrapnel.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } else if (this.getID() == ZhaPin.fragmentation.getID()) { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { " @ ", "@?@", " @ ", '?', ZhaPin.indenciary.getItemStack(), + '@', ZhaPin.shrapnel.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + } + + @Override + public float getRadius() { + return 20.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExSonic.java b/src/main/java/icbm/zhapin/zhapin/ex/ExSonic.java new file mode 100644 index 0000000..7dff618 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExSonic.java @@ -0,0 +1,201 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.EGravityBlock; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.daodan.EMissile; +import icbm.zhapin.zhapin.BExplosives; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.TExplosive; +import icbm.zhapin.zhapin.ZhaPin; +import java.util.List; +import mffs.api.IForceFieldBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExSonic extends ZhaPin { + public ExSonic(final String name, final int ID, final int tier) { + super(name, ID, tier); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + if (!worldObj.isRemote) { + final EExplosion source = (EExplosion) explosionSource; + for (int x = 0; x < this.getRadius(); ++x) { + for (int y = 0; y < this.getRadius(); ++y) { + for (int z = 0; z < this.getRadius(); ++z) { + if (x == 0 || x == this.getRadius() - 1.0f || y == 0 || + y == this.getRadius() - 1.0f || z == 0 || + z == this.getRadius() - 1.0f) { + double xStep = x / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double yStep = y / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + double zStep = z / (this.getRadius() - 1.0f) * 2.0f - 1.0f; + final double diagonalDistance = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep); + xStep /= diagonalDistance; + yStep /= diagonalDistance; + zStep /= diagonalDistance; + float power = 40.0f * (0.7f + worldObj.rand.nextFloat() * 0.6f); + double var15 = position.x; + double var16 = position.y; + double var17 = position.z; + for (float var18 = 0.3f; power > 0.0f; power -= var18 * 0.75f) { + final Vector3 targetPosition = new Vector3(var15, var16, var17); + final Block block = worldObj.getBlock(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (block != Blocks.air) { + float resistance = 0.0f; + if (block == Blocks.bedrock) { + break; + } + if (block instanceof BlockLiquid) { + resistance = 2.0f; + } else { + resistance = (block.getExplosionResistance( + explosionSource, worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) position.intX(), (double) position.intY(), + (double) position.intZ()) + + 0.3f) * + var18; + } + power -= resistance; + } + if (power > 0.0f) { + source.dataList1.add(targetPosition.clone()); + } + var15 += xStep * var18; + var16 += yStep * var18; + var17 += zStep * var18; + } + } + } + } + } + } + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.sonicwave", 4.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, + final int explosionMetadata, final int callCount) { + final EExplosion source = (EExplosion) explosionSource; + int r = callCount; + if (!worldObj.isRemote) { + for (final Object obj : source.dataList1) { + final Vector3 targetPosition = (Vector3) obj; + final double distance = Vector3.distance(targetPosition, position); + if (distance <= r) { + if (distance < r - 3) { + continue; + } + final Block block = worldObj.getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()); + if (block == Blocks.air || block == Blocks.bedrock) { + continue; + } + if (block == Blocks.obsidian) { + continue; + } + if (block instanceof IForceFieldBlock) { + continue; + } + final int metadata = worldObj.getBlockMetadata(targetPosition.intX(), + targetPosition.intY(), + targetPosition.intZ()); + if (distance >= r - 1 && worldObj.rand.nextInt(3) <= 0) { + continue; + } + if (block == ICBMExplosion.bExplosives) { + BExplosives.yinZha(worldObj, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + ((TExplosive) worldObj.getTileEntity( + targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ())).explosiveId, + 1); + } else { + worldObj.setBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ(), Blocks.air, 0, 2); + } + targetPosition.add(0.5); + if (worldObj.rand.nextFloat() >= 0.3 * (this.getRadius() - r)) { + continue; + } + final EGravityBlock entity = new EGravityBlock(worldObj, targetPosition, block, metadata); + worldObj.spawnEntityInWorld((Entity) entity); + entity.yawChange = 50.0f * worldObj.rand.nextFloat(); + entity.pitchChange = 100.0f * worldObj.rand.nextFloat(); + } + } + } + final int radius = 2 * callCount; + final AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox( + position.x - radius, position.y - radius, position.z - radius, + position.x + radius, position.y + radius, position.z + radius); + final List allEntities = worldObj.getEntitiesWithinAABB(Entity.class, bounds); + synchronized (allEntities) { + for (final Entity entity2 : allEntities) { + if (entity2 instanceof EMissile) { + ((EMissile) entity2).setExplode(); + break; + } + final double xDifference = entity2.posX - position.x; + final double zDifference = entity2.posZ - position.z; + r = (int) this.getRadius(); + if (xDifference < 0.0) { + r = (int) (-this.getRadius()); + } + final Entity entity3 = entity2; + entity3.motionX += (r - xDifference) * 0.02 * worldObj.rand.nextFloat(); + final Entity entity4 = entity2; + entity4.motionY += 3.0f * worldObj.rand.nextFloat(); + r = (int) this.getRadius(); + if (zDifference < 0.0) { + r = (int) (-this.getRadius()); + } + final Entity entity5 = entity2; + entity5.motionZ += (r - zDifference) * 0.02 * worldObj.rand.nextFloat(); + } + } + return callCount <= this.getRadius(); + } + + public int proceduralInterval() { + return 4; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "@?@", "?R?", "@?@", 'R', ZhaPin.repulsive.getItemStack(), + '?', Blocks.noteblock, '@', "ingotBronze" }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 8.0f; + } + + @Override + public double getEnergy() { + return 0.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExThermobaric.java b/src/main/java/icbm/zhapin/zhapin/ex/ExThermobaric.java new file mode 100644 index 0000000..5181c2f --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExThermobaric.java @@ -0,0 +1,124 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.core.MainBase; +import icbm.zhapin.ICBMExplosion; +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraftforge.oredict.ShapedOreRecipe; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.RecipeHelper; + +public class ExThermobaric extends ExThr { + public static final int BAN_JING = 20; + public static final int NENG_LIANG = 150; + public static final int CALC_SPEED = 800; + + public ExThermobaric(final String name, final int ID, final int tier) { + super(name, ID, tier); + this.setFuse(120); + } + + @Override + public void baoZhaQian(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaQian(worldObj, position, explosionSource); + if (!worldObj.isRemote) { + final ThrSheXian thread = new ThrSheXian(worldObj, position, 20, 150, explosionSource); + thread.run(); + ((EExplosion) explosionSource).dataList1.add(thread); + } + this.doDamageEntities(worldObj, position, 20.0f, 150000.0f); + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.explosion", 7.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int callCount) { + final int r = callCount; + if (worldObj.isRemote && ICBMExplosion.proxy.isGaoQing()) { + for (int x = -r; x < r; ++x) { + for (int z = -r; z < r; ++z) { + final double distance = MathHelper.sqrt_double((double) (x * x + z * z)); + if (distance < r && distance > r - 1) { + final Vector3 targetPosition = Vector3.add(position, new Vector3(x, 0.0, z)); + if (worldObj.rand.nextFloat() < Math.max(0.001 * r, 0.05)) { + ICBMExplosion.proxy.spawnParticle("smoke", worldObj, + targetPosition, 5.0f, 1.0); + } + } + } + } + } + return super.doBaoZha(worldObj, position, explosionSource, callCount); + } + + @Override + public void baoZhaHou(final World worldObj, final Vector3 position, + final Entity explosionSource) { + super.baoZhaHou(worldObj, position, explosionSource); + final EExplosion source = (EExplosion) explosionSource; + if (!worldObj.isRemote && source.dataList1.size() > 0 && + source.dataList1.get(0) instanceof ThrSheXian) { + final ThrSheXian thread = (ThrSheXian) source.dataList1.get(0); + for (final Object obj : thread.destroyed) { + final Vector3 targetPosition = (Vector3) obj; + final Block block = worldObj.getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()); + if (block == Blocks.air) { + try { + worldObj.setBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ(), Blocks.air, 0, 3); + block.onBlockDestroyedByExplosion( + worldObj, targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ(), (Explosion) null); + } catch (final Exception e) { + MainBase.LOGGER.severe("Detonation Failed!"); + e.printStackTrace(); + } + } + } + } + this.doDamageEntities(worldObj, position, 20.0f, 150000.0f); + worldObj.playSoundEffect( + position.x, position.y, position.z, "icbm.explosion", 10.0f, + (1.0f + + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2f) * + 0.7f); + } + + public int proceduralInterval() { + return 1; + } + + @Override + public void init() { + RecipeHelper.addRecipe( + (IRecipe) new ShapedOreRecipe( + this.getItemStack(), + new Object[] { "CIC", "IRI", "CIC", 'R', ZhaPin.repulsive.getItemStack(), + 'C', ZhaPin.chemical.getItemStack(), 'I', + ZhaPin.indenciary.getItemStack() }), + this.getUnlocalizedName(), MainBase.CONFIGURATION, true); + } + + @Override + public float getRadius() { + return 20.0f; + } + + @Override + public double getEnergy() { + return 80000.0; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ExThr.java b/src/main/java/icbm/zhapin/zhapin/ex/ExThr.java new file mode 100644 index 0000000..a46bd6e --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ExThr.java @@ -0,0 +1,32 @@ +package icbm.zhapin.zhapin.ex; + +import icbm.zhapin.zhapin.EExplosion; +import icbm.zhapin.zhapin.ZhaPin; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public abstract class ExThr extends ZhaPin { + protected ExThr(final String mingZi, final int ID, final int tier) { + super(mingZi, ID, tier); + } + + @Override + public boolean doBaoZha(final World worldObj, final Vector3 position, + final Entity explosionSource, final int callCount) { + final EExplosion source = (EExplosion) explosionSource; + if (!worldObj.isRemote && source.dataList1.size() > 0 && + source.dataList1.get(0) instanceof ThrSheXian) { + final ThrSheXian thread = (ThrSheXian) source.dataList1.get(0); + if (thread.isComplete) { + return false; + } + } + return true; + } + + @Override + protected int proceduralInterval() { + return 1; + } +} diff --git a/src/main/java/icbm/zhapin/zhapin/ex/ThrSheXian.java b/src/main/java/icbm/zhapin/zhapin/ex/ThrSheXian.java new file mode 100644 index 0000000..c938477 --- /dev/null +++ b/src/main/java/icbm/zhapin/zhapin/ex/ThrSheXian.java @@ -0,0 +1,84 @@ +package icbm.zhapin.zhapin.ex; + +import java.util.HashSet; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; + +public class ThrSheXian extends Thread { + public World world; + public Vector3 position; + public int radius; + public int energyStored; + public Entity source; + public boolean isComplete; + public final HashSet destroyed; + + public ThrSheXian(final World world, final Vector3 position, + final int banJing, final int nengLiang, + final Entity source) { + this.isComplete = false; + this.destroyed = new HashSet<>(); + this.world = world; + this.position = position; + this.radius = banJing; + this.energyStored = nengLiang; + this.source = source; + this.setPriority(4); + } + + @Override + public void run() { + for (int steps = (int) Math.ceil(3.141592653589793 / + Math.atan(1.0 / this.radius)), + phi_n = 0; phi_n < 2 * steps; ++phi_n) { + for (int theta_n = 0; theta_n < steps; ++theta_n) { + final double phi = 6.283185307179586 / steps * phi_n; + final double theta = 3.141592653589793 / steps * theta_n; + final Vector3 delta = new Vector3(Math.sin(theta) * Math.cos(phi), Math.cos(theta), + Math.sin(theta) * Math.sin(phi)); + float power = this.energyStored - + this.energyStored * this.world.rand.nextFloat() / 2.0f; + final Vector3 targetPosition = this.position.clone(); + for (float var21 = 0.3f; power > 0.0f; power -= var21 * 0.75f * 10.0f) { + if (targetPosition.distanceTo(this.position) > this.radius) { + break; + } + final Block block = this.world.getBlock(targetPosition.intX(), targetPosition.intY(), + targetPosition.intZ()); + if (block == Blocks.air) { + float resistance = 0.0f; + if (block == Blocks.bedrock) { + break; + } + if (block instanceof BlockLiquid) { + resistance = 1.0f; + } else { + resistance = block.getExplosionResistance( + this.source, this.world, targetPosition.intX(), + targetPosition.intY(), targetPosition.intZ(), + (double) this.position.intX(), + (double) this.position.intY(), + (double) this.position.intZ()) * + 4.0f; + } + power -= resistance; + if (power > 0.0f && !this.destroyed.contains(targetPosition)) { + this.destroyed.add(targetPosition.clone()); + } + } + final Vector3 vector3 = targetPosition; + vector3.x += delta.x; + final Vector3 vector4 = targetPosition; + vector4.y += delta.y; + final Vector3 vector5 = targetPosition; + vector5.z += delta.z; + } + } + } + this.isComplete = true; + } +} diff --git a/src/main/java/mffs/api/Blacklist.java b/src/main/java/mffs/api/Blacklist.java new file mode 100644 index 0000000..01e2033 --- /dev/null +++ b/src/main/java/mffs/api/Blacklist.java @@ -0,0 +1,19 @@ +package mffs.api; + +import java.util.HashSet; +import java.util.Set; + +import net.minecraft.block.Block; + +public class Blacklist +{ + public static final Set stabilizationBlacklist; + public static final Set disintegrationBlacklist; + public static final Set forceManipulationBlacklist; + + static { + stabilizationBlacklist = new HashSet<>(); + disintegrationBlacklist = new HashSet<>(); + forceManipulationBlacklist = new HashSet<>(); + } +} diff --git a/src/main/java/mffs/api/IActivatable.java b/src/main/java/mffs/api/IActivatable.java new file mode 100644 index 0000000..c5e4068 --- /dev/null +++ b/src/main/java/mffs/api/IActivatable.java @@ -0,0 +1,8 @@ +package mffs.api; + +public interface IActivatable +{ + boolean isActive(); + + void setActive(final boolean p0); +} diff --git a/src/main/java/mffs/api/IBiometricIdentifierLink.java b/src/main/java/mffs/api/IBiometricIdentifierLink.java new file mode 100644 index 0000000..884e934 --- /dev/null +++ b/src/main/java/mffs/api/IBiometricIdentifierLink.java @@ -0,0 +1,11 @@ +package mffs.api; + +import java.util.Set; +import mffs.api.security.IBiometricIdentifier; + +public interface IBiometricIdentifierLink +{ + IBiometricIdentifier getBiometricIdentifier(); + + Set getBiometricIdentifiers(); +} diff --git a/src/main/java/mffs/api/ICache.java b/src/main/java/mffs/api/ICache.java new file mode 100644 index 0000000..06a06d5 --- /dev/null +++ b/src/main/java/mffs/api/ICache.java @@ -0,0 +1,10 @@ +package mffs.api; + +public interface ICache +{ + Object getCache(final String p0); + + void clearCache(final String p0); + + void clearCache(); +} diff --git a/src/main/java/mffs/api/IFieldInteraction.java b/src/main/java/mffs/api/IFieldInteraction.java new file mode 100644 index 0000000..e6c92a4 --- /dev/null +++ b/src/main/java/mffs/api/IFieldInteraction.java @@ -0,0 +1,41 @@ +package mffs.api; + +import java.util.Set; +import universalelectricity.core.vector.Vector3; +import mffs.api.modules.IModule; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import mffs.api.modules.IProjectorMode; +import universalelectricity.prefab.implement.IRotatable; +import mffs.api.modules.IModuleAcceptor; + +public interface IFieldInteraction extends IModuleAcceptor, IRotatable, IActivatable +{ + IProjectorMode getMode(); + + ItemStack getModeStack(); + + int[] getSlotsBasedOnDirection(final ForgeDirection p0); + + int[] getModuleSlots(); + + int getSidedModuleCount(final IModule p0, final ForgeDirection... p1); + + Vector3 getTranslation(); + + Vector3 getPositiveScale(); + + Vector3 getNegativeScale(); + + int getRotationYaw(); + + int getRotationPitch(); + + Set getCalculatedField(); + + Set getInteriorPoints(); + + void setCalculating(final boolean p0); + + void setCalculated(final boolean p0); +} diff --git a/src/main/java/mffs/api/IForceFieldBlock.java b/src/main/java/mffs/api/IForceFieldBlock.java new file mode 100644 index 0000000..d6965fa --- /dev/null +++ b/src/main/java/mffs/api/IForceFieldBlock.java @@ -0,0 +1,11 @@ +package mffs.api; + +import net.minecraft.world.World; +import net.minecraft.world.IBlockAccess; + +public interface IForceFieldBlock +{ + IProjector getProjector(final IBlockAccess p0, final int p1, final int p2, final int p3); + + void weakenForceField(final World p0, final int p1, final int p2, final int p3, final int p4); +} diff --git a/src/main/java/mffs/api/IProjector.java b/src/main/java/mffs/api/IProjector.java new file mode 100644 index 0000000..0199e80 --- /dev/null +++ b/src/main/java/mffs/api/IProjector.java @@ -0,0 +1,14 @@ +package mffs.api; + +import net.minecraft.inventory.IInventory; + +public interface IProjector extends IInventory, IBiometricIdentifierLink, IFieldInteraction +{ + void projectField(); + + void destroyField(); + + int getProjectionSpeed(); + + long getTicks(); +} diff --git a/src/main/java/mffs/api/ISpecialForceManipulation.java b/src/main/java/mffs/api/ISpecialForceManipulation.java new file mode 100644 index 0000000..3210b48 --- /dev/null +++ b/src/main/java/mffs/api/ISpecialForceManipulation.java @@ -0,0 +1,10 @@ +package mffs.api; + +public interface ISpecialForceManipulation +{ + boolean preMove(final int p0, final int p1, final int p2); + + void move(final int p0, final int p1, final int p2); + + void postMove(); +} diff --git a/src/main/java/mffs/api/card/ICard.java b/src/main/java/mffs/api/card/ICard.java new file mode 100644 index 0000000..4c47839 --- /dev/null +++ b/src/main/java/mffs/api/card/ICard.java @@ -0,0 +1,5 @@ +package mffs.api.card; + +public interface ICard +{ +} diff --git a/src/main/java/mffs/api/card/ICardIdentification.java b/src/main/java/mffs/api/card/ICardIdentification.java new file mode 100644 index 0000000..06c8d87 --- /dev/null +++ b/src/main/java/mffs/api/card/ICardIdentification.java @@ -0,0 +1,17 @@ +package mffs.api.card; + +import mffs.api.security.Permission; +import net.minecraft.item.ItemStack; + +public interface ICardIdentification extends ICard +{ + boolean hasPermission(final ItemStack p0, final Permission p1); + + boolean addPermission(final ItemStack p0, final Permission p1); + + boolean removePermission(final ItemStack p0, final Permission p1); + + String getUsername(final ItemStack p0); + + void setUsername(final ItemStack p0, final String p1); +} diff --git a/src/main/java/mffs/api/card/ICardInfinite.java b/src/main/java/mffs/api/card/ICardInfinite.java new file mode 100644 index 0000000..4f35a5a --- /dev/null +++ b/src/main/java/mffs/api/card/ICardInfinite.java @@ -0,0 +1,5 @@ +package mffs.api.card; + +public interface ICardInfinite +{ +} diff --git a/src/main/java/mffs/api/card/ICardLink.java b/src/main/java/mffs/api/card/ICardLink.java new file mode 100644 index 0000000..460c031 --- /dev/null +++ b/src/main/java/mffs/api/card/ICardLink.java @@ -0,0 +1,11 @@ +package mffs.api.card; + +import universalelectricity.core.vector.Vector3; +import net.minecraft.item.ItemStack; + +public interface ICardLink +{ + void setLink(final ItemStack p0, final Vector3 p1); + + Vector3 getLink(final ItemStack p0); +} diff --git a/src/main/java/mffs/api/fortron/IFortronCapacitor.java b/src/main/java/mffs/api/fortron/IFortronCapacitor.java new file mode 100644 index 0000000..65d7874 --- /dev/null +++ b/src/main/java/mffs/api/fortron/IFortronCapacitor.java @@ -0,0 +1,12 @@ +package mffs.api.fortron; + +import java.util.Set; + +public interface IFortronCapacitor +{ + Set getLinkedDevices(); + + int getTransmissionRange(); + + int getTransmissionRate(); +} diff --git a/src/main/java/mffs/api/fortron/IFortronFrequency.java b/src/main/java/mffs/api/fortron/IFortronFrequency.java new file mode 100644 index 0000000..1e4f9b4 --- /dev/null +++ b/src/main/java/mffs/api/fortron/IFortronFrequency.java @@ -0,0 +1,7 @@ +package mffs.api.fortron; + +import icbm.api.IBlockFrequency; + +public interface IFortronFrequency extends IFortronStorage, IBlockFrequency +{ +} diff --git a/src/main/java/mffs/api/fortron/IFortronStorage.java b/src/main/java/mffs/api/fortron/IFortronStorage.java new file mode 100644 index 0000000..fd7424f --- /dev/null +++ b/src/main/java/mffs/api/fortron/IFortronStorage.java @@ -0,0 +1,14 @@ +package mffs.api.fortron; + +public interface IFortronStorage +{ + void setFortronEnergy(final int p0); + + int getFortronEnergy(); + + int getFortronCapacity(); + + int requestFortron(final int p0, final boolean p1); + + int provideFortron(final int p0, final boolean p1); +} diff --git a/src/main/java/mffs/api/modules/IInterdictionMatrixModule.java b/src/main/java/mffs/api/modules/IInterdictionMatrixModule.java new file mode 100644 index 0000000..9916f8c --- /dev/null +++ b/src/main/java/mffs/api/modules/IInterdictionMatrixModule.java @@ -0,0 +1,9 @@ +package mffs.api.modules; + +import mffs.api.security.IInterdictionMatrix; +import net.minecraft.entity.EntityLivingBase; + +public interface IInterdictionMatrixModule extends IModule +{ + boolean onDefend(final IInterdictionMatrix p0, final EntityLivingBase p1); +} diff --git a/src/main/java/mffs/api/modules/IModule.java b/src/main/java/mffs/api/modules/IModule.java new file mode 100644 index 0000000..f01ab79 --- /dev/null +++ b/src/main/java/mffs/api/modules/IModule.java @@ -0,0 +1,22 @@ +package mffs.api.modules; + +import mffs.api.IFieldInteraction; +import net.minecraft.item.ItemStack; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import universalelectricity.core.vector.Vector3; +import java.util.Set; +import mffs.api.IProjector; + +public interface IModule +{ + float getFortronCost(final float p0); + + boolean onProject(final IProjector p0, final Set fieldBlocks); + + int onProject(final IProjector p0, final Vector3 p1); + + boolean onCollideWithForceField(final World p0, final int p1, final int p2, final int p3, final Entity p4, final ItemStack p5); + + void onCalculate(final IFieldInteraction p0, final Set fieldBlocks); +} diff --git a/src/main/java/mffs/api/modules/IModuleAcceptor.java b/src/main/java/mffs/api/modules/IModuleAcceptor.java new file mode 100644 index 0000000..352b8e3 --- /dev/null +++ b/src/main/java/mffs/api/modules/IModuleAcceptor.java @@ -0,0 +1,17 @@ +package mffs.api.modules; + +import java.util.Set; +import net.minecraft.item.ItemStack; + +public interface IModuleAcceptor +{ + ItemStack getModule(final IModule p0); + + int getModuleCount(final IModule p0, final int... p1); + + Set getModuleStacks(final int... p0); + + Set getModules(final int... p0); + + int getFortronCost(); +} diff --git a/src/main/java/mffs/api/modules/IProjectorMode.java b/src/main/java/mffs/api/modules/IProjectorMode.java new file mode 100644 index 0000000..3ed4ec1 --- /dev/null +++ b/src/main/java/mffs/api/modules/IProjectorMode.java @@ -0,0 +1,17 @@ +package mffs.api.modules; + +import java.util.Set; +import mffs.api.IFieldInteraction; +import mffs.api.IProjector; +import universalelectricity.core.vector.Vector3; + +public interface IProjectorMode { + Set getExteriorPoints(final IFieldInteraction p0); + + Set getInteriorPoints(final IFieldInteraction p0); + + boolean isInField(final IFieldInteraction p0, final Vector3 p1); + + void render(final IProjector p0, final double p1, final double p2, + final double p3, final float p4, final long p5); +} diff --git a/src/main/java/mffs/api/security/IBiometricIdentifier.java b/src/main/java/mffs/api/security/IBiometricIdentifier.java new file mode 100644 index 0000000..eaa760b --- /dev/null +++ b/src/main/java/mffs/api/security/IBiometricIdentifier.java @@ -0,0 +1,12 @@ +package mffs.api.security; + +import net.minecraft.item.ItemStack; + +public interface IBiometricIdentifier +{ + boolean isAccessGranted(final String p0, final Permission p1); + + String getOwner(); + + ItemStack getManipulatingCard(); +} diff --git a/src/main/java/mffs/api/security/IInterdictionMatrix.java b/src/main/java/mffs/api/security/IInterdictionMatrix.java new file mode 100644 index 0000000..4c1aebb --- /dev/null +++ b/src/main/java/mffs/api/security/IInterdictionMatrix.java @@ -0,0 +1,24 @@ +package mffs.api.security; + +import java.util.Set; +import net.minecraft.item.ItemStack; +import mffs.api.IActivatable; +import mffs.api.IBiometricIdentifierLink; +import mffs.api.modules.IModuleAcceptor; +import mffs.api.fortron.IFortronFrequency; +import net.minecraft.inventory.IInventory; + +public interface IInterdictionMatrix extends IInventory, IFortronFrequency, IModuleAcceptor, IBiometricIdentifierLink, IActivatable +{ + int getWarningRange(); + + int getActionRange(); + + boolean mergeIntoInventory(final ItemStack p0); + + Set getFilteredItems(); + + boolean getFilterMode(); + + int getFortronCost(); +} diff --git a/src/main/java/mffs/api/security/Permission.java b/src/main/java/mffs/api/security/Permission.java new file mode 100644 index 0000000..03ea1f1 --- /dev/null +++ b/src/main/java/mffs/api/security/Permission.java @@ -0,0 +1,45 @@ +package mffs.api.security; + +public class Permission +{ + public static final Permission FORCE_FIELD_WARP; + public static final Permission BLOCK_ALTER; + public static final Permission BLOCK_ACCESS; + public static final Permission SECURITY_CENTER_CONFIGURE; + public static final Permission BYPASS_INTERDICTION_MATRIX; + public static final Permission DEFENSE_STATION_CONFISCATION; + public static final Permission REMOTE_CONTROL; + private static Permission[] LIST; + public final int id; + public final String name; + + public Permission(final int id, final String name) { + this.id = id; + this.name = name; + if (Permission.LIST == null) { + Permission.LIST = new Permission[7]; + } + Permission.LIST[this.id] = this; + } + + public static Permission getPermission(final int id) { + if (id < Permission.LIST.length && id >= 0) { + return Permission.LIST[id]; + } + return null; + } + + public static Permission[] getPermissions() { + return Permission.LIST; + } + + static { + FORCE_FIELD_WARP = new Permission(0, "warp"); + BLOCK_ALTER = new Permission(1, "blockPlaceAccess"); + BLOCK_ACCESS = new Permission(2, "blockAccess"); + SECURITY_CENTER_CONFIGURE = new Permission(3, "configure"); + BYPASS_INTERDICTION_MATRIX = new Permission(4, "bypassDefense"); + DEFENSE_STATION_CONFISCATION = new Permission(5, "bypassConfiscation"); + REMOTE_CONTROL = new Permission(6, "remoteControl"); + } +} diff --git a/src/main/resources/assets/icbm/lang/de_DE.lang b/src/main/resources/assets/icbm/lang/de_DE.lang new file mode 100644 index 0000000..9baee37 --- /dev/null +++ b/src/main/resources/assets/icbm/lang/de_DE.lang @@ -0,0 +1,132 @@ + +itemGroup.ICBM=ICBM + +## Items +item.sulfur.name=Schwefel +item.poisonPowder.name=Gift Pulver +item.antidote.name=Gegengift +item.radarGun.name=Radar Pistole +item.remoteDetonator.name=Fernzünder +item.defuser.name=Entschärfer +item.laserDesignator.name=Laser Ziel Erfasser +item.tracker.name=Verfolger +item.signalDisrupter.name=Signal Störer + +item.bullet.0.name=Stanard Geschoss +item.bullet.1.name=Antimatierie Geschoss +item.launcher.name=Raketen Werfer + +## ICBM Machines +icbm.machine.0.name=Startplatform T1 +icbm.machine.1.name=Startplatform T2 +icbm.machine.2.name=Startplatform T3 +icbm.machine.3.name=Start Kontroll Tafel T1 +icbm.machine.4.name=Start Kontroll Tafel T2 +icbm.machine.5.name=Start Konttoll Tafel T3 +icbm.machine.6.name=Startplatform Verstärker T1 +icbm.machine.7.name=Startplatform Verstärker T2 +icbm.machine.8.name=Startplatform Verstärker T3 +icbm.machine.9.name=Radar Station +icbm.machine.10.name=EMP Turm +icbm.machine.11.name=Langstrecken Starter +icbm.machine.12.name=Raketen Koordinator + +## ICBM Explosives + +## Block Form +icbm.explosive.condensed.name=Gepresster Sprengstoff +icbm.explosive.shrapnel.name=Schrapnell Sprengstoff +icbm.explosive.incendiary.name=Entflammbarer Sprengstoff +icbm.explosive.chemical.name=Chemischer Sprengstoff +icbm.explosive.anvil.name=Amboss Sprengstoff +icbm.explosive.repulsive.name=Abstoßender Sprengstoff +icbm.explosive.attractive.name=Anziehener Sprengstoff + +icbm.explosive.fragmentation.name=Splitter Sprengstoff +icbm.explosive.contagious.name=Ansteckender Sprengstoff +icbm.explosive.sonic.name=Schall Sprengstoff +icbm.explosive.breaching.name=Durchschlags Sprengstoff +icbm.explosive.rejuvenation.name=Verjüngungs Sprengstoff +icbm.explosive.thermobaric.name=Thermobarischer Sprengstoff + +icbm.explosive.nuclear.name=Atomarer Sprengstoff +icbm.explosive.emp.name=EMP Sprengstoff +icbm.explosive.exothermic.name=Exothermischer Sprengstoff +icbm.explosive.endothermic.name=Endothermischer Sprengstoff +icbm.explosive.antiGravitational.name=Anti-Schwerkraft Sprengstoff +icbm.explosive.ender.name=Ender Sprengstoff +icbm.explosive.hypersonic.name=Überschall Sprengstoff + +icbm.explosive.antimatter.name=Antimaterie Sprengstoff +icbm.explosive.redMatter.name=Rotematerie Sprengstoff + +icbm.explosive.sMine.name=S-Mine + +## Missile Form +icbm.missile.condensed.name=Standard Rakete +icbm.missile.shrapnel.name=Schrapnell Rakete +icbm.missile.incendiary.name=Entflammbare Rakete +icbm.missile.chemical.name=Chemische Rakete +icbm.missile.anvil.name=Amboss Rakete +icbm.missile.repulsive.name=Abstoßende Rakete +icbm.missile.attractive.name=Anziehende Rakete + +icbm.missile.fragmentation.name=Splitter Rakete +icbm.missile.contagious.name=Ansteckende Rakete +icbm.missile.sonic.name=Schall Rakete +icbm.missile.breaching.name=Durchschlags Rakete +icbm.missile.rejuvenation.name=Verjüngungs Rakete +icbm.missile.thermobaric.name=Thermobarische Rakete + +icbm.missile.nuclear.name=Atom Rakete +icbm.missile.emp.name=EMP Rakete +icbm.missile.exothermic.name=Exothermische Rakete +icbm.missile.endothermic.name=Endothermische Rakete +icbm.missile.antiGravitational.name=Anti-Schwerkraft Rakete +icbm.missile.ender.name=Ender Rakete +icbm.missile.hypersonic.name=Überschall Rakete + +icbm.missile.antimatter.name=Antimaterie Rakete +icbm.missile.redMatter.name=Rotematerie Rakete + +## Special Missiles +icbm.missile.missileModule.name=Raketen Modul +icbm.missile.antiBallistic.name=Anti-Balistische Rakete +icbm.missile.cluster.name=Cluster Rakete +icbm.missile.nuclearCluster.name=Atom Cluster Rakete +icbm.missile.homing.name=Verfolgungs Rakete + +## Grenades +icbm.grenade.condensed.name=Standard Granate +icbm.grenade.shrapnel.name=Schrapnell Granate +icbm.grenade.incendiary.name=Entzündliche Granate +icbm.grenade.chemical.name=Chemische Granate +icbm.grenade.anvil.name=Amboss Granate +icbm.grenade.repulsive.name=Abstoss Granate +icbm.grenade.attractive.name=Anziehungs Granate + +## Explosive Minecarts +icbm.minecart.condensed.name=Explosive Lore +icbm.minecart.shrapnel.name=Schrapnell Lore +icbm.minecart.incendiary.name=Entzündliche Lore +icbm.minecart.chemical.name=Chemische Lore +icbm.minecart.anvil.name=Amboss Lore +icbm.minecart.repulsive.name=Abstoss Lore +icbm.minecart.attractive.name=Anziehende Lore + +icbm.minecart.fragmentation.name=Splitter Lore +icbm.minecart.contagious.name=Ansteckede Lore +icbm.minecart.sonic.name=Schall Lore +icbm.minecart.breaching.name=Durchbrechende Lore +icbm.minecart.rejuvenation.name=Verjüngungs Lore +icbm.minecart.thermobaric.name=Thermobarische Lore + +## ICBM Misc Blocks +tile.sulfurOre.name=Schwefel Erz +tile.glassPressurePlate.name=Glass Druckplatte +tile.glassButton.name=Glass Knopf +tile.camouflage.name=Camouflage +tile.proximityDetector.name=Umgebungs Scanner +tile.spike.0.name=Stacheln +tile.spike.1.name=Gift Stacheln +tile.spike.2.name=Entzündliche Stacheln \ No newline at end of file diff --git a/src/main/resources/assets/icbm/lang/en_US.lang b/src/main/resources/assets/icbm/lang/en_US.lang new file mode 100644 index 0000000..bcfc049 --- /dev/null +++ b/src/main/resources/assets/icbm/lang/en_US.lang @@ -0,0 +1,166 @@ + +itemGroup.ICBM=ICBM + +potion.toxin=Toxin +potion.virus=Virus +potion.frostBite=Frost Bite +potion.radiation=Radiation + +## Items +item.icbm:sulfur.name=Sulfur +item.icbm:poisonPowder.name=Poison Powder +item.icbm:antidote.name=Antidote +item.icbm:radarGun.name=Radar Gun +item.icbm:remoteDetonator.name=Remote Detonator +item.icbm:defuser.name=Defuser +item.icbm:laserDesignator.name=Laser Designator +item.icbm:tracker.name=Tracker +item.icbm:signalDisrupter.name=Signal Disrupter + +item.icbm:bullet.0.name=Conventional Bullet +item.icbm:bullet.1.name=Antimatter Bullet +item.icbm:rocketLauncher.name=Rocket Launcher + +## ICBM Machines +icbm.machine.0.name=Launcher Platform T1 +icbm.machine.1.name=Launcher Platform T2 +icbm.machine.2.name=Launcher Platform T3 +icbm.machine.3.name=Launcher Control Panel T1 +icbm.machine.4.name=Launcher Control Panel T2 +icbm.machine.5.name=Launcher Control Panel T3 +icbm.machine.6.name=Launcher Support Frame T1 +icbm.machine.7.name=Launcher Support Frame T2 +icbm.machine.8.name=Launcher Support Frame T3 +icbm.machine.9.name=Radar Station +icbm.machine.10.name=EMP Tower +icbm.machine.11.name=Cruise Launcher +icbm.machine.12.name=Missile Coordinator + +## ICBM Explosives + +## Block Form +icbm.explosive.condensed.name=Condensed Explosives +icbm.explosive.shrapnel.name=Shrapnel Explosives +icbm.explosive.incendiary.name=Incendiary Explosives +icbm.explosive.debilitation.name=Debilitation Explosives +icbm.explosive.chemical.name=Chemical Explosives +icbm.explosive.anvil.name=Anvil Explosives +icbm.explosive.repulsive.name=Repulsive Explosives +icbm.explosive.attractive.name=Attractive Explosives + +icbm.explosive.fragmentation.name=Fragmentation Explosives +icbm.explosive.contagious.name=Contagious Explosives +icbm.explosive.sonic.name=Sonic Explosives +icbm.explosive.breaching.name=Breaching Explosives +icbm.explosive.rejuvenation.name=Rejuvenation Explosives +icbm.explosive.thermobaric.name=Thermobaric Explosives + +icbm.explosive.nuclear.name=Nuclear Explosives +icbm.explosive.emp.name=EMP Explosives +icbm.explosive.exothermic.name=Exothermic Explosives +icbm.explosive.endothermic.name=Endothermic Explosives +icbm.explosive.antiGravitational.name=Anti-Gravitational Explosives +icbm.explosive.ender.name=Ender Explosives +icbm.explosive.hypersonic.name=Hypersonic Explosives + +icbm.explosive.antimatter.name=Antimatter Explosives +icbm.explosive.redMatter.name=Red Matter Explosives + +icbm.explosive.sMine.name=S-Mine + +## Missile Form +icbm.missile.condensed.name=Conventional Missile +icbm.missile.shrapnel.name=Shrapnel Missile +icbm.missile.incendiary.name=Incendiary Missile +icbm.missile.debilitation.name=Debilitation Missile +icbm.missile.chemical.name=Chemical Missile +icbm.missile.anvil.name=Anvil Missile +icbm.missile.repulsive.name=Repulsive Missile +icbm.missile.attractive.name=Attractive Missile + +icbm.missile.fragmentation.name=Fragmentation Missile +icbm.missile.contagious.name=Contagious Missile +icbm.missile.sonic.name=Sonic Missile +icbm.missile.breaching.name=Breaching Missile +icbm.missile.rejuvenation.name=Rejuvenation Missile +icbm.missile.thermobaric.name=Thermobaric Missile + +icbm.missile.nuclear.name=Nuclear Missile +icbm.missile.emp.name=EMP Missile +icbm.missile.exothermic.name=Exothermic Missile +icbm.missile.endothermic.name=Endothermic Missile +icbm.missile.antiGravitational.name=Anti-Gravitational Missile +icbm.missile.ender.name=Ender Missile +icbm.missile.hypersonic.name=Hypersonic Missile + +icbm.missile.antimatter.name=Antimatter Missile +icbm.missile.redMatter.name=Red Matter Missile + +## Special Missiles +icbm.missile.missileModule.name=Missile Module +icbm.missile.antiBallistic.name=Anti-ballistic Missile +icbm.missile.cluster.name=Cluster Missile +icbm.missile.nuclearCluster.name=Nuclear Cluster Missile +icbm.missile.homing.name=Homing Missile + +## Grenades +icbm.grenade.condensed.name=Conventional Grenade +icbm.grenade.shrapnel.name=Shrapnel Grenade +icbm.grenade.incendiary.name=Incendiary Grenade +icbm.grenade.debilitation.name=Debilitation Grenade +icbm.grenade.chemical.name=Chemical Grenade +icbm.grenade.anvil.name=Anvil Grenade +icbm.grenade.repulsive.name=Repulsive Grenade +icbm.grenade.attractive.name=Attractive Grenade + +## Explosive Minecarts +icbm.minecart.condensed.name=Explosive Cart +icbm.minecart.shrapnel.name=Shrapnel Minecart +icbm.minecart.incendiary.name=Incendiary Minecart +icbm.minecart.debilitation.name=Debilitation Minecart +icbm.minecart.chemical.name=Chemical Minecart +icbm.minecart.anvil.name=Anvil Minecart +icbm.minecart.repulsive.name=Repulsive Minecart +icbm.minecart.attractive.name=Attractive Minecart + +icbm.minecart.fragmentation.name=Fragmentation Minecart +icbm.minecart.contagious.name=Contagious Minecart +icbm.minecart.sonic.name=Sonic Minecart +icbm.minecart.breaching.name=Breaching Minecart +icbm.minecart.rejuvenation.name=Rejuvenation Minecart +icbm.minecart.thermobaric.name=Thermobaric Minecart + +## ICBM Misc Blocks +tile.icbm:oreSulfur.name=Sulfur Ore +tile.icbm:concrete.name=Concrete +tile.icbm:concreteCompact.name=Compact Concrete +tile.icbm:concreteReinforced.name=Reinforced Concrete +tile.icbm:glassReinforced.name=Reinforced Glass +tile.icbm:glassPressurePlate.name=Glass Pressure Plate +tile.icbm:glassButton.name=Glass Button +tile.icbm:camouflage.name=Camouflage +tile.icbm:proximityDetector.name=Proximity Detector +tile.icbm:spikes.0.name=Spikes +tile.icbm:spikes.1.name=Poison Spikes +tile.icbm:spikes.2.name=Flammable Spikes + +## ICBM Sentry +## Translated by Calclavia +tile.icbm:turret.0.name=Gun Turret +tile.icbm:turret.1.name=Railgun +tile.icbm:turret.2.name=AA Turret +tile.icbm:turret.3.name=Laser Turret +tile.icbm:turretPlatform.name=Turret Platform + +item.icbm:bulletShell.name=Bullet Shell +item.icbm:bullet.name=Bullet +item.icbm:bulletRailgun.name=Railgun Bullet +item.icbm:bulletAntimatter.name=Antimatter Bullet +item.icbm:bulletInfinite.name=Infinite Bullet + +item.icbm:targetCard.name=Range Upgrade +item.icbm:shellCollector.name=Shell Collector Upgrade + +## Deaths +death.attack.bullet=%1$s was shot into a swiss cheese! +death.attack.laser=%1$s was vaporized by lasers! diff --git a/src/main/resources/assets/icbm/lang/es_ES.lang b/src/main/resources/assets/icbm/lang/es_ES.lang new file mode 100644 index 0000000..5c05a7a --- /dev/null +++ b/src/main/resources/assets/icbm/lang/es_ES.lang @@ -0,0 +1,133 @@ + +itemGroup.ICBM=ICBM + +children=es_AR,es_MX,es_UY,es_VE + +## Items +item.icbm:sulfur.name=Sulfuro +item.icbm:poisonPowder.name=Polvo Venenoso +item.icbm:antidote.name=Ant\u00EDdoto +item.icbm:radarGun.name=Pistola Radar +item.icbm:remoteDetonator.name=Detonador Remoto +item.icbm:defuser.name=Desactivador +item.icbm:laserDesignator.name=Designador L\u00E1ser +item.icbm:tracker.name=Rastreador +item.icbm:signalDisrupter.name=Disruptor de Se\u00F1al + +item.icbm:bullet.0.name=Bala Convencional +item.icbm:bullet.1.name=Bala Antimateria +item.icbm:launcher.name=Lanzacohetes + +## ICBM Machines +icbm.machine.0.name=Plataforma de Lanzacohetes T1 +icbm.machine.1.name=Plataforma de Lanzacohetes T2 +icbm.machine.2.name=Plataforma de Lanzacohetes T3 +icbm.machine.3.name=Panel de Control de Lanzacohetes T1 +icbm.machine.4.name=Panel de Control de Lanzacohetes T2 +icbm.machine.5.name=Panel de Control de Lanzacohetes T3 +icbm.machine.6.name=Marco de Soporte para Lanzacohetes T1 +icbm.machine.7.name=Marco de Soporte para Lanzacohetes T2 +icbm.machine.8.name=Marco de Soporte para Lanzacohetes T3 +icbm.machine.9.name=Estaciu00F3n de Radar +icbm.machine.10.name=Torre PEM +icbm.machine.12.name=Lanzacohetes Crucero + +## ICBM Explosives + +## Block Form +icbm.explosive.condensed.name=Explosivo Condensado +icbm.explosive.shrapnel.name=Explosivo de Esquirlas +icbm.explosive.incendiary.name=Explosivo Incendiario +icbm.explosive.chemical.name=Explosivo Quu00EDmico +icbm.explosive.anvil.name=Explosivo de Yunques +icbm.explosive.repulsive.name=Explosivo Repulsivo +icbm.explosive.attractive.name=Explosivo Atractivo + +icbm.explosive.fragmentation.name=Explosivo de Fragmentaciu00F3n +icbm.explosive.contagious.name=Explosivo Contagioso +icbm.explosive.sonic.name=Explosivo Su00F3nico +icbm.explosive.breaching.name=Explosivo Penetrante +icbm.explosive.rejuvenation.name=Explosivo Rejuvenecedor +icbm.explosive.thermobaric.name=Explosivo Termobu00E1rico + +icbm.explosive.nuclear.name=Explosivo Nuclear +icbm.explosive.emp.name=Explosivo PEM +icbm.explosive.conflagration.name=Explosivo de Conflagraciu00F3n +icbm.explosive.endothermic.name=Explosivo Endotu00E9rmico +icbm.explosive.antiGravitational.name=Explosivo Anti-Gravitacional +icbm.explosive.ender.name=Explosivo Ender +icbm.explosive.hypersonic.name=Explosivo Hipersu00F3nico + +icbm.explosive.antimatter.name=Explosivo de Antimateria +icbm.explosive.redMatter.name=Explosivo de Materia Roja + +icbm.explosive.sMine.name=Mina-S + +## Missile Form +icbm.missile.condensed.name=Misil Convencional +icbm.missile.shrapnel.name=Misil de Esquirlas +icbm.missile.incendiary.name=Misil Incendiario +icbm.missile.chemical.name=Misil Quu00EDmico +icbm.missile.anvil.name=Misil de Yunques +icbm.missile.repulsive.name=Misil Repulsivo +icbm.missile.attractive.name=Misil Atractivo + +icbm.missile.fragmentation.name=Misil de Fragmentaciu00F3n +icbm.missile.contagious.name=Misil Contagioso +icbm.missile.sonic.name=Misil Su00F3nico +icbm.missile.breaching.name=Misil Penetrante +icbm.missile.rejuvenation.name=Misil Rejuvenecedor +icbm.missile.thermobaric.name=Misil Termobu00E1rico + +icbm.missile.nuclear.name=Misil Nuclear +icbm.missile.emp.name=Misil PEM +icbm.missile.conflagration.name=Misil de Conflagraciu00F3n +icbm.missile.endothermic.name=Misil Endotu00E9rmico +icbm.missile.antiGravitational.name=Misil Anti-Gravitacional +icbm.missile.ender.name=Misil Ender +icbm.missile.hypersonic.name=Misil Hipersu00F3nico + +icbm.missile.antimatter.name=Misil de Antimateria +icbm.missile.redMatter.name=Misil de Materia Roja + +## Special Missiles +icbm.missile.missileModule.name=Modulo para Misiles +icbm.missile.antiBallistic.name=Misil Anti-Balu00EDstico +icbm.missile.cluster.name=Misil de Racimos +icbm.missile.nuclearCluster.name=Misil Nuclear de Racimos +icbm.missile.homing.name=Misil Rastreador + +## Grenades +icbm.grenade.condensed.name=Granada Convencional +icbm.grenade.shrapnel.name=Granada de Esquirlas +icbm.grenade.incendiary.name=Granada Incendiaria +icbm.grenade.chemical.name=Granada Quu00EDmica +icbm.grenade.anvil.name=Granada de Yunques +icbm.grenade.repulsive.name=Granada Repulsiva +icbm.grenade.attractive.name=Granada Atractiva + +## Explosive Minecarts +icbm.minecart.condensed.name=Carro Explosivo +icbm.minecart.shrapnel.name=Carro Minero de Esquirlas +icbm.minecart.incendiary.name=Carro Minero Incendiario +icbm.minecart.chemical.name=Carro Minero Quu00EDmico +icbm.minecart.anvil.name=Carro Minero de Yunques +icbm.minecart.repulsive.name=Carro Minero Repulsivo +icbm.minecart.attractive.name=Carro Minero Atractivo + +icbm.minecart.fragmentation.name=Carro Minero de Fragmentacion +icbm.minecart.contagious.name=Carro Minero Contagioso +icbm.minecart.sonic.name=Carro Minero Su00F3nico +icbm.minecart.breaching.name=Carro Minero Penetrante +icbm.minecart.rejuvenation.name=Carro Minero Rejuvenecedor +icbm.minecart.thermobaric.name=Carro Minero Termobu00E1rico + +## ICBM Misc Blocks +tile.icbm:sulfurOre.name=Mineral de Sulfuro +tile.icbm:glassPressurePlate.name=Placa a Presi\u00F3n de Vidrio +tile.icbm:glassButton.name=Bot\u00F3n de Vidrio +tile.icbm:camouflage.name=Camuflaje +tile.icbm:proximityDetector.name=Detector de Proximidad +tile.icbm:spike.0.name=Pinchos +tile.icbm:spike.1.name=Pinchos Venenosos +tile.icbm:spike.2.name=Pinchos Inflamables diff --git a/src/main/resources/assets/icbm/lang/zh_CN.lang b/src/main/resources/assets/icbm/lang/zh_CN.lang new file mode 100644 index 0000000..110f7e8 --- /dev/null +++ b/src/main/resources/assets/icbm/lang/zh_CN.lang @@ -0,0 +1,131 @@ + +itemGroup.ICBM=ICBM + +## Items +item.sulfur.name=\u786B\u78FA +item.poisonPowder.name=\u6BD2\u7C89 +item.antidote.name=\u85E5\u5291 +item.radarGun.name=\u96F7\u9054\u69CD +item.remoteDetonator.name=\u9059\u63A7\u5F15\u7206\u5668 +item.defuser.name=\u7184\u6EC5\u7CFB\u7D71 +item.laserDesignator.name=\u9433\u5C04\u6307\u793A\u7B26 +item.tracker.name=\u8FFD\u8E64\u5668 +item.signalDisrupter.name=\u4FE1\u865F\u5E72\u64FE\u7CFB\u7D71 + +item.bullet.0.name=\u666E\u7528\u6027\u5B50\u5F48 +item.bullet.1.name=\u53CD\u7269\u8CEA\u5B50\u5F48 +item.launcher.name=\u706B\u7BAD\u7B52 + +## ICBM Machines +icbm.machine.0.name=\u767C\u5C04\u53F0T1 +icbm.machine.1.name=\u767C\u5C04\u53F0T2 +icbm.machine.2.name=\u767C\u5C04\u53F0T3 +icbm.machine.3.name=\u63A7\u5236\u7CFB\u7D71T1 +icbm.machine.4.name=\u63A7\u5236\u7CFB\u7D71T2 +icbm.machine.5.name=\u63A7\u5236\u7CFB\u7D71T3 +icbm.machine.6.name=\u652F\u63F4\u6846T1 +icbm.machine.7.name=\u652F\u63F4\u6846T2 +icbm.machine.8.name=\u652F\u63F4\u6846T3 +icbm.machine.9.name=\u96F7\u9054\u53F0 +icbm.machine.10.name=\u78C1\u66B4\u5854 +icbm.machine.12.name=\u5DE1\u822A\u767C\u5C04\u5668 + +## ICBM Explosives + +## Block Form +icbm.explosive.condensed.name=\u58D3\u7E2E\u6027\u70B8\u85E5 +icbm.explosive.shrapnel.name=\u6563\u5F48\u6027\u70B8\u85E5 +icbm.explosive.incendiary.name=\u71C3\u71D2\u6027\u70B8\u85E5 +icbm.explosive.chemical.name=\u5316\u5B78\u6B66\u5668 +icbm.explosive.anvil.name=\u7827\u70B8\u85E5 +icbm.explosive.repulsive.name=\u6297\u62D2\u6027\u70B8\u85E5 +icbm.explosive.attractive.name=\u5438\u5F15\u6027\u70B8\u85E5 + +icbm.explosive.fragmentation.name=\u788E\u7247\u6027\u70B8\u85E5 +icbm.explosive.contagious.name=\u50B3\u67D3\u6027\u70B8\u85E5 +icbm.explosive.sonic.name=\u97F3\u6CE2\u70B8\u5F48 +icbm.explosive.breaching.name=\u9055\u53CD\u6027\u70B8\u85E5 +icbm.explosive.rejuvenation.name=\u6CBB\u7642\u6027\u70B8\u85E5 +icbm.explosive.thermobaric.name=\u6EAB\u58D3\u6027\u70B8\u85E5 + +icbm.explosive.nuclear.name=\u6838\u5F48 +icbm.explosive.emp.name=\u78C1\u66B4\u5F48 +icbm.explosive.conflagration.name=\u71F9\u70B8\u85E5 +icbm.explosive.endothermic.name=\u5438\u71B1\u6027\u70B8\u85E5 +icbm.explosive.antiGravitational.name=\u53CD\u5730\u5FC3\u5438\u529B\u70B8\u5F48 +icbm.explosive.ender.name=\u77AC\u79FB\u5F48 +icbm.explosive.hypersonic.name=\u8D85\u97F3\u6CE2\u5F48 + +icbm.explosive.antimatter.name=\u53CD\u7269\u8CEA\u70B8\u5F48 +icbm.explosive.redMatter.name=\u7D05\u7269\u8CEA\u70B8\u5F48 + +icbm.explosive.sMine.name=S\u578B\u5730\u96F7 + +## Missile Form +icbm.missile.condensed.name=\u666E\u7528\u5F0F\u5C0E\u5F48 +icbm.missile.shrapnel.name=\u6563\u5F48\u5C0E\u5F48 +icbm.missile.incendiary.name=\u71C3\u71D2\u5C0E\u5F48 +icbm.missile.chemical.name=\u5316\u5B78\u5C0E\u5F48 +icbm.missile.anvil.name=\u7827\u5C0E\u5F48 +icbm.missile.repulsive.name=\u62D2\u6297\u6027\u5C0E\u5F48 +icbm.missile.attractive.name=\u5438\u5F15\u6027\u5C0E\u5F48 + +icbm.missile.fragmentation.name=\u788E\u7247\u5C0E\u5F48 +icbm.missile.contagious.name=\u50B3\u67D3\u6027\u5C0E\u5F48 +icbm.missile.sonic.name=\u97F3\u6CE2\u5C0E\u5F48 +icbm.missile.breaching.name=\u9055\u53CD\u6027\u5C0E\u5F48 +icbm.missile.rejuvenation.name=\u6CBB\u7642\u6027\u5C0E\u5F48 +icbm.missile.thermobaric.name=\u6EAB\u58D3\u6027\u5C0E\u5F48 + +icbm.missile.nuclear.name=\u6838\u5C0E\u5F48 +icbm.missile.emp.name=\u78C1\u66B4\u5C0E\u5F48 +icbm.missile.conflagration.name=\u71F9\u5C0E\u5F48 +icbm.missile.endothermic.name=\u5438\u71B1\u5C0E\u5F48 +icbm.missile.antiGravitational.name=\u53CD\u5730\u5FC3\u5438\u529B\u5C0E\u5F48 +icbm.missile.ender.name=\u77AC\u79FB\u5C0E\u5F48 +icbm.missile.hypersonic.name=\u8D85\u97F3\u6CE2\u5C0E\u5F48 + +icbm.missile.antimatter.name=\u53CD\u7269\u8CEA\u5C0E\u5F48 +icbm.missile.redMatter.name=\u7D05\u7269\u8CEA\u5C0E\u5F48 + +## Special Missiles +icbm.missile.missileModule.name=\u5C0E\u5F48\u6A21 +icbm.missile.antiBallistic.name=\u53CD\u5F48\u9053\u5C0E\u5F48 +icbm.missile.cluster.name=\u98A8\u66B4\u5C0E\u5F48 +icbm.missile.nuclearCluster.name=\u6838\u98A8\u66B4\u5C0E\u5F48 +icbm.missile.homing.name=\u8FFD\u8E64\u6027\u5C0E\u5F48 + +## Grenades +icbm.grenade.condensed.name=\u666E\u7528\u6027\u624B\u69B4\u5F48 +icbm.grenade.shrapnel.name=\u6563\u5F48\u624B\u69B4\u5F48 +icbm.grenade.incendiary.name=\u71C3\u71D2\u6027\u624B\u69B4\u5F48 +icbm.grenade.chemical.name=\u5316\u5B78\u6027\u624B\u69B4\u5F48 +icbm.grenade.anvil.name=\u7827\u624B\u69B4\u5F48 +icbm.grenade.repulsive.name=\u62D2\u6297\u6027\u624B\u69B4\u5F48 +icbm.grenade.attractive.name=\u5438\u5F15\u6027\u624B\u69B4\u5F48 + +## Explosive Minecarts +icbm.minecart.condensed.name=\u7206\u70B8\u5927\u8ECA +icbm.minecart.shrapnel.name=\u6563\u5F48\u5927\u8ECA +icbm.minecart.incendiary.name=\u71C3\u71D2\u5927\u8ECA +icbm.minecart.chemical.name=\u5316\u5B78\u5927\u8ECA +icbm.minecart.anvil.name=\u7827\u5927\u8ECA +icbm.minecart.repulsive.name=\u62D2\u6297\u6027\u5927\u8ECA +icbm.minecart.attractive.name=\u5438\u5F15\u6027\u5927\u8ECA + +icbm.minecart.fragmentation.name=\u788E\u7247\u5927\u8ECA +icbm.minecart.contagious.name=\u50B3\u67D3\u6027\u5927\u8ECA +icbm.minecart.sonic.name=\u97F3\u6CE2\u5927\u8ECA +icbm.minecart.breaching.name=\u9055\u53CD\u6027\u5927\u8ECA +icbm.minecart.rejuvenation.name=\u6CBB\u7642\u6027\u5927\u8ECA +icbm.minecart.thermobaric.name=\u6EAB\u58D3\u6027\u5927\u8ECA + +## ICBM Misc Blocks +tile.sulfurOre.name=\u786B\u7926\u77F3 +tile.glassPressurePlate.name=\u73BB\u7483\u611F\u61C9\u677F +tile.glassButton.name=\u73BB\u7483\u6309\u9215 +tile.camouflage.name=\u507D\u88DD +tile.proximityDetector.name=\u63A5\u8FD1\u7387\u8A08\u7B97\u5668 +tile.spike.0.name=\u5C16\u523A +tile.spike.1.name=\u6709\u6BD2\u5C16\u523A +tile.spike.2.name=\u71C3\u71D2\u5C16\u523A diff --git a/src/main/resources/assets/icbm/textures/antimatter.png b/src/main/resources/assets/icbm/textures/antimatter.png new file mode 100644 index 0000000..c25ff57 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/antimatter.png differ diff --git a/src/main/resources/assets/icbm/textures/blackhole.png b/src/main/resources/assets/icbm/textures/blackhole.png new file mode 100644 index 0000000..bc4142f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blackhole.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/barbedWire.png b/src/main/resources/assets/icbm/textures/blocks/barbedWire.png new file mode 100644 index 0000000..0736671 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/barbedWire.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/camouflage.png b/src/main/resources/assets/icbm/textures/blocks/camouflage.png new file mode 100644 index 0000000..2645c9c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/camouflage.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/concrete.png b/src/main/resources/assets/icbm/textures/blocks/concrete.png new file mode 100644 index 0000000..06abf06 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/concrete.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/concreteCompact.png b/src/main/resources/assets/icbm/textures/blocks/concreteCompact.png new file mode 100644 index 0000000..7e8590b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/concreteCompact.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/concreteReinforced.png b/src/main/resources/assets/icbm/textures/blocks/concreteReinforced.png new file mode 100644 index 0000000..8b2ea6d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/concreteReinforced.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_bottom.png b/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_bottom.png new file mode 100644 index 0000000..0a7f66a Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_bottom.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_side.png new file mode 100644 index 0000000..45cf297 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_top.png new file mode 100644 index 0000000..e558b51 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_antiGravitational_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_side.png new file mode 100644 index 0000000..99d8905 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_side.png.mcmeta b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_side.png.mcmeta new file mode 100644 index 0000000..54a358c --- /dev/null +++ b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_side.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation":{ + "width":1, + "height":24, + "frametime":1, + "frames":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] + } +} diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_top.png new file mode 100644 index 0000000..1931f85 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_top.png.mcmeta b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_top.png.mcmeta new file mode 100644 index 0000000..54a358c --- /dev/null +++ b/src/main/resources/assets/icbm/textures/blocks/explosive_antimatter_top.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation":{ + "width":1, + "height":24, + "frametime":1, + "frames":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] + } +} diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_anvil_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_anvil_side.png new file mode 100644 index 0000000..4d7da41 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_anvil_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_anvil_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_anvil_top.png new file mode 100644 index 0000000..61e0756 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_anvil_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_attractive_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_attractive_side.png new file mode 100644 index 0000000..7c2dac0 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_attractive_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_attractive_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_attractive_top.png new file mode 100644 index 0000000..9588f6c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_attractive_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_base_1.png b/src/main/resources/assets/icbm/textures/blocks/explosive_base_1.png new file mode 100644 index 0000000..bd05a2b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_base_1.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_base_2.png b/src/main/resources/assets/icbm/textures/blocks/explosive_base_2.png new file mode 100644 index 0000000..e40968b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_base_2.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_base_3.png b/src/main/resources/assets/icbm/textures/blocks/explosive_base_3.png new file mode 100644 index 0000000..fdc36a9 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_base_3.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_1.png b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_1.png new file mode 100644 index 0000000..56eccaa Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_1.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_2.png b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_2.png new file mode 100644 index 0000000..d30e9fc Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_2.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_3.png b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_3.png new file mode 100644 index 0000000..9cadfad Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_3.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_4.png b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_4.png new file mode 100644 index 0000000..6c226db Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_bottom_4.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_breaching_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_breaching_side.png new file mode 100644 index 0000000..74c949f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_breaching_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_breaching_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_breaching_top.png new file mode 100644 index 0000000..2893323 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_breaching_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_chemical_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_chemical_side.png new file mode 100644 index 0000000..89cfdd3 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_chemical_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_chemical_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_chemical_top.png new file mode 100644 index 0000000..d0869a0 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_chemical_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_condensed_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_condensed_side.png new file mode 100644 index 0000000..446327e Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_condensed_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_condensed_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_condensed_top.png new file mode 100644 index 0000000..1f2ae43 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_condensed_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_contagious_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_contagious_side.png new file mode 100644 index 0000000..32bf838 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_contagious_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_contagious_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_contagious_top.png new file mode 100644 index 0000000..ad1e142 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_contagious_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_debilitation_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_debilitation_side.png new file mode 100644 index 0000000..7b86c3c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_debilitation_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_debilitation_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_debilitation_top.png new file mode 100644 index 0000000..787d7a7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_debilitation_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_emp_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_emp_side.png new file mode 100644 index 0000000..d379a55 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_emp_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_emp_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_emp_top.png new file mode 100644 index 0000000..eb1907c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_emp_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_ender_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_ender_side.png new file mode 100644 index 0000000..a54f907 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_ender_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_ender_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_ender_top.png new file mode 100644 index 0000000..74a6d47 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_ender_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_endothermic_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_endothermic_side.png new file mode 100644 index 0000000..ca2766f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_endothermic_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_endothermic_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_endothermic_top.png new file mode 100644 index 0000000..b5c59bc Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_endothermic_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_exothermic_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_exothermic_side.png new file mode 100644 index 0000000..71b8e0a Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_exothermic_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_exothermic_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_exothermic_top.png new file mode 100644 index 0000000..25dd010 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_exothermic_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_fragmentation_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_fragmentation_side.png new file mode 100644 index 0000000..6d18771 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_fragmentation_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_fragmentation_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_fragmentation_top.png new file mode 100644 index 0000000..9eaa839 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_fragmentation_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_hypersonic_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_hypersonic_side.png new file mode 100644 index 0000000..fa43876 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_hypersonic_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_hypersonic_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_hypersonic_top.png new file mode 100644 index 0000000..00e6f2e Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_hypersonic_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_incendiary_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_incendiary_side.png new file mode 100644 index 0000000..de8c53f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_incendiary_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_incendiary_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_incendiary_top.png new file mode 100644 index 0000000..1c5cad9 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_incendiary_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_nuclear_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_nuclear_side.png new file mode 100644 index 0000000..6f97220 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_nuclear_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_nuclear_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_nuclear_top.png new file mode 100644 index 0000000..0670b54 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_nuclear_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_side.png new file mode 100644 index 0000000..b18c0bf Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_side.png.mcmeta b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_side.png.mcmeta new file mode 100644 index 0000000..77e6496 --- /dev/null +++ b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_side.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation":{ + "width":1, + "height":24, + "frametime":1, + "frames":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] + } +} diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_top.png new file mode 100644 index 0000000..de2f3cd Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_top.png.mcmeta b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_top.png.mcmeta new file mode 100644 index 0000000..77e6496 --- /dev/null +++ b/src/main/resources/assets/icbm/textures/blocks/explosive_redMatter_top.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation":{ + "width":1, + "height":24, + "frametime":1, + "frames":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] + } +} diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_rejuvenation_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_rejuvenation_side.png new file mode 100644 index 0000000..744a4a6 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_rejuvenation_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_rejuvenation_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_rejuvenation_top.png new file mode 100644 index 0000000..9e2181f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_rejuvenation_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_repulsive_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_repulsive_side.png new file mode 100644 index 0000000..5e598c6 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_repulsive_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_repulsive_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_repulsive_top.png new file mode 100644 index 0000000..25841b7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_repulsive_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_shrapnel_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_shrapnel_side.png new file mode 100644 index 0000000..0ade6f3 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_shrapnel_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_shrapnel_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_shrapnel_top.png new file mode 100644 index 0000000..787d7a7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_shrapnel_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_sonic_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_sonic_side.png new file mode 100644 index 0000000..94095f9 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_sonic_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_sonic_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_sonic_top.png new file mode 100644 index 0000000..a749784 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_sonic_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_thermobaric_side.png b/src/main/resources/assets/icbm/textures/blocks/explosive_thermobaric_side.png new file mode 100644 index 0000000..0424091 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_thermobaric_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/explosive_thermobaric_top.png b/src/main/resources/assets/icbm/textures/blocks/explosive_thermobaric_top.png new file mode 100644 index 0000000..228f5fa Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/explosive_thermobaric_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/glassButton.png b/src/main/resources/assets/icbm/textures/blocks/glassButton.png new file mode 100644 index 0000000..46b91bf Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/glassButton.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/glassPressurePlate.png b/src/main/resources/assets/icbm/textures/blocks/glassPressurePlate.png new file mode 100644 index 0000000..46b91bf Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/glassPressurePlate.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/glassReinforced.png b/src/main/resources/assets/icbm/textures/blocks/glassReinforced.png new file mode 100644 index 0000000..d3c3f17 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/glassReinforced.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/machine.png b/src/main/resources/assets/icbm/textures/blocks/machine.png new file mode 100644 index 0000000..7a7eee7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/machine.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/oreSulfur.png b/src/main/resources/assets/icbm/textures/blocks/oreSulfur.png new file mode 100644 index 0000000..84ec5ce Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/oreSulfur.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/proximityDetector_bottom.png b/src/main/resources/assets/icbm/textures/blocks/proximityDetector_bottom.png new file mode 100644 index 0000000..8542a77 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/proximityDetector_bottom.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/proximityDetector_side.png b/src/main/resources/assets/icbm/textures/blocks/proximityDetector_side.png new file mode 100644 index 0000000..7b43d4d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/proximityDetector_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/proximityDetector_top.png b/src/main/resources/assets/icbm/textures/blocks/proximityDetector_top.png new file mode 100644 index 0000000..c743fcd Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/proximityDetector_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/radioactive.png b/src/main/resources/assets/icbm/textures/blocks/radioactive.png new file mode 100644 index 0000000..235fb43 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/radioactive.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/radioactive_bottom.png b/src/main/resources/assets/icbm/textures/blocks/radioactive_bottom.png new file mode 100644 index 0000000..484b957 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/radioactive_bottom.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/radioactive_top.png b/src/main/resources/assets/icbm/textures/blocks/radioactive_top.png new file mode 100644 index 0000000..6a7730d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/radioactive_top.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/spikes.png b/src/main/resources/assets/icbm/textures/blocks/spikes.png new file mode 100644 index 0000000..ab7941e Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/spikes.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/spikesFlammable.png b/src/main/resources/assets/icbm/textures/blocks/spikesFlammable.png new file mode 100644 index 0000000..834f4bb Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/spikesFlammable.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/spikesPoison.png b/src/main/resources/assets/icbm/textures/blocks/spikesPoison.png new file mode 100644 index 0000000..ebde9bf Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/spikesPoison.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/turretPlatform_bottom.png b/src/main/resources/assets/icbm/textures/blocks/turretPlatform_bottom.png new file mode 100644 index 0000000..7a7eee7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/turretPlatform_bottom.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/turretPlatform_side.png b/src/main/resources/assets/icbm/textures/blocks/turretPlatform_side.png new file mode 100644 index 0000000..044daa2 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/turretPlatform_side.png differ diff --git a/src/main/resources/assets/icbm/textures/blocks/turretPlatform_top.png b/src/main/resources/assets/icbm/textures/blocks/turretPlatform_top.png new file mode 100644 index 0000000..186c42d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/blocks/turretPlatform_top.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/greendot.png b/src/main/resources/assets/icbm/textures/gui/greendot.png new file mode 100644 index 0000000..35c0a2d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/greendot.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui@.png b/src/main/resources/assets/icbm/textures/gui/gui@.png new file mode 100644 index 0000000..6a100b8 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui@.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_base.png b/src/main/resources/assets/icbm/textures/gui/gui_base.png new file mode 100644 index 0000000..6cdb0ba Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_base.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_cruise_launcher.png b/src/main/resources/assets/icbm/textures/gui/gui_cruise_launcher.png new file mode 100644 index 0000000..b83c533 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_cruise_launcher.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_empty.png b/src/main/resources/assets/icbm/textures/gui/gui_empty.png new file mode 100644 index 0000000..7bca84c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_empty.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_launcher.png b/src/main/resources/assets/icbm/textures/gui/gui_launcher.png new file mode 100644 index 0000000..3bc6c03 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_launcher.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_platform_slot.png b/src/main/resources/assets/icbm/textures/gui/gui_platform_slot.png new file mode 100644 index 0000000..690c327 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_platform_slot.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_platform_terminal.png b/src/main/resources/assets/icbm/textures/gui/gui_platform_terminal.png new file mode 100644 index 0000000..ad3c684 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_platform_terminal.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/gui_radar.png b/src/main/resources/assets/icbm/textures/gui/gui_radar.png new file mode 100644 index 0000000..8ae0511 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/gui_radar.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/reddot.png b/src/main/resources/assets/icbm/textures/gui/reddot.png new file mode 100644 index 0000000..cf1fa1c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/reddot.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/whitedot.png b/src/main/resources/assets/icbm/textures/gui/whitedot.png new file mode 100644 index 0000000..3c73e89 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/whitedot.png differ diff --git a/src/main/resources/assets/icbm/textures/gui/yellowdot.png b/src/main/resources/assets/icbm/textures/gui/yellowdot.png new file mode 100644 index 0000000..0b03cc1 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/gui/yellowdot.png differ diff --git a/src/main/resources/assets/icbm/textures/items/EnergyCap.png b/src/main/resources/assets/icbm/textures/items/EnergyCap.png new file mode 100644 index 0000000..a02faa1 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/EnergyCap.png differ diff --git a/src/main/resources/assets/icbm/textures/items/ammoCase.png b/src/main/resources/assets/icbm/textures/items/ammoCase.png new file mode 100644 index 0000000..32dc066 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/ammoCase.png differ diff --git a/src/main/resources/assets/icbm/textures/items/antidote.png b/src/main/resources/assets/icbm/textures/items/antidote.png new file mode 100644 index 0000000..94eb1bc Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/antidote.png differ diff --git a/src/main/resources/assets/icbm/textures/items/bullet.png b/src/main/resources/assets/icbm/textures/items/bullet.png new file mode 100644 index 0000000..bbdd986 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/bullet.png differ diff --git a/src/main/resources/assets/icbm/textures/items/bulletAntimatter.png b/src/main/resources/assets/icbm/textures/items/bulletAntimatter.png new file mode 100644 index 0000000..9aa869d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/bulletAntimatter.png differ diff --git a/src/main/resources/assets/icbm/textures/items/bulletInfinite.png b/src/main/resources/assets/icbm/textures/items/bulletInfinite.png new file mode 100644 index 0000000..d612290 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/bulletInfinite.png differ diff --git a/src/main/resources/assets/icbm/textures/items/bulletRailgun.png b/src/main/resources/assets/icbm/textures/items/bulletRailgun.png new file mode 100644 index 0000000..a6e1aad Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/bulletRailgun.png differ diff --git a/src/main/resources/assets/icbm/textures/items/bulletShell.png b/src/main/resources/assets/icbm/textures/items/bulletShell.png new file mode 100644 index 0000000..c2347d9 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/bulletShell.png differ diff --git a/src/main/resources/assets/icbm/textures/items/defuser.png b/src/main/resources/assets/icbm/textures/items/defuser.png new file mode 100644 index 0000000..927159a Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/defuser.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_anvil.png b/src/main/resources/assets/icbm/textures/items/grenade_anvil.png new file mode 100644 index 0000000..037082e Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_anvil.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_attractive.png b/src/main/resources/assets/icbm/textures/items/grenade_attractive.png new file mode 100644 index 0000000..b57e0be Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_attractive.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_chemical.png b/src/main/resources/assets/icbm/textures/items/grenade_chemical.png new file mode 100644 index 0000000..2140601 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_chemical.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_condensed.png b/src/main/resources/assets/icbm/textures/items/grenade_condensed.png new file mode 100644 index 0000000..25dac2a Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_condensed.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_debilitation.png b/src/main/resources/assets/icbm/textures/items/grenade_debilitation.png new file mode 100644 index 0000000..037082e Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_debilitation.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_incendiary.png b/src/main/resources/assets/icbm/textures/items/grenade_incendiary.png new file mode 100644 index 0000000..d055ce5 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_incendiary.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_repulsive.png b/src/main/resources/assets/icbm/textures/items/grenade_repulsive.png new file mode 100644 index 0000000..b6a38fb Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_repulsive.png differ diff --git a/src/main/resources/assets/icbm/textures/items/grenade_shrapnel.png b/src/main/resources/assets/icbm/textures/items/grenade_shrapnel.png new file mode 100644 index 0000000..50d1eb7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/grenade_shrapnel.png differ diff --git a/src/main/resources/assets/icbm/textures/items/laserDesignator.png b/src/main/resources/assets/icbm/textures/items/laserDesignator.png new file mode 100644 index 0000000..0d37e50 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/laserDesignator.png differ diff --git a/src/main/resources/assets/icbm/textures/items/missileModule.png b/src/main/resources/assets/icbm/textures/items/missileModule.png new file mode 100644 index 0000000..847125d Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/missileModule.png differ diff --git a/src/main/resources/assets/icbm/textures/items/poisonPowder.png b/src/main/resources/assets/icbm/textures/items/poisonPowder.png new file mode 100644 index 0000000..fd2d06b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/poisonPowder.png differ diff --git a/src/main/resources/assets/icbm/textures/items/radarGun.png b/src/main/resources/assets/icbm/textures/items/radarGun.png new file mode 100644 index 0000000..5fc488a Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/radarGun.png differ diff --git a/src/main/resources/assets/icbm/textures/items/radioCard.png b/src/main/resources/assets/icbm/textures/items/radioCard.png new file mode 100644 index 0000000..629b282 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/radioCard.png differ diff --git a/src/main/resources/assets/icbm/textures/items/remoteDetonator.png b/src/main/resources/assets/icbm/textures/items/remoteDetonator.png new file mode 100644 index 0000000..0e851f3 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/remoteDetonator.png differ diff --git a/src/main/resources/assets/icbm/textures/items/shellCollector.png b/src/main/resources/assets/icbm/textures/items/shellCollector.png new file mode 100644 index 0000000..1d917d7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/shellCollector.png differ diff --git a/src/main/resources/assets/icbm/textures/items/signalDisrupter.png b/src/main/resources/assets/icbm/textures/items/signalDisrupter.png new file mode 100644 index 0000000..aed04a9 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/signalDisrupter.png differ diff --git a/src/main/resources/assets/icbm/textures/items/sulfur.png b/src/main/resources/assets/icbm/textures/items/sulfur.png new file mode 100644 index 0000000..78207ba Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/sulfur.png differ diff --git a/src/main/resources/assets/icbm/textures/items/targetCard.png b/src/main/resources/assets/icbm/textures/items/targetCard.png new file mode 100644 index 0000000..96e7f21 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/targetCard.png differ diff --git a/src/main/resources/assets/icbm/textures/items/tracker.png b/src/main/resources/assets/icbm/textures/items/tracker.png new file mode 100644 index 0000000..07b1716 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/items/tracker.png differ diff --git a/src/main/resources/assets/icbm/textures/items/tracker.png.mcmeta b/src/main/resources/assets/icbm/textures/items/tracker.png.mcmeta new file mode 100644 index 0000000..dc9fcd8 --- /dev/null +++ b/src/main/resources/assets/icbm/textures/items/tracker.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":1 + } +} diff --git a/src/main/resources/assets/icbm/textures/models/aa_turret_friendly.png b/src/main/resources/assets/icbm/textures/models/aa_turret_friendly.png new file mode 100644 index 0000000..57592e8 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/aa_turret_friendly.png differ diff --git a/src/main/resources/assets/icbm/textures/models/aa_turret_hostile.png b/src/main/resources/assets/icbm/textures/models/aa_turret_hostile.png new file mode 100644 index 0000000..852b015 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/aa_turret_hostile.png differ diff --git a/src/main/resources/assets/icbm/textures/models/aa_turret_neutral.png b/src/main/resources/assets/icbm/textures/models/aa_turret_neutral.png new file mode 100644 index 0000000..745c4dd Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/aa_turret_neutral.png differ diff --git a/src/main/resources/assets/icbm/textures/models/cannon_friendly.png b/src/main/resources/assets/icbm/textures/models/cannon_friendly.png new file mode 100644 index 0000000..eecf95c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/cannon_friendly.png differ diff --git a/src/main/resources/assets/icbm/textures/models/cannon_hostile.png b/src/main/resources/assets/icbm/textures/models/cannon_hostile.png new file mode 100644 index 0000000..e49e5fe Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/cannon_hostile.png differ diff --git a/src/main/resources/assets/icbm/textures/models/cannon_neutral.png b/src/main/resources/assets/icbm/textures/models/cannon_neutral.png new file mode 100644 index 0000000..5abc4ea Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/cannon_neutral.png differ diff --git a/src/main/resources/assets/icbm/textures/models/cruise_launcher.png b/src/main/resources/assets/icbm/textures/models/cruise_launcher.png new file mode 100644 index 0000000..3864bcb Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/cruise_launcher.png differ diff --git a/src/main/resources/assets/icbm/textures/models/emp_tower.png b/src/main/resources/assets/icbm/textures/models/emp_tower.png new file mode 100644 index 0000000..e12bddd Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/emp_tower.png differ diff --git a/src/main/resources/assets/icbm/textures/models/fragment.png b/src/main/resources/assets/icbm/textures/models/fragment.png new file mode 100644 index 0000000..71e69ed Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/fragment.png differ diff --git a/src/main/resources/assets/icbm/textures/models/gun_turret_friendly.png b/src/main/resources/assets/icbm/textures/models/gun_turret_friendly.png new file mode 100644 index 0000000..21a70e3 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/gun_turret_friendly.png differ diff --git a/src/main/resources/assets/icbm/textures/models/gun_turret_hostile.png b/src/main/resources/assets/icbm/textures/models/gun_turret_hostile.png new file mode 100644 index 0000000..1433b70 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/gun_turret_hostile.png differ diff --git a/src/main/resources/assets/icbm/textures/models/gun_turret_neutral.png b/src/main/resources/assets/icbm/textures/models/gun_turret_neutral.png new file mode 100644 index 0000000..990bf9e Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/gun_turret_neutral.png differ diff --git a/src/main/resources/assets/icbm/textures/models/laser_turret_friendly.png b/src/main/resources/assets/icbm/textures/models/laser_turret_friendly.png new file mode 100644 index 0000000..a71fb7c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/laser_turret_friendly.png differ diff --git a/src/main/resources/assets/icbm/textures/models/laser_turret_hostile.png b/src/main/resources/assets/icbm/textures/models/laser_turret_hostile.png new file mode 100644 index 0000000..fd82a06 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/laser_turret_hostile.png differ diff --git a/src/main/resources/assets/icbm/textures/models/laser_turret_neutral.png b/src/main/resources/assets/icbm/textures/models/laser_turret_neutral.png new file mode 100644 index 0000000..ce78705 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/laser_turret_neutral.png differ diff --git a/src/main/resources/assets/icbm/textures/models/launcher_0.png b/src/main/resources/assets/icbm/textures/models/launcher_0.png new file mode 100644 index 0000000..f298130 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/launcher_0.png differ diff --git a/src/main/resources/assets/icbm/textures/models/launcher_1.png b/src/main/resources/assets/icbm/textures/models/launcher_1.png new file mode 100644 index 0000000..6c0283f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/launcher_1.png differ diff --git a/src/main/resources/assets/icbm/textures/models/launcher_2.png b/src/main/resources/assets/icbm/textures/models/launcher_2.png new file mode 100644 index 0000000..1fc38db Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/launcher_2.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_antiBallistic.png b/src/main/resources/assets/icbm/textures/models/missile_antiBallistic.png new file mode 100644 index 0000000..ba48a20 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_antiBallistic.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_antiGravitational.png b/src/main/resources/assets/icbm/textures/models/missile_antiGravitational.png new file mode 100644 index 0000000..ec2280f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_antiGravitational.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_antimatter.png b/src/main/resources/assets/icbm/textures/models/missile_antimatter.png new file mode 100644 index 0000000..fa21a3c Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_antimatter.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_anvil.png b/src/main/resources/assets/icbm/textures/models/missile_anvil.png new file mode 100644 index 0000000..622bbe5 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_anvil.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_attractive.png b/src/main/resources/assets/icbm/textures/models/missile_attractive.png new file mode 100644 index 0000000..1a40039 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_attractive.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_breaching.png b/src/main/resources/assets/icbm/textures/models/missile_breaching.png new file mode 100644 index 0000000..6e4f393 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_breaching.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_chemical.png b/src/main/resources/assets/icbm/textures/models/missile_chemical.png new file mode 100644 index 0000000..57b0259 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_chemical.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_cluster.png b/src/main/resources/assets/icbm/textures/models/missile_cluster.png new file mode 100644 index 0000000..2361a4b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_cluster.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_condensed.png b/src/main/resources/assets/icbm/textures/models/missile_condensed.png new file mode 100644 index 0000000..2451391 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_condensed.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_contagious.png b/src/main/resources/assets/icbm/textures/models/missile_contagious.png new file mode 100644 index 0000000..4734e91 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_contagious.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_coordinator_off.png b/src/main/resources/assets/icbm/textures/models/missile_coordinator_off.png new file mode 100644 index 0000000..23ba8f7 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_coordinator_off.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_coordinator_on.png b/src/main/resources/assets/icbm/textures/models/missile_coordinator_on.png new file mode 100644 index 0000000..2a5bad3 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_coordinator_on.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_corrosive.png b/src/main/resources/assets/icbm/textures/models/missile_corrosive.png new file mode 100644 index 0000000..12b8d1f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_corrosive.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_debilitation.png b/src/main/resources/assets/icbm/textures/models/missile_debilitation.png new file mode 100644 index 0000000..e025dfe Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_debilitation.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_emp.png b/src/main/resources/assets/icbm/textures/models/missile_emp.png new file mode 100644 index 0000000..7205910 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_emp.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_ender.png b/src/main/resources/assets/icbm/textures/models/missile_ender.png new file mode 100644 index 0000000..5194ef6 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_ender.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_endothermic.png b/src/main/resources/assets/icbm/textures/models/missile_endothermic.png new file mode 100644 index 0000000..64ac937 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_endothermic.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_exothermic.png b/src/main/resources/assets/icbm/textures/models/missile_exothermic.png new file mode 100644 index 0000000..e5c45d4 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_exothermic.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_fragmentation.png b/src/main/resources/assets/icbm/textures/models/missile_fragmentation.png new file mode 100644 index 0000000..75b2b58 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_fragmentation.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_homing.png b/src/main/resources/assets/icbm/textures/models/missile_homing.png new file mode 100644 index 0000000..a040a37 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_homing.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_hypersonic.png b/src/main/resources/assets/icbm/textures/models/missile_hypersonic.png new file mode 100644 index 0000000..497dfcc Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_hypersonic.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_incendiary.png b/src/main/resources/assets/icbm/textures/models/missile_incendiary.png new file mode 100644 index 0000000..2d5be1b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_incendiary.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_missileModule.png b/src/main/resources/assets/icbm/textures/models/missile_missileModule.png new file mode 100644 index 0000000..2451391 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_missileModule.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_nuclear.png b/src/main/resources/assets/icbm/textures/models/missile_nuclear.png new file mode 100644 index 0000000..28065e2 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_nuclear.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_nuclearCluster.png b/src/main/resources/assets/icbm/textures/models/missile_nuclearCluster.png new file mode 100644 index 0000000..a1ccff6 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_nuclearCluster.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_redMatter.png b/src/main/resources/assets/icbm/textures/models/missile_redMatter.png new file mode 100644 index 0000000..1a5cb69 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_redMatter.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_rejuvenation.png b/src/main/resources/assets/icbm/textures/models/missile_rejuvenation.png new file mode 100644 index 0000000..d6df43f Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_rejuvenation.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_repulsive.png b/src/main/resources/assets/icbm/textures/models/missile_repulsive.png new file mode 100644 index 0000000..e044b33 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_repulsive.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_shrapnel.png b/src/main/resources/assets/icbm/textures/models/missile_shrapnel.png new file mode 100644 index 0000000..8b95f58 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_shrapnel.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_sonic.png b/src/main/resources/assets/icbm/textures/models/missile_sonic.png new file mode 100644 index 0000000..d568a0a Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_sonic.png differ diff --git a/src/main/resources/assets/icbm/textures/models/missile_thermobaric.png b/src/main/resources/assets/icbm/textures/models/missile_thermobaric.png new file mode 100644 index 0000000..668457b Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/missile_thermobaric.png differ diff --git a/src/main/resources/assets/icbm/textures/models/radar.png b/src/main/resources/assets/icbm/textures/models/radar.png new file mode 100644 index 0000000..a212244 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/radar.png differ diff --git a/src/main/resources/assets/icbm/textures/models/railgun.png b/src/main/resources/assets/icbm/textures/models/railgun.png new file mode 100644 index 0000000..54bffb0 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/railgun.png differ diff --git a/src/main/resources/assets/icbm/textures/models/rocket_launcher.png b/src/main/resources/assets/icbm/textures/models/rocket_launcher.png new file mode 100644 index 0000000..bf9b2d1 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/rocket_launcher.png differ diff --git a/src/main/resources/assets/icbm/textures/models/s-mine.png b/src/main/resources/assets/icbm/textures/models/s-mine.png new file mode 100644 index 0000000..5946646 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/s-mine.png differ diff --git a/src/main/resources/assets/icbm/textures/models/sentry_med.png b/src/main/resources/assets/icbm/textures/models/sentry_med.png new file mode 100644 index 0000000..4f29442 Binary files /dev/null and b/src/main/resources/assets/icbm/textures/models/sentry_med.png differ diff --git a/src/main/resources/assets/icbm/textures/noise.png b/src/main/resources/assets/icbm/textures/noise.png new file mode 100644 index 0000000..a442aed Binary files /dev/null and b/src/main/resources/assets/icbm/textures/noise.png differ diff --git a/src/main/resources/icbm_at.cfg b/src/main/resources/icbm_at.cfg new file mode 100644 index 0000000..491f5c5 --- /dev/null +++ b/src/main/resources/icbm_at.cfg @@ -0,0 +1,2 @@ +public net.minecraft.entity.EntityLivingBase field_70713_bf # activePotionsMap +public net.minecraft.client.particle.EntityPortalFX field_70571_a # portalParticleScale diff --git a/src/main/resources/icbm_logo.png b/src/main/resources/icbm_logo.png new file mode 100644 index 0000000..da48f4f Binary files /dev/null and b/src/main/resources/icbm_logo.png differ