diff --git a/README.md b/README.md index 4eddaf461..68e85a68e 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,9 @@ NTM has certain behaviors intended to fix vanilla code or to increase compatibil ### Thermos Thermos servers (along with its forks such as Crucible) have a "performance" feature that causes all tile entity ticking to slow down if there's no player present in the same chunk. For obvious reasons, this will heavily impact machines and cause phantom issues that, not having knowledge of this "performance" feature, are near impossible to diagnose. By default, NTM will crash on servers running the Thermos base code and print a lengthy message informing server owners about this "performance" feature as well as how to fix the issues it causes. The error message is printed in plain English on the top of the crash log, failure to read (as well as understand) it will leave the server inoperable. +### Shaders +Shaders (loaded by either Optifine, Iris or otherwise) will in all likelihood break when a gun is held. This is because guns need to skip vanilla's first person item setup for the rendering, however shaders apparently use the setup step for setting certain GL states, and skipping that will break rendering. [Shader Fixer](https://modrinth.com/mod/shader-fixer) is a mod with various fixes, among which is explicit compatibility for NTM's guns. + ### Optifine One of the most common "performance" mods on 1.7.10, Optifine, achieves an increase in performance by breaking small things in spots that are usually hard to notice, although this can cause severe issues with NTM. A short list of problems, along with some solutions, follows: * Get rid of Optifine and use one of the many [other, less intrusive performance mods](https://gist.github.com/makamys/7cb74cd71d93a4332d2891db2624e17c). @@ -113,7 +116,7 @@ One of the most common "performance" mods on 1.7.10, Optifine, achieves an incre ### Angelica In older versions, Angelica caused issues regarding model rendering, often times making 3D models transparent. Ever since the switch to VBOs, models work fine. Another issue was blocks with connected textures not rendering at all, but this too was fixed, meaning as of time of writing there are no major incompatibilities known with Angelica. However there a few minor issues that persist, but those can be fixed: * Often times when making a new world, all items appear as white squares. Somehow, scrolling though the NEI pages fixes this permanently -* Reeds will render weirdly, this is an incompatibility with the "Compact Vertex Format" feature. Disabling it will make reeds look normal +* Reeds will render weirdly, this is an incompatibility with the "Compact Vertex Format" feature. Disabling it will make reeds look normal. Alternatively, reed rendering can be disabled by using `/ntmclient set RENDER_REEDS false`, which works around the issue by not rendering the underwater portion of reeds at all. ### Skybox chainloader NTM adds a few small things to the skybox using a custom skybox renderer. Minecraft can only have a single skybox renderer loaded, so setting the skybox to the NTM custom one would break compatibility with other mods' skyboxes. To mend this, NTM employs a **chainloader**. This chainloader will detect if a different skybox is loaded, save a reference to that skybox and then use NTM's skybox, which when used will also make sure to run the previous modded skybox renderer. In the event that NTM's skybox were to cause trouble, it can be disabled with the config option `1.31_enableSkyboxes`. diff --git a/changelog b/changelog index 3ebccb1e3..9fb1c18d3 100644 --- a/changelog +++ b/changelog @@ -1,26 +1,35 @@ +## The performance update +* my boy gammawave basically did the entire thing +* packet sending should be more performant now, which affects most machines +* RBMKs are now *much* more performant with their simulation and packets + ## Added -* Double barrel shotgun - * Special weapon, spawns as part of certain loot pools - * Uses the new 10 gauge caliber - * Will reload after each shot, however it is not belt-fed, if ammo is depleted, the next reload must be triggered manually +* 10 gauge slug +* Shredder + * A b-side for the autoshotgun + * Fires 12 gauge, accelerated by plasma, which bursts on impact + * Fragments move slowly and have damaging ricochet effects + * Fragments keep the effects of the original shell (e.g. explosive shell will spawn a single explosive fragment) +* Other gun stuff ## Changed -* Removed the old casing items -* Reduced the flicker on the autoshotgun's holo sights -* Leviathan Turbine now has an info overlay displaying steam and energy buffer values +* Black powder bullets now have 75% base damage instead of 50% +* Ball and powder type rounds no longer have a bonus on headshot +* Shot and powder now does way less damage +* Some secret ammo types are now craftable +* Updated the assault rifle's texture +* Shooting at old CRT screens now breaks them ## Fixed -* Fixed the bullet casing molds being unobtainable -* Fixed instant crash caused by smelting certain things in the crucible -* Fixed the SPAS' alt fire having a delay of only 10 ticks instead of 20 -* Fixed 240mm nuclear shells not triggering properly if they hit their target within 3 ticks of being spawned -* Fixed some items that are supposed to be hidden in NEI being visible -* Fixed dual lever action shotguns having inconsistent damage -* Fixed entities (especially players) not being affected at all by their own explosions (rockets, 40mm grenades, etc) - * To keep rocket jumping at least somewhat viable, self-damage from explosions is reduced by 50%, the knockback remains the same -* Fixed missing localization for the casing molds -* Fixed the broken CIWS turret crashing instantly -* Added safeguards to prevent any unnamed casing config from crashing -* Fixed one of the break action revolver's faces having incorrect normals, making it invisible -* Fixed the fluid trait config not loading correctly - * Fluids are now subject to the /ntmreload command +* Fixed `ITEM_TOOLTIP_SHOW_CUSTOM_NUKE` client config overriding `ITEM_TOOLTIP_SHOW_OREDICT` due to name overlap +* Fixed certain secret weapon creation condition not working properly +* Fixed artillery rockets getting stuck in the air when their target is not set to a block +* Fixed potential issue of ABMs getting stuck mid-flight when their target is destroyed prematurely +* Fixed mistakes in the fragment names for de_DE +* Fixed nitra rocket duplication only yielding one rocket +* Fixed rotary furnace not always properly showing the metal pouring effect +* Fixed T45 model not lifting its arms when a new gun is held + * Like previously, due to the archaic nature of the model, the rotations are not very precise, and will most likely break when holding an akimbo gun +* Potentially fixed an issue where cargo planes do not successfully spawn on lower render distances +* Fixed glyphids not calling their `onDeath` function properly, causing them to not drop anything and preventing the appropriate forge events from firing +* Fixed GL state leak caused by plasma blast particles, causing other particles (especially bones) to render weird diff --git a/src/main/java/api/hbm/fluid/PipeNet.java b/src/main/java/api/hbm/fluid/PipeNet.java index 3dacf2f0b..d8a219497 100644 --- a/src/main/java/api/hbm/fluid/PipeNet.java +++ b/src/main/java/api/hbm/fluid/PipeNet.java @@ -1,12 +1,9 @@ package api.hbm.fluid; import java.math.BigInteger; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.HashSet; import java.util.List; -import java.util.TimeZone; import com.hbm.inventory.fluid.FluidType; @@ -18,18 +15,18 @@ public class PipeNet implements IPipeNet { private FluidType type; private List links = new ArrayList(); private HashSet subscribers = new HashSet(); - + public static List trackingInstances = null; protected BigInteger totalTransfer = BigInteger.ZERO; public List debug = new ArrayList(); - + public PipeNet(FluidType type) { this.type = type; } @Override public void joinNetworks(IPipeNet network) { - + if(network == this) return; @@ -38,11 +35,11 @@ public class PipeNet implements IPipeNet { this.getLinks().add(conductor); } network.getLinks().clear(); - + for(IFluidConnector connector : network.getSubscribers()) { this.subscribe(connector); } - + network.destroy(); } @@ -58,10 +55,10 @@ public class PipeNet implements IPipeNet { @Override public IPipeNet joinLink(IFluidConductor conductor) { - + if(conductor.getPipeNet(type) != null) conductor.getPipeNet(type).leaveLink(conductor); - + conductor.setPipeNet(type, this); this.links.add(conductor); return this; @@ -91,53 +88,54 @@ public class PipeNet implements IPipeNet { @Override public long transferFluid(long fill, int pressure) { - subscribers.removeIf(x -> + subscribers.removeIf(x -> x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid() || !x.isLoaded() ); - + if(this.subscribers.isEmpty()) return fill; - + trackingInstances = new ArrayList(); trackingInstances.add(this); List subList = new ArrayList(subscribers); return fairTransfer(subList, type, pressure, fill); } - + public static long fairTransfer(List subList, FluidType type, int pressure, long fill) { - + if(fill <= 0) return 0; - + List weight = new ArrayList(); long totalReq = 0; - + for(IFluidConnector con : subList) { long req = con.getDemand(type, pressure); weight.add(req); totalReq += req; } - + if(totalReq == 0) return fill; - + long totalGiven = 0; - + for(int i = 0; i < subList.size(); i++) { IFluidConnector con = subList.get(i); long req = weight.get(i); double fraction = (double)req / (double)totalReq; - + long given = (long) Math.floor(fraction * fill); - + if(given > 0) { - + totalGiven += (given - con.transferFluid(type, pressure, given)); - + if(con instanceof TileEntity) { TileEntity tile = (TileEntity) con; tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile); } - + + /* debug code if(trackingInstances != null) { for(int j = 0; j < trackingInstances.size(); j++) { PipeNet net = trackingInstances.get(j); @@ -146,17 +144,18 @@ public class PipeNet implements IPipeNet { log(net, sdf.format(new Date(System.currentTimeMillis())) + " Sending " + given + "mB to " + conToString(con)); } } + */ } } - + if(trackingInstances != null) { - + for(int i = 0; i < trackingInstances.size(); i++) { PipeNet net = trackingInstances.get(i); net.totalTransfer = net.totalTransfer.add(BigInteger.valueOf(totalGiven)); } } - + return fill - totalGiven; } @@ -169,10 +168,10 @@ public class PipeNet implements IPipeNet { public void destroy() { this.valid = false; this.subscribers.clear(); - + for(IFluidConductor con : this.links) con.setPipeNet(type, null); - + this.links.clear(); } @@ -185,22 +184,22 @@ public class PipeNet implements IPipeNet { public BigInteger getTotalTransfer() { return this.totalTransfer; } - + public static void log(PipeNet net, String msg) { net.debug.add(msg); - + while(net.debug.size() > 50) { net.debug.remove(0); } } - + public static String conToString(IFluidConnector con) { - + if(con instanceof TileEntity) { TileEntity tile = (TileEntity) con; return tile.getClass().getSimpleName() + " @ " + tile.xCoord + "/" + tile.yCoord + "/" + tile.zCoord; } - + return "" + con; } } diff --git a/src/main/java/com/hbm/blocks/BlockBase.java b/src/main/java/com/hbm/blocks/BlockBase.java index d2e1b01ed..9fc497d64 100644 --- a/src/main/java/com/hbm/blocks/BlockBase.java +++ b/src/main/java/com/hbm/blocks/BlockBase.java @@ -1,7 +1,6 @@ package com.hbm.blocks; import com.hbm.lib.RefStrings; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EnumCreatureType; @@ -11,7 +10,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockBase extends Block { - + private boolean beaconable = false; private boolean canSpawn = true; @@ -22,14 +21,14 @@ public class BlockBase extends Block { public BlockBase(Material material) { super(material); } - + @Override public Block setBlockName(String name) { super.setBlockName(name); this.setBlockTextureName(RefStrings.MODID + ":" + name); return this; } - + /** * Daisychainable setter for making the block a beacon base block * @return @@ -38,7 +37,7 @@ public class BlockBase extends Block { this.beaconable = true; return this; } - + public BlockBase noMobSpawn() { this.canSpawn = false; return this; @@ -53,7 +52,7 @@ public class BlockBase extends Block { public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return this.beaconable; } - + /** * Sets the block to air and drops it * @param world @@ -62,7 +61,7 @@ public class BlockBase extends Block { * @param z */ public void dismantle(World world, int x, int y, int z) { - + world.setBlockToAir(x, y, z); ItemStack itemstack = new ItemStack(this, 1); diff --git a/src/main/java/com/hbm/blocks/BlockDummyable.java b/src/main/java/com/hbm/blocks/BlockDummyable.java index e0463a1b0..cfedf6246 100644 --- a/src/main/java/com/hbm/blocks/BlockDummyable.java +++ b/src/main/java/com/hbm/blocks/BlockDummyable.java @@ -1,15 +1,10 @@ package com.hbm.blocks; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import com.hbm.handler.MultiblockHandlerXR; import com.hbm.handler.ThreeInts; import com.hbm.interfaces.ICopiable; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IPersistentNBT; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -33,6 +28,10 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable { public BlockDummyable(Material mat) { @@ -50,7 +49,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl public static final int offset = 10; // meta offset from dummy to extra rotation public static final int extra = 6; - + /* * An extra integer that can be set before block set operations (such as makeExtra) and intercepted in createNewTileEntity. * This way we can inelegantly add variation to the tiles created even if the metadata would be the same. @@ -60,11 +59,11 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl public static int overrideTileMeta = 0; public static boolean safeRem = false; - + public static void setOverride(int i) { overrideTileMeta = i; } - + public static void resetOverride() { overrideTileMeta = 0; } @@ -179,7 +178,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl if(i == 3) { dir = ForgeDirection.getOrientation(4); } - + dir = getDirModified(dir); if(!checkRequirement(world, x, y, z, dir, o)) { @@ -221,7 +220,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl public void onBlockAdded(World world, int x, int y, int z) { lastBlockSet = new BlockPos(x, y, z); }*/ - + /** * A bit more advanced than the dir modifier, but it is important that the resulting direction meta is in the core range. * Using the "extra" metas is technically possible but requires a bit of tinkering, e.g. preventing a recursive loop @@ -237,7 +236,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl protected int getMetaForCore(World world, int x, int y, int z, EntityPlayer player, int original) { return original; } - + /** * Allows to modify the general placement direction as if the player had another rotation. * Quite basic due to only having 1 param but it's more meant to fix/limit the amount of directions @@ -272,7 +271,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl world.setBlock(x, y, z, this, meta + extra, 3); this.safeRem = false; } - + public void removeExtra(World world, int x, int y, int z) { if(world.getBlock(x, y, z) != this) @@ -310,7 +309,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl // if(pos != null) { ForgeDirection d = ForgeDirection.getOrientation(i); - + if(world.getBlock(x - d.offsetX, y - d.offsetY, z - d.offsetZ) == this) world.setBlockToAir(x - d.offsetX, y - d.offsetY, z - d.offsetZ); // } @@ -385,7 +384,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl } protected boolean standardOpenBehavior(World world, int x, int y, int z, EntityPlayer player, int id) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { @@ -403,14 +402,14 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl @Override public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { - + if(!player.capabilities.isCreativeMode) { harvesters.set(player); this.dropBlockAsItem(world, x, y, z, meta, 0); harvesters.set(null); } } - + /* * Called after the block and TE are already gone, so this method is of no use to us. */ @@ -419,53 +418,53 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); player.addExhaustion(0.025F); } - + public boolean useDetailedHitbox() { return !bounding.isEmpty(); } - + public List bounding = new ArrayList(); @Override public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) { - + if(!this.useDetailedHitbox()) { super.addCollisionBoxesToList(world, x, y, z, entityBounding, list, entity); return; } - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return; - + x = pos[0]; y = pos[1]; z = pos[2]; - + for(AxisAlignedBB aabb :this.bounding) { AxisAlignedBB boxlet = getAABBRotationOffset(aabb, x + 0.5, y, z + 0.5, ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - this.offset).getRotation(ForgeDirection.UP)); - + if(entityBounding.intersectsWith(boxlet)) { list.add(boxlet); } } } - + public static AxisAlignedBB getAABBRotationOffset(AxisAlignedBB aabb, double x, double y, double z, ForgeDirection dir) { - + AxisAlignedBB newBox = null; if(dir == ForgeDirection.NORTH) newBox = AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ); if(dir == ForgeDirection.EAST) newBox = AxisAlignedBB.getBoundingBox(-aabb.maxZ, aabb.minY, aabb.minX, -aabb.minZ, aabb.maxY, aabb.maxX); if(dir == ForgeDirection.SOUTH) newBox = AxisAlignedBB.getBoundingBox(-aabb.maxX, aabb.minY, -aabb.maxZ, -aabb.minX, aabb.maxY, -aabb.minZ); if(dir == ForgeDirection.WEST) newBox = AxisAlignedBB.getBoundingBox(aabb.minZ, aabb.minY, -aabb.maxX, aabb.maxZ, aabb.maxY, -aabb.minX); - + if(newBox != null) { newBox.offset(x, y, z); return newBox; } - + return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5); } @@ -477,31 +476,31 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.999F, 1.0F); //for some fucking reason setting maxY to something that isn't 1 magically fixes item collisions } } - + @Override @SideOnly(Side.CLIENT) public boolean shouldDrawHighlight(World world, int x, int y, int z) { return !this.bounding.isEmpty(); } - + @Override @SideOnly(Side.CLIENT) public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z) { - + int[] pos = this.findCore(world, x, y, z); if(pos == null) return; - + x = pos[0]; y = pos[1]; z = pos[2]; - + EntityPlayer player = event.player; float interp = event.partialTicks; double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp; double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp; double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp; float exp = 0.002F; - + int meta = world.getBlockMetadata(x, y, z); ICustomBlockHighlight.setup(); diff --git a/src/main/java/com/hbm/blocks/BlockEnumMulti.java b/src/main/java/com/hbm/blocks/BlockEnumMulti.java index 0dd222f82..a79493e26 100644 --- a/src/main/java/com/hbm/blocks/BlockEnumMulti.java +++ b/src/main/java/com/hbm/blocks/BlockEnumMulti.java @@ -1,9 +1,6 @@ package com.hbm.blocks; -import java.util.Locale; - import com.hbm.util.EnumUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; @@ -11,6 +8,8 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import java.util.Locale; + public class BlockEnumMulti extends BlockMulti { public Class theEnum; @@ -23,17 +22,17 @@ public class BlockEnumMulti extends BlockMulti { this.multiName = multiName; this.multiTexture = multiTexture; } - + protected IIcon[] icons; @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { - + if(multiTexture) { Enum[] enums = theEnum.getEnumConstants(); this.icons = new IIcon[enums.length]; - + for(int i = 0; i < icons.length; i++) { Enum num = enums[i]; this.icons[i] = reg.registerIcon(this.getTextureMultiName(num)); @@ -42,25 +41,25 @@ public class BlockEnumMulti extends BlockMulti { this.blockIcon = reg.registerIcon(this.getTextureName()); } } - + public String getUnlocalizedName(ItemStack stack) { - + if(this.multiName) { Enum num = EnumUtil.grabEnumSafely(this.theEnum, stack.getItemDamage()); return getUnlocalizedMultiName(num); } - + return this.getUnlocalizedName(); } - + public String getTextureMultiName(Enum num) { return this.getTextureName() + "." + num.name().toLowerCase(Locale.US); } - + public String getUnlocalizedMultiName(Enum num) { return super.getUnlocalizedName() + "." + num.name().toLowerCase(Locale.US); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { diff --git a/src/main/java/com/hbm/blocks/BlockFallingNT.java b/src/main/java/com/hbm/blocks/BlockFallingNT.java index f880d7268..8e23cc57c 100644 --- a/src/main/java/com/hbm/blocks/BlockFallingNT.java +++ b/src/main/java/com/hbm/blocks/BlockFallingNT.java @@ -1,9 +1,6 @@ package com.hbm.blocks; -import java.util.Random; - import com.hbm.entity.item.EntityFallingBlockNT; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -14,6 +11,8 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import java.util.Random; + public class BlockFallingNT extends Block { public static boolean fallInstantly; @@ -45,7 +44,7 @@ public class BlockFallingNT extends Block { } protected void fall(World world, int x, int y, int z) { - + if(canFallThrough(world, x, y - 1, z) && y >= 0) { byte range = 32; diff --git a/src/main/java/com/hbm/blocks/BlockMulti.java b/src/main/java/com/hbm/blocks/BlockMulti.java index 21930f6ff..e676c0b71 100644 --- a/src/main/java/com/hbm/blocks/BlockMulti.java +++ b/src/main/java/com/hbm/blocks/BlockMulti.java @@ -1,7 +1,5 @@ package com.hbm.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; @@ -9,6 +7,8 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import java.util.List; + public abstract class BlockMulti extends BlockBase implements IBlockMulti { public BlockMulti() { diff --git a/src/main/java/com/hbm/blocks/BlockRemap.java b/src/main/java/com/hbm/blocks/BlockRemap.java index 1939b2830..97c21a6a1 100644 --- a/src/main/java/com/hbm/blocks/BlockRemap.java +++ b/src/main/java/com/hbm/blocks/BlockRemap.java @@ -1,8 +1,5 @@ package com.hbm.blocks; -import java.util.ArrayList; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -12,8 +9,11 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.Random; + public class BlockRemap extends Block implements ILookOverlay { - + public Block remapBlock; public int remapMeta; @@ -29,7 +29,7 @@ public class BlockRemap extends Block implements ILookOverlay { public IIcon getIcon(int meta, int side) { return this.remapBlock.getIcon(meta, side); } - + @Override public Item getItemDropped(int meta, Random rand, int fortune) { return this.remapBlock.getItemDropped(meta, rand, fortune); diff --git a/src/main/java/com/hbm/blocks/IAnalyzable.java b/src/main/java/com/hbm/blocks/IAnalyzable.java index e4e76a5ee..7648183c7 100644 --- a/src/main/java/com/hbm/blocks/IAnalyzable.java +++ b/src/main/java/com/hbm/blocks/IAnalyzable.java @@ -1,9 +1,9 @@ package com.hbm.blocks; -import java.util.List; - import net.minecraft.world.World; +import java.util.List; + public interface IAnalyzable { public List getDebugInfo(World world, int x, int y, int z); diff --git a/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java b/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java index 509ddab95..507fe8ff5 100644 --- a/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java +++ b/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java @@ -1,18 +1,17 @@ package com.hbm.blocks; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.world.World; import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import org.lwjgl.opengl.GL11; public interface ICustomBlockHighlight { @SideOnly(Side.CLIENT) public boolean shouldDrawHighlight(World world, int x, int y, int z); @SideOnly(Side.CLIENT) public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z); - + @SideOnly(Side.CLIENT) public static void setup() { GL11.glEnable(GL11.GL_BLEND); @@ -22,7 +21,7 @@ public interface ICustomBlockHighlight { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); } - + @SideOnly(Side.CLIENT) public static void cleanup() { GL11.glDepthMask(true); diff --git a/src/main/java/com/hbm/blocks/ILookOverlay.java b/src/main/java/com/hbm/blocks/ILookOverlay.java index d100ed767..c58c3827b 100644 --- a/src/main/java/com/hbm/blocks/ILookOverlay.java +++ b/src/main/java/com/hbm/blocks/ILookOverlay.java @@ -1,9 +1,5 @@ package com.hbm.blocks; -import java.util.List; - -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; @@ -11,6 +7,9 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import org.lwjgl.opengl.GL11; + +import java.util.List; public interface ILookOverlay { @@ -33,14 +32,14 @@ public interface ILookOverlay { try { for(String line : text) { - + int color = 0xFFFFFF; if(line.startsWith("&[")) { int end = line.lastIndexOf("&]"); color = Integer.parseInt(line.substring(2, end)); line = line.substring(end + 2); } - + mc.fontRenderer.drawStringWithShadow(line, pX, pZ, color); pZ += 10; } diff --git a/src/main/java/com/hbm/blocks/IPersistentInfoProvider.java b/src/main/java/com/hbm/blocks/IPersistentInfoProvider.java index ce033b3cb..4cfb07ad5 100644 --- a/src/main/java/com/hbm/blocks/IPersistentInfoProvider.java +++ b/src/main/java/com/hbm/blocks/IPersistentInfoProvider.java @@ -1,11 +1,11 @@ package com.hbm.blocks; -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import java.util.List; + public interface IPersistentInfoProvider { public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext); diff --git a/src/main/java/com/hbm/blocks/ITooltipProvider.java b/src/main/java/com/hbm/blocks/ITooltipProvider.java index e959db070..5008b1834 100644 --- a/src/main/java/com/hbm/blocks/ITooltipProvider.java +++ b/src/main/java/com/hbm/blocks/ITooltipProvider.java @@ -1,23 +1,21 @@ package com.hbm.blocks; -import java.util.List; - -import org.lwjgl.input.Keyboard; - import com.hbm.util.I18nUtil; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import java.util.List; public interface ITooltipProvider { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext); public default void addStandardInfo(ItemStack stack, EntityPlayer player, List list, boolean ext) { - + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { for(String s : I18nUtil.resolveKeyArray(((Block)this).getUnlocalizedName() + ".desc")) list.add(EnumChatFormatting.YELLOW + s); } else { @@ -26,7 +24,7 @@ public interface ITooltipProvider { EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info"); } } - + public default EnumRarity getRarity(ItemStack stack) { return EnumRarity.common; } diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index cc6d8cec0..ed2fa0b9b 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -1,7 +1,5 @@ package com.hbm.blocks; -import java.util.ArrayList; - import com.hbm.blocks.BlockEnums.*; import com.hbm.blocks.bomb.*; import com.hbm.blocks.fluid.*; @@ -13,7 +11,10 @@ import com.hbm.blocks.machine.pile.*; import com.hbm.blocks.machine.rbmk.*; import com.hbm.blocks.network.*; import com.hbm.blocks.rail.*; -import com.hbm.blocks.test.*; +import com.hbm.blocks.test.TestCharge; +import com.hbm.blocks.test.TestCore; +import com.hbm.blocks.test.TestEventTester; +import com.hbm.blocks.test.TestObjTester; import com.hbm.blocks.turret.*; import com.hbm.items.block.*; import com.hbm.items.bomb.ItemPrototypeBlock; @@ -37,14 +38,16 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import java.util.ArrayList; + public class ModBlocks { - + public static void mainRegistry() { initializeBlock(); registerBlock(); } - + public static Block event_tester; public static Block obj_tester; public static Block test_core; @@ -73,7 +76,7 @@ public class ModBlocks { public static Block ore_bedrock; public static Block ore_volcano; - + public static Block ore_nether_coal; public static Block ore_nether_smoldering; public static Block ore_nether_uranium; @@ -86,7 +89,7 @@ public class ModBlocks { public static Block ore_nether_schrabidium; public static Block ore_meteor; - + public static Block stone_gneiss; public static Block ore_gneiss_iron; public static Block ore_gneiss_gold; @@ -102,7 +105,7 @@ public class ModBlocks { public static Block gneiss_brick; public static Block gneiss_tile; public static Block gneiss_chiseled; - + public static Block stone_depth; public static Block ore_depth_cinnebar; public static Block ore_depth_zirconium; @@ -113,7 +116,7 @@ public class ModBlocks { public static Block stone_keyhole; public static Block stone_keyhole_meta; - + public static Block stone_depth_nether; public static Block ore_depth_nether_neodymium; @@ -359,9 +362,9 @@ public class ModBlocks { public static Block cmb_brick; public static Block cmb_brick_reinforced; - + public static Block vinyl_tile; - + public static Block tile_lab; public static Block tile_lab_cracked; public static Block tile_lab_broken; @@ -379,7 +382,7 @@ public class ModBlocks { public static Block meteor_pillar; public static Block meteor_spawner; public static Block meteor_battery; - + public static Block moon_turf; public static Block brick_jungle; @@ -397,9 +400,9 @@ public class ModBlocks { public static Block deco_computer; public static Block deco_crt; public static Block deco_toaster; - + public static Block filing_cabinet; - + public static Block tape_recorder; public static Block steel_poles; public static Block pole_top; @@ -456,7 +459,7 @@ public class ModBlocks { public static Block glass_polonium; public static Block glass_ash; public static Block glass_quartz; - + public static Block mush; public static Block mush_block; public static Block mush_block_stem; @@ -489,7 +492,7 @@ public class ModBlocks { public static Block tektite; public static Block ore_tektite_osmiridium; public static Block impact_dirt; - + public static Block fallout; public static Block foam_layer; public static Block sand_boron_layer; @@ -537,12 +540,12 @@ public class ModBlocks { public static Block charge_miner; public static Block charge_c4; public static Block charge_semtex; - + public static Block mine_ap; public static Block mine_he; public static Block mine_shrap; public static Block mine_fat; - + public static Block crate; public static Block crate_weapon; public static Block crate_lead; @@ -590,7 +593,7 @@ public class ModBlocks { public static Block spikes; public static Block charger; - + public static Block tesla; public static Block sat_mapper; @@ -612,7 +615,7 @@ public class ModBlocks { public static Block crate_template; public static Block safe; public static Block mass_storage; - + public static Block nuke_gadget; public static Block nuke_boy; public static Block nuke_man; @@ -628,7 +631,7 @@ public class ModBlocks { public static Block pump_steam; public static Block pump_electric; - + public static Block heater_firebox; public static Block heater_oven; public static Block heater_oilburner; @@ -655,23 +658,23 @@ public class ModBlocks { public static Block machine_strand_caster; public static Block foundry_slagtap; public static Block slag; - + public static Block machine_difurnace_off; public static Block machine_difurnace_on; public static Block machine_difurnace_extension; public static Block machine_difurnace_rtg_off; public static Block machine_difurnace_rtg_on; //public static final int guiID_test_difurnace = 1; historical - + public static Block machine_centrifuge; public static Block machine_gascent; - + public static Block machine_fel; public static Block machine_silex; public static Block machine_rotary_furnace; public static Block machine_crystallizer; - + public static Block machine_uf6_tank; public static Block machine_puf6_tank; @@ -683,12 +686,12 @@ public class ModBlocks { public static Block machine_nuke_furnace_on; public static Block machine_rtg_furnace_off; public static Block machine_rtg_furnace_on; - + public static Block machine_industrial_generator; public static Block machine_cyclotron; public static Block machine_exposure_chamber; - + public static Block hadron_plating; public static Block hadron_plating_blue; public static Block hadron_plating_black; @@ -716,17 +719,17 @@ public class ModBlocks { public static Block hadron_access; public static Block hadron_core; public static Block hadron_cooler; - + public static Block machine_electric_furnace_off; public static Block machine_electric_furnace_on; - + public static Block machine_microwave; - + public static Block machine_arc_furnace_off; public static Block machine_arc_furnace_on; - + //public static Block machine_deuterium; - + public static Block machine_battery_potato; public static Block machine_battery; public static Block machine_lithium_battery; @@ -741,9 +744,9 @@ public class ModBlocks { public static Block capacitor_niobium; public static Block capacitor_tantalium; public static Block capacitor_schrabidate; - + public static Block machine_wood_burner; - + public static Block red_wire_coated; public static Block red_cable; public static Block red_cable_classic; @@ -797,9 +800,9 @@ public class ModBlocks { public static Block drone_dock; public static Block drone_crate_provider; public static Block drone_crate_requester; - + public static Block fan; - + public static Block piston_inserter; public static Block chain; @@ -821,7 +824,7 @@ public class ModBlocks { public static Block barrel_steel; public static Block barrel_tcalloy; public static Block barrel_antimatter; - + public static Block machine_transformer; public static Block machine_transformer_20; public static Block machine_transformer_dnt; @@ -843,7 +846,7 @@ public class ModBlocks { public static Block struct_plasma_core; public static Block struct_watz_core; public static Block struct_icf_core; - + public static Block factory_titanium_hull; public static Block factory_advanced_hull; @@ -857,7 +860,7 @@ public class ModBlocks { public static Block cm_heat; public static Block custom_machine; public static Block cm_anchor; - + public static Block pwr_fuel; public static Block pwr_control; public static Block pwr_channel; @@ -869,7 +872,7 @@ public class ModBlocks { public static Block pwr_port; public static Block pwr_controller; public static Block pwr_block; - + public static Block fusion_conductor; public static Block fusion_center; public static Block fusion_motor; @@ -897,18 +900,18 @@ public class ModBlocks { public static Block balefire; public static Block fire_digamma; public static Block digamma_matter; - + public static Block dfc_emitter; public static Block dfc_injector; public static Block dfc_receiver; public static Block dfc_stabilizer; public static Block dfc_core; - + public static Block machine_converter_he_rf; public static Block machine_converter_rf_he; public static Block machine_schrabidium_transmutator; - + public static Block machine_diesel; public static Block machine_combustion_engine; @@ -925,7 +928,7 @@ public class ModBlocks { public static Block machine_powerrtg; public static Block machine_radiolysis; public static Block machine_hephaestus; - + public static Block machine_well; public static Block oil_pipe; public static Block machine_pumpjack; @@ -934,7 +937,7 @@ public class ModBlocks { public static Block machine_flare; public static Block chimney_brick; public static Block chimney_industrial; - + public static Block machine_refinery; public static Block machine_vacuum_distill; public static Block machine_fraction_tower; @@ -946,11 +949,11 @@ public class ModBlocks { public static Block machine_pyrooven; public static Block machine_boiler_off; - + public static Block machine_steam_engine; public static Block machine_turbine; public static Block machine_large_turbine; - + public static Block machine_deuterium_extractor; public static Block machine_deuterium_tower; @@ -963,7 +966,7 @@ public class ModBlocks { public static Block machine_tower_small; public static Block machine_tower_large; public static Block machine_condenser_powered; - + public static Block machine_electrolyser; public static Block machine_excavator; @@ -972,7 +975,7 @@ public class ModBlocks { public static Block machine_mining_laser; public static Block barricade; // a sand bag that drops nothing, for automated walling purposes - + public static Block machine_assembler; public static Block machine_assemfac; public static Block machine_arc_welder; @@ -990,18 +993,18 @@ public class ModBlocks { public static Block launch_pad; public static Block launch_pad_rusted; public static Block launch_pad_large; - + public static Block machine_missile_assembly; - + public static Block compact_launcher; public static Block launch_table; - + public static Block soyuz_launcher; public static Block machine_radar; public static Block machine_radar_large; public static Block radar_screen; - + public static Block machine_turbofan; public static Block machine_turbinegas; public static Block machine_lpw2; @@ -1011,22 +1014,22 @@ public class ModBlocks { public static Block machine_epress; public static Block machine_conveyor_press; public static Block machine_ammo_press; - + public static Block machine_siren; - + public static Block machine_radgen; - + public static Block machine_satlinker; public static Block machine_keyforge; - + public static Block machine_armor_table; - + public static Block reactor_research; public static Block reactor_zirnox; public static Block zirnox_destroyed; public static Block machine_controller; - + public static Block machine_spp_bottom; public static Block machine_spp_top; @@ -1034,13 +1037,13 @@ public class ModBlocks { public static Block radiorec; public static Block machine_forcefield; - + public static Block machine_waste_drum; public static Block machine_storage_drum; public static Block machine_autocrafter; public static Block machine_funnel; - + public static Block anvil_iron; public static Block anvil_lead; public static Block anvil_steel; @@ -1053,7 +1056,7 @@ public class ModBlocks { public static Block anvil_dnt; public static Block anvil_osmiridium; public static Block anvil_murky; - + public static Block turret_chekhov; public static Block turret_friendly; public static Block turret_jeremy; @@ -1112,7 +1115,7 @@ public class ModBlocks { public static Block rail_large_buffer; public static Block rail_large_switch; public static Block rail_large_switch_flipped; - + public static Block statue_elb_f; public static Block cheater_virus; @@ -1165,17 +1168,17 @@ public class ModBlocks { public static Block corium_block; public static Fluid corium_fluid; public static final Material fluidcorium = (new MaterialLiquid(MapColor.brownColor) { - + @Override public boolean blocksMovement() { return true; } - + @Override public Material setImmovableMobility() { //override access modifier return super.setImmovableMobility(); } - + }.setImmovableMobility()); public static Block volcanic_lava_block; @@ -1206,23 +1209,23 @@ public class ModBlocks { public static Block pink_slab; public static Block pink_double_slab; public static Block pink_stairs; - + public static Material materialGas = new MaterialGas(); - + private static void initializeBlock() { - + event_tester = new TestEventTester(Material.iron).setBlockName("event_tester").setCreativeTab(null).setHardness(2.5F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":event_tester"); obj_tester = new TestObjTester(Material.iron).setBlockName("obj_tester").setCreativeTab(null).setHardness(2.5F).setResistance(10.0F); test_core = new TestCore(Material.iron).setBlockName("test_core").setCreativeTab(null).setHardness(2.5F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":test_core"); test_charge = new TestCharge(Material.iron).setBlockName("test_charge").setCreativeTab(null).setHardness(2.5F).setResistance(10.0F); structure_anchor = new BlockGeneric(Material.iron).setBlockName("structure_anchor").setCreativeTab(null).setHardness(2.5F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":structure_anchor"); - + ore_uranium = new BlockOutgas(Material.rock, true, 5, true).setBlockName("ore_uranium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_uranium"); ore_uranium_scorched = new BlockOutgas(Material.rock, true, 5, true).setBlockName("ore_uranium_scorched").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_uranium_scorched"); ore_titanium = new BlockGeneric(Material.rock).setBlockName("ore_titanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_titanium"); ore_sulfur = new BlockOre(Material.rock).setBlockName("ore_sulfur").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_sulfur"); ore_thorium = new BlockGeneric(Material.rock).setBlockName("ore_thorium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_thorium"); - + ore_niter = new BlockOre(Material.rock).setBlockName("ore_niter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_niter"); ore_copper = new BlockGeneric(Material.rock).setBlockName("ore_copper").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_copper"); ore_tungsten = new BlockGeneric(Material.rock).setBlockName("ore_tungsten").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_tungsten"); @@ -1235,12 +1238,12 @@ public class ModBlocks { ore_asbestos = new BlockOutgas(Material.rock, true, 5, true).setBlockName("ore_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":ore_asbestos"); ore_coal_oil = new BlockCoalOil(Material.rock).setBlockName("ore_coal_oil").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":ore_coal_oil"); ore_coal_oil_burning = new BlockCoalBurning(Material.rock).setBlockName("ore_coal_oil_burning").setCreativeTab(MainRegistry.blockTab).setLightLevel(10F/15F).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":ore_coal_oil_burning"); - + cluster_iron = new BlockCluster(Material.rock).setBlockName("cluster_iron").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":cluster_iron"); cluster_titanium = new BlockCluster(Material.rock).setBlockName("cluster_titanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":cluster_titanium"); cluster_aluminium = new BlockCluster(Material.rock).setBlockName("cluster_aluminium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":cluster_aluminium"); cluster_copper = new BlockCluster(Material.rock).setBlockName("cluster_copper").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":cluster_copper"); - + ore_nether_coal = new BlockNetherCoal(Material.rock, false, 5, true).setBlockName("ore_nether_coal").setCreativeTab(MainRegistry.blockTab).setLightLevel(10F/15F).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_coal"); ore_nether_smoldering = new BlockSmolder(Material.rock).setBlockName("ore_nether_smoldering").setCreativeTab(MainRegistry.blockTab).setLightLevel(1F).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_smoldering"); ore_nether_uranium = new BlockOutgas(Material.rock, true, 5, true).setBlockName("ore_nether_uranium").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_uranium"); @@ -1269,7 +1272,7 @@ public class ModBlocks { gneiss_brick = new BlockGeneric(Material.rock).setBlockName("gneiss_brick").setCreativeTab(MainRegistry.blockTab).setHardness(1.5F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":gneiss_brick"); gneiss_tile = new BlockGeneric(Material.rock).setBlockName("gneiss_tile").setCreativeTab(MainRegistry.blockTab).setHardness(1.5F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":gneiss_tile"); gneiss_chiseled = new BlockPillar(Material.rock, RefStrings.MODID + ":gneiss_tile").setBlockName("gneiss_chiseled").setCreativeTab(MainRegistry.blockTab).setHardness(1.5F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":gneiss_chiseled"); - + stone_depth = new BlockDepth().setBlockName("stone_depth").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":stone_depth"); ore_depth_cinnebar = new BlockDepthOre().setBlockName("ore_depth_cinnebar").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ore_depth_cinnebar"); ore_depth_zirconium = new BlockDepthOre().setBlockName("ore_depth_zirconium").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ore_depth_zirconium"); @@ -1278,10 +1281,10 @@ public class ModBlocks { cluster_depth_titanium = new BlockDepthOre().setBlockName("cluster_depth_titanium").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":cluster_depth_titanium"); cluster_depth_tungsten = new BlockDepthOre().setBlockName("cluster_depth_tungsten").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":cluster_depth_tungsten"); ore_alexandrite = new BlockDepthOre().setBlockName("ore_alexandrite").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ore_alexandrite"); - + stone_keyhole = new BlockKeyhole().setBlockName("stone_keyhole").setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":stone_keyhole"); stone_keyhole_meta = new BlockRedBrickKeyhole(Material.rock).setCreativeTab(null).setBlockName("stone_keyhole_meta").setResistance(10_000); - + ore_bedrock = new BlockBedrockOreTE().setBlockName("ore_bedrock").setCreativeTab(null); ore_volcano = new BlockFissure().setBlockName("ore_volcano").setLightLevel(1F).setCreativeTab(MainRegistry.blockTab); @@ -1290,10 +1293,10 @@ public class ModBlocks { depth_nether_brick = new BlockDepth().setBlockName("depth_nether_brick").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":depth_nether_brick"); depth_nether_tiles = new BlockDepth().setBlockName("depth_nether_tiles").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":depth_nether_tiles"); depth_dnt = new BlockDepth().setBlockName("depth_dnt").setCreativeTab(MainRegistry.blockTab).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":depth_dnt"); - + stone_depth_nether = new BlockDepth().setBlockName("stone_depth_nether").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":stone_depth_nether"); ore_depth_nether_neodymium = new BlockDepthOre().setBlockName("ore_depth_nether_neodymium").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ore_depth_nether_neodymium"); - + stone_porous = new BlockPorous().setBlockName("stone_porous").setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":stone_porous"); stone_resource = new BlockResourceStone().setBlockName("stone_resource").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F); stalagmite = new BlockStalagmite().setBlockName("stalagmite").setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.0F); @@ -1306,20 +1309,20 @@ public class ModBlocks { basalt_brick = new BlockGeneric(Material.rock).setBlockName("basalt_brick").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":basalt_brick"); basalt_polished = new BlockGeneric(Material.rock).setBlockName("basalt_polished").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":basalt_polished"); basalt_tiles = new BlockGeneric(Material.rock).setBlockName("basalt_tiles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":basalt_tiles"); - + ore_australium = new BlockGeneric(Material.rock).setBlockName("ore_australium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_australium"); ore_rare = new BlockOre(Material.rock).setBlockName("ore_rare").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_rare"); ore_cobalt = new BlockOre(Material.rock).setBlockName("ore_cobalt").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_cobalt"); ore_cinnebar = new BlockOre(Material.rock).setBlockName("ore_cinnebar").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_cinnebar"); ore_coltan = new BlockOre(Material.rock).setBlockName("ore_coltan").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_coltan"); - + ore_oil = new BlockOre(Material.rock).setBlockName("ore_oil").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_oil"); ore_oil_empty = new BlockGeneric(Material.rock).setBlockName("ore_oil_empty").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_oil_empty"); ore_oil_sand = new BlockFalling(Material.sand).setBlockName("ore_oil_sand").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeSand).setHardness(0.5F).setResistance(1.0F).setBlockTextureName(RefStrings.MODID + ":ore_oil_sand_alt"); ore_bedrock_oil = new BlockGeneric(Material.rock).noMobSpawn().setBlockName("ore_bedrock_oil").setCreativeTab(MainRegistry.blockTab).setBlockUnbreakable().setResistance(1_000_000).setBlockTextureName(RefStrings.MODID + ":ore_bedrock_oil"); - + ore_tikite = new BlockDragonProof(Material.rock).setBlockName("ore_tikite").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_tikite_alt"); - + block_uranium = new BlockHazard().makeBeaconable().setBlockName("block_uranium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(50.0F).setBlockTextureName(RefStrings.MODID + ":block_uranium"); block_u233 = new BlockHazard().makeBeaconable().setDisplayEffect(ExtDisplayEffect.RADFOG).setBlockName("block_u233").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(50.0F).setBlockTextureName(RefStrings.MODID + ":block_u233"); block_u235 = new BlockHazard().makeBeaconable().setDisplayEffect(ExtDisplayEffect.RADFOG).setBlockName("block_u235").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(50.0F).setBlockTextureName(RefStrings.MODID + ":block_u235"); @@ -1411,16 +1414,16 @@ public class ModBlocks { block_c4 = new BlockPlasticExplosive(Material.tnt).setBlockName("block_c4").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_c4"); block_smore = new BlockPillar(Material.rock, RefStrings.MODID + ":block_smore_top").setBlockName("block_smore").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_smore_side"); block_slag = new BlockSlag(Material.rock).setBlockName("block_slag").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeStone).setHardness(2.0F).setBlockTextureName(RefStrings.MODID + ":block_slag"); - + block_australium = new BlockBeaconable(Material.iron).setBlockName("block_australium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_australium"); block_weidanium = new BlockBeaconable(Material.iron).setBlockName("block_weidanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_deprecated"); block_reiium = new BlockBeaconable(Material.iron).setBlockName("block_reiium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_deprecated"); block_unobtainium = new BlockBeaconable(Material.iron).setBlockName("block_unobtainium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_deprecated"); block_daffergon = new BlockBeaconable(Material.iron).setBlockName("block_daffergon").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_deprecated"); block_verticium = new BlockBeaconable(Material.iron).setBlockName("block_verticium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_deprecated"); - + block_cap = new BlockCap().setBlockName("block_cap").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F); - + deco_titanium = new BlockOre(Material.iron).noFortune().setBlockName("deco_titanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_titanium"); deco_red_copper = new BlockDecoCT(Material.iron).noFortune().setBlockName("deco_red_copper").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_red_copper"); deco_tungsten = new BlockDecoCT(Material.iron).noFortune().setBlockName("deco_tungsten").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_tungsten"); @@ -1431,7 +1434,7 @@ public class ModBlocks { deco_asbestos = new BlockOutgas(Material.cloth, true, 5, true).noFortune().setBlockName("deco_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_asbestos"); deco_rbmk = new BlockGeneric(Material.iron).setBlockName("deco_rbmk").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_side"); deco_rbmk_smooth = new BlockGeneric(Material.iron).setBlockName("deco_rbmk_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_top"); - + deco_emitter = new BlockEmitter().setBlockName("deco_emitter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":emitter"); part_emitter = new PartEmitter().setBlockName("part_emitter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":part_top"); deco_loot = new BlockLoot().setBlockName("deco_loot").setCreativeTab(null).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); @@ -1439,7 +1442,7 @@ public class ModBlocks { bobblehead = new BlockBobble().setBlockName("bobblehead").setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); snowglobe = new BlockSnowglobe().setBlockName("snowglobe").setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":glass_boron"); plushie = new BlockPlushie().setBlockName("plushie").setStepSound(Block.soundTypeCloth).setResistance(50_0000.0F).setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":block_fiberglass_side"); - + gravel_obsidian = new BlockFalling(Material.iron).setBlockName("gravel_obsidian").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGravel).setHardness(5.0F).setResistance(240.0F).setBlockTextureName(RefStrings.MODID + ":gravel_obsidian"); gravel_diamond = new BlockFalling(Material.sand).setBlockName("gravel_diamond").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGravel).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":gravel_diamond"); asphalt = new BlockSpeedy(Material.rock, 1.5).setBlockName("asphalt").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(120.0F).setBlockTextureName(RefStrings.MODID + ":asphalt"); @@ -1454,7 +1457,7 @@ public class ModBlocks { reinforced_lamp_on = new ReinforcedLamp(Material.rock, true).setBlockName("reinforced_lamp_on").setHardness(15.0F).setResistance(80.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_lamp_on"); reinforced_laminate = new BlockNTMGlassCT(1, RefStrings.MODID + ":reinforced_laminate", Material.rock, true).setBlockName("reinforced_laminate").setCreativeTab(MainRegistry.blockTab).setLightOpacity(0).setHardness(15.0F).setResistance(300.0F); reinforced_laminate_pane = new BlockNTMGlassPane(1, RefStrings.MODID + ":reinforced_laminate_pane", RefStrings.MODID + ":reinforced_laminate_pane_edge", Material.rock, true).setBlockName("reinforced_laminate_pane").setCreativeTab(MainRegistry.blockTab).setLightOpacity(1).setHardness(15.0F).setResistance(300.0F); - + lamp_tritium_green_off = new TritiumLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_green_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_off"); lamp_tritium_green_on = new TritiumLamp(Material.redstoneLight, true).setBlockName("lamp_tritium_green_on").setStepSound(Block.soundTypeGlass).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_on"); lamp_tritium_blue_off = new TritiumLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_blue_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_blue_off"); @@ -1473,7 +1476,7 @@ public class ModBlocks { spotlight_beam = new SpotlightBeam().setBlockName("spotlight_beam"); floodlight = new Floodlight(Material.iron).setBlockName("floodlight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); floodlight_beam = new FloodlightBeam().setBlockName("floodlight_beam"); - + reinforced_stone = new BlockGeneric(Material.rock).setBlockName("reinforced_stone").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_stone"); concrete_smooth = new BlockRadResistant(Material.rock).setBlockName("concrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete"); concrete_colored = new BlockConcreteColored(Material.rock).setBlockName("concrete_colored").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete"); @@ -1495,7 +1498,7 @@ public class ModBlocks { cmb_brick_reinforced = new BlockGeneric(Material.rock).setBlockName("cmb_brick_reinforced").setCreativeTab(MainRegistry.blockTab).setHardness(25.0F).setResistance(50000.0F).setBlockTextureName(RefStrings.MODID + ":cmb_brick_reinforced"); brick_asbestos = new BlockOutgas(Material.rock, true, 5, true).setBlockName("brick_asbestos").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(1000.0F).setBlockTextureName(RefStrings.MODID + ":brick_asbestos"); brick_fire = new BlockGeneric(Material.rock).setBlockName("brick_fire").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(35.0F).setBlockTextureName(RefStrings.MODID + ":brick_fire"); - + ducrete_smooth = new BlockGeneric(Material.rock).setBlockName("ducrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(20.0F).setResistance(500.0F).setBlockTextureName(RefStrings.MODID + ":ducrete"); ducrete = new BlockGeneric(Material.rock).setBlockName("ducrete").setCreativeTab(MainRegistry.blockTab).setHardness(20.0F).setResistance(500.0F).setBlockTextureName(RefStrings.MODID + ":ducrete_tile"); brick_ducrete = new BlockGeneric(Material.rock).setBlockName("brick_ducrete").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(750.0F).setBlockTextureName(RefStrings.MODID + ":brick_ducrete"); @@ -1507,7 +1510,7 @@ public class ModBlocks { concrete_brick_double_slab = new BlockMultiSlab(concrete_brick_slab, Material.rock, brick_concrete, brick_concrete_mossy, brick_concrete_cracked, brick_concrete_broken, brick_ducrete).setBlockName("concrete_brick_double_slab").setCreativeTab(MainRegistry.blockTab); brick_slab = new BlockMultiSlab(null, Material.rock, reinforced_stone, reinforced_brick, brick_obsidian, brick_light, brick_compound, brick_asbestos, brick_fire).setBlockName("brick_slab").setCreativeTab(MainRegistry.blockTab); brick_double_slab = new BlockMultiSlab(brick_slab, Material.rock, reinforced_stone, reinforced_brick, brick_obsidian, brick_light, brick_compound, brick_asbestos, brick_fire).setBlockName("brick_double_slab").setCreativeTab(MainRegistry.blockTab); - + concrete_smooth_stairs = new BlockGenericStairs(concrete_smooth, 0).setBlockName("concrete_smooth_stairs").setCreativeTab(MainRegistry.blockTab); concrete_stairs = new BlockGenericStairs(concrete, 0).setBlockName("concrete_stairs").setCreativeTab(MainRegistry.blockTab); concrete_asbestos_stairs = new BlockGenericStairs(concrete_asbestos, 0).setBlockName("concrete_asbestos_stairs").setCreativeTab(MainRegistry.blockTab); @@ -1547,7 +1550,7 @@ public class ModBlocks { meteor_spawner = new BlockCybercrab(Material.rock).setBlockName("meteor_spawner").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F); meteor_battery = new BlockPillar(Material.rock, RefStrings.MODID + ":meteor_power").setBlockName("meteor_battery").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F).setBlockTextureName(RefStrings.MODID + ":meteor_spawner_side"); moon_turf = new BlockFalling(Material.sand).setBlockName("moon_turf").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":moon_turf"); - + brick_jungle = new BlockGeneric(Material.rock).setBlockName("brick_jungle").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle"); brick_jungle_cracked = new BlockGeneric(Material.rock).setBlockName("brick_jungle_cracked").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_cracked"); brick_jungle_fragile = new FragileBrick(Material.rock).setBlockName("brick_jungle_fragile").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_fragile"); @@ -1557,14 +1560,14 @@ public class ModBlocks { brick_jungle_trap = new TrappedBrick(Material.rock).setBlockName("brick_jungle_trap").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_trap"); brick_jungle_glyph = new BlockGlyph(Material.rock).setBlockName("brick_jungle_glyph").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F); brick_jungle_circle = new BlockBallsSpawner(Material.rock).setBlockName("brick_jungle_circle").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(360.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_circle"); - + brick_red = new BlockRedBrick(Material.rock).setBlockName("brick_red").setResistance(10_000); - + deco_computer = new BlockDecoModel(Material.iron, DecoComputerEnum.class, true, false).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); deco_crt = new BlockDecoCRT(Material.iron).setBlockName("deco_crt").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); deco_toaster = new BlockDecoToaster(Material.iron).setBlockName("deco_toaster").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); filing_cabinet = new BlockDecoContainer(Material.iron, DecoCabinetEnum.class, true, false, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); pole_top = new DecoPoleTop(Material.iron).setBlockName("pole_top").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_pole_top"); @@ -1576,7 +1579,7 @@ public class ModBlocks { steel_scaffold = new BlockScaffold().setBlockName("steel_scaffold").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_steel_orig"); steel_grate = new BlockGrate(Material.iron).setBlockName("steel_grate").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F); steel_grate_wide = new BlockGrate(Material.iron).setBlockName("steel_grate_wide").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F); - + deco_pipe = new BlockPipe(Material.iron, RefStrings.MODID + ":pipe_side", 0).setBlockName("deco_pipe").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":pipe_top"); deco_pipe_rusted = new BlockPipe(Material.iron, RefStrings.MODID + ":pipe_side_rusty", 0).setBlockName("deco_pipe_rusted").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":pipe_top_rusty"); deco_pipe_green = new BlockPipe(Material.iron, RefStrings.MODID + ":pipe_side_green", 0).setBlockName("deco_pipe_green").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":pipe_top_green"); @@ -1601,13 +1604,13 @@ public class ModBlocks { deco_pipe_quad_green_rusted = new BlockPipe(Material.iron, RefStrings.MODID + ":pipe_side_green_rusty", 2).setBlockName("deco_pipe_quad_green_rusted").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":pipe_top_green_rusty"); deco_pipe_quad_red = new BlockPipe(Material.iron, RefStrings.MODID + ":pipe_side_red", 2).setBlockName("deco_pipe_quad_red").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":pipe_top_red"); deco_pipe_quad_marked = new BlockPipe(Material.iron, RefStrings.MODID + ":pipe_side_marked", 2).setBlockName("deco_pipe_quad_marked").setStepSound(ModSoundTypes.grate).setCreativeTab(MainRegistry.blockTab).setHardness(2.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":pipe_top_marked"); - + broadcaster_pc = new PinkCloudBroadcaster(Material.iron).setBlockName("broadcaster_pc").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":broadcaster_pc"); geiger = new GeigerCounter(Material.iron).setBlockName("geiger").setCreativeTab(MainRegistry.machineTab).setHardness(15.0F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":geiger"); hev_battery = new HEVBattery(Material.iron).setBlockName("hev_battery").setCreativeTab(MainRegistry.machineTab).setLightLevel(10F/15F).setHardness(0.5F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":hev_battery"); - + fence_metal = new BlockMetalFence(Material.iron).setBlockName("fence_metal").setCreativeTab(MainRegistry.machineTab).setHardness(15.0F).setResistance(0.25F).setBlockTextureName(RefStrings.MODID + ":fence_metal"); - + ash_digamma = new BlockAshes(Material.sand).setBlockName("ash_digamma").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setResistance(150.0F).setBlockTextureName(RefStrings.MODID + ":ash_digamma"); sand_boron = new BlockFalling(Material.sand).setBlockName("sand_boron").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_boron"); sand_lead = new BlockFalling(Material.sand).setBlockName("sand_lead").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.machineTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_lead"); @@ -1621,13 +1624,13 @@ public class ModBlocks { glass_polonium = new BlockNTMGlassCT(1, RefStrings.MODID + ":glass_polonium", Material.glass).setBlockName("glass_polonium").setLightLevel(5F/15F).setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F); glass_ash = new BlockNTMGlassCT(1, RefStrings.MODID + ":glass_ash", Material.glass).setBlockName("glass_ash").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(3F); glass_quartz = new BlockNTMGlassCT(0, RefStrings.MODID + ":glass_quartz", Material.packedIce, true).setBlockName("glass_quartz").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGlass).setHardness(1.0F).setResistance(40.0F).setBlockTextureName(RefStrings.MODID + "glass_quartz"); - + mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush"); mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin"); mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem"); glyphid_base = new BlockGlyphid(Material.coral).setBlockName("glyphid_base").setStepSound(Block.soundTypeCloth).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":glyphid_base"); glyphid_spawner = new BlockGlyphidSpawner(Material.coral).setBlockName("glyphid_spawner").setStepSound(Block.soundTypeCloth).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":glyphid_eggs_alt"); - + plant_flower = new BlockNTMFlower().setBlockName("plant_flower").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F); plant_tall = new BlockTallPlant().setBlockName("plant_tall").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F); plant_dead = new BlockDeadPlant().setBlockName("plant_dead").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F); @@ -1649,17 +1652,17 @@ public class ModBlocks { sand_boron_layer = new BlockLayering(Material.sand).setBlockName("sand_boron_layer").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":sand_boron"); leaves_layer = new BlockLayering(Material.leaves).setBlockName("leaves_layer").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":waste_leaves"); oil_spill = new BlockLayering(Material.ground).setBlockName("oil_spill").setStepSound(Block.soundTypeSnow).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":oil_spill"); - + burning_earth = new WasteEarth(Material.ground, true).setBlockName("burning_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":burning_earth"); tektite = new BlockGeneric(Material.sand).setBlockName("tektite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":tektite"); ore_tektite_osmiridium = new BlockGeneric(Material.sand).setBlockName("ore_tektite_osmiridium").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":ore_tektite_osmiridium"); - impact_dirt = new BlockDirt(Material.ground, true).setBlockName("impact_dirt").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":waste_earth_bottom"); + impact_dirt = new BlockDirt(Material.ground, true).setBlockName("impact_dirt").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":waste_earth_bottom"); dirt_dead = new BlockFalling(Material.ground).setBlockName("dirt_dead").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":dirt_dead"); dirt_oily = new BlockFalling(Material.ground).setBlockName("dirt_oily").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":dirt_oily"); sand_dirty = new BlockFalling(Material.sand).setBlockName("sand_dirty").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_dirty"); sand_dirty_red = new BlockFalling(Material.sand).setBlockName("sand_dirty_red").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":sand_dirty_red"); stone_cracked = new BlockFalling(Material.rock).setBlockName("stone_cracked").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":stone_cracked"); - + sellafield_slaked = new BlockSellafieldSlaked(Material.rock).setBlockName("sellafield_slaked").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_slaked"); sellafield_bedrock = new BlockSellafieldSlaked(Material.rock).setBlockName("sellafield_bedrock").setBlockUnbreakable().setResistance(6000000.0F).setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sellafield_slaked"); sellafield = new BlockSellafield(Material.rock).setBlockName("sellafield").setStepSound(Block.soundTypeStone).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":sellafield_0"); @@ -1668,12 +1671,12 @@ public class ModBlocks { ore_sellafield_uranium_scorched = new BlockSellafieldOre(Material.rock).setBlockName("ore_sellafield_uranium_scorched").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":ore_overlay_uranium_scorched"); ore_sellafield_schrabidium = new BlockSellafieldOre(Material.rock).setBlockName("ore_sellafield_schrabidium").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":ore_overlay_schrabidium"); ore_sellafield_radgem = new BlockSellafieldOre(Material.rock).setBlockName("ore_sellafield_radgem").setStepSound(Block.soundTypeStone).setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setBlockTextureName(RefStrings.MODID + ":ore_overlay_radgem"); - + geysir_water = new BlockGeysir(Material.rock).setBlockName("geysir_water").setStepSound(Block.soundTypeStone).setHardness(5.0F); geysir_chlorine = new BlockGeysir(Material.rock).setBlockName("geysir_chlorine").setStepSound(Block.soundTypeStone).setHardness(5.0F); geysir_vapor = new BlockGeysir(Material.rock).setBlockName("geysir_vapor").setStepSound(Block.soundTypeStone).setHardness(5.0F); geysir_nether = new BlockGeysir(Material.rock).setBlockName("geysir_nether").setLightLevel(1.0F).setStepSound(Block.soundTypeStone).setHardness(2.0F); - + nuke_gadget = new NukeGadget(Material.iron).setBlockName("nuke_gadget").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":theGadget"); nuke_boy = new NukeBoy(Material.iron).setBlockName("nuke_boy").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":lilBoy"); nuke_man = new NukeMan(Material.iron).setBlockName("nuke_man").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":fatMan"); @@ -1685,9 +1688,9 @@ public class ModBlocks { nuke_solinium = new NukeSolinium(Material.iron).setBlockName("nuke_solinium").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":nuke_solinium"); nuke_n2 = new NukeN2(Material.iron).setBlockName("nuke_n2").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":nuke_n2"); nuke_fstbmb = new NukeBalefire(Material.iron).setBlockName("nuke_fstbmb").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":nuke_fstbmb"); - + bomb_multi = new BombMulti(Material.iron).setBlockName("bomb_multi").setCreativeTab(MainRegistry.nukeTab).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":bomb_multi1"); - + flame_war = new BombFlameWar(Material.iron).setBlockName("flame_war").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F).setBlockTextureName(RefStrings.MODID + ":flame_war"); float_bomb = new BombFloat(Material.iron).setBlockName("float_bomb").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F); therm_endo = new BombThermo(Material.iron).setBlockName("therm_endo").setCreativeTab(MainRegistry.nukeTab).setHardness(5.0F).setResistance(200.0F); @@ -1721,14 +1724,14 @@ public class ModBlocks { pump_steam = new MachinePump().setBlockName("pump_steam").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper"); pump_electric = new MachinePump().setBlockName("pump_electric").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + heater_firebox = new HeaterFirebox().setBlockName("heater_firebox").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); heater_oven = new HeaterOven().setBlockName("heater_oven").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); heater_oilburner = new HeaterOilburner().setBlockName("heater_oilburner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); heater_electric = new HeaterElectric().setBlockName("heater_electric").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); heater_heatex = new HeaterHeatex().setBlockName("heater_heatex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_ashpit = new MachineAshpit().setBlockName("machine_ashpit").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName("stonebrick"); - + furnace_iron = new FurnaceIron().setBlockName("furnace_iron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_aluminium"); furnace_steel = new FurnaceSteel().setBlockName("furnace_steel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); furnace_combination = new FurnaceCombination().setBlockName("furnace_combination").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_light_alt"); @@ -1740,7 +1743,7 @@ public class ModBlocks { machine_crucible = new MachineCrucible().setBlockName("machine_crucible").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); machine_boiler = new MachineHeatBoiler().setBlockName("machine_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper"); machine_industrial_boiler = new MachineHeatBoilerIndustrial().setBlockName("machine_industrial_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + foundry_mold = new FoundryMold().setBlockName("foundry_mold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); foundry_basin = new FoundryBasin().setBlockName("foundry_basin").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); foundry_channel = new FoundryChannel().setBlockName("foundry_channel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); @@ -1748,24 +1751,24 @@ public class ModBlocks { foundry_outlet = new FoundryOutlet().setBlockName("foundry_outlet").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); foundry_slagtap = new FoundrySlagtap().setBlockName("foundry_slagtap").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); slag = new BlockDynamicSlag().setBlockName("slag").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":slag"); - + machine_difurnace_off = new MachineDiFurnace(false).setBlockName("machine_difurnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_difurnace_on = new MachineDiFurnace(true).setBlockName("machine_difurnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F); machine_difurnace_extension = new MachineDiFurnaceExtension().setBlockName("machine_difurnace_extension").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_difurnace_rtg_off = new MachineDiFurnaceRTG(false).setBlockName("machine_difurnace_rtg_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_difurnace_rtg_on = new MachineDiFurnaceRTG(true).setBlockName("machine_difurnace_rtg_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(2.0F).setCreativeTab(null); - + machine_centrifuge = new MachineCentrifuge(Material.iron).setBlockName("machine_centrifuge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_gascent = new MachineGasCent(Material.iron).setBlockName("machine_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_fel = new MachineFEL(Material.iron).setBlockName("machine_fel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_silex = new MachineSILEX(Material.iron).setBlockName("machine_silex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_rotary_furnace = new MachineRotaryFurnace(Material.iron).setBlockName("machine_rotary_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_fire"); machine_crystallizer = new MachineCrystallizer(Material.iron).setBlockName("machine_crystallizer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_crystallizer"); - + machine_uf6_tank = new MachineUF6Tank(Material.iron).setBlockName("machine_uf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); - + machine_puf6_tank = new MachinePuF6Tank(Material.iron).setBlockName("machine_puf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); - + machine_reactor_breeding = new MachineReactorBreeding(Material.iron).setBlockName("machine_reactor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_reactor"); machine_furnace_brick_off = new MachineBrickFurnace(false).setBlockName("machine_furnace_brick_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); @@ -1807,7 +1810,7 @@ public class ModBlocks { hadron_access = new BlockHadronAccess(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_access").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_access"); hadron_core = new BlockHadronCore(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_core"); hadron_cooler = new BlockHadronCooler(Material.iron).setBlockName("hadron_cooler").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F); - + machine_electric_furnace_off = new MachineElectricFurnace(false).setBlockName("machine_electric_furnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_electric_furnace_on = new MachineElectricFurnace(true).setBlockName("machine_electric_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F); machine_arc_furnace_off = new MachineArcFurnace(false).setBlockName("machine_arc_furnace_off").setHardness(5.0F).setResistance(10.0F); @@ -1821,14 +1824,14 @@ public class ModBlocks { machine_schrabidium_battery = new MachineBattery(Material.iron, 25_000_000_000L).setBlockName("machine_schrabidium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_dineutronium_battery = new MachineBattery(Material.iron, 1_000_000_000_000L).setBlockName("machine_dineutronium_battery").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_fensu = new MachineFENSU(Material.iron).setBlockName("machine_fensu").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_fensu"); - + capacitor_bus = new MachineCapacitorBus(Material.iron).setBlockName("capacitor_bus").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); capacitor_copper = new MachineCapacitor(Material.iron, 1_000_000L, "copper").setBlockName("capacitor_copper").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_copper"); capacitor_gold = new MachineCapacitor(Material.iron, 5_000_000L, "gold").setBlockName("capacitor_gold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName("gold_block"); capacitor_niobium = new MachineCapacitor(Material.iron, 25_000_000L, "niobium").setBlockName("capacitor_niobium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_niobium"); capacitor_tantalium = new MachineCapacitor(Material.iron, 150_000_000L, "tantalium").setBlockName("capacitor_tantalium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_tantalium"); capacitor_schrabidate = new MachineCapacitor(Material.iron, 50_000_000_000L, "schrabidate").setBlockName("capacitor_schrabidate").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_schrabidate"); - + machine_wood_burner = new MachineWoodBurner(Material.iron).setBlockName("machine_wood_burner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_diesel = new MachineDiesel().setBlockName("machine_diesel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_combustion_engine = new MachineCombustionEngine().setBlockName("machine_combustion_engine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); @@ -1877,7 +1880,7 @@ public class ModBlocks { radio_torch_counter = new RadioTorchCounter().setBlockName("radio_torch_counter").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtty_counter"); radio_torch_logic = new RadioTorchLogic().setBlockName("radio_torch_logic").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); radio_telex = new RadioTelex().setBlockName("radio_telex").setHardness(3F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radio_telex"); - + conveyor = new BlockConveyor().setBlockName("conveyor").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor"); conveyor_express = new BlockConveyorExpress().setBlockName("conveyor_express").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor_express"); //conveyor_classic = new BlockConveyorClassic().setBlockName("conveyor_classic").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor"); @@ -1895,14 +1898,14 @@ public class ModBlocks { crane_partitioner = new CranePartitioner().setBlockName("crane_partitioner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":crane_partitioner_side"); fan = new MachineFan().setBlockName("fan").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); piston_inserter = new PistonInserter().setBlockName("piston_inserter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + drone_waypoint = new DroneWaypoint().setBlockName("drone_waypoint").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_waypoint"); drone_crate = new DroneCrate().setBlockName("drone_crate").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); drone_waypoint_request = new DroneWaypointRequest().setBlockName("drone_waypoint_request").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_waypoint_request"); drone_dock = new DroneDock().setBlockName("drone_dock").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_dock"); drone_crate_provider = new DroneDock().setBlockName("drone_crate_provider").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_crate_provider"); drone_crate_requester = new DroneDock().setBlockName("drone_crate_requester").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":drone_crate_requester"); - + chain = new BlockChain(Material.iron).setBlockName("dungeon_chain").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":chain"); ladder_sturdy = new BlockNTMLadder().setBlockName("ladder_sturdy").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_sturdy"); @@ -1915,7 +1918,7 @@ public class ModBlocks { ladder_cobalt = new BlockNTMLadder().setBlockName("ladder_cobalt").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_cobalt"); ladder_steel = new BlockNTMLadder().setBlockName("ladder_steel").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_steel"); ladder_tungsten = new BlockNTMLadder().setBlockName("ladder_tungsten").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_tungsten"); - + barrel_plastic = new BlockFluidBarrel(Material.iron, 12000).setBlockName("barrel_plastic").setStepSound(Block.soundTypeStone).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_plastic"); barrel_corroded = new BlockFluidBarrel(Material.iron, 6000).setBlockName("barrel_corroded").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_corroded"); barrel_iron = new BlockFluidBarrel(Material.iron, 8000).setBlockName("barrel_iron").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_iron"); @@ -1927,14 +1930,14 @@ public class ModBlocks { machine_transformer_dnt = new MachineTransformer(Material.iron, 1000000000000000L, 1).setBlockName("machine_transformer_dnt").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer"); machine_transformer_20 = new MachineTransformer(Material.iron, 10000L, 20).setBlockName("machine_transformer_20").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer_iron"); machine_transformer_dnt_20 = new MachineTransformer(Material.iron, 1000000000000000L, 20).setBlockName("machine_transformer_dnt_20").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer"); - + machine_satlinker = new MachineSatLinker(Material.iron).setBlockName("machine_satlinker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_satlinker_side"); machine_keyforge = new MachineKeyForge(Material.iron).setBlockName("machine_keyforge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":machine_keyforge_side"); machine_armor_table = new BlockArmorTable(Material.iron).setBlockName("machine_armor_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab); machine_solar_boiler = new MachineSolarBoiler(Material.iron).setBlockName("machine_solar_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_solar_boiler"); solar_mirror = new SolarMirror(Material.iron).setBlockName("solar_mirror").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":solar_mirror"); - + struct_launcher = new BlockGeneric(Material.iron).setBlockName("struct_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":struct_launcher"); struct_scaffold = new BlockGeneric(Material.iron).setBlockName("struct_scaffold").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":struct_scaffold"); struct_launcher_core = new BlockStruct(Material.iron).setBlockName("struct_launcher_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":struct_launcher_core"); @@ -1944,7 +1947,7 @@ public class ModBlocks { struct_plasma_core = new BlockPlasmaStruct(Material.iron).setBlockName("struct_plasma_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_plasma_core"); struct_watz_core = new BlockWatzStruct(Material.iron).setBlockName("struct_watz_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_watz_core"); struct_icf_core = new BlockICFStruct(Material.iron).setBlockName("struct_icf_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_icf_core"); - + factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull"); factory_advanced_hull = new BlockGeneric(Material.iron).setBlockName("factory_advanced_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_advanced_hull"); @@ -1979,7 +1982,7 @@ public class ModBlocks { plasma = new BlockPlasma(Material.iron).setBlockName("plasma").setHardness(5.0F).setResistance(6000.0F).setLightLevel(1.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":plasma"); iter = new MachineITER().setBlockName("iter").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":iter"); plasma_heater = new MachinePlasmaHeater().setBlockName("plasma_heater").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":plasma_heater"); - + machine_icf_press = new MachineICFPress().setBlockName("machine_icf_press").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); icf = new MachineICF().setBlockName("icf").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); icf_component = new BlockICFComponent().setBlockName("icf_component").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":icf_component"); @@ -1992,7 +1995,7 @@ public class ModBlocks { watz_end = new BlockToolConversion(Material.iron).addVariant("_bolted").setBlockName("watz_end").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_casing"); watz = new Watz().setBlockName("watz").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); watz_pump = new WatzPump().setBlockName("watz_pump").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + balefire = new Balefire().setBlockName("balefire").setHardness(0.0F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":balefire"); fire_digamma = new DigammaFlame().setBlockName("fire_digamma").setHardness(0.0F).setResistance(150F).setLightLevel(1.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fire_digamma"); digamma_matter = new DigammaMatter().setBlockName("digamma_matter").setBlockUnbreakable().setResistance(18000000).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":digamma_matter"); @@ -2009,7 +2012,7 @@ public class ModBlocks { seal_frame = new BlockGeneric(Material.iron).setBlockName("seal_frame").setHardness(10.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":seal_frame"); seal_controller = new BlockSeal(Material.iron).setBlockName("seal_controller").setHardness(10.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab); seal_hatch = new BlockHatch(Material.iron).setBlockName("seal_hatch").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":seal_hatch_3"); - + vault_door = new VaultDoor(Material.iron).setBlockName("vault_door").setHardness(10.0F).setResistance(1_000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vault_door"); blast_door = new BlastDoor(Material.iron).setBlockName("blast_door").setHardness(10.0F).setResistance(1_000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":blast_door"); @@ -2038,9 +2041,9 @@ public class ModBlocks { barbed_wire_wither = new BarbedWire(Material.iron).setBlockName("barbed_wire_wither").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":barbed_wire_wither_model"); barbed_wire_ultradeath = new BarbedWire(Material.iron).setBlockName("barbed_wire_ultradeath").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":barbed_wire_ultradeath_model"); spikes = new Spikes(Material.iron).setBlockName("spikes").setHardness(2.5F).setResistance(5.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":spikes"); - + charger = new Charger(Material.iron).setBlockName("charger").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + tesla = new MachineTesla(Material.iron).setBlockName("tesla").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":tesla"); launch_pad = new LaunchPad(Material.iron).setBlockName("launch_pad").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":launch_pad"); @@ -2054,18 +2057,18 @@ public class ModBlocks { compact_launcher = new CompactLauncher(Material.iron).setBlockName("compact_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":compact_launcher"); launch_table = new LaunchTable(Material.iron).setBlockName("launch_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":launch_table"); soyuz_launcher = new SoyuzLauncher(Material.iron).setBlockName("soyuz_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":soyuz_launcher"); - + sat_mapper = new DecoBlock(Material.iron).setBlockName("sat_mapper").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_mapper"); sat_radar = new DecoBlock(Material.iron).setBlockName("sat_radar").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_radar"); sat_scanner = new DecoBlock(Material.iron).setBlockName("sat_scanner").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_scanner"); sat_laser = new DecoBlock(Material.iron).setBlockName("sat_laser").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_laser"); sat_foeq = new DecoBlock(Material.iron).setBlockName("sat_foeq").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_foeq"); sat_resonator = new DecoBlock(Material.iron).setBlockName("sat_resonator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":sat_resonator"); - + sat_dock = new MachineSatDock(Material.iron).setBlockName("sat_dock").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":sat_dock"); soyuz_capsule = new SoyuzCapsule(Material.iron).setBlockName("soyuz_capsule").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":soyuz_capsule"); crate_supply = new BlockSupplyCrate(Material.wood).setBlockName("crate_supply").setStepSound(Block.soundTypeWood).setHardness(1.0F).setResistance(2.5F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":crate_can"); - + turret_chekhov = new TurretChekhov(Material.iron).setBlockName("turret_chekhov").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); turret_friendly = new TurretFriendly(Material.iron).setBlockName("turret_friendly").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); turret_jeremy = new TurretJeremy(Material.iron).setBlockName("turret_jeremy").setHardness(5.0F).setResistance(600.0F).setCreativeTab(MainRegistry.weaponTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); @@ -2105,9 +2108,9 @@ public class ModBlocks { pribris_burning = new RBMKDebrisBurning().setBlockName("pribris_burning").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris_burning"); pribris_radiating = new RBMKDebrisRadiating().setBlockName("pribris_radiating").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris_radiating"); pribris_digamma = new RBMKDebrisDigamma().setBlockName("pribris_digamma").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris_digamma"); - + book_guide = new Guide(Material.iron).setBlockName("book_guide").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.nukeTab); - + rail_wood = new RailGeneric().setMaxSpeed(0.2F).setBlockName("rail_wood").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_wood"); rail_narrow = new RailGeneric().setBlockName("rail_narrow").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_narrow"); rail_highspeed = new RailGeneric().setMaxSpeed(1F).setFlexible(false).setBlockName("rail_highspeed").setHardness(5.0F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabTransport).setBlockTextureName(RefStrings.MODID + ":rail_highspeed"); @@ -2139,7 +2142,7 @@ public class ModBlocks { crate_template = new BlockStorageCrate(Material.iron).setBlockName("crate_template").setStepSound(Block.soundTypeMetal).setHardness(7.5F).setResistance(300.0F).setCreativeTab(MainRegistry.machineTab); safe = new BlockStorageCrate(Material.iron).setBlockName("safe").setStepSound(Block.soundTypeMetal).setHardness(7.5F).setResistance(10000.0F).setCreativeTab(MainRegistry.machineTab); mass_storage = new BlockMassStorage().setBlockName("mass_storage").setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); - + boxcar = new DecoBlock(Material.iron).setBlockName("boxcar").setStepSound(Block.soundTypeMetal).setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":boxcar"); boat = new DecoBlock(Material.iron).setBlockName("boat").setStepSound(Block.soundTypeMetal).setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":boat"); @@ -2188,7 +2191,7 @@ public class ModBlocks { machine_controller = new MachineReactorControl(Material.iron).setBlockName("machine_controller").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null); machine_boiler_off = new MachineBoiler(false).setBlockName("machine_boiler_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_boiler_off"); - + machine_steam_engine = new MachineSteamEngine().setBlockName("machine_steam_engine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_turbine = new MachineTurbine(Material.iron).setBlockName("machine_turbine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_turbine"); machine_large_turbine = new MachineLargeTurbine(Material.iron).setBlockName("machine_large_turbine").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_large_turbine"); @@ -2197,19 +2200,19 @@ public class ModBlocks { machine_tower_small = new MachineTowerSmall(Material.iron).setBlockName("machine_tower_small").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_concrete"); machine_tower_large = new MachineTowerLarge(Material.iron).setBlockName("machine_tower_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":concrete"); machine_condenser_powered = new MachineCondenserPowered(Material.iron).setBlockName("machine_condenser_powered").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine"); - + machine_deuterium_extractor = new MachineDeuteriumExtractor(Material.iron).setBlockName("machine_deuterium_extractor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_deuterium_extractor_side"); machine_deuterium_tower = new DeuteriumTower(Material.iron).setBlockName("machine_deuterium_tower").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":concrete"); - + machine_liquefactor = new MachineLiquefactor().setBlockName("machine_liquefactor").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine"); machine_solidifier = new MachineSolidifier().setBlockName("machine_solidifier").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine"); machine_compressor = new MachineCompressor().setBlockName("machine_compressor").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine"); - + machine_electrolyser = new MachineElectrolyser().setBlockName("machine_electrolyser").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine"); - + machine_autocrafter = new MachineAutocrafter().setBlockName("machine_autocrafter").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab); machine_funnel = new MachineFunnel().setBlockName("machine_funnel").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab); - + anvil_iron = new NTMAnvil(Material.iron, NTMAnvil.TIER_IRON).setBlockName("anvil_iron").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_iron"); anvil_lead = new NTMAnvil(Material.iron, NTMAnvil.TIER_IRON).setBlockName("anvil_lead").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_lead"); anvil_steel = new NTMAnvil(Material.iron, NTMAnvil.TIER_STEEL).setBlockName("anvil_steel").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_steel"); @@ -2222,20 +2225,20 @@ public class ModBlocks { anvil_dnt = new NTMAnvil(Material.iron, NTMAnvil.TIER_PARTICLE).setBlockName("anvil_dnt").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_dnt"); anvil_osmiridium = new NTMAnvil(Material.iron, NTMAnvil.TIER_GERALD).setBlockName("anvil_osmiridium").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_osmiridium"); anvil_murky = new NTMAnvil(Material.iron, 1916169).setBlockName("anvil_murky").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_steel"); - + machine_waste_drum = new WasteDrum(Material.iron).setBlockName("machine_waste_drum").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":waste_drum"); machine_storage_drum = new StorageDrum(Material.iron).setBlockName("machine_storage_drum").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_storage_drum"); machine_schrabidium_transmutator = new MachineSchrabidiumTransmutator(Material.iron).setBlockName("machine_schrabidium_transmutator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab); machine_siren = new MachineSiren(Material.iron).setBlockName("machine_siren").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_siren"); - + machine_spp_bottom = new SPPBottom(Material.iron).setBlockName("machine_spp_bottom").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); machine_spp_top = new SPPTop(Material.iron).setBlockName("machine_spp_top").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); - + radiobox = new Radiobox(Material.iron).setBlockName("radiobox").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radiobox"); radiorec = new RadioRec(Material.iron).setBlockName("radiorec").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radiorec"); - + machine_forcefield = new MachineForceField(Material.iron).setBlockName("machine_forcefield").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_forcefield"); cheater_virus = new CheaterVirus(Material.iron).setBlockName("cheater_virus").setHardness(Float.POSITIVE_INFINITY).setResistance(Float.POSITIVE_INFINITY).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":cheater_virus"); @@ -2250,7 +2253,7 @@ public class ModBlocks { vent_pink_cloud = new BlockVent(Material.iron).setBlockName("vent_pink_cloud").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vent_pink_cloud"); vent_chlorine_seal = new BlockClorineSeal(Material.iron).setBlockName("vent_chlorine_seal").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab); chlorine_gas = new BlockGasClorine().setBlockName("chlorine_gas").setHardness(0.0F).setResistance(0.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":chlorine_gas"); - + gas_radon = new BlockGasRadon().setBlockName("gas_radon").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_radon"); gas_radon_dense = new BlockGasRadonDense().setBlockName("gas_radon_dense").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_radon_dense"); gas_radon_tomb = new BlockGasRadonTomb().setBlockName("gas_radon_tomb").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_radon_tomb"); @@ -2268,7 +2271,7 @@ public class ModBlocks { absorber_pink = new BlockAbsorber(Material.iron, 10000F).setBlockName("absorber_pink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_pink"); decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side"); transission_hatch = new BlockTransission(Material.iron).setBlockName("transission_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":transission_hatch"); - + volcano_core = new BlockVolcano().setBlockName("volcano_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_core"); volcano_rad_core = new BlockVolcano().setBlockName("volcano_rad_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_rad_core"); @@ -2305,7 +2308,7 @@ public class ModBlocks { sulfuric_acid_fluid = new GenericFluid("sulfuric_acid_fluid").setDensity(1840).setViscosity(1000).setTemperature(273); FluidRegistry.registerFluid(sulfuric_acid_fluid); sulfuric_acid_block = new GenericFluidBlock(sulfuric_acid_fluid, Material.water, "sulfuric_acid_still", "sulfuric_acid_flowing").setDamage(ModDamageSource.acid, 5F).setBlockName("sulfuric_acid_block").setResistance(500F); - + Fluid liquidConcrete = new GenericFluid("concrete_liquid").setViscosity(2000); concrete_liquid = new GenericFiniteFluid(liquidConcrete, Material.rock, "concrete_liquid", "concrete_liquid_flowing").setQuantaPerBlock(4).setBlockName("concrete_liquid").setResistance(500F); @@ -2316,7 +2319,7 @@ public class ModBlocks { dummy_plate_launch_table = new DummyBlockMachine(Material.iron, launch_table, false).setBounds(0, 16, 0, 16, 16, 16).setBlockName("dummy_plate_launch_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_port_launch_table = new DummyBlockMachine(Material.iron, launch_table, true).setBlockName("dummy_port_launch_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); dummy_plate_cargo = new DummyBlockMachine(Material.iron, sat_dock, false).setBounds(0, 0, 0, 16, 8, 16).setBlockName("dummy_plate_cargo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel"); - + ntm_dirt = new BlockNTMDirt().setBlockName("ntm_dirt").setHardness(0.5F).setStepSound(Block.soundTypeGravel).setCreativeTab(null).setBlockTextureName("dirt"); pink_log = new BlockPinkLog().setBlockName("pink_log").setHardness(0.5F).setStepSound(Block.soundTypeWood).setCreativeTab(null); @@ -2353,27 +2356,27 @@ public class ModBlocks { GameRegistry.registerBlock(ore_lignite, ore_lignite.getUnlocalizedName()); GameRegistry.registerBlock(ore_asbestos, ore_asbestos.getUnlocalizedName()); GameRegistry.registerBlock(ore_schrabidium, ItemBlockLore.class, ore_schrabidium.getUnlocalizedName()); - + //Rare Minerals GameRegistry.registerBlock(ore_australium, ItemOreBlock.class, ore_australium.getUnlocalizedName()); GameRegistry.registerBlock(ore_rare, ItemOreBlock.class, ore_rare.getUnlocalizedName()); GameRegistry.registerBlock(ore_cobalt, ore_cobalt.getUnlocalizedName()); GameRegistry.registerBlock(ore_cinnebar, ore_cinnebar.getUnlocalizedName()); GameRegistry.registerBlock(ore_coltan, ore_coltan.getUnlocalizedName()); - + //Stone clusters GameRegistry.registerBlock(cluster_iron, ItemBlockBase.class, cluster_iron.getUnlocalizedName()); GameRegistry.registerBlock(cluster_titanium, ItemBlockBase.class, cluster_titanium.getUnlocalizedName()); GameRegistry.registerBlock(cluster_aluminium, ItemBlockBase.class, cluster_aluminium.getUnlocalizedName()); GameRegistry.registerBlock(cluster_copper, ItemBlockBase.class, cluster_copper.getUnlocalizedName()); - + //Bedrock ores GameRegistry.registerBlock(ore_bedrock_oil, ore_bedrock_oil.getUnlocalizedName()); - + //Nice Meme GameRegistry.registerBlock(ore_coal_oil, ore_coal_oil.getUnlocalizedName()); GameRegistry.registerBlock(ore_coal_oil_burning, ore_coal_oil_burning.getUnlocalizedName()); - + //Nether Ores GameRegistry.registerBlock(ore_nether_coal, ore_nether_coal.getUnlocalizedName()); GameRegistry.registerBlock(ore_nether_smoldering, ore_nether_smoldering.getUnlocalizedName()); @@ -2385,10 +2388,10 @@ public class ModBlocks { GameRegistry.registerBlock(ore_nether_fire, ore_nether_fire.getUnlocalizedName()); GameRegistry.registerBlock(ore_nether_cobalt, ore_nether_cobalt.getUnlocalizedName()); GameRegistry.registerBlock(ore_nether_schrabidium, ItemBlockLore.class, ore_nether_schrabidium.getUnlocalizedName()); - + //Meteor Ores register(ore_meteor); - + //Gneiss Ores GameRegistry.registerBlock(ore_gneiss_iron, ore_gneiss_iron.getUnlocalizedName()); GameRegistry.registerBlock(ore_gneiss_gold, ore_gneiss_gold.getUnlocalizedName()); @@ -2400,7 +2403,7 @@ public class ModBlocks { GameRegistry.registerBlock(ore_gneiss_schrabidium, ItemBlockLore.class, ore_gneiss_schrabidium.getUnlocalizedName()); GameRegistry.registerBlock(ore_gneiss_rare, ItemOreBlock.class, ore_gneiss_rare.getUnlocalizedName()); GameRegistry.registerBlock(ore_gneiss_gas, ore_gneiss_gas.getUnlocalizedName()); - + //Depth ores GameRegistry.registerBlock(ore_depth_cinnebar, ItemBlockBase.class, ore_depth_cinnebar.getUnlocalizedName()); GameRegistry.registerBlock(ore_depth_zirconium, ItemBlockBase.class, ore_depth_zirconium.getUnlocalizedName()); @@ -2409,30 +2412,30 @@ public class ModBlocks { GameRegistry.registerBlock(cluster_depth_titanium, ItemBlockBase.class, cluster_depth_titanium.getUnlocalizedName()); GameRegistry.registerBlock(cluster_depth_tungsten, ItemBlockBase.class, cluster_depth_tungsten.getUnlocalizedName()); GameRegistry.registerBlock(ore_alexandrite, ItemBlockBase.class, ore_alexandrite.getUnlocalizedName()); - + //Nether depth ores GameRegistry.registerBlock(ore_depth_nether_neodymium, ItemBlockBase.class, ore_depth_nether_neodymium.getUnlocalizedName()); - + //Basalt ores register(ore_basalt); - + //End Ores GameRegistry.registerBlock(ore_tikite, ore_tikite.getUnlocalizedName()); - + //Bedrock ore register(ore_bedrock); register(ore_volcano); - + //Secret register(stone_keyhole); register(stone_keyhole_meta); - + //Resource-bearing Stones register(stone_resource); register(stalagmite); register(stalactite); register(stone_biome); - + //Stone Variants GameRegistry.registerBlock(stone_porous, stone_porous.getUnlocalizedName()); GameRegistry.registerBlock(stone_gneiss, stone_gneiss.getUnlocalizedName()); @@ -2452,7 +2455,7 @@ public class ModBlocks { GameRegistry.registerBlock(basalt_polished, basalt_polished.getUnlocalizedName()); GameRegistry.registerBlock(basalt_tiles, basalt_tiles.getUnlocalizedName()); //GameRegistry.registerBlock(stone_deep_cobble, ItemBlockBase.class, stone_deep_cobble.getUnlocalizedName()); - + //Blocks GameRegistry.registerBlock(block_uranium, block_uranium.getUnlocalizedName()); GameRegistry.registerBlock(block_u233, block_u233.getUnlocalizedName()); @@ -2552,7 +2555,7 @@ public class ModBlocks { GameRegistry.registerBlock(block_c4, block_c4.getUnlocalizedName()); GameRegistry.registerBlock(block_smore, block_smore.getUnlocalizedName()); GameRegistry.registerBlock(block_slag, block_slag.getUnlocalizedName()); - + //Deco Blocks GameRegistry.registerBlock(deco_titanium, deco_titanium.getUnlocalizedName()); GameRegistry.registerBlock(deco_red_copper, deco_red_copper.getUnlocalizedName()); @@ -2571,11 +2574,11 @@ public class ModBlocks { GameRegistry.registerBlock(plushie, ItemBlockBase.class, plushie.getUnlocalizedName()); GameRegistry.registerBlock(deco_rbmk, deco_rbmk.getUnlocalizedName()); GameRegistry.registerBlock(deco_rbmk_smooth, deco_rbmk_smooth.getUnlocalizedName()); - + //Gravel GameRegistry.registerBlock(gravel_obsidian, ItemBlockBlastInfo.class, gravel_obsidian.getUnlocalizedName()); GameRegistry.registerBlock(gravel_diamond, ItemBlockLore.class, gravel_diamond.getUnlocalizedName()); - + //Lamps GameRegistry.registerBlock(lamp_tritium_green_off, lamp_tritium_green_off.getUnlocalizedName()); GameRegistry.registerBlock(lamp_tritium_green_on, lamp_tritium_green_on.getUnlocalizedName()); @@ -2657,18 +2660,18 @@ public class ModBlocks { GameRegistry.registerBlock(brick_fire_stairs, brick_fire_stairs.getUnlocalizedName()); GameRegistry.registerBlock(ducrete_stairs, ducrete_stairs.getUnlocalizedName()); GameRegistry.registerBlock(asphalt_stairs, asphalt_stairs.getUnlocalizedName()); - + //CMB Building Elements GameRegistry.registerBlock(cmb_brick, ItemBlockBlastInfo.class, cmb_brick.getUnlocalizedName()); GameRegistry.registerBlock(cmb_brick_reinforced, ItemBlockBlastInfo.class, cmb_brick_reinforced.getUnlocalizedName()); - + //Tiles GameRegistry.registerBlock(vinyl_tile, ItemBlockBlastInfo.class, vinyl_tile.getUnlocalizedName()); //i would rather die than dip into fucking blocks with subtypes again - + GameRegistry.registerBlock(tile_lab, tile_lab.getUnlocalizedName()); GameRegistry.registerBlock(tile_lab_cracked, tile_lab_cracked.getUnlocalizedName()); GameRegistry.registerBlock(tile_lab_broken, tile_lab_broken.getUnlocalizedName()); - + //Other defensive stuff GameRegistry.registerBlock(barbed_wire, barbed_wire.getUnlocalizedName()); GameRegistry.registerBlock(barbed_wire_fire, barbed_wire_fire.getUnlocalizedName()); @@ -2678,11 +2681,11 @@ public class ModBlocks { GameRegistry.registerBlock(barbed_wire_ultradeath, barbed_wire_ultradeath.getUnlocalizedName()); GameRegistry.registerBlock(spikes, spikes.getUnlocalizedName()); GameRegistry.registerBlock(tesla, tesla.getUnlocalizedName()); - + //Charger GameRegistry.registerBlock(charger, charger.getUnlocalizedName()); //GameRegistry.registerBlock(floodlight, floodlight.getUnlocalizedName()); - + //Decoration Blocks GameRegistry.registerBlock(block_meteor, block_meteor.getUnlocalizedName()); GameRegistry.registerBlock(block_meteor_cobble, block_meteor_cobble.getUnlocalizedName()); @@ -2757,7 +2760,7 @@ public class ModBlocks { register(glyphid_base); register(glyphid_spawner); GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName()); - + //Waste GameRegistry.registerBlock(waste_earth, waste_earth.getUnlocalizedName()); GameRegistry.registerBlock(waste_mycelium, waste_mycelium.getUnlocalizedName()); @@ -2784,7 +2787,7 @@ public class ModBlocks { GameRegistry.registerBlock(tektite, tektite.getUnlocalizedName()); GameRegistry.registerBlock(ore_tektite_osmiridium, ore_tektite_osmiridium.getUnlocalizedName()); GameRegistry.registerBlock(impact_dirt, impact_dirt.getUnlocalizedName()); - + //RAD register(sellafield_slaked); register(sellafield_bedrock); @@ -2813,7 +2816,7 @@ public class ModBlocks { GameRegistry.registerBlock(nuke_n2, nuke_n2.getUnlocalizedName()); GameRegistry.registerBlock(nuke_fstbmb, nuke_fstbmb.getUnlocalizedName()); GameRegistry.registerBlock(nuke_custom, nuke_custom.getUnlocalizedName()); - + //Generic Bombs GameRegistry.registerBlock(bomb_multi, bomb_multi.getUnlocalizedName()); GameRegistry.registerBlock(crashed_balefire, crashed_balefire.getUnlocalizedName()); @@ -2823,7 +2826,7 @@ public class ModBlocks { GameRegistry.registerBlock(semtex, semtex.getUnlocalizedName()); GameRegistry.registerBlock(c4, c4.getUnlocalizedName()); register(fissure_bomb); - + //Turrets GameRegistry.registerBlock(turret_chekhov, turret_chekhov.getUnlocalizedName()); GameRegistry.registerBlock(turret_friendly, turret_friendly.getUnlocalizedName()); @@ -2839,19 +2842,19 @@ public class ModBlocks { GameRegistry.registerBlock(turret_himars, turret_himars.getUnlocalizedName()); GameRegistry.registerBlock(turret_sentry, turret_sentry.getUnlocalizedName()); GameRegistry.registerBlock(turret_sentry_damaged, turret_sentry_damaged.getUnlocalizedName()); - + //Wall-mounted Explosives GameRegistry.registerBlock(charge_dynamite, ItemBlockBase.class, charge_dynamite.getUnlocalizedName()); GameRegistry.registerBlock(charge_miner, ItemBlockBase.class, charge_miner.getUnlocalizedName()); GameRegistry.registerBlock(charge_c4, ItemBlockBase.class, charge_c4.getUnlocalizedName()); GameRegistry.registerBlock(charge_semtex, ItemBlockBase.class, charge_semtex.getUnlocalizedName()); - + //Mines GameRegistry.registerBlock(mine_ap, mine_ap.getUnlocalizedName()); GameRegistry.registerBlock(mine_shrap, mine_shrap.getUnlocalizedName()); GameRegistry.registerBlock(mine_he, mine_he.getUnlocalizedName()); GameRegistry.registerBlock(mine_fat, mine_fat.getUnlocalizedName()); - + //Block Bombs GameRegistry.registerBlock(flame_war, flame_war.getUnlocalizedName()); GameRegistry.registerBlock(float_bomb, float_bomb.getUnlocalizedName()); @@ -2868,22 +2871,22 @@ public class ModBlocks { GameRegistry.registerBlock(taint_barrel, taint_barrel.getUnlocalizedName()); GameRegistry.registerBlock(yellow_barrel, yellow_barrel.getUnlocalizedName()); GameRegistry.registerBlock(vitrified_barrel, vitrified_barrel.getUnlocalizedName()); - + //Siren GameRegistry.registerBlock(machine_siren, machine_siren.getUnlocalizedName()); - + //This Thing GameRegistry.registerBlock(broadcaster_pc, broadcaster_pc.getUnlocalizedName()); - + //Geiger Counter GameRegistry.registerBlock(geiger, geiger.getUnlocalizedName()); - + //HEV Battery GameRegistry.registerBlock(hev_battery, hev_battery.getUnlocalizedName()); - + //Chainlink Fence GameRegistry.registerBlock(fence_metal, ItemBlockBase.class, fence_metal.getUnlocalizedName()); - + //Sands, Glass GameRegistry.registerBlock(ash_digamma, ash_digamma.getUnlocalizedName()); GameRegistry.registerBlock(sand_boron, sand_boron.getUnlocalizedName()); @@ -2898,12 +2901,12 @@ public class ModBlocks { GameRegistry.registerBlock(glass_polonium, glass_polonium.getUnlocalizedName()); GameRegistry.registerBlock(glass_ash, glass_ash.getUnlocalizedName()); GameRegistry.registerBlock(glass_quartz, glass_quartz.getUnlocalizedName()); - + //Silo Hatch GameRegistry.registerBlock(seal_frame, seal_frame.getUnlocalizedName()); GameRegistry.registerBlock(seal_controller, seal_controller.getUnlocalizedName()); GameRegistry.registerBlock(seal_hatch, seal_hatch.getUnlocalizedName()); - + //Vault Door GameRegistry.registerBlock(vault_door, vault_door.getUnlocalizedName()); GameRegistry.registerBlock(blast_door, blast_door.getUnlocalizedName()); @@ -2925,7 +2928,7 @@ public class ModBlocks { GameRegistry.registerBlock(round_airlock_door, round_airlock_door.getUnlocalizedName()); GameRegistry.registerBlock(sliding_seal_door, sliding_seal_door.getUnlocalizedName()); GameRegistry.registerBlock(water_door, water_door.getUnlocalizedName()); - + //Crates register(crate_iron); register(crate_steel); @@ -2934,15 +2937,15 @@ public class ModBlocks { register(crate_template); register(safe); register(mass_storage); - + //Junk GameRegistry.registerBlock(boxcar, boxcar.getUnlocalizedName()); GameRegistry.registerBlock(boat, boat.getUnlocalizedName()); - + //Machines register(machine_autocrafter); register(machine_funnel); - + register(anvil_iron); register(anvil_lead); register(anvil_steel); @@ -2955,7 +2958,7 @@ public class ModBlocks { register(anvil_dnt); register(anvil_osmiridium); register(anvil_murky); - + GameRegistry.registerBlock(press_preheater, press_preheater.getUnlocalizedName()); GameRegistry.registerBlock(machine_press, machine_press.getUnlocalizedName()); GameRegistry.registerBlock(machine_epress, machine_epress.getUnlocalizedName()); @@ -3055,7 +3058,7 @@ public class ModBlocks { GameRegistry.registerBlock(hadron_access, hadron_access.getUnlocalizedName()); GameRegistry.registerBlock(hadron_core, hadron_core.getUnlocalizedName()); register(hadron_cooler); - + GameRegistry.registerBlock(rbmk_rod, rbmk_rod.getUnlocalizedName()); GameRegistry.registerBlock(rbmk_rod_mod, rbmk_rod_mod.getUnlocalizedName()); GameRegistry.registerBlock(rbmk_rod_reasim, rbmk_rod_reasim.getUnlocalizedName()); @@ -3081,7 +3084,7 @@ public class ModBlocks { GameRegistry.registerBlock(pribris_burning, pribris_burning.getUnlocalizedName()); GameRegistry.registerBlock(pribris_radiating, pribris_radiating.getUnlocalizedName()); GameRegistry.registerBlock(pribris_digamma, pribris_digamma.getUnlocalizedName()); - + GameRegistry.registerBlock(red_cable, red_cable.getUnlocalizedName()); GameRegistry.registerBlock(red_cable_classic, red_cable_classic.getUnlocalizedName()); GameRegistry.registerBlock(red_cable_paintable, red_cable_paintable.getUnlocalizedName()); @@ -3135,7 +3138,7 @@ public class ModBlocks { register(drone_crate_requester); register(fan); register(piston_inserter); - + GameRegistry.registerBlock(chain, chain.getUnlocalizedName()); GameRegistry.registerBlock(ladder_sturdy, ladder_sturdy.getUnlocalizedName()); GameRegistry.registerBlock(ladder_iron, ladder_iron.getUnlocalizedName()); @@ -3147,7 +3150,7 @@ public class ModBlocks { GameRegistry.registerBlock(ladder_steel, ladder_steel.getUnlocalizedName()); GameRegistry.registerBlock(ladder_lead, ladder_lead.getUnlocalizedName()); GameRegistry.registerBlock(ladder_cobalt, ladder_cobalt.getUnlocalizedName()); - + register(barrel_plastic); register(barrel_corroded); register(barrel_iron); @@ -3239,7 +3242,7 @@ public class ModBlocks { GameRegistry.registerBlock(machine_forcefield, machine_forcefield.getUnlocalizedName()); GameRegistry.registerBlock(radiorec, radiorec.getUnlocalizedName()); GameRegistry.registerBlock(radiobox, radiobox.getUnlocalizedName()); - + //Multiblock Parts GameRegistry.registerBlock(struct_launcher, struct_launcher.getUnlocalizedName()); GameRegistry.registerBlock(struct_scaffold, struct_scaffold.getUnlocalizedName()); @@ -3250,7 +3253,7 @@ public class ModBlocks { GameRegistry.registerBlock(struct_plasma_core, struct_plasma_core.getUnlocalizedName()); GameRegistry.registerBlock(struct_watz_core, struct_watz_core.getUnlocalizedName()); GameRegistry.registerBlock(struct_icf_core, struct_icf_core.getUnlocalizedName()); - + //Absorbers GameRegistry.registerBlock(absorber, absorber.getUnlocalizedName()); GameRegistry.registerBlock(absorber_red, absorber_red.getUnlocalizedName()); @@ -3258,15 +3261,15 @@ public class ModBlocks { GameRegistry.registerBlock(absorber_pink, absorber_pink.getUnlocalizedName()); GameRegistry.registerBlock(decon, decon.getUnlocalizedName()); GameRegistry.registerBlock(transission_hatch, transission_hatch.getUnlocalizedName()); - + //Solar Tower Blocks GameRegistry.registerBlock(machine_solar_boiler, machine_solar_boiler.getUnlocalizedName()); GameRegistry.registerBlock(solar_mirror, solar_mirror.getUnlocalizedName()); - + //Literal fucking garbage GameRegistry.registerBlock(factory_titanium_hull, factory_titanium_hull.getUnlocalizedName()); GameRegistry.registerBlock(factory_advanced_hull, factory_advanced_hull.getUnlocalizedName()); - + //CM stuff register(custom_machine, ItemCustomMachine.class); register(cm_block); @@ -3278,7 +3281,7 @@ public class ModBlocks { register(cm_flux); register(cm_heat); register(cm_anchor); - + //PWR register(pwr_fuel); register(pwr_control); @@ -3291,7 +3294,7 @@ public class ModBlocks { register(pwr_port); register(pwr_controller); register(pwr_block); - + //Multiblock Generators register(fusion_conductor); GameRegistry.registerBlock(fusion_center, fusion_center.getUnlocalizedName()); @@ -3307,28 +3310,28 @@ public class ModBlocks { register(watz_end); register(watz); register(watz_pump); - + register(machine_icf_press); register(icf_laser_component); register(icf_controller); register(icf_block); register(icf_component); register(icf); - + //E GameRegistry.registerBlock(balefire, balefire.getUnlocalizedName()); GameRegistry.registerBlock(fire_digamma, fire_digamma.getUnlocalizedName()); GameRegistry.registerBlock(digamma_matter, digamma_matter.getUnlocalizedName()); register(volcano_core); register(volcano_rad_core); - + //Dark Fusion Core GameRegistry.registerBlock(dfc_emitter, dfc_emitter.getUnlocalizedName()); GameRegistry.registerBlock(dfc_injector, dfc_injector.getUnlocalizedName()); GameRegistry.registerBlock(dfc_receiver, dfc_receiver.getUnlocalizedName()); GameRegistry.registerBlock(dfc_stabilizer, dfc_stabilizer.getUnlocalizedName()); GameRegistry.registerBlock(dfc_core, dfc_core.getUnlocalizedName()); - + //Missile Blocks GameRegistry.registerBlock(machine_missile_assembly, machine_missile_assembly.getUnlocalizedName()); GameRegistry.registerBlock(launch_pad, launch_pad.getUnlocalizedName()); @@ -3343,10 +3346,10 @@ public class ModBlocks { GameRegistry.registerBlock(machine_radar, machine_radar.getUnlocalizedName()); GameRegistry.registerBlock(machine_radar_large, machine_radar_large.getUnlocalizedName()); GameRegistry.registerBlock(radar_screen, radar_screen.getUnlocalizedName()); - + //Guide GameRegistry.registerBlock(book_guide, book_guide.getUnlocalizedName()); - + //Sat Blocks GameRegistry.registerBlock(sat_mapper, sat_mapper.getUnlocalizedName()); GameRegistry.registerBlock(sat_scanner, sat_scanner.getUnlocalizedName()); @@ -3354,7 +3357,7 @@ public class ModBlocks { GameRegistry.registerBlock(sat_laser, sat_laser.getUnlocalizedName()); GameRegistry.registerBlock(sat_foeq, sat_foeq.getUnlocalizedName()); GameRegistry.registerBlock(sat_resonator, sat_resonator.getUnlocalizedName()); - + //Rails GameRegistry.registerBlock(rail_wood, ItemBlockBase.class, rail_wood.getUnlocalizedName()); GameRegistry.registerBlock(rail_narrow, ItemBlockBase.class, rail_narrow.getUnlocalizedName()); @@ -3371,7 +3374,7 @@ public class ModBlocks { register(rail_large_buffer); register(rail_large_switch); register(rail_large_switch_flipped); - + //Crate GameRegistry.registerBlock(crate, crate.getUnlocalizedName()); GameRegistry.registerBlock(crate_weapon, crate_weapon.getUnlocalizedName()); @@ -3381,10 +3384,10 @@ public class ModBlocks { GameRegistry.registerBlock(crate_can, crate_can.getUnlocalizedName()); GameRegistry.registerBlock(crate_ammo, crate_ammo.getUnlocalizedName()); GameRegistry.registerBlock(crate_jungle, crate_jungle.getUnlocalizedName()); - + //ElB GameRegistry.registerBlock(statue_elb_f, statue_elb_f.getUnlocalizedName()); - + //Fluids GameRegistry.registerBlock(mud_block, mud_block.getUnlocalizedName()); GameRegistry.registerBlock(acid_block, acid_block.getUnlocalizedName()); @@ -3395,7 +3398,7 @@ public class ModBlocks { GameRegistry.registerBlock(rad_lava_block, rad_lava_block.getUnlocalizedName()); GameRegistry.registerBlock(sulfuric_acid_block, sulfuric_acid_block.getUnlocalizedName()); //GameRegistry.registerBlock(concrete_liquid, concrete_liquid.getUnlocalizedName()); - + //Multiblock Dummy Blocks GameRegistry.registerBlock(dummy_block_vault, dummy_block_vault.getUnlocalizedName()); GameRegistry.registerBlock(dummy_block_blast, dummy_block_blast.getUnlocalizedName()); @@ -3404,7 +3407,7 @@ public class ModBlocks { GameRegistry.registerBlock(dummy_plate_launch_table, dummy_plate_launch_table.getUnlocalizedName()); GameRegistry.registerBlock(dummy_port_launch_table, dummy_port_launch_table.getUnlocalizedName()); GameRegistry.registerBlock(dummy_plate_cargo, dummy_plate_cargo.getUnlocalizedName()); - + //Other Technical Blocks GameRegistry.registerBlock(oil_pipe, oil_pipe.getUnlocalizedName()); GameRegistry.registerBlock(vent_chlorine, vent_chlorine.getUnlocalizedName()); @@ -3422,7 +3425,7 @@ public class ModBlocks { GameRegistry.registerBlock(gas_flammable, gas_flammable.getUnlocalizedName()); GameRegistry.registerBlock(gas_explosive, gas_explosive.getUnlocalizedName()); GameRegistry.registerBlock(vacuum, vacuum.getUnlocalizedName()); - + //??? GameRegistry.registerBlock(crystal_virus, crystal_virus.getUnlocalizedName()); GameRegistry.registerBlock(crystal_hardened, crystal_hardened.getUnlocalizedName()); @@ -3437,15 +3440,15 @@ public class ModBlocks { GameRegistry.registerBlock(pink_double_slab, pink_double_slab.getUnlocalizedName()); GameRegistry.registerBlock(pink_stairs, pink_stairs.getUnlocalizedName()); } - + private static void register(Block b) { GameRegistry.registerBlock(b, ItemBlockBase.class, b.getUnlocalizedName()); } - + private static void register(Block b, Class clazz) { GameRegistry.registerBlock(b, clazz, b.getUnlocalizedName()); } - + public static void addRemap(String unloc, Block block, int meta) { Block remap = new BlockRemap(block, meta).setBlockName(unloc); register(remap, ItemBlockRemap.class); diff --git a/src/main/java/com/hbm/blocks/generic/BlockBobble.java b/src/main/java/com/hbm/blocks/generic/BlockBobble.java index d88c4ff23..5e5226e6f 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockBobble.java +++ b/src/main/java/com/hbm/blocks/generic/BlockBobble.java @@ -56,22 +56,22 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { public Item getItemDropped(int i, Random rand, int j) { return null; } - + @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { - + TileEntityBobble entity = (TileEntityBobble) world.getTileEntity(x, y, z); - + if(entity != null) { return new ItemStack(this, 1, entity.type.ordinal()); } - + return super.getPickBlock(target, world, x, y, z, player); } @Override public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { - + if(!player.capabilities.isCreativeMode) { harvesters.set(player); if(!world.isRemote) { @@ -87,7 +87,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { harvesters.set(null); } } - + @Override public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); @@ -96,11 +96,11 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); return true; - + } else { return true; } @@ -109,7 +109,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { - + for(int i = 1; i < BobbleType.values().length; i++) list.add(new ItemStack(item, 1, i)); } @@ -118,12 +118,12 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int meta = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; world.setBlockMetadataWithNotify(x, y, z, meta, 2); - + TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(x, y, z); bobble.type = BobbleType.values()[Math.abs(stack.getItemDamage()) % BobbleType.values().length]; bobble.markDirty(); } - + @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { float f = 0.0625F; @@ -142,7 +142,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { } public static class TileEntityBobble extends TileEntity { - + public BobbleType type = BobbleType.NONE; @Override @@ -156,7 +156,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); @@ -174,9 +174,9 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { nbt.setByte("type", (byte) type.ordinal()); } } - + public static enum BobbleType { - + NONE( "null", "null", null, null, false, ScrapType.BOARD_BLANK), STRENGTH( "Strength", "Strength", null, "It's essential to give your arguments impact.", false, ScrapType.BRIDGE_BIOS), PERCEPTION( "Perception", "Perception", null, "Only through observation will you perceive weakness.", false, ScrapType.BRIDGE_NORTH), @@ -198,7 +198,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR), DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC), CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK), - MICROWAVE( "Microwave", "Microwave", "OC Compatibility", "they call me the food heater", true, ScrapType.BOARD_CONVERTER), + MICROWAVE( "Microwave", "Microwave", "OC Compatibility and massive RBMK/packet optimizations", "they call me the food heater$john optimization", true, ScrapType.BOARD_CONVERTER), PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CARD_BOARD), MELLOW( "MELLOWARPEGGIATION", "Mellow", "Industrial lighting, animation tools", "Make something cool now, ask for permission later.", true, ScrapType.CARD_PROCESSOR); @@ -208,7 +208,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider { public String inscription; //the flavor text public boolean skinLayers; public ScrapType scrap; - + private BobbleType(String name, String label, String contribution, String inscription, boolean layers, ScrapType scrap) { this.name = name; this.label = label; diff --git a/src/main/java/com/hbm/blocks/generic/BlockEmitter.java b/src/main/java/com/hbm/blocks/generic/BlockEmitter.java index c9b09dae1..af2b35e7f 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockEmitter.java +++ b/src/main/java/com/hbm/blocks/generic/BlockEmitter.java @@ -6,13 +6,13 @@ import java.util.List; import com.hbm.blocks.ITooltipProvider; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; -import com.hbm.packet.toclient.NBTPacket; -import com.hbm.tileentity.INBTPacketReceiver; import api.hbm.block.IToolable; +import com.hbm.tileentity.TileEntityLoadedBase; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockPistonBase; @@ -41,7 +41,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityEmitter(); } - + @Override public boolean isOpaqueCube() { return false; @@ -56,12 +56,12 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) { - + if(world.isRemote) return true; - + TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z); - + if(player.getHeldItem() != null) { if(player.getHeldItem().getItem() instanceof ItemDye) { @@ -72,7 +72,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP return true; } } - + return false; } @@ -80,31 +80,31 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z); - + if(tool == ToolType.SCREWDRIVER) { te.girth += 0.125F; te.markDirty(); return true; } - + if(tool == ToolType.DEFUSER) { te.girth -= 0.125F; if(te.girth < 0.125F) te.girth = 0.125F; te.markDirty(); return true; } - + if(tool == ToolType.HAND_DRILL) { te.effect = (te.effect + 1) % te.effectCount; te.markDirty(); return true; } - + return false; } - public static class TileEntityEmitter extends TileEntity implements INBTPacketReceiver { - + public static class TileEntityEmitter extends TileEntityLoadedBase { + public static final int range = 100; public int color; public int beam; @@ -114,39 +114,39 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); - + if(worldObj.getTotalWorldTime() % 20 == 0) { for(int i = 1; i <= range; i++) { - + beam = i; - + int x = xCoord + dir.offsetX * i; int y = yCoord + dir.offsetY * i; int z = zCoord + dir.offsetZ * i; - + Block b = worldObj.getBlock(x, y, z); if(b.isBlockSolid(worldObj, x, y, z, dir.ordinal())) { break; } } } - + if(effect == 4 && beam > 0) { if(worldObj.getTotalWorldTime() % 5 == 0) { double x = (int) (xCoord + dir.offsetX * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5; double y = (int) (yCoord + dir.offsetY * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5; double z = (int) (zCoord + dir.offsetZ * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5; - + int prevColor = color; if(color == 0) { color = Color.HSBtoRGB(worldObj.getTotalWorldTime() / 50.0F, 0.5F, 0.25F) & 16777215; } - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "plasmablast"); data.setFloat("r", ((float)((color & 0xff0000) >> 16)) / 256F); @@ -168,20 +168,16 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP data.setFloat("pitch", -90); data.setFloat("yaw", 90); } - + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(worldObj.provider.dimensionId, x, y, z, 100)); - + color = prevColor; } } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("beam", this.beam); - data.setInteger("color", this.color); - data.setFloat("girth", this.girth); - data.setInteger("effect", this.effect); - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); + + networkPackNT(150); + } } @@ -191,7 +187,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); @@ -212,7 +208,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP nbt.setFloat("girth", this.girth); nbt.setInteger("effect", this.effect); } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; @@ -225,11 +221,19 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.beam = nbt.getInteger("beam"); - this.color = nbt.getInteger("color"); - this.girth = nbt.getFloat("girth"); - this.effect = nbt.getInteger("effect"); + public void serialize(ByteBuf buf) { + buf.writeInt(this.beam); + buf.writeInt(this.color); + buf.writeFloat(this.girth); + buf.writeInt(this.effect); + } + + @Override + public void deserialize(ByteBuf buf) { + this.beam = buf.readInt(); + this.color = buf.readInt(); + this.girth = buf.readFloat(); + this.effect = buf.readInt(); } } diff --git a/src/main/java/com/hbm/blocks/generic/BlockPedestal.java b/src/main/java/com/hbm/blocks/generic/BlockPedestal.java index 6ca0a2586..c6c865f3c 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockPedestal.java +++ b/src/main/java/com/hbm/blocks/generic/BlockPedestal.java @@ -143,7 +143,7 @@ public class BlockPedestal extends BlockContainer { } if(recipe.extra == recipe.extra.SUN) { - if(world.getCelestialAngle(0) > 0.15 || world.getCelestialAngle(0) < 0.85) continue; + if(world.getCelestialAngle(0) > 0.15 && world.getCelestialAngle(0) < 0.85) continue; } for(int i = 0; i < 9; i++) { diff --git a/src/main/java/com/hbm/blocks/machine/BlockICFLaserComponent.java b/src/main/java/com/hbm/blocks/machine/BlockICFLaserComponent.java index 5685fee9a..28161bb09 100644 --- a/src/main/java/com/hbm/blocks/machine/BlockICFLaserComponent.java +++ b/src/main/java/com/hbm/blocks/machine/BlockICFLaserComponent.java @@ -2,7 +2,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockEnumMulti; import com.hbm.lib.RefStrings; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; @@ -10,7 +9,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; public class BlockICFLaserComponent extends BlockEnumMulti { - + protected IIcon[] iconsTop; public BlockICFLaserComponent() { @@ -20,7 +19,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti { @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { - + Enum[] enums = theEnum.getEnumConstants(); this.icons = new IIcon[enums.length]; this.iconsTop = new IIcon[enums.length]; @@ -33,7 +32,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti { this.icons[5] = reg.registerIcon(RefStrings.MODID + ":icf_turbocharger"); this.iconsTop[4] = this.iconsTop[5] = reg.registerIcon(RefStrings.MODID + ":icf_capacitor_top"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { @@ -44,7 +43,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti { public int getSubCount() { return EnumICFPart.values().length; } - + public static enum EnumICFPart { CASING, PORT, diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockAssembler.java b/src/main/java/com/hbm/blocks/machine/DummyBlockAssembler.java index 18ae7e8d8..005858260 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockAssembler.java +++ b/src/main/java/com/hbm/blocks/machine/DummyBlockAssembler.java @@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityDummy; import com.hbm.tileentity.machine.TileEntityMachineAssembler; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,7 +25,7 @@ public class DummyBlockAssembler extends DummyOldBase { { return Item.getItemFromBlock(ModBlocks.machine_assembler); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -39,7 +38,7 @@ public class DummyBlockAssembler extends DummyOldBase { int a = ((TileEntityDummy)te).targetX; int b = ((TileEntityDummy)te).targetY; int c = ((TileEntityDummy)te).targetZ; - + TileEntityMachineAssembler entity = (TileEntityMachineAssembler) world.getTileEntity(a, b, c); if(entity != null) { diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockRefinery.java b/src/main/java/com/hbm/blocks/machine/DummyBlockRefinery.java index fbd2c14d1..1230880dd 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockRefinery.java +++ b/src/main/java/com/hbm/blocks/machine/DummyBlockRefinery.java @@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityDummy; import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,7 +25,7 @@ public class DummyBlockRefinery extends DummyOldBase { { return Item.getItemFromBlock(ModBlocks.machine_refinery); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -39,7 +38,7 @@ public class DummyBlockRefinery extends DummyOldBase { int a = ((TileEntityDummy)te).targetX; int b = ((TileEntityDummy)te).targetY; int c = ((TileEntityDummy)te).targetZ; - + TileEntityMachineRefinery entity = (TileEntityMachineRefinery) world.getTileEntity(a, b, c); if(entity != null) { diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockTurbofan.java b/src/main/java/com/hbm/blocks/machine/DummyBlockTurbofan.java index ecbdf99e1..071b7a529 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockTurbofan.java +++ b/src/main/java/com/hbm/blocks/machine/DummyBlockTurbofan.java @@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityDummy; import com.hbm.tileentity.machine.TileEntityMachineTurbofan; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,7 +25,7 @@ public class DummyBlockTurbofan extends DummyOldBase { { return Item.getItemFromBlock(ModBlocks.machine_turbofan); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -39,7 +38,7 @@ public class DummyBlockTurbofan extends DummyOldBase { int a = ((TileEntityDummy)te).targetX; int b = ((TileEntityDummy)te).targetY; int c = ((TileEntityDummy)te).targetZ; - + TileEntityMachineTurbofan entity = (TileEntityMachineTurbofan) world.getTileEntity(a, b, c); if(entity != null) { diff --git a/src/main/java/com/hbm/blocks/machine/FoundryCastingBase.java b/src/main/java/com/hbm/blocks/machine/FoundryCastingBase.java index 661bab7cd..380d4f4bf 100644 --- a/src/main/java/com/hbm/blocks/machine/FoundryCastingBase.java +++ b/src/main/java/com/hbm/blocks/machine/FoundryCastingBase.java @@ -1,9 +1,7 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - +import api.hbm.block.ICrucibleAcceptor; +import api.hbm.block.IToolable; import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.material.Mats.MaterialStack; import com.hbm.items.ModItems; @@ -12,9 +10,6 @@ import com.hbm.items.machine.ItemMold.Mold; import com.hbm.items.machine.ItemScraps; import com.hbm.tileentity.machine.TileEntityFoundryCastingBase; import com.hbm.util.I18nUtil; - -import api.hbm.block.ICrucibleAcceptor; -import api.hbm.block.IToolable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -30,6 +25,10 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public abstract class FoundryCastingBase extends BlockContainer implements ICrucibleAcceptor, IToolable, ILookOverlay { protected FoundryCastingBase() { @@ -55,30 +54,30 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack); } - + @Override public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack); } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { return true; } - + TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z); - + //remove casted item if(cast.slots[1] != null) { if(!player.inventory.addItemStackToInventory(cast.slots[1].copy())) { @@ -87,17 +86,17 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc } else { player.inventoryContainer.detectAndSendChanges(); } - + cast.slots[1] = null; cast.markDirty(); world.markBlockForUpdate(x, y, z); return true; } - + //insert mold if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.mold && cast.slots[0] == null) { Mold mold = ((ItemMold) player.getHeldItem().getItem()).getMold(player.getHeldItem()); - + if(mold.size == cast.getMoldSize()) { cast.slots[0] = player.getHeldItem().copy(); cast.slots[0].stackSize = 1; @@ -108,7 +107,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc return true; } } - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) { if(cast.amount > 0) { ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount)); @@ -125,13 +124,13 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc } return true; } - + return false; } @Override public void breakBlock(World world, int x, int y, int z, Block b, int i) { - + TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z); if(cast.amount > 0) { ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount)); @@ -139,14 +138,14 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc world.spawnEntityInWorld(item); cast.amount = 0; //just for safety } - + for(ItemStack stack : cast.slots) { if(stack != null) { EntityItem drop = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, stack.copy()); world.spawnEntityInWorld(drop); } } - + super.breakBlock(world, x, y, z, b, i); } @@ -154,7 +153,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random rand) { super.randomDisplayTick(world, x, y, z, rand); - + TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z); if(cast.amount > 0 && cast.amount >= cast.getCapacity()) { @@ -164,28 +163,28 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc @Override public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { - + if(tool != ToolType.SCREWDRIVER) return false; - + TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z); - + if(cast.slots[0] == null) return false; if(cast.amount > 0) return false; - + if(!player.inventory.addItemStackToInventory(cast.slots[0].copy())) { EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, cast.slots[0].copy()); world.spawnEntityInWorld(item); } else { player.inventoryContainer.detectAndSendChanges(); } - + cast.markDirty(); world.markBlockForUpdate(x, y, z); - + cast.slots[0] = null; cast.markDirty(); - + return true; } @@ -193,18 +192,18 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc public void printHook(Pre event, World world, int x, int y, int z) { TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z); List text = new ArrayList(); - + if(cast.slots[0] == null) { text.add(EnumChatFormatting.RED + I18nUtil.resolveKey("foundry.noCast")); } else if(cast.slots[0].getItem() == ModItems.mold){ Mold mold = ((ItemMold) cast.slots[0].getItem()).getMold(cast.slots[0]); text.add(EnumChatFormatting.BLUE + mold.getTitle()); } - + if(cast.type != null && cast.amount > 0) { text.add(EnumChatFormatting.YELLOW + cast.type.names[0] + ": " + cast.amount + " / " + cast.getCapacity()); } - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text); } } diff --git a/src/main/java/com/hbm/blocks/machine/FurnaceCombination.java b/src/main/java/com/hbm/blocks/machine/FurnaceCombination.java index 83e4b5ce9..4ce96d14d 100644 --- a/src/main/java/com/hbm/blocks/machine/FurnaceCombination.java +++ b/src/main/java/com/hbm/blocks/machine/FurnaceCombination.java @@ -1,18 +1,17 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityFurnaceCombination; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import java.util.List; + public class FurnaceCombination extends BlockDummyable implements ITooltipProvider { public FurnaceCombination() { @@ -25,7 +24,7 @@ public class FurnaceCombination extends BlockDummyable implements ITooltipProvid return new TileEntityFurnaceCombination(); return new TileEntityProxyCombo().inventory().fluid(); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); diff --git a/src/main/java/com/hbm/blocks/machine/MachineArcFurnaceLarge.java b/src/main/java/com/hbm/blocks/machine/MachineArcFurnaceLarge.java index 1acdd1a10..43a767a9b 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineArcFurnaceLarge.java +++ b/src/main/java/com/hbm/blocks/machine/MachineArcFurnaceLarge.java @@ -7,7 +7,6 @@ import com.hbm.items.machine.ItemScraps; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; @@ -52,11 +51,11 @@ public class MachineArcFurnaceLarge extends BlockDummyable { public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y, z + dir.offsetZ * o, new int[] {4, 0, 3, -2, 1, 1}, this, dir); - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); x += dir.offsetX * o; z += dir.offsetZ * o; - + this.makeExtra(world, x + dir.offsetX * 2 + rot.offsetX, y, z + dir.offsetZ * 2 + rot.offsetZ); this.makeExtra(world, x + dir.offsetX * 2 - rot.offsetX, y, z + dir.offsetZ * 2 - rot.offsetZ); this.makeExtra(world, x + rot.offsetX * 2 + dir.offsetX, y, z + rot.offsetZ * 2 + dir.offsetZ); @@ -64,10 +63,10 @@ public class MachineArcFurnaceLarge extends BlockDummyable { this.makeExtra(world, x - rot.offsetX * 2 + dir.offsetX, y, z - rot.offsetZ * 2 + dir.offsetZ); this.makeExtra(world, x - rot.offsetX * 2 - dir.offsetX, y, z - rot.offsetZ * 2 - dir.offsetZ); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { @@ -77,7 +76,7 @@ public class MachineArcFurnaceLarge extends BlockDummyable { return false; if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) { TileEntityMachineArcFurnaceLarge crucible = (TileEntityMachineArcFurnaceLarge) world.getTileEntity(pos[0], pos[1], pos[2]); - + for(MaterialStack stack : crucible.liquids) { ItemStack scrap = ItemScraps.create(new MaterialStack(stack.material, stack.amount)); if(!player.inventory.addItemStackToInventory(scrap)) { @@ -85,11 +84,11 @@ public class MachineArcFurnaceLarge extends BlockDummyable { world.spawnEntityInWorld(item); } } - + player.inventoryContainer.detectAndSendChanges(); crucible.liquids.clear(); crucible.markDirty(); - + } else { FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); } diff --git a/src/main/java/com/hbm/blocks/machine/MachineAutocrafter.java b/src/main/java/com/hbm/blocks/machine/MachineAutocrafter.java index 1c922fab5..7cfde7611 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineAutocrafter.java +++ b/src/main/java/com/hbm/blocks/machine/MachineAutocrafter.java @@ -1,11 +1,8 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityMachineAutocrafter; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,6 +19,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import java.util.Random; + public class MachineAutocrafter extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon iconTop; @@ -72,7 +71,7 @@ public class MachineAutocrafter extends BlockContainer { ISidedInventory tile = (ISidedInventory) world.getTileEntity(x, y, z); if(tile != null) { - + for(int i1 = 10; i1 < tile.getSizeInventory(); ++i1) { ItemStack itemstack = tile.getStackInSlot(i1); diff --git a/src/main/java/com/hbm/blocks/machine/MachineBigAssTank9000.java b/src/main/java/com/hbm/blocks/machine/MachineBigAssTank9000.java index 32ba803a3..bb8759c0d 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineBigAssTank9000.java +++ b/src/main/java/com/hbm/blocks/machine/MachineBigAssTank9000.java @@ -1,8 +1,5 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.handler.MultiblockHandlerXR; @@ -14,7 +11,6 @@ import com.hbm.main.MainRegistry; import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.storage.TileEntityMachineBAT9000; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -28,6 +24,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineBigAssTank9000 extends BlockDummyable implements IPersistentInfoProvider { public MachineBigAssTank9000(Material mat) { @@ -36,7 +35,7 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineBAT9000(); if(meta >= 6) return new TileEntityProxyCombo(false, false, true); return null; @@ -74,22 +73,22 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, 0, 1, 1, 2, -2}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, 0, 1, 1, -2, 2}, x, y, z, dir)) return false; - + return true; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); //we can do this because nobody is stopping me from doing this return true; } else if(player.isSneaking()){ @@ -97,9 +96,9 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent if(pos == null) return false; - + TileEntityMachineBAT9000 trialEntity = (TileEntityMachineBAT9000) world.getTileEntity(pos[0], pos[1], pos[2]); - + if(trialEntity != null) { if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) { FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem()); @@ -115,7 +114,7 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent return true; } } - + @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { return IPersistentNBT.getDrops(world, x, y, z, this); @@ -130,19 +129,19 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent public int getComparatorInputOverride(World world, int x, int y, int z, int side) { int meta = world.getBlockMetadata(x, y, z); - + if(meta >= 6) { int[] pos = this.findCore(world, x, y, z); if(pos == null) return 0; TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityMachineBAT9000)) return 0; - + TileEntityMachineBAT9000 tank = (TileEntityMachineBAT9000) te; return tank.getComparatorPower(); } - + return 0; } diff --git a/src/main/java/com/hbm/blocks/machine/MachineBrickFurnace.java b/src/main/java/com/hbm/blocks/machine/MachineBrickFurnace.java index 48054e36e..f4164f964 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineBrickFurnace.java +++ b/src/main/java/com/hbm/blocks/machine/MachineBrickFurnace.java @@ -1,13 +1,10 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityFurnaceBrick; import com.hbm.util.ItemStackUtil; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -24,6 +21,8 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.util.Random; + public class MachineBrickFurnace extends BlockContainer { private final Random rand = new Random(); @@ -38,7 +37,7 @@ public class MachineBrickFurnace extends BlockContainer { super(Material.iron); isActive = blockState; } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -47,7 +46,7 @@ public class MachineBrickFurnace extends BlockContainer { this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_furnace_brick_front_on" : ":machine_furnace_brick_front_off")); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_furnace_brick_side"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -64,31 +63,31 @@ public class MachineBrickFurnace extends BlockContainer { public Item getItem(World world, int x, int y, int z) { return Item.getItemFromBlock(ModBlocks.machine_furnace_brick_off); } - + @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } - + private void setDefaultDirection(World world, int x, int y, int z) { if(!world.isRemote) { Block nZ = world.getBlock(x, y, z - 1); Block pZ = world.getBlock(x, y, z + 1); Block nX = world.getBlock(x - 1, y, z); Block pX = world.getBlock(x + 1, y, z); - + byte meta = 3; - + if(nZ.func_149730_j() && !pZ.func_149730_j()) meta = 3; if(pZ.func_149730_j() && !nZ.func_149730_j()) meta = 2; if(nX.func_149730_j() && !pX.func_149730_j()) meta = 5; if(pX.func_149730_j() && !nX.func_149730_j()) meta = 4; - + world.setBlockMetadataWithNotify(x, y, z, meta, 2); } } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; @@ -96,10 +95,10 @@ public class MachineBrickFurnace extends BlockContainer { if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); - + if(itemStack.hasDisplayName()) ((TileEntityFurnaceBrick)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -119,22 +118,22 @@ public class MachineBrickFurnace extends BlockContainer { int i = world.getBlockMetadata(x, y, z); TileEntity entity = world.getTileEntity(x, y, z); keepInventory = true; - + if(isProcessing) { world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_on); } else { world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_off); } - + keepInventory = false; world.setBlockMetadataWithNotify(x, y, z, i, 2); - + if(entity != null) { entity.validate(); world.setTileEntity(x, y, z, entity); } } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { if(!keepInventory) ItemStackUtil.spillItems(world, x, y, z, block, rand); diff --git a/src/main/java/com/hbm/blocks/machine/MachineCapacitor.java b/src/main/java/com/hbm/blocks/machine/MachineCapacitor.java index f1662ec4e..85bbf4b60 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCapacitor.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCapacitor.java @@ -10,9 +10,6 @@ import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; -import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.BobMathUtil; @@ -22,7 +19,6 @@ import com.hbm.util.fauxpointtwelve.BlockPos; import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -48,7 +44,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP @SideOnly(Side.CLIENT) public IIcon iconBottom; @SideOnly(Side.CLIENT) public IIcon iconInnerTop; @SideOnly(Side.CLIENT) public IIcon iconInnerSide; - + protected long power; String name; @@ -57,7 +53,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP this.power = power; this.name = name; } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -87,23 +83,23 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityCapacitor)) return; - + TileEntityCapacitor battery = (TileEntityCapacitor) te; List text = new ArrayList(); text.add(BobMathUtil.getShortNumber(battery.getPower()) + " / " + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE"); - + double percent = (double) battery.getPower() / (double) battery.getMaxPower(); int charge = (int) Math.floor(percent * 10_000D); int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8); text.add("&[" + color + "&]" + (charge / 100D) + "%"); text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + "+" + BobMathUtil.getShortNumber(battery.powerReceived) + "HE/t"); text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + "-" + BobMathUtil.getShortNumber(battery.powerSent) + "HE/t"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } @@ -117,7 +113,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { - + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { for(String s : I18nUtil.resolveKeyArray("tile.capacitor.desc")) list.add(EnumChatFormatting.YELLOW + s); } else { @@ -126,7 +122,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info"); } } - + @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { return IPersistentNBT.getDrops(world, x, y, z, this); @@ -139,68 +135,68 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP @Override public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { - + if(!player.capabilities.isCreativeMode) { harvesters.set(player); this.dropBlockAsItem(world, x, y, z, meta, 0); harvesters.set(null); } } - + @Override public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); player.addExhaustion(0.025F); } - public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, IBufPacketReceiver, IPersistentNBT { - + public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, IPersistentNBT { + public long power; protected long maxPower; public long powerReceived; public long powerSent; - + public TileEntityCapacitor() { } - + public TileEntityCapacitor(long maxPower) { this.maxPower = maxPower; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + ForgeDirection opp = ForgeDirection.getOrientation(this.getBlockMetadata()); ForgeDirection dir = opp.getOpposite(); - + BlockPos pos = new BlockPos(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); - + boolean didStep = false; ForgeDirection last = null; - + while(worldObj.getBlock(pos.getX(), pos.getY(), pos.getZ()) == ModBlocks.capacitor_bus) { ForgeDirection current = ForgeDirection.getOrientation(worldObj.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ())); if(!didStep) last = current; didStep = true; - + if(last != current) { pos = null; break; } - + pos = pos.offset(current); } - + if(pos != null && last != null) { this.tryUnsubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ()); this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), last); } - + this.trySubscribe(worldObj, xCoord + opp.offsetX, yCoord + opp.offsetY, zCoord + opp.offsetZ, opp); - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15)); - + networkPackNT(15); + this.powerSent = 0; this.powerReceived = 0; } @@ -213,7 +209,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP buf.writeLong(powerReceived); buf.writeLong(powerSent); } - + @Override public void deserialize(ByteBuf buf) { power = buf.readLong(); @@ -235,7 +231,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP this.setPower(this.getMaxPower()); return overshoot; } - + @Override public void usePower(long power) { this.powerSent += Math.min(this.getPower(), power); @@ -255,7 +251,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP @Override public long getProviderSpeed() { return this.getMaxPower() / 300; } - + @Override public long getReceiverSpeed() { return this.getMaxPower() / 100; } @@ -269,7 +265,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP public void setPower(long power) { this.power = power; } - + @Override public boolean canConnect(ForgeDirection dir) { return dir == ForgeDirection.getOrientation(this.getBlockMetadata()); @@ -289,14 +285,14 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP this.power = data.getLong("power"); this.maxPower = data.getLong("maxPower"); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.power = nbt.getLong("power"); this.maxPower = nbt.getLong("maxPower"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/blocks/machine/MachineCapacitorBus.java b/src/main/java/com/hbm/blocks/machine/MachineCapacitorBus.java index dade916fa..1dcac8474 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCapacitorBus.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCapacitorBus.java @@ -1,11 +1,8 @@ package com.hbm.blocks.machine; -import java.util.List; - +import api.hbm.energymk2.IEnergyConnectorBlock; import com.hbm.blocks.ITooltipProvider; import com.hbm.lib.RefStrings; - -import api.hbm.energymk2.IEnergyConnectorBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -20,8 +17,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock, ITooltipProvider { - + @SideOnly(Side.CLIENT) private IIcon topIcon; public MachineCapacitorBus(Material mat) { @@ -38,7 +37,7 @@ public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock, public IIcon getIcon(int side, int meta) { return side == meta ? topIcon : blockIcon; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int l = BlockPistonBase.determineOrientation(world, x, y, z, player); diff --git a/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java b/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java index c8d9bd49d..dd10cb3d1 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCatalyticCracker.java @@ -1,8 +1,5 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.handler.MultiblockHandlerXR; @@ -11,7 +8,6 @@ import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticCracker; import com.hbm.util.I18nUtil; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -23,6 +19,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineCatalyticCracker extends BlockDummyable implements ILookOverlay { public MachineCatalyticCracker(Material mat) { @@ -31,12 +30,12 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineCatalyticCracker(); if(meta >= extra) return new TileEntityProxyCombo(false, false, true); - + return null; } @@ -49,33 +48,33 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver public int getOffset() { return 3; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(!world.isRemote && !player.isSneaking()) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityMachineCatalyticCracker)) return false; - + TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te; FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem()); cracker.tanks[0].setTankType(type); cracker.markDirty(); player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!"))); - + return true; } return false; - + } else { return true; } @@ -98,7 +97,7 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[]{13, 0, 0, 3, 2, 1}, this, dir); MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[]{14, -13, -1, 2, 1, 0}, this, dir); MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[]{3, -1, 2, 3, -1, 3}, this, dir); - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); this.makeExtra(world, x + dir.offsetX * o + dir.offsetX * 3 + rot.offsetX, y + dir.offsetY * o, z + dir.offsetZ * o + dir.offsetZ * 3 + rot.offsetZ); @@ -115,22 +114,22 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver @Override public void printHook(Pre event, World world, int x, int y, int z) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityMachineCatalyticCracker)) return; - + TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te; - + List text = new ArrayList(); for(int i = 0; i < cracker.tanks.length; i++) text.add((i < 2 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + cracker.tanks[i].getTankType().getLocalizedName() + ": " + cracker.tanks[i].getFill() + "/" + cracker.tanks[i].getMaxFill() + "mB"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } } diff --git a/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java b/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java index 80c9f2aef..b8401426a 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCatalyticReformer.java @@ -1,7 +1,5 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.handler.MultiblockHandlerXR; @@ -9,7 +7,6 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -19,6 +16,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineCatalyticReformer extends BlockDummyable implements IPersistentInfoProvider { public MachineCatalyticReformer(Material mat) { @@ -31,7 +30,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist if(meta >= 6) return new TileEntityProxyCombo().fluid().power(); return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return standardOpenBehavior(world, x, y, z, player, side); @@ -49,7 +48,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist super.fillSpace(world, x, y, z, dir, o); MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -3, 1, 0, -1, 2}, this, dir); MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {6, -3, 1, 1, 2, 0}, this, dir); - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1); @@ -72,7 +71,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist @Override public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { - + for(int i = 0; i < 4; i++) { FluidTank tank = new FluidTank(Fluids.NONE, 0); tank.readFromNBT(persistentTag, "" + i); diff --git a/src/main/java/com/hbm/blocks/machine/MachineChimneyBrick.java b/src/main/java/com/hbm/blocks/machine/MachineChimneyBrick.java index 7c8f40bc2..f227488c4 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChimneyBrick.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChimneyBrick.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityChimneyBrick; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvider { public MachineChimneyBrick(Material mat) { @@ -22,7 +21,7 @@ public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvi @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityChimneyBrick(); if(meta >= 6) return new TileEntityProxyCombo().fluid(); return null; diff --git a/src/main/java/com/hbm/blocks/machine/MachineChimneyIndustrial.java b/src/main/java/com/hbm/blocks/machine/MachineChimneyIndustrial.java index 036273535..f32078e16 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChimneyIndustrial.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChimneyIndustrial.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityChimneyIndustrial; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineChimneyIndustrial extends BlockDummyable implements ITooltipProvider { public MachineChimneyIndustrial(Material mat) { @@ -22,7 +21,7 @@ public class MachineChimneyIndustrial extends BlockDummyable implements ITooltip @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityChimneyIndustrial(); if(meta >= 6) return new TileEntityProxyCombo().fluid(); return null; diff --git a/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java b/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java index 162841266..47a7f1f27 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCombustionEngine.java @@ -3,7 +3,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockDummyable; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineCombustionEngine; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -34,15 +33,15 @@ public class MachineCombustionEngine extends BlockDummyable { public int getOffset() { return 0; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); } - + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ); diff --git a/src/main/java/com/hbm/blocks/machine/MachineCondenserPowered.java b/src/main/java/com/hbm/blocks/machine/MachineCondenserPowered.java index 842c084b7..e4918fc42 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCondenserPowered.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCondenserPowered.java @@ -1,15 +1,11 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityCondenserPowered; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; - import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; @@ -17,6 +13,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineCondenserPowered extends BlockDummyable implements ILookOverlay { public MachineCondenserPowered(Material mat) { @@ -43,7 +42,7 @@ public class MachineCondenserPowered extends BlockDummyable implements ILookOver @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + x = x + dir.offsetX * o; z = z + dir.offsetZ * o; @@ -70,7 +69,7 @@ public class MachineCondenserPowered extends BlockDummyable implements ILookOver TileEntityCondenserPowered tower = (TileEntityCondenserPowered) te; List text = new ArrayList(); - + text.add(BobMathUtil.getShortNumber(tower.power) + "HE / " + BobMathUtil.getShortNumber(tower.maxPower) + "HE"); for(int i = 0; i < tower.tanks.length; i++) diff --git a/src/main/java/com/hbm/blocks/machine/MachineConveyorPress.java b/src/main/java/com/hbm/blocks/machine/MachineConveyorPress.java index 1bddf1a9d..396ee0702 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineConveyorPress.java +++ b/src/main/java/com/hbm/blocks/machine/MachineConveyorPress.java @@ -1,8 +1,7 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.block.IToolable; +import api.hbm.conveyor.IConveyorBelt; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; @@ -10,9 +9,6 @@ import com.hbm.items.machine.ItemStamp; import com.hbm.tileentity.machine.TileEntityConveyorPress; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; - -import api.hbm.block.IToolable; -import api.hbm.conveyor.IConveyorBelt; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -25,6 +21,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineConveyorPress extends BlockDummyable implements IConveyorBelt, ILookOverlay, IToolable, ITooltipProvider { public MachineConveyorPress(Material mat) { @@ -46,25 +45,25 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel public int getOffset() { return 0; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { return true; } else { - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityConveyorPress)) return false; - + TileEntityConveyorPress press = (TileEntityConveyorPress) te; - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemStamp && press.slots[0] == null) { press.slots[0] = player.getHeldItem().copy(); press.slots[0].stackSize = 1; @@ -75,39 +74,39 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel return true; } } - + return false; } @Override public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { - + if(tool != ToolType.SCREWDRIVER) return false; - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityConveyorPress)) return false; - + TileEntityConveyorPress press = (TileEntityConveyorPress) te; - + if(press.slots[0] == null) return false; - + if(!player.inventory.addItemStackToInventory(press.slots[0].copy())) { EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, press.slots[0].copy()); world.spawnEntityInWorld(item); } else { player.inventoryContainer.detectAndSendChanges(); } - + press.slots[0] = null; press.markChanged(); - + return true; } @@ -121,7 +120,7 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed); return ret; } - + public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) { int meta = world.getBlockMetadata(x, y - 1, z) - offset; return ForgeDirection.getOrientation(meta).getRotation(ForgeDirection.UP); @@ -148,21 +147,21 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel @Override public void printHook(Pre event, World world, int x, int y, int z) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityConveyorPress)) return; - + TileEntityConveyorPress press = (TileEntityConveyorPress) te; List text = new ArrayList(); text.add(BobMathUtil.getShortNumber(press.power) + "HE / " + BobMathUtil.getShortNumber(press.maxPower) + "HE"); text.add("Installed stamp: " + ((press.syncStack == null || press.syncStack.getItem() == null) ? (EnumChatFormatting.RED + "NONE") : press.syncStack.getDisplayName())); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } diff --git a/src/main/java/com/hbm/blocks/machine/MachineCrystallizer.java b/src/main/java/com/hbm/blocks/machine/MachineCrystallizer.java index 25012acf8..29ed20388 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCrystallizer.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCrystallizer.java @@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineCrystallizer; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -16,7 +15,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class MachineCrystallizer extends BlockDummyable { - + @SideOnly(Side.CLIENT) private IIcon iconTop; @@ -30,7 +29,7 @@ public class MachineCrystallizer extends BlockDummyable { if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid(); return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -60,7 +59,7 @@ public class MachineCrystallizer extends BlockDummyable { public int getOffset() { return 1; } - + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/blocks/machine/MachineDeuteriumExtractor.java b/src/main/java/com/hbm/blocks/machine/MachineDeuteriumExtractor.java index 08c921a35..ba472e1d2 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineDeuteriumExtractor.java +++ b/src/main/java/com/hbm/blocks/machine/MachineDeuteriumExtractor.java @@ -1,14 +1,10 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.TileEntityDeuteriumExtractor; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; @@ -20,6 +16,9 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + public class MachineDeuteriumExtractor extends BlockContainer implements ILookOverlay { public MachineDeuteriumExtractor(Material mat) { @@ -54,20 +53,20 @@ public class MachineDeuteriumExtractor extends BlockContainer implements ILookOv @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityDeuteriumExtractor)) return; - + TileEntityDeuteriumExtractor extractor = (TileEntityDeuteriumExtractor) te; - + List text = new ArrayList(); text.add((extractor.power < extractor.getMaxPower() / 20 ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + "Power: " + BobMathUtil.getShortNumber(extractor.power) + "HE"); for(int i = 0; i < extractor.tanks.length; i++) text.add((i < 1 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + extractor.tanks[i].getTankType().getLocalizedName() + ": " + extractor.tanks[i].getFill() + "/" + extractor.tanks[i].getMaxFill() + "mB"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceExtension.java b/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceExtension.java index 7d67a92b5..74dd3595e 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceExtension.java +++ b/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceExtension.java @@ -6,7 +6,6 @@ import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityDiFurnace; import com.hbm.util.Compat; - import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; @@ -20,7 +19,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; public class MachineDiFurnaceExtension extends BlockContainer implements IProxyController { - + @SideOnly(Side.CLIENT) private IIcon iconTop; @SideOnly(Side.CLIENT) private IIcon iconBottom; @@ -32,7 +31,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityProxyCombo().inventory().fluid(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -40,7 +39,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":difurnace_extension"); this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":brick_fire"); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(!player.isSneaking()) { @@ -52,7 +51,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC } return false; } - + @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon; diff --git a/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceRTG.java b/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceRTG.java index a90699da4..a8f929c81 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceRTG.java +++ b/src/main/java/com/hbm/blocks/machine/MachineDiFurnaceRTG.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityDiFurnaceRTG; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,8 +22,10 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.util.Random; + public class MachineDiFurnaceRTG extends BlockContainer { - + private final Random rand = new Random(); private final boolean isActive; private static boolean keepInventory; @@ -116,7 +115,7 @@ public class MachineDiFurnaceRTG extends BlockContainer { @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { @@ -145,7 +144,7 @@ public class MachineDiFurnaceRTG extends BlockContainer { } else { world.setBlock(x, y, z, ModBlocks.machine_difurnace_rtg_off); } - + keepInventory = false; world.setBlockMetadataWithNotify(x, y, z, i, 2); diff --git a/src/main/java/com/hbm/blocks/machine/MachineElectricFurnace.java b/src/main/java/com/hbm/blocks/machine/MachineElectricFurnace.java index ecdd8c59e..b0a987f27 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineElectricFurnace.java +++ b/src/main/java/com/hbm/blocks/machine/MachineElectricFurnace.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,12 +22,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.util.Random; + public class MachineElectricFurnace extends BlockContainer { private final Random field_149933_a = new Random(); private final boolean isActive; private static boolean keepInventory; - + @SideOnly(Side.CLIENT) private IIcon iconFront; private IIcon iconTop; @@ -40,7 +39,7 @@ public class MachineElectricFurnace extends BlockContainer { super(Material.iron); isActive = blockState; } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -49,7 +48,7 @@ public class MachineElectricFurnace extends BlockContainer { this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_top"); this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_bottom"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -57,19 +56,19 @@ public class MachineElectricFurnace extends BlockContainer { //return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.iconTop); return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon); } - + @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off); } - + @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } - + private void setDefaultDirection(World world, int x, int y, int z) { if(!world.isRemote) { @@ -77,9 +76,9 @@ public class MachineElectricFurnace extends BlockContainer { Block block2 = world.getBlock(x, y, z + 1); Block block3 = world.getBlock(x - 1, y, z); Block block4 = world.getBlock(x + 1, y, z); - + byte b0 = 3; - + if(block1.func_149730_j() && !block2.func_149730_j()) { b0 = 3; @@ -96,15 +95,15 @@ public class MachineElectricFurnace extends BlockContainer { { b0 = 4; } - + world.setBlockMetadataWithNotify(x, y, z, b0, 2); } } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); @@ -121,13 +120,13 @@ public class MachineElectricFurnace extends BlockContainer { { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - + if(itemStack.hasDisplayName()) { ((TileEntityMachineElectricFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); } } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -155,23 +154,23 @@ public class MachineElectricFurnace extends BlockContainer { int i = world.getBlockMetadata(x, y, z); TileEntity entity = world.getTileEntity(x, y, z); keepInventory = true; - + if(isProcessing) { world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_on); }else{ world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_off); } - + keepInventory = false; world.setBlockMetadataWithNotify(x, y, z, i, 2); - + if(entity != null) { entity.validate(); world.setTileEntity(x, y, z, entity); } } - + @Override public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { @@ -223,7 +222,7 @@ public class MachineElectricFurnace extends BlockContainer { super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } - + @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand) @@ -265,4 +264,4 @@ public class MachineElectricFurnace extends BlockContainer { public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off);} - } \ No newline at end of file + } diff --git a/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java b/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java index 3c6b7beac..ab91cbb43 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java +++ b/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java @@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.handler.MultiblockHandlerXR; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityElectrolyser; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -33,19 +32,19 @@ public class MachineElectrolyser extends BlockDummyable { public int getOffset() { return 5; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); } - + @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); x += dir.offsetX * o; z += dir.offsetZ * o; - + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {2, -1, 5, 5, 1, 1}, this, dir); MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -3, 5, 5, 0, 0}, this, dir); MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, 4, -4, -3, 3}, this, dir); @@ -58,7 +57,7 @@ public class MachineElectrolyser extends BlockDummyable { MultiblockHandlerXR.fillSpace(world, x, y + 3, z, new int[] {0, 0, 0, 0, -1, 2}, this, dir); MultiblockHandlerXR.fillSpace(world, x - dir.offsetX * 2, y + 3, z - dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, this, dir); MultiblockHandlerXR.fillSpace(world, x - dir.offsetX * 4, y + 3, z - dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, this, dir); - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); this.makeExtra(world, x - dir.offsetX * 5, y, z - dir.offsetZ * 5); @@ -84,13 +83,13 @@ public class MachineElectrolyser extends BlockDummyable { if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, 0, 0, -3, 3}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, -2, 2, -3, 3}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, -4, 4, -3, 3}, x, y, z, dir)) return false; - + if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * 4, y + 3, z + dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * 2, y + 3, z + dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x, y + 3, z, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x - dir.offsetX * 2, y + 3, z - dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x - dir.offsetX * 4, y + 3, z - dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; - + return true; } diff --git a/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java b/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java index 8efe19ae1..e0d906181 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java +++ b/src/main/java/com/hbm/blocks/machine/MachineExposureChamber.java @@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.handler.MultiblockHandlerXR; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineExposureChamber; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -37,10 +36,10 @@ public class MachineExposureChamber extends BlockDummyable { @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + x += dir.offsetX * o; z += dir.offsetZ * o; - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite(); MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, 0, 0, 0, -3, 8}, this, dir); @@ -58,10 +57,10 @@ public class MachineExposureChamber extends BlockDummyable { @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { - + x += dir.offsetX * o; z += dir.offsetZ * o; - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite(); if(!MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir)) return false; @@ -70,10 +69,10 @@ public class MachineExposureChamber extends BlockDummyable { if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {0, 0, -1, 1, -3, 6}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, 1, -1, 0, 1}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, -1, 1, 0, 1}, x, y, z, dir)) return false; - + return true; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return super.standardOpenBehavior(world, x, y, z, player, 0); diff --git a/src/main/java/com/hbm/blocks/machine/MachineFieldDisturber.java b/src/main/java/com/hbm/blocks/machine/MachineFieldDisturber.java index 4ad885409..751cff978 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFieldDisturber.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFieldDisturber.java @@ -1,20 +1,19 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.entity.logic.EntityNukeExplosionMK3; import com.hbm.entity.logic.EntityNukeExplosionMK3.ATEntry; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; +import java.util.Random; + public class MachineFieldDisturber extends Block { public MachineFieldDisturber() { super(Material.iron); } - + @Override public int tickRate(World world) { return 10; diff --git a/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java b/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java index 7c6281110..761aa10ed 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java @@ -1,8 +1,5 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.handler.MultiblockHandlerXR; @@ -13,7 +10,6 @@ import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineFrackingTower; import com.hbm.util.BobMathUtil; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -24,6 +20,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineFrackingTower extends BlockDummyable implements IPersistentInfoProvider { public MachineFrackingTower() { @@ -32,7 +31,7 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineFrackingTower(); if(meta >= 6) return new TileEntityProxyCombo(false, true, true); return null; @@ -50,9 +49,9 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { - + if(!MultiblockHandlerXR.checkSpace(world, x, y + 2, z, new int[] {1, 0, 3, 3, 3, 3}, x, y, z, dir)) return false; - + if(!MultiblockHandlerXR.checkSpace(world, x - 2, y + 2, z - 2, new int[] {-1, 2, 0, 1, 0, 1}, x, y, z, ForgeDirection.NORTH)) return false; if(!MultiblockHandlerXR.checkSpace(world, x - 2, y + 2, z + 3, new int[] {-1, 2, 0, 1, 0, 1}, x, y, z, ForgeDirection.NORTH)) return false; if(!MultiblockHandlerXR.checkSpace(world, x + 3, y + 2, z - 2, new int[] {-1, 2, 0, 1, 0, 1}, x, y, z, ForgeDirection.NORTH)) return false; @@ -62,7 +61,7 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {24, -9, 1, 1, 1, 1}, x, y, z, dir)) return false; if(!MultiblockHandlerXR.checkSpace(world, x, y + 15, z, new int[] {1, 0, 1, 1, -2, 3}, x, y, z, dir)) return false; - + return super.checkRequirement(world, x, y, z, dir, o); } @@ -78,29 +77,29 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {10, -4, 2, 2, 2, 2}, this, dir); MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {24, -9, 1, 1, 1, 1}, this, dir); - + MultiblockHandlerXR.fillSpace(world, x, y + 15, z, new int[] {1, 0, 1, 1, -2, 3}, this, ForgeDirection.WEST); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); return true; } else { return true; } } - + @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { return IPersistentNBT.getDrops(world, x, y, z, this); diff --git a/src/main/java/com/hbm/blocks/machine/MachineFractionTower.java b/src/main/java/com/hbm/blocks/machine/MachineFractionTower.java index 5c60f53df..1e1fc1e33 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFractionTower.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFractionTower.java @@ -1,8 +1,5 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.fluid.FluidType; @@ -10,7 +7,6 @@ import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower; import com.hbm.util.I18nUtil; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -22,6 +18,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineFractionTower extends BlockDummyable implements ILookOverlay { public MachineFractionTower(Material mat) { @@ -30,12 +29,12 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineFractionTower(); if(meta >= extra) return new TileEntityProxyCombo(false, false, true); - + return null; } @@ -48,25 +47,25 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay public int getOffset() { return 1; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(!world.isRemote && !player.isSneaking()) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityMachineFractionTower)) return false; - + TileEntityMachineFractionTower frac = (TileEntityMachineFractionTower) te; - + if(world.getTileEntity(pos[0], pos[1] - 3, pos[2]) instanceof TileEntityMachineFractionTower) { player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "You can only change the type in the bottom segment!")); } else { @@ -75,11 +74,11 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay frac.markDirty(); player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!"))); } - + return true; } return false; - + } else { return true; } @@ -88,7 +87,7 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + x = x + dir.offsetX * o; z = z + dir.offsetZ * o; @@ -101,22 +100,22 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay @Override public void printHook(Pre event, World world, int x, int y, int z) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityMachineFractionTower)) return; - + TileEntityMachineFractionTower cracker = (TileEntityMachineFractionTower) te; - + List text = new ArrayList(); for(int i = 0; i < cracker.tanks.length; i++) text.add((i == 0 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + cracker.tanks[i].getTankType().getLocalizedName() + ": " + cracker.tanks[i].getFill() + "/" + cracker.tanks[i].getMaxFill() + "mB"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } } diff --git a/src/main/java/com/hbm/blocks/machine/MachineHeatBoilerIndustrial.java b/src/main/java/com/hbm/blocks/machine/MachineHeatBoilerIndustrial.java index 7869a74bd..a2c411072 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineHeatBoilerIndustrial.java +++ b/src/main/java/com/hbm/blocks/machine/MachineHeatBoilerIndustrial.java @@ -1,9 +1,5 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; @@ -14,7 +10,6 @@ import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityHeatBoilerIndustrial; import com.hbm.util.I18nUtil; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,6 +22,10 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILookOverlay, ITooltipProvider { public MachineHeatBoilerIndustrial() { @@ -35,32 +34,32 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityHeatBoilerIndustrial(); if(meta >= extra) return new TileEntityProxyCombo().fluid(); return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(!world.isRemote && !player.isSneaking()) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityHeatBoilerIndustrial)) return false; - + TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te; - + FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem()); - + if(type.hasTrait(FT_Heatable.class) && type.getTrait(FT_Heatable.class).getEfficiency(HeatingType.BOILER) > 0) { boiler.tanks[0].setTankType(type); boiler.markDirty(); @@ -69,7 +68,7 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook return true; } return false; - + } else { return true; } @@ -98,24 +97,24 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook @Override public void printHook(Pre event, World world, int x, int y, int z) { - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntityHeatBoilerIndustrial)) return; - + TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te; - + List text = new ArrayList(); text.add(String.format(Locale.US, "%,d", boiler.heat) + "TU"); text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + boiler.tanks[0].getTankType().getLocalizedName() + ": " + String.format(Locale.US, "%,d", boiler.tanks[0].getFill()) + " / " + String.format(Locale.US, "%,d", boiler.tanks[0].getMaxFill()) + "mB"); text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + boiler.tanks[1].getTankType().getLocalizedName() + ": " + String.format(Locale.US, "%,d", boiler.tanks[1].getFill()) + " / " + String.format(Locale.US, "%,d", boiler.tanks[1].getMaxFill()) + "mB"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } diff --git a/src/main/java/com/hbm/blocks/machine/MachineHydrotreater.java b/src/main/java/com/hbm/blocks/machine/MachineHydrotreater.java index c1ed1c005..a0b223a91 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineHydrotreater.java +++ b/src/main/java/com/hbm/blocks/machine/MachineHydrotreater.java @@ -1,14 +1,11 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -18,6 +15,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineHydrotreater extends BlockDummyable implements IPersistentInfoProvider { public MachineHydrotreater(Material mat) { @@ -30,7 +29,7 @@ public class MachineHydrotreater extends BlockDummyable implements IPersistentIn if(meta >= 6) return new TileEntityProxyCombo().fluid().power(); return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return standardOpenBehavior(world, x, y, z, player, side); @@ -51,7 +50,7 @@ public class MachineHydrotreater extends BlockDummyable implements IPersistentIn @Override public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { - + for(int i = 0; i < 4; i++) { FluidTank tank = new FluidTank(Fluids.NONE, 0); tank.readFromNBT(persistentTag, "" + i); diff --git a/src/main/java/com/hbm/blocks/machine/MachineICFController.java b/src/main/java/com/hbm/blocks/machine/MachineICFController.java index 10d851109..83267cec4 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineICFController.java +++ b/src/main/java/com/hbm/blocks/machine/MachineICFController.java @@ -1,11 +1,5 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map.Entry; - import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.BlockICF.TileEntityBlockICF; @@ -17,7 +11,6 @@ import com.hbm.tileentity.machine.TileEntityICFController; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; import com.hbm.util.fauxpointtwelve.BlockPos; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -36,8 +29,14 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map.Entry; + public class MachineICFController extends BlockContainer implements ILookOverlay { - + @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -49,43 +48,43 @@ public class MachineICFController extends BlockContainer implements ILookOverlay public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityICFController(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { super.registerBlockIcons(iconRegister); this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":icf_controller"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { TileEntityICFController controller = (TileEntityICFController) world.getTileEntity(x, y, z); - + if(!controller.assembled) { assemble(world, x, y, z, player); } - + return true; } else { return false; @@ -101,7 +100,7 @@ public class MachineICFController extends BlockContainer implements ILookOverlay private static HashSet turbochargers = new HashSet(); private static boolean errored; private static final int maxSize = 1024; - + public void assemble(World world, int x, int y, int z, EntityPlayer player) { assembly.clear(); casings.clear(); @@ -111,27 +110,27 @@ public class MachineICFController extends BlockContainer implements ILookOverlay capacitors.clear(); turbochargers.clear(); assembly.put(new BlockPos(x, y, z), 0); - + ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite(); - + errored = false; floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player); assembly.remove(new BlockPos(x, y, z)); - + TileEntityICFController controller = (TileEntityICFController) world.getTileEntity(x, y, z); - + if(!errored) { - + for(Entry entry : assembly.entrySet()) { - + BlockPos pos = entry.getKey(); - + if(ports.contains(pos)) { world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.icf_block, 1, 3); } else { world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.icf_block, 0, 3); } - + TileEntityBlockICF icf = (TileEntityBlockICF) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); icf.block = ModBlocks.icf_laser_component; icf.meta = entry.getValue(); @@ -140,12 +139,12 @@ public class MachineICFController extends BlockContainer implements ILookOverlay icf.coreZ = z; icf.markDirty(); } - + controller.setup(ports, cells, emitters, capacitors, turbochargers); controller.markDirty(); } controller.assembled = !errored; - + assembly.clear(); casings.clear(); ports.clear(); @@ -154,24 +153,24 @@ public class MachineICFController extends BlockContainer implements ILookOverlay capacitors.clear(); turbochargers.clear(); } - + private void floodFill(World world, int x, int y, int z, EntityPlayer player) { - + BlockPos pos = new BlockPos(x, y, z); - + if(assembly.containsKey(pos)) return; if(assembly.size() >= maxSize) { errored = true; sendError(world, x, y, z, "Max size exceeded", player); return; } - + Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); boolean validCasing = false; boolean validCore = false; - + if(block == ModBlocks.icf_laser_component) { if(meta == EnumICFPart.CASING.ordinal()) { casings.add(pos); validCasing = true; } if(meta == EnumICFPart.PORT.ordinal()) { ports.add(pos); validCasing = true; } @@ -180,12 +179,12 @@ public class MachineICFController extends BlockContainer implements ILookOverlay if(meta == EnumICFPart.CAPACITOR.ordinal()) { capacitors.add(pos); validCore = true; } if(meta == EnumICFPart.TURBO.ordinal()) { turbochargers.add(pos); validCore = true; } } - + if(validCasing) { assembly.put(pos, meta); return; } - + if(validCore) { assembly.put(pos, meta); floodFill(world, x + 1, y, z, player); @@ -200,7 +199,7 @@ public class MachineICFController extends BlockContainer implements ILookOverlay sendError(world, x, y, z, "Non-laser block", player); errored = true; } - + private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) { if(player instanceof EntityPlayerMP) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineLargeTurbine.java b/src/main/java/com/hbm/blocks/machine/MachineLargeTurbine.java index 8150f91e6..cc8328dd3 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineLargeTurbine.java +++ b/src/main/java/com/hbm/blocks/machine/MachineLargeTurbine.java @@ -1,13 +1,10 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineLargeTurbine; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; @@ -18,6 +15,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvider { public MachineLargeTurbine(Material mat) { @@ -26,13 +25,13 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineLargeTurbine(); - + if(meta >= 6) return new TileEntityProxyCombo(false, true, true); - + return null; } @@ -45,7 +44,7 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi public int getOffset() { return 1; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -54,20 +53,20 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi } else if(!player.isSneaking()) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); return true; } else { return true; } } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - + super.onBlockPlacedBy(world, x, y, z, player, itemStack); if(world.isRemote) @@ -75,7 +74,7 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi int k = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; ForgeDirection dir = ForgeDirection.NORTH; - + if(k == 0) dir = ForgeDirection.getOrientation(2); if(k == 1) @@ -84,9 +83,9 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi dir = ForgeDirection.getOrientation(3); if(k == 3) dir = ForgeDirection.getOrientation(4); - + ForgeDirection dir2 = dir.getRotation(ForgeDirection.UP); - + //back connector this.makeExtra(world, x + dir.offsetX * -4, y, z + dir.offsetZ * -4); //front connector @@ -94,7 +93,7 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi int xc = x - dir.offsetX; int zc = z - dir.offsetZ; - + //side connectors this.makeExtra(world, xc + dir2.offsetX, y, zc + dir2.offsetZ); this.makeExtra(world, xc - dir2.offsetX, y, zc - dir2.offsetZ); diff --git a/src/main/java/com/hbm/blocks/machine/MachineLiquefactor.java b/src/main/java/com/hbm/blocks/machine/MachineLiquefactor.java index 48165752b..6348106d6 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineLiquefactor.java +++ b/src/main/java/com/hbm/blocks/machine/MachineLiquefactor.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineLiquefactor; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineLiquefactor extends BlockDummyable implements ITooltipProvider { public MachineLiquefactor() { @@ -22,13 +21,13 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineLiquefactor(); - + if(meta >= extra) return new TileEntityProxyCombo(true, true, true); - + return null; } @@ -36,7 +35,7 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid public int[] getDimensions() { return new int[] {3, 0, 1, 1, 1, 1}; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); @@ -50,12 +49,12 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + x = x + dir.offsetX * o; z = z + dir.offsetZ * o; this.makeExtra(world, x, y + 3, z); - + this.makeExtra(world, x + 1, y + 1, z); this.makeExtra(world, x - 1, y + 1, z); this.makeExtra(world, x, y + 1, z + 1); diff --git a/src/main/java/com/hbm/blocks/machine/MachineMiningLaser.java b/src/main/java/com/hbm/blocks/machine/MachineMiningLaser.java index ada5bff34..b8fd117ec 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineMiningLaser.java +++ b/src/main/java/com/hbm/blocks/machine/MachineMiningLaser.java @@ -1,14 +1,11 @@ package com.hbm.blocks.machine; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.TileEntityProxyEnergy; import com.hbm.tileentity.machine.TileEntityMachineMiningLaser; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -17,6 +14,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class MachineMiningLaser extends BlockDummyable implements ITooltipProvider { public MachineMiningLaser(Material mat) { @@ -29,7 +28,7 @@ public class MachineMiningLaser extends BlockDummyable implements ITooltipProvid if(meta >= 12) return new TileEntityMachineMiningLaser(); if(meta == 7) return new TileEntityProxyEnergy(); if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid(); - + return null; } @@ -47,26 +46,26 @@ public class MachineMiningLaser extends BlockDummyable implements ITooltipProvid public int getHeightOffset() { return -1; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); return true; } else { return true; } } - + protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); @@ -78,7 +77,7 @@ public class MachineMiningLaser extends BlockDummyable implements ITooltipProvid this.makeExtra(world, x - 1, y, z); this.makeExtra(world, x, y, z + 1); this.makeExtra(world, x, y, z - 1); - + this.makeExtra(world, x, y + 1, z); } diff --git a/src/main/java/com/hbm/blocks/machine/MachineMissileAssembly.java b/src/main/java/com/hbm/blocks/machine/MachineMissileAssembly.java index ef271e773..87f345b66 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineMissileAssembly.java +++ b/src/main/java/com/hbm/blocks/machine/MachineMissileAssembly.java @@ -1,11 +1,8 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.handler.BossSpawnHandler; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityMachineMissileAssembly; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; @@ -20,6 +17,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.util.Random; + public class MachineMissileAssembly extends BlockContainer { public MachineMissileAssembly(Material p_i45386_1_) { @@ -45,7 +44,7 @@ public class MachineMissileAssembly extends BlockContainer { public boolean renderAsNormalBlock() { return false; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -65,7 +64,7 @@ public class MachineMissileAssembly extends BlockContainer { } private final Random field_149933_a = new Random(); - + @Override public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { @@ -111,11 +110,11 @@ public class MachineMissileAssembly extends BlockContainer { super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); @@ -132,7 +131,7 @@ public class MachineMissileAssembly extends BlockContainer { { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - + if(itemStack.hasDisplayName()) { ((TileEntityMachineMissileAssembly)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); diff --git a/src/main/java/com/hbm/blocks/machine/MachineNukeFurnace.java b/src/main/java/com/hbm/blocks/machine/MachineNukeFurnace.java index de87c78ae..94492e91f 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineNukeFurnace.java +++ b/src/main/java/com/hbm/blocks/machine/MachineNukeFurnace.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityNukeFurnace; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,12 +22,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.util.Random; + public class MachineNukeFurnace extends BlockContainer { private final Random field_149933_a = new Random(); private final boolean isActive; private static boolean keepInventory; - + @SideOnly(Side.CLIENT) private IIcon iconTop; @SideOnly(Side.CLIENT) @@ -40,7 +39,7 @@ public class MachineNukeFurnace extends BlockContainer { super(Material.iron); isActive = blockState; } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -48,25 +47,25 @@ public class MachineNukeFurnace extends BlockContainer { this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_nuke_furnace_front_on_alt" : ":machine_nuke_furnace_front_off_alt")); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_nuke_furnace_side_alt"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : (side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon))); } - + @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(ModBlocks.machine_nuke_furnace_off); } - + @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } - + private void setDefaultDirection(World world, int x, int y, int z) { if(!world.isRemote) { @@ -74,9 +73,9 @@ public class MachineNukeFurnace extends BlockContainer { Block block2 = world.getBlock(x, y, z + 1); Block block3 = world.getBlock(x - 1, y, z); Block block4 = world.getBlock(x + 1, y, z); - + byte b0 = 3; - + if(block1.func_149730_j() && !block2.func_149730_j()) { b0 = 3; @@ -93,15 +92,15 @@ public class MachineNukeFurnace extends BlockContainer { { b0 = 4; } - + world.setBlockMetadataWithNotify(x, y, z, b0, 2); } } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); @@ -118,13 +117,13 @@ public class MachineNukeFurnace extends BlockContainer { { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - + if(itemStack.hasDisplayName()) { ((TileEntityNukeFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); } } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -152,23 +151,23 @@ public class MachineNukeFurnace extends BlockContainer { int i = world.getBlockMetadata(x, y, z); TileEntity entity = world.getTileEntity(x, y, z); keepInventory = true; - + if(isProcessing) { world.setBlock(x, y, z, ModBlocks.machine_nuke_furnace_on); }else{ world.setBlock(x, y, z, ModBlocks.machine_nuke_furnace_off); } - + keepInventory = false; world.setBlockMetadataWithNotify(x, y, z, i, 2); - + if(entity != null) { entity.validate(); world.setTileEntity(x, y, z, entity); } } - + @Override public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { @@ -220,7 +219,7 @@ public class MachineNukeFurnace extends BlockContainer { super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } - + @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand) diff --git a/src/main/java/com/hbm/blocks/machine/MachinePWRController.java b/src/main/java/com/hbm/blocks/machine/MachinePWRController.java index 0fcbc6117..584877d3f 100644 --- a/src/main/java/com/hbm/blocks/machine/MachinePWRController.java +++ b/src/main/java/com/hbm/blocks/machine/MachinePWRController.java @@ -1,9 +1,5 @@ package com.hbm.blocks.machine; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.BlockPWR.TileEntityBlockPWR; @@ -13,7 +9,6 @@ import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.tileentity.machine.TileEntityPWRController; import com.hbm.util.fauxpointtwelve.BlockPos; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -32,8 +27,12 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + public class MachinePWRController extends BlockContainer implements ITooltipProvider { - + @SideOnly(Side.CLIENT) private IIcon iconFront; @@ -45,45 +44,45 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityPWRController(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { super.registerBlockIcons(iconRegister); this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":pwr_controller"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z); - + if(!controller.assembled) { assemble(world, x, y, z, player); } else { FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); } - + return true; } else { return false; @@ -95,44 +94,44 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv private static HashMap sources = new HashMap(); private static boolean errored; private static final int maxSize = 4096; - + public void assemble(World world, int x, int y, int z, EntityPlayer player) { assembly.clear(); fuelRods.clear(); sources.clear(); assembly.put(new BlockPos(x, y, z), this); - + ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite(); - + errored = false; floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player); - + if(fuelRods.size() == 0){ sendError(world, x, y, z, "Fuel rods required", player); errored = true; } - + if(sources.size() == 0) { sendError(world, x, y, z, "Neutron sources required", player); errored = true; } - + TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z); - + if(!errored) { for(Entry entry : assembly.entrySet()) { - + BlockPos pos = entry.getKey(); Block block = entry.getValue(); - + if(block != ModBlocks.pwr_controller) { - + if(block == ModBlocks.pwr_port) { world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 1, 3); } else { world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 0, 3); } - + TileEntityBlockPWR pwr = (TileEntityBlockPWR) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); pwr.block = block; pwr.coreX = x; @@ -141,34 +140,34 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv pwr.markDirty(); } } - + controller.setup(assembly, fuelRods); } controller.assembled = !errored; - + assembly.clear(); fuelRods.clear(); sources.clear(); } - + private void floodFill(World world, int x, int y, int z, EntityPlayer player) { - + BlockPos pos = new BlockPos(x, y, z); - + if(assembly.containsKey(pos)) return; if(assembly.size() >= maxSize) { errored = true; sendError(world, x, y, z, "Max size exceeded", player); return; } - + Block block = world.getBlock(x, y, z); - + if(isValidCasing(block)) { assembly.put(pos, block); return; } - + if(isValidCore(block)) { assembly.put(pos, block); if(block == ModBlocks.pwr_fuel) fuelRods.put(pos, block); @@ -185,7 +184,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv sendError(world, x, y, z, "Non-reactor block", player); errored = true; } - + private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) { if(player instanceof EntityPlayerMP) { @@ -198,7 +197,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player); } } - + private boolean isValidCore(Block block) { if(block == ModBlocks.pwr_fuel || block == ModBlocks.pwr_control || @@ -209,7 +208,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv return true; return false; } - + private boolean isValidCasing(Block block) { if(block == ModBlocks.pwr_casing || block == ModBlocks.pwr_reflector || block == ModBlocks.pwr_port) return true; return false; diff --git a/src/main/java/com/hbm/blocks/machine/MachinePlasmaHeater.java b/src/main/java/com/hbm/blocks/machine/MachinePlasmaHeater.java index 08c7f164f..1c138339a 100644 --- a/src/main/java/com/hbm/blocks/machine/MachinePlasmaHeater.java +++ b/src/main/java/com/hbm/blocks/machine/MachinePlasmaHeater.java @@ -1,14 +1,11 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.handler.MultiblockHandlerXR; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -22,6 +19,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.Random; + public class MachinePlasmaHeater extends BlockDummyable { public MachinePlasmaHeater() { @@ -36,7 +35,7 @@ public class MachinePlasmaHeater extends BlockDummyable { if(meta >= 6) return new TileEntityProxyCombo(false, true, true); - + return null; } @@ -44,7 +43,7 @@ public class MachinePlasmaHeater extends BlockDummyable { public Item getItemDropped(int i, Random rand, int j) { return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -53,10 +52,10 @@ public class MachinePlasmaHeater extends BlockDummyable { } else if(!player.isSneaking()) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntityMachinePlasmaHeater entity = (TileEntityMachinePlasmaHeater) world.getTileEntity(pos[0], pos[1], pos[2]); if(entity != null) { @@ -74,21 +73,21 @@ public class MachinePlasmaHeater extends BlockDummyable { MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -3, 2, 1, 1, 1}, this, dir); MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 2, z + dir.offsetZ * o, new int[] {0, 1, 10, -8, 0, 0}, this, dir); - + ForgeDirection side = dir.getRotation(ForgeDirection.UP); - + for(int i = 1; i < 4; i++) { for(int j = -1; j < 2; j++) { - + this.makeExtra(world, x + side.offsetX * j, y + i, z + side.offsetZ * j); } } } - + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - + float f = 0.0625F; - + if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) { return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + f * 8F, z + 1); } else if(world.getBlockMetadata(x, y, z) == ForgeDirection.DOWN.ordinal() && world.getBlock(x, y - 1, z) != this) { @@ -97,11 +96,11 @@ public class MachinePlasmaHeater extends BlockDummyable { return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1); } } - + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { float f = 0.0625F; - + if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f * 8F, 1.0F); } else if(world.getBlockMetadata(x, y, z) == ForgeDirection.DOWN.ordinal() && world.getBlock(x, y - 1, z) != this) { @@ -110,18 +109,18 @@ public class MachinePlasmaHeater extends BlockDummyable { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } } - + protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir)) return false; - + if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -3, 1, 1, 1, 1}, x, y, z, dir)) return false; - + if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 2, z + dir.offsetZ * o, new int[] {0, 1, 10, -8, 0, 0}, x, y, z, dir)) return false; - + return true; } @@ -134,12 +133,12 @@ public class MachinePlasmaHeater extends BlockDummyable { public int getOffset() { return 1; } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int i) { - + if(i >= 12) { - + for(int l = 0; l < 2; l++) world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModBlocks.fusion_heater, 64))); diff --git a/src/main/java/com/hbm/blocks/machine/MachineRadarScreen.java b/src/main/java/com/hbm/blocks/machine/MachineRadarScreen.java index 6f1df1a14..0f6e63d8e 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineRadarScreen.java +++ b/src/main/java/com/hbm/blocks/machine/MachineRadarScreen.java @@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityMachineRadarNT; import com.hbm.tileentity.machine.TileEntityMachineRadarScreen; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -34,18 +33,18 @@ public class MachineRadarScreen extends BlockDummyable { @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote && !player.isSneaking()) { int[] pos = this.findCore(world, x, y, z); if(pos == null) return false; - + TileEntityMachineRadarScreen screen = (TileEntityMachineRadarScreen) world.getTileEntity(pos[0], pos[1], pos[2]); if(screen.linked && world.getTileEntity(screen.refX, screen.refY, screen.refZ) instanceof TileEntityMachineRadarNT) { FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, screen.refX, screen.refY, screen.refZ); } - + return false; } else if(!player.isSneaking()) { return true; diff --git a/src/main/java/com/hbm/blocks/machine/MachineReactorBreeding.java b/src/main/java/com/hbm/blocks/machine/MachineReactorBreeding.java index bde522787..29f5fa213 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineReactorBreeding.java +++ b/src/main/java/com/hbm/blocks/machine/MachineReactorBreeding.java @@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyInventory; import com.hbm.tileentity.machine.TileEntityMachineReactorBreeding; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -12,20 +11,20 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class MachineReactorBreeding extends BlockDummyable { - + public MachineReactorBreeding(Material mat) { super(mat); } @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityMachineReactorBreeding(); - + return new TileEntityProxyInventory(); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -34,10 +33,10 @@ public class MachineReactorBreeding extends BlockDummyable { } else if(!player.isSneaking()) { int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return false; - + TileEntityMachineReactorBreeding entity = (TileEntityMachineReactorBreeding) world.getTileEntity(pos[0], pos[1], pos[2]); if(entity != null) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineReactorControl.java b/src/main/java/com/hbm/blocks/machine/MachineReactorControl.java index 9b7cde970..4f3fc61bf 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineReactorControl.java +++ b/src/main/java/com/hbm/blocks/machine/MachineReactorControl.java @@ -1,11 +1,8 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityReactorControl; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,8 +22,10 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import java.util.Random; + public class MachineReactorControl extends BlockContainer { - + @SideOnly(Side.CLIENT) private IIcon iconTop; @SideOnly(Side.CLIENT) @@ -40,7 +39,7 @@ public class MachineReactorControl extends BlockContainer { public MachineReactorControl(Material p_i45386_1_) { super(p_i45386_1_); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -49,33 +48,33 @@ public class MachineReactorControl extends BlockContainer { this.iconBack = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_back"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_side"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { - + if(metadata == 0) metadata = 3; - + if(metadata == side) return iconFront; - + if(side == 0 || side == 1) return iconTop; - + if(metadata == 2 && side == 3 || metadata == 3 && side == 2 || metadata == 4 && side == 5 || metadata == 5 && side == 4) return iconBack; - + return blockIcon; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); @@ -92,7 +91,7 @@ public class MachineReactorControl extends BlockContainer { { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - + if(itemStack.hasDisplayName()) { ((TileEntityReactorControl)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); @@ -103,13 +102,13 @@ public class MachineReactorControl extends BlockContainer { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityReactorControl(); } - + @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(this); } - + @Override public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { @@ -161,7 +160,7 @@ public class MachineReactorControl extends BlockContainer { super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -190,12 +189,12 @@ public class MachineReactorControl extends BlockContainer { public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) { TileEntityReactorControl entity = (TileEntityReactorControl) world.getTileEntity(x, y, z); - + if(entity != null) { return (int)Math.ceil((double)entity.heat * 15D / 50000D); } - + return 0; } diff --git a/src/main/java/com/hbm/blocks/machine/MachineRotaryFurnace.java b/src/main/java/com/hbm/blocks/machine/MachineRotaryFurnace.java index 523bc10b7..a438ef38e 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineRotaryFurnace.java +++ b/src/main/java/com/hbm/blocks/machine/MachineRotaryFurnace.java @@ -3,7 +3,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockDummyable; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -22,7 +21,7 @@ public class MachineRotaryFurnace extends BlockDummyable { if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid(); return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); @@ -43,7 +42,7 @@ public class MachineRotaryFurnace extends BlockDummyable { super.fillSpace(world, x, y, z, dir, o); x += dir.offsetX * o; z += dir.offsetZ * o; - + ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); //back diff --git a/src/main/java/com/hbm/blocks/machine/MachineSchrabidiumTransmutator.java b/src/main/java/com/hbm/blocks/machine/MachineSchrabidiumTransmutator.java index d89764265..04bc79818 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineSchrabidiumTransmutator.java +++ b/src/main/java/com/hbm/blocks/machine/MachineSchrabidiumTransmutator.java @@ -1,12 +1,9 @@ package com.hbm.blocks.machine; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,16 +20,18 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import java.util.Random; + public class MachineSchrabidiumTransmutator extends BlockContainer { private final Random field_149933_a = new Random(); private static boolean keepInventory; - + @SideOnly(Side.CLIENT) //private IIcon iconFront; private IIcon iconTop; private IIcon iconBottom; - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -40,7 +39,7 @@ public class MachineSchrabidiumTransmutator extends BlockContainer { this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (":transmutator_bottom")); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":transmutator_side"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -50,13 +49,13 @@ public class MachineSchrabidiumTransmutator extends BlockContainer { public MachineSchrabidiumTransmutator(Material p_i45386_1_) { super(p_i45386_1_); } - + @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(ModBlocks.machine_schrabidium_transmutator); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -79,7 +78,7 @@ public class MachineSchrabidiumTransmutator extends BlockContainer { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityMachineSchrabidiumTransmutator(); } - + @Override public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java b/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java index b4a9479ce..6c4a3e29c 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java +++ b/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java @@ -1,15 +1,11 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntitySolarBoiler; import com.hbm.util.I18nUtil; - import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; @@ -17,6 +13,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay { public MachineSolarBoiler(Material mat) { @@ -25,12 +24,12 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay { @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntitySolarBoiler(); if(meta >= extra) return new TileEntityProxyCombo(false, false, true); - + return null; } @@ -47,10 +46,10 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay { @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + x = x + dir.offsetX * o; z = z + dir.offsetZ * o; - + this.makeExtra(world, x, y + 2, z); } @@ -62,19 +61,19 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay { return; TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntitySolarBoiler)) return; - + TileEntitySolarBoiler boiler = (TileEntitySolarBoiler) te; - + List text = new ArrayList<>(); FluidTank[] tanks = boiler.getAllTanks(); for(int i = 0; i < tanks.length; i++) text.add((i < 1 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + tanks[i].getTankType().getLocalizedName() + ": " + tanks[i].getFill() + "/" + tanks[i].getMaxFill() + "mB"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } } diff --git a/src/main/java/com/hbm/blocks/machine/MachineSolderingStation.java b/src/main/java/com/hbm/blocks/machine/MachineSolderingStation.java index 2d1ee34d1..a3d210b79 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineSolderingStation.java +++ b/src/main/java/com/hbm/blocks/machine/MachineSolderingStation.java @@ -3,7 +3,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockDummyable; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineSolderingStation; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -20,7 +19,7 @@ public class MachineSolderingStation extends BlockDummyable { if(meta >= 12) return new TileEntityMachineSolderingStation(); return new TileEntityProxyCombo().inventory().power().fluid(); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return this.standardOpenBehavior(world, x, y, z, player, 0); diff --git a/src/main/java/com/hbm/blocks/machine/MachineSteamEngine.java b/src/main/java/com/hbm/blocks/machine/MachineSteamEngine.java index b3e1c8cd2..dc7f13426 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineSteamEngine.java +++ b/src/main/java/com/hbm/blocks/machine/MachineSteamEngine.java @@ -1,16 +1,11 @@ package com.hbm.blocks.machine; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntitySteamEngine; import com.hbm.util.I18nUtil; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -20,6 +15,10 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + public class MachineSteamEngine extends BlockDummyable implements ILookOverlay, ITooltipProvider { public MachineSteamEngine() { @@ -46,10 +45,10 @@ public class MachineSteamEngine extends BlockDummyable implements ILookOverlay, @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - + x = x + dir.offsetX * o; z = z + dir.offsetZ * o; - + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); this.makeExtra(world, x + rot.offsetX, y + 1, z + rot.offsetZ); @@ -59,23 +58,23 @@ public class MachineSteamEngine extends BlockDummyable implements ILookOverlay, @Override public void printHook(Pre event, World world, int x, int y, int z) { - + int[] pos = this.findCore(world, x, y, z); - + if(pos == null) return; - + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); - + if(!(te instanceof TileEntitySteamEngine)) return; - + TileEntitySteamEngine engine = (TileEntitySteamEngine) te; List text = new ArrayList(); text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + engine.tanks[0].getTankType().getLocalizedName() + ": " + String.format(Locale.US, "%,d", engine.tanks[0].getFill()) + " / " + String.format(Locale.US, "%,d", engine.tanks[0].getMaxFill()) + "mB"); text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + engine.tanks[1].getTankType().getLocalizedName() + ": " + String.format(Locale.US, "%,d", engine.tanks[1].getFill()) + " / " + String.format(Locale.US, "%,d", engine.tanks[1].getMaxFill()) + "mB"); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } diff --git a/src/main/java/com/hbm/blocks/machine/MachineTransformer.java b/src/main/java/com/hbm/blocks/machine/MachineTransformer.java index 5f1980782..1369765fb 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineTransformer.java +++ b/src/main/java/com/hbm/blocks/machine/MachineTransformer.java @@ -3,7 +3,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.TileEntityMachineTransformer; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; @@ -17,7 +16,7 @@ public class MachineTransformer extends BlockContainer { long buffer; int delay; - + @SideOnly(Side.CLIENT) private IIcon iconTop; @@ -26,11 +25,11 @@ public class MachineTransformer extends BlockContainer { buffer = b; delay = d; } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { - + if(this == ModBlocks.machine_transformer || this == ModBlocks.machine_transformer_20) { this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_transformer_top_iron"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_transformer_iron"); diff --git a/src/main/java/com/hbm/blocks/machine/MachineVacuumDistill.java b/src/main/java/com/hbm/blocks/machine/MachineVacuumDistill.java index 6382054c7..ad06c6e1d 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineVacuumDistill.java +++ b/src/main/java/com/hbm/blocks/machine/MachineVacuumDistill.java @@ -3,7 +3,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockDummyable; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineVacuumDistill; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -22,7 +21,7 @@ public class MachineVacuumDistill extends BlockDummyable { if(meta >= 6) return new TileEntityProxyCombo().fluid().power(); return null; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { return standardOpenBehavior(world, x, y, z, player, side); diff --git a/src/main/java/com/hbm/blocks/machine/PinkCloudBroadcaster.java b/src/main/java/com/hbm/blocks/machine/PinkCloudBroadcaster.java index c975e5ae1..eef9a80be 100644 --- a/src/main/java/com/hbm/blocks/machine/PinkCloudBroadcaster.java +++ b/src/main/java/com/hbm/blocks/machine/PinkCloudBroadcaster.java @@ -1,7 +1,6 @@ package com.hbm.blocks.machine; import com.hbm.tileentity.machine.TileEntityBroadcaster; - import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; @@ -22,26 +21,26 @@ public class PinkCloudBroadcaster extends BlockContainer { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityBroadcaster(); } - + @Override public int getRenderType(){ return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); @@ -59,13 +58,13 @@ public class PinkCloudBroadcaster extends BlockContainer { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } } - + @Override public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_); float f = 0.0625F; - + this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f); switch(te) { @@ -83,13 +82,13 @@ public class PinkCloudBroadcaster extends BlockContainer { break; } } - + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { int te = world.getBlockMetadata(x, y, z); float f = 0.0625F; - + this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f); switch(te) { @@ -106,7 +105,7 @@ public class PinkCloudBroadcaster extends BlockContainer { this.setBlockBounds(1*f, 0.0F, 4*f, 15*f, 10*f, 12*f); break; } - + return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } diff --git a/src/main/java/com/hbm/blocks/machine/PistonInserter.java b/src/main/java/com/hbm/blocks/machine/PistonInserter.java index 8b95fed92..bb33d205d 100644 --- a/src/main/java/com/hbm/blocks/machine/PistonInserter.java +++ b/src/main/java/com/hbm/blocks/machine/PistonInserter.java @@ -4,11 +4,13 @@ import java.util.List; import com.hbm.blocks.BlockContainerBase; import com.hbm.blocks.ITooltipProvider; -import com.hbm.tileentity.INBTPacketReceiver; import api.hbm.block.IInsertable; +import com.hbm.tileentity.TileEntityLoadedBase; +import com.hbm.util.BufferUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.material.Material; @@ -34,112 +36,112 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityPistonInserter(); } - + @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) { this.updateState(world, x, y, z); } - + protected void updateState(World world, int x, int y, int z) { if(!world.isRemote) { ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)); - + if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).isNormalCube()) return; //no obstructions allowed! - + boolean flag = checkRedstone(world, x, y, z); TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z); - + if(flag && !piston.lastState && piston.extend <= 0) piston.isRetracting = false; - + piston.lastState = flag; } } - + protected boolean checkRedstone(World world, int x, int y, int z) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(world.getIndirectPowerOutput(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.ordinal())) return true; } - + return false; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(side != world.getBlockMetadata(x, y, z)) return false; - + if(player.isSneaking()) { if(!world.isRemote) { TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z); - + if(piston.slot != null && piston.isRetracting) { ForgeDirection dir = ForgeDirection.getOrientation(piston.getBlockMetadata()); - + EntityItem dust = new EntityItem(world, x + 0.5D + dir.offsetX * 0.75D, y + 0.5D + dir.offsetY * 0.75D, z + 0.5D + dir.offsetZ * 0.75D, piston.slot); piston.slot = null; - + dust.motionX = dir.offsetX * 0.25; dust.motionY = dir.offsetY * 0.25; dust.motionZ = dir.offsetZ * 0.25; world.spawnEntityInWorld(dust); } } - + return true; } else if(player.getHeldItem() != null) { if(!world.isRemote) { TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z); - + if(piston.slot == null) { piston.slot = player.inventory.decrStackSize(player.inventory.currentItem, 1); player.inventoryContainer.detectAndSendChanges(); } } - + return true; } - + return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int l = BlockPistonBase.determineOrientation(world, x, y, z, player); world.setBlockMetadataWithNotify(x, y, z, l, 2); } - + @Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { int meta = world.getBlockMetadata(x, y, z); return meta != side.ordinal() && meta != side.getOpposite().ordinal(); } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { IInventory tileentityfurnace = (IInventory) world.getTileEntity(x, y, z); if(tileentityfurnace != null) { - + ItemStack itemstack = tileentityfurnace.getStackInSlot(0); if(itemstack != null) { float f = world.rand.nextFloat() * 0.8F + 0.1F; float f1 = world.rand.nextFloat() * 0.8F + 0.1F; float f2 = world.rand.nextFloat() * 0.8F + 0.1F; - + while(itemstack.stackSize > 0) { int j1 = world.rand.nextInt(21) + 10; - + if(j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } - + itemstack.stackSize -= j1; EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - + if(itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } @@ -157,22 +159,22 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid super.breakBlock(world, x, y, z, block, meta); } - + @Override public int getRenderType(){ return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + // $%&#$& // %$&&@$%%#% //______ $%@--$@@%&$%$ @@ -203,73 +205,65 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid // |--' / /| |/ .^ ,^\ \ ) // | |_|| || |(_( ) | | // | \_/`-``-`----'___/_____ | - // |___..---' _|____`-----..-----'\ + // |___..---' _|____`-----..-----'\ // |_____________________| @ | ) // average coding session involving tile entities - public static class TileEntityPistonInserter extends TileEntity implements IInventory, INBTPacketReceiver { - + public static class TileEntityPistonInserter extends TileEntityLoadedBase implements IInventory { + public ItemStack slot; - + public int extend; //why don't we just make all these ones serverside? we're never using them on the client anyway public static final int maxExtend = 25; public boolean isRetracting = true; public int delay; - + //prevents funkies from happening with block updates or loading into a server private boolean lastState; - - //when a fake animatorcel gives you something so 20fps you gotta hit him with the true interpolation stare + + //when a fake animatorcel gives you something so 20fps you gotta hit him with the true interpolation stare @SideOnly(Side.CLIENT) public double renderExtend; @SideOnly(Side.CLIENT) public double lastExtend; @SideOnly(Side.CLIENT) private int syncExtend; //what are these for? @SideOnly(Side.CLIENT) private int turnProgress; - + public TileEntityPistonInserter() { } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(delay <= 0) { - + if(this.isRetracting && this.extend > 0) { this.extend--; } else if(!this.isRetracting) { this.extend++; - + if(this.extend >= this.maxExtend) { worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.pressOperate", 1.0F, 1.5F); - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); Block b = worldObj.getBlock(xCoord + dir.offsetX * 2, yCoord + dir.offsetY * 2, zCoord + dir.offsetZ * 2); - + if(b instanceof IInsertable && ((IInsertable) b).insertItem(worldObj, xCoord + dir.offsetX * 2, yCoord + dir.offsetY * 2, zCoord + dir.offsetZ * 2, dir, slot)) { this.decrStackSize(0, 1); } - + this.isRetracting = true; this.delay = 5; } } - + } else { delay--; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("extend", extend); - if(this.slot != null) { - NBTTagCompound stack = new NBTTagCompound(); - slot.writeToNBT(stack); - data.setTag("stack", stack); - } - - INBTPacketReceiver.networkPack(this, data, 25); - + + networkPackNT(25); + } else { this.lastExtend = this.renderExtend; - + if(this.turnProgress > 0) { this.renderExtend += (this.syncExtend - this.renderExtend) / (double) this.turnProgress; this.turnProgress--; @@ -277,24 +271,34 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid this.renderExtend = this.syncExtend; } } - + } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - this.syncExtend = nbt.getInteger("extend"); - - if(nbt.hasKey("stack")) { - NBTTagCompound stack = nbt.getCompoundTag("stack"); + public void serialize(ByteBuf buf) { + buf.writeInt(extend); + + buf.writeBoolean(this.slot != null); + if(this.slot != null) { + BufferUtil.writeNBT(buf, slot.stackTagCompound); + } + + this.turnProgress = 2; + } + + @Override + public void deserialize(ByteBuf buf) { + this.syncExtend = buf.readInt(); + + if(buf.readBoolean()) { + NBTTagCompound stack = BufferUtil.readNBT(buf); this.slot = ItemStack.loadItemStackFromNBT(stack); } else this.slot = null; - + this.turnProgress = 2; } - - /* :3 NBT stuff */ - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -307,7 +311,7 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid nbt.setTag("stack", stack); } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -321,27 +325,27 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid this.slot = null; } } - + @SideOnly(Side.CLIENT) private AxisAlignedBB aabb; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(aabb != null) return aabb; - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).addCoord(dir.offsetX, dir.offsetY, dir.offsetZ); return aabb; } - + /* BS inventory stuff */ - + @Override public int getSizeInventory() { return 1; } - + @Override public ItemStack getStackInSlot(int slot) { return this.slot; } - + @Override public ItemStack decrStackSize(int slot, int amount) { if(this.slot != null) { @@ -350,41 +354,41 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid this.slot = null; return stack; } - + ItemStack stack = this.slot.splitStack(amount); if(this.slot.stackSize == 0) this.slot = null; - + return stack; } - + return null; } - + @Override public ItemStack getStackInSlotOnClosing(int slot) { return null; } - + @Override public void setInventorySlotContents(int slot, ItemStack stack) { this.slot = stack; if(stack != null && stack.stackSize > this.getInventoryStackLimit()) stack.stackSize = this.getInventoryStackLimit(); } - + @Override public String getInventoryName() { return null; } - + @Override public boolean hasCustomInventoryName() { return false; } - + @Override public int getInventoryStackLimit() { return 1; } - + @Override public boolean isUseableByPlayer(EntityPlayer player) { return false; } - + @Override public void openInventory() {} - + @Override public void closeInventory() {} - + @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; } - + } @Override diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java index 1293874a8..234a2a4b9 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKBase.java @@ -3,6 +3,8 @@ package com.hbm.blocks.machine.rbmk; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ILookOverlay; import com.hbm.handler.MultiblockHandlerXR; +import com.hbm.handler.neutron.NeutronNodeWorld; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKNeutronNode; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemRBMKLid; import com.hbm.lib.RefStrings; @@ -11,6 +13,7 @@ import com.hbm.tileentity.machine.rbmk.RBMKDials; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase; import api.hbm.block.IToolable; +import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; @@ -170,6 +173,10 @@ public abstract class RBMKBase extends BlockDummyable implements IToolable, ILoo int i = rbmk.getBlockMetadata(); if(rbmk.hasLid() && rbmk.isLidRemovable()) { + + RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(new BlockPos(te)); + if (node != null) + node.removeLid(); if(!world.isRemote) { if(i == DIR_NORMAL_LID.ordinal() + offset) { diff --git a/src/main/java/com/hbm/blocks/network/BlockCable.java b/src/main/java/com/hbm/blocks/network/BlockCable.java index 60906e5fd..e0b8418a8 100644 --- a/src/main/java/com/hbm/blocks/network/BlockCable.java +++ b/src/main/java/com/hbm/blocks/network/BlockCable.java @@ -3,7 +3,6 @@ package com.hbm.blocks.network; import com.hbm.blocks.ModBlocks; import com.hbm.lib.Library; import com.hbm.tileentity.network.TileEntityCableBaseNT; - import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -28,26 +27,26 @@ public class BlockCable extends BlockContainer { @Override public int getRenderType() { - + if(this == ModBlocks.red_cable_classic) return renderIDClassic; - + return renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - + boolean posX = Library.canConnect(world, x + 1, y, z, Library.POS_X); boolean negX = Library.canConnect(world, x - 1, y, z, Library.NEG_X); boolean posY = Library.canConnect(world, x, y + 1, z, Library.POS_Y); @@ -56,29 +55,29 @@ public class BlockCable extends BlockContainer { boolean negZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z); setBlockBounds(posX, negX, posY, negY, posZ, negZ); - + return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } - + @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { - + boolean posX = Library.canConnect(world, x + 1, y, z, Library.POS_X); boolean negX = Library.canConnect(world, x - 1, y, z, Library.NEG_X); boolean posY = Library.canConnect(world, x, y + 1, z, Library.POS_Y); boolean negY = Library.canConnect(world, x, y - 1, z, Library.NEG_Y); boolean posZ = Library.canConnect(world, x, y, z + 1, Library.POS_Z); boolean negZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z); - + setBlockBounds(posX, negX, posY, negY, posZ, negZ); } - + private void setBlockBounds(boolean posX, boolean negX, boolean posY, boolean negY, boolean posZ, boolean negZ) { - + float pixel = 0.0625F; float min = pixel * 5.5F; float max = pixel * 10.5F; - + float minX = negX ? 0F : min; float maxX = posX ? 1F : max; float minY = negY ? 0F : min; diff --git a/src/main/java/com/hbm/blocks/network/BlockCableGauge.java b/src/main/java/com/hbm/blocks/network/BlockCableGauge.java index bc31744fd..e87094830 100644 --- a/src/main/java/com/hbm/blocks/network/BlockCableGauge.java +++ b/src/main/java/com/hbm/blocks/network/BlockCableGauge.java @@ -1,23 +1,19 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.energymk2.PowerNetMK2; import com.hbm.blocks.IBlockMultiPass; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.handler.CompatHandler; import com.hbm.lib.RefStrings; import com.hbm.render.block.RenderBlockMultipass; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.network.TileEntityCableBaseNT; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; - -import api.hbm.energymk2.PowerNetMK2; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -29,15 +25,17 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; 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.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, ILookOverlay, ITooltipProvider { - + @SideOnly(Side.CLIENT) protected IIcon overlayGauge; public BlockCableGauge() { @@ -48,7 +46,7 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityCableGauge(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { @@ -59,11 +57,11 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - + if(RenderBlockMultipass.currentPass == 0) { return blockIcon; } - + return side == world.getBlockMetadata(x, y, z) ? this.overlayGauge : this.blockIcon; } @@ -85,42 +83,42 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityCableGauge)) return; - + TileEntityCableGauge duct = (TileEntityCableGauge) te; - + List text = new ArrayList(); text.add(BobMathUtil.getShortNumber(duct.deltaTick) + "HE/t"); text.add(BobMathUtil.getShortNumber(duct.deltaLastSecond) + "HE/s"); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } - + @Override public int getRenderType(){ return IBlockMultiPass.getRenderType(); } @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) - public static class TileEntityCableGauge extends TileEntityCableBaseNT implements INBTPacketReceiver, SimpleComponent, CompatHandler.OCComponent { + public static class TileEntityCableGauge extends TileEntityCableBaseNT implements SimpleComponent, CompatHandler.OCComponent { private long deltaTick = 0; private long deltaSecond = 0; private long deltaLastSecond = 0; - + @Override public void updateEntity() { super.updateEntity(); if(!worldObj.isRemote) { - + if(this.node != null && this.node.net != null) { - + PowerNetMK2 net = this.node.net; - + this.deltaTick = net.energyTracker; if(worldObj.getTotalWorldTime() % 20 == 0) { this.deltaLastSecond = this.deltaSecond; @@ -128,18 +126,21 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, } this.deltaSecond += deltaTick; } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("deltaT", deltaTick); - data.setLong("deltaS", deltaLastSecond); - INBTPacketReceiver.networkPack(this, data, 25); + + networkPackNT(25); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.deltaTick = Math.max(nbt.getLong("deltaT"), 0); - this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0); + public void serialize(ByteBuf buf) { + buf.writeLong(deltaTick); + buf.writeLong(deltaLastSecond); + } + + @Override + public void deserialize(ByteBuf buf) { + this.deltaTick = Math.max(buf.readLong(), 0); + this.deltaLastSecond = Math.max(buf.readLong(), 0); } @Override diff --git a/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java b/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java index 334654a4d..68a0232ee 100644 --- a/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java +++ b/src/main/java/com/hbm/blocks/network/BlockCablePaintable.java @@ -1,11 +1,10 @@ package com.hbm.blocks.network; +import api.hbm.block.IToolable; import com.hbm.blocks.IBlockMultiPass; import com.hbm.lib.RefStrings; import com.hbm.render.block.RenderBlockMultipass; import com.hbm.tileentity.network.TileEntityCableBaseNT; - -import api.hbm.block.IToolable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -36,7 +35,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityCablePaintable(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { @@ -48,10 +47,10 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityCablePaintable) { TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile; - + if(pipe.block != null) { if(RenderBlockMultipass.currentPass == 1) { return this.overlay; @@ -60,26 +59,26 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB } } } - + return RenderBlockMultipass.currentPass == 1 ? this.overlay : this.blockIcon; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) { - + ItemStack stack = player.getHeldItem(); - + if(stack != null && stack.getItem() instanceof ItemBlock) { ItemBlock ib = (ItemBlock) stack.getItem(); Block block = ib.field_150939_a; - + if(block.renderAsNormalBlock() && block != this) { - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityCablePaintable) { TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile; - + if(pipe.block == null) { pipe.block = block; pipe.meta = stack.getItemDamage() & 15; @@ -90,20 +89,20 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB } } } - + return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ); } @Override public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { - + if(tool != ToolType.SCREWDRIVER) return false; - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityCablePaintable) { TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile; - + if(pipe.block != null) { pipe.block = null; world.markBlockForUpdate(x, y, z); @@ -111,7 +110,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB return true; } } - + return false; } @@ -119,7 +118,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB public int getPasses() { return 2; } - + @Override public int getRenderType(){ return IBlockMultiPass.getRenderType(); @@ -149,7 +148,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); diff --git a/src/main/java/com/hbm/blocks/network/BlockConveyorBase.java b/src/main/java/com/hbm/blocks/network/BlockConveyorBase.java index 44ce47839..bf816eef1 100644 --- a/src/main/java/com/hbm/blocks/network/BlockConveyorBase.java +++ b/src/main/java/com/hbm/blocks/network/BlockConveyorBase.java @@ -1,12 +1,9 @@ package com.hbm.blocks.network; -import java.util.List; - +import api.hbm.conveyor.IConveyorBelt; import com.hbm.blocks.ITooltipProvider; import com.hbm.entity.item.EntityMovingItem; import com.hbm.lib.RefStrings; - -import api.hbm.conveyor.IConveyorBelt; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,6 +23,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public abstract class BlockConveyorBase extends Block implements IConveyorBelt, ITooltipProvider { @SideOnly(Side.CLIENT) @@ -34,14 +33,14 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt, public BlockConveyorBase() { super(Material.iron); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { super.registerBlockIcons(iconRegister); this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -50,7 +49,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt, return this.sideIcon; if((metadata == 4 || metadata == 5) && (side == 2 || side == 3)) return this.sideIcon; - + return super.getIcon(side, metadata); } @@ -61,7 +60,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt, @Override public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) { - + ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos); //snapping point Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos); @@ -74,7 +73,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt, Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed); return ret; } - + public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) { return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)); } @@ -83,10 +82,10 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt, public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) { ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos); - + itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1); itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1); - + double posX = x + 0.5; double posZ = z + 0.5; @@ -96,7 +95,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt, if(dir.offsetZ != 0) { posZ = itemPos.zCoord; } - + return Vec3.createVectorHelper(posX, y + 0.25, posZ); } diff --git a/src/main/java/com/hbm/blocks/network/BlockConveyorClassic.java b/src/main/java/com/hbm/blocks/network/BlockConveyorClassic.java index 095615595..7a479c699 100644 --- a/src/main/java/com/hbm/blocks/network/BlockConveyorClassic.java +++ b/src/main/java/com/hbm/blocks/network/BlockConveyorClassic.java @@ -1,9 +1,8 @@ package com.hbm.blocks.network; +import api.hbm.conveyor.IConveyorBelt; import com.hbm.entity.item.EntityMovingItem; import com.hbm.lib.RefStrings; - -import api.hbm.conveyor.IConveyorBelt; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -29,14 +28,14 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt { public BlockConveyorClassic() { super(Material.iron); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { super.registerBlockIcons(iconRegister); this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -45,7 +44,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt { return this.sideIcon; if((metadata == 4 || metadata == 5) && (side == 2 || side == 3)) return this.sideIcon; - + return super.getIcon(side, metadata); } @@ -56,7 +55,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt { @Override public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) { - + ForgeDirection dir = getTravelDirection(world, x, y, z, itemPos, speed); //snapping point Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos); @@ -69,7 +68,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt { Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed); return ret; } - + public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) { return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)); } @@ -78,10 +77,10 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt { public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) { ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)); - + itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1); itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1); - + double posX = x + 0.5; double posZ = z + 0.5; @@ -91,7 +90,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt { if(dir.offsetZ != 0) { posZ = itemPos.zCoord; } - + return Vec3.createVectorHelper(posX, y + 0.25, posZ); } diff --git a/src/main/java/com/hbm/blocks/network/CableDetector.java b/src/main/java/com/hbm/blocks/network/CableDetector.java index 7776212ac..18e80c570 100644 --- a/src/main/java/com/hbm/blocks/network/CableDetector.java +++ b/src/main/java/com/hbm/blocks/network/CableDetector.java @@ -2,7 +2,6 @@ package com.hbm.blocks.network; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityCableSwitch; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -21,14 +20,14 @@ public class CableDetector extends BlockContainer { public CableDetector(Material p_i45386_1_) { super(p_i45386_1_); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_on"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_off"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -42,18 +41,18 @@ public class CableDetector extends BlockContainer { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - + boolean on = world.isBlockIndirectlyGettingPowered(x, y, z); int meta = world.getBlockMetadata(x, y, z); - + boolean update = false; - + if(on && meta == 0) { world.setBlockMetadataWithNotify(x, y, z, 1, 2); world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F); update = true; } - + if(!on && meta == 1) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F); diff --git a/src/main/java/com/hbm/blocks/network/CableDiode.java b/src/main/java/com/hbm/blocks/network/CableDiode.java index 246094666..d0f17735b 100644 --- a/src/main/java/com/hbm/blocks/network/CableDiode.java +++ b/src/main/java/com/hbm/blocks/network/CableDiode.java @@ -1,22 +1,18 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.block.IToolable; +import api.hbm.energymk2.IEnergyConnectorBlock; +import api.hbm.energymk2.IEnergyConnectorMK2; +import api.hbm.energymk2.IEnergyReceiverMK2; +import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; +import api.hbm.energymk2.Nodespace; +import api.hbm.energymk2.Nodespace.PowerNode; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.BobMathUtil; import com.hbm.util.Compat; import com.hbm.util.I18nUtil; - -import api.hbm.block.IToolable; -import api.hbm.energymk2.IEnergyConnectorBlock; -import api.hbm.energymk2.IEnergyConnectorMK2; -import api.hbm.energymk2.IEnergyReceiverMK2; -import api.hbm.energymk2.Nodespace; -import api.hbm.energymk2.Nodespace.PowerNode; -import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -37,8 +33,11 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, ILookOverlay, IToolable, ITooltipProvider { - + public CableDiode(Material mat) { super(mat); } @@ -49,23 +48,23 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, public int getRenderType() { return renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { return true; } - + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int l = BlockPistonBase.determineOrientation(world, x, y, z, player); world.setBlockMetadataWithNotify(x, y, z, l, 2); @@ -80,10 +79,10 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { TileEntityDiode te = (TileEntityDiode)world.getTileEntity(x, y, z); - + if(world.isRemote) return true; - + if(tool == ToolType.SCREWDRIVER) { if(te.level < 11) te.level++; @@ -91,7 +90,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, world.markBlockForUpdate(x, y, z); return true; } - + if(tool == ToolType.HAND_DRILL) { if(te.level > 1) te.level--; @@ -99,7 +98,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, world.markBlockForUpdate(x, y, z); return true; } - + if(tool == ToolType.DEFUSER) { int p = te.priority.ordinal() + 1; if(p > 4) p = 0; @@ -108,7 +107,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, world.markBlockForUpdate(x, y, z); return true; } - + return false; } @@ -122,18 +121,18 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityDiode)) return; - + TileEntityDiode diode = (TileEntityDiode) te; - + List text = new ArrayList(); text.add("Max.: " + BobMathUtil.getShortNumber(diode.getMaxPower()) + "HE/t"); text.add("Priority: " + diode.priority.name()); - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } @@ -141,16 +140,16 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityDiode(); } - + public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyReceiverMK2 { - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); level = nbt.getInteger("level"); priority = ConnectionPriority.values()[nbt.getByte("p")]; } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -164,30 +163,30 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); } - + int level = 1; - + private ForgeDirection getDir() { return ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite(); } @Override public void updateEntity() { - + if(!worldObj.isRemote) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - + if(dir == getDir()) continue; - + this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } - + pulses = 0; this.setPower(0); //tick is over, reset our allowed transfe } @@ -197,7 +196,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, public boolean canConnect(ForgeDirection dir) { return dir != getDir(); } - + /** Used as an intra-tick tracker for how much energy has been transmitted, resets to 0 each tick and maxes out based on transfer */ private long power; private boolean recursionBrake = false; @@ -209,23 +208,23 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, if(recursionBrake) return power; - + pulses++; if(this.getPower() >= this.getMaxPower() || pulses > 10) return power; //if we have already maxed out transfer or max pulses, abort - + recursionBrake = true; - + ForgeDirection dir = getDir(); PowerNode node = Nodespace.getNode(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); TileEntity te = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); - + if(node != null && !node.expired && node.hasValidNet() && te instanceof IEnergyConnectorMK2 && ((IEnergyConnectorMK2) te).canConnect(dir.getOpposite())) { long toTransfer = Math.min(power, this.getReceiverSpeed()); long remainder = node.net.sendPowerDiode(toTransfer); long transferred = (toTransfer - remainder); this.power += transferred; power -= transferred; - + } else if(te instanceof IEnergyReceiverMK2 && te != this) { IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te; if(rec.canConnect(dir.getOpposite())) { @@ -236,7 +235,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, return power; } } - + recursionBrake = false; return power; } @@ -255,7 +254,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock, public long getPower() { return Math.min(power, this.getMaxPower()); } - + @Override public void setPower(long power) { this.power = power; diff --git a/src/main/java/com/hbm/blocks/network/CableSwitch.java b/src/main/java/com/hbm/blocks/network/CableSwitch.java index b419ec28a..f62af26b0 100644 --- a/src/main/java/com/hbm/blocks/network/CableSwitch.java +++ b/src/main/java/com/hbm/blocks/network/CableSwitch.java @@ -2,7 +2,6 @@ package com.hbm.blocks.network; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityCableSwitch; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; @@ -21,14 +20,14 @@ public class CableSwitch extends BlockContainer { public CableSwitch(Material p_i45386_1_) { super(p_i45386_1_); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_switch_on"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_switch_off"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -39,7 +38,7 @@ public class CableSwitch extends BlockContainer { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityCableSwitch(); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) @@ -55,10 +54,10 @@ public class CableSwitch extends BlockContainer { world.setBlockMetadataWithNotify(x, y, z, 0, 2); world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F); } - + TileEntityCableSwitch te = (TileEntityCableSwitch) world.getTileEntity(x, y, z); te.updateState(); - + return true; } else { return false; diff --git a/src/main/java/com/hbm/blocks/network/ConnectorRedWire.java b/src/main/java/com/hbm/blocks/network/ConnectorRedWire.java index c60d9e7a8..c97e067b2 100644 --- a/src/main/java/com/hbm/blocks/network/ConnectorRedWire.java +++ b/src/main/java/com/hbm/blocks/network/ConnectorRedWire.java @@ -1,10 +1,7 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.lib.Library; import com.hbm.tileentity.network.TileEntityConnector; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -15,6 +12,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class ConnectorRedWire extends PylonBase { public ConnectorRedWire(Material mat) { @@ -30,26 +29,26 @@ public class ConnectorRedWire extends PylonBase { public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) { return side; } - + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { setBlockBounds(world.getBlockMetadata(x, y, z)); return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } - + @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { setBlockBounds(world.getBlockMetadata(x, y, z)); } - + private void setBlockBounds(int meta) { - + float pixel = 0.0625F; float min = pixel * 5F; float max = pixel * 11F; - + ForgeDirection dir = ForgeDirection.getOrientation(meta).getOpposite(); - + float minX = dir == Library.NEG_X ? 0F : min; float maxX = dir == Library.POS_X ? 1F : max; float minY = dir == Library.NEG_Y ? 0F : min; diff --git a/src/main/java/com/hbm/blocks/network/CraneInserter.java b/src/main/java/com/hbm/blocks/network/CraneInserter.java index b21009505..b83da5278 100644 --- a/src/main/java/com/hbm/blocks/network/CraneInserter.java +++ b/src/main/java/com/hbm/blocks/network/CraneInserter.java @@ -7,7 +7,6 @@ import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityCraneBase; import com.hbm.tileentity.network.TileEntityCraneInserter; import com.hbm.util.InventoryUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -32,7 +31,7 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock { public TileEntityCraneBase createNewTileEntity(World world, int meta) { return new TileEntityCraneInserter(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -62,28 +61,28 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock { public void onItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) { ForgeDirection outputDirection = getOutputSide(world, x, y, z); TileEntity te = world.getTileEntity(x + outputDirection.offsetX, y + outputDirection.offsetY, z + outputDirection.offsetZ); - + if(entity == null || entity.getItemStack() == null || entity.getItemStack().stackSize <= 0) { return; } - + ItemStack toAdd = entity.getItemStack().copy(); - + int[] access = null; - + if(te instanceof ISidedInventory) { ISidedInventory sided = (ISidedInventory) te; access = InventoryUtil.masquerade(sided, outputDirection.getOpposite().ordinal()); } - + if(te instanceof IInventory) { IInventory inv = (IInventory) te; - + addToInventory(inv, access, toAdd, outputDirection.getOpposite().ordinal()); } - + TileEntityCraneInserter inserter = null; - + if(toAdd.stackSize > 0) { inserter = (TileEntityCraneInserter) world.getTileEntity(x, y, z); addToInventory(inserter, null, toAdd, outputDirection.getOpposite().ordinal()); @@ -93,54 +92,54 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock { world.spawnEntityInWorld(drop); } } - + public static ItemStack addToInventory(IInventory inv, int[] access, ItemStack toAdd, int side) { - + ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; int limit = inv.getInventoryStackLimit(); - + int size = access == null ? inv.getSizeInventory() : access.length; - + for(int i = 0; i < size; i++) { int index = access == null ? i : access[i]; ItemStack stack = inv.getStackInSlot(index); - + if(stack != null && toAdd.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(toAdd, stack) && stack.stackSize < Math.min(stack.getMaxStackSize(), limit) && ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) { - + int stackLimit = Math.min(stack.getMaxStackSize(), limit); int amount = Math.min(toAdd.stackSize, stackLimit - stack.stackSize); - + stack.stackSize += amount; toAdd.stackSize -= amount; inv.markDirty(); - + if(toAdd.stackSize == 0) { return null; } } } - + for(int i = 0; i < size; i++) { int index = access == null ? i : access[i]; ItemStack stack = inv.getStackInSlot(index); - + if(stack == null && ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) { - + int amount = Math.min(toAdd.stackSize, limit); - + ItemStack newStack = toAdd.copy(); newStack.stackSize = amount; inv.setInventorySlotContents(index, newStack); toAdd.stackSize -= amount; inv.markDirty(); - + if(toAdd.stackSize == 0) { return null; } } } - + return toAdd; } @@ -156,7 +155,7 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock { public boolean hasComparatorInputOverride() { return true; } - + @Override public int getComparatorInputOverride(World world, int x, int y, int z, int side) { return Container.calcRedstoneFromInventory((TileEntityCraneInserter)world.getTileEntity(x, y, z)); diff --git a/src/main/java/com/hbm/blocks/network/CranePartitioner.java b/src/main/java/com/hbm/blocks/network/CranePartitioner.java index 415ed34aa..f2d0b7cee 100644 --- a/src/main/java/com/hbm/blocks/network/CranePartitioner.java +++ b/src/main/java/com/hbm/blocks/network/CranePartitioner.java @@ -1,21 +1,15 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Random; - +import api.hbm.conveyor.IConveyorBelt; +import api.hbm.conveyor.IConveyorItem; +import api.hbm.conveyor.IConveyorPackage; +import api.hbm.conveyor.IEnterableBlock; import com.hbm.blocks.ITooltipProvider; import com.hbm.entity.item.EntityMovingItem; import com.hbm.inventory.recipes.CrystallizerRecipes; import com.hbm.lib.RefStrings; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.InventoryUtil; - -import api.hbm.conveyor.IConveyorBelt; -import api.hbm.conveyor.IConveyorItem; -import api.hbm.conveyor.IConveyorPackage; -import api.hbm.conveyor.IEnterableBlock; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -37,6 +31,11 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Random; + public class CranePartitioner extends BlockContainer implements IConveyorBelt, IEnterableBlock, ITooltipProvider { @SideOnly(Side.CLIENT) public IIcon iconTop; @@ -48,7 +47,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I public CranePartitioner() { super(Material.iron); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -116,7 +115,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I if(dir.offsetZ != 0) posZ = itemPos.zCoord; return Vec3.createVectorHelper(posX, y + 0.25, posZ); } - + public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) { int meta = world.getBlockMetadata(x, y, z); return ForgeDirection.getOrientation(meta); @@ -137,7 +136,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I world.spawnEntityInWorld(item); } } - + public static class TileEntityCranePartitioner extends TileEntityMachineBase { public TileEntityCranePartitioner() { @@ -148,14 +147,14 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + List stacks = new ArrayList(); for(int i = 0; i < 9; i++) if(slots[i] != null) stacks.add(slots[i]); stacks.sort(stackSizeComparator); boolean markDirty = false; - + for(ItemStack stack : stacks) { int amount = CrystallizerRecipes.getAmount(stack); while(stack.stackSize >= amount) { @@ -168,12 +167,12 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I worldObj.spawnEntityInWorld(item); } } - + for(int i = 0; i < 9; i++) if(slots[i] != null && slots[i].stackSize <= 0) slots[i] = null; if(markDirty) this.markDirty(); } } - + public static Comparator stackSizeComparator = new Comparator() { @Override @@ -204,7 +203,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I } private final Random dropRandom = new Random(); - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntity tile = world.getTileEntity(x, y, z); diff --git a/src/main/java/com/hbm/blocks/network/CraneRouter.java b/src/main/java/com/hbm/blocks/network/CraneRouter.java index a89d2a695..d6f663817 100644 --- a/src/main/java/com/hbm/blocks/network/CraneRouter.java +++ b/src/main/java/com/hbm/blocks/network/CraneRouter.java @@ -1,8 +1,9 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.conveyor.IConveyorBelt; +import api.hbm.conveyor.IConveyorItem; +import api.hbm.conveyor.IConveyorPackage; +import api.hbm.conveyor.IEnterableBlock; import com.hbm.blocks.IBlockMultiPass; import com.hbm.blocks.ITooltipProvider; import com.hbm.entity.item.EntityMovingItem; @@ -11,11 +12,6 @@ import com.hbm.main.MainRegistry; import com.hbm.module.ModulePatternMatcher; import com.hbm.render.block.RenderBlockMultipass; import com.hbm.tileentity.network.TileEntityCraneRouter; - -import api.hbm.conveyor.IConveyorBelt; -import api.hbm.conveyor.IConveyorItem; -import api.hbm.conveyor.IConveyorPackage; -import api.hbm.conveyor.IEnterableBlock; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -33,6 +29,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnterableBlock, ITooltipProvider { @SideOnly(Side.CLIENT) protected IIcon iconOverlay; @@ -46,7 +45,7 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityCraneRouter(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -59,7 +58,7 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt public IIcon getIcon(int side, int metadata) { return RenderBlockMultipass.currentPass == 0 ? this.blockIcon : this.iconOverlay; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -75,10 +74,10 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt @Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess world, int x, int y, int z) { - + if(RenderBlockMultipass.currentPass == 0) return 0xffffff; - + switch(RenderBlockMultipass.currentPass - 1) { case 0: return 0xff0000; case 1: return 0xff8000; @@ -89,7 +88,7 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt default: return 0xffffff; } } - + @Override public int getRenderType(){ return IBlockMultiPass.getRenderType(); @@ -101,10 +100,10 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { - + if(RenderBlockMultipass.currentPass == 0) return true; - + return side == RenderBlockMultipass.currentPass - 1; } @@ -122,40 +121,40 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt public void onItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) { TileEntityCraneRouter router = (TileEntityCraneRouter) world.getTileEntity(x, y, z); ItemStack stack = entity.getItemStack(); - + List validDirs = new ArrayList(); - + //check filters for all sides for(int side = 0; side < 6; side++) { - + ModulePatternMatcher matcher = router.patterns[side]; int mode = router.modes[side]; - + //if the side is disabled or wildcard, skip if(mode == router.MODE_NONE || mode == router.MODE_WILDCARD) continue; - + boolean matchesFilter = false; - + for(int slot = 0; slot < 5; slot++) { ItemStack filter = router.slots[side * 5 + slot]; - + if(filter == null) continue; - + //the filter kicks in so long as one entry matches if(matcher.isValidForFilter(filter, slot, stack)) { matchesFilter = true; break; } } - + //add dir if matches with whitelist on or doesn't match with blacklist on if((mode == router.MODE_WHITELIST && matchesFilter) || (mode == router.MODE_BLACKLIST && !matchesFilter)) { validDirs.add(ForgeDirection.getOrientation(side)); } } - + //if no valid dirs have yet been found, use wildcard if(validDirs.isEmpty()) { for(int side = 0; side < 6; side++) { @@ -164,25 +163,25 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt } } } - + if(validDirs.isEmpty()) { world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy())); return; } - + int i = world.rand.nextInt(validDirs.size()); sendOnRoute(world, x, y, z, entity, validDirs.get(i)); } - + protected void sendOnRoute(World world, int x, int y, int z, IConveyorItem item, ForgeDirection dir) { - + IConveyorBelt belt = null; Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ); - + if(block instanceof IConveyorBelt) { belt = (IConveyorBelt) block; } - + if(belt != null) { EntityMovingItem moving = new EntityMovingItem(world); Vec3 pos = Vec3.createVectorHelper(x + 0.5 + dir.offsetX * 0.55, y + 0.5 + dir.offsetY * 0.55, z + 0.5 + dir.offsetZ * 0.55); diff --git a/src/main/java/com/hbm/blocks/network/CraneSplitter.java b/src/main/java/com/hbm/blocks/network/CraneSplitter.java index a39396fb0..562c495a2 100644 --- a/src/main/java/com/hbm/blocks/network/CraneSplitter.java +++ b/src/main/java/com/hbm/blocks/network/CraneSplitter.java @@ -1,17 +1,14 @@ package com.hbm.blocks.network; -import java.util.List; - -import com.hbm.blocks.BlockDummyable; -import com.hbm.blocks.ITooltipProvider; -import com.hbm.entity.item.EntityMovingItem; -import com.hbm.lib.RefStrings; -import com.hbm.tileentity.network.TileEntityCraneSplitter; - import api.hbm.conveyor.IConveyorBelt; import api.hbm.conveyor.IConveyorItem; import api.hbm.conveyor.IConveyorPackage; import api.hbm.conveyor.IEnterableBlock; +import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ITooltipProvider; +import com.hbm.entity.item.EntityMovingItem; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.network.TileEntityCraneSplitter; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,6 +23,8 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnterableBlock, ITooltipProvider { @SideOnly(Side.CLIENT) public IIcon iconTopLeft; @@ -39,7 +38,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt @SideOnly(Side.CLIENT) public IIcon iconBelt; @SideOnly(Side.CLIENT) public IIcon iconInner; @SideOnly(Side.CLIENT) public IIcon iconInnerSide; - + public CraneSplitter() { super(Material.iron); } @@ -58,7 +57,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt public int getOffset() { return 0; } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -100,7 +99,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt boolean pos = splitter.getPosition(); ItemStack stack = entity.getItemStack(); ForgeDirection rot = ForgeDirection.getOrientation(splitter.getBlockMetadata() - offset).getRotation(ForgeDirection.DOWN); - + if(stack.stackSize % 2 == 0) { stack.stackSize /= 2; spawnMovingItem(world, x, y, z, stack.copy()); @@ -114,7 +113,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt splitter.setPosition(!pos); } } - + private void spawnMovingItem(World world, int x, int y, int z, ItemStack stack) { if(stack.stackSize <= 0) return; EntityMovingItem moving = new EntityMovingItem(world); @@ -152,7 +151,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt if(dir.offsetZ != 0) posZ = itemPos.zCoord; return Vec3.createVectorHelper(posX, y + 0.25, posZ); } - + public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) { int meta = world.getBlockMetadata(x, y, z); if(meta >= 12) return ForgeDirection.getOrientation(meta - offset); diff --git a/src/main/java/com/hbm/blocks/network/DroneCrate.java b/src/main/java/com/hbm/blocks/network/DroneCrate.java index 94641ed8f..78a64be21 100644 --- a/src/main/java/com/hbm/blocks/network/DroneCrate.java +++ b/src/main/java/com/hbm/blocks/network/DroneCrate.java @@ -1,9 +1,5 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.items.ModItems; @@ -11,7 +7,6 @@ import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.network.TileEntityDroneCrate; import com.hbm.util.I18nUtil; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -28,8 +23,12 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltipProvider { - + private static Random rand = new Random(); @SideOnly(Side.CLIENT) private IIcon iconTop; @@ -60,9 +59,9 @@ public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltip @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.drone_linker) return false; - + if(world.isRemote) { return true; } else if(!player.isSneaking()) { @@ -72,7 +71,7 @@ public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltip return false; } } - + @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntityDroneCrate tileentityfurnace = (TileEntityDroneCrate) world.getTileEntity(x, y, z); @@ -124,7 +123,7 @@ public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltip public void printHook(Pre event, World world, int x, int y, int z) { TileEntityDroneCrate tile = (TileEntityDroneCrate) world.getTileEntity(x, y, z); List text = new ArrayList(); - + if(tile.nextY != -1) { text.add("Next waypoint: " + tile.nextX + " / " + tile.nextY + " / " + tile.nextZ); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); diff --git a/src/main/java/com/hbm/blocks/network/DroneDock.java b/src/main/java/com/hbm/blocks/network/DroneDock.java index df16956fc..226d3c3f0 100644 --- a/src/main/java/com/hbm/blocks/network/DroneDock.java +++ b/src/main/java/com/hbm/blocks/network/DroneDock.java @@ -1,14 +1,11 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.blocks.ITooltipProvider; import com.hbm.blocks.ModBlocks; import com.hbm.main.MainRegistry; import com.hbm.tileentity.network.TileEntityDroneDock; import com.hbm.tileentity.network.TileEntityDroneProvider; import com.hbm.tileentity.network.TileEntityDroneRequester; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -21,6 +18,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import java.util.List; + public class DroneDock extends BlockContainer implements ITooltipProvider { @SideOnly(Side.CLIENT) private IIcon iconTop; @@ -36,7 +35,7 @@ public class DroneDock extends BlockContainer implements ITooltipProvider { if(this == ModBlocks.drone_dock) return new TileEntityDroneDock(); if(this == ModBlocks.drone_crate_provider) return new TileEntityDroneProvider(); if(this == ModBlocks.drone_crate_requester) return new TileEntityDroneRequester(); - + return null; } @@ -53,7 +52,7 @@ public class DroneDock extends BlockContainer implements ITooltipProvider { public IIcon getIcon(int side, int metadata) { return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { diff --git a/src/main/java/com/hbm/blocks/network/DroneWaypoint.java b/src/main/java/com/hbm/blocks/network/DroneWaypoint.java index 28e9e338b..16f5c60eb 100644 --- a/src/main/java/com/hbm/blocks/network/DroneWaypoint.java +++ b/src/main/java/com/hbm/blocks/network/DroneWaypoint.java @@ -1,14 +1,10 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.items.ModItems; import com.hbm.tileentity.network.TileEntityDroneWaypoint; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -25,6 +21,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITooltipProvider { public DroneWaypoint() { @@ -40,34 +39,34 @@ public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITool public int getRenderType() { return RadioTorchBase.renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { return true; } - + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } - + @Override public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) { - + int meta = world.getBlockMetadata(x, y, z) & 7; ForgeDirection dir = ForgeDirection.getOrientation(meta); - + this.setBlockBounds( dir.offsetX == 1 ? 0F : 0.375F, dir.offsetY == 1 ? 0F : 0.375F, @@ -87,34 +86,34 @@ public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITool @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - + int meta = world.getBlockMetadata(x, y, z); ForgeDirection dir = ForgeDirection.getOrientation(meta); Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ); - + if(!b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) && (!b.renderAsNormalBlock() || b.isAir(world, x, y, z))) { this.dropBlockAsItem(world, x, y, z, meta, 0); world.setBlockToAir(x, y, z); } } - + @Override public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) { if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false; - + ForgeDirection dir = ForgeDirection.getOrientation(side); Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ); - + return b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) || (b.renderAsNormalBlock() && !b.isAir(world, x, y, z)); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.drone_linker) return false; - + if(world.isRemote) return true; - + TileEntityDroneWaypoint tile = (TileEntityDroneWaypoint) world.getTileEntity(x, y, z); tile.addHeight(player.isSneaking() ? - 1 : 1); return true; @@ -129,13 +128,13 @@ public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITool public void printHook(Pre event, World world, int x, int y, int z) { TileEntityDroneWaypoint tile = (TileEntityDroneWaypoint) world.getTileEntity(x, y, z); List text = new ArrayList(); - + text.add("Waypoint distance: " + tile.height); - + if(tile.nextY != -1) { text.add("Next waypoint: " + tile.nextX + " / " + tile.nextY + " / " + tile.nextZ); } - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } } diff --git a/src/main/java/com/hbm/blocks/network/DroneWaypointRequest.java b/src/main/java/com/hbm/blocks/network/DroneWaypointRequest.java index a02b63a3c..82318b0a8 100644 --- a/src/main/java/com/hbm/blocks/network/DroneWaypointRequest.java +++ b/src/main/java/com/hbm/blocks/network/DroneWaypointRequest.java @@ -1,7 +1,6 @@ package com.hbm.blocks.network; import com.hbm.tileentity.network.TileEntityDroneWaypointRequest; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -30,34 +29,34 @@ public class DroneWaypointRequest extends BlockContainer { public int getRenderType() { return RadioTorchBase.renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { return true; } - + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } - + @Override public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) { - + int meta = world.getBlockMetadata(x, y, z) & 7; ForgeDirection dir = ForgeDirection.getOrientation(meta); - + this.setBlockBounds( dir.offsetX == 1 ? 0F : 0.375F, dir.offsetY == 1 ? 0F : 0.375F, @@ -77,24 +76,24 @@ public class DroneWaypointRequest extends BlockContainer { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - + int meta = world.getBlockMetadata(x, y, z); ForgeDirection dir = ForgeDirection.getOrientation(meta); Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ); - + if(!b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) && (!b.renderAsNormalBlock() || b.isAir(world, x, y, z))) { this.dropBlockAsItem(world, x, y, z, meta, 0); world.setBlockToAir(x, y, z); } } - + @Override public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) { if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false; - + ForgeDirection dir = ForgeDirection.getOrientation(side); Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ); - + return b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) || (b.renderAsNormalBlock() && !b.isAir(world, x, y, z)); } } diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctBase.java b/src/main/java/com/hbm/blocks/network/FluidDuctBase.java index 65af59af5..3016bc287 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctBase.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctBase.java @@ -1,8 +1,7 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.fluid.IPipeNet; +import api.hbm.fluid.PipeNet; import com.hbm.blocks.IAnalyzable; import com.hbm.extprop.HbmPlayerProps; import com.hbm.handler.HbmKeybinds; @@ -10,9 +9,6 @@ import com.hbm.inventory.fluid.FluidType; import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.items.machine.ItemFluidIDMulti; import com.hbm.tileentity.network.TileEntityPipeBaseNT; - -import api.hbm.fluid.IPipeNet; -import api.hbm.fluid.PipeNet; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -22,6 +18,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IAnalyzable { public FluidDuctBase(Material mat) { @@ -35,15 +34,15 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) { IItemFluidIdentifier id = (IItemFluidIdentifier) player.getHeldItem().getItem(); FluidType type = id.getType(world, x, y, z, player.getHeldItem()); - + if(!HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_CTRL) && !player.isSneaking()) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityPipeBaseNT) { TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; @@ -64,7 +63,7 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA } } } else { - + TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityPipeBaseNT) { @@ -86,25 +85,25 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA } } } - + return false; } @Override public void changeTypeRecursively(World world, int x, int y, int z, FluidType prevType, FluidType type, int loopsRemaining) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityPipeBaseNT) { TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; - + if(pipe.getType() == prevType && pipe.getType() != type) { pipe.setType(type); - + if(loopsRemaining > 0) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { Block b = world.getBlock(x, y, z); - + if(b instanceof IBlockFluidDuct) { ((IBlockFluidDuct) b).changeTypeRecursively(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, prevType, type, loopsRemaining - 1); } @@ -116,20 +115,20 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA @Override public List getDebugInfo(World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityPipeBaseNT) { TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te; FluidType type = pipe.getType(); - + if(type != null) { - + IPipeNet net = pipe.getPipeNet(type); - + if(net instanceof PipeNet) { PipeNet pipeNet = (PipeNet) net; - + List debug = new ArrayList(); debug.add("=== DEBUG START ==="); debug.addAll(pipeNet.debug); @@ -141,7 +140,7 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA } } } - + return null; } } diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctBox.java b/src/main/java/com/hbm/blocks/network/FluidDuctBox.java index fb759fb93..6d091e422 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctBox.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctBox.java @@ -1,15 +1,11 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.IBlockMulti; import com.hbm.blocks.ILookOverlay; import com.hbm.lib.Library; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityPipeBaseNT; import com.hbm.util.I18nUtil; - import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -27,6 +23,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOverlay { @SideOnly(Side.CLIENT) public IIcon[] iconStraight; @@ -36,13 +35,13 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve @SideOnly(Side.CLIENT) public IIcon[] iconCurveBL; @SideOnly(Side.CLIENT) public IIcon[] iconCurveBR; @SideOnly(Side.CLIENT) public IIcon[][] iconJunction; - + private static final String[] materials = new String[] { "silver", "copper", "white" }; public FluidDuctBox(Material mat) { super(mat); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -79,13 +78,13 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te); boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te); boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te); - + int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); - + int meta = world.getBlockMetadata(x, y, z); int m = rectify(meta); - + if((mask & 0b001111) == 0 && mask > 0) { return (side == 4 || side == 5) ? iconEnd[m] : iconStraight[m]; } else if((mask & 0b111100) == 0 && mask > 0) { @@ -112,41 +111,41 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve if(pX && pZ) return side == 0 ? iconCurveBR[m] : iconCurveBR[m]; if(nX && nZ) return side == 0 ? iconCurveTL[m] : iconCurveTL[m]; if(nX && pZ) return side == 0 ? iconCurveBL[m] : iconCurveBL[m]; - + return iconJunction[m][meta / 3]; } - + return iconJunction[m][meta / 3]; } - + @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { for(int i = 0; i < 15; ++i) { list.add(new ItemStack(item, 1, i)); } } - + public int damageDropped(int meta) { return meta % 15; } - + public static int renderID = RenderingRegistry.getNextAvailableRenderId(); @Override public int getRenderType() { return renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { @@ -160,7 +159,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve @Override public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) { - + List bbs = new ArrayList(); TileEntity te = world.getTileEntity(x, y, z); @@ -170,9 +169,9 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve double jLower = 0.0625D; double jUpper = 0.9375D; int meta = world.getBlockMetadata(x, y, z); - + for(int i = 2; i < 13; i += 3) { - + if(meta > i) { lower += 0.0625D; upper -= 0.0625D; @@ -180,7 +179,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve jUpper -= 0.0625D; } } - + boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te); boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te); boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te); @@ -189,7 +188,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te); int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); - + if(mask == 0) { bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper)); } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { @@ -199,13 +198,13 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + 1.0D)); } else { - + if(count != 2) { bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper)); } else { bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + lower, x + upper, y + upper, z + upper)); } - + if(pX) bbs.add(AxisAlignedBB.getBoundingBox(x + upper, y + lower, z + lower, x + 1.0D, y + upper, z + upper)); if(nX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + lower, y + upper, z + upper)); if(pY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + upper, z + lower, x + upper, y + 1.0D, z + upper)); @@ -213,7 +212,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve if(pZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + upper, x + upper, y + upper, z + 1.0D)); if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + lower)); } - + for(AxisAlignedBB bb : bbs) { if(entityBounding.intersectsWith(bb)) { list.add(bb); @@ -244,9 +243,9 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve float jLower = 0.0625F; float jUpper = 0.9375F; int meta = world.getBlockMetadata(x, y, z); - + for(int i = 2; i < 13; i += 3) { - + if(meta > i) { lower += 0.0625F; upper -= 0.0625F; @@ -254,7 +253,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve jUpper -= 0.0625F; } } - + boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te); boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te); boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te); @@ -263,7 +262,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te); int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0); - + if(mask == 0) { this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper); } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { @@ -273,7 +272,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { this.setBlockBounds(lower, lower, 0F, upper, upper, 1F); } else { - + if(count != 2) { this.setBlockBounds( nX ? 0F : jLower, @@ -293,7 +292,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve } } } - + public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) { if(tile instanceof TileEntityPipeBaseNT) { return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, ((TileEntityPipeBaseNT) tile).getType()); @@ -303,21 +302,21 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityPipeBaseNT)) return; - + TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te; - + List text = new ArrayList(); text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName()); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } - + public static int cachedColor = 0xffffff; - + @Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess world, int x, int y, int z) { diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java b/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java index 41a081993..4384b908b 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctBoxExhaust.java @@ -1,15 +1,11 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.fluid.Fluids; import com.hbm.lib.Library; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityPipeExhaust; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; @@ -24,6 +20,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class FluidDuctBoxExhaust extends FluidDuctBox { public FluidDuctBoxExhaust(Material mat) { @@ -34,7 +33,7 @@ public class FluidDuctBoxExhaust extends FluidDuctBox { public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityPipeExhaust(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -56,7 +55,7 @@ public class FluidDuctBoxExhaust extends FluidDuctBox { iconCurveBR[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_curve_br"); for(int i = 0; i < 5; i++) iconJunction[0][i] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_junction_" + i); } - + public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) { return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE) || Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, Fluids.SMOKE_LEADED) || @@ -67,7 +66,7 @@ public class FluidDuctBoxExhaust extends FluidDuctBox { public int getSubCount() { return 1; } - + @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { for(int i = 0; i < 15; i += 3) { diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java b/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java index 2c60fbc59..44d66e8f8 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctGauge.java @@ -1,10 +1,6 @@ package com.hbm.blocks.network; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - +import api.hbm.fluid.IPipeNet; import com.hbm.blocks.IBlockMultiPass; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; @@ -12,14 +8,12 @@ import com.hbm.handler.CompatHandler; import com.hbm.inventory.fluid.Fluids; import com.hbm.lib.RefStrings; import com.hbm.render.block.RenderBlockMultipass; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.network.TileEntityPipeBaseNT; import com.hbm.util.I18nUtil; - -import api.hbm.fluid.IPipeNet; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -30,13 +24,17 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; 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.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, ILookOverlay, ITooltipProvider { @SideOnly(Side.CLIENT) protected IIcon overlay; @@ -50,7 +48,7 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityPipeGauge(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { @@ -62,11 +60,11 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - + if(RenderBlockMultipass.currentPass == 0) { return blockIcon; } - + return side == world.getBlockMetadata(x, y, z) ? this.overlayGauge : this.overlay; } @@ -88,34 +86,34 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityPipeBaseNT)) return; - + TileEntityPipeGauge duct = (TileEntityPipeGauge) te; - + List text = new ArrayList(); text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName()); text.add(String.format(Locale.US, "%,d", duct.deltaTick) + " mB/t"); text.add(String.format(Locale.US, "%,d", duct.deltaLastSecond) + " mB/s"); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } - + @Override public int getRenderType(){ return IBlockMultiPass.getRenderType(); } @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) - public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements INBTPacketReceiver, SimpleComponent, CompatHandler.OCComponent { + public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements SimpleComponent, CompatHandler.OCComponent { private BigInteger lastMeasurement = BigInteger.valueOf(10); private long deltaTick = 0; private long deltaSecond = 0; private long deltaLastSecond = 0; - + @Override public void updateEntity() { super.updateEntity(); @@ -123,12 +121,12 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL if(!worldObj.isRemote) { IPipeNet net = this.getPipeNet(this.getType()); - + if(net != null && this.getType() != Fluids.NONE) { BigInteger total = net.getTotalTransfer(); BigInteger delta = total.subtract(this.lastMeasurement); this.lastMeasurement = total; - + try { this.deltaTick = delta.longValueExact(); if(worldObj.getTotalWorldTime() % 20 == 0) { @@ -136,21 +134,24 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL this.deltaSecond = 0; } this.deltaSecond += deltaTick; - + } catch(Exception ex) { } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("deltaT", deltaTick); - data.setLong("deltaS", deltaLastSecond); - INBTPacketReceiver.networkPack(this, data, 25); + + networkPackNT(25); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.deltaTick = Math.max(nbt.getLong("deltaT"), 0); - this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0); + public void serialize(ByteBuf buf) { + buf.writeLong(deltaTick); + buf.writeLong(deltaLastSecond); + } + + @Override + public void deserialize(ByteBuf buf) { + this.deltaTick = Math.max(buf.readLong(), 0); + this.deltaLastSecond = Math.max(buf.readLong(), 0); } @Optional.Method(modid = "OpenComputers") diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctPaintable.java b/src/main/java/com/hbm/blocks/network/FluidDuctPaintable.java index 6777195d8..37599923b 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctPaintable.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctPaintable.java @@ -1,16 +1,12 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.block.IToolable; import com.hbm.blocks.IBlockMultiPass; import com.hbm.blocks.ILookOverlay; import com.hbm.lib.RefStrings; import com.hbm.render.block.RenderBlockMultipass; import com.hbm.tileentity.network.TileEntityPipeBaseNT; import com.hbm.util.I18nUtil; - -import api.hbm.block.IToolable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -26,6 +22,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlockMultiPass, ILookOverlay { @SideOnly(Side.CLIENT) protected IIcon overlay; @@ -39,7 +38,7 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityPipePaintable(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { @@ -52,10 +51,10 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityPipePaintable) { TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile; - + if(pipe.block != null) { if(RenderBlockMultipass.currentPass == 1) { return this.overlay; @@ -64,46 +63,46 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo } } } - + return RenderBlockMultipass.currentPass == 1 ? this.overlayColor : this.blockIcon; } @Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess world, int x, int y, int z) { - + if(RenderBlockMultipass.currentPass == 0) return 0xffffff; - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityPipePaintable) { TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile; - + if(pipe.block == null) { return pipe.getType().getColor(); } } - + return 0xffffff; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) { - + ItemStack stack = player.getHeldItem(); - + if(stack != null && stack.getItem() instanceof ItemBlock) { ItemBlock ib = (ItemBlock) stack.getItem(); Block block = ib.field_150939_a; - + if(block.renderAsNormalBlock() && block != this) { - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityPipePaintable) { TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile; - + if(pipe.block == null) { pipe.block = block; pipe.meta = stack.getItemDamage() & 15; @@ -114,20 +113,20 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo } } } - + return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ); } @Override public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) { - + if(tool != ToolType.SCREWDRIVER) return false; - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityPipePaintable) { TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile; - + if(pipe.block != null) { pipe.block = null; world.markBlockForUpdate(x, y, z); @@ -135,7 +134,7 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo return true; } } - + return false; } @@ -143,7 +142,7 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo public int getPasses() { return 2; } - + @Override public int getRenderType(){ return IBlockMultiPass.getRenderType(); @@ -151,19 +150,19 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityPipeBaseNT)) return; - + TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te; - + List text = new ArrayList(); text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName()); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } - + public static class TileEntityPipePaintable extends TileEntityPipeBaseNT { private Block block; diff --git a/src/main/java/com/hbm/blocks/network/FluidDuctStandard.java b/src/main/java/com/hbm/blocks/network/FluidDuctStandard.java index e482398c9..d1b46bc94 100644 --- a/src/main/java/com/hbm/blocks/network/FluidDuctStandard.java +++ b/src/main/java/com/hbm/blocks/network/FluidDuctStandard.java @@ -1,8 +1,5 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.IBlockMulti; import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.fluid.FluidType; @@ -11,7 +8,6 @@ import com.hbm.lib.Library; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityPipeBaseNT; import com.hbm.util.I18nUtil; - import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -31,6 +27,9 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILookOverlay { @SideOnly(Side.CLIENT) @@ -41,7 +40,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo public FluidDuctStandard(Material mat) { super(mat); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -56,20 +55,20 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo this.overlay[1] = iconRegister.registerIcon(RefStrings.MODID + ":pipe_silver_overlay"); this.overlay[2] = iconRegister.registerIcon(RefStrings.MODID + ":pipe_colored_overlay"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return side == 0 ? this.icon[rectify(metadata)] : this.overlay[rectify(metadata)]; } - + @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { for(int i = 0; i < 3; ++i) { list.add(new ItemStack(item, 1, i)); } } - + public int damageDropped(int meta) { return rectify(meta); } @@ -95,7 +94,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo return new ItemStack(ModItems.fluid_duct, 1, metadata).getItem(); } */ - + @Override @SideOnly(Side.CLIENT) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { @@ -109,19 +108,19 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo } return super.getPickBlock(target, world, x, y, z, player); } - + public static int renderID = RenderingRegistry.getNextAvailableRenderId(); - + @Override public int getRenderType() { return renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; @@ -134,7 +133,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo @Override public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) { - + List bbs = new ArrayList(); TileEntity te = world.getTileEntity(x, y, z); @@ -149,7 +148,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, type); boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, type); int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); - + if(mask == 0) { bbs.add(AxisAlignedBB.getBoundingBox(x + 0.6875D, y + 0.3125D, z + 0.3125D, x + 1.0D, y + 0.6875D, z + 0.6875D)); bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + 0.3125D, z + 0.3125D, x + 0.3125D, y + 0.6875D, z + 0.6875D)); @@ -164,9 +163,9 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.0D, x + 0.6875D, y + 0.6875D, z + 1.0D)); } else { - + bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.3125D, x + 0.6875D, y + 0.6875D, z + 0.6875D)); - + if(pX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.6875D, y + 0.3125D, z + 0.3125D, x + 1.0D, y + 0.6875D, z + 0.6875D)); if(nX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + 0.3125D, z + 0.3125D, x + 0.3125D, y + 0.6875D, z + 0.6875D)); if(pY) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.6875D, z + 0.3125D, x + 0.6875D, y + 1.0D, z + 0.6875D)); @@ -175,7 +174,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.0D, x + 0.6875D, y + 0.6875D, z + 0.3125D)); } } - + for(AxisAlignedBB bb : bbs) { if(entityBounding.intersectsWith(bb)) { list.add(bb); @@ -211,7 +210,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, type); boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, type); int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0); - + if(mask == 0) { this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F); } else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) { @@ -221,7 +220,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo } else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) { this.setBlockBounds(0.3125F, 0.3125F, 0F, 0.6875F, 0.6875F, 1F); } else { - + this.setBlockBounds( nX ? 0F : 0.3125F, nY ? 0F : 0.3125F, @@ -232,21 +231,21 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo } } } - + public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, FluidType type) { return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, type); } @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityPipeBaseNT)) return; - + TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te; - + List text = new ArrayList(); text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName()); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); diff --git a/src/main/java/com/hbm/blocks/network/FluidSwitch.java b/src/main/java/com/hbm/blocks/network/FluidSwitch.java index f4fc8c82d..77ed6519d 100644 --- a/src/main/java/com/hbm/blocks/network/FluidSwitch.java +++ b/src/main/java/com/hbm/blocks/network/FluidSwitch.java @@ -1,13 +1,9 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityFluidValve; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -18,6 +14,9 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + public class FluidSwitch extends FluidDuctBase implements ILookOverlay { @SideOnly(Side.CLIENT) @@ -26,14 +25,14 @@ public class FluidSwitch extends FluidDuctBase implements ILookOverlay { public FluidSwitch(Material mat) { super(mat); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_on"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_off"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -47,18 +46,18 @@ public class FluidSwitch extends FluidDuctBase implements ILookOverlay { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - + boolean on = world.isBlockIndirectlyGettingPowered(x, y, z); int meta = world.getBlockMetadata(x, y, z); - + boolean update = false; - + if(on && meta == 0) { world.setBlockMetadataWithNotify(x, y, z, 1, 2); world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F); update = true; } - + if(!on && meta == 1) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F); @@ -73,14 +72,14 @@ public class FluidSwitch extends FluidDuctBase implements ILookOverlay { @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityFluidValve)) return; - + TileEntityFluidValve duct = (TileEntityFluidValve) te; - + List text = new ArrayList(); text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName()); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); diff --git a/src/main/java/com/hbm/blocks/network/FluidValve.java b/src/main/java/com/hbm/blocks/network/FluidValve.java index bfea2582e..7c05600e8 100644 --- a/src/main/java/com/hbm/blocks/network/FluidValve.java +++ b/src/main/java/com/hbm/blocks/network/FluidValve.java @@ -1,13 +1,9 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityFluidValve; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; @@ -18,6 +14,9 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + public class FluidValve extends FluidDuctBase implements ILookOverlay { @SideOnly(Side.CLIENT) @@ -26,14 +25,14 @@ public class FluidValve extends FluidDuctBase implements ILookOverlay { public FluidValve(Material mat) { super(mat); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_on"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_off"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -44,14 +43,14 @@ public class FluidValve extends FluidDuctBase implements ILookOverlay { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityFluidValve(); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - + if(world.isRemote) return true; - + if(super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ)) return true; - + if(!player.isSneaking()) { int meta = world.getBlockMetadata(x, y, z); TileEntityFluidValve te = (TileEntityFluidValve) world.getTileEntity(x, y, z); @@ -62,9 +61,9 @@ public class FluidValve extends FluidDuctBase implements ILookOverlay { world.setBlockMetadataWithNotify(x, y, z, 0, 2); world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F); } - + te.updateState(); - + return true; } else { return false; @@ -73,14 +72,14 @@ public class FluidValve extends FluidDuctBase implements ILookOverlay { @Override public void printHook(Pre event, World world, int x, int y, int z) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(!(te instanceof TileEntityFluidValve)) return; - + TileEntityFluidValve duct = (TileEntityFluidValve) te; - + List text = new ArrayList(); text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName()); ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); diff --git a/src/main/java/com/hbm/blocks/network/IBlockFluidDuct.java b/src/main/java/com/hbm/blocks/network/IBlockFluidDuct.java index c222b595c..c537a374d 100644 --- a/src/main/java/com/hbm/blocks/network/IBlockFluidDuct.java +++ b/src/main/java/com/hbm/blocks/network/IBlockFluidDuct.java @@ -1,7 +1,6 @@ package com.hbm.blocks.network; import com.hbm.inventory.fluid.FluidType; - import net.minecraft.world.World; public interface IBlockFluidDuct { diff --git a/src/main/java/com/hbm/blocks/network/PylonBase.java b/src/main/java/com/hbm/blocks/network/PylonBase.java index bf35c9fbe..95a2476f7 100644 --- a/src/main/java/com/hbm/blocks/network/PylonBase.java +++ b/src/main/java/com/hbm/blocks/network/PylonBase.java @@ -2,7 +2,6 @@ package com.hbm.blocks.network; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.network.TileEntityPylonBase; - import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -18,31 +17,31 @@ public abstract class PylonBase extends BlockContainer implements ITooltipProvid @Override public void breakBlock(World world, int x, int y, int z, Block b, int m) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityPylonBase) { ((TileEntityPylonBase)te).disconnectAll(); } - + super.breakBlock(world, x, y, z, b, m); } - + @Override public int getRenderType(){ return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { diff --git a/src/main/java/com/hbm/blocks/network/PylonLarge.java b/src/main/java/com/hbm/blocks/network/PylonLarge.java index 6333a6e28..a81a1af5f 100644 --- a/src/main/java/com/hbm/blocks/network/PylonLarge.java +++ b/src/main/java/com/hbm/blocks/network/PylonLarge.java @@ -1,12 +1,9 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.network.TileEntityPylonBase; import com.hbm.tileentity.network.TileEntityPylonLarge; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -17,6 +14,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class PylonLarge extends BlockDummyable implements ITooltipProvider { public PylonLarge(Material mat) { @@ -25,7 +24,7 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityPylonLarge(); return null; @@ -50,19 +49,19 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { @Override public void breakBlock(World world, int x, int y, int z, Block b, int m) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityPylonBase) { ((TileEntityPylonBase)te).disconnectAll(); } - + super.breakBlock(world, x, y, z, b, m); } @Override protected int getMetaForCore(World world, int x, int y, int z, EntityPlayer player, int original) { - + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 180.0F + 0.5D) & 3; ForgeDirection dir = ForgeDirection.NORTH; @@ -79,10 +78,10 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { if(i == 3) { dir = ForgeDirection.getOrientation(4); } - + return dir.ordinal() + offset; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { diff --git a/src/main/java/com/hbm/blocks/network/PylonMedium.java b/src/main/java/com/hbm/blocks/network/PylonMedium.java index 7a29f4614..5f4e0957d 100644 --- a/src/main/java/com/hbm/blocks/network/PylonMedium.java +++ b/src/main/java/com/hbm/blocks/network/PylonMedium.java @@ -1,12 +1,9 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.network.TileEntityPylonBase; import com.hbm.tileentity.network.TileEntityPylonMedium; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -15,6 +12,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import java.util.List; + public class PylonMedium extends BlockDummyable implements ITooltipProvider { public PylonMedium(Material mat) { @@ -23,7 +22,7 @@ public class PylonMedium extends BlockDummyable implements ITooltipProvider { @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntityPylonMedium(); return null; } @@ -50,7 +49,7 @@ public class PylonMedium extends BlockDummyable implements ITooltipProvider { if(te instanceof TileEntityPylonBase) ((TileEntityPylonBase)te).disconnectAll(); super.breakBlock(world, x, y, z, b, m); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { diff --git a/src/main/java/com/hbm/blocks/network/PylonRedWire.java b/src/main/java/com/hbm/blocks/network/PylonRedWire.java index 79a44f541..8594cbb72 100644 --- a/src/main/java/com/hbm/blocks/network/PylonRedWire.java +++ b/src/main/java/com/hbm/blocks/network/PylonRedWire.java @@ -1,9 +1,6 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.tileentity.network.TileEntityPylon; - import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -11,6 +8,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import java.util.List; + public class PylonRedWire extends PylonBase { public PylonRedWire(Material material) { diff --git a/src/main/java/com/hbm/blocks/network/RadioTelex.java b/src/main/java/com/hbm/blocks/network/RadioTelex.java index 8b7614b51..5d042ff63 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTelex.java +++ b/src/main/java/com/hbm/blocks/network/RadioTelex.java @@ -3,7 +3,6 @@ package com.hbm.blocks.network; import com.hbm.blocks.BlockDummyable; import com.hbm.main.MainRegistry; import com.hbm.tileentity.network.TileEntityRadioTelex; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -31,7 +30,7 @@ public class RadioTelex extends BlockDummyable { public int getOffset() { return 0; } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote && !player.isSneaking()) { diff --git a/src/main/java/com/hbm/blocks/network/RadioTorchBase.java b/src/main/java/com/hbm/blocks/network/RadioTorchBase.java index 4ebd140fd..35e69429c 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTorchBase.java +++ b/src/main/java/com/hbm/blocks/network/RadioTorchBase.java @@ -1,12 +1,9 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; - import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; @@ -23,6 +20,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + /** * Base class for all torch-like RTTY blocks * @author hbm @@ -39,34 +38,34 @@ public abstract class RadioTorchBase extends BlockContainer implements IGUIProvi public int getRenderType() { return renderID; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { return true; } - + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } - + @Override public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) { - + int meta = world.getBlockMetadata(x, y, z) & 7; ForgeDirection dir = ForgeDirection.getOrientation(meta); - + this.setBlockBounds( dir.offsetX == 1 ? 0F : 0.375F, dir.offsetY == 1 ? 0F : 0.375F, @@ -86,31 +85,31 @@ public abstract class RadioTorchBase extends BlockContainer implements IGUIProvi @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - + int meta = world.getBlockMetadata(x, y, z); ForgeDirection dir = ForgeDirection.getOrientation(meta); Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ); - + if(!canBlockStay(world, x, y, z, dir, b)) { this.dropBlockAsItem(world, x, y, z, meta, 0); world.setBlockToAir(x, y, z); } } - + @Override public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) { if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false; - + ForgeDirection dir = ForgeDirection.getOrientation(side); Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ); - + return canBlockStay(world, x, y, z, dir, b); } - + public boolean canBlockStay(World world, int x, int y, int z, ForgeDirection dir, Block b) { return b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) || b.hasComparatorInputOverride() || b.canProvidePower() || (b.renderAsNormalBlock() && !b.isAir(world, x, y, z)); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote && !player.isSneaking()) { diff --git a/src/main/java/com/hbm/blocks/network/RadioTorchCounter.java b/src/main/java/com/hbm/blocks/network/RadioTorchCounter.java index 76365ca81..80bacd8c4 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTorchCounter.java +++ b/src/main/java/com/hbm/blocks/network/RadioTorchCounter.java @@ -1,8 +1,5 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.container.ContainerCounterTorch; import com.hbm.inventory.gui.GUICounterTorch; @@ -10,7 +7,6 @@ import com.hbm.main.MainRegistry; import com.hbm.tileentity.network.TileEntityRadioTorchCounter; import com.hbm.util.Compat; import com.hbm.util.I18nUtil; - import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -24,8 +20,11 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; + public class RadioTorchCounter extends RadioTorchBase { - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(!world.isRemote && !player.isSneaking()) { @@ -62,18 +61,18 @@ public class RadioTorchCounter extends RadioTorchBase { @Override public void printHook(Pre event, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityRadioTorchCounter) { TileEntityRadioTorchCounter radio = (TileEntityRadioTorchCounter) te; List text = new ArrayList(); - + for(int i = 0; i < 3; i++) { if(!radio.channel[i].isEmpty()) { text.add(EnumChatFormatting.AQUA + "Freq " + (i + 1) + ": " + radio.channel[i]); text.add(EnumChatFormatting.RED + "Signal " + (i + 1) + ": " + radio.lastCount[i]); } } - + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } } diff --git a/src/main/java/com/hbm/blocks/network/RadioTorchLogic.java b/src/main/java/com/hbm/blocks/network/RadioTorchLogic.java index 4d4e679a3..65d144ef9 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTorchLogic.java +++ b/src/main/java/com/hbm/blocks/network/RadioTorchLogic.java @@ -1,14 +1,10 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.gui.GUIScreenRadioTorchLogic; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityRadioTorchLogic; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -19,12 +15,15 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + public class RadioTorchLogic extends RadioTorchRWBase { - + public RadioTorchLogic() { super(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -38,30 +37,30 @@ public class RadioTorchLogic extends RadioTorchRWBase { tile.lastUpdate = world.getTotalWorldTime(); return tile; } - + @Override public boolean canProvidePower() { return true; } - + @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityRadioTorchLogic) { int state = ((TileEntityRadioTorchLogic) tile).lastState; return state; } - + return 0; } - + @Override @SideOnly(Side.CLIENT) public void printHook(Pre event, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityRadioTorchLogic) { TileEntityRadioTorchLogic radio = (TileEntityRadioTorchLogic) te; List text = new ArrayList(); @@ -70,15 +69,15 @@ public class RadioTorchLogic extends RadioTorchRWBase { ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); } } - + @Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityRadioTorchLogic) return new GUIScreenRadioTorchLogic((TileEntityRadioTorchLogic) te); - + return null; } } diff --git a/src/main/java/com/hbm/blocks/network/RadioTorchRWBase.java b/src/main/java/com/hbm/blocks/network/RadioTorchRWBase.java index 07e00c29b..c73f7ea5c 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTorchRWBase.java +++ b/src/main/java/com/hbm/blocks/network/RadioTorchRWBase.java @@ -1,13 +1,9 @@ package com.hbm.blocks.network; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ILookOverlay; import com.hbm.inventory.gui.GUIScreenRadioTorch; import com.hbm.tileentity.network.TileEntityRadioTorchBase; import com.hbm.util.I18nUtil; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; @@ -18,6 +14,9 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; +import java.util.ArrayList; +import java.util.List; + /** * Base class for the basic sender and receiver RTTY torch * @author hbm @@ -31,12 +30,12 @@ public abstract class RadioTorchRWBase extends RadioTorchBase { public IIcon getIcon(int side, int metadata) { return side == 0 ? this.blockIcon : this.iconOn; } - + @Override @SideOnly(Side.CLIENT) public void printHook(Pre event, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityRadioTorchBase) { TileEntityRadioTorchBase radio = (TileEntityRadioTorchBase) te; List text = new ArrayList(); @@ -52,10 +51,10 @@ public abstract class RadioTorchRWBase extends RadioTorchBase { @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityRadioTorchBase) return new GUIScreenRadioTorch((TileEntityRadioTorchBase) te); - + return null; } } diff --git a/src/main/java/com/hbm/blocks/network/RadioTorchReceiver.java b/src/main/java/com/hbm/blocks/network/RadioTorchReceiver.java index 4d7f28c83..cc3c58986 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTorchReceiver.java +++ b/src/main/java/com/hbm/blocks/network/RadioTorchReceiver.java @@ -2,7 +2,6 @@ package com.hbm.blocks.network; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityRadioTorchReceiver; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -15,7 +14,7 @@ public class RadioTorchReceiver extends RadioTorchRWBase { public RadioTorchReceiver() { super(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -29,22 +28,22 @@ public class RadioTorchReceiver extends RadioTorchRWBase { tile.lastUpdate = world.getTotalWorldTime(); return tile; } - + @Override public boolean canProvidePower() { return true; } - + @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - + TileEntity tile = world.getTileEntity(x, y, z); - + if(tile instanceof TileEntityRadioTorchReceiver) { int state = ((TileEntityRadioTorchReceiver) tile).lastState; return state; } - + return 0; } } diff --git a/src/main/java/com/hbm/blocks/network/RadioTorchSender.java b/src/main/java/com/hbm/blocks/network/RadioTorchSender.java index 2045be8a3..1a11b9b0e 100644 --- a/src/main/java/com/hbm/blocks/network/RadioTorchSender.java +++ b/src/main/java/com/hbm/blocks/network/RadioTorchSender.java @@ -2,7 +2,6 @@ package com.hbm.blocks.network; import com.hbm.lib.RefStrings; import com.hbm.tileentity.network.TileEntityRadioTorchSender; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -14,7 +13,7 @@ public class RadioTorchSender extends RadioTorchRWBase { public RadioTorchSender() { super(); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { diff --git a/src/main/java/com/hbm/blocks/network/Substation.java b/src/main/java/com/hbm/blocks/network/Substation.java index 6c8e3cb34..6affdeb4e 100644 --- a/src/main/java/com/hbm/blocks/network/Substation.java +++ b/src/main/java/com/hbm/blocks/network/Substation.java @@ -1,13 +1,10 @@ package com.hbm.blocks.network; -import java.util.List; - import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyConductor; import com.hbm.tileentity.network.TileEntityPylonBase; import com.hbm.tileentity.network.TileEntitySubstation; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -17,6 +14,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class Substation extends BlockDummyable implements ITooltipProvider { public Substation(Material mat) { @@ -25,13 +24,13 @@ public class Substation extends BlockDummyable implements ITooltipProvider { @Override public TileEntity createNewTileEntity(World world, int meta) { - + if(meta >= 12) return new TileEntitySubstation(); - + if(meta >= 6) return new TileEntityProxyConductor(); - + return null; } @@ -43,13 +42,13 @@ public class Substation extends BlockDummyable implements ITooltipProvider { @Override public void breakBlock(World world, int x, int y, int z, Block b, int m) { - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityPylonBase) { ((TileEntityPylonBase)te).disconnectAll(); } - + super.breakBlock(world, x, y, z, b, m); } @@ -72,7 +71,7 @@ public class Substation extends BlockDummyable implements ITooltipProvider { this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o + 1); this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o - 1); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { diff --git a/src/main/java/com/hbm/blocks/network/WireCoated.java b/src/main/java/com/hbm/blocks/network/WireCoated.java index 3e939327c..c96c68ad5 100644 --- a/src/main/java/com/hbm/blocks/network/WireCoated.java +++ b/src/main/java/com/hbm/blocks/network/WireCoated.java @@ -4,7 +4,6 @@ import com.hbm.render.block.ct.CT; import com.hbm.render.block.ct.CTStitchReceiver; import com.hbm.render.block.ct.IBlockCT; import com.hbm.tileentity.network.TileEntityCableBaseNT; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; diff --git a/src/main/java/com/hbm/commands/CommandPacketInfo.java b/src/main/java/com/hbm/commands/CommandPacketInfo.java new file mode 100644 index 000000000..1affa486c --- /dev/null +++ b/src/main/java/com/hbm/commands/CommandPacketInfo.java @@ -0,0 +1,89 @@ +package com.hbm.commands; + +import com.hbm.config.GeneralConfig; +import com.hbm.handler.threading.PacketThreading; +import com.hbm.main.MainRegistry; +import com.hbm.util.BobMathUtil; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.util.concurrent.TimeUnit; + +import static com.hbm.handler.threading.PacketThreading.totalCnt; + +public class CommandPacketInfo extends CommandBase { + @Override + public String getCommandName() { + return "ntmpackets"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return EnumChatFormatting.RED + "/ntmpackets [info/resetState/toggleThreadingStatus/forceLock/forceUnlock]"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + + if (args.length > 0) { + switch (args[0]) { + case "resetState": + PacketThreading.hasTriggered = false; + PacketThreading.clearCnt = 0; + return; + case "toggleThreadingStatus": + GeneralConfig.enablePacketThreading = !GeneralConfig.enablePacketThreading; // Force toggle. + PacketThreading.init(); // Reinit threads. + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Packet sending status toggled to " + GeneralConfig.enablePacketThreading + ".")); + return; + case "forceLock": + PacketThreading.lock.lock(); // oh my fucking god never do this please unless you really have to + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Packet thread lock acquired, this may freeze the main thread!")); + MainRegistry.logger.error("Packet thread lock acquired by {}, this may freeze the main thread!", sender.getCommandSenderName()); + return; + case "forceUnlock": + PacketThreading.lock.unlock(); + MainRegistry.logger.warn("Packet thread lock released by {}.", sender.getCommandSenderName()); + return; + case "info": + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "NTM Packet Debugger v1.2")); + + if (PacketThreading.isTriggered() && GeneralConfig.enablePacketThreading) + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Packet Threading Errored, check log.")); + else if (GeneralConfig.enablePacketThreading) + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Packet Threading Active")); + else + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Packet Threading Inactive")); + + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Thread Pool Info")); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "# Threads (total): " + PacketThreading.threadPool.getPoolSize())); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "# Threads (core): " + PacketThreading.threadPool.getCorePoolSize())); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "# Threads (idle): " + (PacketThreading.threadPool.getPoolSize() - PacketThreading.threadPool.getActiveCount()))); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "# Threads (maximum): " + PacketThreading.threadPool.getMaximumPoolSize())); + + for (ThreadInfo thread : ManagementFactory.getThreadMXBean().dumpAllThreads(false, false)) + if (thread.getThreadName().startsWith(PacketThreading.threadPrefix)) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Thread Name: " + thread.getThreadName())); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Thread ID: " + thread.getThreadId())); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Thread state: " + thread.getThreadState())); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Locked by: " + (thread.getLockOwnerName() == null ? "None" : thread.getLockName()))); + } + + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "Packet Info: ")); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Amount total: " + totalCnt)); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Amount remaining: " + PacketThreading.threadPool.getQueue().size())); + + if (totalCnt != 0) + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "% Remaining to process: " + BobMathUtil.roundDecimal(((double) PacketThreading.threadPool.getQueue().size() / totalCnt) * 100, 2) + "%")); + + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Time spent waiting on thread(s) last tick: " + BobMathUtil.roundDecimal(TimeUnit.MILLISECONDS.convert(PacketThreading.nanoTimeWaited, TimeUnit.NANOSECONDS), 4) + "ms")); + return; + } + } + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + } +} diff --git a/src/main/java/com/hbm/config/ClientConfig.java b/src/main/java/com/hbm/config/ClientConfig.java index d0f2165c2..9165031d4 100644 --- a/src/main/java/com/hbm/config/ClientConfig.java +++ b/src/main/java/com/hbm/config/ClientConfig.java @@ -1,5 +1,12 @@ package com.hbm.config; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; +import com.hbm.main.MainRegistry; +import com.hbm.util.Compat; + import java.io.File; import java.io.FileReader; import java.io.FileWriter; @@ -10,13 +17,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.stream.JsonWriter; -import com.hbm.main.MainRegistry; -import com.hbm.util.Compat; - // https://youtube.com/shorts/XTHZWqZt_AI public class ClientConfig { @@ -40,7 +40,7 @@ public class ClientConfig { public static ConfigWrapper NUKE_HUD_FLASH = new ConfigWrapper(true); public static ConfigWrapper NUKE_HUD_SHAKE = new ConfigWrapper(true); public static ConfigWrapper RENDER_REEDS = new ConfigWrapper(!Compat.isModLoaded(Compat.MOD_ANG)); - + private static void initDefaults() { configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL); configMap.put("GEIGER_OFFSET_VERTICAL", GEIGER_OFFSET_VERTICAL); @@ -51,7 +51,7 @@ public class ClientConfig { configMap.put("GUN_MODEL_FOV", GUN_MODEL_FOV); configMap.put("GUN_VISUAL_RECOIL", GUN_VISUAL_RECOIL); configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_OREDICT); - configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_CUSTOM_NUKE); + configMap.put("ITEM_TOOLTIP_SHOW_CUSTOM_NUKE", ITEM_TOOLTIP_SHOW_CUSTOM_NUKE); configMap.put("MAIN_MENU_WACKY_SPLASHES", MAIN_MENU_WACKY_SPLASHES); configMap.put("DODD_RBMK_DIAGNOSTIC", DODD_RBMK_DIAGNOSTIC); configMap.put("RENDER_CABLE_HANG", RENDER_CABLE_HANG); @@ -59,7 +59,7 @@ public class ClientConfig { configMap.put("NUKE_HUD_SHAKE", NUKE_HUD_SHAKE); configMap.put("RENDER_REEDS", RENDER_REEDS); } - + /** Initializes defaults, then reads the config file if it exists, then writes the config file. */ public static void initConfig() { initDefaults(); @@ -68,31 +68,31 @@ public class ClientConfig { if(config.exists()) readConfig(config); refresh(); } - + /** Writes over the config file using the running config. */ public static void refresh() { File folder = MainRegistry.configHbmDir; File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json"); writeConfig(config); } - + /** Writes over the running config using the config file. */ public static void reload() { File folder = MainRegistry.configHbmDir; File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json"); if(config.exists()) readConfig(config); } - + private static void readConfig(File config) { - + try { JsonObject json = gson.fromJson(new FileReader(config), JsonObject.class); - + for(Entry line : configMap.entrySet()) { - + if(json.has(line.getKey())) { JsonElement value = json.get(line.getKey()); - + try { //world's shittiest dynamic type parser @@ -103,38 +103,38 @@ public class ClientConfig { if(line.getValue().value instanceof Integer) configMap.get(line.getKey()).set(value.getAsInt()); if(line.getValue().value instanceof Boolean) configMap.get(line.getKey()).set(value.getAsBoolean()); } - + //gson doesn't give me the option to read the raw value of a JsonPrimitive so we have to this shit effectively twice //once to make sure that the parsed data matches with what's determined by the default, //and a second time in the ConfigWrapper to add ease of reading the data without needing manual casts - + } catch(Exception ex) { ex.printStackTrace(); } } } - + } catch(Exception ex) { ex.printStackTrace(); } } - + private static void writeConfig(File config) { try { JsonWriter writer = new JsonWriter(new FileWriter(config)); writer.setIndent(" "); writer.beginObject(); - + writer.name("info").value("This file can be edited ingame using the /ntmclient command."); - + List keys = new ArrayList(); keys.addAll(configMap.keySet()); Collections.sort(keys); //readability is cool - + for(String key : keys) { - - ConfigWrapper wrapper = configMap.get(key); + + ConfigWrapper wrapper = configMap.get(key); Object value = wrapper.value; //this sucks and i am too stupid to come up with something better if(value instanceof String) writer.name(key).value((String) value); @@ -143,24 +143,24 @@ public class ClientConfig { if(value instanceof Integer) writer.name(key).value((Integer) value); if(value instanceof Boolean) writer.name(key).value((Boolean) value); } - + writer.endObject(); writer.close(); } catch(IOException e) { e.printStackTrace(); } } - + public static class ConfigWrapper { public T value; - + public ConfigWrapper(T o) { this.value = o; } public T get() { return value; } public void set(T value) { this.value = value; } - + public void update(String param) { Object stupidBufferObject = null; // wahh wahh can't cast Float to T wahh wahh shut the fuck up if(value instanceof String) stupidBufferObject = param; diff --git a/src/main/java/com/hbm/config/GeneralConfig.java b/src/main/java/com/hbm/config/GeneralConfig.java index 643ca8a9a..916bd9e9c 100644 --- a/src/main/java/com/hbm/config/GeneralConfig.java +++ b/src/main/java/com/hbm/config/GeneralConfig.java @@ -5,7 +5,12 @@ import net.minecraftforge.common.config.Configuration; public class GeneralConfig { public static boolean enableThermosPreventer = true; - + + public static boolean enablePacketThreading = true; + public static int packetThreadingCoreCount = 1; + public static int packetThreadingMaxCount = 1; + public static boolean packetThreadingErrorBypass = false; + public static boolean enableDebugMode = true; public static boolean enableMycelium = false; public static boolean enablePlutoniumOre = false; @@ -40,7 +45,7 @@ public class GeneralConfig { public static int hintPos = 0; public static boolean enableExpensiveMode = false; - + public static boolean enable528 = false; public static boolean enable528ReasimBoilers = true; public static boolean enable528ColtanDeposit = true; @@ -68,11 +73,18 @@ public class GeneralConfig { public static boolean enableLBSMSafeMEDrives = true; public static boolean enableLBSMIGen = true; public static int schrabRate = 20; - + public static void loadFromConfig(Configuration config) { final String CATEGORY_GENERAL = CommonConfig.CATEGORY_GENERAL; enableThermosPreventer = config.get(CATEGORY_GENERAL, "0.00_crashOnThermos", true, "When set to true, will prevent the mod to launch on Thermos servers. Only disable this if you understand what \"tileentities.yml\" is, and how it severely cripples the mod.").getBoolean(true); + + enablePacketThreading = config.get(CATEGORY_GENERAL, "0.01_enablePacketThreading", true, "Enables creation of a separate thread to increase packet processing speed on servers. Disable this if you are having anomalous crashes related to memory connections.").getBoolean(true); + + packetThreadingCoreCount = config.get(CATEGORY_GENERAL, "0.02_packetThreadingCoreCount", 1, "Number of core threads to create for packets (recommended 1).").getInt(1); + packetThreadingMaxCount = config.get(CATEGORY_GENERAL, "0.03_packetThreadingMaxCount", 1, "Maximum number of threads to create for packet threading. Must be greater than or equal to 0.02_packetThreadingCoreCount.").getInt(1); + packetThreadingErrorBypass = config.get(CATEGORY_GENERAL, "0.04_packetThreadingErrorBypass", false, "Forces the bypassing of most packet threading errors, only enable this if directed to or if you know what you're doing.").getBoolean(false); + enableDebugMode = config.get(CATEGORY_GENERAL, "1.00_enableDebugMode", false, "Enable debugging mode").getBoolean(false); enableMycelium = config.get(CATEGORY_GENERAL, "1.01_enableMyceliumSpread", false, "Allows glowing mycelium to spread").getBoolean(false); enablePlutoniumOre = config.get(CATEGORY_GENERAL, "1.02_enablePlutoniumNetherOre", false, "Enables plutonium ore generation in the nether").getBoolean(false); @@ -112,14 +124,14 @@ public class GeneralConfig { "Note that a value below 28 or above 200 can cause buggy sounds and issues with other mods running out of sound memory.", 100); enableExpensiveMode = config.get(CATEGORY_GENERAL, "1.99_enableExpensiveMode", false, "It does what the name implies.").getBoolean(false); - + final String CATEGORY_528 = CommonConfig.CATEGORY_528; config.addCustomCategoryComment(CATEGORY_528, "CAUTION\n" + "528 Mode: Please proceed with caution!\n" + "528-Modus: Lassen Sie Vorsicht walten!\n" + "способ-528: действовать с осторожностью!"); - + enable528 = CommonConfig.createConfigBool(config, CATEGORY_528, "enable528Mode", "The central toggle for 528 mode.", false); enable528ReasimBoilers = CommonConfig.createConfigBool(config, CATEGORY_528, "X528_forceReasimBoilers", "Keeps the RBMK dial for ReaSim boilers on, preventing use of non-ReaSim boiler columns and forcing the use of steam in-/outlets", true); enable528ColtanDeposit = CommonConfig.createConfigBool(config, CATEGORY_528, "X528_enableColtanDepsoit", "Enables the coltan deposit. A large amount of coltan will spawn around a single random location in the world.", true); @@ -131,15 +143,15 @@ public class GeneralConfig { enable528NetherBurn = CommonConfig.createConfigBool(config, CATEGORY_528, "X528_enable528NetherBurn", "Whether players burn in the nether", true); coltanRate = CommonConfig.createConfigInt(config, CATEGORY_528, "X528_oreColtanFrequency", "Determines how many coltan ore veins are to be expected in a chunk. These values do not affect the frequency in deposits, and only apply if random coltan spanwing is enabled.", 2); bedrockRate = CommonConfig.createConfigInt(config, CATEGORY_528, "X528_bedrockColtanFrequency", "Determines how often (1 in X) bedrock coltan ores spawn. Applies for both the bedrock ores in the coltan deposit (if applicable) and the random bedrock ores (if applicable)", 50); - - + + final String CATEGORY_LBSM = CommonConfig.CATEGORY_LBSM; config.addCustomCategoryComment(CATEGORY_LBSM, "Will most likely break standard progression!\n" + "However, the game gets generally easier and more enjoyable for casual players.\n" + "Progression-braking recipes are usually not too severe, so the mode is generally server-friendly!"); - + enableLBSM = CommonConfig.createConfigBool(config, CATEGORY_LBSM, "enableLessBullshitMode", "The central toggle for LBS mode. Forced OFF when 528 is enabled!", false); enableLBSMFullSchrab = CommonConfig.createConfigBool(config, CATEGORY_LBSM, "LBSM_fullSchrab", "When enabled, this will replace schraranium with full schrabidium ingots in the transmutator's output", true); enableLBSMShorterDecay = CommonConfig.createConfigBool(config, CATEGORY_LBSM, "LBSM_shortDecay", "When enabled, this will highly accelerate the speed at which nuclear waste disposal drums decay their contents. 60x faster than 528 mode and 5-12x faster than on normal mode.", true); @@ -155,7 +167,7 @@ public class GeneralConfig { enableLBSMSafeMEDrives = CommonConfig.createConfigBool(config, CATEGORY_LBSM, "LBSM_safeMEDrives", "When enabled, prevents ME Drives and Portable Cells from becoming radioactive", true); enableLBSMIGen = CommonConfig.createConfigBool(config, CATEGORY_LBSM, "LBSM_iGen", "When enabled, restores the industrial generator to pre-nerf power", true); schrabRate = CommonConfig.createConfigInt(config, CATEGORY_LBSM, "LBSM_schrabOreRate", "Changes the amount of uranium ore needed on average to create one schrabidium ore using nukes. Standard mode value is 100", 20); - + if(enable528) enableLBSM = false; } } diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index f4939f6dd..49777c12d 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -10,10 +10,12 @@ import static com.hbm.inventory.OreDictManager.*; import com.hbm.items.ItemAmmoEnums.*; import com.hbm.items.ItemEnums.EnumCasingType; +import com.hbm.items.ItemEnums.EnumSecretType; import com.hbm.items.machine.ItemCircuit.EnumCircuitType; import com.hbm.items.ModItems; import com.hbm.items.weapon.GunB92Cell; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; +import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; import com.hbm.main.CraftingManager; import net.minecraft.init.Blocks; @@ -72,6 +74,7 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_chemthrower, 1), new Object[] { "MHW", "PSS", 'M', WEAPONSTEEL.mechanism(), 'H', RUBBER.pipe(), 'W', ModItems.wrench, 'P', WEAPONSTEEL.heavyBarrel(), 'S', WEAPONSTEEL.shell() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_m2, 1), new Object[] { " G", "BRM", " G", 'G', WOOD.grip(), 'B', FERRO.heavyBarrel(), 'R', FERRO.heavyReceiver(), 'M', WEAPONSTEEL.mechanism() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_autoshotgun, 1), new Object[] { "BRM", "G G", 'B', FERRO.heavyBarrel(), 'R', FERRO.heavyReceiver(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_autoshotgun_shredder, 1), new Object[] { " M ", "MAM", " M ", 'M', BIGMT.mechanism(), 'A', ModItems.gun_autoshotgun }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_quadro, 1), new Object[] { "BCB", "BMB", "GG ", 'B', FERRO.heavyBarrel(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lag, 1), new Object[] { "BRM", " G", 'B', ANY_RESISTANTALLOY.lightBarrel(), 'R', ANY_RESISTANTALLOY.lightReceiver(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_minigun, 1), new Object[] { "BMG", "BRE", "BGM", 'B', ANY_RESISTANTALLOY.lightBarrel(), 'M', WEAPONSTEEL.mechanism(), 'G', ANY_PLASTIC.grip(), 'R', ANY_RESISTANTALLOY.heavyReceiver(), 'E', ModItems.motor_desh }); @@ -81,7 +84,8 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_fatman, 1), new Object[] { "PPP", "BSR", "G M", 'P', BIGMT.plate(), 'B', BIGMT.heavyBarrel(), 'S', BIGMT.shell(), 'R', BIGMT.heavyReceiver(), 'G', ANY_HARDPLASTIC.grip(), 'M', BIGMT.mechanism() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_tau, 1), new Object[] { " RD", "CTT", "GMS", 'D', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'C', CU.pipe(), 'T', ModItems.coil_advanced_torus, 'G', ANY_HARDPLASTIC.grip(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'S', ANY_HARDPLASTIC.stock() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_lasrifle, 1), new Object[] { "LC ", "BRS", "MG ", 'L', ModItems.crystal_redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'B', ANY_BISMOIDBRONZE.lightBarrel(), 'R', ANY_BISMOIDBRONZE.lightReceiver(), 'S', ANY_HARDPLASTIC.stock(), 'M', BIGMT.mechanism(), 'G', ANY_HARDPLASTIC.grip() }); - + CraftingManager.addShapelessAuto(new ItemStack(ModItems.gun_double_barrel_sacred_dragon, 1), new Object[] { ModItems.gun_double_barrel, DictFrame.fromOne(ModItems.item_secret, EnumSecretType.SELENIUM_STEEL) }); + //SEDNA Ammo CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE, 6), new Object[] { "C", "P", "G", 'C', KEY_COBBLESTONE, 'P', Items.paper, 'G', Items.gunpowder }); CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_AP, 6), new Object[] { "C", "P", "G", 'C', Items.flint, 'P', Items.paper, 'G', Items.gunpowder }); @@ -96,8 +100,13 @@ public class WeaponRecipes { CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_SP, 8), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_SP), ModItems.nitra }); CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_SP, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_SP), ModItems.nitra }); CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_SP, 4), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_SP), ModItems.nitra }); - CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G40_HE, 2), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G40_HE), ModItems.nitra }); - CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.ROCKET_HE, 1), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.ROCKET_HE), ModItems.nitra }); + CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G40_HE, 3), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G40_HE), ModItems.nitra }); + CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.ROCKET_HE, 2), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.ROCKET_HE), ModItems.nitra }); + + //secrets! + CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_secret, EnumAmmoSecret.M44_EQUESTRIAN, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_JHP), DictFrame.fromOne(ModItems.item_secret, EnumSecretType.SELENIUM_STEEL) }); + CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_secret, EnumAmmoSecret.G12_EQUESTRIAN, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G12), DictFrame.fromOne(ModItems.item_secret, EnumSecretType.SELENIUM_STEEL) }); + CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_secret, EnumAmmoSecret.BMG50_EQUESTRIAN, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_FMJ), DictFrame.fromOne(ModItems.item_secret, EnumSecretType.SELENIUM_STEEL) }); //Missiles CraftingManager.addShapelessAuto(new ItemStack(ModItems.missile_taint, 1), new Object[] { ModItems.missile_assembly, ModItems.bucket_mud, ModItems.powder_spark_mix, ModItems.powder_magic }); diff --git a/src/main/java/com/hbm/entity/missile/EntityMissileAntiBallistic.java b/src/main/java/com/hbm/entity/missile/EntityMissileAntiBallistic.java index 3dbb048d8..8cd806ca0 100644 --- a/src/main/java/com/hbm/entity/missile/EntityMissileAntiBallistic.java +++ b/src/main/java/com/hbm/entity/missile/EntityMissileAntiBallistic.java @@ -30,7 +30,7 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements public Entity tracking; public double velocity; protected int activationTimer; - + public static double baseSpeed = 1.5D; public EntityMissileAntiBallistic(World world) { @@ -60,22 +60,22 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements super.onUpdate(); if(!worldObj.isRemote) { - + if(velocity < 6) velocity += 0.1; - + if(activationTimer < 40) { activationTimer++; motionY = baseSpeed; } else { Entity prevTracking = this.tracking; - + if(this.tracking == null || this.tracking.isDead) this.targetMissile(); - + if(prevTracking == null && this.tracking != null) { ExplosionLarge.spawnShock(worldObj, posX, posY, posZ, 24, 3F); } - - if(this.tracking != null) { + + if(this.tracking != null && !this.tracking.isDead) { this.aimAtTarget(); } else { if(this.ticksExisted > 600) this.setDead(); @@ -83,15 +83,20 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements } loadNeighboringChunks((int) Math.floor(posX / 16), (int) Math.floor(posZ / 16)); - + if(this.posY > 2000 && (this.tracking == null || this.tracking.isDead)) this.setDead(); - + } else { - + Vec3 vec = Vec3.createVectorHelper(motionX, motionY, motionZ).normalize(); - MainRegistry.proxy.particleControl(posX - vec.xCoord, posY - vec.yCoord, posZ - vec.zCoord, 2); + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "ABMContrail"); + data.setDouble("posX", posX - vec.xCoord); + data.setDouble("posY", posY - vec.yCoord); + data.setDouble("posZ", posZ - vec.zCoord); + MainRegistry.proxy.effectNT(data); } - + float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); for(this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI) - 90; this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F); @@ -102,33 +107,33 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements /** Detects and caches nearby EntityMissileBaseNT */ protected void targetMissile() { - + Entity closest = null; double dist = 1_000; - + for(Entity e : TileEntityMachineRadarNT.matchingEntities) { if(e.dimension != this.dimension) continue; if(!(e instanceof EntityMissileBaseNT)) continue; //can only lock onto missiles if(e instanceof EntityMissileStealth) continue; //cannot lack onto missiles with stealth coating - + Vec3 vec = Vec3.createVectorHelper(e.posX - posX, e.posY - posY, e.posZ - posZ); - + if(vec.lengthVector() < dist) { closest = e; } } - + this.tracking = closest; } - + /** Predictive targeting system */ protected void aimAtTarget() { - + Vec3 delta = Vec3.createVectorHelper(tracking.posX - posX, tracking.posY - posY, tracking.posZ - posZ); double intercept = delta.lengthVector() / (this.baseSpeed * this.velocity); Vec3 predicted = Vec3.createVectorHelper(tracking.posX + (tracking.posX - tracking.lastTickPosX) * intercept, tracking.posY + (tracking.posY - tracking.lastTickPosY) * intercept, tracking.posZ + (tracking.posZ - tracking.lastTickPosZ) * intercept); Vec3 motion = Vec3.createVectorHelper(predicted.xCoord - posX, predicted.yCoord - posY, predicted.zCoord - posZ).normalize(); - + if(delta.lengthVector() < 10 && activationTimer >= 40) { this.setDead(); ExplosionLarge.explode(worldObj, posX, posY, posZ, 15F, true, false, false); @@ -168,13 +173,13 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements super.readEntityFromNBT(nbt); this.velocity = nbt.getDouble("veloc"); } - + @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setDouble("veloc", this.velocity); } - + @Override public void init(Ticket ticket) { if(!worldObj.isRemote) { @@ -197,7 +202,7 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements public void loadNeighboringChunks(int newChunkX, int newChunkZ) { if(!worldObj.isRemote && loaderTicket != null) { - + clearChunkLoader(); loadedChunks.clear(); @@ -208,13 +213,13 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements } } } - + @Override public void setDead() { super.setDead(); this.clearChunkLoader(); } - + public void clearChunkLoader() { if(!worldObj.isRemote && loaderTicket != null) { for(ChunkCoordIntPair chunk : loadedChunks) { diff --git a/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java b/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java index 3b171440f..0b6a51cf8 100644 --- a/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java +++ b/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java @@ -78,7 +78,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo ExplosionLarge.spawnShrapnelShower(worldObj, posX, posY, posZ, motionX, motionY, motionZ, 15, 0.075); } } - + @Override public void onUpdate() { @@ -87,11 +87,11 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo if(type != null && type.updateCustom != null) { type.updateCustom.accept(this); } - + if(!worldObj.isRemote) { if(this.hasPropulsion()) this.fuel -= this.consumption; } - + super.onUpdate(); } @@ -131,7 +131,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo nbt.setInteger("fins", this.dataWatcher.getWatchableObjectInt(11)); nbt.setInteger("thruster", this.dataWatcher.getWatchableObjectInt(12)); } - + @Override protected void spawnContrail() { @@ -148,7 +148,16 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo case XENON: break; } - if(!smoke.isEmpty()) for(int i = 0; i < velocity; i++) MainRegistry.proxy.spawnParticle(posX - v.xCoord * i, posY - v.yCoord * i, posZ - v.zCoord * i, smoke, null); + if(!smoke.isEmpty()) { + for (int i = 0; i < velocity; i++) { + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", posX - v.xCoord * i); + data.setDouble("posY", posY - v.yCoord * i); + data.setDouble("posZ", posZ - v.zCoord * i); + data.setString("type", smoke); + MainRegistry.proxy.effectNT(data); + } + } } @Override @@ -158,7 +167,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo WarheadType type = (WarheadType) part.attributes[0]; float strength = (Float) part.attributes[1]; - + if(type.impactCustom != null) { type.impactCustom.accept(this); return; @@ -244,7 +253,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo if(top == PartSize.SIZE_15 && bottom == PartSize.SIZE_15) return "radar.target.custom15"; if(top == PartSize.SIZE_15 && bottom == PartSize.SIZE_20) return "radar.target.custom1520"; if(top == PartSize.SIZE_20 && bottom == PartSize.SIZE_20) return "radar.target.custom20"; - + return "radar.target.custom"; } @@ -260,7 +269,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo if(top == PartSize.SIZE_15 && bottom == PartSize.SIZE_15) return IRadarDetectableNT.TIER15; if(top == PartSize.SIZE_15 && bottom == PartSize.SIZE_20) return IRadarDetectableNT.TIER15_20; if(top == PartSize.SIZE_20 && bottom == PartSize.SIZE_20) return IRadarDetectableNT.TIER20; - + return IRadarDetectableNT.TIER1; } diff --git a/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java index e335f0614..00162795a 100644 --- a/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java @@ -321,6 +321,7 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider { @Override public void onDeath(DamageSource source) { + super.onDeath(source); if(doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) { diff --git a/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java b/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java index 1a04f5a2f..2c1773df7 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java +++ b/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java @@ -28,14 +28,14 @@ import net.minecraftforge.common.ForgeChunkManager.Type; public class EntityArtilleryRocket extends EntityThrowableInterp implements IChunkLoader, IRadarDetectable { private Ticket loaderTicket; - + //TODO: find satisfying solution for when an entity is unloaded and reloaded, possibly a custom entity lookup using persistent UUIDs public Entity targetEntity = null; public Vec3 lastTargetPos; - + public IRocketTargetingBehavior targeting; public IRocketSteeringBehavior steering; - + public EntityArtilleryRocket(World world) { super(world); this.ignoreFrustumCheck = true; @@ -49,18 +49,18 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY)); this.dataWatcher.addObject(10, new Integer(0)); } - + @Override @SideOnly(Side.CLIENT) public boolean isInRangeToRenderDist(double distance) { return true; } - + public EntityArtilleryRocket setType(int type) { this.dataWatcher.updateObject(10, type); return this; } - + public HIMARSRocket getType() { try { return ItemAmmoHIMARS.itemTypes[this.dataWatcher.getWatchableObjectInt(10)]; @@ -68,62 +68,75 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu return ItemAmmoHIMARS.itemTypes[0]; } } - + public EntityArtilleryRocket setTarget(Entity target) { this.targetEntity = target; setTarget(target.posX, target.posY - target.yOffset + target.height / 2D, target.posZ); return this; } - + public EntityArtilleryRocket setTarget(double x, double y, double z) { this.lastTargetPos = Vec3.createVectorHelper(x, y, z); return this; } - + public Vec3 getLastTarget() { return this.lastTargetPos; } - + @Override public void onUpdate() { - + if(worldObj.isRemote) { this.lastTickPosX = this.posX; this.lastTickPosY = this.posY; this.lastTickPosZ = this.posZ; } - + super.onUpdate(); - + if(!worldObj.isRemote) { + + //shitty hack, figure out what's happening here + if(this.targeting == null) this.targeting = new RocketTargetingPredictive(); + if(this.steering == null) this.steering = new RocketSteeringBallisticArc(); - /*if(this.targetEntity == null) { + if(this.targetEntity == null) { Vec3 delta = Vec3.createVectorHelper(this.lastTargetPos.xCoord - this.posX, this.lastTargetPos.yCoord - this.posY, this.lastTargetPos.zCoord - this.posZ); if(delta.lengthVector() <= 15D) { this.targeting = null; this.steering = null; } - }*/ + } if(this.targeting != null && this.targetEntity != null) this.targeting.recalculateTargetPosition(this, this.targetEntity); if(this.steering != null) this.steering.adjustCourse(this, 25D, 15D); - + loadNeighboringChunks((int)Math.floor(posX / 16D), (int)Math.floor(posZ / 16D)); this.getType().onUpdate(this); } else { - + Vec3 v = Vec3.createVectorHelper(lastTickPosX - posX, lastTickPosY - posY, lastTickPosZ - posZ); double velocity = v.lengthVector(); v = v.normalize(); - + int offset = 6; - if(velocity > 1) for(int i = offset; i < velocity + offset; i++) MainRegistry.proxy.spawnParticle(posX + v.xCoord * i, posY + v.yCoord * i, posZ + v.zCoord * i, "exKerosene", null); + if(velocity > 1) { + for (int i = offset; i < velocity + offset; i++) { + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", posX + v.xCoord * i); + data.setDouble("posY", posY + v.yCoord * i); + data.setDouble("posZ", posZ + v.zCoord * i); + data.setString("type", "exKerosene"); + MainRegistry.proxy.effectNT(data); + } + } } } @Override protected void onImpact(MovingObjectPosition mop) { - + if(!worldObj.isRemote) { this.getType().onImpact(this, mop); } @@ -145,7 +158,7 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu public void loadNeighboringChunks(int newChunkX, int newChunkZ) { if(!worldObj.isRemote && loaderTicket != null) { - + clearChunkLoader(); loadedChunks.clear(); @@ -157,12 +170,12 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu } } } - + public void killAndClear() { this.setDead(); this.clearChunkLoader(); } - + public void clearChunkLoader() { if(!worldObj.isRemote && loaderTicket != null) { for(ChunkCoordIntPair chunk : loadedChunks) { @@ -174,15 +187,15 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); - + if(this.lastTargetPos == null) { this.lastTargetPos = Vec3.createVectorHelper(posX, posY, posZ); } - + nbt.setDouble("targetX", this.lastTargetPos.xCoord); nbt.setDouble("targetY", this.lastTargetPos.yCoord); nbt.setDouble("targetZ", this.lastTargetPos.zCoord); - + nbt.setInteger("type", this.dataWatcher.getWatchableObjectInt(10)); } @@ -191,7 +204,7 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu super.readEntityFromNBT(nbt); this.lastTargetPos = Vec3.createVectorHelper(nbt.getDouble("targetX"), nbt.getDouble("targetY"), nbt.getDouble("targetZ")); - + this.dataWatcher.updateObject(10, nbt.getInteger("type")); } @@ -209,7 +222,7 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu public RadarTargetType getTargetType() { return RadarTargetType.ARTILLERY; } - + @Override public int approachNum() { return 0; // diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java index 0d9161b98..29b0ce553 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java @@ -34,6 +34,26 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp { this.isImmuneToFire = true; } + /** For submunitions! */ + public EntityBulletBaseMK4(World world, EntityLivingBase entity, BulletConfig config, float damage, float gunSpread, double posX, double posY, double posZ, double motionX, double motionY, double motionZ) { + this(world); + + this.thrower = entity; + this.setBulletConfig(config); + + this.damage = damage; + + this.setLocationAndAngles(posX, posY, posZ, 0, 0); + this.setPosition(this.posX, this.posY, this.posZ); + + this.motionX = motionX; + this.motionY = motionY; + this.motionZ = motionZ; + + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread + gunSpread); + } + + /** For standard guns */ public EntityBulletBaseMK4(EntityLivingBase entity, BulletConfig config, float baseDamage, float gunSpread, double sideOffset, double heightOffset, double frontOffset) { this(entity.worldObj); @@ -57,15 +77,11 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp { this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); - - /*motionX += entity.motionX; - motionY += entity.motionY; - motionZ += entity.motionZ;*/ this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread + gunSpread); } - /** For turrets - angles are in radians, andp itch is negative! */ + /** For turrets - angles are in radians, and pitch is negative! */ public EntityBulletBaseMK4(World world, BulletConfig config, float baseDamage, float gunSpread, float yaw, float pitch) { this(world); diff --git a/src/main/java/com/hbm/entity/projectile/EntityWaterSplash.java b/src/main/java/com/hbm/entity/projectile/EntityWaterSplash.java index 4eed4570b..49ea4ae20 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityWaterSplash.java +++ b/src/main/java/com/hbm/entity/projectile/EntityWaterSplash.java @@ -24,7 +24,7 @@ public class EntityWaterSplash extends EntityThrowable { public EntityWaterSplash(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) { super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_); } - + @Override public void onUpdate() { super.onUpdate(); @@ -35,8 +35,12 @@ public class EntityWaterSplash extends EntityThrowable { this.setDead(); } } else { - - MainRegistry.proxy.particleControl(posX, posY, posZ, 0); + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "waterSplash"); + data.setDouble("posX", posX); + data.setDouble("posY", posY); + data.setDouble("posZ", posZ); + MainRegistry.proxy.effectNT(data); } } diff --git a/src/main/java/com/hbm/extprop/HbmLivingProps.java b/src/main/java/com/hbm/extprop/HbmLivingProps.java index 8a7331382..b09d20d52 100644 --- a/src/main/java/com/hbm/extprop/HbmLivingProps.java +++ b/src/main/java/com/hbm/extprop/HbmLivingProps.java @@ -14,6 +14,7 @@ import com.hbm.packet.toclient.PlayerInformPacket; import com.hbm.util.ChatBuilder; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -29,11 +30,11 @@ import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; public class HbmLivingProps implements IExtendedEntityProperties { - + public static final String key = "NTM_EXT_LIVING"; public static final UUID digamma_UUID = UUID.fromString("2a3d8aec-5ab9-4218-9b8b-ca812bdf378b"); public EntityLivingBase entity; - + /// VALS /// private float radiation; private float digamma; @@ -50,24 +51,24 @@ public class HbmLivingProps implements IExtendedEntityProperties { public int phosphorus; public int balefire; private List contamination = new ArrayList(); - + public HbmLivingProps(EntityLivingBase entity) { this.entity = entity; } - + /// DATA /// public static HbmLivingProps registerData(EntityLivingBase entity) { - + entity.registerExtendedProperties(key, new HbmLivingProps(entity)); return (HbmLivingProps) entity.getExtendedProperties(key); } - + public static HbmLivingProps getData(EntityLivingBase entity) { - + HbmLivingProps props = (HbmLivingProps) entity.getExtendedProperties(key); return props != null ? props : registerData(entity); } - + /// RADIATION /// public static float getRadiation(EntityLivingBase entity) { if(!RadiationConfig.enableContamination) @@ -75,89 +76,89 @@ public class HbmLivingProps implements IExtendedEntityProperties { return getData(entity).radiation; } - + public static void setRadiation(EntityLivingBase entity, float rad) { if(RadiationConfig.enableContamination) getData(entity).radiation = rad; } - + public static void incrementRadiation(EntityLivingBase entity, float rad) { if(!RadiationConfig.enableContamination) return; - + HbmLivingProps data = getData(entity); float radiation = getData(entity).radiation + rad; - + if(radiation > 2500) radiation = 2500; if(radiation < 0) radiation = 0; - + data.setRadiation(entity, radiation); } - + /// RAD ENV /// public static float getRadEnv(EntityLivingBase entity) { return getData(entity).radEnv; } - + public static void setRadEnv(EntityLivingBase entity, float rad) { getData(entity).radEnv = rad; } - + /// RAD BUF /// public static float getRadBuf(EntityLivingBase entity) { return getData(entity).radBuf; } - + public static void setRadBuf(EntityLivingBase entity, float rad) { getData(entity).radBuf = rad; } - + /// CONTAMINATION /// public static List getCont(EntityLivingBase entity) { return getData(entity).contamination; } - + public static void addCont(EntityLivingBase entity, ContaminationEffect cont) { getData(entity).contamination.add(cont); } - + /// DIGAMA /// public static float getDigamma(EntityLivingBase entity) { return getData(entity).digamma; } - + public static void setDigamma(EntityLivingBase entity, float digamma) { - + if(entity.worldObj.isRemote) return; - + if(entity instanceof EntityDuck) digamma = 0.0F; - + getData(entity).digamma = digamma; - + float healthMod = (float)Math.pow(0.5, digamma) - 1F; - + IAttributeInstance attributeinstance = entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth); - + try { attributeinstance.removeModifier(attributeinstance.getModifier(digamma_UUID)); } catch(Exception ex) { } - + attributeinstance.applyModifier(new AttributeModifier(digamma_UUID, "digamma", healthMod, 2)); - + if(entity.getHealth() > entity.getMaxHealth() && entity.getMaxHealth() > 0) { entity.setHealth(entity.getMaxHealth()); } - + if((entity.getMaxHealth() <= 0 || digamma >= 10.0F) && entity.isEntityAlive()) { entity.setAbsorptionAmount(0); entity.attackEntityFrom(ModDamageSource.digamma, 500F); entity.setHealth(0); entity.onDeath(ModDamageSource.digamma); - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "sweat"); data.setInteger("count", 50); @@ -165,9 +166,9 @@ public class HbmLivingProps implements IExtendedEntityProperties { data.setInteger("entity", entity.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50)); } - + if(entity instanceof EntityPlayer) { - + float di = getData(entity).digamma; if(di > 0F) @@ -178,93 +179,93 @@ public class HbmLivingProps implements IExtendedEntityProperties { ((EntityPlayer) entity).triggerAchievement(MainRegistry.digammaKnow); } } - + public static void incrementDigamma(EntityLivingBase entity, float digamma) { - + if(entity instanceof EntityDuck) digamma = 0.0F; - + HbmLivingProps data = getData(entity); float dRad = getDigamma(entity) + digamma; - + if(dRad > 10) dRad = 10; if(dRad < 0) dRad = 0; - + data.setDigamma(entity, dRad); } - - + + /// ASBESTOS /// public static int getAsbestos(EntityLivingBase entity) { if(RadiationConfig.disableAsbestos) return 0; return getData(entity).asbestos; } - + public static void setAsbestos(EntityLivingBase entity, int asbestos) { if(RadiationConfig.disableAsbestos) return; getData(entity).asbestos = asbestos; - + if(asbestos >= maxAsbestos) { getData(entity).asbestos = 0; entity.attackEntityFrom(ModDamageSource.asbestos, 1000); } } - + public static void incrementAsbestos(EntityLivingBase entity, int asbestos) { if(RadiationConfig.disableAsbestos) return; setAsbestos(entity, getAsbestos(entity) + asbestos); - + if(entity instanceof EntityPlayerMP) { PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation("info.asbestos").color(EnumChatFormatting.RED).flush(), MainRegistry.proxy.ID_GAS_HAZARD, 3000), (EntityPlayerMP) entity); } } - - + + /// BLACK LUNG DISEASE /// public static int getBlackLung(EntityLivingBase entity) { if(RadiationConfig.disableCoal) return 0; return getData(entity).blacklung; } - + public static void setBlackLung(EntityLivingBase entity, int blacklung) { if(RadiationConfig.disableCoal) return; getData(entity).blacklung = blacklung; - + if(blacklung >= maxBlacklung) { getData(entity).blacklung = 0; entity.attackEntityFrom(ModDamageSource.blacklung, 1000); } } - + public static void incrementBlackLung(EntityLivingBase entity, int blacklung) { if(RadiationConfig.disableCoal) return; setBlackLung(entity, getBlackLung(entity) + blacklung); - + if(entity instanceof EntityPlayerMP) { PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation("info.coaldust").color(EnumChatFormatting.RED).flush(), MainRegistry.proxy.ID_GAS_HAZARD, 3000), (EntityPlayerMP) entity); } } - + /// TIME BOMB /// public static int getTimer(EntityLivingBase entity) { return getData(entity).bombTimer; } - + public static void setTimer(EntityLivingBase entity, int bombTimer) { getData(entity).bombTimer = bombTimer; } - + /// CONTAGION /// public static int getContagion(EntityLivingBase entity) { return getData(entity).contagion; } - + public static void setContagion(EntityLivingBase entity, int contageon) { getData(entity).contagion = contageon; } - + /// OIL /// public static int getOil(EntityLivingBase entity) { return getData(entity).oil; } public static void setOil(EntityLivingBase entity, int oil) { getData(entity).oil = oil; } @@ -272,11 +273,42 @@ public class HbmLivingProps implements IExtendedEntityProperties { @Override public void init(Entity entity, World world) { } + public void serialize(ByteBuf buf) { + buf.writeFloat(radiation); + buf.writeFloat(digamma); + buf.writeInt(asbestos); + buf.writeInt(bombTimer); + buf.writeInt(contagion); + buf.writeInt(blacklung); + buf.writeInt(oil); + buf.writeInt(this.contamination.size()); + for (ContaminationEffect contaminationEffect : this.contamination) { + contaminationEffect.serialize(buf); // long ass buffers? uh, yes please! + } + } + + public void deserialize(ByteBuf buf) { + if(buf.readableBytes() > 0) { + radiation = buf.readFloat(); + digamma = buf.readFloat(); + asbestos = buf.readInt(); + bombTimer = buf.readInt(); + contagion = buf.readInt(); + blacklung = buf.readInt(); + oil = buf.readInt(); + int size = buf.readInt(); + for (int i = 0; i < size; i++) { + this.contamination.add(ContaminationEffect.deserialize(buf)); + } + } + } + + @Deprecated @Override public void saveNBTData(NBTTagCompound nbt) { - + NBTTagCompound props = new NBTTagCompound(); - + props.setFloat("hfr_radiation", radiation); props.setFloat("hfr_digamma", digamma); props.setInteger("hfr_asbestos", asbestos); @@ -287,21 +319,22 @@ public class HbmLivingProps implements IExtendedEntityProperties { props.setInteger("hfr_fire", fire); props.setInteger("hfr_phosphorus", phosphorus); props.setInteger("hfr_balefire", balefire); - + props.setInteger("hfr_cont_count", this.contamination.size()); - + for(int i = 0; i < this.contamination.size(); i++) { this.contamination.get(i).save(props, i); } - + nbt.setTag("HbmLivingProps", props); } + @Deprecated @Override public void loadNBTData(NBTTagCompound nbt) { - + NBTTagCompound props = (NBTTagCompound) nbt.getTag("HbmLivingProps"); - + if(props != null) { radiation = props.getFloat("hfr_radiation"); digamma = props.getFloat("hfr_digamma"); @@ -313,32 +346,49 @@ public class HbmLivingProps implements IExtendedEntityProperties { fire = props.getInteger("hfr_fire"); phosphorus = props.getInteger("hfr_phosphorus"); balefire = props.getInteger("hfr_balefire"); - + int cont = props.getInteger("hfr_cont_count"); - + for(int i = 0; i < cont; i++) { this.contamination.add(ContaminationEffect.load(props, i)); } } } - + public static class ContaminationEffect { - + public float maxRad; public int maxTime; public int time; public boolean ignoreArmor; - + public ContaminationEffect(float rad, int time, boolean ignoreArmor) { this.maxRad = rad; this.maxTime = this.time = time; this.ignoreArmor = ignoreArmor; } - + public float getRad() { return maxRad * ((float)time / (float)maxTime); } - + + public void serialize(ByteBuf buf) { + buf.writeFloat(this.maxRad); + buf.writeInt(this.maxTime); + buf.writeInt(this.time); + buf.writeBoolean(ignoreArmor); + } + + public static ContaminationEffect deserialize(ByteBuf buf) { + float maxRad = buf.readFloat(); + int maxTime = buf.readInt(); + int time = buf.readInt(); + boolean ignoreArmor = buf.readBoolean(); + ContaminationEffect effect = new ContaminationEffect(maxRad, maxTime, ignoreArmor); + effect.time = time; + return effect; + } + public void save(NBTTagCompound nbt, int index) { NBTTagCompound me = new NBTTagCompound(); me.setFloat("maxRad", this.maxRad); @@ -347,14 +397,14 @@ public class HbmLivingProps implements IExtendedEntityProperties { me.setBoolean("ignoreArmor", ignoreArmor); nbt.setTag("cont_" + index, me); } - + public static ContaminationEffect load(NBTTagCompound nbt, int index) { NBTTagCompound me = (NBTTagCompound) nbt.getTag("cont_" + index); float maxRad = me.getFloat("maxRad"); int maxTime = nbt.getInteger("maxTime"); int time = nbt.getInteger("time"); boolean ignoreArmor = nbt.getBoolean("ignoreArmor"); - + ContaminationEffect effect = new ContaminationEffect(maxRad, maxTime, ignoreArmor); effect.time = time; return effect; diff --git a/src/main/java/com/hbm/extprop/HbmPlayerProps.java b/src/main/java/com/hbm/extprop/HbmPlayerProps.java index b1dfbd74d..9439b5572 100644 --- a/src/main/java/com/hbm/extprop/HbmPlayerProps.java +++ b/src/main/java/com/hbm/extprop/HbmPlayerProps.java @@ -8,6 +8,7 @@ import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -17,68 +18,68 @@ import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; public class HbmPlayerProps implements IExtendedEntityProperties { - + public static final String key = "NTM_EXT_PLAYER"; public EntityPlayer player; - + public boolean hasReceivedBook = false; - + public boolean enableHUD = true; public boolean enableBackpack = true; - + private boolean[] keysPressed = new boolean[EnumKeybind.values().length]; - + public boolean dashActivated = true; - + public static final int dashCooldownLength = 5; public int dashCooldown = 0; - + public int totalDashCount = 0; public int stamina = 0; - + public static final int plinkCooldownLength = 10; public int plinkCooldown = 0; - + public float shield = 0; public float maxShield = 0; public int lastDamage = 0; public static final float shieldCap = 100; - + public int reputation; - + public boolean isOnLadder = false; - + public HbmPlayerProps(EntityPlayer player) { this.player = player; } - + public static HbmPlayerProps registerData(EntityPlayer player) { player.registerExtendedProperties(key, new HbmPlayerProps(player)); return (HbmPlayerProps) player.getExtendedProperties(key); } - + public static HbmPlayerProps getData(EntityPlayer player) { HbmPlayerProps props = (HbmPlayerProps) player.getExtendedProperties(key); return props != null ? props : registerData(player); } - + public boolean getKeyPressed(EnumKeybind key) { return keysPressed[key.ordinal()]; } - + public boolean isJetpackActive() { return this.enableBackpack && getKeyPressed(EnumKeybind.JETPACK); } - + public void setKeyPressed(EnumKeybind key, boolean pressed) { - + if(!getKeyPressed(key) && pressed) { - + if(key == EnumKeybind.TOGGLE_JETPACK) { - + if(!player.worldObj.isRemote) { this.enableBackpack = !this.enableBackpack; - + if(this.enableBackpack) MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "Jetpack ON", MainRegistry.proxy.ID_JETPACK); else @@ -86,19 +87,19 @@ public class HbmPlayerProps implements IExtendedEntityProperties { } } if(key == EnumKeybind.TOGGLE_HEAD) { - + if(!player.worldObj.isRemote) { this.enableHUD = !this.enableHUD; - + if(this.enableHUD) MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "HUD ON", MainRegistry.proxy.ID_HUD); else MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "HUD OFF", MainRegistry.proxy.ID_HUD); } } - + if(key == EnumKeybind.TRAIN) { - + if(!this.player.worldObj.isRemote) { if(player.ridingEntity != null && player.ridingEntity instanceof EntityRailCarBase && player.ridingEntity instanceof IGUIProvider) { @@ -107,50 +108,50 @@ public class HbmPlayerProps implements IExtendedEntityProperties { } } } - + keysPressed[key.ordinal()] = pressed; } - + public void setDashCooldown(int cooldown) { this.dashCooldown = cooldown; return; } - + public int getDashCooldown() { return this.dashCooldown; } - + public void setStamina(int stamina) { this.stamina = stamina; return; } - + public int getStamina() { return this.stamina; } - + public void setDashCount(int count) { this.totalDashCount = count; return; } - + public int getDashCount() { return this.totalDashCount; } - + public static void plink(EntityPlayer player, String sound, float volume, float pitch) { HbmPlayerProps props = HbmPlayerProps.getData(player); - + if(props.plinkCooldown <= 0) { player.worldObj.playSoundAtEntity(player, sound, volume, pitch); props.plinkCooldown = props.plinkCooldownLength; } } - + public float getEffectiveMaxShield() { - + float max = this.maxShield; - + if(player.getCurrentArmor(2) != null) { ItemStack[] mods = ArmorModHandler.pryMods(player.getCurrentArmor(2)); if(mods[ArmorModHandler.kevlar] != null && mods[ArmorModHandler.kevlar].getItem() instanceof ItemModShield) { @@ -158,16 +159,39 @@ public class HbmPlayerProps implements IExtendedEntityProperties { max += mod.shield; } } - + return max; } @Override public void init(Entity entity, World world) { } + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.hasReceivedBook); + buf.writeFloat(this.shield); + buf.writeFloat(this.maxShield); + buf.writeBoolean(this.enableBackpack); + buf.writeBoolean(this.enableHUD); + buf.writeInt(this.reputation); + buf.writeBoolean(this.isOnLadder); + } + + public void deserialize(ByteBuf buf) { + if(buf.readableBytes() > 0) { + this.hasReceivedBook = buf.readBoolean(); + this.shield = buf.readFloat(); + this.maxShield = buf.readFloat(); + this.enableBackpack = buf.readBoolean(); + this.enableHUD = buf.readBoolean(); + this.reputation = buf.readInt(); + this.isOnLadder = buf.readBoolean(); + } + } + + @Deprecated @Override public void saveNBTData(NBTTagCompound nbt) { - + NBTTagCompound props = new NBTTagCompound(); props.setBoolean("hasReceivedBook", hasReceivedBook); @@ -177,15 +201,16 @@ public class HbmPlayerProps implements IExtendedEntityProperties { props.setBoolean("enableHUD", enableHUD); props.setInteger("reputation", reputation); props.setBoolean("isOnLadder", isOnLadder); - + nbt.setTag("HbmPlayerProps", props); } + @Deprecated @Override public void loadNBTData(NBTTagCompound nbt) { - + NBTTagCompound props = (NBTTagCompound) nbt.getTag("HbmPlayerProps"); - + if(props != null) { this.hasReceivedBook = props.getBoolean("hasReceivedBook"); this.shield = props.getFloat("shield"); diff --git a/src/main/java/com/hbm/handler/ArmorModHandler.java b/src/main/java/com/hbm/handler/ArmorModHandler.java index 04877a1df..9104d826b 100644 --- a/src/main/java/com/hbm/handler/ArmorModHandler.java +++ b/src/main/java/com/hbm/handler/ArmorModHandler.java @@ -1,13 +1,12 @@ package com.hbm.handler; -import java.util.UUID; - import com.hbm.items.armor.ItemArmorMod; - import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import java.util.UUID; + public class ArmorModHandler { public static final int helmet_only = 0; @@ -19,28 +18,28 @@ public class ArmorModHandler { public static final int kevlar = 6; public static final int extra = 7; public static final int battery = 8; - + public static final int MOD_SLOTS = 9; - + public static final UUID[] UUIDs = new UUID[] { UUID.fromString("8d6e5c77-133e-4056-9c80-a9e42a1a0b65"), UUID.fromString("b1b7ee0e-1d14-4400-8037-f7f2e02f21ca"), UUID.fromString("30b50d2a-4858-4e5b-88d4-3e3612224238"), UUID.fromString("426ee0d0-7587-4697-aaef-4772ab202e78") }; - + public static final UUID[] fixedUUIDs = new UUID[] { UUID.fromString("e572caf4-3e65-4152-bc79-c4d4048cbd29"), UUID.fromString("bed30902-8a6a-4769-9f65-2a9b67469fff"), UUID.fromString("baebf7b3-1eda-4a14-b233-068e2493e9a2"), UUID.fromString("28016c1b-d992-4324-9409-a9f9f0ffb85c") }; - + //The key for the NBTTagCompound that holds the armor mods public static final String MOD_COMPOUND_KEY = "ntm_armor_mods"; //The key for the specific slot inside the armor mod NBT Tag public static final String MOD_SLOT_KEY = "mod_slot_"; - + /** * Checks if a mod can be applied to an armor piece * Needs to be used to prevent people from inserting invalid items into the armor table @@ -49,23 +48,23 @@ public class ArmorModHandler { * @return */ public static boolean isApplicable(ItemStack armor, ItemStack mod) { - + if(armor == null || mod == null) return false; - + if(!(armor.getItem() instanceof ItemArmor)) return false; - + if(!(mod.getItem() instanceof ItemArmorMod)) return false; - + int type = ((ItemArmor)armor.getItem()).armorType; - + ItemArmorMod aMod = (ItemArmorMod)mod.getItem(); - + return (type == 0 && aMod.helmet) || (type == 1 && aMod.chestplate) || (type == 2 && aMod.leggings) || (type == 3 && aMod.boots); } - + /** * Applies an mod to the given armor piece * Make sure to check for applicability first @@ -74,119 +73,124 @@ public class ArmorModHandler { * @param mod */ public static void applyMod(ItemStack armor, ItemStack mod) { - + if(!armor.hasTagCompound()) armor.stackTagCompound = new NBTTagCompound(); - + NBTTagCompound nbt = armor.getTagCompound(); - + if(!nbt.hasKey(MOD_COMPOUND_KEY)) nbt.setTag(MOD_COMPOUND_KEY, new NBTTagCompound()); - + NBTTagCompound mods = nbt.getCompoundTag(MOD_COMPOUND_KEY); - + ItemArmorMod aMod = (ItemArmorMod)mod.getItem(); int slot = aMod.type; - + NBTTagCompound cmp = new NBTTagCompound(); mod.writeToNBT(cmp); - + mods.setTag(MOD_SLOT_KEY + slot, cmp); } - + /** * Removes the mod from the given slot * @param armor * @param slot */ public static void removeMod(ItemStack armor, int slot) { - + if(armor == null) return; - + if(!armor.hasTagCompound()) armor.stackTagCompound = new NBTTagCompound(); - + NBTTagCompound nbt = armor.getTagCompound(); - + if(!nbt.hasKey(MOD_COMPOUND_KEY)) nbt.setTag(MOD_COMPOUND_KEY, new NBTTagCompound()); - + NBTTagCompound mods = nbt.getCompoundTag(MOD_COMPOUND_KEY); mods.removeTag(MOD_SLOT_KEY + slot); - + if(mods.hasNoTags()) clearMods(armor); } - + /** * Removes ALL mods * Should be used when the armor piece is put in the armor table slot AFTER the armor pieces have been separated * @param armor */ public static void clearMods(ItemStack armor) { - + if(!armor.hasTagCompound()) return; - + NBTTagCompound nbt = armor.getTagCompound(); nbt.removeTag(MOD_COMPOUND_KEY); } - + /** * Does what the name implies. Returns true if the stack has NBT and that NBT has the MOD_COMPOUND_KEY tag. * @param armor * @return */ public static boolean hasMods(ItemStack armor) { - + if(!armor.hasTagCompound()) return false; - + NBTTagCompound nbt = armor.getTagCompound(); return nbt.hasKey(MOD_COMPOUND_KEY); } - + + /** + * Gets all the modifications in the provided armor + * @param armor + * @return + */ public static ItemStack[] pryMods(ItemStack armor) { - + ItemStack[] slots = new ItemStack[MOD_SLOTS]; if(!hasMods(armor)) return slots; - + NBTTagCompound nbt = armor.getTagCompound(); NBTTagCompound mods = nbt.getCompoundTag(MOD_COMPOUND_KEY); - + for(int i = 0; i < MOD_SLOTS; i++) { - + NBTTagCompound cmp = mods.getCompoundTag(MOD_SLOT_KEY + i); - + ItemStack stack = ItemStack.loadItemStackFromNBT(cmp); - + if(stack != null) slots[i] = stack; else // Any non-existing armor mods will be sorted out automatically removeMod(armor, i); } - + return slots; } - + public static ItemStack pryMod(ItemStack armor, int slot) { - + if(!hasMods(armor)) return null; - + NBTTagCompound nbt = armor.getTagCompound(); NBTTagCompound mods = nbt.getCompoundTag(MOD_COMPOUND_KEY); NBTTagCompound cmp = mods.getCompoundTag(MOD_SLOT_KEY + slot); ItemStack stack = ItemStack.loadItemStackFromNBT(cmp); - + if(stack != null) return stack; - + removeMod(armor, slot); - + return null; } } diff --git a/src/main/java/com/hbm/handler/CompatHandler.java b/src/main/java/com/hbm/handler/CompatHandler.java index fe0b08ca0..2a59c92fe 100644 --- a/src/main/java/com/hbm/handler/CompatHandler.java +++ b/src/main/java/com/hbm/handler/CompatHandler.java @@ -39,14 +39,14 @@ public class CompatHandler { */ public static Object[] steamTypeToInt(FluidType type) { switch(type.getID()) { - default: - return new Object[] {0}; case(4): // Fluids.HOTSTEAM return new Object[] {1}; case(5): // Fluids.SUPERHOTSTEAM return new Object[] {2}; case(6): // Fluids.ULTRAHOTSTEAM return new Object[] {3}; + default: + return new Object[] {0}; } } @@ -57,14 +57,14 @@ public class CompatHandler { */ public static FluidType intToSteamType(int arg) { switch(arg) { - default: - return Fluids.STEAM; case(1): return Fluids.HOTSTEAM; case(2): return Fluids.SUPERHOTSTEAM; case(3): return Fluids.ULTRAHOTSTEAM; + default: + return Fluids.STEAM; } } @@ -72,7 +72,7 @@ public class CompatHandler { * Allows for easy creation of read-only filesystems. Primarily for floppy disks. * (Though maybe reading directly from VOTV drives as filesystems could be implemented. :3) **/ - private static class ReadOnlyFileSystem implements Callable { + protected static class ReadOnlyFileSystem implements Callable { private final String name; @@ -90,7 +90,7 @@ public class CompatHandler { // Floppy disk class. public static class FloppyDisk { // Specifies the callable ReadOnlyFileSystem to allow OC to access the floppy. - public final ReadOnlyFileSystem fs; + protected final ReadOnlyFileSystem fs; // Specifies the color of the floppy disk (0-16 colors defined by OC). public final Byte color; // Set after loading the disk; allows for adding a recipe to the item. @@ -103,7 +103,7 @@ public class CompatHandler { // Disk names will be sanitized before the FileSystem is created. // This only affects the location/directory, not the display name. - // (Prevents filesystems from breaking/crashing due to having file separators, wildcards, etc. + // (Prevents filesystems from breaking/crashing due to having file separators, wildcards, etc.) public static String sanitizeName(String input) { return input.toLowerCase().replaceAll("\\W", ""); } @@ -152,7 +152,7 @@ public class CompatHandler { // begin registering disks Logger logger = LogManager.getLogger("HBM"); logger.info("Loading OpenComputers disks..."); - if(disks.size() == 0) { + if(disks.isEmpty()) { logger.info("No disks registered; see com.hbm.handler.CompatHandler.disks"); return; } @@ -163,13 +163,13 @@ public class CompatHandler { if (fs == null) { // Disk path does NOT exist, and it should not be loaded. - logger.error("Error loading disk: " + s + " at /assets/" + RefStrings.MODID + "/disks/" + disk.fs.name); + logger.error("Error loading disk: {} at /assets/" + RefStrings.MODID + "/disks/{}", s, disk.fs.name); logger.error("This is likely due to the path to the disk being non-existent."); } else { // Disk path DOES exist, and it should be loaded. disk.item = Items.registerFloppy(s, disk.color, disk.fs); // The big part, actually registering the floppies! - logger.info("Registered disk: " + s + " at /assets/" + RefStrings.MODID + "/disks/" + disk.fs.name); + logger.info("Registered disk: {} at /assets/" + RefStrings.MODID + "/disks/{}", s, disk.fs.name); } }); @@ -178,10 +178,10 @@ public class CompatHandler { // OC disk recipes! List floppyDisks = new RecipesCommon.OreDictStack("oc:floppy").toStacks(); - if(floppyDisks.size() > 0) { //check that floppy disks even exist in oredict. + if(!floppyDisks.isEmpty()) { //check that floppy disks even exist in oredict. // Recipes must be initialized here, since if they were initialized in `CraftingManager` then the disk item would not be created yet. - addShapelessAuto(disks.get("PWRangler").item, new Object[] {"oc:floppy", new ItemStack(ModBlocks.pwr_casing)}); + addShapelessAuto(disks.get("PWRangler").item, "oc:floppy", new ItemStack(ModBlocks.pwr_casing)); logger.info("OpenComputers disk recipe added for PWRangler."); } else { diff --git a/src/main/java/com/hbm/handler/EntityEffectHandler.java b/src/main/java/com/hbm/handler/EntityEffectHandler.java index ab683b588..19536eace 100644 --- a/src/main/java/com/hbm/handler/EntityEffectHandler.java +++ b/src/main/java/com/hbm/handler/EntityEffectHandler.java @@ -16,6 +16,7 @@ import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.handler.radiation.ChunkRadiationManager; +import com.hbm.handler.threading.PacketThreading; import com.hbm.interfaces.IArmorModDash; import com.hbm.items.armor.ArmorFSB; import com.hbm.items.weapon.sedna.factory.ConfettiUtil; @@ -58,12 +59,12 @@ import net.minecraft.world.biome.BiomeGenBase; public class EntityEffectHandler { public static void onUpdate(EntityLivingBase entity) { - + if(entity.ticksExisted % 20 == 0) { HbmLivingProps.setRadBuf(entity, HbmLivingProps.getRadEnv(entity)); HbmLivingProps.setRadEnv(entity, 0); } - + if(entity instanceof EntityPlayer && entity == MainRegistry.proxy.me()) { EntityPlayer player = MainRegistry.proxy.me(); if(player != null) { @@ -78,7 +79,6 @@ public class EntityEffectHandler { if(entity instanceof EntityPlayerMP) { HbmLivingProps props = HbmLivingProps.getData(entity); HbmPlayerProps pprps = HbmPlayerProps.getData((EntityPlayerMP) entity); - NBTTagCompound data = new NBTTagCompound(); if(pprps.shield < pprps.getEffectiveMaxShield() && entity.ticksExisted > pprps.lastDamage + 60) { int tsd = entity.ticksExisted - (pprps.lastDamage + 60); @@ -88,16 +88,14 @@ public class EntityEffectHandler { if(pprps.shield > pprps.getEffectiveMaxShield()) pprps.shield = pprps.getEffectiveMaxShield(); - props.saveNBTData(data); - pprps.saveNBTData(data); - PacketDispatcher.wrapper.sendTo(new ExtPropPacket(data), (EntityPlayerMP) entity); + PacketThreading.createSendToThreadedPacket(new ExtPropPacket(props, pprps), (EntityPlayerMP) entity); } if(!entity.worldObj.isRemote) { int timer = HbmLivingProps.getTimer(entity); if(timer > 0) { HbmLivingProps.setTimer(entity, timer - 1); - + if(timer == 1) { ExplosionNukeSmall.explode(entity.worldObj, entity.posX, entity.posY, entity.posZ, ExplosionNukeSmall.PARAMS_MEDIUM); } @@ -106,15 +104,15 @@ public class EntityEffectHandler { if((GeneralConfig.enable528 && GeneralConfig.enable528NetherBurn) && entity instanceof EntityPlayer && !entity.isImmuneToFire() && entity.worldObj.provider.isHellWorld) { entity.setFire(5); } - + BiomeGenBase biome = entity.worldObj.getBiomeGenForCoords((int) Math.floor(entity.posX), (int) Math.floor(entity.posZ)); float radiation = 0; if(biome == BiomeGenCraterBase.craterOuterBiome) radiation = WorldConfig.craterBiomeOuterRad; if(biome == BiomeGenCraterBase.craterBiome) radiation = WorldConfig.craterBiomeRad; if(biome == BiomeGenCraterBase.craterInnerBiome) radiation = WorldConfig.craterBiomeInnerRad; - + if(entity.isWet()) radiation *= WorldConfig.craterBiomeWaterMult; - + if(radiation > 0) { ContaminationUtil.contaminate(entity, HazardType.RADIATION, ContaminationType.CREATIVE, radiation / 20F); } @@ -131,14 +129,14 @@ public class EntityEffectHandler { handleDashing(entity); handlePlinking(entity); - + if(entity instanceof EntityPlayer) handleFauxLadder((EntityPlayer) entity); } - + private static void handleFauxLadder(EntityPlayer player) { - + HbmPlayerProps props = HbmPlayerProps.getData(player); - + if(props.isOnLadder) { float f5 = 0.15F; @@ -173,67 +171,67 @@ public class EntityEffectHandler { } props.isOnLadder = false; - + if(!player.worldObj.isRemote) ArmorUtil.resetFlightTime(player); } } - + private static void handleContamination(EntityLivingBase entity) { - + if(entity.worldObj.isRemote) return; - + List contamination = HbmLivingProps.getCont(entity); List rem = new ArrayList(); - + for(ContaminationEffect con : contamination) { ContaminationUtil.contaminate(entity, HazardType.RADIATION, con.ignoreArmor ? ContaminationType.RAD_BYPASS : ContaminationType.CREATIVE, con.getRad()); - + con.time--; - + if(con.time <= 0) rem.add(con); } - + contamination.removeAll(rem); } - + private static void handleRadiation(EntityLivingBase entity) { - + World world = entity.worldObj; - + if(!world.isRemote) { - + if(ContaminationUtil.isRadImmune(entity)) return; - + int ix = (int)MathHelper.floor_double(entity.posX); int iy = (int)MathHelper.floor_double(entity.posY); int iz = (int)MathHelper.floor_double(entity.posZ); - + float rad = ChunkRadiationManager.proxy.getRadiation(world, ix, iy, iz); - + if(world.provider.isHellWorld && RadiationConfig.hellRad > 0 && rad < RadiationConfig.hellRad) rad = (float) RadiationConfig.hellRad; - + if(rad > 0) { ContaminationUtil.contaminate(entity, HazardType.RADIATION, ContaminationType.CREATIVE, rad / 20F); } - + if(entity.worldObj.isRaining() && BombConfig.cont > 0 && AuxSavedData.getThunder(entity.worldObj) > 0 && entity.worldObj.canBlockSeeTheSky(ix, iy, iz)) { ContaminationUtil.contaminate(entity, HazardType.RADIATION, ContaminationType.CREATIVE, BombConfig.cont * 0.0005F); } - + if(entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode) return; - + Random rand = new Random(entity.getEntityId()); int r600 = rand.nextInt(600); int r1200 = rand.nextInt(1200); - + if(HbmLivingProps.getRadiation(entity) > 600) { - + if((world.getTotalWorldTime() + r600) % 600 < 20 && canVomit(entity)) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "vomit"); @@ -241,44 +239,44 @@ public class EntityEffectHandler { nbt.setInteger("count", 25); nbt.setInteger("entity", entity.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25)); - + if((world.getTotalWorldTime() + r600) % 600 == 1) { world.playSoundEffect(ix, iy, iz, "hbm:player.vomit", 1.0F, 1.0F); entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 60, 19)); } } - + } else if(HbmLivingProps.getRadiation(entity) > 200 && (world.getTotalWorldTime() + r1200) % 1200 < 20 && canVomit(entity)) { - + NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "vomit"); nbt.setString("mode", "normal"); nbt.setInteger("count", 15); nbt.setInteger("entity", entity.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25)); - + if((world.getTotalWorldTime() + r1200) % 1200 == 1) { world.playSoundEffect(ix, iy, iz, "hbm:player.vomit", 1.0F, 1.0F); entity.addPotionEffect(new PotionEffect(Potion.hunger.id, 60, 19)); } - + } - + if(HbmLivingProps.getRadiation(entity) > 900 && (world.getTotalWorldTime() + rand.nextInt(10)) % 10 == 0) { - + NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "sweat"); nbt.setInteger("count", 1); nbt.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block)); nbt.setInteger("entity", entity.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25)); - + } } else { float radiation = HbmLivingProps.getRadiation(entity); - + if(entity instanceof EntityPlayer && radiation > 600) { - + NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "radiation"); nbt.setInteger("count", radiation > 900 ? 4 : radiation > 800 ? 2 : 1); @@ -286,20 +284,20 @@ public class EntityEffectHandler { } } } - + private static void handleDigamma(EntityLivingBase entity) { - + if(!entity.worldObj.isRemote) { - + float digamma = HbmLivingProps.getDigamma(entity); - + if(digamma < 0.01F) return; - + int chance = Math.max(10 - (int)(digamma), 1); - + if(chance == 1 || entity.getRNG().nextInt(chance) == 0) { - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "sweat"); data.setInteger("count", 1); @@ -309,41 +307,41 @@ public class EntityEffectHandler { } } } - + private static void handleContagion(EntityLivingBase entity) { - + World world = entity.worldObj; - + if(!entity.worldObj.isRemote) { - + Random rand = entity.getRNG(); int minute = 60 * 20; int hour = 60 * minute; - + int contagion = HbmLivingProps.getContagion(entity); - + if(entity instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer) entity; int randSlot = rand.nextInt(player.inventory.mainInventory.length); ItemStack stack = player.inventory.getStackInSlot(randSlot); - + if(rand.nextInt(100) == 0) { stack = player.inventory.armorItemInSlot(rand.nextInt(4)); } - + //only affect unstackables (e.g. tools and armor) so that the NBT tag's stack restrictions isn't noticeable if(stack != null && stack.getMaxStackSize() == 1) { - + if(contagion > 0) { - + if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); - + stack.stackTagCompound.setBoolean("ntmContagion", true); - + } else { - + if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("ntmContagion")) { if(!ArmorUtil.checkForHaz2(player) || !ArmorRegistry.hasProtection(player, 3, HazardClass.BACTERIA)) //liable to change to hazmat 1 at bob's pleasure HbmLivingProps.setContagion(player, 3 * hour); @@ -351,19 +349,19 @@ public class EntityEffectHandler { } } } - + if(contagion > 0) { HbmLivingProps.setContagion(entity, contagion - 1); - + //aerial transmission only happens once a second 5 minutes into the contagion if(contagion < (2 * hour + 55 * minute) && contagion % 20 == 0) { - + double range = entity.isWet() ? 16D : 2D; //avoid rain, just avoid it - + List list = world.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(range, range, range)); - + for(Entity ent : list) { - + if(ent instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase) ent; if(HbmLivingProps.getContagion(living) <= 0) { @@ -371,39 +369,39 @@ public class EntityEffectHandler { HbmLivingProps.setContagion(living, 3 * hour); } } - + if(ent instanceof EntityItem) { ItemStack stack = ((EntityItem)ent).getEntityItem(); - + if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); - + stack.stackTagCompound.setBoolean("ntmContagion", true); } } } - + //one hour in, add rare and subtle screen fuckery if(contagion < 2 * hour && rand.nextInt(1000) == 0) { entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 20, 0)); } - + //two hours in, give 'em the full blast if(contagion < 1 * hour && rand.nextInt(100) == 0) { entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 60, 0)); entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 300, 4)); } - + //T-30 minutes, take damage every 20 seconds if(contagion < 30 * minute && rand.nextInt(400) == 0) { entity.attackEntityFrom(ModDamageSource.mku, 1F); } - + //T-5 minutes, take damage every 5 seconds if(contagion < 5 * minute && rand.nextInt(100) == 0) { entity.attackEntityFrom(ModDamageSource.mku, 2F); } - + if(contagion < 30 * minute && (contagion + entity.getEntityId()) % 200 < 20 && canVomit(entity)) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "vomit"); @@ -411,11 +409,11 @@ public class EntityEffectHandler { nbt.setInteger("count", 25); nbt.setInteger("entity", entity.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25)); - + if((contagion + entity.getEntityId()) % 200 == 19) world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "hbm:player.vomit", 1.0F, 1.0F); } - + //end of contagion, drop dead if(contagion == 0) { entity.attackEntityFrom(ModDamageSource.mku, 1000F); @@ -423,20 +421,20 @@ public class EntityEffectHandler { } } } - + private static void handleLungDisease(EntityLivingBase entity) { - + if(entity.worldObj.isRemote) return; - + if(entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) { HbmLivingProps.setBlackLung(entity, 0); HbmLivingProps.setAsbestos(entity, 0); return; } else { - + int bl = HbmLivingProps.getBlackLung(entity); - + if(bl > 0 && bl < HbmLivingProps.maxBlacklung * 0.5) HbmLivingProps.setBlackLung(entity, HbmLivingProps.getBlackLung(entity) - 1); } @@ -444,13 +442,13 @@ public class EntityEffectHandler { double blacklung = Math.min(HbmLivingProps.getBlackLung(entity), HbmLivingProps.maxBlacklung); double asbestos = Math.min(HbmLivingProps.getAsbestos(entity), HbmLivingProps.maxAsbestos); double soot = PollutionHandler.getPollution(entity.worldObj, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY + entity.getEyeHeight()), (int) Math.floor(entity.posZ), PollutionType.SOOT); - + if(!(entity instanceof EntityPlayer)) soot = 0; - + if(ArmorRegistry.hasProtection(entity, 3, HazardClass.PARTICLE_COARSE)) soot = 0; - + boolean coughs = blacklung / HbmLivingProps.maxBlacklung > 0.25D || asbestos / HbmLivingProps.maxAsbestos > 0.25D || soot > 30; - + if(!coughs) return; @@ -461,25 +459,25 @@ public class EntityEffectHandler { double blacklungDelta = 1D - (blacklung / (double)HbmLivingProps.maxBlacklung); double asbestosDelta = 1D - (asbestos / (double)HbmLivingProps.maxAsbestos); double sootDelta = 1D - Math.min(soot / 100, 1D); - + double total = 1 - (blacklungDelta * asbestosDelta); - + World world = entity.worldObj; - + if(total > 0.75D) { entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 100, 2)); } - + if(total > 0.95D) { entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); } - + total = 1 - (blacklungDelta * asbestosDelta * sootDelta); int freq = Math.max((int) (1000 - 950 * total), 20); - + if(world.getTotalWorldTime() % freq == entity.getEntityId() % freq) { world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "hbm:player.cough", 1.0F, 1.0F); - + if(coughsBlood) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "vomit"); @@ -488,7 +486,7 @@ public class EntityEffectHandler { nbt.setInteger("entity", entity.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25)); } - + if(coughsCoal) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "vomit"); @@ -499,23 +497,23 @@ public class EntityEffectHandler { } } } - + private static void handleOil(EntityLivingBase entity) { - + if(entity.worldObj.isRemote) return; - + int oil = HbmLivingProps.getOil(entity); - + if(oil > 0) { - + if(entity.isBurning()) { HbmLivingProps.setOil(entity, 0); entity.worldObj.newExplosion(null, entity.posX, entity.posY + entity.height / 2, entity.posZ, 3F, false, true); } else { HbmLivingProps.setOil(entity, oil - 1); } - + if(entity.ticksExisted % 5 == 0) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("type", "sweat"); @@ -526,17 +524,17 @@ public class EntityEffectHandler { } } } - + private static void handlePollution(EntityLivingBase entity) { - + if(!RadiationConfig.enablePollution) return; - + if(RadiationConfig.enablePoison && !ArmorRegistry.hasProtection(entity, 3, HazardClass.GAS_BLISTERING) && entity.ticksExisted % 60 == 0) { - + float poison = PollutionHandler.getPollution(entity.worldObj, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY + entity.getEyeHeight()), (int) Math.floor(entity.posZ), PollutionType.POISON); - + if(poison > 10) { - + if(poison < 25) { entity.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 0)); } else if(poison < 50) { @@ -546,13 +544,13 @@ public class EntityEffectHandler { } } } - + if(RadiationConfig.enableLeadPoisoning && !ArmorRegistry.hasProtection(entity, 3, HazardClass.PARTICLE_FINE) && entity.ticksExisted % 60 == 0) { - + float poison = PollutionHandler.getPollution(entity.worldObj, (int) Math.floor(entity.posX), (int) Math.floor(entity.posY + entity.getEyeHeight()), (int) Math.floor(entity.posZ), PollutionType.HEAVYMETAL); - + if(poison > 25) { - + if(poison < 50) { entity.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 100, 0)); } else if(poison < 75) { @@ -563,18 +561,18 @@ public class EntityEffectHandler { } } } - + private static void handleTemperature(Entity entity) { - + if(!(entity instanceof EntityLivingBase)) return; if(entity.worldObj.isRemote) return; - + EntityLivingBase living = (EntityLivingBase) entity; HbmLivingProps props = HbmLivingProps.getData(living); Random rand = living.getRNG(); - + if(!entity.isEntityAlive()) return; - + if(living.isImmuneToFire()) { props.fire = 0; props.phosphorus = 0; @@ -583,23 +581,23 @@ public class EntityEffectHandler { double x = living.posX; double y = living.posY; double z = living.posZ; - + if(living.isInWater() || living.isWet()) props.fire = 0; - + if(props.fire > 0) { props.fire--; if((living.ticksExisted + living.getEntityId()) % 15 == 0) living.worldObj.playSoundEffect(living.posX, living.posY + living.height / 2, living.posZ, "random.fizz", 1F, 1.5F + rand.nextFloat() * 0.5F); if((living.ticksExisted + living.getEntityId()) % 40 == 0) living.attackEntityFrom(DamageSource.onFire, 2F); FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_FIRE); } - + if(props.phosphorus > 0) { props.phosphorus--; if((living.ticksExisted + living.getEntityId()) % 15 == 0) living.worldObj.playSoundEffect(living.posX, living.posY + living.height / 2, living.posZ, "random.fizz", 1F, 1.5F + rand.nextFloat() * 0.5F); if((living.ticksExisted + living.getEntityId()) % 40 == 0) living.attackEntityFrom(DamageSource.onFire, 5F); FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_FIRE); } - + if(props.balefire > 0) { props.balefire--; if((living.ticksExisted + living.getEntityId()) % 15 == 0) living.worldObj.playSoundEffect(living.posX, living.posY + living.height / 2, living.posZ, "random.fizz", 1F, 1.5F + rand.nextFloat() * 0.5F); @@ -607,42 +605,42 @@ public class EntityEffectHandler { if((living.ticksExisted + living.getEntityId()) % 20 == 0) living.attackEntityFrom(DamageSource.onFire, 5F); FlameCreator.composeEffect(entity.worldObj, x - living.width / 2 + living.width * rand.nextDouble(), y + rand.nextDouble() * living.height, z - living.width / 2 + living.width * rand.nextDouble(), FlameCreator.META_BALEFIRE); } - + if(props.fire > 0 || props.phosphorus > 0 || props.balefire > 0) if(!entity.isEntityAlive()) ConfettiUtil.decideConfetti(living, DamageSource.onFire); } - + private static void handleDashing(Entity entity) { - + //AAAAAAAAAAAAAAAAAAAAEEEEEEEEEEEEEEEEEEEE if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; - + HbmPlayerProps props = HbmPlayerProps.getData(player); - + props.setDashCount(0); - + ArmorFSB chestplate = null; - + int armorDashCount = 0; int armorModDashCount = 0; - + if(ArmorFSB.hasFSBArmor(player)) { - ItemStack plate = player.inventory.armorInventory[2]; - + ItemStack plate = player.inventory.armorInventory[2]; + chestplate = (ArmorFSB)plate.getItem(); } - + if(chestplate != null) armorDashCount = chestplate.dashCount; - + for(int armorSlot = 0; armorSlot < 4; armorSlot++) { ItemStack armorStack = player.inventory.armorInventory[armorSlot]; - + if(armorStack != null && armorStack.getItem() instanceof ItemArmor) { - + for(int modSlot = 0; modSlot < 8; modSlot++) { ItemStack mod = ArmorModHandler.pryMods(armorStack)[modSlot]; - + if(mod != null && mod.getItem() instanceof IArmorModDash) { int count = ((IArmorModDash)mod.getItem()).getDashes(); armorModDashCount += count; @@ -650,24 +648,24 @@ public class EntityEffectHandler { } } } - + int dashCount = armorDashCount + armorModDashCount; - + boolean dashActivated = props.getKeyPressed(EnumKeybind.DASH); - + if(dashCount * 30 < props.getStamina()) props.setStamina(dashCount * 30); - + if(dashCount > 0) { int perDash = 30; - + props.setDashCount(dashCount); - + int stamina = props.getStamina(); - + if(props.getDashCooldown() <= 0) { - + if(dashActivated && stamina >= perDash) { Vec3 lookingIn = player.getLookVec(); @@ -676,7 +674,7 @@ public class EntityEffectHandler { int forward = (int) Math.signum(player.moveForward); int strafe = (int) Math.signum(player.moveStrafing); - + if(forward == 0 && strafe == 0) forward = 1; @@ -684,42 +682,42 @@ public class EntityEffectHandler { player.motionY = 0; player.fallDistance = 0F; player.playSound("hbm:weapon.rocketFlame", 1.0F, 1.0F); - + props.setDashCooldown(HbmPlayerProps.dashCooldownLength); stamina -= perDash; } - } else { + } else { props.setDashCooldown(props.getDashCooldown() - 1); props.setKeyPressed(EnumKeybind.DASH, false); } - + if(stamina < props.getDashCount() * perDash) { stamina++; - + if(stamina % perDash == perDash-1) { - + player.playSound("hbm:item.techBoop", 1.0F, (1.0F + ((1F/12F)*(stamina/perDash)))); stamina++; } } - + props.setStamina(stamina); - } - + } + } } - + private static void handlePlinking(Entity entity) { - + if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; HbmPlayerProps props = HbmPlayerProps.getData(player); - + if(props.plinkCooldown > 0) props.plinkCooldown--; } } - + private static boolean canVomit(Entity e) { if(e.isCreatureType(EnumCreatureType.waterCreature, false)) return false; return true; diff --git a/src/main/java/com/hbm/handler/ImpactWorldHandler.java b/src/main/java/com/hbm/handler/ImpactWorldHandler.java index fc528fc6d..365f17cd4 100644 --- a/src/main/java/com/hbm/handler/ImpactWorldHandler.java +++ b/src/main/java/com/hbm/handler/ImpactWorldHandler.java @@ -31,28 +31,32 @@ public class ImpactWorldHandler { return; } + TomSaveData data = TomSaveData.forWorld(world); + + if (data.dust <= 0 && data.fire <= 0) + return; + WorldServer serv = (WorldServer) world; List list = serv.theChunkProviderServer.loadedChunks; int listSize = list.size(); - + if(listSize > 0) { for(int i = 0; i < 3; i++) { - + Chunk chunk = list.get(serv.rand.nextInt(listSize)); ChunkCoordIntPair coord = chunk.getChunkCoordIntPair(); - + for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { - + if(world.rand.nextBoolean()) continue; - + int X = coord.getCenterXPos() - 8 + x; int Z = coord.getCenterZPosition() - 8 + z; int Y = world.getHeightValue(X, Z) - world.rand.nextInt(Math.max(1, world.getHeightValue(X, Z))); - TomSaveData data = TomSaveData.forWorld(world); - + if(data.dust > 0) { die(world, X, Y, Z); } @@ -70,7 +74,7 @@ public class ImpactWorldHandler { TomSaveData data = TomSaveData.forWorld(world); int light = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y + 1, z), (int) (world.getBlockLightValue(x, y + 1, z) * (1 - data.dust))); - + if(light < 4) { if(world.getBlock(x, y, z) == Blocks.grass) { world.setBlock(x, y, z, Blocks.dirt); @@ -86,18 +90,18 @@ public class ImpactWorldHandler { /// Burn the world. public static void burn(World world, int x, int y, int z) { - + Block b = world.getBlock(x, y, z); if(b.isFlammable(world, x, y, z, ForgeDirection.UP) && world.getBlock(x, y + 1, z) == Blocks.air && world.getSavedLightValue(EnumSkyBlock.Sky, x, y + 1, z) >= 7) { if(b instanceof BlockLeaves || b instanceof BlockBush) { world.setBlockToAir(x, y, z); } world.setBlock(x, y + 1, z, Blocks.fire); - + } else if((b == Blocks.grass || b == Blocks.mycelium || b == ModBlocks.waste_earth || b == ModBlocks.frozen_grass || b == ModBlocks.waste_mycelium) && !world.canLightningStrikeAt(x, y, z) && world.getSavedLightValue(EnumSkyBlock.Sky, x, y + 1, z) >= 7) { world.setBlock(x, y, z, ModBlocks.burning_earth); - + } else if(b == ModBlocks.frozen_dirt && world.getSavedLightValue(EnumSkyBlock.Sky, x, y + 1, z) >= 7) { world.setBlock(x, y, z, Blocks.dirt); } @@ -125,4 +129,4 @@ public class ImpactWorldHandler { if(world != lastSyncWorld) return false; return impact; } -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/handler/neutron/NeutronHandler.java b/src/main/java/com/hbm/handler/neutron/NeutronHandler.java new file mode 100644 index 000000000..efc536f2e --- /dev/null +++ b/src/main/java/com/hbm/handler/neutron/NeutronHandler.java @@ -0,0 +1,80 @@ +package com.hbm.handler.neutron; + +import com.hbm.tileentity.machine.rbmk.RBMKDials; +import com.hbm.util.fauxpointtwelve.BlockPos; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + + +// General neutron handler because I didn't feel like having each handler class have its own interaction function. +public class NeutronHandler { + + private static int ticks = 0; + + @SubscribeEvent + public void onServerTick(TickEvent.ServerTickEvent event) { + if(event.phase != TickEvent.Phase.START) + return; + + // Remove `StreamWorld` objects if they have no streams. + { // aflghdkljghlkbhfjkghgilurbhlkfjghkffdjgn + List toRemove = new ArrayList<>(); + NeutronNodeWorld.streamWorlds.forEach((world, streamWorld) -> { + if (streamWorld.streams.isEmpty()) + toRemove.add(world); + }); + + for (World world : toRemove) { + NeutronNodeWorld.streamWorlds.remove(world); + } + } + + for (Map.Entry world : NeutronNodeWorld.streamWorlds.entrySet()) { + + // Gamerule caching because this apparently is kinda slow? + // meh, good enough + RBMKNeutronHandler.reflectorEfficiency = RBMKDials.getReflectorEfficiency(world.getKey()); + RBMKNeutronHandler.absorberEfficiency = RBMKDials.getAbsorberEfficiency(world.getKey()); + RBMKNeutronHandler.moderatorEfficiency = RBMKDials.getModeratorEfficiency(world.getKey()); + + // I hate this. + // this broke everything because it was ONE OFF + // IT'S NOT THE TOTAL HEIGHT IT'S THE AMOUNT OF BLOCKS ABOVE AAAAAAAAAAAAA + RBMKNeutronHandler.columnHeight = RBMKDials.getColumnHeight(world.getKey()) + 1; + RBMKNeutronHandler.fluxRange = RBMKDials.getFluxRange(world.getKey()); + + for (NeutronStream stream : world.getValue().streams) { + stream.runStreamInteraction(world.getKey()); + } + world.getValue().removeAllStreams(); + } + + // Freshen the node cache every `cacheTime` ticks to prevent huge RAM usage from idle nodes. + int cacheTime = 20; + if (ticks >= cacheTime) { + ticks = 0; + List toRemove = new ArrayList<>(); + for (NeutronNode cachedNode : NeutronNodeWorld.nodeCache.values()) { + if (cachedNode.type == NeutronStream.NeutronType.RBMK) { + RBMKNeutronHandler.RBMKNeutronNode node = (RBMKNeutronHandler.RBMKNeutronNode) cachedNode; + toRemove.addAll(node.checkNode()); + } + /* TODO: actually do this and uncache pile nodes + if (cachedNode.type == NeutronStream.NeutronType.PILE) { + PileNeutronNode node = (PileNeutronNode) cachedNode; + toRemove.addAll(node.checkNode()); + } + */ + } + + toRemove.forEach(NeutronNodeWorld::removeNode); + + } + ticks++; + } +} diff --git a/src/main/java/com/hbm/handler/neutron/NeutronNode.java b/src/main/java/com/hbm/handler/neutron/NeutronNode.java new file mode 100644 index 000000000..0c11d3a05 --- /dev/null +++ b/src/main/java/com/hbm/handler/neutron/NeutronNode.java @@ -0,0 +1,27 @@ +package com.hbm.handler.neutron; + +import com.hbm.handler.neutron.NeutronStream.NeutronType; +import com.hbm.util.fauxpointtwelve.BlockPos; +import net.minecraft.tileentity.TileEntity; + +import java.util.HashMap; +import java.util.Map; + +public abstract class NeutronNode { + + protected NeutronType type; + + protected BlockPos pos; + + protected TileEntity tile; + + // like NBT but less fucking CANCER + // Holds things like cached RBMK lid values. + protected Map data = new HashMap<>(); + + public NeutronNode(TileEntity tile, NeutronType type) { + this.type = type; + this.tile = tile; + this.pos = new BlockPos(tile); + } +} diff --git a/src/main/java/com/hbm/handler/neutron/NeutronNodeWorld.java b/src/main/java/com/hbm/handler/neutron/NeutronNodeWorld.java new file mode 100644 index 000000000..1f544ae7f --- /dev/null +++ b/src/main/java/com/hbm/handler/neutron/NeutronNodeWorld.java @@ -0,0 +1,62 @@ +package com.hbm.handler.neutron; + +import com.hbm.util.fauxpointtwelve.BlockPos; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class NeutronNodeWorld { + // HashMap of all neutron nodes and their positions. + protected static HashMap nodeCache = new HashMap<>(); + + public static void addNode(NeutronNode node) { + nodeCache.put(node.pos, node); + } + + public static void removeNode(BlockPos position) { + nodeCache.remove(position); + } + + public static NeutronNode getNode(BlockPos position) { + return nodeCache.get(position); + } + + public static void removeAllNodes() { + nodeCache.clear(); + } + + // List of all stream worlds. + public static HashMap streamWorlds = new HashMap<>(); + + public static class StreamWorld { + + List streams; + + public StreamWorld() { + streams = new ArrayList<>(); + } + + public void addStream(NeutronStream stream) { + this.streams.add(stream); + } + + public void removeAllStreams() { + this.streams.clear(); + } + + public void removeAllStreamsOfType(NeutronStream.NeutronType type) { + List toRemove = new ArrayList<>(); + for (NeutronStream stream : streams) { + if (stream.type == type) + toRemove.add(stream); + } + toRemove.forEach((stream) -> streams.remove(stream)); + } + } + + public static void removeAllWorlds() { + streamWorlds.clear(); + } +} diff --git a/src/main/java/com/hbm/handler/neutron/NeutronStream.java b/src/main/java/com/hbm/handler/neutron/NeutronStream.java new file mode 100644 index 000000000..7de1cc4aa --- /dev/null +++ b/src/main/java/com/hbm/handler/neutron/NeutronStream.java @@ -0,0 +1,82 @@ +package com.hbm.handler.neutron; + +import com.hbm.util.fauxpointtwelve.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import com.hbm.handler.neutron.NeutronNodeWorld.StreamWorld; + +import java.util.Iterator; + +public abstract class NeutronStream { + + public enum NeutronType { + DUMMY, // Dummy streams for node decaying + RBMK, // RBMK neutron streams + PILE // Chicago pile streams + } + + public NeutronNode origin; + + // doubles!! + public double fluxQuantity; + // Hey, new implementation! Basically a ratio for slow flux to fast flux + // 0 = all slow flux + // 1 = all fast flux + public double fluxRatio; + + public NeutronType type = NeutronType.DUMMY; + + // Vector for direction of neutron flow. + public Vec3 vector; + + // Primarily used as a "dummy stream", not to be added to the streams list. + public NeutronStream(NeutronNode origin, Vec3 vector) { + this.origin = origin; + this.vector = vector; + posInstance = origin.pos.clone(); + } + + public NeutronStream(NeutronNode origin, Vec3 vector, double flux, double ratio, NeutronType type) { + this.origin = origin; + this.vector = vector; + posInstance = origin.pos.clone(); + this.fluxQuantity = flux; + this.fluxRatio = ratio; + this.type = type; + World worldObj = origin.tile.getWorldObj(); + if (NeutronNodeWorld.streamWorlds.get(worldObj) == null) { + StreamWorld world = new StreamWorld(); + world.addStream(this); + NeutronNodeWorld.streamWorlds.put(worldObj, world); + } else + NeutronNodeWorld.streamWorlds.get(worldObj).addStream(this); + } + + protected BlockPos posInstance; + + private int i; + + // USES THE CACHE!!! + public Iterator getBlocks(int range) { + + i = 1; + + return new Iterator() { + @Override + public boolean hasNext() { + return i <= range; + } + + @Override + public BlockPos next() { + int x = (int) Math.floor(0.5 + vector.xCoord * i); + int z = (int) Math.floor(0.5 + vector.zCoord * i); + + i++; + return posInstance.mutate(origin.tile.xCoord + x, origin.tile.yCoord, origin.tile.zCoord + z); + } + }; + } + + public abstract void runStreamInteraction(World worldObj); +} diff --git a/src/main/java/com/hbm/handler/neutron/PileNeutronHandler.java b/src/main/java/com/hbm/handler/neutron/PileNeutronHandler.java new file mode 100644 index 000000000..56913bc91 --- /dev/null +++ b/src/main/java/com/hbm/handler/neutron/PileNeutronHandler.java @@ -0,0 +1,116 @@ +package com.hbm.handler.neutron; + +import api.hbm.block.IPileNeutronReceiver; +import com.hbm.blocks.ModBlocks; +import com.hbm.tileentity.machine.pile.TileEntityPileBase; +import com.hbm.util.ContaminationUtil; +import com.hbm.util.fauxpointtwelve.BlockPos; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +import java.util.List; + +public class PileNeutronHandler { + + public static int range = 5; + + public static class PileNeutronNode extends NeutronNode { + + public PileNeutronNode(TileEntityPileBase tile) { + super(tile, NeutronStream.NeutronType.PILE); + } + + } + + public static PileNeutronNode makeNode(TileEntityPileBase tile) { + BlockPos pos = new BlockPos(tile); + if (NeutronNodeWorld.nodeCache.containsKey(pos)) + return (PileNeutronNode) NeutronNodeWorld.getNode(pos); + return new PileNeutronNode(tile); + } + + private static TileEntity blockPosToTE(World worldObj, BlockPos pos) { + return worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); + } + + public static class PileNeutronStream extends NeutronStream { + + public PileNeutronStream(NeutronNode origin, Vec3 vector, double flux) { + super(origin, vector, flux, 0D, NeutronType.PILE); + } + + @Override + public void runStreamInteraction(World worldObj) { + + TileEntityPileBase originTE = (TileEntityPileBase) origin.tile; + BlockPos pos = new BlockPos(originTE); + + for(float i = 1; i <= range; i += 0.5F) { + + BlockPos node = new BlockPos( + (int)Math.floor(pos.getX() + 0.5 + vector.xCoord * i), + (int)Math.floor(pos.getY() + 0.5 + vector.yCoord * i), + (int)Math.floor(pos.getZ() + 0.5 + vector.zCoord * i) + ); + + if(node.equals(pos)) + continue; // don't interact with itself! + + pos.mutate(node.getX(), node.getY(), node.getZ()); + + TileEntity tile; + + if (NeutronNodeWorld.nodeCache.containsKey(node)) + tile = NeutronNodeWorld.nodeCache.get(node).tile; + else { + tile = blockPosToTE(worldObj, node); + if (tile == null) + return; // Doesn't exist! + if (tile instanceof TileEntityPileBase) + NeutronNodeWorld.addNode(new PileNeutronNode((TileEntityPileBase) tile)); + } + + Block block = tile.getBlockType(); + int meta = tile.getBlockMetadata(); + if(!(tile instanceof TileEntityPileBase)) { + + // Return when a boron block is hit + if (block == ModBlocks.block_boron) + return; + + else if (block == ModBlocks.concrete || + block == ModBlocks.concrete_smooth || + block == ModBlocks.concrete_asbestos || + block == ModBlocks.concrete_colored || + block == ModBlocks.brick_concrete) + fluxQuantity *= 0.25; + + if (block == ModBlocks.block_graphite_rod && (meta & 8) == 0) + return; + } + + if(tile instanceof IPileNeutronReceiver) { + + IPileNeutronReceiver rec = (IPileNeutronReceiver) tile; + rec.receiveNeutrons((int) Math.floor(fluxQuantity)); + + if(block != ModBlocks.block_graphite_detector || (meta & 8) == 0) + return; + } + + int x = (int) (node.getX() + 0.5); + int y = (int) (node.getY() + 0.5); + int z = (int) (node.getZ() + 0.5); + List entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x, y, z, x, y, z)); + + if(entities != null) + for(EntityLivingBase e : entities) + ContaminationUtil.contaminate(e, ContaminationUtil.HazardType.RADIATION, ContaminationUtil.ContaminationType.CREATIVE, (float) (fluxQuantity / 4D)); + } + } + } +} diff --git a/src/main/java/com/hbm/handler/neutron/RBMKNeutronHandler.java b/src/main/java/com/hbm/handler/neutron/RBMKNeutronHandler.java new file mode 100644 index 000000000..d3f883589 --- /dev/null +++ b/src/main/java/com/hbm/handler/neutron/RBMKNeutronHandler.java @@ -0,0 +1,415 @@ +package com.hbm.handler.neutron; + +import com.hbm.blocks.machine.rbmk.RBMKBase; +import com.hbm.handler.radiation.ChunkRadiationManager; +import com.hbm.tileentity.machine.rbmk.*; +import com.hbm.util.fauxpointtwelve.BlockPos; + +import java.util.ArrayList; +import java.util.List; +import java.util.Iterator; + +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class RBMKNeutronHandler { + + static double moderatorEfficiency; + static double reflectorEfficiency; + static double absorberEfficiency; + static int columnHeight; + static int fluxRange; + + public enum RBMKType { + ROD, + MODERATOR, + CONTROL_ROD, + REFLECTOR, + ABSORBER, + OUTGASSER, + OTHER // why do neutron calculations on them if they won't change anything? + } + + private static TileEntity blockPosToTE(World worldObj, BlockPos pos) { + return worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); + } + + public static RBMKNeutronNode makeNode(TileEntityRBMKBase tile) { + BlockPos pos = new BlockPos(tile); + if (NeutronNodeWorld.nodeCache.containsKey(pos)) + return (RBMKNeutronNode) NeutronNodeWorld.getNode(pos); + return new RBMKNeutronNode(tile, tile.getRBMKType(), tile.hasLid()); + } + + public static class RBMKNeutronNode extends NeutronNode { + + public RBMKNeutronNode(TileEntityRBMKBase tile, RBMKType type, boolean hasLid) { + super(tile, NeutronStream.NeutronType.RBMK); + this.data.put("hasLid", hasLid); + this.data.put("type", type); + posInstance = new BlockPos(tile); + } + + public void addLid() { + this.data.replace("hasLid", true); + } + + public void removeLid() { + this.data.replace("hasLid", false); + } + + protected BlockPos posInstance; + + private int x; + private int z; + + public Iterator getReaSimNodes() { + + x = -fluxRange; + z = -fluxRange; + + return new Iterator() { + @Override + public boolean hasNext() { + return (fluxRange + x) * (fluxRange * 2 + 1) + z + fluxRange + 1 < (fluxRange * 2 + 1) * (fluxRange * 2 + 1); + } + + @Override + public BlockPos next() { + if (Math.pow(x, 2) + Math.pow(z, 2) <= fluxRange * fluxRange) { + z++; + if (z > fluxRange) { + z = -fluxRange; + x++; + } + return posInstance.mutate(tile.xCoord + x, tile.yCoord, tile.zCoord + z); + } else { + z++; + if (z > fluxRange) { + z = -fluxRange; + x++; + } + return null; + } + } + }; + } + + public List checkNode() { + List list = new ArrayList<>(); + + BlockPos pos = new BlockPos(this.tile); + + RBMKNeutronStream[] streams = new RBMKNeutronStream[TileEntityRBMKRod.fluxDirs.length]; + + // Simulate streams coming out of the RBMK rod. + ForgeDirection[] fluxDirs = TileEntityRBMKRod.fluxDirs; + for (int i = 0; i < fluxDirs.length; i++) { + streams[i] = (new RBMKNeutronStream(this, Vec3.createVectorHelper(fluxDirs[i].offsetX, 0, fluxDirs[i].offsetZ))); + } + + // Check if the rod should uncache nodes. + if (tile instanceof TileEntityRBMKRod && !(tile instanceof TileEntityRBMKRodReaSim)) { + TileEntityRBMKRod rod = (TileEntityRBMKRod) tile; + if (!rod.hasRod || rod.lastFluxQuantity == 0) { + + for (RBMKNeutronStream stream : streams) { + for(RBMKNeutronNode node : stream.getNodes(false)) + if (node != null) + list.add(new BlockPos(node.tile)); + } + + return list; + } + } + + { + Iterator reaSimNodes = getReaSimNodes(); + + // Check if the ReaSim rod should be culled from the cache due to no rod or no flux. + if (tile instanceof TileEntityRBMKRodReaSim) { // fuckkkkkkk + TileEntityRBMKRodReaSim rod = (TileEntityRBMKRodReaSim) tile; + if (!rod.hasRod || rod.lastFluxQuantity == 0) { + reaSimNodes.forEachRemaining((a) -> { + if (a != null) + list.add(a.clone()); // ae The RAM usage will be really high here but hopefully the GC can take care of it :pray: + }); + return list; + } + } + } + + // Check if non-rod nodes should be uncached... but now with ReaSim! + { // Yeah, I don't want to contaminate the surrounding scope. + Iterator reaSimNodes = getReaSimNodes(); + + boolean hasRod = false; + + while(reaSimNodes.hasNext()) { + + BlockPos nodePos = reaSimNodes.next(); + + if(nodePos == null) + continue; + + NeutronNode node = NeutronNodeWorld.nodeCache.get(nodePos); + + if (node != null && node.tile instanceof TileEntityRBMKRod) { + + TileEntityRBMKRod rod = (TileEntityRBMKRod) node.tile; + + if (rod.hasRod && rod.lastFluxQuantity > 0) { + hasRod = true; + break; + } + } + } + + if (!hasRod) { + list.add(pos); + return list; + } + } + + // Check if non-rod nodes should be uncached due to no rod in range. + for (RBMKNeutronStream stream : streams) { + + RBMKNeutronNode[] nodes = stream.getNodes(false); + + for (RBMKNeutronNode node : nodes) { + if (!(node == null) && node.tile instanceof TileEntityRBMKRod) + return list; + } + } + + // If we get here, then no rods were found along this stream's path! + // This, most of the time, means we can just uncache all the nodes inside the stream's path. + // That other part of the time, streams will be crossing paths. + // This is fine though, we can just uncache them anyway and the streams later on (next tick) will recache them. + // /\ idk what this guy was on about but this is just plain wrong. /\ + list.add(pos); + + return list; + } + } + + + public static class RBMKNeutronStream extends NeutronStream { + + public RBMKNeutronStream(NeutronNode origin, Vec3 vector) { + super(origin, vector); + } + + public RBMKNeutronStream(NeutronNode origin, Vec3 vector, double flux, double ratio) { + super(origin, vector, flux, ratio, NeutronType.RBMK); + } + + // Does NOT include the origin node + // USES THE CACHE!!! + public RBMKNeutronNode[] getNodes(boolean addNode) { + RBMKNeutronNode[] positions = new RBMKNeutronNode[fluxRange]; + + BlockPos pos = new BlockPos(origin.tile); + + for (int i = 1; i <= fluxRange; i++) { + int x = (int) Math.floor(0.5 + vector.xCoord * i); + int z = (int) Math.floor(0.5 + vector.zCoord * i); + + pos.mutate(origin.tile.xCoord + x, origin.tile.yCoord, origin.tile.zCoord + z); + + if (NeutronNodeWorld.nodeCache.containsKey(pos)) + positions[i - 1] = (RBMKNeutronNode) NeutronNodeWorld.getNode(pos); + + else if (this.origin.tile.getBlockType() instanceof RBMKBase) { + TileEntity te = blockPosToTE(this.origin.tile.getWorldObj(), pos); + if (te instanceof TileEntityRBMKBase) { + TileEntityRBMKBase rbmkBase = (TileEntityRBMKBase) te; + RBMKNeutronNode node = makeNode(rbmkBase); + positions[i - 1] = node; + if (addNode) + NeutronNodeWorld.addNode(node); + } + } + } + return positions; + } + + // The... small one? whatever it's still pretty big, runs the interaction for the stream. + public void runStreamInteraction(World worldObj) { + + // do nothing if there's nothing to do lmao + if (fluxQuantity == 0D) + return; + + BlockPos pos = new BlockPos(origin.tile); + + TileEntityRBMKBase originTE; + + if (NeutronNodeWorld.nodeCache.containsKey(pos)) + originTE = (TileEntityRBMKBase) NeutronNodeWorld.nodeCache.get(pos).tile; + else { + originTE = (TileEntityRBMKBase) blockPosToTE(worldObj, pos); + if (originTE == null) + return; // Doesn't exist anymore! + NeutronNodeWorld.addNode(new RBMKNeutronNode(originTE, originTE.getRBMKType(), originTE.hasLid())); + } + + int moderatedCount = 0; + + Iterator iterator = getBlocks(fluxRange); + + while(iterator.hasNext()) { + + BlockPos nodePos = iterator.next(); + + if (fluxQuantity == 0D) // Whoops, used it all up! + return; + + RBMKNeutronNode node; + + if (!NeutronNodeWorld.nodeCache.containsKey(nodePos)) { + TileEntity te = blockPosToTE(worldObj, nodePos); // ok, maybe it didn't get added to the list somehow?? + if (te instanceof TileEntityRBMKBase) { + node = makeNode((TileEntityRBMKBase) te); + NeutronNodeWorld.addNode(node); // whoops! + } else { + int hits = getHits(nodePos); // Get the amount of hits on blocks. + if (hits == columnHeight) // If stream is fully blocked. + return; + else if (hits > 0) { // If stream is partially blocked. + irradiateFromFlux(pos, hits); + fluxQuantity *= 1 - ((double) hits / columnHeight); // Inverse to get partial blocking by blocks. + continue; + } else { // Nothing hit! + irradiateFromFlux(pos, 0); + continue; + } + } + } + + node = (RBMKNeutronNode) NeutronNodeWorld.nodeCache.get(nodePos); + + RBMKType type = (RBMKType) node.data.get("type"); + + if (type == RBMKType.OTHER) // pass right on by! + continue; + + // we established earlier during `getNodes()` that they should all be RBMKBase TEs + // no issue with casting here! + TileEntityRBMKBase nodeTE = (TileEntityRBMKBase) node.tile; + + if (!(boolean) node.data.get("hasLid")) + ChunkRadiationManager.proxy.incrementRad(worldObj, nodePos.getX(), nodePos.getY(), nodePos.getZ(), (float) (this.fluxQuantity * 0.05F)); + + if (type == RBMKType.MODERATOR || nodeTE.isModerated()) { + moderatedCount++; + moderateStream(); + } + + if (nodeTE instanceof IRBMKFluxReceiver) { + IRBMKFluxReceiver column = (IRBMKFluxReceiver) nodeTE; + + if (type == RBMKType.ROD) { + TileEntityRBMKRod rod = (TileEntityRBMKRod) column; + + if (rod.hasRod) { + rod.receiveFlux(this); + return; + } + + } else if (type == RBMKType.OUTGASSER) { + TileEntityRBMKOutgasser outgasser = ((TileEntityRBMKOutgasser) column); + + if (outgasser.canProcess()) { + column.receiveFlux(this); + return; + } + } + + } else if (type == RBMKType.CONTROL_ROD) { + TileEntityRBMKControl rod = (TileEntityRBMKControl) nodeTE; + + if (rod.level > 0.0D) { + + this.fluxQuantity *= rod.getMult(); + continue; + } + return; + } else if (type == RBMKType.REFLECTOR) { + + if (((TileEntityRBMKBase) this.origin.tile).isModerated()) + moderatedCount++; + + if (this.fluxRatio > 0 && moderatedCount > 0) + for (int i = 0; i < moderatedCount; i++) + moderateStream(); + + if (reflectorEfficiency != 1.0D) { + this.fluxQuantity *= reflectorEfficiency; + continue; + } + + ((TileEntityRBMKRod) originTE).receiveFlux(this); + return; + } else if (type == RBMKType.ABSORBER) { + if (absorberEfficiency == 1) + return; + + this.fluxQuantity *= absorberEfficiency; + } + } + + RBMKNeutronNode[] nodes = getNodes(true); + + RBMKNeutronNode lastNode = nodes[(nodes.length - 1)]; + + if(lastNode == null) { // This implies that there was *no* last node, meaning either way it was never caught. + // There is really no good way to figure out where exactly it should irradiate, so just irradiate at the origin tile. + irradiateFromFlux(new BlockPos(origin.tile.xCoord + this.vector.xCoord, origin.tile.yCoord, origin.tile.zCoord + this.vector.zCoord)); + return; + } + + RBMKType lastNodeType = (RBMKType) lastNode.data.get("type"); + + if (lastNodeType == RBMKType.CONTROL_ROD) { + TileEntityRBMKControl rod = (TileEntityRBMKControl) lastNode.tile; + if (rod.getMult() > 0.0D) { + this.fluxQuantity *= rod.getMult(); + irradiateFromFlux(new BlockPos(lastNode.tile.xCoord + this.vector.xCoord, lastNode.tile.yCoord, lastNode.tile.zCoord + this.vector.zCoord)); + } + } + } + + public int getHits(BlockPos pos) { + int hits = 0; + + for(int h = 0; h < columnHeight; h++) { + // holy fucking shit + // I have had this one line cause me like tens of problems + // I FUCKING HATE THIS + // total count of bugs fixed attributed to this function: 13 + Block block = origin.tile.getWorldObj().getBlock(pos.getX(), pos.getY() + h, pos.getZ()); + if (block.isOpaqueCube()) + hits += 1; + } + + return hits; + } + + public void irradiateFromFlux(BlockPos pos) { + ChunkRadiationManager.proxy.incrementRad(origin.tile.getWorldObj(), pos.getX(), pos.getY(), pos.getZ(), (float) (fluxQuantity * 0.05F * (1 - (double) getHits(pos) / columnHeight))); + } + + public void irradiateFromFlux(BlockPos pos, int hits) { + ChunkRadiationManager.proxy.incrementRad(origin.tile.getWorldObj(), pos.getX(), pos.getY(), pos.getZ(), (float) (fluxQuantity * 0.05F * (1 - (double) hits / columnHeight))); + } + + public void moderateStream() { + fluxRatio *= (1 - moderatorEfficiency); + } + + } +} diff --git a/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerSimple.java b/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerSimple.java index e09d50209..d77c6b34b 100644 --- a/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerSimple.java +++ b/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerSimple.java @@ -5,12 +5,11 @@ import java.util.Map.Entry; import com.hbm.blocks.ModBlocks; import com.hbm.config.RadiationConfig; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.AuxParticlePacket; +import com.hbm.main.MainRegistry; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; @@ -25,31 +24,31 @@ import net.minecraftforge.event.world.WorldEvent; * @author hbm */ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { - + private HashMap perWorld = new HashMap(); private static final float maxRad = 100_000F; @Override public float getRadiation(World world, int x, int y, int z) { SimpleRadiationPerWorld radWorld = perWorld.get(world); - + if(radWorld != null) { ChunkCoordIntPair coords = new ChunkCoordIntPair(x >> 4, z >> 4); Float rad = radWorld.radiation.get(coords); return rad == null ? 0F : MathHelper.clamp_float(rad, 0, maxRad); } - + return 0; } @Override public void setRadiation(World world, int x, int y, int z, float rad) { SimpleRadiationPerWorld radWorld = perWorld.get(world); - + if(radWorld != null) { - + if(world.blockExists(x, 0, z)) { - + ChunkCoordIntPair coords = new ChunkCoordIntPair(x >> 4, z >> 4); radWorld.radiation.put(coords, MathHelper.clamp_float(rad, 0, maxRad)); world.getChunkFromBlockCoords(x, z).isModified = true; @@ -69,28 +68,28 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { @Override public void updateSystem() { - + for(Entry entry : perWorld.entrySet()) { - + HashMap radiation = entry.getValue().radiation; HashMap buff = new HashMap(radiation); radiation.clear(); World world = entry.getKey(); - + for(Entry chunk : buff.entrySet()) { - + if(chunk.getValue() == 0) continue; - + ChunkCoordIntPair coord = chunk.getKey(); - + for(int i = -1; i <= 1; i++) { for(int j = -1; j<= 1; j++) { - + int type = Math.abs(i) + Math.abs(j); float percent = type == 0 ? 0.6F : type == 1 ? 0.075F : 0.025F; ChunkCoordIntPair newCoord = new ChunkCoordIntPair(coord.chunkXPos + i, coord.chunkZPos + j); - + if(buff.containsKey(newCoord)) { Float val = radiation.get(newCoord); float rad = val == null ? 0 : val; @@ -100,15 +99,20 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { } else { radiation.put(newCoord, chunk.getValue() * percent); } - + float rad = radiation.get(newCoord); if(rad > RadiationConfig.fogRad && world != null && world.rand.nextInt(RadiationConfig.fogCh) == 0 && world.getChunkProvider().chunkExists(coord.chunkXPos, coord.chunkZPos)) { - + int x = coord.chunkXPos * 16 + world.rand.nextInt(16); int z = coord.chunkZPos * 16 + world.rand.nextInt(16); int y = world.getHeightValue(x, z) + world.rand.nextInt(5); - - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(x, y, z, 3), new TargetPoint(world.provider.dimensionId, x, y, z, 100)); + + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "radFog"); + data.setDouble("posX", x); + data.setDouble("posY", y); + data.setDouble("posZ", z); + MainRegistry.proxy.effectNT(data); } } } @@ -119,7 +123,7 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { @Override public void clearSystem(World world) { SimpleRadiationPerWorld radWorld = perWorld.get(world); - + if(radWorld != null) { radWorld.radiation.clear(); } @@ -136,15 +140,15 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { if(!event.world.isRemote) perWorld.remove(event.world); } - + private static final String NBT_KEY_CHUNK_RADIATION = "hfr_simple_radiation"; @Override public void receiveChunkLoad(ChunkDataEvent.Load event) { - + if(!event.world.isRemote) { SimpleRadiationPerWorld radWorld = perWorld.get(event.world); - + if(radWorld != null) { radWorld.radiation.put(event.getChunk().getChunkCoordIntPair(), event.getData().getFloat(NBT_KEY_CHUNK_RADIATION)); } @@ -153,10 +157,10 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { @Override public void receiveChunkSave(ChunkDataEvent.Save event) { - + if(!event.world.isRemote) { SimpleRadiationPerWorld radWorld = perWorld.get(event.world); - + if(radWorld != null) { Float val = radWorld.radiation.get(event.getChunk().getChunkCoordIntPair()); float rad = val == null ? 0F : val; @@ -167,74 +171,74 @@ public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler { @Override public void receiveChunkUnload(ChunkEvent.Unload event) { - + if(!event.world.isRemote) { SimpleRadiationPerWorld radWorld = perWorld.get(event.world); - + if(radWorld != null) { radWorld.radiation.remove(event.getChunk()); } } } - + public static class SimpleRadiationPerWorld { - + public HashMap radiation = new HashMap(); } - + @Override public void handleWorldDestruction() { - + int count = 10; int threshold = 10; int chunks = 5; - + //for all worlds for(Entry per : perWorld.entrySet()) { - + World world = per.getKey(); SimpleRadiationPerWorld list = per.getValue(); - + Object[] entries = list.radiation.entrySet().toArray(); - + if(entries.length == 0) continue; - + //chose this many random chunks for(int c = 0; c < chunks; c++) { - + Entry randEnt = (Entry) entries[world.rand.nextInt(entries.length)]; - + ChunkCoordIntPair coords = randEnt.getKey(); WorldServer serv = (WorldServer) world; ChunkProviderServer provider = (ChunkProviderServer) serv.getChunkProvider(); - + //choose this many random locations within the chunk for(int i = 0; i < count; i++) { - + if(randEnt == null || randEnt.getValue() < threshold) continue; - + if(provider.chunkExists(coords.chunkXPos, coords.chunkZPos)) { - + for(int a = 0; a < 16; a++) { for(int b = 0; b < 16; b++) { - + if(world.rand.nextInt(3) != 0) continue; - + int x = coords.getCenterXPos() - 8 + a; int z = coords.getCenterZPosition() - 8 + b; int y = world.getHeightValue(x, z) - world.rand.nextInt(2); - + if(world.getBlock(x, y, z) == Blocks.grass) { world.setBlock(x, y, z, ModBlocks.waste_earth); - + } else if(world.getBlock(x, y, z) == Blocks.tallgrass) { world.setBlock(x, y, z, Blocks.air); - + } else if(world.getBlock(x, y, z).getMaterial() == Material.leaves && !(world.getBlock(x, y, z) == ModBlocks.waste_leaves)) { - + if(world.rand.nextInt(7) <= 5) { world.setBlock(x, y, z, ModBlocks.waste_leaves); } else { diff --git a/src/main/java/com/hbm/handler/threading/PacketThreading.java b/src/main/java/com/hbm/handler/threading/PacketThreading.java new file mode 100644 index 000000000..18c5fda01 --- /dev/null +++ b/src/main/java/com/hbm/handler/threading/PacketThreading.java @@ -0,0 +1,196 @@ +package com.hbm.handler.threading; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.hbm.config.GeneralConfig; +import com.hbm.main.MainRegistry; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.PrecompiledPacket; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import net.minecraft.entity.player.EntityPlayerMP; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.*; +import java.util.concurrent.locks.ReentrantLock; + +public class PacketThreading { + + public static final String threadPrefix = "NTM-Packet-Thread-"; + + public static final ThreadFactory packetThreadFactory = new ThreadFactoryBuilder().setNameFormat(threadPrefix + "%d").build(); + + public static final ThreadPoolExecutor threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(1, packetThreadFactory); + + public static int totalCnt = 0; + + public static long nanoTimeWaited = 0; + + public static final List> futureList = new ArrayList<>(); + + public static ReentrantLock lock = new ReentrantLock(); + + /** + * Sets up thread pool settings during mod initialization. + */ + public static void init() { + threadPool.setKeepAliveTime(50, TimeUnit.MILLISECONDS); + if (GeneralConfig.enablePacketThreading) { + if (GeneralConfig.packetThreadingCoreCount < 0 || GeneralConfig.packetThreadingMaxCount <= 0) { + MainRegistry.logger.error("0.02_packetThreadingCoreCount < 0 or 0.03_packetThreadingMaxCount is <= 0, defaulting to 1 each."); + threadPool.setCorePoolSize(1); // beugh + threadPool.setMaximumPoolSize(1); + } else if (GeneralConfig.packetThreadingMaxCount > GeneralConfig.packetThreadingCoreCount) { + MainRegistry.logger.error("0.03_packetThreadingMaxCount is > 0.02_packetThreadingCoreCount, defaulting to 1 each."); + threadPool.setCorePoolSize(1); + threadPool.setMaximumPoolSize(1); + } else { + threadPool.setCorePoolSize(GeneralConfig.packetThreadingCoreCount); + threadPool.setMaximumPoolSize(GeneralConfig.packetThreadingMaxCount); + } + threadPool.allowCoreThreadTimeOut(false); + } else { + threadPool.allowCoreThreadTimeOut(true); + try { + lock.lock(); + for (Runnable task : threadPool.getQueue()) { + task.run(); // Run all tasks async just in-case there *are* tasks left to run. + } + clearThreadPoolTasks(); + } finally { + lock.unlock(); + } + } + } + + /** + * Adds a packet to the thread pool to be processed in the future. This is only compatible with the `sendToAllAround` dispatch operation. + * @param message Message to process. + * @param target TargetPoint to send to. + */ + public static void createAllAroundThreadedPacket(IMessage message, TargetPoint target) { + // `message` can be precompiled or not. + if(message instanceof PrecompiledPacket) + ((PrecompiledPacket) message).getPreBuf(); // Gets the precompiled buffer, doing nothing if it already exists. + totalCnt++; + + Runnable task = () -> { + try { + lock.lock(); + PacketDispatcher.wrapper.sendToAllAround(message, target); + if (message instanceof PrecompiledPacket) + ((PrecompiledPacket) message).getPreBuf().release(); + } finally { + lock.unlock(); + } + }; + + addTask(task); + } + + /** + * Adds a packet to the thread pool to be processed in the future. This is only compatible with the `sendTo` dispatch operation. + * + * @param message Message to process. + * @param player PlayerMP to send to. + */ + public static void createSendToThreadedPacket(IMessage message, EntityPlayerMP player) { + if(message instanceof PrecompiledPacket) + ((PrecompiledPacket) message).getPreBuf(); + totalCnt++; + + Runnable task = () -> { + try { + lock.lock(); + PacketDispatcher.wrapper.sendTo(message, player); + if (message instanceof PrecompiledPacket) + ((PrecompiledPacket) message).getPreBuf().release(); + } finally { + lock.unlock(); + } + }; + + addTask(task); + } + + private static void addTask(Runnable task) { + if(isTriggered()) + task.run(); + else if(GeneralConfig.enablePacketThreading) + futureList.add(threadPool.submit(task)); + else + task.run(); + } + + /** + * Wait until the packet thread is finished processing. + */ + public static void waitUntilThreadFinished() { + long startTime = System.nanoTime(); + try { + if (GeneralConfig.enablePacketThreading && (!GeneralConfig.packetThreadingErrorBypass && !hasTriggered)) { + for (Future future : futureList) { + nanoTimeWaited = System.nanoTime() - startTime; + future.get(50, TimeUnit.MILLISECONDS); // I HATE EVERYTHING + if(TimeUnit.MILLISECONDS.convert(nanoTimeWaited, TimeUnit.NANOSECONDS) > 50) throw new TimeoutException(); // >50ms total time? timeout? yes sir, ooh rah! + } + } + } catch (ExecutionException ignored) { + // impossible + } catch (TimeoutException e) { + if(!GeneralConfig.packetThreadingErrorBypass && !hasTriggered) + MainRegistry.logger.warn("A packet has taken >50ms to process, discarding {}/{} packets to prevent pausing of main thread ({} total futures).", threadPool.getQueue().size(), totalCnt, futureList.size()); + clearThreadPoolTasks(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); // maybe not the best thing but it's gotta be here + } finally { + futureList.clear(); + if(!threadPool.getQueue().isEmpty()) { + if(!GeneralConfig.packetThreadingErrorBypass && !hasTriggered) + MainRegistry.logger.warn("Residual packets in packet threading queue detected, discarding {}/{} packets.", threadPool.getQueue().size(), totalCnt); + clearThreadPoolTasks(); // Just in case the thread somehow doesn't process all the tasks, we don't want this backing up too far. + } + + totalCnt = 0; + } + } + + public static int clearCnt = 0; + + public static boolean hasTriggered = false; + + public static void clearThreadPoolTasks() { + + if(threadPool.getQueue().isEmpty()) { + clearCnt = 0; + return; + } + + threadPool.getQueue().clear(); + + if(!GeneralConfig.packetThreadingErrorBypass && !hasTriggered) + MainRegistry.logger.warn("Packet work queue cleared forcefully (clear count: {}).", clearCnt); + + clearCnt++; + + if(clearCnt > 5 && !isTriggered()) { + // If it's been cleared 5 times in a row, something may have gone really wrong. + // Best case scenario here, the server is lagging terribly, has a bad CPU, or has a poor network connection + // Worst case scenario, the entire packet thread is dead. (very not good) + // So just log it with a special message and only once. + MainRegistry.logger.error( + "Something has gone wrong and the packet pool has cleared 5 times (or more) in a row. " + + "This can indicate that the thread has been killed, suspended, or is otherwise non-functioning. " + + "This message will only be logged once, further packet operations will continue on the main thread. " + + "If this message is a common occurrence and is *completely expected*, then it can be bypassed permanently by setting " + + "the \"0.04_packetThreadingErrorBypass\" config option to true. This can lead to adverse effects, so do this at your own risk. " + + "Running \"/ntmpacket resetState\" resets this trigger as a temporary fix." + ); + hasTriggered = true; + } + } + + public static boolean isTriggered() { + return hasTriggered && !GeneralConfig.packetThreadingErrorBypass; + } +} diff --git a/src/main/java/com/hbm/hazard/HazardRegistry.java b/src/main/java/com/hbm/hazard/HazardRegistry.java index eeb51bcd8..6c7b2a19b 100644 --- a/src/main/java/com/hbm/hazard/HazardRegistry.java +++ b/src/main/java/com/hbm/hazard/HazardRegistry.java @@ -394,6 +394,7 @@ public class HazardRegistry { registerRBMKRod(rbmk_fuel_zfb_pu241, pu239 * rod_rbmk * 0.1F, wst * rod_rbmk * 7.5F); registerRBMKRod(rbmk_fuel_zfb_am_mix, pu241 * rod_rbmk * 0.1F, wst * rod_rbmk * 10F); registerRBMK(rbmk_fuel_drx, bf * rod_rbmk, bf * rod_rbmk * 100F, true, true, 0, 1F/3F); + //registerRBMKRod(rbmk_fuel_curve, saf * rod_rbmk * np237 * rod_rbmk, wst * rod_rbmk * 35F); registerRBMKPellet(rbmk_pellet_ueu, u * billet, wst * billet * 20F); registerRBMKPellet(rbmk_pellet_meu, uf * billet, wst * billet * 21.5F); diff --git a/src/main/java/com/hbm/interfaces/IOrderedEnum.java b/src/main/java/com/hbm/interfaces/IOrderedEnum.java new file mode 100644 index 000000000..59f00f84d --- /dev/null +++ b/src/main/java/com/hbm/interfaces/IOrderedEnum.java @@ -0,0 +1,6 @@ +package com.hbm.interfaces; + +public interface IOrderedEnum { + + public Enum[] getOrder(); +} diff --git a/src/main/java/com/hbm/inventory/UpgradeManager.java b/src/main/java/com/hbm/inventory/UpgradeManager.java deleted file mode 100644 index 39c366de4..000000000 --- a/src/main/java/com/hbm/inventory/UpgradeManager.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hbm.inventory; - -import java.util.HashMap; - -import com.hbm.interfaces.Untested; -import com.hbm.items.machine.ItemMachineUpgrade; -import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; - -import net.minecraft.item.ItemStack; - -public class UpgradeManager { - - private static HashMap upgrades = new HashMap(); - private static UpgradeType mutexType = null; - - @Untested - public static void eval(ItemStack[] slots, int start, int end) { - - upgrades.clear(); - - for(int i = start; i <= end; i++) { - - if(slots[i] != null && slots[i].getItem() instanceof ItemMachineUpgrade) { - ItemMachineUpgrade item = (ItemMachineUpgrade) slots[i].getItem(); - - if(item.type.mutex) { - - if(mutexType == null || mutexType.ordinal() < item.type.ordinal()) { - mutexType = item.type; - } - - } else { - Integer up = upgrades.get(item.type); - int upgrade = (up == null ? 0 : up); - upgrade += item.tier; - upgrades.put(item.type, upgrade); - } - } - } - } - - public static int getLevel(UpgradeType type) { - Integer up = upgrades.get(type); - return up == null ? 0 : up; - } - - public static UpgradeType getMinerMutex() { - return mutexType; - } -} diff --git a/src/main/java/com/hbm/inventory/UpgradeManagerNT.java b/src/main/java/com/hbm/inventory/UpgradeManagerNT.java new file mode 100644 index 000000000..55422fb8d --- /dev/null +++ b/src/main/java/com/hbm/inventory/UpgradeManagerNT.java @@ -0,0 +1,80 @@ +package com.hbm.inventory; + +import com.hbm.items.machine.ItemMachineUpgrade; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; +import com.hbm.tileentity.IUpgradeInfoProvider; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import java.util.Arrays; +import java.util.HashMap; + +/* + Steps for use: + 1. TE implements IUpgradeInfoProvider + 2. TE creates a new instance of UpgradeManagerNT + 3. Upgrades and their levels can then be pulled from there. + */ + +/** + * Upgrade system, now with caching! + * @author BallOfEnergy1 + */ +public class UpgradeManagerNT { + + public ItemStack[] cachedSlots; + + private UpgradeType mutexType; + public HashMap upgrades = new HashMap<>(); + + public void checkSlots(TileEntity te, ItemStack[] slots, int start, int end) { + + if(!(te instanceof IUpgradeInfoProvider) || slots == null) + return; + + ItemStack[] upgradeSlots = Arrays.copyOfRange(slots, start, end + 1); + + if(Arrays.equals(upgradeSlots, cachedSlots)) + return; + + cachedSlots = upgradeSlots.clone(); + + upgrades.clear(); + + for (int i = 0; i <= end - start; i++) { + + if(upgradeSlots[i] != null && upgradeSlots[i].getItem() instanceof ItemMachineUpgrade) { + + ItemMachineUpgrade item = (ItemMachineUpgrade) upgradeSlots[i].getItem(); + IUpgradeInfoProvider upgradable = (IUpgradeInfoProvider) te; + + if(upgradable.getValidUpgrades() == null) + return; + + if (upgradable.getValidUpgrades().containsKey(item.type)) { // Check if upgrade can even be accepted by the machine. + if (item.type.mutex) { + if (mutexType == null) { + upgrades.put(item.type, 1); + mutexType = item.type; + } else if(item.type.ordinal() > mutexType.ordinal()) { + upgrades.remove(mutexType); + upgrades.put(item.type, 1); + mutexType = item.type; + } + } else { + + Integer levelBefore = upgrades.get(item.type); + int upgradeLevel = (levelBefore == null ? 0 : levelBefore); + upgradeLevel += item.tier; + // Add additional check to make sure it doesn't go over the max. + upgrades.put(item.type, Math.min(upgradeLevel, upgradable.getValidUpgrades().get(item.type))); + } + } + } + } + } + + public Integer getLevel(UpgradeType type) { + return upgrades.getOrDefault(type, 0); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java index 5499a16fe..58075788b 100644 --- a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java +++ b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java @@ -41,36 +41,36 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa public GuiInfoContainer(Container p_i1072_1_) { super(p_i1072_1_); } - + public void drawElectricityInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height, long power, long maxPower) { if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) gui.drawInfo(new String[] { BobMathUtil.getShortNumber(power) + "/" + BobMathUtil.getShortNumber(maxPower) + "HE" }, mouseX, mouseY); } - + public void drawCustomInfoStat(int mouseX, int mouseY, int x, int y, int width, int height, int tPosX, int tPosY, String... text) { drawCustomInfoStat(mouseX, mouseY, x, y, width, height, tPosX, tPosY, Arrays.asList(text)); } - + public void drawCustomInfoStat(int mouseX, int mouseY, int x, int y, int width, int height, int tPosX, int tPosY, List text) { - + if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) this.func_146283_a(text, tPosX, tPosY); } - + public void drawInfo(String[] text, int x, int y) { this.func_146283_a(Arrays.asList(text), x, y); } - + /** Automatically grabs upgrade info out of the tile entity if it's a IUpgradeInfoProvider and crams the available info into a list for display. Automation, yeah! */ public List getUpgradeInfo(TileEntity tile) { List lines = new ArrayList(); - + if(tile instanceof IUpgradeInfoProvider) { IUpgradeInfoProvider provider = (IUpgradeInfoProvider) tile; - + lines.add(I18nUtil.resolveKey("upgrade.gui.title")); - + for(UpgradeType type : UpgradeType.values()) { if(provider.canProvideInfo(type, 0, false)) { - int maxLevel = provider.getMaxLevel(type); + int maxLevel = provider.getValidUpgrades().get(type); switch(type) { case SPEED: lines.add(I18nUtil.resolveKey("upgrade.gui.speed", maxLevel)); break; case POWER: lines.add(I18nUtil.resolveKey("upgrade.gui.power", maxLevel)); break; @@ -82,20 +82,20 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa } } } - + return lines; } - + @Deprecated public void drawCustomInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height, String[] text) { if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) this.func_146283_a(Arrays.asList(text), mouseX, mouseY); } - + public void drawInfoPanel(int x, int y, int width, int height, int type) { Minecraft.getMinecraft().getTextureManager().bindTexture(guiUtil); - + switch(type) { case 0: drawTexturedModalRect(x, y, 0, 0, 8, 8); break; //Small blue I case 1: drawTexturedModalRect(x, y, 0, 8, 8, 8); break; //Small green I @@ -111,7 +111,7 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa case 11: drawTexturedModalRect(x, y, 24, 32, 16, 16); break; //Large grey * } } - + protected boolean isMouseOverSlot(Slot slot, int x, int y) { return this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, x, y); } @@ -131,32 +131,32 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa return null; } - + protected boolean checkClick(int x, int y, int left, int top, int sizeX, int sizeY) { return guiLeft + left <= x && guiLeft + left + sizeX > x && guiTop + top < y && guiTop + top + sizeY >= y; } - + /* Getters for external use of the GUI's rect rendering, such as NumberDisplay */ public int getGuiTop() { return this.guiTop; } - + public int getGuiLeft() { return this.guiLeft; } - + public float getZLevel() { return this.zLevel; } - + public void setZLevel(float level) { this.zLevel = level; } - + public RenderItem getItemRenderer() { return this.itemRender; } - + public FontRenderer getFontRenderer() { return this.fontRendererObj; } @@ -176,7 +176,7 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa } protected void drawStackText(List lines, int x, int y, FontRenderer font) { - + if(!lines.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); @@ -190,11 +190,11 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa while(iterator.hasNext()) { Object[] line = (Object[]) iterator.next(); int lineWidth = 0; - + boolean hasStack = false; - + for(Object o : line) { - + if(o instanceof String) { lineWidth += font.getStringWidth((String) o); } else { @@ -202,7 +202,7 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa hasStack = true; } } - + if(hasStack) { height += 18; } else { @@ -244,19 +244,19 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa this.drawGradientRect(minX - 3, minY + height + 2, minX + longestline + 3, minY + height + 3, color1, color1); for(int index = 0; index < lines.size(); ++index) { - + Object[] line = (Object[]) lines.get(index); int indent = 0; boolean hasStack = false; - + for(Object o : line) { if(!(o instanceof String)) { hasStack = true; } } - + for(Object o : line) { - + if(o instanceof String) { font.drawStringWithShadow((String) o, minX + indent, minY + (hasStack ? 4 : 0), -1); indent += font.getStringWidth((String) o) + 2; @@ -307,7 +307,7 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa if(inventorySlots instanceof ContainerBase) { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("slot", slot.slotNumber); - + NBTTagCompound item = new NBTTagCompound(); stack.writeToNBT(item); tag.setTag("stack", item); diff --git a/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java b/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java index 57278443c..08c98125d 100644 --- a/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java @@ -247,6 +247,11 @@ public class AmmoPressRecipes extends SerializableRecipe { null, uranium, null, null, smokeless.copy(2), null, null, sShell, null)); + + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_SLUG, 4), + null, lead, null, + null, smokeless.copy(2), null, + null, sShell, null)); recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G26_FLARE, 4), null, rp, null, diff --git a/src/main/java/com/hbm/items/ItemEnumMulti.java b/src/main/java/com/hbm/items/ItemEnumMulti.java index 8085625d1..3d677b7ff 100644 --- a/src/main/java/com/hbm/items/ItemEnumMulti.java +++ b/src/main/java/com/hbm/items/ItemEnumMulti.java @@ -3,6 +3,7 @@ package com.hbm.items; import java.util.List; import java.util.Locale; +import com.hbm.interfaces.IOrderedEnum; import com.hbm.lib.RefStrings; import com.hbm.util.EnumUtil; @@ -31,8 +32,12 @@ public class ItemEnumMulti extends Item { @Override @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs tab, List list) { - for(int i = 0; i < theEnum.getEnumConstants().length; i++) { - list.add(new ItemStack(item, 1, i)); + + Enum[] order = theEnum.getEnumConstants(); + if(order[0] instanceof IOrderedEnum) order = ((IOrderedEnum) order[0]).getOrder(); + + for(int i = 0; i < order.length; i++) { + list.add(new ItemStack(item, 1, order[i].ordinal())); } } diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index ecaadac18..8e563aee3 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1108,6 +1108,7 @@ public class ModItems { public static ItemRBMKRod rbmk_fuel_zfb_am_mix; public static ItemRBMKRod rbmk_fuel_drx; public static ItemRBMKRod rbmk_fuel_test; + //public static ItemRBMKRod rbmk_fuel_curve; public static ItemRBMKPellet rbmk_pellet_ueu; public static ItemRBMKPellet rbmk_pellet_meu; public static ItemRBMKPellet rbmk_pellet_heu233; @@ -1501,6 +1502,7 @@ public class ModItems { public static Item gun_chemthrower; public static Item gun_m2; public static Item gun_autoshotgun; + public static Item gun_autoshotgun_shredder; public static Item gun_autoshotgun_sexy; public static Item gun_quadro; public static Item gun_lag; @@ -1517,6 +1519,7 @@ public class ModItems { public static Item gun_bolter; public static Item gun_folly; public static Item gun_double_barrel; + public static Item gun_double_barrel_sacred_dragon; public static Item ammo_standard; public static Item ammo_secret; @@ -3578,6 +3581,18 @@ public class ModItems { .setHeat(1.0D) .setMeltingPoint(100000) .setUnlocalizedName("rbmk_fuel_test").setTextureName(RefStrings.MODID + ":rbmk_fuel_test"); + /* Experimental flux curve shit + rbmk_fuel_curve = (ItemRBMKRod) new ItemRBMKRod("3D Flux Curve Test") + .setFluxCurve(true) + .setOutputFluxCurve((fluxQuantity, fluxRatio) -> fluxQuantity * (1 - Math.pow(fluxRatio, 2))) + .setDepletionOutputRatioCurve((ratioIn, depletion) -> Math.pow(ratioIn, 2) * depletion) + .setYield(1000000D) + .setStats(75) + .setFunction(EnumBurnFunc.SQUARE_ROOT) + .setHeat(1.5D) + .setMeltingPoint(100000) + .setUnlocalizedName("rbmk_fuel_curve").setTextureName(RefStrings.MODID + ":rbmk_fuel_curve"); + */ watz_pellet = new ItemWatzPellet().setUnlocalizedName("watz_pellet").setTextureName(RefStrings.MODID + ":watz_pellet"); watz_pellet_depleted = new ItemWatzPellet().setUnlocalizedName("watz_pellet_depleted").setTextureName(RefStrings.MODID + ":watz_pellet"); @@ -6164,6 +6179,7 @@ public class ModItems { GameRegistry.registerItem(rbmk_fuel_zfb_am_mix, rbmk_fuel_zfb_am_mix.getUnlocalizedName()); GameRegistry.registerItem(rbmk_fuel_drx, rbmk_fuel_drx.getUnlocalizedName()); GameRegistry.registerItem(rbmk_fuel_test, rbmk_fuel_test.getUnlocalizedName()); + //GameRegistry.registerItem(rbmk_fuel_curve, rbmk_fuel_curve.getUnlocalizedName()); GameRegistry.registerItem(rbmk_pellet_ueu, rbmk_pellet_ueu.getUnlocalizedName()); GameRegistry.registerItem(rbmk_pellet_meu, rbmk_pellet_meu.getUnlocalizedName()); @@ -6512,6 +6528,7 @@ public class ModItems { GameRegistry.registerItem(gun_chemthrower, gun_chemthrower.getUnlocalizedName()); GameRegistry.registerItem(gun_m2, gun_m2.getUnlocalizedName()); GameRegistry.registerItem(gun_autoshotgun, gun_autoshotgun.getUnlocalizedName()); + GameRegistry.registerItem(gun_autoshotgun_shredder, gun_autoshotgun_shredder.getUnlocalizedName()); GameRegistry.registerItem(gun_autoshotgun_sexy, gun_autoshotgun_sexy.getUnlocalizedName()); GameRegistry.registerItem(gun_quadro, gun_quadro.getUnlocalizedName()); GameRegistry.registerItem(gun_lag, gun_lag.getUnlocalizedName()); @@ -6528,6 +6545,7 @@ public class ModItems { GameRegistry.registerItem(gun_bolter, gun_bolter.getUnlocalizedName()); GameRegistry.registerItem(gun_folly, gun_folly.getUnlocalizedName()); GameRegistry.registerItem(gun_double_barrel, gun_double_barrel.getUnlocalizedName()); + GameRegistry.registerItem(gun_double_barrel_sacred_dragon, gun_double_barrel_sacred_dragon.getUnlocalizedName()); GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName()); GameRegistry.registerItem(ammo_secret, ammo_secret.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/armor/ArmorEnvsuit.java b/src/main/java/com/hbm/items/armor/ArmorEnvsuit.java index e7ee41f79..940955329 100644 --- a/src/main/java/com/hbm/items/armor/ArmorEnvsuit.java +++ b/src/main/java/com/hbm/items/armor/ArmorEnvsuit.java @@ -1,11 +1,9 @@ package com.hbm.items.armor; -import java.util.UUID; - import com.google.common.collect.Multimap; +import com.hbm.handler.ArmorModHandler; import com.hbm.items.ModItems; import com.hbm.render.model.ModelArmorEnvsuit; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBiped; @@ -19,6 +17,8 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import java.util.UUID; + public class ArmorEnvsuit extends ArmorFSBPowered { public ArmorEnvsuit(ArmorMaterial material, int slot, String texture, long maxPower, long chargeRate, long consumption, long drain) { @@ -41,14 +41,14 @@ public class ArmorEnvsuit extends ArmorFSBPowered { return models[armorSlot]; } - + private static final UUID speed = UUID.fromString("6ab858ba-d712-485c-bae9-e5e765fc555a"); @Override public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { super.onArmorTick(world, player, stack); - + if(this != ModItems.envsuit_plate) return; @@ -56,13 +56,13 @@ public class ArmorEnvsuit extends ArmorFSBPowered { Multimap multimap = super.getAttributeModifiers(stack); multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(speed, "SQUIRREL SPEED", 0.1, 0)); player.getAttributeMap().removeAttributeModifiers(multimap); - + if(this.hasFSBArmor(player)) { - + if(player.isSprinting()) player.getAttributeMap().applyAttributeModifiers(multimap); - + if(player.isInWater()) { - + if(!world.isRemote) { player.setAir(300); player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0)); @@ -78,7 +78,14 @@ public class ArmorEnvsuit extends ArmorFSBPowered { player.motionY += vec.yCoord; player.motionZ += vec.zCoord; } else { - if(!world.isRemote) { + boolean canRemoveNightVision = true; + ItemStack helmet = player.inventory.armorInventory[3]; + ItemStack helmetMod = ArmorModHandler.pryMod(helmet, ArmorModHandler.helmet_only); // Get the modification! + if (helmetMod != null && helmetMod.getItem() instanceof ItemModNightVision) { + canRemoveNightVision = false; + } + + if(!world.isRemote && canRemoveNightVision) { player.removePotionEffect(Potion.nightVision.id); } } diff --git a/src/main/java/com/hbm/items/machine/ItemRBMKLid.java b/src/main/java/com/hbm/items/machine/ItemRBMKLid.java index 1c1490798..853fe918f 100644 --- a/src/main/java/com/hbm/items/machine/ItemRBMKLid.java +++ b/src/main/java/com/hbm/items/machine/ItemRBMKLid.java @@ -2,9 +2,12 @@ package com.hbm.items.machine; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.rbmk.RBMKBase; +import com.hbm.handler.neutron.NeutronNodeWorld; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKNeutronNode; import com.hbm.items.ModItems; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase; +import com.hbm.util.fauxpointtwelve.BlockPos; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -37,7 +40,11 @@ public class ItemRBMKLid extends Item { if(tile.hasLid()) return false; - + + RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(new BlockPos(te)); + if (node != null) + node.addLid(); + int meta = RBMKBase.DIR_NORMAL_LID.ordinal(); if(this == ModItems.rbmk_lid_glass) { diff --git a/src/main/java/com/hbm/items/machine/ItemRBMKRod.java b/src/main/java/com/hbm/items/machine/ItemRBMKRod.java index 93e30f4ac..d02a393d2 100644 --- a/src/main/java/com/hbm/items/machine/ItemRBMKRod.java +++ b/src/main/java/com/hbm/items/machine/ItemRBMKRod.java @@ -2,6 +2,8 @@ package com.hbm.items.machine; import java.util.List; import java.util.Locale; +import java.util.function.BiFunction; +import java.util.function.Function; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; @@ -14,6 +16,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemRBMKRod extends Item { @@ -241,7 +244,7 @@ public class ItemRBMKRod extends Item { } /** - * @param reactivity [0;100] ...or at least those are sane levels + * @param enrichment [0;100] ...or at least those are sane levels * @return the amount of reactivity yielded, unmodified by xenon */ public double reactivityFunc(double in, double enrichment) { @@ -355,7 +358,55 @@ public class ItemRBMKRod extends Item { public static double getPoisonLevel(ItemStack stack) { return getPoison(stack) / 100D; } - + + // START Special flux curve handling! + // Nothing really uses this yet, though it's a really fun feature to play around with. + + // For the RBMK handler to see if the rod is special. + public boolean specialFluxCurve = false; + + public ItemRBMKRod setFluxCurve(boolean bool) { + specialFluxCurve = bool; + return this; + } + + /** Double 1: Flux ratio in. + * Double 2: Depletion value. + * Return double: Output flux ratio. + **/ + BiFunction ratioCurve; + + /** Double 1: Flux quantity in.
+ * Double 2: Flux ratio in.
+ * Return double: Output flux quantity. + **/ + BiFunction fluxCurve; + + public ItemRBMKRod setOutputRatioCurve(Function func) { + this.ratioCurve = (fluxRatioIn, depletion) -> func.apply(fluxRatioIn) * 1.0D; + return this; + } + + public ItemRBMKRod setDepletionOutputRatioCurve(BiFunction func) { + this.ratioCurve = func; + return this; + } + + public ItemRBMKRod setOutputFluxCurve(BiFunction func) { + this.fluxCurve = func; + return this; + } + + public double fluxRatioOut(double fluxRatioIn, double depletion) { + return MathHelper.clamp_double(ratioCurve.apply(fluxRatioIn, depletion), 0, 1); + } + + public double fluxFromRatio(double quantity, double ratio) { + return fluxCurve.apply(quantity, ratio); + } + + // END Special flux curve handling. + @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { diff --git a/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java b/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java index 865b4e598..4e916200c 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java +++ b/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.function.BiConsumer; import java.util.function.Consumer; +import com.hbm.blocks.ModBlocks; import com.hbm.blocks.bomb.BlockDetonatable; import com.hbm.entity.projectile.EntityBulletBaseMK4; import com.hbm.entity.projectile.EntityBulletBeamBase; @@ -99,6 +100,7 @@ public class BulletConfig implements Cloneable { public BulletConfig setChunkloading() { this.pType = ProjectileType.BULLET_CHUNKLOADING; return this; } public BulletConfig setItem(Item ammo) { this.ammo = new ComparableStack(ammo); return this; } public BulletConfig setItem(ItemStack ammo) { this.ammo = new ComparableStack(ammo); return this; } + public BulletConfig setItem(ComparableStack ammo) { this.ammo = ammo; return this; } public BulletConfig setItem(EnumAmmo ammo) { this.ammo = new ComparableStack(ModItems.ammo_standard, 1, ammo.ordinal()); return this; } public BulletConfig setItem(EnumAmmoSecret ammo) { this.ammo = new ComparableStack(ModItems.ammo_secret, 1, ammo.ordinal()); return this; } public BulletConfig setReloadCount(int ammoReloadCount) { this.ammoReloadCount = ammoReloadCount; return this; } @@ -174,6 +176,10 @@ public class BulletConfig implements Cloneable { if(b instanceof BlockDetonatable) { ((BlockDetonatable) b).onShot(bullet.worldObj, mop.blockX, mop.blockY, mop.blockZ); } + if(b == ModBlocks.deco_crt) { + int meta = bullet.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ); + bullet.worldObj.setBlockMetadataWithNotify(mop.blockX, mop.blockY, mop.blockZ, meta % 4 + 4, 3); + } ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit); Vec3 face = Vec3.createVectorHelper(dir.offsetX, dir.offsetY, dir.offsetZ); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java index 49b7e1ef7..afd0b437a 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java @@ -1,5 +1,6 @@ package com.hbm.items.weapon.sedna.factory; +import com.hbm.interfaces.IOrderedEnum; import com.hbm.items.ItemEnumMulti; import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.BulletConfig; @@ -69,7 +70,7 @@ public class GunFactory { MainRegistry.proxy.registerGunCfg(); } - public static enum EnumAmmo { + public static enum EnumAmmo implements IOrderedEnum { STONE, STONE_AP, STONE_IRON, STONE_SHOT, M357_BP, M357_SP, M357_FMJ, M357_JHP, M357_AP, M357_EXPRESS, M44_BP, M44_SP, M44_FMJ, M44_JHP, M44_AP, M44_EXPRESS, @@ -88,7 +89,37 @@ public class GunFactory { TAU_URANIUM, COIL_TUNGSTEN, COIL_FERROURANIUM, NUKE_STANDARD, NUKE_DEMO, NUKE_HIGH, NUKE_TOTS, NUKE_HIVE, - G10, G10_SHRAPNEL, G10_DU + G10, G10_SHRAPNEL, G10_DU, G10_SLUG, + + //ONLY ADD NEW ENTRIES AT THE BOTTOM TO AVOID SHIFTING! + ; + + /** used for creative tab order */ + public static EnumAmmo[] order = new EnumAmmo[] { + STONE, STONE_AP, STONE_IRON, STONE_SHOT, + M357_BP, M357_SP, M357_FMJ, M357_JHP, M357_AP, M357_EXPRESS, + M44_BP, M44_SP, M44_FMJ, M44_JHP, M44_AP, M44_EXPRESS, + P22_SP, P22_FMJ, P22_JHP, P22_AP, + P9_SP, P9_FMJ, P9_JHP, P9_AP, + R556_SP, R556_FMJ, R556_JHP, R556_AP, + R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU, + BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU, + B75, B75_INC, B75_EXP, + G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G12_SLUG, G12_FLECHETTE, G12_MAGNUM, G12_EXPLOSIVE, G12_PHOSPHORUS, + G10, G10_SHRAPNEL, G10_DU, G10_SLUG, + G26_FLARE, G26_FLARE_SUPPLY, G26_FLARE_WEAPON, + G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS, + ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS, + FLAME_DIESEL, FLAME_GAS, FLAME_NAPALM, FLAME_BALEFIRE, + CAPACITOR, CAPACITOR_OVERCHARGE, CAPACITOR_IR, + TAU_URANIUM, + COIL_TUNGSTEN, COIL_FERROURANIUM, + NUKE_STANDARD, NUKE_DEMO, NUKE_HIGH, NUKE_TOTS, NUKE_HIVE, + }; + + public Enum[] getOrder() { + return order; + } } public static enum EnumAmmoSecret { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java index 7ad7d2f6a..600dfbd19 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java @@ -36,52 +36,54 @@ public class GunFactoryClient { public static void init() { //GUNS - MinecraftForgeClient.registerItemRenderer(ModItems.gun_debug, new ItemRenderDebug()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_pepperbox, new ItemRenderPepperbox()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver, new ItemRenderAtlas(ResourceManager.bio_revolver_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_atlas, new ItemRenderAtlas(ResourceManager.bio_revolver_atlas_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_dani, new ItemRenderDANI()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry, new ItemRenderHenry()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_greasegun, new ItemRenderGreasegun()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg, new ItemRenderMaresleg(ResourceManager.maresleg_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg_akimbo, new ItemRenderMareslegAkimbo()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg_broken, new ItemRenderMaresleg(ResourceManager.maresleg_broken_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_flaregun, new ItemRenderFlaregun()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver, new ItemRenderHeavyRevolver(ResourceManager.heavy_revolver_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver_lilmac, new ItemRenderHeavyRevolver(ResourceManager.lilmac_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver_protege, new ItemRenderHeavyRevolver(ResourceManager.heavy_revolver_protege_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_carbine, new ItemRenderCarbine()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_am180, new ItemRenderAm180()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_liberator, new ItemRenderLiberator()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_congolake, new ItemRenderCongoLake()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer, new ItemRenderFlamer(ResourceManager.flamethrower_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer_topaz, new ItemRenderFlamer(ResourceManager.flamethrower_topaz_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer_daybreaker, new ItemRenderFlamer(ResourceManager.flamethrower_daybreaker_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_lag, new ItemRenderLAG()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_uzi, new ItemRenderUzi()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_uzi_akimbo, new ItemRenderUziAkimbo()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_spas12, new ItemRenderSPAS12()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_panzerschreck, new ItemRenderPanzerschreck()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_g3, new ItemRenderG3()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_stinger, new ItemRenderStinger()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_chemthrower, new ItemRenderChemthrower()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_m2, new ItemRenderM2()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun, new ItemRenderShredder(ResourceManager.shredder_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun_sexy, new ItemRenderShredder(ResourceManager.sexy_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderQuadro()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun, new ItemRenderMinigun(ResourceManager.minigun_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun_lacunae, new ItemRenderMinigun(ResourceManager.minigun_lacunae_tex)); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_missile_launcher, new ItemRenderMissileLauncher()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_tesla_cannon, new ItemRenderTeslaCannon()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_stg77, new ItemRenderSTG77()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_tau, new ItemRenderTau()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_fatman, new ItemRenderFatMan()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_lasrifle, new ItemRenderLasrifle()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_coilgun, new ItemRenderCoilgun()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_hangman, new ItemRenderHangman()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter, new ItemRenderBolter()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_folly, new ItemRenderFolly()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_double_barrel, new ItemRenderDoubleBarrel()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_debug, new ItemRenderDebug()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_pepperbox, new ItemRenderPepperbox()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver, new ItemRenderAtlas(ResourceManager.bio_revolver_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_atlas, new ItemRenderAtlas(ResourceManager.bio_revolver_atlas_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_dani, new ItemRenderDANI()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry, new ItemRenderHenry()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_greasegun, new ItemRenderGreasegun()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg, new ItemRenderMaresleg(ResourceManager.maresleg_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg_akimbo, new ItemRenderMareslegAkimbo()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg_broken, new ItemRenderMaresleg(ResourceManager.maresleg_broken_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_flaregun, new ItemRenderFlaregun()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver, new ItemRenderHeavyRevolver(ResourceManager.heavy_revolver_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver_lilmac, new ItemRenderHeavyRevolver(ResourceManager.lilmac_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_heavy_revolver_protege, new ItemRenderHeavyRevolver(ResourceManager.heavy_revolver_protege_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_carbine, new ItemRenderCarbine()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_am180, new ItemRenderAm180()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_liberator, new ItemRenderLiberator()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_congolake, new ItemRenderCongoLake()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer, new ItemRenderFlamer(ResourceManager.flamethrower_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer_topaz, new ItemRenderFlamer(ResourceManager.flamethrower_topaz_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_flamer_daybreaker, new ItemRenderFlamer(ResourceManager.flamethrower_daybreaker_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_lag, new ItemRenderLAG()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_uzi, new ItemRenderUzi()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_uzi_akimbo, new ItemRenderUziAkimbo()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_spas12, new ItemRenderSPAS12()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_panzerschreck, new ItemRenderPanzerschreck()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_g3, new ItemRenderG3()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_stinger, new ItemRenderStinger()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_chemthrower, new ItemRenderChemthrower()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_m2, new ItemRenderM2()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun, new ItemRenderShredder(ResourceManager.shredder_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun_shredder, new ItemRenderShredder(ResourceManager.shredder_orig_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_autoshotgun_sexy, new ItemRenderShredder(ResourceManager.sexy_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderQuadro()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun, new ItemRenderMinigun(ResourceManager.minigun_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_minigun_lacunae, new ItemRenderMinigun(ResourceManager.minigun_lacunae_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_missile_launcher, new ItemRenderMissileLauncher()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_tesla_cannon, new ItemRenderTeslaCannon()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_stg77, new ItemRenderSTG77()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_tau, new ItemRenderTau()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_fatman, new ItemRenderFatMan()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_lasrifle, new ItemRenderLasrifle()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_coilgun, new ItemRenderCoilgun()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_hangman, new ItemRenderHangman()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter, new ItemRenderBolter()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_folly, new ItemRenderFolly()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_double_barrel, new ItemRenderDoubleBarrel(ResourceManager.double_barrel_tex)); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_double_barrel_sacred_dragon, new ItemRenderDoubleBarrel(ResourceManager.double_barrel_sacred_dragon_tex)); //PROJECTILES ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET); @@ -146,13 +148,22 @@ public class GunFactoryClient { g12_magnum.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_explosive.setRenderer(LegoClient.RENDER_EXPRESS_BULLET); g12_phosphorus.setRenderer(LegoClient.RENDER_AP_BULLET); - //g12_anthrax.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_equestrian_bj.setRenderer(LegoClient.RENDER_LEGENDARY_BULLET); g12_equestrian_tkr.setRenderer(LegoClient.RENDER_LEGENDARY_BULLET); + g12_sub.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + g12_sub_slug.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + g12_sub_flechette.setRenderer(LegoClient.RENDER_FLECHETTE_BULLET); + g12_sub_magnum.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + g12_sub_explosive.setRenderer(LegoClient.RENDER_EXPRESS_BULLET); + g12_sub_phosphorus.setRenderer(LegoClient.RENDER_AP_BULLET); + + setRendererBulkBeam(LegoClient.RENDER_LASER_CYAN, g12_shredder, g12_shredder_slug, g12_shredder_flechette, g12_shredder_magnum, g12_shredder_explosive, g12_shredder_phosphorus); + g10.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g10_shrapnel.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g10_du.setRenderer(LegoClient.RENDER_DU_BULLET); + g10_slug.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g26_flare.setRenderer(LegoClient.RENDER_FLARE); g26_flare_supply.setRenderer(LegoClient.RENDER_FLARE_SUPPLY); @@ -182,49 +193,51 @@ public class GunFactoryClient { setRendererBulk(LegoClient.RENDER_GRENADE, shell_normal, shell_explosive, shell_ap, shell_du, shell_w9); //TODO: change the sabots //HUDS - ((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_pepperbox) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_light_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_light_revolver_atlas) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_henry) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_greasegun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_maresleg) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_maresleg_broken) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_flaregun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_heavy_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_heavy_revolver_lilmac) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_heavy_revolver_protege) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_carbine) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_am180) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_liberator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_congolake) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_flamer) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); - ((ItemGunBaseNT) ModItems.gun_flamer_topaz) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); - ((ItemGunBaseNT) ModItems.gun_flamer_daybreaker) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); - ((ItemGunBaseNT) ModItems.gun_uzi) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_spas12) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_panzerschreck) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_g3) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_stinger) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_chemthrower) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_m2) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_autoshotgun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_autoshotgun_sexy) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_quadro) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_lag) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_minigun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_minigun_lacunae) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_missile_launcher) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_tesla_cannon) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_stg77) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_tau) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_fatman) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_lasrifle) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_coilgun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_hangman) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_bolter) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_folly) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_double_barrel) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_pepperbox) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_light_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_light_revolver_atlas) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_henry) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_greasegun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_maresleg) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_maresleg_broken) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_flaregun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_heavy_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_heavy_revolver_lilmac) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_heavy_revolver_protege) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_carbine) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_am180) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_liberator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_congolake) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_flamer) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); + ((ItemGunBaseNT) ModItems.gun_flamer_topaz) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); + ((ItemGunBaseNT) ModItems.gun_flamer_daybreaker) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); + ((ItemGunBaseNT) ModItems.gun_uzi) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_spas12) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_panzerschreck) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_g3) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_stinger) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_chemthrower) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_m2) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_autoshotgun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_autoshotgun_shredder) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_autoshotgun_sexy) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_quadro) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_lag) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_minigun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_minigun_lacunae) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_missile_launcher) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_tesla_cannon) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_stg77) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_tau) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_fatman) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_lasrifle) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_coilgun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_hangman) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_bolter) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_folly) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_double_barrel) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_double_barrel_sacred_dragon) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_light_revolver_dani) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR); ((ItemGunBaseNT) ModItems.gun_light_revolver_dani) .getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java b/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java index a0a2c8bbb..10f124031 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/LegoClient.java @@ -318,11 +318,13 @@ public class LegoClient { GL11.glPopMatrix(); RenderArcFurnace.fullbright(false); }; - + public static BiConsumer RENDER_LASER_RED = (bullet, interp) -> { renderStandardLaser(bullet, interp, 0x80, 0x15, 0x15); }; - + public static BiConsumer RENDER_LASER_CYAN = (bullet, interp) -> { + renderStandardLaser(bullet, interp, 0x15, 0x15, 0x80); + }; public static BiConsumer RENDER_LASER_PURPLE = (bullet, interp) -> { renderStandardLaser(bullet, interp, 0x60, 0x15, 0x80); }; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory10ga.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory10ga.java index 60130b5ff..9df3a3a63 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory10ga.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory10ga.java @@ -27,23 +27,35 @@ public class XFactory10ga { public static BulletConfig g10; public static BulletConfig g10_shrapnel; public static BulletConfig g10_du; + public static BulletConfig g10_slug; public static void init() { g10 = new BulletConfig().setItem(EnumAmmo.G10).setProjectiles(10).setDamage(1F/10F).setSpread(0.05F).setRicochetAngle(15).setThresholdNegation(5F).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xB52B2B, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GA")); g10_shrapnel = new BulletConfig().setItem(EnumAmmo.G10_SHRAPNEL).setProjectiles(10).setDamage(1F/10F).setSpread(0.05F).setRicochetAngle(90).setRicochetCount(15).setThresholdNegation(5F).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xE5DD00, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GAShrapnel")); g10_du = new BulletConfig().setItem(EnumAmmo.G10_DU).setProjectiles(10).setDamage(1F/4F).setSpread(0.05F).setRicochetAngle(15).setThresholdNegation(10F).setArmorPiercing(0.2F).setDoesPenetrate(true).setDamageFalloutByPen(false).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x538D53, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GADU")); + g10_slug = new BulletConfig().setItem(EnumAmmo.G10_SLUG).setRicochetAngle(15).setThresholdNegation(10F).setArmorPiercing(0.1F).setDoesPenetrate(true).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x808080, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GASlug")); ModItems.gun_double_barrel = new ItemGunBaseNT(WeaponQuality.SPECIAL, new GunConfig() .dura(1000).draw(10).inspect(39).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .rec(new Receiver(0) .dmg(30F).rounds(2).delay(10).reload(41).reloadOnEmpty(true).sound("hbm:weapon.fire.shotgun", 1.0F, 0.9F) - .mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du)) + .mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du, g10_slug)) .offset(0.75, -0.0625, -0.1875) .setupStandardFire().recoil(LAMBDA_RECOIL_DOUBLE_BARREL)) .setupStandardConfiguration() .anim(LAMBDA_DOUBLE_BARREL_ANIMS).orchestra(Orchestras.ORCHESTRA_DOUBLE_BARREL) ).setUnlocalizedName("gun_double_barrel"); + ModItems.gun_double_barrel_sacred_dragon = new ItemGunBaseNT(WeaponQuality.B_SIDE, new GunConfig() + .dura(6000).draw(10).inspect(39).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) + .rec(new Receiver(0) + .dmg(45F).rounds(2).delay(10).reload(41).reloadOnEmpty(true).sound("hbm:weapon.fire.shotgun", 1.0F, 0.9F) + .mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du, g10_slug)) + .offset(0.75, -0.0625, -0.1875) + .setupStandardFire().recoil(LAMBDA_RECOIL_DOUBLE_BARREL)) + .setupStandardConfiguration() + .anim(LAMBDA_DOUBLE_BARREL_ANIMS).orchestra(Orchestras.ORCHESTRA_DOUBLE_BARREL) + ).setUnlocalizedName("gun_double_barrel_sacred_dragon"); } public static BiConsumer LAMBDA_RECOIL_DOUBLE_BARREL = (stack, ctx) -> { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory12ga.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory12ga.java index 748262005..d62c65262 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory12ga.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory12ga.java @@ -1,8 +1,11 @@ package com.hbm.items.weapon.sedna.factory; +import java.util.List; import java.util.function.BiConsumer; import java.util.function.BiFunction; +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.bomb.BlockDetonatable; import com.hbm.entity.projectile.EntityBulletBaseMK4; import com.hbm.entity.projectile.EntityDuchessGambit; import com.hbm.extprop.HbmLivingProps; @@ -17,21 +20,40 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; +import com.hbm.items.weapon.sedna.mags.MagazineBelt; import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.main.MainRegistry; import com.hbm.main.ResourceManager; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing.CasingType; import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.HbmAnimations.AnimType; +import com.hbm.util.BobMathUtil; +import com.hbm.util.TrackerUtil; +import com.hbm.util.Vec3NT; +import com.hbm.util.DamageResistanceHandler.DamageClass; +import com.hbm.util.EntityDamageUtil; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.ForgeDirection; public class XFactory12ga { @@ -47,6 +69,20 @@ public class XFactory12ga { public static BulletConfig g12_anthrax; public static BulletConfig g12_equestrian_bj; public static BulletConfig g12_equestrian_tkr; + + public static BulletConfig g12_shredder; + public static BulletConfig g12_shredder_slug; + public static BulletConfig g12_shredder_flechette; + public static BulletConfig g12_shredder_magnum; + public static BulletConfig g12_shredder_explosive; + public static BulletConfig g12_shredder_phosphorus; + + public static BulletConfig g12_sub; + public static BulletConfig g12_sub_slug; + public static BulletConfig g12_sub_flechette; + public static BulletConfig g12_sub_magnum; + public static BulletConfig g12_sub_explosive; + public static BulletConfig g12_sub_phosphorus; public static BiConsumer LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> { Lego.standardExplode(bullet, mop, 2F); bullet.setDead(); @@ -62,11 +98,166 @@ public class XFactory12ga { bullet.setDead(); }; + public static BulletConfig makeShredderConfig(BulletConfig original, BulletConfig submunition) { + BulletConfig cfg = new BulletConfig().setBeam().setRenderRotations(false).setLife(5).setDamage(original.damageMult * original.projectilesMax).setupDamageClass(DamageClass.LASER); + cfg.setItem(original.ammo); + cfg.setCasing(original.casing); + cfg.setOnBeamImpact((beam, mop) -> { + + int projectiles = submunition.projectilesMin; + if(submunition.projectilesMax > submunition.projectilesMin) projectiles += beam.worldObj.rand.nextInt(submunition.projectilesMax - submunition.projectilesMin + 1); + + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { + + ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit); + + mop.hitVec.xCoord += dir.offsetX * 0.1; + mop.hitVec.yCoord += dir.offsetY * 0.1; + mop.hitVec.zCoord += dir.offsetZ * 0.1; + + spawnPulse(beam.worldObj, mop, beam.rotationYaw, beam.rotationPitch); + + List blast = beam.worldObj.getEntitiesWithinAABBExcludingEntity(beam, AxisAlignedBB.getBoundingBox(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord).expand(0.75, 0.75, 0.75)); + DamageSource source = BulletConfig.getDamage(beam, beam.getThrower(), DamageClass.LASER); + + for(Entity e : blast) { + if(!e.isEntityAlive()) continue; + if(e instanceof EntityLivingBase) { + EntityDamageUtil.attackEntityFromNT((EntityLivingBase) e, source, beam.damage, true, false, 0D, 0F, 0F); + if(!e.isEntityAlive()) ConfettiUtil.decideConfetti((EntityLivingBase) e, source); + } else { + e.attackEntityFrom(source, beam.damage); + } + } + + for(int i = 0; i < projectiles; i++) { + EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(beam.worldObj, beam.thrower, submunition, beam.damage * submunition.damageMult, 0.2F, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, dir.offsetX, dir.offsetY, dir.offsetZ); + bullet.worldObj.spawnEntityInWorld(bullet); + } + } + + if(mop.typeOfHit == mop.typeOfHit.ENTITY) { + + spawnPulse(beam.worldObj, mop, beam.rotationYaw, beam.rotationPitch); + + for(int i = 0; i < projectiles; i++) { + Vec3NT vec = new Vec3NT(beam.worldObj.rand.nextGaussian(), beam.worldObj.rand.nextGaussian(), beam.worldObj.rand.nextGaussian()).normalizeSelf(); + EntityBulletBaseMK4 bullet = new EntityBulletBaseMK4(beam.worldObj, beam.thrower, submunition, beam.damage * submunition.damageMult, 0.2F, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, vec.xCoord, vec.yCoord, vec.zCoord); + bullet.worldObj.spawnEntityInWorld(bullet); + } + } + }); + return cfg; + } + + public static BulletConfig makeShredderSubmunition(BulletConfig original) { + BulletConfig cfg = original.clone(); + cfg.setRicochetAngle(90).setRicochetCount(3).setVel(0.5F).setLife(50).setupDamageClass(DamageClass.LASER).setOnRicochet(LAMBDA_SHREDDER_RICOCHET); + return cfg; + } + + //this sucks + public static BiConsumer LAMBDA_SHREDDER_RICOCHET = (bullet, mop) -> { + + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { + + Block b = bullet.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); + if(b.getMaterial() == Material.glass) { + bullet.worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false); + bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); + return; + } + if(b instanceof BlockDetonatable) { + ((BlockDetonatable) b).onShot(bullet.worldObj, mop.blockX, mop.blockY, mop.blockZ); + } + if(b == ModBlocks.deco_crt) { + int meta = bullet.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ); + bullet.worldObj.setBlockMetadataWithNotify(mop.blockX, mop.blockY, mop.blockZ, meta % 4 + 4, 3); + } + + ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit); + Vec3 face = Vec3.createVectorHelper(dir.offsetX, dir.offsetY, dir.offsetZ); + Vec3 vel = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).normalize(); + + double angle = Math.abs(BobMathUtil.getCrossAngle(vel, face) - 90); + + if(angle <= bullet.config.ricochetAngle) { + + spawnPulse(bullet.worldObj, mop, bullet.rotationYaw, bullet.rotationPitch); + + List blast = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX, bullet.posY, bullet.posZ, bullet.posX, bullet.posY, bullet.posZ).expand(0.5, 0.5, 0.5)); + DamageSource source = BulletConfig.getDamage(bullet, bullet.getThrower(), DamageClass.LASER); + + for(Entity e : blast) { + if(!e.isEntityAlive()) continue; + if(e instanceof EntityLivingBase) { + EntityDamageUtil.attackEntityFromNT((EntityLivingBase) e, source, bullet.damage, true, false, 0D, 0F, 0F); + if(!e.isEntityAlive()) ConfettiUtil.decideConfetti((EntityLivingBase) e, source); + } else { + e.attackEntityFrom(source, bullet.damage); + } + } + + bullet.ricochets++; + if(bullet.ricochets > bullet.config.maxRicochetCount) { + bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); + bullet.setDead(); + } + + switch(mop.sideHit) { + case 0: case 1: bullet.motionY *= -1; break; + case 2: case 3: bullet.motionZ *= -1; break; + case 4: case 5: bullet.motionX *= -1; break; + } + bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); + //send a teleport so the ricochet is more accurate instead of the interp smoothing fucking everything up + if(bullet.worldObj instanceof WorldServer) TrackerUtil.sendTeleport((WorldServer) bullet.worldObj, bullet); + return; + + } else { + bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); + bullet.setDead(); + } + } + }; + + public static void spawnPulse(World world, MovingObjectPosition mop, float yaw, float pitch) { + + double x = mop.hitVec.xCoord; + double y = mop.hitVec.yCoord; + double z = mop.hitVec.zCoord; + + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { + if(mop.sideHit == ForgeDirection.UP.ordinal()) { yaw = 0F; pitch = 0F; } + if(mop.sideHit == ForgeDirection.DOWN.ordinal()) { yaw = 0F; pitch = 0F; } + if(mop.sideHit == ForgeDirection.NORTH.ordinal()) { yaw = 0F; pitch = 90F; } + if(mop.sideHit == ForgeDirection.SOUTH.ordinal()) { yaw = 180F; pitch = 90F; } + if(mop.sideHit == ForgeDirection.EAST.ordinal()) { yaw = 90F; pitch = 90F; } + if(mop.sideHit == ForgeDirection.WEST.ordinal()) { yaw = 270F; pitch = 90F; } + + ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit); + + x += dir.offsetX * 0.05; + y += dir.offsetY * 0.05; + z += dir.offsetZ * 0.05; + } + + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "plasmablast"); + data.setFloat("r", 0.5F); + data.setFloat("g", 0.5F); + data.setFloat("b", 1.0F); + data.setFloat("pitch", pitch); + data.setFloat("yaw", yaw); + data.setFloat("scale", 0.75F); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 100)); + } + public static void init() { - g12_bp = new BulletConfig().setItem(EnumAmmo.G12_BP).setBlackPowder(true).setProjectiles(8).setDamage(0.5F/8F).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP")); - g12_bp_magnum = new BulletConfig().setItem(EnumAmmo.G12_BP_MAGNUM).setBlackPowder(true).setProjectiles(4).setDamage(0.5F/4F).setSpread(0.05F).setRicochetAngle(25).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP_MAGNUM")); - g12_bp_slug = new BulletConfig().setItem(EnumAmmo.G12_BP_SLUG).setBlackPowder(true).setDamage(0.5F).setSpread(0.01F).setRicochetAngle(5).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP_SLUG")); + g12_bp = new BulletConfig().setItem(EnumAmmo.G12_BP).setBlackPowder(true).setProjectiles(8).setDamage(0.75F/8F).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP")); + g12_bp_magnum = new BulletConfig().setItem(EnumAmmo.G12_BP_MAGNUM).setBlackPowder(true).setProjectiles(4).setDamage(0.75F/4F).setSpread(0.05F).setRicochetAngle(25).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP_MAGNUM")); + g12_bp_slug = new BulletConfig().setItem(EnumAmmo.G12_BP_SLUG).setBlackPowder(true).setDamage(0.75F).setSpread(0.01F).setRicochetAngle(5).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP_SLUG")); g12 = new BulletConfig().setItem(EnumAmmo.G12).setProjectiles(8).setDamage(1F/8F).setSpread(0.05F).setRicochetAngle(15).setThresholdNegation(2F).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xB52B2B, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA")); g12_slug = new BulletConfig().setItem(EnumAmmo.G12_SLUG).setHeadshot(1.5F).setSpread(0.0F).setRicochetAngle(25).setThresholdNegation(4F).setArmorPiercing(0.15F).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x393939, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_SLUG")); g12_flechette = new BulletConfig().setItem(EnumAmmo.G12_FLECHETTE).setProjectiles(8).setDamage(1F/8F).setThresholdNegation(5F).setThresholdNegation(3F).setArmorPiercing(0.2F).setSpread(0.025F).setRicochetAngle(5).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x3C80F0, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_FLECHETTE")); @@ -79,6 +270,19 @@ public class XFactory12ga { g12_equestrian_tkr = new BulletConfig().setItem(EnumAmmoSecret.G12_EQUESTRIAN).setDamage(0F).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_EQUESTRIAN, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12gaEquestrianTKR")); BulletConfig[] all = new BulletConfig[] {g12_bp, g12_bp_magnum, g12_bp_slug, g12, g12_slug, g12_flechette, g12_magnum, g12_explosive, g12_phosphorus}; + + g12_sub = makeShredderSubmunition(g12); + g12_sub_slug = makeShredderSubmunition(g12_slug); + g12_sub_flechette = makeShredderSubmunition(g12_flechette); + g12_sub_magnum = makeShredderSubmunition(g12_magnum); + g12_sub_explosive = makeShredderSubmunition(g12_explosive); + g12_sub_phosphorus = makeShredderSubmunition(g12_phosphorus); + g12_shredder = makeShredderConfig(g12, g12_sub); + g12_shredder_slug = makeShredderConfig(g12_slug, g12_sub_slug); + g12_shredder_flechette = makeShredderConfig(g12_flechette, g12_sub_flechette); + g12_shredder_magnum = makeShredderConfig(g12_magnum, g12_sub_magnum); + g12_shredder_explosive = makeShredderConfig(g12_explosive, g12_sub_explosive); + g12_shredder_phosphorus = makeShredderConfig(g12_phosphorus, g12_sub_phosphorus); ModItems.gun_maresleg = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() .dura(600).draw(10).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) @@ -153,6 +357,16 @@ public class XFactory12ga { .setupStandardConfiguration() .anim(LAMBDA_SHREDDER_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER) ).setUnlocalizedName("gun_autoshotgun"); + ModItems.gun_autoshotgun_shredder = new ItemGunBaseNT(WeaponQuality.B_SIDE, new GunConfig() + .dura(2_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) + .rec(new Receiver(0) + .dmg(50F).delay(10).auto(true).autoAfterDry(true).dryfireAfterAuto(true).reload(44).jam(19).sound("hbm:weapon.fire.shotgunAuto", 1.0F, 1.0F) + .mag(new MagazineBelt().addConfigs(g12_shredder, g12_shredder_slug, g12_shredder_flechette, g12_shredder_magnum, g12_shredder_explosive, g12_shredder_phosphorus)) + .offset(0.75, -0.125, -0.25) + .setupStandardFire().recoil(LAMBDA_RECOIL_AUTOSHOTGUN)) + .setupStandardConfiguration() + .anim(LAMBDA_SHREDDER_ANIMS).orchestra(Orchestras.ORCHESTRA_SHREDDER) + ).setUnlocalizedName("gun_autoshotgun_shredder"); ModItems.gun_autoshotgun_sexy = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig() .dura(5_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .rec(new Receiver(0) diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory357.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory357.java index ee5846c7a..e99c6d6a4 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory357.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory357.java @@ -30,7 +30,7 @@ public class XFactory357 { public static BulletConfig m357_express; public static void init() { - m357_bp = new BulletConfig().setItem(EnumAmmo.M357_BP).setDamage(0.5F).setBlackPowder(true); + m357_bp = new BulletConfig().setItem(EnumAmmo.M357_BP).setDamage(0.75F).setBlackPowder(true); m357_sp = new BulletConfig().setItem(EnumAmmo.M357_SP); m357_fmj = new BulletConfig().setItem(EnumAmmo.M357_FMJ).setDamage(0.8F).setThresholdNegation(2F).setArmorPiercing(0.1F); m357_jhp = new BulletConfig().setItem(EnumAmmo.M357_JHP).setDamage(1.5F).setHeadshot(1.5F).setArmorPiercing(-0.25F); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory40mm.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory40mm.java index b814c14c4..e85ba975f 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory40mm.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory40mm.java @@ -36,6 +36,7 @@ import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.util.EntityDamageUtil; import com.hbm.util.TrackerUtil; import com.hbm.util.DamageResistanceHandler.DamageClass; +import com.hbm.world.WorldUtil; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -133,7 +134,7 @@ public class XFactory40mm { int z = (int) Math.floor(bullet.posZ); int y = bullet.worldObj.getHeightValue(x, z); c130.fac(bullet.worldObj, x, y, z, payload); - bullet.worldObj.spawnEntityInWorld(c130); + WorldUtil.loadAndSpawnEntityInWorld(c130); TrackerUtil.setTrackingRange(bullet.worldObj, c130, 250); } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java index c7ca8f24a..a86c9f699 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java @@ -66,7 +66,7 @@ public class XFactory44 { public static void init() { SpentCasing casing44 = new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(1F, 0.5D, 60, 20); - m44_bp = new BulletConfig().setItem(EnumAmmo.M44_BP).setDamage(0.5F).setBlackPowder(true) + m44_bp = new BulletConfig().setItem(EnumAmmo.M44_BP).setDamage(0.75F).setBlackPowder(true) .setCasing(casing44.clone().register("m44bp")); m44_sp = new BulletConfig().setItem(EnumAmmo.M44_SP) .setCasing(casing44.clone().register("m44")); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java index c87554f38..c86790f7a 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java @@ -99,7 +99,8 @@ public class XFactory556mm { case CYCLE: return new BusAnimation() .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.5 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL)); case CYCLE_DRY: return new BusAnimation() - .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100)); + .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -3.25, 150).addPos(0, 0, 0, 100)) + .addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 400).addPos(-1, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL)); case RELOAD: return new BusAnimation() .addBus("MAG", new BusAnimationSequence() diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryBlackPowder.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryBlackPowder.java index 203770f37..e3366bca2 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryBlackPowder.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryBlackPowder.java @@ -22,10 +22,10 @@ import net.minecraft.item.ItemStack; public class XFactoryBlackPowder { - public static BulletConfig stone = new BulletConfig().setItem(EnumAmmo.STONE).setBlackPowder(true).setSpread(0.025F).setRicochetAngle(15); - public static BulletConfig flint = new BulletConfig().setItem(EnumAmmo.STONE_AP).setBlackPowder(true).setSpread(0.01F).setRicochetAngle(5).setDoesPenetrate(true).setDamage(1.75F); - public static BulletConfig iron = new BulletConfig().setItem(EnumAmmo.STONE_IRON).setBlackPowder(true).setSpread(0F).setRicochetAngle(90).setRicochetCount(5).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(2F); - public static BulletConfig shot = new BulletConfig().setItem(EnumAmmo.STONE_SHOT).setBlackPowder(true).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setDamage(0.5F); + public static BulletConfig stone = new BulletConfig().setItem(EnumAmmo.STONE).setBlackPowder(true).setHeadshot(1F).setSpread(0.025F).setRicochetAngle(15); + public static BulletConfig flint = new BulletConfig().setItem(EnumAmmo.STONE_AP).setBlackPowder(true).setHeadshot(1F).setSpread(0.01F).setRicochetAngle(5).setDoesPenetrate(true).setDamage(1.5F); + public static BulletConfig iron = new BulletConfig().setItem(EnumAmmo.STONE_IRON).setBlackPowder(true).setHeadshot(1F).setSpread(0F).setRicochetAngle(90).setRicochetCount(5).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(1.5F); + public static BulletConfig shot = new BulletConfig().setItem(EnumAmmo.STONE_SHOT).setBlackPowder(true).setHeadshot(1F).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setDamage(1F/6F); public static void init() { diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index 7c3c1f9f6..157ff80ea 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -1,20 +1,19 @@ package com.hbm.lib; -import java.util.Random; - import com.hbm.items.special.ItemBookLore; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.WeightedRandomChestContent; +import java.util.Random; + public class HbmChestContents { public static WeightedRandomChestContent weighted(Item item, int meta, int min, int max, int weight) { return new WeightedRandomChestContent(item, meta, Math.min(min, max), Math.max(min, max), weight); } public static WeightedRandomChestContent weighted(Block block, int meta, int min, int max, int weight) { return new WeightedRandomChestContent(Item.getItemFromBlock(block), meta, Math.min(min, max), Math.max(min, max), weight); } public static WeightedRandomChestContent weighted(ItemStack item, int min, int max, int weight) { return new WeightedRandomChestContent(item, Math.min(min, max), Math.max(min, max), weight); } - + /** ITEMBOOKLORE SHIT */ //one downside of all this huge flexibility, make a wrapper if it's too annoying public static ItemStack generateOfficeBook(Random rand) { //TODO rework this lore in general @@ -28,14 +27,14 @@ public class HbmChestContents { case 4: key = "memo_schrab_nuke"; pages = 3; break; default: return null; } - + return ItemBookLore.createBook(key, pages, 0x6BC8FF, 0x0A0A0A); } - + public static ItemStack generateLabBook(Random rand) { String key; int pages; - + switch(rand.nextInt(5)) { case 0: key = "bf_bomb_1"; pages = 4; break; case 1: key = "bf_bomb_2"; pages = 6; break; @@ -44,7 +43,7 @@ public class HbmChestContents { case 4: key = "bf_bomb_5"; pages = 9; break; default: return null; } - + return ItemBookLore.createBook(key, pages, 0x1E1E1E, 0x46EA44); } } diff --git a/src/main/java/com/hbm/lib/HbmCollection.java b/src/main/java/com/hbm/lib/HbmCollection.java index 86a7f0fa4..577e990a8 100644 --- a/src/main/java/com/hbm/lib/HbmCollection.java +++ b/src/main/java/com/hbm/lib/HbmCollection.java @@ -1,7 +1,7 @@ package com.hbm.lib; public class HbmCollection { - + /// FREQUENTLY USED TRANSLATION KEYS // GUN MANUFACTURERS public static enum EnumGunManufacturer { @@ -99,12 +99,12 @@ public class HbmCollection { WINCHESTER, /**Winchester Repeating Arms Company / Big MT**/ WINCHESTER_BIGMT; - + public String getKey() { return "gun.make." + toString(); } } - + // GUN DETAILS public static final String ammo = "desc.item.gun.ammo"; public static final String ammoMag = "desc.item.gun.ammoMag"; diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 3c6b89701..3cd40d0ba 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -2,26 +2,21 @@ package com.hbm.lib; import com.hbm.world.gen.MapGenNTMFeatures; import com.hbm.world.gen.NTMWorldGenerator; -import com.hbm.world.gen.component.BunkerComponents; +import com.hbm.world.gen.component.*; import com.hbm.world.gen.component.BunkerComponents.BunkerStart; -import com.hbm.world.gen.component.CivilianFeatures; -import com.hbm.world.gen.component.OfficeFeatures; -import com.hbm.world.gen.component.RuinFeatures; -import com.hbm.world.gen.component.SiloComponent; - import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraftforge.common.MinecraftForge; public class HbmWorld { - + public static void mainRegistry() { initWorldGen(); } - + public static NTMWorldGenerator worldGenerator; - + public static void initWorldGen() { //MapGenStructureIO.registerStructure(StructureStartTest.class, "HFR_STRUCTURE"); @@ -29,19 +24,19 @@ public class HbmWorld { MapGenStructureIO.registerStructure(MapGenNTMFeatures.Start.class, "NTMFeatures"); MapGenStructureIO.registerStructure(BunkerStart.class, "NTMBunker"); registerNTMFeatures(); - + registerWorldGen(new HbmWorldGen(), 1); - + worldGenerator = new NTMWorldGenerator(); registerWorldGen(worldGenerator, 1); //Ideally, move everything over from HbmWorldGen to NTMWorldGenerator MinecraftForge.EVENT_BUS.register(worldGenerator); //registerWorldGen(new WorldGenTest(), 1); } - + public static void registerWorldGen(IWorldGenerator nukerWorldGen, int weightedProbability) { GameRegistry.registerWorldGenerator(nukerWorldGen, weightedProbability); } - + /** Register structures in MapGenStructureIO */ public static void registerNTMFeatures() { CivilianFeatures.registerComponents(); diff --git a/src/main/java/com/hbm/lib/HbmWorldGen.java b/src/main/java/com/hbm/lib/HbmWorldGen.java index 3aa200c39..863b2876e 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -1,7 +1,5 @@ package com.hbm.lib; -import java.util.Random; - import com.hbm.blocks.BlockEnums.EnumStoneType; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockNTMFlower.EnumFlowerType; @@ -21,21 +19,11 @@ import com.hbm.tileentity.machine.storage.TileEntitySoyuzCapsule; import com.hbm.util.LootGenerator; import com.hbm.util.WeightedRandomGeneric; import com.hbm.world.dungeon.*; -import com.hbm.world.feature.BedrockOre; +import com.hbm.world.feature.*; import com.hbm.world.feature.BedrockOre.BedrockOreDefinition; -import com.hbm.world.feature.DepthDeposit; -import com.hbm.world.feature.Dud; -import com.hbm.world.feature.Geyser; -import com.hbm.world.feature.GeyserLarge; -import com.hbm.world.feature.GlyphidHive; -import com.hbm.world.feature.Meteorite; -import com.hbm.world.feature.OilBubble; -import com.hbm.world.feature.OilSandBubble; -import com.hbm.world.feature.OilSpot; -import com.hbm.world.feature.Sellafield; import com.hbm.world.generator.CellularDungeonFactory; import com.hbm.world.generator.DungeonToolbox; - +import cpw.mods.fml.common.IWorldGenerator; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -44,15 +32,12 @@ import net.minecraft.tileentity.TileEntitySkull; import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.BiomeGenBeach; -import net.minecraft.world.biome.BiomeGenForest; -import net.minecraft.world.biome.BiomeGenJungle; -import net.minecraft.world.biome.BiomeGenRiver; +import net.minecraft.world.biome.*; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.IWorldGenerator; + +import java.util.Random; public class HbmWorldGen implements IWorldGenerator { @@ -70,13 +55,13 @@ public class HbmWorldGen implements IWorldGenerator { generateSurface(world, rand, chunkX * 16, chunkZ * 16); break; } } - + private void generateSurface(World world, Random rand, int i, int j) { BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(i, j); if(!TomSaveData.forWorld(world).impact) { - + if(biome instanceof BiomeGenForest && rand.nextInt(16) == 0) { DungeonToolbox.generateFlowers(world, rand, i, j, ModBlocks.plant_flower, EnumFlowerType.FOXGLOVE.ordinal()); } @@ -114,7 +99,7 @@ public class HbmWorldGen implements IWorldGenerator { DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_cinnebar, rand, 16); DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_zirconium, rand, 16); DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_borax, rand, 16); - + DungeonToolbox.generateOre(world, rand, i, j, 25, 6, 30, 10, ModBlocks.ore_gneiss_iron, ModBlocks.stone_gneiss); DungeonToolbox.generateOre(world, rand, i, j, 10, 6, 30, 10, ModBlocks.ore_gneiss_gold, ModBlocks.stone_gneiss); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.uraniumSpawn * 3, 6, 30, 10, ModBlocks.ore_gneiss_uranium, ModBlocks.stone_gneiss); @@ -123,7 +108,7 @@ public class HbmWorldGen implements IWorldGenerator { DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.lithiumSpawn, 6, 30, 10, ModBlocks.ore_gneiss_lithium, ModBlocks.stone_gneiss); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.rareSpawn, 6, 30, 10, ModBlocks.ore_gneiss_rare, ModBlocks.stone_gneiss); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.gassshaleSpawn * 3, 10, 30, 10, ModBlocks.ore_gneiss_gas, ModBlocks.stone_gneiss); - + DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.uraniumSpawn, 5, 5, 20, ModBlocks.ore_uranium); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.thoriumSpawn, 5, 5, 25, ModBlocks.ore_thorium); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.titaniumSpawn, 6, 5, 30, ModBlocks.ore_titanium); @@ -140,7 +125,7 @@ public class HbmWorldGen implements IWorldGenerator { DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.asbestosSpawn, 4, 16, 16, ModBlocks.ore_asbestos); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.cinnebarSpawn, 4, 8, 16, ModBlocks.ore_cinnebar); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.cobaltSpawn, 4, 4, 8, ModBlocks.ore_cobalt); - + DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.ironClusterSpawn, 6, 15, 45, ModBlocks.cluster_iron); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.titaniumClusterSpawn, 6, 15, 30, ModBlocks.cluster_titanium); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.aluminiumClusterSpawn, 6, 15, 35, ModBlocks.cluster_aluminium); @@ -154,7 +139,7 @@ public class HbmWorldGen implements IWorldGenerator { if(rand.nextInt(10) == 0) { int randPosX = i + rand.nextInt(2) + 8; int randPosZ = j + rand.nextInt(2) + 8; - + BedrockOre.generate(world, randPosX, randPosZ, new ItemStack(ModItems.bedrock_ore_base), null, 0xD78A16, 1); } @@ -175,7 +160,7 @@ public class HbmWorldGen implements IWorldGenerator { BedrockOre.generate(world, randPosX, randPosZ, def.stack, def.acid, def.color, def.tier); } } - + if(GeneralConfig.enable528ColtanSpawn) { DungeonToolbox.generateOre(world, rand, i, j, GeneralConfig.coltanRate, 4, 15, 40, ModBlocks.ore_coltan); } @@ -184,16 +169,16 @@ public class HbmWorldGen implements IWorldGenerator { int colX = (int) (colRand.nextGaussian() * 1500); int colZ = (int) (colRand.nextGaussian() * 1500); int colRange = 750; - + if((GeneralConfig.enable528BedrockSpawn || GeneralConfig.enable528BedrockDeposit) && rand.nextInt(GeneralConfig.bedrockRate) != 0) { int x = i + rand.nextInt(16) + 8; int z = j + rand.nextInt(16) + 8; - + if(GeneralConfig.enable528BedrockSpawn || (GeneralConfig.enable528BedrockDeposit && x <= colX + colRange && x >= colX - colRange && z <= colZ + colRange && z >= colZ - colRange)) { BedrockOre.generate(world, x, z, new ItemStack(ModItems.fragment_coltan), null, 0xA78D7A, 1); } } - + if(GeneralConfig.enable528ColtanDeposit) { for(int k = 0; k < 2; k++) { @@ -220,18 +205,18 @@ public class HbmWorldGen implements IWorldGenerator { (new WorldGenMinable(ModBlocks.ore_australium, 50)).generate(world, rand, randPosX, randPosY, randPosZ); } } - + boolean enableDungeons = world.getWorldInfo().isMapFeaturesEnabled(); if(GeneralConfig.enableDungeons == 1) enableDungeons = true; if(GeneralConfig.enableDungeons == 0) enableDungeons = false; - + if(enableDungeons && world.provider.dimensionId == 0) { - + if(MobConfig.enableHives && rand.nextInt(MobConfig.hiveSpawn) == 0) { int x = i + rand.nextInt(16) + 8; int z = j + rand.nextInt(16) + 8; int y = world.getHeightValue(x, z); - + for(int k = 3; k >= -1; k--) { if(world.getBlock(x, y - 1 + k, z).isNormalCube()) { GlyphidHive.generateSmall(world, x, y + k, z, rand, rand.nextInt(10) == 0, true); @@ -383,7 +368,7 @@ public class HbmWorldGen implements IWorldGenerator { if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z)) { world.setBlock(x, y, z, ModBlocks.broadcaster_pc, rand.nextInt(4) + 2, 2); - + if(GeneralConfig.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned corrupted broadcaster at " + x + " " + (y) +" " + z); } @@ -393,9 +378,9 @@ public class HbmWorldGen implements IWorldGenerator { int x = i + rand.nextInt(16) + 8; int z = j + rand.nextInt(16) + 8; int y = world.getHeightValue(x, z); - + for(int g = y + 2; g >= y; g--) { - + if(world.getBlock(x, g - 1, z).canPlaceTorchOnTop(world, x, g - 1, z)) { world.setBlock(x, g, z, ModBlocks.mine_ap); TileEntityLandmine landmine = (TileEntityLandmine) world.getTileEntity(x, g, z); @@ -412,13 +397,13 @@ public class HbmWorldGen implements IWorldGenerator { int y = world.getHeightValue(x, z); if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z) && world.getBlock(x, y, z).isReplaceable(world, x, y, z)) { - + world.setBlock(x, y, z, ModBlocks.lantern_behemoth, 12, 3); MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {4, 0, 0, 0, 0, 0}, ModBlocks.lantern_behemoth, ForgeDirection.NORTH); - + TileEntityLanternBehemoth lantern = (TileEntityLanternBehemoth) world.getTileEntity(x, y, z); lantern.isBroken = true; - + if(rand.nextInt(2) == 0) { LootGenerator.setBlock(world, x, y, z - 2); LootGenerator.lootBooklet(world, x, y, z - 2); @@ -441,13 +426,13 @@ public class HbmWorldGen implements IWorldGenerator { } if(WorldConfig.radfreq > 0 && GeneralConfig.enableRad && rand.nextInt(WorldConfig.radfreq) == 0 && biome == BiomeGenBase.desert) { - + for (int a = 0; a < 1; a++) { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); - + double r = rand.nextInt(15) + 10; - + if(rand.nextInt(50) == 0) r = 50; @@ -462,7 +447,7 @@ public class HbmWorldGen implements IWorldGenerator { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); int y = world.getHeightValue(x, z); - + if(world.getBlock(x, y - 1, z) == Blocks.grass) new Geyser().generate(world, rand, x, y, z); } @@ -480,17 +465,17 @@ public class HbmWorldGen implements IWorldGenerator { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); int y = world.getHeightValue(x, z) - 4; - + if(world.getBlock(x, y + 1, z).canPlaceTorchOnTop(world, x, y + 1, z)) { - + world.setBlock(x, y, z, ModBlocks.soyuz_capsule, 3, 2); - + TileEntitySoyuzCapsule cap = (TileEntitySoyuzCapsule)world.getTileEntity(x, y, z); - + if(cap != null) { cap.setInventorySlotContents(rand.nextInt(cap.getSizeInventory()), new ItemStack(ModItems.record_glass)); } - + if(GeneralConfig.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned capsule at " + x + " " + z); } @@ -510,9 +495,9 @@ public class HbmWorldGen implements IWorldGenerator { if (rand.nextInt(1000) == 0) { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); - + boolean done = false; - + for(int k = 0; k < 256; k++) { if(world.getBlock(x, k, z) == Blocks.log && world.getBlockMetadata(x, k, z) == 0) { world.setBlock(x, k, z, ModBlocks.pink_log); @@ -532,7 +517,7 @@ public class HbmWorldGen implements IWorldGenerator { if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z)) { world.setBlock(x, y, z, ModBlocks.safe, rand.nextInt(4) + 2, 2); TileEntitySafe safe = (TileEntitySafe) world.getTileEntity(x, y, z); - + switch(rand.nextInt(10)) { case 0: case 1: case 2: case 3: safe.setMod(1); @@ -554,38 +539,38 @@ public class HbmWorldGen implements IWorldGenerator { safe.setPins(rand.nextInt(999) + 1); safe.lock(); - + if(GeneralConfig.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned safe at " + x + " " + (y + 1) +" " + z); } - + } if (WorldConfig.meteorStructure > 0 && rand.nextInt(WorldConfig.meteorStructure) == 0 && biome != BiomeGenBase.ocean && biome != BiomeGenBase.deepOcean) { int x = i + rand.nextInt(16) + 8; int z = j + rand.nextInt(16) + 8; - + CellularDungeonFactory.meteor.generate(world, x, 10, z, rand); - + if(GeneralConfig.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned meteor dungeon at " + x + " 10 " + z); - + int y = world.getHeightValue(x, z); - + for(int f = 0; f < 3; f++) world.setBlock(x, y + f, z, ModBlocks.meteor_pillar); world.setBlock(x, y + 3, z, ModBlocks.meteor_brick_chiseled); - + for(int f = 0; f < 10; f++) { x = i + rand.nextInt(65) - 32; z = j + rand.nextInt(65) - 32; y = world.getHeightValue(x, z); - + if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z)) { world.setBlock(x, y, z, Blocks.skull, 1, 2); TileEntitySkull skull = (TileEntitySkull)world.getTileEntity(x, y, z); - + if(skull != null) skull.func_145903_a(rand.nextInt(16)); } @@ -596,16 +581,16 @@ public class HbmWorldGen implements IWorldGenerator { WorldConfig.jungleStructure > 0 && rand.nextInt(WorldConfig.jungleStructure) == 0) { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); - + CellularDungeonFactory.jungle.generate(world, x, 20, z, world.rand); CellularDungeonFactory.jungle.generate(world, x, 24, z, world.rand); CellularDungeonFactory.jungle.generate(world, x, 28, z, world.rand); - + if(GeneralConfig.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned jungle dungeon at " + x + " 10 " + z); - + int y = world.getHeightValue(x, z); - + for(int f = 0; f < 3; f++) world.setBlock(x, y + f, z, ModBlocks.deco_titanium); world.setBlock(x, y + 3, z, Blocks.redstone_block); @@ -617,12 +602,12 @@ public class HbmWorldGen implements IWorldGenerator { int y = 16 + rand.nextInt(32); new ArcticVault().trySpawn(world, x, y, z); } - + if (WorldConfig.pyramidStructure > 0 && biome.temperature >= 2.0F && !biome.canSpawnLightningBolt() && rand.nextInt(WorldConfig.pyramidStructure) == 0) { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); int y = world.getHeightValue(x, z); - + new AncientTomb().build(world, rand, x, y, z); } } @@ -638,11 +623,11 @@ public class HbmWorldGen implements IWorldGenerator { if(WorldConfig.bedrockOilSpawn > 0 && rand.nextInt(WorldConfig.bedrockOilSpawn) == 0) { int randPosX = i + rand.nextInt(16); int randPosZ = j + rand.nextInt(16); - + for(int x = -4; x <= 4; x++) { for(int y = 0; y <= 4; y++) { for(int z = -4; z <= 4; z++) { - + if(Math.abs(x) + Math.abs(y) + Math.abs(z) <= 6) { Block b = world.getBlock(randPosX + x, y, randPosZ + z); if(b.isReplaceableOreGen(world, randPosX + x, y, randPosZ + z, Blocks.stone) || b.isReplaceableOreGen(world, randPosX + x, y, randPosZ + z, Blocks.bedrock)) { @@ -652,7 +637,7 @@ public class HbmWorldGen implements IWorldGenerator { } } } - + DungeonToolbox.generateOre(world, rand, i, j, 16, 8, 10, 50, ModBlocks.stone_porous); OilSpot.generateOilSpot(world, randPosX, randPosZ, 5, 50, true); } @@ -731,12 +716,12 @@ public class HbmWorldGen implements IWorldGenerator { } } } - + if(rand.nextInt(4) == 0) { int x = i + rand.nextInt(16) + 8; int y = 6 + rand.nextInt(13); int z = j + rand.nextInt(16) + 8; - + if(world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, Blocks.stone)) { world.setBlock(x, y, z, ModBlocks.stone_keyhole); } @@ -753,10 +738,10 @@ public class HbmWorldGen implements IWorldGenerator { DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.netherPhosphorusSpawn, 6, 0, 127, ModBlocks.ore_nether_fire, Blocks.netherrack); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.netherCoalSpawn, 32, 16, 96, ModBlocks.ore_nether_coal, Blocks.netherrack); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.netherCobaltSpawn, 6, 100, 26, ModBlocks.ore_nether_cobalt, Blocks.netherrack); - + if(GeneralConfig.enablePlutoniumOre) DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.netherPlutoniumSpawn, 4, 0, 127, ModBlocks.ore_nether_plutonium, Blocks.netherrack); - + if(rand.nextInt(10) == 0) { @SuppressWarnings("unchecked") WeightedRandomGeneric item = (WeightedRandomGeneric) WeightedRandom.getRandomItem(rand, BedrockOre.weightedOresNether); @@ -792,15 +777,15 @@ public class HbmWorldGen implements IWorldGenerator { } private void generateEnd(World world, Random rand, int i, int j) { - + if(WorldConfig.endOre) { DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.endTikiteSpawn, 6, 0, 127, ModBlocks.ore_tikite, Blocks.end_stone); - + /*for(int k = 0; k < 50; k++){ int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); int d = 5 + rand.nextInt(60); - + for(int y = d - 5; y <= d; y++) if(world.getBlock(x, y, z) == Blocks.air && world.getBlock(x, y + 1, z).isSideSolid(world, x, y, z, ForgeDirection.DOWN)) world.setBlock(x, y, z, ModBlocks.crystal_trixite); diff --git a/src/main/java/com/hbm/lib/Library.java b/src/main/java/com/hbm/lib/Library.java index 828433470..96a019726 100644 --- a/src/main/java/com/hbm/lib/Library.java +++ b/src/main/java/com/hbm/lib/Library.java @@ -1,21 +1,16 @@ package com.hbm.lib; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import com.hbm.blocks.ModBlocks; -import com.hbm.entity.mob.EntityHunterChopper; -import com.hbm.entity.projectile.EntityChopperMine; -import com.hbm.interfaces.Spaghetti; -import com.hbm.inventory.fluid.FluidType; -import com.hbm.items.ModItems; - import api.hbm.energymk2.IBatteryItem; import api.hbm.energymk2.IEnergyConnectorBlock; import api.hbm.energymk2.IEnergyConnectorMK2; import api.hbm.fluid.IFluidConnector; import api.hbm.fluid.IFluidConnectorBlock; +import com.hbm.blocks.ModBlocks; +import com.hbm.entity.mob.EntityHunterChopper; +import com.hbm.entity.projectile.EntityChopperMine; +import com.hbm.interfaces.Spaghetti; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.items.ModItems; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -30,11 +25,15 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + @Spaghetti("this whole class") public class Library { - + static Random rand = new Random(); - + public static boolean checkForHeld(EntityPlayer player, Item item) { if(player.getHeldItem() == null) return false; return player.getHeldItem().getItem() == item; @@ -46,60 +45,60 @@ public class Library { public static final ForgeDirection NEG_Y = ForgeDirection.DOWN; public static final ForgeDirection POS_Z = ForgeDirection.SOUTH; public static final ForgeDirection NEG_Z = ForgeDirection.NORTH; - + /* * Is putting this into this trash can a good idea? No. Do I have a better idea? Not currently. */ public static boolean canConnect(IBlockAccess world, int x, int y, int z, ForgeDirection dir /* cable's connecting side */) { - + if(y > 255 || y < 0) return false; - + Block b = world.getBlock(x, y, z); - + if(b instanceof IEnergyConnectorBlock) { IEnergyConnectorBlock con = (IEnergyConnectorBlock) b; - + if(con.canConnect(world, x, y, z, dir.getOpposite() /* machine's connecting side */)) return true; } - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof IEnergyConnectorMK2) { IEnergyConnectorMK2 con = (IEnergyConnectorMK2) te; - + if(con.canConnect(dir.getOpposite() /* machine's connecting side */)) return true; } - + return false; } /** dir is the direction along the fluid duct entering the block */ public static boolean canConnectFluid(IBlockAccess world, int x, int y, int z, ForgeDirection dir /* duct's connecting side */, FluidType type) { - + if(y > 255 || y < 0) return false; - + Block b = world.getBlock(x, y, z); - + if(b instanceof IFluidConnectorBlock) { IFluidConnectorBlock con = (IFluidConnectorBlock) b; - + if(con.canConnect(type, world, x, y, z, dir.getOpposite() /* machine's connecting side */)) return true; } - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof IFluidConnector) { IFluidConnector con = (IFluidConnector) te; - + if(con.canConnect(type, dir.getOpposite() /* machine's connecting side */)) return true; } - + return false; } @@ -192,7 +191,7 @@ public class Library { return entity; } - + public static MovingObjectPosition rayTrace(EntityPlayer player, double length, float interpolation) { Vec3 vec3 = getPosition(interpolation, player); vec3.yCoord += player.eyeHeight; @@ -208,7 +207,7 @@ public class Library { Vec3 vec32 = vec3.addVector(vec31.xCoord * length, vec31.yCoord * length, vec31.zCoord * length); return player.worldObj.func_147447_a(vec3, vec32, allowLiquids, disallowNonCollidingBlocks, mopOnMiss); } - + public static Vec3 getPosition(float interpolation, EntityPlayer player) { if(interpolation == 1.0F) { return Vec3.createVectorHelper(player.posX, player.posY + (player.getEyeHeight() - player.getDefaultEyeHeight()), player.posZ); @@ -219,43 +218,43 @@ public class Library { return Vec3.createVectorHelper(d0, d1, d2); } } - + public static List getBlockPosInPath(int x, int y, int z, int length, Vec3 vec0) { List list = new ArrayList(); - + for(int i = 0; i <= length; i++) { list.add(new int[] { (int)(x + (vec0.xCoord * i)), y, (int)(z + (vec0.zCoord * i)), i }); } - + return list; } - + //not great either but certainly better public static long chargeItemsFromTE(ItemStack[] slots, int index, long power, long maxPower) { - + if(power < 0) return 0; - + if(power > maxPower) return maxPower; if(slots[index] != null && slots[index].getItem() instanceof IBatteryItem) { - + IBatteryItem battery = (IBatteryItem) slots[index].getItem(); long batMax = battery.getMaxCharge(slots[index]); long batCharge = battery.getCharge(slots[index]); long batRate = battery.getChargeRate(); long toCharge = Math.min(Math.min(power, batRate), batMax - batCharge); - + power -= toCharge; - + battery.chargeBattery(slots[index], toCharge); } - + return power; } - + public static long chargeTEFromItems(ItemStack[] slots, int index, long power, long maxPower) { if(slots[index] != null && slots[index].getItem() == ModItems.battery_creative) { @@ -280,11 +279,11 @@ public class Library { return power; } - + //Flut-Füll gesteuerter Energieübertragungsalgorithmus //Flood fill controlled energy transmission algorithm public static void ffgeua(int x, int y, int z, boolean newTact, Object that, World worldObj) { - + /* * This here smoldering crater is all that remains from the old energy system. * In loving memory, 2016-2021. @@ -307,12 +306,12 @@ public class Library { MovingObjectPosition pos = world.rayTraceBlocks(Vec3.createVectorHelper(x, y, z), Vec3.createVectorHelper(a, b, c)); return pos != null; } - + public static boolean isObstructedOpaque(World world, double x, double y, double z, double a, double b, double c) { MovingObjectPosition pos = world.func_147447_a(Vec3.createVectorHelper(x, y, z), Vec3.createVectorHelper(a, b, c), false, true, false); return pos != null; } - + public static Block getRandomConcrete() { int i = rand.nextInt(20); if(i <= 1) return ModBlocks.brick_concrete_broken; diff --git a/src/main/java/com/hbm/lib/ModDamageSource.java b/src/main/java/com/hbm/lib/ModDamageSource.java index de2da75ca..deaeca1f7 100644 --- a/src/main/java/com/hbm/lib/ModDamageSource.java +++ b/src/main/java/com/hbm/lib/ModDamageSource.java @@ -1,13 +1,14 @@ package com.hbm.lib; -import com.hbm.entity.projectile.*; - +import com.hbm.entity.projectile.EntityBullet; +import com.hbm.entity.projectile.EntityLaserBeam; +import com.hbm.entity.projectile.EntityMinerBeam; import net.minecraft.entity.Entity; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSourceIndirect; public class ModDamageSource extends DamageSource { - + public static DamageSource nuclearBlast = (new DamageSource("nuclearBlast")).setExplosion(); public static DamageSource mudPoisoning = (new DamageSource("mudPoisoning")).setDamageBypassesArmor(); public static DamageSource acid = (new DamageSource("acid")); //.setDamageBypassesArmor(); diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 700c2fe2b..592722535 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -1,148 +1,144 @@ package com.hbm.main; -import com.hbm.handler.imc.IMCHandlerNHNEI; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.model.ModelChicken; -import net.minecraft.client.particle.EntityAuraFX; -import net.minecraft.client.particle.EntityBlockDustFX; -import net.minecraft.client.particle.EntityCloudFX; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.particle.EntityFireworkSparkFX; -import net.minecraft.client.particle.EntityFlameFX; -import net.minecraft.client.particle.EntityReddustFX; -import net.minecraft.client.renderer.entity.RenderMinecart; -import net.minecraft.client.renderer.entity.RenderSnowball; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.client.resources.Language; -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.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; -import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.common.MinecraftForge; -import paulscode.sound.SoundSystemConfig; + import com.hbm.blocks.ModBlocks; + import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; + import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter; + import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; + import com.hbm.blocks.generic.BlockPedestal.TileEntityPedestal; + import com.hbm.blocks.generic.BlockPlushie.TileEntityPlushie; + import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe; + import com.hbm.blocks.machine.Floodlight.TileEntityFloodlight; + import com.hbm.blocks.machine.MachineFan.TileEntityFan; + import com.hbm.blocks.machine.PistonInserter.TileEntityPistonInserter; + import com.hbm.blocks.machine.WatzPump.TileEntityWatzPump; + import com.hbm.config.GeneralConfig; + import com.hbm.entity.cart.EntityMinecartCrate; + import com.hbm.entity.cart.EntityMinecartNTM; + import com.hbm.entity.effect.*; + import com.hbm.entity.grenade.*; + import com.hbm.entity.item.*; + import com.hbm.entity.logic.*; + import com.hbm.entity.missile.*; + import com.hbm.entity.missile.EntityMissileTier0.*; + import com.hbm.entity.missile.EntityMissileTier1.*; + import com.hbm.entity.missile.EntityMissileTier2.*; + import com.hbm.entity.missile.EntityMissileTier3.EntityMissileBurst; + import com.hbm.entity.missile.EntityMissileTier3.EntityMissileDrill; + import com.hbm.entity.missile.EntityMissileTier3.EntityMissileInferno; + import com.hbm.entity.missile.EntityMissileTier3.EntityMissileRain; + import com.hbm.entity.missile.EntityMissileTier4.*; + import com.hbm.entity.mob.*; + import com.hbm.entity.mob.botprime.EntityBOTPrimeBody; + import com.hbm.entity.mob.botprime.EntityBOTPrimeHead; + import com.hbm.entity.mob.glyphid.*; + import com.hbm.entity.mob.siege.*; + import com.hbm.entity.particle.*; + import com.hbm.entity.projectile.*; + import com.hbm.entity.train.EntityRailCarBase.BoundingBoxDummyEntity; + import com.hbm.entity.train.EntityRailCarRidable.SeatDummyEntity; + import com.hbm.entity.train.TrainCargoTram; + import com.hbm.entity.train.TrainCargoTramTrailer; + import com.hbm.entity.train.TrainTunnelBore; + import com.hbm.handler.CasingEjector; + import com.hbm.handler.HbmKeybinds; + import com.hbm.handler.HbmKeybinds.EnumKeybind; + import com.hbm.handler.ImpactWorldHandler; + import com.hbm.handler.imc.IMCHandlerNHNEI; + import com.hbm.items.IAnimatedItem; + import com.hbm.items.ModItems; + import com.hbm.items.weapon.sedna.factory.GunFactoryClient; + import com.hbm.lib.RefStrings; + import com.hbm.particle.*; + import com.hbm.particle.helper.ParticleCreators; + import com.hbm.particle.psys.engine.EventHandlerParticleEngine; + import com.hbm.render.anim.BusAnimation; + import com.hbm.render.anim.BusAnimationSequence; + import com.hbm.render.anim.HbmAnimations; + import com.hbm.render.anim.HbmAnimations.Animation; + import com.hbm.render.block.*; + import com.hbm.render.entity.RenderEmpty; + import com.hbm.render.entity.effect.*; + import com.hbm.render.entity.item.*; + import com.hbm.render.entity.mob.*; + import com.hbm.render.entity.projectile.*; + import com.hbm.render.entity.rocket.*; + import com.hbm.render.item.*; + import com.hbm.render.item.ItemRenderMissileGeneric.RenderMissileType; + import com.hbm.render.item.block.ItemRenderDecoBlock; + import com.hbm.render.item.weapon.*; + import com.hbm.render.loader.HmfModelLoader; + import com.hbm.render.model.ModelPigeon; + import com.hbm.render.tileentity.*; + import com.hbm.render.util.MissilePart; + import com.hbm.render.util.RenderInfoSystem; + import com.hbm.render.util.RenderInfoSystem.InfoEntry; + import com.hbm.render.util.RenderOverhead; + import com.hbm.render.util.RenderOverhead.Marker; + import com.hbm.sound.AudioWrapper; + import com.hbm.sound.AudioWrapperClient; + import com.hbm.tileentity.TileEntityDoorGeneric; + import com.hbm.tileentity.bomb.*; + import com.hbm.tileentity.deco.*; + import com.hbm.tileentity.machine.*; + import com.hbm.tileentity.machine.oil.*; + import com.hbm.tileentity.machine.rbmk.*; + import com.hbm.tileentity.machine.storage.*; + import com.hbm.tileentity.network.*; + import com.hbm.tileentity.turret.*; + import com.hbm.util.BobMathUtil; + import com.hbm.util.ColorUtil; + import com.hbm.util.fauxpointtwelve.BlockPos; + import com.hbm.wiaj.cannery.Jars; + import cpw.mods.fml.client.registry.ClientRegistry; + import cpw.mods.fml.client.registry.RenderingRegistry; + import cpw.mods.fml.common.FMLCommonHandler; + import cpw.mods.fml.relauncher.ReflectionHelper; + import net.minecraft.block.Block; + import net.minecraft.client.Minecraft; + import net.minecraft.client.audio.PositionedSoundRecord; + import net.minecraft.client.model.ModelChicken; + import net.minecraft.client.particle.EntityCloudFX; + import net.minecraft.client.particle.*; + import net.minecraft.client.renderer.entity.RenderMinecart; + import net.minecraft.client.renderer.entity.RenderSnowball; + import net.minecraft.client.renderer.texture.TextureManager; + import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; + import net.minecraft.client.resources.Language; + 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.ItemBlock; + import net.minecraft.item.ItemStack; + import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.util.MovingObjectPosition; + import net.minecraft.util.MovingObjectPosition.MovingObjectType; + import net.minecraft.util.ResourceLocation; + import net.minecraft.util.Vec3; + import net.minecraft.world.World; + import net.minecraftforge.client.MinecraftForgeClient; + import net.minecraftforge.client.model.AdvancedModelLoader; + import net.minecraftforge.common.MinecraftForge; + import paulscode.sound.SoundSystemConfig; -import java.awt.Color; -import java.awt.Desktop; -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import java.util.Random; - -import com.hbm.blocks.ModBlocks; -import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; -import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter; -import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; -import com.hbm.blocks.generic.BlockPedestal.TileEntityPedestal; -import com.hbm.blocks.generic.BlockPlushie.TileEntityPlushie; -import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe; -import com.hbm.blocks.machine.Floodlight.TileEntityFloodlight; -import com.hbm.blocks.machine.MachineFan.TileEntityFan; -import com.hbm.blocks.machine.PistonInserter.TileEntityPistonInserter; -import com.hbm.blocks.machine.WatzPump.TileEntityWatzPump; -import com.hbm.config.GeneralConfig; -import com.hbm.entity.cart.*; -import com.hbm.entity.effect.*; -import com.hbm.entity.grenade.*; -import com.hbm.entity.item.*; -import com.hbm.entity.logic.*; -import com.hbm.entity.missile.*; -import com.hbm.entity.missile.EntityMissileTier0.*; -import com.hbm.entity.missile.EntityMissileTier1.*; -import com.hbm.entity.missile.EntityMissileTier2.*; -import com.hbm.entity.missile.EntityMissileTier3.*; -import com.hbm.entity.missile.EntityMissileTier4.*; -import com.hbm.entity.mob.*; -import com.hbm.entity.mob.botprime.*; -import com.hbm.entity.mob.glyphid.*; -import com.hbm.entity.mob.siege.*; -import com.hbm.entity.particle.*; -import com.hbm.entity.projectile.*; -import com.hbm.entity.train.*; -import com.hbm.entity.train.EntityRailCarBase.BoundingBoxDummyEntity; -import com.hbm.entity.train.EntityRailCarRidable.SeatDummyEntity; -import com.hbm.handler.CasingEjector; -import com.hbm.handler.HbmKeybinds; -import com.hbm.handler.ImpactWorldHandler; -import com.hbm.handler.HbmKeybinds.EnumKeybind; -import com.hbm.items.IAnimatedItem; -import com.hbm.items.ModItems; -import com.hbm.items.weapon.sedna.factory.GunFactoryClient; -import com.hbm.lib.RefStrings; -import com.hbm.particle.*; -import com.hbm.particle.helper.*; -import com.hbm.particle.psys.engine.EventHandlerParticleEngine; -import com.hbm.render.anim.*; -import com.hbm.render.anim.HbmAnimations.Animation; -import com.hbm.render.block.*; -import com.hbm.render.entity.*; -import com.hbm.render.entity.effect.*; -import com.hbm.render.entity.item.*; -import com.hbm.render.entity.mob.*; -import com.hbm.render.entity.projectile.*; -import com.hbm.render.entity.rocket.*; -import com.hbm.render.item.*; -import com.hbm.render.item.ItemRenderMissileGeneric.RenderMissileType; -import com.hbm.render.item.block.*; -import com.hbm.render.item.weapon.*; -import com.hbm.render.loader.HmfModelLoader; -import com.hbm.render.model.ModelPigeon; -import com.hbm.render.tileentity.*; -import com.hbm.render.util.MissilePart; -import com.hbm.render.util.RenderInfoSystem; -import com.hbm.render.util.RenderInfoSystem.InfoEntry; -import com.hbm.render.util.RenderOverhead; -import com.hbm.render.util.RenderOverhead.Marker; -import com.hbm.sound.AudioWrapper; -import com.hbm.sound.AudioWrapperClient; -import com.hbm.tileentity.TileEntityDoorGeneric; -import com.hbm.tileentity.bomb.*; -import com.hbm.tileentity.deco.*; -import com.hbm.tileentity.machine.*; -import com.hbm.tileentity.machine.oil.*; -import com.hbm.tileentity.machine.rbmk.*; -import com.hbm.tileentity.machine.storage.*; -import com.hbm.tileentity.network.*; -import com.hbm.tileentity.turret.*; -import com.hbm.util.BobMathUtil; -import com.hbm.util.ColorUtil; -import com.hbm.util.fauxpointtwelve.BlockPos; -import com.hbm.wiaj.cannery.Jars; - -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.ReflectionHelper; + import java.awt.*; + import java.net.URI; + import java.util.List; + import java.util.*; + import java.util.Map.Entry; public class ClientProxy extends ServerProxy { - + public RenderInfoSystem theInfoSystem = new RenderInfoSystem(); - + /** Runs just before item an block init */ @Override public void registerPreRenderInfo() { AdvancedModelLoader.registerModelHandler(new HmfModelLoader()); } - + /** Runs right after item and block init */ @Override public void registerRenderInfo() { @@ -156,15 +152,15 @@ public class ClientProxy extends ServerProxy { registerItemRenderer(); registerEntityRenderer(); registerBlockRenderer(); - + Jars.initJars(); - + if(GeneralConfig.enableSoundExtension) { SoundSystemConfig.setNumberNormalChannels(GeneralConfig.normalSoundChannels); SoundSystemConfig.setNumberStreamingChannels(50); } } - + private void registerClientEventHandler(Object handler) { MinecraftForge.EVENT_BUS.register(handler); FMLCommonHandler.instance().bus().register(handler); @@ -174,7 +170,7 @@ public class ClientProxy extends ServerProxy { public void handleNHNEICompat(){ IMCHandlerNHNEI.IMCSender(); } - + @Override public void registerGunCfg() { GunFactoryClient.init(); @@ -411,12 +407,12 @@ public class ClientProxy extends ServerProxy { @Override public void registerItemRenderer() { - + ItemRenderLibrary.init(); - + for(Entry entry : ItemRenderLibrary.renderers.entrySet()) MinecraftForgeClient.registerItemRenderer(entry.getKey(), entry.getValue()); - + //this bit registers an item renderer for every existing tile entity renderer that implements IItemRendererProvider Iterator iterator = TileEntityRendererDispatcher.instance.mapSpecialRenderers.values().iterator(); while(iterator.hasNext()) { @@ -428,7 +424,7 @@ public class ClientProxy extends ServerProxy { } } } - + //universal JSON translated items double[] rtp = new double[] {0, 180, -90}; double[] ttp_high = new double[] {0.125, 0.625, 0}; @@ -454,7 +450,7 @@ public class ClientProxy extends ServerProxy { double[] sfp_default = new double[] {1, 1, 1}; double[] tfp_default = new double[] {0, 0, 0}; double[] sir_default = new double[] {1, 1, 1}; - + MinecraftForgeClient.registerItemRenderer(ModItems.bismuth_pickaxe, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp_default, sfp_default, rir, tir, sir_default)); MinecraftForgeClient.registerItemRenderer(ModItems.bismuth_axe, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp_default, sfp_default, rir, tir, sir_default)); MinecraftForgeClient.registerItemRenderer(ModItems.volcanic_pickaxe, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp_default, sfp_default, rir, tir, sir_default)); @@ -463,7 +459,7 @@ public class ClientProxy extends ServerProxy { MinecraftForgeClient.registerItemRenderer(ModItems.chlorophyte_axe, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp_default, sfp_default, rir, tir, sir_default)); MinecraftForgeClient.registerItemRenderer(ModItems.mese_pickaxe, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp_default, sfp_default, rir, tir, sir_default)); MinecraftForgeClient.registerItemRenderer(ModItems.mese_axe, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp_default, sfp_default, rir, tir, sir_default)); - + ItemRenderMissileGeneric.init(); MinecraftForgeClient.registerItemRenderer(ModItems.missile_test, new ItemRenderMissileGeneric(RenderMissileType.TYPE_TIER0)); MinecraftForgeClient.registerItemRenderer(ModItems.missile_taint, new ItemRenderMissileGeneric(RenderMissileType.TYPE_TIER0)); @@ -494,7 +490,7 @@ public class ClientProxy extends ServerProxy { MinecraftForgeClient.registerItemRenderer(ModItems.missile_doomsday_rusted, new ItemRenderMissileGeneric(RenderMissileType.TYPE_NUCLEAR)); MinecraftForgeClient.registerItemRenderer(ModItems.missile_carrier, new ItemRenderMissileGeneric(RenderMissileType.TYPE_CARRIER)); MinecraftForgeClient.registerItemRenderer(ModItems.missile_shuttle, new ItemRenderMissileGeneric(RenderMissileType.TYPE_ROBIN)); - + //templates MinecraftForgeClient.registerItemRenderer(ModItems.assembly_template, new ItemRenderTemplate()); MinecraftForgeClient.registerItemRenderer(ModItems.chemistry_template, new ItemRenderTemplate()); @@ -760,7 +756,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntityFogFX.class, new FogRenderer()); RenderingRegistry.registerEntityRenderingHandler(EntityEMPBlast.class, new RenderEMPBlast()); } - + @Override public void registerBlockRenderer() { @@ -814,7 +810,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerBlockHandler(new RenderFoundryOutlet()); RenderingRegistry.registerBlockHandler(new RenderRail()); - + RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite)); RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_c4.getRenderType(), ResourceManager.charge_c4)); @@ -823,106 +819,32 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerBlockHandler(new RenderRBMKControl()); RenderingRegistry.registerBlockHandler(new RenderPribris()); } - + @Override public void registerMissileItems() { - + MissilePart.registerAllParts(); - + Iterator it = MissilePart.parts.entrySet().iterator(); - + while(it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); MissilePart part = (MissilePart) pair.getValue(); MinecraftForgeClient.registerItemRenderer(part.part, new ItemRenderMissilePart(part)); } - + MinecraftForgeClient.registerItemRenderer(ModItems.missile_custom, new ItemRenderMissile()); } - @Deprecated - @Override - public void particleControl(double x, double y, double z, int type) { - - - World world = Minecraft.getMinecraft().theWorld; - TextureManager man = Minecraft.getMinecraft().renderEngine; - - switch(type) { - case 0: - - for(int i = 0; i < 10; i++) { - EntityCloudFX smoke = new EntityCloudFX(world, x + world.rand.nextGaussian(), y + world.rand.nextGaussian(), z + world.rand.nextGaussian(), 0.0, 0.0, 0.0); - Minecraft.getMinecraft().effectRenderer.addEffect(smoke); - } - break; - - case 1: - - EntityCloudFX smoke = new EntityCloudFX(world, x, y, z, 0.0, 0.1, 0.0); - Minecraft.getMinecraft().effectRenderer.addEffect(smoke); - break; - - case 2: - - ParticleContrail contrail = new ParticleContrail(man, world, x, y, z); - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - break; - - case 3: - - ParticleRadiationFog fog = new ParticleRadiationFog(man, world, x, y, z); - Minecraft.getMinecraft().effectRenderer.addEffect(fog); - break; - } - } - - //version 2, now with strings! - @Deprecated - @Override - public void spawnParticle(double x, double y, double z, String type, float args[]) { - - World world = Minecraft.getMinecraft().theWorld; - TextureManager man = Minecraft.getMinecraft().renderEngine; - - if("launchsmoke".equals(type) && args.length == 3) { - ParticleSmokePlume contrail = new ParticleSmokePlume(man, world, x, y, z); - contrail.motionX = args[0]; - contrail.motionY = args[1]; - contrail.motionZ = args[2]; - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - } - if("exKerosene".equals(type)) { - ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0F, 0F, 0F, 1F); - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - } - if("exSolid".equals(type)) { - ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.3F, 0.2F, 0.05F, 1F); - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - } - if("exHydrogen".equals(type)) { - ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.7F, 0.7F, 0.7F, 1F); - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - } - if("exBalefire".equals(type)) { - ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.2F, 0.7F, 0.2F, 1F); - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - } - if("radSmoke".equals(type)) { - ParticleRadiationFog contrail = new ParticleRadiationFog(man, world, x, y, z); - Minecraft.getMinecraft().effectRenderer.addEffect(contrail); - } - } - //mk3, only use this one @Override public void effectNT(NBTTagCompound data) { - + World world = Minecraft.getMinecraft().theWorld; - + if(world == null) //might i ask why? return; - + TextureManager man = Minecraft.getMinecraft().renderEngine; EntityPlayer player = Minecraft.getMinecraft().thePlayer; int particleSetting = Minecraft.getMinecraft().gameSettings.particleSetting; @@ -931,27 +853,85 @@ public class ClientProxy extends ServerProxy { double x = data.getDouble("posX"); double y = data.getDouble("posY"); double z = data.getDouble("posZ"); - + if(ParticleCreators.particleCreators.containsKey(type)) { ParticleCreators.particleCreators.get(type).makeParticle(world, player, man, rand, x, y, z, data); return; } - + + // Old MK1 system ported to MK3: + + if("waterSplash".equals(type)) { + for (int i = 0; i < 10; i++) { + EntityCloudFX smoke = new EntityCloudFX(world, x + world.rand.nextGaussian(), y + world.rand.nextGaussian(), z + world.rand.nextGaussian(), 0.0, 0.0, 0.0); + Minecraft.getMinecraft().effectRenderer.addEffect(smoke); + } + } + + if("cloudFX2".equals(type)) { // i have genuinely no idea what used this + EntityCloudFX smoke = new EntityCloudFX(world, x, y, z, 0.0, 0.1, 0.0); + Minecraft.getMinecraft().effectRenderer.addEffect(smoke); + } + + if("ABMContrail".equals(type)) { + ParticleContrail contrail = new ParticleContrail(man, world, x, y, z); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + // End MK1 porting. + + // Old MK2 system ported to MK3: + + if("launchSmoke".equals(type)) { + ParticleSmokePlume contrail = new ParticleSmokePlume(man, world, x, y, z); + contrail.motionX = data.getDouble("moX"); + contrail.motionY = data.getDouble("moY"); + contrail.motionZ = data.getDouble("moZ"); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + if("exKerosene".equals(type)) { + ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0F, 0F, 0F, 1F); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + if("exSolid".equals(type)) { + ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.3F, 0.2F, 0.05F, 1F); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + if("exHydrogen".equals(type)) { + ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.7F, 0.7F, 0.7F, 1F); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + if("exBalefire".equals(type)) { + ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0.2F, 0.7F, 0.2F, 1F); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + if("radFog".equals(type)) { + ParticleRadiationFog contrail = new ParticleRadiationFog(man, world, x, y, z); + Minecraft.getMinecraft().effectRenderer.addEffect(contrail); + } + + // End MK2 porting. + if("missileContrail".equals(type)) { - + if(Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector() > 350) return; - + float scale = data.hasKey("scale") ? data.getFloat("scale") : 1F; double mX = data.getDouble("moX"); double mY = data.getDouble("moY"); double mZ = data.getDouble("moZ"); - + /*ParticleContrail contrail = new ParticleContrail(man, world, x, y, z, 0, 0, 0, scale); contrail.motionX = mX; contrail.motionY = mY; contrail.motionZ = mZ; Minecraft.getMinecraft().effectRenderer.addEffect(contrail);*/ - + ParticleRocketFlame fx = new ParticleRocketFlame(man, world, x, y, z).setScale(scale); fx.motionX = mX; fx.motionY = mY; @@ -959,14 +939,14 @@ public class ClientProxy extends ServerProxy { if(data.hasKey("maxAge")) fx.setMaxAge(data.getInteger("maxAge")); Minecraft.getMinecraft().effectRenderer.addEffect(fx); } - + if("smoke".equals(type)) { - + String mode = data.getString("mode"); int count = Math.max(1, data.getInteger("count")); - + if("cloud".equals(mode)) { - + for(int i = 0; i < count; i++) { ParticleExSmoke fx = new ParticleExSmoke(man, world, x, y, z); fx.motionY = rand.nextGaussian() * (1 + (count / 100)); @@ -992,25 +972,25 @@ public class ClientProxy extends ServerProxy { Vec3 vec = Vec3.createVectorHelper(2, 0, 0); vec.rotateAroundY(rand.nextFloat() * (float)Math.PI * 2F); - + for(int i = 0; i < count; i++) { ParticleDigammaSmoke fx = new ParticleDigammaSmoke(man, world, x, y, z); fx.motionY = 0; fx.motionX = vec.xCoord; fx.motionZ = vec.zCoord; Minecraft.getMinecraft().effectRenderer.addEffect(fx); - + vec.rotateAroundY((float)Math.PI * 2F / (float)count); } } - + if("shock".equals(mode)) { - + double strength = data.getDouble("strength"); Vec3 vec = Vec3.createVectorHelper(strength, 0, 0); vec.rotateAroundY(rand.nextInt(360)); - + for(int i = 0; i < count; i++) { ParticleExSmoke fx = new ParticleExSmoke(man, world, x, y, z); fx.motionY = 0; @@ -1021,15 +1001,15 @@ public class ClientProxy extends ServerProxy { vec.rotateAroundY((float)Math.PI * 2F / (float)count); } } - + if("shockRand".equals(mode)) { - + double strength = data.getDouble("strength"); Vec3 vec = Vec3.createVectorHelper(strength, 0, 0); vec.rotateAroundY(rand.nextInt(360)); double r; - + for(int i = 0; i < count; i++) { r = rand.nextDouble(); ParticleExSmoke fx = new ParticleExSmoke(man, world, x, y, z); @@ -1037,76 +1017,76 @@ public class ClientProxy extends ServerProxy { fx.motionX = vec.xCoord * r; fx.motionZ = vec.zCoord * r; Minecraft.getMinecraft().effectRenderer.addEffect(fx); - + vec.rotateAroundY(360 / count); } } - + if("wave".equals(mode)) { - + double strength = data.getDouble("range"); Vec3 vec = Vec3.createVectorHelper(strength, 0, 0); - + for(int i = 0; i < count; i++) { - + vec.rotateAroundY((float) Math.toRadians(rand.nextFloat() * 360F)); - + ParticleExSmoke fx = new ParticleExSmoke(man, world, x + vec.xCoord, y, z + vec.zCoord); fx.maxAge = 50; fx.motionY = 0; fx.motionX = 0; fx.motionZ = 0; Minecraft.getMinecraft().effectRenderer.addEffect(fx); - + vec.rotateAroundY(360 / count); } } } - + if("exhaust".equals(type)) { String mode = data.getString("mode"); - + if("soyuz".equals(mode)) { - + if(Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector() > 350) return; - + int count = Math.max(1, data.getInteger("count")); double width = data.getDouble("width"); - + for(int i = 0; i < count; i++) { - + ParticleRocketFlame fx = new ParticleRocketFlame(man, world, x + rand.nextGaussian() * width, y, z + rand.nextGaussian() * width); fx.motionY = -0.75 + rand.nextDouble() * 0.5; Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } - + if("meteor".equals(mode)) { - + if(Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector() > 350) return; - + int count = Math.max(1, data.getInteger("count")); double width = data.getDouble("width"); - + for(int i = 0; i < count; i++) { - + ParticleRocketFlame fx = new ParticleRocketFlame(man, world, x + rand.nextGaussian() * width, y + rand.nextGaussian() * width, z + rand.nextGaussian() * width); Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } } - + if("fireworks".equals(type)) { int color = data.getInteger("color"); char c = (char)data.getInteger("char"); - + ParticleLetter fx = new ParticleLetter(world, x, y, z, color, c); Minecraft.getMinecraft().effectRenderer.addEffect(fx); - + for(int i = 0; i < 50; i++) { EntityFireworkSparkFX blast = new EntityFireworkSparkFX(world, x, y, z, 0.4 * world.rand.nextGaussian(), @@ -1116,17 +1096,17 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().effectRenderer.addEffect(blast); } } - + if("vanillaburst".equals(type)) { - + double motion = data.getDouble("motion"); - + for(int i = 0; i < data.getInteger("count"); i++) { double mX = rand.nextGaussian() * motion; double mY = rand.nextGaussian() * motion; double mZ = rand.nextGaussian() * motion; - + EntityFX fx = null; if("flame".equals(data.getString("mode"))) { @@ -1153,23 +1133,23 @@ public class ClientProxy extends ServerProxy { } if("blockdust".equals(data.getString("mode"))) { - + Block b = Block.getBlockById(data.getInteger("block")); fx = new net.minecraft.client.particle.EntityBlockDustFX(world, x, y, z, mX, mY + 0.2, mZ, b, 0); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 50 + rand.nextInt(50), "particleMaxAge", "field_70547_e"); } - + if(fx != null) Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } - + if("vanillaExt".equals(type)) { double mX = data.getDouble("mX"); double mY = data.getDouble("mY"); double mZ = data.getDouble("mZ"); - + EntityFX fx = null; if("flame".equals(data.getString("mode"))) { @@ -1193,7 +1173,7 @@ public class ClientProxy extends ServerProxy { if("cloud".equals(data.getString("mode"))) { fx = new net.minecraft.client.particle.EntityCloudFX(world, x, y, z, mX, mY, mZ); - + if(data.hasKey("r")) { float rng = rand.nextFloat() * 0.1F; fx.setRBGColorF(data.getFloat("r") + rng, data.getFloat("g") + rng, data.getFloat("b") + rng); @@ -1221,12 +1201,12 @@ public class ClientProxy extends ServerProxy { } if("largeexplode".equals(data.getString("mode"))) { - - + + fx = new net.minecraft.client.particle.EntityLargeExplodeFX(man, world, x, y, z, data.getFloat("size"), 0.0F, 0.0F); float r = 1.0F - rand.nextFloat() * 0.2F; fx.setRBGColorF(1F * r, 0.9F * r, 0.5F * r); - + for(int i = 0; i < data.getByte("count"); i++) { net.minecraft.client.particle.EntityExplodeFX sec = new net.minecraft.client.particle.EntityExplodeFX(world, x, y, z, 0.0F, 0.0F, 0.0F); float r2 = 1.0F - rand.nextFloat() * 0.5F; @@ -1244,34 +1224,34 @@ public class ClientProxy extends ServerProxy { } if("blockdust".equals(data.getString("mode"))) { - + Block b = Block.getBlockById(data.getInteger("block")); fx = new net.minecraft.client.particle.EntityBlockDustFX(world, x, y, z, mX, mY + 0.2, mZ, b, 0); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 10 + rand.nextInt(20), "particleMaxAge", "field_70547_e"); } if("colordust".equals(data.getString("mode"))) { - + Block b = Blocks.wool; fx = new net.minecraft.client.particle.EntityBlockDustFX(world, x, y, z, mX, mY + 0.2, mZ, b, 0); fx.setRBGColorF(data.getFloat("r"), data.getFloat("g"), data.getFloat("b")); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 10 + rand.nextInt(20), "particleMaxAge", "field_70547_e"); } - + if(fx != null) { - + if(data.getBoolean("noclip")) { fx.noClip = true; } - + if(data.getInteger("overrideAge") > 0) { ReflectionHelper.setPrivateValue(EntityFX.class, fx, data.getInteger("overrideAge"), "particleMaxAge", "field_70547_e"); } - + Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } - + if("vanilla".equals(type)) { double mX = data.getDouble("mX"); @@ -1279,41 +1259,41 @@ public class ClientProxy extends ServerProxy { double mZ = data.getDouble("mZ"); world.spawnParticle(data.getString("mode"), x, y, z, mX, mY, mZ); } - + if("jetpack".equals(type)) { - + if(particleSetting == 2) return; - + Entity ent = world.getEntityByID(data.getInteger("player")); - + if(ent instanceof EntityPlayer) { - + EntityPlayer p = (EntityPlayer)ent; - + Vec3 vec = Vec3.createVectorHelper(0, 0, -0.25); Vec3 offset = Vec3.createVectorHelper(0.125, 0, 0); float angle = (float) -Math.toRadians(p.rotationYawHead - (p.rotationYawHead - p.renderYawOffset)); vec.rotateAroundY(angle); offset.rotateAroundY(angle); - + double ix = p.posX + vec.xCoord; double iy = p.posY + p.eyeHeight - 1; double iz = p.posZ + vec.zCoord; double ox = offset.xCoord; double oz = offset.zCoord; - + double moX = 0; double moY = 0; double moZ = 0; - + int mode = data.getInteger("mode"); - + if(mode == 0) { moY -= 0.2; } - + if(mode == 1) { Vec3 look = p.getLookVec(); @@ -1328,15 +1308,15 @@ public class ClientProxy extends ServerProxy { thrust = thrust.normalize(); Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10); MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true); - + if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) { - + Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ); - + Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord); Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0); - + for(int i = 0; i < (10 - delta.lengthVector()); i++) { vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F); Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta)); @@ -1353,50 +1333,50 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(world, ix + ox, iy, iz + oz, mX2, mY2, mZ2)); Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(world, ix - ox, iy, iz - oz, mX2, mY2, mZ2)); - + if(particleSetting == 0) { Minecraft.getMinecraft().effectRenderer.addEffect(new net.minecraft.client.particle.EntitySmokeFX(world, ix + ox, iy, iz + oz, mX3, mY3, mZ3)); Minecraft.getMinecraft().effectRenderer.addEffect(new net.minecraft.client.particle.EntitySmokeFX(world, ix - ox, iy, iz - oz, mX3, mY3, mZ3)); } } } - + if("bnuuy".equals(type)) { - + if(particleSetting == 2) return; - + Entity ent = world.getEntityByID(data.getInteger("player")); - + if(ent instanceof EntityPlayer) { - + EntityPlayer p = (EntityPlayer)ent; - + Vec3 vec = Vec3.createVectorHelper(0, 0, -0.6); Vec3 offset = Vec3.createVectorHelper(0.275, 0, 0); float angle = (float) -Math.toRadians(p.rotationYawHead - (p.rotationYawHead - p.renderYawOffset)); vec.rotateAroundY(angle); offset.rotateAroundY(angle); - + double ix = p.posX + vec.xCoord; double iy = p.posY + p.eyeHeight - 1 + 0.4; double iz = p.posZ + vec.zCoord; double ox = offset.xCoord; double oz = offset.zCoord; - + if(player.isSneaking()) { iy += 0.25; } - + vec = vec.normalize(); double mult = 0.025D; double mX = vec.xCoord * mult; double mZ = vec.zCoord * mult; - + //Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(world, ix + ox, iy, iz + oz, 0, 0, 0)); //Minecraft.getMinecraft().effectRenderer.addEffect(new EntityFlameFX(world, ix - ox, iy, iz - oz, 0, 0, 0)); - + for(int i = 0; i < 2; i++) { net.minecraft.client.particle.EntitySmokeFX fx = new net.minecraft.client.particle.EntitySmokeFX(world, ix + ox * (i == 0 ? -1 : 1), iy, iz + oz * (i == 0 ? -1 : 1), mX, 0, mZ); float scale = 0.5F; @@ -1405,25 +1385,25 @@ public class ClientProxy extends ServerProxy { } } } - + if("jetpack_bj".equals(type)) { - + if(particleSetting == 2) return; - + Entity ent = world.getEntityByID(data.getInteger("player")); - + if(ent instanceof EntityPlayer) { - + EntityPlayer p = (EntityPlayer)ent; - + Vec3 vec = Vec3.createVectorHelper(0, 0, -0.3125); Vec3 offset = Vec3.createVectorHelper(0.125, 0, 0); float angle = (float) -Math.toRadians(p.rotationYawHead - (p.rotationYawHead - p.renderYawOffset)); vec.rotateAroundY(angle); offset.rotateAroundY(angle); - + double ix = p.posX + vec.xCoord; double iy = p.posY + p.eyeHeight - 0.9375; double iz = p.posZ + vec.zCoord; @@ -1435,15 +1415,15 @@ public class ClientProxy extends ServerProxy { Vec3 thrust = Vec3.createVectorHelper(0, -1, 0); Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10); MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true); - + if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) { - + Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ); - + Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord); Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0); - + for(int i = 0; i < (10 - delta.lengthVector()); i++) { vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F); Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta)); @@ -1459,23 +1439,23 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().effectRenderer.addEffect(dust2); } } - + if("jetpack_dns".equals(type)) { - + if(particleSetting == 2) return; - + Entity ent = world.getEntityByID(data.getInteger("player")); - + if(ent instanceof EntityPlayer) { - + EntityPlayer p = (EntityPlayer)ent; - + Vec3 offset = Vec3.createVectorHelper(0.125, 0, 0); float angle = (float) -Math.toRadians(p.rotationYawHead - (p.rotationYawHead - p.renderYawOffset)); offset.rotateAroundY(angle); - + double ix = p.posX; double iy = p.posY - p.getYOffset() - 0.5D; double iz = p.posZ; @@ -1487,15 +1467,15 @@ public class ClientProxy extends ServerProxy { Vec3 thrust = Vec3.createVectorHelper(0, -1, 0); Vec3 target = pos.addVector(thrust.xCoord * 10, thrust.yCoord * 10, thrust.zCoord * 10); MovingObjectPosition mop = player.worldObj.func_147447_a(pos, target, false, false, true); - + if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && mop.sideHit == 1) { - + Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ); - + Vec3 delta = Vec3.createVectorHelper(ix - mop.hitVec.xCoord, iy - mop.hitVec.yCoord, iz - mop.hitVec.zCoord); Vec3 vel = Vec3.createVectorHelper(0.75 - delta.lengthVector() * 0.075, 0, 0); - + for(int i = 0; i < (10 - delta.lengthVector()); i++) { vel.rotateAroundY(world.rand.nextFloat() * (float)Math.PI * 2F); Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlockDustFX(world, mop.hitVec.xCoord, mop.hitVec.yCoord + 0.1, mop.hitVec.zCoord, vel.xCoord, 0.1, vel.zCoord, b, meta)); @@ -1511,7 +1491,7 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().effectRenderer.addEffect(dust2); } } - + if("muke".equals(type)) { ParticleMukeWave wave = new ParticleMukeWave(man, world, x, y, z); @@ -1527,12 +1507,12 @@ public class ClientProxy extends ServerProxy { player.maxHurtTime = 15; player.attackedAtYaw = 0F; } - + if("tinytot".equals(type)) { ParticleMukeWave wave = new ParticleMukeWave(man, world, x, y, z); Minecraft.getMinecraft().effectRenderer.addEffect(wave); - + for(double d = 0.0D; d <= 1.6D; d += 0.1) { ParticleMukeCloud cloud = new ParticleMukeCloud(man, world, x, y, z, rand.nextGaussian() * 0.05, d + rand.nextGaussian() * 0.02, rand.nextGaussian() * 0.05); Minecraft.getMinecraft().effectRenderer.addEffect(cloud); @@ -1544,14 +1524,14 @@ public class ClientProxy extends ServerProxy { for(int i = 0; i < 15; i++) { double ix = rand.nextGaussian() * 0.2; double iz = rand.nextGaussian() * 0.2; - + if(ix * ix + iz * iz > 0.75) { ix *= 0.5; iz *= 0.5; } - + double iy = 1.6 + (rand.nextDouble() * 2 - 1) * (0.75 - (ix * ix + iz * iz)) * 0.5; - + ParticleMukeCloud cloud = new ParticleMukeCloud(man, world, x, y, z, ix, iy + rand.nextGaussian() * 0.02, iz); Minecraft.getMinecraft().effectRenderer.addEffect(cloud); } @@ -1559,94 +1539,94 @@ public class ClientProxy extends ServerProxy { player.maxHurtTime = 15; player.attackedAtYaw = 0F; } - + if("ufo".equals(type)) { double motion = data.getDouble("motion"); ParticleMukeCloud cloud = new ParticleMukeCloud(man, world, x, y, z, rand.nextGaussian() * motion, 0, rand.nextGaussian() * motion); Minecraft.getMinecraft().effectRenderer.addEffect(cloud); } - + if("bf".equals(type)) { ParticleMukeCloud cloud = new ParticleMukeCloudBF(man, world, x, y, z, 0, 0, 0); Minecraft.getMinecraft().effectRenderer.addEffect(cloud); } - + if("haze".equals(type)) { ParticleHaze fog = new ParticleHaze(man, world, x, y, z); Minecraft.getMinecraft().effectRenderer.addEffect(fog); } - + if("plasmablast".equals(type)) { - + ParticlePlasmaBlast cloud = new ParticlePlasmaBlast(man, world, x, y, z, data.getFloat("r"), data.getFloat("g"), data.getFloat("b"), data.getFloat("pitch"), data.getFloat("yaw")); cloud.setScale(data.getFloat("scale")); Minecraft.getMinecraft().effectRenderer.addEffect(cloud); } - + if("justTilt".equals(type)) { - + player.hurtTime = player.maxHurtTime = data.getInteger("time"); player.attackedAtYaw = 0F; } - + if("properJolt".equals(type)) { - + player.hurtTime = data.getInteger("time"); player.maxHurtTime = data.getInteger("maxTime"); player.attackedAtYaw = 0F; } - + if("sweat".equals(type)) { - + Entity e = world.getEntityByID(data.getInteger("entity")); Block b = Block.getBlockById(data.getInteger("block")); int meta = data.getInteger("meta"); - + if(e instanceof EntityLivingBase) { - + for(int i = 0; i < data.getInteger("count"); i++) { - + double ix = e.boundingBox.minX - 0.2 + (e.boundingBox.maxX - e.boundingBox.minX + 0.4) * rand.nextDouble(); double iy = e.boundingBox.minY + (e.boundingBox.maxY - e.boundingBox.minY + 0.2) * rand.nextDouble(); double iz = e.boundingBox.minZ - 0.2 + (e.boundingBox.maxZ - e.boundingBox.minZ + 0.4) * rand.nextDouble(); - - + + EntityFX fx = new net.minecraft.client.particle.EntityBlockDustFX(world, ix, iy, iz, 0, 0, 0, b, meta); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 150 + rand.nextInt(50), "particleMaxAge", "field_70547_e"); - + Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } } - + if("vomit".equals(type)) { - + Entity e = world.getEntityByID(data.getInteger("entity")); int count = data.getInteger("count") / (particleSetting + 1); - + if(e instanceof EntityLivingBase) { double ix = e.posX; double iy = e.posY - e.getYOffset() + e.getEyeHeight() + (e instanceof EntityPlayer ? 1 : 0); double iz = e.posZ; - + Vec3 vec = e.getLookVec(); - + for(int i = 0; i < count; i++) { - + if("normal".equals(data.getString("mode"))) { EntityFX fx = new net.minecraft.client.particle.EntityBlockDustFX(world, ix, iy, iz, (vec.xCoord + rand.nextGaussian() * 0.2) * 0.2, (vec.yCoord + rand.nextGaussian() * 0.2) * 0.2, (vec.zCoord + rand.nextGaussian() * 0.2) * 0.2, Blocks.stained_hardened_clay, (rand.nextBoolean() ? 5 : 13)); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 150 + rand.nextInt(50), "particleMaxAge", "field_70547_e"); Minecraft.getMinecraft().effectRenderer.addEffect(fx); } - + if("blood".equals(data.getString("mode"))) { EntityFX fx = new net.minecraft.client.particle.EntityBlockDustFX(world, ix, iy, iz, (vec.xCoord + rand.nextGaussian() * 0.2) * 0.2, (vec.yCoord + rand.nextGaussian() * 0.2) * 0.2, (vec.zCoord + rand.nextGaussian() * 0.2) * 0.2, Blocks.redstone_block, 0); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 150 + rand.nextInt(50), "particleMaxAge", "field_70547_e"); Minecraft.getMinecraft().effectRenderer.addEffect(fx); } - + if("smoke".equals(data.getString("mode"))) { EntityFX fx = new net.minecraft.client.particle.EntitySmokeFX(world, ix, iy, iz, (vec.xCoord + rand.nextGaussian() * 0.1) * 0.05, (vec.yCoord + rand.nextGaussian() * 0.1) * 0.05, (vec.zCoord + rand.nextGaussian() * 0.1) * 0.05, 0.2F); ReflectionHelper.setPrivateValue(EntityFX.class, fx, 10 + rand.nextInt(10), "particleMaxAge", "field_70547_e"); @@ -1655,50 +1635,50 @@ public class ClientProxy extends ServerProxy { } } } - + if("radiation".equals(type)) { - + for(int i = 0; i < data.getInteger("count"); i++) { - + EntityAuraFX flash = new EntityAuraFX(world, player.posX + rand.nextGaussian() * 4, player.posY + rand.nextGaussian() * 2, player.posZ + rand.nextGaussian() * 4, 0, 0, 0); - + flash.setRBGColorF(0F, 0.75F, 1F); flash.setVelocity(rand.nextGaussian(), rand.nextGaussian(), rand.nextGaussian()); Minecraft.getMinecraft().effectRenderer.addEffect(flash); } } - + if("schrabfog".equals(type)) { - + EntityAuraFX flash = new EntityAuraFX(world, x, y, z, 0, 0, 0); flash.setRBGColorF(0F, 1F, 1F); Minecraft.getMinecraft().effectRenderer.addEffect(flash); } - + if("hadron".equals(type)) { - + Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleHadron(man, world, x, y, z)); } - + if("rift".equals(type)) { - + Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleRift(man, world, x, y, z)); } - + if("rbmkflame".equals(type)) { int maxAge = data.getInteger("maxAge"); Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleRBMKFlame(man, world, x, y, z, maxAge)); } - + if("rbmkmush".equals(type)) { float scale = data.getFloat("scale"); Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleRBMKMush(man, world, x, y, z, scale)); } - + if("tower".equals(type)) { if(particleSetting == 0 || (particleSetting == 1 && rand.nextBoolean())) { ParticleCoolingTower fx = new ParticleCoolingTower(man, world, x, y, z); @@ -1709,58 +1689,58 @@ public class ClientProxy extends ServerProxy { if(data.hasKey("noWind")) fx.noWind(); if(data.hasKey("strafe")) fx.setStrafe(data.getFloat("strafe")); if(data.hasKey("alpha")) fx.alphaMod(data.getFloat("alpha")); - + if(data.hasKey("color")) { Color color = new Color(data.getInteger("color")); fx.setRBGColorF(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F); } - + Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } - + if("splash".equals(type)) { if(particleSetting == 0 || (particleSetting == 1 && rand.nextBoolean())) { ParticleSplash fx = new ParticleSplash(man, world, x, y, z); - + if(data.hasKey("color")) { Color color = new Color(data.getInteger("color")); float f = 1F - rand.nextFloat() * 0.2F; fx.setRBGColorF(color.getRed() / 255F * f, color.getGreen() / 255F * f, color.getBlue() / 255F * f); } - + Minecraft.getMinecraft().effectRenderer.addEffect(fx); } } - + if("deadleaf".equals(type)) { if(particleSetting == 0 || (particleSetting == 1 && rand.nextBoolean())) Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDeadLeaf(man, world, x, y, z)); } - + if("anim".equals(type)) { - + String mode = data.getString("mode"); - + /* crucible deploy */ if("crucible".equals(mode) && player.getHeldItem() != null) { - + BusAnimation animation = new BusAnimation() .addBus("GUARD_ROT", new BusAnimationSequence() .addPos(90, 0, 1, 0) .addPos(90, 0, 1, 800) .addPos(0, 0, 1, 50)); - + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); } - + /* crucible swing */ if("cSwing".equals(mode)) { - + if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) { - + int offset = rand.nextInt(80) - 20; - + BusAnimation animation = new BusAnimation() .addBus("SWING_ROT", new BusAnimationSequence() .addPos(90 - offset, 90 - offset, 35, 75) @@ -1772,20 +1752,20 @@ public class ClientProxy extends ServerProxy { .addPos(0, 0, 0, 500)); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F)); - + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); } } - + /* chainsaw swing */ if("sSwing".equals(mode) || "lSwing".equals(mode)) { //temp for lance int forward = 150; int sideways = 100; int retire = 200; - + if(HbmAnimations.getRelevantAnim() == null) { - + BusAnimation animation = new BusAnimation() .addBus("SWING_ROT", new BusAnimationSequence() .addPos(0, 0, 90, forward) @@ -1796,16 +1776,16 @@ public class ClientProxy extends ServerProxy { .addPos(2, 0, 2, sideways) .addPos(0, 0, 0, retire)); - + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); - + } else { double[] rot = HbmAnimations.getRelevantTransformation("SWING_ROT"); double[] trans = HbmAnimations.getRelevantTransformation("SWING_TRANS"); - + if(System.currentTimeMillis() - HbmAnimations.getRelevantAnim().startMillis < 50) return; - + BusAnimation animation = new BusAnimation() .addBus("SWING_ROT", new BusAnimationSequence() .addPos(rot[0], rot[1], rot[2], 0) @@ -1817,70 +1797,70 @@ public class ClientProxy extends ServerProxy { .addPos(0, 0, 3, forward) .addPos(2, 0, 2, sideways) .addPos(0, 0, 0, retire)); - + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); } } - + if("generic".equals(mode)) { ItemStack stack = player.getHeldItem(); - + if(stack != null && stack.getItem() instanceof IAnimatedItem) { IAnimatedItem item = (IAnimatedItem) stack.getItem(); BusAnimation anim = item.getAnimation(data, stack); - + if(anim != null) { HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim); } } } } - + if("tau".equals(type)) { - + for(int i = 0; i < data.getByte("count"); i++) Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(world, x, y, z, rand.nextGaussian() * 0.05, 0.05, rand.nextGaussian() * 0.05)); Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleHadron(man, world, x, y, z)); } - + if("vanish".equals(type)) { int ent = data.getInteger("ent"); this.vanish(ent); } - + if("giblets".equals(type)) { int ent = data.getInteger("ent"); this.vanish(ent); Entity e = world.getEntityByID(ent); - + if(e == null) return; - + float width = e.width; float height = e.height; int gW = (int)(width / 0.25F); int gH = (int)(height / 0.25F); - + int count = (int) (gW * 1.5 * gH); - + if(data.hasKey("cDiv")) count = (int) Math.ceil(count / (double)data.getInteger("cDiv")); - + boolean blowMeIntoTheGodDamnStratosphere = rand.nextInt(15) == 0; double mult = 1D; - + if(blowMeIntoTheGodDamnStratosphere) mult *= 10; - + for(int i = 0; i < count; i++) { Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleGiblet(man, world, x, y, z, rand.nextGaussian() * 0.25 * mult, rand.nextDouble() * mult, rand.nextGaussian() * 0.25 * mult)); } } - + if("amat".equals(type)) { Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleAmatFlash(world, x, y, z, data.getFloat("scale"))); } - + if("debug".equals(type)) { String t = data.getString("text"); int color = data.getInteger("color"); @@ -1889,7 +1869,7 @@ public class ClientProxy extends ServerProxy { text.multipleParticleScaleBy(scale); Minecraft.getMinecraft().effectRenderer.addEffect(text); } - + if("debugline".equals(type)) { double mX = data.getDouble("mX"); double mY = data.getDouble("mY"); @@ -1898,10 +1878,10 @@ public class ClientProxy extends ServerProxy { ParticleDebugLine text = new ParticleDebugLine(world, x, y, z, mX, mY, mZ, color); Minecraft.getMinecraft().effectRenderer.addEffect(text); } - + if("debugdrone".equals(type)) { Item held = player.getHeldItem() == null ? null : player.getHeldItem().getItem(); - + if(held == ModItems.drone || held == Item.getItemFromBlock(ModBlocks.drone_crate_provider) || held == Item.getItemFromBlock(ModBlocks.drone_crate_requester) || @@ -1917,7 +1897,7 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().effectRenderer.addEffect(text); } } - + if("network".equals(type)) { ParticleDebug debug = null; double mX = data.getDouble("mX"); @@ -1933,7 +1913,7 @@ public class ClientProxy extends ServerProxy { } Minecraft.getMinecraft().effectRenderer.addEffect(debug); } - + if("gasfire".equals(type)) { double mX = data.getDouble("mX"); double mY = data.getDouble("mY"); @@ -1942,38 +1922,38 @@ public class ClientProxy extends ServerProxy { ParticleGasFlame text = new ParticleGasFlame(world, x, y, z, mX, mY, mZ, scale > 0 ? scale : 6.5F); Minecraft.getMinecraft().effectRenderer.addEffect(text); } - + if("marker".equals(type)) { int color = data.getInteger("color"); String label = data.getString("label"); int expires = data.getInteger("expires"); double dist = data.getDouble("dist"); - + RenderOverhead.queuedMarkers.put(new BlockPos(x, y, z), new Marker(color).setDist(dist).setExpire(expires > 0 ? System.currentTimeMillis() + expires : 0).withLabel(label.isEmpty() ? null : label)); } - + if("casing".equals(type)) { CasingEjector ejector = CasingEjector.fromId(data.getInteger("ej")); if(ejector == null) return; SpentCasing casingConfig = SpentCasing.fromName((data.getString("name"))); if(casingConfig == null) return; - + for(int i = 0; i < ejector.getAmount(); i++) { ejector.spawnCasing(man, casingConfig, world, x, y, z, data.getFloat("pitch"), data.getFloat("yaw"), data.getBoolean("crouched")); } } - + if("foundry".equals(type)) { int color = data.getInteger("color"); byte dir = data.getByte("dir"); float length = data.getFloat("len"); float base = data.getFloat("base"); float offset = data.getFloat("off"); - + ParticleFoundry sploosh = new ParticleFoundry(man, world, x, y, z, color, dir, length, base, offset); Minecraft.getMinecraft().effectRenderer.addEffect(sploosh); } - + if("frozen".equals(type)) { player.motionX = 0; player.motionZ = 0; @@ -1982,28 +1962,28 @@ public class ClientProxy extends ServerProxy { player.moveStrafing = 0; } } - + private static HashMap vanished = new HashMap(); public static void vanish(int ent) { vanished.put(ent, System.currentTimeMillis() + 2000); } public static void vanish(int ent, int duration) { vanished.put(ent, System.currentTimeMillis() + duration); } - + @Override public boolean isVanished(Entity e) { if(e == null) return false; if(!this.vanished.containsKey(e.getEntityId())) return false; return this.vanished.get(e.getEntityId()) > System.currentTimeMillis(); } - + @Override public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float range, float pitch) { - + AudioWrapperClient audio = new AudioWrapperClient(new ResourceLocation(sound)); audio.updatePosition(x, y, z); audio.updateVolume(volume); audio.updateRange(range); return audio; } - + @Override public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float range, float pitch, int keepAlive) { AudioWrapper audio = getLoopedSound(sound, x, y, z, volume, range, pitch); @@ -2013,10 +1993,10 @@ public class ClientProxy extends ServerProxy { @Override public void playSound(String sound, Object data) { } - + @Override public void displayTooltip(String msg, int time, int id) { - + if(id != 0) this.theInfoSystem.push(new InfoEntry(msg, time), id); else @@ -2044,7 +2024,7 @@ public class ClientProxy extends ServerProxy { case GUN_SECONDARY: return HbmKeybinds.gunSecondaryKey.getIsKeyPressed(); case GUN_TERTIARY: return HbmKeybinds.gunTertiaryKey.getIsKeyPressed(); } - + return false; } @@ -2052,17 +2032,17 @@ public class ClientProxy extends ServerProxy { public EntityPlayer me() { return Minecraft.getMinecraft().thePlayer; } - + @Override public void openLink(String url) { try { Desktop.getDesktop().browse(new URI(url)); } catch (Exception e) { } } - + @Override public List getSubItems(ItemStack stack) { - + List list = new ArrayList(); stack.getItem().getSubItems(stack.getItem(), stack.getItem().getCreativeTab(), list); for(ItemStack sta : list) { @@ -2096,7 +2076,7 @@ public class ClientProxy extends ServerProxy { Language lang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage(); return lang.getLanguageCode(); } - + @Override public int getStackColor(ItemStack stack, boolean amplify) { if(stack == null) return 0x000000; diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index b4232a54a..e18be7120 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -1,8 +1,5 @@ package com.hbm.main; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.BlockEnums.DecoCabinetEnum; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockConcreteColoredExt.EnumConcreteType; @@ -35,7 +32,8 @@ import com.hbm.items.special.ItemHolotapeImage.EnumHoloImage; import com.hbm.items.special.ItemPlasticScrap.ScrapType; import com.hbm.items.tool.ItemDrone.EnumDroneType; import com.hbm.items.tool.ItemGuideBook.BookType; - +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -46,16 +44,17 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameRegistry; + +import java.util.ArrayList; +import java.util.List; public class CraftingManager { - + public static void mainRegistry() { - + AddCraftingRec(); SmeltingRecipes.AddSmeltingRec(); - + MineralRecipes.register(); RodRecipes.register(); ToolRecipes.register(); @@ -63,13 +62,13 @@ public class CraftingManager { WeaponRecipes.register(); ConsumableRecipes.register(); PowderRecipes.register(); - + GameRegistry.addRecipe(new RBMKFuelCraftingHandler()); GameRegistry.addRecipe(new MKUCraftingHandler()); GameRegistry.addRecipe(new ToolboxCraftingHandler()); GameRegistry.addRecipe(new CargoShellCraftingHandler()); GameRegistry.addRecipe(new ScrapsCraftingHandler()); - + RecipeSorter.register("hbm:rbmk", RBMKFuelCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:toolbox", ToolboxCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:cargo", CargoShellCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); @@ -86,7 +85,7 @@ public class CraftingManager { for(Object[] array : BlockGenericStairs.recipeGen) { addRecipeAuto(new ItemStack((Block) array[2], 4), new Object[] { "# ", "## ", "###", '#', new ItemStack((Block) array[0], 1, (int) array[1]) }); } - + addRecipeAuto(new ItemStack(ModItems.redstone_sword, 1), new Object[] { "R", "R", "S", 'R', REDSTONE.block(), 'S', KEY_STICK }); addRecipeAuto(new ItemStack(ModItems.big_sword, 1), new Object[] { "QIQ", "QIQ", "GSG", 'G', Items.gold_ingot, 'S', KEY_STICK, 'I', Items.iron_ingot, 'Q', Items.quartz}); @@ -122,9 +121,9 @@ public class CraftingManager { addRecipeAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP_QUANTUM), new Object[] { "HHH", "SIS", "WWW", 'H', ANY_HARDPLASTIC.ingot(), 'S', BSCCO.wireDense(), 'I', ModItems.pellet_charged, 'W', GOLD.wireFine() }); addRecipeAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER_CHASSIS), new Object[] { "PPP", "CBB", "PPP", 'P', ANY_PLASTIC.ingot(), 'C', ModItems.crt_display, 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.PCB) }); addRecipeAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ATOMIC_CLOCK), new Object[] { "ICI", "CSC", "ICI", 'I', ModItems.plate_polymer, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP), 'S', SR.dust() }); - + addRecipeAuto(new ItemStack(ModItems.crt_display, 4), new Object[] { " A ", "SGS", " T ", 'A', AL.dust(), 'S', STEEL.plate(), 'G', KEY_ANYPANE, 'T', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE) }); - + addRecipeAuto(new ItemStack(ModItems.cell_empty, 6), new Object[] { " S ", "G G", " S ", 'S', STEEL.plate(), 'G', KEY_ANYPANE }); addRecipeAuto(new ItemStack(ModItems.cell_deuterium, 8), new Object[] { "DDD", "DTD", "DDD", 'D', ModItems.cell_empty, 'T', ModItems.mike_deut }); addRecipeAuto(new ItemStack(ModItems.particle_empty, 2), new Object[] { "STS", "G G", "STS", 'S', STEEL.plate(), 'T', W.ingot(), 'G', KEY_ANYPANE }); @@ -221,7 +220,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.radio_torch_logic, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP) }); addRecipeAuto(new ItemStack(ModBlocks.radio_torch_counter, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE) }); addRecipeAuto(new ItemStack(ModBlocks.radio_telex, 2), new Object[] { "SCR", "W#W", "WWW", 'S', ModBlocks.radio_torch_sender, 'C', ModItems.crt_display, 'R', ModBlocks.radio_torch_receiver, 'W', KEY_PLANKS, '#', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ANALOG) }); - + addRecipeAuto(new ItemStack(ModBlocks.conveyor, 16), new Object[] { "LLL", "I I", "LLL", 'L', Items.leather, 'I', IRON.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.conveyor, 16), new Object[] { "RSR", "I I", "RSR", 'I', IRON.ingot(), 'R', DictFrame.fromOne(ModItems.plant_item, EnumPlantType.ROPE), 'S', IRON.plate() }); addRecipeAuto(new ItemStack(ModBlocks.conveyor, 64), new Object[] { "LLL", "I I", "LLL", 'L', ANY_RUBBER.ingot(), 'I', IRON.ingot() }); @@ -266,7 +265,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.crate_template, 1), new Object[] { "IPI", "P P", "IPI", 'I', IRON.ingot(), 'P', Items.paper }); addRecipeAuto(new ItemStack(ModBlocks.crate_iron, 1), new Object[] { "PPP", "I I", "III", 'P', IRON.plate(), 'I', IRON.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.crate_steel, 1), new Object[] { "PPP", "I I", "III", 'P', STEEL.plate(), 'I', STEEL.ingot() }); - + GameRegistry.addRecipe(new ContainerUpgradeCraftingHandler(new ItemStack(ModBlocks.crate_desh, 1), new Object[] { " D ", "DSD", " D ", 'D', ModItems.plate_desh, 'S', ModBlocks.crate_steel })); GameRegistry.addRecipe(new ContainerUpgradeCraftingHandler(new ItemStack(ModBlocks.crate_tungsten, 1), new Object[] { "BPB", "PCP", "BPB", 'B', W.block(), 'P', CU.plateCast(), 'C', ModBlocks.crate_steel })); // Note: voids the last few slots when placed, because a safe's inventory is smaller than a crate's one @@ -276,7 +275,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ContainerUpgradeCraftingHandler(new ItemStack(ModBlocks.mass_storage, 1, 1), new Object[] { "PCP", "PMP", "PPP", 'P', DESH.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP), 'M', new ItemStack(ModBlocks.mass_storage, 1, 0) })); GameRegistry.addRecipe(new ContainerUpgradeCraftingHandler(new ItemStack(ModBlocks.mass_storage, 1, 2), new Object[] { "PCP", "PMP", "PPP", 'P', ANY_RESISTANTALLOY.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'M', new ItemStack(ModBlocks.mass_storage, 1, 1) })); addRecipeAuto(new ItemStack(ModBlocks.mass_storage, 1, 3), new Object[] { "PPP", "PIP", "PPP", 'P', KEY_PLANKS, 'I', IRON.plate() }); - + addRecipeAuto(new ItemStack(ModBlocks.machine_autocrafter, 1), new Object[] { "SCS", "MWM", "SCS", 'S', STEEL.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE), 'M', ModItems.motor, 'W', Blocks.crafting_table }); addRecipeAuto(new ItemStack(ModBlocks.machine_funnel, 1), new Object[] { "S S", "SRS", " S ", 'S', STEEL.ingot(), 'R', REDSTONE.dust() }); addRecipeAuto(new ItemStack(ModBlocks.machine_waste_drum, 1), new Object[] { "LRL", "BRB", "LRL", 'L', PB.ingot(), 'B', Blocks.iron_bars, 'R', ModItems.rod_quad_empty }); @@ -310,7 +309,7 @@ public class CraftingManager { addRecipeAuto(DictFrame.fromOne(ModItems.arc_electrode, EnumElectrodeType.DESH), new Object[] { "C", "T", "C", 'C', DESH.ingot(), 'T', TI.ingot() }); addRecipeAuto(DictFrame.fromOne(ModItems.arc_electrode, EnumElectrodeType.DESH), new Object[] { "C", "T", "C", 'C', DESH.ingot(), 'T', W.ingot() }); addRecipeAuto(DictFrame.fromOne(ModItems.arc_electrode, EnumElectrodeType.SATURNITE), new Object[] { "C", "T", "C", 'C', BIGMT.ingot(), 'T', NB.ingot() }); - + addRecipeAuto(new ItemStack(ModItems.detonator, 1), new Object[] { " W", "SC", "CE", 'S', STEEL.plate(), 'W', MINGRADE.wireFine(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'E', STEEL.ingot() }); addShapelessAuto(new ItemStack(ModItems.detonator_multi, 1), new Object[] { ModItems.detonator, DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) }); addRecipeAuto(new ItemStack(ModItems.detonator_laser, 1), new Object[] { "RRD", "PIC", " P", 'P', STEEL.plate(), 'R', REDSTONE.dust(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', DIAMOND.gem(), 'I', STEEL.ingot() }); @@ -327,16 +326,16 @@ public class CraftingManager { addShapelessAuto(new ItemStack(ModItems.fuse, 1), new Object[] { STEEL.plate(), ModItems.plate_polymer, W.wireFine() }); addShapelessAuto(new ItemStack(ModItems.overfuse, 1), new Object[] { STEEL.bolt(), NP237.dust(), I.dust(), TH232.dust(), AT.dust(), ND.dust(), CU.plateCast(), ModItems.black_hole, CS.dust() }); addShapelessAuto(new ItemStack(ModItems.overfuse, 1), new Object[] { STEEL.bolt(), ST.dust(), BR.dust(), CO.dust(), TS.dust(), NB.dust(), CU.plateCast(), ModItems.black_hole, CE.dust() }); - + addRecipeAuto(new ItemStack(ModItems.blades_steel, 1), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', STEEL.ingot() }); addRecipeAuto(new ItemStack(ModItems.blades_titanium, 1), new Object[] { " P ", "PIP", " P ", 'P', TI.plate(), 'I', TI.ingot() }); addRecipeAuto(new ItemStack(ModItems.blades_advanced_alloy, 1), new Object[] { " P ", "PIP", " P ", 'P', ALLOY.plate(), 'I', ALLOY.ingot() }); addRecipeAuto(new ItemStack(ModItems.blades_desh, 1), new Object[] { " P ", "PBP", " P ", 'P', ModItems.plate_desh, 'B', ModItems.blades_advanced_alloy }); //4 desh ingots still needed to do anything - + addRecipeAuto(new ItemStack(ModItems.blades_steel, 1), new Object[] { "PIP", 'P', STEEL.plate(), 'I', new ItemStack(ModItems.blades_steel, 1, OreDictionary.WILDCARD_VALUE) }); addRecipeAuto(new ItemStack(ModItems.blades_titanium, 1), new Object[] { "PIP", 'P', TI.plate(), 'I', new ItemStack(ModItems.blades_titanium, 1, OreDictionary.WILDCARD_VALUE) }); addRecipeAuto(new ItemStack(ModItems.blades_advanced_alloy, 1), new Object[] { "PIP", 'P', ALLOY.plate(), 'I', new ItemStack(ModItems.blades_advanced_alloy, 1, OreDictionary.WILDCARD_VALUE) }); - + addRecipeAuto(new ItemStack(ModItems.laser_crystal_co2, 1), new Object[] { "QDQ", "NCN", "QDQ", 'Q', ModBlocks.glass_quartz, 'D', DESH.ingot(), 'N', NB.ingot(), 'C', new ItemStack(ModItems.fluid_tank_full, 1, Fluids.CARBONDIOXIDE.getID()) }); addRecipeAuto(new ItemStack(ModItems.laser_crystal_bismuth, 1), new Object[] {"QUQ", "BCB", "QTQ", 'Q', ModBlocks.glass_quartz, 'U', U.ingot(), 'T', TH232.ingot(), 'B', ModItems.nugget_bismuth, 'C', ModItems.crystal_rare }); addRecipeAuto(new ItemStack(ModItems.laser_crystal_cmb, 1), new Object[] {"QBQ", "CSC", "QBQ", 'Q', ModBlocks.glass_quartz, 'B', CMB.ingot(), 'C', SBD.ingot(), 'S', ModItems.cell_anti_schrabidium }); @@ -344,7 +343,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.laser_crystal_digamma, 1), new Object[] {"QUQ", "UEU", "QUQ", 'Q', ModBlocks.glass_quartz, 'U', ModItems.undefined, 'E', ModItems.ingot_electronium } ); Item[] bricks = new Item[] {Items.brick, Items.netherbrick}; - + for(Item brick : bricks) { addRecipeAuto(new ItemStack(ModItems.stamp_stone_flat, 1), new Object[] { "III", "SSS", 'I', brick, 'S', "stone" }); addRecipeAuto(new ItemStack(ModItems.stamp_iron_flat, 1), new Object[] { "III", "SSS", 'I', brick, 'S', IRON.ingot() }); @@ -353,7 +352,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.stamp_obsidian_flat, 1), new Object[] { "III", "SSS", 'I', brick, 'S', Blocks.obsidian }); addRecipeAuto(new ItemStack(ModItems.stamp_desh_flat, 1), new Object[] { "BDB", "DSD", "BDB", 'B', brick, 'D', DESH.ingot(), 'S', FERRO.ingot() }); } - + addRecipeAuto(new ItemStack(ModItems.mechanism_revolver_1, 1), new Object[] { "ICI", "CAC", "ICI", 'I', IRON.plate(), 'C', CU.ingot(), 'A', AL.ingot() }); addRecipeAuto(new ItemStack(ModItems.mechanism_revolver_2, 1), new Object[] { "ATA", "TDT", "ATA", 'A', ALLOY.plate(), 'T', W.ingot(), 'D', DURA.ingot() }); addRecipeAuto(new ItemStack(ModItems.mechanism_rifle_1, 1), new Object[] { "ICI", "MAM", "ICI", 'I', IRON.plate(), 'C', CU.ingot(), 'A', AL.ingot(), 'M', ModItems.mechanism_revolver_1 }); @@ -390,16 +389,16 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.tile_lab_broken, 6), new Object[] { " C " , "C C", " C ", 'C', ModBlocks.tile_lab_cracked }); addShapelessAuto(new ItemStack(ModBlocks.asphalt_light, 1), new Object[] { ModBlocks.asphalt, Items.glowstone_dust }); addShapelessAuto(new ItemStack(ModBlocks.asphalt, 1), new Object[] { ModBlocks.asphalt_light }); - + String[] dyes = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" }; - + for(int i = 0; i < 16; i++) { String dyeName = "dye" + dyes[15 - i]; addRecipeAuto(new ItemStack(ModBlocks.concrete_colored, 8, i), new Object[] { "CCC", "CDC", "CCC", 'C', ModBlocks.concrete_smooth, 'D', dyeName }); } addShapelessAuto(new ItemStack(ModBlocks.concrete_smooth, 1), new Object[] { new ItemStack(ModBlocks.concrete_colored, 1, OreDictionary.WILDCARD_VALUE) }); addShapelessAuto(new ItemStack(ModBlocks.concrete_smooth, 1), new Object[] { new ItemStack(ModBlocks.concrete_colored_ext, 1, OreDictionary.WILDCARD_VALUE) }); - + addRecipeAuto(new ItemStack(ModBlocks.concrete_colored_ext, 6, EnumConcreteType.MACHINE.ordinal()), new Object[] { "CCC", "1 2", "CCC", 'C', ModBlocks.concrete_smooth, '1', KEY_BROWN, '2', KEY_GRAY }); addRecipeAuto(new ItemStack(ModBlocks.concrete_colored_ext, 6, EnumConcreteType.MACHINE_STRIPE.ordinal()), new Object[] { "CCC", "1 2", "CCC", 'C', ModBlocks.concrete_smooth, '1', KEY_BROWN, '2', KEY_BLACK }); addRecipeAuto(new ItemStack(ModBlocks.concrete_colored_ext, 6, EnumConcreteType.INDIGO.ordinal()), new Object[] { "CCC", "1 2", "CCC", 'C', ModBlocks.concrete_smooth, '1', KEY_BLUE, '2', KEY_PURPLE }); @@ -437,7 +436,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.spotlight_fluoro, 8), new Object[] { "G", "M", "A", 'G', KEY_ANYPANE, 'M', ModItems.ingot_mercury, 'A', ModItems.plate_aluminium }); addRecipeAuto(new ItemStack(ModBlocks.spotlight_halogen, 8), new Object[] { "G", "B", "S", 'G', KEY_ANYPANE, 'B', ModItems.powder_bromine, 'S', STEEL.plate() }); addRecipeAuto(new ItemStack(ModBlocks.floodlight, 2), new Object[] { "CSC", "TST", "G G", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CAPACITOR), 'S', STEEL.plate(), 'T', ModItems.coil_tungsten, 'G', KEY_ANYPANE }); - + addRecipeAuto(new ItemStack(ModBlocks.barbed_wire, 16), new Object[] { "AIA", "I I", "AIA", 'A', STEEL.wireFine(), 'I', IRON.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.barbed_wire_fire, 8), new Object[] { "BBB", "BIB", "BBB", 'B', ModBlocks.barbed_wire, 'I', P_RED.dust() }); addRecipeAuto(new ItemStack(ModBlocks.barbed_wire_poison, 8), new Object[] { "BBB", "BIB", "BBB", 'B', ModBlocks.barbed_wire, 'I', ModItems.powder_poison }); @@ -459,16 +458,16 @@ public class CraftingManager { addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate), 4), new Object[] { "SS", "SS", 'S', ModBlocks.steel_beam }); addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate_wide), 4), new Object[] { "SS", 'S', ModBlocks.steel_grate }); addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.steel_grate), 1), new Object[] { "SS", 'S', ModBlocks.steel_grate_wide }); - + addRecipeAuto(new ItemStack(ModBlocks.steel_scaffold, 8, 0), new Object[] { "SSS", "SDS", "SSS", 'S', ModBlocks.steel_scaffold, 'D', "dyeGray" }); addRecipeAuto(new ItemStack(ModBlocks.steel_scaffold, 8, 1), new Object[] { "SSS", "SDS", "SSS", 'S', ModBlocks.steel_scaffold, 'D', "dyeRed" }); addRecipeAuto(new ItemStack(ModBlocks.steel_scaffold, 8, 2), new Object[] { "SSS", "SDS", "SSS", 'S', ModBlocks.steel_scaffold, 'D', "dyeWhite" }); addRecipeAuto(new ItemStack(ModBlocks.steel_scaffold, 8, 3), new Object[] { "SSS", "SDS", "SSS", 'S', ModBlocks.steel_scaffold, 'D', "dyeYellow" }); - + reg2(); } - + public static void reg2() { addRecipeAuto(new ItemStack(ModBlocks.sat_dock, 1), new Object[] { "SSS", "PCP", 'S', STEEL.ingot(), 'P', ANY_PLASTIC.ingot(), 'C', ModBlocks.crate_iron }); @@ -500,12 +499,12 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.flame_conspiracy, 1), new Object[] { " S ", "STS", " S ", 'S', Fluids.KEROSENE.getDict(1000), 'T', STEEL.ingot() }); addRecipeAuto(new ItemStack(ModItems.flame_politics, 1), new Object[] { " I ", "IPI", " I ", 'P', Items.paper, 'I', KEY_BLACK }); addRecipeAuto(new ItemStack(ModItems.flame_opinion, 1), new Object[] { " R ", "RPR", " R ", 'P', Items.paper, 'R', KEY_RED }); - + addRecipeAuto(new ItemStack(ModItems.solid_fuel_presto, 1), new Object[] { " P ", "SRS", " P ", 'P', Items.paper, 'S', ModItems.solid_fuel, 'R', REDSTONE.dust() }); addShapelessAuto(new ItemStack(ModItems.solid_fuel_presto_triplet, 1), new Object[] { ModItems.solid_fuel_presto, ModItems.solid_fuel_presto, ModItems.solid_fuel_presto, ModItems.ball_dynamite }); addRecipeAuto(new ItemStack(ModItems.solid_fuel_presto_bf, 1), new Object[] { " P ", "SRS", " P ", 'P', Items.paper, 'S', ModItems.solid_fuel_bf, 'R', REDSTONE.dust() }); addShapelessAuto(new ItemStack(ModItems.solid_fuel_presto_triplet_bf, 1), new Object[] { ModItems.solid_fuel_presto_bf, ModItems.solid_fuel_presto_bf, ModItems.solid_fuel_presto_bf, ModItems.ingot_c4 }); - + addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.flame_war), 1), new Object[] { "WHW", "CTP", "WOW", 'W', Item.getItemFromBlock(Blocks.planks), 'T', Item.getItemFromBlock(Blocks.tnt), 'H', ModItems.flame_pony, 'C', ModItems.flame_conspiracy, 'P', ModItems.flame_politics, 'O', ModItems.flame_opinion }); addRecipeAuto(new ItemStack(ModBlocks.det_cord, 4), new Object[] { " P ", "PGP", " P ", 'P', Items.paper, 'G', Items.gunpowder }); addRecipeAuto(new ItemStack(ModBlocks.det_charge, 1), new Object[] { "PDP", "DTD", "PDP", 'P', STEEL.plate(), 'D', ModBlocks.det_cord, 'T', ANY_PLASTICEXPLOSIVE.ingot() }); @@ -567,9 +566,9 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.battery_sc_gold), new Object[] { "NBN", "PCP", "NBN", 'N', TA.nugget(), 'B', AU198.billet(), 'P', ANY_PLASTIC.ingot(), 'C', ModItems.battery_sc_polonium }); addRecipeAuto(new ItemStack(ModItems.battery_sc_lead), new Object[] { "NBN", "PCP", "NBN", 'N', TA.nugget(), 'B', PB209.billet(), 'P', ANY_PLASTIC.ingot(), 'C', ModItems.battery_sc_gold }); addRecipeAuto(new ItemStack(ModItems.battery_sc_americium), new Object[] { "NBN", "PCP", "NBN", 'N', TA.nugget(), 'B', AM241.billet(), 'P', ANY_PLASTIC.ingot(), 'C', ModItems.battery_sc_lead }); - + addRecipeAuto(new ItemStack(ModItems.wiring_red_copper, 1), new Object[] { "PPP", "PIP", "PPP", 'P', STEEL.plate(), 'I', STEEL.ingot() }); - + addRecipeAuto(new ItemStack(ModItems.jetpack_tank, 1), new Object[] { " S ", "BKB", " S ", 'S', STEEL.plate(), 'B', STEEL.bolt(), 'K', Fluids.KEROSENE.getDict(1000) }); addShapelessAuto(new ItemStack(ModItems.gun_kit_1, 1), new Object[] { ANY_RUBBER.ingot(), Fluids.WOODOIL.getDict(1_000), IRON.ingot() }); addShapelessAuto(new ItemStack(ModItems.gun_kit_2, 1), new Object[] { ModItems.gun_kit_1, ModItems.wrench, ModItems.ducttape, Fluids.LUBRICANT.getDict(1_000) }); @@ -585,7 +584,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.padlock, 1), new Object[] { " P ", "PBP", "PPP", 'P', STEEL.plate(), 'B', STEEL.bolt() }); addRecipeAuto(new ItemStack(ModItems.padlock_reinforced, 1), new Object[] { " P ", "PBP", "PDP", 'P', ALLOY.plate(), 'D', ModItems.plate_desh, 'B', DURA.bolt() }); addRecipeAuto(new ItemStack(ModItems.padlock_unbreakable, 1), new Object[] { " P ", "PBP", "PDP", 'P', BIGMT.plate(), 'D', DIAMOND.gem(), 'B', DURA.bolt() }); - + addRecipeAuto(new ItemStack(ModItems.record_lc, 1), new Object[] { " S ", "SDS", " S ", 'S', ANY_PLASTIC.ingot(), 'D', LAPIS.dust() }); addRecipeAuto(new ItemStack(ModItems.record_ss, 1), new Object[] { " S ", "SDS", " S ", 'S', ANY_PLASTIC.ingot(), 'D', ALLOY.dust() }); addRecipeAuto(new ItemStack(ModItems.record_vc, 1), new Object[] { " S ", "SDS", " S ", 'S', ANY_PLASTIC.ingot(), 'D', CMB.dust() }); @@ -609,12 +608,12 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.fluid_tank_empty, 8), new Object[] { "121", "1G1", "121", '1', AL.plate(), '2', IRON.plate(), 'G', KEY_ANYPANE }); addRecipeAuto(new ItemStack(ModItems.fluid_tank_lead_empty, 4), new Object[] { "LUL", "LTL", "LUL", 'L', PB.plate(), 'U', U238.billet(), 'T', ModItems.fluid_tank_empty }); addRecipeAuto(new ItemStack(ModItems.fluid_barrel_empty, 2), new Object[] { "121", "1G1", "121", '1', STEEL.plate(), '2', AL.plate(), 'G', KEY_ANYPANE }); - + if(!GeneralConfig.enable528) { addRecipeAuto(new ItemStack(ModItems.inf_water, 1), new Object[] { "222", "131", "222", '1', Items.water_bucket, '2', AL.plate(), '3', DIAMOND.gem() }); addRecipeAuto(new ItemStack(ModItems.inf_water_mk2, 1), new Object[] { "BPB", "PTP", "BPB", 'B', ModItems.inf_water, 'P', ModBlocks.fluid_duct_neo, 'T', ModItems.tank_steel }); } - + //not so Temporary Crappy Recipes addRecipeAuto(new ItemStack(ModItems.piston_selenium, 1), new Object[] { "SSS", "STS", " D ", 'S', STEEL.plate(), 'T', W.ingot(), 'D', DURA.bolt() }); addShapelessAuto(new ItemStack(ModItems.catalyst_clay), new Object[] { IRON.dust(), Items.clay_ball }); @@ -676,15 +675,15 @@ public class CraftingManager { for(int i = 1; i < Fluids.getAll().length; ++i) { addShapelessAuto(new ItemStack(ModItems.fluid_duct, 1, i), new Object[] { new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModItems.fluid_identifier, 1, i) }); - - addShapelessAuto(new ItemStack(ModItems.fluid_duct, 8, i), new Object[] { new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), - new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), + + addShapelessAuto(new ItemStack(ModItems.fluid_duct, 8, i), new Object[] { new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), + new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModBlocks.fluid_duct_neo, 1), new ItemStack(ModItems.fluid_identifier, 1, i) }); - + addShapelessAuto(new ItemStack(ModItems.fluid_duct, 1, i), new Object[] { new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_identifier, 1, i) }); - - addShapelessAuto(new ItemStack(ModItems.fluid_duct, 8, i), new Object[] { new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), - new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), + + addShapelessAuto(new ItemStack(ModItems.fluid_duct, 8, i), new Object[] { new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_duct, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.fluid_identifier, 1, i) }); } @@ -714,7 +713,7 @@ public class CraftingManager { addShapelessAuto(new ItemStack(ModBlocks.sand_boron, 8), new Object[] { "sand", "sand", "sand", "sand", "sand", "sand", "sand", "sand", B.dust() }); addShapelessAuto(new ItemStack(ModBlocks.sand_lead, 8), new Object[] { "sand", "sand", "sand", "sand", "sand", "sand", "sand", "sand", PB.dust() }); addShapelessAuto(new ItemStack(ModBlocks.sand_quartz, 1), new Object[] { "sand", "sand", NETHERQUARTZ.dust(), NETHERQUARTZ.dust() }); - + addRecipeAuto(new ItemStack(ModItems.rune_blank, 1), new Object[] { "PSP", "SDS", "PSP", 'P', ModItems.powder_magic, 'S', STAR.ingot(), 'D', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID) }); addShapelessAuto(new ItemStack(ModItems.rune_isa, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity_counter_resonant }); addShapelessAuto(new ItemStack(ModItems.rune_dagaz, 1), new Object[] { ModItems.rune_blank, ModItems.powder_spark_mix, ModItems.singularity }); @@ -763,7 +762,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.upgrade_crystallizer, 1), new Object[] { "PHP", "CUC", "DTD", 'P', new ItemStack(ModItems.fluid_barrel_full, 1, Fluids.PEROXIDE.getID()), 'H', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'C', ModBlocks.barrel_steel, 'U', ModItems.upgrade_centrifuge, 'D', ModItems.motor, 'T', ModBlocks.machine_transformer }); addRecipeAuto(new ItemStack(ModItems.upgrade_screm, 1), new Object[] { "SUS", "SCS", "SUS", 'S', STEEL.plate(), 'U', ModItems.upgrade_template, 'C', ModItems.crystal_xen }); addRecipeAuto(new ItemStack(ModItems.upgrade_gc_speed, 1), new Object[] {"GNG", "RUR", "GMG", 'R', RUBBER.ingot(), 'M', ModItems.motor, 'G', ModItems.coil_gold, 'N', NB.ingot(), 'U', ModItems.upgrade_template}); - + addRecipeAuto(new ItemStack(ModItems.upgrade_stack, 1, 0), new Object[] { " C ", "PUP", " C ", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'U', ModItems.upgrade_template }); addRecipeAuto(new ItemStack(ModItems.upgrade_stack, 1, 1), new Object[] { " C ", "PUP", " C ", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CAPACITOR), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_HYDRAULIC), 'U', new ItemStack(ModItems.upgrade_stack, 1, 0) }); addRecipeAuto(new ItemStack(ModItems.upgrade_stack, 1, 2), new Object[] { " C ", "PUP", " C ", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_ELECTRIC), 'U', new ItemStack(ModItems.upgrade_stack, 1, 1) }); @@ -773,7 +772,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.mech_key, 1), new Object[] { "MCM", "MKM", "MMM", 'M', ModItems.ingot_meteorite_forged, 'C', ModItems.coin_maskman, 'K', ModItems.key }); addRecipeAuto(new ItemStack(ModItems.spawn_ufo, 1), new Object[] { "MMM", "DCD", "MMM", 'M', ModItems.ingot_meteorite, 'D', DNT.ingot(), 'C', ModItems.coin_worm }); - + addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_alloy, 1), new Object[] { "WWW", "WCW", "WWW", 'W', ALLOY.wireFine(), 'C', ModBlocks.fusion_conductor }); addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_alloy, 1), new Object[] { "WW", "WW", 'W', ALLOY.wireDense() }); addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_gold, 1), new Object[] { "PGP", "PCP", "PGP", 'G', GOLD.dust(), 'C', ModBlocks.hadron_coil_alloy, 'P', IRON.plate() }); @@ -810,7 +809,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.fireworks, 1), new Object[] { "PPP", "PPP", "WIW", 'P', Items.paper, 'W', KEY_PLANKS, 'I', IRON.ingot() }); addRecipeAuto(new ItemStack(ModItems.safety_fuse, 8), new Object[] { "SSS", "SGS", "SSS", 'S', Items.string, 'G', Items.gunpowder }); - + addRecipeAuto(new ItemStack(ModItems.rbmk_lid, 4), new Object[] { "PPP", "CCC", "PPP", 'P', STEEL.plate(), 'C', ModBlocks.concrete_asbestos }); addRecipeAuto(new ItemStack(ModItems.rbmk_lid_glass, 4), new Object[] { "LLL", "BBB", "P P", 'P', STEEL.plate(), 'L', ModBlocks.glass_lead, 'B', ModBlocks.glass_boron }); addRecipeAuto(new ItemStack(ModItems.rbmk_lid_glass, 4), new Object[] { "BBB", "LLL", "P P", 'P', STEEL.plate(), 'L', ModBlocks.glass_lead, 'B', ModBlocks.glass_boron }); @@ -893,7 +892,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.deco_pipe_rim_marked, 8), new Object[] { "PPP", "PCP", "PPP", 'P', ModBlocks.deco_pipe_rim_green, 'C', KEY_GREEN }); addRecipeAuto(new ItemStack(ModBlocks.deco_pipe_quad_marked, 8), new Object[] { "PPP", "PCP", "PPP", 'P', ModBlocks.deco_pipe_quad_green, 'C', KEY_GREEN }); addRecipeAuto(new ItemStack(ModBlocks.deco_pipe_framed_marked, 8), new Object[] { "PPP", "PCP", "PPP", 'P', ModBlocks.deco_pipe_framed_green, 'C', KEY_GREEN }); - + addRecipeAuto(new ItemStack(ModBlocks.deco_emitter), new Object[] { "IDI", "DRD", "IDI", 'I', IRON.ingot(), 'D', DIAMOND.gem(), 'R', REDSTONE.block() }); addRecipeAuto(new ItemStack(Items.name_tag), new Object[] { "SB ", "BPB", " BP", 'S', Items.string, 'B', KEY_SLIME, 'P', Items.paper }); @@ -919,20 +918,20 @@ public class CraftingManager { addShapelessAuto(ItemBattery.getEmptyBattery(ModItems.anchor_remote), new Object[] { DIAMOND.gem(), ModItems.ducttape, DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC) }); addRecipeAuto(new ItemStack(ModBlocks.teleanchor), new Object[] { "ODO", "EAE", "ODO", 'O', Blocks.obsidian, 'D', DIAMOND.gem(), 'E', ModItems.powder_magic, 'A', ModItems.gem_alexandrite }); addRecipeAuto(new ItemStack(ModBlocks.field_disturber), new Object[] { "ICI", "CAC", "ICI", 'I', STAR.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'A', ModItems.gem_alexandrite }); - + addShapelessAuto(new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_RESTORED.ordinal()), new Object[] { new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_DIGAMMA.ordinal()), KEY_TOOL_SCREWDRIVER, ModItems.ducttape, ModItems.armor_polish }); addShapelessAuto(new ItemStack(ModItems.holotape_damaged), new Object[] { DictFrame.fromOne(ModItems.holotape_image, EnumHoloImage.HOLO_RESTORED), ModItems.upgrade_muffler, ModItems.crt_display, ModItems.gem_alexandrite /* placeholder for amplifier */ }); addRecipeAuto(DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC, 4), new Object[] { " I ", "CPC", " I ", 'I', IRON.ingot(), 'C', CU.ingot(), 'P', IRON.plate() }); addRecipeAuto(DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_HYDRAULIC, 4), new Object[] { " I ", "CPC", " I ", 'I', STEEL.ingot(), 'C', TI.ingot(), 'P', Fluids.LUBRICANT.getDict(1000) }); addRecipeAuto(DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_ELECTRIC, 4), new Object[] { " I ", "CPC", " I ", 'I', ANY_RESISTANTALLOY.ingot(), 'C', ANY_PLASTIC.ingot(), 'P', ModItems.motor }); - + Object[] craneCasing = new Object[] { Blocks.stonebrick, 1, IRON.ingot(), 2, STEEL.ingot(), 4 }; - + for(int i = 0; i < craneCasing.length / 2; i++) { Object casing = craneCasing[i * 2]; int amount = (int) craneCasing[i * 2 + 1]; @@ -969,7 +968,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.drone_dock), new Object[] { "T", "C", "B", 'T', ModBlocks.drone_waypoint_request, 'C', ModBlocks.crate_steel, 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) }); addRecipeAuto(new ItemStack(ModItems.ball_resin), new Object[] { "DD", "DD", 'D', Blocks.yellow_flower }); - + addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER1), new Object[] { ModItems.ingot_chainsteel, ASBESTOS.ingot(), ModItems.gem_alexandrite }); addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER1, 3), new Object[] { DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER2) }); addShapelessAuto(DictFrame.fromOne(ModItems.parts_legendary, EnumLegendaryType.TIER2), new Object[] { ModItems.ingot_chainsteel, ModItems.ingot_bismuth, ModItems.gem_alexandrite, ModItems.gem_alexandrite }); @@ -991,19 +990,19 @@ public class CraftingManager { addShapelessAuto(new ItemStack(ModItems.ingot_firebrick, 4), new Object[] { ModBlocks.brick_fire }); addRecipeAuto(new ItemStack(ModBlocks.machine_drain), new Object[] { "PPP", "T ", "PPP", 'P', STEEL.plateCast(), 'T', ModItems.tank_steel }); - + addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, DecoCabinetEnum.STEEL.ordinal()), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer }); - + addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4), new Object[] { " I ", "IBI", " I ", 'I', ModItems.plate_polymer, 'B', ModBlocks.brick_light }); addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4, 1), new Object[] { "BB", "BB", 'B', new ItemStack(ModBlocks.vinyl_tile, 1, 0) }); addShapelessAuto(new ItemStack(ModBlocks.vinyl_tile), new Object[] { new ItemStack(ModBlocks.vinyl_tile, 1, 1) }); - + addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite }); - + addShapelessAuto(new ItemStack(ModItems.bdcl), new Object[] { ANY_TAR.any(), Fluids.WATER.getDict(1_000), KEY_WHITE }); - + addShapelessAuto(new ItemStack(ModItems.book_of_), new Object[] { DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE1), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE2), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE3), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE4), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE5), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE6), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE7), DictFrame.fromOne(ModItems.page_of_, EnumPages.PAGE8), ModItems.egg_balefire }); - + if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleCrafting) { addShapelessAuto(new ItemStack(ModItems.cordite, 3), new Object[] { ModItems.ballistite, Items.gunpowder, new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) }); addShapelessAuto(new ItemStack(ModItems.ingot_semtex, 3), new Object[] { Items.slime_ball, Blocks.tnt, KNO.dust() }); @@ -1034,10 +1033,10 @@ public class CraftingManager { for(NTMMaterial mat : Mats.orderedList) { if(mat.autogen.contains(MaterialShapes.WIRE)) for(String name : mat.names) addRecipeAuto(new ItemStack(ModItems.wire_fine, 24, mat.id), new Object[] { "###", '#', MaterialShapes.INGOT.prefixes[0] + name }); } - + addRecipeAuto(new ItemStack(ModItems.book_of_), new Object[] { "BGB", "GAG", "BGB", 'B', ModItems.egg_balefire_shard, 'G', GOLD.ingot(), 'A', Items.book }); } - + for(NTMMaterial mat : Mats.orderedList) { if(mat.autogen.contains(MaterialShapes.BOLT)) for(String name : mat.names) addRecipeAuto(new ItemStack(ModItems.bolt, 16, mat.id), new Object[] { "#", "#", '#', MaterialShapes.INGOT.prefixes[0] + name }); } @@ -1060,7 +1059,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.rbmk_heater, 1), new Object[] { "CIC", "PRP", "CIC", 'C', CU.pipe(), 'P', STEEL.shell(), 'R', ModBlocks.rbmk_blank, 'I', ANY_PLASTIC.ingot() }); addRecipeAuto(new ItemStack(ModBlocks.rbmk_cooler, 1), new Object[] { "IGI", "GCG", "IGI", 'C', ModBlocks.rbmk_blank, 'I', ModItems.plate_polymer, 'G', ModBlocks.steel_grate }); } - + addShapelessAuto(new ItemStack(ModItems.launch_code), new Object[] { new ItemStack(ModItems.launch_code_piece), new ItemStack(ModItems.launch_code_piece), new ItemStack(ModItems.launch_code_piece), new ItemStack(ModItems.launch_code_piece), @@ -1068,7 +1067,7 @@ public class CraftingManager { new ItemStack(ModItems.launch_code_piece), new ItemStack(ModItems.launch_code_piece), DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) }); - + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CHIPSET), new Object[] { ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_BIOS), ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_BUS), @@ -1078,7 +1077,7 @@ public class CraftingManager { ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_NORTH), ModItems.circuit_star_piece.stackFromEnum(ScrapType.BRIDGE_SOUTH) }); - + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CPU), new Object[] { ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_CACHE), ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_CLOCK), @@ -1087,7 +1086,7 @@ public class CraftingManager { ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_REGISTER), ModItems.circuit_star_piece.stackFromEnum(ScrapType.CPU_SOCKET) }); - + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.RAM), new Object[] { ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_SOCKET), ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_A), @@ -1095,12 +1094,12 @@ public class CraftingManager { ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_C), ModItems.circuit_star_piece.stackFromEnum(ScrapType.MEM_16K_D) }); - + addShapelessAuto(ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CARD), new Object[] { ModItems.circuit_star_piece.stackFromEnum(ScrapType.CARD_BOARD), ModItems.circuit_star_piece.stackFromEnum(ScrapType.CARD_PROCESSOR) }); - + addShapelessAuto(new ItemStack(ModItems.circuit_star), new Object[] { ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CHIPSET), ModItems.circuit_star_component.stackFromEnum(CircuitComponentType.CPU), @@ -1120,7 +1119,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 1), " I ", "IPI", " I ", 'I', ALLOY.ingot(), 'P', ALLOY.plateCast()); addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 2), " I ", "IPI", " I ", 'I', DESH.ingot(), 'P', DESH.plateCast()); addRecipeAuto(new ItemStack(ModBlocks.cm_block, 4, 3), " I ", "IPI", " I ", 'I', ANY_RESISTANTALLOY.ingot(), 'P', ANY_RESISTANTALLOY.plateCast()); - + for(int i = 0; i < 4; i++) { addRecipeAuto(new ItemStack(ModBlocks.cm_sheet, 16, i), "BB", "BB", 'B', new ItemStack(ModBlocks.cm_block, 1, i)); addRecipeAuto(new ItemStack(ModBlocks.cm_tank, 4, i), " B ", "BGB", " B ", 'B', new ItemStack(ModBlocks.cm_block, 1, i), 'G', KEY_ANYGLASS); @@ -1143,39 +1142,39 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.plushie, 1, PlushieType.YOMI.ordinal()), "LCR", 'L', "cropCarrot", 'C', ModItems.rag, 'R', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.VACUUM_TUBE)); addRecipeAuto(new ItemStack(ModBlocks.plushie, 1, PlushieType.NUMBERNINE.ordinal()), " C ", "LCR", " C ", 'L', ModItems.cigarette, 'C', ModItems.rag, 'R', COAL.gem()); } - + public static void crumple() { - + List targets = new ArrayList(); - + if(GeneralConfig.enableMekanismChanges) { - + if(Loader.isModLoaded("Mekanism")) { Block mb = (Block) Block.blockRegistry.getObject("Mekanism:MachineBlock"); Item disassembler = (Item) Item.itemRegistry.getObject("Mekanism:AtomicDisassembler"); targets.add(new ItemStack(mb, 1, 4)); // digiminer targets.add(new ItemStack(disassembler)); // atomic disassembler } - + if(Loader.isModLoaded("MekanismGenerators")) { Block mb = (Block) Block.blockRegistry.getObject("MekanismGenerators:Generator"); targets.add(new ItemStack(mb, 1, 6)); // wind turbine } - + List toDestroy = new ArrayList(); - + for(Object o : net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList()) { - + if(o instanceof IRecipe) { IRecipe rec = (IRecipe)o; ItemStack stack = rec.getRecipeOutput(); - + for(ItemStack target : targets) { if(stack != null && stack.getItem() == target.getItem() && stack.getItemDamage() == target.getItemDamage()) toDestroy.add(rec); } } } - + if(toDestroy.size() > 0) { net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList().removeAll(toDestroy); } @@ -1184,26 +1183,26 @@ public class CraftingManager { Item disassembler = (Item) Item.itemRegistry.getObject("Mekanism:AtomicDisassembler"); if(disassembler != null) addRecipeAuto(new ItemStack(disassembler, 1), "GAG", "EIE", " I ", 'G', GOLD.plateCast(), 'A', "alloyUltimate", 'E', "battery", 'I', "ingotRefinedObsidian"); } - + if(Loader.isModLoaded("MekanismGenerators")) { Block generator = (Block) Block.blockRegistry.getObject("MekanismGenerators:Generator"); if(generator != null) addRecipeAuto(new ItemStack(generator, 1, 6), " T ", "TAT", "BCB", 'T', TI.plateCast(), 'A', "alloyAdvanced", 'B', "battery", 'C', ANY_PLASTIC.ingot()); } } } - + //option 1: find every entry that needs to be ore dicted and change the recipe method by hand and commit to doing it right in the future //option 2: just make the computer do all the stupid work for us public static void addRecipeAuto(ItemStack result, Object... ins) { - + boolean shouldUseOD = false; boolean engage = false; - + for(int i = 0; i < ins.length; i++) { Object ingredient = ins[i]; - + if(ingredient instanceof String) { - + if(engage) { shouldUseOD = true; break; @@ -1212,26 +1211,26 @@ public class CraftingManager { engage = true; } } - + if(shouldUseOD) GameRegistry.addRecipe(new ShapedOreRecipe(result, ins)); else GameRegistry.addRecipe(result, ins); } - + public static void addShapelessAuto(ItemStack result, Object... ins) { - + boolean shouldUseOD = false; - + for(int i = 0; i < ins.length; i ++) { Object ingredient = ins[i]; - + if(ingredient instanceof String) { shouldUseOD = true; break; } } - + if(shouldUseOD) GameRegistry.addRecipe(new ShapelessOreRecipe(result, ins)); else diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index ad62eab77..8f818c9a0 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -17,6 +17,7 @@ import com.hbm.handler.imc.IMCBlastFurnace; import com.hbm.handler.imc.IMCCentrifuge; import com.hbm.handler.imc.IMCCrystallizer; import com.hbm.handler.imc.IMCHandler; +import com.hbm.handler.neutron.NeutronHandler; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.hazard.HazardRegistry; @@ -98,7 +99,7 @@ import java.util.Random; @Mod(modid = RefStrings.MODID, name = RefStrings.NAME, version = RefStrings.VERSION) public class MainRegistry { - + @Instance(RefStrings.MODID) public static MainRegistry instance; @@ -153,7 +154,7 @@ public class MainRegistry { public static ArmorMaterial aMatBismuth = EnumHelper.addArmorMaterial("HBM_BISMUTH", 100, new int[] { 3, 8, 6, 3 }, 100); // Creative Tabs - + public static CreativeTabs partsTab = new PartsTab(CreativeTabs.getNextID(), "tabParts"); // ingots, nuggets, wires, machine parts public static CreativeTabs controlTab = new ControlTab(CreativeTabs.getNextID(), "tabControl"); // items that belong in machines, fuels, etc public static CreativeTabs templateTab = new TemplateTab(CreativeTabs.getNextID(), "tabTemplate"); // templates, siren tracks @@ -197,7 +198,7 @@ public class MainRegistry { public static Achievement digammaKnow; public static Achievement digammaKauaiMoho; public static Achievement digammaUpOnTop; - + public static Achievement achBurnerPress; public static Achievement achBlastFurnace; public static Achievement achAssembly; @@ -229,10 +230,10 @@ public class MainRegistry { public static Achievement achBreeding; public static Achievement achFusion; public static Achievement achMeltdown; - + public static int generalOverride = 0; public static int polaroidID = 1; - + public static long startupTime = 0; public static File configDir; public static File configHbmDir; @@ -242,13 +243,13 @@ public class MainRegistry { @EventHandler public void PreLoad(FMLPreInitializationEvent PreEvent) { CrashHelper.init(); - + startupTime = System.currentTimeMillis(); configDir = PreEvent.getModConfigurationDirectory(); configHbmDir = new File(configDir.getAbsolutePath() + File.separatorChar + "hbmConfig"); if(!configHbmDir.exists()) configHbmDir.mkdir(); - + logger.info("Let us celebrate the fact that the logger finally works again!"); // Reroll Polaroid @@ -263,7 +264,7 @@ public class MainRegistry { //ShadyUtil.test(); loadConfig(PreEvent); HbmPotion.init(); - + /* For whichever fucking reason, replacing the bolt items with a bolt autogen broke all autogen items, most likely due to the load order. * This "fix" just makes sure that the material system is loaded first no matter what. */ Mats.MAT_STONE.getUnlocalizedName(); @@ -282,12 +283,12 @@ public class MainRegistry { SiegeTier.registerTiers(); HazardRegistry.registerItems(); HazardRegistry.registerTrafos(); - + OreDictManager oreMan = new OreDictManager(); MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent OreDictManager.registerGroups(); //important to run first OreDictManager.registerOres(); - + if(WorldConfig.enableCraterBiomes) BiomeGenCraterBase.initDictionary(); aMatSchrab.customCraftingMaterial = ModItems.ingot_schrabidium; @@ -315,13 +316,13 @@ public class MainRegistry { tMatDesh.setRepairItem(new ItemStack(ModItems.ingot_desh)); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GUIHandler()); - + TileMappings.writeMappings(); MachineDynConfig.initialize(); TileEntityLaunchPadBase.registerLaunchables(); - + for(Entry, String[]> e : TileMappings.map.entrySet()) { - + if(e.getValue().length == 1) GameRegistry.registerTileEntity(e.getKey(), e.getValue()[0]); else @@ -344,7 +345,7 @@ public class MainRegistry { EntityMappings.writeMappings(); //CompatNER.init(); - + ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() { @Override @@ -632,7 +633,7 @@ public class MainRegistry { private boolean dispenseSound = true; @Override protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { - + EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata()); World world = source.getWorld(); int x = source.getXInt() + facing.getFrontOffsetX(); @@ -653,7 +654,7 @@ public class MainRegistry { @EventHandler public static void load(FMLInitializationEvent event) { - + RodRecipes.registerInit(); achSacrifice = new Achievement("achievement.sacrifice", "sacrifice", -3, 1, ModItems.burnt_bark, null).initIndependentStat().setSpecial().registerStat(); @@ -672,7 +673,7 @@ public class MainRegistry { achSulfuric = new Achievement("achievement.sulfuric", "sulfuric", -10, 8, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.BALLS), achSlimeball).initIndependentStat().setSpecial().registerStat(); achInferno = new Achievement("achievement.inferno", "inferno", -8, 10, ModItems.canister_napalm, null).initIndependentStat().setSpecial().registerStat(); achRedRoom = new Achievement("achievement.redRoom", "redRoom", -10, 10, ModItems.key_red, null).initIndependentStat().setSpecial().registerStat(); - + bobHidden = new Achievement("achievement.hidden", "hidden", 15, -4, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.QUESTIONMARK), null).initIndependentStat().registerStat(); horizonsStart = new Achievement("achievement.horizonsStart", "horizonsStart", -5, 4, ModItems.sat_gerald, null).initIndependentStat().registerStat(); @@ -689,13 +690,13 @@ public class MainRegistry { achRadDeath = new Achievement("achievement.radDeath", "radDeath", 0, 6, Items.skull, achRadPoison).initIndependentStat().registerStat().setSpecial(); achSomeWounds = new Achievement("achievement.someWounds", "someWounds", -2, 10, ModItems.injector_knife, null).initIndependentStat().registerStat(); - + digammaSee = new Achievement("achievement.digammaSee", "digammaSee", -1, 8, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.DIGAMMASEE), null).initIndependentStat().registerStat(); digammaFeel = new Achievement("achievement.digammaFeel", "digammaFeel", 1, 8, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.DIGAMMAFEEL), digammaSee).initIndependentStat().registerStat(); digammaKnow = new Achievement("achievement.digammaKnow", "digammaKnow", 3, 8, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.DIGAMMAKNOW), digammaFeel).initIndependentStat().registerStat().setSpecial(); digammaKauaiMoho = new Achievement("achievement.digammaKauaiMoho", "digammaKauaiMoho", 5, 8, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.DIGAMMAKAUAIMOHO), digammaKnow).initIndependentStat().registerStat().setSpecial(); digammaUpOnTop = new Achievement("achievement.digammaUpOnTop", "digammaUpOnTop", 7, 8, DictFrame.fromOne(ModItems.achievement_icon, EnumAchievementType.DIGAMMAUPONTOP), digammaKauaiMoho).initIndependentStat().registerStat().setSpecial(); - + //progression achieves achBurnerPress = new Achievement("achievement.burnerPress", "burnerPress", 0, 0, new ItemStack(ModBlocks.machine_press), null).initIndependentStat().registerStat(); achBlastFurnace = new Achievement("achievement.blastFurnace", "blastFurnace", 1, 3, new ItemStack(ModBlocks.machine_difurnace_off), achBurnerPress).initIndependentStat().registerStat(); @@ -728,72 +729,72 @@ public class MainRegistry { achMeltdown = new Achievement("achievement.meltdown", "meltdown", 15, -7, ModItems.powder_balefire, achFusion).initIndependentStat().setSpecial().registerStat(); achRedBalloons = new Achievement("achievement.redBalloons", "redBalloons", 11, 0, ModItems.missile_nuclear, achPolymer).initIndependentStat().setSpecial().registerStat(); achManhattan = new Achievement("achievement.manhattan", "manhattan", 11, -4, new ItemStack(ModBlocks.nuke_boy), achPolymer).initIndependentStat().setSpecial().registerStat(); - + AchievementPage.registerAchievementPage(new AchievementPage("Nuclear Tech", new Achievement[] { - achSacrifice, - achImpossible, - achTOB, - achGoFish, - achPotato, - achC20_5, - achFiend, - achFiend2, - achStratum, - achOmega12, - bobHidden, - horizonsStart, - horizonsEnd, - horizonsBonus, - achRadPoison, - achRadDeath, - achNo9, - achInferno, - achRedRoom, - achSlimeball, - achSulfuric, - bossCreeper, - bossMeltdown, - bossMaskman, - bossWorm, - bossUFO, - achSomeWounds, - digammaSee, - digammaFeel, - digammaKnow, - digammaKauaiMoho, - digammaUpOnTop, - - achBurnerPress, - achBlastFurnace, - achAssembly, - achSelenium, - achChemplant, - achConcrete, - achPolymer, - achDesh, - achTantalum, - achGasCent, - achCentrifuge, - achFOEQ, - achSoyuz, - achSpace, - achSchrab, - achAcidizer, - achRadium, - achTechnetium, - achZIRNOXBoom, - achChicagoPile, - achSILEX, - achWatz, - achWatzBoom, - achRBMK, - achRBMKBoom, - achBismuth, - achBreeding, - achFusion, - achMeltdown, - achRedBalloons, - achManhattan + achSacrifice, + achImpossible, + achTOB, + achGoFish, + achPotato, + achC20_5, + achFiend, + achFiend2, + achStratum, + achOmega12, + bobHidden, + horizonsStart, + horizonsEnd, + horizonsBonus, + achRadPoison, + achRadDeath, + achNo9, + achInferno, + achRedRoom, + achSlimeball, + achSulfuric, + bossCreeper, + bossMeltdown, + bossMaskman, + bossWorm, + bossUFO, + achSomeWounds, + digammaSee, + digammaFeel, + digammaKnow, + digammaKauaiMoho, + digammaUpOnTop, + + achBurnerPress, + achBlastFurnace, + achAssembly, + achSelenium, + achChemplant, + achConcrete, + achPolymer, + achDesh, + achTantalum, + achGasCent, + achCentrifuge, + achFOEQ, + achSoyuz, + achSpace, + achSchrab, + achAcidizer, + achRadium, + achTechnetium, + achZIRNOXBoom, + achChicagoPile, + achSILEX, + achWatz, + achWatzBoom, + achRBMK, + achRBMKBoom, + achBismuth, + achBreeding, + achFusion, + achMeltdown, + achRedBalloons, + achManhattan })); // MUST be initialized AFTER achievements!! @@ -809,15 +810,15 @@ public class MainRegistry { } } } - + @EventHandler public static void initIMC(IMCEvent event) { - + ImmutableList inbox = event.getMessages(); //tee-hee - + for(IMCMessage message : inbox) { IMCHandler handler = IMCHandler.getHandler(message.key); - + if(handler != null) { MainRegistry.logger.info("Received IMC of type >" + message.key + "< from " + message.getSender() + "!"); handler.process(message); @@ -835,19 +836,19 @@ public class MainRegistry { SILEXRecipes.register(); RefineryRecipes.registerRefinery(); GasCentrifugeRecipes.register(); - + CustomMachineConfigJSON.initialize(); //the good stuff SerializableRecipe.registerAllHandlers(); SerializableRecipe.initialize(); - + //Anvil has to come after serializables (i.e. anvil) AnvilRecipes.register(); //has to register after cracking, and therefore after all serializable recipes RadiolysisRecipes.registerRadiolysis(); - + FalloutConfigJSON.initialize(); ItemPoolConfigJSON.initialize(); ClientConfig.initConfig(); @@ -878,11 +879,11 @@ public class MainRegistry { //new BiomeCave().setThreshold(1.5D).setRangeMult(20).setYLevel(40).setMaxRange(20); //new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70); BedrockOre.init(); - + Compat.handleRailcraftNonsense(); SuicideThreadDump.register(); CommandReloadClient.register(); - + //ExplosionTests.runTest(); } @@ -901,7 +902,7 @@ public class MainRegistry { FMLCommonHandler.instance().bus().register(impactHandler); MinecraftForge.EVENT_BUS.register(impactHandler); MinecraftForge.TERRAIN_GEN_BUS.register(impactHandler); - + PacketDispatcher.registerPackets(); ChunkRadiationManager radiationSystem = new ChunkRadiationManager(); @@ -914,14 +915,18 @@ public class MainRegistry { DamageResistanceHandler dmgHandler = new DamageResistanceHandler(); MinecraftForge.EVENT_BUS.register(dmgHandler); - + + NeutronHandler neutronHandler = new NeutronHandler(); + MinecraftForge.EVENT_BUS.register(neutronHandler); + FMLCommonHandler.instance().bus().register(neutronHandler); + if(event.getSide() == Side.CLIENT) { HbmKeybinds.register(); HbmKeybinds keyHandler = new HbmKeybinds(); FMLCommonHandler.instance().bus().register(keyHandler); } } - + //yes kids, this is where we would usually register commands @EventHandler public void serverStart(FMLServerStartingEvent event) { @@ -931,18 +936,19 @@ public class MainRegistry { event.registerServerCommand(new CommandDebugChunkLoad()); event.registerServerCommand(new CommandSatellites()); event.registerServerCommand(new CommandRadiation()); + event.registerServerCommand(new CommandPacketInfo()); } - + @EventHandler public void serverStart(FMLServerStartedEvent event) { - + if(GeneralConfig.enableStatReRegistering) { logger.info("Attempting to re-register item stats..."); StatHelper.resetStatShitFuck(); //shit yourself logger.info("Item stats re-registered"); } } - + private void loadConfig(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); @@ -960,30 +966,30 @@ public class MainRegistry { StructureConfig.loadFromConfig(config); config.save(); - + try { if(GeneralConfig.enableThermosPreventer && Class.forName("thermos.ThermosClassTransformer") != null) { throw new IllegalStateException("The mod tried to start on a Thermos or its fork server and therefore stopped. To allow the server to start on Thermos, change the appropriate " - + "config entry (0.00 in hbm.cfg). This was done because, by default, Thermos " - + "uses a so-called \"optimization\" feature that reduces tile ticking a lot, which will inevitably break a lot of machines. Most people aren't even aware " - + "of this, and start blaming random mods for all their stuff breaking. In order to adjust or even disable this feature, edit \"tileentities.yml\" in your " - + "Thermos install folder. If you believe that crashing the server until a config option is changed is annoying, then I would agree, but it's still preferable " - + "over wasting hours trying to fix an issue that is really just an \"intended feature\" added by Thermos itself, and not a bug in the mod. You'll have to " - + "change Thermos' config anyway so that extra change in NTM's config can't be that big of a burden."); + + "config entry (0.00 in hbm.cfg). This was done because, by default, Thermos " + + "uses a so-called \"optimization\" feature that reduces tile ticking a lot, which will inevitably break a lot of machines. Most people aren't even aware " + + "of this, and start blaming random mods for all their stuff breaking. In order to adjust or even disable this feature, edit \"tileentities.yml\" in your " + + "Thermos install folder. If you believe that crashing the server until a config option is changed is annoying, then I would agree, but it's still preferable " + + "over wasting hours trying to fix an issue that is really just an \"intended feature\" added by Thermos itself, and not a bug in the mod. You'll have to " + + "change Thermos' config anyway so that extra change in NTM's config can't be that big of a burden."); } } catch(ClassNotFoundException e) { } } - + private static HashSet ignoreMappings = new HashSet(); private static HashMap remapItems = new HashMap(); - + @EventHandler public void handleMissingMappings(FMLMissingMappingsEvent event) { - + ignoreMappings.clear(); remapItems.clear(); - + /// IGNORE /// for(int i = 1; i <= 8; i++) ignoreMappings.add("hbm:item.gasflame" + i); ignoreMappings.add("hbm:item.cyclotron_tower"); @@ -1617,15 +1623,15 @@ public class MainRegistry { ignoreMappings.add("hbm:item.casing_9"); ignoreMappings.add("hbm:item.casing_50"); ignoreMappings.add("hbm:item.casing_buckshot"); - + /// REMAP /// remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses); remapItems.put("hbm:item.man_explosive8", ModItems.explosive_lenses); remapItems.put("hbm:item.briquette_lignite", ModItems.briquette); remapItems.put("hbm:item.antiknock", ModItems.fuel_additive); - + for(MissingMapping mapping : event.get()) { - + // ignore all ammo prefixes because those are from the time we threw out all the ammo items if(mapping.name.startsWith("hbm:item.ammo_")) { mapping.ignore(); @@ -1636,9 +1642,9 @@ public class MainRegistry { mapping.ignore(); continue; } - + if(mapping.type == GameRegistry.Type.ITEM) { - + if(remapItems.get(mapping.name) != null) { mapping.remap(remapItems.get(mapping.name)); continue; diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index 7c9f208b1..9debc9d25 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -1,17 +1,6 @@ package com.hbm.main; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.logging.log4j.Level; - +import api.hbm.energymk2.Nodespace; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.hbm.blocks.IStepTickReceiver; @@ -20,10 +9,7 @@ import com.hbm.blocks.generic.BlockAshes; import com.hbm.config.GeneralConfig; import com.hbm.config.MobConfig; import com.hbm.config.RadiationConfig; -import com.hbm.entity.mob.EntityCyberCrab; -import com.hbm.entity.mob.EntityDuck; -import com.hbm.entity.mob.EntityCreeperNuclear; -import com.hbm.entity.mob.EntityQuackos; +import com.hbm.entity.mob.*; import com.hbm.entity.mob.ai.EntityAIFireGun; import com.hbm.entity.mob.EntityCreeperTainted; import com.hbm.entity.projectile.EntityBulletBaseMK4; @@ -39,16 +25,13 @@ import com.hbm.hazard.HazardSystem; import com.hbm.interfaces.IBomb; import com.hbm.handler.HTTPHandler; import com.hbm.handler.HbmKeybinds.EnumKeybind; +import com.hbm.handler.neutron.NeutronNodeWorld; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; +import com.hbm.handler.threading.PacketThreading; import com.hbm.items.IEquipReceiver; import com.hbm.items.ModItems; -import com.hbm.items.armor.ArmorFSB; -import com.hbm.items.armor.IAttackHandler; -import com.hbm.items.armor.IDamageHandler; -import com.hbm.items.armor.ItemArmorMod; -import com.hbm.items.armor.ItemModRevive; -import com.hbm.items.armor.ItemModShackles; +import com.hbm.items.armor.*; import com.hbm.items.food.ItemConserve.EnumFoodType; import com.hbm.items.tool.ItemGuideBook.BookType; import com.hbm.items.weapon.ItemGunBase; @@ -64,13 +47,12 @@ import com.hbm.particle.helper.BlackPowderCreator; import com.hbm.potion.HbmPotion; import com.hbm.saveddata.AuxSavedData; import com.hbm.tileentity.machine.TileEntityMachineRadarNT; +import com.hbm.tileentity.machine.rbmk.RBMKDials; import com.hbm.tileentity.network.RTTYSystem; import com.hbm.tileentity.network.RequestNetwork; import com.hbm.util.*; import com.hbm.util.ArmorRegistry.HazardClass; import com.hbm.world.generator.TimedGenerator; - -import api.hbm.energymk2.Nodespace; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; @@ -79,7 +61,12 @@ import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; import cpw.mods.fml.relauncher.ReflectionHelper; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.PooledByteBufAllocator; import net.minecraft.block.Block; +import net.minecraft.command.CommandGameRule; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -89,12 +76,7 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAITasks; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.monster.EntityCaveSpider; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.monster.*; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityMooshroom; @@ -117,39 +99,40 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.AnvilUpdateEvent; +import net.minecraftforge.event.CommandEvent; import net.minecraftforge.event.ServerChatEvent; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.EntityEvent.EnteringChunk; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.item.ItemTossEvent; -import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.living.*; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import net.minecraftforge.event.entity.living.LivingFallEvent; -import net.minecraftforge.event.entity.living.LivingHurtEvent; -import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; +import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.event.world.WorldEvent; +import org.apache.commons.lang3.math.NumberUtils; +import org.apache.logging.log4j.Level; + +import java.lang.reflect.Field; +import java.util.*; public class ModEventHandler { - + private static Random rand = new Random(); - + @SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { if(!event.player.worldObj.isRemote) { - + if(GeneralConfig.enableMOTD) { event.player.addChatMessage(new ChatComponentText("Loaded world with Hbm's Nuclear Tech Mod " + RefStrings.VERSION + " for Minecraft 1.7.10!")); - + if(HTTPHandler.newVersion) { event.player.addChatMessage( new ChatComponentText("New version " + HTTPHandler.versionNumber + " is available! Click ") @@ -165,14 +148,14 @@ public class ModEventHandler { ); } } - + if(MobConfig.enableDucks && event.player instanceof EntityPlayerMP && !event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("hasDucked")) PacketDispatcher.wrapper.sendTo(new PlayerInformPacket("Press O to Duck!", MainRegistry.proxy.ID_DUCK, 30_000), (EntityPlayerMP) event.player); - + if(GeneralConfig.enableGuideBook) { HbmPlayerProps props = HbmPlayerProps.getData(event.player); - + if(!props.hasReceivedBook) { event.player.inventory.addItemStackToInventory(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal())); event.player.inventoryContainer.detectAndSendChanges(); @@ -181,17 +164,17 @@ public class ModEventHandler { } } } - + @SubscribeEvent public void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) { - + EntityPlayer player = event.player; - + if((player.getUniqueID().toString().equals(ShadyUtil.Dr_Nostalgia) || player.getDisplayName().equals("Dr_Nostalgia")) && !player.worldObj.isRemote) { - + if(!player.inventory.hasItem(ModItems.hat)) player.inventory.addItemStackToInventory(new ItemStack(ModItems.hat)); - + if(!player.inventory.hasItem(ModItems.beta)) player.inventory.addItemStackToInventory(new ItemStack(ModItems.beta)); } @@ -199,18 +182,18 @@ public class ModEventHandler { @SubscribeEvent public void onEntityConstructing(EntityEvent.EntityConstructing event) { - + if(event.entity instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer) event.entity; HbmPlayerProps.getData(player); //this already calls the register method if it's null so no further action required - + if(event.entity == MainRegistry.proxy.me()) BlockAshes.ashes = 0; } - + if(event.entity instanceof EntityLivingBase) { - + EntityLivingBase living = (EntityLivingBase) event.entity; HbmLivingProps.getData(living); //ditto } @@ -223,44 +206,44 @@ public class ModEventHandler { data.setKeyPressed(EnumKeybind.JETPACK, false); data.setKeyPressed(EnumKeybind.DASH, false); } - + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onEntityDeathFirst(LivingDeathEvent event) { - + for(int i = 1; i < 5; i++) { - + ItemStack stack = event.entityLiving.getEquipmentInSlot(i); - + if(stack != null && stack.getItem() instanceof ItemArmor && ArmorModHandler.hasMods(stack)) { - + ItemStack revive = ArmorModHandler.pryMods(stack)[ArmorModHandler.extra]; - + if(revive != null) { - + //Classic revive if(revive.getItem() instanceof ItemModRevive) { revive.setItemDamage(revive.getItemDamage() + 1); - + if(revive.getItemDamage() >= revive.getMaxDamage()) { ArmorModHandler.removeMod(stack, ArmorModHandler.extra); } else { ArmorModHandler.applyMod(stack, revive); } - + event.entityLiving.setHealth(event.entityLiving.getMaxHealth()); event.entityLiving.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 99)); event.setCanceled(true); return; } - + //Shackles if(revive.getItem() instanceof ItemModShackles && HbmLivingProps.getRadiation(event.entityLiving) < 1000F) { - + revive.setItemDamage(revive.getItemDamage() + 1); - + int dmg = revive.getItemDamage(); ArmorModHandler.applyMod(stack, revive); - + event.entityLiving.setHealth(event.entityLiving.getMaxHealth()); HbmLivingProps.incrementRadiation(event.entityLiving, dmg * dmg); event.setCanceled(true); @@ -269,104 +252,104 @@ public class ModEventHandler { } } } - + } - + @SubscribeEvent public void onEntityDeath(LivingDeathEvent event) { - + HbmLivingProps.setRadiation(event.entityLiving, 0); - + if(event.entity.worldObj.isRemote) return; - + if(GeneralConfig.enableCataclysm) { EntityBurningFOEQ foeq = new EntityBurningFOEQ(event.entity.worldObj); foeq.setPositionAndRotation(event.entity.posX, 500, event.entity.posZ, 0.0F, 0.0F); event.entity.worldObj.spawnEntityInWorld(foeq); } - + if(event.entity.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) || event.entity.getCommandSenderName().equals("HbMinecraft")) { event.entity.dropItem(ModItems.book_of_, 1); } - + if(event.entity instanceof EntityCreeperTainted && event.source == ModDamageSource.boxcar) { - + for(Object o : event.entity.worldObj.getEntitiesWithinAABB(EntityPlayer.class, event.entity.boundingBox.expand(50, 50, 50))) { EntityPlayer player = (EntityPlayer)o; player.triggerAchievement(MainRegistry.bobHidden); } } - + if(!event.entityLiving.worldObj.isRemote) { - + if(event.source instanceof EntityDamageSource && ((EntityDamageSource)event.source).getEntity() instanceof EntityPlayer && !(((EntityDamageSource)event.source).getEntity() instanceof FakePlayer)) { - + if(event.entityLiving instanceof EntitySpider && event.entityLiving.getRNG().nextInt(500) == 0) { event.entityLiving.dropItem(ModItems.spider_milk, 1); } - + if(event.entityLiving instanceof EntityCaveSpider && event.entityLiving.getRNG().nextInt(100) == 0) { event.entityLiving.dropItem(ModItems.serum, 1); } - + if(event.entityLiving instanceof EntityAnimal && event.entityLiving.getRNG().nextInt(500) == 0) { event.entityLiving.dropItem(ModItems.bandaid, 1); } - + if(event.entityLiving instanceof IMob) { if(event.entityLiving.getRNG().nextInt(1000) == 0) event.entityLiving.dropItem(ModItems.heart_piece, 1); if(event.entityLiving.getRNG().nextInt(250) == 0) event.entityLiving.dropItem(ModItems.key_red_cracked, 1); if(event.entityLiving.getRNG().nextInt(250) == 0) event.entityLiving.dropItem(ModItems.launch_code_piece, 1); } - + if(event.entityLiving instanceof EntityCyberCrab && event.entityLiving.getRNG().nextInt(500) == 0) { event.entityLiving.dropItem(ModItems.wd40, 1); } } } } - + @SubscribeEvent(priority = EventPriority.LOWEST) public void onEntityDeathLast(LivingDeathEvent event) { - + if(event.entityLiving instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer) event.entityLiving; - + for(int i = 0; i < player.inventory.getSizeInventory(); i++) { - + ItemStack stack = player.inventory.getStackInSlot(i); - + if(stack != null && stack.getItem() == ModItems.detonator_deadman) { - + if(stack.stackTagCompound != null) { - + int x = stack.stackTagCompound.getInteger("x"); int y = stack.stackTagCompound.getInteger("y"); int z = stack.stackTagCompound.getInteger("z"); if(!player.worldObj.isRemote && player.worldObj.getBlock(x, y, z) instanceof IBomb) { - + ((IBomb) player.worldObj.getBlock(x, y, z)).explode(player.worldObj, x, y, z); - + if(GeneralConfig.enableExtendedLogging) MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by dead man's switch from " + player.getDisplayName() + "!"); } - + player.inventory.setInventorySlotContents(i, null); } } } } } - + @SubscribeEvent public void decorateMob(LivingSpawnEvent event) { EntityLivingBase entity = event.entityLiving; World world = event.world; - + if(!MobConfig.enableMobGear || entity.isChild() || world.isRemote) return; @@ -385,7 +368,7 @@ public class ModEventHandler { entity.setCurrentItemOrArmor(4, new ItemStack(ModItems.mask_of_infamy, 1, world.rand.nextInt(100))); if(rand.nextInt(1024) == 0) entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.starmetal_plate, 1, world.rand.nextInt(ModItems.starmetal_plate.getMaxDamage()))); - + if(rand.nextInt(128) == 0) entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.pipe_lead, 1, world.rand.nextInt(100))); if(rand.nextInt(128) == 0) @@ -413,7 +396,7 @@ public class ModEventHandler { } if(rand.nextInt(64) == 0) entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.steel_plate, 1, world.rand.nextInt(ModItems.steel_plate.getMaxDamage()))); - + float soot = PollutionHandler.getPollution(entity.worldObj, MathHelper.floor_double(event.x), MathHelper.floor_double(event.y), MathHelper.floor_double(event.z), PollutionType.SOOT); ItemStack bowReplacement = getSkelegun(soot, entity.worldObj.rand); if(bowReplacement != null) { @@ -459,7 +442,7 @@ public class ModEventHandler { entity.tasks.addTask(3, new EntityAIFireGun(entity)); } - + @SubscribeEvent public void addAITasks(EntityJoinWorldEvent event) { if(event.world.isRemote || !(event.entity instanceof EntityLiving)) return; @@ -471,96 +454,96 @@ public class ModEventHandler { addFireTask(living); } } - + @SubscribeEvent public void onItemToss(ItemTossEvent event) { - + ItemStack yeet = event.entityItem.getEntityItem(); - + if(yeet.getItem() instanceof ItemArmor && ArmorModHandler.hasMods(yeet)) { - + ItemStack[] mods = ArmorModHandler.pryMods(yeet); ItemStack cladding = mods[ArmorModHandler.cladding]; - + if(cladding != null && cladding.getItem() == ModItems.cladding_obsidian) { ReflectionHelper.setPrivateValue(Entity.class, event.entityItem, true, "field_149119_a", "field_83001_bt", "field_149500_a", "invulnerable"); } } - + if(yeet.getItem() == ModItems.bismuth_tool) { ReflectionHelper.setPrivateValue(Entity.class, event.entityItem, true, "field_149119_a", "field_83001_bt", "field_149500_a", "invulnerable"); } } - + @SubscribeEvent public void onLivingDrop(LivingDropsEvent event) { - + if(!event.entityLiving.worldObj.isRemote) { boolean contaminated = HbmLivingProps.getContagion(event.entityLiving) > 0; - + if(contaminated) { - + for(EntityItem item : event.drops) { ItemStack stack = item.getEntityItem(); - + if(!stack.hasTagCompound()) { stack.stackTagCompound = new NBTTagCompound(); } - + stack.stackTagCompound.setBoolean("ntmContagion", true); } } } } - + @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { - + ItemStack[] prevArmor = event.entityLiving.previousEquipment; - if(event.entityLiving instanceof EntityPlayer && prevArmor != null && event.entityLiving.getHeldItem() != null + if(event.entityLiving instanceof EntityPlayer && prevArmor != null && event.entityLiving.getHeldItem() != null && (prevArmor[0] == null || prevArmor[0].getItem() != event.entityLiving.getHeldItem().getItem()) && event.entityLiving.getHeldItem().getItem() instanceof IEquipReceiver) { ((IEquipReceiver)event.entityLiving.getHeldItem().getItem()).onEquip((EntityPlayer) event.entityLiving, event.entityLiving.getHeldItem()); } - + for(int i = 1; i < 5; i++) { - + ItemStack prev = prevArmor != null ? prevArmor[i] : null; ItemStack armor = event.entityLiving.getEquipmentInSlot(i); - + boolean reapply = prevArmor != null && !ItemStack.areItemStacksEqual(prev, armor); - + if(reapply) { - + if(prev != null && ArmorModHandler.hasMods(prev)) { - + for(ItemStack mod : ArmorModHandler.pryMods(prev)) { - + if(mod != null && mod.getItem() instanceof ItemArmorMod) { - + Multimap map = ((ItemArmorMod)mod.getItem()).getModifiers(prev); - + if(map != null) event.entityLiving.getAttributeMap().removeAttributeModifiers(map); } } } } - + if(armor != null && ArmorModHandler.hasMods(armor)) { - + for(ItemStack mod : ArmorModHandler.pryMods(armor)) { - + if(mod != null && mod.getItem() instanceof ItemArmorMod) { ((ItemArmorMod)mod.getItem()).modUpdate(event.entityLiving, armor); HazardSystem.applyHazards(mod, event.entityLiving); - + if(reapply) { - + Multimap map = ((ItemArmorMod)mod.getItem()).getModifiers(armor); - + if(map != null) event.entityLiving.getAttributeMap().applyAttributeModifiers(map); } @@ -568,28 +551,34 @@ public class ModEventHandler { } } } - + EntityEffectHandler.onUpdate(event.entityLiving); - + if(!event.entity.worldObj.isRemote && !(event.entityLiving instanceof EntityPlayer)) { HazardSystem.updateLivingInventory(event.entityLiving); } } - + @SubscribeEvent(priority = EventPriority.LOWEST) public void onLoad(WorldEvent.Load event) { BobmazonOfferFactory.init(); } - + + @SubscribeEvent + public void onUnload(WorldEvent.Unload event) { + NeutronNodeWorld.removeAllWorlds(); // Remove world from worlds when unloaded to avoid world issues. + NeutronNodeWorld.removeAllNodes(); // Remove all nodes. + } + public static boolean didSit = false; public static Field reference = null; - + @SubscribeEvent public void worldTick(WorldTickEvent event) { - + /// RADIATION STUFF START /// if(event.world != null && !event.world.isRemote) { - + if(reference != null) { for(Object player : event.world.playerEntities) { if(((EntityPlayer) player).ridingEntity != null) { didSit = true; } @@ -598,37 +587,37 @@ public class ModEventHandler { try { reference.setFloat(null, (float) (rand.nextGaussian() * 0.1 + Math.PI)); } catch(Throwable e) { } } } - + int thunder = AuxSavedData.getThunder(event.world); - + if(thunder > 0) AuxSavedData.setThunder(event.world, thunder - 1); - + if(!event.world.loadedEntityList.isEmpty()) { - + List oList = new ArrayList(); oList.addAll(event.world.loadedEntityList); - + /** * REMOVE THIS V V V */ for(Object e : oList) { if(e instanceof EntityLivingBase) { - + //effect for radiation EntityLivingBase entity = (EntityLivingBase) e; - + if(entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode) continue; - + float eRad = HbmLivingProps.getRadiation(entity); - + if(entity.getClass().equals(EntityCreeper.class) && eRad >= 200 && entity.getHealth() > 0) { - + if(event.world.rand.nextInt(3) == 0 ) { EntityCreeperNuclear creep = new EntityCreeperNuclear(event.world); creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); - + if(!entity.isDead) if(!event.world.isRemote) event.world.spawnEntityInWorld(creep); @@ -637,7 +626,7 @@ public class ModEventHandler { entity.attackEntityFrom(ModDamageSource.radiation, 100F); } continue; - + } else if(entity instanceof EntityCow && !(entity instanceof EntityMooshroom) && eRad >= 50) { EntityMooshroom creep = new EntityMooshroom(event.world); creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); @@ -647,47 +636,47 @@ public class ModEventHandler { event.world.spawnEntityInWorld(creep); entity.setDead(); continue; - + } else if(entity instanceof EntityVillager && eRad >= 500) { EntityZombie creep = new EntityZombie(event.world); creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); - + if(!entity.isDead) if(!event.world.isRemote) event.world.spawnEntityInWorld(creep); entity.setDead(); continue; } else if(entity.getClass().equals(EntityDuck.class) && eRad >= 200) { - + EntityQuackos quacc = new EntityQuackos(event.world); quacc.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); - + if(!entity.isDead && !event.world.isRemote) event.world.spawnEntityInWorld(quacc); - + entity.setDead(); continue; } - + if(eRad < 200 || ContaminationUtil.isRadImmune(entity)) continue; - + if(eRad > 2500) HbmLivingProps.setRadiation(entity, 2500); - + if(eRad >= 1000) { entity.attackEntityFrom(ModDamageSource.radiation, 1000F); HbmLivingProps.setRadiation(entity, 0); - + if(entity.getHealth() > 0) { entity.setHealth(0); entity.onDeath(ModDamageSource.radiation); } - + if(entity instanceof EntityPlayer) ((EntityPlayer)entity).triggerAchievement(MainRegistry.achRadDeath); - + } else if(eRad >= 800) { if(event.world.rand.nextInt(300) == 0) entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 30, 0)); @@ -699,7 +688,7 @@ public class ModEventHandler { entity.addPotionEffect(new PotionEffect(Potion.poison.id, 3 * 20, 2)); if(event.world.rand.nextInt(700) == 0) entity.addPotionEffect(new PotionEffect(Potion.wither.id, 3 * 20, 1)); - + } else if(eRad >= 600) { if(event.world.rand.nextInt(300) == 0) entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 30, 0)); @@ -709,7 +698,7 @@ public class ModEventHandler { entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 10 * 20, 2)); if(event.world.rand.nextInt(500) == 0) entity.addPotionEffect(new PotionEffect(Potion.poison.id, 3 * 20, 1)); - + } else if(eRad >= 400) { if(event.world.rand.nextInt(300) == 0) entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 30, 0)); @@ -717,18 +706,18 @@ public class ModEventHandler { entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5 * 20, 0)); if(event.world.rand.nextInt(300) == 0) entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5 * 20, 1)); - + } else if(eRad >= 200) { if(event.world.rand.nextInt(300) == 0) entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 5 * 20, 0)); if(event.world.rand.nextInt(500) == 0) entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 5 * 20, 0)); - + if(entity instanceof EntityPlayer) ((EntityPlayer)entity).triggerAchievement(MainRegistry.achRadPoison); } } - + if(e instanceof EntityItem) { EntityItem item = (EntityItem) e; HazardSystem.updateDroppedItem(item); @@ -739,36 +728,36 @@ public class ModEventHandler { */ } /// RADIATION STUFF END /// - - + + if(event.phase == Phase.END) { EntityRailCarBase.updateMotion(event.world); } } - + if(event.phase == Phase.START) { BossSpawnHandler.rollTheDice(event.world); TimedGenerator.automaton(event.world, 100); } } - + @SubscribeEvent public void onEntityAttacked(LivingAttackEvent event) { - + EntityLivingBase e = event.entityLiving; if(e instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer) e; - + if(ArmorUtil.checkArmor(player, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots)) { HbmPlayerProps.plink(player, "random.break", 0.5F, 1.0F + e.getRNG().nextFloat() * 0.5F); event.setCanceled(true); } - + if(player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof ArmorFSB) ((ArmorFSB)player.inventory.armorInventory[2].getItem()).handleAttack(event); - + for(ItemStack stack : player.inventory.armorInventory) { if(stack != null && stack.getItem() instanceof IAttackHandler) { ((IAttackHandler)stack.getItem()).handleAttack(event, stack); @@ -776,16 +765,16 @@ public class ModEventHandler { } } } - + @SubscribeEvent public void onEntityDamaged(LivingHurtEvent event) { - + EntityLivingBase e = event.entityLiving; - + if(e instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer) e; - + HbmPlayerProps props = HbmPlayerProps.getData(player); if(props.shield > 0) { float reduce = Math.min(props.shield, event.ammount); @@ -794,35 +783,35 @@ public class ModEventHandler { } props.lastDamage = player.ticksExisted; } - + if(HbmLivingProps.getContagion(e) > 0 && event.ammount < 100) event.ammount *= 2F; - + /// ARMOR MODS /// for(int i = 1; i < 5; i++) { - + ItemStack armor = e.getEquipmentInSlot(i); - + if(armor != null && ArmorModHandler.hasMods(armor)) { - + for(ItemStack mod : ArmorModHandler.pryMods(armor)) { - + if(mod != null && mod.getItem() instanceof ItemArmorMod) { ((ItemArmorMod)mod.getItem()).modDamage(event, armor); } } } } - + if(e instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer) e; - + /// FSB ARMOR /// if(player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof ArmorFSB) ((ArmorFSB)player.inventory.armorInventory[2].getItem()).handleHurt(event); - - + + for(ItemStack stack : player.inventory.armorInventory) { if(stack != null && stack.getItem() instanceof IDamageHandler) { ((IDamageHandler)stack.getItem()).handleDamage(event, stack); @@ -830,108 +819,108 @@ public class ModEventHandler { } } } - + @SubscribeEvent public void onPlayerFall(PlayerFlyableFallEvent event) { - + EntityPlayer e = event.entityPlayer; - + if(e.inventory.armorInventory[2] != null && e.inventory.armorInventory[2].getItem() instanceof ArmorFSB) ((ArmorFSB)e.inventory.armorInventory[2].getItem()).handleFall(e); } - + // only for the ballistic gauntlet! contains dangerous conditional returns! @SubscribeEvent public void onPlayerPunch(AttackEntityEvent event) { - + EntityPlayer player = event.entityPlayer; ItemStack chestplate = player.inventory.armorInventory[2]; - + if(!player.worldObj.isRemote && chestplate != null && ArmorModHandler.hasMods(chestplate)) { - + if(player.getHeldItem() != null && player.getHeldItem().getAttributeModifiers().containsKey(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName())) return; - + ItemStack[] mods = ArmorModHandler.pryMods(chestplate); ItemStack servo = mods[ArmorModHandler.servos]; - + if(servo != null && servo.getItem() == ModItems.ballistic_gauntlet) { - + BulletConfig firedConfig = null; BulletConfig[] gauntletConfigs = new BulletConfig[] {XFactory12ga.g12_bp, XFactory12ga.g12_bp_magnum, XFactory12ga.g12_bp_slug, XFactory12ga.g12, XFactory12ga.g12_slug, XFactory12ga.g12_flechette, XFactory12ga.g12_magnum, XFactory12ga.g12_explosive, XFactory12ga.g12_phosphorus}; for(BulletConfig config : gauntletConfigs) { - + if(InventoryUtil.doesPlayerHaveAStack(player, config.ammo, true, true)) { firedConfig = config; break; } } - + if(firedConfig != null) { int bullets = firedConfig.projectilesMin; - + if(firedConfig.projectilesMax > firedConfig.projectilesMin) { bullets += player.getRNG().nextInt(firedConfig.projectilesMax - firedConfig.projectilesMin); } - + for(int i = 0; i < bullets; i++) { EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(player, firedConfig, 15F, 0F, -0.1875, -0.0625, 0.5); player.worldObj.spawnEntityInWorld(mk4); if(i == 0 && firedConfig.blackPowder) BlackPowderCreator.composeEffect(player.worldObj, mk4.posX, mk4.posY, mk4.posZ, mk4.motionX, mk4.motionY, mk4.motionZ, 10, 0.25F, 0.5F, 10, 0.25F); } - + player.worldObj.playSoundAtEntity(player, "hbm:weapon.shotgunShoot", 1.0F, 1.0F); } } } } - + @SubscribeEvent public void onEntityJump(LivingJumpEvent event) { - + EntityLivingBase e = event.entityLiving; - + if(e instanceof EntityPlayer && ((EntityPlayer)e).inventory.armorInventory[2] != null && ((EntityPlayer)e).inventory.armorInventory[2].getItem() instanceof ArmorFSB) ((ArmorFSB)((EntityPlayer)e).inventory.armorInventory[2].getItem()).handleJump((EntityPlayer)e); } - + @SubscribeEvent public void onEntityFall(LivingFallEvent event) { - + EntityLivingBase e = event.entityLiving; - + if(e instanceof EntityPlayer && ((EntityPlayer)e).inventory.armorInventory[2] != null && ((EntityPlayer)e).inventory.armorInventory[2].getItem() instanceof ArmorFSB) ((ArmorFSB)((EntityPlayer)e).inventory.armorInventory[2].getItem()).handleFall((EntityPlayer)e); } - + private static final UUID fopSpeed = UUID.fromString("e5a8c95d-c7a0-4ecf-8126-76fb8c949389"); - + @SubscribeEvent public void onWingFlop(TickEvent.PlayerTickEvent event) { EntityPlayer player = event.player; - + if(event.phase == TickEvent.Phase.START) { - + if(player.getCurrentArmor(2) == null && !player.onGround) { - + if(player.getUniqueID().toString().equals(ShadyUtil.Barnaby99_x) || player.getDisplayName().equals("pheo7")) { ArmorUtil.resetFlightTime(player); HbmPlayerProps props = HbmPlayerProps.getData(player); - + if(props.isJetpackActive()) { - + if(player.motionY < 0.4D) player.motionY += 0.1D; - + Vec3 look = player.getLookVec(); - + if(Vec3.createVectorHelper(player.motionX, player.motionY, player.motionZ).lengthVector() < 2) { player.motionX += look.xCoord * 0.2; player.motionY += look.yCoord * 0.2; player.motionZ += look.zCoord * 0.2; - + if(look.yCoord > 0) player.fallDistance = 0; } @@ -940,42 +929,42 @@ public class ModEventHandler { if(player.fallDistance > 0) player.fallDistance = 0; } } - + boolean isBob = player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) || player.getDisplayName().equals("HbMinecraft"); boolean isOther = player.getUniqueID().toString().equals(ShadyUtil.the_NCR) || player.getDisplayName().equals("the_NCR"); - + if(isBob || isOther) { - + ArmorUtil.resetFlightTime(player); - + if(player.fallDistance > 0) player.fallDistance = 0; - + if(player.motionY < -0.4D) player.motionY = -0.4D; - + HbmPlayerProps props = HbmPlayerProps.getData(player); - + if(isBob || player.getFoodStats().getFoodLevel() > 6) { - + if(props.isJetpackActive()) { - + double cap = (isBob ? 0.8D : 0.4D); - + if(player.motionY < cap) player.motionY += 0.15D; else player.motionY = cap + 0.15D; - + if(isOther) { if(player.getFoodStats().getSaturationLevel() > 0F) player.addExhaustion(4F); //burn up saturation so that super-saturating foods have no effect else player.addExhaustion(0.2F); //4:1 -> 0.05 hunger per tick or 1 per second } - + } else if(props.enableBackpack && !player.isSneaking()) { - + if(player.motionY < -1) player.motionY += 0.4D; else if(player.motionY < -0.1) @@ -989,35 +978,35 @@ public class ModEventHandler { else player.addExhaustion(0.04F); } - + } else if(!props.enableBackpack && player.isSneaking()) { - + if(player.motionY < -0.08) { - + double mo = player.motionY * (isBob ? -0.6 : -0.4); player.motionY += mo; - + Vec3 vec = player.getLookVec(); vec.xCoord *= mo; vec.yCoord *= mo; vec.zCoord *= mo; - + player.motionX += vec.xCoord; player.motionY += vec.yCoord; player.motionZ += vec.zCoord; } } } - + Vec3 orig = player.getLookVec(); Vec3 look = Vec3.createVectorHelper(orig.xCoord, 0, orig.zCoord).normalize(); double mod = props.enableBackpack ? (isBob ? 0.5D : 0.25D) : 0.125D; - + if(player.moveForward != 0) { player.motionX += look.xCoord * 0.35 * player.moveForward * mod; player.motionZ += look.zCoord * 0.35 * player.moveForward * mod; } - + if(player.moveStrafing != 0) { look.rotateAroundY((float) Math.PI * 0.5F); player.motionX += look.xCoord * 0.15 * player.moveStrafing * mod; @@ -1025,65 +1014,65 @@ public class ModEventHandler { } } } - + if(player.getUniqueID().toString().equals(ShadyUtil.LePeeperSauvage) || player.getDisplayName().equals("LePeeperSauvage")) { - + Multimap multimap = HashMultimap.create(); multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(fopSpeed, "FOP SPEED", 0.5, 1)); player.getAttributeMap().removeAttributeModifiers(multimap); - + if(player.isSprinting()) { player.getAttributeMap().applyAttributeModifiers(multimap); } } } } - + @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { - + EntityPlayer player = event.player; - + if(player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof ArmorFSB) ((ArmorFSB)player.inventory.armorInventory[2].getItem()).handleTick(event); - + if(player.ticksExisted == 100 || player.ticksExisted == 200) CraftingManager.crumple(); - + if(event.phase == TickEvent.Phase.START) { int x = MathHelper.floor_double(player.posX); int y = MathHelper.floor_double(player.posY - player.yOffset - 0.01); int z = MathHelper.floor_double(player.posZ); Block b = player.worldObj.getBlock(x, y, z); - + if(b instanceof IStepTickReceiver && !player.capabilities.isFlying) { IStepTickReceiver step = (IStepTickReceiver) b; step.onPlayerStep(player.worldObj, x, y, z, player); } } - + if(!player.worldObj.isRemote && event.phase == TickEvent.Phase.START) { - + /// GHOST FIX START /// - + if(!Float.isFinite(player.getHealth()) || !Float.isFinite(player.getAbsorptionAmount())) { player.addChatComponentMessage(new ChatComponentText("Your health has been restored!")); player.worldObj.playSoundAtEntity(player, "hbm:item.syringe", 1.0F, 1.0F); player.setHealth(player.getMaxHealth()); player.setAbsorptionAmount(0); } - + /// GHOST FIX END /// - + /// BETA HEALTH START /// if(player.inventory.hasItem(ModItems.beta)) { - + if(player.getFoodStats().getFoodLevel() > 10) { player.heal(player.getFoodStats().getFoodLevel() - 10); } - + if(player.getFoodStats().getFoodLevel() != 10) { - + // Why can't you be normal?? try { Field food = ReflectionHelper.findField(FoodStats.class, "field_75127_a", "foodLevel"); @@ -1094,27 +1083,27 @@ public class ModEventHandler { /// BETA HEALTH END /// /// PU RADIATION START /// - + if(player.getUniqueID().toString().equals(ShadyUtil.Pu_238)) { - + List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, player.boundingBox.expand(3, 3, 3)); - + for(EntityLivingBase e : entities) { - + if(e != player) { e.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 300, 2)); } } } - + /// PU RADIATION END /// - + /*if(player instanceof EntityPlayerMP) { int x = (int) Math.floor(player.posX); int y = (int) Math.floor(player.posY - 0.01); int z = (int) Math.floor(player.posZ); - + if(player.worldObj.getTileEntity(x, y, z) instanceof IEnergyConductor) { PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(((IEnergyConductor) player.worldObj.getTileEntity(x, y, z)).getPowerNet() + ""), (EntityPlayerMP) player); } @@ -1123,46 +1112,46 @@ public class ModEventHandler { /// NEW ITEM SYS START /// HazardSystem.updatePlayerInventory(player); /// NEW ITEM SYS END /// - + /// SYNC START /// if(!player.worldObj.isRemote && player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new PermaSyncPacket((EntityPlayerMP) player), (EntityPlayerMP) player); /// SYNC END /// } if(player.worldObj.isRemote && event.phase == event.phase.START && !player.isInvisible() && !player.isSneaking()) { - + if(player.getUniqueID().toString().equals(ShadyUtil.Pu_238)) { - + Vec3 vec = Vec3.createVectorHelper(3 * rand.nextDouble(), 0, 0); vec.rotateAroundZ((float) (rand.nextDouble() * Math.PI)); vec.rotateAroundY((float) (rand.nextDouble() * Math.PI * 2)); player.worldObj.spawnParticle("townaura", player.posX + vec.xCoord, player.posY + 1 + vec.yCoord, player.posZ + vec.zCoord, 0.0, 0.0, 0.0); } } - + // OREDBG /*if(!event.player.worldObj.isRemote) { for(BedrockOreType type : BedrockOreType.values()) { PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(StatCollector.translateToLocalFormatted("item.bedrock_ore.type." + type.suffix + ".name") + ": " + ((int) (ItemBedrockOreBase.getOreLevel((int) Math.floor(player.posX), (int) Math.floor(player.posZ), type) * 100) / 100D), 777 + type.ordinal()), (EntityPlayerMP) player); } }*/ - + // PRISMDBG /*if(!event.player.worldObj.isRemote) { ChunkRadiationHandlerPRISM prism = (ChunkRadiationHandlerPRISM) ChunkRadiationManager.proxy; - + RadPerWorld perWorld = prism.perWorld.get(player.worldObj); - + if(perWorld != null) { SubChunk[] chunk = perWorld.radiation.get(new ChunkCoordIntPair(((int) Math.floor(player.posX)) >> 4, ((int) Math.floor(player.posZ)) >> 4)); - + if(chunk != null) { - + int y = ((int) Math.floor(player.posY)) >> 4; - + if(y >= 0 && y <= 15) { SubChunk sub = chunk[y]; - + if(sub != null) { float xSum = 0, ySum = 0, zSum = 0; for(int i = 0; i < 16; i++) { @@ -1186,21 +1175,54 @@ public class ModEventHandler { } }*/ } - + @SubscribeEvent public void onServerTick(TickEvent.ServerTickEvent event) { - - if(event.phase == event.phase.START) { + + if(event.phase == Phase.START) { + + // do other shit I guess? RTTYSystem.updateBroadcastQueue(); RequestNetwork.updateEntries(); TileEntityMachineRadarNT.updateSystem(); Nodespace.updateNodespace(); + // bob i beg of you i need fluid nodespace :pray: + } + + // There is an issue here somewhere... + // I cannot, for the life of me, figure out why a single certain bug happens. + // Every 20-30 or so ticks, players will receive wrong/outdated/weird information in packets + // I have tried everything to see if I can get this to stop, but it just doesn't seem to work. + + // ^ Update ^ - I figured it out, when the packets were being made for some machines they were being created inside the thread, + // meaning sometimes the machine would change data *after* the packet was supposed to be sent, meaning incorrect data was being sent. + // This has since been fixed. + + if(event.phase == Phase.END) { + // As ByteBufs are added to the queue in `com.hbm.packet.toclient.PacketThreading`, they are processed by the packet thread. + // This waits until the thread is finished, which most of the time will be instantly since it has plenty of time to process in parallel to everything else. + PacketThreading.waitUntilThreadFinished(); + + NetworkHandler.flush(); // Flush ALL network packets. } } - + + @SubscribeEvent + public void commandEvent(CommandEvent event) { + ICommand command = event.command; + ICommandSender sender = event.sender; + if(command instanceof CommandGameRule) { + if(command.canCommandSenderUseCommand(sender)) { + command.processCommand(sender,event.parameters); + RBMKDials.refresh(sender.getEntityWorld()); // Refresh RBMK gamerules. + event.setCanceled(true); + } + } + } + @SubscribeEvent public void enteringChunk(EnteringChunk evt) { - + /*if(evt.entity instanceof EntityMissileBaseNT) { ((EntityMissileBaseNT) evt.entity).loadNeighboringChunks(evt.newChunkX, evt.newChunkZ); } @@ -1209,41 +1231,42 @@ public class ModEventHandler { ((EntityMissileCustom) evt.entity).loadNeighboringChunks(evt.newChunkX, evt.newChunkZ); }*/ } - + @SubscribeEvent public void onPlayerClone(net.minecraftforge.event.entity.player.PlayerEvent.Clone event) { - - NBTTagCompound data = new NBTTagCompound(); - HbmPlayerProps.getData(event.original).saveNBTData(data); - HbmPlayerProps.getData(event.entityPlayer).loadNBTData(data); + + ByteBuf buf = PooledByteBufAllocator.DEFAULT.buffer(); + HbmPlayerProps.getData(event.original).serialize(buf); + HbmPlayerProps.getData(event.entityPlayer).deserialize(buf); + buf.release(); } - + @SubscribeEvent public void itemCrafted(PlayerEvent.ItemCraftedEvent e) { AchievementHandler.fire(e.player, e.crafting); } - + @SubscribeEvent public void itemSmelted(PlayerEvent.ItemSmeltedEvent e) { AchievementHandler.fire(e.player, e.smelting); - + if(!e.player.worldObj.isRemote && e.smelting.getItem() == Items.iron_ingot && e.player.getRNG().nextInt(64) == 0) { - + if(!e.player.inventory.addItemStackToInventory(new ItemStack(ModItems.lodestone))) e.player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.lodestone), false); else e.player.inventoryContainer.detectAndSendChanges(); } - + if(!e.player.worldObj.isRemote && e.smelting.getItem() == ModItems.ingot_uranium && e.player.getRNG().nextInt(64) == 0) { - + if(!e.player.inventory.addItemStackToInventory(new ItemStack(ModItems.quartz_plutonium))) e.player.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.quartz_plutonium), false); else e.player.inventoryContainer.detectAndSendChanges(); } } - + @SubscribeEvent public void onItemPickup(PlayerEvent.ItemPickupEvent event) { if(event.pickedUp.getEntityItem().getItem() == ModItems.canned_conserve && EnumUtil.grabEnumSafely(EnumFoodType.class, event.pickedUp.getEntityItem().getItemDamage()) == EnumFoodType.JIZZ) @@ -1251,40 +1274,40 @@ public class ModEventHandler { if(event.pickedUp.getEntityItem().getItem() == Items.slime_ball) event.player.triggerAchievement(MainRegistry.achSlimeball); } - + @SubscribeEvent public void onBlockBreak(BreakEvent event) { - + EntityPlayer player = event.getPlayer(); - + if(!(player instanceof EntityPlayerMP)) return; - + if(event.block == ModBlocks.stone_gneiss && !((EntityPlayerMP) player).func_147099_x().hasAchievementUnlocked(MainRegistry.achStratum)) { event.getPlayer().triggerAchievement(MainRegistry.achStratum); event.setExpToDrop(500); } - + if(event.block == Blocks.coal_ore || event.block == Blocks.coal_block || event.block == ModBlocks.ore_lignite) { - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { int x = event.x + dir.offsetX; int y = event.y + dir.offsetY; int z = event.z + dir.offsetZ; - + if(event.world.rand.nextInt(2) == 0 && event.world.getBlock(x, y, z) == Blocks.air) event.world.setBlock(x, y, z, ModBlocks.gas_coal); } } - + if(RadiationConfig.enablePollution && RadiationConfig.enableLeadFromBlocks) { if(!ArmorRegistry.hasProtection(player, 3, HazardClass.PARTICLE_FINE)) { - + float metal = PollutionHandler.getPollution(player.worldObj, event.x, event.y, event.z, PollutionType.HEAVYMETAL); - + if(metal < 5) return; - + if(metal < 10) { player.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 100, 0)); } else if(metal < 25) { @@ -1295,7 +1318,7 @@ public class ModEventHandler { } } } - + @SubscribeEvent public void onClickSign(PlayerInteractEvent event) { @@ -1303,13 +1326,13 @@ public class ModEventHandler { int y = event.y; int z = event.z; World world = event.world; - + if(!world.isRemote && event.action == Action.RIGHT_CLICK_BLOCK && world.getTileEntity(x, y, z) instanceof TileEntitySign) { - + TileEntitySign sign = (TileEntitySign)world.getTileEntity(x, y, z); - + String result = ShadyUtil.smoosh(sign.signText[0], sign.signText[1], sign.signText[2], sign.signText[3]); - + if(ShadyUtil.hashes.contains(result)) { world.func_147480_a(x, y, z, false); EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(ModItems.bobmazon_hidden)); @@ -1318,22 +1341,22 @@ public class ModEventHandler { } } } - + @SubscribeEvent public void chatEvent(ServerChatEvent event) { - + EntityPlayerMP player = event.player; String message = event.message; - + //boolean conditions for the illiterate, edition 1 //bellow you can see the header of an if-block. inside the brackets, there is a boolean statement. //that means nothing other than its value totaling either 'true' or 'false' //examples: 'true' would just mean true //'1 > 3' would equal false //'i < 10' would equal true if 'i' is smaller than 10, if equal or greater, it will result in false - + //let's start from the back: - + //this part means that the message's first character has to equal a '!': ----------------------------+ // | //this is a logical AND operator: ----------------------------------------------------------------+ | @@ -1359,72 +1382,72 @@ public class ModEventHandler { //the config file: | | | | | | // V V V V V V if(GeneralConfig.enableDebugMode && player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) && message.startsWith("!")) { - + String[] msg = message.split(" "); - + String m = msg[0].substring(1, msg[0].length()).toLowerCase(Locale.US); - + if("gv".equals(m)) { - + int id = 0; int size = 1; int meta = 0; - + if(msg.length > 1 && NumberUtils.isNumber(msg[1])) { id = (int)(double)NumberUtils.createDouble(msg[1]); } - + if(msg.length > 2 && NumberUtils.isNumber(msg[2])) { size = (int)(double)NumberUtils.createDouble(msg[2]); } - + if(msg.length > 3 && NumberUtils.isNumber(msg[3])) { meta = (int)(double)NumberUtils.createDouble(msg[3]); } - + Item item = Item.getItemById(id); - + if(item != null && size > 0 && meta >= 0) { player.inventory.addItemStackToInventory(new ItemStack(item, size, meta)); } } - + player.inventoryContainer.detectAndSendChanges(); event.setCanceled(true); } } - + @SubscribeEvent public void anvilUpdateEvent(AnvilUpdateEvent event) { - + if(event.left.getItem() instanceof ItemGunBase && event.right.getItem() == Items.enchanted_book) { - + event.output = event.left.copy(); - + Map mapright = EnchantmentHelper.getEnchantments(event.right); Iterator itr = mapright.keySet().iterator(); - + while(itr.hasNext()) { - + int i = ((Integer) itr.next()).intValue(); int j = ((Integer) mapright.get(Integer.valueOf(i))).intValue(); Enchantment e = Enchantment.enchantmentsList[i]; - + EnchantmentUtil.removeEnchantment(event.output, e); EnchantmentUtil.addEnchantment(event.output, e, j); } - + event.cost = 10; } } - + @SubscribeEvent public void onFoodEaten(PlayerUseItemEvent.Finish event) { - + ItemStack stack = event.item; - + if(stack != null && stack.getItem() instanceof ItemFood) { - + if(stack.hasTagCompound() && stack.getTagCompound().getBoolean("ntmCyanide")) { for(int i = 0; i < 10; i++) { event.entityPlayer.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, 1000); @@ -1432,17 +1455,17 @@ public class ModEventHandler { } } } - + @SubscribeEvent public void filterBrokenEntity(EntityJoinWorldEvent event) { - + Entity entity = event.entity; Entity[] parts = entity.getParts(); - + //MainRegistry.logger.error("Trying to spawn entity " + entity.getClass().getCanonicalName()); - + if(parts != null) { - + for(int i = 0; i < parts.length; i++) { if(parts[i] == null) { MainRegistry.logger.error("Prevented spawning of multipart entity " + entity.getClass().getCanonicalName() + " due to parts being null!"); diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index 9ad3e4e83..79ea907c7 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -1,16 +1,5 @@ package com.hbm.main; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; -import java.util.Random; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockAshes; @@ -37,12 +26,7 @@ import com.hbm.inventory.gui.GUIArmorTable; import com.hbm.inventory.gui.GUIScreenPreview; import com.hbm.inventory.gui.GUIScreenWikiRender; import com.hbm.items.ModItems; -import com.hbm.items.armor.ArmorFSB; -import com.hbm.items.armor.ArmorFSBPowered; -import com.hbm.items.armor.ArmorNo9; -import com.hbm.items.armor.ItemArmorMod; -import com.hbm.items.armor.JetpackBase; -import com.hbm.items.armor.JetpackFueledBase; +import com.hbm.items.armor.*; import com.hbm.items.machine.ItemDepletedFuel; import com.hbm.items.machine.ItemFluidDuct; import com.hbm.items.machine.ItemRBMKPellet; @@ -69,25 +53,20 @@ import com.hbm.sound.MovingSoundChopper; import com.hbm.sound.MovingSoundChopperMine; import com.hbm.sound.MovingSoundCrashing; import com.hbm.sound.MovingSoundPlayerLoop; +import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound; import com.hbm.tileentity.bomb.TileEntityNukeCustom; import com.hbm.tileentity.bomb.TileEntityNukeCustom.CustomNukeEntry; import com.hbm.tileentity.bomb.TileEntityNukeCustom.EnumEntryType; import com.hbm.tileentity.machine.TileEntityNukeFurnace; -import com.hbm.util.I18nUtil; -import com.hbm.util.ItemStackUtil; -import com.hbm.util.LoggingUtil; -import com.hbm.util.ShadyUtil; +import com.hbm.util.*; +import com.hbm.util.ArmorRegistry.HazardClass; import com.hbm.wiaj.GuiWorldInAJar; import com.hbm.wiaj.cannery.CanneryBase; import com.hbm.wiaj.cannery.Jars; import com.hbm.util.ArmorRegistry; import com.hbm.util.ArmorUtil; import com.hbm.util.DamageResistanceHandler; -import com.hbm.util.ArmorRegistry.HazardClass; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; - -import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound; - import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; @@ -115,8 +94,8 @@ import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; @@ -125,45 +104,37 @@ import net.minecraft.network.play.client.C03PacketPlayer; import net.minecraft.network.play.client.C0CPacketInput; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraft.world.WorldProviderSurface; import net.minecraftforge.client.GuiIngameForge; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.client.event.FOVUpdateEvent; -import net.minecraftforge.client.event.GuiOpenEvent; -import net.minecraftforge.client.event.MouseEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; -import net.minecraftforge.client.event.RenderHandEvent; -import net.minecraftforge.client.event.RenderItemInFrameEvent; -import net.minecraftforge.client.event.RenderLivingEvent; -import net.minecraftforge.client.event.RenderPlayerEvent; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent17; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.lang.reflect.Method; +import java.util.*; public class ModEventHandlerClient { - + public static final int flashDuration = 5_000; public static long flashTimestamp; public static final int shakeDuration = 1_500; public static long shakeTimestamp; - + @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent.Pre event) { - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + /// NUKE FLASH /// if(event.type == ElementType.CROSSHAIRS && (flashTimestamp + flashDuration - System.currentTimeMillis()) > 0 && ClientConfig.NUKE_HUD_FLASH.get()) { int width = event.resolution.getScaledWidth(); @@ -188,21 +159,21 @@ public class ModEventHandlerClient { GL11.glDepthMask(true); return; } - + /// HANDLE GUN OVERLAYS /// if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemHUD) { ((IItemHUD)player.getHeldItem().getItem()).renderHUD(event, event.type, player, player.getHeldItem()); } - + /// HANDLE GEIGER COUNTER HUD /// if(event.type == ElementType.HOTBAR) { - + if(!(ArmorFSB.hasFSBArmor(player) && ((ArmorFSB)player.inventory.armorInventory[2].getItem()).customGeiger)) { - + if(player.inventory.hasItem(ModItems.geiger_counter)) { - + float rads = HbmLivingProps.getRadiation(player); - + RenderScreenOverlay.renderRadCounter(event.resolution, rads, Minecraft.getMinecraft().ingameGUI); } } @@ -213,37 +184,37 @@ public class ModEventHandlerClient { Minecraft mc = Minecraft.getMinecraft(); World world = mc.theWorld; MovingObjectPosition mop = mc.objectMouseOver; - + if(mop != null) { - + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ILookOverlay) { ((ILookOverlay) player.getHeldItem().getItem()).printHook(event, world, mop.blockX, mop.blockY, mop.blockZ); - + } else if(world.getBlock(mop.blockX, mop.blockY, mop.blockZ) instanceof ILookOverlay) { ((ILookOverlay) world.getBlock(mop.blockX, mop.blockY, mop.blockZ)).printHook(event, world, mop.blockX, mop.blockY, mop.blockZ); } - + /*List text = new ArrayList(); text.add("Meta: " + world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ)); ILookOverlay.printGeneric(event, "DEBUG", 0xffff00, 0x4040000, text);*/ - + } else if(mop.typeOfHit == mop.typeOfHit.ENTITY) { Entity entity = mop.entityHit; - + if(entity instanceof ILookOverlay) { ((ILookOverlay) entity).printHook(event, world, 0, 0, 0); } } } - + /*List text = new ArrayList(); text.add("IMPACT: " + ImpactWorldHandler.getImpactForClient(world)); text.add("DUST: " + ImpactWorldHandler.getDustForClient(world)); text.add("FIRE: " + ImpactWorldHandler.getFireForClient(world)); ILookOverlay.printGeneric(event, "DEBUG", 0xffff00, 0x4040000, text);*/ - + /*if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { ScaledResolution resolution = event.resolution; GL11.glPushMatrix(); @@ -255,115 +226,115 @@ public class ModEventHandlerClient { GL11.glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons); }*/ - + /*List text = new ArrayList(); MovingObjectPosition pos = Library.rayTrace(player, 500, 1, false, true, false); - + for(int i = 0; i < 2; i++) if(pos != null && pos.typeOfHit == pos.typeOfHit.BLOCK) { - + float yaw = player.rotationYaw; - + Vec3 next = Vec3.createVectorHelper(pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord); int it = 0; - + BlockPos anchor = new BlockPos(pos.blockX, pos.blockY, pos.blockZ); - + double distanceToCover = 4D * (i == 0 ? 1 : -1); - + if(distanceToCover < 0) { distanceToCover *= -1; yaw += 180; } - + do { - + it++; - + if(it > 30) { world.createExplosion(player, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 5F, false); break; } - + int x = anchor.getX(); int y = anchor.getY(); int z = anchor.getZ(); Block block = world.getBlock(x, y, z); - + Vec3 rot = Vec3.createVectorHelper(0, 0, 1); rot.rotateAroundY((float) (-yaw * Math.PI / 180D)); - + if(block instanceof IRailNTM) { IRailNTM rail = (IRailNTM) block; RailContext info = new RailContext(); - + boolean flip = distanceToCover < 0; - + if(it == 1) { Vec3 snap = next = rail.getTravelLocation(world, x, y, z, next.xCoord, next.yCoord, next.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, 0, info, new MoveContext(RailCheckType.CORE, 0)); if(i == 0) world.spawnParticle("reddust", snap.xCoord, snap.yCoord + 0.25, snap.zCoord, 0.1, 1, 0.1); } - + Vec3 prev = next; next = rail.getTravelLocation(world, x, y, z, prev.xCoord, prev.yCoord, prev.zCoord, rot.xCoord, rot.yCoord, rot.zCoord, distanceToCover, info, new MoveContext(i == 0 ? RailCheckType.FRONT : RailCheckType.BACK, 0)); distanceToCover = info.overshoot; anchor = info.pos; if(i == 0) world.spawnParticle("reddust", next.xCoord, next.yCoord + 0.25, next.zCoord, 0, distanceToCover != 0 ? 0.5 : 0, 0); else world.spawnParticle("reddust", next.xCoord, next.yCoord + 0.25, next.zCoord, 0, distanceToCover != 0 ? 0.5 : 0, 1); - + double deltaX = next.xCoord - prev.xCoord; double deltaZ = next.zCoord - prev.zCoord; double radians = -Math.atan2(deltaX, deltaZ); yaw = (float) MathHelper.wrapAngleTo180_double(radians * 180D / Math.PI + (flip ? 180 : 0)); - + text.add(it + ": " + yaw); - + } else { break; } - + } while(distanceToCover != 0); - + ILookOverlay.printGeneric(event, "DEBUG", 0xffff00, 0x4040000, text); }*/ } - + /// HANLDE ANIMATION BUSES /// - + for(int i = 0; i < HbmAnimations.hotbar.length; i++) { for(int j = 0; j < HbmAnimations.hotbar[i].length; j++) { - + Animation animation = HbmAnimations.hotbar[i][j]; - + if(animation == null) continue; - + if(animation.holdLastFrame) continue; - + long time = System.currentTimeMillis() - animation.startMillis; - + if(time > animation.animation.getDuration()) HbmAnimations.hotbar[i][j] = null; } } - + if(!ducked && Keyboard.isKeyDown(Keyboard.KEY_O) && Minecraft.getMinecraft().currentScreen == null) { ducked = true; PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(0, 0, 0, 999, 0)); } - + /// HANDLE SCOPE OVERLAY /// ItemStack held = player.getHeldItem(); - + if(player.isSneaking() && held != null && held.getItem() instanceof ItemGunBase && event.type == event.type.HOTBAR) { GunConfiguration config = ((ItemGunBase) held.getItem()).mainConfig; - + if(config.scopeTexture != null) { ScaledResolution resolution = event.resolution; RenderScreenOverlay.renderScope(resolution, config.scopeTexture); } } - + if(held != null && held.getItem() instanceof ItemGunBaseNT && ItemGunBaseNT.aimingProgress == ItemGunBaseNT.prevAimingProgress && ItemGunBaseNT.aimingProgress == 1F && event.type == event.type.HOTBAR) { ItemGunBaseNT gun = (ItemGunBaseNT) held.getItem(); GunConfig cfg = gun.getConfig(held, 0); @@ -372,28 +343,28 @@ public class ModEventHandlerClient { RenderScreenOverlay.renderScope(resolution, cfg.getScopeTexture(held)); } } - + /// HANDLE FSB HUD /// ItemStack helmet = player.inventory.armorInventory[3]; - + if(helmet != null && helmet.getItem() instanceof ArmorFSB) { ((ArmorFSB)helmet.getItem()).handleOverlay(event, player); } if(!event.isCanceled() && event.type == event.type.HOTBAR) { - + HbmPlayerProps props = HbmPlayerProps.getData(player); if(props.getDashCount() > 0) { RenderScreenOverlay.renderDashBar(event.resolution, Minecraft.getMinecraft().ingameGUI, props); - + } } } - + @SubscribeEvent(receiveCanceled = true) public void onHUDRenderShield(RenderGameOverlayEvent.Pre event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + if(event.type == event.type.ARMOR) { HbmPlayerProps props = HbmPlayerProps.getData(player); @@ -402,17 +373,17 @@ public class ModEventHandlerClient { } } } - + @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW) public void onHUDRenderBar(RenderGameOverlayEvent.Post event) { - + /// HANDLE ELECTRIC FSB HUD /// - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; Tessellator tess = Tessellator.instance; - + if(event.type == event.type.ARMOR) { - + if(ForgeHooks.getTotalArmorValue(player) == 0) { GuiIngameForge.left_height -= 10; } @@ -429,7 +400,7 @@ public class ModEventHandlerClient { tess.startDrawingQuads(); for(int i = 0; i < (noHelmet ? 3 : 4); i++) { - + int top = height - GuiIngameForge.left_height + 7; ItemStack stack = player.inventory.armorInventory[i]; @@ -463,7 +434,7 @@ public class ModEventHandlerClient { ItemStack stack = player.inventory.armorInventory[2]; float tot = (float) ((JetpackFueledBase) stack.getItem()).getFuel(stack) / (float) ((JetpackFueledBase) stack.getItem()).getMaxFill(stack); - + int top = height - GuiIngameForge.left_height + 3; GL11.glDisable(GL11.GL_TEXTURE_2D); @@ -486,59 +457,59 @@ public class ModEventHandlerClient { } } } - + @SubscribeEvent public void setupFOV(FOVUpdateEvent event) { - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack held = player.getHeldItem(); - + if(held == null) return; if(!(held.getItem() instanceof ItemGunBase)) return; - + GunConfiguration config = ((ItemGunBase) held.getItem()).mainConfig; - + if(config == null) return; if(config.zoomFOV == 0F || !player.isSneaking()) return; - + if(config.absoluteFOV) { event.newfov = config.zoomFOV; } else { event.newfov += config.zoomFOV; } } - + @SubscribeEvent public void setupNewFOV(FOVUpdateEvent event) { - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack held = player.getHeldItem(); - + if(held == null) return; - + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED); if(!(customRenderer instanceof ItemRenderWeaponBase)) return; ItemRenderWeaponBase renderGun = (ItemRenderWeaponBase) customRenderer; event.newfov = renderGun.getViewFOV(held, event.fov); } - + public static boolean ducked = false; - + @SubscribeEvent public void preRenderEvent(RenderPlayerEvent.Pre event) { - + RenderPlayer renderer = event.renderer; AbstractClientPlayer player = (AbstractClientPlayer)event.entityPlayer; - + PotionEffect invis = player.getActivePotionEffect(Potion.invisibility); - + if(invis != null && invis.getAmplifier() > 0) event.setCanceled(true); if(player.getDisplayName().toLowerCase(Locale.US).equals("martmn")) { - + event.setCanceled(true); - + float pX = (float) (player.prevPosX + (player.posX - player.prevPosX) * (double)event.partialRenderTick); float pY = (float) (player.prevPosY + (player.posY - player.prevPosY) * (double)event.partialRenderTick); float pZ = (float) (player.prevPosZ + (player.posZ - player.prevPosZ) * (double)event.partialRenderTick); @@ -562,49 +533,49 @@ public class ModEventHandlerClient { t.addVertexWithUV(1, -1, 0, 1, 1); t.addVertexWithUV(-1, -1, 0, 0, 1); t.draw(); - + GL11.glEnable(GL11.GL_LIGHTING); - + GL11.glPopMatrix(); } - + ResourceLocation cloak = RenderAccessoryUtility.getCloakFromPlayer(player); - + if(cloak != null) player.func_152121_a(Type.CAPE, cloak); - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IHoldableWeapon) { renderer.modelBipedMain.aimedBow = true; renderer.modelArmor.aimedBow = true; renderer.modelArmorChestplate.aimedBow = true; } } - + @SubscribeEvent public void onRenderArmorEvent(RenderPlayerEvent.SetArmorModel event) { - + EntityPlayer player = event.entityPlayer; - + for(int i = 0; i < 4; i++) { - + ItemStack armor = player.getCurrentArmor(i); - + if(armor != null && ArmorModHandler.hasMods(armor)) { - + for(ItemStack mod : ArmorModHandler.pryMods(armor)) { - + if(mod != null && mod.getItem() instanceof ItemArmorMod) { ((ItemArmorMod)mod.getItem()).modRender(event, armor); } } } - + //because armor that isn't ItemArmor doesn't render at all if(armor != null && armor.getItem() instanceof JetpackBase) { ((ItemArmorMod)armor.getItem()).modRender(event, armor); } } - + if(player.getCurrentArmor(2) == null && !player.isPotionActive(Potion.invisibility)) { if(player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) || player.getDisplayName().equals("HbMinecraft")) RenderAccessoryUtility.renderWings(event, 2); if(player.getUniqueID().toString().equals(ShadyUtil.the_NCR) || player.getDisplayName().equals("the_NCR")) RenderAccessoryUtility.renderWings(event, 3); @@ -615,20 +586,20 @@ public class ModEventHandlerClient { @SubscribeEvent public void clickHandler(MouseEvent event) { - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + if(player.getHeldItem() != null) { - + Item held = player.getHeldItem().getItem(); - + if(held instanceof ItemGunBase) { - + if(event.button == 0) event.setCanceled(true); - + ItemGunBase item = (ItemGunBase)player.getHeldItem().getItem(); - + if(event.button == 0 && !item.m1 && !item.m2) { item.m1 = true; PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 0)); @@ -646,55 +617,55 @@ public class ModEventHandlerClient { @Spaghetti("please get this shit out of my face") @SubscribeEvent public void onPlaySound(PlaySoundEvent17 e) { - + EntityPlayer player = MainRegistry.proxy.me(); Minecraft mc = Minecraft.getMinecraft(); - + if(player != null && mc.theWorld != null) { int i = MathHelper.floor_double(player.posX); int j = MathHelper.floor_double(player.posY); int k = MathHelper.floor_double(player.posZ); Block block = mc.theWorld.getBlock(i, j, k); - + if(block == ModBlocks.vacuum) { e.result = null; return; } } - + ResourceLocation r = e.sound.getPositionedSoundLocation(); WorldClient wc = mc.theWorld; - + //Alright, alright, I give the fuck up, you've wasted my time enough with this bullshit. You win. //A winner is you. //Conglaturations. //Fuck you. - + if(r.toString().equals("hbm:misc.nullChopper") && Library.getClosestChopperForSound(wc, e.sound.getXPosF(), e.sound.getYPosF(), e.sound.getZPosF(), 2) != null) { EntityHunterChopper ent = Library.getClosestChopperForSound(wc, e.sound.getXPosF(), e.sound.getYPosF(), e.sound.getZPosF(), 2); - + if(MovingSoundPlayerLoop.getSoundByPlayer(ent, EnumHbmSound.soundChopperLoop) == null) { MovingSoundPlayerLoop.globalSoundList.add(new MovingSoundChopper(new ResourceLocation("hbm:entity.chopperFlyingLoop"), ent, EnumHbmSound.soundChopperLoop)); MovingSoundPlayerLoop.getSoundByPlayer(ent, EnumHbmSound.soundChopperLoop).setVolume(10.0F); } } - + if(r.toString().equals("hbm:misc.nullCrashing") && Library.getClosestChopperForSound(wc, e.sound.getXPosF(), e.sound.getYPosF(), e.sound.getZPosF(), 2) != null) { EntityHunterChopper ent = Library.getClosestChopperForSound(wc, e.sound.getXPosF(), e.sound.getYPosF(), e.sound.getZPosF(), 2); - + if(MovingSoundPlayerLoop.getSoundByPlayer(ent, EnumHbmSound.soundCrashingLoop) == null) { MovingSoundPlayerLoop.globalSoundList.add(new MovingSoundCrashing(new ResourceLocation("hbm:entity.chopperCrashingLoop"), ent, EnumHbmSound.soundCrashingLoop)); MovingSoundPlayerLoop.getSoundByPlayer(ent, EnumHbmSound.soundCrashingLoop).setVolume(10.0F); } } - + if(r.toString().equals("hbm:misc.nullMine") && Library.getClosestMineForSound(wc, e.sound.getXPosF(), e.sound.getYPosF(), e.sound.getZPosF(), 2) != null) { EntityChopperMine ent = Library.getClosestMineForSound(wc, e.sound.getXPosF(), e.sound.getYPosF(), e.sound.getZPosF(), 2); - + if(MovingSoundPlayerLoop.getSoundByPlayer(ent, EnumHbmSound.soundMineLoop) == null) { MovingSoundPlayerLoop.globalSoundList.add(new MovingSoundChopperMine(new ResourceLocation("hbm:entity.chopperMineLoop"), ent, EnumHbmSound.soundMineLoop)); MovingSoundPlayerLoop.getSoundByPlayer(ent, EnumHbmSound.soundMineLoop).setVolume(10.0F); @@ -710,70 +681,70 @@ public class ModEventHandlerClient { } } } - + @SubscribeEvent public void drawTooltip(ItemTooltipEvent event) { - + ItemStack stack = event.itemStack; List list = event.toolTip; - + /// DAMAGE RESISTANCE /// DamageResistanceHandler.addInfo(stack, list); - + /// HAZMAT INFO /// List hazInfo = ArmorRegistry.hazardClasses.get(stack.getItem()); - + if(hazInfo != null) { - + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("hazard.prot")); for(HazardClass clazz : hazInfo) { list.add(EnumChatFormatting.YELLOW + " " + I18nUtil.resolveKey(clazz.lang)); } } else { - + list.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC +"Hold <" + EnumChatFormatting.YELLOW + "" + EnumChatFormatting.ITALIC + "LSHIFT" + EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display protection info"); } } - + /// CLADDING (LEGACY) /// double rad = HazmatRegistry.getResistance(stack); rad = ((int)(rad * 1000)) / 1000D; if(rad > 0) list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.radResistance", rad)); - + /// ARMOR MODS /// if(stack.getItem() instanceof ItemArmor && ArmorModHandler.hasMods(stack)) { - + if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !(Minecraft.getMinecraft().currentScreen instanceof GUIArmorTable)) { - + list.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC +"Hold <" + EnumChatFormatting.YELLOW + "" + EnumChatFormatting.ITALIC + "LSHIFT" + EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display installed armor mods"); - + } else { - + list.add(EnumChatFormatting.YELLOW + "Mods:"); - + ItemStack[] mods = ArmorModHandler.pryMods(stack); - + for(int i = 0; i < 8; i++) { - + if(mods[i] != null && mods[i].getItem() instanceof ItemArmorMod) { - + ((ItemArmorMod)mods[i].getItem()).addDesc(list, mods[i], stack); } } } } - + /// HAZARDS /// HazardSystem.addFullTooltip(stack, event.entityPlayer, list); - + if(event.showAdvancedItemTooltips && ClientConfig.ITEM_TOOLTIP_SHOW_OREDICT.get()) { List names = ItemStackUtil.getOreDictNames(stack); - + if(names.size() > 0) { list.add(EnumChatFormatting.BLUE + "Ore Dict:"); for(String s : names) { @@ -783,33 +754,33 @@ public class ModEventHandlerClient { list.add(EnumChatFormatting.RED + "No Ore Dict data!"); } } - + /// NUCLEAR FURNACE FUELS /// int breeder = TileEntityNukeFurnace.getFuelValue(stack); - + if(breeder != 0) { list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.furnace", breeder)); } - + /// CUSTOM NUKE /// ComparableStack comp = new ComparableStack(stack).makeSingular(); - + if(ClientConfig.ITEM_TOOLTIP_SHOW_CUSTOM_NUKE.get()) { CustomNukeEntry entry = TileEntityNukeCustom.entries.get(comp); - + if(entry != null) { - + if(!list.isEmpty()) list.add(""); - + if(entry.entry == EnumEntryType.ADD) list.add(EnumChatFormatting.GOLD + "Adds " + entry.value + " to the custom nuke stage " + entry.type); - + if(entry.entry == EnumEntryType.MULT) list.add(EnumChatFormatting.GOLD + "Adds multiplier " + entry.value + " to the custom nuke stage " + entry.type); } } - + try { CanneryBase cannery = Jars.canneries.get(comp); if(cannery != null) { @@ -820,36 +791,36 @@ public class ModEventHandlerClient { } catch(Exception ex) { list.add(EnumChatFormatting.RED + "Error loading cannery: " + ex.getLocalizedMessage()); } - + /*ItemStack copy = stack.copy(); List materials = Mats.getMaterialsFromItem(copy); - + if(!materials.isEmpty()) { for(MaterialStack mat : materials) { list.add(EnumChatFormatting.DARK_PURPLE + mat.material.names[0] + ": " + Mats.formatAmount(mat.amount * stack.stackSize)); } }*/ } - + private static long canneryTimestamp; private static ComparableStack lastCannery = null; - + private ResourceLocation ashes = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_ash.png"); - + @SideOnly(Side.CLIENT) //@SubscribeEvent public void onRenderStorm(RenderHandEvent event) { - + if(BlockAshes.ashes == 0) return; - + GL11.glPushMatrix(); - + Minecraft mc = Minecraft.getMinecraft(); GL11.glRotatef((float)-mc.thePlayer.rotationYaw, 0, 1, 0); GL11.glRotatef((float)(mc.thePlayer.rotationPitch), 1, 0, 0); - + ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -857,12 +828,12 @@ public class ModEventHandlerClient { GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glEnable(GL11.GL_ALPHA_TEST); - + int w = resolution.getScaledWidth(); int h = resolution.getScaledHeight(); double off = System.currentTimeMillis() / -10000D % 10000D; double aw = 25; - + Tessellator tessellator = Tessellator.instance; //int d = mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posY), MathHelper.floor_double(mc.thePlayer.posZ), 0); @@ -871,21 +842,21 @@ public class ModEventHandlerClient { int lX = lastBrightness % 65536; int lY = lastBrightness / 65536; float interp = (mc.theWorld.getTotalWorldTime() % 20) * 0.05F; - + if(mc.theWorld.getTotalWorldTime() == 1) lastBrightness = currentBrightness; - + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)(lX + (cX - lX) * interp) / 1.0F, (float)(lY + (cY - lY) * interp) / 1.0F); mc.entityRenderer.enableLightmap((double)event.partialTicks); - + mc.getTextureManager().bindTexture(ashes); - + for(int i = 1; i < 3; i++) { - + GL11.glRotatef(-15, 0, 0, 1); GL11.glColor4f(1.0F, 1.0F, 1.0F, BlockAshes.ashes / 256F * 0.98F / i); - + tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-w * 0.25, h * 0.25, aw, 0.0D + off * i, 1.0D); tessellator.addVertexWithUV(w * 0.25, h * 0.25, aw, 1.0D + off * i, 1.0D); @@ -895,7 +866,7 @@ public class ModEventHandlerClient { } mc.entityRenderer.disableLightmap((double)event.partialTicks); - + GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); @@ -908,15 +879,15 @@ public class ModEventHandlerClient { public static int lastBrightness = 0; static boolean isRenderingItems = false; - + @SubscribeEvent public void clientTick(ClientTickEvent event) { - + Minecraft mc = Minecraft.getMinecraft(); ArmorNo9.updateWorldHook(mc.theWorld); boolean supportsHighRenderDistance = FMLClientHandler.instance().hasOptifine() || Loader.isModLoaded("angelica"); - + if(mc.gameSettings.renderDistanceChunks > 16 && GeneralConfig.enableRenderDistCheck && !supportsHighRenderDistance) { mc.gameSettings.renderDistanceChunks = 16; LoggingUtil.errorWithHighlight("========================== WARNING =========================="); @@ -927,35 +898,35 @@ public class ModEventHandlerClient { LoggingUtil.errorWithHighlight("If you got this error after downgrading your Minecraft version: Consider using a launcher that doesn't reuse the same folders for every game instance. MultiMC for example, it's really good and it comes with a dedicated cat button. You like cats, right? Are you using the Microsoft launcher? The one launcher that turns every version switch into a tightrope act because all the old config and options files are still here because different instances all use the same folder structure instead of different folders like a competent launcher would, because some MO-RON thought that this was an acceptable way of doing things? Really? The launcher that circumcises every crashlog into indecipherable garbage, tricking oblivious people into posting that as a \"crash report\", effectively wasting everyone's time? The launcher made by the company that thought it would be HI-LA-RI-OUS to force everyone to use Microsoft accounts, effectively breaking every other launcher until they implement their terrible auth system?"); LoggingUtil.errorWithHighlight("========================== WARNING =========================="); } - + if(mc.theWorld == null || mc.thePlayer == null) return; - + if(event.phase == Phase.START && event.side == Side.CLIENT) { - + if(BlockAshes.ashes > 256) BlockAshes.ashes = 256; if(BlockAshes.ashes > 0) BlockAshes.ashes -= 2; if(BlockAshes.ashes < 0) BlockAshes.ashes = 0; - + if(mc.theWorld.getTotalWorldTime() % 20 == 0) { this.lastBrightness = this.currentBrightness; currentBrightness = mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posY), MathHelper.floor_double(mc.thePlayer.posZ), 0); } - + if(ArmorUtil.isWearingEmptyMask(mc.thePlayer)) { MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Your mask has no filter!", MainRegistry.proxy.ID_FILTER); } } - + if(Keyboard.isKeyDown(Keyboard.KEY_F1) && Minecraft.getMinecraft().currentScreen != null) { - + ComparableStack comp = canneryTimestamp > System.currentTimeMillis() - 100 ? lastCannery : null; - + if(comp == null) { ItemStack stack = getMouseOverStack(); if(stack != null) comp = new ComparableStack(stack).makeSingular(); } - + if(comp != null) { CanneryBase cannery = Jars.canneries.get(comp); if(cannery != null) { @@ -963,9 +934,9 @@ public class ModEventHandlerClient { } } } - + if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_LMENU)) { - + ItemStack stack = getMouseOverStack(); if(stack != null) { stack = stack.copy(); @@ -1014,38 +985,38 @@ public class ModEventHandlerClient { } EntityPlayer player = mc.thePlayer; - + if(event.phase == Phase.START) { - + float discriminator = 0.003F; float defaultStepSize = 0.5F; int newStepSize = 0; - + if(player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof ArmorFSB) { ArmorFSB plate = (ArmorFSB) player.inventory.armorInventory[2].getItem(); if(plate.hasFSBArmor(player)) newStepSize = plate.stepSize; } - + if(newStepSize > 0) { player.stepHeight = newStepSize + discriminator; } else { for(int i = 1; i < 4; i++) if(player.stepHeight == i + discriminator) player.stepHeight = defaultStepSize; } } - + if(event.phase == Phase.END) { - + if(ClientConfig.GUN_VISUAL_RECOIL.get()) { ItemGunBaseNT.offsetVertical += ItemGunBaseNT.recoilVertical; ItemGunBaseNT.offsetHorizontal += ItemGunBaseNT.recoilHorizontal; player.rotationPitch -= ItemGunBaseNT.recoilVertical; player.rotationYaw -= ItemGunBaseNT.recoilHorizontal; - + ItemGunBaseNT.recoilVertical *= ItemGunBaseNT.recoilDecay; ItemGunBaseNT.recoilHorizontal *= ItemGunBaseNT.recoilDecay; float dV = ItemGunBaseNT.offsetVertical * ItemGunBaseNT.recoilRebound; float dH = ItemGunBaseNT.offsetHorizontal * ItemGunBaseNT.recoilRebound; - + ItemGunBaseNT.offsetVertical -= dV; ItemGunBaseNT.offsetHorizontal -= dH; player.rotationPitch += dV; @@ -1058,9 +1029,9 @@ public class ModEventHandlerClient { } } } - + public static ItemStack getMouseOverStack() { - + Minecraft mc = Minecraft.getMinecraft(); if(mc.currentScreen instanceof GuiContainer) { @@ -1069,41 +1040,41 @@ public class ModEventHandlerClient { int height = scaledresolution.getScaledHeight(); int mouseX = Mouse.getX() * width / mc.displayWidth; int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1; - + GuiContainer container = (GuiContainer) mc.currentScreen; - + for(Object o : container.inventorySlots.inventorySlots) { Slot slot = (Slot) o; - + if(slot.getHasStack()) { try { Method isMouseOverSlot = ReflectionHelper.findMethod(GuiContainer.class, container, new String[] {"func_146981_a", "isMouseOverSlot"}, Slot.class, int.class, int.class); - + if((boolean) isMouseOverSlot.invoke(container, slot, mouseX, mouseY)) { return slot.getStack(); } - + } catch(Exception ex) { } } } } - + return null; } - + @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.LOWEST) public void onClientTickLast(ClientTickEvent event) { - + if(event.phase == Phase.START && GeneralConfig.enableSkyboxes) { - + World world = Minecraft.getMinecraft().theWorld; if(world == null) return; - + IRenderHandler sky = world.provider.getSkyRenderer(); - + if(world.provider instanceof WorldProviderSurface) { - + if(ImpactWorldHandler.getDustForClient(world) > 0 || ImpactWorldHandler.getFireForClient(world) > 0) { //using a chainloader isn't necessary since none of the sky effects should render anyway @@ -1113,9 +1084,9 @@ public class ModEventHandlerClient { } } } - + if(world.provider.dimensionId == 0) { - + if(!(sky instanceof RenderNTMSkyboxChainloader)) { world.provider.setSkyRenderer(new RenderNTMSkyboxChainloader(sky)); } @@ -1123,15 +1094,15 @@ public class ModEventHandlerClient { } if(event.phase == Phase.START) { - + Minecraft mc = Minecraft.getMinecraft(); - + if(mc.currentScreen != null && mc.currentScreen.allowUserInput) { HbmPlayerProps props = HbmPlayerProps.getData(MainRegistry.proxy.me()); - + for(EnumKeybind key : EnumKeybind.values()) { boolean last = props.getKeyPressed(key); - + if(last) { PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, !last)); props.setKeyPressed(key, !last); @@ -1144,16 +1115,16 @@ public class ModEventHandlerClient { @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.LOW) public void onMouseClicked(InputEvent.MouseInputEvent event) { - + Minecraft mc = Minecraft.getMinecraft(); if(GeneralConfig.enableKeybindOverlap && (mc.currentScreen == null || mc.currentScreen.allowUserInput)) { boolean state = Mouse.getEventButtonState(); int keyCode = Mouse.getEventButton() - 100; - + //if anything errors here, run ./gradlew clean setupDecompWorkSpace for(Object o : KeyBinding.keybindArray) { KeyBinding key = (KeyBinding) o; - + if(key.getKeyCode() == keyCode && KeyBinding.hash.lookup(key.getKeyCode()) != key) { key.pressed = state; @@ -1162,20 +1133,20 @@ public class ModEventHandlerClient { } } } - + boolean gunKey = keyCode == HbmKeybinds.gunPrimaryKey.getKeyCode() || keyCode == HbmKeybinds.gunSecondaryKey.getKeyCode() || keyCode == HbmKeybinds.gunTertiaryKey.getKeyCode() || keyCode == HbmKeybinds.reloadKey.getKeyCode(); - + EntityPlayer player = mc.thePlayer; - + if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) { - + /* Shoot in favor of attacking */ if(gunKey && keyCode == mc.gameSettings.keyBindAttack.getKeyCode()) { mc.gameSettings.keyBindAttack.pressed = false; mc.gameSettings.keyBindAttack.pressTime = 0; } - + if(gunKey && keyCode == mc.gameSettings.keyBindPickBlock.getKeyCode()) { mc.gameSettings.keyBindPickBlock.pressed = false; mc.gameSettings.keyBindPickBlock.pressTime = 0; @@ -1192,13 +1163,13 @@ public class ModEventHandlerClient { if(GeneralConfig.enableKeybindOverlap && (mc.currentScreen == null || mc.currentScreen.allowUserInput)) { boolean state = Keyboard.getEventKeyState(); int keyCode = Keyboard.getEventKey(); - + //if anything errors here, run ./gradlew clean setupDecompWorkSpace for(Object o : KeyBinding.keybindArray) { KeyBinding key = (KeyBinding) o; - + if(keyCode != 0 && key.getKeyCode() == keyCode && KeyBinding.hash.lookup(key.getKeyCode()) != key) { - + key.pressed = state; if(state && key.pressTime == 0) { key.pressTime = 1; @@ -1207,7 +1178,7 @@ public class ModEventHandlerClient { } } } - + @SideOnly(Side.CLIENT) @SubscribeEvent public void onRenderWorldLastEvent(RenderWorldLastEvent event) { @@ -1278,7 +1249,7 @@ public class ModEventHandlerClient { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); } - + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); @@ -1287,51 +1258,51 @@ public class ModEventHandlerClient { } GL11.glPopMatrix(); - + boolean hudOn = HbmPlayerProps.getData(player).enableHUD; - + if(hudOn) { RenderOverhead.renderMarkers(event.partialTicks); - + if(ArmorFSB.hasFSBArmor(player)) { ItemStack plate = player.inventory.armorInventory[2]; ArmorFSB chestplate = (ArmorFSB) plate.getItem(); - + if(chestplate.thermal) RenderOverhead.renderThermalSight(event.partialTicks); } } } - + @SubscribeEvent(priority = EventPriority.HIGHEST) public void preRenderEventFirst(RenderLivingEvent.Pre event) { - + if(MainRegistry.proxy.isVanished(event.entity)) event.setCanceled(true); } - + @SubscribeEvent public void preRenderEvent(RenderLivingEvent.Pre event) { - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + if(ArmorFSB.hasFSBArmor(player) && HbmPlayerProps.getData(player).enableHUD) { ItemStack plate = player.inventory.armorInventory[2]; ArmorFSB chestplate = (ArmorFSB)plate.getItem(); - + if(chestplate.vats) { - + int count = (int)Math.min(event.entity.getMaxHealth(), 100); - + int bars = (int)Math.ceil(event.entity.getHealth() * count / event.entity.getMaxHealth()); - + String bar = EnumChatFormatting.RED + ""; - + for(int i = 0; i < count; i++) { - + if(i == bars) bar += EnumChatFormatting.RESET + ""; - + bar += "|"; } RenderOverhead.renderTag(event.entity, event.x, event.y, event.z, event.renderer, bar, chestplate.thermal); @@ -1346,7 +1317,7 @@ public class ModEventHandlerClient { @SubscribeEvent public void onTextureStitch(TextureStitchEvent.Pre event) { - + if(event.map.getTextureType() == 0) { particleBase = event.map.registerIcon(RefStrings.MODID + ":particle/particle_base"); particleLeaf = event.map.registerIcon(RefStrings.MODID + ":particle/dead_leaf"); @@ -1362,16 +1333,16 @@ public class ModEventHandlerClient { private static final ResourceLocation poster = new ResourceLocation(RefStrings.MODID + ":textures/models/misc/poster.png"); private static final ResourceLocation poster_cat = new ResourceLocation(RefStrings.MODID + ":textures/models/misc/poster_cat.png"); - + @SubscribeEvent public void renderFrame(RenderItemInFrameEvent event) { - + if(event.item != null && event.item.getItem() == ModItems.flame_pony) { event.setCanceled(true); - + double p = 0.0625D; double o = p * 2.75D; - + GL11.glDisable(GL11.GL_LIGHTING); Minecraft.getMinecraft().renderEngine.bindTexture(poster); Tessellator tess = Tessellator.instance; @@ -1383,10 +1354,10 @@ public class ModEventHandlerClient { tess.draw(); GL11.glEnable(GL11.GL_LIGHTING); } - + if(event.item != null && event.item.getItem() == Items.paper) { event.setCanceled(true); - + double p = 0.0625D; double o = p * 2.75D; @@ -1402,16 +1373,16 @@ public class ModEventHandlerClient { GL11.glEnable(GL11.GL_LIGHTING); } } - + @SubscribeEvent public void worldTick(WorldTickEvent event) { - + EntityPlayer player = Minecraft.getMinecraft().thePlayer; - + if(player != null && player.ridingEntity instanceof EntityRailCarRidable && player instanceof EntityClientPlayerMP) { EntityRailCarRidable train = (EntityRailCarRidable) player.ridingEntity; EntityClientPlayerMP client = (EntityClientPlayerMP) player; - + //mojank compensation, because apparently the "this makes the render work" method also determines the fucking input if(!train.shouldRiderSit()) { client.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(client.rotationYaw, client.rotationPitch, client.onGround)); @@ -1419,14 +1390,14 @@ public class ModEventHandlerClient { } } } - + @SubscribeEvent public void onOpenGUI(GuiOpenEvent event) { - + if(event.gui instanceof GuiMainMenu && ClientConfig.MAIN_MENU_WACKY_SPLASHES.get()) { GuiMainMenu main = (GuiMainMenu) event.gui; int rand = (int)(Math.random() * 150); - + switch(rand) { case 0: main.splashText = "Floppenheimer!"; break; case 1: main.splashText = "i should dip my balls in sulfuric acid"; break; @@ -1442,7 +1413,7 @@ public class ModEventHandlerClient { case 11: main.splashText = "Do drugs!"; break; case 12: main.splashText = "Imagine being scared by splash texts!"; break; } - + double d = Math.random(); if(d < 0.1) main.splashText = "Redditors aren't people!"; else if(d < 0.2) main.splashText = "Can someone tell me what corrosive fumes the people on Reddit are huffing so I can avoid those more effectively?"; diff --git a/src/main/java/com/hbm/main/ModEventHandlerImpact.java b/src/main/java/com/hbm/main/ModEventHandlerImpact.java index 7f178531f..723410c6d 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerImpact.java +++ b/src/main/java/com/hbm/main/ModEventHandlerImpact.java @@ -1,26 +1,16 @@ package com.hbm.main; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.config.GeneralConfig; import com.hbm.handler.ImpactWorldHandler; import com.hbm.saveddata.TomSaveData; import com.hbm.world.WorldProviderNTM; - +import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; -import net.minecraft.block.Block; -import net.minecraft.block.BlockBush; -import net.minecraft.block.BlockCrops; -import net.minecraft.block.BlockDoor; -import net.minecraft.block.BlockLeaves; -import net.minecraft.block.BlockLog; +import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityWaterMob; @@ -34,50 +24,54 @@ import net.minecraftforge.common.DimensionManager; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import net.minecraftforge.event.terraingen.BiomeEvent; import net.minecraftforge.event.terraingen.DecorateBiomeEvent; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; import net.minecraftforge.event.world.WorldEvent; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class ModEventHandlerImpact { - + ////////////////////////////////////////// private static Random rand = new Random(); ////////////////////////////////////////// - + @SubscribeEvent public void worldTick(WorldTickEvent event) { if(event.world != null && !event.world.isRemote && event.phase == Phase.START) { float settle = 1F / 14400000F; // 600 days to completely clear all dust. float cool = 1F / 24000F; // One MC day between initial impact and total darkness. - + ImpactWorldHandler.impactEffects(event.world); TomSaveData data = TomSaveData.forWorld(event.world); - + if(data.dust > 0 && data.fire == 0) { data.dust = Math.max(0, data.dust - settle); data.markDirty(); } - + if(data.fire > 0) { data.fire = Math.max(0, (data.fire - cool)); data.dust = Math.min(1, (data.dust + cool)); data.markDirty(); } - + if(!event.world.loadedEntityList.isEmpty()) { - + List oList = new ArrayList(); oList.addAll(event.world.loadedEntityList); - + for(Object e : oList) { if(e instanceof EntityLivingBase) { EntityLivingBase entity = (EntityLivingBase) e; - + if(entity.worldObj.provider.dimensionId == 0 && data.fire > 0 && data.dust < 0.75f && event.world.getSavedLightValue(EnumSkyBlock.Sky, (int) entity.posX, (int) entity.posY, (int) entity.posZ) > 7) { - + entity.setFire(5); entity.attackEntityFrom(DamageSource.onFire, 2); } @@ -102,9 +96,9 @@ public class ModEventHandlerImpact { @SubscribeEvent public void extinction(CheckSpawn event) { - + TomSaveData data = TomSaveData.forWorld(event.world); - + if(data.impact) { if(!(event.entityLiving instanceof EntityPlayer) && event.entityLiving instanceof EntityLivingBase) { if(event.world.provider.dimensionId == 0) { @@ -126,22 +120,22 @@ public class ModEventHandlerImpact { @SubscribeEvent public void onPopulate(Populate event) { - + if(event.type == Populate.EventType.ANIMALS) { - + TomSaveData data = TomSaveData.forWorld(event.world); - + if(data.impact) { event.setResult(Result.DENY); } } } - + @SubscribeEvent(priority = EventPriority.LOWEST) public void onLoad(WorldEvent.Load event) { - + TomSaveData.resetLastCached(); - + if(GeneralConfig.enableImpactWorldProvider) { DimensionManager.unregisterProviderType(0); DimensionManager.registerProviderType(0, WorldProviderNTM.class, true); @@ -152,18 +146,18 @@ public class ModEventHandlerImpact { public void modifyVillageGen(BiomeEvent.GetVillageBlockID event) { Block b = event.original; Material mat = event.original.getMaterial(); - + TomSaveData data = TomSaveData.getLastCachedOrNull(); - + if(data == null || event.biome == null) { return; } - + if(data.impact) { if(mat == Material.wood || mat == Material.glass || b == Blocks.ladder || b instanceof BlockCrops || b == Blocks.chest || b instanceof BlockDoor || mat == Material.cloth || mat == Material.water || b == Blocks.stone_slab) { event.replacement = Blocks.air; - + } else if(b == Blocks.cobblestone || b == Blocks.stonebrick) { if(rand.nextInt(3) == 1) { event.replacement = Blocks.gravel; @@ -176,19 +170,19 @@ public class ModEventHandlerImpact { event.replacement = Blocks.dirt; } } - + if(event.replacement != null) { event.setResult(Result.DENY); } } - + @SubscribeEvent public void postImpactGeneration(BiomeEvent event) { /// Disables post-impact surface replacement for superflat worlds /// because they are retarded and crash with a NullPointerException if /// you try to look for biome-specific blocks. - TomSaveData data = TomSaveData.getLastCachedOrNull(); //despite forcing the data, we cannot rule out canceling events or custom firing shenanigans + TomSaveData data = TomSaveData.getLastCachedOrNull(); //despite forcing the data, we cannot rule out canceling events or custom firing shenanigans if(data != null && event.biome != null) { if(event.biome.topBlock != null) { if(event.biome.topBlock == Blocks.grass) { @@ -204,18 +198,18 @@ public class ModEventHandlerImpact { @SubscribeEvent public void postImpactDecoration(DecorateBiomeEvent.Decorate event) { - + TomSaveData data = TomSaveData.forWorld(event.world); - + if(data.impact) { EventType type = event.type; - + if(data.dust > 0 || data.fire > 0) { if(type == event.type.TREE || type == event.type.BIG_SHROOM || type == event.type.GRASS || type == event.type.REED || type == event.type.FLOWERS || type == event.type.DEAD_BUSH || type == event.type.CACTUS || type == event.type.PUMPKIN || type == event.type.LILYPAD) { event.setResult(Result.DENY); } - + } else if(data.dust == 0 && data.fire == 0) { if(type == event.type.TREE || type == event.type.BIG_SHROOM || type == event.type.CACTUS) { if(event.world.rand.nextInt(9) == 0) { @@ -224,12 +218,12 @@ public class ModEventHandlerImpact { event.setResult(Result.DENY); } } - + if(type == event.type.GRASS || type == event.type.REED) { event.setResult(Result.DEFAULT); } } - + } else { event.setResult(Result.DEFAULT); } @@ -242,20 +236,20 @@ public class ModEventHandlerImpact { @SubscribeEvent public void populateChunkPost(PopulateChunkEvent.Post event) { - + TomSaveData data = TomSaveData.forWorld(event.world); - + if(data.impact) { Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ); - + for(ExtendedBlockStorage storage : chunk.getBlockStorageArray()) { - + if(storage != null) { - + for(int x = 0; x < 16; ++x) { for(int y = 0; y < 16; ++y) { for(int z = 0; z < 16; ++z) { - + if(data.dust > 0.25 || data.fire > 0) { if(storage.getBlockByExtId(x, y, z) == Blocks.grass) { storage.func_150818_a(x, y, z, ModBlocks.impact_dirt); diff --git a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java index 77a667d49..d19c8bd2f 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java +++ b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java @@ -1,9 +1,5 @@ package com.hbm.main; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; -import org.lwjgl.opengl.GLContext; - import com.hbm.blocks.ICustomBlockHighlight; import com.hbm.config.ClientConfig; import com.hbm.config.RadiationConfig; @@ -15,7 +11,6 @@ import com.hbm.packet.PermaSyncHandler; import com.hbm.render.item.weapon.sedna.ItemRenderWeaponBase; import com.hbm.render.model.ModelMan; import com.hbm.world.biome.BiomeGenCraterBase; - import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; @@ -43,13 +38,16 @@ import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.event.DrawBlockHighlightEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.EntityViewRenderEvent.FogColors; import net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.common.ForgeModContainer; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import org.lwjgl.opengl.GLContext; public class ModEventHandlerRenderer { @@ -116,11 +114,11 @@ public class ModEventHandlerRenderer { EntityPlayer player = event.entityPlayer; RenderPlayer renderer = event.renderer; - + boolean akimbo = false; ItemStack held = player.getHeldItem(); - + if(held != null) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED); if(customRenderer instanceof ItemRenderWeaponBase) { @@ -132,7 +130,7 @@ public class ModEventHandlerRenderer { } boolean isManly = PermaSyncHandler.boykissers.contains(player.getEntityId()); - + if(akimbo) { ModelBiped biped = renderer.modelBipedMain; renderer.modelArmorChestplate.bipedLeftArm.rotateAngleY = renderer.modelArmor.bipedLeftArm.rotateAngleY = biped.bipedLeftArm.rotateAngleY = @@ -159,7 +157,7 @@ public class ModEventHandlerRenderer { if(f6 > 1.0F) { f6 = 1.0F; } - + manlyModel.render(event.entityPlayer, f7, f6, yawWrapped, yaw, pitch, 0.0625F, renderer); } } @@ -176,14 +174,14 @@ public class ModEventHandlerRenderer { } } } - + @SubscribeEvent public void onRenderHeldGun(RenderPlayerEvent.Pre event) { EntityPlayer player = event.entityPlayer; RenderPlayer renderer = event.renderer; ItemStack held = player.getHeldItem(); - + if(held != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) { renderer.modelBipedMain.aimedBow = true; renderer.modelArmor.aimedBow = true; @@ -210,7 +208,7 @@ public class ModEventHandlerRenderer { if(held == null) return; IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED); - + if(customRenderer instanceof ItemRenderWeaponBase) { ItemRenderWeaponBase renderWeapon = (ItemRenderWeaponBase) customRenderer; if(renderWeapon.isAkimbo()) { @@ -251,16 +249,16 @@ public class ModEventHandlerRenderer { if(manlyModel == null) manlyModel = new ModelMan(); - + event.renderItem = false; float f2 = 1.3333334F; ItemStack held = player.getHeldItem(); - + if(held == null) return; - + GL11.glPushMatrix(); manlyModel.rightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); @@ -358,16 +356,16 @@ public class ModEventHandlerRenderer { default: return null; } } - + @SubscribeEvent public void onDrawHighlight(DrawBlockHighlightEvent event) { MovingObjectPosition mop = event.target; - + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { Block b = event.player.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); if(b instanceof ICustomBlockHighlight) { ICustomBlockHighlight cus = (ICustomBlockHighlight) b; - + if(cus.shouldDrawHighlight(event.player.worldObj, mop.blockX, mop.blockY, mop.blockZ)) { cus.drawHighlight(event, event.player.worldObj, mop.blockX, mop.blockY, mop.blockZ); event.setCanceled(true); @@ -445,17 +443,17 @@ public class ModEventHandlerRenderer { GL11.glPopMatrix(); } }*/ - + float renderSoot = 0; - + @SubscribeEvent public void worldTick(WorldTickEvent event) { - + if(event.phase == event.phase.START && RadiationConfig.enableSootFog) { float step = 0.05F; float soot = PermaSyncHandler.pollution[PollutionType.SOOT.ordinal()]; - + if(Math.abs(renderSoot - soot) < step) { renderSoot = soot; } else if(renderSoot < soot) { @@ -470,7 +468,7 @@ public class ModEventHandlerRenderer { public void thickenFog(FogDensity event) { float soot = (float) (renderSoot - RadiationConfig.sootFogThreshold); if(soot > 0 && RadiationConfig.enableSootFog) { - + float farPlaneDistance = (float) (Minecraft.getMinecraft().gameSettings.renderDistanceChunks * 16); float fogDist = farPlaneDistance / (1 + soot * 5F / (float) RadiationConfig.sootFogDivisor); GL11.glFogf(GL11.GL_FOG_START, 0); @@ -484,10 +482,10 @@ public class ModEventHandlerRenderer { event.setCanceled(true); } } - + @SubscribeEvent(priority = EventPriority.LOW) public void tintFog(FogColors event) { - + EntityPlayer player = MainRegistry.proxy.me(); if(player.worldObj.getBlock((int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ)).getMaterial() != Material.water) { Vec3 color = getFogBlendColor(player.worldObj, (int) Math.floor(player.posX), (int) Math.floor(player.posZ), event.red, event.green, event.blue, event.renderPartialTicks); @@ -497,7 +495,7 @@ public class ModEventHandlerRenderer { event.blue = (float) color.zCoord; } } - + float soot = (float) (renderSoot - RadiationConfig.sootFogThreshold); float sootColor = 0.15F; float sootReq = (float) RadiationConfig.sootFogDivisor; @@ -508,10 +506,10 @@ public class ModEventHandlerRenderer { event.blue = event.blue * (1 - interp) + sootColor * interp; } } - + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderHUD(RenderGameOverlayEvent.Pre event) { - + if(event.type == ElementType.HOTBAR && (ModEventHandlerClient.shakeTimestamp + ModEventHandlerClient.shakeDuration - System.currentTimeMillis()) > 0 && ClientConfig.NUKE_HUD_SHAKE.get()) { double mult = (ModEventHandlerClient.shakeTimestamp + ModEventHandlerClient.shakeDuration - System.currentTimeMillis()) / (double) ModEventHandlerClient.shakeDuration * 2; double horizontal = MathHelper.clamp_double(Math.sin(System.currentTimeMillis() * 0.02), -0.7, 0.7) * 15; @@ -522,13 +520,13 @@ public class ModEventHandlerRenderer { @SubscribeEvent public void onRenderHand(RenderHandEvent event) { - + //can't use plaxer.getHeldItem() here because the item rendering persists for a few frames after hitting the switch key ItemStack toRender = Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender; - + if(toRender != null) { IItemRenderer renderer = MinecraftForgeClient.getItemRenderer(toRender, ItemRenderType.EQUIPPED_FIRST_PERSON); - + if(renderer instanceof ItemRenderWeaponBase) { ((ItemRenderWeaponBase) renderer).setPerspectiveAndRender(toRender, event.partialTicks); event.setCanceled(true); @@ -542,10 +540,10 @@ public class ModEventHandlerRenderer { private static Vec3 fogRGBMultiplier; private static boolean doesBiomeApply = false; private static long fogTimer = 0; - + /** Same procedure as getting the blended sky color but for fog */ public static Vec3 getFogBlendColor(World world, int playerX, int playerZ, float red, float green, float blue, double partialTicks) { - + long millis = System.currentTimeMillis() - fogTimer; if(playerX == fogX && playerZ == fogZ && fogInit && millis < 3000) return fogRGBMultiplier; @@ -554,7 +552,7 @@ public class ModEventHandlerRenderer { GameSettings settings = Minecraft.getMinecraft().gameSettings; int[] ranges = ForgeModContainer.blendRanges; int distance = 0; - + if(settings.fancyGraphics && settings.renderDistanceChunks >= 0) { distance = ranges[Math.min(settings.renderDistanceChunks, ranges.length - 1)]; } @@ -562,10 +560,10 @@ public class ModEventHandlerRenderer { float r = 0F; float g = 0F; float b = 0F; - + int divider = 0; doesBiomeApply = false; - + for(int x = -distance; x <= distance; x++) { for(int z = -distance; z <= distance; z++) { BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z); @@ -579,7 +577,7 @@ public class ModEventHandlerRenderer { fogX = playerX; fogZ = playerZ; - + if(doesBiomeApply) { fogRGBMultiplier = Vec3.createVectorHelper(r / divider, g / divider, b / divider); } else { @@ -588,25 +586,25 @@ public class ModEventHandlerRenderer { return fogRGBMultiplier; } - + /** Returns the current biome's fog color adjusted for brightness if in a crater, or the world's cached fog color if not */ public static Vec3 getBiomeFogColors(World world, BiomeGenBase biome, float r, float g, float b, double partialTicks) { - + if(biome instanceof BiomeGenCraterBase) { int color = biome.getSkyColorByTemp(biome.temperature); r = ((color & 0xff0000) >> 16) / 255F; g = ((color & 0x00ff00) >> 8) / 255F; b = (color & 0x0000ff) / 255F; - + float celestialAngle = world.getCelestialAngle((float) partialTicks); float skyBrightness = MathHelper.clamp_float(MathHelper.cos(celestialAngle * (float) Math.PI * 2.0F) * 2.0F + 0.5F, 0F, 1F); r *= skyBrightness; g *= skyBrightness; b *= skyBrightness; - + doesBiomeApply = true; } - + return Vec3.createVectorHelper(r, g, b); } } diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index f479e4fb0..2e94e548c 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -1,7 +1,9 @@ package com.hbm.main; -import java.util.List; - +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import codechicken.nei.api.IHighlightHandler; +import codechicken.nei.api.ItemInfo.Layout; import codechicken.nei.recipe.*; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockPlushie.TileEntityPlushie; @@ -13,11 +15,6 @@ import com.hbm.items.machine.ItemBattery; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; import com.hbm.lib.RefStrings; - -import codechicken.nei.api.API; -import codechicken.nei.api.IConfigureNEI; -import codechicken.nei.api.IHighlightHandler; -import codechicken.nei.api.ItemInfo.Layout; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -25,8 +22,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import java.util.List; + public class NEIConfig implements IConfigureNEI { - + @Override public void loadConfig() { for (TemplateRecipeHandler handler: NEIRegistry.listAllHandlers()) { @@ -36,13 +35,13 @@ public class NEIConfig implements IConfigureNEI { for(CustomMachineConfigJSON.MachineConfiguration conf : CustomMachineConfigJSON.niceList) { registerHandlerBypass(new CustomMachineHandler(conf)); } - + for(Item item : ItemGunBaseNT.secrets) { API.hideItem(new ItemStack(item)); } - + for(int i = 0; i < EnumAmmoSecret.values().length; i++) API.hideItem(new ItemStack(ModItems.ammo_secret, 1, i)); - + //Some things are even beyond my control...or are they? API.hideItem(ItemBattery.getEmptyBattery(ModItems.memory)); API.hideItem(ItemBattery.getFullBattery(ModItems.memory)); @@ -84,7 +83,7 @@ public class NEIConfig implements IConfigureNEI { API.hideItem(new ItemStack(ModBlocks.spotlight_fluoro_off)); API.hideItem(new ItemStack(ModBlocks.spotlight_halogen_off)); API.hideItem(new ItemStack(ModBlocks.spotlight_beam)); - + API.registerHighlightIdentifier(ModBlocks.plushie, new IHighlightHandler() { @Override public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) { int x = mop.blockX; @@ -100,12 +99,12 @@ public class NEIConfig implements IConfigureNEI { @Override public List handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, List currenttip, Layout layout) { return currenttip; } }); } - + public static void registerHandler(Object o) { API.registerRecipeHandler((ICraftingHandler) o); API.registerUsageHandler((IUsageHandler) o); } - + /** Bypasses the utterly useless restriction of one registered handler per class */ public static void registerHandlerBypass(Object o) { GuiCraftingRecipe.craftinghandlers.add((ICraftingHandler) o); diff --git a/src/main/java/com/hbm/main/NEIRegistry.java b/src/main/java/com/hbm/main/NEIRegistry.java index 1c40d9429..3e6589cd6 100644 --- a/src/main/java/com/hbm/main/NEIRegistry.java +++ b/src/main/java/com/hbm/main/NEIRegistry.java @@ -1,19 +1,18 @@ package com.hbm.main; +import codechicken.nei.recipe.TemplateRecipeHandler; +import com.hbm.config.VersatileConfig; +import com.hbm.handler.nei.*; + import java.util.ArrayList; import java.util.List; -import com.hbm.config.VersatileConfig; -import com.hbm.handler.nei.*; - -import codechicken.nei.recipe.TemplateRecipeHandler; - public class NEIRegistry { public static List handlers = new ArrayList(); - + public static List listAllHandlers() { - + if(!handlers.isEmpty()) return handlers; handlers.add(new AnvilRecipeHandler()); @@ -71,7 +70,7 @@ public class NEIRegistry { //this shit comes last handlers.add(new FluidRecipeHandler()); - + return handlers; } } diff --git a/src/main/java/com/hbm/main/NetworkHandler.java b/src/main/java/com/hbm/main/NetworkHandler.java new file mode 100644 index 000000000..06ff25dc1 --- /dev/null +++ b/src/main/java/com/hbm/main/NetworkHandler.java @@ -0,0 +1,215 @@ +package com.hbm.main; + +import com.hbm.handler.threading.PacketThreading; +import com.hbm.packet.PrecompiledPacket; +import cpw.mods.fml.common.network.FMLEmbeddedChannel; +import cpw.mods.fml.common.network.FMLOutboundHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper; +import cpw.mods.fml.relauncher.Side; +import gnu.trove.map.hash.TByteObjectHashMap; +import gnu.trove.map.hash.TObjectByteHashMap; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.PooledByteBufAllocator; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.CodecException; +import io.netty.handler.codec.MessageToMessageCodec; +import net.minecraft.entity.player.EntityPlayerMP; + +import java.lang.ref.WeakReference; +import java.util.EnumMap; +import java.util.List; + +import static cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.INBOUNDPACKETTRACKER; + +// Essentially the `SimpleNetworkWrapper` from FML but doesn't flush the packets immediately. Also now with a custom codec! +public class NetworkHandler { + + // Network codec for allowing packets to be "precompiled". + @ChannelHandler.Sharable + private static class PrecompilingNetworkCodec extends MessageToMessageCodec { + + private final TByteObjectHashMap> discriminators = new TByteObjectHashMap<>(); + private final TObjectByteHashMap> types = new TObjectByteHashMap<>(); + + public void addDiscriminator(int discriminator, Class type) { + discriminators.put((byte) discriminator, type); + types.put(type, (byte) discriminator); + } + + @Override + public void handlerAdded(ChannelHandlerContext ctx) { + ctx.attr(INBOUNDPACKETTRACKER).set(new ThreadLocal<>()); + } + + @Override + protected void encode(ChannelHandlerContext ctx, Object msg, List out) { + ByteBuf outboundBuf = PooledByteBufAllocator.DEFAULT.heapBuffer(); + byte discriminator; + Class msgClass = msg.getClass(); + discriminator = types.get(msgClass); + outboundBuf.writeByte(discriminator); + + if(msg instanceof PrecompiledPacket) // Precompiled packet to avoid race conditions/speed up serialization. + outboundBuf.writeBytes(((PrecompiledPacket) msg).getPreBuf()); + else if(msg instanceof IMessage) + ((IMessage) msg).toBytes(outboundBuf); + else + throw new CodecException("Unknown packet codec requested during encoding, expected IMessage/PrecompiledPacket, got " + msg.getClass().getName()); + + FMLProxyPacket proxy = new FMLProxyPacket(Unpooled.buffer().writeBytes(outboundBuf), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get()); + outboundBuf.release(); + WeakReference ref = ctx.attr(INBOUNDPACKETTRACKER).get().get(); + FMLProxyPacket old = ref == null ? null : ref.get(); + if (old != null) { + proxy.setDispatcher(old.getDispatcher()); + } + out.add(proxy); + } + + @Override + protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List out) throws Exception { + ByteBuf inboundBuf = msg.payload(); + byte discriminator = inboundBuf.readByte(); + Class originalMsgClass = discriminators.get(discriminator); + + if(originalMsgClass == null) + throw new CodecException("Undefined message for discriminator " + discriminator + " in channel " + msg.channel()); + + Object newMsg = originalMsgClass.newInstance(); + ctx.attr(INBOUNDPACKETTRACKER).get().set(new WeakReference<>(msg)); + + if(newMsg instanceof IMessage) // pretty much always the case + ((IMessage) newMsg).fromBytes(inboundBuf.slice()); + else + throw new CodecException("Unknown packet codec requested during decoding, expected IMessage/PrecompiledPacket, got " + msg.getClass().getName()); + + out.add(newMsg); + } + } + + private static FMLEmbeddedChannel clientChannel; + private static FMLEmbeddedChannel serverChannel; + + private static PrecompilingNetworkCodec packetCodec; + + public NetworkHandler(String name) { + packetCodec = new PrecompilingNetworkCodec(); + EnumMap channels = NetworkRegistry.INSTANCE.newChannel(name, packetCodec); + clientChannel = channels.get(Side.CLIENT); + serverChannel = channels.get(Side.SERVER); + } + + public void registerMessage(Class> messageHandler, Class requestMessageType, int discriminator, Side side) { + + packetCodec.addDiscriminator(discriminator, requestMessageType); + + FMLEmbeddedChannel channel; + if(side.isClient()) + channel = clientChannel; + else + channel = serverChannel; + String type = channel.findChannelHandlerNameForType(PrecompilingNetworkCodec.class); + SimpleChannelHandlerWrapper handler; + handler = new SimpleChannelHandlerWrapper<>(messageHandler, side, requestMessageType); + channel.pipeline().addAfter(type, messageHandler.getName(), handler); + } + + public static void flush() { + clientChannel.flush(); + serverChannel.flush(); + } + + public void sendToServer(IMessage message) { // No thread protection needed here, since the client never threads packets to the server. + clientChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); + clientChannel.write(message); + } + + public void sendToDimension(IMessage message, int dimensionId) { + if(!Thread.currentThread().getName().contains(PacketThreading.threadPrefix)) { + try { + PacketThreading.lock.lock(); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.DIMENSION); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId); + serverChannel.write(message); + } finally { + PacketThreading.lock.unlock(); + } + } else { + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.DIMENSION); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId); + serverChannel.write(message); + } + } + + public void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point) { + if(!Thread.currentThread().getName().contains(PacketThreading.threadPrefix)) { + try { + PacketThreading.lock.lock(); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); + serverChannel.write(message); + } finally { + PacketThreading.lock.unlock(); + } + } else { + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); + serverChannel.write(message); + } + } + + public void sendToAllAround(ByteBuf message, NetworkRegistry.TargetPoint point) { + if(!Thread.currentThread().getName().contains(PacketThreading.threadPrefix)) { + try { + PacketThreading.lock.lock(); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); + serverChannel.write(message); + } finally { + PacketThreading.lock.unlock(); + } + } else { + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); + serverChannel.write(message); + } + } + + public void sendTo(IMessage message, EntityPlayerMP player) { + if(!Thread.currentThread().getName().contains(PacketThreading.threadPrefix)) { + try { + PacketThreading.lock.lock(); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); + serverChannel.write(message); + } finally { + PacketThreading.lock.unlock(); + } + } else { + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); + serverChannel.write(message); + } + } + + public void sendToAll(IMessage message) { + if(!Thread.currentThread().getName().contains(PacketThreading.threadPrefix)) { + try { + PacketThreading.lock.lock(); + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + serverChannel.write(message); + } finally { + PacketThreading.lock.unlock(); + } + } else { + serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + serverChannel.write(message); + } + } +} diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index 6138868ef..4efabb02f 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -1,7 +1,5 @@ package com.hbm.main; -import java.util.HashMap; - import com.hbm.animloader.AnimatedModel; import com.hbm.animloader.Animation; import com.hbm.animloader.ColladaLoader; @@ -10,15 +8,16 @@ import com.hbm.render.anim.AnimationLoader; import com.hbm.render.anim.BusAnimation; import com.hbm.render.loader.HFRWavefrontObject; import com.hbm.render.loader.IModelCustomNamed; - import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import java.util.HashMap; + public class ResourceManager { - + ////Obj TEs - + //Turrets public static final IModelCustom turret_chekhov = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_chekhov.obj")).asVBO(); public static final IModelCustom turret_jeremy = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_jeremy.obj")).asVBO(); @@ -33,14 +32,14 @@ public class ResourceManager { public static final IModelCustom turret_sentry = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_sentry.obj")).asVBO(); public static final IModelCustom turret_howard_damaged = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/turrets/turret_howard_damaged.obj")).asVBO(); - + //Heaters public static final IModelCustom heater_firebox = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/firebox.obj"), false).asVBO(); public static final IModelCustom heater_oven = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/heating_oven.obj"), false).asVBO(); public static final IModelCustom heater_oilburner = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/oilburner.obj")).asVBO(); public static final IModelCustom heater_electric = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/electric_heater.obj"), false).asVBO(); public static final IModelCustom heater_heatex = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/heatex.obj")).asVBO(); - + //Heat Engines public static final IModelCustom stirling = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/stirling.obj")); public static final IModelCustom sawmill = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/sawmill.obj")); @@ -57,17 +56,17 @@ public class ResourceManager { public static final IModelCustom furnace_iron = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/furnace_iron.obj")); public static final IModelCustom furnace_steel = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/furnace_steel.obj")); public static final IModelCustom combination_oven = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/combination_oven.obj")); - + //Landmines public static final IModelCustom mine_ap = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/bombs/ap_mine.obj")).asVBO(); public static final IModelCustom mine_marelet = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/bombs/marelet.obj")).asVBO(); public static final IModelCustom mine_fat = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mine_fat.obj")); - + //Oil Pumps public static final IModelCustom derrick = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/derrick.obj")).asVBO(); public static final IModelCustom pumpjack = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/pumpjack.obj")).asVBO(); public static final IModelCustom fracking_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/fracking_tower.obj")).asVBO(); - + //Refinery public static final IModelCustom refinery = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/refinery.obj")).asVBO(); public static final IModelCustom vacuum_distill = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/vacuum_distill.obj")).asVBO(); @@ -82,7 +81,7 @@ public class ResourceManager { public static final IModelCustom compressor = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/compressor.obj")).asVBO(); public static final IModelCustom coker = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/coker.obj")).asVBO(); public static final IModelCustom pyrooven = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/pyrooven.obj")).asVBO(); - + //Flare Stack public static final IModelCustom oilflare = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/flare_stack.obj")).asVBO(); public static final IModelCustom chimney_brick = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chimney_brick.obj")).asVBO(); @@ -93,36 +92,36 @@ public class ResourceManager { public static final IModelCustom fluidtank_exploded = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fluidtank_exploded.obj")).asVBO(); public static final IModelCustom bat9000 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/bat9000.obj")).asVBO(); public static final IModelCustom orbus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/orbus.obj")).asVBO(); - + //Turbofan public static final IModelCustom turbofan = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/turbofan.obj")).asVBO(); - + //Gas Turbine public static final IModelCustom turbinegas = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/turbinegas.obj")).asVBO(); - + //Pumps public static final IModelCustom pump = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/pump.obj")).asVBO(); - + //Large Turbine public static final IModelCustom steam_engine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/steam_engine.obj")).asVBO(); public static final IModelCustom turbine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/turbine.obj")); public static final IModelCustom chungus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chungus.obj")).asVBO(); - + //Cooling Tower public static final IModelCustom tower_small = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/tower_small.obj")).asVBO(); public static final IModelCustom tower_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/tower_large.obj")).asVBO(); public static final IModelCustom condenser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/condenser.obj")).asVBO(); - + //Wood burner public static final IModelCustom wood_burner = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/wood_burner.obj")); - + //IGen public static final IModelCustom igen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/igen.obj")); - + //Combustion Engine public static final IModelCustom dieselgen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/dieselgen.obj")); public static final IModelCustom combustion_engine = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/combustion_engine.obj")).asVBO(); - + //Press public static final IModelCustom press_body = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/press_body.obj")); public static final IModelCustom press_head = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/press_head.obj")); @@ -130,14 +129,14 @@ public class ResourceManager { public static final IModelCustom epress_head = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/epress_head.obj")); public static final IModelCustom conveyor_press = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/conveyor_press.obj")); public static final IModelCustom ammo_press = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/ammo_press.obj")).asVBO(); - + //Assembler public static final IModelCustom assembler_body = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_body.obj")); public static final IModelCustom assembler_cog = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_cog.obj")); public static final IModelCustom assembler_slider = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_slider.obj")); public static final IModelCustom assembler_arm = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/assembler_new_arm.obj")); public static final IModelCustom assemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/assemfac.obj")); - + //Chemplant public static final IModelCustom chemplant_body = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_body.obj")); public static final IModelCustom chemplant_spinner = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_spinner.obj")); @@ -145,114 +144,114 @@ public class ResourceManager { public static final IModelCustom chemplant_fluid = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluid.hmf")); public static final IModelCustom chemplant_fluidcap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluidcap.hmf")); public static final IModelCustom chemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemfac.obj")); - + //Mixer public static final IModelCustom mixer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/mixer.obj")); - + //Arc Welder public static final IModelCustom arc_welder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/arc_welder.obj"), false).asVBO(); - + //Solderer public static final IModelCustom soldering_station = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/soldering_station.obj"), false).asVBO(); - + //Arc Furnace public static final IModelCustom arc_furnace = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/arc_furnace.obj")).asVBO(); - + //F6 TANKS public static final IModelCustom tank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/tank.obj")); - + //Centrifuge public static final IModelCustom centrifuge = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/centrifuge.obj")).asVBO(); public static final IModelCustom gascent = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/gascent.obj")).asVBO(); public static final IModelCustom silex = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/silex.obj")).asVBO(); public static final IModelCustom fel = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/fel.obj")).asVBO(); - + //Magnusson Device public static final IModelCustom microwave = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/microwave.obj")); - + //Big Man Johnson public static final IModelCustom autosaw = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/autosaw.obj")); - + //Mining Drill public static final IModelCustom mining_drill = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/mining_drill.obj")).asVBO(); public static final IModelCustom ore_slopper = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/ore_slopper.obj")).asVBO(); - + //Laser Miner public static final IModelCustom mining_laser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/mining_laser.obj")).asVBO(); - + //Crystallizer public static final IModelCustom crystallizer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/acidizer.obj")).asVBO(); - + //Cyclotron public static final IModelCustom cyclotron = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cyclotron.obj")).asVBO(); - + //Exposure Chamber public static final IModelCustom exposure_chamber = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/exposure_chamber.obj")).asVBO(); - + //RTG public static final IModelCustom rtg = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/rtg.obj")); //Waste Drum public static final IModelCustom waste_drum = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/drum.obj")); - + //Deuterium Tower public static final IModelCustom deuterium_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/machine_deuterium_tower.obj")).asVBO(); - + //Dark Matter Core public static final IModelCustom dfc_emitter = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/core_emitter.obj")); public static final IModelCustom dfc_receiver = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/core_receiver.obj")); public static final IModelCustom dfc_injector = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/core_injector.obj")); - + //Fan public static final IModelCustom fan = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/fan.obj")); - + //Piston Inserter public static final IModelCustom piston_inserter = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/piston_inserter.obj")); - + //Sphere public static final IModelCustom sphere_ruv = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/sphere_ruv.obj")); public static final IModelCustom sphere_iuv = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/sphere_iuv.obj")); public static final IModelCustom sphere_uv = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/sphere_uv.obj")); public static final IModelCustom sphere_uv_anim = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/sphere_uv.hmf")); - + //Meteor public static final IModelCustom meteor = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/weapons/meteor.obj")); - + //Radgen public static final IModelCustom radgen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radgen.obj")); - + //Small Reactor public static final IModelCustom reactor_small_base = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/reactors/reactor_small_base.obj")); public static final IModelCustom reactor_small_rods = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/reactors/reactor_small_rods.obj")); - + //Breeder public static final IModelCustom breeder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/breeder.obj")); - + //ITER public static final IModelCustom iter = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/iter.obj")).asVBO(); - + //ICF public static final IModelCustom icf = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/icf.obj")).asVBO(); - + //ICF public static final IModelCustom lpw2 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/lpw2.obj")).asVBO(); - + //Watz public static final IModelCustom watz = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/watz.obj")).asVBO(); public static final IModelCustom watz_pump = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/watz_pump.obj")).asVBO(); - + //FENSU public static final IModelCustom fensu = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/fensu.obj")).asVBO(); - + //Radar public static final IModelCustom radar_body = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/radar_base.obj"), false).asVBO(); public static final IModelCustom radar = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radar.obj"), false).asVBO(); public static final IModelCustom radar_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radar_large.obj"), false).asVBO(); public static final IModelCustom radar_screen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radar_screen.obj"), false).asVBO(); - + //Forcefield public static final IModelCustom forcefield_top = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/forcefield_top.obj")); - + //Bombs public static final IModelCustom bomb_gadget = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/bombs/gadget.obj")).asVBO(); public static final IModelCustom bomb_boy = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/LilBoy1.obj")); @@ -280,20 +279,20 @@ public class ResourceManager { //SatDock public static final IModelCustom satDock = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/sat_dock.obj")); - + //Solar Tower public static final IModelCustom solar_boiler = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/solar_boiler.obj")).asVBO(); public static final IModelCustom solar_mirror = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/solar_mirror.obj")); - + //Drain public static final IModelCustom drain = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/drain.obj")); - + //Vault Door public static final IModelCustom vault_cog = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vault_cog.obj")); public static final IModelCustom vault_frame = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vault_frame.obj")); public static final IModelCustom vault_teeth = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vault_teeth.obj")); public static final IModelCustom vault_label = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vault_label.obj")); - + //Blast Door public static final IModelCustom blast_door_base = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blast_door_base.obj")); public static final IModelCustom blast_door_tooth = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blast_door_tooth.obj")); @@ -341,13 +340,13 @@ public class ResourceManager { public static final ResourceLocation silo_hatch_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/doors/silo_hatch_large.png"); public static IModelCustomNamed silo_hatch_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/doors/silo_hatch_large.obj")).asVBO(); - + //Lights public static final IModelCustom lantern = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/trinkets/lantern.obj")); public static final IModelCustom cage_lamp = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/lights/cage_lamp.obj")); public static final IModelCustom fluorescent_lamp = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/lights/fluorescent_lamp.obj")); public static final IModelCustom flood_lamp = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/lights/flood_lamp.obj")); - + //Tesla Coil public static final IModelCustom tesla = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/tesla.obj")); public static final IModelCustom teslacrab = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/teslacrab.obj")); @@ -359,43 +358,43 @@ public class ResourceManager { public static final IModelCustom siege_ufo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/siege_ufo.obj")); public static final IModelCustom glyphid = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/mobs/glyphid.obj")); public static final IModelCustom drone = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/quadcopter.obj")); - + //ZIRNOX public static final IModelCustom zirnox = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/zirnox.obj")).asVBO(); public static final IModelCustom zirnox_destroyed = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/zirnox_destroyed.obj")).asVBO(); - + //Belt public static final IModelCustom arrow = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/arrow.obj")); - + //Network public static final IModelCustom connector = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/network/connector.obj")); public static final IModelCustom pylon_medium = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/network/pylon_medium.obj")); public static final IModelCustom pylon_large = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/network/pylon_large.obj")); public static final IModelCustom substation = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/network/substation.obj")); - + //Radiolysis public static final IModelCustom radiolysis = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/radiolysis.obj")); - + //RotaryFurnace public static final IModelCustom rotary_furnace = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/rotary_furnace.obj")).asVBO(); - + //Electrolyser public static final IModelCustom electrolyser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/electrolyser.obj")).asVBO(); - + //Charging Station public static final IModelCustom charger = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/blocks/charger.obj")); - + //DecoContainer (File Cabinet for now) public static final IModelCustom file_cabinet = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/file_cabinet.obj")); - + //TELEX public static final IModelCustom telex = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/telex.obj")); - + ////Textures TEs - + public static final ResourceLocation universal = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_.png"); public static final ResourceLocation universal_bright = new ResourceLocation(RefStrings.MODID, "textures/models/turbofan_blades.png"); - + public static final ResourceLocation turret_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/base.png"); public static final ResourceLocation turret_base_friendly_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/base_friendly.png"); public static final ResourceLocation turret_carriage_tex = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/carriage.png"); @@ -424,7 +423,7 @@ public class ResourceManager { public static final ResourceLocation turret_carriage_ciws_rusted = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/rusted/carriage_ciws.png"); public static final ResourceLocation turret_howard_rusted = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/rusted/howard.png"); public static final ResourceLocation turret_howard_barrels_rusted = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/rusted/howard_barrels.png"); - + public static final ResourceLocation brandon_explosive = new ResourceLocation(RefStrings.MODID, "textures/models/turrets/brandon_drum.png"); //Landmines @@ -436,7 +435,7 @@ public class ResourceManager { public static final ResourceLocation mine_marelet_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/mine_marelet.png"); public static final ResourceLocation mine_shrap_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/mine_shrapnel.png"); public static final ResourceLocation mine_fat_tex = new ResourceLocation(RefStrings.MODID, "textures/models/mine_fat.png"); - + //Heaters public static final ResourceLocation heater_firebox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/firebox.png"); public static final ResourceLocation heater_oven_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/heating_oven.png"); @@ -444,7 +443,7 @@ public class ResourceManager { public static final ResourceLocation heater_oilburner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/oilburner.png"); public static final ResourceLocation heater_electric_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/electric_heater.png"); public static final ResourceLocation heater_heatex_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/heater_heatex.png"); - + //Heat Engines public static final ResourceLocation stirling_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/stirling.png"); public static final ResourceLocation stirling_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/stirling_steel.png"); @@ -462,12 +461,12 @@ public class ResourceManager { public static final ResourceLocation furnace_iron_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/furnace_iron.png"); public static final ResourceLocation furnace_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/furnace_steel.png"); public static final ResourceLocation combination_oven_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/combination_oven.png"); - + //Oil Pumps public static final ResourceLocation derrick_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/derrick.png"); public static final ResourceLocation pumpjack_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/pumpjack.png"); public static final ResourceLocation fracking_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fracking_tower.png"); - + //Refinery public static final ResourceLocation refinery_tex = new ResourceLocation(RefStrings.MODID, "textures/models/refinery.png"); public static final ResourceLocation vacuum_distill_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/vacuum_distill.png"); @@ -481,27 +480,27 @@ public class ResourceManager { public static final ResourceLocation compressor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/compressor.png"); public static final ResourceLocation coker_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/coker.png"); public static final ResourceLocation pyrooven_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/pyrooven.png"); - + //Flare Stack public static final ResourceLocation oilflare_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/flare_stack.png"); public static final ResourceLocation chimney_brick_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chimney_brick.png"); public static final ResourceLocation chimney_industrial_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chimney_industrial.png"); - + //Tank public static final ResourceLocation tank_tex = new ResourceLocation(RefStrings.MODID, "textures/models/tank.png"); public static final ResourceLocation tank_inner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/tank/tank_inner.png"); public static final ResourceLocation tank_label_tex = new ResourceLocation(RefStrings.MODID, "textures/models/tank/tank_NONE.png"); public static final ResourceLocation bat9000_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/bat9000.png"); public static final ResourceLocation orbus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/orbus.png"); - + //Turbofan public static final ResourceLocation turbofan_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbofan.png"); public static final ResourceLocation turbofan_back_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbofan_back.png"); public static final ResourceLocation turbofan_afterburner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbofan_afterburner.png"); - + //Gas Turbine public static final ResourceLocation turbinegas_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbinegas.png"); - + //Pumps public static final ResourceLocation pump_steam_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/pump_steam.png"); public static final ResourceLocation pump_electric_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/pump_electric.png"); @@ -510,29 +509,29 @@ public class ResourceManager { public static final ResourceLocation steam_engine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/steam_engine.png"); public static final ResourceLocation turbine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/turbine.png"); public static final ResourceLocation chungus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chungus.png"); - + //Cooling Tower public static final ResourceLocation tower_small_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/tower_small.png"); public static final ResourceLocation tower_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/tower_large.png"); public static final ResourceLocation condenser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/condenser.png"); - + //Deuterium Tower public static final ResourceLocation deuterium_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/machine_deuterium_tower.png"); - + //Wood Burner public static final ResourceLocation wood_burner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/wood_burner.png"); - + //IGen public static final ResourceLocation igen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen.png"); public static final ResourceLocation igen_rotor = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen_rotor.png"); public static final ResourceLocation igen_cog = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen_cog.png"); public static final ResourceLocation igen_arm = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen_arm.png"); public static final ResourceLocation igen_pistons = new ResourceLocation(RefStrings.MODID, "textures/models/machines/igen_pistons.png"); - + //Combustion Engine public static final ResourceLocation dieselgen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/dieselgen.png"); public static final ResourceLocation combustion_engine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/combustion_engine.png"); - + //Press public static final ResourceLocation press_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/press_body.png"); public static final ResourceLocation press_head_tex = new ResourceLocation(RefStrings.MODID, "textures/models/press_head.png"); @@ -541,49 +540,49 @@ public class ResourceManager { public static final ResourceLocation conveyor_press_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/conveyor_press.png"); public static final ResourceLocation conveyor_press_belt_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/conveyor_press_belt.png"); public static final ResourceLocation ammo_press_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/ammo_press.png"); - + //Assembler public static final ResourceLocation assembler_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_base_new.png"); public static final ResourceLocation assembler_cog_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_cog_new.png"); public static final ResourceLocation assembler_slider_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_slider_new.png"); public static final ResourceLocation assembler_arm_tex = new ResourceLocation(RefStrings.MODID, "textures/models/assembler_arm_new.png"); public static final ResourceLocation assemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/assemfac.png"); - + //Chemplant public static final ResourceLocation chemplant_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_base_new.png"); public static final ResourceLocation chemplant_spinner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_spinner_new.png"); public static final ResourceLocation chemplant_piston_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_piston_new.png"); public static final ResourceLocation chemplant_fluid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lavabase_small.png"); public static final ResourceLocation chemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemfac.png"); - + //Mixer public static final ResourceLocation mixer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mixer.png"); - + //Welder public static final ResourceLocation arc_welder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/arc_welder.png"); - + //Solderer public static final ResourceLocation soldering_station_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/soldering_station.png"); - + //Arc Furnace public static final ResourceLocation arc_furnace_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/arc_furnace.png"); //F6 TANKS public static final ResourceLocation uf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/UF6Tank.png"); public static final ResourceLocation puf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/PUF6Tank.png"); - + //Centrifuge public static final ResourceLocation centrifuge_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/centrifuge.png"); public static final ResourceLocation gascent_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/gascent.png"); public static final ResourceLocation fel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fel.png"); public static final ResourceLocation silex_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/silex.png"); - + //Magnusson Device public static final ResourceLocation microwave_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/microwave.png"); - + //Big Man Johnson public static final ResourceLocation autosaw_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/autosaw.png"); - + //Mining Drill public static final ResourceLocation mining_drill_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mining_drill.png"); public static final ResourceLocation ore_slopper_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/ore_slopper.png"); @@ -592,10 +591,10 @@ public class ResourceManager { public static final ResourceLocation mining_laser_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mining_laser_base.png"); public static final ResourceLocation mining_laser_pivot_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mining_laser_pivot.png"); public static final ResourceLocation mining_laser_laser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mining_laser_laser.png"); - + //Crystallizer public static final ResourceLocation crystallizer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/acidizer.png"); - + //Cyclotron public static final ResourceLocation cyclotron_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron.png"); public static final ResourceLocation cyclotron_ashes = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_ashes.png"); @@ -606,40 +605,40 @@ public class ResourceManager { public static final ResourceLocation cyclotron_gavel_filled = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_gavel_filled.png"); public static final ResourceLocation cyclotron_coin = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_coin.png"); public static final ResourceLocation cyclotron_coin_filled = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_coin_filled.png"); - + //Exposure Chamber public static final ResourceLocation exposure_chamber_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/exposure_chamber.png"); - + //RTG public static final ResourceLocation rtg_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg.png"); public static final ResourceLocation rtg_cell_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg_cell.png"); public static final ResourceLocation rtg_polonium_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg_polonium.png"); - + //Waste Drum public static final ResourceLocation waste_drum_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/drum_gray.png"); - + //Dark Matter Core public static final ResourceLocation dfc_emitter_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_emitter.png"); public static final ResourceLocation dfc_receiver_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_receiver.png"); public static final ResourceLocation dfc_injector_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_injector.png"); public static final ResourceLocation dfc_stabilizer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_stabilizer.png"); - + //Fan public static final ResourceLocation fan_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fan.png"); - + //Piston_Inserter public static final ResourceLocation piston_inserter_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/piston_inserter.png"); - + //Radgen public static final ResourceLocation radgen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radgen.png"); - + //Small Reactor public static final ResourceLocation reactor_small_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/reactor_small_base.png"); public static final ResourceLocation reactor_small_rods_tex = new ResourceLocation(RefStrings.MODID, "textures/models/reactor_small_rods.png"); //Breeder public static final ResourceLocation breeder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/breeder.png"); - + //ITER public static final ResourceLocation iter_glass = new ResourceLocation(RefStrings.MODID, "textures/models/iter/glass.png"); public static final ResourceLocation iter_microwave = new ResourceLocation(RefStrings.MODID, "textures/models/iter/microwave.png"); @@ -653,22 +652,22 @@ public class ResourceManager { public static final ResourceLocation iter_torus_desh = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_desh.png"); public static final ResourceLocation iter_torus_chlorophyte = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_chlorophyte.png"); public static final ResourceLocation iter_torus_vaporwave = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_vaporwave.png"); - + //ICF public static final ResourceLocation icf_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/icf.png"); - + //Fat Fuck public static final ResourceLocation lpw2_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/lpw2.png"); public static final ResourceLocation lpw2_term_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/lpw2_term.png"); public static final ResourceLocation lpw2_error_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/lpw2_term_error.png"); - + //Watz public static final ResourceLocation watz_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/watz.png"); public static final ResourceLocation watz_pump_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/watz_pump.png"); - + //FENSU public static final ResourceLocation fensu_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fensu.png"); - + //Radar public static final ResourceLocation radar_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/radar_base.png"); public static final ResourceLocation radar_head_tex = new ResourceLocation(RefStrings.MODID, "textures/models/radar_head.png"); @@ -676,11 +675,11 @@ public class ResourceManager { public static final ResourceLocation radar_dish_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_dish.png"); public static final ResourceLocation radar_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_large.png"); public static final ResourceLocation radar_screen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_screen.png"); - + //Forcefield public static final ResourceLocation forcefield_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/forcefield_base.png"); public static final ResourceLocation forcefield_top_tex = new ResourceLocation(RefStrings.MODID, "textures/models/forcefield_top.png"); - + //Bombs public static final ResourceLocation bomb_gadget_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/gadget.png"); public static final ResourceLocation bomb_boy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lilboy.png"); @@ -700,7 +699,7 @@ public class ResourceManager { public static final ResourceLocation n45_chain_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/n45_chain.png"); public static final ResourceLocation fstbmb_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bombs/fstbmb.png"); public static final ResourceLocation dud_tex = new ResourceLocation(RefStrings.MODID, "textures/models/BalefireCrashed.png"); - + //Satellites public static final ResourceLocation sat_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/sat_base.png"); public static final ResourceLocation sat_radar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/sat_radar.png"); @@ -710,10 +709,10 @@ public class ResourceManager { public static final ResourceLocation sat_laser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/sat_laser.png"); public static final ResourceLocation sat_foeq_tex = new ResourceLocation(RefStrings.MODID, "textures/models/sat_foeq.png"); public static final ResourceLocation sat_foeq_burning_tex = new ResourceLocation(RefStrings.MODID, "textures/models/sat_foeq_burning.png"); - + //SatDock public static final ResourceLocation satdock_tex = new ResourceLocation(RefStrings.MODID, "textures/models/sat_dock.png"); - + //Vault Door public static final ResourceLocation vault_cog_tex = new ResourceLocation(RefStrings.MODID, "textures/models/vault_cog.png"); public static final ResourceLocation vault_frame_tex = new ResourceLocation(RefStrings.MODID, "textures/models/vault_frame.png"); @@ -726,20 +725,20 @@ public class ResourceManager { public static final ResourceLocation vault4_cog_tex = new ResourceLocation(RefStrings.MODID, "textures/models/vault4_cog.png"); public static final ResourceLocation vault4_label_111_tex = new ResourceLocation(RefStrings.MODID, "textures/models/vault4_label_111.png"); public static final ResourceLocation vault4_label_81_tex = new ResourceLocation(RefStrings.MODID, "textures/models/vault4_label_81.png"); - + //Solar Tower public static final ResourceLocation solar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/solar_boiler.png"); public static final ResourceLocation solar_mirror_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/solar_mirror.png"); - + //Drain public static final ResourceLocation drain_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/drain.png"); - + //Blast Door public static final ResourceLocation blast_door_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_base.png"); public static final ResourceLocation blast_door_tooth_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_tooth.png"); public static final ResourceLocation blast_door_slider_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_slider.png"); public static final ResourceLocation blast_door_block_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_block.png"); - + //Doors public static final ResourceLocation transition_seal_tex = new ResourceLocation(RefStrings.MODID, "textures/models/doors/transition_seal.png"); public static final ResourceLocation fire_door_tex = new ResourceLocation(RefStrings.MODID, "textures/models/doors/fire_door.png"); @@ -765,11 +764,11 @@ public class ResourceManager { public static final ResourceLocation glyphid_scout_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_scout.png"); public static final ResourceLocation glyphid_nuclear_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_nuclear.png"); public static final ResourceLocation glyphid_digger_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_digger.png"); - + //ZIRNOX public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png"); public static final ResourceLocation zirnox_destroyed_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox_destroyed.png"); - + //Electricity public static final ResourceLocation connector_tex = new ResourceLocation(RefStrings.MODID, "textures/models/network/connector.png"); public static final ResourceLocation pylon_medium_tex = new ResourceLocation(RefStrings.MODID, "textures/models/network/pylon_medium.png"); @@ -781,25 +780,25 @@ public class ResourceManager { //Radiolysis public static final ResourceLocation radiolysis_tex = new ResourceLocation(RefStrings.MODID, "textures/models/radiolysis.png"); - + //Rotary Furnace public static final ResourceLocation rotary_furnace_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rotary_furnace.png"); - + //Electrolyser public static final ResourceLocation electrolyser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/electrolyser.png"); - + //Charger public static final ResourceLocation charger_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/charger.png"); - + //DecoContainer public static final ResourceLocation file_cabinet_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet.png"); public static final ResourceLocation file_cabinet_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet_steel.png"); - + //TELEX public static final ResourceLocation telex_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/telex.png"); - + ////Obj Items - + //Shimmer Sledge public static final IModelCustom shimmer_sledge = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/shimmer_sledge.obj")); public static final IModelCustom shimmer_axe = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/shimmer_axe.obj")); @@ -884,7 +883,7 @@ public class ResourceManager { public static final HashMap flamethrower_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/flamethrower.json")); public static final HashMap stg77_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/stg77.json")); public static final HashMap lag_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/lag.json")); - + public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj")); public static final IModelCustom grenade_frag = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/grenade_frag.obj")); @@ -909,7 +908,7 @@ public class ResourceManager { public static final IModelCustom player_manly_af = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/armor/player_fem.obj")); public static final IModelCustom armor_envsuit = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/armor/envsuit.obj")); public static final IModelCustom armor_trenchmaster = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/armor/trenchmaster.obj")); - + ////Texture Items //Shimmer Sledge @@ -1002,6 +1001,7 @@ public class ResourceManager { public static final ResourceLocation panzerschreck_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/panzerschreck.png"); public static final ResourceLocation g3_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3.png"); public static final ResourceLocation shredder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shredder.png"); + public static final ResourceLocation shredder_orig_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shredder_orig.png"); public static final ResourceLocation sexy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sexy.png"); public static final ResourceLocation quadro_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/quadro.png"); public static final ResourceLocation quadro_rocket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/quadro_rocket.png"); @@ -1016,8 +1016,9 @@ public class ResourceManager { public static final ResourceLocation lasrifle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lasrifle.png"); public static final ResourceLocation hangman_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/hangman.png"); public static final ResourceLocation folly_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/moonlight.png"); - public static final ResourceLocation double_barrel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sacred_dragon.png"); - + public static final ResourceLocation double_barrel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/double_barrel.png"); + public static final ResourceLocation double_barrel_sacred_dragon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/double_barrel_sacred_dragon.png"); + public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png"); public static final ResourceLocation ff_gold = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/gold.png"); @@ -1096,7 +1097,7 @@ public class ResourceManager { public static final ResourceLocation trenchmaster_arm = new ResourceLocation(RefStrings.MODID, "textures/armor/trenchmaster_arm.png"); public static final ResourceLocation mod_tesla = new ResourceLocation(RefStrings.MODID, "textures/armor/mod_tesla.png"); - + public static final ResourceLocation armor_bismuth_tex = new ResourceLocation(RefStrings.MODID, "textures/armor/bismuth.png"); public static final ResourceLocation wings_murk = new ResourceLocation(RefStrings.MODID, "textures/armor/wings_murk.png"); @@ -1109,13 +1110,13 @@ public class ResourceManager { public static final ResourceLocation no9 = new ResourceLocation(RefStrings.MODID, "textures/armor/no9.png"); public static final ResourceLocation no9_insignia = new ResourceLocation(RefStrings.MODID, "textures/armor/no9_insignia.png"); public static final ResourceLocation goggles = new ResourceLocation(RefStrings.MODID, "textures/armor/goggles.png"); - - public static final ResourceLocation player_manly_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/player_fem.png"); - - - + + public static final ResourceLocation player_manly_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/player_fem.png"); + + + ////Obj Entities - + //Boxcar public static final IModelCustom boxcar = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/boxcar.obj")); public static final IModelCustom duchessgambit = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/duchessgambit.obj")); @@ -1125,17 +1126,17 @@ public class ResourceManager { public static final IModelCustom tom_main = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/weapons/tom_main.obj")); public static final IModelCustom tom_flame = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/weapons/tom_flame.hmf")); public static final IModelCustom nikonium = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/nikonium.obj")); - + //Projectiles public static final IModelCustom projectiles = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/projectiles/projectiles.obj")); public static final IModelCustom leadburster = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/projectiles/leadburster.obj")); public static final IModelCustom casings = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/effect/casings.obj")); - + //Bomber public static final IModelCustom dornier = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/dornier.obj")); public static final IModelCustom b29 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/b29.obj")); public static final IModelCustom c130 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/c130.obj")).asVBO(); - + //Missiles public static final IModelCustom missileV2 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/missile_v2.obj")).asVBO(); public static final IModelCustom missileABM = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/missile_abm.obj")).asVBO(); @@ -1155,7 +1156,7 @@ public class ResourceManager { public static final IModelCustom soyuz_launcher_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_tower.obj"), false).asVBO(); public static final IModelCustom soyuz_launcher_support_base = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support_base.obj"), false).asVBO(); public static final IModelCustom soyuz_launcher_support = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support.obj"), false).asVBO(); - + //Missile Parts public static final IModelCustom missile_pad = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/weapons/launch_pad_silo.obj")); public static final IModelCustom missile_erector = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/launch_pad_erector.obj")).asVBO(); @@ -1206,7 +1207,7 @@ public class ResourceManager { public static final IModelCustom mp_f_15_hydrogen = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_f_15_hydrogen.obj")); public static final IModelCustom mp_f_15_20_kerosene = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_f_15_20_kerosene.obj")); public static final IModelCustom mp_f_20 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_f_20.obj")); - + public static final IModelCustom mp_w_10_he = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_w_10_he.obj")); public static final IModelCustom mp_w_10_incendiary = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_w_10_incendiary.obj")); public static final IModelCustom mp_w_10_buster = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_w_10_buster.obj")); @@ -1221,7 +1222,7 @@ public class ResourceManager { public static final IModelCustom mp_w_15_balefire = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_w_15_balefire.obj")); public static final IModelCustom mp_w_15_turbine = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_w_15_turbine.obj")); public static final IModelCustom mp_w_20 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_parts/mp_w_20.obj")); - + //Carts public static final IModelCustom cart = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vehicles/cart.obj")); public static final IModelCustom cart_destroyer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vehicles/cart_destroyer.obj")); @@ -1229,17 +1230,17 @@ public class ResourceManager { public static final IModelCustom train_cargo_tram = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vehicles/tram.obj")); public static final IModelCustom train_cargo_tram_trailer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/vehicles/tram_trailer.obj")); public static final IModelCustom tunnel_bore = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/vehicles/tunnel_bore.obj")); - + //Drones public static final IModelCustom delivery_drone = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/drone.obj")); - + ////Texture Entities - + //Blast public static final ResourceLocation fireball = new ResourceLocation(RefStrings.MODID, "textures/models/explosion/fireball.png"); public static final ResourceLocation balefire = new ResourceLocation(RefStrings.MODID, "textures/models/explosion/balefire.png"); public static final ResourceLocation tomblast = new ResourceLocation(RefStrings.MODID, "textures/models/explosion/tomblast.png"); - + //Boxcar public static final ResourceLocation boxcar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/boxcar.png"); public static final ResourceLocation duchessgambit_tex = new ResourceLocation(RefStrings.MODID, "textures/models/duchessgambit.png"); @@ -1249,7 +1250,7 @@ public class ResourceManager { public static final ResourceLocation tom_main_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tom_main.png"); public static final ResourceLocation tom_flame_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tom_flame.png"); public static final ResourceLocation nikonium_tex = new ResourceLocation(RefStrings.MODID, "textures/models/misc/nikonium.png"); - + //Projectiles public static final ResourceLocation bullet_pistol_tex = new ResourceLocation(RefStrings.MODID, "textures/models/projectiles/bullet_pistol.png"); public static final ResourceLocation bullet_rifle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/projectiles/bullet_rifle.png"); @@ -1262,7 +1263,7 @@ public class ResourceManager { public static final ResourceLocation mini_mirv_tex = new ResourceLocation(RefStrings.MODID, "textures/models/projectiles/mini_mirv.png"); public static final ResourceLocation leadburster_tex = new ResourceLocation(RefStrings.MODID, "textures/models/projectiles/leadburster.png"); public static final ResourceLocation casings_tex = new ResourceLocation(RefStrings.MODID, "textures/particle/casings.png"); - + //Bomber public static final ResourceLocation dornier_1_tex = new ResourceLocation(RefStrings.MODID, "textures/models/dornier_1.png"); public static final ResourceLocation dornier_2_tex = new ResourceLocation(RefStrings.MODID, "textures/models/dornier_2.png"); @@ -1272,7 +1273,7 @@ public class ResourceManager { public static final ResourceLocation b29_2_tex = new ResourceLocation(RefStrings.MODID, "textures/models/b29_2.png"); public static final ResourceLocation b29_3_tex = new ResourceLocation(RefStrings.MODID, "textures/models/b29_3.png"); public static final ResourceLocation c130_0_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/c130_0.png"); - + //Missiles public static final ResourceLocation missileV2_HE_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_v2.png"); public static final ResourceLocation missileV2_IN_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_v2_inc.png"); @@ -1307,7 +1308,7 @@ public class ResourceManager { public static final ResourceLocation missileMicroSchrab_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_micro_schrab.png"); public static final ResourceLocation missileMicroEMP_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_micro_emp.png"); public static final ResourceLocation missileMicroTest_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_test.png"); - + public static final ResourceLocation soyuz_engineblock = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/engineblock.png"); public static final ResourceLocation soyuz_bottomstage = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/bottomstage.png"); public static final ResourceLocation soyuz_topstage = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/topstage.png"); @@ -1359,7 +1360,7 @@ public class ResourceManager { public static final ResourceLocation soyuz_launcher_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz_launcher/launcher_tower.png"); public static final ResourceLocation soyuz_launcher_support_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz_launcher/launcher_support_base.png"); public static final ResourceLocation soyuz_launcher_support_tex = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz_launcher/launcher_support.png"); - + //Missile Parts public static final ResourceLocation missile_pad_tex = new ResourceLocation(RefStrings.MODID, "textures/models/launchpad/silo.png"); public static final ResourceLocation missile_pad_rusted_tex = new ResourceLocation(RefStrings.MODID, "textures/models/launchpad/silo_rusted.png"); @@ -1380,7 +1381,7 @@ public class ResourceManager { public static final ResourceLocation launch_table_large_scaffold_connector_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/launch_table_large_scaffold_connector.png"); public static final ResourceLocation launch_table_small_scaffold_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/launch_table_small_scaffold_base.png"); public static final ResourceLocation launch_table_small_scaffold_connector_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/launch_table_small_scaffold_connector.png"); - + public static final ResourceLocation mp_t_10_kerosene_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_10_kerosene.png"); public static final ResourceLocation mp_t_10_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_10_solid.png"); public static final ResourceLocation mp_t_10_xenon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_10_xenon.png"); @@ -1394,7 +1395,7 @@ public class ResourceManager { public static final ResourceLocation mp_t_15_balefire_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_15_balefire.png"); public static final ResourceLocation mp_t_15_balefire_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_15_balefire_large.png"); public static final ResourceLocation mp_t_15_balefire_large_rad_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_15_balefire_large_rad.png"); - + public static final ResourceLocation mp_t_20_kerosene_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_20_kerosene.png"); public static final ResourceLocation mp_t_20_kerosene_dual_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_20_kerosene_dual.png"); public static final ResourceLocation mp_t_20_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/thrusters/mp_t_20_solid.png"); @@ -1417,7 +1418,7 @@ public class ResourceManager { public static final ResourceLocation mp_f_10_kerosene_sleek_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_kerosene_sleek.png"); public static final ResourceLocation mp_f_10_kerosene_metal_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_kerosene_metal.png"); public static final ResourceLocation mp_f_10_kerosene_taint_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_kerosene_taint.png"); - + public static final ResourceLocation mp_f_10_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_solid.png"); public static final ResourceLocation mp_f_10_solid_flames_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_solid_flames.png"); public static final ResourceLocation mp_f_10_solid_insulation_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_solid_insulation.png"); @@ -1430,7 +1431,7 @@ public class ResourceManager { public static final ResourceLocation mp_f_10_xenon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_xenon.png"); public static final ResourceLocation mp_f_10_xenon_bhole_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_xenon_bhole.png"); - + public static final ResourceLocation mp_f_10_long_kerosene_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_kerosene.png"); public static final ResourceLocation mp_f_10_long_kerosene_camo_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_kerosene_camo.png"); public static final ResourceLocation mp_f_10_long_kerosene_desert_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_kerosene_desert.png"); @@ -1442,7 +1443,7 @@ public class ResourceManager { public static final ResourceLocation mp_f_10_long_kerosene_dash_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_long_kerosene_dash.png"); public static final ResourceLocation mp_f_10_long_kerosene_taint_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_long_kerosene_taint.png"); public static final ResourceLocation mp_f_10_long_kerosene_vap_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_long_kerosene_vap.png"); - + public static final ResourceLocation mp_f_10_long_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_solid.png"); public static final ResourceLocation mp_f_10_long_solid_flames_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_solid_flames.png"); public static final ResourceLocation mp_f_10_long_solid_insulation_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_solid_insulation.png"); @@ -1450,12 +1451,12 @@ public class ResourceManager { public static final ResourceLocation mp_f_10_long_solid_soviet_glory_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_long_solid_soviet_glory.png"); public static final ResourceLocation mp_f_10_long_solid_bullet_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_long_solid_bullet.png"); public static final ResourceLocation mp_f_10_long_solid_silvermoonlight_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_10_long_solid_silvermoonlight.png"); - + public static final ResourceLocation mp_f_10_15_kerosene_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_15_kerosene.png"); public static final ResourceLocation mp_f_10_15_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_15_solid.png"); public static final ResourceLocation mp_f_10_15_hydrogen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_15_hydrogen.png"); public static final ResourceLocation mp_f_10_15_balefire_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_10_15_balefire.png"); - + public static final ResourceLocation mp_f_15_kerosene_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_kerosene.png"); public static final ResourceLocation mp_f_15_kerosene_camo_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_kerosene_camo.png"); public static final ResourceLocation mp_f_15_kerosene_desert_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_kerosene_desert.png"); @@ -1471,7 +1472,7 @@ public class ResourceManager { public static final ResourceLocation mp_f_15_kerosene_pip_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_15_kerosene_pip.png"); public static final ResourceLocation mp_f_15_kerosene_taint_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/contest/mp_f_15_kerosene_taint.png"); public static final ResourceLocation mp_f_15_kerosene_yuck_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_kerosene_yuck.png"); - + public static final ResourceLocation mp_f_15_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_solid.png"); public static final ResourceLocation mp_f_15_solid_insulation_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_solid_insulation.png"); public static final ResourceLocation mp_f_15_solid_desh_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_solid_desh.png"); @@ -1492,7 +1493,7 @@ public class ResourceManager { public static final ResourceLocation mp_f_15_20_kerosene_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_20_kerosene.png"); public static final ResourceLocation mp_f_15_20_kerosene_magnusson_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_20_kerosene_magnusson.png"); public static final ResourceLocation mp_f_15_20_solid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/fuselages/mp_f_15_20_solid.png"); - + public static final ResourceLocation mp_w_10_he_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/warheads/mp_w_10_he.png"); public static final ResourceLocation mp_w_10_incendiary_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/warheads/mp_w_10_incendiary.png"); public static final ResourceLocation mp_w_10_buster_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/warheads/mp_w_10_buster.png"); @@ -1508,7 +1509,7 @@ public class ResourceManager { public static final ResourceLocation mp_w_15_n2_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/warheads/mp_w_15_n2.png"); public static final ResourceLocation mp_w_15_balefire_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/warheads/mp_w_15_balefire.png"); public static final ResourceLocation mp_w_15_turbine_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_parts/warheads/mp_w_15_turbine.png"); - + //Carts public static final ResourceLocation cart_metal = new ResourceLocation(RefStrings.MODID, "textures/entity/cart_metal.png"); public static final ResourceLocation cart_blank = new ResourceLocation(RefStrings.MODID, "textures/entity/cart_metal_naked.png"); @@ -1519,12 +1520,12 @@ public class ResourceManager { public static final ResourceLocation cart_semtex_top = new ResourceLocation(RefStrings.MODID, "textures/blocks/semtex_bottom.png"); public static final ResourceLocation train_tram = new ResourceLocation(RefStrings.MODID, "textures/models/trains/tram.png"); public static final ResourceLocation tram_trailer = new ResourceLocation(RefStrings.MODID, "textures/models/trains/tram_trailer.png"); - + //Drone public static final ResourceLocation delivery_drone_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/drone.png"); public static final ResourceLocation delivery_drone_express_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/drone_express.png"); public static final ResourceLocation delivery_drone_request_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/drone_request.png"); - + //ISBRHs public static final IModelCustom scaffold = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/scaffold.obj")); public static final IModelCustom taperecorder = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/taperecorder.obj")); @@ -1544,7 +1545,7 @@ public class ResourceManager { public static final IModelCustom toaster = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/toaster.obj")); public static final IModelCustom deco_computer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/puter.obj")); - + // Some RBMK elements are loaded twice due to VBOs not supporting tessellation public static final IModelCustom rbmk_element = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/rbmk/rbmk_element.obj")); public static final IModelCustom rbmk_element_vbo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/rbmk/rbmk_element.obj")).asVBO(); @@ -1585,7 +1586,7 @@ public class ResourceManager { public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj")); public static final IModelCustom charge_c4 = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_c4.obj")); - + //RBMK DEBRIS public static final IModelCustom deb_blank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/projectiles/deb_blank.obj")); public static final IModelCustom deb_element = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/projectiles/deb_element.obj")); @@ -1599,5 +1600,5 @@ public class ResourceManager { public static final IModelCustom deb_zirnox_element = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_element.obj")); public static final IModelCustom deb_zirnox_exchanger = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_exchanger.obj")); public static final IModelCustom deb_zirnox_shrapnel = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_shrapnel.obj")); - + } diff --git a/src/main/java/com/hbm/main/ServerProxy.java b/src/main/java/com/hbm/main/ServerProxy.java index da21cb2f7..25f965437 100644 --- a/src/main/java/com/hbm/main/ServerProxy.java +++ b/src/main/java/com/hbm/main/ServerProxy.java @@ -1,18 +1,17 @@ package com.hbm.main; -import java.util.ArrayList; -import java.util.List; - import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.saveddata.TomSaveData; import com.hbm.sound.AudioWrapper; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import java.util.ArrayList; +import java.util.List; + public class ServerProxy { //sort by estimated time of display. longer lasting ones should be sorted at the top. @@ -37,25 +36,23 @@ public class ServerProxy { public void registerBlockRenderer() { } public void registerGunCfg() { } public void handleNHNEICompat() { } - - public void particleControl(double x, double y, double z, int type) { } public void spawnParticle(double x, double y, double z, String type, float[] args) { } - + public void effectNT(NBTTagCompound data) { } public void registerMissileItems() { } public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float range, float pitch) { return null; } public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float range, float pitch, int keepAlive) { return null; } - + public void playSound(String sound, Object data) { } public void displayTooltip(String msg, int id) { displayTooltip(msg, 1000, id); } public void displayTooltip(String msg, int time, int id) { } - + public boolean getIsKeyPressed(EnumKeybind key) { return false; } @@ -68,29 +65,29 @@ public class ServerProxy { } public void openLink(String url) { } - + public List getSubItems(ItemStack stack) { - + List list = new ArrayList(); list.add(stack); return list; } - + public float getImpactDust(World world) { return TomSaveData.forWorld(world).dust; } - + public float getImpactFire(World world) { return TomSaveData.forWorld(world).fire; } - + public boolean getImpact(World world) { return TomSaveData.forWorld(world).impact; } - + public void playSoundClient(double x, double y, double z, String sound, float volume, float pitch) { } - + public String getLanguageCode() { return "en_US"; } - + public int getStackColor(ItemStack stack, boolean amplify) { return 0x000000; } -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/packet/PacketDispatcher.java b/src/main/java/com/hbm/packet/PacketDispatcher.java index ac69da882..b749cfdd3 100644 --- a/src/main/java/com/hbm/packet/PacketDispatcher.java +++ b/src/main/java/com/hbm/packet/PacketDispatcher.java @@ -1,27 +1,22 @@ package com.hbm.packet; import com.hbm.lib.RefStrings; +import com.hbm.main.NetworkHandler; import com.hbm.packet.toclient.*; import com.hbm.packet.toserver.*; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; public class PacketDispatcher { - //Mark 1 Packet Sending Device - public static final SimpleNetworkWrapper wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(RefStrings.MODID); + //Mark 1.5 Packet Sending Device + public static final NetworkHandler wrapper = new NetworkHandler(RefStrings.MODID); - public static final void registerPackets() { + public static void registerPackets() { int i = 0; - - //Sound packet that keeps client and server separated - wrapper.registerMessage(LoopedSoundPacket.Handler.class, LoopedSoundPacket.class, i++, Side.CLIENT); + //Signals server to consume items and create template wrapper.registerMessage(ItemFolderPacket.Handler.class, ItemFolderPacket.class, i++, Side.SERVER); - //Electricity gauge for GUI rendering - wrapper.registerMessage(AuxElectricityPacket.Handler.class, AuxElectricityPacket.class, i++, Side.CLIENT); //Siren packet for looped sounds wrapper.registerMessage(TESirenPacket.Handler.class, TESirenPacket.class, i++, Side.CLIENT); //Signals server to change ItemStacks @@ -42,8 +37,6 @@ public class PacketDispatcher { wrapper.registerMessage(TEFFPacket.Handler.class, TEFFPacket.class, i++, Side.CLIENT); //Sends button information for ItemGunBase wrapper.registerMessage(GunButtonPacket.Handler.class, GunButtonPacket.class, i++, Side.SERVER); - //Packet to send block break particles - wrapper.registerMessage(AuxParticlePacket.Handler.class, AuxParticlePacket.class, i++, Side.CLIENT); //Signals server to buy offer from bobmazon wrapper.registerMessage(ItemBobmazonPacket.Handler.class, ItemBobmazonPacket.class, i++, Side.SERVER); //Packet to send missile multipart information to TEs @@ -74,11 +67,8 @@ public class PacketDispatcher { wrapper.registerMessage(PermaSyncPacket.Handler.class, PermaSyncPacket.class, i++, Side.CLIENT); //Syncs biome information for single positions or entire chunks wrapper.registerMessage(BiomeSyncPacket.Handler.class, BiomeSyncPacket.class, i++, Side.CLIENT); - - //Tile sync - wrapper.registerMessage(AuxGaugePacket.Handler.class, AuxGaugePacket.class, i++, Side.CLIENT); //The horrid one - wrapper.registerMessage(NBTPacket.Handler.class, NBTPacket.class, i++, Side.CLIENT); //The convenient but laggy one - wrapper.registerMessage(BufPacket.Handler.class, BufPacket.class, i++, Side.CLIENT); //The not-so-convenient but not laggy one + //The not-so-convenient but not laggy one + wrapper.registerMessage(BufPacket.Handler.class, BufPacket.class, i++, Side.CLIENT); } - + } diff --git a/src/main/java/com/hbm/packet/PrecompiledPacket.java b/src/main/java/com/hbm/packet/PrecompiledPacket.java new file mode 100644 index 000000000..30d4c456d --- /dev/null +++ b/src/main/java/com/hbm/packet/PrecompiledPacket.java @@ -0,0 +1,35 @@ +package com.hbm.packet; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +/** + * Abstract class for precompiled packets. This should be used if the packet is going to be threaded through the `PacketThreading` handler. + */ +public abstract class PrecompiledPacket implements IMessage { + + ByteBuf preCompiledBuf; + + /** + * Returns a precompiled buffer used to avoid race conditions when sending certain packets in threads. + * @return The precompiled packet in a `ByteBuf`. + */ + public ByteBuf getPreBuf() { + if(preCompiledBuf == null || preCompiledBuf.readableBytes() <= 0 /* No data written */) + this.makePreBuf(); + return preCompiledBuf; + } + + /** + * Forcefully creates the precompiled buffer, use `getPreBuf()` whenever possible. + */ + public void makePreBuf() { + if(preCompiledBuf != null) + preCompiledBuf.release(); + + preCompiledBuf = Unpooled.buffer(); + + this.toBytes(preCompiledBuf); // Create buffer and read data to it. + } +} diff --git a/src/main/java/com/hbm/packet/toclient/AuxElectricityPacket.java b/src/main/java/com/hbm/packet/toclient/AuxElectricityPacket.java deleted file mode 100644 index 571f925ce..000000000 --- a/src/main/java/com/hbm/packet/toclient/AuxElectricityPacket.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.hbm.packet.toclient; - -import api.hbm.energymk2.IEnergyHandlerMK2; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import io.netty.buffer.ByteBuf; -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; - -@Deprecated //use the NBT packet instead -public class AuxElectricityPacket implements IMessage { - - int x; - int y; - int z; - long charge; - - public AuxElectricityPacket() - { - - } - - public AuxElectricityPacket(int x, int y, int z, long charge) - { - this.x = x; - this.y = y; - this.z = z; - this.charge = charge; - } - - @Override - public void fromBytes(ByteBuf buf) { - x = buf.readInt(); - y = buf.readInt(); - z = buf.readInt(); - charge = buf.readLong(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(x); - buf.writeInt(y); - buf.writeInt(z); - buf.writeLong(charge); - } - - public static class Handler implements IMessageHandler { - - @Override - @SideOnly(Side.CLIENT) - public IMessage onMessage(AuxElectricityPacket m, MessageContext ctx) { - try { - TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); - - if (te instanceof IEnergyHandlerMK2) { - - IEnergyHandlerMK2 gen = (IEnergyHandlerMK2) te; - gen.setPower(m.charge); - } - } catch (Exception x) { } - return null; - } - } -} diff --git a/src/main/java/com/hbm/packet/toclient/AuxGaugePacket.java b/src/main/java/com/hbm/packet/toclient/AuxGaugePacket.java deleted file mode 100644 index 190a7f4b4..000000000 --- a/src/main/java/com/hbm/packet/toclient/AuxGaugePacket.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.hbm.packet.toclient; - -import com.hbm.interfaces.Spaghetti; -import com.hbm.items.weapon.ItemCustomMissilePart.PartSize; -import com.hbm.tileentity.TileEntityMachineBase; -import com.hbm.tileentity.bomb.TileEntityCompactLauncher; -import com.hbm.tileentity.bomb.TileEntityLaunchTable; -import com.hbm.tileentity.machine.TileEntityMachineArcFurnace; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import io.netty.buffer.ByteBuf; -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; - -@Spaghetti("Changing all machines to use TileEntityMachineBase will reduce the total chaos in this class") -@Deprecated //use the NBT packet instead -public class AuxGaugePacket implements IMessage { - - int x; - int y; - int z; - int value; - int id; - - public AuxGaugePacket() - { - - } - - public AuxGaugePacket(int x, int y, int z, int value, int id) - { - this.x = x; - this.y = y; - this.z = z; - this.value = value; - this.id = id; - } - - @Override - public void fromBytes(ByteBuf buf) { - x = buf.readInt(); - y = buf.readInt(); - z = buf.readInt(); - value = buf.readInt(); - id = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(x); - buf.writeInt(y); - buf.writeInt(z); - buf.writeInt(value); - buf.writeInt(id); - } - - public static class Handler implements IMessageHandler { - - @Override - @SideOnly(Side.CLIENT) - public IMessage onMessage(AuxGaugePacket m, MessageContext ctx) { - try { - TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); - if (te instanceof TileEntityMachineArcFurnace) { - TileEntityMachineArcFurnace furn = (TileEntityMachineArcFurnace)te; - - if(m.id == 0) - furn.dualCookTime = m.value; - } - if (te instanceof TileEntityCompactLauncher) { - TileEntityCompactLauncher launcher = (TileEntityCompactLauncher)te; - - launcher.solid = m.value; - } - if (te instanceof TileEntityLaunchTable) { - TileEntityLaunchTable launcher = (TileEntityLaunchTable)te; - - if(m.id == 0) - launcher.solid = m.value; - if(m.id == 1) - launcher.padSize = PartSize.values()[m.value]; - } - - if(te instanceof TileEntityMachineBase) { - ((TileEntityMachineBase)te).processGauge(m.value, m.id); - } - - } catch (Exception x) {} - return null; - } - } -} diff --git a/src/main/java/com/hbm/packet/toclient/AuxParticlePacket.java b/src/main/java/com/hbm/packet/toclient/AuxParticlePacket.java deleted file mode 100644 index 317e121c0..000000000 --- a/src/main/java/com/hbm/packet/toclient/AuxParticlePacket.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hbm.packet.toclient; - -import com.hbm.main.MainRegistry; - -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 io.netty.buffer.ByteBuf; - -public class AuxParticlePacket implements IMessage { - - double x; - double y; - double z; - int type; - - public AuxParticlePacket() - { - - } - - public AuxParticlePacket(double x, double y, double z, int type) - { - this.x = x; - this.y = y; - this.z = z; - this.type = type; - } - - @Override - public void fromBytes(ByteBuf buf) { - x = buf.readDouble(); - y = buf.readDouble(); - z = buf.readDouble(); - type = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeDouble(x); - buf.writeDouble(y); - buf.writeDouble(z); - buf.writeInt(type); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(AuxParticlePacket m, MessageContext ctx) { - - try { - - MainRegistry.proxy.particleControl(m.x, m.y, m.z, m.type); - - } catch(Exception x) { } - - return null; - } - } -} diff --git a/src/main/java/com/hbm/packet/toclient/AuxParticlePacketNT.java b/src/main/java/com/hbm/packet/toclient/AuxParticlePacketNT.java index beace3830..a9d44e0b7 100644 --- a/src/main/java/com/hbm/packet/toclient/AuxParticlePacketNT.java +++ b/src/main/java/com/hbm/packet/toclient/AuxParticlePacketNT.java @@ -14,22 +14,22 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; public class AuxParticlePacketNT implements IMessage { - + PacketBuffer buffer; public AuxParticlePacketNT() { } public AuxParticlePacketNT(NBTTagCompound nbt, double x, double y, double z) { - + this.buffer = new PacketBuffer(Unpooled.buffer()); nbt.setDouble("posX", x); nbt.setDouble("posY", y); nbt.setDouble("posZ", z); - + try { buffer.writeNBTTagCompoundToBuffer(nbt); - + } catch (IOException e) { e.printStackTrace(); } @@ -37,7 +37,7 @@ public class AuxParticlePacketNT implements IMessage { @Override public void fromBytes(ByteBuf buf) { - + if (buffer == null) { buffer = new PacketBuffer(Unpooled.buffer()); } @@ -46,7 +46,7 @@ public class AuxParticlePacketNT implements IMessage { @Override public void toBytes(ByteBuf buf) { - + if (buffer == null) { buffer = new PacketBuffer(Unpooled.buffer()); } @@ -54,25 +54,27 @@ public class AuxParticlePacketNT implements IMessage { } public static class Handler implements IMessageHandler { - + @Override public IMessage onMessage(AuxParticlePacketNT m, MessageContext ctx) { - + if(Minecraft.getMinecraft().theWorld == null) return null; - + try { NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); - + if(nbt != null) MainRegistry.proxy.effectNT(nbt); - + } catch (IOException e) { e.printStackTrace(); + } finally { + m.buffer.release(); } - + return null; } } diff --git a/src/main/java/com/hbm/packet/toclient/BufPacket.java b/src/main/java/com/hbm/packet/toclient/BufPacket.java index 2e9b32c12..2cc78b657 100644 --- a/src/main/java/com/hbm/packet/toclient/BufPacket.java +++ b/src/main/java/com/hbm/packet/toclient/BufPacket.java @@ -1,5 +1,7 @@ package com.hbm.packet.toclient; +import com.hbm.main.MainRegistry; +import com.hbm.packet.PrecompiledPacket; import com.hbm.tileentity.IBufPacketReceiver; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -9,14 +11,14 @@ import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; -public class BufPacket implements IMessage { +public class BufPacket extends PrecompiledPacket { int x; int y; int z; IBufPacketReceiver rec; ByteBuf buf; - + public BufPacket() { } public BufPacket(int x, int y, int z, IBufPacketReceiver rec) { @@ -43,19 +45,27 @@ public class BufPacket implements IMessage { } public static class Handler implements IMessageHandler { - + @Override public IMessage onMessage(BufPacket m, MessageContext ctx) { - + if(Minecraft.getMinecraft().theWorld == null) return null; - + TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); - - if(te instanceof IBufPacketReceiver) { - ((IBufPacketReceiver) te).deserialize(m.buf); + + if (te instanceof IBufPacketReceiver) { + try { + ((IBufPacketReceiver) te).deserialize(m.buf); + } catch(Exception e) { // just in case I fucked up + MainRegistry.logger.warn("A ByteBuf packet failed to be read and has thrown an error. This normally means that there was a buffer underflow and more data was read than was actually in the packet."); + MainRegistry.logger.warn("Tile: {}", te.getBlockType().getUnlocalizedName()); + MainRegistry.logger.warn(e.getMessage()); + } finally { + m.buf.release(); + } } - + return null; } } diff --git a/src/main/java/com/hbm/packet/toclient/ExtPropPacket.java b/src/main/java/com/hbm/packet/toclient/ExtPropPacket.java index 0364bf7e9..97ac8016a 100644 --- a/src/main/java/com/hbm/packet/toclient/ExtPropPacket.java +++ b/src/main/java/com/hbm/packet/toclient/ExtPropPacket.java @@ -1,78 +1,58 @@ package com.hbm.packet.toclient; -import java.io.IOException; - import com.hbm.extprop.HbmLivingProps; import com.hbm.extprop.HbmPlayerProps; +import com.hbm.packet.PrecompiledPacket; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -public class ExtPropPacket implements IMessage { - - PacketBuffer buffer; +public class ExtPropPacket extends PrecompiledPacket { + + HbmLivingProps props; + HbmPlayerProps pprps; + ByteBuf buf; public ExtPropPacket() { } - public ExtPropPacket(NBTTagCompound nbt) { - - this.buffer = new PacketBuffer(Unpooled.buffer()); - - try { - buffer.writeNBTTagCompoundToBuffer(nbt); - - } catch (IOException e) { - e.printStackTrace(); - } + public ExtPropPacket(HbmLivingProps props, HbmPlayerProps pprps) { + this.props = props; + this.pprps = pprps; } @Override public void fromBytes(ByteBuf buf) { - - if (buffer == null) { - buffer = new PacketBuffer(Unpooled.buffer()); - } - buffer.writeBytes(buf); + this.buf = buf; } @Override public void toBytes(ByteBuf buf) { - - if (buffer == null) { - buffer = new PacketBuffer(Unpooled.buffer()); - } - buf.writeBytes(buffer); + props.serialize(buf); + pprps.serialize(buf); } public static class Handler implements IMessageHandler { - + @Override @SideOnly(Side.CLIENT) public IMessage onMessage(ExtPropPacket m, MessageContext ctx) { - + if(Minecraft.getMinecraft().theWorld == null) return null; - - try { - - NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); - HbmLivingProps props = HbmLivingProps.getData(Minecraft.getMinecraft().thePlayer); - HbmPlayerProps pprps = HbmPlayerProps.getData(Minecraft.getMinecraft().thePlayer); - props.loadNBTData(nbt); - pprps.loadNBTData(nbt); - - } catch (IOException e) { - e.printStackTrace(); - } - + + HbmLivingProps props = HbmLivingProps.getData(Minecraft.getMinecraft().thePlayer); + HbmPlayerProps pprps = HbmPlayerProps.getData(Minecraft.getMinecraft().thePlayer); + + props.deserialize(m.buf); + pprps.deserialize(m.buf); + + m.buf.release(); + return null; } } diff --git a/src/main/java/com/hbm/packet/toclient/LoopedSoundPacket.java b/src/main/java/com/hbm/packet/toclient/LoopedSoundPacket.java deleted file mode 100644 index 5533245d1..000000000 --- a/src/main/java/com/hbm/packet/toclient/LoopedSoundPacket.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.hbm.packet.toclient; - -import com.hbm.interfaces.Spaghetti; -import com.hbm.sound.*; -import com.hbm.tileentity.machine.*; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import io.netty.buffer.ByteBuf; -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -@Spaghetti("this class should be destroyed") -public class LoopedSoundPacket implements IMessage { - - int x; - int y; - int z; - - public LoopedSoundPacket() - { - - } - - public LoopedSoundPacket(int x, int y, int z) - { - this.x = x; - this.y = y; - this.z = z; - } - - @Override - public void fromBytes(ByteBuf buf) { - x = buf.readInt(); - y = buf.readInt(); - z = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(x); - buf.writeInt(y); - buf.writeInt(z); - } - - public static class Handler implements IMessageHandler { - - @Override - //Tamaized, I love you! - @SideOnly(Side.CLIENT) - public IMessage onMessage(LoopedSoundPacket m, MessageContext ctx) { - TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); - - if (te != null && te instanceof TileEntityMachineAssembler) { - - boolean flag = true; - for(int i = 0; i < SoundLoopAssembler.list.size(); i++) { - if(SoundLoopAssembler.list.get(i).getTE() == te && !SoundLoopAssembler.list.get(i).isDonePlaying()) - flag = false; - } - - if(flag && te.getWorldObj().isRemote && ((TileEntityMachineAssembler)te).isProgressing) - Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopAssembler(new ResourceLocation("hbm:block.assemblerOperate"), te)); - } - - if (te != null && te instanceof TileEntityMachineTurbofan) { - - boolean flag = true; - for(int i = 0; i < SoundLoopTurbofan.list.size(); i++) { - if(SoundLoopTurbofan.list.get(i).getTE() == te && !SoundLoopTurbofan.list.get(i).isDonePlaying()) - flag = false; - } - - if(flag && te.getWorldObj().isRemote && ((TileEntityMachineTurbofan)te).wasOn) - Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopTurbofan(new ResourceLocation("hbm:block.turbofanOperate"), te)); - } - - if (te != null && te instanceof TileEntityBroadcaster) { - - boolean flag = true; - for(int i = 0; i < SoundLoopBroadcaster.list.size(); i++) { - if(SoundLoopBroadcaster.list.get(i).getTE() == te && !SoundLoopBroadcaster.list.get(i).isDonePlaying()) - flag = false; - } - - int j = te.xCoord + te.zCoord + te.yCoord; - - if(flag && te.getWorldObj().isRemote) - Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopBroadcaster(new ResourceLocation("hbm:block.broadcast" + (Math.abs(j) % 3 + 1)), te)); - } - - if (te != null && te instanceof TileEntityMachineCentrifuge) { - - boolean flag = true; - for(int i = 0; i < SoundLoopCentrifuge.list.size(); i++) { - if(SoundLoopCentrifuge.list.get(i).getTE() == te && !SoundLoopCentrifuge.list.get(i).isDonePlaying()) - flag = false; - } - - if(flag && te.getWorldObj().isRemote && ((TileEntityMachineCentrifuge)te).isProgressing) - Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopCentrifuge(new ResourceLocation("hbm:block.centrifugeOperate"), te)); - } - - if (te != null && te instanceof TileEntityMachineGasCent) { - - boolean flag = true; - for(int i = 0; i < SoundLoopCentrifuge.list.size(); i++) { - if(SoundLoopCentrifuge.list.get(i).getTE() == te && !SoundLoopCentrifuge.list.get(i).isDonePlaying()) - flag = false; - } - - if(flag && te.getWorldObj().isRemote && ((TileEntityMachineGasCent)te).isProgressing) - Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopCentrifuge(new ResourceLocation("hbm:block.centrifugeOperate"), te)); - } - return null; - } - } -} diff --git a/src/main/java/com/hbm/packet/toclient/NBTPacket.java b/src/main/java/com/hbm/packet/toclient/NBTPacket.java deleted file mode 100644 index 65b15e8af..000000000 --- a/src/main/java/com/hbm/packet/toclient/NBTPacket.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.hbm.packet.toclient; - -import java.io.IOException; - -import com.hbm.tileentity.INBTPacketReceiver; - -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 io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; - -@Deprecated // rest in peace sweet little prince -public class NBTPacket implements IMessage { - - PacketBuffer buffer; - int x; - int y; - int z; - - public NBTPacket() { } - - public NBTPacket(NBTTagCompound nbt, int x, int y, int z) { - - this.buffer = new PacketBuffer(Unpooled.buffer()); - this.x = x; - this.y = y; - this.z = z; - - try { - buffer.writeNBTTagCompoundToBuffer(nbt); - - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public void fromBytes(ByteBuf buf) { - - x = buf.readInt(); - y = buf.readInt(); - z = buf.readInt(); - - if (buffer == null) { - buffer = new PacketBuffer(Unpooled.buffer()); - } - buffer.writeBytes(buf); - } - - @Override - public void toBytes(ByteBuf buf) { - - buf.writeInt(x); - buf.writeInt(y); - buf.writeInt(z); - - if (buffer == null) { - buffer = new PacketBuffer(Unpooled.buffer()); - } - buf.writeBytes(buffer); - } - - public static class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(NBTPacket m, MessageContext ctx) { - - if(Minecraft.getMinecraft().theWorld == null) - return null; - - TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); - - try { - - NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); - - if(nbt != null) { - - if(te instanceof INBTPacketReceiver) - ((INBTPacketReceiver) te).networkUnpack(nbt); - } - - } catch (IOException e) { - e.printStackTrace(); - } - - return null; - } - } - -} diff --git a/src/main/java/com/hbm/packet/toclient/PermaSyncPacket.java b/src/main/java/com/hbm/packet/toclient/PermaSyncPacket.java index dcf7ee365..f756d9f3e 100644 --- a/src/main/java/com/hbm/packet/toclient/PermaSyncPacket.java +++ b/src/main/java/com/hbm/packet/toclient/PermaSyncPacket.java @@ -13,7 +13,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; public class PermaSyncPacket implements IMessage { - + EntityPlayerMP player; //server only, for writing ByteBuf out; //client only, for reading @@ -34,18 +34,20 @@ public class PermaSyncPacket implements IMessage { } public static class Handler implements IMessageHandler { - + @Override @SideOnly(Side.CLIENT) public IMessage onMessage(PermaSyncPacket m, MessageContext ctx) { - + try { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(player != null) PermaSyncHandler.readPacket(m.out, player.worldObj, player); - - } catch(Exception x) { } - + + } catch(Exception x) { } finally { + m.out.release(); + } + return null; } } diff --git a/src/main/java/com/hbm/packet/toclient/SatPanelPacket.java b/src/main/java/com/hbm/packet/toclient/SatPanelPacket.java index 3a1a343d3..e3b815808 100644 --- a/src/main/java/com/hbm/packet/toclient/SatPanelPacket.java +++ b/src/main/java/com/hbm/packet/toclient/SatPanelPacket.java @@ -17,7 +17,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; public class SatPanelPacket implements IMessage { - + PacketBuffer buffer; int type; @@ -31,10 +31,10 @@ public class SatPanelPacket implements IMessage { this.buffer = new PacketBuffer(Unpooled.buffer()); NBTTagCompound nbt = new NBTTagCompound(); sat.writeToNBT(nbt); - + try { buffer.writeNBTTagCompoundToBuffer(nbt); - + } catch (IOException e) { e.printStackTrace(); } @@ -42,9 +42,9 @@ public class SatPanelPacket implements IMessage { @Override public void fromBytes(ByteBuf buf) { - + type = buf.readInt(); - + if (buffer == null) { buffer = new PacketBuffer(Unpooled.buffer()); } @@ -53,9 +53,9 @@ public class SatPanelPacket implements IMessage { @Override public void toBytes(ByteBuf buf) { - + buf.writeInt(type); - + if (buffer == null) { buffer = new PacketBuffer(Unpooled.buffer()); } @@ -67,18 +67,20 @@ public class SatPanelPacket implements IMessage { @Override @SideOnly(Side.CLIENT) public IMessage onMessage(SatPanelPacket m, MessageContext ctx) { - + Minecraft.getMinecraft(); try { - + NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); ItemSatInterface.currentSat = Satellite.create(m.type); - + if(nbt != null) ItemSatInterface.currentSat.readFromNBT(nbt); - + } catch (Exception x) { + } finally { + m.buffer.release(); } return null; } diff --git a/src/main/java/com/hbm/packet/toserver/NBTControlPacket.java b/src/main/java/com/hbm/packet/toserver/NBTControlPacket.java index 52ca6261c..6a2a58c16 100644 --- a/src/main/java/com/hbm/packet/toserver/NBTControlPacket.java +++ b/src/main/java/com/hbm/packet/toserver/NBTControlPacket.java @@ -15,7 +15,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; public class NBTControlPacket implements IMessage { - + PacketBuffer buffer; int x; int y; @@ -24,12 +24,12 @@ public class NBTControlPacket implements IMessage { public NBTControlPacket() { } public NBTControlPacket(NBTTagCompound nbt, int x, int y, int z) { - + this.buffer = new PacketBuffer(Unpooled.buffer()); this.x = x; this.y = y; this.z = z; - + try { buffer.writeNBTTagCompoundToBuffer(nbt); } catch (IOException e) { @@ -39,60 +39,62 @@ public class NBTControlPacket implements IMessage { @Override public void fromBytes(ByteBuf buf) { - + x = buf.readInt(); y = buf.readInt(); z = buf.readInt(); - + if(buffer == null) buffer = new PacketBuffer(Unpooled.buffer()); - + buffer.writeBytes(buf); } @Override public void toBytes(ByteBuf buf) { - + buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); - + if (buffer == null) buffer = new PacketBuffer(Unpooled.buffer()); - + buf.writeBytes(buffer); } public static class Handler implements IMessageHandler { - + @Override public IMessage onMessage(NBTControlPacket m, MessageContext ctx) { EntityPlayer p = ctx.getServerHandler().playerEntity; - + if(p.worldObj == null) return null; - + TileEntity te = p.worldObj.getTileEntity(m.x, m.y, m.z); - + try { - + NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); - + if(nbt != null) { if(te instanceof IControlReceiver) { - + IControlReceiver tile = (IControlReceiver)te; - + if(tile.hasPermission(p)) { tile.receiveControl(p, nbt); tile.receiveControl(nbt); } } } - + } catch (IOException e) { e.printStackTrace(); + } finally { + m.buffer.release(); } - + return null; } } diff --git a/src/main/java/com/hbm/packet/toserver/NBTItemControlPacket.java b/src/main/java/com/hbm/packet/toserver/NBTItemControlPacket.java index 3bae1121a..499617bac 100644 --- a/src/main/java/com/hbm/packet/toserver/NBTItemControlPacket.java +++ b/src/main/java/com/hbm/packet/toserver/NBTItemControlPacket.java @@ -15,18 +15,18 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; public class NBTItemControlPacket implements IMessage { - + PacketBuffer buffer; public NBTItemControlPacket() { } public NBTItemControlPacket(NBTTagCompound nbt) { - + this.buffer = new PacketBuffer(Unpooled.buffer()); - + try { buffer.writeNBTTagCompoundToBuffer(nbt); - + } catch (IOException e) { e.printStackTrace(); } @@ -34,7 +34,7 @@ public class NBTItemControlPacket implements IMessage { @Override public void fromBytes(ByteBuf buf) { - + if (buffer == null) { buffer = new PacketBuffer(Unpooled.buffer()); } @@ -43,7 +43,7 @@ public class NBTItemControlPacket implements IMessage { @Override public void toBytes(ByteBuf buf) { - + if (buffer == null) { buffer = new PacketBuffer(Unpooled.buffer()); } @@ -51,28 +51,30 @@ public class NBTItemControlPacket implements IMessage { } public static class Handler implements IMessageHandler { - + @Override public IMessage onMessage(NBTItemControlPacket m, MessageContext ctx) { EntityPlayer p = ctx.getServerHandler().playerEntity; - + try { - + NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer(); - + if(nbt != null) { ItemStack held = p.getHeldItem(); - + if(held != null && held.getItem() instanceof IItemControlReceiver) { ((IItemControlReceiver) held.getItem()).receiveControl(held, nbt); } } - + } catch (IOException e) { e.printStackTrace(); + } finally { + m.buffer.release(); } - + return null; } } diff --git a/src/main/java/com/hbm/particle/ParticlePlasmaBlast.java b/src/main/java/com/hbm/particle/ParticlePlasmaBlast.java index 413dd35b9..8f449ef14 100644 --- a/src/main/java/com/hbm/particle/ParticlePlasmaBlast.java +++ b/src/main/java/com/hbm/particle/ParticlePlasmaBlast.java @@ -77,16 +77,17 @@ public class ParticlePlasmaBlast extends EntityFX { tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); - tess.addVertexWithUV((double)(- 1 * scale), (double)(- 0.25), (double)(- 1 * scale), 1, 1); - tess.addVertexWithUV((double)(- 1 * scale), (double)(- 0.25), (double)(+ 1 * scale), 1, 0); - tess.addVertexWithUV((double)(+ 1 * scale), (double)(- 0.25), (double)(+ 1 * scale), 0, 0); - tess.addVertexWithUV((double)(+ 1 * scale), (double)(- 0.25), (double)(- 1 * scale), 0, 1); + tess.addVertexWithUV((double)(- 1 * scale), 0, (double)(- 1 * scale), 1, 1); + tess.addVertexWithUV((double)(- 1 * scale), 0, (double)(+ 1 * scale), 1, 0); + tess.addVertexWithUV((double)(+ 1 * scale), 0, (double)(+ 1 * scale), 0, 0); + tess.addVertexWithUV((double)(+ 1 * scale), 0, (double)(- 1 * scale), 0, 1); tess.draw(); if(fog) GL11.glEnable(GL11.GL_FOG); GL11.glPolygonOffset(0.0F, 0.0F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glPopMatrix(); } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java index c83cfb1a6..5647da9ae 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java @@ -2,14 +2,22 @@ package com.hbm.render.item.weapon.sedna; import org.lwjgl.opengl.GL11; +import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase { + + protected ResourceLocation texture; + + public ItemRenderDoubleBarrel(ResourceLocation texture) { + this.texture = texture; + } @Override protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.5F; } @@ -34,7 +42,7 @@ public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase { public void renderFirstPerson(ItemStack stack) { ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.double_barrel_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(texture); double scale = 0.375D; GL11.glScaled(scale, scale, scale); @@ -75,7 +83,7 @@ public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase { GL11.glTranslated(0, 0.4375, 0.875); ResourceManager.double_barrel.renderPart("BarrelShort"); - ResourceManager.double_barrel.renderPart("Barrel"); + if(!isSawedOff(stack)) ResourceManager.double_barrel.renderPart("Barrel"); GL11.glPushMatrix(); GL11.glTranslated(0.75, 0, -0.6875); @@ -126,11 +134,19 @@ public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase { @Override public void setupInv(ItemStack stack) { super.setupInv(stack); - double scale = 1.375D; - GL11.glScaled(scale, scale, scale); - GL11.glRotated(25, 1, 0, 0); - GL11.glRotated(45, 0, 1, 0); - GL11.glTranslated(0, 0.5, 0); + if(isSawedOff(stack)) { + double scale = 2D; + GL11.glScaled(scale, scale, scale); + GL11.glRotated(25, 1, 0, 0); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(-2, 0.5, 0); + } else { + double scale = 1.375D; + GL11.glScaled(scale, scale, scale); + GL11.glRotated(25, 1, 0, 0); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(0, 0.5, 0); + } } @Override @@ -138,8 +154,17 @@ public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.double_barrel_tex); - ResourceManager.double_barrel.renderAll(); + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + ResourceManager.double_barrel.renderPart("Stock"); + ResourceManager.double_barrel.renderPart("BarrelShort"); + if(!isSawedOff(stack)) ResourceManager.double_barrel.renderPart("Barrel"); + ResourceManager.double_barrel.renderPart("Buckle"); + ResourceManager.double_barrel.renderPart("Lever"); + ResourceManager.double_barrel.renderPart("Shells"); GL11.glShadeModel(GL11.GL_FLAT); } + + public boolean isSawedOff(ItemStack stack) { + return stack.getItem() == ModItems.gun_double_barrel_sacred_dragon; + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java index c647d6f2c..82d881174 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java @@ -61,7 +61,8 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { ResourceManager.g3.renderPart("Rifle"); ResourceManager.g3.renderPart("Stock"); - ResourceManager.g3.renderPart("FlashHider"); + ResourceManager.g3.renderPart("Flash_Hider"); + ResourceManager.g3.renderPart("Trigger_Rifle.002"); GL11.glPushMatrix(); GL11.glTranslated(mag[0], mag[1], mag[2]); @@ -86,7 +87,7 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { GL11.glTranslated(0, -0.875, -3.5); GL11.glRotated(-30 * (1 - ItemGunBaseNT.getMode(stack, 0)), 1, 0, 0); GL11.glTranslated(0, 0.875, 3.5); - ResourceManager.g3.renderPart("Selector"); + ResourceManager.g3.renderPart("Selector_Rifle.001"); GL11.glPopMatrix(); double smokeScale = 0.75; @@ -137,15 +138,16 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { ResourceManager.g3.renderPart("Rifle"); ResourceManager.g3.renderPart("Stock"); ResourceManager.g3.renderPart("Magazine"); - ResourceManager.g3.renderPart("FlashHider"); + ResourceManager.g3.renderPart("Flash_Hider"); ResourceManager.g3.renderPart("Bolt"); ResourceManager.g3.renderPart("Handle"); + ResourceManager.g3.renderPart("Trigger_Rifle.002"); GL11.glPushMatrix(); GL11.glTranslated(0, -0.875, -3.5); GL11.glRotated(-30, 1, 0, 0); GL11.glTranslated(0, 0.875, 3.5); - ResourceManager.g3.renderPart("Selector"); + ResourceManager.g3.renderPart("Selector_Rifle.001"); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); } diff --git a/src/main/java/com/hbm/render/model/ModelT45Chest.java b/src/main/java/com/hbm/render/model/ModelT45Chest.java index 07f4cda1f..8f341f412 100644 --- a/src/main/java/com/hbm/render/model/ModelT45Chest.java +++ b/src/main/java/com/hbm/render/model/ModelT45Chest.java @@ -9,6 +9,7 @@ package com.hbm.render.model; import org.lwjgl.opengl.GL11; import com.hbm.interfaces.IHoldableWeapon; +import com.hbm.items.weapon.sedna.ItemGunBaseNT; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; @@ -207,6 +208,7 @@ public class ModelT45Chest extends ModelBiped { @Override public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; if (player.isSneaking()) { @@ -227,8 +229,8 @@ public class ModelT45Chest extends ModelBiped { } } - if(itemstack != null && player.getHeldItem().getItem() instanceof IHoldableWeapon) - this.aimedBow = true; + if(itemstack != null && player.getHeldItem().getItem() instanceof IHoldableWeapon) this.aimedBow = true; + if(itemstack != null && player.getHeldItem().getItem() instanceof ItemGunBaseNT) this.aimedBow = true; } super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); this.chest.rotationPointX = this.bipedBody.rotationPointX; diff --git a/src/main/java/com/hbm/render/tileentity/RenderRBMKLid.java b/src/main/java/com/hbm/render/tileentity/RenderRBMKLid.java index 2783e8508..a72e81da4 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderRBMKLid.java +++ b/src/main/java/com/hbm/render/tileentity/RenderRBMKLid.java @@ -35,7 +35,7 @@ public class RenderRBMKLid extends TileEntitySpecialRenderer { if(rod.hasRod) hasRod = true; - if(rod.fluxFast + rod.fluxSlow > 5) + if(rod.lastFluxQuantity > 5) cherenkov = true; } diff --git a/src/main/java/com/hbm/sound/SoundLoopAssembler.java b/src/main/java/com/hbm/sound/SoundLoopAssembler.java deleted file mode 100644 index c69ea40c6..000000000 --- a/src/main/java/com/hbm/sound/SoundLoopAssembler.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hbm.sound; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.tileentity.machine.TileEntityMachineAssembler; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class SoundLoopAssembler extends SoundLoopMachine { - - public static List list = new ArrayList(); - - public SoundLoopAssembler(ResourceLocation path, TileEntity te) { - super(path, te); - list.add(this); - } - - @Override - public void update() { - super.update(); - - if(te instanceof TileEntityMachineAssembler) { - TileEntityMachineAssembler drill = (TileEntityMachineAssembler)te; - - if(this.volume != 3) - volume = 3; - - if(!drill.isProgressing) - this.donePlaying = true; - } - } - - public TileEntity getTE() { - return te; - } - -} diff --git a/src/main/java/com/hbm/sound/SoundLoopBroadcaster.java b/src/main/java/com/hbm/sound/SoundLoopBroadcaster.java deleted file mode 100644 index 3b00039a5..000000000 --- a/src/main/java/com/hbm/sound/SoundLoopBroadcaster.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.hbm.sound; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.tileentity.machine.TileEntityBroadcaster; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.ISound; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class SoundLoopBroadcaster extends SoundLoopMachine { - - public static List list = new ArrayList(); - public float intendedVolume = 25.0F; - - public SoundLoopBroadcaster(ResourceLocation path, TileEntity te) { - super(path, te); - list.add(this); - this.field_147666_i = ISound.AttenuationType.NONE; - } - - @Override - public void update() { - super.update(); - - EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; - float f = 0; - - if(player != null) { - f = (float)Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2)); - volume = func(f, intendedVolume); - - if(!(player.worldObj.getTileEntity((int)xPosF, (int)yPosF, (int)zPosF) instanceof TileEntityBroadcaster)) { - this.donePlaying = true; - volume = 0; - } - } else { - volume = intendedVolume; - } - } - - public TileEntity getTE() { - return te; - } - - public float func(float f, float v) { - return (f / v) * -2 + 2; - } - -} diff --git a/src/main/java/com/hbm/sound/SoundLoopCentrifuge.java b/src/main/java/com/hbm/sound/SoundLoopCentrifuge.java deleted file mode 100644 index 2989ddf9c..000000000 --- a/src/main/java/com/hbm/sound/SoundLoopCentrifuge.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hbm.sound; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.tileentity.machine.TileEntityMachineCentrifuge; -import com.hbm.tileentity.machine.TileEntityMachineGasCent; -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class SoundLoopCentrifuge extends SoundLoopMachine { - - public static List list = new ArrayList(); - - public SoundLoopCentrifuge(ResourceLocation path, TileEntity te) { - super(path, te); - list.add(this); - } - - @Override - public void update() { - super.update(); - - if(te instanceof TileEntityMachineCentrifuge) { - TileEntityMachineCentrifuge plant = (TileEntityMachineCentrifuge)te; - - if(this.volume != 1) - volume = 1; - - if(!plant.isProgressing) - this.donePlaying = true; - } - - if(te instanceof TileEntityMachineGasCent) { - TileEntityMachineGasCent plant = (TileEntityMachineGasCent)te; - - if(this.volume != 1) - volume = 1; - - if(!plant.isProgressing) - this.donePlaying = true; - } - - if(!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(this)) { - stop(); - } - } - - public TileEntity getTE() { - return te; - } - -} diff --git a/src/main/java/com/hbm/sound/SoundLoopTurbofan.java b/src/main/java/com/hbm/sound/SoundLoopTurbofan.java deleted file mode 100644 index 4b08d0471..000000000 --- a/src/main/java/com/hbm/sound/SoundLoopTurbofan.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.hbm.sound; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.tileentity.machine.TileEntityMachineTurbofan; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class SoundLoopTurbofan extends SoundLoopMachine { - - public static List list = new ArrayList(); - - public SoundLoopTurbofan(ResourceLocation path, TileEntity te) { - super(path, te); - list.add(this); - } - - @Override - public void update() { - super.update(); - - if(te instanceof TileEntityMachineTurbofan) { - TileEntityMachineTurbofan drill = (TileEntityMachineTurbofan)te; - - if(this.volume != 10) - volume = 10; - - if(!drill.wasOn) - this.donePlaying = true; - } - } - - public TileEntity getTE() { - return te; - } - -} diff --git a/src/main/java/com/hbm/test/ExplosionTests.java b/src/main/java/com/hbm/test/ExplosionTests.java index 544a61157..bbc3dcd78 100644 --- a/src/main/java/com/hbm/test/ExplosionTests.java +++ b/src/main/java/com/hbm/test/ExplosionTests.java @@ -1,32 +1,33 @@ package com.hbm.test; -import com.hbm.test.MK5Frame.*; +import com.hbm.test.MK5Frame.BufferArray; +import com.hbm.test.MK5Frame.BufferMap; +import com.hbm.test.MK5Frame.BufferNone; import com.hbm.util.TimeAnalyzer; - import cpw.mods.fml.common.FMLCommonHandler; public class ExplosionTests { private static ExplosionWorld world = new ExplosionWorld(); public static double BUFFER_THRESHOLD = 0.25D; - + public static void runTest() { - + int standardSpeed = (int)Math.ceil(100000 / 300); double[] thresholds = new double[] {0.25, 0.5}; int[] radii = new int[] {100, 250}; - + int x = 200; int y = 70; int z = 200; long mem = 0; - + for(int radius : radii) { - + int strength = radius * 2; int length = radius; - + System.gc(); mem = getMem(); System.out.println("#### STARTING TEST WITH NO PROXIMITY BUFFER " + radius + " ####"); @@ -36,7 +37,7 @@ public class ExplosionTests { TimeAnalyzer.endCount(); TimeAnalyzer.dump(); System.out.println("Mem diff: " + ((getMem() - mem) / 1_048_576) + "MB"); - + for(double threshold : thresholds) { BUFFER_THRESHOLD = threshold; @@ -61,10 +62,10 @@ public class ExplosionTests { System.out.println("Mem diff: " + ((getMem() - mem) / 1_048_576) + "MB"); } } - + FMLCommonHandler.instance().exitJava(0, true); } - + public static long getMem() { return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); } diff --git a/src/main/java/com/hbm/test/MK5Frame.java b/src/main/java/com/hbm/test/MK5Frame.java index a20fd01aa..383ecc043 100644 --- a/src/main/java/com/hbm/test/MK5Frame.java +++ b/src/main/java/com/hbm/test/MK5Frame.java @@ -1,19 +1,14 @@ package com.hbm.test; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; - import com.hbm.util.TimeAnalyzer; import com.hbm.util.fauxpointtwelve.BlockPos; - import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.Vec3; import net.minecraft.world.ChunkCoordIntPair; +import java.util.*; + public class MK5Frame { public HashMap> perChunk = new HashMap(); //for future: optimize blockmap further by using sub-chunks instead of chunks @@ -52,7 +47,7 @@ public class MK5Frame { } private void generateGspUp(){ - + if (this.gspNum < this.gspNumMax) { int k = this.gspNum + 1; double hk = -1.0 + 2.0 * (k - 1.0) / (this.gspNumMax - 1.0); @@ -77,7 +72,7 @@ public class MK5Frame { } public void collectTip(int count) { - + TimeAnalyzer.startCount("collect"); int amountProcessed = 0; @@ -107,24 +102,24 @@ public class MK5Frame { double fac = 100 - ((double) i) / ((double) length) * 100; fac *= 0.07D; - + Block block = null; boolean withinThreshold = (double) i / (double) length <= ExplosionTests.BUFFER_THRESHOLD; - + Float buffered = withinThreshold ? buffer.getBufferedResult(iX, iY, iZ) : null; - + float f = 0; - + if(buffered == null) { - + block = world.getBlock(iX, iY, iZ); if(!block.getMaterial().isLiquid()) { f = (float) Math.pow(block.getExplosionResistance(null), 7.5D - fac); } - + if(withinThreshold) buffer.setBufferedResult(iX, iY, iZ, f); - + } else { f = buffered; } @@ -142,18 +137,18 @@ public class MK5Frame { break; } } - + for(ChunkCoordIntPair pos : chunkCoords) { List triplets = perChunk.get(pos); - + if(triplets == null) { triplets = new ArrayList(); perChunk.put(pos, triplets); //we re-use the same pos instead of using individualized per-chunk ones to save on RAM } - + triplets.add(lastPos); } - + // Raise one generalized spiral points this.generateGspUp(); @@ -163,14 +158,14 @@ public class MK5Frame { return; } } - + orderedChunks.addAll(perChunk.keySet()); orderedChunks.sort(comparator); - + isCollectionComplete = true; TimeAnalyzer.endCount(); } - + /* TEST INSERT START */ private ResultBuffer buffer; public MK5Frame setBuffer(ResultBuffer buffer) { @@ -205,7 +200,7 @@ public class MK5Frame { } } /* TEST INSERT END */ - + /** little comparator for roughly sorting chunks by distance to the center */ public class CoordComparator implements Comparator { @@ -217,29 +212,29 @@ public class MK5Frame { int diff1 = Math.abs((chunkX - o1.chunkXPos)) + Math.abs((chunkZ - o1.chunkZPos)); int diff2 = Math.abs((chunkX - o2.chunkXPos)) + Math.abs((chunkZ - o2.chunkZPos)); - + return diff1 > diff2 ? 1 : diff1 < diff2 ? -1 : 0; } } public void processChunk() { - + TimeAnalyzer.startCount("processChunk"); if(this.perChunk.isEmpty()) { TimeAnalyzer.endCount(); return; } - + ChunkCoordIntPair coord = orderedChunks.get(0); List list = perChunk.get(coord); HashSet toRem = new HashSet(); int chunkX = coord.chunkXPos; int chunkZ = coord.chunkZPos; - + int enter = (int) (Math.min( Math.abs(posX - (chunkX << 4)), Math.abs(posZ - (chunkZ << 4)))) - 16; //jump ahead to cut back on NOPs - + for(FloatTriplet triplet : list) { float x = triplet.xCoord; float y = triplet.yCoord; @@ -248,13 +243,13 @@ public class MK5Frame { double pX = vec.xCoord / vec.lengthVector(); double pY = vec.yCoord / vec.lengthVector(); double pZ = vec.zCoord / vec.lengthVector(); - + boolean inChunk = false; for(int i = enter; i < vec.lengthVector(); i++) { int x0 = (int) Math.floor(posX + pX * i); int y0 = (int) Math.floor(posY + pY * i); int z0 = (int) Math.floor(posZ + pZ * i); - + if(x0 >> 4 != chunkX || z0 >> 4 != chunkZ) { if(inChunk) { break; @@ -262,7 +257,7 @@ public class MK5Frame { continue; } } - + inChunk = true; if(!world.isAirBlock(x0, y0, z0)) { @@ -270,22 +265,22 @@ public class MK5Frame { } } } - + for(BlockPos pos : toRem) { world.setBlock(pos.getX(), pos.getY(), pos.getZ(), Blocks.air); } - + perChunk.remove(coord); orderedChunks.remove(0); - + TimeAnalyzer.endCount(); } - + public class FloatTriplet { public float xCoord; public float yCoord; public float zCoord; - + public FloatTriplet(float x, float y, float z) { xCoord = x; yCoord = y; diff --git a/src/main/java/com/hbm/tileentity/IBufPacketReceiver.java b/src/main/java/com/hbm/tileentity/IBufPacketReceiver.java index 04d1fe52a..4250d6edd 100644 --- a/src/main/java/com/hbm/tileentity/IBufPacketReceiver.java +++ b/src/main/java/com/hbm/tileentity/IBufPacketReceiver.java @@ -1,19 +1,9 @@ package com.hbm.tileentity; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; - -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import io.netty.buffer.ByteBuf; -import net.minecraft.tileentity.TileEntity; public interface IBufPacketReceiver { public void serialize(ByteBuf buf); public void deserialize(ByteBuf buf); - - public default void sendStandard(int range) { - TileEntity te = (TileEntity) this; - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(te.xCoord, te.yCoord, te.zCoord, this), new TargetPoint(te.getWorldObj().provider.dimensionId, te.xCoord, te.yCoord, te.zCoord, range)); - } } diff --git a/src/main/java/com/hbm/tileentity/INBTPacketReceiver.java b/src/main/java/com/hbm/tileentity/INBTPacketReceiver.java deleted file mode 100644 index a22b501e8..000000000 --- a/src/main/java/com/hbm/tileentity/INBTPacketReceiver.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hbm.tileentity; - -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; - -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -public interface INBTPacketReceiver { - - public void networkUnpack(NBTTagCompound nbt); - - public static void networkPack(TileEntity that, NBTTagCompound data, int range) { - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, that.xCoord, that.yCoord, that.zCoord), new TargetPoint(that.getWorldObj().provider.dimensionId, that.xCoord, that.yCoord, that.zCoord, range)); - } -} diff --git a/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java b/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java index 0fd4f7dab..1539d3eb0 100644 --- a/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java +++ b/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java @@ -1,5 +1,6 @@ package com.hbm.tileentity; +import java.util.HashMap; import java.util.List; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; @@ -13,8 +14,8 @@ public interface IUpgradeInfoProvider { /** If any of the automated display stuff should be applied for this upgrade. A level of 0 is used by the GUI's indicator, as opposed to the item tooltips */ public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo); public void provideInfo(UpgradeType type, int level, List info, boolean extendedInfo); - public int getMaxLevel(UpgradeType type); - + public HashMap getValidUpgrades(); + public static String getStandardLabel(Block block) { return EnumChatFormatting.GREEN.YELLOW + ">>> " + I18nUtil.resolveKey(block.getUnlocalizedName() + ".name") + " <<<"; } diff --git a/src/main/java/com/hbm/tileentity/TileEntityLoadedBase.java b/src/main/java/com/hbm/tileentity/TileEntityLoadedBase.java index 11ec8ddd1..74b61d7b0 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityLoadedBase.java +++ b/src/main/java/com/hbm/tileentity/TileEntityLoadedBase.java @@ -1,16 +1,20 @@ package com.hbm.tileentity; +import com.hbm.handler.threading.PacketThreading; +import com.hbm.packet.toclient.BufPacket; import com.hbm.sound.AudioWrapper; import api.hbm.tile.ILoadedTile; +import cpw.mods.fml.common.network.NetworkRegistry; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -public class TileEntityLoadedBase extends TileEntity implements ILoadedTile { - +public class TileEntityLoadedBase extends TileEntity implements ILoadedTile, IBufPacketReceiver { + public boolean isLoaded = true; public boolean muffled = false; - + @Override public boolean isLoaded() { return isLoaded; @@ -21,29 +25,68 @@ public class TileEntityLoadedBase extends TileEntity implements ILoadedTile { super.onChunkUnload(); this.isLoaded = false; } - + public AudioWrapper createAudioLoop() { return null; } - + public AudioWrapper rebootAudio(AudioWrapper wrapper) { wrapper.stopSound(); AudioWrapper audio = createAudioLoop(); audio.startSound(); return audio; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.muffled = nbt.getBoolean("muffled"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setBoolean("muffled", muffled); } - + public float getVolume(float baseVolume) { return muffled ? baseVolume * 0.1F : baseVolume; } + + private ByteBuf lastPackedBuf; + + @Override + public void serialize(ByteBuf buf) { + buf.writeBoolean(muffled); + } + + @Override + public void deserialize(ByteBuf buf) { + this.muffled = buf.readBoolean(); + } + + /** Sends a sync packet that uses ByteBuf for efficient information-cramming */ + public void networkPackNT(int range) { + if(worldObj.isRemote) { + return; + } + + BufPacket packet = new BufPacket(xCoord, yCoord, zCoord, this); + + ByteBuf preBuf = packet.getPreBuf(); + + // Don't send unnecessary packets, except for maybe one every second or so. + // If we stop sending duplicate packets entirely, this causes issues when + // a client unloads and then loads back a chunk with an unchanged tile entity. + // For that client, the tile entity will appear default until anything changes about it. + // In my testing, this can be reliably reproduced with a full fluid barrel, for instance. + // I think it might be fixable by doing something with getDescriptionPacket() and onDataPacket(), + // but this sidesteps the problem for the mean time. + if (preBuf.equals(lastPackedBuf) && this.worldObj.getWorldTime() % 20 != 0) { + return; + } + + this.lastPackedBuf = preBuf.copy(); + + PacketThreading.createAllAroundThreadedPacket(packet, new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); + } + } diff --git a/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java b/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java index 81c099073..e38bf2f63 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java +++ b/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java @@ -1,14 +1,7 @@ package com.hbm.tileentity; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.AuxGaugePacket; -import com.hbm.packet.toclient.BufPacket; -import com.hbm.packet.toclient.NBTPacket; import com.hbm.util.fauxpointtwelve.DirPos; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -18,19 +11,16 @@ import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidTank; -public abstract class TileEntityMachineBase extends TileEntityLoadedBase implements ISidedInventory, INBTPacketReceiver, IBufPacketReceiver { +public abstract class TileEntityMachineBase extends TileEntityLoadedBase implements ISidedInventory { public ItemStack slots[]; - + private String customName; - - private NBTTagCompound lastPackedNBT = null; - private ByteBuf lastPackedBuf = null; - + public TileEntityMachineBase(int slotCount) { slots = new ItemStack[slotCount]; } - + /** The "chunks is modified, pls don't forget to save me" effect of markDirty, minus the block updates */ public void markChanged() { this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); @@ -71,14 +61,14 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme public String getInventoryName() { return this.hasCustomInventoryName() ? this.customName : getName(); } - + public abstract String getName(); @Override public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @@ -96,7 +86,7 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 128; } } - + @Override public void openInventory() {} @Override @@ -106,22 +96,22 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme public boolean isItemValidForSlot(int slot, ItemStack itemStack) { return false; } - + @Override public ItemStack decrStackSize(int slot, int amount) { if(slots[slot] != null) { - + if(slots[slot].stackSize <= amount) { ItemStack itemStack = slots[slot]; slots[slot] = null; return itemStack; } - + ItemStack itemStack1 = slots[slot].splitStack(amount); if(slots[slot].stackSize == 0) { slots[slot] = null; } - + return itemStack1; } else { return null; @@ -142,7 +132,7 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme public int[] getAccessibleSlotsFromSide(int side) { return new int[] { }; } - + public int getGaugeScaled(int i, FluidTank tank) { return tank.getFluidAmount() * i / tank.getCapacity(); } @@ -153,74 +143,15 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme //shit i don't know man @Override public abstract void updateEntity(); - - @Deprecated public void updateGauge(int val, int id, int range) { - if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, val, id), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - @Deprecated public void processGauge(int val, int id) { } - - @Deprecated public void networkPack(NBTTagCompound nbt, int range) { - nbt.setBoolean("muffled", muffled); - if(worldObj.isRemote) { - return; - } - - // Same as networkPackNT - if (lastPackedNBT != null && lastPackedNBT.equals(nbt) && worldObj.getWorldTime() % 20 != 0) { - return; - } - this.lastPackedNBT = nbt; - - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - - @Deprecated - public void networkUnpack(NBTTagCompound nbt) { - this.muffled = nbt.getBoolean("muffled"); - } - - /** Sends a sync packet that uses ByteBuf for efficient information-cramming */ - public void networkPackNT(int range) { - if(worldObj.isRemote) { - return; - } - - BufPacket packet = new BufPacket(xCoord, yCoord, zCoord, this); - ByteBuf buf = Unpooled.buffer(); - packet.toBytes(buf); - - // Don't send unnecessary packets, except for maybe one every second or so. - // If we stop sending duplicate packets entirely, this causes issues when - // a client unloads and then loads back a chunk with an unchanged tile entity. - // For that client, the tile entity will appear default until anything changes about it. - // In my testing, this can be reliably reproduced with a full fluid barrel, for instance. - // I think it might be fixable by doing something with getDescriptionPacket() and onDataPacket(), - // but this sidesteps the problem for the mean time. - if (lastPackedBuf != null && buf.equals(lastPackedBuf) && worldObj.getWorldTime() % 20 != 0) { - return; - } - this.lastPackedBuf = buf; - - PacketDispatcher.wrapper.sendToAllAround(packet, new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - - @Override public void serialize(ByteBuf buf) { - buf.writeBoolean(muffled); - } - - @Override public void deserialize(ByteBuf buf) { - this.muffled = buf.readBoolean(); - } - @Deprecated public void handleButtonPacket(int value, int meta) { } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - + for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = list.getCompoundTagAt(i); @@ -231,12 +162,12 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); NBTTagList list = new NBTTagList(); - + for(int i = 0; i < slots.length; i++) { if(slots[i] != null) @@ -249,7 +180,7 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme } nbt.setTag("items", list); } - + public void updateRedstoneConnection(DirPos pos) { int x = pos.getX(); diff --git a/src/main/java/com/hbm/tileentity/TileEntityTickingBase.java b/src/main/java/com/hbm/tileentity/TileEntityTickingBase.java index bfd9a6ced..2924a3467 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityTickingBase.java +++ b/src/main/java/com/hbm/tileentity/TileEntityTickingBase.java @@ -1,20 +1,13 @@ package com.hbm.tileentity; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; -import com.hbm.packet.toclient.NBTPacket; - -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import io.netty.buffer.ByteBuf; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidTank; -public abstract class TileEntityTickingBase extends TileEntityLoadedBase implements INBTPacketReceiver, IBufPacketReceiver { - +public abstract class TileEntityTickingBase extends TileEntityLoadedBase { + public TileEntityTickingBase() { } - + public abstract String getInventoryName(); - + public int getGaugeScaled(int i, FluidTank tank) { return tank.getFluidAmount() * i / tank.getCapacity(); } @@ -25,27 +18,8 @@ public abstract class TileEntityTickingBase extends TileEntityLoadedBase impleme //shit i don't know man @Override public abstract void updateEntity(); - - @Deprecated public void networkPack(NBTTagCompound nbt, int range) { - if(!worldObj.isRemote) - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - - @Deprecated public void networkUnpack(NBTTagCompound nbt) { } - @Deprecated public void handleButtonPacket(int value, int meta) { } - - public void networkPackNT(int range) { - if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - @Override public void serialize(ByteBuf buf) { - buf.writeBoolean(muffled); - } - - @Override public void deserialize(ByteBuf buf) { - this.muffled = buf.readBoolean(); - } } diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityCharge.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityCharge.java index 0577276c8..18a08483e 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityCharge.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityCharge.java @@ -1,65 +1,64 @@ package com.hbm.tileentity.bomb; import com.hbm.blocks.bomb.BlockChargeBase; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; -import com.hbm.tileentity.INBTPacketReceiver; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; +import com.hbm.tileentity.TileEntityLoadedBase; +import io.netty.buffer.ByteBuf; + +public class TileEntityCharge extends TileEntityLoadedBase { -public class TileEntityCharge extends TileEntity implements INBTPacketReceiver { - public boolean started; public int timer; @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(started) { timer--; - + if(timer % 20 == 0 && timer > 0) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.fstbmbPing", 1.0F, 1.0F); - + if(timer <= 0) { ((BlockChargeBase)this.getBlockType()).explode(worldObj, xCoord, yCoord, zCoord); } } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("timer", timer); - data.setBoolean("started", started); - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 100)); + + networkPackNT(100); } } @Override - public void networkUnpack(NBTTagCompound data) { - timer = data.getInteger("timer"); - started = data.getBoolean("started"); + public void serialize(ByteBuf buf) { + buf.writeLong(this.timer); + buf.writeBoolean(this.started); } - + + @Override + public void deserialize(ByteBuf buf) { + this.timer = buf.readInt(); + this.started = buf.readBoolean(); + } + public String getMinutes() { - + String mins = "" + (timer / 1200); - + if(mins.length() == 1) mins = "0" + mins; - + return mins; } - + public String getSeconds() { - + String mins = "" + ((timer / 20) % 60); - + if(mins.length() == 1) mins = "0" + mins; - + return mins; } } diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityCompactLauncher.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityCompactLauncher.java index 26c6ceea8..12dd8bab2 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityCompactLauncher.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityCompactLauncher.java @@ -17,7 +17,6 @@ import com.hbm.items.weapon.ItemCustomMissilePart.PartSize; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.packet.toclient.TEMissileMultipartPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IGUIProvider; @@ -55,7 +54,7 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I public int solid; public static final int maxSolid = 25000; public FluidTank[] tanks; - + public MissileStruct load; private static final int[] access = new int[] { 0 }; @@ -158,11 +157,11 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I return null; } } - + public long getPowerScaled(long i) { return (power * i) / maxPower; } - + public int getSolidScaled(int i) { return (solid * i) / maxSolid; } @@ -171,27 +170,27 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I public void updateEntity() { if (!worldObj.isRemote) { - + updateTypes(); tanks[0].loadTank(2, 6, slots); tanks[1].loadTank(3, 7, slots); - + power = Library.chargeTEFromItems(slots, 5, power, maxPower); - + if(slots[4] != null && slots[4].getItem() == ModItems.rocket_fuel && solid + 250 <= maxSolid) { - + this.decrStackSize(4, 1); solid += 250; } if(worldObj.getTotalWorldTime() % 20 == 0) this.updateConnections(); - - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - + + networkPackNT(50); + MissileStruct multipart = getStruct(slots[0]); - + if(multipart != null) PacketDispatcher.wrapper.sendToAllAround(new TEMissileMultipartPacket(xCoord, yCoord, zCoord, multipart), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250)); else @@ -200,7 +199,7 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I outer: for(int x = -1; x <= 1; x++) { for(int z = -1; z <= 1; z++) { - + if(worldObj.isBlockIndirectlyGettingPowered(xCoord + x, yCoord, zCoord + z) && canLaunch()) { launchFromDesignator(); break outer; @@ -208,22 +207,30 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I } } } else { - + List entities = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5)); - + for(Entity e : entities) { - + if(e instanceof EntityMissileCustom) { - + for(int i = 0; i < 15; i++) { - + boolean dir = worldObj.rand.nextBoolean(); float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.5F); float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.5F); - - MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ}); + + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", xCoord + 0.5); + data.setDouble("posY", yCoord + 0.25); + data.setDouble("posZ", zCoord + 0.5); + data.setString("type", "launchSmoke"); + data.setDouble("moX", moX); + data.setDouble("moY", 0); + data.setDouble("moZ", moZ); + MainRegistry.proxy.effectNT(data); } - + break; } } @@ -236,23 +243,23 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I tanks[0].serialize(buf); tanks[1].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { this.power = buf.readLong(); this.solid = buf.readInt(); tanks[0].deserialize(buf); tanks[1].deserialize(buf); } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + public DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord + 1, Library.POS_X), @@ -269,12 +276,12 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I new DirPos(xCoord - 1, yCoord - 1, zCoord - 1, Library.NEG_Y) }; } - + public boolean canLaunch() { - + if(power >= maxPower * 0.75 && isMissileValid() && hasDesignator() && hasFuel()) return true; - + return false; } @@ -289,66 +296,66 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I this.launchTo(x, z); return true; } - + public void launchFromDesignator() { if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) { IDesignatorItem designator = (IDesignatorItem) slots[1].getItem(); - + if(designator.isReady(worldObj, slots[1], xCoord, yCoord, zCoord)) { Vec3 coords = designator.getCoords(worldObj, slots[1], xCoord, yCoord, zCoord); int tX = (int) Math.floor(coords.xCoord); int tZ = (int) Math.floor(coords.zCoord); - + this.launchTo(tX, tZ); } } } - + public void launchTo(int tX, int tZ) { worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.missileTakeOff", 10.0F, 1.0F); - + ItemCustomMissilePart chip = (ItemCustomMissilePart) Item.getItemById(ItemCustomMissile.readFromNBT(slots[0], "chip")); float c = (Float)chip.attributes[0]; float f = 1.0F; - + if(getStruct(slots[0]).fins != null) { ItemCustomMissilePart fins = (ItemCustomMissilePart) Item.getItemById(ItemCustomMissile.readFromNBT(slots[0], "stability")); f = (Float) fins.attributes[0]; } - + Vec3 target = Vec3.createVectorHelper(xCoord - tX, 0, zCoord - tZ); target.xCoord *= c * f; target.zCoord *= c * f; - + target.rotateAroundY(worldObj.rand.nextFloat() * 360); - + EntityMissileCustom missile = new EntityMissileCustom(worldObj, xCoord + 0.5F, yCoord + 2.5F, zCoord + 0.5F, tX + (int)target.xCoord, tZ + (int)target.zCoord, getStruct(slots[0])); worldObj.spawnEntityInWorld(missile); - + subtractFuel(); - + slots[0] = null; } - + private boolean hasFuel() { return solidState() != 0 && liquidState() != 0 && oxidizerState() != 0; } - + private void subtractFuel() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + float f = (Float)fuselage.attributes[1]; int fuel = (int)f; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: tanks[0].setFill(tanks[0].getFill() - fuel); @@ -369,114 +376,114 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I this.solid -= fuel; break; default: break; } - + this.power -= maxPower * 0.75; } - + public static MissileStruct getStruct(ItemStack stack) { - + return ItemCustomMissile.getStruct(stack); } - + public boolean isMissileValid() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return false; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + return fuselage.top == PartSize.SIZE_10; } - + public boolean hasDesignator() { - + if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem && ((IDesignatorItem)slots[1].getItem()).isReady(worldObj, slots[1], xCoord, yCoord, zCoord)) { return true; } - + return false; } - + public int solidState() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return -1; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + if((FuelType)fuselage.attributes[0] == FuelType.SOLID) { - + if(solid >= (Float)fuselage.attributes[1]) return 1; else return 0; } - + return -1; } - + public int liquidState() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return -1; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: case HYDROGEN: case XENON: case BALEFIRE: - + if(tanks[0].getFill() >= (Float)fuselage.attributes[1]) return 1; else return 0; default: break; } - + return -1; } - + public int oxidizerState() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return -1; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: case HYDROGEN: case BALEFIRE: - + if(tanks[1].getFill() >= (Float)fuselage.attributes[1]) return 1; else return 0; default: break; } - + return -1; } - + public void updateTypes() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: tanks[0].setTankType(Fluids.KEROSENE); @@ -521,7 +528,7 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + NBTTagList list = new NBTTagList(); tanks[0].writeToNBT(nbt, "fuel"); @@ -559,7 +566,7 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() @@ -584,16 +591,16 @@ public class TileEntityCompactLauncher extends TileEntityLoadedBase implements I @Override public long transferPower(long power) { - + this.power += power; - + if(this.power > this.getMaxPower()) { - + long overshoot = this.power - this.getMaxPower(); this.power = this.getMaxPower(); return overshoot; } - + return 0; } diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java index 0adf91ab8..11650a3ff 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java @@ -18,16 +18,16 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase { @Override public boolean isReadyForLaunch() { return delay <= 0; } @Override public double getLaunchOffset() { return 1D; } - + public int delay = 0; @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(this.delay > 0) delay--; - + if(!this.isMissileValid() || !this.hasFuel()) { this.delay = 100; } @@ -41,11 +41,11 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase { this.state = this.STATE_READY; } } - + } else { - + List entities = worldObj.getEntitiesWithinAABB(EntityMissileBaseNT.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5)); - + if(!entities.isEmpty()) { for(int i = 0; i < 15; i++) { @@ -54,12 +54,20 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase { if(worldObj.rand.nextBoolean()) dir = dir.getRotation(ForgeDirection.UP); float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX; float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ; - - MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ}); + + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", xCoord + 0.5); + data.setDouble("posY", yCoord + 0.25); + data.setDouble("posZ", zCoord + 0.5); + data.setString("type", "launchSmoke"); + data.setDouble("moX", moX); + data.setDouble("moY", 0); + data.setDouble("moZ", moZ); + MainRegistry.proxy.effectNT(data); } } } - + super.updateEntity(); } @@ -68,7 +76,7 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase { super.finalizeLaunch(missile); this.delay = 100; } - + @Override public DirPos[] getConPos() { return new DirPos[] { @@ -82,24 +90,24 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase { new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z) }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.delay = nbt.getInteger("delay"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("delay", delay); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -110,10 +118,10 @@ public class TileEntityLaunchPad extends TileEntityLaunchPadBase { zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java index 55a9dac77..ef3868d79 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadLarge.java @@ -37,10 +37,10 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { private int sync; /** Delay between erector movements */ public int delay = 20; - + private AudioWrapper audioLift; private AudioWrapper audioErector; - + protected boolean liftMoving = false; protected boolean erectorMoving = false; @@ -49,26 +49,26 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.prevLift = this.lift; this.prevErector = this.erector; - + float erectorSpeed = 1.5F; float liftSpeed = 0.025F; - + if(this.isMissileValid()) { if(slots[0].getItem() instanceof ItemMissile) { ItemMissile missile = (ItemMissile) slots[0].getItem(); this.formFactor = missile.formFactor.ordinal(); - + if(missile.formFactor == MissileFormFactor.ATLAS || missile.formFactor == MissileFormFactor.HUGE) { erectorSpeed /= 2F; liftSpeed /= 2F; } } - + if(this.erector == 90F && this.lift == 1F) { this.readyToLoad = true; } @@ -77,16 +77,16 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { erected = false; delay = 20; } - + if(this.power >= 75_000) { if(delay > 0) { delay--; - + if(delay < 10 && scheduleErect) { this.erected = true; this.scheduleErect = false; } - + // if there is no missile or the missile isn't ready (i.e. the erector hasn't returned to zero position yet), retract if(slots[0] == null || !readyToLoad) { //fold back erector @@ -103,13 +103,13 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { } } } - + } else { - + //only extend if the erector isn't up yet and the missile can be loaded if(!erected && readyToLoad) { this.state = this.STATE_LOADING; - + //first, rotate the erector if(erector != 0F) { erector = Math.max(erector - erectorSpeed, 0F); @@ -140,7 +140,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { } } } - + if(!this.hasFuel() || !this.isMissileValid()) this.state = this.STATE_MISSING; if(this.erected && this.canLaunch()) this.state = this.STATE_READY; @@ -153,11 +153,11 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { if(prevLiftMoving && !this.liftMoving) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:door.wgh_stop", 2F, 1F); if(prevErectorMoving && !this.erectorMoving) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:door.garage_stop", 2F, 1F); - + } else { this.prevLift = this.lift; this.prevErector = this.erector; - + if(this.sync > 0) { this.lift = this.lift + ((this.syncLift - this.lift) / (float) this.sync); this.erector = this.erector + ((this.syncErector - this.erector) / (float) this.sync); @@ -166,7 +166,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { this.lift = this.syncLift; this.erector = this.syncErector; } - + if(this.liftMoving) { if(this.audioLift == null || !this.audioLift.isPlaying()) { this.audioLift = MainRegistry.proxy.getLoopedSound("hbm:door.wgh_start", xCoord, yCoord, zCoord, 0.75F, 25F, 1.0F, 5); @@ -179,7 +179,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { this.audioLift = null; } } - + if(this.erectorMoving) { if(this.audioErector == null || !this.audioErector.isPlaying()) { this.audioErector = MainRegistry.proxy.getLoopedSound("hbm:door.garage_move", xCoord, yCoord, zCoord, 1.5F, 25F, 1.0F, 5); @@ -192,7 +192,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { this.audioErector = null; } } - + if(this.erected && (this.formFactor == MissileFormFactor.HUGE.ordinal() || this.formFactor == MissileFormFactor.ATLAS.ordinal()) && this.tanks[1].getFill() > 0) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "tower"); @@ -208,9 +208,9 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { data.setFloat("strafe", 0.05F); for(int i = 0; i < 3; i++) MainRegistry.proxy.effectNT(data); } - + List entities = worldObj.getEntitiesWithinAABB(EntityMissileBaseNT.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5)); - + if(!entities.isEmpty()) { for(int i = 0; i < 15; i++) { @@ -218,19 +218,27 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { if(worldObj.rand.nextBoolean()) dir = dir.getOpposite(); float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX; float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ; - - MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ}); + + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", xCoord + 0.5); + data.setDouble("posY", yCoord + 0.25); + data.setDouble("posZ", zCoord + 0.5); + data.setString("type", "launchSmoke"); + data.setDouble("moX", moX); + data.setDouble("moY", 0); + data.setDouble("moZ", moZ); + MainRegistry.proxy.effectNT(data); } } } - + super.updateEntity(); } @Override public void serialize(ByteBuf buf) { super.serialize(buf); - + buf.writeBoolean(this.liftMoving); buf.writeBoolean(this.erectorMoving); buf.writeBoolean(this.erected); @@ -239,7 +247,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { buf.writeFloat(this.lift); buf.writeFloat(this.erector); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -251,12 +259,12 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { this.formFactor = buf.readByte(); this.syncLift = buf.readFloat(); this.syncErector = buf.readFloat(); - + if(this.lift != this.syncLift || this.erector != this.syncErector) { this.sync = 3; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -267,7 +275,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { this.erector = nbt.getFloat("erector"); this.formFactor = nbt.getInteger("formFactor"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -284,7 +292,7 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { super.finalizeLaunch(missile); this.erected = false; } - + @Override public DirPos[] getConPos() { return new DirPos[] { @@ -298,12 +306,12 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { new DirPos(xCoord + 2, yCoord, zCoord - 5, Library.NEG_Z) }; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 10, @@ -314,10 +322,10 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase { zCoord + 11 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadRusted.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadRusted.java index 8137fa469..973a078da 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadRusted.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPadRusted.java @@ -35,9 +35,9 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements public int prevRedstonePower; public int redstonePower; public Set activatedBlocks = new HashSet<>(4); - + public boolean missileLoaded; - + public TileEntityLaunchPadRusted() { super(4); } @@ -49,19 +49,19 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(this.redstonePower > 0 && this.prevRedstonePower <= 0) { this.launch(); } - + this.prevRedstonePower = this.redstonePower; this.networkPackNT(250); } else { - + List entities = worldObj.getEntitiesWithinAABB(EntityMissileBaseNT.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5)); - + if(!entities.isEmpty()) { for(int i = 0; i < 15; i++) { @@ -70,8 +70,17 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements if(worldObj.rand.nextBoolean()) dir = dir.getRotation(ForgeDirection.UP); float moX = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetX; float moZ = (float) (worldObj.rand.nextGaussian() * 0.15F + 0.75) * dir.offsetZ; - - MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ}); + + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", xCoord + 0.5); + data.setDouble("posY", yCoord + 0.25); + data.setDouble("posZ", zCoord + 0.5); + data.setString("type", "launchSmoke"); + data.setDouble("moX", moX); + data.setDouble("moY", 0); + data.setDouble("moZ", moZ); + MainRegistry.proxy.effectNT(data); + } } } @@ -82,7 +91,7 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements super.serialize(buf); buf.writeBoolean(this.missileLoaded); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -90,18 +99,18 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements } public BombReturnCode launch() { - + if(slots[1] != null && slots[2] != null && slots[3] != null && this.missileLoaded) { if(slots[1].getItem() == ModItems.launch_code && slots[2].getItem() == ModItems.launch_key) { if(slots[3] != null && slots[3].getItem() instanceof IDesignatorItem) { IDesignatorItem designator = (IDesignatorItem) slots[3].getItem(); - + if(!designator.isReady(worldObj, slots[3], xCoord, yCoord, zCoord)) return BombReturnCode.ERROR_MISSING_COMPONENT; - + Vec3 coords = designator.getCoords(worldObj, slots[3], xCoord, yCoord, zCoord); int targetX = (int) Math.floor(coords.xCoord); int targetZ = (int) Math.floor(coords.zCoord); - + EntityMissileDoomsdayRusted missile = new EntityMissileDoomsdayRusted(worldObj, xCoord + 0.5F, yCoord + 1F, zCoord + 0.5F, targetX, targetZ); worldObj.spawnEntityInWorld(missile); TrackerUtil.setTrackingRange(worldObj, missile, 500); @@ -109,19 +118,19 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements this.missileLoaded = false; this.decrStackSize(1, 1); this.markDirty(); - + return BombReturnCode.LAUNCHED; } } } - + return BombReturnCode.ERROR_MISSING_COMPONENT; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.missileLoaded = nbt.getBoolean("missileLoaded"); this.redstonePower = nbt.getInteger("redstonePower"); @@ -132,11 +141,11 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements this.activatedBlocks.add(new BlockPos(activatedBlocks.getInteger("x" + i), activatedBlocks.getInteger("y" + i), activatedBlocks.getInteger("z" + i))); } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setBoolean("missileLoaded", missileLoaded); nbt.setInteger("redstonePower", redstonePower); @@ -172,10 +181,10 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements } AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -186,10 +195,10 @@ public class TileEntityLaunchPadRusted extends TileEntityMachineBase implements zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java index ba3b56d40..a5e49a870 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java @@ -18,7 +18,6 @@ import com.hbm.items.weapon.ItemCustomMissilePart.PartSize; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.packet.toclient.TEMissileMultipartPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IGUIProvider; @@ -62,7 +61,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide public FluidTank[] tanks; public PartSize padSize; public int height; - + public MissileStruct load; private static final int[] access = new int[] { 0 }; @@ -167,11 +166,11 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide return null; } } - + public long getPowerScaled(long i) { return (power * i) / maxPower; } - + public int getSolidScaled(int i) { return (solid * i) / maxSolid; } @@ -180,27 +179,27 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide public void updateEntity() { if (!worldObj.isRemote) { - + updateTypes(); - + if(worldObj.getTotalWorldTime() % 20 == 0) this.updateConnections(); tanks[0].loadTank(2, 6, slots); tanks[1].loadTank(3, 7, slots); - + power = Library.chargeTEFromItems(slots, 5, power, maxPower); - + if(slots[4] != null && slots[4].getItem() == ModItems.rocket_fuel && solid + 250 <= maxSolid) { - + this.decrStackSize(4, 1); solid += 250; } - - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - + + networkPackNT(50); + MissileStruct multipart = getStruct(slots[0]); - + if(multipart != null) PacketDispatcher.wrapper.sendToAllAround(new TEMissileMultipartPacket(xCoord, yCoord, zCoord, multipart), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250)); else @@ -209,7 +208,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide outer: for(int x = -4; x <= 4; x++) { for(int z = -4; z <= 4; z++) { - + if(worldObj.isBlockIndirectlyGettingPowered(xCoord + x, yCoord, zCoord + z) && canLaunch()) { launchFromDesignator(); break outer; @@ -217,17 +216,25 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide } } } else { - + List entities = worldObj.getEntitiesWithinAABB(EntityMissileCustom.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5)); - + if(!entities.isEmpty()) { for(int i = 0; i < 15; i++) { boolean dir = worldObj.rand.nextBoolean(); float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.65F); float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.65F); - - MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] {moX, 0, moZ}); + + NBTTagCompound data = new NBTTagCompound(); + data.setDouble("posX", xCoord + 0.5); + data.setDouble("posY", yCoord + 0.25); + data.setDouble("posZ", zCoord + 0.5); + data.setString("type", "launchSmoke"); + data.setDouble("moX", moX); + data.setDouble("moY", 0); + data.setDouble("moZ", moZ); + MainRegistry.proxy.effectNT(data); } } } @@ -240,7 +247,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide tanks[0].serialize(buf); tanks[1].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { this.power = buf.readLong(); this.solid = buf.readInt(); @@ -248,7 +255,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide tanks[0].deserialize(buf); tanks[1].deserialize(buf); } - + private void updateConnections() { for(int i = -4; i <= 4; i++) { @@ -256,7 +263,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide this.trySubscribe(worldObj, xCoord + i, yCoord, zCoord - 5, Library.NEG_Z); this.trySubscribe(worldObj, xCoord + 5, yCoord, zCoord + i, Library.POS_X); this.trySubscribe(worldObj, xCoord - 5, yCoord, zCoord + i, Library.NEG_X); - + for(int j = 0; j < 2; j++) { this.trySubscribe(tanks[j].getTankType(), worldObj, xCoord + i, yCoord, zCoord + 5, Library.POS_Z); this.trySubscribe(tanks[j].getTankType(), worldObj, xCoord + i, yCoord, zCoord - 5, Library.NEG_Z); @@ -265,12 +272,12 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide } } } - + public boolean canLaunch() { - + if(power >= maxPower * 0.75 && isMissileValid() && hasFuel()) return true; - + return false; } @@ -285,66 +292,66 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide this.launchTo(x, z); return true; } - + public void launchFromDesignator() { if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) { IDesignatorItem designator = (IDesignatorItem) slots[1].getItem(); - + if(designator.isReady(worldObj, slots[1], xCoord, yCoord, zCoord)) { Vec3 coords = designator.getCoords(worldObj, slots[1], xCoord, yCoord, zCoord); int tX = (int) Math.floor(coords.xCoord); int tZ = (int) Math.floor(coords.zCoord); - + this.launchTo(tX, tZ); } } } - + public void launchTo(int tX, int tZ) { worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.missileTakeOff", 10.0F, 1.0F); - + ItemCustomMissilePart chip = (ItemCustomMissilePart) Item.getItemById(ItemCustomMissile.readFromNBT(slots[0], "chip")); float c = (Float)chip.attributes[0]; float f = 1.0F; - + if(getStruct(slots[0]).fins != null) { ItemCustomMissilePart fins = (ItemCustomMissilePart) Item.getItemById(ItemCustomMissile.readFromNBT(slots[0], "stability")); f = (Float) fins.attributes[0]; } - + Vec3 target = Vec3.createVectorHelper(xCoord - tX, 0, zCoord - tZ); target.xCoord *= c * f; target.zCoord *= c * f; - + target.rotateAroundY(worldObj.rand.nextFloat() * 360); - + EntityMissileCustom missile = new EntityMissileCustom(worldObj, xCoord + 0.5F, yCoord + 2.5F, zCoord + 0.5F, tX + (int)target.xCoord, tZ + (int)target.zCoord, getStruct(slots[0])); worldObj.spawnEntityInWorld(missile); - + subtractFuel(); - + slots[0] = null; } - + private boolean hasFuel() { return solidState() != 0 && liquidState() != 0 && oxidizerState() != 0; } - + private void subtractFuel() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + float f = (Float)fuselage.attributes[1]; int fuel = (int)f; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: tanks[0].setFill(tanks[0].getFill() - fuel); @@ -365,114 +372,114 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide this.solid -= fuel; break; default: break; } - + this.power -= maxPower * 0.75; } - + public static MissileStruct getStruct(ItemStack stack) { - + return ItemCustomMissile.getStruct(stack); } - + public boolean isMissileValid() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return false; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + return fuselage.top == padSize; } - + public boolean hasDesignator() { - + if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem && ((IDesignatorItem)slots[1].getItem()).isReady(worldObj, slots[1], xCoord, yCoord, zCoord)) { return true; } - + return false; } - + public int solidState() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return -1; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + if((FuelType)fuselage.attributes[0] == FuelType.SOLID) { - + if(solid >= (Float)fuselage.attributes[1]) return 1; else return 0; } - + return -1; } - + public int liquidState() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return -1; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: case HYDROGEN: case XENON: case BALEFIRE: - + if(tanks[0].getFill() >= (Float)fuselage.attributes[1]) return 1; else return 0; default: break; } - + return -1; } - + public int oxidizerState() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return -1; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: case HYDROGEN: case BALEFIRE: - + if(tanks[1].getFill() >= (Float)fuselage.attributes[1]) return 1; else return 0; default: break; } - + return -1; } - + public void updateTypes() { - + MissileStruct multipart = getStruct(slots[0]); - + if(multipart == null || multipart.fuselage == null) return; - + ItemCustomMissilePart fuselage = (ItemCustomMissilePart)multipart.fuselage; - + switch((FuelType)fuselage.attributes[0]) { case KEROSENE: tanks[0].setTankType(Fluids.KEROSENE); @@ -518,7 +525,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + NBTTagList list = new NBTTagList(); tanks[0].writeToNBT(nbt, "fuel"); @@ -552,12 +559,12 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide public boolean canExtractItem(int i, ItemStack itemStack, int j) { return false; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() @@ -579,19 +586,19 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide public long getMaxPower() { return this.maxPower; } - + @Override public long transferPower(long power) { - + this.power += power; - + if(this.power > this.getMaxPower()) { - + long overshoot = this.power - this.getMaxPower(); this.power = this.getMaxPower(); return overshoot; } - + return 0; } diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeBalefire.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeBalefire.java index 41ce3c37b..f88b7070b 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeBalefire.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeBalefire.java @@ -11,6 +11,7 @@ import com.hbm.tileentity.TileEntityMachineBase; import api.hbm.energymk2.IBatteryItem; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -53,22 +54,29 @@ public class TileEntityNukeBalefire extends TileEntityMachineBase implements IGU if(timer <= 0) { explode(); } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("timer", timer); - data.setBoolean("loaded", this.isLoaded()); - data.setBoolean("started", started); - networkPack(data, 250); + + networkPackNT(250); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - timer = data.getInteger("timer"); - started = data.getBoolean("started"); - loaded = data.getBoolean("loaded"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeInt(this.timer); + buf.writeBoolean(this.started); + buf.writeBoolean(this.loaded); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.timer = buf.readInt(); + this.started = buf.readBoolean(); + this.loaded = buf.readBoolean(); + } + public void handleButtonPacket(int value, int meta) { if(meta == 0 && this.isLoaded()) { diff --git a/src/main/java/com/hbm/tileentity/deco/TileEntityLanternBehemoth.java b/src/main/java/com/hbm/tileentity/deco/TileEntityLanternBehemoth.java index 758f1727d..eb5e45113 100644 --- a/src/main/java/com/hbm/tileentity/deco/TileEntityLanternBehemoth.java +++ b/src/main/java/com/hbm/tileentity/deco/TileEntityLanternBehemoth.java @@ -13,35 +13,35 @@ import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemCircuit.EnumCircuitType; import com.hbm.items.special.ItemKitCustom; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.IRepairable; +import com.hbm.tileentity.TileEntityLoadedBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketReceiver, IRepairable { - +public class TileEntityLanternBehemoth extends TileEntityLoadedBase implements IRepairable { + public boolean isBroken = false; public int comTimer = -1; @Override public void updateEntity() { - + if(!worldObj.isRemote) { if(comTimer == 360) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.hornNearSingle", 10F, 1F); if(comTimer == 280) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.hornFarSingle", 10000F, 1F); if(comTimer == 220) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.hornNearDual", 10F, 1F); if(comTimer == 100) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.hornFarDual", 10000F, 1F); - + if(comTimer == 0) { List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord - 10, yCoord - 10, zCoord - 10, xCoord + 11, yCoord + 11, zCoord + 11)); EntityPlayer first = players.isEmpty() ? null : players.get(0); @@ -56,20 +56,18 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR bonus ? new ItemStack(ModItems.gem_alexandrite) : new ItemStack(Items.diamond, 6 + worldObj.rand.nextInt(6)), new ItemStack(Blocks.red_flower)); shuttle.payload = payload; - + worldObj.spawnEntityInWorld(shuttle); } - + if(comTimer >= 0) { comTimer--; } - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("isBroken", isBroken); - INBTPacketReceiver.networkPack(this, data, 250); + + networkPackNT(250); } } - + @Override public void invalidate() { super.invalidate(); @@ -81,17 +79,22 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.isBroken = nbt.getBoolean("isBroken"); + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.isBroken); } - + + @Override + public void deserialize(ByteBuf buf) { + this.isBroken = buf.readBoolean(); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); isBroken = nbt.getBoolean("isBroken"); comTimer = nbt.getInteger("comTimer"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -103,11 +106,11 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR public boolean isDamaged() { return isBroken; } - + List repair = new ArrayList(); @Override public List getRepairMaterials() { - + if(!repair.isEmpty()) return repair; @@ -124,12 +127,12 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR } @Override public void tryExtinguish(World world, int x, int y, int z, EnumExtinguishType type) { } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord, @@ -140,10 +143,10 @@ public class TileEntityLanternBehemoth extends TileEntity implements INBTPacketR zCoord + 1 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityAshpit.java b/src/main/java/com/hbm/tileentity/machine/TileEntityAshpit.java index 99e32fe38..b99ea830a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityAshpit.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityAshpit.java @@ -15,6 +15,7 @@ import com.hbm.tileentity.TileEntityMachineBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -102,11 +103,8 @@ public class TileEntityAshpit extends TileEntityMachineBase implements IGUIProvi for(int i = 0; i < 5; i++) { if(slots[i] != null) isFull = true; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("playersUsing", this.playersUsing); - data.setBoolean("isFull", this.isFull); - this.networkPack(data, 50); + + this.networkPackNT(50); } else { this.prevDoorAngle = this.doorAngle; @@ -141,10 +139,19 @@ public class TileEntityAshpit extends TileEntityMachineBase implements IGUIProvi } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.playersUsing = nbt.getInteger("playersUsing"); - this.isFull = nbt.getBoolean("isFull"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeInt(this.playersUsing); + buf.writeBoolean(this.isFull); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.playersUsing = buf.readInt(); + this.isFull = buf.readBoolean(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityBlastDoor.java b/src/main/java/com/hbm/tileentity/machine/TileEntityBlastDoor.java index d22bd4150..5d52acb62 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityBlastDoor.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityBlastDoor.java @@ -14,19 +14,19 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; public class TileEntityBlastDoor extends TileEntityLockableBase { - + public boolean isOpening = false; //0: closed, 1: opening/closing, 2:open public int state = 0; public long sysTime; private int timer = 0; public boolean redstoned = false; - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() @@ -36,25 +36,25 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(!isLocked() && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) || worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord + 6, zCoord)) { - + if(!redstoned) { this.tryToggle(); } redstoned = true; - + } else { redstoned = false; } - + if(state != 1) { timer = 0; } else { timer++; - + if(isOpening) { if(timer >= 0) { removeDummy(xCoord, yCoord + 1, zCoord); @@ -88,20 +88,20 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { placeDummy(xCoord, yCoord + 1, zCoord); } } - + if(timer >= 100) { - + if(isOpening) finishOpen(); else finishClose(); } } - + PacketDispatcher.wrapper.sendToAllAround(new TEVaultPacket(xCoord, yCoord, zCoord, isOpening, state, 0, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250)); } } - + public void open() { if(state == 0) { PacketDispatcher.wrapper.sendToAllAround(new TEVaultPacket(xCoord, yCoord, zCoord, isOpening, state, 1, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250)); @@ -112,17 +112,17 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { 0.75F); } } - + public void finishOpen() { state = 2; this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 0.5F, 1.0F); } - + public void close() { if(state == 2) { - PacketDispatcher.wrapper.sendToAll(new TEVaultPacket(xCoord, yCoord, zCoord, isOpening, state, 1, 0)); + PacketDispatcher.wrapper.sendToAllAround(new TEVaultPacket(xCoord, yCoord, zCoord, isOpening, state, 1, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250)); isOpening = false; state = 1; @@ -130,116 +130,116 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { 0.75F); } } - + public void finishClose() { state = 0; this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 0.5F, 1.0F); } - + public void openNeigh() { TileEntity te0 = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); TileEntity te1 = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); TileEntity te2 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); TileEntity te3 = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); - + if(te0 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te0).canOpen() && (!((TileEntityBlastDoor)te0).isLocked() || ((TileEntityBlastDoor)te0).lock == lock)) { ((TileEntityBlastDoor)te0).open(); ((TileEntityBlastDoor)te0).openNeigh(); } } - + if(te1 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te1).canOpen() && (!((TileEntityBlastDoor)te1).isLocked() || ((TileEntityBlastDoor)te1).lock == lock)) { ((TileEntityBlastDoor)te1).open(); ((TileEntityBlastDoor)te1).openNeigh(); } } - + if(te2 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te2).canOpen() && (!((TileEntityBlastDoor)te2).isLocked() || ((TileEntityBlastDoor)te2).lock == lock)) { ((TileEntityBlastDoor)te2).open(); ((TileEntityBlastDoor)te2).openNeigh(); } } - + if(te3 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te3).canOpen() && (!((TileEntityBlastDoor)te3).isLocked() || ((TileEntityBlastDoor)te3).lock == lock)) { ((TileEntityBlastDoor)te3).open(); ((TileEntityBlastDoor)te3).openNeigh(); } } } - + @Override public void lock() { super.lock(); lockNeigh(); } - + public void closeNeigh() { TileEntity te0 = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); TileEntity te1 = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); TileEntity te2 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); TileEntity te3 = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); - + if(te0 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te0).canClose() && (!((TileEntityBlastDoor)te0).isLocked() || ((TileEntityBlastDoor)te0).lock == lock)) { ((TileEntityBlastDoor)te0).close(); ((TileEntityBlastDoor)te0).closeNeigh(); } } - + if(te1 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te1).canClose() && (!((TileEntityBlastDoor)te1).isLocked() || ((TileEntityBlastDoor)te1).lock == lock)) { ((TileEntityBlastDoor)te1).close(); ((TileEntityBlastDoor)te1).closeNeigh(); } } - + if(te2 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te2).canClose() && (!((TileEntityBlastDoor)te2).isLocked() || ((TileEntityBlastDoor)te2).lock == lock)) { ((TileEntityBlastDoor)te2).close(); ((TileEntityBlastDoor)te2).closeNeigh(); } } - + if(te3 instanceof TileEntityBlastDoor) { - + if(((TileEntityBlastDoor)te3).canClose() && (!((TileEntityBlastDoor)te3).isLocked() || ((TileEntityBlastDoor)te3).lock == lock)) { ((TileEntityBlastDoor)te3).close(); ((TileEntityBlastDoor)te3).closeNeigh(); } } } - + public void lockNeigh() { TileEntity te0 = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); TileEntity te1 = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); TileEntity te2 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); TileEntity te3 = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); - + if(te0 instanceof TileEntityBlastDoor) { - + if(!((TileEntityBlastDoor)te0).isLocked()) { ((TileEntityBlastDoor)te0).setPins(this.lock); ((TileEntityBlastDoor)te0).lock(); ((TileEntityBlastDoor)te0).setMod(lockMod); } } - + if(te1 instanceof TileEntityBlastDoor) { if(!((TileEntityBlastDoor)te1).isLocked()) { @@ -248,7 +248,7 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { ((TileEntityBlastDoor)te1).setMod(lockMod); } } - + if(te2 instanceof TileEntityBlastDoor) { if(!((TileEntityBlastDoor)te2).isLocked()) { @@ -257,7 +257,7 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { ((TileEntityBlastDoor)te2).setMod(lockMod); } } - + if(te3 instanceof TileEntityBlastDoor) { if(!((TileEntityBlastDoor)te3).isLocked()) { @@ -267,15 +267,15 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { } } } - + public boolean canOpen() { return state == 0; } - + public boolean canClose() { return state == 2; } - + public void tryToggle() { if(canOpen()) { @@ -286,28 +286,28 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { closeNeigh(); } } - + public boolean placeDummy(int x, int y, int z) { - + if(!worldObj.getBlock(x, y, z).isReplaceable(worldObj, x, y, z)) return false; - + worldObj.setBlock(x, y, z, ModBlocks.dummy_block_blast); - + TileEntity te = worldObj.getTileEntity(x, y, z); - + if(te instanceof TileEntityDummy) { TileEntityDummy dummy = (TileEntityDummy)te; dummy.targetX = xCoord; dummy.targetY = yCoord; dummy.targetZ = zCoord; } - + return true; } - + public void removeDummy(int x, int y, int z) { - + if(worldObj.getBlock(x, y, z) == ModBlocks.dummy_block_blast) { DummyBlockBlast.safeBreak = true; worldObj.setBlock(x, y, z, Blocks.air); @@ -317,7 +317,7 @@ public class TileEntityBlastDoor extends TileEntityLockableBase { public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + isOpening = nbt.getBoolean("isOpening"); state = nbt.getInteger("state"); sysTime = nbt.getLong("sysTime"); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityBroadcaster.java b/src/main/java/com/hbm/tileentity/machine/TileEntityBroadcaster.java index 744e3bab9..e1b261544 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityBroadcaster.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityBroadcaster.java @@ -1,38 +1,42 @@ package com.hbm.tileentity.machine; import java.util.List; +import java.util.Random; import com.hbm.lib.ModDamageSource; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.LoopedSoundPacket; +import com.hbm.main.MainRegistry; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.TileEntityLoadedBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -public class TileEntityBroadcaster extends TileEntity { - +public class TileEntityBroadcaster extends TileEntityLoadedBase { + + private AudioWrapper audio; + @Override public void updateEntity() { - + List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 25, yCoord + 0.5 - 25, zCoord + 0.5 - 25, xCoord + 0.5 + 25, yCoord + 0.5 + 25, zCoord + 0.5 + 25)); - + for(int i = 0; i < list.size(); i++) { if(list.get(i) instanceof EntityLivingBase) { EntityLivingBase e = (EntityLivingBase)list.get(i); double d = Math.sqrt(Math.pow(e.posX - (xCoord + 0.5), 2) + Math.pow(e.posY - (yCoord + 0.5), 2) + Math.pow(e.posZ - (zCoord + 0.5), 2)); - + if(d <= 25) { if(e.getActivePotionEffect(Potion.confusion) == null || e.getActivePotionEffect(Potion.confusion).getDuration() < 100) e.addPotionEffect(new PotionEffect(Potion.confusion.id, 300, 0)); } - + if(d <= 15) { double t = (15 - d) / 15 * 10; e.attackEntityFrom(ModDamageSource.broadcast, (float) t); @@ -40,16 +44,59 @@ public class TileEntityBroadcaster extends TileEntity { } } - if(!worldObj.isRemote) { - PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); + if (worldObj.isRemote) { + if(audio == null) { + audio = createAudioLoop(); + audio.startSound(); + } else if(!audio.isPlaying()) { + audio = rebootAudio(audio); + } + + int intendedVolume = 25; + + EntityPlayer player = MainRegistry.proxy.me(); + float volume; + if(player != null) { + float f = (float)Math.sqrt(Math.pow(xCoord - player.posX, 2) + Math.pow(yCoord - player.posY, 2) + Math.pow(zCoord - player.posZ, 2)); + volume = (f / intendedVolume) * -2 + 2; + } else { + volume = intendedVolume; + } + + audio.updateVolume(getVolume(volume)); + audio.keepAlive(); } } - + + @Override + public void onChunkUnload() { + super.onChunkUnload(); + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + @Override + public void invalidate() { + super.invalidate(); + if(audio != null) { + audio.stopSound(); + audio = null; + } + } + + @Override + public AudioWrapper createAudioLoop() { + Random rand = new Random(xCoord + yCoord + zCoord); + return MainRegistry.proxy.getLoopedSound("hbm:block.broadcast" + (rand.nextInt(3) + 1), xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F); + } + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCharger.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCharger.java index 6df1f8bf9..313d19986 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCharger.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCharger.java @@ -4,72 +4,68 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import com.hbm.tileentity.INBTPacketReceiver; -import com.hbm.tileentity.TileEntityLoadedBase; - import api.hbm.energymk2.IBatteryItem; import api.hbm.energymk2.IEnergyReceiverMK2; +import com.hbm.tileentity.IBufPacketReceiver; +import com.hbm.tileentity.TileEntityLoadedBase; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyReceiverMK2, INBTPacketReceiver { - +public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyReceiverMK2, IBufPacketReceiver { + private List players = new ArrayList(); private long charge = 0; private int lastOp = 0; - + boolean particles = false; - + public int usingTicks; public int lastUsingTicks; public static final int delay = 20; @Override public void updateEntity() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite(); - + if(!worldObj.isRemote) { this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir); - + players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(0.5, 0.0, 0.5)); - + charge = 0; - + for(EntityPlayer player : players) { - + for(int i = 0; i < 5; i++) { - + ItemStack stack = player.getEquipmentInSlot(i); - + if(stack != null && stack.getItem() instanceof IBatteryItem) { IBatteryItem battery = (IBatteryItem) stack.getItem(); charge += Math.min(battery.getMaxCharge(stack) - battery.getCharge(stack), battery.getChargeRate()); } } } - + particles = lastOp > 0; - + if(particles) { - + lastOp--; - + if(worldObj.getTotalWorldTime() % 20 == 0) worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 0.2F, 0.5F); } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("c", charge); - data.setBoolean("p", particles); - INBTPacketReceiver.networkPack(this, data, 50); + + networkPackNT(50); } - + lastUsingTicks = usingTicks; - + if((charge > 0 || particles) && usingTicks < delay) { usingTicks++; if(usingTicks == 2) @@ -80,7 +76,7 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyRe if(usingTicks == 4) worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "tile.piston.in", 0.5F, 0.5F); } - + if(particles) { Random rand = worldObj.rand; worldObj.spawnParticle("magicCrit", @@ -94,9 +90,15 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyRe } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.charge = nbt.getLong("c"); - this.particles = nbt.getBoolean("p"); + public void serialize(ByteBuf buf) { + buf.writeLong(this.charge); + buf.writeBoolean(this.particles); + } + + @Override + public void deserialize(ByteBuf buf) { + this.charge = buf.readLong(); + this.particles = buf.readBoolean(); } @Override @@ -111,32 +113,32 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyRe @Override public void setPower(long power) { } - + @Override public long transferPower(long power) { - + if(this.usingTicks < delay || power == 0) return power; - + for(EntityPlayer player : players) { - + for(int i = 0; i < 5; i++) { - + ItemStack stack = player.getEquipmentInSlot(i); - + if(stack != null && stack.getItem() instanceof IBatteryItem) { IBatteryItem battery = (IBatteryItem) stack.getItem(); - + long toCharge = Math.min(battery.getMaxCharge(stack) - battery.getCharge(stack), battery.getChargeRate()); toCharge = Math.min(toCharge, power / 5); battery.chargeBattery(stack, toCharge); power -= toCharge; - + lastOp = 4; } } } - + return power; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBase.java index 08964ccc8..3638afecb 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBase.java @@ -6,28 +6,28 @@ import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.fluid.IFluidUser; -import net.minecraft.nbt.NBTTagCompound; +import io.netty.buffer.ByteBuf; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public abstract class TileEntityChimneyBase extends TileEntityLoadedBase implements IFluidUser, INBTPacketReceiver { +public abstract class TileEntityChimneyBase extends TileEntityLoadedBase implements IFluidUser, IBufPacketReceiver { public long ashTick = 0; public long sootTick = 0; public int onTicks; - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { FluidType[] types = new FluidType[] {Fluids.SMOKE, Fluids.SMOKE_LEADED, Fluids.SMOKE_POISON}; - + for(FluidType type : types) { this.trySubscribe(type, worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X); this.trySubscribe(type, worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X); @@ -35,11 +35,11 @@ public abstract class TileEntityChimneyBase extends TileEntityLoadedBase impleme this.trySubscribe(type, worldObj, xCoord, yCoord, zCoord - 2, Library.NEG_Z); } } - + if(ashTick > 0 || sootTick > 0) { TileEntity below = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(below instanceof TileEntityAshpit) { TileEntityAshpit ashpit = (TileEntityAshpit) below; ashpit.ashLevelFly += ashTick; @@ -48,15 +48,13 @@ public abstract class TileEntityChimneyBase extends TileEntityLoadedBase impleme this.ashTick = 0; this.sootTick = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("onTicks", onTicks); - INBTPacketReceiver.networkPack(this, data, 150); - + + networkPackNT(150); + if(onTicks > 0) onTicks--; - + } else { - + if(onTicks > 0) { this.spawnParticles(); } @@ -66,15 +64,21 @@ public abstract class TileEntityChimneyBase extends TileEntityLoadedBase impleme public boolean cpaturesAsh() { return true; } - + public boolean cpaturesSoot() { return false; } - + public void spawnParticles() { } - - public void networkUnpack(NBTTagCompound nbt) { - this.onTicks = nbt.getInteger("onTicks"); + + @Override + public void serialize(ByteBuf buf) { + buf.writeInt(this.onTicks); + } + + @Override + public void deserialize(ByteBuf buf) { + this.onTicks = buf.readInt(); } @Override @@ -85,23 +89,23 @@ public abstract class TileEntityChimneyBase extends TileEntityLoadedBase impleme @Override public long transferFluid(FluidType type, int pressure, long fluid) { - + if(type != Fluids.SMOKE && type != Fluids.SMOKE_LEADED && type != Fluids.SMOKE_POISON) return fluid; - + onTicks = 20; if(cpaturesAsh()) ashTick += fluid; if(cpaturesSoot()) sootTick += fluid; - + fluid *= getPollutionMod(); if(type == Fluids.SMOKE) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, fluid / 100F); if(type == Fluids.SMOKE_LEADED) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, fluid / 100F); if(type == Fluids.SMOKE_POISON) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.POISON, fluid / 100F); - + return 0; } - + public abstract double getPollutionMod(); @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java b/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java index 2a9e10f17..9aa33070d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java @@ -13,12 +13,10 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.trait.FT_Coolable; import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType; import com.hbm.main.MainRegistry; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.IConfigurableMachine; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.CompatEnergyControl; import com.hbm.util.fauxpointtwelve.BlockPos; @@ -28,9 +26,9 @@ import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -41,16 +39,17 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyProviderMK2, INBTPacketReceiver, IFluidStandardTransceiver, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IConfigurableMachine, IFluidCopiable { +public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiver, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IConfigurableMachine, IBufPacketReceiver, IFluidCopiable{ + public long power; private int turnTimer; public float rotor; public float lastRotor; public float fanAcceleration = 0F; - + public FluidTank[] tanks; protected double[] info = new double[3]; - + private AudioWrapper audio; private float audioDesync; @@ -59,7 +58,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr public static int inputTankSize = 1_000_000_000; public static int outputTankSize = 1_000_000_000; public static double efficiency = 0.85D; - + public TileEntityChungus() { tanks = new FluidTank[2]; tanks[0] = new FluidTank(Fluids.STEAM, inputTankSize); @@ -95,11 +94,11 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.info = new double[3]; - + boolean operational = false; FluidType in = tanks[0].getTankType(); boolean valid = false; @@ -121,51 +120,44 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr operational = ops > 0; } } - + if(!valid) tanks[1].setTankType(Fluids.NONE); if(power > maxPower) power = maxPower; - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); this.tryProvide(worldObj, xCoord - dir.offsetX * 11, yCoord, zCoord - dir.offsetZ * 11, dir.getOpposite()); - + for(DirPos pos : this.getConPos()) { this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + if(power > maxPower) power = maxPower; - + turnTimer--; - + if(operational) turnTimer = 25; - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("type", tanks[0].getTankType().getID()); - data.setInteger("operational", turnTimer); - data.setInteger("input_fill", tanks[0].getFill()); - data.setInteger("output_fill", tanks[1].getFill()); - this.networkPack(data, 150); - + networkPackNT(150); + } else { - + this.lastRotor = this.rotor; this.rotor += this.fanAcceleration; - + if(this.rotor >= 360) { this.rotor -= 360; this.lastRotor -= 360; } - + if(turnTimer > 0) { // Fan accelerates with a random offset to ensure the audio doesn't perfectly align, makes for a more pleasant hum this.fanAcceleration = Math.max(0F, Math.min(25F, this.fanAcceleration += 0.075F + audioDesync)); - + Random rand = worldObj.rand; ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection side = dir.getRotation(ForgeDirection.UP); - + for(int i = 0; i < 10; i++) { worldObj.spawnParticle("cloud", xCoord + 0.5 + dir.offsetX * (rand.nextDouble() + 1.25) + rand.nextGaussian() * side.offsetX * 0.65, @@ -174,7 +166,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr -dir.offsetX * 0.2, 0, -dir.offsetZ * 0.2); } - + if(audio == null) { audio = MainRegistry.proxy.getLoopedSound("hbm:block.chungusTurbineRunning", xCoord, yCoord, zCoord, 1.0F, 20F, 1.0F); audio.startSound(); @@ -185,7 +177,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr audio.updatePitch(0.25F + 0.75F * turbineSpeed); } else { this.fanAcceleration = Math.max(0F, Math.min(25F, this.fanAcceleration -= 0.1F)); - + if(audio != null) { if(this.fanAcceleration > 0) { float turbineSpeed = this.fanAcceleration / 25F; @@ -196,16 +188,16 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr audio = null; } } - } + } } } - + public void onLeverPull(FluidType previous) { for(BlockPos pos : getConPos()) { this.tryUnsubscribe(previous, worldObj, pos.getX(), pos.getY(), pos.getZ()); } } - + public DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); @@ -215,20 +207,23 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr new DirPos(xCoord - rot.offsetX * 3, yCoord, zCoord - rot.offsetZ * 3, rot.getOpposite()) }; } - - public void networkPack(NBTTagCompound nbt, int range) { - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); + + @Override + public void serialize(ByteBuf buf) { + buf.writeLong(this.power); + buf.writeInt(this.turnTimer); + this.tanks[0].serialize(buf); + this.tanks[1].serialize(buf); } @Override - public void networkUnpack(NBTTagCompound data) { - this.power = data.getLong("power"); - this.turnTimer = data.getInteger("operational"); - this.tanks[0].setTankType(Fluids.fromID(data.getInteger("type"))); - this.tanks[0].setFill(data.getInteger("input_fill")); - this.tanks[1].setFill(data.getInteger("output_fill")); + public void deserialize(ByteBuf buf) { + this.power = buf.readLong(); + this.turnTimer = buf.readInt(); + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -236,7 +231,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr tanks[1].readFromNBT(nbt, "steam"); power = nbt.getLong("power"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -244,12 +239,12 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr tanks[1].writeToNBT(nbt, "steam"); nbt.setLong("power", power); } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -281,7 +276,7 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr public String getComponentName() { return "ntm_turbine"; } - + @Override public void onChunkUnload() { super.onChunkUnload(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java index ce3437db8..f29d0c0c1 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java @@ -7,25 +7,26 @@ import com.google.gson.stream.JsonWriter; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.saveddata.TomSaveData; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.IConfigurableMachine; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.CompatEnergyControl; import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IInfoProviderEC; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.EnumSkyBlock; -public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver, IInfoProviderEC, IConfigurableMachine, IFluidCopiable { +public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidStandardTransceiver, IInfoProviderEC, IConfigurableMachine, IBufPacketReceiver, IFluidCopiable { public int age = 0; public FluidTank[] tanks; - + public int waterTimer = 0; protected int throughput; - + //Configurable values public static int inputTankSize = 100; public static int outputTankSize = 100; @@ -53,73 +54,71 @@ public class TileEntityCondenser extends TileEntityLoadedBase implements IFluidS writer.name("I:outputTankSize").value(outputTankSize); } - - @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + age++; if(age >= 2) { age = 0; } - - NBTTagCompound data = new NBTTagCompound(); - this.tanks[0].writeToNBT(data, "0"); - + if(this.waterTimer > 0) this.waterTimer--; int convert = Math.min(tanks[0].getFill(), tanks[1].getMaxFill() - tanks[1].getFill()); this.throughput = convert; - + if(extraCondition(convert)) { tanks[0].setFill(tanks[0].getFill() - convert); - + if(convert > 0) this.waterTimer = 20; - + int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord); - + if(TomSaveData.forWorld(worldObj).fire > 1e-5 && light > 7) { // Make both steam and water evaporate during firestorms... tanks[1].setFill(tanks[1].getFill() - convert); } else { tanks[1].setFill(tanks[1].getFill() + convert); } - + postConvert(convert); } - - this.tanks[1].writeToNBT(data, "1"); - + this.subscribeToAllAround(tanks[0].getTankType(), this); this.sendFluidToAll(tanks[1], this); - - data.setByte("timer", (byte) this.waterTimer); - packExtra(data); - INBTPacketReceiver.networkPack(this, data, 150); + + networkPackNT(150); } } - + public void packExtra(NBTTagCompound data) { } public boolean extraCondition(int convert) { return true; } public void postConvert(int convert) { } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.tanks[0].readFromNBT(nbt, "0"); - this.tanks[1].readFromNBT(nbt, "1"); - this.waterTimer = nbt.getByte("timer"); + public void serialize(ByteBuf buf) { + this.tanks[0].serialize(buf); + this.tanks[1].serialize(buf); + buf.writeByte(this.waterTimer); } - + + @Override + public void deserialize(ByteBuf buf) { + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); + this.waterTimer = buf.readByte(); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); tanks[0].readFromNBT(nbt, "water"); tanks[1].readFromNBT(nbt, "steam"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenserPowered.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenserPowered.java index 9aabea820..2240477cd 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenserPowered.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenserPowered.java @@ -13,6 +13,7 @@ import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; @@ -98,11 +99,21 @@ public class TileEntityCondenserPowered extends TileEntityCondenser implements I } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.power = nbt.getLong("power"); - this.tanks[0].readFromNBT(nbt, "0"); - this.tanks[1].readFromNBT(nbt, "1"); - this.waterTimer = nbt.getByte("timer"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + this.tanks[0].serialize(buf); + this.tanks[1].serialize(buf); + buf.writeByte(this.waterTimer); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); + this.waterTimer = buf.readByte(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityConveyorPress.java b/src/main/java/com/hbm/tileentity/machine/TileEntityConveyorPress.java index 418c9932c..d7a93653e 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityConveyorPress.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityConveyorPress.java @@ -7,11 +7,13 @@ import com.hbm.inventory.recipes.PressRecipes; import com.hbm.items.machine.ItemStamp; import com.hbm.lib.Library; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -31,7 +33,7 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE private int turnProgress; protected boolean isRetracting = false; private int delay; - + public ItemStack syncStack; public TileEntityConveyorPress() { @@ -45,32 +47,32 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.updateConnections(); - + if(delay <= 0) { - + if(isRetracting) { - + if(this.canRetract()) { this.press -= speed; this.power -= this.usage; - + if(press <= 0) { press = 0; this.isRetracting = false; delay = 0; } } - + } else { - + if(this.canExtend()) { this.press += speed; this.power -= this.usage; - + if(press >= 1) { press = 1; this.isRetracting = true; @@ -79,26 +81,17 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE } } } - + } else { delay--; } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setDouble("press", press); - if(slots[0] != null) { - NBTTagCompound stack = new NBTTagCompound(); - slots[0].writeToNBT(stack); - data.setTag("stack", stack); - } - - this.networkPack(data, 50); + + this.networkPackNT(50); } else { - + // approach-based interpolation, GO! this.lastPress = this.renderPress; - + if(this.turnProgress > 0) { this.renderPress = this.renderPress + ((this.syncPress - this.renderPress) / (double) this.turnProgress); --this.turnProgress; @@ -107,11 +100,11 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE } } } - + protected void updateConnections() { for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X), @@ -120,40 +113,40 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z), }; } - + public boolean canExtend() { - + if(this.power < usage) return false; if(slots[0] == null) return false; - + List items = worldObj.getEntitiesWithinAABB(EntityMovingItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1)); if(items.isEmpty()) return false; - + for(EntityMovingItem item : items) { ItemStack stack = item.getItemStack(); if(PressRecipes.getOutput(stack, slots[0]) != null && stack.stackSize == 1) { - + double d0 = 0.35; double d1 = 0.65; if(item.posX > xCoord + d0 && item.posX < xCoord + d1 && item.posZ > zCoord + d0 && item.posZ < zCoord + d1) { item.setPosition(xCoord + 0.5, item.posY, zCoord + 0.5); } - + return true; } } - + return false; } - + public void process() { - + List items = worldObj.getEntitiesWithinAABB(EntityMovingItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 1.5, zCoord + 1)); - + for(EntityMovingItem item : items) { ItemStack stack = item.getItemStack(); ItemStack output = PressRecipes.getOutput(stack, slots[0]); - + if(output != null && stack.stackSize == 1) { item.setDead(); EntityMovingItem out = new EntityMovingItem(worldObj); @@ -162,9 +155,9 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE worldObj.spawnEntityInWorld(out); } } - + this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.pressOperate", getVolume(1.5F), 1.0F); - + if(slots[0].getMaxDamage() != 0) { slots[0].setItemDamage(slots[0].getItemDamage() + 1); if(slots[0].getItemDamage() >= slots[0].getMaxDamage()) { @@ -172,25 +165,28 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE } } } - + public boolean canRetract() { - if(this.power < usage) return false; - return true; + return this.power >= usage; } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.power = nbt.getLong("power"); - this.syncPress = nbt.getInteger("press"); - - if(nbt.hasKey("stack")) { - NBTTagCompound stack = nbt.getCompoundTag("stack"); - this.syncStack = ItemStack.loadItemStackFromNBT(stack); - } else { - this.syncStack = null; - } - + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeLong(this.power); + buf.writeDouble(this.press); + BufferUtil.writeItemStack(buf, slots[0]); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.power = buf.readLong(); + this.syncPress = buf.readDouble(); + this.syncStack = BufferUtil.readItemStack(buf); + this.turnProgress = 2; } @@ -198,7 +194,7 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE public boolean isItemValidForSlot(int i, ItemStack stack) { return stack.getItem() instanceof ItemStamp; } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return new int[] { 0 }; @@ -228,26 +224,26 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE public boolean canConnect(ForgeDirection dir) { return dir != ForgeDirection.DOWN; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.power = nbt.getLong("power"); this.press = nbt.getDouble("press"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("power", power); nbt.setDouble("press", press); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -258,10 +254,10 @@ public class TileEntityConveyorPress extends TileEntityMachineBase implements IE zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCore.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCore.java index a3c1cd5be..767575fa9 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCore.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCore.java @@ -26,6 +26,7 @@ import com.hbm.util.CompatEnergyControl; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -137,15 +138,8 @@ public class TileEntityCore extends TileEntityMachineBase implements IGUIProvide if(heat > 0) radiation(); - - NBTTagCompound data = new NBTTagCompound(); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - data.setInteger("field", field); - data.setInteger("heat", heat); - data.setInteger("color", color); - data.setBoolean("melt", meltdownTick); - networkPack(data, 250); + + networkPackNT(250); heat = 0; @@ -161,15 +155,28 @@ public class TileEntityCore extends TileEntityMachineBase implements IGUIProvide } - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); - tanks[0].readFromNBT(data, "t0"); - tanks[1].readFromNBT(data, "t1"); - field = data.getInteger("field"); - heat = data.getInteger("heat"); - color = data.getInteger("color"); - meltdownTick = data.getBoolean("melt"); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + buf.writeInt(field); + buf.writeInt(heat); + buf.writeInt(color); + buf.writeBoolean(meltdownTick); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + this.field = buf.readInt(); + this.heat = buf.readInt(); + this.color = buf.readInt(); + this.meltdownTick = buf.readBoolean(); } private void radiation() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java index edcca5f2f..3a6712af9 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java @@ -18,6 +18,7 @@ import com.hbm.util.CompatEnergyControl; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -157,26 +158,32 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne this.markDirty(); - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("watts", watts); - data.setLong("prev", prev); - data.setInteger("beam", beam); - data.setBoolean("isOn", isOn); - tank.writeToNBT(data, "tank"); - this.networkPack(data, 250); + this.networkPackNT(250); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - power = data.getLong("power"); - watts = data.getInteger("watts"); - prev = data.getLong("prev"); - beam = data.getInteger("beam"); - isOn = data.getBoolean("isOn"); - tank.readFromNBT(data, "tank"); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeLong(power); + buf.writeInt(watts); + buf.writeLong(prev); + buf.writeInt(beam); + buf.writeBoolean(isOn); + tank.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.power = buf.readLong(); + this.watts = buf.readInt(); + this.prev = buf.readLong(); + this.beam = buf.readInt(); + this.isOn = buf.readBoolean(); + tank.deserialize(buf); } public long getPowerScaled(long i) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java index f84cc698f..5380702cf 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreInjector.java @@ -12,6 +12,7 @@ import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -100,19 +101,26 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl this.markDirty(); - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("beam", beam); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - this.networkPack(data, 250); + this.networkPackNT(250); } } - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - beam = data.getInteger("beam"); - tanks[0].readFromNBT(data, "t0"); - tanks[1].readFromNBT(data, "t1"); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeInt(beam); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.beam = buf.readInt(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java index 574f40e56..c85a206c7 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java @@ -16,6 +16,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -68,19 +69,26 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn } } - NBTTagCompound data = new NBTTagCompound(); - data.setLong("joules", joules); - tank.writeToNBT(data, "t"); - this.networkPack(data, 50); + this.networkPackNT(50); joules = 0; } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - joules = data.getLong("joules"); - tank.readFromNBT(data, "t"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeLong(joules); + tank.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + joules = buf.readLong(); + tank.deserialize(buf); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java index 1d8e8044d..2647d4c6e 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java @@ -14,6 +14,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -92,11 +93,7 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I } } - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("watts", watts); - data.setInteger("beam", beam); - this.networkPack(data, 250); + this.networkPackNT(250); } } @@ -105,13 +102,23 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - power = data.getLong("power"); - watts = data.getInteger("watts"); - beam = data.getInteger("beam"); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeLong(power); + buf.writeInt(watts); + buf.writeInt(beam); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.power = buf.readLong(); + this.watts = buf.readInt(); + this.beam = buf.readInt(); } public long getPowerScaled(long i) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java index a799ab1b6..fd3f5248d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java @@ -50,7 +50,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro public int heat; public int progress; - + public List recipeStack = new ArrayList(); public List wasteStack = new ArrayList(); @@ -102,21 +102,21 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro @Override public void updateEntity() { - + if(!worldObj.isRemote) { tryPullHeat(); - + /* collect items */ if(worldObj.getTotalWorldTime() % 5 == 0) { List list = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord + 0.5, zCoord - 0.5, xCoord + 1.5, yCoord + 1, zCoord + 1.5)); - + for(EntityItem item : list) { ItemStack stack = item.getEntityItem(); if(this.isItemSmeltable(stack)) { - + for(int i = 1; i < 10; i++) { if(slots[i] == null) { - + if(stack.stackSize == 1) { slots[i] = stack.copy(); item.setDead(); @@ -126,7 +126,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro slots[i].stackSize = 1; stack.stackSize--; } - + this.markChanged(); } } @@ -139,29 +139,29 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro for(MaterialStack stack : recipeStack) totalMass += stack.amount; for(MaterialStack stack : wasteStack) totalMass += stack.amount; - + double level = ((double) totalMass / (double) totalCap) * 0.875D; - + List living = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5 + level, zCoord + 0.5).expand(1, 0, 1)); for(EntityLivingBase entity : living) { entity.attackEntityFrom(DamageSource.lava, 5F); entity.setFire(5); } - + /* smelt items from buffer */ if(!trySmelt()) { this.progress = 0; } - + tryRecipe(); - + /* pour waste stack */ if(!this.wasteStack.isEmpty()) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); Vec3 impact = Vec3.createVectorHelper(0, 0, 0); MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord + 0.25D, zCoord + 0.5D + dir.offsetZ * 1.875D, 6, true, this.wasteStack, MaterialShapes.NUGGET.q(3), impact); - + if(didPour != null) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "foundry"); @@ -171,24 +171,24 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro data.setFloat("base", 0.625F); data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875))); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord, zCoord + 0.5D + dir.offsetZ * 1.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); - + } PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND / 20F); } - + /* pour recipe stack */ if(!this.recipeStack.isEmpty()) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); List toCast = new ArrayList(); - + CrucibleRecipe recipe = this.getLoadedRecipe(); //if no recipe is loaded, everything from the recipe stack will be drainable if(recipe == null) { toCast.addAll(this.recipeStack); } else { - + for(MaterialStack stack : this.recipeStack) { for(MaterialStack output : recipe.output) { if(stack.material == output.material) { @@ -198,7 +198,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro } } } - + Vec3 impact = Vec3.createVectorHelper(0, 0, 0); MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord + 0.25D, zCoord + 0.5D + dir.offsetZ * 1.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3), impact); @@ -211,7 +211,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro data.setFloat("base", 0.625F); data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875))); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 1.875D, yCoord, zCoord + 0.5D + dir.offsetZ * 1.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); - + } PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND / 20F); @@ -220,51 +220,63 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro /* clean up stacks */ this.recipeStack.removeIf(o -> o.amount <= 0); this.wasteStack.removeIf(x -> x.amount <= 0); - + /* sync */ this.networkPackNT(25); } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); buf.writeInt(progress); buf.writeInt(heat); - + buf.writeShort(recipeStack.size()); for(MaterialStack sta : recipeStack) { - buf.writeInt(sta.material.id); + if (sta.material == null) + buf.writeInt(-1); + else + buf.writeInt(sta.material.id); buf.writeInt(sta.amount); } - + buf.writeShort(wasteStack.size()); for(MaterialStack sta : wasteStack) { - buf.writeInt(sta.material.id); + if (sta.material == null) + buf.writeInt(-1); + else + buf.writeInt(sta.material.id); buf.writeInt(sta.amount); } } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); progress = buf.readInt(); heat = buf.readInt(); - + recipeStack.clear(); wasteStack.clear(); - + int mats = buf.readShort(); for(int i = 0; i < mats; i++) { - recipeStack.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt())); + int id = buf.readInt(); + if (id == -1) + continue; + recipeStack.add(new MaterialStack(Mats.matById.get(id), buf.readInt())); } - + mats = buf.readShort(); for(int i = 0; i < mats; i++) { - wasteStack.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt())); + int id = buf.readInt(); + if (id == -1) + continue; + wasteStack.add(new MaterialStack(Mats.matById.get(id), buf.readInt())); } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -273,20 +285,20 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro for(int i = 0; i < rec.length / 2; i++) { recipeStack.add(new MaterialStack(Mats.matById.get(rec[i * 2]), rec[i * 2 + 1])); } - + int[] was = nbt.getIntArray("was"); for(int i = 0; i < was.length / 2; i++) { wasteStack.add(new MaterialStack(Mats.matById.get(was[i * 2]), was[i * 2 + 1])); } - + this.progress = nbt.getInteger("progress"); this.heat = nbt.getInteger("heat"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + int[] rec = new int[recipeStack.size() * 2]; int[] was = new int[wasteStack.size() * 2]; for(int i = 0; i < recipeStack.size(); i++) { MaterialStack sta = recipeStack.get(i); rec[i * 2] = sta.material.id; rec[i * 2 + 1] = sta.amount; } @@ -296,21 +308,21 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro nbt.setInteger("progress", progress); nbt.setInteger("heat", heat); } - + protected void tryPullHeat() { - + if(this.heat >= this.maxHeat) return; - + TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(con instanceof IHeatSource) { IHeatSource source = (IHeatSource) con; int diff = source.getHeatStored() - this.heat; - + if(diff == 0) { return; } - + if(diff > 0) { diff = (int) Math.ceil(diff * diffusion); source.useUpHeat(diff); @@ -320,170 +332,170 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro return; } } - + this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0); } - + protected boolean trySmelt() { - + if(this.heat < maxHeat / 2) return false; - + int slot = this.getFirstSmeltableSlot(); if(slot == -1) return false; - + int delta = this.heat - (maxHeat / 2); delta *= 0.05; - + this.progress += delta; this.heat -= delta; - + if(this.progress >= processTime) { this.progress = 0; - + List materials = Mats.getSmeltingMaterialsFromItem(slots[slot]); CrucibleRecipe recipe = getLoadedRecipe(); - + for(MaterialStack material : materials) { boolean mainStack = recipe != null && (getQuantaFromType(recipe.input, material.material) > 0 || getQuantaFromType(recipe.output, material.material) > 0); - + if(mainStack) { this.addToStack(this.recipeStack, material); } else { this.addToStack(this.wasteStack, material); } } - + this.decrStackSize(slot, 1); } - + return true; } - + protected void tryRecipe() { CrucibleRecipe recipe = this.getLoadedRecipe(); - + if(recipe == null) return; if(worldObj.getTotalWorldTime() % recipe.frequency > 0) return; - + for(MaterialStack stack : recipe.input) { if(getQuantaFromType(this.recipeStack, stack.material) < stack.amount) return; } - + for(MaterialStack stack : this.recipeStack) { stack.amount -= getQuantaFromType(recipe.input, stack.material); } - + outer: for(MaterialStack out : recipe.output) { - + for(MaterialStack stack : this.recipeStack) { if(stack.material == out.material) { stack.amount += out.amount; continue outer; } } - + this.recipeStack.add(out.copy()); } } - + protected int getFirstSmeltableSlot() { - + for(int i = 1; i < 10; i++) { - + ItemStack stack = slots[i]; - + if(stack != null && isItemSmeltable(stack)) { return i; } } - + return -1; } @Override public boolean isItemValidForSlot(int i, ItemStack stack) { - + if(i == 0) { return stack.getItem() == ModItems.crucible_template; } - + return isItemSmeltable(stack); } - + public boolean isItemSmeltable(ItemStack stack) { - + List materials = Mats.getSmeltingMaterialsFromItem(stack); - + //if there's no materials in there at all, don't smelt if(materials.isEmpty()) return false; CrucibleRecipe recipe = getLoadedRecipe(); - + //needs to be true, will always be true if there's no recipe loaded boolean matchesRecipe = recipe == null; - + //the amount of material in the entire recipe input int recipeContent = recipe != null ? recipe.getInputAmount() : 0; //the total amount of the current waste stack, used for simulation int recipeAmount = getQuantaFromType(this.recipeStack, null); int wasteAmount = getQuantaFromType(this.wasteStack, null); - + for(MaterialStack mat : materials) { //if no recipe is loaded, everything will land in the waste stack int recipeInputRequired = recipe != null ? getQuantaFromType(recipe.input, mat.material) : 0; - + //this allows pouring the ouput material back into the crucible if(recipe != null && getQuantaFromType(recipe.output, mat.material) > 0) { recipeAmount += mat.amount; matchesRecipe = true; continue; } - + if(recipeInputRequired == 0) { //if this type isn't required by the recipe, add it to the waste stack wasteAmount += mat.amount; } else { - + //the maximum is the recipe's ratio scaled up to the recipe stack's capacity int matMaximum = recipeInputRequired * this.recipeZCapacity / recipeContent; int amountStored = getQuantaFromType(recipeStack, mat.material); - + matchesRecipe = true; - + recipeAmount += mat.amount; - + //if the amount of that input would exceed the amount dictated by the recipe, return false if(recipe != null && amountStored + mat.amount > matMaximum) return false; } } - + //if the amount doesn't exceed the capacity and the recipe matches (or isn't null), return true return recipeAmount <= this.recipeZCapacity && wasteAmount <= this.wasteZCapacity && matchesRecipe; } - + public void addToStack(List stack, MaterialStack matStack) { - + for(MaterialStack mat : stack) { if(mat.material == matStack.material) { mat.amount += matStack.amount; return; } } - + stack.add(matStack.copy()); } - + public CrucibleRecipe getLoadedRecipe() { - + if(slots[0] != null && slots[0].getItem() == ModItems.crucible_template) { return CrucibleRecipes.indexMapping.get(slots[0].getItemDamage()); } - + return null; } - + /* "Arrays and Lists don't have a common ancestor" my fucking ass */ public int getQuantaFromType(MaterialStack[] stacks, NTMMaterial mat) { for(MaterialStack stack : stacks) { @@ -493,7 +505,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro } return 0; } - + public int getQuantaFromType(List stacks, NTMMaterial mat) { int sum = 0; for(MaterialStack stack : stacks) { @@ -522,12 +534,12 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUICrucible(player.inventory, this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -538,10 +550,10 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -550,30 +562,30 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro @Override public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { - + CrucibleRecipe recipe = getLoadedRecipe(); - + if(recipe == null) { return getQuantaFromType(this.wasteStack, null) < this.wasteZCapacity; } - + int recipeContent = recipe.getInputAmount(); int recipeInputRequired = getQuantaFromType(recipe.input, stack.material); int matMaximum = recipeInputRequired * this.recipeZCapacity / recipeContent; int amountStored = getQuantaFromType(recipeStack, stack.material); - + return amountStored < matMaximum && getQuantaFromType(this.recipeStack, null) < this.recipeZCapacity; } @Override public MaterialStack pour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { - + CrucibleRecipe recipe = getLoadedRecipe(); - + if(recipe == null) { - + int amount = getQuantaFromType(this.wasteStack, null); - + if(amount + stack.amount <= this.wasteZCapacity) { this.addToStack(this.wasteStack, stack.copy()); return null; @@ -583,16 +595,16 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro return new MaterialStack(stack.material, stack.amount - toAdd); } } - + int recipeContent = recipe.getInputAmount(); int recipeInputRequired = getQuantaFromType(recipe.input, stack.material); int matMaximum = recipeInputRequired * this.recipeZCapacity / recipeContent; - + if(recipeInputRequired + stack.amount <= matMaximum) { this.addToStack(this.recipeStack, stack.copy()); return null; } - + int toAdd = matMaximum - stack.amount; toAdd = Math.min(toAdd, this.recipeZCapacity - getQuantaFromType(this.recipeStack, null)); this.addToStack(this.recipeStack, new MaterialStack(stack.material, toAdd)); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java index 22aa98873..4ea41461d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java @@ -22,6 +22,7 @@ import com.hbm.module.ModulePatternMatcher; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachinePolluting; import com.hbm.tileentity.TileEntityProxyBase; +import com.hbm.util.BufferUtil; import com.hbm.util.Compat; import com.hbm.util.fauxpointtwelve.BlockPos; import com.hbm.util.fauxpointtwelve.DirPos; @@ -31,6 +32,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -220,23 +222,44 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen } else { this.progress = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", this.machineType); - data.setLong("power", power); - data.setBoolean("structureOK", structureOK); - data.setInteger("flux", flux); - data.setInteger("heat", heat); - data.setInteger("progress", progress); - data.setInteger("maxProgress", maxProgress); - for (int i = 0; i < inputTanks.length; i++) inputTanks[i].writeToNBT(data, "i" + i); - for (int i = 0; i < outputTanks.length; i++) outputTanks[i].writeToNBT(data, "o" + i); - this.matcher.writeToNBT(data); - this.networkPack(data, 50); + this.networkPackNT(50); } } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeLong(power); + buf.writeInt(progress); + buf.writeInt(flux); + buf.writeInt(heat); + buf.writeBoolean(structureOK); + buf.writeInt(maxProgress); + for (FluidTank inputTank : inputTanks) inputTank.serialize(buf); + for (FluidTank outputTank : outputTanks) outputTank.serialize(buf); + this.matcher.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.machineType = BufferUtil.readString(buf); + if(this.config == null) this.init(); + + this.power = buf.readLong(); + this.progress = buf.readInt(); + this.flux = buf.readInt(); + this.heat = buf.readInt(); + this.structureOK = buf.readBoolean(); + this.maxProgress = buf.readInt(); + for (FluidTank inputTank : inputTanks) inputTank.deserialize(buf); + for (FluidTank outputTank : outputTanks) outputTank.deserialize(buf); + this.matcher.deserialize(buf); + } + /** Only accepts inputs in a fixed order, saves a ton of performance because there's no permutations to check for */ public CustomMachineRecipe getMatchingRecipe() { List recipes = CustomMachineRecipes.recipes.get(this.config.recipeKey); @@ -458,25 +481,6 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen return matcher.isValidForFilter(slots[filterSlot], index, stack); } - @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.machineType = nbt.getString("type"); - if(this.config == null) this.init(); - - this.power = nbt.getLong("power"); - this.progress = nbt.getInteger("progress"); - this.flux = nbt.getInteger("flux"); - this.heat = nbt.getInteger("heat"); - this.structureOK = nbt.getBoolean("structureOK"); - this.maxProgress = nbt.getInteger("maxProgress"); - for(int i = 0; i < inputTanks.length; i++) inputTanks[i].readFromNBT(nbt, "i" + i); - for(int i = 0; i < outputTanks.length; i++) outputTanks[i].readFromNBT(nbt, "o" + i); - - this.matcher.readFromNBT(nbt); - } - @Override public void readFromNBT(NBTTagCompound nbt) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java index 9cf923a9b..50a277d3a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java @@ -7,6 +7,7 @@ import com.hbm.tileentity.TileEntityMachineBase; import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -45,13 +46,8 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen this.subscribeToAllAround(tanks[0].getTankType(), this); this.sendFluidToAll(tanks[1], this); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - tanks[0].writeToNBT(data, "water"); - tanks[1].writeToNBT(data, "heavyWater"); - this.networkPack(data, 50); + this.networkPackNT(50); } } @@ -61,12 +57,20 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.power = data.getLong("power"); - tanks[0].readFromNBT(data, "water"); - tanks[1].readFromNBT(data, "heavyWater"); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); } public boolean hasPower() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java index 68d3cbc0d..ea816adae 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnace.java @@ -10,7 +10,6 @@ import com.hbm.inventory.gui.GUIDiFurnace; import com.hbm.inventory.recipes.BlastFurnaceRecipes; import com.hbm.items.ModItems; import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityMachinePolluting; import com.hbm.util.CompatEnergyControl; @@ -18,6 +17,7 @@ import api.hbm.fluid.IFluidStandardSender; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -229,11 +229,7 @@ public class TileEntityDiFurnace extends TileEntityMachinePolluting implements I MachineDiFurnace.updateBlockState(this.progress > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } - NBTTagCompound data = new NBTTagCompound(); - data.setShort("time", (short) this.progress); - data.setShort("fuel", (short) this.fuel); - data.setByteArray("modes", new byte[] { (byte) sideFuel, (byte) sideUpper, (byte) sideLower }); - INBTPacketReceiver.networkPack(this, data, 15); + networkPackNT(15); if(markDirty) { this.markDirty(); @@ -242,10 +238,21 @@ public class TileEntityDiFurnace extends TileEntityMachinePolluting implements I } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.progress = nbt.getShort("time"); - this.fuel = nbt.getShort("fuel"); - byte[] modes = nbt.getByteArray("modes"); + public void serialize(ByteBuf buf) { + buf.writeShort(this.progress); + buf.writeShort(this.fuel); + buf.writeBytes(new byte[] { + this.sideFuel, + this.sideUpper, + this.sideLower}); + } + + @Override + public void deserialize(ByteBuf buf) { + this.progress = buf.readShort(); + this.fuel = buf.readShort(); + byte[] modes = new byte[3]; + buf.readBytes(modes); this.sideFuel = modes[0]; this.sideUpper = modes[1]; this.sideLower = modes[2]; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnaceRTG.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnaceRTG.java index b9d0bc3b4..8481f713a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnaceRTG.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDiFurnaceRTG.java @@ -13,6 +13,7 @@ import com.hbm.util.RTGUtil; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -71,24 +72,28 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGU MachineDiFurnaceRTG.updateBlockState(isProcessing() || (canProcess() && hasPower()), getWorldObj(), xCoord, yCoord, zCoord); - NBTTagCompound data = new NBTTagCompound(); - data.setShort("progress", progress); - data.setShort("speed", processSpeed); - data.setByteArray("modes", new byte[] {(byte) sideUpper, (byte) sideLower}); - networkPack(data, 10); + networkPackNT(10); } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - progress = nbt.getShort("progress"); - processSpeed = nbt.getShort("speed"); - byte[] modes = nbt.getByteArray("modes"); - this.sideUpper = modes[0]; - this.sideLower = modes[1]; + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeShort(progress); + buf.writeShort(processSpeed); + buf.writeBytes(new byte[] {sideUpper, sideLower}); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + progress = buf.readShort(); + processSpeed = buf.readShort(); + byte[] bytes = new byte[2]; + buf.readBytes(bytes); + this.sideUpper = bytes[0]; + this.sideLower = bytes[1]; + } + private void processItem() { if(canProcess()) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java index ef4ad3a02..2626569a2 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java @@ -1,591 +1,605 @@ -package com.hbm.tileentity.machine; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.BlockDummyable; -import com.hbm.blocks.ModBlocks; -import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; -import com.hbm.inventory.container.ContainerElectrolyserFluid; -import com.hbm.inventory.container.ContainerElectrolyserMetal; -import com.hbm.inventory.fluid.Fluids; -import com.hbm.inventory.fluid.tank.FluidTank; -import com.hbm.inventory.gui.GUIElectrolyserFluid; -import com.hbm.inventory.gui.GUIElectrolyserMetal; -import com.hbm.inventory.material.MaterialShapes; -import com.hbm.inventory.material.Mats; -import com.hbm.inventory.material.Mats.MaterialStack; -import com.hbm.inventory.recipes.ElectrolyserFluidRecipes; -import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe; -import com.hbm.inventory.recipes.ElectrolyserMetalRecipes; -import com.hbm.inventory.recipes.ElectrolyserMetalRecipes.ElectrolysisMetalRecipe; -import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; -import com.hbm.lib.Library; -import com.hbm.main.MainRegistry; -import com.hbm.packet.PacketDispatcher; -import com.hbm.tileentity.*; -import com.hbm.packet.toclient.AuxParticlePacketNT; -import com.hbm.util.BobMathUtil; -import com.hbm.util.CrucibleUtil; -import com.hbm.util.I18nUtil; -import com.hbm.util.fauxpointtwelve.DirPos; - -import api.hbm.energymk2.IEnergyReceiverMK2; -import api.hbm.fluid.IFluidStandardTransceiver; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable, IMetalCopiable { - - public long power; - public static final long maxPower = 20000000; - public static final int usageOreBase = 10_000; - public static final int usageFluidBase = 10_000; - public int usageOre; - public int usageFluid; - - public int progressFluid; - public int processFluidTime = 100; - public int progressOre; - public int processOreTime = 600; - - public MaterialStack leftStack; - public MaterialStack rightStack; - public int maxMaterial = MaterialShapes.BLOCK.q(16); - - public FluidTank[] tanks; - - public TileEntityElectrolyser() { - //0: Battery - //1-2: Upgrades - //// FLUID - //3-4: Fluid ID - //5-10: Fluid IO - //11-13: Byproducts - //// METAL - //14: Crystal - //15-20: Outputs - super(21); - tanks = new FluidTank[4]; - tanks[0] = new FluidTank(Fluids.WATER, 16000); - tanks[1] = new FluidTank(Fluids.HYDROGEN, 16000); - tanks[2] = new FluidTank(Fluids.OXYGEN, 16000); - tanks[3] = new FluidTank(Fluids.NITRIC_ACID, 16000); - } - - @Override - public int[] getAccessibleSlotsFromSide(int meta) { - return new int[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemStack) { - if(i == 14) return ElectrolyserMetalRecipes.getRecipe(itemStack) != null; - return false; - } - - @Override - public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return i != 14; - } - - @Override - public String getName() { - return "container.machineElectrolyser"; - } - - @Override - public void updateEntity() { - - if(!worldObj.isRemote) { - - this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); - this.tanks[0].setType(3, 4, slots); - this.tanks[0].loadTank(5, 6, slots); - this.tanks[1].unloadTank(7, 8, slots); - this.tanks[2].unloadTank(9, 10, slots); - - if(worldObj.getTotalWorldTime() % 20 == 0) { - for(DirPos pos : this.getConPos()) { - this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - this.trySubscribe(tanks[3].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - - if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - } - } - - UpgradeManager.eval(slots, 1, 2); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - - usageOre = usageOreBase - usageOreBase * powerLevel / 4 + usageOreBase * speedLevel; - usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4 + usageFluidBase * speedLevel; - - for(int i = 0; i < getCycleCount(); i++) { - if (this.canProcessFluid()) { - this.progressFluid++; - this.power -= this.usageFluid; - - if (this.progressFluid >= this.getDurationFluid()) { - this.processFluids(); - this.progressFluid = 0; - this.markChanged(); - } - } - - if (this.canProcessMetal()) { - this.progressOre++; - this.power -= this.usageOre; - - if (this.progressOre >= this.getDurationMetal()) { - this.processMetal(); - this.progressOre = 0; - this.markChanged(); - } - } - } - - if(this.leftStack != null) { - - ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); - List toCast = new ArrayList(); - toCast.add(this.leftStack); - - Vec3 impact = Vec3.createVectorHelper(0, 0, 0); - MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3) * Math.max (getCycleCount() * speedLevel, 1), impact); - - if(didPour != null) { - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "foundry"); - data.setInteger("color", didPour.material.moltenColor); - data.setByte("dir", (byte) dir.ordinal()); - data.setFloat("off", 0.625F); - data.setFloat("base", 0.625F); - data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2)); - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); - - if(this.leftStack.amount <= 0) this.leftStack = null; - } - } - - if(this.rightStack != null) { - - ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); - List toCast = new ArrayList(); - toCast.add(this.rightStack); - - Vec3 impact = Vec3.createVectorHelper(0, 0, 0); - MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3) * Math.max (getCycleCount() * speedLevel, 1), impact); - - if(didPour != null) { - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "foundry"); - data.setInteger("color", didPour.material.moltenColor); - data.setByte("dir", (byte) dir.ordinal()); - data.setFloat("off", 0.625F); - data.setFloat("base", 0.625F); - data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2)); - PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); - - if(this.rightStack.amount <= 0) this.rightStack = null; - } - } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - data.setInteger("progressFluid", this.progressFluid); - data.setInteger("progressOre", this.progressOre); - data.setInteger("usageOre", this.usageOre); - data.setInteger("usageFluid", this.usageFluid); - data.setInteger("processFluidTime", this.getDurationFluid()); - data.setInteger("processOreTime", this.getDurationMetal()); - if(this.leftStack != null) { - data.setInteger("leftType", leftStack.material.id); - data.setInteger("leftAmount", leftStack.amount); - } - if(this.rightStack != null) { - data.setInteger("rightType", rightStack.material.id); - data.setInteger("rightAmount", rightStack.amount); - } - for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "t" + i); - this.networkPack(data, 50); - } - } - - public DirPos[] getConPos() { - ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); - ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - - return new DirPos[] { - new DirPos(xCoord - dir.offsetX * 6, yCoord, zCoord - dir.offsetZ * 6, dir.getOpposite()), - new DirPos(xCoord - dir.offsetX * 6 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 6 + rot.offsetZ, dir.getOpposite()), - new DirPos(xCoord - dir.offsetX * 6 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 6 - rot.offsetZ, dir.getOpposite()), - new DirPos(xCoord + dir.offsetX * 6, yCoord, zCoord + dir.offsetZ * 6, dir), - new DirPos(xCoord + dir.offsetX * 6 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 6 + rot.offsetZ, dir), - new DirPos(xCoord + dir.offsetX * 6 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 6 - rot.offsetZ, dir) - }; - } - - @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.progressFluid = nbt.getInteger("progressFluid"); - this.progressOre = nbt.getInteger("progressOre"); - this.usageOre = nbt.getInteger("usageOre"); - this.usageFluid = nbt.getInteger("usageFluid"); - this.processFluidTime = nbt.getInteger("processFluidTime"); - this.processOreTime = nbt.getInteger("processOreTime"); - if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount")); - else this.leftStack = null; - if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount")); - else this.rightStack = null; - for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i); - } - - public boolean canProcessFluid() { - - if(this.power < usageFluid) return false; - - ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); - - if(recipe == null) return false; - if(recipe.amount > tanks[0].getFill()) return false; - if(recipe.output1.type == tanks[1].getTankType() && recipe.output1.fill + tanks[1].getFill() > tanks[1].getMaxFill()) return false; - if(recipe.output2.type == tanks[2].getTankType() && recipe.output2.fill + tanks[2].getFill() > tanks[2].getMaxFill()) return false; - - if(recipe.byproduct != null) { - - for(int i = 0; i < recipe.byproduct.length; i++) { - ItemStack slot = slots[11 + i]; - ItemStack byproduct = recipe.byproduct[i]; - - if(slot == null) continue; - if(!slot.isItemEqual(byproduct)) return false; - if(slot.stackSize + byproduct.stackSize > slot.getMaxStackSize()) return false; - } - } - - return true; - } - - public void processFluids() { - - ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); - tanks[0].setFill(tanks[0].getFill() - recipe.amount); - tanks[1].setTankType(recipe.output1.type); - tanks[2].setTankType(recipe.output2.type); - tanks[1].setFill(tanks[1].getFill() + recipe.output1.fill); - tanks[2].setFill(tanks[2].getFill() + recipe.output2.fill); - - if(recipe.byproduct != null) { - - for(int i = 0; i < recipe.byproduct.length; i++) { - ItemStack slot = slots[11 + i]; - ItemStack byproduct = recipe.byproduct[i]; - - if(slot == null) { - slots[11 + i] = byproduct.copy(); - } else { - slots[11 + i].stackSize += byproduct.stackSize; - } - } - } - } - - public boolean canProcessMetal() { - - if(slots[14] == null) return false; - if(this.power < usageOre) return false; - if(this.tanks[3].getFill() < 100) return false; - - ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]); - if(recipe == null) return false; - - if(leftStack != null && recipe.output1 != null) { - if(recipe.output1.material != leftStack.material) return false; - if(recipe.output1.amount + leftStack.amount > this.maxMaterial) return false; - } - - if(rightStack != null && recipe.output2 != null) { - if(recipe.output2.material != rightStack.material) return false; - if(recipe.output2.amount + rightStack.amount > this.maxMaterial) return false; - } - - if(recipe.byproduct != null) { - - for(int i = 0; i < recipe.byproduct.length; i++) { - ItemStack slot = slots[15 + i]; - ItemStack byproduct = recipe.byproduct[i]; - - if(slot == null) continue; - if(!slot.isItemEqual(byproduct)) return false; - if(slot.stackSize + byproduct.stackSize > slot.getMaxStackSize()) return false; - } - } - - return true; - } - - public void processMetal() { - - ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]); - if(recipe.output1 != null) - if(leftStack == null) { - leftStack = new MaterialStack(recipe.output1.material, recipe.output1.amount); - } else { - leftStack.amount += recipe.output1.amount; - } - - if(recipe.output2 != null) - if(rightStack == null ) { - rightStack = new MaterialStack(recipe.output2.material, recipe.output2.amount); - } else { - rightStack.amount += recipe.output2.amount; - } - - if(recipe.byproduct != null) { - - for(int i = 0; i < recipe.byproduct.length; i++) { - ItemStack slot = slots[15 + i]; - ItemStack byproduct = recipe.byproduct[i]; - - if(slot == null) { - slots[15 + i] = byproduct.copy(); - } else { - slots[15 + i].stackSize += byproduct.stackSize; - } - } - } - - this.tanks[3].setFill(this.tanks[3].getFill() - 100); - this.decrStackSize(14, 1); - } - - public int getDurationMetal() { - ElectrolysisMetalRecipe result = ElectrolyserMetalRecipes.getRecipe(slots[14]); - int base = result != null ? result.duration : 600; - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) - Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 1); - return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2))); - } - public int getDurationFluid() { - ElectrolysisRecipe result = ElectrolyserFluidRecipes.getRecipe(tanks[0].getTankType()); - int base = result != null ? result.duration : 100; - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) - Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 1); - return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2))); - - } - - public int getCycleCount() { - int speed = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - return Math.min(1 + speed * 2, 7); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - - this.power = nbt.getLong("power"); - this.progressFluid = nbt.getInteger("progressFluid"); - this.progressOre = nbt.getInteger("progressOre"); - this.processFluidTime = nbt.getInteger("processFluidTime"); - this.processOreTime = nbt.getInteger("processOreTime"); - if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount")); - else this.leftStack = null; - if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount")); - else this.rightStack = null; - for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - - nbt.setLong("power", this.power); - nbt.setInteger("progressFluid", this.progressFluid); - nbt.setInteger("progressOre", this.progressOre); - nbt.setInteger("processFluidTime", getDurationFluid()); - nbt.setInteger("processOreTime", getDurationMetal()); - if(this.leftStack != null) { - nbt.setInteger("leftType", leftStack.material.id); - nbt.setInteger("leftAmount", leftStack.amount); - } - if(this.rightStack != null) { - nbt.setInteger("rightType", rightStack.material.id); - nbt.setInteger("rightAmount", rightStack.amount); - } - for(int i = 0; i < 4; i++) tanks[i].writeToNBT(nbt, "t" + i); - - } - - AxisAlignedBB bb = null; - - @Override - public AxisAlignedBB getRenderBoundingBox() { - - if(bb == null) { - bb = AxisAlignedBB.getBoundingBox( - xCoord - 5, - yCoord - 0, - zCoord - 5, - xCoord + 6, - yCoord + 4, - zCoord + 6 - ); - } - - return bb; - } - - @Override - @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() { - return 65536.0D; - } - - @Override - public long getPower() { - return this.power; - } - - @Override - public long getMaxPower() { - return maxPower; - } - - @Override - public void setPower(long power) { - this.power = power; - } - - @Override - public FluidTank[] getAllTanks() { - return tanks; - } - - @Override - public FluidTank[] getSendingTanks() { - return new FluidTank[] {tanks[1], tanks[2]}; - } - - @Override - public FluidTank[] getReceivingTanks() { - return new FluidTank[] {tanks[0], tanks[3]}; - } - - @Override - public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { - if(ID == 0) return new ContainerElectrolyserFluid(player.inventory, this); - return new ContainerElectrolyserMetal(player.inventory, this); - } - - @Override - @SideOnly(Side.CLIENT) - public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { - if(ID == 0) return new GUIElectrolyserFluid(player.inventory, this); - return new GUIElectrolyserMetal(player.inventory, this); - } - - @Override - public void receiveControl(NBTTagCompound data) { } - - @Override - public void receiveControl(EntityPlayer player, NBTTagCompound data) { - - if(data.hasKey("sgm")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 1, worldObj, xCoord, yCoord, zCoord); - if(data.hasKey("sgf")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, worldObj, xCoord, yCoord, zCoord); - } - - @Override - public boolean hasPermission(EntityPlayer player) { - return this.isUseableByPlayer(player); - } - - @Override - public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) { - return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE; - } - - @Override - public void provideInfo(UpgradeType type, int level, List info, boolean extendedInfo) { - info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_electrolyser)); - if(type == UpgradeType.SPEED) { - info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_DELAY, "-" + (level * 25) + "%")); - info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "+" + (level * 100) + "%")); - } - if(type == UpgradeType.POWER) { - info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "-" + (level * 25) + "%")); - info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(this.KEY_DELAY, "+" + (25) + "%")); - } - if(type == UpgradeType.OVERDRIVE) { - info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES"); - } - } - - @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 3; - return 0; - } - - @Override - public FluidTank getTankToPaste() { - return tanks[0]; - } - - @Override - public NBTTagCompound getSettings(World world, int x, int y, int z) { - NBTTagCompound tag = new NBTTagCompound(); - if(getFluidIDToCopy().length > 0) - tag.setIntArray("fluidID", getFluidIDToCopy()); - if(getMatsToCopy().length > 0) - tag.setIntArray("matFilter", getMatsToCopy()); - return tag; - } - - @Override - public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) { - IFluidCopiable.super.pasteSettings(nbt, index, world, player, x, y, z); - } - - @Override - public String[] infoForDisplay(World world, int x, int y, int z) { - ArrayList names = new ArrayList<>(); - int[] fluidIDs = getFluidIDToCopy(); - int[] matIDs = getMatsToCopy(); - - for (int fluidID : fluidIDs) { - names.add(Fluids.fromID(fluidID).getUnlocalizedName()); - } - for (int matID : matIDs) { - names.add(Mats.matById.get(matID).getUnlocalizedName()); - } - - return names.toArray(new String[0]); - } - - @Override - public int[] getMatsToCopy() { - ArrayList types = new ArrayList<>(); - if(leftStack != null) types.add(leftStack.material.id); - if(rightStack != null) types.add(rightStack.material.id); - return BobMathUtil.intCollectionToArray(types); - } -} +package com.hbm.tileentity.machine; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ModBlocks; +import com.hbm.interfaces.IControlReceiver; +import com.hbm.inventory.UpgradeManagerNT; +import com.hbm.inventory.container.ContainerElectrolyserFluid; +import com.hbm.inventory.container.ContainerElectrolyserMetal; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.fluid.tank.FluidTank; +import com.hbm.inventory.gui.GUIElectrolyserFluid; +import com.hbm.inventory.gui.GUIElectrolyserMetal; +import com.hbm.inventory.material.MaterialShapes; +import com.hbm.inventory.material.Mats; +import com.hbm.inventory.material.Mats.MaterialStack; +import com.hbm.inventory.recipes.ElectrolyserFluidRecipes; +import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe; +import com.hbm.inventory.recipes.ElectrolyserMetalRecipes; +import com.hbm.inventory.recipes.ElectrolyserMetalRecipes.ElectrolysisMetalRecipe; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; +import com.hbm.lib.Library; +import com.hbm.main.MainRegistry; +import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.*; +import com.hbm.packet.toclient.AuxParticlePacketNT; +import com.hbm.util.BobMathUtil; +import com.hbm.util.CrucibleUtil; +import com.hbm.util.I18nUtil; +import com.hbm.util.fauxpointtwelve.DirPos; + +import api.hbm.energymk2.IEnergyReceiverMK2; +import api.hbm.fluid.IFluidStandardTransceiver; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable, IMetalCopiable { + + public long power; + public static final long maxPower = 20000000; + public static final int usageOreBase = 10_000; + public static final int usageFluidBase = 10_000; + public int usageOre; + public int usageFluid; + + public int progressFluid; + public int processFluidTime = 100; + public int progressOre; + public int processOreTime = 600; + + public MaterialStack leftStack; + public MaterialStack rightStack; + public int maxMaterial = MaterialShapes.BLOCK.q(16); + + public FluidTank[] tanks; + + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + + public TileEntityElectrolyser() { + //0: Battery + //1-2: Upgrades + //// FLUID + //3-4: Fluid ID + //5-10: Fluid IO + //11-13: Byproducts + //// METAL + //14: Crystal + //15-20: Outputs + super(21); + tanks = new FluidTank[4]; + tanks[0] = new FluidTank(Fluids.WATER, 16000); + tanks[1] = new FluidTank(Fluids.HYDROGEN, 16000); + tanks[2] = new FluidTank(Fluids.OXYGEN, 16000); + tanks[3] = new FluidTank(Fluids.NITRIC_ACID, 16000); + } + + @Override + public int[] getAccessibleSlotsFromSide(int meta) { + return new int[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + if(i == 14) return ElectrolyserMetalRecipes.getRecipe(itemStack) != null; + return false; + } + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return i != 14; + } + + @Override + public String getName() { + return "container.machineElectrolyser"; + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); + this.tanks[0].setType(3, 4, slots); + this.tanks[0].loadTank(5, 6, slots); + this.tanks[1].unloadTank(7, 8, slots); + this.tanks[2].unloadTank(9, 10, slots); + + if(worldObj.getTotalWorldTime() % 20 == 0) { + for(DirPos pos : this.getConPos()) { + this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + this.trySubscribe(tanks[3].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + + if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + } + } + + upgradeManager.checkSlots(this, slots, 1, 2); + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + + usageOre = usageOreBase - usageOreBase * powerLevel / 4 + usageOreBase * speedLevel; + usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4 + usageFluidBase * speedLevel; + + for(int i = 0; i < getCycleCount(); i++) { + if (this.canProcessFluid()) { + this.progressFluid++; + this.power -= this.usageFluid; + + if (this.progressFluid >= this.getDurationFluid()) { + this.processFluids(); + this.progressFluid = 0; + this.markChanged(); + } + } + + if (this.canProcessMetal()) { + this.progressOre++; + this.power -= this.usageOre; + + if (this.progressOre >= this.getDurationMetal()) { + this.processMetal(); + this.progressOre = 0; + this.markChanged(); + } + } + } + + if(this.leftStack != null) { + + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); + List toCast = new ArrayList(); + toCast.add(this.leftStack); + + Vec3 impact = Vec3.createVectorHelper(0, 0, 0); + MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3) * Math.max (getCycleCount() * speedLevel, 1), impact); + + if(didPour != null) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "foundry"); + data.setInteger("color", didPour.material.moltenColor); + data.setByte("dir", (byte) dir.ordinal()); + data.setFloat("off", 0.625F); + data.setFloat("base", 0.625F); + data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2)); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); + + if(this.leftStack.amount <= 0) this.leftStack = null; + } + } + + if(this.rightStack != null) { + + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + List toCast = new ArrayList(); + toCast.add(this.rightStack); + + Vec3 impact = Vec3.createVectorHelper(0, 0, 0); + MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3) * Math.max (getCycleCount() * speedLevel, 1), impact); + + if(didPour != null) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "foundry"); + data.setInteger("color", didPour.material.moltenColor); + data.setByte("dir", (byte) dir.ordinal()); + data.setFloat("off", 0.625F); + data.setFloat("base", 0.625F); + data.setFloat("len", Math.max(1F, yCoord - (float) (Math.ceil(impact.yCoord) - 0.875) + 2)); + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2, zCoord + 0.5D + dir.offsetZ * 5.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); + + if(this.rightStack.amount <= 0) this.rightStack = null; + } + } + + this.networkPackNT(50); + } + } + + public DirPos[] getConPos() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + return new DirPos[] { + new DirPos(xCoord - dir.offsetX * 6, yCoord, zCoord - dir.offsetZ * 6, dir.getOpposite()), + new DirPos(xCoord - dir.offsetX * 6 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 6 + rot.offsetZ, dir.getOpposite()), + new DirPos(xCoord - dir.offsetX * 6 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 6 - rot.offsetZ, dir.getOpposite()), + new DirPos(xCoord + dir.offsetX * 6, yCoord, zCoord + dir.offsetZ * 6, dir), + new DirPos(xCoord + dir.offsetX * 6 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 6 + rot.offsetZ, dir), + new DirPos(xCoord + dir.offsetX * 6 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 6 - rot.offsetZ, dir) + }; + } + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeInt(this.progressFluid); + buf.writeInt(this.progressOre); + buf.writeInt(this.usageOre); + buf.writeInt(this.usageFluid); + buf.writeInt(this.getDurationFluid()); + buf.writeInt(this.getDurationMetal()); + for(int i = 0; i < 4; i++) tanks[i].serialize(buf); + buf.writeBoolean(this.leftStack != null); + buf.writeBoolean(this.rightStack != null); + if(this.leftStack != null) { + buf.writeInt(leftStack.material.id); + buf.writeInt(leftStack.amount); + } + if(this.rightStack != null) { + buf.writeInt(rightStack.material.id); + buf.writeInt(rightStack.amount); + } + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.progressFluid = buf.readInt(); + this.progressOre = buf.readInt(); + this.usageOre = buf.readInt(); + this.usageFluid = buf.readInt(); + this.processFluidTime = buf.readInt(); + this.processOreTime = buf.readInt(); + for(int i = 0; i < 4; i++) tanks[i].deserialize(buf); + boolean left = buf.readBoolean(); + boolean right = buf.readBoolean(); + if(left) { + this.leftStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()); + } + if(right) { + this.rightStack = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()); + } + } + + public boolean canProcessFluid() { + + if(this.power < usageFluid) return false; + + ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); + + if(recipe == null) return false; + if(recipe.amount > tanks[0].getFill()) return false; + if(recipe.output1.type == tanks[1].getTankType() && recipe.output1.fill + tanks[1].getFill() > tanks[1].getMaxFill()) return false; + if(recipe.output2.type == tanks[2].getTankType() && recipe.output2.fill + tanks[2].getFill() > tanks[2].getMaxFill()) return false; + + if(recipe.byproduct != null) { + + for(int i = 0; i < recipe.byproduct.length; i++) { + ItemStack slot = slots[11 + i]; + ItemStack byproduct = recipe.byproduct[i]; + + if(slot == null) continue; + if(!slot.isItemEqual(byproduct)) return false; + if(slot.stackSize + byproduct.stackSize > slot.getMaxStackSize()) return false; + } + } + + return true; + } + + public void processFluids() { + + ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); + tanks[0].setFill(tanks[0].getFill() - recipe.amount); + tanks[1].setTankType(recipe.output1.type); + tanks[2].setTankType(recipe.output2.type); + tanks[1].setFill(tanks[1].getFill() + recipe.output1.fill); + tanks[2].setFill(tanks[2].getFill() + recipe.output2.fill); + + if(recipe.byproduct != null) { + + for(int i = 0; i < recipe.byproduct.length; i++) { + ItemStack slot = slots[11 + i]; + ItemStack byproduct = recipe.byproduct[i]; + + if(slot == null) { + slots[11 + i] = byproduct.copy(); + } else { + slots[11 + i].stackSize += byproduct.stackSize; + } + } + } + } + + public boolean canProcessMetal() { + + if(slots[14] == null) return false; + if(this.power < usageOre) return false; + if(this.tanks[3].getFill() < 100) return false; + + ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]); + if(recipe == null) return false; + + if(leftStack != null && recipe.output1 != null) { + if(recipe.output1.material != leftStack.material) return false; + if(recipe.output1.amount + leftStack.amount > this.maxMaterial) return false; + } + + if(rightStack != null && recipe.output2 != null) { + if(recipe.output2.material != rightStack.material) return false; + if(recipe.output2.amount + rightStack.amount > this.maxMaterial) return false; + } + + if(recipe.byproduct != null) { + + for(int i = 0; i < recipe.byproduct.length; i++) { + ItemStack slot = slots[15 + i]; + ItemStack byproduct = recipe.byproduct[i]; + + if(slot == null) continue; + if(!slot.isItemEqual(byproduct)) return false; + if(slot.stackSize + byproduct.stackSize > slot.getMaxStackSize()) return false; + } + } + + return true; + } + + public void processMetal() { + + ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]); + if(recipe.output1 != null) + if(leftStack == null) { + leftStack = new MaterialStack(recipe.output1.material, recipe.output1.amount); + } else { + leftStack.amount += recipe.output1.amount; + } + + if(recipe.output2 != null) + if(rightStack == null ) { + rightStack = new MaterialStack(recipe.output2.material, recipe.output2.amount); + } else { + rightStack.amount += recipe.output2.amount; + } + + if(recipe.byproduct != null) { + + for(int i = 0; i < recipe.byproduct.length; i++) { + ItemStack slot = slots[15 + i]; + ItemStack byproduct = recipe.byproduct[i]; + + if(slot == null) { + slots[15 + i] = byproduct.copy(); + } else { + slots[15 + i].stackSize += byproduct.stackSize; + } + } + } + + this.tanks[3].setFill(this.tanks[3].getFill() - 100); + this.decrStackSize(14, 1); + } + + public int getDurationMetal() { + ElectrolysisMetalRecipe result = ElectrolyserMetalRecipes.getRecipe(slots[14]); + int base = result != null ? result.duration : 600; + int speed = upgradeManager.getLevel(UpgradeType.SPEED) - Math.min(upgradeManager.getLevel(UpgradeType.POWER), 1); + return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2))); + } + public int getDurationFluid() { + ElectrolysisRecipe result = ElectrolyserFluidRecipes.getRecipe(tanks[0].getTankType()); + int base = result != null ? result.duration : 100; + int speed = upgradeManager.getLevel(UpgradeType.SPEED) - Math.min(upgradeManager.getLevel(UpgradeType.POWER), 1); + return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2))); + + } + + public int getCycleCount() { + int speed = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + return Math.min(1 + speed * 2, 7); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + this.power = nbt.getLong("power"); + this.progressFluid = nbt.getInteger("progressFluid"); + this.progressOre = nbt.getInteger("progressOre"); + this.processFluidTime = nbt.getInteger("processFluidTime"); + this.processOreTime = nbt.getInteger("processOreTime"); + if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount")); + else this.leftStack = null; + if(nbt.hasKey("rightType")) this.rightStack = new MaterialStack(Mats.matById.get(nbt.getInteger("rightType")), nbt.getInteger("rightAmount")); + else this.rightStack = null; + for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setLong("power", this.power); + nbt.setInteger("progressFluid", this.progressFluid); + nbt.setInteger("progressOre", this.progressOre); + nbt.setInteger("processFluidTime", getDurationFluid()); + nbt.setInteger("processOreTime", getDurationMetal()); + if(this.leftStack != null) { + nbt.setInteger("leftType", leftStack.material.id); + nbt.setInteger("leftAmount", leftStack.amount); + } + if(this.rightStack != null) { + nbt.setInteger("rightType", rightStack.material.id); + nbt.setInteger("rightAmount", rightStack.amount); + } + for(int i = 0; i < 4; i++) tanks[i].writeToNBT(nbt, "t" + i); + + } + + AxisAlignedBB bb = null; + + @Override + public AxisAlignedBB getRenderBoundingBox() { + + if(bb == null) { + bb = AxisAlignedBB.getBoundingBox( + xCoord - 5, + yCoord - 0, + zCoord - 5, + xCoord + 6, + yCoord + 4, + zCoord + 6 + ); + } + + return bb; + } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() { + return 65536.0D; + } + + @Override + public long getPower() { + return this.power; + } + + @Override + public long getMaxPower() { + return maxPower; + } + + @Override + public void setPower(long power) { + this.power = power; + } + + @Override + public FluidTank[] getAllTanks() { + return tanks; + } + + @Override + public FluidTank[] getSendingTanks() { + return new FluidTank[] {tanks[1], tanks[2]}; + } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] {tanks[0], tanks[3]}; + } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + if(ID == 0) return new ContainerElectrolyserFluid(player.inventory, this); + return new ContainerElectrolyserMetal(player.inventory, this); + } + + @Override + @SideOnly(Side.CLIENT) + public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + if(ID == 0) return new GUIElectrolyserFluid(player.inventory, this); + return new GUIElectrolyserMetal(player.inventory, this); + } + + @Override + public void receiveControl(NBTTagCompound data) { } + + @Override + public void receiveControl(EntityPlayer player, NBTTagCompound data) { + + if(data.hasKey("sgm")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 1, worldObj, xCoord, yCoord, zCoord); + if(data.hasKey("sgf")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, worldObj, xCoord, yCoord, zCoord); + } + + @Override + public boolean hasPermission(EntityPlayer player) { + return this.isUseableByPlayer(player); + } + + @Override + public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) { + return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE; + } + + @Override + public void provideInfo(UpgradeType type, int level, List info, boolean extendedInfo) { + info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_electrolyser)); + if(type == UpgradeType.SPEED) { + info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_DELAY, "-" + (level * 25) + "%")); + info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "+" + (level * 100) + "%")); + } + if(type == UpgradeType.POWER) { + info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "-" + (level * 25) + "%")); + info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(this.KEY_DELAY, "+" + (25) + "%")); + } + if(type == UpgradeType.OVERDRIVE) { + info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES"); + } + } + + @Override + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; + } + + @Override + public FluidTank getTankToPaste() { + return tanks[0]; + } + + @Override + public NBTTagCompound getSettings(World world, int x, int y, int z) { + NBTTagCompound tag = new NBTTagCompound(); + if(getFluidIDToCopy().length > 0) + tag.setIntArray("fluidID", getFluidIDToCopy()); + if(getMatsToCopy().length > 0) + tag.setIntArray("matFilter", getMatsToCopy()); + return tag; + } + + @Override + public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) { + IFluidCopiable.super.pasteSettings(nbt, index, world, player, x, y, z); + } + + @Override + public String[] infoForDisplay(World world, int x, int y, int z) { + ArrayList names = new ArrayList<>(); + int[] fluidIDs = getFluidIDToCopy(); + int[] matIDs = getMatsToCopy(); + + for (int fluidID : fluidIDs) { + names.add(Fluids.fromID(fluidID).getUnlocalizedName()); + } + for (int matID : matIDs) { + names.add(Mats.matById.get(matID).getUnlocalizedName()); + } + + return names.toArray(new String[0]); + } + + @Override + public int[] getMatsToCopy() { + ArrayList types = new ArrayList<>(); + if(leftStack != null) types.add(leftStack.material.id); + if(rightStack != null) types.add(rightStack.material.id); + return BobMathUtil.intCollectionToArray(types); + } +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityFoundryBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityFoundryBase.java index c90d9ec0b..5c5b8969c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityFoundryBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityFoundryBase.java @@ -6,12 +6,12 @@ import com.hbm.inventory.material.NTMMaterial; import com.hbm.inventory.material.Mats.MaterialStack; import api.hbm.block.ICrucibleAcceptor; +import com.hbm.tileentity.TileEntityLoadedBase; import net.minecraft.entity.player.EntityPlayer; 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.World; import net.minecraftforge.common.util.ForgeDirection; @@ -21,25 +21,25 @@ import net.minecraftforge.common.util.ForgeDirection; * @author hbm * */ -public abstract class TileEntityFoundryBase extends TileEntity implements ICrucibleAcceptor, ICopiable { - +public abstract class TileEntityFoundryBase extends TileEntityLoadedBase implements ICrucibleAcceptor, ICopiable { + public NTMMaterial type; protected NTMMaterial lastType; public int amount; protected int lastAmount; - + @Override public void updateEntity() { - + if(worldObj.isRemote) { - + if(shouldClientReRender() && this.lastType != this.type || this.lastAmount != this.amount) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); this.lastType = this.type; this.lastAmount = this.amount; } } else { - + if(this.lastType != this.type || this.lastAmount != this.amount) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); this.lastType = this.type; @@ -47,7 +47,7 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci } } } - + /** Recommended FALSE for things that update a whole lot. TRUE if updates only happen once every few ticks. */ protected boolean shouldClientReRender() { return true; @@ -59,7 +59,7 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); @@ -75,18 +75,18 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + if(this.type == null) { nbt.setInteger("type", -1); } else { nbt.setInteger("type", this.type.id); } - + nbt.setInteger("amount", this.amount); } - + public abstract int getCapacity(); - + /** * Standard check for testing if this material stack can be added to the casting block. Checks:
* - type matching
@@ -97,7 +97,7 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci if(this.amount >= this.getCapacity()) return false; //reject if the buffer is already full return true; } - + /** * Standardized adding of material via pouring or flowing. Does:
* - sets material to match the input @@ -106,17 +106,17 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci */ public MaterialStack standardAdd(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { this.type = stack.material; - + if(stack.amount + this.amount <= this.getCapacity()) { this.amount += stack.amount; return null; } - + int required = this.getCapacity() - this.amount; this.amount = this.getCapacity(); - + stack.amount -= required; - + return stack; } @@ -125,7 +125,7 @@ public abstract class TileEntityFoundryBase extends TileEntity implements ICruci public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { return this.standardCheck(world, x, y, z, side, stack); } - + /** Standard flow, no special handling required */ @Override public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceIron.java b/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceIron.java index cf9168efd..76cb76189 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceIron.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceIron.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerFurnaceIron; import com.hbm.inventory.gui.GUIFurnaceIron; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; @@ -17,6 +18,7 @@ import com.hbm.util.I18nUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -28,7 +30,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUIProvider, IUpgradeInfoProvider { - + public int maxBurnTime; public int burnTime; public boolean wasOn = false; @@ -36,12 +38,14 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI public int progress; public int processingTime; public static final int baseTime = 160; - + public ModuleBurnTime burnModule; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityFurnaceIron() { super(5); - + burnModule = new ModuleBurnTime() .setLigniteTimeMod(1.25) .setCoalTimeMod(1.25) @@ -58,21 +62,21 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI @Override public void updateEntity() { - + if(!worldObj.isRemote) { - - UpgradeManager.eval(slots, 4, 4); - this.processingTime = baseTime - ((baseTime / 2) * Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) / 3); - + + upgradeManager.checkSlots(this, slots, 4, 4); + this.processingTime = baseTime - ((baseTime / 2) * upgradeManager.getLevel(UpgradeType.SPEED) / 3); + wasOn = false; - + if(burnTime <= 0) { - + for(int i = 1; i < 3; i++) { if(slots[i] != null) { - + int fuel = burnModule.getBurnTime(slots[i]); - + if(fuel > 0) { this.maxBurnTime = this.burnTime = fuel; slots[i].stackSize--; @@ -80,33 +84,33 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI if(slots[i].stackSize == 0) { slots[i] = slots[i].getItem().getContainerItem(slots[i]); } - + break; } } - } + } } - + if(canSmelt()) { wasOn = true; this.progress++; this.burnTime--; - + if(this.progress % 15 == 0 && !this.muffled) { worldObj.playSoundEffect(xCoord, yCoord, zCoord, "fire.fire", 1.0F, 0.5F + worldObj.rand.nextFloat() * 0.5F); } - + if(this.progress >= this.processingTime) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(slots[0]); - + if(slots[3] == null) { slots[3] = result.copy(); } else { slots[3].stackSize += result.stackSize; } - + this.decrStackSize(0, 1); - + this.progress = 0; this.markDirty(); } @@ -114,23 +118,17 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI } else { this.progress = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("maxBurnTime", this.maxBurnTime); - data.setInteger("burnTime", this.burnTime); - data.setInteger("progress", this.progress); - data.setInteger("processingTime", this.processingTime); - data.setBoolean("wasOn", this.wasOn); - this.networkPack(data, 50); + + this.networkPackNT(50); } else { - + if(this.progress > 0) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + double offset = this.progress % 2 == 0 ? 1 : 0.5; worldObj.spawnParticle("smoke", xCoord + 0.5 - dir.offsetX * offset - rot.offsetX * 0.1875, yCoord + 2, zCoord + 0.5 - dir.offsetZ * offset - rot.offsetZ * 0.1875, 0.0, 0.01, 0.0); - + if(this.progress % 5 == 0) { double rand = worldObj.rand.nextDouble(); worldObj.spawnParticle("flame", xCoord + 0.5 + dir.offsetX * 0.25 + rot.offsetX * rand, yCoord + 0.25 + worldObj.rand.nextDouble() * 0.25, zCoord + 0.5 + dir.offsetZ * 0.25 + rot.offsetZ * rand, 0.0, 0.0, 0.0); @@ -140,32 +138,41 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.maxBurnTime = nbt.getInteger("maxBurnTime"); - this.burnTime = nbt.getInteger("burnTime"); - this.progress = nbt.getInteger("progress"); - this.processingTime = nbt.getInteger("processingTime"); - this.wasOn = nbt.getBoolean("wasOn"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.maxBurnTime); + buf.writeInt(this.burnTime); + buf.writeInt(this.progress); + buf.writeInt(this.processingTime); + buf.writeBoolean(this.wasOn); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.maxBurnTime = buf.readInt(); + this.burnTime = buf.readInt(); + this.progress = buf.readInt(); + this.processingTime = buf.readInt(); + this.wasOn = buf.readBoolean(); + } + public boolean canSmelt() { - + if(this.burnTime <= 0) return false; if(slots[0] == null) return false; - + ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(slots[0]); - + if(result == null) return false; if(slots[3] == null) return true; - + if(!result.isItemEqual(slots[3])) return false; if(result.stackSize + slots[3].stackSize > slots[3].getMaxStackSize()) return false; - + return true; } - + @Override public int[] getAccessibleSlotsFromSide(int meta) { return new int[] { 0, 1, 2, 3 }; @@ -173,13 +180,13 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - + if(i == 0) return FurnaceRecipes.smelting().getSmeltingResult(itemStack) != null; - + if(i < 3) return burnModule.getBurnTime(itemStack) > 0; - + return false; } @@ -187,7 +194,7 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI public boolean canExtractItem(int i, ItemStack itemStack, int j) { return i == 3; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -196,7 +203,7 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI this.burnTime = nbt.getInteger("burnTime"); this.progress = nbt.getInteger("progress"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -216,12 +223,12 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIFurnaceIron(player.inventory, this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -232,10 +239,10 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -256,8 +263,9 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceSteel.java b/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceSteel.java index 3de52135f..73a470859 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceSteel.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityFurnaceSteel.java @@ -8,11 +8,13 @@ import com.hbm.inventory.container.ContainerFurnaceSteel; import com.hbm.inventory.gui.GUIFurnaceSteel; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.ItemStackUtil; import api.hbm.tile.IHeatSource; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -95,13 +97,9 @@ public class TileEntityFurnaceSteel extends TileEntityMachineBase implements IGU } } - - NBTTagCompound data = new NBTTagCompound(); - data.setIntArray("progress", progress); - data.setIntArray("bonus", bonus); - data.setInteger("heat", heat); - data.setBoolean("wasOn", wasOn); - this.networkPack(data, 50); + + this.networkPackNT(50); + } else { if(this.wasOn) { @@ -121,13 +119,21 @@ public class TileEntityFurnaceSteel extends TileEntityMachineBase implements IGU } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.progress = nbt.getIntArray("progress"); - this.bonus = nbt.getIntArray("bonus"); - this.heat = nbt.getInteger("heat"); - this.wasOn = nbt.getBoolean("wasOn"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + BufferUtil.writeIntArray(buf, this.progress); + BufferUtil.writeIntArray(buf, this.bonus); + buf.writeInt(this.heat); + buf.writeBoolean(this.wasOn); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.progress = BufferUtil.readIntArray(buf); + this.bonus = BufferUtil.readIntArray(buf); + this.heat = buf.readInt(); + this.wasOn = buf.readBoolean(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java index 8ff655068..c2c737fda 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java @@ -25,6 +25,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -169,7 +170,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe data.setInteger("stat_x", stat_x); data.setInteger("stat_y", stat_y); data.setInteger("stat_z", stat_z); - this.networkPack(data, 50); + this.networkPackNT(50); } } @@ -212,21 +213,37 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe } @Override - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.isOn = data.getBoolean("isOn"); - this.power = data.getLong("power"); - this.analysisOnly = data.getBoolean("analysis"); - this.ioMode = data.getInteger("ioMode"); - this.state = EnumHadronState.values()[data.getByte("state")]; + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeBoolean(this.isOn); + buf.writeLong(this.power); + buf.writeBoolean(this.analysisOnly); + buf.writeInt(this.ioMode); + buf.writeByte((byte) this.state.ordinal()); - this.stat_success = data.getBoolean("stat_success"); - this.stat_state = EnumHadronState.values()[data.getByte("stat_state")]; - this.stat_charge = data.getInteger("stat_charge"); - this.stat_x = data.getInteger("stat_x"); - this.stat_y = data.getInteger("stat_y"); - this.stat_z = data.getInteger("stat_z"); + buf.writeBoolean(this.stat_success); + buf.writeByte((byte) this.stat_state.ordinal()); + buf.writeInt(this.stat_charge); + buf.writeInt(this.stat_x); + buf.writeInt(this.stat_y); + buf.writeInt(this.stat_z); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.isOn = buf.readBoolean(); + this.power = buf.readLong(); + this.analysisOnly = buf.readBoolean(); + this.ioMode = buf.readInt(); + this.state = EnumHadronState.values()[buf.readByte()]; + + this.stat_success = buf.readBoolean(); + this.stat_state = EnumHadronState.values()[buf.readByte()]; + this.stat_charge = buf.readInt(); + this.stat_x = buf.readInt(); + this.stat_y = buf.readInt(); + this.stat_z = buf.readInt(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHadronDiode.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHadronDiode.java index d77c5339a..f9c89de10 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHadronDiode.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHadronDiode.java @@ -2,6 +2,7 @@ package com.hbm.tileentity.machine; import com.hbm.tileentity.TileEntityTickingBase; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -25,7 +26,7 @@ public class TileEntityHadronDiode extends TileEntityTickingBase { if(age >= 20) { age = 0; - sendSides(); + this.networkPackNT(250); } } else { @@ -35,27 +36,18 @@ public class TileEntityHadronDiode extends TileEntityTickingBase { } } } - - public void sendSides() { - - NBTTagCompound data = new NBTTagCompound(); - + + @Override public void serialize(ByteBuf buf) { for(int i = 0; i < 6; i++) { - - if(sides[i] != null) - data.setInteger("" + i, sides[i].ordinal()); + buf.writeByte(sides[i].ordinal()); } - - this.networkPack(data, 250); } - @Override - public void networkUnpack(NBTTagCompound nbt) { - + @Override public void deserialize(ByteBuf buf) { for(int i = 0; i < 6; i++) { - sides[i] = DiodeConfig.values()[nbt.getInteger("" + i)]; + sides[i] = DiodeConfig.values()[buf.readByte()]; } - + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -75,7 +67,7 @@ public class TileEntityHadronDiode extends TileEntityTickingBase { public void setConfig(int side, int config) { sides[side] = DiodeConfig.values()[config]; this.markDirty(); - sendSides(); + this.networkPackNT(250); } public static enum DiodeConfig { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHadronPower.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHadronPower.java index d4b0ff25f..3423d2583 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHadronPower.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHadronPower.java @@ -1,13 +1,10 @@ package com.hbm.tileentity.machine; import com.hbm.blocks.machine.BlockHadronPower; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.energymk2.IEnergyReceiverMK2; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; @@ -21,16 +18,16 @@ public class TileEntityHadronPower extends TileEntityLoadedBase implements IEner public boolean canUpdate() { return true; //yeah idk wtf happened with the old behavior and honestly i'm not keen on figuring that one out } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } - - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15)); + + networkPackNT(15); } } @@ -57,13 +54,13 @@ public class TileEntityHadronPower extends TileEntityLoadedBase implements IEner @Override public long getMaxPower() { - + Block b = this.getBlockType(); - + if(b instanceof BlockHadronPower) { return ((BlockHadronPower)b).power; } - + return 0; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java index 2d3746ed8..e6aef59a0 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoiler.java @@ -18,9 +18,9 @@ import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.saveddata.TomSaveData; import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IConfigurableMachine; import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.fauxpointtwelve.DirPos; @@ -28,22 +28,24 @@ import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IHeatSource; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.EnumSkyBlock; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine, IFluidCopiable { +public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine, IFluidCopiable { public int heat; public FluidTank[] tanks; public boolean isOn; public boolean hasExploded = false; - + private AudioWrapper audio; private int audioTime; - + /* CONFIGURABLE */ public static int maxHeat = 3_200_000; public static double diffusion = 0.1D; @@ -55,49 +57,54 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa this.tanks[0] = new FluidTank(Fluids.WATER, 16_000); this.tanks[1] = new FluidTank(Fluids.STEAM, 16_000 * 100); } - + + ByteBuf buf; + @Override public void updateEntity() { if(!worldObj.isRemote) { - - NBTTagCompound data = new NBTTagCompound(); - + + if(this.buf != null) + this.buf.release(); + this.buf = Unpooled.buffer(); + + buf.writeBoolean(this.hasExploded); + if(!this.hasExploded) { this.setupTanks(); this.updateConnections(); this.tryPullHeat(); int lastHeat = this.heat; - + int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord); if(light > 7 && TomSaveData.forWorld(worldObj).fire > 1e-5) { this.heat += ((maxHeat - heat) * 0.000005D); //constantly heat up 0.0005% of the remaining heat buffer for rampant but diminishing heating } - - data.setInteger("heat", lastHeat); - tanks[0].writeToNBT(data, "0"); + buf.writeInt(lastHeat); + + tanks[0].serialize(buf); this.isOn = false; this.tryConvert(); - tanks[1].writeToNBT(data, "1"); - + tanks[1].serialize(buf); + if(this.tanks[1].getFill() > 0) { this.sendFluid(); } } - data.setBoolean("exploded", this.hasExploded); - data.setBoolean("isOn", this.isOn); - data.setBoolean("muffled", this.muffled); - INBTPacketReceiver.networkPack(this, data, 25); + buf.writeBoolean(this.muffled); + buf.writeBoolean(this.isOn); + networkPackNT(25); } else { - + if(this.isOn) audioTime = 20; - + if(audioTime > 0) { - + audioTime--; - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -107,9 +114,9 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa audio.updateVolume(getVolume(1F)); audio.keepAlive(); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -117,7 +124,7 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa } } } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.boiler", xCoord, yCoord, zCoord, 0.125F, 10F, 1.0F, 20); @@ -144,26 +151,33 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.hasExploded = nbt.getBoolean("exploded"); - this.muffled = nbt.getBoolean("muffled"); - this.heat = nbt.getInteger("heat"); - this.tanks[0].readFromNBT(nbt, "0"); - this.tanks[1].readFromNBT(nbt, "1"); - this.isOn = nbt.getBoolean("isOn"); + public void serialize(ByteBuf buf) { + buf.writeBytes(this.buf); } - + + @Override + public void deserialize(ByteBuf buf) { + this.hasExploded = buf.readBoolean(); + if (!this.hasExploded) { + this.heat = buf.readInt(); + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); + this.muffled = buf.readBoolean(); + this.isOn = buf.readBoolean(); + } + } + protected void tryPullHeat() { TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(con instanceof IHeatSource) { IHeatSource source = (IHeatSource) con; int diff = source.getHeatStored() - this.heat; - + if(diff == 0) { return; } - + if(diff > 0) { diff = (int) Math.ceil(diff * diffusion); source.useUpHeat(diff); @@ -173,12 +187,12 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa return; } } - + this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0); } - + protected void setupTanks() { - + if(tanks[0].getTankType().hasTrait(FT_Heatable.class)) { FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); if(trait.getEfficiency(HeatingType.BOILER) > 0) { @@ -192,32 +206,32 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa tanks[0].setTankType(Fluids.NONE); tanks[1].setTankType(Fluids.NONE); } - + protected void tryConvert() { - + if(tanks[0].getTankType().hasTrait(FT_Heatable.class)) { FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); if(trait.getEfficiency(HeatingType.BOILER) > 0) { - + HeatingStep entry = trait.getFirstStep(); int inputOps = this.tanks[0].getFill() / entry.amountReq; int outputOps = (this.tanks[1].getMaxFill() - this.tanks[1].getFill()) / entry.amountProduced; int heatOps = this.heat / entry.heatReq; - + int ops = Math.min(inputOps, Math.min(outputOps, heatOps)); this.tanks[0].setFill(this.tanks[0].getFill() - entry.amountReq * ops); this.tanks[1].setFill(this.tanks[1].getFill() + entry.amountProduced * ops); this.heat -= entry.heatReq * ops; - + if(ops > 0 && worldObj.rand.nextInt(400) == 0) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 2, zCoord + 0.5, "hbm:block.boilerGroan", 0.5F, 1.0F); } - + if(ops > 0) { this.isOn = true; } - + if(outputOps == 0 && canExplode) { this.hasExploded = true; BlockDummyable.safeRem = true; @@ -229,33 +243,33 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa } } worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord); - + ExplosionVNT xnt = new ExplosionVNT(worldObj, xCoord + 0.5, yCoord + 2, zCoord + 0.5, 5F); xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F)); xnt.setPlayerProcessor(new PlayerProcessorStandard()); xnt.setSFX(new ExplosionEffectStandard()); xnt.explode(); - + BlockDummyable.safeRem = false; } } } } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private void sendFluid() { - + for(DirPos pos : getConPos()) { this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir().getOpposite()); } } - + private DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getRotation(ForgeDirection.UP); return new DirPos[] { @@ -264,7 +278,7 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa new DirPos(xCoord, yCoord + 4, zCoord, Library.POS_Y), }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -273,7 +287,7 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa heat = nbt.getInteger("heat"); hasExploded = nbt.getBoolean("exploded"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -297,12 +311,12 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0]}; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -313,10 +327,10 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements INBTPa zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java index caeff9522..21d273973 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeatBoilerIndustrial.java @@ -13,9 +13,9 @@ import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.saveddata.TomSaveData; import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IConfigurableMachine; import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.fauxpointtwelve.DirPos; @@ -23,20 +23,22 @@ import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IHeatSource; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.EnumSkyBlock; -public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine, IFluidCopiable { +public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine, IFluidCopiable { public int heat; public FluidTank[] tanks; public boolean isOn; - + private AudioWrapper audio; private int audioTime; - + /* CONFIGURABLE */ public static int maxHeat = 12_800_000; public static double diffusion = 0.1D; @@ -47,45 +49,51 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme this.tanks[0] = new FluidTank(Fluids.WATER, 64_000); this.tanks[1] = new FluidTank(Fluids.STEAM, 64_000 * 100); } - + + ByteBuf buf; + @Override public void updateEntity() { if(!worldObj.isRemote) { - - NBTTagCompound data = new NBTTagCompound(); + + if(this.buf != null) + this.buf.release(); + this.buf = Unpooled.buffer(); + this.setupTanks(); this.updateConnections(); this.tryPullHeat(); int lastHeat = this.heat; - + int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord); if(light > 7 && TomSaveData.forWorld(worldObj).fire > 1e-5) { this.heat += ((maxHeat - heat) * 0.000005D); //constantly heat up 0.0005% of the remaining heat buffer for rampant but diminishing heating } - - data.setInteger("heat", lastHeat); - tanks[0].writeToNBT(data, "0"); + buf.writeInt(lastHeat); + + tanks[0].serialize(buf); this.isOn = false; this.tryConvert(); - tanks[1].writeToNBT(data, "1"); - + tanks[1].serialize(buf); + if(this.tanks[1].getFill() > 0) { this.sendFluid(); } - data.setBoolean("isOn", this.isOn); - data.setBoolean("muffled", this.muffled); - INBTPacketReceiver.networkPack(this, data, 25); + buf.writeBoolean(this.isOn); + buf.writeBoolean(this.muffled); + networkPackNT(25); + } else { - + if(this.isOn) audioTime = 20; - + if(audioTime > 0) { - + audioTime--; - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -95,9 +103,9 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme audio.updateVolume(getVolume(1F)); audio.keepAlive(); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -105,7 +113,7 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme } } } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.boiler", xCoord, yCoord, zCoord, 0.125F, 10F, 1.0F, 20); @@ -132,25 +140,30 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.heat = nbt.getInteger("heat"); - this.tanks[0].readFromNBT(nbt, "0"); - this.tanks[1].readFromNBT(nbt, "1"); - this.isOn = nbt.getBoolean("isOn"); - this.muffled = nbt.getBoolean("muffled"); + public void serialize(ByteBuf buf) { + buf.writeBytes(this.buf); } - + + @Override + public void deserialize(ByteBuf buf) { + this.heat = buf.readInt(); + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); + this.isOn = buf.readBoolean(); + this.muffled = buf.readBoolean(); + } + protected void tryPullHeat() { TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(con instanceof IHeatSource) { IHeatSource source = (IHeatSource) con; int diff = source.getHeatStored() - this.heat; - + if(diff == 0) { return; } - + if(diff > 0) { diff = (int) Math.ceil(diff * diffusion); source.useUpHeat(diff); @@ -160,12 +173,12 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme return; } } - + this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0); } - + protected void setupTanks() { - + if(tanks[0].getTankType().hasTrait(FT_Heatable.class)) { FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); if(trait.getEfficiency(HeatingType.BOILER) > 0) { @@ -179,49 +192,49 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme tanks[0].setTankType(Fluids.NONE); tanks[1].setTankType(Fluids.NONE); } - + protected void tryConvert() { - + if(tanks[0].getTankType().hasTrait(FT_Heatable.class)) { FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); if(trait.getEfficiency(HeatingType.BOILER) > 0) { - + HeatingStep entry = trait.getFirstStep(); int inputOps = this.tanks[0].getFill() / entry.amountReq; int outputOps = (this.tanks[1].getMaxFill() - this.tanks[1].getFill()) / entry.amountProduced; int heatOps = this.heat / entry.heatReq; - + int ops = Math.min(inputOps, Math.min(outputOps, heatOps)); this.tanks[0].setFill(this.tanks[0].getFill() - entry.amountReq * ops); this.tanks[1].setFill(this.tanks[1].getFill() + entry.amountProduced * ops); this.heat -= entry.heatReq * ops; - + if(ops > 0 && worldObj.rand.nextInt(400) == 0) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 2, zCoord + 0.5, "hbm:block.boilerGroan", 0.5F, 1.0F); } - + if(ops > 0) { this.isOn = true; } } } } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private void sendFluid() { - + for(DirPos pos : getConPos()) { this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir().getOpposite()); } } - + private DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), @@ -231,7 +244,7 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme new DirPos(xCoord, yCoord + 5, zCoord, Library.POS_Y), }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -239,7 +252,7 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme tanks[1].readFromNBT(nbt, "steam"); heat = nbt.getInteger("heat"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -262,12 +275,12 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0]}; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -278,10 +291,10 @@ public class TileEntityHeatBoilerIndustrial extends TileEntityLoadedBase impleme zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java index 79a69a00a..1ad302c0b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterElectric.java @@ -4,7 +4,7 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.interfaces.ICopiable; import com.hbm.main.MainRegistry; import com.hbm.sound.AudioWrapper; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.CompatEnergyControl; @@ -14,33 +14,34 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IHeatSource, IEnergyReceiverMK2, INBTPacketReceiver, ICopiable, IInfoProviderEC { - +public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IHeatSource, IEnergyReceiverMK2, IBufPacketReceiver, ICopiable, IInfoProviderEC { + public long power; public int heatEnergy; public boolean isOn; protected int setting = 0; - + private AudioWrapper audio; @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { //doesn't have to happen constantly ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); this.trySubscribe(worldObj, xCoord + dir.offsetX * 3, yCoord, zCoord + dir.offsetZ * 3, dir); } - + this.heatEnergy *= 0.999; - + this.tryPullHeat(); this.isOn = false; @@ -49,17 +50,12 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH this.heatEnergy += getHeatGen(); this.isOn = true; } - - NBTTagCompound data = new NBTTagCompound(); - data.setByte("s", (byte) this.setting); - data.setInteger("h", this.heatEnergy); - data.setBoolean("o", isOn); - data.setBoolean("muffled", muffled); - INBTPacketReceiver.networkPack(this, data, 25); + + networkPackNT(25); } else { - + if(isOn) { - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -69,9 +65,9 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH audio.updateVolume(getVolume(1F)); audio.keepAlive(); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -79,7 +75,7 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH } } } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.electricHum", xCoord, yCoord, zCoord, 0.25F, 7.5F, 1.0F, 20); @@ -106,13 +102,21 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.setting = nbt.getByte("s"); - this.heatEnergy = nbt.getInteger("h"); - this.isOn = nbt.getBoolean("o"); - this.muffled = nbt.getBoolean("muffled"); + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.muffled); + buf.writeByte(this.setting); + buf.writeInt(this.heatEnergy); + buf.writeBoolean(this.isOn); } - + + @Override + public void deserialize(ByteBuf buf) { + this.muffled = buf.readBoolean(); + this.setting = buf.readByte(); + this.heatEnergy = buf.readInt(); + this.isOn = buf.readBoolean(); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -121,7 +125,7 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH this.setting = nbt.getInteger("setting"); this.heatEnergy = nbt.getInteger("heatEnergy"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -130,20 +134,20 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH nbt.setInteger("setting", setting); nbt.setInteger("heatEnergy", heatEnergy); } - + protected void tryPullHeat() { TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(con instanceof IHeatSource) { IHeatSource source = (IHeatSource) con; this.heatEnergy += source.getHeatStored() * 0.85; source.useUpHeat(source.getHeatStored()); } } - + public void toggleSetting() { setting++; - + if(setting > 10) setting = 0; } @@ -152,7 +156,7 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH public long getPower() { return power; } - + public long getConsumption() { return (long) (Math.pow(setting, 1.4D) * 200D); } @@ -161,7 +165,7 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH public long getMaxPower() { return getConsumption() * 20; } - + public int getHeatGen() { return this.setting * 100; } @@ -180,12 +184,12 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH public void useUpHeat(int heat) { this.heatEnergy = Math.max(0, this.heatEnergy - heat); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -196,10 +200,10 @@ public class TileEntityHeaterElectric extends TileEntityLoadedBase implements IH zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterHeatex.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterHeatex.java index 2dd2bc66b..7a1a9a18c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterHeatex.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHeaterHeatex.java @@ -11,7 +11,6 @@ import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType; import com.hbm.inventory.gui.GUIHeaterHeatex; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.fauxpointtwelve.DirPos; @@ -19,6 +18,8 @@ import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IHeatSource; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -27,13 +28,13 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHeatSource, INBTPacketReceiver, IFluidStandardTransceiver, IGUIProvider, IControlReceiver, IFluidCopiable { - +public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHeatSource, IFluidStandardTransceiver, IGUIProvider, IControlReceiver, IFluidCopiable { + public FluidTank[] tanks; public int amountToCool = 24_000; public int tickDelay = 1; public int heatEnergy; - + public TileEntityHeaterHeatex() { super(1); this.tanks = new FluidTank[2]; @@ -46,42 +47,56 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe return "container.heaterHeatex"; } + ByteBuf buf; + @Override public void updateEntity() { - + if(!worldObj.isRemote) { + + if(this.buf != null) + this.buf.release(); + this.buf = Unpooled.buffer(); + this.tanks[0].setType(0, slots); this.setupTanks(); this.updateConnections(); - + this.heatEnergy *= 0.999; - - NBTTagCompound data = new NBTTagCompound(); - tanks[0].writeToNBT(data, "0"); + + tanks[0].serialize(buf); + this.tryConvert(); - tanks[1].writeToNBT(data, "1"); - data.setInteger("heat", heatEnergy); - data.setInteger("toCool", amountToCool); - data.setInteger("delay", tickDelay); - INBTPacketReceiver.networkPack(this, data, 25); - + + tanks[1].serialize(buf); + + networkPackNT(25); + for(DirPos pos : getConPos()) { if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - tanks[0].readFromNBT(nbt, "0"); - tanks[1].readFromNBT(nbt, "1"); - this.heatEnergy = nbt.getInteger("heat"); - this.amountToCool = nbt.getInteger("toCool"); - this.tickDelay = nbt.getInteger("delay"); + public void serialize(ByteBuf buf) { + buf.writeBytes(this.buf); + buf.writeInt(this.heatEnergy); + buf.writeInt(this.amountToCool); + buf.writeInt(this.tickDelay); } - + + @Override + public void deserialize(ByteBuf buf) { + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + this.heatEnergy = buf.readInt(); + this.amountToCool = buf.readInt(); + this.tickDelay = buf.readInt(); + } + protected void setupTanks() { - + if(tanks[0].getTankType().hasTrait(FT_Coolable.class)) { FT_Coolable trait = tanks[0].getTankType().getTrait(FT_Coolable.class); if(trait.getEfficiency(CoolingType.HEATEXCHANGER) > 0) { @@ -93,37 +108,37 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe tanks[0].setTankType(Fluids.NONE); tanks[1].setTankType(Fluids.NONE); } - + protected void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + protected void tryConvert() { - + if(!tanks[0].getTankType().hasTrait(FT_Coolable.class)) return; if(tickDelay < 1) tickDelay = 1; if(worldObj.getTotalWorldTime() % tickDelay != 0) return; - + FT_Coolable trait = tanks[0].getTankType().getTrait(FT_Coolable.class); - + int inputOps = tanks[0].getFill() / trait.amountReq; int outputOps = (tanks[1].getMaxFill() - tanks[1].getFill()) / trait.amountProduced; int opCap = this.amountToCool; - + int ops = Math.min(inputOps, Math.min(outputOps, opCap)); tanks[0].setFill(tanks[0].getFill() - trait.amountReq * ops); tanks[1].setFill(tanks[1].getFill() + trait.amountProduced * ops); this.heatEnergy += trait.heatEnergy * ops * trait.getEfficiency(CoolingType.HEATEXCHANGER); this.markChanged(); } - + private DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ, dir), new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 - rot.offsetZ, dir), @@ -131,7 +146,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ, dir.getOpposite()) }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -142,7 +157,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe this.amountToCool = nbt.getInteger("toCool"); this.tickDelay = nbt.getInteger("delay"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -195,12 +210,12 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIHeaterHeatex(player.inventory, this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -211,10 +226,10 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -230,7 +245,7 @@ public class TileEntityHeaterHeatex extends TileEntityMachineBase implements IHe public void receiveControl(NBTTagCompound data) { if(data.hasKey("toCool")) this.amountToCool = MathHelper.clamp_int(data.getInteger("toCool"), 1, tanks[0].getMaxFill()); if(data.hasKey("delay")) this.tickDelay = Math.max(data.getInteger("delay"), 1); - + this.markChanged(); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java b/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java index 2997ffc7b..30ea58b03 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java @@ -37,6 +37,7 @@ import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -158,27 +159,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece } } - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("isOn", isOn); - data.setLong("power", power); - data.setInteger("progress", progress); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - plasma.writeToNBT(data, "t2"); - - if(slots[3] == null) { - data.setInteger("blanket", 0); - } else if(slots[3].getItem() == ModItems.fusion_shield_tungsten) { - data.setInteger("blanket", 1); - } else if(slots[3].getItem() == ModItems.fusion_shield_desh) { - data.setInteger("blanket", 2); - } else if(slots[3].getItem() == ModItems.fusion_shield_chlorophyte) { - data.setInteger("blanket", 3); - } else if(slots[3].getItem() == ModItems.fusion_shield_vaporwave) { - data.setInteger("blanket", 4); - } - - this.networkPack(data, 250); + this.networkPackNT(250); /// END Notif packets /// } else { @@ -378,16 +359,37 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece } @Override - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.isOn = data.getBoolean("isOn"); - this.power = data.getLong("power"); - this.blanket = data.getInteger("blanket"); - this.progress = data.getInteger("progress"); // - tanks[0].readFromNBT(data, "t0"); - tanks[1].readFromNBT(data, "t1"); - plasma.readFromNBT(data, "t2"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeBoolean(this.isOn); + buf.writeLong(this.power); + buf.writeInt(this.progress); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + plasma.serialize(buf); + if(slots[3] == null) { + buf.writeInt(0); + } else if(slots[3].getItem() == ModItems.fusion_shield_tungsten) { + buf.writeInt(1); + } else if(slots[3].getItem() == ModItems.fusion_shield_desh) { + buf.writeInt(2); + } else if(slots[3].getItem() == ModItems.fusion_shield_chlorophyte) { + buf.writeInt(3); + } else if(slots[3].getItem() == ModItems.fusion_shield_vaporwave) { + buf.writeInt(4); + } + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.isOn = buf.readBoolean(); + this.power = buf.readLong(); + this.progress = buf.readInt(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + plasma.deserialize(buf); + this.blanket = buf.readInt(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityLockableBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityLockableBase.java index 702589b42..2f8bb86d2 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityLockableBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityLockableBase.java @@ -3,14 +3,14 @@ package com.hbm.tileentity.machine; import com.hbm.items.ModItems; import com.hbm.items.tool.ItemKey; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.ArmorUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -public abstract class TileEntityLockableBase extends TileEntity { +public abstract class TileEntityLockableBase extends TileEntityLoadedBase { protected int lock; private boolean isLocked = false; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnace.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnace.java index e2090764d..15a099436 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnace.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnace.java @@ -6,18 +6,15 @@ import com.hbm.inventory.container.ContainerMachineArcFurnace; import com.hbm.inventory.gui.GUIMachineArcFurnace; import com.hbm.items.ModItems; import com.hbm.lib.Library; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.AuxElectricityPacket; -import com.hbm.packet.toclient.AuxGaugePacket; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.CompatEnergyControl; import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.tile.IInfoProviderEC; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ISidedInventory; @@ -31,12 +28,12 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements ISidedInventory, IEnergyReceiverMK2, IGUIProvider, IInfoProviderEC { private ItemStack slots[]; - + public int dualCookTime; public long power; public static final long maxPower = 50000; public static final int processingSpeed = 20; - + //0: i //1: o //2: 1 @@ -44,9 +41,9 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements //4: 3 //5: b private static final int[] slots_io = new int[] {0, 1, 2, 3, 4, 5}; - + private String customName; - + public TileEntityMachineArcFurnace() { slots = new ItemStack[6]; } @@ -91,7 +88,7 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @@ -110,7 +107,7 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; } } - + //You scrubs aren't needed for anything (right now) @Override public void openInventory() {} @@ -119,16 +116,16 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - + if(i == 2 || i == 3 || i == 4) return itemStack.getItem() == ModItems.arc_electrode; - + if(i == 0) return FurnaceRecipes.smelting().getSmeltingResult(itemStack) != null; - + return false; } - + @Override public ItemStack decrStackSize(int i, int j) { if(slots[i] != null) @@ -144,22 +141,22 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements { slots[i] = null; } - + return itemStack1; } else { return null; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - + this.power = nbt.getLong("powerTime"); this.dualCookTime = nbt.getInteger("cookTime"); slots = new ItemStack[getSizeInventory()]; - + for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = list.getCompoundTagAt(i); @@ -170,14 +167,14 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("powerTime", power); nbt.setInteger("cookTime", dualCookTime); NBTTagList list = new NBTTagList(); - + for(int i = 0; i < slots.length; i++) { if(slots[i] != null) @@ -190,7 +187,7 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements } nbt.setTag("items", list); } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return slots_io; @@ -203,87 +200,87 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - + if(i == 1) return true; - + if(i == 2 || i == 3 || i == 4) return itemStack.getItem() == ModItems.arc_electrode_burnt; - + return false; } - + public int getDiFurnaceProgressScaled(int i) { return (dualCookTime * i) / processingSpeed; } - + public long getPowerRemainingScaled(long i) { return (power * i) / maxPower; } - + public boolean hasPower() { return power >= 250; } - + public boolean isProcessing() { return this.dualCookTime > 0; } - + private boolean hasElectrodes() { - + if(slots[2] != null && slots[3] != null && slots[4] != null) { if((slots[2].getItem() == ModItems.arc_electrode) && (slots[3].getItem() == ModItems.arc_electrode) && (slots[4].getItem() == ModItems.arc_electrode)) return true; } - + return false; } - + public boolean canProcess() { - + if(!hasElectrodes()) return false; - + if(slots[0] == null) { return false; } ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); - + if(itemStack == null) { return false; } - + if(slots[1] == null) { return true; } - + if(!slots[1].isItemEqual(itemStack)) { return false; } - + if(slots[1].stackSize < getInventoryStackLimit() && slots[1].stackSize < slots[1].getMaxStackSize()) { return true; }else{ return slots[1].stackSize < itemStack.getMaxStackSize(); } } - + private void processItem() { if(canProcess()) { ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); - + if(slots[1] == null) { slots[1] = itemStack.copy(); }else if(slots[1].isItemEqual(itemStack)) { slots[1].stackSize += itemStack.stackSize; } - + for(int i = 0; i < 1; i++) { if(slots[i].stackSize <= 0) @@ -299,26 +296,26 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements } } } - + //TODO: fix this punjabi trash @Override public void updateEntity() { boolean flag1 = false; - + if(!worldObj.isRemote) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); - + if(hasPower() && canProcess()) { dualCookTime++; - + power -= 250; - + if(power < 0) power = 0; - + if(this.dualCookTime == processingSpeed) { this.dualCookTime = 0; @@ -328,22 +325,22 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements }else{ dualCookTime = 0; } - + boolean trigger = true; - + if(hasPower() && canProcess() && this.dualCookTime == 0) { trigger = false; } - + if(trigger) { flag1 = true; MachineArcFurnace.updateBlockState(this.dualCookTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } - + if(worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_arc_furnace_off) { - + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); if(hasElectrodes() && meta <= 5) { @@ -353,30 +350,42 @@ public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta - 4, 2); } } - + power = Library.chargeTEFromItems(slots, 5, power, maxPower); - PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, dualCookTime, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); + networkPackNT(50); // it makes no sense to refactor this to some, but I want to delete the AuxElectricityPacket already } - - + if(flag1) { this.markDirty(); } } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + buf.writeInt(dualCookTime); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + power = buf.readLong(); + dualCookTime = buf.readInt(); + } + @Override public void setPower(long i) { power = i; - + } @Override public long getPower() { return power; - + } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnaceLarge.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnaceLarge.java index 874a815ef..7ec5ae47f 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnaceLarge.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcFurnaceLarge.java @@ -1,13 +1,14 @@ package com.hbm.tileentity.machine; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineArcFurnaceLarge; import com.hbm.inventory.gui.GUIMachineArcFurnaceLarge; import com.hbm.inventory.material.MaterialShapes; @@ -47,7 +48,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase implements IEnergyReceiverMK2, IControlReceiver, IGUIProvider, IUpgradeInfoProvider { - + public long power; public static final long maxPower = 2_500_000; public boolean liquidMode = false; @@ -56,25 +57,27 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl public boolean hasMaterial; public int delay; public int upgrade; - + public float lid; public float prevLid; public int approachNum; public float syncLid; - + private AudioWrapper audioLid; private AudioWrapper audioProgress; - + + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public byte[] electrodes = new byte[3]; public static final byte ELECTRODE_NONE = 0; public static final byte ELECTRODE_FRESH = 1; public static final byte ELECTRODE_USED = 2; public static final byte ELECTRODE_DEPLETED = 3; - + public int getMaxInputSize() { return upgrade == 0 ? 1 : upgrade == 1 ? 4 : upgrade == 2 ? 8 : 16; } - + public static final int maxLiquid = MaterialShapes.BLOCK.q(128); public List liquids = new ArrayList(); @@ -90,7 +93,7 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && stack.getItem() instanceof ItemMachineUpgrade && i == 4) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -98,31 +101,31 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl @Override public void updateEntity() { - - UpgradeManager.eval(slots, 4, 4); - this.upgrade = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - + + upgradeManager.checkSlots(this, slots, 4, 4); + this.upgrade = upgradeManager.getLevel(UpgradeType.SPEED); + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 3, power, maxPower); this.isProgressing = false; - + for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - + if(power > 0) { - + boolean ingredients = this.hasIngredients(); boolean electrodes = this.hasElectrodes(); - + int consumption = (int) (1_000 * Math.pow(5, upgrade)); - + if(ingredients && electrodes && delay <= 0 && this.liquids.isEmpty()) { if(lid > 0) { lid -= 1F / (60F / (upgrade * 0.5 + 1)); if(lid < 0) lid = 0; this.progress = 0; } else { - + if(power >= consumption) { int duration = 400 / (upgrade * 2 + 1); this.progress += 1F / duration; @@ -145,18 +148,18 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl if(lid > 1) lid = 1; } } - + hasMaterial = ingredients; } - + this.decideElectrodeState(); - + if(!hasMaterial) hasMaterial = this.hasIngredients(); - + if(!this.liquids.isEmpty() && this.lid > 0F) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); - + Vec3 impact = Vec3.createVectorHelper(0, 0, 0); MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 2.875D, yCoord + 1.25D, zCoord + 0.5D + dir.offsetZ * 2.875D, 6, true, this.liquids, MaterialShapes.INGOT.q(1), impact); @@ -171,21 +174,21 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + dir.offsetX * 2.875D, yCoord + 1, zCoord + 0.5D + dir.offsetZ * 2.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); } } - + this.liquids.removeIf(o -> o.amount <= 0); - + this.networkPackNT(150); } else { this.prevLid = this.lid; - + if(this.approachNum > 0) { this.lid = this.lid + ((this.syncLid - this.lid) / (float) this.approachNum); --this.approachNum; } else { this.lid = this.syncLid; } - + if(this.lid != this.prevLid) { if(this.audioLid == null || !this.audioLid.isPlaying()) { this.audioLid = MainRegistry.proxy.getLoopedSound("hbm:door.wgh_start", xCoord, yCoord, zCoord, this.getVolume(0.75F), 15F, 1.0F, 5); @@ -198,11 +201,11 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl this.audioLid = null; } } - + if((lid == 1 || lid == 0) && lid != prevLid && !(this.prevLid == 0 && this.lid == 1)) { MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:door.wgh_stop", this.getVolume(1), 1F); } - + if(this.isProgressing) { if(this.audioProgress == null || !this.audioProgress.isPlaying()) { this.audioProgress = MainRegistry.proxy.getLoopedSound("hbm:block.electricHum", xCoord, yCoord, zCoord, this.getVolume(1.5F), 15F, 0.75F, 5); @@ -216,7 +219,7 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl this.audioProgress = null; } } - + if(this.lid != this.prevLid && this.lid > this.prevLid && !(this.prevLid == 0 && this.lid == 1) && MainRegistry.proxy.me().getDistance(xCoord + 0.5, yCoord + 4, zCoord + 0.5) < 50) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "tower"); @@ -233,7 +236,7 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl data.setFloat("strafe", 0.05F); for(int i = 0; i < 3; i++) MainRegistry.proxy.effectNT(data); } - + if(this.lid != this.prevLid && this.lid < this.prevLid && this.lid > 0.5F && this.hasMaterial && MainRegistry.proxy.me().getDistance(xCoord + 0.5, yCoord + 4, zCoord + 0.5) < 50) { /*NBTTagCompound data = new NBTTagCompound(); data.setString("type", "tower"); @@ -249,7 +252,7 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl data.setInteger("color", 0x808080); data.setFloat("strafe", 0.15F); MainRegistry.proxy.effectNT(data);*/ - + if(worldObj.rand.nextInt(5) == 0) { NBTTagCompound flame = new NBTTagCompound(); flame.setString("type", "rbmkflame"); @@ -262,10 +265,10 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl } } } - + public void decideElectrodeState() { for(int i = 0; i < 3; i++) { - + if(slots[i] != null) { if(slots[i].getItem() == ModItems.arc_electrode_burnt) { this.electrodes[i] = this.ELECTRODE_DEPLETED; continue; } if(slots[i].getItem() == ModItems.arc_electrode) { @@ -277,26 +280,26 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl this.electrodes[i] = this.ELECTRODE_NONE; } } - + public void process() { - + for(int i = 5; i < 25; i++) { if(slots[i] == null) continue; ArcFurnaceRecipe recipe = ArcFurnaceRecipes.getOutput(slots[i], this.liquidMode); if(recipe == null) continue; - + if(!liquidMode && recipe.solidOutput != null) { int amount = slots[i].stackSize; slots[i] = recipe.solidOutput.copy(); slots[i].stackSize *= amount; } - + if(liquidMode && recipe.fluidOutput != null) { - + while(slots[i] != null && slots[i].stackSize > 0) { int liquid = this.getStackAmount(liquids); int toAdd = this.getStackAmount(recipe.fluidOutput); - + if(liquid + toAdd <= this.maxLiquid) { this.decrStackSize(i, 1); for(MaterialStack stack : recipe.fluidOutput) { @@ -308,16 +311,16 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl } } } - + for(int i = 0; i < 3; i++) { if(ItemArcElectrode.damage(slots[i])) { slots[i] = new ItemStack(ModItems.arc_electrode_burnt, 1, slots[i].getItemDamage()); } } } - + public boolean hasIngredients() { - + for(int i = 5; i < 25; i++) { if(slots[i] == null) continue; ArcFurnaceRecipe recipe = ArcFurnaceRecipes.getOutput(slots[i], this.liquidMode); @@ -325,10 +328,10 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl if(liquidMode && recipe.fluidOutput != null) return true; if(!liquidMode && recipe.solidOutput != null) return true; } - + return false; } - + public boolean hasElectrodes() { for(int i = 0; i < 3; i++) { if(slots[i] == null || slots[i].getItem() != ModItems.arc_electrode) return false; @@ -384,35 +387,35 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl if(slot > 4) return lid > 0 && ArcFurnaceRecipes.getOutput(stack, this.liquidMode) == null; return false; } - + public void addToStack(MaterialStack matStack) { - + for(MaterialStack mat : liquids) { if(mat.material == matStack.material) { mat.amount += matStack.amount; return; } } - + liquids.add(matStack.copy()); } - + public static int getStackAmount(List stack) { int amount = 0; for(MaterialStack mat : stack) amount += mat.amount; return amount; } - + public static int getStackAmount(MaterialStack[] stack) { int amount = 0; for(MaterialStack mat : stack) amount += mat.amount; return amount; } - + protected DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 3 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 3 + rot.offsetZ, dir), new DirPos(xCoord + dir.offsetX * 3 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 3 - rot.offsetZ, dir), @@ -432,17 +435,17 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl buf.writeBoolean(isProgressing); buf.writeBoolean(liquidMode); buf.writeBoolean(hasMaterial); - + for(int i = 0; i < 3; i++) buf.writeByte(electrodes[i]); - + buf.writeShort(liquids.size()); - + for(MaterialStack mat : liquids) { buf.writeInt(mat.material.id); buf.writeInt(mat.amount); } } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -452,32 +455,32 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl this.isProgressing = buf.readBoolean(); this.liquidMode = buf.readBoolean(); this.hasMaterial = buf.readBoolean(); - + for(int i = 0; i < 3; i++) electrodes[i] = buf.readByte(); - + int mats = buf.readShort(); - + this.liquids.clear(); for(int i = 0; i < mats; i++) { liquids.add(new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt())); } - + if(syncLid != 0 && syncLid != 1) this.approachNum = 2; } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); this.liquidMode = nbt.getBoolean("liquidMode"); this.progress = nbt.getFloat("progress"); this.lid = nbt.getFloat("lid"); this.delay = nbt.getInteger("delay"); - + int count = nbt.getShort("count"); liquids.clear(); - + for(int i = 0; i < count; i++) { liquids.add(new MaterialStack(Mats.matById.get(nbt.getInteger("m" + i)), nbt.getInteger("a" + i))); } @@ -491,7 +494,7 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl nbt.setFloat("progress", progress); nbt.setFloat("lid", lid); nbt.setInteger("delay", delay); - + int count = liquids.size(); nbt.setShort("count", (short) count); for(int i = 0; i < count; i++) { @@ -515,12 +518,12 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl public long getMaxPower() { return maxPower; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 3, @@ -531,10 +534,10 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl zCoord + 4 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -580,8 +583,10 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + return upgrades; } + } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcWelder.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcWelder.java index 82c0d7547..6ab6585c6 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcWelder.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineArcWelder.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineArcWelder; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -38,17 +39,19 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineArcWelder extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IConditionalInvAccess, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable { - + public long power; public long maxPower = 2_000; public long consumption; - + public int progress; public int processTime = 1; - + public FluidTank tank; public ItemStack display; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineArcWelder() { super(8); this.tank = new FluidTank(Fluids.NONE, 24_000); @@ -62,7 +65,7 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && stack.getItem() instanceof ItemMachineUpgrade && i >= 6 && i <= 7) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -70,48 +73,48 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 4, this.getPower(), this.getMaxPower()); this.tank.setType(5, slots); - + if(worldObj.getTotalWorldTime() % 20 == 0) { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + ArcWelderRecipe recipe = ArcWelderRecipes.getRecipe(slots[0], slots[1], slots[2]); long intendedMaxPower; - - UpgradeManager.eval(slots, 6, 7); - int redLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int blueLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - + + upgradeManager.checkSlots(this, slots, 6, 7); + int redLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int blueLevel = upgradeManager.getLevel(UpgradeType.POWER); + if(recipe != null) { this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3); this.consumption = recipe.consumption + (recipe.consumption * redLevel) - (recipe.consumption * blueLevel / 6); intendedMaxPower = recipe.consumption * 20; - + if(canProcess(recipe)) { this.progress++; this.power -= this.consumption; - + if(progress >= processTime) { this.progress = 0; this.consumeItems(recipe); - + if(slots[3] == null) { slots[3] = recipe.output.copy(); } else { slots[3].stackSize += recipe.output.stackSize; } - + this.markDirty(); } - + if(worldObj.getTotalWorldTime() % 2 == 0) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); NBTTagCompound dPart = new NBTTagCompound(); @@ -119,23 +122,23 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements dPart.setByte("count", (byte) 5); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(dPart, xCoord + 0.5 - dir.offsetX * 0.5, yCoord + 1.25, zCoord + 0.5 - dir.offsetZ * 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 25)); } - + } else { this.progress = 0; } - + } else { this.progress = 0; this.consumption = 100; intendedMaxPower = 2000; } - + this.maxPower = Math.max(intendedMaxPower, power); - + this.networkPackNT(25); } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -144,11 +147,11 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements buf.writeLong(consumption); buf.writeInt(progress); buf.writeInt(processTime); - + tank.serialize(buf); - + ArcWelderRecipe recipe = ArcWelderRecipes.getRecipe(slots[0], slots[1], slots[2]); - + if(recipe != null) { buf.writeBoolean(true); buf.writeInt(Item.getIdFromItem(recipe.output.getItem())); @@ -156,7 +159,7 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements } else buf.writeBoolean(false); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -165,37 +168,37 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements consumption = buf.readLong(); progress = buf.readInt(); processTime = buf.readInt(); - + tank.deserialize(buf); - + if(buf.readBoolean()) { this.display = new ItemStack(Item.getItemById(buf.readInt()), 1, buf.readInt()); } else this.display = null; } - + public boolean canProcess(ArcWelderRecipe recipe) { - + if(this.power < this.consumption) return false; - + if(recipe.fluid != null) { if(this.tank.getTankType() != recipe.fluid.type) return false; if(this.tank.getFill() < recipe.fluid.fill) return false; } - + if(slots[3] != null) { if(slots[3].getItem() != recipe.output.getItem()) return false; if(slots[3].getItemDamage() != recipe.output.getItemDamage()) return false; if(slots[3].stackSize + recipe.output.stackSize > slots[3].getMaxStackSize()) return false; } - + return true; } - + public void consumeItems(ArcWelderRecipe recipe) { - + for(AStack aStack : recipe.ingredients) { - + for(int i = 0; i < 3; i++) { ItemStack stack = slots[i]; if(aStack.matchesRecipe(stack, true) && stack.stackSize >= aStack.stacksize) { @@ -204,17 +207,17 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements } } } - + if(recipe.fluid != null) { this.tank.setFill(tank.getFill() - recipe.fluid.fill); } } - + protected DirPos[] getConPos() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir), new DirPos(xCoord + dir.offsetX + rot.offsetX, yCoord, zCoord + dir.offsetZ + rot.offsetZ, dir), @@ -228,7 +231,7 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements new DirPos(xCoord - dir.offsetX - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ - rot.offsetZ * 2, rot.getOpposite()) }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -239,7 +242,7 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements this.processTime = nbt.getInteger("processTime"); tank.readFromNBT(nbt, "t"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -312,19 +315,19 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); BlockPos core = new BlockPos(xCoord, yCoord, zCoord); - + //Red if(pos.equals(core.clone().offset(rot)) || pos.equals(core.clone().offset(rot.getOpposite()).offset(dir.getOpposite()))) return new int[] { 0, 3 }; - + //Yellow if(pos.equals(core.clone().offset(dir.getOpposite()))) return new int[] { 1, 3 }; - + //Green if(pos.equals(core.clone().offset(rot.getOpposite())) || pos.equals(core.clone().offset(rot).offset(dir.getOpposite()))) return new int[] { 2, 3 }; - + return new int[] { }; } @@ -338,12 +341,12 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineArcWelder(player.inventory, this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -354,10 +357,10 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -383,10 +386,11 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java index 9755049d3..fd7d1b822 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssembler.java @@ -1,12 +1,13 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import java.util.Random; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.handler.MultiblockHandlerXR; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineAssembler; import com.hbm.inventory.gui.GUIMachineAssembler; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; @@ -31,11 +32,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase implements IUpgradeInfoProvider { - + public int recipe = -1; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + Random rand = new Random(); - + public TileEntityMachineAssembler() { super(18); } @@ -50,19 +53,19 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i if(i == 0) if(itemStack.getItem() instanceof IBatteryItem) return true; - + if(i == 1) return true; - + return false; } - + @Override public void updateEntity() { super.updateEntity(); - + if(!worldObj.isRemote) { - + //meta below 12 means that it's an old multiblock configuration if(this.getBlockMetadata() < 12) { int meta = this.getBlockMetadata(); @@ -83,18 +86,18 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i worldObj.getTileEntity(xCoord, yCoord, zCoord).readFromNBT(data); return; } - + this.updateConnections(); this.consumption = 100; this.speed = 100; - - UpgradeManager.eval(slots, 1, 3); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - + upgradeManager.checkSlots(this, slots, 1, 3); + + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + speed -= speedLevel * 25; consumption += speedLevel * 300; speed += powerLevel * 5; @@ -107,14 +110,14 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i ComparableStack comp = ItemAssemblyTemplate.readType(slots[4]); rec = AssemblerRecipes.recipeList.indexOf(comp); }*/ - + this.networkPackNT(150); } else { - + float volume = this.getVolume(2F); if(isProgressing && volume > 0) { - + if(audio == null) { audio = this.createAudioLoop(); audio.updateVolume(volume); @@ -123,9 +126,9 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i audio = rebootAudio(audio); audio.updateVolume(volume); } - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -133,7 +136,7 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i } } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -142,11 +145,11 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i buf.writeInt(progress[i]); buf.writeInt(maxProgress[i]); } - + buf.writeBoolean(isProgressing); buf.writeInt(recipe); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -155,28 +158,28 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i progress[i] = buf.readInt(); maxProgress[i] = buf.readInt(); } - + isProgressing = buf.readBoolean(); recipe = buf.readInt(); } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.assemblerOperate", xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F); } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + public DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + return new DirPos[] { new DirPos(xCoord + rot.offsetX * 3, yCoord, zCoord + rot.offsetZ * 3, rot), new DirPos(xCoord - rot.offsetX * 2, yCoord, zCoord - rot.offsetZ * 2, rot.getOpposite()), @@ -204,7 +207,7 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i audio = null; } } - + private AudioWrapper audio; @Override @@ -244,12 +247,12 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i public long getMaxPower() { return 100_000; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(2, 1, 2); } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -289,10 +292,11 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 9; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java index be6f29afa..d0d58dfb4 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java @@ -1,5 +1,6 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.inventory.RecipesCommon.AStack; @@ -11,6 +12,7 @@ import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.machine.storage.TileEntityCrateTemplate; import com.hbm.util.InventoryUtil; +import com.hbm.util.ItemStackUtil; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; @@ -27,13 +29,13 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa public int[] maxProgress; public boolean isProgressing; public boolean[] needsTemplateSwitch; - + int consumption = 100; int speed = 100; public TileEntityMachineAssemblerBase(int scount) { super(scount); - + int count = this.getRecipeCount(); progress = new int[count]; @@ -43,20 +45,20 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + int count = this.getRecipeCount(); - + this.isProgressing = false; this.power = Library.chargeTEFromItems(slots, getPowerSlot(), power, this.getMaxPower()); - + for(int i = 0; i < count; i++) { unloadItems(i); loadItems(i); } - + for(int i = 0; i < count; i++) { if(!canProcess(i)) { this.progress[i] = 0; @@ -67,53 +69,62 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa } } } - + protected boolean canProcess(int index) { - + int template = getTemplateIndex(index); - + if(slots[template] == null || slots[template].getItem() != ModItems.assembly_template) return false; List recipe = AssemblerRecipes.getRecipeFromTempate(slots[template]); ItemStack output = AssemblerRecipes.getOutputFromTempate(slots[template]); - + if(recipe == null) return false; - + if(this.power < this.consumption) return false; if(!hasRequiredItems(recipe, index)) return false; if(!hasSpaceForItems(output, index)) return false; - + return true; } - + + public HashMap cachedItems = new HashMap<>(); + private boolean hasRequiredItems(List recipe, int index) { int[] indices = getSlotIndicesFromIndex(index); - return InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.toArray(new AStack[0])); + ItemStack[] copy = ItemStackUtil.carefulCopyArrayTruncate(slots, indices[0], indices[1]); + if (cachedItems.get(copy) != null) + return cachedItems.get(copy); + else { + boolean hasItems = InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.toArray(new AStack[0])); + cachedItems.put(copy, hasItems); + return hasItems; + } } - + private boolean hasSpaceForItems(ItemStack recipe, int index) { int[] indices = getSlotIndicesFromIndex(index); return InventoryUtil.doesArrayHaveSpace(slots, indices[2], indices[2], new ItemStack[] { recipe }); } - + protected void process(int index) { - + this.power -= this.consumption; this.progress[index]++; - + if(slots[0] != null && slots[0].getItem() == ModItems.meteorite_sword_alloyed) slots[0] = new ItemStack(ModItems.meteorite_sword_machined); //fisfndmoivndlmgindgifgjfdnblfm - + int template = getTemplateIndex(index); List recipe = AssemblerRecipes.getRecipeFromTempate(slots[template]); ItemStack output = AssemblerRecipes.getOutputFromTempate(slots[template]); int time = ItemAssemblyTemplate.getProcessTime(slots[template]); - + this.maxProgress[index] = time * this.speed / 100; - + if(this.progress[index] >= this.maxProgress[index]) { consumeItems(recipe, index); produceItems(output, index); @@ -122,28 +133,28 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa this.markDirty(); } } - + private void consumeItems(List recipe, int index) { - + int[] indices = getSlotIndicesFromIndex(index); - + for(AStack in : recipe) { if(in != null) InventoryUtil.tryConsumeAStack(slots, indices[0], indices[1], in); } } - + private void produceItems(ItemStack out, int index) { - + int[] indices = getSlotIndicesFromIndex(index); - + if(out != null) { InventoryUtil.tryAddItemToInventory(slots, indices[2], indices[2], out.copy()); } } - + private void loadItems(int index) { - + int template = getTemplateIndex(index); DirPos[] positions = getInputPositions(); @@ -152,7 +163,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa for(DirPos coord : positions) { TileEntity te = worldObj.getTileEntity(coord.getX(), coord.getY(), coord.getZ()); - + if(te instanceof IInventory) { IInventory inv = (IInventory) te; @@ -174,7 +185,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa } } } - + boolean noTemplate = slots[template] == null || slots[template].getItem() != ModItems.assembly_template; if(!noTemplate) { @@ -184,17 +195,17 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa if(recipe != null) { for(AStack ingredient : recipe) { - + int tracker = 0; outer: while(!InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], ingredient)) { - + if(tracker++ > 10) break; boolean found = false; for(int i = 0; i < (access != null ? access.length : inv.getSizeInventory()); i++) { - + int slot = access != null ? access[i] : i; ItemStack stack = inv.getStackInSlot(slot); if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(slot, stack, 0))) { @@ -229,25 +240,25 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa } } } - + private void unloadItems(int index) { DirPos[] positions = getOutputPositions(); int[] indices = getSlotIndicesFromIndex(index); - + for(DirPos coord : positions) { - + TileEntity te = worldObj.getTileEntity(coord.getX(), coord.getY(), coord.getZ()); - + if(te instanceof IInventory) { - + IInventory inv = (IInventory) te; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(coord.getDir().ordinal()) : null; - + int i = indices[2]; ItemStack out = slots[i]; - + int template = getTemplateIndex(index); if(this.needsTemplateSwitch[index] && te instanceof TileEntityCrateTemplate && slots[template] != null) { out = slots[template]; @@ -259,10 +270,10 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) { int slot = access != null ? access[j] : j; - + if(!(sided != null ? sided.canInsertItem(slot, out, coord.getDir().ordinal()) : inv.isItemValidForSlot(slot, out))) continue; - + ItemStack target = inv.getStackInSlot(slot); if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) { @@ -275,7 +286,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) { int slot = access != null ? access[j] : j; - + if(!inv.isItemValidForSlot(slot, out)) continue; @@ -291,20 +302,20 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa } } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); if(nbt.hasKey("progress")) this.progress = nbt.getIntArray("progress"); if(nbt.hasKey("maxProgress")) this.maxProgress = nbt.getIntArray("maxProgress"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setIntArray("progress", progress); nbt.setIntArray("maxProgress", maxProgress); @@ -322,7 +333,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa public abstract int getRecipeCount(); public abstract int getTemplateIndex(int index); - + /** * @param index * @return A size 3 int array containing min input, max input and output indices in that order. diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java index 9a443510a..9919ffec1 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemfac.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import java.util.Random; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerAssemfac; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -25,22 +26,23 @@ import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase implements IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable { - + public AssemblerArm[] arms; public FluidTank water; public FluidTank steam; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineAssemfac() { super(14 * 8 + 4 + 1); //8 assembler groups with 14 slots, 4 upgrade slots, 1 battery slot - + arms = new AssemblerArm[6]; for(int i = 0; i < arms.length; i++) { arms[i] = new AssemblerArm(i % 3 == 1 ? 1 : 0); //the second of every group of three becomes a welder @@ -58,7 +60,7 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && i >= 1 && i <= 4 && stack.getItem() instanceof ItemMachineUpgrade) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -67,37 +69,37 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im @Override public void updateEntity() { super.updateEntity(); - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { this.updateConnections(); } - + this.speed = 100; this.consumption = 100; - - UpgradeManager.eval(slots, 1, 4); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 6); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - + upgradeManager.checkSlots(this, slots, 1, 4); + + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + this.speed -= speedLevel * 15; this.consumption += speedLevel * 300; this.speed += powerLevel * 5; this.consumption -= powerLevel * 30; this.speed /= (overLevel + 1); this.consumption *= (overLevel + 1); - + for(DirPos pos : getConPos()) { this.sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + this.networkPackNT(150); - + } else { - + for(AssemblerArm arm : arms) { arm.updateInterp(); if(isProgressing) { @@ -106,7 +108,7 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im } } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -119,7 +121,7 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im water.serialize(buf); steam.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -132,20 +134,7 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im water.deserialize(buf); steam.deserialize(buf); } - - @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.progress = nbt.getIntArray("progress"); - this.maxProgress = nbt.getIntArray("maxProgress"); - this.isProgressing = nbt.getBoolean("isProgressing"); - - water.readFromNBT(nbt, "w"); - steam.readFromNBT(nbt, "s"); - } - + private int getWaterRequired() { return 1000 / this.speed; } @@ -161,19 +150,19 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im this.water.setFill(this.water.getFill() - getWaterRequired()); this.steam.setFill(this.steam.getFill() + getWaterRequired()); } - + private void updateConnections() { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(water.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + public DirPos[] getConPos() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord - dir.offsetX * 3 + rot.offsetX * 5, yCoord, zCoord - dir.offsetZ * 3 + rot.offsetZ * 5, rot), new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 5, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 5, rot), @@ -185,22 +174,22 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 2, dir) }; } - + public static class AssemblerArm { public double[] angles = new double[4]; public double[] prevAngles = new double[4]; public double[] targetAngles = new double[4]; public double[] speed = new double[4]; - + Random rand = new Random(); - + int actionMode; ArmActionState state; int actionDelay = 0; - + public AssemblerArm(int actionMode) { this.actionMode = actionMode; - + if(this.actionMode == 0) { speed[0] = 15; //Pivot speed[1] = 15; //Arm @@ -212,19 +201,19 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im speed[2] = 1; //Piston speed[3] = 0.125; //Striker } - + state = ArmActionState.ASSUME_POSITION; chooseNewArmPoistion(); actionDelay = rand.nextInt(20); } - + public void updateArm() { - + if(actionDelay > 0) { actionDelay--; return; } - + switch(state) { //Move. If done moving, set a delay and progress to EXTEND case ASSUME_POSITION: @@ -268,12 +257,12 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im state = ArmActionState.ASSUME_POSITION; } break; - + } } - + public void chooseNewArmPoistion() { - + if(this.actionMode == 0) { targetAngles[0] = -rand.nextInt(50); //Pivot targetAngles[1] = -targetAngles[0]; //Arm @@ -284,45 +273,45 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im targetAngles[2] = rand.nextInt(10) + 10; //Piston } } - + private void updateInterp() { for(int i = 0; i < angles.length; i++) { prevAngles[i] = angles[i]; } } - + /** * @return True when it has finished moving */ private boolean move() { boolean didMove = false; - + for(int i = 0; i < angles.length; i++) { if(angles[i] == targetAngles[i]) continue; - + didMove = true; - + double angle = angles[i]; double target = targetAngles[i]; double turn = speed[i]; double delta = Math.abs(angle - target); - + if(delta <= turn) { angles[i] = targetAngles[i]; continue; } - + if(angle < target) { angles[i] += turn; } else { angles[i] -= turn; } } - + return !didMove; } - + public static enum ArmActionState { ASSUME_POSITION, EXTEND_STRIKER, @@ -330,12 +319,12 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im RETRACT_STRIKER } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 5, @@ -346,10 +335,10 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im zCoord + 5 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -378,42 +367,42 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im DirPos[] inpos; DirPos[] outpos; - + @Override public DirPos[] getInputPositions() { - + if(inpos != null) return inpos; - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + inpos = new DirPos[] { new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 1, dir), new DirPos(xCoord - dir.offsetX * 5 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 5 + rot.offsetZ * 2, dir.getOpposite()), new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 4, rot.getOpposite()), new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX * 5, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * 5, rot) }; - + return inpos; } @Override public DirPos[] getOutputPositions() { - + if(outpos != null) return outpos; - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + outpos = new DirPos[] { new DirPos(xCoord + dir.offsetX * 4 + rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 4 + rot.offsetZ * 2, dir), new DirPos(xCoord - dir.offsetX * 5 - rot.offsetX * 1, yCoord, zCoord - dir.offsetZ * 5 - rot.offsetZ * 1, dir.getOpposite()), new DirPos(xCoord + dir.offsetX * 1 - rot.offsetX * 4, yCoord, zCoord + dir.offsetZ * 1 - rot.offsetZ * 4, rot.getOpposite()), new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 5, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 5, rot) }; - + return outpos; } @@ -470,11 +459,12 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 6; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 12; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 6); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 12); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java index d33ec0705..b5bba66f0 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAutosaw.java @@ -12,13 +12,14 @@ import com.hbm.lib.ModDamageSource; import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.IFluidCopiable; import com.hbm.packet.toclient.AuxParticlePacketNT; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.material.Material; @@ -30,19 +31,19 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; -public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardReceiver, IFluidCopiable { - +public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardReceiver, IFluidCopiable { + public static final HashSet acceptedFuels = new HashSet(); - + static { acceptedFuels.add(Fluids.WOODOIL); acceptedFuels.add(Fluids.ETHANOL); acceptedFuels.add(Fluids.FISHOIL); acceptedFuels.add(Fluids.HEAVYOIL); } - + public FluidTank tank; - + public boolean isOn; public float syncYaw; public float rotationYaw; @@ -50,24 +51,24 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN public float syncPitch; public float rotationPitch; public float prevRotationPitch; - + // 0: searching, 1: extending, 2: retracting private int state = 0; - + private int turnProgress; - + public float spin; public float lastSpin; - + public TileEntityMachineAutosaw() { this.tank = new FluidTank(Fluids.WOODOIL, 100); } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { if(tank.getFill() > 0) { tank.setFill(tank.getFill() - 1); @@ -75,7 +76,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN } else { this.isOn = false; } - + this.subscribeToAllAround(tank.getTankType(), this); } @@ -89,13 +90,13 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN lowerArm.rotateAroundY(-(float) Math.toRadians(rotationYaw)); Vec3 armTip = Vec3.createVectorHelper(0, 0, -2); armTip.rotateAroundY(-(float) Math.toRadians(rotationYaw)); - + double cX = pivot.xCoord + upperArm.xCoord + lowerArm.xCoord + armTip.xCoord; double cY = pivot.yCoord; double cZ = pivot.zCoord + upperArm.zCoord + lowerArm.zCoord + armTip.zCoord; - + List affected = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(cX - 1, cY - 0.25, cZ - 1, cX + 1, cY + 0.25, cZ + 1)); - + for(EntityLivingBase e : affected) { if(e.isEntityAlive() && e.attackEntityFrom(ModDamageSource.turbofan, 100)) { worldObj.playSoundEffect(e.posX, e.posY, e.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F); @@ -109,34 +110,34 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY, e.posZ, 50)); } } - + if(state == 0) { - + this.rotationYaw += 1; - + if(this.rotationYaw >= 360) { this.rotationYaw -= 360; } - + Vec3 grace = Vec3.createVectorHelper(0, 0, -3.5); grace.rotateAroundY(-(float) Math.toRadians(rotationYaw)); grace.xCoord += pivot.xCoord; grace.yCoord += pivot.yCoord; grace.zCoord += pivot.zCoord; - + Vec3 detector = Vec3.createVectorHelper(0, 0, -9); detector.rotateAroundY(-(float) Math.toRadians(rotationYaw)); detector.xCoord += pivot.xCoord; detector.yCoord += pivot.yCoord; detector.zCoord += pivot.zCoord; MovingObjectPosition pos = worldObj.func_147447_a(grace, detector, false, false, false); - + if(pos != null && pos.typeOfHit == pos.typeOfHit.BLOCK) { - + Block b = worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ); - + if(b.getMaterial() == Material.wood || b.getMaterial() == Material.leaves || b.getMaterial() == Material.plants) { - + int meta = worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ); if(!shouldIgnore(b, meta)) { state = 1; @@ -155,7 +156,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN this.tryInteract(hitX1, hitY, hitZ0); this.tryInteract(hitX0, hitY, hitZ1); this.tryInteract(hitX1, hitY, hitZ1); - + if(state == 1) { this.rotationPitch += 2; @@ -164,36 +165,31 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN state = 2; } } - + if(state == 2) { this.rotationPitch -= 2; - + if(this.rotationPitch <= 0) { this.rotationPitch = 0; state = 0; } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("isOn", isOn); - data.setFloat("yaw", this.rotationYaw); - data.setFloat("pitch", this.rotationPitch); - tank.writeToNBT(data, "t"); - INBTPacketReceiver.networkPack(this, data, 100); + + networkPackNT(100); } else { - + this.lastSpin = this.spin; - + if(isOn) { this.spin += 15F; - + Vec3 vec = Vec3.createVectorHelper(0.625, 0, 1.625); vec.rotateAroundY(-(float) Math.toRadians(rotationYaw)); - + worldObj.spawnParticle("smoke", xCoord + 0.5 + vec.xCoord, yCoord + 2.0625, zCoord + 0.5 + vec.zCoord, 0, 0, 0); } - + if(this.spin >= 360F) { this.spin -= 360F; this.lastSpin -= 360F; @@ -201,7 +197,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN this.prevRotationYaw = this.rotationYaw; this.prevRotationPitch = this.rotationPitch; - + if(this.turnProgress > 0) { double d0 = MathHelper.wrapAngleTo180_double(this.syncYaw - (double) this.rotationYaw); double d1 = MathHelper.wrapAngleTo180_double(this.syncPitch - (double) this.rotationPitch); @@ -214,30 +210,30 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN } } } - + /** Anything additionally that the detector nor the blades should pick up on, like non-mature willows */ public static boolean shouldIgnore(Block b, int meta) { if(b == ModBlocks.plant_tall) { return meta == EnumTallFlower.CD2.ordinal() + 8 || meta == EnumTallFlower.CD3.ordinal() + 8; } - + return false; } - + protected void tryInteract(int x, int y, int z) { - + Block b = worldObj.getBlock(x, y, z); int meta = worldObj.getBlockMetadata(x, y, z); - + if(shouldIgnore(b, meta)) { return; } - + if(b.getMaterial() == Material.leaves || b.getMaterial() == Material.plants) { worldObj.func_147480_a(x, y, z, true); return; } - + if(b.getMaterial() == Material.wood) { fellTree(x, y, z); if(state == 1) { @@ -245,22 +241,22 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN } } } - + protected void fellTree(int x, int y, int z) { - + if(worldObj.getBlock(x, y - 1, z).getMaterial() == Material.wood) { y--; if(worldObj.getBlock(x, y - 2, z).getMaterial() == Material.wood) { y--; } } - + int meta = -1; - + for(int i = y; i < y + 10; i++) { - + int[][] dir = new int[][] {{0, 0}, {1, 0}, {-1, 0}, {0, 1}, {0, -1}}; - + for(int[] d : dir) { Block b = worldObj.getBlock(x + d[0], i, z + d[1]); @@ -272,7 +268,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN } } } - + if(meta >= 0) { if(Blocks.sapling.canPlaceBlockAt(worldObj, x, y, z)) { worldObj.setBlock(x, y, z, Blocks.sapling, meta, 3); @@ -281,14 +277,22 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.isOn = nbt.getBoolean("isOn"); - this.syncYaw = nbt.getFloat("yaw"); - this.syncPitch = nbt.getFloat("pitch"); - this.turnProgress = 3; //use 3-ply for extra smoothness - this.tank.readFromNBT(nbt, "t"); + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.isOn); + buf.writeFloat(this.rotationYaw); + buf.writeFloat(this.rotationPitch); + this.tank.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + this.isOn = buf.readBoolean(); + this.syncYaw = buf.readFloat(); + this.syncPitch = buf.readFloat(); + this.turnProgress = 3; //use 3-ply for extra smoothness + this.tank.deserialize(buf); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -298,7 +302,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN this.state = nbt.getInteger("state"); this.tank.readFromNBT(nbt, "t"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -318,12 +322,12 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN public FluidTank[] getReceivingTanks() { return new FluidTank[] {tank}; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 12, @@ -334,10 +338,10 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IN zCoord + 13 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java index ebcb7381b..aeb067770 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCentrifuge.java @@ -1,12 +1,13 @@ package com.hbm.tileentity.machine; import java.io.IOException; +import java.util.HashMap; import java.util.List; import com.google.gson.JsonObject; import com.google.gson.stream.JsonWriter; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerCentrifuge; import com.hbm.inventory.gui.GUIMachineCentrifuge; import com.hbm.inventory.recipes.CentrifugeRecipes; @@ -38,12 +39,12 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineCentrifuge extends TileEntityMachineBase implements IEnergyReceiverMK2, IGUIProvider, IUpgradeInfoProvider, IInfoProviderEC, IConfigurableMachine{ - + public int progress; public long power; public boolean isProgressing; private int audioDuration = 0; - + private AudioWrapper audio; //configurable values @@ -51,6 +52,8 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement public static int processingSpeed = 200; public static int baseConsumption = 200; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public String getConfigName() { return "centrifuge"; } @@ -70,7 +73,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement /* * So why do we do this now? You have a funny mekanism/thermal/whatever pipe and you want to output stuff from a side - * that isn't the bottom, what do? Answer: make all slots accessible from all sides and regulate in/output in the + * that isn't the bottom, what do? Answer: make all slots accessible from all sides and regulate in/output in the * dedicated methods. Duh. */ private static final int[] slot_io = new int[] { 0, 2, 3, 4, 5 }; @@ -78,11 +81,11 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement public TileEntityMachineCentrifuge() { super(8); } - + public String getName() { return "container.centrifuge"; } - + @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { return i == 0; @@ -126,7 +129,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement return false; } ItemStack[] out = CentrifugeRecipes.getOutput(slots[0]); - + if(out == null) { return false; } @@ -175,7 +178,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement public boolean isProcessing() { return this.progress > 0; } - + @Override public void updateEntity() { @@ -184,18 +187,18 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); power = Library.chargeTEFromItems(slots, 1, power, maxPower); - + int consumption = baseConsumption; int speed = 1; - - UpgradeManager.eval(slots, 6, 7); - speed += Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - consumption += Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) * baseConsumption; - - speed *= (1 + Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 5); - consumption += Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * baseConsumption * 50; - - consumption /= (1 + Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3)); + + upgradeManager.checkSlots(this, slots, 6, 7); + speed += upgradeManager.getLevel(UpgradeType.SPEED); + consumption += upgradeManager.getLevel(UpgradeType.SPEED) * baseConsumption; + + speed *= (1 + upgradeManager.getLevel(UpgradeType.OVERDRIVE) * 5); + consumption += upgradeManager.getLevel(UpgradeType.OVERDRIVE) * baseConsumption * 50; + + consumption /= (1 + upgradeManager.getLevel(UpgradeType.POWER)); if(hasPower() && isProcessing()) { this.power -= consumption; @@ -221,20 +224,20 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement } else { progress = 0; } - + this.networkPackNT(50); } else { - + if(isProgressing) { audioDuration += 2; } else { audioDuration -= 3; } - + audioDuration = MathHelper.clamp_int(audioDuration, 0, 60); - + if(audioDuration > 10) { - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -244,9 +247,9 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement audio.updateVolume(getVolume(1F)); audio.updatePitch((audioDuration - 10) / 100F + 0.5F); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -254,7 +257,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement } } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -262,7 +265,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement buf.writeInt(progress); buf.writeBoolean(isProgressing); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -295,12 +298,12 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement audio = null; } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord, @@ -311,7 +314,7 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement zCoord + 1 ); } - + return bb; } @@ -369,11 +372,12 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; } @Override @@ -381,4 +385,4 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement data.setBoolean(CompatEnergyControl.B_ACTIVE, this.progress > 0); data.setInteger(CompatEnergyControl.B_ACTIVE, this.progress); } -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java index c1f38d691..e845b225b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java @@ -1,12 +1,13 @@ package com.hbm.tileentity.machine; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Random; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerChemfac; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -33,7 +34,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase implements IUpgradeInfoProvider, IFluidCopiable { - + float rotSpeed; public float rot; public float prevRot; @@ -41,6 +42,8 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp public FluidTank water; public FluidTank steam; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineChemfac() { super(77); @@ -51,7 +54,7 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && i >= 1 && i <= 4 && stack.getItem() instanceof ItemMachineUpgrade) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -60,14 +63,14 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp @Override public void updateEntity() { super.updateEntity(); - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 60 == 0) { - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - + for(FluidTank tank : inTanks()) { if(tank.getTankType() != Fluids.NONE) { this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); @@ -75,77 +78,77 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp } } } - + for(DirPos pos : getConPos()) for(FluidTank tank : outTanks()) { if(tank.getTankType() != Fluids.NONE && tank.getFill() > 0) { this.sendFluid(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + this.speed = 100; this.consumption = 100; - - UpgradeManager.eval(slots, 1, 4); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 6); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - + upgradeManager.checkSlots(this, slots, 1, 4); + + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + this.speed -= speedLevel * 15; this.consumption += speedLevel * 300; this.speed += powerLevel * 5; this.consumption -= powerLevel * 20; this.speed /= (overLevel + 1); this.consumption *= (overLevel + 1); - + if(this.speed <= 0) { this.speed = 1; } - + this.networkPackNT(150); } else { - + float maxSpeed = 30F; - + if(isProgressing) { - + rotSpeed += 0.1; - + if(rotSpeed > maxSpeed) rotSpeed = maxSpeed; - + if(rotSpeed == maxSpeed && this.worldObj.getTotalWorldTime() % 5 == 0) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); Random rand = worldObj.rand; - + double x = xCoord + 0.5 - rot.offsetX * 0.5; double y = yCoord + 3; double z = zCoord + 0.5 - rot.offsetZ * 0.5; - + worldObj.spawnParticle("cloud", x + dir.offsetX * 1.5 + rand.nextGaussian() * 0.15, y, z + dir.offsetZ * 1.5 + rand.nextGaussian() * 0.15, 0.0, 0.15, 0.0); worldObj.spawnParticle("cloud", x - dir.offsetX * 0.5 + rand.nextGaussian() * 0.15, y, z - dir.offsetZ * 0.5 + rand.nextGaussian() * 0.15, 0.0, 0.15, 0.0); } } else { - + rotSpeed -= 0.1; - + if(rotSpeed < 0) rotSpeed = 0; } - + prevRot = rot; - + rot += rotSpeed; - + if(rot >= 360) { rot -= 360; prevRot -= 360; } } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -154,15 +157,15 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp buf.writeInt(progress[i]); buf.writeInt(maxProgress[i]); } - + buf.writeBoolean(isProgressing); - + for(int i = 0; i < tanks.length; i++) tanks[i].serialize(buf); - + water.serialize(buf); steam.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -171,15 +174,15 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp progress[i] = buf.readInt(); maxProgress[i] = buf.readInt(); } - + isProgressing = buf.readBoolean(); - + for(int i = 0; i < tanks.length; i++) tanks[i].deserialize(buf); - + water.deserialize(buf); steam.deserialize(buf); } - + private int getWaterRequired() { return 1000 / this.speed; } @@ -201,19 +204,19 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp public long getMaxPower() { return 10_000_000; } - + protected List conPos; - + protected List getConPos() { - + if(conPos != null && !conPos.isEmpty()) return conPos; - + conPos = new ArrayList(); ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + for(int i = 0; i < 6; i++) { conPos.add(new DirPos(xCoord + dir.offsetX * (3 - i) + rot.offsetX * 3, yCoord + 4, zCoord + dir.offsetZ * (3 - i) + rot.offsetZ * 3, Library.POS_Y)); conPos.add(new DirPos(xCoord + dir.offsetX * (3 - i) - rot.offsetX * 2, yCoord + 4, zCoord + dir.offsetZ * (3 - i) - rot.offsetZ * 2, Library.POS_Y)); @@ -223,7 +226,7 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp conPos.add(new DirPos(xCoord + dir.offsetX * (3 - i) - rot.offsetX * 4, yCoord + 1 + j, zCoord + dir.offsetZ * (3 - i) - rot.offsetZ * 4, rot.getOpposite())); } } - + return conPos; } @@ -249,52 +252,52 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp DirPos[] inpos; DirPos[] outpos; - + @Override public DirPos[] getInputPositions() { - + if(inpos != null) return inpos; - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + inpos = new DirPos[] { new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 1, dir), new DirPos(xCoord - dir.offsetX * 5 + rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 5 + rot.offsetZ * 2, dir.getOpposite()), new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 4, rot.getOpposite()), new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX * 5, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * 5, rot) }; - + return inpos; } @Override public DirPos[] getOutputPositions() { - + if(outpos != null) return outpos; - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + outpos = new DirPos[] { new DirPos(xCoord + dir.offsetX * 4 + rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 4 + rot.offsetZ * 2, dir), new DirPos(xCoord - dir.offsetX * 5 - rot.offsetX * 1, yCoord, zCoord - dir.offsetZ * 5 - rot.offsetZ * 1, dir.getOpposite()), new DirPos(xCoord + dir.offsetX * 1 - rot.offsetX * 4, yCoord, zCoord + dir.offsetZ * 1 - rot.offsetZ * 4, rot.getOpposite()), new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 5, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * 5, rot) }; - + return outpos; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); water.readFromNBT(nbt, "w"); steam.readFromNBT(nbt, "s"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -309,27 +312,27 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp @Override protected List inTanks() { - + List inTanks = super.inTanks(); inTanks.add(water); - + return inTanks; } @Override protected List outTanks() { - + List outTanks = super.outTanks(); outTanks.add(steam); - + return outTanks; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 5, @@ -340,10 +343,10 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp zCoord + 5 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -383,11 +386,12 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 6; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 12; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 6); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 12); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java index 256b98e1f..d352430a5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.inventory.RecipesCommon.AStack; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineChemplant; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -49,15 +50,17 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements public int progress; public int maxProgress = 100; public boolean isProgressing; - + private AudioWrapper audio; - + public FluidTank[] tanks; - + //upgraded stats int consumption = 100; int speed = 100; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineChemplant() { super(21); /* @@ -71,7 +74,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements * 17-18 FIn In * 19-20 FIn Out */ - + tanks = new FluidTank[4]; for(int i = 0; i < 4; i++) { tanks[i] = new FluidTank(Fluids.NONE, 24_000); @@ -82,7 +85,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements public String getName() { return "container.chemplant"; } - + // last successful load int lsl0 = 0; int lsl1 = 0; @@ -91,23 +94,23 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.speed = 100; this.consumption = 100; - + this.isProgressing = false; this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); int fluidDelay = 40; - + if(lsu0 >= fluidDelay && tanks[0].loadTank(17, 19, slots)) lsl0 = 0; if(lsu1 >= fluidDelay && tanks[1].loadTank(18, 20, slots)) lsl1 = 0; - + if(lsl0 >= fluidDelay && slots[17] != null && !FluidTank.noDualUnload.contains(slots[17].getItem())) if(tanks[0].unloadTank(17, 19, slots)) lsu0 = 0; if(lsl1 >= fluidDelay && slots[18] != null && !FluidTank.noDualUnload.contains(slots[18].getItem())) if(tanks[1].unloadTank(18, 20, slots)) lsu1 = 0; - + tanks[2].unloadTank(9, 11, slots); tanks[3].unloadTank(10, 12, slots); @@ -115,48 +118,48 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements if(lsl1 < fluidDelay) lsl1++; if(lsu0 < fluidDelay) lsu0++; if(lsu1 < fluidDelay) lsu1++; - + loadItems(); unloadItems(); - + if(worldObj.getTotalWorldTime() % 20 == 0) { this.updateConnections(); } - + for(DirPos pos : getConPos()) { if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tanks[3].getFill() > 0) this.sendFluid(tanks[3], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - UpgradeManager.eval(slots, 1, 3); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - + upgradeManager.checkSlots(this, slots, 1, 3); + + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + this.speed -= speedLevel * 25; this.consumption += speedLevel * 300; this.speed += powerLevel * 5; this.consumption -= powerLevel * 20; this.speed /= (overLevel + 1); this.consumption *= (overLevel + 1); - + if(this.speed <= 0) { this.speed = 1; } - + if(!canProcess()) { this.progress = 0; } else { isProgressing = true; process(); } - + this.networkPackNT(150); } else { - + if(isProgressing && this.worldObj.getTotalWorldTime() % 3 == 0) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); double x = xCoord + 0.5 + dir.offsetX * 1.125 + rot.offsetX * 0.125; @@ -164,11 +167,11 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements double z = zCoord + 0.5 + dir.offsetZ * 1.125 + rot.offsetZ * 0.125; worldObj.spawnParticle("cloud", x, y, z, 0.0, 0.1, 0.0); } - + float volume = this.getVolume(1F); - + if(isProgressing && volume > 0) { - + if(audio == null) { audio = this.createAudioLoop(); audio.updateVolume(volume); @@ -177,9 +180,9 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements audio = rebootAudio(audio); audio.updateVolume(volume); } - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -199,7 +202,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements for(int i = 0; i < tanks.length; i++) tanks[i].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -211,7 +214,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements for(int i = 0; i < tanks.length; i++) tanks[i].deserialize(buf); } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.chemplantOperate", xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F); @@ -236,21 +239,21 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements audio = null; } } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + public DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + return new DirPos[] { new DirPos(xCoord + rot.offsetX * 3, yCoord, zCoord + rot.offsetZ * 3, rot), new DirPos(xCoord - rot.offsetX * 2, yCoord, zCoord - rot.offsetZ * 2, rot.getOpposite()), @@ -258,69 +261,69 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements new DirPos(xCoord - rot.offsetX * 2 + dir.offsetX, yCoord, zCoord - rot.offsetZ * 2 + dir.offsetZ, rot.getOpposite()) }; } - + private boolean canProcess() { - + if(slots[4] == null || slots[4].getItem() != ModItems.chemistry_template) return false; - + ChemRecipe recipe = ChemplantRecipes.indexMapping.get(slots[4].getItemDamage()); - + if(recipe == null) return false; - + setupTanks(recipe); - + if(this.power < this.consumption) return false; if(!hasRequiredFluids(recipe)) return false; if(!hasSpaceForFluids(recipe)) return false; if(!hasRequiredItems(recipe)) return false; if(!hasSpaceForItems(recipe)) return false; - + return true; } - + private void setupTanks(ChemRecipe recipe) { if(recipe.inputFluids[0] != null) tanks[0].withPressure(recipe.inputFluids[0].pressure).setTankType(recipe.inputFluids[0].type); else tanks[0].setTankType(Fluids.NONE); if(recipe.inputFluids[1] != null) tanks[1].withPressure(recipe.inputFluids[1].pressure).setTankType(recipe.inputFluids[1].type); else tanks[1].setTankType(Fluids.NONE); if(recipe.outputFluids[0] != null) tanks[2].withPressure(recipe.outputFluids[0].pressure).setTankType(recipe.outputFluids[0].type); else tanks[2].setTankType(Fluids.NONE); if(recipe.outputFluids[1] != null) tanks[3].withPressure(recipe.outputFluids[1].pressure).setTankType(recipe.outputFluids[1].type); else tanks[3].setTankType(Fluids.NONE); } - + private boolean hasRequiredFluids(ChemRecipe recipe) { if(recipe.inputFluids[0] != null && tanks[0].getFill() < recipe.inputFluids[0].fill) return false; if(recipe.inputFluids[1] != null && tanks[1].getFill() < recipe.inputFluids[1].fill) return false; return true; } - + private boolean hasSpaceForFluids(ChemRecipe recipe) { if(recipe.outputFluids[0] != null && tanks[2].getFill() + recipe.outputFluids[0].fill > tanks[2].getMaxFill()) return false; if(recipe.outputFluids[1] != null && tanks[3].getFill() + recipe.outputFluids[1].fill > tanks[3].getMaxFill()) return false; return true; } - + private boolean hasRequiredItems(ChemRecipe recipe) { return InventoryUtil.doesArrayHaveIngredients(slots, 13, 16, recipe.inputs); } - + private boolean hasSpaceForItems(ChemRecipe recipe) { return InventoryUtil.doesArrayHaveSpace(slots, 5, 8, recipe.outputs); } - + private void process() { - + this.power -= this.consumption; this.progress++; - + if(slots[0] != null && slots[0].getItem() == ModItems.meteorite_sword_machined) slots[0] = new ItemStack(ModItems.meteorite_sword_treated); //fisfndmoivndlmgindgifgjfdnblfm - + ChemRecipe recipe = ChemplantRecipes.indexMapping.get(slots[4].getItemDamage()); - + this.maxProgress = recipe.getDuration() * this.speed / 100; - + if(maxProgress <= 0) maxProgress = 1; - + if(this.progress >= this.maxProgress) { consumeFluids(recipe); produceFluids(recipe); @@ -330,81 +333,81 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements this.markDirty(); } } - + private void consumeFluids(ChemRecipe recipe) { if(recipe.inputFluids[0] != null) tanks[0].setFill(tanks[0].getFill() - recipe.inputFluids[0].fill); if(recipe.inputFluids[1] != null) tanks[1].setFill(tanks[1].getFill() - recipe.inputFluids[1].fill); } - + private void produceFluids(ChemRecipe recipe) { if(recipe.outputFluids[0] != null) tanks[2].setFill(tanks[2].getFill() + recipe.outputFluids[0].fill); if(recipe.outputFluids[1] != null) tanks[3].setFill(tanks[3].getFill() + recipe.outputFluids[1].fill); } - + private void consumeItems(ChemRecipe recipe) { - + for(AStack in : recipe.inputs) { if(in != null) InventoryUtil.tryConsumeAStack(slots, 13, 16, in); } } - + private void produceItems(ChemRecipe recipe) { - + for(ItemStack out : recipe.outputs) { if(out != null) InventoryUtil.tryAddItemToInventory(slots, 5, 8, out.copy()); } } - + //TODO: move this into a util class private void loadItems() { - + if(slots[4] == null || slots[4].getItem() != ModItems.chemistry_template) return; - + ChemRecipe recipe = ChemplantRecipes.indexMapping.get(slots[4].getItemDamage()); - + if(recipe != null) { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); int x = xCoord - dir.offsetX * 2; int z = zCoord - dir.offsetZ * 2; - + TileEntity te = worldObj.getTileEntity(x, yCoord, z); - + if(te instanceof IInventory) { - + IInventory inv = (IInventory) te; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(dir.ordinal()) : null; - + for(AStack ingredient : recipe.inputs) { - + outer: while(!InventoryUtil.doesArrayHaveIngredients(slots, 13, 16, ingredient)) { - + boolean found = false; - + for(int i = 0; i < (access != null ? access.length : inv.getSizeInventory()); i++) { int slot = access != null ? access[i] : i; ItemStack stack = inv.getStackInSlot(slot); - + if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(slot, stack, 0))) { - + for(int j = 13; j <= 16; j++) { - + if(slots[j] != null && slots[j].stackSize < slots[j].getMaxStackSize() & InventoryUtil.doesStackDataMatch(slots[j], stack)) { inv.decrStackSize(slot, 1); slots[j].stackSize++; continue outer; } } - + for(int j = 13; j <= 16; j++) { - + if(slots[j] == null) { slots[j] = stack.copy(); slots[j].stackSize = 1; @@ -421,43 +424,43 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements } } } - + private void unloadItems() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); int x = xCoord + dir.offsetX * 3 + rot.offsetX; int z = zCoord + dir.offsetZ * 3 + rot.offsetZ; - + TileEntity te = worldObj.getTileEntity(x, yCoord, z); - + if(te instanceof IInventory) { - + IInventory inv = (IInventory) te; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(dir.ordinal()) : null; - + boolean shouldOutput = true; - + while(shouldOutput) { shouldOutput = false; outer: for(int i = 5; i <= 8; i++) { - + ItemStack out = slots[i]; - + if(out != null) { - + for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) { - + int slot = access != null ? access[j] : j; - + if(!inv.isItemValidForSlot(slot, out)) continue; - + ItemStack target = inv.getStackInSlot(slot); - + if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit())) { int toDec = Math.min(out.stackSize, Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit()) - target.stackSize); this.decrStackSize(i, toDec); @@ -466,14 +469,14 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements break outer; } } - + for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) { - + int slot = access != null ? access[j] : j; - + if(!inv.isItemValidForSlot(slot, out)) continue; - + if(inv.getStackInSlot(slot) == null && (sided != null ? sided.canInsertItem(slot, out, dir.ordinal()) : inv.isItemValidForSlot(slot, out))) { ItemStack copy = out.copy(); copy.stackSize = 1; @@ -503,36 +506,36 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements public long getMaxPower() { return maxPower; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); this.progress = nbt.getInteger("progress"); - + for(int i = 0; i < tanks.length; i++) { tanks[i].readFromNBT(nbt, "t" + i); } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setInteger("progress", progress); - + for(int i = 0; i < tanks.length; i++) { tanks[i].writeToNBT(nbt, "t" + i); } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -543,10 +546,10 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -601,10 +604,11 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 9; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 9); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java index 77eb13f89..64930bf2d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java @@ -1,6 +1,7 @@ package com.hbm.tileentity.machine; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import com.hbm.inventory.RecipesCommon.AStack; @@ -14,6 +15,7 @@ import com.hbm.lib.Library; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.InventoryUtil; +import com.hbm.util.ItemStackUtil; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; @@ -38,20 +40,20 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa public int[] progress; public int[] maxProgress; public boolean isProgressing; - + public FluidTank[] tanks; - + int consumption = 100; int speed = 100; public TileEntityMachineChemplantBase(int scount) { super(scount); - + int count = this.getRecipeCount(); progress = new int[count]; maxProgress = new int[count]; - + tanks = new FluidTank[4 * count]; for(int i = 0; i < 4 * count; i++) { tanks[i] = new FluidTank(Fluids.NONE, getTankCapacity()); @@ -60,20 +62,20 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + int count = this.getRecipeCount(); - + this.isProgressing = false; this.power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower()); - + for(int i = 0; i < count; i++) { loadItems(i); unloadItems(i); } - + for(int i = 0; i < count; i++) { if(!canProcess(i)) { this.progress[i] = 0; @@ -84,74 +86,83 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa } } } - + protected boolean canProcess(int index) { - + int template = getTemplateIndex(index); - + if(slots[template] == null || slots[template].getItem() != ModItems.chemistry_template) return false; - + ChemRecipe recipe = ChemplantRecipes.indexMapping.get(slots[template].getItemDamage()); - + if(recipe == null) return false; - + setupTanks(recipe, index); - + if(this.power < this.consumption) return false; if(!hasRequiredFluids(recipe, index)) return false; if(!hasSpaceForFluids(recipe, index)) return false; if(!hasRequiredItems(recipe, index)) return false; if(!hasSpaceForItems(recipe, index)) return false; - + return true; } - + private void setupTanks(ChemRecipe recipe, int index) { if(recipe.inputFluids[0] != null) tanks[index * 4].withPressure(recipe.inputFluids[0].pressure).setTankType(recipe.inputFluids[0].type); else tanks[index * 4].setTankType(Fluids.NONE); if(recipe.inputFluids[1] != null) tanks[index * 4 + 1].withPressure(recipe.inputFluids[1].pressure).setTankType(recipe.inputFluids[1].type); else tanks[index * 4 + 1].setTankType(Fluids.NONE); if(recipe.outputFluids[0] != null) tanks[index * 4 + 2].withPressure(recipe.outputFluids[0].pressure).setTankType(recipe.outputFluids[0].type); else tanks[index * 4 + 2].setTankType(Fluids.NONE); if(recipe.outputFluids[1] != null) tanks[index * 4 + 3].withPressure(recipe.outputFluids[1].pressure).setTankType(recipe.outputFluids[1].type); else tanks[index * 4 + 3].setTankType(Fluids.NONE); } - + private boolean hasRequiredFluids(ChemRecipe recipe, int index) { if(recipe.inputFluids[0] != null && tanks[index * 4].getFill() < recipe.inputFluids[0].fill) return false; if(recipe.inputFluids[1] != null && tanks[index * 4 + 1].getFill() < recipe.inputFluids[1].fill) return false; return true; } - + private boolean hasSpaceForFluids(ChemRecipe recipe, int index) { if(recipe.outputFluids[0] != null && tanks[index * 4 + 2].getFill() + recipe.outputFluids[0].fill > tanks[index * 4 + 2].getMaxFill()) return false; if(recipe.outputFluids[1] != null && tanks[index * 4 + 3].getFill() + recipe.outputFluids[1].fill > tanks[index * 4 + 3].getMaxFill()) return false; return true; } - + + public HashMap cachedItems = new HashMap<>(); + private boolean hasRequiredItems(ChemRecipe recipe, int index) { int[] indices = getSlotIndicesFromIndex(index); - return InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.inputs); + ItemStack[] copy = ItemStackUtil.carefulCopyArrayTruncate(slots, indices[0], indices[1]); + if (cachedItems.get(copy) != null) + return cachedItems.get(copy); + else { + boolean hasItems = InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], recipe.inputs); + cachedItems.put(copy, hasItems); + return hasItems; + } } - + private boolean hasSpaceForItems(ChemRecipe recipe, int index) { int[] indices = getSlotIndicesFromIndex(index); return InventoryUtil.doesArrayHaveSpace(slots, indices[2], indices[3], recipe.outputs); } - + protected void process(int index) { - + this.power -= this.consumption; this.progress[index]++; - + if(slots[0] != null && slots[0].getItem() == ModItems.meteorite_sword_machined) slots[0] = new ItemStack(ModItems.meteorite_sword_treated); //fisfndmoivndlmgindgifgjfdnblfm - + int template = getTemplateIndex(index); ChemRecipe recipe = ChemplantRecipes.indexMapping.get(slots[template].getItemDamage()); - + this.maxProgress[index] = recipe.getDuration() * this.speed / 100; - + if(maxProgress[index] <= 0) maxProgress[index] = 1; - + if(this.progress[index] >= this.maxProgress[index]) { consumeFluids(recipe, index); produceFluids(recipe, index); @@ -161,84 +172,84 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa this.markDirty(); } } - + private void consumeFluids(ChemRecipe recipe, int index) { if(recipe.inputFluids[0] != null) tanks[index * 4].setFill(tanks[index * 4].getFill() - recipe.inputFluids[0].fill); if(recipe.inputFluids[1] != null) tanks[index * 4 + 1].setFill(tanks[index * 4 + 1].getFill() - recipe.inputFluids[1].fill); } - + private void produceFluids(ChemRecipe recipe, int index) { if(recipe.outputFluids[0] != null) tanks[index * 4 + 2].setFill(tanks[index * 4 + 2].getFill() + recipe.outputFluids[0].fill); if(recipe.outputFluids[1] != null) tanks[index * 4 + 3].setFill(tanks[index * 4 + 3].getFill() + recipe.outputFluids[1].fill); } - + private void consumeItems(ChemRecipe recipe, int index) { - + int[] indices = getSlotIndicesFromIndex(index); - + for(AStack in : recipe.inputs) { if(in != null) InventoryUtil.tryConsumeAStack(slots, indices[0], indices[1], in); } } - + private void produceItems(ChemRecipe recipe, int index) { - + int[] indices = getSlotIndicesFromIndex(index); - + for(ItemStack out : recipe.outputs) { if(out != null) InventoryUtil.tryAddItemToInventory(slots, indices[2], indices[3], out.copy()); } } - + private void loadItems(int index) { - + int template = getTemplateIndex(index); if(slots[template] == null || slots[template].getItem() != ModItems.chemistry_template) return; - + ChemRecipe recipe = ChemplantRecipes.indexMapping.get(slots[template].getItemDamage()); - + if(recipe != null) { - + DirPos[] positions = getInputPositions(); int[] indices = getSlotIndicesFromIndex(index); - + for(DirPos coord : positions) { TileEntity te = worldObj.getTileEntity(coord.getX(), coord.getY(), coord.getZ()); - + if(te instanceof IInventory) { - + IInventory inv = (IInventory) te; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(coord.getDir().ordinal()) : null; - + for(AStack ingredient : recipe.inputs) { - + outer: while(!InventoryUtil.doesArrayHaveIngredients(slots, indices[0], indices[1], ingredient)) { - + boolean found = false; - + for(int i = 0; i < (access != null ? access.length : inv.getSizeInventory()); i++) { int slot = access != null ? access[i] : i; ItemStack stack = inv.getStackInSlot(slot); if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(slot, stack, 0))) { - + for(int j = indices[0]; j <= indices[1]; j++) { - + if(slots[j] != null && slots[j].stackSize < slots[j].getMaxStackSize() & InventoryUtil.doesStackDataMatch(slots[j], stack)) { inv.decrStackSize(slot, 1); slots[j].stackSize++; continue outer; } } - + for(int j = indices[0]; j <= indices[1]; j++) { - + if(slots[j] == null) { slots[j] = stack.copy(); slots[j].stackSize = 1; @@ -256,18 +267,18 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa } } } - + private void unloadItems(int index) { DirPos[] positions = getOutputPositions(); int[] indices = getSlotIndicesFromIndex(index); - + for(DirPos coord : positions) { TileEntity te = worldObj.getTileEntity(coord.getX(), coord.getY(), coord.getZ()); - + if(te instanceof IInventory) { - + IInventory inv = (IInventory) te; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(coord.getDir().ordinal()) : null; @@ -277,20 +288,20 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa shouldOutput = false; outer: for(int i = indices[2]; i <= indices[3]; i++) { - + ItemStack out = slots[i]; - + if(out != null) { - + for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) { - + int slot = access != null ? access[j] : j; - + if(!inv.isItemValidForSlot(slot, out)) continue; - + ItemStack target = inv.getStackInSlot(slot); - + if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) { int toDec = Math.min(out.stackSize, Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit()) - target.stackSize); this.decrStackSize(i, toDec); @@ -299,14 +310,14 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa break outer; } } - + for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) { - + int slot = access != null ? access[j] : j; - + if(!inv.isItemValidForSlot(slot, out)) continue; - + if(inv.getStackInSlot(slot) == null && (sided != null ? sided.canInsertItem(slot, out, coord.getDir().ordinal()) : inv.isItemValidForSlot(slot, out))) { ItemStack copy = out.copy(); copy.stackSize = 1; @@ -334,105 +345,105 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa } /*public int getFluidFill(FluidType type) { - + int fill = 0; - + for(FluidTank tank : inTanks()) { if(tank.getTankType() == type) { fill += tank.getFill(); } } - + for(FluidTank tank : outTanks()) { if(tank.getTankType() == type) { fill += tank.getFill(); } } - + return fill; }*/ /* For input only! */ public int getMaxFluidFill(FluidType type) { - + int maxFill = 0; - + for(FluidTank tank : inTanks()) { if(tank.getTankType() == type) { maxFill += tank.getMaxFill(); } } - + return maxFill; } - + protected List inTanks() { List inTanks = new ArrayList(); - + for(int i = 0; i < tanks.length; i++) { FluidTank tank = tanks[i]; if(i % 4 < 2) { inTanks.add(tank); } } - + return inTanks; } /*public void receiveFluid(int amount, FluidType type) { - + if(amount <= 0) return; - + List rec = new ArrayList(); - + for(FluidTank tank : inTanks()) { if(tank.getTankType() == type) { rec.add(tank); } } - + if(rec.size() == 0) return; - + int demand = 0; List weight = new ArrayList(); - + for(FluidTank tank : rec) { int fillWeight = tank.getMaxFill() - tank.getFill(); demand += fillWeight; weight.add(fillWeight); } - + for(int i = 0; i < rec.size(); i++) { - + if(demand <= 0) break; - + FluidTank tank = rec.get(i); int fillWeight = weight.get(i); int part = (int) (Math.min((long)amount, (long)demand) * (long)fillWeight / (long)demand); - + tank.setFill(tank.getFill() + part); } }*/ public int getFluidFillForTransfer(FluidType type, int pressure) { - + int fill = 0; - + for(FluidTank tank : outTanks()) { if(tank.getTankType() == type && tank.getPressure() == pressure) { fill += tank.getFill(); } } - + return fill; } - + public void transferFluid(int amount, FluidType type, int pressure) { - + /* * this whole new fluid mumbo jumbo extra abstraction layer might just be a bandaid * on the gushing wound that is the current fluid systemm but i'll be damned if it @@ -441,44 +452,44 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa */ if(amount <= 0) return; - + List send = new ArrayList(); - + for(FluidTank tank : outTanks()) { if(tank.getTankType() == type && tank.getPressure() == pressure) { send.add(tank); } } - + if(send.size() == 0) return; - + int offer = 0; List weight = new ArrayList(); - + for(FluidTank tank : send) { int fillWeight = tank.getFill(); offer += fillWeight; weight.add(fillWeight); } - + int tracker = amount; - + for(int i = 0; i < send.size(); i++) { - + FluidTank tank = send.get(i); int fillWeight = weight.get(i); int part = amount * fillWeight / offer; - + tank.setFill(tank.getFill() - part); tracker -= part; } - + //making sure to properly deduct even the last mB lost by rounding errors for(int i = 0; i < 100 && tracker > 0; i++) { - + FluidTank tank = send.get(i % send.size()); - + if(tank.getFill() > 0) { int total = Math.min(tank.getFill(), tracker); tracker -= total; @@ -486,18 +497,18 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa } } } - + protected List outTanks() { - + List outTanks = new ArrayList(); - + for(int i = 0; i < tanks.length; i++) { FluidTank tank = tanks[i]; if(i % 4 > 1) { outTanks.add(tank); } } - + return outTanks; } @@ -509,43 +520,43 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa @Override public long transferFluid(FluidType type, int pressure, long fluid) { int amount = (int) fluid; - + if(amount <= 0) return 0; - + List rec = new ArrayList(); - + for(FluidTank tank : inTanks()) { if(tank.getTankType() == type && tank.getPressure() == pressure) { rec.add(tank); } } - + if(rec.size() == 0) return fluid; - + int demand = 0; List weight = new ArrayList(); - + for(FluidTank tank : rec) { int fillWeight = tank.getMaxFill() - tank.getFill(); demand += fillWeight; weight.add(fillWeight); } - + for(int i = 0; i < rec.size(); i++) { - + if(demand <= 0) break; - + FluidTank tank = rec.get(i); int fillWeight = weight.get(i); int part = (int) (Math.min((long)amount, (long)demand) * (long)fillWeight / (long)demand); - + tank.setFill(tank.getFill() + part); fluid -= part; } - + return fluid; } @@ -563,29 +574,29 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa public void removeFluidForTransfer(FluidType type, int pressure, long amount) { this.transferFluid((int) amount, type, pressure); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); this.progress = nbt.getIntArray("progress"); - + if(progress.length == 0) progress = new int[this.getRecipeCount()]; - + for(int i = 0; i < tanks.length; i++) { tanks[i].readFromNBT(nbt, "t" + i); } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setIntArray("progress", progress); - + for(int i = 0; i < tanks.length; i++) { tanks[i].writeToNBT(nbt, "t" + i); } @@ -594,7 +605,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa public abstract int getRecipeCount(); public abstract int getTankCapacity(); public abstract int getTemplateIndex(int index); - + /** * @param index * @return A size 4 int array containing min input, max input, min output and max output indices in that order. diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCombustionEngine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCombustionEngine.java index 788629924..7c56a59f1 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCombustionEngine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCombustionEngine.java @@ -24,6 +24,7 @@ import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -33,19 +34,19 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineCombustionEngine extends TileEntityMachinePolluting implements IEnergyProviderMK2, IFluidStandardTransceiver, IControlReceiver, IGUIProvider, IFluidCopiable { - + public boolean isOn = false; public static long maxPower = 2_500_000; public long power; private int playersUsing = 0; public int setting = 0; public boolean wasOn = false; - + public float doorAngle = 0; public float prevDoorAngle = 0; - + private AudioWrapper audio; - + public FluidTank tank; public int tenth = 0; @@ -61,26 +62,26 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.tank.loadTank(0, 1, slots); if(this.tank.setType(4, slots)) { this.tenth = 0; } - + wasOn = false; int fill = tank.getFill() * 10 + tenth; if(isOn && setting > 0 && slots[2] != null && slots[2].getItem() == ModItems.piston_set && fill > 0 && tank.getTankType().hasTrait(FT_Combustible.class)) { EnumPistonType piston = EnumUtil.grabEnumSafely(EnumPistonType.class, slots[2].getItemDamage()); FT_Combustible trait = tank.getTankType().getTrait(FT_Combustible.class); - + double eff = piston.eff[trait.getGrade().ordinal()]; - + if(eff > 0) { int speed = setting * 2; - + int toBurn = Math.min(fill, speed); this.power += toBurn * (trait.getCombustionEnergy() / 10_000D) * eff; fill -= toBurn; @@ -88,51 +89,46 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin if(worldObj.getTotalWorldTime() % 5 == 0 && toBurn > 0) { super.pollute(tank.getTankType(), FluidReleaseType.BURN, toBurn * 0.5F); } - + if(toBurn > 0) { wasOn = true; } - + tank.setFill(fill / 10); tenth = fill % 10; } } - + NBTTagCompound data = new NBTTagCompound(); data.setLong("power", Math.min(power, maxPower)); - + this.power = Library.chargeItemsFromTE(slots, 3, power, power); - + for(DirPos pos : getConPos()) { this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.sendSmoke(pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + if(power > maxPower) power = maxPower; - - data.setInteger("playersUsing", playersUsing); - data.setInteger("setting", setting); - data.setBoolean("isOn", isOn); - data.setBoolean("wasOn", wasOn); - tank.writeToNBT(data, "tank"); - this.networkPack(data, 50); - + + this.networkPackNT(50); + } else { this.prevDoorAngle = this.doorAngle; float swingSpeed = (doorAngle / 10F) + 3; - + if(this.playersUsing > 0) { this.doorAngle += swingSpeed; } else { this.doorAngle -= swingSpeed; } - + this.doorAngle = MathHelper.clamp_float(this.doorAngle, 0F, 135F); if(wasOn) { - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -142,9 +138,9 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin audio.keepAlive(); audio.updateVolume(this.getVolume(1F)); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -152,11 +148,11 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin } } } - + private DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ, dir), new DirPos(xCoord + dir.offsetX * 1 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 1 - rot.offsetZ, dir), @@ -164,7 +160,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ, dir.getOpposite()) }; } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.igeneratorOperate", xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F, 20); @@ -200,14 +196,25 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.playersUsing = nbt.getInteger("playersUsing"); - this.setting = nbt.getInteger("setting"); - this.power = nbt.getLong("power"); - this.isOn = nbt.getBoolean("isOn"); - this.wasOn = nbt.getBoolean("wasOn"); - this.tank.readFromNBT(nbt, "tank"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.playersUsing); + buf.writeInt(this.setting); + buf.writeLong(this.power); + buf.writeBoolean(this.isOn); + buf.writeBoolean(this.wasOn); + tank.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.playersUsing = buf.readInt(); + this.setting = buf.readInt(); + this.power = buf.readLong(); + this.isOn = buf.readBoolean(); + this.wasOn = buf.readBoolean(); + tank.deserialize(buf); } @Override @@ -229,12 +236,12 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin tank.writeToNBT(nbt, "tank"); nbt.setInteger("tenth", tenth); } - + @Override public void openInventory() { if(!worldObj.isRemote) this.playersUsing++; } - + @Override public void closeInventory() { if(!worldObj.isRemote) this.playersUsing--; @@ -280,12 +287,12 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin public FluidTank[] getSendingTanks() { return this.getSmokeTanks(); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 3, @@ -296,10 +303,10 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin zCoord + 4 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -315,7 +322,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin public void receiveControl(NBTTagCompound data) { if(data.hasKey("turnOn")) this.isOn = !this.isOn; if(data.hasKey("setting")) this.setting = data.getInteger("setting"); - + this.markChanged(); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCompressor.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCompressor.java index eb4c50eb4..e7e5ad2d5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCompressor.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCompressor.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerCompressor; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -15,10 +16,7 @@ import com.hbm.inventory.recipes.CompressorRecipes.CompressorRecipe; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; -import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.IUpgradeInfoProvider; -import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.tileentity.*; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; import com.hbm.util.Tuple.Pair; @@ -28,6 +26,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -38,7 +37,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineCompressor extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable { - + public FluidTank[] tanks; public long power; public static final long maxPower = 100_000; @@ -48,13 +47,15 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement public static final int processTimeBase = 100; public int powerRequirement; public static final int powerRequirementBase = 2_500; - + public float fanSpin; public float prevFanSpin; public float piston; public float prevPiston; public boolean pistonDir; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineCompressor() { super(4); this.tanks = new FluidTank[2]; @@ -69,23 +70,23 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { this.updateConnections(); } - + this.power = Library.chargeTEFromItems(slots, 1, power, maxPower); this.tanks[0].setType(0, slots); this.setupTanks(); - - UpgradeManager.eval(slots, 1, 3); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - + upgradeManager.checkSlots(this, slots, 1, 3); + + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + CompressorRecipe rec = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure())); int timeBase = this.processTimeBase; if(rec != null) timeBase = rec.duration; @@ -97,52 +98,44 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement this.powerRequirement = this.powerRequirementBase / (powerLevel + 1); this.processTime = this.processTime / (overLevel + 1); this.powerRequirement = this.powerRequirement * ((overLevel * 2) + 1); - + if(processTime <= 0) processTime = 1; - + if(canProcess()) { this.progress++; this.isOn = true; this.power -= powerRequirement; - + if(progress >= this.processTime) { progress = 0; this.process(); this.markChanged(); } - + } else { this.progress = 0; this.isOn = false; } - + for(DirPos pos : getConPos()) { this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("progress", progress); - data.setInteger("processTime", processTime); - data.setInteger("powerRequirement", powerRequirement); - data.setLong("power", power); - tanks[0].writeToNBT(data, "0"); - tanks[1].writeToNBT(data, "1"); - data.setBoolean("isOn", isOn); - this.networkPack(data, 100); - + + this.networkPackNT(100); + } else { - + this.prevFanSpin = this.fanSpin; this.prevPiston = this.piston; - + if(this.isOn) { this.fanSpin += 15; - + if(this.fanSpin >= 360) { this.prevFanSpin -= 360; this.fanSpin -= 360; } - + if(this.pistonDir) { this.piston -= randSpeed; if(this.piston <= 0) { @@ -156,61 +149,73 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement this.pistonDir = !this.pistonDir; } } - + this.piston = MathHelper.clamp_float(this.piston, 0F, 1F); } } } - + private float randSpeed = 0.1F; - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.progress = nbt.getInteger("progress"); - this.processTime = nbt.getInteger("processTime"); - this.powerRequirement = nbt.getInteger("powerRequirement"); - this.power = nbt.getLong("power"); - tanks[0].readFromNBT(nbt, "0"); - tanks[1].readFromNBT(nbt, "1"); - this.isOn = nbt.getBoolean("isOn"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.progress); + buf.writeInt(this.processTime); + buf.writeInt(this.powerRequirement); + buf.writeLong(this.power); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + buf.writeBoolean(this.isOn); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.progress = buf.readInt(); + this.processTime = buf.readInt(); + this.powerRequirement = buf.readInt(); + this.power = buf.readLong(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + this.isOn = buf.readBoolean(); + } + private void updateConnections() { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + public DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + rot.offsetX * 2, yCoord, zCoord + rot.offsetZ * 2, rot), new DirPos(xCoord - rot.offsetX * 2, yCoord, zCoord - rot.offsetZ * 2, rot.getOpposite()), new DirPos(xCoord - dir.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2, dir.getOpposite()), }; } - + public boolean canProcess() { - + if(this.power <= powerRequirement) return false; - + CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure())); - + if(recipe == null) { return tanks[0].getFill() >= 1000 && tanks[1].getFill() + 1000 <= tanks[1].getMaxFill(); } - + return tanks[0].getFill() > recipe.inputAmount && tanks[1].getFill() + recipe.output.fill <= tanks[1].getMaxFill(); } - + public void process() { - + CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure())); - + if(recipe == null) { tanks[0].setFill(tanks[0].getFill() - 1_000); tanks[1].setFill(tanks[1].getFill() + 1_000); @@ -219,18 +224,18 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement tanks[1].setFill(tanks[1].getFill() + recipe.output.fill); } } - + protected void setupTanks() { - + CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure())); - + if(recipe == null) { tanks[1].withPressure(tanks[0].getPressure() + 1).setTankType(tanks[0].getTankType()); } else { tanks[1].withPressure(recipe.output.pressure).setTankType(recipe.output.type); } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -239,7 +244,7 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement tanks[0].readFromNBT(nbt, "0"); tanks[1].readFromNBT(nbt, "1"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -268,18 +273,18 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement @Override public void receiveControl(NBTTagCompound data) { int compression = data.getInteger("compression"); - + if(compression != tanks[0].getPressure()) { tanks[0].withPressure(compression); - + CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), compression)); - + if(recipe == null) { tanks[1].withPressure(compression + 1); } else { tanks[1].withPressure(recipe.output.pressure).setTankType(recipe.output.type); } - + this.markChanged(); } } @@ -313,12 +318,12 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0]}; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -329,10 +334,10 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -360,11 +365,12 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 9; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 9); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java index 0fe75035d..23771df85 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCrystallizer.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.extprop.HbmPlayerProps; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerCrystallizer; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -15,10 +16,7 @@ import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; -import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.IUpgradeInfoProvider; -import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.tileentity.*; import com.hbm.util.BobMathUtil; import com.hbm.util.I18nUtil; import com.hbm.util.fauxpointtwelve.DirPos; @@ -40,19 +38,21 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineCrystallizer extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable { - + public long power; public static final long maxPower = 1000000; public static final int demand = 1000; public short progress; public short duration = 600; public boolean isOn; - + public float angle; public float prevAngle; - + public FluidTank tank; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineCrystallizer() { super(8); tank = new FluidTank(Fluids.PEROXIDE, 8000); @@ -65,76 +65,76 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.isOn = false; - + this.updateConnections(); - + power = Library.chargeTEFromItems(slots, 1, power, maxPower); tank.setType(7, slots); tank.loadTank(3, 4, slots); - - UpgradeManager.eval(slots, 5, 6); - + + upgradeManager.checkSlots(this, slots, 5, 6); + for(int i = 0; i < getCycleCount(); i++) { - + if(canProcess()) { - + progress++; power -= getPowerRequired(); isOn = true; - + if(progress > getDuration()) { progress = 0; processItem(); - + this.markDirty(); } - + } else { progress = 0; } } - + this.networkPackNT(25); } else { - + prevAngle = angle; - + if(isOn) { angle += 5F * this.getCycleCount(); - + if(angle >= 360) { angle -= 360; prevAngle -= 360; } - + if(worldObj.rand.nextInt(20) == 0 && MainRegistry.proxy.me().getDistance(xCoord + 0.5, yCoord + 6, zCoord + 0.5) < 50) { worldObj.spawnParticle("cloud", xCoord + worldObj.rand.nextDouble(), yCoord + 6.5D, zCoord + worldObj.rand.nextDouble(), 0.0, 0.1, 0.0); } } } - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.25, yCoord + 1, zCoord + 0.25, xCoord + 0.75, yCoord + 6, zCoord + 0.75).offset(rot.offsetX * 1.5, 0, rot.offsetZ * 1.5)); - + for(EntityPlayer player : players) { HbmPlayerProps props = HbmPlayerProps.getData(player); props.isOnLadder = true; } } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + protected DirPos[] getConPos() { return new DirPos[] { @@ -148,7 +148,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme new DirPos(xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z) }; } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -158,7 +158,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme buf.writeBoolean(isOn); tank.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -168,103 +168,103 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme isOn = buf.readBoolean(); tank.deserialize(buf); } - + private void processItem() { CrystallizerRecipe result = CrystallizerRecipes.getOutput(slots[0], tank.getTankType()); - + if(result == null) //never happens but you can't be sure enough return; - + ItemStack stack = result.output.copy(); - + if(slots[2] == null) slots[2] = stack; else if(slots[2].stackSize + stack.stackSize <= slots[2].getMaxStackSize()) slots[2].stackSize += stack.stackSize; - + tank.setFill(tank.getFill() - getRequiredAcid(result.acidAmount)); - + float freeChance = this.getFreeChance(); - + if(freeChance == 0 || freeChance < worldObj.rand.nextFloat()) this.decrStackSize(0, result.itemAmount); } - + private boolean canProcess() { - + //Is there no input? if(slots[0] == null) return false; - + if(power < getPowerRequired()) return false; - + CrystallizerRecipe result = CrystallizerRecipes.getOutput(slots[0], tank.getTankType()); - + //Or output? if(result == null) return false; - + //Not enough of the input item? if(slots[0].stackSize < result.itemAmount) return false; - + if(tank.getFill() < getRequiredAcid(result.acidAmount)) return false; - + ItemStack stack = result.output.copy(); - + //Does the output not match? if(slots[2] != null && (slots[2].getItem() != stack.getItem() || slots[2].getItemDamage() != stack.getItemDamage())) return false; - + //Or is the output slot already full? if(slots[2] != null && slots[2].stackSize + stack.stackSize > slots[2].getMaxStackSize()) return false; - + return true; } - + public int getRequiredAcid(int base) { - int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3); + int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT); if(efficiency > 0) { return base * (efficiency + 2); } return base; } - + public float getFreeChance() { - int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3); + int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT); if(efficiency > 0) { return Math.min(efficiency * 0.05F, 0.15F); } return 0; } - + public short getDuration() { CrystallizerRecipe result = CrystallizerRecipes.getOutput(slots[0], tank.getTankType()); int base = result != null ? result.duration : 600; - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); if(speed > 0) { return (short) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.25F))); } return (short) base; } - + public int getPowerRequired() { - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); return (int) (demand + Math.min(speed * 1000, 3000)); } - + public float getCycleCount() { - int speed = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); + int speed = upgradeManager.getLevel(UpgradeType.OVERDRIVE); return Math.min(1 + speed * 2, 7); } - + public long getPowerScaled(int i) { return (power * i) / maxPower; } - + public int getProgressScaled(int i) { return (progress * i) / duration; } @@ -283,34 +283,34 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme public long getMaxPower() { return maxPower; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + power = nbt.getLong("power"); tank.readFromNBT(nbt, "tank"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); tank.writeToNBT(nbt, "tank"); } @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - + CrystallizerRecipe recipe = CrystallizerRecipes.getOutput(itemStack, tank.getTankType()); if(i == 0 && recipe != null) { return true; } - + if(i == 1 && itemStack.getItem() instanceof IBatteryItem) return true; - + return false; } @@ -321,15 +321,15 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme @Override public int[] getAccessibleSlotsFromSide(int side) { - + return side == 0 ? new int[] { 2 } : new int[] { 0, 2 }; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -339,7 +339,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && i >= 5 && i <= 6 && stack.getItem() instanceof ItemMachineUpgrade) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -388,11 +388,12 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.EFFECT) return 3; - if(type == UpgradeType.OVERDRIVE) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.EFFECT, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCyclotron.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCyclotron.java index 7224feee4..b254d0fdf 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCyclotron.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineCyclotron.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.container.ContainerMachineCyclotron; @@ -39,21 +40,23 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IConditionalInvAccess, IUpgradeInfoProvider, IInfoProviderEC, IFluidCopiable { - + public long power; public static final long maxPower = 100000000; public static int consumption = 1_000_000; - - private byte plugs; - + + private byte plugs; + public int progress; public static final int duration = 690; - + public FluidTank[] tanks; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineCyclotron() { super(12); - + this.tanks = new FluidTank[3]; this.tanks[0] = new FluidTank(Fluids.WATER, 32000); this.tanks[1] = new FluidTank(Fluids.SPENTSTEAM, 32000); @@ -67,67 +70,67 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.updateConnections(); this.power = Library.chargeTEFromItems(slots, 9, power, maxPower); - - UpgradeManager.eval(slots, 10, 11); - + + upgradeManager.checkSlots(this, slots, 10, 11); + if(canProcess()) { progress += getSpeed(); power -= getConsumption(); - + int convert = getCoolantConsumption(); tanks[0].setFill(tanks[0].getFill() - convert); tanks[1].setFill(tanks[1].getFill() + convert); - + if(progress >= duration) { process(); progress = 0; this.markDirty(); } - + } else { progress = 0; } - + this.sendFluid(); this.networkPackNT(25); } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); buf.writeLong(power); buf.writeInt(progress); buf.writeByte(plugs); - + for(int i = 0; i < 3; i++) tanks[i].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); power = buf.readLong(); progress = buf.readInt(); plugs = buf.readByte(); - + for(int i = 0; i < 3; i++) tanks[i].deserialize(buf); } - + private void updateConnections() { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private void sendFluid() { for(int i = 1; i < 3; i++) { if(tanks[i].getFill() > 0) { @@ -137,7 +140,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements } } } - + public DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 3, yCoord, zCoord + 1, Library.POS_X), @@ -150,93 +153,93 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements new DirPos(xCoord - 1, yCoord, zCoord - 3, Library.NEG_Z) }; } - + public boolean canProcess() { - + if(power < getConsumption()) return false; - + int convert = getCoolantConsumption(); - + if(tanks[0].getFill() < convert) return false; - + if(tanks[1].getFill() + convert > tanks[1].getMaxFill()) return false; - + for(int i = 0; i < 3; i++) { - + Object[] res = CyclotronRecipes.getOutput(slots[i + 3], slots[i]); - + if(res == null) continue; - + ItemStack out = (ItemStack)res[0]; - + if(out == null) continue; - + if(slots[i + 6] == null) return true; - + if(slots[i + 6].getItem() == out.getItem() && slots[i + 6].getItemDamage() == out.getItemDamage() && slots[i + 6].stackSize < out.getMaxStackSize()) return true; } - + return false; } - + public void process() { - + for(int i = 0; i < 3; i++) { - + Object[] res = CyclotronRecipes.getOutput(slots[i + 3], slots[i]); - + if(res == null) continue; - + ItemStack out = (ItemStack)res[0]; - + if(out == null) continue; - + if(slots[i + 6] == null) { - + this.decrStackSize(i, 1); this.decrStackSize(i + 3, 1); slots[i + 6] = out; - + this.tanks[2].setFill(this.tanks[2].getFill() + (Integer)res[1]); - + continue; } - + if(slots[i + 6].getItem() == out.getItem() && slots[i + 6].getItemDamage() == out.getItemDamage() && slots[i + 6].stackSize < out.getMaxStackSize()) { - + this.decrStackSize(i, 1); this.decrStackSize(i + 3, 1); slots[i + 6].stackSize++; - + this.tanks[2].setFill(this.tanks[2].getFill() + (Integer)res[1]); } } - + if(this.tanks[2].getFill() > this.tanks[2].getMaxFill()) this.tanks[2].setFill(this.tanks[2].getMaxFill()); } - + public int getSpeed() { - return Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) + 1; + return upgradeManager.getLevel(UpgradeType.SPEED) + 1; } - + public int getConsumption() { - int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - + int efficiency = upgradeManager.getLevel(UpgradeType.POWER); + return consumption - 100_000 * efficiency; } - + public int getCoolantConsumption() { - int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3); + int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT); //half a small tower's worth return 500 / (efficiency + 1) * getSpeed(); } @@ -248,67 +251,67 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements public int getProgressScaled(int i) { return (progress * i) / duration; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 4, zCoord + 3); } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 65536.0D; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + for(int i = 0; i < 3; i++) tanks[i].readFromNBT(nbt, "t" + i); - + this.progress = nbt.getInteger("progress"); this.power = nbt.getLong("power"); this.plugs = nbt.getByte("plugs"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + for(int i = 0; i < 3; i++) tanks[i].writeToNBT(nbt, "t" + i); - + nbt.setInteger("progress", progress); nbt.setLong("power", power); nbt.setByte("plugs", plugs); } - + public void setPlug(int index) { this.plugs |= (1 << index); this.markDirty(); } - + public boolean getPlug(int index) { return (this.plugs & (1 << index)) > 0; } - + public static Item getItemForPlug(int i) { - + switch(i) { case 0: return ModItems.powder_balefire; case 1: return ModItems.book_of_; case 2: return ModItems.diamond_gavel; case 3: return ModItems.coin_maskman; } - + return null; } @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && i >= 14 && i <= 15 && stack.getItem() instanceof ItemMachineUpgrade) worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.5F, 1.0F); } @@ -356,7 +359,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements @Override public boolean isItemValidForSlot(int x, int y, int z, int slot, ItemStack stack) { - + if(slot < 3) { for(Entry, Pair> entry : CyclotronRecipes.recipes.entrySet()) { if(entry.getKey().getKey().matchesRecipe(stack, true)) return true; @@ -367,7 +370,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements if(entry.getKey().getValue().matchesRecipe(stack, true)) return true; } } - + return false; } @@ -383,7 +386,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements @Override public int[] getAccessibleSlotsFromSide(int x, int y, int z, int side) { - + for(int i = 2; i < 6; i++) { ForgeDirection dir = ForgeDirection.getOrientation(i); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); @@ -392,7 +395,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements if(x == xCoord + dir.offsetX * 2 && z == zCoord + dir.offsetZ * 2) return new int[] {1, 4, 6, 7, 8}; if(x == xCoord + dir.offsetX * 2 - rot.offsetX && z == zCoord + dir.offsetZ * 2 - rot.offsetZ) return new int[] {2, 5, 6, 7, 8}; } - + return new int[] {6, 7, 8}; } @@ -417,11 +420,12 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.EFFECT) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.EFFECT, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java index d971abae4..808554c37 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java @@ -29,6 +29,7 @@ import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -151,22 +152,26 @@ public class TileEntityMachineDiesel extends TileEntityMachinePolluting implemen generate(); - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("power", (int) power); - data.setInteger("powerCap", (int) powerCap); - tank.writeToNBT(data, "t"); - this.networkPack(data, 50); + this.networkPackNT(50); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - power = data.getInteger("power"); - powerCap = data.getInteger("powerCap"); - tank.readFromNBT(data, "t"); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt((int) power); + buf.writeInt((int) powerCap); + tank.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readInt(); + this.powerCap = buf.readInt(); + tank.deserialize(buf); + } + public boolean hasAcceptableFuel() { return getHEFromFuel() > 0; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDrain.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDrain.java index 6719b17d3..22b99e917 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDrain.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDrain.java @@ -12,15 +12,12 @@ import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Liquid; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Viscous; import com.hbm.main.MainRegistry; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.fluid.IFluidStandardReceiver; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -32,24 +29,24 @@ import net.minecraft.util.Vec3; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFluidStandardReceiver, IBufPacketReceiver, IFluidCopiable { - + public FluidTank tank; - + public TileEntityMachineDrain() { this.tank = new FluidTank(Fluids.NONE, 2_000); } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { for(DirPos pos : getConPos()) this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - + + networkPackNT(50); + if(tank.getFill() > 0) { if(tank.getTankType().hasTrait(FT_Amat.class)) { worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 10F, true, true); @@ -58,13 +55,13 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu int toSpill = Math.max(tank.getFill() / 2, 1); tank.setFill(tank.getFill() - toSpill); FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.SPILL, toSpill); - + if(toSpill >= 100 && worldObj.rand.nextInt(20) == 0 && tank.getTankType().hasTrait(FT_Liquid.class) && tank.getTankType().hasTrait(FT_Viscous.class) && tank.getTankType().hasTrait(FT_Flammable.class)) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); Vec3 start = Vec3.createVectorHelper(xCoord + 0.5 - dir.offsetX * 3, yCoord + 0.5, zCoord + 0.5 - dir.offsetZ * 3); Vec3 end = start.addVector(worldObj.rand.nextGaussian() * 5, -25, worldObj.rand.nextGaussian() * 5); MovingObjectPosition mop = worldObj.func_147447_a(start, end, false, true, false); - + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK && mop.sideHit == 1) { Block block = worldObj.getBlock(mop.blockX, mop.blockY + 1, mop.blockZ); if(!block.getMaterial().isLiquid() && block.isReplaceable(worldObj, mop.blockX, mop.blockY + 1, mop.blockZ) && ModBlocks.oil_spill.canPlaceBlockAt(worldObj, mop.blockX, mop.blockY + 1, mop.blockZ)) { @@ -73,12 +70,12 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu } } } - + } else { - + if(tank.getFill() > 0 && MainRegistry.proxy.me().getDistance(xCoord, yCoord, zCoord) < 100) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); - + NBTTagCompound data = new NBTTagCompound(); if(tank.getTankType().hasTrait(FT_Gaseous.class)) { data.setString("type", "tower"); @@ -89,17 +86,17 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu } else { data.setString("type", "splash"); } - + data.setInteger("color", tank.getTankType().getColor()); data.setDouble("posX", xCoord + 0.5 - dir.offsetX * 2.5); data.setDouble("posZ", zCoord + 0.5 - dir.offsetZ * 2.5); data.setDouble("posY", yCoord + 0.5); - + MainRegistry.proxy.effectNT(data); } } } - + public DirPos[] getConPos() { ForgeDirection dir0 = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection dir1 = dir0.getRotation(ForgeDirection.UP); @@ -110,13 +107,13 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu new DirPos(xCoord + dir2.offsetX, yCoord, zCoord + dir2.offsetZ, dir2) }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.tank.readFromNBT(nbt, "t"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -128,17 +125,17 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu @Override public FluidTank[] getAllTanks() { return new FluidTank[] {tank}; } @Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tank}; } - + @Override public boolean canConnect(FluidType type, ForgeDirection dir) { return dir != ForgeDirection.UP && dir != ForgeDirection.DOWN; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -149,10 +146,10 @@ public class TileEntityMachineDrain extends TileEntityLoadedBase implements IFlu zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineEPress.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineEPress.java index 69de4e64f..0462f77f7 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineEPress.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineEPress.java @@ -1,9 +1,10 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineEPress; import com.hbm.inventory.gui.GUIMachineEPress; import com.hbm.inventory.recipes.PressRecipes; @@ -13,6 +14,7 @@ import com.hbm.lib.Library; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.CompatEnergyControl; import com.hbm.util.I18nUtil; @@ -20,6 +22,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -42,9 +45,11 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE public final static int maxPress = 200; boolean isRetracting = false; private int delay; - + public ItemStack syncStack; - + + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineEPress() { super(5); } @@ -53,39 +58,39 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE public String getName() { return "container.epress"; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.updateConnections(); power = Library.chargeTEFromItems(slots, 0, power, maxPower); - + boolean canProcess = this.canProcess(); - + if((canProcess || this.isRetracting || this.delay > 0) && power >= 100) { - + power -= 100; - + if(delay <= 0) { - - UpgradeManager.eval(slots, 4, 4); - int speed = 1 + Math.min(3, UpgradeManager.getLevel(UpgradeType.SPEED)); - + + upgradeManager.checkSlots(this, slots, 4, 4); + int speed = 1 + upgradeManager.getLevel(UpgradeType.SPEED); + int stampSpeed = this.isRetracting ? 20 : 45; stampSpeed *= (1D + (double) speed / 4D); - + if(this.isRetracting) { this.press -= stampSpeed; - + if(this.press <= 0) { this.isRetracting = false; this.delay = 5 - speed + 1; } } else if(canProcess) { this.press += stampSpeed; - + if(this.press >= this.maxPress) { this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.pressOperate", getVolume(1.5F), 1.0F); ItemStack output = PressRecipes.getOutput(slots[2], slots[1]); @@ -95,17 +100,17 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE slots[3].stackSize += output.stackSize; } this.decrStackSize(2, 1); - + if(slots[1].getMaxDamage() != 0) { slots[1].setItemDamage(slots[1].getItemDamage() + 1); if(slots[1].getItemDamage() >= slots[1].getMaxDamage()) { slots[1] = null; } } - + this.isRetracting = true; this.delay = 5 - speed + 1; - + this.markDirty(); } } else if(this.press > 0){ @@ -115,23 +120,14 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE delay--; } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("press", press); - if(slots[2] != null) { - NBTTagCompound stack = new NBTTagCompound(); - slots[2].writeToNBT(stack); - data.setTag("stack", stack); - } - - this.networkPack(data, 50); - + + this.networkPackNT(50); + } else { - + // approach-based interpolation, GO! this.lastPress = this.renderPress; - + if(this.turnProgress > 0) { this.renderPress = this.renderPress + ((this.syncPress - this.renderPress) / (double) this.turnProgress); --this.turnProgress; @@ -140,52 +136,58 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE } } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.syncPress = nbt.getInteger("press"); - - if(nbt.hasKey("stack")) { - NBTTagCompound stack = nbt.getCompoundTag("stack"); - this.syncStack = ItemStack.loadItemStackFromNBT(stack); - } else { - this.syncStack = null; - } - + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + buf.writeInt(press); + if (slots[2] == null) + buf.writeShort(-1); // indicate that the NBT doesn't actually exist to avoid null pointer errors. + else + BufferUtil.writeNBT(buf, slots[2].stackTagCompound); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.syncPress = buf.readInt(); + + NBTTagCompound stack = BufferUtil.readNBT(buf); + this.syncStack = ItemStack.loadItemStackFromNBT(stack); + this.turnProgress = 2; } - + public boolean canProcess() { if(power < 100) return false; if(slots[1] == null || slots[2] == null) return false; - + ItemStack output = PressRecipes.getOutput(slots[2], slots[1]); - + if(output == null) return false; - + if(slots[3] == null) return true; if(slots[3].stackSize + output.stackSize <= slots[3].getMaxStackSize() && slots[3].getItem() == output.getItem() && slots[3].getItemDamage() == output.getItemDamage()) return true; return false; } - + private void updateConnections() { - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } @Override public boolean isItemValidForSlot(int i, ItemStack stack) { - + if(stack.getItem() instanceof ItemStamp) return i == 1; - + return i == 2; } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return new int[] { 1, 2, 3 }; @@ -200,16 +202,16 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE public boolean canExtractItem(int i, ItemStack itemStack, int j) { return i == 3; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + press = nbt.getInteger("press"); power = nbt.getInteger("power"); isRetracting = nbt.getBoolean("ret"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -222,7 +224,7 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE @Override public void setPower(long i) { power = i; - + } @Override @@ -234,19 +236,19 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE public long getMaxPower() { return maxPower; } - + AxisAlignedBB aabb; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(aabb != null) return aabb; - + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 3, zCoord + 1); return aabb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -278,9 +280,10 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineElectricFurnace.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineElectricFurnace.java index 0442a250d..3f8223d23 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineElectricFurnace.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineElectricFurnace.java @@ -1,12 +1,13 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.MachineElectricFurnace; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerElectricFurnace; import com.hbm.inventory.gui.GUIMachineElectricFurnace; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; @@ -44,6 +45,8 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl private static final int[] slots_io = new int[] { 0, 1, 2 }; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineElectricFurnace() { super(4); } @@ -69,7 +72,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); this.progress = nbt.getInteger("progress"); } @@ -114,7 +117,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl } public boolean canProcess() { - + if(slots[1] == null || cooldown > 0) { return false; } @@ -167,7 +170,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl boolean markDirty = false; if(!worldObj.isRemote) { - + if(cooldown > 0) { cooldown--; } @@ -179,16 +182,16 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl this.consumption = 50; this.maxProgress = 100; - UpgradeManager.eval(slots, 3, 3); + upgradeManager.checkSlots(this, slots, 3, 3); - int speedLevel = UpgradeManager.getLevel(UpgradeType.SPEED); - int powerLevel = UpgradeManager.getLevel(UpgradeType.POWER); + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); maxProgress -= speedLevel * 25; consumption += speedLevel * 50; maxProgress += powerLevel * 10; consumption -= powerLevel * 15; - + if(!hasPower()) { cooldown = 20; } @@ -197,7 +200,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl progress++; power -= consumption; - + if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND); if(this.progress >= maxProgress) { @@ -219,7 +222,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl markDirty = true; MachineElectricFurnace.updateBlockState(this.progress > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } - + this.networkPackNT(50); @@ -228,7 +231,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl } } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -236,7 +239,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl buf.writeInt(maxProgress); buf.writeInt(progress); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -244,7 +247,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl maxProgress = buf.readInt(); progress = buf.readInt(); } - + private void updateConnections() { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) @@ -298,9 +301,10 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + return upgrades; } -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExcavator.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExcavator.java index 479a91fe7..0892fa27b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExcavator.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExcavator.java @@ -1,10 +1,7 @@ package com.hbm.tileentity.machine; import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Random; +import java.util.*; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; @@ -12,7 +9,7 @@ import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre; import com.hbm.blocks.network.CraneInserter; import com.hbm.entity.item.EntityMovingItem; import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineExcavator; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -65,13 +62,13 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements public static final long maxPower = 1_000_000; public long power; public boolean operational = false; - + public boolean enableDrill = false; public boolean enableCrusher = false; public boolean enableWalling = false; public boolean enableVeinMiner = false; public boolean enableSilkTouch = false; - + protected int ticksWorked = 0; protected int targetDepth = 0; //0 is the first block below null position protected boolean bedrockDrilling = false; @@ -83,13 +80,15 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements public float crusherRotation = 0F; public float prevCrusherRotation = 0F; public int chuteTimer = 0; - + public double speed = 1.0D; public final long baseConsumption = 10_000L; public long consumption = baseConsumption; - + public FluidTank tank; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineExcavator() { super(14); this.tank = new FluidTank(Fluids.SULFURIC_ACID, 16_000); @@ -102,48 +101,48 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements @Override public void updateEntity() { - + //needs to happen on client too for GUI rendering - UpgradeManager.eval(slots, 2, 3); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - + upgradeManager.checkSlots(this, slots, 2, 3); + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + consumption = baseConsumption * (1 + speedLevel); consumption /= (1 + powerLevel); - + if(!worldObj.isRemote) { - + this.tank.setType(1, slots); - + if(worldObj.getTotalWorldTime() % 20 == 0) { tryEjectBuffer(); - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + if(chuteTimer > 0) chuteTimer--; - + this.power = Library.chargeTEFromItems(slots, 0, this.getPower(), this.getMaxPower()); this.operational = false; - int radiusLevel = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3); - + int radiusLevel = upgradeManager.getLevel(UpgradeType.EFFECT); + EnumDrillType type = this.getInstalledDrill(); if(this.enableDrill && type != null && this.power >= this.getPowerConsumption()) { - + operational = true; this.power -= this.getPowerConsumption(); - + this.speed = type.speed; this.speed *= (1 + speedLevel / 2D); - + int maxDepth = this.yCoord - 4; if((bedrockDrilling || targetDepth <= maxDepth) && tryDrill(1 + radiusLevel * 2)) { targetDepth++; - + if(targetDepth > maxDepth) { this.enableDrill = false; } @@ -151,17 +150,17 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } else { this.targetDepth = 0; } - + this.networkPackNT(150); - + } else { - + this.prevDrillExtension = this.drillExtension; - + if(this.drillExtension != this.targetDepth) { float diff = Math.abs(this.drillExtension - this.targetDepth); float speed = Math.max(0.15F, diff / 10F); - + if(diff <= speed) { this.drillExtension = this.targetDepth; } else { @@ -172,31 +171,31 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements this.prevDrillRotation = this.drillRotation; this.prevCrusherRotation = this.crusherRotation; - + if(this.operational) { this.drillRotation += 15F; - + if(this.enableCrusher) { this.crusherRotation += 15F; } } - + if(this.drillRotation >= 360F) { this.drillRotation -= 360F; this.prevDrillRotation -= 360F; } - + if(this.crusherRotation >= 360F) { this.crusherRotation -= 360F; this.prevCrusherRotation -= 360F; } } } - + protected DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 4 + rot.offsetX, yCoord + 1, zCoord + dir.offsetZ * 4 + rot.offsetZ, dir), new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX, yCoord + 1, zCoord + dir.offsetZ * 4 - rot.offsetZ, dir), @@ -204,7 +203,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements new DirPos(xCoord - rot.offsetX * 4, yCoord + 1, zCoord - rot.offsetZ * 4, rot.getOpposite()) }; } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -219,7 +218,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements buf.writeLong(power); tank.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -234,11 +233,11 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements power = buf.readLong(); tank.deserialize(buf); } - + protected int getY() { return yCoord - targetDepth - 4; } - + /** Works outwards and tries to break a ring, returns true if all rings are broken (or ignorable) and the drill should extend. */ protected boolean tryDrill(int radius) { int y = getY(); @@ -246,22 +245,22 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements if(targetDepth == 0 || y == 0) { radius = 1; } - + for(int ring = 1; ring <= radius; ring++) { - + boolean ignoreAll = true; float combinedHardness = 0F; BlockPos bedrockOre = null; bedrockDrilling = false; - + for(int x = xCoord - ring; x <= xCoord + ring; x++) { for(int z = zCoord - ring; z <= zCoord + ring; z++) { - + /* Process blocks either if we are in the inner ring (1 = 3x3) or if the target block is on the outer edge */ if(ring == 1 || (x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring)) { - + Block b = worldObj.getBlock(x, y, z); - + if(b == ModBlocks.ore_bedrock) { combinedHardness = 5 * 60 * 20; bedrockOre = new BlockPos(x, y, z); @@ -270,23 +269,23 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements ignoreAll = false; break; } - + if(shouldIgnoreBlock(b, x, y ,z)) continue; - + ignoreAll = false; - + combinedHardness += b.getBlockHardness(worldObj, x, y, z); } } } - + if(!ignoreAll) { ticksWorked++; - + int ticksToWork = (int) Math.ceil(combinedHardness / this.speed); - + if(ticksWorked >= ticksToWork) { - + if(bedrockOre == null) { breakBlocks(ring); buildWall(ring + 1, ring == radius && this.enableWalling); @@ -297,7 +296,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } ticksWorked = 0; } - + return false; } else { tryCollect(radius + 1); @@ -308,26 +307,26 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements ticksWorked = 0; return true; } - + protected void collectBedrock(BlockPos pos) { TileEntity oreTile = Compat.getTileStandard(worldObj, pos.getX(), pos.getY(), pos.getZ()); - + if(oreTile instanceof TileEntityBedrockOre) { TileEntityBedrockOre ore = (TileEntityBedrockOre) oreTile; - + if(ore.resource == null) return; if(ore.tier > this.getInstalledDrill().tier) return; if(ore.acidRequirement != null) { - + if(ore.acidRequirement.type != tank.getTankType() || ore.acidRequirement.fill > tank.getFill()) return; - + tank.setFill(tank.getFill() - ore.acidRequirement.fill); } - + ItemStack stack = ore.resource.copy(); List stacks = new ArrayList(); stacks.add(stack); - + if(stack.getItem() == ModItems.bedrock_ore_base) { ItemBedrockOreBase.setOreAmount(stack, pos.getX(), pos.getZ()); } @@ -337,63 +336,63 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements int x = xCoord + dir.offsetX * 4; int y = yCoord - 3; int z = zCoord + dir.offsetZ * 4; - + /* try to insert into a valid container */ TileEntity tile = worldObj.getTileEntity(x, y, z); if(tile instanceof IInventory) { supplyContainer((IInventory) tile, stacks, dir.getOpposite()); } - + if(stack.stackSize <= 0) return; - + /* try to place on conveyor belt */ Block b = worldObj.getBlock(x, y, z); if(b instanceof IConveyorBelt) { supplyConveyor((IConveyorBelt) b, stacks, x, y, z); } - + if(stack.stackSize <= 0) return; - + for(int i = 5; i < 14; i++) { - + if(slots[i] != null && slots[i].stackSize < slots[i].getMaxStackSize() && stack.isItemEqual(slots[i]) && ItemStack.areItemStackTagsEqual(stack, slots[i])) { int toAdd = Math.min(slots[i].getMaxStackSize() - slots[i].stackSize, stack.stackSize); slots[i].stackSize += toAdd; stack.stackSize -= toAdd; - + chuteTimer = 40; - + if(stack.stackSize <= 0) { return; } } } - + /* add leftovers to empty slots */ for(int i = 5; i < 14; i++) { - + if(slots[i] == null) { - + chuteTimer = 40; - + slots[i] = stack.copy(); return; } } } } - + /** breaks and drops all blocks in the specified ring */ protected void breakBlocks(int ring) { int y = getY(); - + for(int x = xCoord - ring; x <= xCoord + ring; x++) { for(int z = zCoord - ring; z <= zCoord + ring; z++) { - + if(ring == 1 || (x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring)) { - + Block b = worldObj.getBlock(x, y, z); - + if(!this.shouldIgnoreBlock(b, x, y, z)) { tryMineAtLocation(x, y, z); } @@ -401,13 +400,13 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } } } - + public void tryMineAtLocation(int x ,int y, int z) { Block b = worldObj.getBlock(x, y, z); - + if(this.enableVeinMiner && this.getInstalledDrill().vein) { - + if(isOre(x, y, z, b)) { minX = x; minY = y; @@ -417,51 +416,51 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements maxZ = z; breakRecursively(x, y, z, 10); recursionBrake.clear(); - + /* move all excavated items to the last drillable position which is also within collection range */ List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1)); for(EntityItem item : items) item.setPosition(x + 0.5, y + 0.5, z + 0.5); - + return; } } breakSingleBlock(b, x, y, z); } - + protected boolean isOre(int x ,int y, int z, Block b) { - + /* doing this isn't terribly accurate but just for figuring out if there's OD it works */ Item blockItem = Item.getItemFromBlock(b); - + if(blockItem != null) { List names = ItemStackUtil.getOreDictNames(new ItemStack(blockItem)); - + for(String name : names) { if(name.startsWith("ore")) { return true; } } } - + return false; } - + private HashSet recursionBrake = new HashSet(); private int minX = 0, minY = 0, minZ = 0, maxX = 0, maxY = 0, maxZ = 0; protected void breakRecursively(int x ,int y, int z, int depth) { - + if(depth < 0) return; BlockPos pos = new BlockPos(x, y, z); if(recursionBrake.contains(pos)) return; recursionBrake.add(pos); - + Block b = worldObj.getBlock(x, y, z); - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { int ix = x + dir.offsetX; int iy = y + dir.offsetY; int iz = z + dir.offsetZ; - + if(worldObj.getBlock(ix, iy, iz) == b) { breakRecursively(ix, iy, iz, depth - 1); } @@ -475,36 +474,36 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements if(y > maxY) maxY = y; if(z < minZ) minZ = z; if(z > maxZ) maxZ = z; - + if(this.enableWalling) { worldObj.setBlock(x, y, z, ModBlocks.barricade); } } - + protected void breakSingleBlock(Block b, int x ,int y, int z) { - + List items = b.getDrops(worldObj, x, y, z, worldObj.getBlockMetadata(x, y, z), this.getFortuneLevel()); - + if(this.canSilkTouch()) { - + try { Method createStackedBlock = ReflectionHelper.findMethod(Block.class, b, new String[] {"createStackedBlock", "func_149644_j"}, int.class); ItemStack result = (ItemStack) createStackedBlock.invoke(b, worldObj.getBlockMetadata(x, y, z)); - + if(result != null) { items.clear(); items.add(result.copy()); } } catch(Exception ex) { } } - + if(this.enableCrusher) { - + List list = new ArrayList(); - + for(ItemStack stack : items) { ItemStack crushed = ShredderRecipes.getShredderResult(stack).copy(); - + if(crushed.getItem() == ModItems.scrap || crushed.getItem() == ModItems.dust) { list.add(stack); } else { @@ -512,36 +511,36 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements list.add(crushed); } } - + items = list; } - + if(b == ModBlocks.barricade) items.clear(); - + for(ItemStack item : items) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, x + 0.5, y + 0.5, z + 0.5, item)); } - + worldObj.func_147480_a(x, y, z, false); } - + /** builds a wall along the specified ring, replacing fluid blocks. if wallEverything is set, it will also wall off replacable blocks like air or grass */ protected void buildWall(int ring, boolean wallEverything) { int y = getY(); - + for(int x = xCoord - ring; x <= xCoord + ring; x++) { for(int z = zCoord - ring; z <= zCoord + ring; z++) { - + Block b = worldObj.getBlock(x, y, z); - + if(x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring) { - + if(b.isReplaceable(worldObj, x, y, z) && (wallEverything || b.getMaterial().isLiquid())) { worldObj.setBlock(x, y, z, ModBlocks.barricade); } } else { - + if(b.getMaterial().isLiquid()) { worldObj.setBlockToAir(x, y, z); continue; @@ -552,14 +551,14 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } protected void mineOuterOres(int ring) { int y = getY(); - + for(int x = xCoord - ring; x <= xCoord + ring; x++) { for(int z = zCoord - ring; z <= zCoord + ring; z++) { - + if(ring == 1 || (x == xCoord - ring || x == xCoord + ring || z == zCoord - ring || z == zCoord + ring)) { - + Block b = worldObj.getBlock(x, y, z); - + if(!this.shouldIgnoreBlock(b, x, y, z) && this.isOre(x, y, z, b)) { tryMineAtLocation(x, y, z); } @@ -567,7 +566,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } } } - + protected void tryEjectBuffer() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); @@ -575,32 +574,32 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements int x = xCoord + dir.offsetX * 4; int y = yCoord - 3; int z = zCoord + dir.offsetZ * 4; - + List items = new ArrayList(); for(int i = 5; i < 14; i++) { ItemStack stack = slots[i]; - + if(stack != null) { items.add(stack.copy()); } } - + TileEntity tile = worldObj.getTileEntity(x, y, z); if(tile instanceof IInventory) { supplyContainer((IInventory) tile, items, dir.getOpposite()); } - + Block b = worldObj.getBlock(x, y, z); if(b instanceof IConveyorBelt) { supplyConveyor((IConveyorBelt) b, items, x, y, z); } - + items.removeIf(i -> i == null || i.stackSize <= 0); for(int i = 5; i < 14; i++) { int index = i - 5; - + if(items.size() > index) { slots[i] = items.get(index).copy(); } else { @@ -608,66 +607,66 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } } } - + /** pulls up an AABB around the drillbit and tries to either conveyor output or buffer collected items */ protected void tryCollect(int radius) { int yLevel = getY(); - + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - radius, yLevel - 1, zCoord - radius, xCoord + radius + 1, yLevel + 2, zCoord + radius + 1)); - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); int x = xCoord + dir.offsetX * 4; int y = yCoord - 3; int z = zCoord + dir.offsetZ * 4; - + List stacks = new ArrayList(); items.forEach(i -> stacks.add(i.getEntityItem())); - + /* try to insert into a valid container */ TileEntity tile = worldObj.getTileEntity(x, y, z); if(tile instanceof IInventory) { supplyContainer((IInventory) tile, stacks, dir.getOpposite()); } - + /* try to place on conveyor belt */ Block b = worldObj.getBlock(x, y, z); if(b instanceof IConveyorBelt) { supplyConveyor((IConveyorBelt) b, stacks, x, y, z); } - + items.removeIf(i -> i.isDead || i.getEntityItem().stackSize <= 0); - + /* collect remaining items in internal buffer */ outer: for(EntityItem item : items) { - + ItemStack stack = item.getEntityItem(); - + /* adding items to existing stacks */ for(int i = 5; i < 14; i++) { - + if(slots[i] != null && slots[i].stackSize < slots[i].getMaxStackSize() && stack.isItemEqual(slots[i]) && ItemStack.areItemStackTagsEqual(stack, slots[i])) { int toAdd = Math.min(slots[i].getMaxStackSize() - slots[i].stackSize, stack.stackSize); slots[i].stackSize += toAdd; stack.stackSize -= toAdd; - + chuteTimer = 40; - + if(stack.stackSize <= 0) { item.setDead(); continue outer; } } } - + /* add leftovers to empty slots */ for(int i = 5; i < 14; i++) { - + if(slots[i] == null) { - + chuteTimer = 40; - + slots[i] = stack.copy(); item.setDead(); break; @@ -675,60 +674,60 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } } } - + /** places all items into a connected container, if possible */ protected void supplyContainer(IInventory inv, List items, ForgeDirection dir) { - + int side = dir.ordinal(); int[] access = null; - + if(inv instanceof ISidedInventory) { ISidedInventory sided = (ISidedInventory) inv; access = InventoryUtil.masquerade(sided, dir.ordinal()); } - + for(ItemStack item : items) { - + if(item.stackSize <= 0) continue; - + CraneInserter.addToInventory(inv, access, item, side); chuteTimer = 40; } } - + /** moves all items onto a connected conveyor belt */ protected void supplyConveyor(IConveyorBelt belt, List items, int x, int y, int z) { - + Random rand = worldObj.rand; - + for(ItemStack item : items) { - + if(item.stackSize <= 0) continue; - + Vec3 base = Vec3.createVectorHelper(x + rand.nextDouble(), y + 0.5, z + rand.nextDouble()); Vec3 vec = belt.getClosestSnappingPosition(worldObj, x, y, z, base); - + EntityMovingItem moving = new EntityMovingItem(worldObj); moving.setPosition(base.xCoord, vec.yCoord, base.zCoord); moving.setItemStack(item.copy()); worldObj.spawnEntityInWorld(moving); item.stackSize = 0; - + chuteTimer = 40; } } - + public long getPowerConsumption() { return consumption; } - + public int getFortuneLevel() { EnumDrillType type = getInstalledDrill(); - + if(type != null) return type.fortune; return 0; } - + public boolean shouldIgnoreBlock(Block block, int x, int y, int z) { return block.isAir(worldObj, x, y, z) || block.getMaterial() == ModBlocks.materialGas || block.getBlockHardness(worldObj, x, y, z) < 0 || block.getMaterial().isLiquid() || block == Blocks.bedrock; } @@ -740,32 +739,32 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements if(data.hasKey("walling")) this.enableWalling = !this.enableWalling; if(data.hasKey("veinminer")) this.enableVeinMiner = !this.enableVeinMiner; if(data.hasKey("silktouch")) this.enableSilkTouch = !this.enableSilkTouch; - + this.markChanged(); } - + public EnumDrillType getInstalledDrill() { if(slots[4] != null && slots[4].getItem() instanceof ItemDrillbit) { return EnumUtil.grabEnumSafely(EnumDrillType.class, slots[4].getItemDamage()); } - + return null; } - + public boolean canVeinMine() { EnumDrillType type = getInstalledDrill(); return this.enableVeinMiner && type != null && type.vein; } - + public boolean canSilkTouch() { EnumDrillType type = getInstalledDrill(); return this.enableSilkTouch && type != null && type.silk; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.enableDrill = nbt.getBoolean("d"); this.enableCrusher = nbt.getBoolean("c"); this.enableWalling = nbt.getBoolean("w"); @@ -775,11 +774,11 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements this.power = nbt.getLong("p"); this.tank.readFromNBT(nbt, "tank"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setBoolean("d", enableDrill); nbt.setBoolean("c", enableCrusher); nbt.setBoolean("w", enableWalling); @@ -805,12 +804,12 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineExcavator(player.inventory, this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 3, @@ -821,10 +820,10 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements zCoord + 4 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -874,10 +873,12 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.EFFECT, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExposureChamber.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExposureChamber.java index 190b9b7d2..77ac2635a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExposureChamber.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineExposureChamber.java @@ -1,9 +1,10 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineExposureChamber; import com.hbm.inventory.gui.GUIMachineExposureChamber; import com.hbm.inventory.recipes.ExposureChamberRecipes; @@ -31,10 +32,10 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineExposureChamber extends TileEntityMachineBase implements IGUIProvider, IEnergyReceiverMK2, IUpgradeInfoProvider { - + public long power; public static final long maxPower = 1_000_000; - + public int progress; public static final int processTimeBase = 200; public int processTime = processTimeBase; @@ -45,7 +46,9 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl public boolean isOn = false; public float rotation; public float prevRotation; - + + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -53,7 +56,7 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl this.power = nbt.getLong("power"); this.savedParticles = nbt.getInteger("savedParticles"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -82,39 +85,39 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.isOn = false; this.power = Library.chargeTEFromItems(slots, 5, power, maxPower); - + if(worldObj.getTotalWorldTime() % 20 == 0) { for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - UpgradeManager.eval(slots, 6, 7); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overdriveLevel = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3); - + + upgradeManager.checkSlots(this, slots, 6, 7); + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overdriveLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + this.consumption = this.consumptionBase; - + this.processTime = this.processTimeBase - this.processTimeBase / 4 * speedLevel; this.consumption *= (speedLevel / 2 + 1); this.processTime *= (powerLevel / 2 + 1); this.consumption /= (powerLevel + 1); this.processTime /= (overdriveLevel + 1); this.consumption *= (overdriveLevel * 2 + 1); - + if(slots[1] == null && slots[0] != null && slots[3] != null && this.savedParticles <= 0) { ExposureChamberRecipe recipe = this.getRecipe(slots[0], slots[3]); - + if(recipe != null) { - + ItemStack container = slots[0].getItem().getContainerItem(slots[0]); - + boolean canStore = false; - + if(container == null) { canStore = true; } else if(slots[2] == null) { @@ -124,7 +127,7 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl slots[2].stackSize++; canStore = true; } - + if(canStore) { slots[1] = slots[0].copy(); slots[1].stackSize = 0; @@ -133,47 +136,47 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl } } } - + if(slots[1] != null && this.savedParticles > 0 && this.power >= this.consumption) { ExposureChamberRecipe recipe = this.getRecipe(slots[1], slots[3]); - + if(recipe != null && (slots[4] == null || (slots[4].getItem() == recipe.output.getItem() && slots[4].getItemDamage() == recipe.output.getItemDamage() && slots[4].stackSize + recipe.output.stackSize <= slots[4].getMaxStackSize()))) { this.progress++; this.power -= this.consumption; this.isOn = true; - + if(this.progress >= this.processTime) { this.progress = 0; this.savedParticles--; this.decrStackSize(3, 1); - + if(slots[4] == null) { slots[4] = recipe.output.copy(); } else { slots[4].stackSize += recipe.output.stackSize; } } - + } else { this.progress = 0; } } else { this.progress = 0; } - + if(this.savedParticles <= 0) { slots[1] = null; } - + this.networkPackNT(50); } else { - + this.prevRotation = this.rotation; - + if(this.isOn) { - + this.rotation += 10D; - + if(this.rotation >= 720D) { this.rotation -= 720D; this.prevRotation -= 720D; @@ -181,7 +184,7 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl } } } - + public DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite(); @@ -193,44 +196,44 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl new DirPos(xCoord + rot.offsetX * 9, yCoord, zCoord + rot.offsetZ * 9, rot) }; } - + public ExposureChamberRecipe getRecipe(ItemStack particle, ItemStack ingredient) { return ExposureChamberRecipes.getRecipe(particle, ingredient); } @Override public boolean isItemValidForSlot(int i, ItemStack stack) { - + //will only load new capsules if there's no cached particles, this should prevent clogging //accept items when the slots are already partially filled, i.e. applicable if(i == 0 && slots[0] != null) return true; if(i == 3 && slots[3] != null) return true; - + //if there's no particle stored, use the un-consumed capsule for reference ItemStack particle = slots[1] != null ? slots[1] : slots[0]; - + //if no particle is loaded and an ingot is present if(i == 0 && particle == null && slots[3] != null) { ExposureChamberRecipe recipe = getRecipe(stack, slots[3]); return recipe != null; } - + //if a particle is loaded but no ingot present if(i == 3 && particle != null && slots[3] == null) { ExposureChamberRecipe recipe = getRecipe(slots[0], stack); return recipe != null; } - + //if there's nothing at all, find a reference recipe and see if the item matches anything if(particle == null && slots[3] == null) { - + for(ExposureChamberRecipe recipe : ExposureChamberRecipes.recipes) { if(i == 0 && recipe.particle.matchesRecipe(stack, true)) return true; - if(i == 3 && recipe.ingredient.matchesRecipe(stack, true)) return true; + if(i == 3 && recipe.ingredient.matchesRecipe(stack, true)) return true; } } - + return false; } @@ -253,7 +256,7 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl buf.writeLong(this.power); buf.writeByte((byte) this.savedParticles); } - + @Override public void deserialize(ByteBuf buf) { this.isOn = buf.readBoolean(); @@ -280,10 +283,10 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl } AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 8, @@ -294,10 +297,10 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl zCoord + 9 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -337,10 +340,11 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java index 384e252c7..62e76ae0e 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineGasCent.java @@ -11,8 +11,8 @@ import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType; import com.hbm.items.ModItems; import com.hbm.items.machine.IItemFluidIdentifier; import com.hbm.lib.Library; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.LoopedSoundPacket; +import com.hbm.main.MainRegistry; +import com.hbm.sound.AudioWrapper; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.BufferUtil; @@ -23,7 +23,6 @@ import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardReceiver; import api.hbm.tile.IInfoProviderEC; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -33,57 +32,61 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; //epic! public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IGUIProvider, IInfoProviderEC { - + public long power; public int progress; public boolean isProgressing; public static final int maxPower = 100000; public static final int processingSpeed = 150; - + public FluidTank tank; public PseudoFluidTank inputTank; public PseudoFluidTank outputTank; - + + private int audioDuration = 0; + private AudioWrapper audio; + private static final int[] slots_io = new int[] { 0, 1, 2, 3 }; - + public TileEntityMachineGasCent() { - super(7); + super(7); tank = new FluidTank(Fluids.UF6, 2000); inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000); outputTank = new PseudoFluidTank(PseudoFluidType.LEUF6, 8000); } - + @Override public String getName() { return "container.gasCentrifuge"; } - + @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { return i < 4; } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return slots_io; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + power = nbt.getLong("power"); progress = nbt.getShort("progress"); tank.readFromNBT(nbt, "tank"); inputTank.readFromNBT(nbt, "inputTank"); outputTank.readFromNBT(nbt, "outputTank"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -93,127 +96,127 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I inputTank.writeToNBT(nbt, "inputTank"); outputTank.writeToNBT(nbt, "outputTank"); } - + public int getCentrifugeProgressScaled(int i) { return (progress * i) / getProcessingSpeed(); } - + public long getPowerRemainingScaled(int i) { return (power * i) / maxPower; } - + private boolean canEnrich() { if(power > 0 && this.inputTank.getFill() >= inputTank.getTankType().getFluidConsumed() && this.outputTank.getFill() + this.inputTank.getTankType().getFluidProduced() <= outputTank.getMaxFill()) { - + ItemStack[] list = inputTank.getTankType().getOutput(); - + if(this.inputTank.getTankType().getIfHighSpeed()) if(!(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed)) return false; - + if(list == null) return false; - + if(list.length < 1) return false; - + if(InventoryUtil.doesArrayHaveSpace(slots, 0, 3, list)) return true; } - + return false; } - + private void enrich() { ItemStack[] output = inputTank.getTankType().getOutput(); - + this.progress = 0; - inputTank.setFill(inputTank.getFill() - inputTank.getTankType().getFluidConsumed()); - outputTank.setFill(outputTank.getFill() + inputTank.getTankType().getFluidProduced()); - + inputTank.setFill(inputTank.getFill() - inputTank.getTankType().getFluidConsumed()); + outputTank.setFill(outputTank.getFill() + inputTank.getTankType().getFluidProduced()); + for(byte i = 0; i < output.length; i++) InventoryUtil.tryAddItemToInventory(slots, 0, 3, output[i].copy()); //reference types almost got me again } - + private void attemptConversion() { if(inputTank.getFill() < inputTank.getMaxFill() && tank.getFill() > 0) { int fill = Math.min(inputTank.getMaxFill() - inputTank.getFill(), tank.getFill()); - + tank.setFill(tank.getFill() - fill); inputTank.setFill(inputTank.getFill() + fill); } } - + private boolean attemptTransfer(TileEntity te) { if(te instanceof TileEntityMachineGasCent) { TileEntityMachineGasCent cent = (TileEntityMachineGasCent) te; - + if(cent.tank.getFill() == 0 && cent.tank.getTankType() == tank.getTankType()) { if(cent.inputTank.getTankType() != outputTank.getTankType() && outputTank.getTankType() != PseudoFluidType.NONE) { cent.inputTank.setTankType(outputTank.getTankType()); cent.outputTank.setTankType(outputTank.getTankType().getOutputType()); } - + //God, why did I forget about the entirety of the fucking math library? if(cent.inputTank.getFill() < cent.inputTank.getMaxFill() && outputTank.getFill() > 0) { int fill = Math.min(cent.inputTank.getMaxFill() - cent.inputTank.getFill(), outputTank.getFill()); - + outputTank.setFill(outputTank.getFill() - fill); cent.inputTank.setFill(cent.inputTank.getFill() + fill); } - + return true; } } - + return false; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + updateConnections(); power = Library.chargeTEFromItems(slots, 4, power, maxPower); setTankType(5); - + if(GasCentrifugeRecipes.fluidConversions.containsValue(inputTank.getTankType())) { attemptConversion(); } - + if(canEnrich()) { - + isProgressing = true; this.progress++; - + if(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed) this.power -= 300; else this.power -= 200; - + if(this.power < 0) { power = 0; this.progress = 0; } - + if(progress >= getProcessingSpeed()) enrich(); - + } else { isProgressing = false; this.progress = 0; } - + if(worldObj.getTotalWorldTime() % 10 == 0) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); TileEntity te = worldObj.getTileEntity(this.xCoord - dir.offsetX, this.yCoord, this.zCoord - dir.offsetZ); - + //*AT THE MOMENT*, there's not really any need for a dedicated method for this. Yet. if(!attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) { ItemStack[] converted = new ItemStack[] { new ItemStack(ModItems.nugget_uranium_fuel, 6), new ItemStack(ModItems.fluorite) }; - + if(this.outputTank.getFill() >= 600 && InventoryUtil.doesArrayHaveSpace(slots, 0, 3, converted)) { this.outputTank.setFill(this.outputTank.getFill() - 600); for(ItemStack stack : converted) @@ -221,13 +224,46 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I } } } - + this.networkPackNT(50); - PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); + } else { + + if(isProgressing) { + audioDuration += 2; + } else { + audioDuration -= 3; + } + + audioDuration = MathHelper.clamp_int(audioDuration, 0, 60); + + if(audioDuration > 10) { + + if(audio == null) { + audio = createAudioLoop(); + audio.startSound(); + } else if(!audio.isPlaying()) { + audio = rebootAudio(audio); + } + + audio.updateVolume(getVolume(1F)); + audio.updatePitch((audioDuration - 10) / 100F + 0.5F); + + } else { + + if(audio != null) { + audio.stopSound(); + audio = null; + } + } } } - + + @Override + public AudioWrapper createAudioLoop() { + return MainRegistry.proxy.getLoopedSound("hbm:block.centrifugeOperate", xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F); + } + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -239,35 +275,35 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I buf.writeInt(outputTank.getFill()); BufferUtil.writeString(buf, inputTank.getTankType().name); //cough cough BufferUtil.writeString(buf, outputTank.getTankType().name); - + tank.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); power = buf.readLong(); progress = buf.readInt(); isProgressing = buf.readBoolean(); - + inputTank.setFill(buf.readInt()); outputTank.setFill(buf.readInt()); inputTank.setTankType(PseudoFluidType.types.get(BufferUtil.readString(buf))); outputTank.setTankType(PseudoFluidType.types.get(BufferUtil.readString(buf))); - + tank.deserialize(buf); } - + private void updateConnections() { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - + if(GasCentrifugeRecipes.fluidConversions.containsValue(inputTank.getTankType())) { this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } } - + private DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y), @@ -286,40 +322,40 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I @Override public long getPower() { return power; - + } @Override public long getMaxPower() { return maxPower; } - + public int getProcessingSpeed() { if(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed) { return processingSpeed - 70; } return processingSpeed; } - + public void setTankType(int in) { - + if(slots[in] != null && slots[in].getItem() instanceof IItemFluidIdentifier) { IItemFluidIdentifier id = (IItemFluidIdentifier) slots[in].getItem(); FluidType newType = id.getType(worldObj, xCoord, yCoord, zCoord, slots[in]); - + if(tank.getTankType() != newType) { PseudoFluidType pseudo = GasCentrifugeRecipes.fluidConversions.get(newType); - + if(pseudo != null) { inputTank.setTankType(pseudo); outputTank.setTankType(pseudo.getOutputType()); tank.setTankType(newType); } } - + } } - + @Override public FluidTank[] getReceivingTanks() { return new FluidTank[] { tank }; @@ -329,71 +365,71 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I public FluidTank[] getAllTanks() { return new FluidTank[] { tank }; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 5, zCoord + 1); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 65536.0D; } - + public class PseudoFluidTank { PseudoFluidType type; int fluid; int maxFluid; - + public PseudoFluidTank(PseudoFluidType type, int maxFluid) { this.type = type; this.maxFluid = maxFluid; } - + public void setFill(int i) { fluid = i; } - + public void setTankType(PseudoFluidType type) { - + if(this.type.equals(type)) return; - + if(type == null) this.type = PseudoFluidType.NONE; else this.type = type; - + this.setFill(0); } - + public PseudoFluidType getTankType() { return type; } - + public int getFill() { return fluid; } - + public int getMaxFill() { return maxFluid; } - + //Called by TE to save fillstate public void writeToNBT(NBTTagCompound nbt, String s) { nbt.setInteger(s, fluid); nbt.setInteger(s + "_max", maxFluid); nbt.setString(s + "_type", type.name); } - + //Called by TE to load fillstate public void readFromNBT(NBTTagCompound nbt, String s) { fluid = nbt.getInteger(s); @@ -402,7 +438,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I type = PseudoFluidType.types.get(nbt.getString(s + "_type")); if(type == null) type = PseudoFluidType.NONE; } - + /* ______ ______ * _I____I_ _I____I_ * / \\\ / \\\ diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineHephaestus.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineHephaestus.java index ccc8406f9..3453ef320 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineHephaestus.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineHephaestus.java @@ -10,26 +10,28 @@ import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IFluidCopiable { +public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IFluidCopiable { public FluidTank input; public FluidTank output; public int bufferedHeat; - + public float rot; public float prevRot; @@ -37,29 +39,35 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements this.input = new FluidTank(Fluids.OIL, 24_000); this.output = new FluidTank(Fluids.HOTOIL, 24_000); } - + private int[] heat = new int[10]; private long fissureScanTime; private AudioWrapper audio; - + + ByteBuf buf; + @Override public void updateEntity() { if(!worldObj.isRemote) { - + + if(this.buf != null) + this.buf.release(); + this.buf = Unpooled.buffer(); + setupTanks(); - + if(worldObj.getTotalWorldTime() % 20 == 0) { this.updateConnections(); } - + int height = (int) (worldObj.getTotalWorldTime() % 10); int range = 7; int y = yCoord - 1 - height; - + heat[height] = 0; - + if(y >= 0) { for(int x = -range; x <= range; x++) { for(int z = -range; z <= range; z++) { @@ -67,29 +75,28 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements } } } - - NBTTagCompound data = new NBTTagCompound(); - input.writeToNBT(data, "i"); - + + input.serialize(buf); + heatFluid(); - - output.writeToNBT(data, "o"); - + + output.serialize(buf); + if(output.getFill() > 0) { for(DirPos pos : getConPos()) { this.sendFluid(output, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - data.setInteger("heat", this.getTotalHeat()); - INBTPacketReceiver.networkPack(this, data, 150); - + buf.writeInt(this.getTotalHeat()); + networkPackNT(150); + } else { - + this.prevRot = this.rot; - + if(this.bufferedHeat > 0) { this.rot += 0.5F; - + if(worldObj.rand.nextInt(7) == 0) { double x = worldObj.rand.nextGaussian() * 2; double y = worldObj.rand.nextGaussian() * 3; @@ -107,23 +114,23 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements audio = null; } } - + if(this.rot >= 360F) { this.prevRot -= 360F; this.rot -= 360F; } } } - + protected void heatFluid() { - + FluidType type = input.getTankType(); - + if(type.hasTrait(FT_Heatable.class)) { FT_Heatable trait = type.getTrait(FT_Heatable.class); int heat = this.getTotalHeat(); HeatingStep step = trait.getFirstStep(); - + int inputOps = input.getFill() / step.amountReq; int outputOps = (output.getMaxFill() - output.getFill()) / step.amountProduced; int heatOps = heat / step.heatReq; @@ -134,14 +141,14 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); } } - + protected void setupTanks() { - + FluidType type = input.getTankType(); - + if(type.hasTrait(FT_Heatable.class)) { FT_Heatable trait = type.getTrait(FT_Heatable.class); - + if(trait.getEfficiency(HeatingType.HEATEXCHANGER) > 0) { FluidType outType = trait.getFirstStep().typeProduced; output.setTankType(outType); @@ -152,55 +159,60 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements input.setTankType(Fluids.NONE); output.setTankType(Fluids.NONE); } - + protected int heatFromBlock(int x, int y, int z) { Block b = worldObj.getBlock(x, y, z); - + if(b == Blocks.lava || b == Blocks.flowing_lava) return 5; if(b == ModBlocks.volcanic_lava_block) return 150; - + if(b == ModBlocks.ore_volcano) { this.fissureScanTime = worldObj.getTotalWorldTime(); return 300; } - + return 0; } - + public int getTotalHeat() { boolean fissure = worldObj.getTotalWorldTime() - this.fissureScanTime < 20; int heat = 0; - + for(int h : this.heat) { heat += h; } - + if(fissure) { heat *= 3; } - + return heat; } @Override - public void networkUnpack(NBTTagCompound nbt) { - input.readFromNBT(nbt, "i"); - output.readFromNBT(nbt, "o"); - - this.bufferedHeat = nbt.getInteger("heat"); + public void serialize(ByteBuf buf) { + buf.writeBytes(this.buf); } - + + @Override + public void deserialize(ByteBuf buf) { + input.deserialize(buf); + output.deserialize(buf); + + this.bufferedHeat = buf.readInt(); + } + private void updateConnections() { - + if(input.getTankType() == Fluids.NONE) return; - + for(DirPos pos : getConPos()) { this.trySubscribe(input.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private DirPos[] getConPos() { - + return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), new DirPos(xCoord - 2, yCoord, zCoord, Library.NEG_X), @@ -212,7 +224,7 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements new DirPos(xCoord, yCoord + 11, zCoord - 2, Library.NEG_Z) }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -220,7 +232,7 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements this.input.readFromNBT(nbt, "0"); this.output.readFromNBT(nbt, "1"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -243,12 +255,12 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements public FluidTank[] getReceivingTanks() { return new FluidTank[] {input}; } - + @Override public boolean canConnect(FluidType type, ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.UP && dir != ForgeDirection.DOWN; } - + @Override public void onChunkUnload() { super.onChunkUnload(); @@ -268,12 +280,12 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements audio = null; } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 3, @@ -284,10 +296,10 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements zCoord + 4 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIGenerator.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIGenerator.java index 64961ce37..34dbf6200 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIGenerator.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineIGenerator.java @@ -221,15 +221,18 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement return new int[] { 3, 4, 5, 6 }; } + // o7 + /* @Override public void networkUnpack(NBTTagCompound nbt) { super.networkUnpack(nbt); - + this.power = nbt.getLong("power"); this.spin = nbt.getInteger("spin"); this.burn = nbt.getIntArray("burn"); this.hasRTG = nbt.getBoolean("hasRTG"); } + */ public int getPowerFromFuel(boolean con) { FluidType type = tanks[1].getTankType(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineLargeTurbine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineLargeTurbine.java index a77cfaf2e..060710858 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineLargeTurbine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineLargeTurbine.java @@ -30,6 +30,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -102,6 +103,8 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme return "container.machineLargeTurbine"; } + private boolean operational; + @Override public void updateEntity() { @@ -117,9 +120,7 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme tanks[0].setType(0, 1, slots); tanks[0].loadTank(2, 3, slots); power = Library.chargeItemsFromTE(slots, 4, power, maxPower); - - boolean operational = false; - + FluidType in = tanks[0].getTankType(); boolean valid = false; if(in.hasTrait(FT_Coolable.class)) { @@ -145,13 +146,9 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme if(power > maxPower) power = maxPower; tanks[1].unloadTank(5, 6, slots); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setBoolean("operational", operational); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - this.networkPack(data, 50); + + this.networkPackNT(50); + } else { this.lastRotor = this.rotor; this.rotor += this.fanAcceleration; @@ -199,14 +196,23 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme new DirPos(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, dir) }; } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.power = data.getLong("power"); - this.shouldTurn = data.getBoolean("operational"); - tanks[0].readFromNBT(data, "t0"); - tanks[1].readFromNBT(data, "t1"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeBoolean(operational); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.shouldTurn = buf.readBoolean(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); } public long getPowerScaled(int i) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java index 9ea737988..6dff13040 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import java.util.Set; import com.google.common.collect.Sets; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMiningLaser; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -31,6 +32,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardSender; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -50,7 +52,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineMiningLaser extends TileEntityMachineBase implements IEnergyReceiverMK2, IMiningDrill, IFluidStandardSender, IGUIProvider, IUpgradeInfoProvider { - + public long power; public int age = 0; public static final long maxPower = 100000000; @@ -68,8 +70,10 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen boolean lock = false; double breakProgress; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineMiningLaser() { - + //slot 0: battery //slots 1 - 8: upgrades //slots 9 - 29: output @@ -82,72 +86,72 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen return "container.miningLaser"; } + private double clientBreakProgress; + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.updateConnections(); this.sendFluid(tank, worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X); this.sendFluid(tank, worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X); this.sendFluid(tank, worldObj, xCoord, yCoord + 2, zCoord, Library.POS_Z); this.sendFluid(tank, worldObj, xCoord, yCoord - 2, zCoord, Library.NEG_Z); - + power = Library.chargeTEFromItems(slots, 0, power, maxPower); - + //reset progress if the position changes if(lastTargetX != targetX || lastTargetY != targetY || lastTargetZ != targetZ) breakProgress = 0; - + //set last positions for interpolation and the like lastTargetX = targetX; lastTargetY = targetY; lastTargetZ = targetZ; - - double clientBreakProgress = 0; - + if(isOn) { - - UpgradeManager.eval(slots, 1, 8); - int cycles = 1 + UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - int speed = 1 + Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 12); - int range = 1 + Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT) * 2, 24); - int fortune = Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3); + + upgradeManager.checkSlots(this, slots, 1, 8); + int cycles = 1 + upgradeManager.getLevel(UpgradeType.OVERDRIVE); + int speed = 1 + upgradeManager.getLevel(UpgradeType.SPEED); + int range = 1 + upgradeManager.getLevel(UpgradeType.EFFECT) * 2; + int fortune = upgradeManager.getLevel(UpgradeType.FORTUNE); int consumption = this.consumption - - (this.consumption * Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 12) / 16) - + (this.consumption * Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 12) / 16); - + - (this.consumption * upgradeManager.getLevel(UpgradeType.POWER) / 16) + + (this.consumption * upgradeManager.getLevel(UpgradeType.SPEED) / 16); + for(int i = 0; i < cycles; i++) { - + if(power < consumption) { beam = false; break; } - + power -= consumption; - + if(targetY <= 0) targetY = yCoord - 2; - + scan(range); - - + + Block block = worldObj.getBlock(targetX, targetY, targetZ); - + if(block.getMaterial().isLiquid()) { worldObj.setBlockToAir(targetX, targetY, targetZ); buildDam(); continue; } - + if(beam && canBreak(block, targetX, targetY, targetZ)) { - + breakProgress += getBreakSpeed(speed); clientBreakProgress = Math.min(breakProgress, 1); - + if(breakProgress < 1) { worldObj.destroyBlockInWorldPartially(-1, targetX, targetY, targetZ, (int) Math.floor(breakProgress * 10)); } else { @@ -165,44 +169,47 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen this.tryFillContainer(xCoord - 2, yCoord, zCoord); this.tryFillContainer(xCoord, yCoord, zCoord + 2); this.tryFillContainer(xCoord, yCoord, zCoord - 2); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("lastX", lastTargetX); - data.setInteger("lastY", lastTargetY); - data.setInteger("lastZ", lastTargetZ); - data.setInteger("x", targetX); - data.setInteger("y", targetY); - data.setInteger("z", targetZ); - data.setBoolean("beam", beam); - data.setBoolean("isOn", isOn); - data.setDouble("progress", clientBreakProgress); - tank.writeToNBT(data, "t"); - - this.networkPack(data, 250); + + this.networkPackNT(250); } } - + private void updateConnections() { this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord, ForgeDirection.UP); } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - this.power = data.getLong("power"); - this.lastTargetX = data.getInteger("lastX"); - this.lastTargetY = data.getInteger("lastY"); - this.lastTargetZ = data.getInteger("lastZ"); - this.targetX = data.getInteger("x"); - this.targetY = data.getInteger("y"); - this.targetZ = data.getInteger("z"); - this.beam = data.getBoolean("beam"); - this.isOn = data.getBoolean("isOn"); - this.breakProgress = data.getDouble("progress"); - tank.readFromNBT(data, "t"); + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeInt(this.lastTargetX); + buf.writeInt(this.lastTargetY); + buf.writeInt(this.lastTargetZ); + buf.writeInt(this.targetX); + buf.writeInt(this.targetY); + buf.writeInt(this.targetZ); + buf.writeBoolean(this.beam); + buf.writeBoolean(this.isOn); + buf.writeDouble(this.clientBreakProgress); + tank.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.lastTargetX = buf.readInt(); + this.lastTargetY = buf.readInt(); + this.lastTargetZ = buf.readInt(); + this.targetX = buf.readInt(); + this.targetY = buf.readInt(); + this.targetZ = buf.readInt(); + this.beam = buf.readBoolean(); + this.isOn = buf.readBoolean(); + this.breakProgress = buf.readDouble(); + tank.deserialize(buf); + } + private void buildDam() { if(worldObj.getBlock(targetX + 1, targetY, targetZ).getMaterial().isLiquid()) worldObj.setBlock(targetX + 1, targetY, targetZ, ModBlocks.barricade); @@ -210,76 +217,76 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen if(worldObj.getBlock(targetX, targetY, targetZ + 1).getMaterial().isLiquid()) worldObj.setBlock(targetX, targetY, targetZ + 1, ModBlocks.barricade); if(worldObj.getBlock(targetX, targetY, targetZ - 1).getMaterial().isLiquid()) worldObj.setBlock(targetX, targetY, targetZ - 1, ModBlocks.barricade); } - + private void tryFillContainer(int x, int y, int z) { - + Block b = worldObj.getBlock(x, y, z); if(b != Blocks.chest && b != Blocks.trapped_chest && b != ModBlocks.crate_iron && b != ModBlocks.crate_desh && b != ModBlocks.crate_steel && b != ModBlocks.safe && b != Blocks.hopper) return; - + IInventory inventory = (IInventory)worldObj.getTileEntity(x, y, z); if(inventory == null) return; - + for(int i = 9; i <= 29; i++) { - + if(slots[i] != null) { int prev = slots[i].stackSize; slots[i] = InventoryUtil.tryAddItemToInventory(inventory, 0, inventory.getSizeInventory() - 1, slots[i]); - + if(slots[i] == null || slots[i].stackSize < prev) return; } } } - + private void breakBlock(int fortune) { - + Block b = worldObj.getBlock(targetX, targetY, targetZ); int meta = worldObj.getBlockMetadata(targetX, targetY, targetZ); boolean normal = true; boolean doesBreak = true; - + if(b == Blocks.lit_redstone_ore) b = Blocks.redstone_ore; - + ItemStack stack = new ItemStack(b, 1, meta); - + if(stack != null && stack.getItem() != null) { if(hasCrystallizer()) { CrystallizerRecipe result = CrystallizerRecipes.getOutput(stack, Fluids.PEROXIDE); if(result == null) result = CrystallizerRecipes.getOutput(stack, Fluids.SULFURIC_ACID); - + if(result != null) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, targetX + 0.5, targetY + 0.5, targetZ + 0.5, result.output.copy())); normal = false; } - + } else if(hasCentrifuge()) { - + ItemStack[] result = CentrifugeRecipes.getOutput(stack); if(result != null) { for(ItemStack sta : result) { - + if(sta != null) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, targetX + 0.5, targetY + 0.5, targetZ + 0.5, sta.copy())); normal = false; } } } - + } else if(hasShredder()) { - + ItemStack result = ShredderRecipes.getShredderResult(stack); if(result != null && result.getItem() != ModItems.scrap) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, targetX + 0.5, targetY + 0.5, targetZ + 0.5, result.copy())); normal = false; } - + } else if(hasSmelter()) { - + ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(stack); if(result != null) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, targetX + 0.5, targetY + 0.5, targetZ + 0.5, result.copy())); @@ -287,32 +294,32 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen } } } - + if(normal && b instanceof IDrillInteraction) { IDrillInteraction in = (IDrillInteraction) b; ItemStack drop = in.extractResource(worldObj, targetX, targetY, targetZ, meta, this); - + if(drop != null) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, targetX + 0.5, targetY + 0.5, targetZ + 0.5, drop.copy())); } - + doesBreak = in.canBreak(worldObj, targetX, targetY, targetZ, meta, this); } - + if(doesBreak) { if(normal) b.dropBlockAsItem(worldObj, targetX, targetY, targetZ, meta, fortune); worldObj.func_147480_a(targetX, targetY, targetZ, false); } - + suckDrops(); if(doesScream()) { worldObj.playSoundEffect(targetX + 0.5, targetY + 0.5, targetZ + 0.5, "hbm:block.screm", 2000.0F, 1.0F); } - + breakProgress = 0; } - + private static final Set bad = Sets.newHashSet(new Item[] { Item.getItemFromBlock(Blocks.dirt), Item.getItemFromBlock(Blocks.stone), @@ -326,14 +333,14 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen Items.snowball, Items.wheat_seeds }); - + //hahahahahahahaha he said "suck" private void suckDrops() { - + int rangeHor = 3; int rangeVer = 1; boolean nullifier = hasNullifier(); - + List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox( targetX + 0.5 - rangeHor, targetY + 0.5 - rangeVer, @@ -342,36 +349,36 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen targetY + 0.5 + rangeVer, targetZ + 0.5 + rangeHor )); - + for(EntityItem item : items) { - + if(item.isDead) continue; - + if(nullifier && bad.contains(item.getEntityItem().getItem())) { item.setDead(); continue; } - + if(item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.ore_oil)) { - + tank.setTankType(Fluids.OIL); //just to be sure - + tank.setFill(tank.getFill() + 500); if(tank.getFill() > tank.getMaxFill()) tank.setFill(tank.getMaxFill()); - + item.setDead(); continue; } - + ItemStack stack = InventoryUtil.tryAddItemToInventory(slots, 9, 29, item.getEntityItem().copy()); - + if(stack == null) item.setDead(); else item.setEntityItemStack(stack.copy()); //copy is not necessary but i'm paranoid due to the kerfuffle of the old drill } - + List mobs = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox( targetX + 0.5 - 1, targetY + 0.5 - 1, @@ -380,31 +387,31 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen targetY + 0.5 + 1, targetZ + 0.5 + 1 )); - + for(EntityLivingBase mob : mobs) { mob.setFire(5); } } - + public double getBreakSpeed(int speed) { - + float hardness = worldObj.getBlock(targetX, targetY, targetZ).getBlockHardness(worldObj, targetX, targetY, targetZ) * 15 / speed; - + if(hardness == 0) return 1; - + return 1 / hardness; } - + public void scan(int range) { - + for(int x = -range; x <= range; x++) { for(int z = -range; z <= range; z++) { - + if(worldObj.getBlock(x + xCoord, targetY, z + zCoord).getMaterial().isLiquid()) { continue; } - + if(canBreak(worldObj.getBlock(x + xCoord, targetY, z + zCoord), x + xCoord, targetY, z + zCoord)) { targetX = x + xCoord; targetZ = z + zCoord; @@ -413,23 +420,23 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen } } } - + beam = false; targetY--; } - + private boolean canBreak(Block block, int x, int y, int z) { return !block.isAir(worldObj, x, y, z) && block.getBlockHardness(worldObj, x, y, z) >= 0 && !block.getMaterial().isLiquid() && block != Blocks.bedrock; } - + public int getRange() { - + int range = 1; - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_effect_1) range += 2; else if(slots[i].getItem() == ModItems.upgrade_effect_2) @@ -438,100 +445,100 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen range += 6; } } - + return Math.min(range, 25); } - + public boolean hasNullifier() { - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_nullifier) return true; } } - + return false; } - + public boolean hasSmelter() { - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_smelter) return true; } } - + return false; } - + public boolean hasShredder() { - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_shredder) return true; } } - + return false; } - + public boolean hasCentrifuge() { - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_centrifuge) return true; } } - + return false; } - + public boolean hasCrystallizer() { - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_crystallizer) return true; } } - + return false; } - + public boolean doesScream() { - + for(int i = 1; i < 9; i++) { - + if(slots[i] != null) { - + if(slots[i].getItem() == ModItems.upgrade_screm) return true; } } - + return false; } - + public int getConsumption() { return this.consumption; } - + public int getWidth() { - + return 1 + getRange() * 2; } @@ -542,12 +549,12 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen public int getProgressScaled(int i) { return (int) (breakProgress * i); } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() @@ -567,20 +574,20 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen @Override public int[] getAccessibleSlotsFromSide(int slot) { - + int[] slots = new int[21]; - + for(int i = 0; i < 21; i++) { slots[i] = i + 9; } - + return slots; } @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && i >= 1 && i <= 8 && stack.getItem() instanceof ItemMachineUpgrade) worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -603,7 +610,7 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + tank.readFromNBT(nbt, "oil"); isOn = nbt.getBoolean("isOn"); } @@ -611,7 +618,7 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + tank.writeToNBT(nbt, "oil"); nbt.setBoolean("isOn", isOn); } @@ -674,12 +681,13 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 12; - if(type == UpgradeType.POWER) return 12; - if(type == UpgradeType.EFFECT) return 12; - if(type == UpgradeType.FORTUNE) return 3; - if(type == UpgradeType.OVERDRIVE) return 9; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 12); + upgrades.put(UpgradeType.POWER, 12); + upgrades.put(UpgradeType.EFFECT, 12); + upgrades.put(UpgradeType.FORTUNE, 3); + upgrades.put(UpgradeType.OVERDRIVE, 9); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMixer.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMixer.java index c1447512c..b3b14eacd 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMixer.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMixer.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMixer; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -31,22 +32,24 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IControlReceiver, IGUIProvider, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable { - +public class TileEntityMachineMixer extends TileEntityMachineBase implements IControlReceiver, IGUIProvider, IEnergyReceiverMK2, IFluidStandardTransceiver, IUpgradeInfoProvider, IFluidCopiable { + public long power; public static final long maxPower = 10_000; public int progress; public int processTime; public int recipeIndex; - + public float rotation; public float prevRotation; public boolean wasOn = false; private int consumption = 50; - + public FluidTank[] tanks; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineMixer() { super(5); this.tanks = new FluidTank[3]; @@ -62,53 +65,53 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); tanks[2].setType(2, slots); - - UpgradeManager.eval(slots, 3, 4); - int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE); - + + upgradeManager.checkSlots(this, slots, 3, 4); + int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int powerLevel = upgradeManager.getLevel(UpgradeType.POWER); + int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + this.consumption = 50; this.consumption += speedLevel * 150; this.consumption -= this.consumption * powerLevel * 0.25; this.consumption *= (overLevel * 3 + 1); - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tanks[0].getTankType() != Fluids.NONE) this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tanks[1].getTankType() != Fluids.NONE) this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + this.wasOn = this.canProcess(); - + if(this.wasOn) { this.progress++; this.power -= this.getConsumption(); - + this.processTime -= this.processTime * speedLevel / 4; this.processTime /= (overLevel + 1); - + if(processTime <= 0) this.processTime = 1; - + if(this.progress >= this.processTime) { this.process(); this.progress = 0; } - + } else { this.progress = 0; } - + for(DirPos pos : getConPos()) { if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + NBTTagCompound data = new NBTTagCompound(); data.setLong("power", power); data.setInteger("processTime", processTime); @@ -119,22 +122,22 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB tanks[i].writeToNBT(data, i + ""); } this.networkPackNT(50); - + } else { - + this.prevRotation = this.rotation; - + if(this.wasOn) { this.rotation += 20F; } - + if(this.rotation >= 360) { this.rotation -= 360; this.prevRotation -= 360; } } } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -143,10 +146,10 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB buf.writeInt(progress); buf.writeInt(recipeIndex); buf.writeBoolean(wasOn); - + for(int i = 0; i < tanks.length; i++) tanks[i].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -155,24 +158,10 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB progress = buf.readInt(); recipeIndex = buf.readInt(); wasOn = buf.readBoolean(); - + for(int i = 0; i < tanks.length; i++) tanks[i].deserialize(buf); } - @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.processTime = nbt.getInteger("processTime"); - this.progress = nbt.getInteger("progress"); - this.recipeIndex = nbt.getInteger("recipe"); - this.wasOn = nbt.getBoolean("wasOn"); - for(int i = 0; i < 3; i++) { - tanks[i].readFromNBT(nbt, i + ""); - } - } - public boolean canProcess() { MixerRecipe[] recipes = MixerRecipes.getOutput(tanks[2].getTankType()); @@ -180,38 +169,38 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB this.recipeIndex = 0; return false; } - + this.recipeIndex = this.recipeIndex % recipes.length; MixerRecipe recipe = recipes[this.recipeIndex]; if(recipe == null) { this.recipeIndex = 0; return false; } - + tanks[0].setTankType(recipe.input1 != null ? recipe.input1.type : Fluids.NONE); tanks[1].setTankType(recipe.input2 != null ? recipe.input2.type : Fluids.NONE); if(recipe.input1 != null && tanks[0].getFill() < recipe.input1.fill) return false; if(recipe.input2 != null && tanks[1].getFill() < recipe.input2.fill) return false; - + /* simplest check would usually go first, but fluid checks also do the setup and we want that to happen even without power */ if(this.power < getConsumption()) return false; - + if(recipe.output + tanks[2].getFill() > tanks[2].getMaxFill()) return false; - + if(recipe.solidInput != null) { - + if(slots[1] == null) return false; - - if(!recipe.solidInput.matchesRecipe(slots[1], true) || recipe.solidInput.stacksize > slots[1].stackSize) return false; + + if(!recipe.solidInput.matchesRecipe(slots[1], true) || recipe.solidInput.stacksize > slots[1].stackSize) return false; } - + this.processTime = recipe.processTime; return true; } - + protected void process() { - + MixerRecipe[] recipes = MixerRecipes.getOutput(tanks[2].getTankType()); MixerRecipe recipe = recipes[this.recipeIndex % recipes.length]; @@ -220,11 +209,11 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB if(recipe.solidInput != null) this.decrStackSize(1, recipe.solidInput.stacksize); tanks[2].setFill(tanks[2].getFill() + recipe.output); } - + public int getConsumption() { return consumption; } - + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y), @@ -234,7 +223,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z), }; } - + @Override public int[] getAccessibleSlotsFromSide(int meta) { return new int[] { 1 }; @@ -242,16 +231,16 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - + MixerRecipe[] recipes = MixerRecipes.getOutput(tanks[2].getTankType()); if(recipes == null || recipes.length <= 0) return false; - + MixerRecipe recipe = recipes[this.recipeIndex % recipes.length]; if(recipe == null || recipe.solidInput == null) return false; - + return recipe.solidInput.matchesRecipe(itemStack, true); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -262,11 +251,11 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB this.recipeIndex = nbt.getInteger("recipe"); for(int i = 0; i < 3; i++) this.tanks[i].readFromNBT(nbt, i + ""); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setInteger("progress", progress); nbt.setInteger("processTime", processTime); @@ -314,19 +303,19 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMixer(player.inventory, this); } - + AxisAlignedBB aabb; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(aabb != null) return aabb; - + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 3, zCoord + 1); return aabb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -364,11 +353,12 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 6; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 6); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineOreSlopper.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineOreSlopper.java index b37ae8279..35fcc77e6 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineOreSlopper.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineOreSlopper.java @@ -1,9 +1,10 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerOreSlopper; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; @@ -47,18 +48,18 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineOreSlopper extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable { - + public long power; public static final long maxPower = 100_000; - + public static final int waterUsedBase = 1_000; public int waterUsed = waterUsedBase; public static final long consumptionBase = 200; public long consumption = consumptionBase; - + public float progress; public boolean processing; - + public SlopperAnimation animation = SlopperAnimation.LOWERING; public float slider; public float prevSlider; @@ -69,10 +70,12 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement public float fan; public float prevFan; public int delay; - + public FluidTank[] tanks; public double[] ores = new double[BedrockOreType.values().length]; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineOreSlopper() { super(11); tanks = new FluidTank[2]; @@ -84,75 +87,75 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement public String getName() { return "container.machineOreSlopper"; } - + public static enum SlopperAnimation { LOWERING, LIFTING, MOVE_SHREDDER, DUMPING, MOVE_BUCKET } @Override public void updateEntity() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); - + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); - + tanks[0].setType(1, slots); FluidType conversion = this.getFluidOutput(tanks[0].getTankType()); if(conversion != null) tanks[1].setTankType(conversion); - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + this.processing = false; - - UpgradeManager.eval(slots, 9, 10); - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3); - + + upgradeManager.checkSlots(this, slots, 9, 10); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); + int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT); + this.consumption = this.consumptionBase + (this.consumptionBase * speed) / 2 + (this.consumptionBase * efficiency); - + if(canSlop()) { this.power -= this.consumption; this.progress += 1F / (600 - speed * 150); this.processing = true; boolean markDirty = false; - + while(progress >= 1F && canSlop()) { progress -= 1F; - + for(BedrockOreType type : BedrockOreType.values()) { ores[type.ordinal()] += (ItemBedrockOreBase.getOreAmount(slots[2], type) * (1D + efficiency * 0.1)); } - + this.decrStackSize(2, 1); this.tanks[0].setFill(this.tanks[0].getFill() - waterUsed); this.tanks[1].setFill(this.tanks[1].getFill() + waterUsed); markDirty = true; } - + if(markDirty) this.markDirty(); - + List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord + 1, zCoord - 0.5, xCoord + 1.5, yCoord + 3, zCoord + 1.5).offset(dir.offsetX, 0, dir.offsetZ)); - + for(Entity e : entities) { e.attackEntityFrom(ModDamageSource.turbofan, 1000F); - + if(!e.isEntityAlive() && e instanceof EntityLivingBase) { NBTTagCompound vdat = new NBTTagCompound(); vdat.setString("type", "giblets"); vdat.setInteger("ent", e.getEntityId()); vdat.setInteger("cDiv", 5); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY + e.height * 0.5, e.posZ, 150)); - + worldObj.playSoundEffect(e.posX, e.posY, e.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F); } } - + } else { this.progress = 0; } @@ -169,31 +172,31 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement break outer; } } - + this.networkPackNT(150); - + } else { - + this.prevSlider = this.slider; this.prevBucket = this.bucket; this.prevBlades = this.blades; this.prevFan = this.fan; - + if(this.processing) { - + this.blades += 15F; this.fan += 35F; - + if(blades >= 360) { blades -= 360; prevBlades -= 360; } - + if(fan >= 360) { fan -= 360; prevFan -= 360; } - + if(animation == animation.DUMPING && MainRegistry.proxy.me().getDistance(xCoord + 0.5, yCoord + 4, zCoord + 0.5) <= 50) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "vanillaExt"); @@ -205,12 +208,12 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement data.setDouble("mY", -0.2D); MainRegistry.proxy.effectNT(data); } - + if(delay > 0) { delay--; return; } - + switch(animation) { case LOWERING: this.bucket += 1F/40F; @@ -250,11 +253,11 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement } } } - + public DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 4, yCoord, zCoord + dir.offsetZ * 4, dir), new DirPos(xCoord - dir.offsetX * 4, yCoord, zCoord - dir.offsetZ * 4, dir.getOpposite()), @@ -278,7 +281,7 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement } private static final int[] slot_access = new int[] {2, 3, 4, 5, 6, 7, 8}; - + @Override public int[] getAccessibleSlotsFromSide(int side) { return slot_access; @@ -293,7 +296,7 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement tanks[0].serialize(buf); tanks[1].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); this.power = buf.readLong(); @@ -303,7 +306,7 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement tanks[0].deserialize(buf); tanks[1].deserialize(buf); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -312,7 +315,7 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement tanks[0].readFromNBT(nbt, "water"); tanks[1].readFromNBT(nbt, "slop"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -321,16 +324,16 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement tanks[0].writeToNBT(nbt, "water"); tanks[1].writeToNBT(nbt, "slop"); } - + public boolean canSlop() { if(this.getFluidOutput(tanks[0].getTankType()) == null) return false; if(tanks[0].getFill() < waterUsed) return false; if(tanks[1].getFill() + waterUsed > tanks[1].getMaxFill()) return false; if(power < consumption) return false; - + return slots[2] != null && slots[2].getItem() == ModItems.bedrock_ore_base; } - + public FluidType getFluidOutput(FluidType input) { if(input == Fluids.WATER) return Fluids.SLOP; return null; @@ -343,12 +346,12 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement @Override public FluidTank[] getAllTanks() { return tanks; } @Override public FluidTank[] getSendingTanks() { return new FluidTank[] {tanks[1]}; } @Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0]}; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 3, @@ -359,10 +362,10 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement zCoord + 4 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -399,9 +402,10 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.EFFECT) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.EFFECT, 3); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePlasmaHeater.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePlasmaHeater.java index 38aaf9fb2..d8ed532d3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePlasmaHeater.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePlasmaHeater.java @@ -20,6 +20,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -122,13 +123,7 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme /// END Loading plasma into the ITER /// /// START Notif packets /// - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - plasma.writeToNBT(data, "t2"); - this.networkPack(data, 50); + this.networkPackNT(50); /// END Notif packets /// } } @@ -148,14 +143,23 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme } } } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - tanks[0].readFromNBT(nbt, "t0"); - tanks[1].readFromNBT(nbt, "t1"); - plasma.readFromNBT(nbt, "t2"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + plasma.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + plasma.deserialize(buf); } private void updateType() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePress.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePress.java index bc8c4c531..c927edc0a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePress.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePress.java @@ -8,8 +8,10 @@ import com.hbm.items.machine.ItemStamp; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -34,9 +36,9 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU public final static int maxPress = 200; // max tick count per operation assuming speed is 1 boolean isRetracting = false; // direction the press is currently going private int delay; // delay between direction changes to look a bit more appealing - + public ItemStack syncStack; - + public TileEntityMachinePress() { super(4); } @@ -45,26 +47,26 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU public String getName() { return "container.press"; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + boolean preheated = false; - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) == ModBlocks.press_preheater) { preheated = true; break; } } - + boolean canProcess = this.canProcess(); - + if((canProcess || this.isRetracting) && this.burnTime >= 200) { this.speed += preheated ? 4 : 1; - + if(this.speed > this.maxSpeed) { this.speed = this.maxSpeed; } @@ -74,21 +76,21 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU this.speed = 0; } } - + if(delay <= 0) { - + int stampSpeed = speed * progressAtMax / maxSpeed; - + if(this.isRetracting) { this.press -= stampSpeed; - + if(this.press <= 0) { this.isRetracting = false; this.delay = 5; } } else if(canProcess) { this.press += stampSpeed; - + if(this.press >= this.maxPress) { this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.pressOperate", getVolume(1.5F), 1.0F); ItemStack output = PressRecipes.getOutput(slots[2], slots[1]); @@ -98,20 +100,20 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU slots[3].stackSize += output.stackSize; } this.decrStackSize(2, 1); - + if(slots[1].getMaxDamage() != 0) { slots[1].setItemDamage(slots[1].getItemDamage() + 1); if(slots[1].getItemDamage() >= slots[1].getMaxDamage()) { slots[1] = null; } } - + this.isRetracting = true; this.delay = 5; if(this.burnTime >= 200) { this.burnTime -= 200; // only subtract fuel if operation was actually successful } - + this.markDirty(); } } else if(this.press > 0){ @@ -120,10 +122,10 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU } else { delay--; } - + if(slots[0] != null && burnTime < 200 && TileEntityFurnace.getItemBurnTime(slots[0]) > 0) { // less than one operation stored? burn more fuel! burnTime += TileEntityFurnace.getItemBurnTime(slots[0]); - + if(slots[0].stackSize == 1 && slots[0].getItem().hasContainerItem(slots[0])) { slots[0] = slots[0].getItem().getContainerItem(slots[0]).copy(); } else { @@ -131,24 +133,14 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU } this.markChanged(); } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("speed", speed); - data.setInteger("burnTime", burnTime); - data.setInteger("press", press); - if(slots[2] != null) { - NBTTagCompound stack = new NBTTagCompound(); - slots[2].writeToNBT(stack); - data.setTag("stack", stack); - } - - this.networkPack(data, 50); - + + this.networkPackNT(50); + } else { - + // approach-based interpolation, GO! this.lastPress = this.renderPress; - + if(this.turnProgress > 0) { this.renderPress = this.renderPress + ((this.syncPress - this.renderPress) / (double) this.turnProgress); --this.turnProgress; @@ -157,33 +149,35 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU } } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.speed = nbt.getInteger("speed"); - this.burnTime = nbt.getInteger("burnTime"); - this.syncPress = nbt.getInteger("press"); - - if(nbt.hasKey("stack")) { - NBTTagCompound stack = nbt.getCompoundTag("stack"); - this.syncStack = ItemStack.loadItemStackFromNBT(stack); - } else { - this.syncStack = null; - } - + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.speed); + buf.writeInt(this.burnTime); + buf.writeInt(this.press); + BufferUtil.writeItemStack(buf, slots[2]); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.speed = buf.readInt(); + this.burnTime = buf.readInt(); + this.syncPress = buf.readInt(); + this.syncStack = BufferUtil.readItemStack(buf); + this.turnProgress = 2; } - + public boolean canProcess() { if(burnTime < 200) return false; if(slots[1] == null || slots[2] == null) return false; - + ItemStack output = PressRecipes.getOutput(slots[2], slots[1]); - + if(output == null) return false; - + if(slots[3] == null) return true; if(slots[3].stackSize + output.stackSize <= slots[3].getMaxStackSize() && slots[3].getItem() == output.getItem() && slots[3].getItemDamage() == output.getItemDamage()) return true; return false; @@ -191,16 +185,16 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU @Override public boolean isItemValidForSlot(int i, ItemStack stack) { - + if(stack.getItem() instanceof ItemStamp) return i == 1; - + if(TileEntityFurnace.getItemBurnTime(stack) > 0 && i == 0) return true; - + return i == 2; } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return new int[] { 0, 1, 2, 3 }; @@ -215,7 +209,7 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU public boolean canExtractItem(int i, ItemStack itemStack, int j) { return i == 3; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -233,19 +227,19 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU nbt.setInteger("speed", speed); nbt.setBoolean("ret", isRetracting); } - + AxisAlignedBB aabb; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(aabb != null) return aabb; - + aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 3, zCoord + 1); return aabb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpBase.java index c96f013e6..46131c44b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpBase.java @@ -9,24 +9,21 @@ import com.hbm.blocks.ModBlocks; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; -import com.hbm.tileentity.IConfigurableMachine; -import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.INBTPacketReceiver; -import com.hbm.tileentity.TileEntityLoadedBase; +import com.hbm.tileentity.*; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; -public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver, IConfigurableMachine, IFluidCopiable { +public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, IBufPacketReceiver, IConfigurableMachine, IFluidCopiable { public static final HashSet validBlocks = new HashSet(); - + static { validBlocks.add(Blocks.grass); validBlocks.add(Blocks.dirt); @@ -38,7 +35,7 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp validBlocks.add(ModBlocks.sand_dirty); validBlocks.add(ModBlocks.sand_dirty_red); } - + public FluidTank water; public boolean isOn = false; @@ -51,7 +48,7 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp public static int groundDepth = 4; public static int steamSpeed = 1_000; public static int electricSpeed = 10_000; - + @Override public String getConfigName() { return "waterpump"; @@ -72,87 +69,85 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp writer.name("I:steamSpeed").value(steamSpeed); writer.name("I:electricSpeed").value(electricSpeed); } - + public void updateEntity() { - + if(!worldObj.isRemote) { - + for(DirPos pos : getConPos()) { if(water.getFill() > 0) this.sendFluid(water, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + if(groundCheckDelay > 0) { groundCheckDelay--; } else { onGround = this.checkGround(); } - + this.isOn = false; if(this.canOperate() && yCoord <= groundHeight && onGround) { this.isOn = true; this.operate(); } - - NBTTagCompound data = this.getSync(); - INBTPacketReceiver.networkPack(this, data, 150); - + + networkPackNT(150); + } else { - + this.lastRotor = this.rotor; if(this.isOn) this.rotor += 10F; - + if(this.rotor >= 360F) { this.rotor -= 360F; this.lastRotor -= 360F; - + MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:block.steamEngineOperate", 0.5F, 0.75F); MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "game.neutral.swim.splash", 1F, 0.5F); } } } - + protected boolean checkGround() { - + if(worldObj.provider.hasNoSky) return false; - + int validBlocks = 0; int invalidBlocks = 0; - + for(int x = -1; x <= 1; x++) { for(int y = -1; y >= -groundDepth; y--) { for(int z = -1; z <= 1; z++) { - + Block b = worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z); - + if(y == -1 && !b.isNormalCube()) return false; // first layer has to be full solid - + if(this.validBlocks.contains(b)) validBlocks++; else invalidBlocks ++; } } } - + return validBlocks >= invalidBlocks; // valid block count has to be at least 50% } - - protected NBTTagCompound getSync() { - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("isOn", isOn); - data.setBoolean("onGround", onGround); - water.writeToNBT(data, "w"); - return data; - } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.isOn = nbt.getBoolean("isOn"); - this.onGround = nbt.getBoolean("onGround"); - water.readFromNBT(nbt, "w"); + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.isOn); + buf.writeBoolean(this.onGround); + water.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + this.isOn = buf.readBoolean(); + this.onGround = buf.readBoolean(); + water.deserialize(buf); } protected abstract boolean canOperate(); protected abstract void operate(); - + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), @@ -176,12 +171,12 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp public FluidTank[] getReceivingTanks() { return new FluidTank[0]; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -192,10 +187,10 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpElectric.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpElectric.java index 288193818..d0990e5f2 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpElectric.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpElectric.java @@ -5,7 +5,7 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; -import net.minecraft.nbt.NBTTagCompound; +import io.netty.buffer.ByteBuf; public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase implements IEnergyReceiverMK2 { @@ -28,17 +28,17 @@ public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase imp super.updateEntity(); } - - protected NBTTagCompound getSync() { - NBTTagCompound data = super.getSync(); - data.setLong("power", power); - return data; + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.power = nbt.getLong("power"); + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpSteam.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpSteam.java index d935cfbf4..eb37f7d03 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpSteam.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePumpSteam.java @@ -4,7 +4,7 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.util.fauxpointtwelve.DirPos; -import net.minecraft.nbt.NBTTagCompound; +import io.netty.buffer.ByteBuf; public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase { @@ -47,19 +47,19 @@ public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase { public FluidTank[] getReceivingTanks() { return new FluidTank[] {steam}; } - - protected NBTTagCompound getSync() { - NBTTagCompound data = super.getSync(); - steam.writeToNBT(data, "s"); - lps.writeToNBT(data, "l"); - return data; + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + steam.serialize(buf); + lps.serialize(buf); } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - steam.readFromNBT(nbt, "s"); - lps.readFromNBT(nbt, "l"); + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + steam.deserialize(buf); + lps.deserialize(buf); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRTG.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRTG.java index 0ce599eea..e5a502f0c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRTG.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRTG.java @@ -4,8 +4,6 @@ import com.hbm.config.VersatileConfig; import com.hbm.inventory.container.ContainerMachineRTG; import com.hbm.inventory.gui.GUIMachineRTG; import com.hbm.items.machine.ItemRTGPellet; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.AuxElectricityPacket; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.CompatEnergyControl; @@ -13,9 +11,9 @@ import com.hbm.util.RTGUtil; import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.tile.IInfoProviderEC; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ISidedInventory; @@ -28,16 +26,16 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISidedInventory, IEnergyProviderMK2, IGUIProvider, IInfoProviderEC { private ItemStack slots[]; - + public int heat; public final int heatMax = VersatileConfig.rtgDecay() ? 600 : 200; public long power; public final long powerMax = 100000; - + public static final int[] slot_io = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - + private String customName; - + public TileEntityMachineRTG() { slots = new ItemStack[15]; } @@ -82,7 +80,7 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @@ -101,7 +99,7 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; } } - + //You scrubs aren't needed for anything (right now) @Override public void openInventory() {} @@ -112,7 +110,7 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided public boolean isItemValidForSlot(int i, ItemStack itemStack) { return itemStack.getItem() instanceof ItemRTGPellet; } - + @Override public ItemStack decrStackSize(int i, int j) { if(slots[i] != null) @@ -128,13 +126,13 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided { slots[i] = null; } - + return itemStack1; } else { return null; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -143,7 +141,7 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided power = nbt.getLong("power"); heat = nbt.getInteger("heat"); slots = new ItemStack[getSizeInventory()]; - + for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = list.getCompoundTagAt(i); @@ -154,14 +152,14 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("power", power); nbt.setInteger("heat", heat); NBTTagList list = new NBTTagList(); - + for(int i = 0; i < slots.length; i++) { if(slots[i] != null) { NBTTagCompound nbt1 = new NBTTagCompound(); @@ -172,7 +170,7 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided } nbt.setTag("items", list); } - + @Override public int[] getAccessibleSlotsFromSide(int p_94128_1_) { return slot_io; @@ -187,19 +185,19 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided public boolean canExtractItem(int i, ItemStack itemStack, int j) { return false; } - + public long getPowerScaled(long i) { return (power * i) / powerMax; } - + public int getHeatScaled(int i) { return (heat * i) / heatMax; } - + public boolean hasPower() { return power > 0; } - + public boolean hasHeat() { return RTGUtil.hasHeat(slots, slot_io); } @@ -208,23 +206,35 @@ public class TileEntityMachineRTG extends TileEntityLoadedBase implements ISided public void updateEntity() { if(!worldObj.isRemote) { - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); - + heat = RTGUtil.updateRTGs(slots, slot_io); - + if(heat > heatMax) heat = heatMax; - + power += heat * 5; if(power > powerMax) power = powerMax; - - PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); + + networkPackNT(50); } } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + power = buf.readLong(); + } + @Override public long getPower() { return power; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadGen.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadGen.java index d47e22261..3c80edfc5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadGen.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadGen.java @@ -11,6 +11,7 @@ import com.hbm.items.special.ItemWasteLong; import com.hbm.items.special.ItemWasteShort; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.CompatEnergyControl; import com.hbm.util.Tuple.Triplet; @@ -18,6 +19,7 @@ import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.Container; @@ -110,26 +112,29 @@ public class TileEntityMachineRadGen extends TileEntityMachineBase implements IE if(this.power > maxPower) this.power = maxPower; - - NBTTagCompound data = new NBTTagCompound(); - data.setIntArray("progress", this.progress); - data.setIntArray("maxProgress", this.maxProgress); - data.setIntArray("production", this.production); - data.setLong("power", this.power); - data.setBoolean("isOn", this.isOn); - this.networkPack(data, 50); + + this.networkPackNT(50); } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.progress = nbt.getIntArray("progress"); - this.maxProgress = nbt.getIntArray("maxProgress"); - this.production = nbt.getIntArray("production"); - this.power = nbt.getLong("power"); - this.isOn = nbt.getBoolean("isOn"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + BufferUtil.writeIntArray(buf, this.progress); + BufferUtil.writeIntArray(buf, this.maxProgress); + BufferUtil.writeIntArray(buf, this.production); + buf.writeLong(this.power); + buf.writeBoolean(this.isOn); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.progress = BufferUtil.readIntArray(buf); + this.maxProgress = BufferUtil.readIntArray(buf); + this.production = BufferUtil.readIntArray(buf); + this.power = buf.readLong(); + this.isOn = buf.readBoolean(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarNT.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarNT.java index 7f0b5a801..b830abfe9 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarNT.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarNT.java @@ -18,8 +18,6 @@ import com.hbm.items.ModItems; import com.hbm.items.tool.ItemCoordinateBase; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.saveddata.SatelliteSavedData; import com.hbm.saveddata.satellites.Satellite; import com.hbm.saveddata.satellites.SatelliteHorizons; @@ -40,7 +38,6 @@ import api.hbm.entity.IRadarDetectableNT; import api.hbm.entity.IRadarDetectableNT.RadarScanParams; import api.hbm.entity.RadarEntry; import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -75,14 +72,14 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I public boolean smartMode = true; public boolean redMode = true; public boolean showMap = false; - + public boolean jammed = false; public float prevRotation; public float rotation; public long power = 0; - + protected int pingTimer = 0; protected int lastPower; protected final static int maxTimer = 80; @@ -94,10 +91,10 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I public static int radarAltitude = 55; public static int chunkLoadCap = 10; public static boolean generateChunks = false; - + public byte[] map = new byte[40_000]; public boolean clearFlag = false; - + public List entries = new ArrayList(); @Override @@ -134,18 +131,18 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I public String getName() { return "container.radar"; } - + public int getRange() { return radarRange; } @Override public void updateEntity() { - + if(this.map == null || this.map.length != 40_000) this.map = new byte[40_000]; - + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 9, power, maxPower); if(worldObj.getTotalWorldTime() % 20 == 0) { @@ -153,37 +150,37 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); this.jammed = false; allocateTargets(); - + if(this.lastPower != getRedPower()) { this.markChanged(); for(DirPos pos : getConPos()) this.updateRedstoneConnection(pos); } lastPower = getRedPower(); - + if(!this.muffled) { - + pingTimer++; - + if(power > 0 && pingTimer >= maxTimer) { this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.sonarPing", 5.0F, 1.0F); pingTimer = 0; } } - + if(this.showMap) { int chunkLoads = 0; for(int i = 0; i < 100; i++) { int index = (int) (worldObj.getTotalWorldTime() % 400) * 100 + i; int iX = (index % 200) * getRange() * 2 / 200; int iZ = index / 200 * getRange() * 2 / 200; - + int x = xCoord - getRange() + iX; int z = zCoord - getRange() + iZ; - + if(worldObj.getChunkProvider().chunkExists(x >> 4, z >> 4)) { this.map[index] = (byte) MathHelper.clamp_int(worldObj.getHeightValue(x, z), 50, 128); } else { @@ -201,7 +198,7 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } } } - + if(slots[8] != null && slots[8].getItem() == ModItems.radar_linker) { BlockPos pos = ItemCoordinateBase.getPosition(slots[8]); if(pos != null) { @@ -215,11 +212,11 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I screen.refZ = zCoord; screen.range = this.getRange(); screen.linked = true; - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, pos.getX(), pos.getY(), pos.getZ(), 25)); + networkPackNT(25); } } } - + this.networkPackNT(50); if(this.clearFlag) { this.map = new byte[40_000]; @@ -228,14 +225,14 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } else { prevRotation = rotation; if(power > 0) rotation += 5F; - + if(rotation >= 360) { rotation -= 360F; prevRotation -= 360F; } } } - + public DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X), @@ -244,7 +241,7 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z), }; } - + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -274,7 +271,7 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } } } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -330,30 +327,30 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I nbt.setBoolean("showMap", showMap); nbt.setByteArray("map", map); } - + protected void allocateTargets() { this.entries.clear(); - + if(this.yCoord < radarAltitude) return; if(this.power < consumption) return; this.power -= consumption; - + int scan = this.getRange(); - + RadarScanParams params = new RadarScanParams(this.scanMissiles, this.scanShells, this.scanPlayers, this.smartMode); - + for(Entity e : matchingEntities) { - + if(e.dimension == worldObj.provider.dimensionId && Math.abs(e.posX - (xCoord + 0.5)) <= scan && Math.abs(e.posZ - (zCoord + 0.5)) <= scan && e.posY - yCoord > radarBuffer) { - + if(e instanceof EntityLivingBase && HbmLivingProps.getDigamma((EntityLivingBase) e) > 0.001) { this.jammed = true; entries.clear(); return; } - + for(Function, RadarEntry> converter : converters) { - + RadarEntry entry = converter.apply(new Triplet(e, this, params)); if(entry != null) { this.entries.add(entry); @@ -363,33 +360,33 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } } } - + public int getRedPower() { - + if(!entries.isEmpty()) { - + /// PROXIMITY /// if(redMode) { - + double maxRange = this.getRange() * Math.sqrt(2D); int power = 0; - + for(int i = 0; i < entries.size(); i++) { RadarEntry e = entries.get(i); if(!e.redstone) continue; double dist = Math.sqrt(Math.pow(e.posX - xCoord, 2) + Math.pow(e.posZ - zCoord, 2)); int p = 15 - (int)Math.floor(dist / maxRange * 15); - + if(p > power) power = p; } - + return power; - + /// TIER /// } else { - + int power = 0; - + for(int i = 0; i < entries.size(); i++) { RadarEntry e = entries.get(i); if(!e.redstone) continue; @@ -397,11 +394,11 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I power = e.blipLevel + 1; } } - + return power; } } - + return 0; } @@ -426,10 +423,10 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } @Override public void receiveControl(NBTTagCompound data) { } - + @Override public void receiveControl(EntityPlayer player, NBTTagCompound data) { - + if(data.hasKey("missiles")) this.scanMissiles = !this.scanMissiles; if(data.hasKey("shells")) this.scanShells = !this.scanShells; if(data.hasKey("players")) this.scanPlayers = !this.scanPlayers; @@ -439,11 +436,11 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I if(data.hasKey("clear")) this.clearFlag = true; if(data.hasKey("gui1")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 1, worldObj, xCoord, yCoord, zCoord); - + if(data.hasKey("link")) { int id = data.getInteger("link"); ItemStack link = slots[id]; - + if(link != null && link.getItem() == ModItems.sat_relay) { World world = player.getEntityWorld(); Satellite sat = SatelliteSavedData.getData(world).getSatFromFreq(ISatChip.getFreqS(link)); @@ -476,12 +473,12 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } if(link != null && link.getItem() == ModItems.radar_linker) { BlockPos pos = ItemCoordinateBase.getPosition(link); - + if(pos != null) { TileEntity tile = worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); if(tile instanceof IRadarCommandReceiver) { IRadarCommandReceiver rec = (IRadarCommandReceiver) tile; - + if(data.hasKey("launchEntity")) { Entity entity = worldObj.getEntityByID(data.getInteger("launchEntity")); if(entity != null) { @@ -501,12 +498,12 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I } } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -517,10 +514,10 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -549,20 +546,20 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I if(ID == 1) return new GUIMachineRadarNTSlots(player.inventory, this); return null; } - + /** List of lambdas that are supplied a Pair with the entity and radar in question to generate a RadarEntry The converters coming first have the highest priority */ public static List, RadarEntry>> converters = new ArrayList(); public static List classes = new ArrayList(); public static List matchingEntities = new ArrayList(); - + /** * Iterates over every entity in the world and add them to the matchingEntities list if the class is in the detectable list * From this compiled list, radars can easily grab the required entities since we can assume that the total amount of detectable entities is comparatively low */ public static void updateSystem() { matchingEntities.clear(); - + for(WorldServer world : MinecraftServer.getServer().worldServers) { for(Object entity : world.loadedEntityList) { for(Class clazz : classes) { @@ -581,7 +578,7 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I classes.add(IRadarDetectable.class); classes.add(EntityPlayer.class); } - + /** Registers converters. Converters are used to go over the list of detected entities and turn them into a RadarEntry using the entity instance and the radar's instance. */ public static void registerConverters() { //IRadarDetectableNT diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarScreen.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarScreen.java index f4dfafdd3..9b55ca183 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarScreen.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadarScreen.java @@ -3,20 +3,17 @@ package com.hbm.tileentity.machine; import java.util.ArrayList; import java.util.List; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.tileentity.IBufPacketReceiver; import api.hbm.entity.RadarEntry; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import com.hbm.tileentity.TileEntityLoadedBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -public class TileEntityMachineRadarScreen extends TileEntity implements IBufPacketReceiver { - +public class TileEntityMachineRadarScreen extends TileEntityLoadedBase implements IBufPacketReceiver { + public List entries = new ArrayList(); public int refX; public int refY; @@ -26,18 +23,14 @@ public class TileEntityMachineRadarScreen extends TileEntity implements IBufPack @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.networkPackNT(100); entries.clear(); this.linked = false; } } - - public void networkPackNT(int range) { - if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - + @Override public void serialize(ByteBuf buf) { buf.writeBoolean(linked); @@ -48,7 +41,7 @@ public class TileEntityMachineRadarScreen extends TileEntity implements IBufPack buf.writeInt(entries.size()); for(RadarEntry entry : entries) entry.toBytes(buf); } - + @Override public void deserialize(ByteBuf buf) { linked = buf.readBoolean(); @@ -64,12 +57,12 @@ public class TileEntityMachineRadarScreen extends TileEntity implements IBufPack this.entries.add(entry); } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -80,10 +73,10 @@ public class TileEntityMachineRadarScreen extends TileEntity implements IBufPack zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java index 618e2735b..67c8f316b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java @@ -24,6 +24,7 @@ import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemFood; @@ -34,16 +35,16 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineRadiolysis extends TileEntityMachineBase implements IEnergyProviderMK2, IFluidStandardTransceiver, IGUIProvider, IInfoProviderEC, IFluidCopiable { - + public long power; public static final int maxPower = 1000000; public int heat; public FluidTank[] tanks; - + private static final int[] slot_io = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13 }; private static final int[] slot_rtg = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - + public TileEntityMachineRadiolysis() { super(15); //10 rtg slots, 2 fluid ID slots (io), 2 irradiation slots (io), battery slot tanks = new FluidTank[3]; @@ -51,12 +52,12 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement tanks[1] = new FluidTank(Fluids.NONE, 2_000); tanks[2] = new FluidTank(Fluids.NONE, 2_000); } - + @Override public String getName() { return "container.radiolysis"; } - + /* IO Methods */ @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { @@ -67,89 +68,93 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement public int[] getAccessibleSlotsFromSide(int side) { return slot_io; } - + @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { return (i < 10 && itemStack.getItem() instanceof ItemRTGPelletDepleted) || i == 13; } - + /* NBT Methods */ @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); this.heat = nbt.getInteger("heat"); - + tanks[0].readFromNBT(nbt, "input"); tanks[1].readFromNBT(nbt, "output1"); tanks[2].readFromNBT(nbt, "output2"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setInteger("heat", heat); - + tanks[0].writeToNBT(nbt, "input"); tanks[1].writeToNBT(nbt, "output1"); tanks[2].writeToNBT(nbt, "output2"); } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.power = data.getLong("power"); - this.heat = data.getInteger("heat"); - tanks[0].readFromNBT(data, "t0"); - tanks[1].readFromNBT(data, "t1"); - tanks[2].readFromNBT(data, "t2"); - } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { power = Library.chargeItemsFromTE(slots, 14, power, maxPower); - + heat = RTGUtil.updateRTGs(slots, slot_rtg); power += heat * 10; - + if(power > maxPower) power = maxPower; - + tanks[0].setType(10, 11, slots); setupTanks(); - + if(heat > 100) { int crackTime = (int) Math.max(-0.1 * (heat - 100) + 30, 5); - + if(worldObj.getTotalWorldTime() % crackTime == 0) crack(); - + if(heat >= 200 && worldObj.getTotalWorldTime() % 100 == 0) sterilize(); } - + for(DirPos pos : getConPos()) { this.tryProvide(worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir()); if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir()); if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(),pos.getZ(), pos.getDir()); } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("heat", heat); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - tanks[2].writeToNBT(data, "t2"); - this.networkPack(data, 50); + + this.networkPackNT(50); } } - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeInt(this.heat); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + tanks[2].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.heat = buf.readInt(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + tanks[2].deserialize(buf); + } + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), @@ -158,17 +163,17 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z) }; } - + /* Processing Methods */ private void crack() { - + Pair quart = RadiolysisRecipes.getRadiolysis(tanks[0].getTankType()); - + if(quart != null) { - + int left = quart.getKey().fill; int right = quart.getValue().fill; - + if(tanks[0].getFill() >= 100 && hasSpace(left, right)) { tanks[0].setFill(tanks[0].getFill() - 100); tanks[1].setFill(tanks[1].getFill() + left); @@ -176,15 +181,15 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement } } } - + private boolean hasSpace(int left, int right) { return tanks[1].getFill() + left <= tanks[1].getMaxFill() && tanks[2].getFill() + right <= tanks[2].getMaxFill(); } - + private void setupTanks() { - + Pair quart = RadiolysisRecipes.getRadiolysis(tanks[0].getTankType()); - + if(quart != null) { tanks[1].setTankType(quart.getKey().type); tanks[2].setTankType(quart.getValue().type); @@ -193,21 +198,21 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement tanks[1].setTankType(Fluids.NONE); tanks[2].setTankType(Fluids.NONE); } - + } - + // Code: pressure, sword, sterilize. private void sterilize() { if(slots[12] != null) { if(slots[12].getItem() instanceof ItemFood && !(slots[12].getItem() == ModItems.pancake)) { this.decrStackSize(12, 1); } - + if(!checkIfValid()) return; - + ItemStack output = slots[12].copy(); output.stackSize = 1; - + if(slots[13] == null) { this.decrStackSize(12, output.stackSize); slots[13] = output; @@ -227,14 +232,14 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement } } } - + private boolean checkIfValid() { if(slots[12] == null) return false; if(!slots[12].hasTagCompound()) return false; if(!slots[12].getTagCompound().getBoolean("ntmContagion")) return false; return true; } - + /* Power methods */ @Override public void setPower(long power) { @@ -250,7 +255,7 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement public long getMaxPower() { return maxPower; } - + @Override public FluidTank[] getAllTanks() { return tanks; @@ -270,11 +275,11 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement public boolean canConnect(FluidType type, ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN; } - + public AxisAlignedBB getRenderBoundingBox() { return AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 3, zCoord + 2); } - + @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 65536.0D; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorBreeding.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorBreeding.java index 53d0f0725..3776b6701 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorBreeding.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineReactorBreeding.java @@ -15,6 +15,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -65,19 +66,23 @@ public class TileEntityMachineReactorBreeding extends TileEntityMachineBase impl } else { progress = 0.0F; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("flux", flux); - data.setFloat("progress", progress); - this.networkPack(data, 20); + + this.networkPackNT(20); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - flux = data.getInteger("flux"); - progress = data.getFloat("progress"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(flux); + buf.writeFloat(progress); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.flux = buf.readInt(); + this.progress = buf.readFloat(); } public void getInteractions() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java index ba54dee6f..a63acd692 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java @@ -90,10 +90,11 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i if(this.output != null) { + int prev = this.output.amount; Vec3 impact = Vec3.createVectorHelper(0, 0, 0); MaterialStack leftover = CrucibleUtil.pourSingleStack(worldObj, xCoord + 0.5D + rot.offsetX * 2.875D, yCoord + 1.25D, zCoord + 0.5D + rot.offsetZ * 2.875D, 6, true, this.output, MaterialShapes.INGOT.q(1), impact); - if(leftover.amount != this.output.amount) { + if(prev != this.output.amount) { this.output = leftover; NBTTagCompound data = new NBTTagCompound(); data.setString("type", "foundry"); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java index 4cd964da3..6f9016127 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSchrabidiumTransmutator.java @@ -16,6 +16,7 @@ import api.hbm.energymk2.IBatteryItem; import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -166,11 +167,8 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB } else { process = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("progress", process); - this.networkPack(data, 50); + + this.networkPackNT(50); } else { @@ -192,7 +190,21 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB } } } - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeInt(this.process); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.process = buf.readInt(); + } + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:weapon.tauChargeLoop", xCoord, yCoord, zCoord, 1.0F, 10F, 1.0F); @@ -223,14 +235,6 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntityMachineB audio = null; } } - - @Override - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.power = data.getLong("power"); - this.process = data.getInteger("progress"); - } @Override public void setPower(long i) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineShredder.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineShredder.java index 67ad5583c..f948a67f4 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineShredder.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineShredder.java @@ -5,16 +5,14 @@ import com.hbm.inventory.gui.GUIMachineShredder; import com.hbm.inventory.recipes.ShredderRecipes; import com.hbm.items.machine.ItemBlades; import com.hbm.lib.Library; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.AuxElectricityPacket; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.energymk2.IBatteryItem; import api.hbm.energymk2.IEnergyReceiverMK2; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ISidedInventory; @@ -33,11 +31,11 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I public int soundCycle = 0; public static final long maxPower = 10000; public static final int processingSpeed = 60; - + private static final int[] slots_io = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29}; - + private String customName; - + public TileEntityMachineShredder() { slots = new ItemStack[30]; } @@ -82,7 +80,7 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @@ -101,7 +99,7 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; } } - + //You scrubs aren't needed for anything (right now) @Override public void openInventory() {} @@ -113,10 +111,10 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I if(i < 9) return ShredderRecipes.getShredderResult(stack) != null && !(stack.getItem() instanceof ItemBlades); if(i == 29) return stack.getItem() instanceof IBatteryItem; if(i == 27 || i == 28) return stack.getItem() instanceof ItemBlades; - + return false; } - + @Override public ItemStack decrStackSize(int i, int j) { if(slots[i] != null) @@ -132,21 +130,21 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I { slots[i] = null; } - + return itemStack1; } else { return null; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - + this.power = nbt.getLong("powerTime"); slots = new ItemStack[getSizeInventory()]; - + for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = list.getCompoundTagAt(i); @@ -157,13 +155,13 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("powerTime", power); NBTTagList list = new NBTTagList(); - + for(int i = 0; i < slots.length; i++) { if(slots[i] != null) @@ -176,7 +174,7 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I } nbt.setTag("items", list); } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return slots_io; @@ -186,20 +184,20 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I public boolean canInsertItem(int slot, ItemStack itemStack, int side) { if((slot >= 9 && slot != 27 && slot != 28) || !this.isItemValidForSlot(slot, itemStack)) return false; - + if(slots[slot] == null) return true; - + int size = slots[slot].stackSize; - + for(int k = 0; k < 9; k++) { if(slots[k] == null) return false; - + if(slots[k].getItem() == itemStack.getItem() && slots[k].getItemDamage() == itemStack.getItemDamage() && slots[k].stackSize < size) return false; } - + return true; } @@ -207,42 +205,42 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I public boolean canExtractItem(int i, ItemStack itemStack, int j) { if(i >= 9 && i <= 26) return true; if(i >= 27 && i <= 28) if(itemStack.getItemDamage() == itemStack.getMaxDamage() && itemStack.getMaxDamage() > 0) return true; - + return false; } - + public int getDiFurnaceProgressScaled(int i) { return (progress * i) / processingSpeed; } - + public boolean hasPower() { return power > 0; } - + public boolean isProcessing() { return this.progress > 0; } - + @Override public void updateEntity() { boolean flag1 = false; - + if(!worldObj.isRemote) { - + this.updateConnections(); - + if(hasPower() && canProcess()) { progress++; - + power -= 5; - + if(this.progress == TileEntityMachineShredder.processingSpeed) { for(int i = 27; i <= 28; i++) if(slots[i].getMaxDamage() > 0) this.slots[i].setItemDamage(this.slots[i].getItemDamage() + 1); - + this.progress = 0; this.processItem(); flag1 = true; @@ -250,66 +248,78 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I if(soundCycle == 0) this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "minecart.base", getVolume(1.0F), 0.75F); soundCycle++; - + if(soundCycle >= 50) soundCycle = 0; }else{ progress = 0; } - + boolean trigger = true; - + if(hasPower() && canProcess() && this.progress == 0) { trigger = false; } - + if(trigger) { flag1 = true; } - + power = Library.chargeTEFromItems(slots, 29, power, maxPower); - - PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); + + networkPackNT(50); } - + if(flag1) { this.markDirty(); } } - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + power = buf.readLong(); + } + private void updateConnections() { - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); } - + public void processItem() { - + for(int inpSlot = 0; inpSlot < 9; inpSlot++) { if(slots[inpSlot] != null && hasSpace(slots[inpSlot])) { ItemStack inp = slots[inpSlot]; ItemStack outp = ShredderRecipes.getShredderResult(inp); - + boolean flag = false; - + for (int outSlot = 9; outSlot < 27; outSlot++) { - if (slots[outSlot] != null && slots[outSlot].getItem() == outp.getItem() && + if (slots[outSlot] != null && slots[outSlot].getItem() == outp.getItem() && slots[outSlot].getItemDamage() == outp.getItemDamage() && slots[outSlot].stackSize + outp.stackSize <= outp.getMaxStackSize()) { - + slots[outSlot].stackSize += outp.stackSize; slots[inpSlot].stackSize -= 1; flag = true; break; } } - + if(!flag) for (int outSlot = 9; outSlot < 27; outSlot++) { @@ -319,18 +329,18 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I break; } } - + if(slots[inpSlot].stackSize <= 0) slots[inpSlot] = null; } } } - + public boolean canProcess() { - if(slots[27] != null && slots[28] != null && - this.getGearLeft() > 0 && this.getGearLeft() < 3 && + if(slots[27] != null && slots[28] != null && + this.getGearLeft() > 0 && this.getGearLeft() < 3 && this.getGearRight() > 0 && this.getGearRight() < 3) { - + for(int i = 0; i < 9; i++) { if(slots[i] != null && slots[i].stackSize > 0 && hasSpace(slots[i])) @@ -339,14 +349,14 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I } } } - + return false; } - + public boolean hasSpace(ItemStack stack) { - + ItemStack result = ShredderRecipes.getShredderResult(stack); - + if (result != null) for (int i = 9; i < 27; i++) { if (slots[i] == null) { @@ -358,16 +368,16 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I return true; } } - + return false; } @Override public void setPower(long i) { this.power = i; - + } - + public long getPowerScaled(long i) { return (power * i) / maxPower; } @@ -381,14 +391,14 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I public long getMaxPower() { return TileEntityMachineShredder.maxPower; } - + public int getGearLeft() { - + if(slots[27] != null && slots[27].getItem() instanceof ItemBlades) { if(slots[27].getMaxDamage() == 0) return 1; - + if(slots[27].getItemDamage() < slots[27].getItem().getMaxDamage()/2) { return 1; @@ -398,17 +408,17 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I return 3; } } - + return 0; } - + public int getGearRight() { - + if(slots[28] != null && slots[28].getItem() instanceof ItemBlades) { if(slots[28].getMaxDamage() == 0) return 1; - + if(slots[28].getItemDamage() < slots[28].getItem().getMaxDamage()/2) { return 1; @@ -418,7 +428,7 @@ public class TileEntityMachineShredder extends TileEntityLoadedBase implements I return 3; } } - + return 0; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSolderingStation.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSolderingStation.java index be2d34aa9..bf1c795da 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSolderingStation.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSolderingStation.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.container.ContainerMachineSolderingStation; import com.hbm.inventory.fluid.Fluids; @@ -29,6 +30,7 @@ import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.Item; @@ -45,13 +47,15 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp public long maxPower = 2_000; public long consumption; public boolean collisionPrevention = false; - + public int progress; public int processTime = 1; - + public FluidTank tank; public ItemStack display; - + + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineSolderingStation() { super(11); this.tank = new FluidTank(Fluids.NONE, 8_000); @@ -65,56 +69,58 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && stack.getItem() instanceof ItemMachineUpgrade && i >= 9 && i <= 10) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } } + private SolderingRecipe recipe; + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 7, this.getPower(), this.getMaxPower()); this.tank.setType(8, slots); - + if(worldObj.getTotalWorldTime() % 20 == 0) { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - - SolderingRecipe recipe = SolderingRecipes.getRecipe(new ItemStack[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5]}); + + recipe = SolderingRecipes.getRecipe(new ItemStack[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5]}); long intendedMaxPower; - - UpgradeManager.eval(slots, 9, 10); - int redLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int blueLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - + + upgradeManager.checkSlots(this, slots, 9, 10); + int redLevel = upgradeManager.getLevel(UpgradeType.SPEED); + int blueLevel = upgradeManager.getLevel(UpgradeType.POWER); + if(recipe != null) { this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3); this.consumption = recipe.consumption + (recipe.consumption * redLevel) - (recipe.consumption * blueLevel / 6); intendedMaxPower = recipe.consumption * 20; - + if(canProcess(recipe)) { this.progress++; this.power -= this.consumption; - + if(progress >= processTime) { this.progress = 0; this.consumeItems(recipe); - + if(slots[6] == null) { slots[6] = recipe.output.copy(); } else { slots[6].stackSize += recipe.output.stackSize; } - + this.markDirty(); } - + if(worldObj.getTotalWorldTime() % 20 == 0) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); @@ -123,78 +129,66 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp dPart.setByte("count", (byte) 3); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(dPart, xCoord + 0.5 - dir.offsetX * 0.5 + rot.offsetX * 0.5, yCoord + 1.125, zCoord + 0.5 - dir.offsetZ * 0.5 + rot.offsetZ * 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 25)); } - + } else { this.progress = 0; } - + } else { this.progress = 0; this.consumption = 100; intendedMaxPower = 2000; } - + this.maxPower = Math.max(intendedMaxPower, power); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setLong("maxPower", maxPower); - data.setLong("consumption", consumption); - data.setInteger("progress", progress); - data.setInteger("processTime", processTime); - data.setBoolean("collisionPrevention", collisionPrevention); - if(recipe != null) { - data.setInteger("display", Item.getIdFromItem(recipe.output.getItem())); - data.setInteger("displayMeta", recipe.output.getItemDamage()); - } - this.tank.writeToNBT(data, "t"); - this.networkPack(data, 25); + + this.networkPackNT(25); } } - + public boolean canProcess(SolderingRecipe recipe) { - + if(this.power < this.consumption) return false; - + if(recipe.fluid != null) { if(this.tank.getTankType() != recipe.fluid.type) return false; if(this.tank.getFill() < recipe.fluid.fill) return false; } - + if(collisionPrevention && recipe.fluid == null && this.tank.getFill() > 0) return false; - + if(slots[6] != null) { if(slots[6].getItem() != recipe.output.getItem()) return false; if(slots[6].getItemDamage() != recipe.output.getItemDamage()) return false; if(slots[6].stackSize + recipe.output.stackSize > slots[6].getMaxStackSize()) return false; } - + return true; } - + public void consumeItems(SolderingRecipe recipe) { - + for(AStack aStack : recipe.toppings) { for(int i = 0; i < 3; i++) { ItemStack stack = slots[i]; if(aStack.matchesRecipe(stack, true) && stack.stackSize >= aStack.stacksize) { this.decrStackSize(i, aStack.stacksize); break; } } } - + for(AStack aStack : recipe.pcb) { for(int i = 3; i < 5; i++) { ItemStack stack = slots[i]; if(aStack.matchesRecipe(stack, true) && stack.stackSize >= aStack.stacksize) { this.decrStackSize(i, aStack.stacksize); break; } } } - + for(AStack aStack : recipe.solder) { for(int i = 5; i < 6; i++) { ItemStack stack = slots[i]; if(aStack.matchesRecipe(stack, true) && stack.stackSize >= aStack.stacksize) { this.decrStackSize(i, aStack.stacksize); break; } } } - + if(recipe.fluid != null) { this.tank.setFill(tank.getFill() - recipe.fluid.fill); } @@ -224,12 +218,12 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp public int[] getAccessibleSlotsFromSide(int side) { return new int[] { 0, 1, 2, 3, 4, 5, 6 }; } - + protected DirPos[] getConPos() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir), new DirPos(xCoord + dir.offsetX + rot.offsetX, yCoord, zCoord + dir.offsetZ + rot.offsetZ, dir), @@ -243,25 +237,42 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.maxPower = nbt.getLong("maxPower"); - this.consumption = nbt.getLong("consumption"); - this.progress = nbt.getInteger("progress"); - this.processTime = nbt.getInteger("processTime"); - this.collisionPrevention = nbt.getBoolean("collisionPrevention"); - - if(nbt.hasKey("display")) { - this.display = new ItemStack(Item.getItemById(nbt.getInteger("display")), 1, nbt.getInteger("displayMeta")); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeLong(this.maxPower); + buf.writeLong(this.consumption); + buf.writeInt(this.progress); + buf.writeInt(this.processTime); + buf.writeBoolean(this.collisionPrevention); + buf.writeBoolean(recipe != null); + if(recipe != null) { + buf.writeInt(Item.getIdFromItem(recipe.output.getItem())); + buf.writeInt(recipe.output.getItemDamage()); + } + this.tank.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.maxPower = buf.readLong(); + this.consumption = buf.readLong(); + this.progress = buf.readInt(); + this.processTime = buf.readInt(); + this.collisionPrevention = buf.readBoolean(); + + if(buf.readBoolean()) { + int id = buf.readInt(); + this.display = new ItemStack(Item.getItemById(id), 1, buf.readInt()); } else { this.display = null; } - - this.tank.readFromNBT(nbt, "t"); + + this.tank.deserialize(buf); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -273,7 +284,7 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp this.collisionPrevention = nbt.getBoolean("collisionPrevention"); tank.readFromNBT(nbt, "t"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -321,12 +332,12 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineSolderingStation(player.inventory, this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -337,10 +348,10 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -366,10 +377,11 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineStrandCaster.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineStrandCaster.java index c05bfe3fe..00b4812ce 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineStrandCaster.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineStrandCaster.java @@ -11,14 +11,11 @@ import com.hbm.inventory.material.Mats; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemMold; import com.hbm.items.machine.ItemScraps; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.util.fauxpointtwelve.DirPos; -import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -31,7 +28,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; //god thank you bob for this base class -public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase implements IGUIProvider, ICrucibleAcceptor, ISidedInventory, IFluidStandardTransceiver, INBTPacketReceiver, IInventory { +public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase implements IGUIProvider, ICrucibleAcceptor, ISidedInventory, IFluidStandardTransceiver, IInventory { public FluidTank water; public FluidTank steam; @@ -83,7 +80,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase if(canProcess()) { int minAmount = mold.getCost() * 9; - + // Makes it flush the buffers after 10 seconds of inactivity if(worldObj.getWorldTime() >= lastCastTick + 200) { minAmount = mold.getCost(); @@ -118,14 +115,10 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase lastCastTick = worldObj.getWorldTime(); } } - } - NBTTagCompound data = new NBTTagCompound(); + networkPackNT(150); - water.writeToNBT(data, "w"); - steam.writeToNBT(data, "s"); - - this.networkPack(data, 150); + } } @@ -197,7 +190,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase } return false; - } + } @Override public boolean standardCheck(World world, int x, int y, int z, ForgeDirection side, Mats.MaterialStack stack) { @@ -264,16 +257,16 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase return new GUIMachineStrandCaster(player.inventory, this); } - public void networkPack(NBTTagCompound nbt, int range) { - if(!worldObj.isRemote) - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); + @Override + public void serialize(ByteBuf buf) { + water.serialize(buf); + steam.serialize(buf); } @Override - public void networkUnpack(NBTTagCompound nbt) { - water.readFromNBT(nbt, "w"); - steam.readFromNBT(nbt, "s"); - + public void deserialize(ByteBuf buf) { + water.deserialize(buf); + steam.deserialize(buf); } @Override @@ -350,7 +343,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase } public boolean isLoaded = true; - + @Override public boolean isLoaded() { return isLoaded; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTeleporter.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTeleporter.java index 0784cd130..cdcbea5a3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTeleporter.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTeleporter.java @@ -3,12 +3,14 @@ package com.hbm.tileentity.machine; import java.util.Iterator; import java.util.List; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.energymk2.IEnergyReceiverMK2; +import com.hbm.util.BufferUtil; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.ReflectionHelper; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityTracker; @@ -29,7 +31,7 @@ import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements IEnergyReceiverMK2, INBTPacketReceiver { +public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements IEnergyReceiverMK2, IBufPacketReceiver { public long power = 0; public int targetX = -1; @@ -41,25 +43,22 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements @Override public void updateEntity() { - + if(!this.worldObj.isRemote) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); - + if(this.targetY != -1) { List entities = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(this.xCoord + 0.25, this.yCoord, this.zCoord + 0.25, this.xCoord + 0.75, this.yCoord + 2, this.zCoord + 0.75)); - + if(!entities.isEmpty()) { for(Entity e : entities) { teleport(e); } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setIntArray("target", new int[] {targetX, targetY, targetZ, targetDim}); - INBTPacketReceiver.networkPack(this, data, 15); - + + networkPackNT(15); + } else { if(this.targetY != -1 && power >= consumption) { @@ -72,9 +71,15 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.power = nbt.getLong("power"); - int[] target = nbt.getIntArray("target"); + public void serialize(ByteBuf buf) { + buf.writeLong(power); + BufferUtil.writeIntArray(buf, new int[] {targetX, targetY, targetZ, targetDim}); + } + + @Override + public void deserialize(ByteBuf buf) { + this.power = buf.readLong(); + int[] target = BufferUtil.readIntArray(buf); this.targetX = target[0]; this.targetY = target[1]; this.targetZ = target[2]; @@ -95,7 +100,7 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setInteger("x1", targetX); nbt.setInteger("y1", targetY); @@ -104,25 +109,25 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements } public void teleport(Entity entity) { - + if(this.power < consumption) return; - + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "mob.endermen.portal", 1.0F, 1.0F); - + if((entity instanceof EntityPlayerMP)) { - + EntityPlayerMP player = (EntityPlayerMP) entity; if(entity.dimension == this.targetDim) { player.setPositionAndUpdate(this.targetX + 0.5D, this.targetY + 1.5D + entity.getYOffset(), this.targetZ + 0.5D); } else { teleportPlayerInterdimensionally(player, this.targetX + 0.5D, this.targetY + 1.5D + entity.getYOffset(), this.targetZ + 0.5D, this.targetDim); } - + } else { - + if(entity.dimension == this.targetDim) { entity.setPositionAndRotation(this.targetX + 0.5D, this.targetY + 1.5D + entity.getYOffset(), this.targetZ + 0.5D, entity.rotationYaw, entity.rotationPitch); - + try { EntityTracker entitytracker = ((WorldServer)worldObj).getEntityTracker(); IntHashMap map = ReflectionHelper.getPrivateValue(EntityTracker.class, entitytracker, "trackedEntityIDs", "field_72794_c"); @@ -138,21 +143,21 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements teleportEntityInterdimensionally(entity, this.targetX + 0.5D, this.targetY + 1.5D + entity.getYOffset(), this.targetZ + 0.5D, this.targetDim); } } - + worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); - + this.power -= consumption; this.markDirty(); } - + /** Teleports a player to a different dimension, gracefully copied from ServerConfigurationManager */ public static boolean teleportPlayerInterdimensionally(EntityPlayerMP player, double x, double y, double z, int dim) { - + int prevDim = player.dimension; WorldServer prevWorld = player.mcServer.worldServerForDimension(prevDim); WorldServer newWorld = player.mcServer.worldServerForDimension(dim); player.dimension = dim; - + if(newWorld == null) return false; ServerConfigurationManager man = player.mcServer.getConfigurationManager(); @@ -160,15 +165,15 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements net.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); prevWorld.removePlayerEntityDangerously(player); player.isDead = false; - + if(player.isEntityAlive()) { player.setLocationAndAngles(x, y, z, player.rotationYaw, player.rotationPitch); newWorld.spawnEntityInWorld(player); newWorld.updateEntityWithOptionalForce(player, false); } - + player.setWorld(newWorld); - + man.func_72375_a(player, prevWorld); net.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch); player.theItemInWorldManager.setWorld(newWorld); @@ -183,18 +188,18 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, prevDim, dim); return true; } - + /** Teleports non-player entities to different dimensions, gracefully copied from Entity */ public static boolean teleportEntityInterdimensionally(Entity oldEntity, double x, double y, double z, int dim) { MinecraftServer minecraftserver = MinecraftServer.getServer(); WorldServer newWorld = minecraftserver.worldServerForDimension(dim); - + if(newWorld == null) return false; oldEntity.worldObj.removeEntity(oldEntity); oldEntity.isDead = false; - + Entity entity = EntityList.createEntityByName(EntityList.getEntityString(oldEntity), newWorld); if(entity != null) { @@ -202,7 +207,7 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements entity.setLocationAndAngles(x, y, z, entity.rotationYaw, entity.rotationPitch); newWorld.updateEntityWithOptionalForce(entity, false); entity.setWorld(newWorld); - + IChunkProvider provider = newWorld.getChunkProvider(); provider.loadChunk(((int) Math.floor(x)) >> 4, ((int) Math.floor(z)) >> 4); newWorld.spawnEntityInWorld(entity); @@ -210,7 +215,7 @@ public class TileEntityMachineTeleporter extends TileEntityLoadedBase implements oldEntity.isDead = true; newWorld.resetUpdateEntityTick(); - + return true; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java index 9ea860818..88f1c3694 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java @@ -49,14 +49,14 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS public long power; public int age = 0; public FluidTank[] tanks; - + private static final int[] slots_top = new int[] {4}; private static final int[] slots_bottom = new int[] {6}; private static final int[] slots_side = new int[] {4}; - + private String customName; protected double[] info = new double[3]; - + //Configurable values public static long maxPower = 1_000_000; public static int inputTankSize = 64_000; @@ -133,7 +133,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @@ -152,7 +152,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; } } - + //You scrubs aren't needed for anything (right now) @Override public void openInventory() {} @@ -161,14 +161,14 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS @Override public boolean isItemValidForSlot(int i, ItemStack stack) { - + if(i == 4) if(stack != null && stack.getItem() instanceof IBatteryItem) return true; - + return false; } - + @Override public ItemStack decrStackSize(int i, int j) { if(slots[i] != null) @@ -184,13 +184,13 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS { slots[i] = null; } - + return itemStack1; } else { return null; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -199,9 +199,9 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS tanks[0].readFromNBT(nbt, "water"); tanks[1].readFromNBT(nbt, "steam"); power = nbt.getLong("power"); - + slots = new ItemStack[getSizeInventory()]; - + for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = list.getCompoundTagAt(i); @@ -212,16 +212,16 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); tanks[0].writeToNBT(nbt, "water"); tanks[1].writeToNBT(nbt, "steam"); nbt.setLong("power", power); - + NBTTagList list = new NBTTagList(); - + for(int i = 0; i < slots.length; i++) { if(slots[i] != null) @@ -234,7 +234,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS } nbt.setTag("items", list); } - + @Override public int[] getAccessibleSlotsFromSide(int p_94128_1_) { @@ -250,32 +250,32 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS public boolean canExtractItem(int i, ItemStack itemStack, int j) { return false; } - + public long getPowerScaled(int i) { return (power * i) / maxPower; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.info = new double[3]; - + age++; if(age >= 2) { age = 0; } - + this.subscribeToAllAround(tanks[0].getTankType(), this); - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); tanks[0].setType(0, 1, slots); tanks[0].loadTank(2, 3, slots); power = Library.chargeItemsFromTE(slots, 4, power, maxPower); - + FluidType in = tanks[0].getTankType(); boolean valid = false; if(in.hasTrait(FT_Coolable.class)) { @@ -298,12 +298,12 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS } if(!valid) tanks[1].setTankType(Fluids.NONE); if(power > maxPower) power = maxPower; - + this.sendFluidToAll(tanks[1], this); - + tanks[1].unloadTank(5, 6, slots); - - this.sendStandard(25); + + this.networkPackNT(25); } } @@ -318,7 +318,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS tanks[0].deserialize(buf); tanks[1].deserialize(buf); } - + @Override public long getPower() { return power; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java index 1f83acbff..59081ba7c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java @@ -29,6 +29,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -43,30 +44,30 @@ import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyProviderMK2, IControlReceiver, IGUIProvider, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent, IFluidCopiable { - + public long power; public static final long maxPower = 1000000L; - + public int rpm; //0-100, crescent moon gauge, used for calculating the amount of power generated, starts past 10% public int temp; //0-800, used for figuring out how much water to boil, starts boiling at 300°C public int rpmIdle = 10; public int tempIdle = 300; - + public int powerSliderPos; //goes from 0 to 60, 0 is idle, 60 is max power public int throttle; //the same thing, but goes from 0 to 100 - + public boolean autoMode; public int state = 0; //0 is offline, -1 is startup, 1 is online - + public int counter = 0; //used to startup and shutdown public int instantPowerOutput; - + public FluidTank[] tanks; - + private AudioWrapper audio; - + public static HashMap fuelMaxCons = new HashMap(); //fuel consumption per tick at max power - + static { fuelMaxCons.put(Fluids.GAS, 50D); // natgas doesn't burn well so it burns faster to compensate fuelMaxCons.put(Fluids.SYNGAS, 10D); // syngas just fucks @@ -74,9 +75,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement fuelMaxCons.put(Fluids.REFORMGAS, 5D); // fuck it we ball // default to 5 if not in list } - + //TODO particles from heat exchanger maybe? maybe in a future - + public TileEntityMachineTurbineGas() { super(2); this.tanks = new FluidTank[4]; @@ -85,26 +86,28 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement tanks[2] = new FluidTank(Fluids.WATER, 16000); tanks[3] = new FluidTank(Fluids.HOTSTEAM, 160000); } - + + private long powerBeforeNet; + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + throttle = powerSliderPos * 100 / 60; - + if(slots[1] != null && slots[1].getItem() instanceof IItemFluidIdentifier) { FluidType fluid = ((IItemFluidIdentifier) slots[1].getItem()).getType(worldObj, xCoord, yCoord, zCoord, slots[1]); if(fluid.hasTrait(FT_Combustible.class) && fluid.getTrait(FT_Combustible.class).getGrade() == FuelGrade.GAS) { tanks[0].setTankType(fluid); } } - + if(autoMode) { //power production depending on power requirement - + //scales the slider proportionally to the power gauge int powerSliderTarget = 60 - (int) (60 * power / maxPower); - + if(powerSliderTarget > powerSliderPos) { //makes the auto slider slide instead of snapping into position powerSliderPos++; } @@ -112,37 +115,36 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement powerSliderPos--; } } - - switch(state) { //what to do when turbine offline, starting up and online + + switch(state) { //what to do when turbine offline, starting up and online case 0: - shutdown(); + shutdown(); break; case -1: stopIfNotReady(); startup(); break; - case 1: + case 1: stopIfNotReady(); run(); break; default: break; } - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", Math.min(this.power, this.maxPower)); //set first to get an unmodified view of how much power was generated before deductions from the net - + + powerBeforeNet = Math.min(this.power, maxPower); + //do net/battery deductions first... power = Library.chargeItemsFromTE(slots, 0, power, maxPower); this.tryProvide(worldObj, xCoord - dir.offsetZ * 5, yCoord + 1, zCoord + dir.offsetX * 5, rot); //sends out power - + //...and then cap it. Prevents potential future cases where power would be limited due to the fuel being too strong and the buffer too small. if(this.power > this.maxPower) this.power = this.maxPower; - + for(int i = 0; i < 2; i++) { //fuel and lube this.trySubscribe(tanks[i].getTankType(), worldObj, xCoord - dir.offsetX * 2 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ, dir.getOpposite()); this.trySubscribe(tanks[i].getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ, dir); @@ -152,47 +154,29 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement this.trySubscribe(tanks[2].getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -4, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -4, dir); //steam this.sendFluid(tanks[3], worldObj, xCoord + dir.offsetZ * 6, yCoord + 1, zCoord - dir.offsetX * 6, rot.getOpposite()); - - data.setInteger("rpm", this.rpm); - data.setInteger("temp", this.temp); - data.setInteger("state", this.state); - data.setBoolean("automode", this.autoMode); - data.setInteger("throttle", this.throttle); - data.setInteger("slidpos", this.powerSliderPos); - - if(state != 1) { - data.setInteger("counter", this.counter); //sent during startup and shutdown - } else { - data.setInteger("instantPow", this.instantPowerOutput); //sent while running - } - - tanks[0].writeToNBT(data, "fuel"); - tanks[1].writeToNBT(data, "lube"); - tanks[2].writeToNBT(data, "water"); - tanks[3].writeToNBT(data, "steam"); - - this.networkPack(data, 150); - + + this.networkPackNT(150); + } else { //client side, for sounds n shit - + if(rpm >= 10 && state != -1) { //if conditions are right, play the sound - + if(audio == null) { //if there is no sound playing, start it - + audio = MainRegistry.proxy.getLoopedSound("hbm:block.turbinegasRunning", xCoord, yCoord, zCoord, getVolume(1.0F), 20F, 2.0F); audio.startSound(); - + } else if(!audio.isPlaying()) { audio.stopSound(); audio = MainRegistry.proxy.getLoopedSound("hbm:block.turbinegasRunning", xCoord, yCoord, zCoord, getVolume(1.0F), 20F, 2.0F); audio.startSound(); } - + audio.updatePitch((float) (0.55 + 0.1 * rpm / 10)); //dynamic pitch update based on rpm audio.updateVolume(getVolume(2F)); //yeah i need this - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -200,9 +184,54 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement } } } - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.powerBeforeNet); + buf.writeInt(this.rpm); + buf.writeInt(this.temp); + buf.writeInt(this.state); + buf.writeBoolean(this.autoMode); + buf.writeInt(this.throttle); + buf.writeInt(this.powerSliderPos); + + if(state != 1) { + buf.writeInt(this.counter); //sent during startup and shutdown + } else { + buf.writeInt(this.instantPowerOutput); //sent while running + } + + tanks[0].serialize(buf); + tanks[1].serialize(buf); + tanks[2].serialize(buf); + tanks[3].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.rpm = buf.readInt(); + this.temp = buf.readInt(); + this.state = buf.readInt(); + this.autoMode = buf.readBoolean(); + this.throttle = buf.readInt(); + this.powerSliderPos = buf.readInt(); + + if(state != 1) + this.counter = buf.readInt(); + else + this.instantPowerOutput = buf.readInt(); //state 1 + + this.tanks[0].deserialize(buf); + this.tanks[1].deserialize(buf); + this.tanks[2].deserialize(buf); + this.tanks[3].deserialize(buf); + } + private void stopIfNotReady() { - + if(tanks[0].getFill() == 0 || tanks[1].getFill() == 0) { state = 0; } @@ -210,20 +239,20 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement state = 0; } } - + public boolean hasAcceptableFuel() { - + if(tanks[0].getTankType().hasTrait(FT_Combustible.class)) { return tanks[0].getTankType().getTrait(FT_Combustible.class).getGrade() == FuelGrade.GAS; } - + return false; } - + private void startup() { - + counter++; - + if(counter <= 20) //rpm gauge 0-100-0 rpm = 5 * counter; else if (counter > 20 && counter <= 40) @@ -232,43 +261,43 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement rpm = (int) (rpmIdle * (counter - 50) / 530); //slowly ramps up temp and RPM temp = (int) (tempIdle * (counter - 50) / 530); } - + if(counter == 50) { worldObj.playSoundEffect(xCoord, yCoord + 2, zCoord, "hbm:block.turbinegasStartup", getVolume(1.0F), 1.0F); } - + if(counter == 580) { state = 1; } } - - + + int rpmLast; //used to progressively slow down and cool the turbine without immediatly setting rpm and temp to 0 int tempLast; - + private void shutdown() { - + autoMode = false; instantPowerOutput = 0; - + if(powerSliderPos > 0) powerSliderPos--; - + if(rpm <= 10 && counter > 0) { - + if(counter == 225) { - + worldObj.playSoundEffect(xCoord, yCoord + 2, zCoord, "hbm:block.turbinegasShutdown", getVolume(1.0F), 1.0F); - + rpmLast = rpm; tempLast = temp; } - + counter--; - + rpm = (int) (rpmLast * (counter) / 225); temp = (int) (tempLast * (counter) / 225); - + } else if(rpm > 11) { //quickly slows down the turbine to idle before shutdown counter = 42069; //absolutely necessary to avoid fuckeries on shutdown rpm--; @@ -277,15 +306,15 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement rpm--; } } - + /** Dynamically calculates a (hopefully) sensible burn heat from the combustion energy, scales from 300°C - 800°C */ protected int getFluidBurnTemp(FluidType type) { double dFuel = type.hasTrait(FT_Combustible.class) ? type.getTrait(FT_Combustible.class).getCombustionEnergy() : 0; return (int) Math.floor(800D - (Math.pow(Math.E, -dFuel / 100_000D)) * 300D); } - + private void run() { - + if((int) (throttle * 0.9) > rpm - rpmIdle) { //simulates the rotor's moment of inertia if(worldObj.getTotalWorldTime() % 5 == 0) { rpm++; @@ -295,9 +324,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement rpm--; } } - + int maxTemp = getFluidBurnTemp(tanks[0].getTankType()); // fuelMaxTemp.get(tanks[0].getTankType()) - + if(throttle * 5 * (maxTemp - tempIdle) / 500 > temp - tempIdle) { //simulates the heat exchanger's resistance to temperature variation if(worldObj.getTotalWorldTime() % 2 == 0) { temp++; @@ -307,30 +336,30 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement temp--; } } - + double consumption = fuelMaxCons.containsKey(tanks[0].getTankType()) ? fuelMaxCons.get(tanks[0].getTankType()) : 5D; if(worldObj.getTotalWorldTime() % 20 == 0 && tanks[0].getTankType() != Fluids.OXYHYDROGEN) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 3); makePower(consumption, throttle); } - - + + double fuelToConsume; //used to consume 1 mb of fuel at a time when consumption is <1 mb/tick double waterToBoil; double waterPerTick = 0; - + private void makePower(double consMax, int throttle) { - + double idleConsumption = consMax * 0.05D; double consumption = idleConsumption + consMax * throttle / 100; - + fuelToConsume += consumption; - + tanks[0].setFill(tanks[0].getFill() - (int) Math.floor(fuelToConsume)); fuelToConsume -= (int) Math.floor(fuelToConsume); - - if(worldObj.getTotalWorldTime() % 10 == 0) //lube consumption + + if(worldObj.getTotalWorldTime() % 10 == 0) //lube consumption tanks[1].setFill(tanks[1].getFill() - 1); - + if(tanks[0].getFill() < 0) { //avoids negative amounts of fluid tanks[0].setFill(0); state = 0; @@ -339,16 +368,16 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement tanks[1].setFill(0); state = 0; } - - + + long energy = 0; //energy per mb of fuel - + if(tanks[0].getTankType().hasTrait(FT_Combustible.class)) { energy = tanks[0].getTankType().getTrait(FT_Combustible.class).getCombustionEnergy() / 1000L; } - + int rpmEff = rpm - rpmIdle; // RPM above idle level, 0-90 - + //consMax*energy is equivalent to power production at 100% if(instantPowerOutput < (consMax * energy * rpmEff / 90)) { //this shit avoids power rising in steps of 2000 or so HE at a time, instead it does it smoothly instantPowerOutput += Math.random() * 0.005 * consMax * energy; @@ -361,47 +390,24 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement instantPowerOutput = (int) (consMax * energy * rpmEff / 90); } this.power += instantPowerOutput; - + waterPerTick = (consMax * energy * (temp - tempIdle) / 220000); //it just works fuck you - + if(tanks[2].getFill() >= Math.ceil(waterPerTick)) { //checks if there's enough water to boil - + waterToBoil += waterPerTick; - + if(tanks[3].getFill() <= 160000 - waterToBoil * 10) { //checks if there's room for steam in the tank - + tanks[2].setFill(tanks[2].getFill() - (int) Math.floor(waterToBoil)); tanks[3].setFill(tanks[3].getFill() + 10 * (int) Math.floor(waterToBoil)); waterToBoil -= (int) Math.floor(waterToBoil); } } } - + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.rpm = nbt.getInteger("rpm"); - this.temp = nbt.getInteger("temp"); - this.state = nbt.getInteger("state"); - this.autoMode = nbt.getBoolean("automode"); - this.powerSliderPos = nbt.getInteger("slidpos"); - this.throttle = nbt.getInteger("throttle"); - - if(nbt.hasKey("counter")) - this.counter = nbt.getInteger("counter"); //state 0 and -1 - else - this.instantPowerOutput = nbt.getInteger("instantPow"); //state 1 - - this.tanks[0].readFromNBT(nbt, "fuel"); - this.tanks[1].readFromNBT(nbt, "lube"); - this.tanks[2].readFromNBT(nbt, "water"); - this.tanks[3].readFromNBT(nbt, "steam"); - } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -418,11 +424,11 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement this.instantPowerOutput = nbt.getInteger("instPwr"); this.counter = nbt.getInteger("counter"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + tanks[0].writeToNBT(nbt, "gas"); tanks[1].writeToNBT(nbt, "lube"); tanks[2].writeToNBT(nbt, "water"); @@ -448,24 +454,24 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement @Override public void receiveControl(NBTTagCompound data) { - + if(data.hasKey("slidPos")) powerSliderPos = data.getInteger("slidPos"); - + if(data.hasKey("autoMode")) autoMode = data.getBoolean("autoMode"); - + if(data.hasKey("state")) state = data.getInteger("state"); this.markDirty(); } - + @Override public boolean hasPermission(EntityPlayer player) { return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 25; } - + @Override public void onChunkUnload() { @@ -495,17 +501,17 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement public long getPower() { return this.power; } - + @Override public long getMaxPower() { return this.maxPower; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 5, @@ -516,10 +522,10 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement zCoord + 6 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -545,7 +551,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement public FluidTank[] getSendingTanks() { return new FluidTank[] { tanks[3] }; } - + @Override public boolean canConnect(ForgeDirection dir) { return dir != ForgeDirection.DOWN; @@ -710,4 +716,4 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, this.waterToBoil); data.setDouble(CompatEnergyControl.D_OUTPUT_MB, this.waterToBoil * 10); } -} \ No newline at end of file +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java index c8ad6e894..3af43d301 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbofan.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.handler.MultiblockHandlerXR; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineTurbofan; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -35,6 +36,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -53,7 +55,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem public static final long maxPower = 1_000_000; public FluidTank tank; public FluidTank blood; - + public int afterburner; public boolean wasOn; public boolean showBlood = false; @@ -63,9 +65,11 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem public float spin; public float lastSpin; public int momentum = 0; - + private AudioWrapper audio; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineTurbofan() { super(5, 150); tank = new FluidTank(Fluids.KEROSENE, 24000); @@ -90,7 +94,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("powerTime", power); tank.writeToNBT(nbt, "fuel"); blood.writeToNBT(nbt, "blood"); @@ -100,12 +104,12 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem public long getPowerScaled(long i) { return (power * i) / maxPower; } - + protected DirPos[] getConPos() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getRotation(ForgeDirection.UP); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + return new DirPos[] { new DirPos(this.xCoord + rot.offsetX * 2, this.yCoord, this.zCoord + rot.offsetZ * 2, rot), new DirPos(this.xCoord + rot.offsetX * 2 - dir.offsetX, this.yCoord, this.zCoord + rot.offsetZ * 2 - dir.offsetZ, rot), @@ -116,12 +120,12 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.output = 0; this.consumption = 0; - + //meta below 12 means that it's an old multiblock configuration if(this.getBlockMetadata() < 12) { //get old direction @@ -143,54 +147,54 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem worldObj.getTileEntity(xCoord, yCoord, zCoord).readFromNBT(data); return; } - + tank.setType(4, slots); tank.loadTank(0, 1, slots); blood.setTankType(Fluids.BLOOD); - + this.wasOn = false; - - UpgradeManager.eval(slots, 2, 2); - this.afterburner = UpgradeManager.getLevel(UpgradeType.AFTERBURN); - + + upgradeManager.checkSlots(this, slots, 2, 2); + this.afterburner = upgradeManager.getLevel(UpgradeType.AFTERBURN); + if(slots[2] != null && slots[2].getItem() == ModItems.flame_pony) this.afterburner = 100; - + long burnValue = 0; int amount = 1 + this.afterburner; - + if(tank.getTankType().hasTrait(FT_Combustible.class) && tank.getTankType().getTrait(FT_Combustible.class).getGrade() == FuelGrade.AERO) { burnValue = tank.getTankType().getTrait(FT_Combustible.class).getCombustionEnergy() / 1_000; } - + int amountToBurn = Math.min(amount, this.tank.getFill()); - + if(amountToBurn > 0) { this.wasOn = true; this.tank.setFill(this.tank.getFill() - amountToBurn); this.output = (int) (burnValue * amountToBurn * (1 + Math.min(this.afterburner / 3D, 4))); this.power += this.output; this.consumption = amountToBurn; - + if(worldObj.getTotalWorldTime() % 20 == 0) super.pollute(tank.getTankType(), FluidTrait.FluidReleaseType.BURN, amountToBurn * 5);; } - + power = Library.chargeItemsFromTE(slots, 3, power, power); - + for(DirPos pos : getConPos()) { this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(this.blood.getFill() > 0) this.sendFluid(blood, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.sendSmoke(pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + if(burnValue > 0 && amountToBurn > 0) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getRotation(ForgeDirection.UP); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + if(this.afterburner > 0) { - + for(int i = 0; i < 2; i++) { double speed = 2 + worldObj.rand.nextDouble() * 3; double deviation = worldObj.rand.nextGaussian() * 0.2; @@ -201,15 +205,15 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem data.setFloat("scale", 8F); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, this.xCoord + 0.5F - dir.offsetX * (3 - i), this.yCoord + 1.5F, this.zCoord + 0.5F - dir.offsetZ * (3 - i)), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); } - + /*if(this.afterburner > 90 && worldObj.rand.nextInt(60) == 0) { worldObj.newExplosion(null, xCoord + 0.5 + dir.offsetX * 3.5, yCoord + 0.5, zCoord + 0.5 + dir.offsetZ * 3.5, 3F, false, false); }*/ - + if(this.afterburner > 90 && worldObj.rand.nextInt(30) == 0) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "hbm:block.damage", 3.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F); } - + if(this.afterburner > 90) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "gasfire"); @@ -222,16 +226,16 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem ), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); } } - + double minX = this.xCoord + 0.5 - dir.offsetX * 3.5 - rot.offsetX * 1.5; double maxX = this.xCoord + 0.5 - dir.offsetX * 19.5 + rot.offsetX * 1.5; double minZ = this.zCoord + 0.5 - dir.offsetZ * 3.5 - rot.offsetZ * 1.5; double maxZ = this.zCoord + 0.5 - dir.offsetZ * 19.5 + rot.offsetZ * 1.5; - + List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(Math.min(minX, maxX), yCoord, Math.min(minZ, maxZ), Math.max(minX, maxX), yCoord + 3, Math.max(minZ, maxZ))); - + for(Entity e : list) { - + if(this.afterburner > 0) { e.setFire(5); e.attackEntityFrom(DamageSource.onFire, 5F); @@ -239,40 +243,40 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem e.motionX -= dir.offsetX * 0.2; e.motionZ -= dir.offsetZ * 0.2; } - + minX = this.xCoord + 0.5 + dir.offsetX * 3.5 - rot.offsetX * 1.5; maxX = this.xCoord + 0.5 + dir.offsetX * 8.5 + rot.offsetX * 1.5; minZ = this.zCoord + 0.5 + dir.offsetZ * 3.5 - rot.offsetZ * 1.5; maxZ = this.zCoord + 0.5 + dir.offsetZ * 8.5 + rot.offsetZ * 1.5; - + list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(Math.min(minX, maxX), yCoord, Math.min(minZ, maxZ), Math.max(minX, maxX), yCoord + 3, Math.max(minZ, maxZ))); - + for(Entity e : list) { e.motionX -= dir.offsetX * 0.2; e.motionZ -= dir.offsetZ * 0.2; } - + minX = this.xCoord + 0.5 + dir.offsetX * 3.5 - rot.offsetX * 1.5; maxX = this.xCoord + 0.5 + dir.offsetX * 3.75 + rot.offsetX * 1.5; minZ = this.zCoord + 0.5 + dir.offsetZ * 3.5 - rot.offsetZ * 1.5; maxZ = this.zCoord + 0.5 + dir.offsetZ * 3.75 + rot.offsetZ * 1.5; - + list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(Math.min(minX, maxX), yCoord, Math.min(minZ, maxZ), Math.max(minX, maxX), yCoord + 3, Math.max(minZ, maxZ))); - + for(Entity e : list) { e.attackEntityFrom(ModDamageSource.turbofan, 1000); e.setInWeb(); - + if(!e.isEntityAlive() && e instanceof EntityLivingBase) { NBTTagCompound vdat = new NBTTagCompound(); vdat.setString("type", "giblets"); vdat.setInteger("ent", e.getEntityId()); vdat.setInteger("cDiv", 5); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY + e.height * 0.5, e.posZ, 150)); - + worldObj.playSoundEffect(e.posX, e.posY, e.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F); - - blood.setFill(blood.getFill() + 50); + + blood.setFill(blood.getFill() + 50); if(blood.getFill() > blood.getMaxFill()) { blood.setFill(blood.getMaxFill()); } @@ -280,24 +284,17 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem } } } - + if(this.power > this.maxPower) { this.power = this.maxPower; } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setByte("after", (byte) afterburner); - data.setBoolean("wasOn", wasOn); - data.setBoolean("showBlood", showBlood); - tank.writeToNBT(data, "tank"); - blood.writeToNBT(data, "blood"); - this.networkPack(data, 150); - + + this.networkPackNT(150); + } else { - + this.lastSpin = this.spin; - + if(wasOn) { if(this.momentum < 100F) this.momentum++; @@ -305,16 +302,16 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem if(this.momentum > 0) this.momentum--; } - + this.spin += momentum / 2; - + if(this.spin >= 360) { this.spin -= 360F; this.lastSpin -= 360F; } if(momentum > 0) { - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -325,9 +322,9 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem audio.keepAlive(); audio.updateVolume(getVolume(momentum / 50F)); audio.updatePitch(momentum / 200F + 0.5F + this.afterburner * 0.16F); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -346,37 +343,37 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem double maxX = this.xCoord + 0.5 - dir.offsetX * 19.5 + rot.offsetX * 1.5; double minZ = this.zCoord + 0.5 - dir.offsetZ * 3.5 - rot.offsetZ * 1.5; double maxZ = this.zCoord + 0.5 - dir.offsetZ * 19.5 + rot.offsetZ * 1.5; - + List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(Math.min(minX, maxX), yCoord, Math.min(minZ, maxZ), Math.max(minX, maxX), yCoord + 3, Math.max(minZ, maxZ))); - + for(Entity e : list) { if(e == MainRegistry.proxy.me()) { e.motionX -= dir.offsetX * 0.2; e.motionZ -= dir.offsetZ * 0.2; } } - + minX = this.xCoord + 0.5 + dir.offsetX * 3.5 - rot.offsetX * 1.5; maxX = this.xCoord + 0.5 + dir.offsetX * 8.5 + rot.offsetX * 1.5; minZ = this.zCoord + 0.5 + dir.offsetZ * 3.5 - rot.offsetZ * 1.5; maxZ = this.zCoord + 0.5 + dir.offsetZ * 8.5 + rot.offsetZ * 1.5; - + list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(Math.min(minX, maxX), yCoord, Math.min(minZ, maxZ), Math.max(minX, maxX), yCoord + 3, Math.max(minZ, maxZ))); - + for(Entity e : list) { if(e == MainRegistry.proxy.me()) { e.motionX -= dir.offsetX * 0.2; e.motionZ -= dir.offsetZ * 0.2; } } - + minX = this.xCoord + 0.5 + dir.offsetX * 3.5 - rot.offsetX * 1.5; maxX = this.xCoord + 0.5 + dir.offsetX * 3.75 + rot.offsetX * 1.5; minZ = this.zCoord + 0.5 + dir.offsetZ * 3.5 - rot.offsetZ * 1.5; maxZ = this.zCoord + 0.5 + dir.offsetZ * 3.75 + rot.offsetZ * 1.5; - + list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(Math.min(minX, maxX), yCoord, Math.min(minZ, maxZ), Math.max(minX, maxX), yCoord + 3, Math.max(minZ, maxZ))); - + for(Entity e : list) { if(e == MainRegistry.proxy.me()) { e.setInWeb(); @@ -385,18 +382,29 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem } } } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.afterburner = nbt.getByte("after"); - this.wasOn = nbt.getBoolean("wasOn"); - this.showBlood = nbt.getBoolean("showBlood"); - tank.readFromNBT(nbt, "tank"); - blood.readFromNBT(nbt, "blood"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + buf.writeByte((byte) afterburner); + buf.writeBoolean(wasOn); + buf.writeBoolean(showBlood); + tank.serialize(buf); + blood.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.afterburner = buf.readByte(); + this.wasOn = buf.readBoolean(); + this.showBlood = buf.readBoolean(); + tank.deserialize(buf); + blood.deserialize(buf); + } + public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.turbofanOperate", xCoord, yCoord, zCoord, 1.0F, 50F, 1.0F, 20); } @@ -435,7 +443,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem public void setPower(long i) { this.power = i; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; @@ -488,9 +496,10 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.AFTERBURN) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.AFTERBURN, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMicrowave.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMicrowave.java index e8f3f72a2..5f81bccb6 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMicrowave.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMicrowave.java @@ -16,6 +16,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -83,21 +84,25 @@ public class TileEntityMicrowave extends TileEntityMachineBase implements IEnerg time += speed * 2; } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("time", time); - data.setInteger("speed", speed); - networkPack(data, 50); + + networkPackNT(50); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - power = data.getLong("power"); - time = data.getInteger("time"); - speed = data.getInteger("speed"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + buf.writeInt(time); + buf.writeInt(speed); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + power = buf.readLong(); + time = buf.readInt(); + speed = buf.readInt(); } public void handleButtonPacket(int value, int meta) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java index 0d7e8edd0..c7dceeda3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java @@ -29,6 +29,7 @@ import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -44,7 +45,7 @@ import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, SimpleComponent, IFluidStandardTransceiver, CompatHandler.OCComponent { - + public FluidTank[] tanks; public long coreHeat; public static final long coreHeatCapacityBase = 10_000_000; @@ -52,15 +53,15 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG public long hullHeat; public static final long hullHeatCapacityBase = 10_000_000; public double flux; - + public double rodLevel = 100; public double rodTarget = 100; - + public int typeLoaded; public int amountLoaded; public double progress; public double processTime; - + public int rodCount; public int connections; public int connectionsControlled; @@ -68,10 +69,10 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG public int heatsinkCount; public int channelCount; public int sourceCount; - + public int unloadDelay = 0; public boolean assembled; - + private AudioWrapper audio; protected List ports = new ArrayList(); @@ -79,15 +80,15 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG public TileEntityPWRController() { super(3); - + this.tanks = new FluidTank[2]; this.tanks[0] = new FluidTank(Fluids.COOLANT, 128_000); this.tanks[1] = new FluidTank(Fluids.COOLANT_HOT, 128_000); } - + /** The initial creation of the reactor, does all the pre-calculation and whatnot */ public void setup(HashMap partMap, HashMap rodMap) { - + rodCount = 0; connections = 0; connectionsControlled = 0; @@ -100,7 +101,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG int connectionsDouble = 0; int connectionsControlledDouble = 0; - + for(Entry entry : partMap.entrySet()) { Block block = entry.getValue(); @@ -111,16 +112,16 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG if(block == ModBlocks.pwr_neutron_source) sourceCount++; if(block == ModBlocks.pwr_port) ports.add(entry.getKey()); } - + for(Entry entry : rodMap.entrySet()) { BlockPos fuelPos = entry.getKey(); - + rods.add(fuelPos); - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - + boolean controlled = false; - + for(int i = 1; i < 16; i++) { BlockPos checkPos = fuelPos.offset(dir, i); Block atPos = partMap.get(checkPos); @@ -149,7 +150,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG connections = connectionsDouble / 2; connectionsControlled = connectionsControlledDouble / 2; heatsinkCount = Math.min(heatsinkCount, 80); - + //switching this to int64 because after 2127 heatsinks the capacity exceeds the int32 which is well within the 4000+ threshold we are working with. oops! this.coreHeatCapacity = this.coreHeatCapacityBase + this.heatsinkCount * (this.coreHeatCapacityBase / 20); } @@ -161,17 +162,17 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.tanks[0].setType(2, slots); setupTanks(); - + if(unloadDelay > 0) unloadDelay--; - + int chunkX = xCoord >> 4; int chunkZ = zCoord >> 4; - + //since fluid sources are often not within 1 chunk, we just do 2 chunks distance and call it a day if(!worldObj.getChunkProvider().chunkExists(chunkX, chunkZ) || !worldObj.getChunkProvider().chunkExists(chunkX + 2, chunkZ + 2) || @@ -180,20 +181,20 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG !worldObj.getChunkProvider().chunkExists(chunkX - 2, chunkZ - 2)) { this.unloadDelay = 60; } - + if(this.assembled) { for(BlockPos pos : ports) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { BlockPos portPos = pos.offset(dir); - + if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); if(worldObj.getTotalWorldTime() % 20 == 0) this.trySubscribe(tanks[0].getTankType(), worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir); } } - + //only perform fission if the area has been loaded for 40 ticks or more if(this.unloadDelay <= 0) { - + if((typeLoaded == -1 || amountLoaded <= 0) && slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel) { typeLoaded = slots[0].getItemDamage(); amountLoaded++; @@ -208,61 +209,61 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG if(diff < 1 && diff > -1) this.rodLevel = this.rodTarget; if(this.rodTarget > this.rodLevel) this.rodLevel++; if(this.rodTarget < this.rodLevel) this.rodLevel--; - + int newFlux = this.sourceCount * 20; - + if(typeLoaded != -1 && amountLoaded > 0) { - + EnumPWRFuel fuel = EnumUtil.grabEnumSafely(EnumPWRFuel.class, typeLoaded); double usedRods = getTotalProcessMultiplier(); double fluxPerRod = this.flux / this.rodCount; double outputPerRod = fuel.function.effonix(fluxPerRod); double totalOutput = outputPerRod * amountLoaded * usedRods; double totalHeatOutput = totalOutput * fuel.heatEmission; - + this.coreHeat += totalHeatOutput; newFlux += totalOutput; - + this.processTime = (int) fuel.yield; this.progress += totalOutput; - + if(this.progress >= this.processTime) { this.progress -= this.processTime; - + if(slots[1] == null) { slots[1] = new ItemStack(ModItems.pwr_fuel_hot, 1, typeLoaded); } else if(slots[1].getItem() == ModItems.pwr_fuel_hot && slots[1].getItemDamage() == typeLoaded && slots[1].stackSize < slots[1].getMaxStackSize()) { slots[1].stackSize++; } - + this.amountLoaded--; this.markChanged(); } } - + if(this.amountLoaded <= 0) { this.typeLoaded = -1; } - + if(amountLoaded > rodCount) amountLoaded = rodCount; - + /* CORE COOLING */ double coreCoolingApproachNum = getXOverE((double) this.heatexCount * 5 / (double) getRodCountForCoolant(), 2) / 2D; long averageCoreHeat = (this.coreHeat + this.hullHeat) / 2; this.coreHeat -= (coreHeat - averageCoreHeat) * coreCoolingApproachNum; this.hullHeat -= (hullHeat - averageCoreHeat) * coreCoolingApproachNum; - + updateCoolant(); - + this.coreHeat *= 0.999D; this.hullHeat *= 0.999D; - + this.flux = newFlux; - + if(tanks[0].getTankType().hasTrait(FT_PWRModerator.class) && tanks[0].getFill() > 0) { this.flux *= tanks[0].getTankType().getTrait(FT_PWRModerator.class).getMultiplier(); } - + if(this.coreHeat > this.coreHeatCapacity) { meltDown(); } @@ -271,26 +272,12 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG this.coreHeat = 0; } } - - NBTTagCompound data = new NBTTagCompound(); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - data.setInteger("rodCount", rodCount); - data.setLong("coreHeat", coreHeat); - data.setLong("hullHeat", hullHeat); - data.setDouble("flux", flux); - data.setDouble("processTime", processTime); - data.setDouble("progress", progress); - data.setInteger("typeLoaded", typeLoaded); - data.setInteger("amountLoaded", amountLoaded); - data.setDouble("rodLevel", rodLevel); - data.setDouble("rodTarget", rodTarget); - data.setLong("coreHeatCapacity", coreHeatCapacity); - this.networkPack(data, 150); + + this.networkPackNT(150); } else { - + if(amountLoaded > 0) { - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); @@ -300,9 +287,9 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG audio.updateVolume(getVolume(1F)); audio.keepAlive(); - + } else { - + if(audio != null) { audio.stopSound(); audio = null; @@ -310,15 +297,15 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG } } } - + protected void meltDown() { - + worldObj.func_147480_a(xCoord, yCoord, zCoord, false); double x = 0; double y = 0; double z = 0; - + for(BlockPos pos : this.rods) { Block b = worldObj.getBlock(pos.getX(), pos.getY(), pos.getZ()); b.breakBlock(worldObj, pos.getX(), pos.getY(), pos.getZ(), b, worldObj.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ())); @@ -332,10 +319,10 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG x /= rods.size(); y /= rods.size(); z /= rods.size(); - + worldObj.newExplosion(null, x, y, z, 15F, true, true); } - + @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.reactorLoop", xCoord, yCoord, zCoord, 1F, 10F, 1.0F, 20); @@ -360,15 +347,15 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG audio = null; } } - + protected void updateCoolant() { - + FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); if(trait == null || trait.getEfficiency(HeatingType.PWR) <= 0) return; - + double coolingEff = (double) this.channelCount / (double) getRodCountForCoolant() * 0.1D; //10% cooling if numbers match if(coolingEff > 1D) coolingEff = 1D; - + //no use in trying to convert everythin to long since the internal tanks would never even support operation like that, just cap the heat cycle count to prevent overflows in the math int heatToUse = (int) Math.min(Math.min(this.hullHeat, (long) (this.hullHeat * coolingEff * trait.getEfficiency(HeatingType.PWR))), 2_000_000_000); HeatingStep step = trait.getFirstStep(); @@ -376,57 +363,75 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG int hotCycles = (tanks[1].getMaxFill() - tanks[1].getFill()) / step.amountProduced; int heatCycles = heatToUse / step.heatReq; int cycles = Math.min(coolCycles, Math.min(hotCycles, heatCycles)); - + this.hullHeat -= step.heatReq * cycles; this.tanks[0].setFill(tanks[0].getFill() - step.amountReq * cycles); this.tanks[1].setFill(tanks[1].getFill() + step.amountProduced * cycles); } - + protected int getRodCountForCoolant() { return this.rodCount + (int) Math.ceil(this.heatsinkCount / 4D); } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - tanks[0].readFromNBT(nbt, "t0"); - tanks[1].readFromNBT(nbt, "t1"); - rodCount = nbt.getInteger("rodCount"); - coreHeat = nbt.getLong("coreHeat"); - hullHeat = nbt.getLong("hullHeat"); - flux = nbt.getDouble("flux"); - processTime = nbt.getDouble("processTime"); - progress = nbt.getDouble("progress"); - typeLoaded = nbt.getInteger("typeLoaded"); - amountLoaded = nbt.getInteger("amountLoaded"); - rodLevel = nbt.getDouble("rodLevel"); - rodTarget = nbt.getInteger("rodTarget"); - coreHeatCapacity = nbt.getLong("coreHeatCapacity"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.rodCount); + buf.writeLong(this.coreHeat); + buf.writeLong(this.hullHeat); + buf.writeDouble(this.flux); + buf.writeDouble(this.processTime); + buf.writeDouble(this.progress); + buf.writeInt(this.typeLoaded); + buf.writeInt(this.amountLoaded); + buf.writeDouble(this.rodLevel); + buf.writeDouble(this.rodTarget); + buf.writeLong(this.coreHeatCapacity); + tanks[0].serialize(buf); + tanks[1].serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.rodCount = buf.readInt(); + this.coreHeat = buf.readLong(); + this.hullHeat = buf.readLong(); + this.flux = buf.readDouble(); + this.processTime = buf.readDouble(); + this.progress = buf.readDouble(); + this.typeLoaded = buf.readInt(); + this.amountLoaded = buf.readInt(); + this.rodLevel = buf.readDouble(); + this.rodTarget = buf.readDouble(); + this.coreHeatCapacity = buf.readLong(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + } + protected void setupTanks() { - + FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); - + if(trait == null || trait.getEfficiency(HeatingType.PWR) <= 0) { tanks[0].setTankType(Fluids.NONE); tanks[1].setTankType(Fluids.NONE); return; } - + tanks[1].setTankType(trait.getFirstStep().typeProduced); } - + public double getTotalProcessMultiplier() { double totalConnections = this.connections + this.connectionsControlled * (1D - (this.rodLevel / 100D)); double connectionsEff = connectinFunc(totalConnections); return connectionsEff; } - + public double connectinFunc(double connections) { return connections / 10D * (1D - getXOverE(connections, 300D)) + connections / 150D * getXOverE(connections, 300D); } - + public double getXOverE(double x, double d) { return 1 - Math.pow(Math.E, -x / d); } @@ -446,14 +451,14 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG public boolean canExtractItem(int slot, ItemStack itemStack, int side) { return slot == 1; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); tanks[0].readFromNBT(nbt, "t0"); tanks[1].readFromNBT(nbt, "t1"); - + this.assembled = nbt.getBoolean("assembled"); this.coreHeat = Math.max(nbt.getInteger("coreHeat"), nbt.getLong("coreHeatL")); this.hullHeat = Math.max(nbt.getInteger("hullHeat"), nbt.getLong("hullHeatL")); @@ -474,14 +479,14 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG this.channelCount = nbt.getInteger("channelCount"); this.sourceCount = nbt.getInteger("sourceCount"); this.heatsinkCount = nbt.getInteger("heatsinkCount"); - + ports.clear(); int portCount = nbt.getInteger("portCount"); for(int i = 0; i < portCount; i++) { int[] port = nbt.getIntArray("p" + i); ports.add(new BlockPos(port[0], port[1], port[2])); } - + rods.clear(); int rodCount = nbt.getInteger("rodCount"); for(int i = 0; i < rodCount; i++) { @@ -491,14 +496,14 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); tanks[0].writeToNBT(nbt, "t0"); tanks[1].writeToNBT(nbt, "t1"); - + nbt.setBoolean("assembled", assembled); nbt.setLong("coreHeatL", coreHeat); nbt.setLong("hullHeatL", hullHeat); @@ -518,13 +523,13 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG nbt.setInteger("channelCount", channelCount); nbt.setInteger("sourceCount", sourceCount); nbt.setInteger("heatsinkCount", heatsinkCount); - + nbt.setInteger("portCount", ports.size()); for(int i = 0; i < ports.size(); i++) { BlockPos pos = ports.get(i); nbt.setIntArray("p" + i, new int[] { pos.getX(), pos.getY(), pos.getZ() }); } - + nbt.setInteger("rodCount", rods.size()); for(int i = 0; i < rods.size(); i++) { BlockPos pos = rods.get(i); @@ -539,7 +544,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG @Override public void receiveControl(NBTTagCompound data) { - + if(data.hasKey("control")) { this.rodTarget = MathHelper.clamp_int(data.getInteger("control"), 0, 100); this.markChanged(); @@ -571,13 +576,13 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG public Object[] getLevel(Context context, Arguments args) { return new Object[] {rodTarget, rodLevel}; } - + @Callback(direct = true) @Optional.Method(modid = "OpenComputers") public Object[] getCoolantInfo(Context context, Arguments args) { return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()}; } - + @Callback(direct = true) @Optional.Method(modid = "OpenComputers") public Object[] getFuelInfo(Context context, Arguments args) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityRadioRec.java b/src/main/java/com/hbm/tileentity/machine/TileEntityRadioRec.java index 7c1f7ea37..bc148cff5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityRadioRec.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityRadioRec.java @@ -1,40 +1,41 @@ package com.hbm.tileentity.machine; import com.hbm.interfaces.IControlReceiver; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.network.RTTYSystem; import com.hbm.tileentity.network.RTTYSystem.RTTYChannel; +import com.hbm.util.BufferUtil; import com.hbm.util.NoteBuilder; import com.hbm.util.NoteBuilder.Instrument; import com.hbm.util.NoteBuilder.Note; import com.hbm.util.NoteBuilder.Octave; import com.hbm.util.Tuple.Triplet; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -public class TileEntityRadioRec extends TileEntity implements INBTPacketReceiver, IControlReceiver { - +public class TileEntityRadioRec extends TileEntityLoadedBase implements IControlReceiver { + public String channel = ""; public boolean isOn = false; - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(this.isOn && !this.channel.isEmpty()) { RTTYChannel chan = RTTYSystem.listen(worldObj, this.channel); - + if(chan != null && chan.timeStamp == worldObj.getTotalWorldTime() - 1) { Triplet[] notes = NoteBuilder.translate(chan.signal + ""); - + for(Triplet note : notes) { Instrument i = note.getX(); Note n = note.getY(); Octave o = note.getZ(); - + int noteId = n.ordinal() + o.ordinal() * 12; String s = "harp"; @@ -48,28 +49,31 @@ public class TileEntityRadioRec extends TileEntity implements INBTPacketReceiver } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setString("channel", channel); - data.setBoolean("isOn", isOn); - INBTPacketReceiver.networkPack(this, data, 15); + + networkPackNT(15); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - channel = nbt.getString("channel"); - isOn = nbt.getBoolean("isOn"); + public void serialize(ByteBuf buf) { + BufferUtil.writeString(buf, this.channel); + buf.writeBoolean(this.isOn); } - + + @Override + public void deserialize(ByteBuf buf) { + this.channel = BufferUtil.readString(buf); + this.isOn = buf.readBoolean(); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + channel = nbt.getString("channel"); isOn = nbt.getBoolean("isOn"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -87,7 +91,7 @@ public class TileEntityRadioRec extends TileEntity implements INBTPacketReceiver public void receiveControl(NBTTagCompound data) { if(data.hasKey("channel")) this.channel = data.getString("channel"); if(data.hasKey("isOn")) this.isOn = data.getBoolean("isOn"); - + this.markDirty(); } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorControl.java b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorControl.java index ccf44a185..407eeef44 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorControl.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorControl.java @@ -13,6 +13,7 @@ import com.hbm.tileentity.TileEntityMachineBase; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -135,33 +136,37 @@ public class TileEntityReactorControl extends TileEntityMachineBase implements I reactor.setTarget(level); } } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("heat", heat); - data.setDouble("level", level); - data.setInteger("flux", flux); - data.setBoolean("isLinked", isLinked); - data.setDouble("levelLower", levelLower); - data.setDouble("levelUpper", levelUpper); - data.setDouble("heatLower", heatLower); - data.setDouble("heatUpper", heatUpper); - data.setInteger("function", function.ordinal()); - this.networkPack(data, 150); + + this.networkPackNT(150); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.heat = data.getInteger("heat"); - this.level = data.getDouble("level"); - this.flux = data.getInteger("flux"); - isLinked = data.getBoolean("isLinked"); - levelLower = data.getDouble("levelLower"); - levelUpper = data.getDouble("levelUpper"); - heatLower = data.getDouble("heatLower"); - heatUpper = data.getDouble("heatUpper"); - function = RodFunction.values()[data.getInteger("function")]; + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(heat); + buf.writeDouble(level); + buf.writeInt(flux); + buf.writeBoolean(isLinked); + buf.writeDouble(levelLower); + buf.writeDouble(levelUpper); + buf.writeDouble(heatLower); + buf.writeDouble(heatUpper); + buf.writeByte(function.ordinal()); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.heat = buf.readInt(); + this.level = buf.readDouble(); + this.flux = buf.readInt(); + isLinked = buf.readBoolean(); + levelLower = buf.readDouble(); + levelUpper = buf.readDouble(); + heatLower = buf.readDouble(); + heatUpper = buf.readDouble(); + function = RodFunction.values()[buf.readByte()]; } private boolean establishLink() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorResearch.java b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorResearch.java index c04a16f92..db295cee4 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorResearch.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorResearch.java @@ -15,12 +15,14 @@ import com.hbm.items.ModItems; import com.hbm.items.machine.ItemPlateFuel; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.CompatEnergyControl; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -150,27 +152,31 @@ public class TileEntityReactorResearch extends TileEntityMachineBase implements float rad = (float) heat / (float) maxHeat * 50F; ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, rad); } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("heat", heat); - data.setByte("water", water); - data.setDouble("level", level); - data.setDouble("targetLevel", targetLevel); - data.setIntArray("slotFlux", slotFlux); - data.setInteger("totalFlux", totalFlux); - this.networkPack(data, 150); + + this.networkPackNT(150); } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.heat = data.getInteger("heat"); - this.water = data.getByte("water"); - this.level = data.getDouble("level"); - this.targetLevel = data.getDouble("targetLevel"); - this.slotFlux = data.getIntArray("slotFlux"); - this.totalFlux = data.getInteger("totalFlux"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.heat); + buf.writeByte(this.water); + buf.writeDouble(this.level); + buf.writeDouble(this.targetLevel); + BufferUtil.writeIntArray(buf, this.slotFlux); + buf.writeInt(this.totalFlux); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.heat = buf.readInt(); + this.water = buf.readByte(); + this.level = buf.readDouble(); + this.targetLevel = buf.readDouble(); + this.slotFlux = BufferUtil.readIntArray(buf); + this.totalFlux = buf.readInt(); } public byte getWater() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java index 418fc91a5..ff9bfee76 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java @@ -33,6 +33,7 @@ import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -127,17 +128,6 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC } - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - this.heat = data.getInteger("heat"); - this.pressure = data.getInteger("pressure"); - this.isOn = data.getBoolean("isOn"); - steam.readFromNBT(data, "t0"); - carbonDioxide.readFromNBT(data, "t1"); - water.readFromNBT(data, "t2"); - } - public int getGaugeScaled(int i, int type) { switch (type) { case 0: return (steam.getFill() * i) / steam.getMaxFill(); @@ -226,18 +216,33 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC } checkIfMeltdown(); - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("heat", heat); - data.setInteger("pressure", pressure); - data.setBoolean("isOn", isOn); - steam.writeToNBT(data, "t0"); - carbonDioxide.writeToNBT(data, "t1"); - water.writeToNBT(data, "t2"); - this.networkPack(data, 150); + + this.networkPackNT(150); } } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.heat); + buf.writeInt(this.pressure); + buf.writeBoolean(this.isOn); + steam.serialize(buf); + carbonDioxide.serialize(buf); + water.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.heat = buf.readInt(); + this.pressure = buf.readInt(); + this.isOn = buf.readBoolean(); + steam.deserialize(buf); + carbonDioxide.deserialize(buf); + water.deserialize(buf); + } + private void generateSteam() { // function of SHS produced per tick diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySawmill.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySawmill.java index cd7a8ad37..a6f591167 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySawmill.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySawmill.java @@ -10,15 +10,16 @@ import com.hbm.items.ModItems; import com.hbm.lib.ModDamageSource; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.machine.TileEntityMachineAutocrafter.InventoryCraftingAuto; +import com.hbm.util.BufferUtil; import com.hbm.util.ItemStackUtil; import api.hbm.tile.IHeatSource; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; @@ -27,14 +28,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; public class TileEntitySawmill extends TileEntityMachineBase { - + public int heat; public static final double diffusion = 0.1D; private int warnCooldown = 0; @@ -42,7 +42,7 @@ public class TileEntitySawmill extends TileEntityMachineBase { public boolean hasBlade = true; public int progress = 0; public static final int processingTime = 600; - + public float spin; public float lastSpin; @@ -55,41 +55,41 @@ public class TileEntitySawmill extends TileEntityMachineBase { @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(hasBlade) { tryPullHeat(); - + if(warnCooldown > 0) warnCooldown--; - + if(heat >= 100) { - + ItemStack result = this.getOutput(slots[0]); - + if(result != null) { progress += heat / 10; - + if(progress >= this.processingTime) { progress = 0; slots[0] = null; slots[1] = result; - + if(result.getItem() != ModItems.powder_sawdust) { float chance = result.getItem() == Items.stick ? 0.1F : 0.5F; if(worldObj.rand.nextFloat() < chance) { slots[2] = new ItemStack(ModItems.powder_sawdust); } } - + this.markDirty(); } - + } else { this.progress = 0; } - + AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(-1D, 0.375D, -1D, -0.875, 2.375D, 1D); aabb = BlockDummyable.getAABBRotationOffset(aabb, xCoord + 0.5, yCoord, zCoord + 0.5, ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getRotation(ForgeDirection.UP)); for(Object o : worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb)) { @@ -106,37 +106,37 @@ public class TileEntitySawmill extends TileEntityMachineBase { PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, e.posX, e.posY + e.height * 0.5, e.posZ), new TargetPoint(e.dimension, e.posX, e.posY, e.posZ, 50)); } } - + } else { this.progress = 0; } - + if(heat > 300) { - + this.overspeed++; - + if(overspeed > 60 && warnCooldown == 0) { warnCooldown = 100; worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1, zCoord + 0.5, "hbm:block.warnOverspeed", 2.0F, 1.0F); } - + if(overspeed > 300) { this.hasBlade = false; this.worldObj.newExplosion(null, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 5F, false, false); - + int orientation = this.getBlockMetadata() - BlockDummyable.offset; ForgeDirection dir = ForgeDirection.getOrientation(orientation); EntitySawblade cog = new EntitySawblade(worldObj, xCoord + 0.5 + dir.offsetX, yCoord + 1, zCoord + 0.5 + dir.offsetZ).setOrientation(orientation); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + cog.motionX = rot.offsetX; cog.motionY = 1 + (heat - 100) * 0.0001D; cog.motionZ = rot.offsetZ; worldObj.spawnEntityInWorld(cog); - + this.markDirty(); } - + } else { this.overspeed = 0; } @@ -144,34 +144,18 @@ public class TileEntitySawmill extends TileEntityMachineBase { this.overspeed = 0; this.warnCooldown = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("heat", heat); - data.setInteger("progress", progress); - data.setBoolean("hasBlade", hasBlade); - NBTTagList list = new NBTTagList(); - for(int i = 0; i < slots.length; i++) { - if(slots[i] != null) { - NBTTagCompound nbt1 = new NBTTagCompound(); - nbt1.setByte("slot", (byte) i); - slots[i].writeToNBT(nbt1); - list.appendTag(nbt1); - } - } - data.setTag("items", list); - - INBTPacketReceiver.networkPack(this, data, 150); - + networkPackNT(150); + this.heat = 0; - + } else { - + float momentum = heat * 25F / ((float) 300); - + this.lastSpin = this.spin; this.spin += momentum; - + if(this.spin >= 360F) { this.spin -= 360F; this.lastSpin -= 360F; @@ -180,54 +164,58 @@ public class TileEntitySawmill extends TileEntityMachineBase { } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.heat = nbt.getInteger("heat"); - this.progress = nbt.getInteger("progress"); - this.hasBlade = nbt.getBoolean("hasBlade"); - - NBTTagList list = nbt.getTagList("items", 10); + public void serialize(ByteBuf buf) { + buf.writeInt(heat); + buf.writeInt(progress); + buf.writeBoolean(hasBlade); - slots = new ItemStack[3]; - for(int i = 0; i < list.tagCount(); i++) { - NBTTagCompound nbt1 = list.getCompoundTagAt(i); - byte b0 = nbt1.getByte("slot"); - if(b0 >= 0 && b0 < slots.length) { - slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); - } + for (ItemStack slot : slots) { + BufferUtil.writeItemStack(buf, slot); } } - + + @Override + public void deserialize(ByteBuf buf) { + this.heat = buf.readInt(); + this.progress = buf.readInt(); + this.hasBlade = buf.readBoolean(); + + for(int i = 0; i < slots.length; i++) { + slots[i] = BufferUtil.readItemStack(buf); + } + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.hasBlade = nbt.getBoolean("hasBlade"); this.progress = nbt.getInteger("progress"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setBoolean("hasBlade", hasBlade); nbt.setInteger("progress", progress); } - + protected void tryPullHeat() { TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(con instanceof IHeatSource) { IHeatSource source = (IHeatSource) con; int heatSrc = (int) (source.getHeatStored() * diffusion); - + if(heatSrc > 0) { source.useUpHeat(heatSrc); this.heat += heatSrc; return; } } - + this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0); } - + protected InventoryCraftingAuto craftingInventory = new InventoryCraftingAuto(1, 1); @Override @@ -244,20 +232,20 @@ public class TileEntitySawmill extends TileEntityMachineBase { public int[] getAccessibleSlotsFromSide(int side) { return new int[] {0, 1, 2}; } - + public ItemStack getOutput(ItemStack input) { - + if(input == null) return null; - + craftingInventory.setInventorySlotContents(0, input); - + List names = ItemStackUtil.getOreDictNames(input); - + if(names.contains("stickWood")) { return new ItemStack(ModItems.powder_sawdust); } - + if(names.contains("logWood")) { for(Object o : CraftingManager.getInstance().getRecipeList()) { IRecipe recipe = (IRecipe) o; @@ -271,35 +259,35 @@ public class TileEntitySawmill extends TileEntityMachineBase { } } } - + if(names.contains("plankWood")) { return new ItemStack(Items.stick, 6); } - + if(names.contains("treeSapling")) { return new ItemStack(Items.stick, 1); } - + return null; } public static HashMap getRecipes() { - + HashMap recipes = new HashMap(); recipes.put(new OreDictStack("logWood"), new ItemStack[] { new ItemStack(Blocks.planks, 6), ItemStackUtil.addTooltipToStack(new ItemStack(ModItems.powder_sawdust), EnumChatFormatting.RED + "50%") }); recipes.put(new OreDictStack("plankWood"), new ItemStack[] { new ItemStack(Items.stick, 6), ItemStackUtil.addTooltipToStack(new ItemStack(ModItems.powder_sawdust), EnumChatFormatting.RED + "10%") }); recipes.put(new OreDictStack("stickWood"), new ItemStack[] { new ItemStack(ModItems.powder_sawdust) }); recipes.put(new OreDictStack("treeSapling"), new ItemStack[] { new ItemStack(Items.stick, 1), ItemStackUtil.addTooltipToStack(new ItemStack(ModItems.powder_sawdust), EnumChatFormatting.RED + "10%") }); - + return recipes; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -310,10 +298,10 @@ public class TileEntitySawmill extends TileEntityMachineBase { zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java index 3c59f1881..107fe54ab 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java @@ -5,14 +5,11 @@ import java.util.HashSet; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.fluid.IFluidStandardTransceiver; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -28,7 +25,7 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui public HashSet primary = new HashSet(); public HashSet secondary = new HashSet(); - + public TileEntitySolarBoiler() { water = new FluidTank(Fluids.WATER, 100); steam = new FluidTank(Fluids.STEAM, 10_000); @@ -36,16 +33,16 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.trySubscribe(water.getTankType(), worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y); this.trySubscribe(water.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); - + int process = heat / 50; process = Math.min(process, water.getFill()); process = Math.min(process, (steam.getMaxFill() - steam.getFill()) / 100); - + if(process < 0) process = 0; @@ -54,12 +51,12 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui this.sendFluid(steam, worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y); this.sendFluid(steam, worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); - + heat = 0; networkPackNT(15); } else { - + //a delayed queue of mirror positions because we can't expect the boiler to always tick first secondary.clear(); secondary.addAll(primary); @@ -82,12 +79,12 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui this.water.writeToNBT(nbt, "water"); this.steam.writeToNBT(nbt, "steam"); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -98,10 +95,10 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -122,10 +119,6 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui public FluidTank[] getAllTanks() { return new FluidTank[] { water, steam }; } - - public void networkPackNT(int range) { - if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } @Override public void serialize(ByteBuf buf) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySolarMirror.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySolarMirror.java index c64a83cec..f921d04ad 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySolarMirror.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySolarMirror.java @@ -4,6 +4,7 @@ import com.hbm.tileentity.TileEntityTickingBase; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; @@ -28,7 +29,7 @@ public class TileEntitySolarMirror extends TileEntityTickingBase { if(!worldObj.isRemote) { if(worldObj.getTotalWorldTime() % 20 == 0) - sendUpdate(); + this.networkPackNT(200); if(tY < yCoord) { isOn = false; @@ -64,22 +65,18 @@ public class TileEntitySolarMirror extends TileEntityTickingBase { } } - public void sendUpdate() { - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("posX", tX); - data.setInteger("posY", tY); - data.setInteger("posZ", tZ); - data.setBoolean("isOn", isOn); - this.networkPack(data, 200); + @Override public void serialize(ByteBuf buf) { + buf.writeInt(this.tX); + buf.writeInt(this.tY); + buf.writeInt(this.tZ); + buf.writeBoolean(this.isOn); } - @Override - public void networkUnpack(NBTTagCompound nbt) { - tX = nbt.getInteger("posX"); - tY = nbt.getInteger("posY"); - tZ = nbt.getInteger("posZ"); - isOn = nbt.getBoolean("isOn"); + @Override public void deserialize(ByteBuf buf) { + this.tX = buf.readInt(); + this.tY = buf.readInt(); + this.tZ = buf.readInt(); + this.isOn = buf.readBoolean(); } public void setTarget(int x, int y, int z) { @@ -87,7 +84,7 @@ public class TileEntitySolarMirror extends TileEntityTickingBase { tY = y; tZ = z; this.markDirty(); - this.sendUpdate(); + this.networkPackNT(200); } public void readFromNBT(NBTTagCompound nbt) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java index 5163eaf84..10fb7aa82 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySoyuzLauncher.java @@ -24,6 +24,7 @@ import api.hbm.fluid.IFluidStandardReceiver; import api.hbm.item.IDesignatorItem; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ISidedInventory; @@ -94,15 +95,8 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS } else { liftOff(); } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setByte("mode", mode); - data.setBoolean("starting", starting); - data.setByte("type", this.getType()); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - networkPack(data, 250); + + networkPackNT(250); } if(worldObj.isRemote) { @@ -189,18 +183,29 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS audio = null; } } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - power = data.getLong("power"); - mode = data.getByte("mode"); - starting = data.getBoolean("starting"); - rocketType = data.getByte("type"); - tanks[0].readFromNBT(data, "t0"); - tanks[1].readFromNBT(data, "t1"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(power); + buf.writeByte(mode); + buf.writeBoolean(starting); + buf.writeByte(this.getType()); + tanks[0].serialize(buf); + tanks[1].serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + power = buf.readLong(); + mode = buf.readByte(); + starting = buf.readBoolean(); + rocketType = buf.readByte(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); + } + public void startCountdown() { if(canLaunch()) diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySteamEngine.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySteamEngine.java index fbab44838..d0297d2f8 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySteamEngine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySteamEngine.java @@ -9,9 +9,9 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.trait.FT_Coolable; import com.hbm.inventory.fluid.trait.FT_Coolable.CoolingType; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IConfigurableMachine; import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.fauxpointtwelve.DirPos; @@ -19,13 +19,15 @@ import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiver, INBTPacketReceiver, IConfigurableMachine, IFluidCopiable { +public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiver, IBufPacketReceiver, IConfigurableMachine, IFluidCopiable { public long powerBuffer; @@ -36,14 +38,14 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner private int turnProgress; private float acceleration = 0F; - + /* CONFIGURABLE */ private static int steamCap = 2_000; private static int ldsCap = 20; private static double efficiency = 0.85D; - + public TileEntitySteamEngine() { - + tanks = new FluidTank[2]; tanks[0] = new FluidTank(Fluids.STEAM, steamCap); tanks[1] = new FluidTank(Fluids.SPENTSTEAM, ldsCap); @@ -67,59 +69,64 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner writer.name("I:ldsCap").value(ldsCap); writer.name("D:efficiency").value(efficiency); } - + + ByteBuf buf; + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + + if(this.buf != null) + this.buf.release(); + this.buf = Unpooled.buffer(); + this.powerBuffer = 0; tanks[0].setTankType(Fluids.STEAM); tanks[1].setTankType(Fluids.SPENTSTEAM); - - NBTTagCompound data = new NBTTagCompound(); - tanks[0].writeToNBT(data, "s"); + + tanks[0].serialize(buf); FT_Coolable trait = tanks[0].getTankType().getTrait(FT_Coolable.class); double eff = trait.getEfficiency(CoolingType.TURBINE) * efficiency; - + int inputOps = tanks[0].getFill() / trait.amountReq; int outputOps = (tanks[1].getMaxFill() - tanks[1].getFill()) / trait.amountProduced; int ops = Math.min(inputOps, outputOps); tanks[0].setFill(tanks[0].getFill() - ops * trait.amountReq); tanks[1].setFill(tanks[1].getFill() + ops * trait.amountProduced); this.powerBuffer += (ops * trait.heatEnergy * eff); - + if(ops > 0) { this.acceleration += 0.1F; } else { this.acceleration -= 0.1F; } - + this.acceleration = MathHelper.clamp_float(this.acceleration, 0F, 40F); this.rotor += this.acceleration; - + if(this.rotor >= 360D) { this.rotor -= 360D; - + this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.steamEngineOperate", getVolume(1.0F), 0.5F + (acceleration / 80F)); } - - data.setLong("power", this.powerBuffer); - data.setFloat("rotor", this.rotor); - tanks[1].writeToNBT(data, "w"); + + buf.writeLong(this.powerBuffer); + buf.writeFloat(this.rotor); + tanks[1].serialize(buf); for(DirPos pos : getConPos()) { if(this.powerBuffer > 0) this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - INBTPacketReceiver.networkPack(this, data, 150); + + networkPackNT(150); } else { this.lastRotor = this.rotor; - + if(this.turnProgress > 0) { double d = MathHelper.wrapAngleTo180_double(this.syncRotor - (double) this.rotor); this.rotor = (float) ((double) this.rotor + d / (double) this.turnProgress); @@ -129,18 +136,18 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner } } } - + protected DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + rot.offsetX * 2, yCoord + 1, zCoord + rot.offsetZ * 2, rot), new DirPos(xCoord + rot.offsetX * 2 + dir.offsetX, yCoord + 1, zCoord + rot.offsetZ * 2 + dir.offsetZ, rot), new DirPos(xCoord + rot.offsetX * 2 - dir.offsetX, yCoord + 1, zCoord + rot.offsetZ * 2 - dir.offsetZ, rot) }; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -150,7 +157,7 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner this.tanks[0].readFromNBT(nbt, "s"); this.tanks[1].readFromNBT(nbt, "w"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -160,12 +167,12 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner tanks[0].writeToNBT(nbt, "s"); tanks[1].writeToNBT(nbt, "w"); } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -208,12 +215,17 @@ public class TileEntitySteamEngine extends TileEntityLoadedBase implements IEner } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.powerBuffer = nbt.getLong("power"); - this.syncRotor = nbt.getFloat("rotor"); + public void serialize(ByteBuf buf) { + buf.writeBytes(this.buf); + } + + @Override + public void deserialize(ByteBuf buf) { + this.tanks[0].deserialize(buf); + this.powerBuffer = buf.readLong(); + this.syncRotor = buf.readFloat(); + this.tanks[1].deserialize(buf); this.turnProgress = 3; //use 3-ply for extra smoothness - this.tanks[0].readFromNBT(nbt, "s"); - this.tanks[1].readFromNBT(nbt, "w"); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java b/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java index d59a5e933..44a71b5d5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityStirling.java @@ -8,8 +8,8 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.entity.projectile.EntityCog; import com.hbm.lib.Library; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IConfigurableMachine; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.fauxpointtwelve.DirPos; @@ -17,22 +17,23 @@ import api.hbm.energymk2.IEnergyProviderMK2; import api.hbm.tile.IHeatSource; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityStirling extends TileEntityLoadedBase implements INBTPacketReceiver, IEnergyProviderMK2, IConfigurableMachine { - +public class TileEntityStirling extends TileEntityLoadedBase implements IBufPacketReceiver, IEnergyProviderMK2, IConfigurableMachine { + public long powerBuffer; public int heat; private int warnCooldown = 0; private int overspeed = 0; public boolean hasCog = true; - + public float spin; public float lastSpin; - + /* CONFIGURABLE CONSTANTS */ public static double diffusion = 0.1D; public static double efficiency = 0.5D; @@ -42,44 +43,44 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(hasCog) { this.powerBuffer = 0; tryPullHeat(); - + this.powerBuffer = (long) (this.heat * (this.isCreative() ? 1 : this.efficiency)); - + if(warnCooldown > 0) warnCooldown--; - + if(heat > maxHeat() && !isCreative()) { - + this.overspeed++; - + if(overspeed > 60 && warnCooldown == 0) { warnCooldown = 100; worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1, zCoord + 0.5, "hbm:block.warnOverspeed", 2.0F, 1.0F); } - + if(overspeed > overspeedLimit) { this.hasCog = false; this.worldObj.newExplosion(null, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 5F, false, false); - + int orientation = this.getBlockMetadata() - BlockDummyable.offset; ForgeDirection dir = ForgeDirection.getOrientation(orientation); EntityCog cog = new EntityCog(worldObj, xCoord + 0.5 + dir.offsetX, yCoord + 1, zCoord + 0.5 + dir.offsetZ).setOrientation(orientation).setMeta(this.getGeatMeta()); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + cog.motionX = rot.offsetX; cog.motionY = 1 + (heat - maxHeat()) * 0.0001D; cog.motionZ = rot.offsetZ; worldObj.spawnEntityInWorld(cog); - + this.markDirty(); } - + } else { this.overspeed = 0; } @@ -87,52 +88,48 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack this.overspeed = 0; this.warnCooldown = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", powerBuffer); - data.setInteger("heat", heat); - data.setBoolean("hasCog", hasCog); - INBTPacketReceiver.networkPack(this, data, 150); - + + networkPackNT(150); + if(hasCog) { for(DirPos pos : getConPos()) { this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } else { - + if(this.powerBuffer > 0) this.powerBuffer--; } - + this.heat = 0; } else { - + float momentum = powerBuffer * 50F / ((float) maxHeat()); - + if(this.isCreative()) momentum = Math.min(momentum, 45F); - + this.lastSpin = this.spin; this.spin += momentum; - + if(this.spin >= 360F) { this.spin -= 360F; this.lastSpin -= 360F; } } } - + public int getGeatMeta() { return this.getBlockType() == ModBlocks.machine_stirling ? 0 : this.getBlockType() == ModBlocks.machine_stirling_creative ? 2 : 1; } - + public int maxHeat() { return this.getBlockType() == ModBlocks.machine_stirling ? 300 : 1500; } - + public boolean isCreative() { return this.getBlockType() == ModBlocks.machine_stirling_creative; } - + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), @@ -143,29 +140,36 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.powerBuffer = nbt.getLong("power"); - this.heat = nbt.getInteger("heat"); - this.hasCog = nbt.getBoolean("hasCog"); + public void serialize(ByteBuf buf) { + buf.writeLong(this.powerBuffer); + buf.writeInt(this.heat); + buf.writeBoolean(this.hasCog); } - + + @Override + public void deserialize(ByteBuf buf) { + this.powerBuffer = buf.readLong(); + this.heat = buf.readInt(); + this.hasCog = buf.readBoolean(); + } + protected void tryPullHeat() { TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); - + if(con instanceof IHeatSource) { IHeatSource source = (IHeatSource) con; int heatSrc = (int) (source.getHeatStored() * diffusion); - + if(heatSrc > 0) { source.useUpHeat(heatSrc); this.heat += heatSrc; return; } } - + this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -174,7 +178,7 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack this.hasCog = nbt.getBoolean("hasCog"); this.overspeed = nbt.getInteger("overspeed"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -198,12 +202,12 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack public long getMaxPower() { return powerBuffer; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -214,10 +218,10 @@ public class TileEntityStirling extends TileEntityLoadedBase implements INBTPack zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityStorageDrum.java b/src/main/java/com/hbm/tileentity/machine/TileEntityStorageDrum.java index 0ea865d8d..407c79868 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityStorageDrum.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityStorageDrum.java @@ -55,61 +55,61 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + float rad = 0; - + int liquid = 0; int gas = 0; - + for(int i = 0; i < 24; i++) { - + if(slots[i] != null) { - + Item item = slots[i].getItem(); - + if(worldObj.getTotalWorldTime() % 20 == 0) { rad += HazardSystem.getHazardLevelFromStack(slots[i], HazardRegistry.RADIATION); } - + int meta = slots[i].getItemDamage(); - + if(item == ModItems.nuclear_waste_long && worldObj.rand.nextInt(VersatileConfig.getLongDecayChance()) == 0) { ItemWasteLong.WasteClass wasteClass = ItemWasteLong.WasteClass.values()[ItemWasteLong.rectify(meta)]; liquid += wasteClass.liquid; gas += wasteClass.gas; slots[i] = new ItemStack(ModItems.nuclear_waste_long_depleted, 1, meta); } - + if(item == ModItems.nuclear_waste_long_tiny && worldObj.rand.nextInt(VersatileConfig.getLongDecayChance() / 10) == 0) { ItemWasteLong.WasteClass wasteClass = ItemWasteLong.WasteClass.values()[ItemWasteLong.rectify(meta)]; liquid += wasteClass.liquid / 10; gas += wasteClass.gas / 10; slots[i] = new ItemStack(ModItems.nuclear_waste_long_depleted_tiny, 1, meta); } - + if(item == ModItems.nuclear_waste_short && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance()) == 0) { ItemWasteShort.WasteClass wasteClass = ItemWasteShort.WasteClass.values()[ItemWasteLong.rectify(meta)]; liquid += wasteClass.liquid; gas += wasteClass.gas; slots[i] = new ItemStack(ModItems.nuclear_waste_short_depleted, 1, meta); } - + if(item == ModItems.nuclear_waste_short_tiny && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance() / 10) == 0) { ItemWasteShort.WasteClass wasteClass = ItemWasteShort.WasteClass.values()[ItemWasteLong.rectify(meta)]; liquid += wasteClass.liquid / 10; gas += wasteClass.gas / 10; slots[i] = new ItemStack(ModItems.nuclear_waste_short_depleted_tiny, 1, meta); } - + if(item == ModItems.ingot_au198 && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance() / 20) == 0) { slots[i] = new ItemStack(ModItems.ingot_mercury, 1, meta); } if(item == ModItems.nugget_au198 && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance() / 100) == 0) { slots[i] = new ItemStack(ModItems.nugget_mercury, 1, meta); } - + if(item == ModItems.ingot_pb209 && worldObj.rand.nextInt(VersatileConfig.getShortDecayChance() / 10) == 0) { slots[i] = new ItemStack(ModItems.ingot_bismuth, 1, meta); } @@ -128,27 +128,27 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu this.tanks[0].setFill(this.tanks[0].getFill() + liquid); this.tanks[1].setFill(this.tanks[1].getFill() + gas); - + for(int i = 0; i < 2; i++) { - + int overflow = Math.max(this.tanks[i].getFill() - this.tanks[i].getMaxFill(), 0); - + if(overflow > 0) { this.tanks[i].setFill(this.tanks[i].getFill() - overflow); this.tanks[i].getTankType().onFluidRelease(this, this.tanks[i], overflow); } } - + age++; - + if(age >= 20) age -= 20; - + this.sendFluidToAll(tanks[0], this); this.sendFluidToAll(tanks[1], this); - - this.sendStandard(25); - + + this.networkPackNT(25); + if(rad > 0) { radiate(worldObj, xCoord, yCoord, zCoord, rad); } @@ -159,58 +159,58 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu tanks[0].serialize(buf); tanks[1].serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { tanks[0].deserialize(buf); tanks[1].deserialize(buf); } - + private void radiate(World world, int x, int y, int z, float rads) { - + double range = 32D; - + List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x + 0.5, y + 0.5, z + 0.5, x + 0.5, y + 0.5, z + 0.5).expand(range, range, range)); - + for(EntityLivingBase e : entities) { - + Vec3 vec = Vec3.createVectorHelper(e.posX - (x + 0.5), (e.posY + e.getEyeHeight()) - (y + 0.5), e.posZ - (z + 0.5)); double len = vec.lengthVector(); vec = vec.normalize(); - + float res = 0; - + for(int i = 1; i < len; i++) { int ix = (int)Math.floor(x + 0.5 + vec.xCoord * i); int iy = (int)Math.floor(y + 0.5 + vec.yCoord * i); int iz = (int)Math.floor(z + 0.5 + vec.zCoord * i); - + res += world.getBlock(ix, iy, iz).getExplosionResistance(null); } - + if(res < 1) res = 1; - + float eRads = rads; eRads /= (float)res; eRads /= (float)(len * len); - + ContaminationUtil.contaminate(e, HazardType.RADIATION, ContaminationType.CREATIVE, eRads); } } @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - + Item item = itemStack.getItem(); - - if(item == ModItems.nuclear_waste_long || - item == ModItems.nuclear_waste_long_tiny || - item == ModItems.nuclear_waste_short || - item == ModItems.nuclear_waste_short_tiny || + + if(item == ModItems.nuclear_waste_long || + item == ModItems.nuclear_waste_long_tiny || + item == ModItems.nuclear_waste_short || + item == ModItems.nuclear_waste_short_tiny || item == ModItems.ingot_au198) return true; - + return false; } @@ -223,14 +223,14 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu public boolean canExtractItem(int i, ItemStack itemStack, int j) { Item item = itemStack.getItem(); - - if(item == ModItems.nuclear_waste_long_depleted || - item == ModItems.nuclear_waste_long_depleted_tiny || - item == ModItems.nuclear_waste_short_depleted || - item == ModItems.nuclear_waste_short_depleted_tiny || + + if(item == ModItems.nuclear_waste_long_depleted || + item == ModItems.nuclear_waste_long_depleted_tiny || + item == ModItems.nuclear_waste_short_depleted || + item == ModItems.nuclear_waste_short_depleted_tiny || item == ModItems.ingot_mercury) return true; - + return false; } @@ -238,19 +238,19 @@ public class TileEntityStorageDrum extends TileEntityMachineBase implements IFlu public int getInventoryStackLimit() { return 1; } - + @Override public int[] getAccessibleSlotsFromSide(int side) { return slots_arr; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.tanks[0].readFromNBT(nbt, "liquid"); this.tanks[1].readFromNBT(nbt, "gas"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityTesla.java b/src/main/java/com/hbm/tileentity/machine/TileEntityTesla.java index ecdb619a0..30d3d8df5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityTesla.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityTesla.java @@ -15,12 +15,12 @@ import com.hbm.util.ArmorUtil; import api.hbm.energymk2.IEnergyReceiverMK2; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; @@ -69,17 +69,7 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyRec this.targets = zap(worldObj, dx, dy, dz, range, null); } - NBTTagCompound data = new NBTTagCompound(); - data.setShort("length", (short)targets.size()); - int i = 0; - for(double[] d : this.targets) { - data.setDouble("x" + i, d[0]); - data.setDouble("y" + i, d[1]); - data.setDouble("z" + i, d[2]); - i++; - } - - this.networkPack(data, 100); + this.networkPackNT(100); } } @@ -145,19 +135,30 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyRec return ret; } - - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - int s = data.getShort("length"); - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeShort((short)targets.size()); + for(double[] d : this.targets) { + buf.writeDouble(d[0]); + buf.writeDouble(d[1]); + buf.writeDouble(d[2]); + } + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + int s = buf.readShort(); + this.targets.clear(); - + for(int i = 0; i < s; i++) this.targets.add(new double[] { - data.getDouble("x" + i), - data.getDouble("y" + i), - data.getDouble("z" + i) + buf.readDouble(), // X + buf.readDouble(), // Y + buf.readDouble() // Z }); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityWatz.java b/src/main/java/com/hbm/tileentity/machine/TileEntityWatz.java index 6ec9b1fa4..20852c6e2 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityWatz.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityWatz.java @@ -32,6 +32,7 @@ import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -120,7 +121,7 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand /* send sync packets (order doesn't matter) */ for(TileEntityWatz segment : segments) { segment.isOn = turnedOn; - segment.sendPacket(sharedTanks); + this.networkPackNT(25); segment.heat *= 0.99; //cool 1% per tick } @@ -277,30 +278,28 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand } } } - - public void sendPacket(FluidTank[] tanks) { - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("heat", this.heat); - data.setBoolean("isOn", isOn); - data.setBoolean("lock", isLocked); - data.setDouble("flux", this.fluxLastReaction + this.fluxLastBase); - for(int i = 0; i < tanks.length; i++) { - tanks[i].writeToNBT(data, "t" + i); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeInt(this.heat); + buf.writeBoolean(isOn); + buf.writeBoolean(isLocked); + buf.writeDouble(this.fluxLastReaction + this.fluxLastBase); + for (FluidTank tank : tanks) { + tank.serialize(buf); } - this.networkPack(data, 25); } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.heat = nbt.getInteger("heat"); - this.isOn = nbt.getBoolean("isOn"); - this.isLocked = nbt.getBoolean("lock"); - this.fluxDisplay = nbt.getDouble("flux"); - for(int i = 0; i < tanks.length; i++) { - tanks[i].readFromNBT(nbt, "t" + i); + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.heat = buf.readInt(); + this.isOn = buf.readBoolean(); + this.isLocked = buf.readBoolean(); + this.fluxDisplay = buf.readDouble(); + for (FluidTank tank : tanks) { + tank.deserialize(buf); } } diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticCracker.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticCracker.java index 9019364d6..d4e2c6705 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticCracker.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticCracker.java @@ -5,8 +5,8 @@ import com.hbm.inventory.FluidStack; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.recipes.CrackingRecipes; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.Tuple.Pair; import com.hbm.util.fauxpointtwelve.DirPos; @@ -14,14 +14,15 @@ import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver, IFluidCopiable { - +public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IFluidCopiable { + public FluidTank[] tanks; - + public TileEntityMachineCatalyticCracker() { tanks = new FluidTank[5]; tanks[0] = new FluidTank(Fluids.BITUMEN, 4000); @@ -30,10 +31,10 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl tanks[3] = new FluidTank(Fluids.PETROLEUM, 4000); tanks[4] = new FluidTank(Fluids.SPENTSTEAM, 800); } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.worldObj.theProfiler.startSection("catalyticCracker_setup_tanks"); @@ -47,47 +48,48 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl this.worldObj.theProfiler.endStartSection("catalyticCracker_send_fluid"); if(worldObj.getTotalWorldTime() % 10 == 0) { - + for(DirPos pos : getConPos()) { for(int i = 2; i <= 4; i++) { if(tanks[i].getFill() > 0) this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - - NBTTagCompound data = new NBTTagCompound(); - for(int i = 0; i < 5; i++) - tanks[i].writeToNBT(data, "tank" + i); - - INBTPacketReceiver.networkPack(this, data, 50); } this.worldObj.theProfiler.endSection(); + networkPackNT(25); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - for(int i = 0; i < 5; i++) - tanks[i].readFromNBT(nbt, "tank" + i); + public void serialize(ByteBuf buf) { + for(FluidTank tank : tanks) + tank.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + for(FluidTank tank : tanks) + tank.deserialize(buf); + } + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private void crack() { - + Pair quart = CrackingRecipes.getCracking(tanks[0].getTankType()); - + if(quart != null) { - + int left = quart.getKey().fill; int right = quart.getValue().fill; - + for(int i = 0; i < 2; i++) { if(tanks[0].getFill() >= 100 && tanks[1].getFill() >= 200 && hasSpace(left, right)) { tanks[0].setFill(tanks[0].getFill() - 100); @@ -99,15 +101,15 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl } } } - + private boolean hasSpace(int left, int right) { return tanks[2].getFill() + left <= tanks[2].getMaxFill() && tanks[3].getFill() + right <= tanks[3].getMaxFill() && tanks[4].getFill() + 2 <= tanks[4].getMaxFill(); } - + private void setupTanks() { - + Pair quart = CrackingRecipes.getCracking(tanks[0].getTankType()); - + if(quart != null) { tanks[1].setTankType(Fluids.STEAM); tanks[2].setTankType(quart.getKey().type); @@ -119,7 +121,7 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl tanks[4].setTankType(Fluids.NONE); } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -127,7 +129,7 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "tank" + i); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -135,12 +137,12 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl for(int i = 0; i < 5; i++) tanks[i].writeToNBT(nbt, "tank" + i); } - + protected DirPos[] getConPos() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 4 + rot.offsetX * 1, yCoord, zCoord + dir.offsetZ * 4 + rot.offsetZ * 1, dir), new DirPos(xCoord + dir.offsetX * 4 - rot.offsetX * 2, yCoord, zCoord + dir.offsetZ * 4 - rot.offsetZ * 2, dir), @@ -152,12 +154,12 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 4, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 4, rot.getOpposite()) }; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 3, @@ -168,10 +170,10 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl zCoord + 4 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticReformer.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticReformer.java index 364b50ee0..abca3a2ea 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticReformer.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCatalyticReformer.java @@ -21,6 +21,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -73,20 +74,23 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "" + i); - this.networkPack(data, 150); + + this.networkPackNT(150); } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "" + i); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + for(int i = 0; i < 4; i++) tanks[i].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + for(int i = 0; i < 4; i++) tanks[i].deserialize(buf); } private void reform() { diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCoker.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCoker.java index 5fbbf66e4..3d1d6d2b9 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCoker.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineCoker.java @@ -20,6 +20,7 @@ import api.hbm.fluid.IFluidStandardTransceiver; import api.hbm.tile.IHeatSource; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -107,14 +108,8 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl for(DirPos pos : getConPos()) { if(this.tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("wasOn", this.wasOn); - data.setInteger("heat", this.heat); - data.setInteger("progress", this.progress); - tanks[0].writeToNBT(data, "t0"); - tanks[1].writeToNBT(data, "t1"); - this.networkPack(data, 25); + + this.networkPackNT(25); } else { if(this.wasOn) { @@ -135,7 +130,9 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl } } } - + + + public DirPos[] getConPos() { return new DirPos[] { @@ -172,16 +169,25 @@ public class TileEntityMachineCoker extends TileEntityMachineBase implements IFl return true; } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.wasOn = nbt.getBoolean("wasOn"); - this.heat = nbt.getInteger("heat"); - this.progress = nbt.getInteger("progress"); - tanks[0].readFromNBT(nbt, "t0"); - tanks[1].readFromNBT(nbt, "t1"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeBoolean(this.wasOn); + buf.writeInt(this.heat); + buf.writeInt(this.progress); + tanks[0].serialize(buf); + tanks[1].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.wasOn = buf.readBoolean(); + this.heat = buf.readInt(); + this.progress = buf.readInt(); + tanks[0].deserialize(buf); + tanks[1].deserialize(buf); } protected void tryPullHeat() { diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineFractionTower.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineFractionTower.java index 7964d9c83..d186eb1e3 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineFractionTower.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineFractionTower.java @@ -5,8 +5,6 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.recipes.FractionRecipes; import com.hbm.lib.Library; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.TileEntityLoadedBase; @@ -14,7 +12,6 @@ import com.hbm.util.Tuple.Pair; import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.fluid.IFluidStandardTransceiver; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -23,36 +20,36 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; public class TileEntityMachineFractionTower extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardTransceiver, IFluidCopiable { - + public FluidTank[] tanks; - + public TileEntityMachineFractionTower() { tanks = new FluidTank[3]; tanks[0] = new FluidTank(Fluids.HEAVYOIL, 4000); tanks[1] = new FluidTank(Fluids.BITUMEN, 4000); tanks[2] = new FluidTank(Fluids.SMEAR, 4000); } - + @Override public void updateEntity() { if(!worldObj.isRemote) { - + TileEntity stack = worldObj.getTileEntity(xCoord, yCoord + 3, zCoord); - + if(stack instanceof TileEntityMachineFractionTower) { TileEntityMachineFractionTower frac = (TileEntityMachineFractionTower) stack; - + //make types equal for(int i = 0; i < 3; i++) { frac.tanks[i].setTankType(tanks[i].getTankType()); } - + //calculate transfer int oil = Math.min(tanks[0].getFill(), frac.tanks[0].getMaxFill() - frac.tanks[0].getFill()); int left = Math.min(frac.tanks[1].getFill(), tanks[1].getMaxFill() - tanks[1].getFill()); int right = Math.min(frac.tanks[2].getFill(), tanks[2].getMaxFill() - tanks[2].getFill()); - + //move oil up, pull fractions down tanks[0].setFill(tanks[0].getFill() - oil); tanks[1].setFill(tanks[1].getFill() + left); @@ -61,16 +58,16 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme frac.tanks[1].setFill(frac.tanks[1].getFill() - left); frac.tanks[2].setFill(frac.tanks[2].getFill() - right); } - + setupTanks(); this.updateConnections(); - + if(worldObj.getTotalWorldTime() % 10 == 0) fractionate(); - + this.sendFluid(); - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); + networkPackNT(50); } } @@ -85,22 +82,22 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme for(int i = 0; i < 3; i++) tanks[i].deserialize(buf); } - + private void updateConnections() { - + for(DirPos pos : getConPos()) { this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private void sendFluid() { - + for(DirPos pos : getConPos()) { this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), @@ -109,11 +106,11 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z) }; } - + private void setupTanks() { - + Pair quart = FractionRecipes.getFractions(tanks[0].getTankType()); - + if(quart != null) { tanks[1].setTankType(quart.getKey().type); tanks[2].setTankType(quart.getValue().type); @@ -123,16 +120,16 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme tanks[2].setTankType(Fluids.NONE); } } - + private void fractionate() { - + Pair quart = FractionRecipes.getFractions(tanks[0].getTankType()); - + if(quart != null) { - + int left = quart.getKey().fill; int right = quart.getValue().fill; - + if(tanks[0].getFill() >= 100 && hasSpace(left, right)) { tanks[0].setFill(tanks[0].getFill() - 100); tanks[1].setFill(tanks[1].getFill() + left); @@ -140,11 +137,11 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme } } } - + private boolean hasSpace(int left, int right) { return tanks[1].getFill() + left <= tanks[1].getMaxFill() && tanks[2].getFill() + right <= tanks[2].getMaxFill(); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -152,7 +149,7 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme for(int i = 0; i < 3; i++) tanks[i].readFromNBT(nbt, "tank" + i); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -160,12 +157,12 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme for(int i = 0; i < 3; i++) tanks[i].writeToNBT(nbt, "tank" + i); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -176,10 +173,10 @@ public class TileEntityMachineFractionTower extends TileEntityLoadedBase impleme zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineGasFlare.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineGasFlare.java index 6d19ae824..49eba901b 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineGasFlare.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineGasFlare.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine.oil; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IControlReceiver; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerMachineGasFlare; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -31,6 +32,7 @@ import api.hbm.fluid.IFluidStandardReceiver; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -51,6 +53,8 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements protected int fluidUsed = 0; protected int output = 0; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineGasFlare() { super(6); tank = new FluidTank(Fluids.GAS, 64000); @@ -99,7 +103,7 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements public void updateEntity() { if(!worldObj.isRemote) { - + this.fluidUsed = 0; this.output = 0; @@ -110,63 +114,63 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements tank.setType(3, slots); tank.loadTank(1, 2, slots); - + int maxVent = 50; int maxBurn = 10; - + if(isOn && tank.getFill() > 0) { - - UpgradeManager.eval(slots, 4, 5); - int burn = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int yield = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3); + + upgradeManager.checkSlots(this, slots, 4, 5); + int burn = upgradeManager.getLevel(UpgradeType.SPEED); + int yield = upgradeManager.getLevel(UpgradeType.EFFECT); maxVent += maxVent * burn; maxBurn += maxBurn * burn; - + if(!doesBurn || !(tank.getTankType().hasTrait(FT_Flammable.class))) { - + if(tank.getTankType().hasTrait(FT_Gaseous.class) || tank.getTankType().hasTrait(FT_Gaseous_ART.class)) { int eject = Math.min(maxVent, tank.getFill()); this.fluidUsed = eject; tank.setFill(tank.getFill() - eject); tank.getTankType().onFluidRelease(this, tank, eject); - + if(worldObj.getTotalWorldTime() % 7 == 0) this.worldObj.playSoundEffect(this.xCoord, this.yCoord + 11, this.zCoord, "random.fizz", getVolume(1.5F), 0.5F); - + if(worldObj.getTotalWorldTime() % 5 == 0 && eject > 0) { FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.SPILL, eject * 5); } } } else { - + if(tank.getTankType().hasTrait(FT_Flammable.class)) { int eject = Math.min(maxBurn, tank.getFill()); this.fluidUsed = eject; tank.setFill(tank.getFill() - eject); - + int penalty = 5; if(!tank.getTankType().hasTrait(FT_Gaseous.class) && !tank.getTankType().hasTrait(FT_Gaseous_ART.class)) penalty = 10; - + long powerProd = tank.getTankType().getTrait(FT_Flammable.class).getHeatEnergy() * eject / 1_000; // divided by 1000 per mB powerProd /= penalty; powerProd += powerProd * yield / 3; - + this.output = (int) powerProd; power += powerProd; - + if(power > maxPower) power = maxPower; - + ParticleUtil.spawnGasFlame(worldObj, this.xCoord + 0.5F, this.yCoord + 11.75F, this.zCoord + 0.5F, worldObj.rand.nextGaussian() * 0.15, 0.2, worldObj.rand.nextGaussian() * 0.15); - + List list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord + 12, zCoord - 2, xCoord + 2, yCoord + 17, zCoord + 2)); for(Entity e : list) { e.setFire(5); e.attackEntityFrom(DamageSource.onFire, 5F); } - + if(worldObj.getTotalWorldTime() % 3 == 0) this.worldObj.playSoundEffect(this.xCoord, this.yCoord + 11, this.zCoord, "hbm:weapon.flamethrowerShoot", getVolume(1.5F), 0.75F); @@ -178,20 +182,15 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements } power = Library.chargeItemsFromTE(slots, 0, power, maxPower); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - data.setBoolean("isOn", isOn); - data.setBoolean("doesBurn", doesBurn); - tank.writeToNBT(data, "t"); - this.networkPack(data, 50); + + this.networkPackNT(50); } else { - + if(isOn && tank.getFill() > 0) { - + if((!doesBurn || !(tank.getTankType().hasTrait(FT_Flammable.class))) && (tank.getTankType().hasTrait(FT_Gaseous.class) || tank.getTankType().hasTrait(FT_Gaseous_ART.class))) { - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "tower"); data.setFloat("lift", 1F); @@ -203,13 +202,13 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements data.setDouble("posX", xCoord + 0.5); data.setDouble("posZ", zCoord + 0.5); data.setDouble("posY", yCoord + 11); - + MainRegistry.proxy.effectNT(data); - + } - + if(doesBurn && tank.getTankType().hasTrait(FT_Flammable.class) && MainRegistry.proxy.me().getDistanceSq(xCoord, yCoord + 10, zCoord) <= 1024) { - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "vanillaExt"); data.setString("mode", "smoke"); @@ -225,13 +224,13 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements data.setDouble("posZ", zCoord - 0.5); data.setDouble("posY", yCoord + 11.75); } - + MainRegistry.proxy.effectNT(data); } } } } - + public DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X), @@ -240,15 +239,23 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z) }; } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.isOn = nbt.getBoolean("isOn"); - this.doesBurn = nbt.getBoolean("doesBurn"); - tank.readFromNBT(nbt, "t"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeBoolean(this.isOn); + buf.writeBoolean(this.doesBurn); + tank.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.isOn = buf.readBoolean(); + this.doesBurn = buf.readBoolean(); + tank.deserialize(buf); } @Override @@ -315,10 +322,11 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.EFFECT) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.EFFECT, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineLiquefactor.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineLiquefactor.java index eb78670d3..072acadcf 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineLiquefactor.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineLiquefactor.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine.oil; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.inventory.FluidStack; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerLiquefactor; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -25,6 +26,7 @@ import api.hbm.fluid.IFluidStandardSender; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -43,9 +45,11 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen public int progress; public static final int processTimeBase = 100; public int processTime; - + public FluidTank tank; - + + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineLiquefactor() { super(4); tank = new FluidTank(Fluids.NONE, 24_000); @@ -58,48 +62,42 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.power = Library.chargeTEFromItems(slots, 1, power, maxPower); - + this.updateConnections(); - UpgradeManager.eval(slots, 2, 3); - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int power = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); + upgradeManager.checkSlots(this, slots, 2, 3); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); + int power = upgradeManager.getLevel(UpgradeType.POWER); this.processTime = processTimeBase - (processTimeBase / 4) * speed; this.usage = (usageBase + (usageBase * speed)) / (power + 1); - + if(this.canProcess()) this.process(); else this.progress = 0; - + this.sendFluid(); - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - data.setInteger("progress", this.progress); - data.setInteger("usage", this.usage); - data.setInteger("processTime", this.processTime); - tank.writeToNBT(data, "t"); - this.networkPack(data, 50); + + this.networkPackNT(50); } } - + private void updateConnections() { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private void sendFluid() { for(DirPos pos : getConPos()) { this.sendFluid(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord, yCoord + 4, zCoord, Library.POS_Y), @@ -120,57 +118,66 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen public int[] getAccessibleSlotsFromSide(int side) { return new int[] { 0 }; } - + public boolean canProcess() { - + if(this.power < usage) return false; if(slots[0] == null) return false; - + FluidStack out = LiquefactionRecipes.getOutput(slots[0]); - + if(out == null) return false; if(out.type != tank.getTankType() && tank.getFill() > 0) return false; if(out.fill + tank.getFill() > tank.getMaxFill()) return false; - + return true; } - + public void process() { - + this.power -= usage; - + progress++; - + if(progress >= processTime) { - + FluidStack out = LiquefactionRecipes.getOutput(slots[0]); tank.setTankType(out.type); tank.setFill(tank.getFill() + out.fill); this.decrStackSize(0, 1); - + progress = 0; - + this.markDirty(); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.progress = nbt.getInteger("progress"); - this.usage = nbt.getInteger("usage"); - this.processTime = nbt.getInteger("processTime"); - tank.readFromNBT(nbt, "t"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeInt(this.progress); + buf.writeInt(this.usage); + buf.writeInt(this.processTime); + tank.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.progress = buf.readInt(); + this.usage = buf.readInt(); + this.processTime = buf.readInt(); + tank.deserialize(buf); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); tank.readFromNBT(nbt, "tank"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -193,10 +200,10 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen } AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -207,10 +214,10 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -256,10 +263,11 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePumpjack.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePumpjack.java index c61f96f7e..1dfee2567 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePumpjack.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePumpjack.java @@ -18,11 +18,11 @@ import com.hbm.util.fauxpointtwelve.DirPos; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; @@ -109,19 +109,18 @@ public class TileEntityMachinePumpjack extends TileEntityOilDrillBase { } } } - - @Override - public void networkPack(NBTTagCompound nbt, int range) { - nbt.setFloat("speed", this.indicator == 0 ? (5F + (2F * this.speedLevel)) + (this.overLevel - 1F) * 10: 0F); - super.networkPack(nbt, range); - } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.speed = nbt.getFloat("speed"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeFloat(this.indicator == 0 ? (5F + (2F * this.speedLevel)) + (this.overLevel - 1F) * 10: 0F); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.speed = buf.readFloat(); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePyroOven.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePyroOven.java index 17c9e8db8..146a4629b 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePyroOven.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachinePyroOven.java @@ -1,11 +1,12 @@ package com.hbm.tileentity.machine.oil; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerPyroOven; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -40,21 +41,23 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable { - + public long power; public static final long maxPower = 10_000_000; public boolean isVenting; public boolean isProgressing; public float progress; public static int consumption = 10_000; - + public int prevAnim; public int anim = 0; - + public FluidTank[] tanks; - + private AudioWrapper audio; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachinePyroOven() { super(6, 50); tanks = new FluidTank[2]; @@ -65,7 +68,7 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && stack.getItem() instanceof ItemMachineUpgrade && i >= 4 && i <= 5) { worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } @@ -78,12 +81,12 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); tanks[0].setType(3, slots); - + for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); if(tanks[0].getTankType() != Fluids.NONE) this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); @@ -93,50 +96,50 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); if(smoke.getFill() > 0) this.sendFluid(smoke, worldObj, xCoord - rot.offsetX, yCoord + 3, zCoord - rot.offsetZ, Library.POS_Y); - - UpgradeManager.eval(slots, 4, 5); - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerSaving = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - int overdrive = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3); - + + upgradeManager.checkSlots(this, slots, 4, 5); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); + int powerSaving = upgradeManager.getLevel(UpgradeType.POWER); + int overdrive = upgradeManager.getLevel(UpgradeType.OVERDRIVE); + this.isProgressing = false; this.isVenting = false; - + if(this.canProcess()) { PyroOvenRecipe recipe = getMatchingRecipe(); this.progress += 1F / Math.max((recipe.duration - speed * (recipe.duration / 4)) / (overdrive * 2 + 1), 1); this.isProgressing = true; this.power -= this.getConsumption(speed + overdrive * 2, powerSaving); - + if(progress >= 1F) { this.progress = 0F; this.finishRecipe(recipe); this.markDirty(); } - + this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND); - + } else { this.progress = 0F; } - + this.networkPackNT(50); } else { - + this.prevAnim = this.anim; ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + if(isProgressing) { this.anim++; - + if(audio == null) { audio = createAudioLoop(); audio.startSound(); } else if(!audio.isPlaying()) { audio = rebootAudio(audio); } - + audio.keepAlive(); audio.updateVolume(this.getVolume(1F)); @@ -146,15 +149,15 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem if(worldObj.rand.nextInt(20) == 0) worldObj.spawnParticle("cloud", xCoord + 0.5 - rot.offsetX + dir.offsetX * 0.875, yCoord + 3, zCoord + 0.5 - rot.offsetZ + dir.offsetZ * 0.875, 0.0, 0.05, 0.0); if(worldObj.rand.nextInt(20) == 0) worldObj.spawnParticle("cloud", xCoord + 0.5 - rot.offsetX + dir.offsetX * 2.375, yCoord + 3, zCoord + 0.5 - rot.offsetZ + dir.offsetZ * 2.375, 0.0, 0.05, 0.0); } - + } else { - + if(audio != null) { audio.stopSound(); audio = null; } } - + if(this.isVenting) { if(worldObj.getTotalWorldTime() % 2 == 0) { @@ -173,29 +176,29 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem } } } - + public static int getConsumption(int speed, int powerSaving) { return (int) (consumption * Math.pow(speed + 1, 2)) / (powerSaving + 1); } - + protected PyroOvenRecipe lastValidRecipe; - + public PyroOvenRecipe getMatchingRecipe() { - + if(lastValidRecipe != null && doesRecipeMatch(lastValidRecipe)) return lastValidRecipe; - + for(PyroOvenRecipe rec : PyroOvenRecipes.recipes) { if(doesRecipeMatch(rec)) { lastValidRecipe = rec; return rec; } } - + return null; } - + public boolean doesRecipeMatch(PyroOvenRecipe recipe) { - + if(recipe.inputFluid != null) { if(tanks[0].getTankType() != recipe.inputFluid.type) return false; // recipe needs fluid, fluid doesn't match } @@ -205,15 +208,15 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem } else { if(slots[1] != null) return false; // recipe does not need item, but item is present } - + return true; } - + public boolean canProcess() { - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int powerSaving = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); + int powerSaving = upgradeManager.getLevel(UpgradeType.POWER); if(power < this.getConsumption(speed, powerSaving)) return false; // not enough power - + PyroOvenRecipe recipe = this.getMatchingRecipe(); if(recipe == null) return false; // no matching recipe if(recipe.inputFluid != null && tanks[0].getFill() < recipe.inputFluid.fill) return false; // not enough input fluid @@ -222,10 +225,10 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem if(recipe.outputItem != null && slots[2] != null && recipe.outputItem.stackSize + slots[2].stackSize > slots[2].getMaxStackSize()) return false; // too much output item if(recipe.outputItem != null && slots[2] != null && recipe.outputItem.getItem() != slots[2].getItem()) return false; // output item doesn't match if(recipe.outputItem != null && slots[2] != null && recipe.outputItem.getItemDamage() != slots[2].getItemDamage()) return false; // output meta doesn't match - + return true; } - + public void finishRecipe(PyroOvenRecipe recipe) { if(recipe.outputItem != null) { if(slots[2] == null) { @@ -245,11 +248,11 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem tanks[0].setFill(tanks[0].getFill() - recipe.inputFluid.fill); } } - + protected DirPos[] getConPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * 3, rot), new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ * 1 + rot.offsetZ * 3, rot), @@ -268,7 +271,7 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem buf.writeBoolean(isProgressing); buf.writeFloat(progress); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); tanks[0].deserialize(buf); @@ -278,7 +281,7 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem isProgressing = buf.readBoolean(); progress = buf.readFloat(); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -287,7 +290,7 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem this.progress = nbt.getFloat("prog"); this.power = nbt.getLong("power"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -296,18 +299,18 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem nbt.setFloat("prog", progress); nbt.setLong("power", power); } - + @Override public int[] getAccessibleSlotsFromSide(int meta) { return new int[] { 1, 2 }; } @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { return i == 1; } @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { return i == 2; } - + @Override public void pollute(PollutionType type, float amount) { FluidTank tank = type == PollutionType.SOOT ? smoke : type == PollutionType.HEAVYMETAL ? smoke_leaded : smoke_poison; - + int fluidAmount = (int) Math.ceil(amount * 100); tank.setFill(tank.getFill() + fluidAmount); - + if(tank.getFill() > tank.getMaxFill()) { int overflow = tank.getFill() - tank.getMaxFill(); tank.setFill(tank.getMaxFill()); @@ -319,7 +322,7 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem @Override public AudioWrapper createAudioLoop() { return MainRegistry.proxy.getLoopedSound("hbm:block.pyroOperate", xCoord, yCoord, zCoord, 1.0F, 15F, 1.0F, 20); } - + @Override public void onChunkUnload() { if(audio != null) { audio.stopSound(); audio = null; } } @@ -328,15 +331,15 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem super.invalidate(); if(audio != null) { audio.stopSound(); audio = null; } } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord - 3, yCoord, zCoord - 3, xCoord + 4, yCoord + 3.5, zCoord + 4); return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -375,10 +378,11 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.OVERDRIVE) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; } } diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineRefinery.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineRefinery.java index 1aa19b43b..b474ce248 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineRefinery.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineRefinery.java @@ -33,6 +33,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -188,14 +189,9 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - for(int i = 0; i < 5; i++) tanks[i].writeToNBT(data, "" + i); - data.setBoolean("exploded", hasExploded); - data.setBoolean("onFire", onFire); - data.setBoolean("isOn", this.isOn); - this.networkPack(data, 150); + + this.networkPackNT(150); + } else { if(this.isOn) audioTime = 20; @@ -248,16 +244,25 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements audio = null; } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "" + i); - this.hasExploded = nbt.getBoolean("exploded"); - this.onFire = nbt.getBoolean("onFire"); - this.isOn = nbt.getBoolean("isOn"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + for(int i = 0; i < 5; i++) tanks[i].serialize(buf); + buf.writeBoolean(this.hasExploded); + buf.writeBoolean(this.onFire); + buf.writeBoolean(this.isOn); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + for(int i = 0; i < 5; i++) tanks[i].deserialize(buf); + this.hasExploded = buf.readBoolean(); + this.onFire = buf.readBoolean(); + this.isOn = buf.readBoolean(); } private void refine() { diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineSolidifier.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineSolidifier.java index 2110112c3..67cc1e661 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineSolidifier.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineSolidifier.java @@ -1,9 +1,10 @@ package com.hbm.tileentity.machine.oil; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.container.ContainerSolidifier; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -25,6 +26,7 @@ import api.hbm.fluid.IFluidStandardReceiver; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -42,9 +44,11 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement public int progress; public static final int processTimeBase = 100; public int processTime; - + public FluidTank tank; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityMachineSolidifier() { super(5); tank = new FluidTank(Fluids.NONE, 24_000); @@ -57,42 +61,36 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement @Override public void updateEntity() { - + if(!worldObj.isRemote) { this.power = Library.chargeTEFromItems(slots, 1, power, maxPower); tank.setType(4, slots); this.updateConnections(); - UpgradeManager.eval(slots, 2, 3); - int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - int power = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); + upgradeManager.checkSlots(this, slots, 2, 3); + int speed = upgradeManager.getLevel(UpgradeType.SPEED); + int power = upgradeManager.getLevel(UpgradeType.POWER); this.processTime = processTimeBase - (processTimeBase / 4) * speed; this.usage = (usageBase + (usageBase * speed)) / (power + 1); - + if(this.canProcess()) this.process(); else this.progress = 0; - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - data.setInteger("progress", this.progress); - data.setInteger("usage", this.usage); - data.setInteger("processTime", this.processTime); - tank.writeToNBT(data, "t"); - this.networkPack(data, 50); + + this.networkPackNT(50); } } - + private void updateConnections() { for(DirPos pos : getConPos()) { this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } } - + private DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord, yCoord + 4, zCoord, Library.POS_Y), @@ -113,80 +111,89 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement public int[] getAccessibleSlotsFromSide(int side) { return new int[] { 0 }; } - + public boolean canProcess() { - + if(this.power < usage) return false; - + Pair out = SolidificationRecipes.getOutput(tank.getTankType()); - + if(out == null) return false; - + int req = out.getKey(); ItemStack stack = out.getValue(); - + if(req > tank.getFill()) return false; - + if(slots[0] != null) { - + if(slots[0].getItem() != stack.getItem()) return false; - + if(slots[0].getItemDamage() != stack.getItemDamage()) return false; - + if(slots[0].stackSize + stack.stackSize > slots[0].getMaxStackSize()) return false; } - + return true; } - + public void process() { - + this.power -= usage; - + progress++; - + if(progress >= processTime) { - + Pair out = SolidificationRecipes.getOutput(tank.getTankType()); int req = out.getKey(); ItemStack stack = out.getValue(); tank.setFill(tank.getFill() - req); - + if(slots[0] == null) { slots[0] = stack.copy(); } else { slots[0].stackSize += stack.stackSize; } - + progress = 0; - + this.markDirty(); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.progress = nbt.getInteger("progress"); - this.usage = nbt.getInteger("usage"); - this.processTime = nbt.getInteger("processTime"); - tank.readFromNBT(nbt, "t"); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeInt(this.progress); + buf.writeInt(this.usage); + buf.writeInt(this.processTime); + tank.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.progress = buf.readInt(); + this.usage = buf.readInt(); + this.processTime = buf.readInt(); + tank.deserialize(buf); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); tank.readFromNBT(nbt, "tank"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -207,12 +214,12 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement public long getMaxPower() { return maxPower; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -223,10 +230,10 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -272,10 +279,11 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineVacuumDistill.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineVacuumDistill.java index f01cc989c..3653b2138 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineVacuumDistill.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityMachineVacuumDistill.java @@ -21,6 +21,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -81,12 +82,9 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", this.power); - data.setBoolean("isOn", this.isOn); - for(int i = 0; i < 5; i++) tanks[i].writeToNBT(data, "" + i); - this.networkPack(data, 150); + + this.networkPackNT(150); + } else { if(this.isOn) audioTime = 20; @@ -139,14 +137,21 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem audio = null; } } - + @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.isOn = nbt.getBoolean("isOn"); - for(int i = 0; i < 5; i++) tanks[i].readFromNBT(nbt, "" + i); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeLong(this.power); + buf.writeBoolean(this.isOn); + for(int i = 0; i < 5; i++) tanks[i].serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.power = buf.readLong(); + this.isOn = buf.readBoolean(); + for(int i = 0; i < 5; i++) tanks[i].deserialize(buf); } private void refine() { diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java index 877d3981d..502d1bbbf 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java @@ -1,9 +1,10 @@ package com.hbm.tileentity.machine.oil; +import java.util.HashMap; import java.util.HashSet; import com.hbm.blocks.ModBlocks; -import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.UpgradeManagerNT; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.items.machine.ItemMachineUpgrade; @@ -19,6 +20,7 @@ import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -29,31 +31,33 @@ import net.minecraftforge.common.util.ForgeDirection; public abstract class TileEntityOilDrillBase extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IConfigurableMachine, IPersistentNBT, IGUIProvider, IUpgradeInfoProvider, IFluidCopiable { public int indicator = 0; - + public long power; - + public FluidTank[] tanks; + public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(); + public TileEntityOilDrillBase() { super(8); tanks = new FluidTank[2]; tanks[0] = new FluidTank(Fluids.OIL, 64_000); tanks[1] = new FluidTank(Fluids.GAS, 64_000); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); for(int i = 0; i < this.tanks.length; i++) this.tanks[i].readFromNBT(nbt, "t" + i); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); for(int i = 0; i < this.tanks.length; i++) this.tanks[i].writeToNBT(nbt, "t" + i); @@ -61,10 +65,10 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple @Override public void writeNBT(NBTTagCompound nbt) { - + boolean empty = power == 0; for(FluidTank tank : tanks) if(tank.getFill() > 0) empty = false; - + if(!empty) { nbt.setLong("power", power); for(int i = 0; i < this.tanks.length; i++) { @@ -86,85 +90,89 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple @Override public void updateEntity() { - - if(!worldObj.isRemote) { - + + if (!worldObj.isRemote) { + this.updateConnections(); - + this.tanks[0].unloadTank(1, 2, slots); this.tanks[1].unloadTank(3, 4, slots); - - UpgradeManager.eval(slots, 5, 7); - this.speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); - this.energyLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); - this.overLevel = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) + 1; - int abLevel = Math.min(UpgradeManager.getLevel(UpgradeType.AFTERBURN), 3); - + + upgradeManager.checkSlots(this, slots, 5, 7); + this.speedLevel = upgradeManager.getLevel(UpgradeType.SPEED); + this.energyLevel = upgradeManager.getLevel(UpgradeType.POWER); + this.overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE) + 1; + int abLevel = upgradeManager.getLevel(UpgradeType.AFTERBURN); + int toBurn = Math.min(tanks[1].getFill(), abLevel * 10); - - if(toBurn > 0) { + + if (toBurn > 0) { tanks[1].setFill(tanks[1].getFill() - toBurn); this.power += toBurn * 5; - - if(this.power > this.getMaxPower()) + + if (this.power > this.getMaxPower()) this.power = this.getMaxPower(); } - + power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower()); - for(DirPos pos : getConPos()) { - if(tanks[0].getFill() > 0) this.sendFluid(tanks[0], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); - if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + for (DirPos pos : getConPos()) { + if (tanks[0].getFill() > 0) + this.sendFluid(tanks[0], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + if (tanks[1].getFill() > 0) + this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - - if(this.power >= this.getPowerReqEff() && this.tanks[0].getFill() < this.tanks[0].getMaxFill() && this.tanks[1].getFill() < this.tanks[1].getMaxFill()) { - + + if (this.power >= this.getPowerReqEff() && this.tanks[0].getFill() < this.tanks[0].getMaxFill() && this.tanks[1].getFill() < this.tanks[1].getMaxFill()) { + this.power -= this.getPowerReqEff(); - - if(worldObj.getTotalWorldTime() % getDelayEff() == 0) { + + if (worldObj.getTotalWorldTime() % getDelayEff() == 0) { this.indicator = 0; - - for(int y = yCoord - 1; y >= getDrillDepth(); y--) { - - if(worldObj.getBlock(xCoord, y, zCoord) != ModBlocks.oil_pipe) { - - if(trySuck(y)) { + + for (int y = yCoord - 1; y >= getDrillDepth(); y--) { + + if (worldObj.getBlock(xCoord, y, zCoord) != ModBlocks.oil_pipe) { + + if (trySuck(y)) { break; } else { tryDrill(y); break; } } - - if(y == getDrillDepth()) + + if (y == getDrillDepth()) this.indicator = 1; } } - + } else { this.indicator = 2; } - - this.sendUpdate(); + + this.networkPackNT(25); } } - - public void sendUpdate() { - NBTTagCompound data = new NBTTagCompound(); - data.setLong("power", power); - data.setInteger("indicator", this.indicator); - for(int i = 0; i < tanks.length; i++) tanks[i].writeToNBT(data, "t" + i); - this.networkPack(data, 25); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + + buf.writeLong(this.power); + buf.writeInt(this.indicator); + for (FluidTank tank : tanks) tank.serialize(buf); } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.power = nbt.getLong("power"); - this.indicator = nbt.getInteger("indicator"); - for(int i = 0; i < tanks.length; i++) tanks[i].readFromNBT(nbt, "t" + i); + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + this.power = buf.readLong(); + this.indicator = buf.readInt(); + for (FluidTank tank : tanks) tank.deserialize(buf); } - + public boolean canPump() { return true; } @@ -172,27 +180,27 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple @Override public void setInventorySlotContents(int i, ItemStack stack) { super.setInventorySlotContents(i, stack); - + if(stack != null && i >= 5 && i <= 7 && stack.getItem() instanceof ItemMachineUpgrade) worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.0F, 1.0F); } - + public int getPowerReqEff() { int req = this.getPowerReq(); return (req + (req / 4 * this.speedLevel) - (req / 4 * this.energyLevel)) * this.overLevel; } - + public int getDelayEff() { int delay = getDelay(); return Math.max((delay - (delay / 4 * this.speedLevel) + (delay / 10 * this.energyLevel)) / this.overLevel, 1); } - + public abstract int getPowerReq(); public abstract int getDelay(); - + public void tryDrill(int y) { Block b = worldObj.getBlock(xCoord, y, zCoord); - + if(b.getExplosionResistance(null) < 1000) { onDrill(y); worldObj.setBlock(xCoord, y, zCoord, ModBlocks.oil_pipe); @@ -200,72 +208,72 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple this.indicator = 2; } } - + public void onDrill(int y) { } - + public int getDrillDepth() { return 5; } - + public boolean trySuck(int y) { - + Block b = worldObj.getBlock(xCoord, y, zCoord); - + if(!canSuckBlock(b)) return false; - + if(!this.canPump()) return true; - + trace.clear(); - + return suckRec(xCoord, y, zCoord, 0); } - + public boolean canSuckBlock(Block b) { return b == ModBlocks.ore_oil || b == ModBlocks.ore_oil_empty; } - + protected HashSet> trace = new HashSet(); - + public boolean suckRec(int x, int y, int z, int layer) { - + Triplet pos = new Triplet(x, y, z); - + if(trace.contains(pos)) return false; - + trace.add(pos); - + if(layer > 64) return false; - + Block b = worldObj.getBlock(x, y, z); - + if(b == ModBlocks.ore_oil || b == ModBlocks.ore_bedrock_oil) { doSuck(x, y, z); return true; } - + if(b == ModBlocks.ore_oil_empty) { ForgeDirection[] dirs = BobMathUtil.getShuffledDirs(); - + for(ForgeDirection dir : dirs) { if(suckRec(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, layer + 1)) return true; } } - + return false; } - + public void doSuck(int x, int y, int z) { - + if(worldObj.getBlock(x, y, z) == ModBlocks.ore_oil) { onSuck(x, y, z); } } - + public abstract void onSuck(int x, int y, int z); @Override @@ -303,7 +311,7 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple public FluidTank[] getAllTanks() { return tanks; } - + public abstract DirPos[] getConPos(); protected void updateConnections() { @@ -318,12 +326,13 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 3; - if(type == UpgradeType.POWER) return 3; - if(type == UpgradeType.AFTERBURN) return 3; - if(type == UpgradeType.OVERDRIVE) return 3; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 3); + upgrades.put(UpgradeType.POWER, 3); + upgrades.put(UpgradeType.AFTERBURN, 3); + upgrades.put(UpgradeType.OVERDRIVE, 3); + return upgrades; } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBase.java b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBase.java index 8c06fd658..0463be416 100644 --- a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBase.java +++ b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBase.java @@ -1,96 +1,49 @@ package com.hbm.tileentity.machine.pile; -import java.util.List; -import java.util.Random; +import com.hbm.handler.neutron.NeutronNodeWorld; +import com.hbm.handler.neutron.PileNeutronHandler; +import com.hbm.handler.neutron.PileNeutronHandler.PileNeutronStream; +import com.hbm.handler.neutron.PileNeutronHandler.PileNeutronNode; -import com.hbm.blocks.ModBlocks; -import com.hbm.util.ContaminationUtil; -import com.hbm.util.ContaminationUtil.ContaminationType; -import com.hbm.util.ContaminationUtil.HazardType; - -import api.hbm.block.IPileNeutronReceiver; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; +import com.hbm.util.fauxpointtwelve.BlockPos; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; public abstract class TileEntityPileBase extends TileEntity { @Override public abstract void updateEntity(); - - protected void castRay(int flux, int range) { - Random rand = worldObj.rand; - Vec3 vec = Vec3.createVectorHelper(1, 0, 0); - vec.rotateAroundZ((float)(rand.nextDouble() * Math.PI * 2D)); - vec.rotateAroundY((float)(rand.nextDouble() * Math.PI * 2D)); - vec.rotateAroundX((float)(rand.nextDouble() * Math.PI * 2D)); - - int prevX = xCoord; - int prevY = yCoord; - int prevZ = zCoord; - - for(float i = 1; i <= range; i += 0.5F) { - int x = (int)Math.floor(xCoord + 0.5 + vec.xCoord * i); - int y = (int)Math.floor(yCoord + 0.5 + vec.yCoord * i); - int z = (int)Math.floor(zCoord + 0.5 + vec.zCoord * i); - - if(x == prevX && y == prevY && z == prevZ) - continue; + @Override + public void invalidate() { + super.invalidate(); - prevX = x; - prevY = y; - prevZ = z; - - /*if(i == range || i == 1) { - NBTTagCompound data2 = new NBTTagCompound(); - data2.setString("type", "vanillaExt"); - data2.setString("mode", i == range ? "greendust" : - i == 1 ? "reddust" : "bluedust"); - data2.setDouble("posX", xCoord + 0.5 + vec.xCoord * i); - data2.setDouble("posY", yCoord + 0.5 + vec.yCoord * i); - data2.setDouble("posZ", zCoord + 0.5 + vec.zCoord * i); - MainRegistry.proxy.effectNT(data2); - }*/ - - Block b = worldObj.getBlock(x, y, z); - - if(b == ModBlocks.concrete || b == ModBlocks.concrete_smooth || b == ModBlocks.concrete_asbestos || b == ModBlocks.concrete_colored || b == ModBlocks.brick_concrete) - flux *= 0.25; - - if(b == ModBlocks.block_boron) - return; - - int meta = worldObj.getBlockMetadata(x, y, z); - - if(b == ModBlocks.block_graphite_rod && (meta & 8) == 0) - return; - - TileEntity te = worldObj.getTileEntity(x, y, z); - - if(te instanceof IPileNeutronReceiver) { - - //this part throttles neutron efficiency for reactions that are way too close, efficiency reaches 100% after 1.5 meters - //This entire time, this multiplier has been using the max distance, not the actual one, meaning efficency has always been 100% - //float mult = Math.min((float)i / 1.5F, 1F); - //int n = (int)(flux * mult); - - IPileNeutronReceiver rec = (IPileNeutronReceiver) te; - rec.receiveNeutrons(flux); - - if(b != ModBlocks.block_graphite_detector || (meta & 8) == 0) - return; - } - - List entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x + 0.5, y + 0.5, z + 0.5, x + 0.5, y + 0.5, z + 0.5)); - - if(entities != null) - for(EntityLivingBase e : entities) { - - ContaminationUtil.contaminate(e, HazardType.RADIATION, ContaminationType.CREATIVE, flux / 4F); - } + NeutronNodeWorld.removeNode(new BlockPos(this)); + } + + protected void castRay(int flux) { + + BlockPos pos = new BlockPos(this); + + if (flux == 0) { + // simple way to remove the node from the cache when no flux is going into it! + NeutronNodeWorld.removeNode(pos); + return; } + + PileNeutronNode node = (PileNeutronNode) NeutronNodeWorld.getNode(pos); + + if(node == null) { + node = PileNeutronHandler.makeNode(this); + NeutronNodeWorld.addNode(node); + } + + Vec3 neutronVector = Vec3.createVectorHelper(1, 0, 0); + + neutronVector.rotateAroundZ((float)(Math.PI * 2D * worldObj.rand.nextDouble())); + neutronVector.rotateAroundY((float)(Math.PI * 2D * worldObj.rand.nextDouble())); + neutronVector.rotateAroundX((float)(Math.PI * 2D * worldObj.rand.nextDouble())); + + new PileNeutronStream(node, neutronVector, flux); } } diff --git a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBreedingFuel.java b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBreedingFuel.java index 1bbe94acb..c1f775e0e 100644 --- a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBreedingFuel.java +++ b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileBreedingFuel.java @@ -35,7 +35,7 @@ public class TileEntityPileBreedingFuel extends TileEntityPileBase implements IP return; for(int i = 0; i < 2; i++) - this.castRay(1, 5); + this.castRay(1); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileFuel.java b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileFuel.java index 288faa0ea..2d44341e6 100644 --- a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileFuel.java +++ b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileFuel.java @@ -2,7 +2,6 @@ package com.hbm.tileentity.machine.pile; import com.hbm.blocks.ModBlocks; import com.hbm.config.GeneralConfig; -import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; @@ -22,17 +21,17 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr @Override public void updateEntity() { - + if(!worldObj.isRemote) { dissipateHeat(); checkRedstone(react()); transmute(); - + if(this.heat >= this.maxHeat) { worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 4, true, true); worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.gas_radon_dense); } - + if(worldObj.rand.nextFloat() * 2F <= this.heat / (float)this.maxHeat) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "vanillaExt"); @@ -40,55 +39,54 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr data.setDouble("mY", 0.05); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.25 + worldObj.rand.nextDouble() * 0.5, yCoord + 1, zCoord + 0.25 + worldObj.rand.nextDouble() * 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 20)); - MainRegistry.proxy.effectNT(data); } - + if(this.progress >= this.maxProgress) { worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.block_graphite_plutonium, this.getBlockMetadata() & 7, 3); } } - + } - + private void dissipateHeat() { this.heat -= (this.getBlockMetadata() & 4) == 4 ? heat * 0.065 : heat * 0.05; //remove 5% of the stored heat per tick; 6.5% for windscale } - + private int react() { - + int reaction = (int) (this.neutrons * (1D - ((double)this.heat / (double)this.maxHeat) * 0.5D)); //max heat reduces reaction by 50% due to thermal expansion - + this.lastNeutrons = this.neutrons; this.neutrons = 0; - + int lastProgress = this.progress; - + this.progress += reaction; - + if(reaction <= 0) return lastProgress; - + this.heat += reaction; - + for(int i = 0; i < 12; i++) - this.castRay((int) Math.max(reaction * 0.25, 1), 5); - + this.castRay((int) Math.max(reaction * 0.25, 1)); + return lastProgress; } - + private void checkRedstone(int lastProgress) { int lastLevel = MathHelper.clamp_int((lastProgress * 16) / maxProgress, 0, 15); int newLevel = MathHelper.clamp_int((progress * 16) / maxProgress, 0, 15); if(lastLevel != newLevel) worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, this.getBlockType()); } - + private void transmute() { - + if((this.getBlockMetadata() & 8) == 8) { if(this.progress < this.maxProgress - 1000) //Might be subject to change, but 1000 seems like a good number. this.progress = maxProgress - 1000; - + return; } else if(this.progress >= maxProgress - 1000) { worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata() | 8, 3); @@ -100,7 +98,7 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr public void receiveNeutrons(int n) { this.neutrons += n; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -108,7 +106,7 @@ public class TileEntityPileFuel extends TileEntityPileBase implements IPileNeutr this.progress = nbt.getInteger("progress"); this.neutrons = nbt.getInteger("neutrons"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileSource.java b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileSource.java index c297f9dfb..6b38b7875 100644 --- a/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileSource.java +++ b/src/main/java/com/hbm/tileentity/machine/pile/TileEntityPileSource.java @@ -12,7 +12,7 @@ public class TileEntityPileSource extends TileEntityPileBase { int n = this.getBlockType() == ModBlocks.block_graphite_source ? 1 : 2; for(int i = 0; i < 12; i++) { - this.castRay(n, 5); + this.castRay(n); } } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/IRBMKFluxReceiver.java b/src/main/java/com/hbm/tileentity/machine/rbmk/IRBMKFluxReceiver.java index 91824df0a..2b8464354 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/IRBMKFluxReceiver.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/IRBMKFluxReceiver.java @@ -1,5 +1,7 @@ package com.hbm.tileentity.machine.rbmk; +import com.hbm.handler.neutron.NeutronStream; + public interface IRBMKFluxReceiver { public enum NType { @@ -14,5 +16,5 @@ public interface IRBMKFluxReceiver { } } - public void receiveFlux(NType type, double flux); + public void receiveFlux(NeutronStream stream); } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java b/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java index a93498b6f..98bf32af6 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/RBMKDials.java @@ -1,216 +1,311 @@ package com.hbm.tileentity.machine.rbmk; import com.hbm.config.GeneralConfig; +import com.hbm.main.MainRegistry; import com.hbm.util.GameRuleHelper; -import net.minecraft.util.MathHelper; +import com.hbm.util.Tuple; import net.minecraft.world.GameRules; import net.minecraft.world.World; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + public class RBMKDials { - public static final String KEY_SAVE_DIALS = "dialSaveDials"; - - public static final String KEY_PASSIVE_COOLING = "dialPassiveCooling"; - public static final String KEY_COLUMN_HEAT_FLOW = "dialColumnHeatFlow"; - public static final String KEY_FUEL_DIFFUSION_MOD = "dialDiffusionMod"; - public static final String KEY_HEAT_PROVISION = "dialHeatProvision"; - public static final String KEY_COLUMN_HEIGHT = "dialColumnHeight"; - public static final String KEY_PERMANENT_SCRAP = "dialEnablePermaScrap"; - public static final String KEY_BOILER_HEAT_CONSUMPTION = "dialBoilerHeatConsumption"; - public static final String KEY_CONTROL_SPEED_MOD = "dialControlSpeed"; - public static final String KEY_REACTIVITY_MOD = "dialReactivityMod"; - public static final String KEY_OUTGASSER_MOD = "dialOutgasserSpeedMod"; - public static final String KEY_SURGE_MOD = "dialControlSurgeMod"; - public static final String KEY_FLUX_RANGE = "dialFluxRange"; - public static final String KEY_REASIM_RANGE = "dialReasimRange"; - public static final String KEY_REASIM_COUNT = "dialReasimCount"; - public static final String KEY_REASIM_MOD = "dialReasimOutputMod"; - public static final String KEY_REASIM_BOILERS = "dialReasimBoilers"; - public static final String KEY_REASIM_BOILER_SPEED = "dialReasimBoilerSpeed"; - public static final String KEY_DISABLE_MELTDOWNS = "dialDisableMeltdowns"; - public static final String KEY_ENABLE_MELTDOWN_OVERPRESSURE = "dialEnableMeltdownOverpressure"; - - public static void createDials(World world) { - GameRules rules = world.getGameRules(); - - if(!rules.getGameRuleBooleanValue(KEY_SAVE_DIALS)) { - rules.setOrCreateGameRule(KEY_PASSIVE_COOLING, "1.0"); - rules.setOrCreateGameRule(KEY_COLUMN_HEAT_FLOW, "0.2"); - rules.setOrCreateGameRule(KEY_FUEL_DIFFUSION_MOD, "1.0"); - rules.setOrCreateGameRule(KEY_HEAT_PROVISION, "0.2"); - rules.setOrCreateGameRule(KEY_COLUMN_HEIGHT, "4"); - rules.setOrCreateGameRule(KEY_PERMANENT_SCRAP, "true"); - rules.setOrCreateGameRule(KEY_BOILER_HEAT_CONSUMPTION, "0.1"); - rules.setOrCreateGameRule(KEY_CONTROL_SPEED_MOD, "1.0"); - rules.setOrCreateGameRule(KEY_REACTIVITY_MOD, "1.0"); - rules.setOrCreateGameRule(KEY_SAVE_DIALS, "true"); - rules.setOrCreateGameRule(KEY_OUTGASSER_MOD, "1.0"); - rules.setOrCreateGameRule(KEY_SURGE_MOD, "1.0"); - rules.setOrCreateGameRule(KEY_FLUX_RANGE, "5"); - rules.setOrCreateGameRule(KEY_REASIM_RANGE, "10"); - rules.setOrCreateGameRule(KEY_REASIM_COUNT, "6"); - rules.setOrCreateGameRule(KEY_REASIM_MOD, "1.0"); - rules.setOrCreateGameRule(KEY_REASIM_BOILERS, "false"); - rules.setOrCreateGameRule(KEY_REASIM_BOILER_SPEED, "0.05"); - rules.setOrCreateGameRule(KEY_DISABLE_MELTDOWNS, "false"); - rules.setOrCreateGameRule(KEY_ENABLE_MELTDOWN_OVERPRESSURE, "false"); + public enum RBMKKeys { + KEY_SAVE_DIALS("dialSaveDials", true), + KEY_PASSIVE_COOLING("dialPassiveCooling", 1.0), + KEY_COLUMN_HEAT_FLOW("dialColumnHeatFlow", 0.2), + KEY_FUEL_DIFFUSION_MOD("dialDiffusionMod", 1.0), + KEY_HEAT_PROVISION("dialHeatProvision", 0.2), + KEY_COLUMN_HEIGHT("dialColumnHeight", 4), + KEY_PERMANENT_SCRAP("dialEnablePermaScrap", true), + KEY_BOILER_HEAT_CONSUMPTION("dialBoilerHeatConsumption", 0.1), + KEY_CONTROL_SPEED_MOD("dialControlSpeed", 1.0), + KEY_REACTIVITY_MOD("dialReactivityMod", 1.0), + KEY_OUTGASSER_MOD("dialOutgasserSpeedMod", 1.0), + KEY_SURGE_MOD("dialControlSurgeMod", 1.0), + KEY_FLUX_RANGE("dialFluxRange", 5), + KEY_REASIM_RANGE("dialReasimRange", 10), + KEY_REASIM_COUNT("dialReasimCount", 6), + KEY_REASIM_MOD("dialReasimOutputMod", 1.0), + KEY_REASIM_BOILERS("dialReasimBoilers", false), + KEY_REASIM_BOILER_SPEED("dialReasimBoilerSpeed", 0.05), + KEY_DISABLE_MELTDOWNS("dialDisableMeltdowns", false), + KEY_ENABLE_MELTDOWN_OVERPRESSURE("dialEnableMeltdownOverpressure", false), + KEY_MODERATOR_EFFICIENCY("dialModeratorEfficiency", 1.0), + KEY_ABSORBER_EFFICIENCY("dialAbsorberEfficiency", 1.0), + KEY_REFLECTOR_EFFICIENCY("dialReflectorEfficiency", 1.0); + + public final String keyString; + public final Object defValue; + + RBMKKeys(String key, Object def) { + keyString = key; + defValue = def; } } - + + public static HashMap>> gameRules = new HashMap<>(); + + public static void createDials(World world) { + createDials(world, false); + } + + public static void createDials(World world, boolean forceRecreate) { + GameRules rules = world.getGameRules(); + + for(RBMKKeys key : RBMKKeys.values()) + gameRules.put(key, new ArrayList<>()); + refresh(world); + + if(!rules.getGameRuleBooleanValue(RBMKKeys.KEY_SAVE_DIALS.keyString) || forceRecreate) { + for(RBMKKeys key : RBMKKeys.values()) + rules.setOrCreateGameRule(key.keyString, String.valueOf(key.defValue)); + } + } + + + /** + * Refresh all gamerules. + * @param world World to refresh for. + */ + public static void refresh(World world) { + List> toRemove = new ArrayList<>(); + for(List> values : gameRules.values()) { + + for(Tuple.Pair rulePair : values) + if(rulePair.key == world) + toRemove.add(rulePair); + + for(Tuple.Pair pair : toRemove) + values.remove(pair); + + toRemove.clear(); + } + + gameRules.get(RBMKKeys.KEY_PASSIVE_COOLING).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_PASSIVE_COOLING, 0.0D))); + gameRules.get(RBMKKeys.KEY_COLUMN_HEAT_FLOW).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedDouble(world, RBMKKeys.KEY_COLUMN_HEAT_FLOW, 0.0D, 1.0D))); + gameRules.get(RBMKKeys.KEY_FUEL_DIFFUSION_MOD).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_FUEL_DIFFUSION_MOD, 0.0D))); + gameRules.get(RBMKKeys.KEY_HEAT_PROVISION).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedDouble(world, RBMKKeys.KEY_HEAT_PROVISION, 0.0D, 1.0D))); + gameRules.get(RBMKKeys.KEY_COLUMN_HEIGHT).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedInt(world, RBMKKeys.KEY_COLUMN_HEIGHT, 2, 16) - 1)); + gameRules.get(RBMKKeys.KEY_PERMANENT_SCRAP).add(new Tuple.Pair<>(world, world.getGameRules().getGameRuleBooleanValue(RBMKKeys.KEY_PERMANENT_SCRAP.keyString))); + gameRules.get(RBMKKeys.KEY_BOILER_HEAT_CONSUMPTION).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_BOILER_HEAT_CONSUMPTION, 0D))); + gameRules.get(RBMKKeys.KEY_CONTROL_SPEED_MOD).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_CONTROL_SPEED_MOD, 0.0D))); + gameRules.get(RBMKKeys.KEY_REACTIVITY_MOD).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_REACTIVITY_MOD, 0.0D))); + gameRules.get(RBMKKeys.KEY_OUTGASSER_MOD).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_OUTGASSER_MOD, 0.0D))); + gameRules.get(RBMKKeys.KEY_SURGE_MOD).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_SURGE_MOD, 0.0D))); + gameRules.get(RBMKKeys.KEY_FLUX_RANGE).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedInt(world, RBMKKeys.KEY_FLUX_RANGE, 1, 100))); + gameRules.get(RBMKKeys.KEY_REASIM_RANGE).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedInt(world, RBMKKeys.KEY_REASIM_RANGE, 1, 100))); + gameRules.get(RBMKKeys.KEY_REASIM_COUNT).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedInt(world, RBMKKeys.KEY_REASIM_COUNT, 1, 24))); + gameRules.get(RBMKKeys.KEY_REASIM_MOD).add(new Tuple.Pair<>(world, GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_REASIM_MOD, 0.0D))); + gameRules.get(RBMKKeys.KEY_REASIM_BOILERS).add(new Tuple.Pair<>(world, world.getGameRules().getGameRuleBooleanValue(RBMKKeys.KEY_REASIM_BOILERS.keyString) || (GeneralConfig.enable528 && GeneralConfig.enable528ReasimBoilers))); + gameRules.get(RBMKKeys.KEY_REASIM_BOILER_SPEED).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedDouble(world, RBMKKeys.KEY_REASIM_BOILER_SPEED, 0.0D, 1.0D))); + gameRules.get(RBMKKeys.KEY_DISABLE_MELTDOWNS).add(new Tuple.Pair<>(world, world.getGameRules().getGameRuleBooleanValue(RBMKKeys.KEY_DISABLE_MELTDOWNS.keyString))); + gameRules.get(RBMKKeys.KEY_ENABLE_MELTDOWN_OVERPRESSURE).add(new Tuple.Pair<>(world, world.getGameRules().getGameRuleBooleanValue(RBMKKeys.KEY_ENABLE_MELTDOWN_OVERPRESSURE.keyString))); + gameRules.get(RBMKKeys.KEY_MODERATOR_EFFICIENCY).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedDouble(world, RBMKKeys.KEY_MODERATOR_EFFICIENCY, 0.0D, 1.0D))); + gameRules.get(RBMKKeys.KEY_ABSORBER_EFFICIENCY).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedDouble(world, RBMKKeys.KEY_ABSORBER_EFFICIENCY, 0.0D, 1.0D))); + gameRules.get(RBMKKeys.KEY_REFLECTOR_EFFICIENCY).add(new Tuple.Pair<>(world, GameRuleHelper.getClampedDouble(world, RBMKKeys.KEY_REFLECTOR_EFFICIENCY, 0.0D, 1.0D))); + } + + /** + * Gets a gamerule from the internal cache. + * This will not work if called on the client. + * @param world World to get the gamerule for. + * @param rule Rule to get. + * @return The rule in an Object. + */ + public static Object getGameRule(World world, RBMKKeys rule) { + if(world.isRemote) { + MainRegistry.logger.error("Attempted to grab cached gamerules on client side, returning default value."); + MainRegistry.logger.error("Gamerule: {}, Default Value: {}.", rule.keyString, rule.defValue.toString()); + return rule.defValue; + } + return getGameRule(world, rule, false); + } + + public static Object getGameRule(World world, RBMKKeys rule, boolean isIteration) { + List> rulesList = new ArrayList<>(); + + for(Tuple.Pair rulePair : gameRules.get(rule)) { + if(rulePair.key == world) { + rulesList.add(rulePair); + } + } + + if(rulesList.isEmpty()) { + if(isIteration) + throw new NullPointerException("Cannot find gamerule for dial " + rule.keyString + " after creation."); + else { + world.getGameRules().setOrCreateGameRule(rule.keyString, rule.defValue.toString()); // fuck + refresh(world); + return getGameRule(world, rule, true); + } + } else if(rulesList.size() > 1) + // what??? why??? + MainRegistry.logger.warn("Duplicate values for gamerules detected! Found {} rules for gamerule {}", rulesList.size(), rule.keyString); + + return rulesList.get(0).value; // realistically there should only be one of this gamerule that satisfies the filter sooooo... + } + /** * Returns the amount of heat per tick removed from components passively * @param world * @return >0 */ public static double getPassiveCooling(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_PASSIVE_COOLING), 1.0D), 0.0D); + return (double) getGameRule(world, RBMKKeys.KEY_PASSIVE_COOLING); } - + /** * Returns the percentual step size how quickly neighboring component heat equalizes. 1 is instant, 0.5 is in 50% steps, et cetera. * @param world * @return [0;1] */ public static double getColumnHeatFlow(World world) { - return MathHelper.clamp_double(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_COLUMN_HEAT_FLOW), 0.2D), 0.0D, 1.0D); + return (double) getGameRule(world, RBMKKeys.KEY_COLUMN_HEAT_FLOW); } - + /** * Returns a modifier for fuel rod diffusion, i.e. how quickly the core and hull temperatures equalize. * @param world * @return >0 */ public static double getFuelDiffusionMod(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_FUEL_DIFFUSION_MOD), 1.0D), 0.0D); + return (double) getGameRule(world, RBMKKeys.KEY_FUEL_DIFFUSION_MOD); } - + /** * Returns the percentual step size how quickly the fuel hull heat and the component heat equalizes. 1 is instant, 0.5 is in 50% steps, et cetera. * @param world * @return [0;1] */ public static double getFuelHeatProvision(World world) { - return MathHelper.clamp_double(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_HEAT_PROVISION), 0.2D), 0.0D, 1.0D); + return (double) getGameRule(world, RBMKKeys.KEY_HEAT_PROVISION); } - + /** * Simple integer that decides how tall the structure is. * @param world * @return [0;15] */ public static int getColumnHeight(World world) { - return MathHelper.clamp_int(GameRuleHelper.parseInt(world.getGameRules().getGameRuleStringValue(KEY_COLUMN_HEIGHT), 4), 2, 16) - 1; + return (int) getGameRule(world, RBMKKeys.KEY_COLUMN_HEIGHT); } - + /** * Whether or not scrap entities despawn on their own or remain alive until picked up. * @param world * @return */ public static boolean getPermaScrap(World world) { - return world.getGameRules().getGameRuleBooleanValue(KEY_PERMANENT_SCRAP); + return (boolean) getGameRule(world, RBMKKeys.KEY_PERMANENT_SCRAP); } - + /** * How many heat units are consumed per mB water used. * @param world * @return >0 */ public static double getBoilerHeatConsumption(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_BOILER_HEAT_CONSUMPTION), 0.1D), 0D); + return (double) getGameRule(world, RBMKKeys.KEY_BOILER_HEAT_CONSUMPTION); } - + /** * A multiplier for how quickly the control rods move. * @param world * @return >0 */ public static double getControlSpeed(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_CONTROL_SPEED_MOD), 1.0D), 0.0D); + return (double) getGameRule(world, RBMKKeys.KEY_CONTROL_SPEED_MOD); } - + /** * A multiplier for how much flux the rods give out. * @param world * @return >0 */ public static double getReactivityMod(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_REACTIVITY_MOD), 1.0D), 0.0D); + return (double) getGameRule(world, RBMKKeys.KEY_REACTIVITY_MOD); } - + /** * A multiplier for how much flux the rods give out. * @param world * @return >0 */ public static double getOutgasserMod(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_OUTGASSER_MOD), 1.0D), 0.0D); + return (double) getGameRule(world, RBMKKeys.KEY_OUTGASSER_MOD); } - + /** * A multiplier for how high the power surge goes when inserting control rods. * @param world * @return >0 */ public static double getSurgeMod(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_SURGE_MOD), 1.0D), 0.0D); + if(world.isRemote) { // The control rods use this gamerule for RBMK diag, which happens to be calculated on the client side. whoops! + return GameRuleHelper.getDoubleMinimum(world, RBMKKeys.KEY_PASSIVE_COOLING, 0.0D); + } + return (double) getGameRule(world, RBMKKeys.KEY_SURGE_MOD); } - + /** * Simple integer that decides how far the flux of a normal fuel rod reaches. * @param world * @return [1;100] */ public static int getFluxRange(World world) { - return MathHelper.clamp_int(GameRuleHelper.parseInt(world.getGameRules().getGameRuleStringValue(KEY_FLUX_RANGE), 5), 1, 100); + return (int) getGameRule(world, RBMKKeys.KEY_FLUX_RANGE); } - + /** * Simple integer that decides how far the flux of a ReaSim fuel rod reaches. * @param world * @return [1;100] */ public static int getReaSimRange(World world) { - return MathHelper.clamp_int(GameRuleHelper.parseInt(world.getGameRules().getGameRuleStringValue(KEY_REASIM_RANGE), 10), 1, 100); + return (int) getGameRule(world, RBMKKeys.KEY_REASIM_RANGE); } - + /** * Simple integer that decides how many neutrons are created from ReaSim fuel rods. * @param world * @return [1;24] */ public static int getReaSimCount(World world) { - return MathHelper.clamp_int(GameRuleHelper.parseInt(world.getGameRules().getGameRuleStringValue(KEY_REASIM_COUNT), 6), 1, 24); + return (int) getGameRule(world, RBMKKeys.KEY_REASIM_COUNT); } - + /** * Returns a modifier for the outgoing flux of individual streams from the ReaSim fuel rod to compensate for the potentially increased stream count. * @param world * @return >0 */ public static double getReaSimOutputMod(World world) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_REASIM_MOD), 1.0D), 0.0D); + return (double) getGameRule(world, RBMKKeys.KEY_REASIM_MOD); } - + /** * Whether or not all components should act like boilers with dedicated in/outlet blocks * @param world * @return */ public static boolean getReasimBoilers(World world) { - return world.getGameRules().getGameRuleBooleanValue(KEY_REASIM_BOILERS) || (GeneralConfig.enable528 && GeneralConfig.enable528ReasimBoilers); + return (boolean) getGameRule(world, RBMKKeys.KEY_REASIM_BOILERS); } - + /** * How much % of the possible steam ends up being produced per tick * @param world * @return [0;1] */ public static double getReaSimBoilerSpeed(World world) { - return MathHelper.clamp_double(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(KEY_REASIM_BOILER_SPEED), 0.05D), 0.0D, 1.0D); + return (double) getGameRule(world, RBMKKeys.KEY_REASIM_BOILER_SPEED); } - + /** * Whether or not fuel columns should initiate a meltdown when overheating * The method is in reverse because the default for older worlds will be 'false' @@ -218,15 +313,42 @@ public class RBMKDials { * @return */ public static boolean getMeltdownsDisabled(World world) { - return world.getGameRules().getGameRuleBooleanValue(KEY_DISABLE_MELTDOWNS); + return (boolean) getGameRule(world, RBMKKeys.KEY_DISABLE_MELTDOWNS); } - + /** * Whether or not connected pipes and turbines should explode when the reactor undergoes a meltdown. * @param world * @return */ public static boolean getOverpressure(World world) { - return world.getGameRules().getGameRuleBooleanValue(KEY_ENABLE_MELTDOWN_OVERPRESSURE); + return (boolean) getGameRule(world, RBMKKeys.KEY_ENABLE_MELTDOWN_OVERPRESSURE); + } + + /** + * The percentage of neutrons to moderate from fast to slow when they pass through a moderator. + * @param world + * @return + */ + public static double getModeratorEfficiency(World world) { + return (double) getGameRule(world, RBMKKeys.KEY_MODERATOR_EFFICIENCY); + } + + /** + * The percentage of neutrons to be absorbed when a stream hits an absorber column. + * @param world + * @return + */ + public static double getAbsorberEfficiency(World world) { + return (double) getGameRule(world, RBMKKeys.KEY_ABSORBER_EFFICIENCY); + } + + /** + * The percentage of neutron to reflect when a stream hits a reflector column. + * @param world + * @return + */ + public static double getReflectorEfficiency(World world) { + return (double) getGameRule(world, RBMKKeys.KEY_REFLECTOR_EFFICIENCY); } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java index a71c407b5..06970b7b6 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityCraneConsole.java @@ -6,13 +6,11 @@ import com.hbm.extprop.HbmPlayerProps; import com.hbm.handler.CompatHandler; import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.items.machine.ItemRBMKRod; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.TileEntityLoadedBase; import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -21,7 +19,6 @@ import net.minecraft.block.Block; 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.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraftforge.common.util.ForgeDirection; @@ -29,19 +26,19 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.List; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityCraneConsole extends TileEntity implements INBTPacketReceiver, SimpleComponent, CompatHandler.OCComponent { - +public class TileEntityCraneConsole extends TileEntityLoadedBase implements SimpleComponent, CompatHandler.OCComponent { + public int centerX; public int centerY; public int centerZ; - + public int spanF; public int spanB; public int spanL; public int spanR; - + public int height; - + public boolean setUpCrane = false; public int craneRotationOffset = 0; @@ -56,11 +53,11 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece public double posFront = 0; public double posLeft = 0; private static final double speed = 0.05D; - + private boolean goesDown = false; public double lastProgress = 1D; public double progress = 1D; - + private ItemStack loadedItem; private boolean hasLoaded = false; public double loadedHeat; @@ -73,15 +70,15 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece lastTiltFront = tiltFront; lastTiltLeft = tiltLeft; } - + if(goesDown) { - + if(progress > 0) { progress -= 0.04D; } else { progress = 0; goesDown = false; - + if(!worldObj.isRemote && this.canTargetInteract()) { IRBMKLoadable column = getColumnAtPos(); if(column != null) { // canTargetInteract already assumes this, but there seems to be some freak race conditions that cause the column to be null anyway @@ -92,16 +89,16 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece this.loadedItem = column.provideNext(); column.unload(); } - + this.markDirty(); } } - + } } else if(progress != 1) { - + progress += 0.04D; - + if(progress > 1D) { progress = 1D; } @@ -113,7 +110,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece double maxX = xCoord + 0.5 + side.offsetX * 1.5 + dir.offsetX * 2; double minZ = zCoord + 0.5 - side.offsetZ * 1.5; double maxZ = zCoord + 0.5 + side.offsetZ * 1.5 + dir.offsetZ * 2; - + List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox( Math.min(minX, maxX), yCoord, @@ -123,7 +120,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece Math.max(minZ, maxZ))); tiltFront = 0; tiltLeft = 0; - + if(players.size() > 0 && !isCraneLoading()) { EntityPlayer player = players.get(0); HbmPlayerProps props = HbmPlayerProps.getData(player); @@ -131,7 +128,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece boolean down = props.getKeyPressed(EnumKeybind.CRANE_DOWN); boolean left = props.getKeyPressed(EnumKeybind.CRANE_LEFT); boolean right = props.getKeyPressed(EnumKeybind.CRANE_RIGHT); - + if(up && !down) { tiltFront = 30; if(!worldObj.isRemote) posFront += speed; @@ -148,17 +145,17 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece tiltLeft = -30; if(!worldObj.isRemote) posLeft -= speed; } - + if(props.getKeyPressed(EnumKeybind.CRANE_LOAD)) { goesDown = true; } } - + posFront = MathHelper.clamp_double(posFront, -spanB, spanF); posLeft = MathHelper.clamp_double(posLeft, -spanR, spanL); - + if(!worldObj.isRemote) { - + if(loadedItem != null && loadedItem.getItem() instanceof ItemRBMKRod) { this.loadedHeat = ItemRBMKRod.getHullHeat(loadedItem); this.loadedEnrichment = ItemRBMKRod.getEnrichment(loadedItem); @@ -166,73 +163,54 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece this.loadedHeat = 0; this.loadedEnrichment = 0; } - - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setBoolean("crane", setUpCrane); - - if(setUpCrane) { //no need to send any of this if there's NO FUCKING CRANE THERE - nbt.setInteger("craneRotationOffset", craneRotationOffset); - nbt.setInteger("centerX", centerX); - nbt.setInteger("centerY", centerY); - nbt.setInteger("centerZ", centerZ); - nbt.setInteger("spanF", spanF); - nbt.setInteger("spanB", spanB); - nbt.setInteger("spanL", spanL); - nbt.setInteger("spanR", spanR); - nbt.setInteger("height", height); - nbt.setDouble("posFront", posFront); - nbt.setDouble("posLeft", posLeft); - nbt.setBoolean("loaded", this.hasItemLoaded()); - nbt.setDouble("loadedHeat", loadedHeat); - nbt.setDouble("loadedEnrichment", loadedEnrichment); - } - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250)); + + networkPackNT(250); } } - + public boolean hasItemLoaded() { - + if(!worldObj.isRemote) return this.loadedItem != null; else return this.hasLoaded; } - + public boolean isCraneLoading() { return this.progress != 1D; } - + public boolean isAboveValidTarget() { return getColumnAtPos() != null; } - + public boolean canTargetInteract() { - + IRBMKLoadable column = getColumnAtPos(); - + if(column == null) return false; - + if(this.hasItemLoaded()) { return column.canLoad(loadedItem); } else { return column.canUnload(); } } - + public IRBMKLoadable getColumnAtPos() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); ForgeDirection left = dir.getRotation(ForgeDirection.DOWN); int x = (int)Math.floor(this.centerX - dir.offsetX * this.posFront - left.offsetX * this.posLeft + 0.5D); int y = this.centerY - 1; int z = (int)Math.floor(this.centerZ - dir.offsetZ * this.posFront - left.offsetZ * this.posLeft + 0.5D); - + Block b = worldObj.getBlock(x, y, z); - + if(b instanceof RBMKBase) { - + int[] pos = ((BlockDummyable)b).findCore(worldObj, x, y, z); if(pos != null) { TileEntityRBMKBase column = (TileEntityRBMKBase)worldObj.getTileEntity(pos[0], pos[1], pos[2]); @@ -241,35 +219,58 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece } } } - + return null; } @Override - public void networkUnpack(NBTTagCompound nbt) { - + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.setUpCrane); + + if(this.setUpCrane) { //no need to send any of this if there's NO FUCKING CRANE THERE + buf.writeInt(this.craneRotationOffset); + buf.writeInt(this.centerX); + buf.writeInt(this.centerY); + buf.writeInt(this.centerZ); + buf.writeInt(this.spanF); + buf.writeInt(this.spanB); + buf.writeInt(this.spanL); + buf.writeInt(this.spanR); + buf.writeInt(this.height); + buf.writeDouble(this.posFront); + buf.writeDouble(this.posLeft); + buf.writeBoolean(this.hasItemLoaded()); + buf.writeDouble(this.loadedHeat); + buf.writeDouble(this.loadedEnrichment); + } + } + + @Override + public void deserialize(ByteBuf buf) { lastPosFront = posFront; lastPosLeft = posLeft; lastProgress = progress; - - this.setUpCrane = nbt.getBoolean("crane"); - this.craneRotationOffset = nbt.getInteger("craneRotationOffset"); - this.centerX = nbt.getInteger("centerX"); - this.centerY = nbt.getInteger("centerY"); - this.centerZ = nbt.getInteger("centerZ"); - this.spanF = nbt.getInteger("spanF"); - this.spanB = nbt.getInteger("spanB"); - this.spanL = nbt.getInteger("spanL"); - this.spanR = nbt.getInteger("spanR"); - this.height = nbt.getInteger("height"); - this.posFront = nbt.getDouble("posFront"); - this.posLeft = nbt.getDouble("posLeft"); - this.hasLoaded = nbt.getBoolean("loaded"); - this.posLeft = nbt.getDouble("posLeft"); - this.loadedHeat = nbt.getDouble("loadedHeat"); - this.loadedEnrichment = nbt.getDouble("loadedEnrichment"); + + this.setUpCrane = buf.readBoolean(); + if (this.setUpCrane) { + this.craneRotationOffset = buf.readInt(); + this.centerX = buf.readInt(); + this.centerY = buf.readInt(); + this.centerZ = buf.readInt(); + this.spanF = buf.readInt(); + this.spanB = buf.readInt(); + this.spanL = buf.readInt(); + this.spanR = buf.readInt(); + this.height = buf.readInt(); + this.posFront = buf.readDouble(); + this.posLeft = buf.readDouble(); + this.hasLoaded = buf.readBoolean(); + this.posLeft = buf.readDouble(); + this.loadedHeat = buf.readDouble(); + this.loadedEnrichment = buf.readDouble(); + } } - + public void setTarget(int x, int y, int z) { this.centerX = x; this.centerY = y + RBMKDials.getColumnHeight(worldObj) + 1; @@ -279,18 +280,18 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece this.spanB = 7; this.spanL = 7; this.spanR = 7; - + this.height = 7; this.setUpCrane = true; - + this.markDirty(); } public void cycleCraneRotation() { this.craneRotationOffset = (this.craneRotationOffset + 90) % 360; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -307,11 +308,11 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece this.height = nbt.getInteger("height"); this.posFront = nbt.getDouble("posFront"); this.posLeft = nbt.getDouble("posLeft"); - + NBTTagCompound held = nbt.getCompoundTag("held"); this.loadedItem = ItemStack.loadItemStackFromNBT(held); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -328,25 +329,25 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece nbt.setInteger("height", height); nbt.setDouble("posFront", posFront); nbt.setDouble("posLeft", posLeft); - + if(this.loadedItem != null) { NBTTagCompound held = new NBTTagCompound(); this.loadedItem.writeToNBT(held); nbt.setTag("held", held); } } - + @Override public AxisAlignedBB getRenderBoundingBox() { return this.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 65536.0D; } - + // do some opencomputer stuff @Override @Optional.Method(modid = "OpenComputers") @@ -378,12 +379,12 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece if(!worldObj.isRemote) posLeft -= speed; break; } - + return new Object[] {}; } return new Object[] {"Crane not found"}; } - + @Callback @Optional.Method(modid = "OpenComputers") public Object[] load(Context context, Arguments args) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAbsorber.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAbsorber.java index 20512c206..d1c585539 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAbsorber.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKAbsorber.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine.rbmk; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; public class TileEntityRBMKAbsorber extends TileEntityRBMKBase { - + @Override public void onMelt(int reduce) { @@ -17,6 +18,11 @@ public class TileEntityRBMKAbsorber extends TileEntityRBMKBase { super.onMelt(reduce); } + @Override + public RBMKType getRBMKType() { + return RBMKType.ABSORBER; + } + @Override public ColumnType getConsoleType() { return ColumnType.ABSORBER; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java index 9adb5b1a8..8ee80176b 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java @@ -8,20 +8,23 @@ import com.hbm.blocks.machine.rbmk.RBMKBase; import com.hbm.entity.effect.EntitySpear; import com.hbm.entity.projectile.EntityRBMKDebris; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; +import com.hbm.handler.neutron.NeutronNodeWorld; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; -import com.hbm.packet.toclient.NBTPacket; import com.hbm.saveddata.TomSaveData; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IOverpressurable; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import com.hbm.util.Compat; import com.hbm.util.I18nUtil; +import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -38,34 +41,39 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import java.util.*; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Set; +import java.util.HashSet; +import java.util.Iterator; /** * Base class for all RBMK components, active or passive. Handles heat and the explosion sequence * @author hbm * */ -public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements INBTPacketReceiver { - +public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements IBufPacketReceiver { + public double heat; - + public int water; public static final int maxWater = 16000; public int steam; public static final int maxSteam = 16000; public boolean hasLid() { - + if(!isLidRemovable()) return true; - + return this.getBlockMetadata() != RBMKBase.DIR_NO_LID.ordinal() + RBMKBase.offset; } public boolean isLidRemovable() { return true; } - + /** * Approx melting point of steel * Fuels often burn much hotter than this but it won't affect the column too much due to low diffusion @@ -74,7 +82,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements public double maxHeat() { return 1500D; } - + /** * Around the same for every component except boilers which do not have passive cooling * @return @@ -82,22 +90,22 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements public double passiveCooling() { return RBMKDials.getPassiveCooling(worldObj); //default: 1.0D } - + //necessary checks to figure out whether players are close enough to ensure that the reactor can be safely used public boolean shouldUpdate() { return true; } - + //unused public int trackingRange() { return 15; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.worldObj.theProfiler.startSection("rbmkBase_heat_movement"); moveHeat(); if(RBMKDials.getReasimBoilers(worldObj)) { @@ -108,73 +116,74 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements this.worldObj.theProfiler.endStartSection("rbmkBase_rpassive_cooling"); coolPassively(); this.worldObj.theProfiler.endSection(); - - NBTTagCompound data = new NBTTagCompound(); - this.writeToNBT(data); - this.networkPack(data, trackingRange()); + + this.networkPackNT(trackingRange()); } } - + /** * The ReaSim boiler dial causes all RBMK parts to behave like boilers */ private void boilWater() { - + if(heat < 100D) return; - + double heatConsumption = RBMKDials.getBoilerHeatConsumption(worldObj); double availableHeat = (this.heat - 100) / heatConsumption; double availableWater = this.water; double availableSpace = this.maxSteam - this.steam; - + int processedWater = (int) Math.floor(Math.min(availableHeat, Math.min(availableWater, availableSpace)) * RBMKDials.getReaSimBoilerSpeed(worldObj)); - + this.water -= processedWater; this.steam += processedWater; this.heat -= processedWater * heatConsumption; } - + public static final ForgeDirection[] neighborDirs = new ForgeDirection[] { ForgeDirection.NORTH, ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.WEST }; - + protected TileEntityRBMKBase[] neighborCache = new TileEntityRBMKBase[4]; - + /** * Moves heat to neighboring parts, if possible, in a relatively fair manner */ private void moveHeat() { - + + if(heat == 20 && RBMKDials.getReasimBoilers(worldObj)) + return; + List rec = new ArrayList(); rec.add(this); double heatTot = this.heat; int waterTot = this.water; int steamTot = this.steam; - + int index = 0; for(ForgeDirection dir : neighborDirs) { - + if(neighborCache[index] != null && neighborCache[index].isInvalid()) neighborCache[index] = null; - + if(neighborCache[index] == null) { TileEntity te = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ); - + if(te instanceof TileEntityRBMKBase) { TileEntityRBMKBase base = (TileEntityRBMKBase) te; neighborCache[index] = base; } } - + index++; } - + for(TileEntityRBMKBase base : neighborCache) { - + if(base != null) { rec.add(base); heatTot += base.heat; @@ -182,44 +191,51 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements steamTot += base.steam; } } - + int members = rec.size(); double stepSize = RBMKDials.getColumnHeatFlow(worldObj); - + if(members > 1) { - + double targetHeat = heatTot / (double)members; - + int tWater = waterTot / members; int rWater = waterTot % members; int tSteam = steamTot / members; int rSteam = steamTot % members; - + for(TileEntityRBMKBase rbmk : rec) { double delta = targetHeat - rbmk.heat; rbmk.heat += delta * stepSize; - + //set to the averages, rounded down rbmk.water = tWater; rbmk.steam = tSteam; } - + //add the modulo to make up for the losses coming from rounding this.water += rWater; this.steam += rSteam; - + this.markDirty(); } } - + + @Override + public void invalidate() { + super.invalidate(); + + NeutronNodeWorld.removeNode(new BlockPos(this)); // woo-fucking-hoo!!! + } + @Override public void markDirty() { - + if(this.worldObj != null) { this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); } } - + protected void coolPassively() { if(TomSaveData.forWorld(worldObj).fire > 1e-5) { @@ -228,18 +244,22 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements this.heat += this.passiveCooling() * 2; } } - + this.heat -= this.passiveCooling(); - + if(heat < 20) heat = 20D; } - + + public RBMKType getRBMKType() { + return RBMKType.OTHER; + } + protected static boolean diag = false; - + @Override public void readFromNBT(NBTTagCompound nbt) { - + if(!diag) { super.readFromNBT(nbt); } @@ -248,40 +268,39 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements this.water = nbt.getInteger("water"); this.steam = nbt.getInteger("steam"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { - + if(!diag) { super.writeToNBT(nbt); } - + nbt.setDouble("heat", this.heat); nbt.setInteger("water", this.water); nbt.setInteger("steam", this.steam); } - - public void networkPack(NBTTagCompound nbt, int range) { - diag = true; - if(!worldObj.isRemote) - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - diag = false; + @Override + public void serialize(ByteBuf buf) { + buf.writeDouble(this.heat); + buf.writeInt(this.water); + buf.writeInt(this.steam); } - - public void networkUnpack(NBTTagCompound nbt) { - - diag = true; - this.readFromNBT(nbt); - diag = false; + + @Override + public void deserialize(ByteBuf buf) { + this.heat = buf.readDouble(); + this.water = buf.readInt(); + this.steam = buf.readInt(); } - + public void getDiagData(NBTTagCompound nbt) { diag = true; this.writeToNBT(nbt); diag = false; } - + @SideOnly(Side.CLIENT) public static void diagnosticPrintHook(RenderGameOverlayEvent.Pre event, World world, int x, int y, int z) { @@ -310,6 +329,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements exceptions.add("z"); exceptions.add("items"); exceptions.add("id"); + exceptions.add("muffled"); String title = "Dump of Ordered Data Diagnostic (DODD)"; mc.fontRenderer.drawString(title, pX + 1, pZ - 19, 0x006000); @@ -336,80 +356,80 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements GL11.glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons); } - + public void onOverheat() { - + for(int i = 0; i < 4; i++) { worldObj.setBlock(xCoord, yCoord + i, zCoord, Blocks.lava); } } - + public void onMelt(int reduce) { - + standardMelt(reduce); - + if(this.getBlockMetadata() == RBMKBase.DIR_NORMAL_LID.ordinal() + RBMKBase.offset) spawnDebris(DebrisType.LID); } - + protected void standardMelt(int reduce) { - + int h = RBMKDials.getColumnHeight(worldObj); reduce = MathHelper.clamp_int(reduce, 1, h); - + if(worldObj.rand.nextInt(3) == 0) reduce++; - + for(int i = h; i >= 0; i--) { - + if(i <= h + 1 - reduce) { - + if(reduce > 1 && i == h + 1 - reduce) { worldObj.setBlock(xCoord, yCoord + i, zCoord, ModBlocks.pribris_burning); } else { worldObj.setBlock(xCoord, yCoord + i, zCoord, ModBlocks.pribris); } - + } else { worldObj.setBlock(xCoord, yCoord + i, zCoord, Blocks.air); } worldObj.markBlockForUpdate(xCoord, yCoord + i, zCoord); } } - + protected void spawnDebris(DebrisType type) { EntityRBMKDebris debris = new EntityRBMKDebris(worldObj, xCoord + 0.5D, yCoord + 4D, zCoord + 0.5D, type); debris.motionX = worldObj.rand.nextGaussian() * 0.25D; debris.motionZ = worldObj.rand.nextGaussian() * 0.25D; debris.motionY = 0.25D + worldObj.rand.nextDouble() * 1.25D; - + if(type == DebrisType.LID) { debris.motionX *= 0.5D; debris.motionY += 0.5D; debris.motionZ *= 0.5D; } - + worldObj.spawnEntityInWorld(debris); } - + public static HashSet columns = new HashSet(); public static HashSet pipes = new HashSet(); - + //assumes that !worldObj.isRemote public void meltdown() { - + RBMKBase.dropLids = false; - + columns.clear(); pipes.clear(); getFF(xCoord, yCoord, zCoord); - + int minX = xCoord; int maxX = xCoord; int minZ = zCoord; int maxZ = zCoord; - + //set meltdown bounds for(TileEntityRBMKBase rbmk : columns) { @@ -422,31 +442,31 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements if(rbmk.zCoord > maxZ) maxZ = rbmk.zCoord; } - + for(TileEntityRBMKBase rbmk : columns) { int distFromMinX = rbmk.xCoord - minX; int distFromMaxX = maxX - rbmk.xCoord; int distFromMinZ = rbmk.zCoord - minZ; int distFromMaxZ = maxZ - rbmk.zCoord; - + int minDist = Math.min(distFromMinX, Math.min(distFromMaxX, Math.min(distFromMinZ, distFromMaxZ))); - + rbmk.onMelt(minDist + 1); } - + for(TileEntityRBMKBase rbmk : columns) { - + if(rbmk instanceof TileEntityRBMKRod && worldObj.getBlock(rbmk.xCoord, rbmk.yCoord, rbmk.zCoord) == ModBlocks.corium_block) { - + for(int x = rbmk.xCoord - 1; x <= rbmk.xCoord + 1; x ++) { for(int y = rbmk.yCoord - 1; y <= rbmk.yCoord + 1; y ++) { for(int z = rbmk.zCoord - 1; z <= rbmk.zCoord + 1; z ++) { - + Block b = worldObj.getBlock(x, y, z); - + if(worldObj.rand.nextInt(3) == 0 && (b == ModBlocks.pribris || b == ModBlocks.pribris_burning)) { - + if(RBMKBase.digamma) worldObj.setBlock(x, y, z, ModBlocks.pribris_digamma); else @@ -457,23 +477,23 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements } } } - + /* Hanlde overpressure event */ if(RBMKDials.getOverpressure(worldObj) && !pipes.isEmpty()) { HashSet pipeBlocks = new HashSet(); HashSet pipeReceivers = new HashSet(); - + //unify all parts into single sets to prevent redundancy pipes.forEach(x -> { pipeBlocks.addAll(x.getLinks()); pipeReceivers.addAll(x.getSubscribers()); }); - + int count = 0; int max = Math.min(pipeBlocks.size() / 5, 100); Iterator itPipes = pipeBlocks.iterator(); Iterator itReceivers = pipeReceivers.iterator(); - + while(itPipes.hasNext() && count < max) { IFluidConductor pipe = itPipes.next(); if(pipe instanceof TileEntity) { @@ -482,7 +502,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements } count++; } - + while(itReceivers.hasNext()) { IFluidConnector con = itReceivers.next(); if(con instanceof TileEntity) { @@ -496,26 +516,26 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements } } } - + int smallDim = Math.min(maxX - minX, maxZ - minZ); int avgX = minX + (maxX - minX) / 2; int avgZ = minZ + (maxZ - minZ) / 2; - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "rbmkmush"); data.setFloat("scale", smallDim); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, avgX + 0.5, yCoord + 1, avgZ + 0.5), new TargetPoint(worldObj.provider.dimensionId,avgX + 0.5, yCoord + 1, avgZ + 0.5, 250)); MainRegistry.proxy.effectNT(data); - + worldObj.playSoundEffect(avgX + 0.5, yCoord + 1, avgZ + 0.5, "hbm:block.rbmk_explosion", 50.0F, 1.0F); - + List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(50, 50, 50)); - + for(EntityPlayer player : players) { player.triggerAchievement(MainRegistry.achRBMKBoom); } - + if(RBMKBase.digamma) { EntitySpear spear = new EntitySpear(worldObj); spear.posX = avgX + 0.5; @@ -523,19 +543,19 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements spear.posY = yCoord + 100; worldObj.spawnEntityInWorld(spear); } - + RBMKBase.dropLids = true; RBMKBase.digamma = false; } - + private void getFF(int x, int y, int z) { - + TileEntity te = Compat.getTileStandard(worldObj, x, y, z); - + if(te instanceof TileEntityRBMKBase) { - + TileEntityRBMKBase rbmk = (TileEntityRBMKBase) te; - + if(!columns.contains(rbmk)) { columns.add(rbmk); getFF(x + 1, y, z); @@ -545,21 +565,21 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements } } } - + public boolean isModerated() { return false; } - + public abstract ColumnType getConsoleType(); - + public NBTTagCompound getNBTForConsole() { return null; } - + public static List getFancyStats(NBTTagCompound nbt) { return null; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 17, zCoord + 1); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java index 1076989f8..14f8a8b15 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBoiler.java @@ -21,6 +21,7 @@ import com.hbm.util.fauxpointtwelve.DirPos; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -162,6 +163,20 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I steam.writeToNBT(nbt, "steam"); } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + steam.serialize(buf); + feed.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.steam.deserialize(buf); + this.feed.deserialize(buf); + } + @Override public boolean hasPermission(EntityPlayer player) { return Vec3.createVectorHelper(xCoord - player.posX, yCoord - player.posY, zCoord - player.posZ).lengthVector() < 20; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java index ca269016a..f41643047 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java @@ -14,6 +14,7 @@ import com.hbm.inventory.gui.GUIRBMKConsole; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor; +import com.hbm.util.BufferUtil; import com.hbm.util.Compat; import com.hbm.util.EnumUtil; import com.hbm.util.I18nUtil; @@ -21,6 +22,7 @@ import com.hbm.util.I18nUtil; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -76,8 +78,8 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon this.worldObj.theProfiler.endSection(); prepareScreenInfo(); } - - prepareNetworkPack(); + + this.networkPackNT(50); } } @@ -102,7 +104,7 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon if(te instanceof TileEntityRBMKRod) { TileEntityRBMKRod fuel = (TileEntityRBMKRod) te; - flux += fuel.fluxFast + fuel.fluxSlow; + flux += fuel.lastFluxQuantity; } } else { @@ -184,66 +186,65 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon screen.display = text; } } - - private void prepareNetworkPack() { - - NBTTagCompound data = new NBTTagCompound(); - - if(this.worldObj.getTotalWorldTime() % 10 == 0) { - - data.setBoolean("full", true); - - for(int i = 0; i < columns.length; i++) { - - if(this.columns[i] != null) { - data.setTag("column_" + i, this.columns[i].data); - data.setShort("type_" + i, (short)this.columns[i].type.ordinal()); - } - } - - data.setIntArray("flux", this.fluxBuffer); - - for(int i = 0; i < this.screens.length; i++) { - RBMKScreen screen = screens[i]; - if(screen.display != null) { - data.setString("t" + i, screen.display); - } - } - } - - for(int i = 0; i < this.screens.length; i++) { - RBMKScreen screen = screens[i]; - data.setByte("s" + i, (byte) screen.type.ordinal()); - } - - this.networkPack(data, 50); - } - @Override - public void networkUnpack(NBTTagCompound data) { - - if(data.getBoolean("full")) { - this.columns = new RBMKColumn[15 * 15]; - - for(int i = 0; i < columns.length; i++) { - - if(data.hasKey("type_" + i)) { - this.columns[i] = new RBMKColumn(ColumnType.values()[data.getShort("type_" + i)], (NBTTagCompound)data.getTag("column_" + i)); + public void serialize(ByteBuf buf) { + super.serialize(buf); + + if (this.worldObj.getTotalWorldTime() % 10 == 0) { + buf.writeBoolean(true); + + for (RBMKColumn column : this.columns) { + if (column == null || column.type == null) + buf.writeByte(-1); + else { + buf.writeByte((byte) column.type.ordinal()); + BufferUtil.writeNBT(buf, column.data); } } - - this.fluxBuffer = data.getIntArray("flux"); - - for(int i = 0; i < this.screens.length; i++) { - RBMKScreen screen = screens[i]; - screen.display = data.getString("t" + i); + + BufferUtil.writeIntArray(buf, fluxBuffer); + + for (RBMKScreen screen : this.screens) { + BufferUtil.writeString(buf, screen.display); + } + + } else { + + buf.writeBoolean(false); + + for (RBMKScreen screen : screens) { + buf.writeByte((byte) screen.type.ordinal()); } } - - for(int i = 0; i < this.screens.length; i++) { - RBMKScreen screen = screens[i]; - screen.type = ScreenType.values()[data.getByte("s" + i)]; + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + + if (buf.readBoolean()) { // check if it should be a full packet + + for(int i = 0; i < this.columns.length; i++) { + byte ordinal = buf.readByte(); + if (ordinal == -1) + this.columns[i] = null; + else + this.columns[i] = new RBMKColumn(ColumnType.values()[ordinal], BufferUtil.readNBT(buf)); + } + + this.fluxBuffer = BufferUtil.readIntArray(buf); + + for (RBMKScreen screen : this.screens) { + screen.display = BufferUtil.readString(buf); + } + + } else { + + for (RBMKScreen screen : this.screens) { + screen.type = ScreenType.values()[buf.readByte()]; + } + } } @@ -555,8 +556,8 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon if(te instanceof TileEntityRBMKRod){ TileEntityRBMKRod fuelChannel = (TileEntityRBMKRod)te; - data_table.put("fluxSlow", fuelChannel.fluxSlow); - data_table.put("fluxFast", fuelChannel.fluxFast); + data_table.put("fluxQuantity", fuelChannel.lastFluxQuantity); + data_table.put("fluxRatio", fuelChannel.fluxRatio); } if(te instanceof TileEntityRBMKBoiler){ diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControl.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControl.java index 4b3f79c15..9e6d43868 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControl.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControl.java @@ -2,9 +2,11 @@ package com.hbm.tileentity.machine.rbmk; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; import com.hbm.handler.CompatHandler; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -87,6 +89,20 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im nbt.setDouble("level", this.level); nbt.setDouble("targetLevel", this.targetLevel); } + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeDouble(this.level); + buf.writeDouble(this.targetLevel); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.level = buf.readDouble(); + this.targetLevel = buf.readDouble(); + } @Override @SideOnly(Side.CLIENT) @@ -115,6 +131,11 @@ public abstract class TileEntityRBMKControl extends TileEntityRBMKSlottedBase im this.standardMelt(reduce); } + @Override + public RBMKType getRBMKType() { + return RBMKType.CONTROL_ROD; + } + @Override public NBTTagCompound getNBTForConsole() { NBTTagCompound data = new NBTTagCompound(); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlAuto.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlAuto.java index a0c38f10f..3da017e91 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlAuto.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlAuto.java @@ -8,6 +8,7 @@ import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; @@ -104,6 +105,24 @@ public class TileEntityRBMKControlAuto extends TileEntityRBMKControl implements nbt.setInteger("function", function.ordinal()); } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeDouble(this.levelLower); + buf.writeDouble(this.levelUpper); + buf.writeDouble(this.heatLower); + buf.writeDouble(this.heatUpper); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.levelLower = buf.readDouble(); + this.levelUpper = buf.readDouble(); + this.heatLower = buf.readDouble(); + this.heatUpper = buf.readDouble(); + } + @Override public void receiveControl(NBTTagCompound data) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java index 9b25682cc..b34f99a5e 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKControlManual.java @@ -9,6 +9,7 @@ import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -90,7 +91,7 @@ public class TileEntityRBMKControlManual extends TileEntityRBMKControl implement if(nbt.hasKey("startingLevel")) this.startingLevel = nbt.getDouble("startingLevel"); - + if(nbt.hasKey("color")) this.color = RBMKColor.values()[nbt.getInteger("color")]; else @@ -107,6 +108,24 @@ public class TileEntityRBMKControlManual extends TileEntityRBMKControl implement if(color != null) nbt.setInteger("color", color.ordinal()); } + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeDouble(this.startingLevel); + if(this.color != null) + buf.writeInt(this.color.ordinal()); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.startingLevel = buf.readDouble(); + if(buf.isReadable(1)) { + int color = buf.readInt(); + this.color = RBMKColor.values()[MathHelper.clamp_int(color, 0, RBMKColor.values().length)]; + } + } public static enum RBMKColor { RED, diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java index bd7250cf7..fe3ddc71d 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKCooler.java @@ -7,6 +7,7 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import cpw.mods.fml.common.Optional; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -101,6 +102,20 @@ public class TileEntityRBMKCooler extends TileEntityRBMKBase implements IFluidSt nbt.setInteger("cooled", this.lastCooled); } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + this.tank.serialize(buf); + buf.writeInt(this.lastCooled); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.tank.deserialize(buf); + this.lastCooled = buf.readInt(); + } + @Override public ColumnType getConsoleType() { return ColumnType.COOLER; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java index 54fb66914..3965ea170 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKHeater.java @@ -17,6 +17,7 @@ import com.hbm.util.fauxpointtwelve.DirPos; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -49,7 +50,7 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I if(!worldObj.isRemote) { feed.setType(0, slots); - + if(feed.getTankType().hasTrait(FT_Heatable.class)) { FT_Heatable trait = feed.getTankType().getTrait(FT_Heatable.class); HeatingStep step = trait.getFirstStep(); @@ -81,7 +82,7 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I super.updateEntity(); } - + protected DirPos[] getOutputPos() { if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.rbmk_loader) { @@ -124,7 +125,21 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I feed.writeToNBT(nbt, "feed"); steam.writeToNBT(nbt, "steam"); } - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + this.feed.serialize(buf); + this.steam.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.feed.deserialize(buf); + this.steam.deserialize(buf); + } + @Override public void onMelt(int reduce) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java index be66e767d..301f5bb1c 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKInlet.java @@ -4,14 +4,16 @@ import api.hbm.fluid.IFluidStandardReceiver; import com.hbm.blocks.machine.rbmk.RBMKBase; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidStandardReceiver { +public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidStandardReceiver, IBufPacketReceiver { public FluidTank water; @@ -61,6 +63,14 @@ public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidS this.water.writeToNBT(nbt, "tank"); } + public void serialize(ByteBuf buf) { + this.water.serialize(buf); + } + + public void deserialize(ByteBuf buf) { + this.water.deserialize(buf); + } + @Override public FluidTank[] getAllTanks() { return new FluidTank[] {water}; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKModerator.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKModerator.java index 7abb95b12..989b0af42 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKModerator.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKModerator.java @@ -1,10 +1,11 @@ package com.hbm.tileentity.machine.rbmk; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKType; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; public class TileEntityRBMKModerator extends TileEntityRBMKBase { - + @Override public void onMelt(int reduce) { @@ -17,6 +18,11 @@ public class TileEntityRBMKModerator extends TileEntityRBMKBase { super.onMelt(reduce); } + @Override + public RBMKType getRBMKType() { + return RBMKType.MODERATOR; + } + @Override public ColumnType getConsoleType() { return ColumnType.MODERATOR; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java index 573739520..eccf38e4c 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutgasser.java @@ -4,6 +4,8 @@ import api.hbm.fluid.IFluidStandardSender; import com.hbm.blocks.ModBlocks; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; import com.hbm.handler.CompatHandler; +import com.hbm.handler.neutron.NeutronStream; +import com.hbm.handler.neutron.RBMKNeutronHandler; import com.hbm.inventory.FluidStack; import com.hbm.inventory.container.ContainerRBMKOutgasser; import com.hbm.inventory.fluid.Fluids; @@ -17,6 +19,7 @@ import com.hbm.util.fauxpointtwelve.DirPos; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -89,14 +92,13 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement } @Override - public void receiveFlux(NType type, double flux) { + public void receiveFlux(NeutronStream stream) { if(canProcess()) { - - if(type == NType.FAST) - flux *= 0.2D; - - progress += flux * RBMKDials.getOutgasserMod(worldObj); + + double efficiency = Math.min(1 - stream.fluxRatio * 0.8, 1); + + progress += stream.fluxQuantity * efficiency * RBMKDials.getOutgasserMod(worldObj); if(progress > duration) { process(); @@ -164,6 +166,11 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement super.onMelt(reduce); } + @Override + public RBMKNeutronHandler.RBMKType getRBMKType() { + return RBMKNeutronHandler.RBMKType.OUTGASSER; + } + @Override public ColumnType getConsoleType() { return ColumnType.OUTGASSER; @@ -195,6 +202,20 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement this.gas.writeToNBT(nbt, "gas"); } + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + this.gas.serialize(buf); + buf.writeDouble(this.progress); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.gas.deserialize(buf); + this.progress = buf.readDouble(); + } + @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { return OutgasserRecipes.getOutput(itemStack) != null && i == 0; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java index 259ac0b4c..0dc4cd89b 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKOutlet.java @@ -4,14 +4,16 @@ import api.hbm.fluid.IFluidStandardSender; import com.hbm.blocks.machine.rbmk.RBMKBase; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.TileEntityLoadedBase; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluidStandardSender { +public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluidStandardSender, IBufPacketReceiver { public FluidTank steam; @@ -61,6 +63,16 @@ public class TileEntityRBMKOutlet extends TileEntityLoadedBase implements IFluid this.steam.writeToNBT(nbt, "tank"); } + @Override + public void serialize(ByteBuf buf) { + this.steam.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + this.steam.deserialize(buf); + } + public void fillFluidInit() { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.sendFluid(steam, worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKReflector.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKReflector.java index ed5b1afc0..f2157f849 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKReflector.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKReflector.java @@ -1,6 +1,7 @@ package com.hbm.tileentity.machine.rbmk; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; +import com.hbm.handler.neutron.RBMKNeutronHandler; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; public class TileEntityRBMKReflector extends TileEntityRBMKBase { @@ -17,6 +18,11 @@ public class TileEntityRBMKReflector extends TileEntityRBMKBase { super.onMelt(reduce); } + @Override + public RBMKNeutronHandler.RBMKType getRBMKType() { + return RBMKNeutronHandler.RBMKType.REFLECTOR; + } + @Override public ColumnType getConsoleType() { return ColumnType.REFLECTOR; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java index aebb8808a..6a7acf1bf 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java @@ -5,20 +5,25 @@ import com.hbm.blocks.machine.rbmk.RBMKBase; import com.hbm.blocks.machine.rbmk.RBMKRod; import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType; import com.hbm.handler.CompatHandler; +import com.hbm.handler.neutron.NeutronNodeWorld; +import com.hbm.handler.neutron.RBMKNeutronHandler; import com.hbm.handler.radiation.ChunkRadiationManager; +import com.hbm.handler.neutron.RBMKNeutronHandler.RBMKNeutronNode; +import com.hbm.handler.neutron.NeutronStream; import com.hbm.inventory.container.ContainerRBMKRod; import com.hbm.inventory.gui.GUIRBMKRod; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemRBMKRod; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; -import com.hbm.util.Compat; import com.hbm.util.CompatEnergyControl; import com.hbm.util.ParticleUtil; import api.hbm.tile.IInfoProviderEC; +import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -27,8 +32,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -37,10 +42,14 @@ import java.util.List; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IRBMKLoadable, SimpleComponent, IInfoProviderEC, CompatHandler.OCComponent { - - //amount of "neutron energy" buffered for the next tick to use for the reaction - public double fluxFast; - public double fluxSlow; + + // New system!! + // Used for receiving flux (calculating outbound flux/burning rods) + public double fluxRatio; + public double fluxQuantity; + public double lastFluxQuantity; + public double lastFluxRatio; + public boolean hasRod; public TileEntityRBMKRod() { @@ -51,243 +60,212 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM public String getName() { return "container.rbmkRod"; } - + @Override public boolean isModerated() { return ((RBMKRod)this.getBlockType()).moderated; } - + @Override public int trackingRange() { return 25; } - @SuppressWarnings("incomplete-switch") //shut the fuck up @Override - public void receiveFlux(NType type, double flux) { - - switch(type) { - case FAST: this.fluxFast += flux; break; - case SLOW: this.fluxSlow += flux; break; - } + public void receiveFlux(NeutronStream stream) { + double fastFlux = this.fluxQuantity * this.fluxRatio; + double fastFluxIn = stream.fluxQuantity * stream.fluxRatio; + + this.fluxQuantity += stream.fluxQuantity; + fluxRatio = (fastFlux + fastFluxIn) / fluxQuantity; } - + @Override public void updateEntity() { if(!worldObj.isRemote) { - + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { - + ItemRBMKRod rod = ((ItemRBMKRod)slots[0].getItem()); - - double fluxIn = fluxFromType(rod.nType); - double fluxOut = rod.burn(worldObj, slots[0], fluxIn); - NType rType = rod.rType; - + + double fluxRatioOut; + double fluxQuantityOut; + + // Experimental flux ratio curve rods! + // Again, nothing really uses this so its just idle code at the moment. + if (rod.specialFluxCurve) { + + fluxRatioOut = rod.fluxRatioOut(this.fluxRatio, ItemRBMKRod.getEnrichment(slots[0])); + + double fluxIn; + + fluxIn = rod.fluxFromRatio(this.fluxQuantity, this.fluxRatio); + + fluxQuantityOut = rod.burn(worldObj, slots[0], fluxIn); + } else { + NType rType = rod.rType; + if (rType == NType.SLOW) + fluxRatioOut = 0; + else + fluxRatioOut = 1; + + double fluxIn = fluxFromType(rod.nType); + fluxQuantityOut = rod.burn(worldObj, slots[0], fluxIn); + } + rod.updateHeat(worldObj, slots[0], 1.0D); this.heat += rod.provideHeat(worldObj, slots[0], heat, 1.0D); - + if(!this.hasLid()) { - ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, (float) ((this.fluxFast + this.fluxSlow) * 0.05F)); + ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, (float) (this.fluxQuantity * 0.05F)); } - + super.updateEntity(); - + if(this.heat > this.maxHeat()) { - + if(RBMKDials.getMeltdownsDisabled(worldObj)) { ParticleUtil.spawnGasFlame(worldObj, xCoord + 0.5, yCoord + RBMKDials.getColumnHeight(worldObj) + 0.5, zCoord + 0.5, 0, 0.2, 0); } else { this.meltdown(); } - this.fluxFast = 0; - this.fluxSlow = 0; + this.lastFluxRatio = 0; + this.lastFluxQuantity = 0; + this.fluxQuantity = 0; return; } - - if(this.heat > 10_000) this.heat = 10_000; - - //for spreading, we want the buffered flux to be 0 because we want to know exactly how much gets reflected back - this.fluxFast = 0; - this.fluxSlow = 0; - this.worldObj.theProfiler.startSection("rbmkRod_flux_spread"); - spreadFlux(rType, fluxOut); - this.worldObj.theProfiler.endSection(); - + if(this.heat > 10_000) this.heat = 10_000; + + //for spreading, we want the buffered flux to be 0 because we want to know exactly how much gets reflected back + + this.lastFluxQuantity = this.fluxQuantity; + this.lastFluxRatio = this.fluxRatio; + + this.fluxQuantity = 0; + this.fluxRatio = 0; + + spreadFlux(fluxQuantityOut, fluxRatioOut); + hasRod = true; - + } else { - this.fluxFast = 0; - this.fluxSlow = 0; - + this.lastFluxRatio = 0; + this.lastFluxQuantity = 0; + this.fluxQuantity = 0; + this.fluxRatio = 0; + hasRod = false; - + super.updateEntity(); } } } - - /** - * SLOW: full efficiency for slow neutrons, fast neutrons have half efficiency - * FAST: fast neutrons have 100% efficiency, slow only 30% - * ANY: just add together whatever we have because who cares - * @param type - * @return - */ - + private double fluxFromType(NType type) { - + switch(type) { - case SLOW: return this.fluxFast * 0.5D + this.fluxSlow; - case FAST: return this.fluxFast + this.fluxSlow * 0.3D; - case ANY: return this.fluxFast + this.fluxSlow; + case SLOW: return (this.fluxQuantity * (1 - this.fluxRatio) + Math.min(this.fluxRatio * 0.5, 1)); + case FAST: return (this.fluxQuantity * (1 - this.fluxRatio) + Math.min(this.fluxRatio * 0.3, 1)); + case ANY: return this.fluxQuantity; } - + return 0.0D; } - + public static final ForgeDirection[] fluxDirs = new ForgeDirection[] { ForgeDirection.NORTH, ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.WEST }; - - protected static NType stream; - - protected void spreadFlux(NType type, double fluxOut) { - - int range = RBMKDials.getFluxRange(worldObj); - - for(ForgeDirection dir : fluxDirs) { - - stream = type; - double flux = fluxOut; - - for(int i = 1; i <= range; i++) { - - flux = runInteraction(xCoord + dir.offsetX * i, yCoord, zCoord + dir.offsetZ * i, flux); - - if(flux <= 0) - break; - } - } - } - - protected double runInteraction(int x, int y, int z, double flux) { - - TileEntity te = Compat.getTileStandard(worldObj, x, y, z); - - if(te instanceof TileEntityRBMKBase) { - TileEntityRBMKBase base = (TileEntityRBMKBase) te; - - if(!base.hasLid()) - ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, (float) (flux * 0.05F)); - - if(base.isModerated()) { - this.stream = NType.SLOW; - } + + private BlockPos pos; + + public void spreadFlux(double flux, double ratio) { + + if(pos == null) + pos = new BlockPos(this); + + if (flux == 0) { + // simple way to remove the node from the cache when no flux is going into it! + NeutronNodeWorld.removeNode(pos); + return; } - //burn baby burn - if(te instanceof TileEntityRBMKRod) { - TileEntityRBMKRod rod = (TileEntityRBMKRod)te; - - if(rod.getStackInSlot(0) != null && rod.getStackInSlot(0).getItem() instanceof ItemRBMKRod) { - rod.receiveFlux(stream, flux); - return 0; - } else { - return flux; - } + RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(pos); + + if(node == null) { + node = RBMKNeutronHandler.makeNode(this); + NeutronNodeWorld.addNode(node); } - - if(te instanceof TileEntityRBMKOutgasser) { - TileEntityRBMKOutgasser rod = (TileEntityRBMKOutgasser)te; - - if(!rod.canProcess()) { - return flux; - } + + for(ForgeDirection dir : fluxDirs) { + + Vec3 neutronVector = Vec3.createVectorHelper(dir.offsetX, dir.offsetY, dir.offsetZ); + + // Create new neutron streams + new RBMKNeutronHandler.RBMKNeutronStream(node, neutronVector, flux, ratio); } - - if(te instanceof IRBMKFluxReceiver) { - IRBMKFluxReceiver rod = (IRBMKFluxReceiver)te; - rod.receiveFlux(stream, flux); - return 0; - } - - //multiply neutron count with rod setting - if(te instanceof TileEntityRBMKControl) { - TileEntityRBMKControl control = (TileEntityRBMKControl)te; - - if(control.getMult() == 0.0D) - return 0; - - flux *= control.getMult(); - - return flux; - } - - //set neutrons to slow - if(te instanceof TileEntityRBMKModerator) { - stream = NType.SLOW; - return flux; - } - - //return the neutrons back to this with no further action required - if(te instanceof TileEntityRBMKReflector) { - this.receiveFlux(this.isModerated() ? NType.SLOW : stream, flux); - return 0; - } - - //break the neutron flow and nothign else - if(te instanceof TileEntityRBMKAbsorber) { - return 0; - } - - if(te instanceof TileEntityRBMKBase) { - return flux; - } - - int limit = RBMKDials.getColumnHeight(worldObj); - int hits = 0; - for(int h = 0; h <= limit; h++) { - - if(!worldObj.getBlock(x, y + h, z).isOpaqueCube()) - hits++; - } - - if(hits > 0) - ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, (float) (flux * 0.05F * hits / (float)limit)); - - return 0; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - this.fluxFast = nbt.getDouble("fluxFast"); - this.fluxSlow = nbt.getDouble("fluxSlow"); + if (nbt.hasKey("fluxFast") || nbt.hasKey("fluxSlow")) { + // recalculate new values to keep stable operations + this.fluxQuantity = nbt.getDouble("fluxFast") + nbt.getDouble("fluxSlow"); + if (this.fluxQuantity > 0) + this.fluxRatio = nbt.getDouble("fluxFast") / fluxQuantity; + else + this.fluxRatio = 0; + } else { + this.fluxQuantity = nbt.getDouble("fluxQuantity"); + this.fluxRatio = nbt.getDouble("fluxMod"); + } this.hasRod = nbt.getBoolean("hasRod"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - nbt.setDouble("fluxFast", this.fluxFast); - nbt.setDouble("fluxSlow", this.fluxSlow); + if (!diag) { + nbt.setDouble("fluxQuantity", this.lastFluxQuantity); + nbt.setDouble("fluxMod", this.lastFluxRatio); + } else { + nbt.setDouble("fluxSlow", this.fluxQuantity * (1 - fluxRatio)); + nbt.setDouble("fluxFast", this.fluxQuantity * fluxRatio); + } nbt.setBoolean("hasRod", this.hasRod); } - + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeDouble(this.lastFluxQuantity); + buf.writeDouble(this.lastFluxRatio); + buf.writeBoolean(this.hasRod); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.fluxQuantity = buf.readDouble(); + this.fluxRatio = buf.readDouble(); + this.hasRod = buf.readBoolean(); + } + public void getDiagData(NBTTagCompound nbt) { + diag = true; this.writeToNBT(nbt); - + diag = false; + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { - + ItemRBMKRod rod = ((ItemRBMKRod)slots[0].getItem()); nbt.setString("f_yield", rod.getYield(slots[0]) + " / " + rod.yield + " (" + (rod.getEnrichment(slots[0]) * 100) + "%)"); @@ -295,55 +273,60 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM nbt.setString("f_heat", rod.getCoreHeat(slots[0]) + " / " + rod.getHullHeat(slots[0]) + " / " + rod.meltingPoint); } } - + @Override public void onMelt(int reduce) { boolean moderated = this.isModerated(); int h = RBMKDials.getColumnHeight(worldObj); reduce = MathHelper.clamp_int(reduce, 1, h); - + if(worldObj.rand.nextInt(3) == 0) reduce++; - + boolean corium = slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod; - - if(corium && slots[0].getItem() == ModItems.rbmk_fuel_drx) + + if(corium && slots[0].getItem() == ModItems.rbmk_fuel_drx) RBMKBase.digamma = true; - + slots[0] = null; if(corium) { - + for(int i = h; i >= 0; i--) { worldObj.setBlock(xCoord, yCoord + i, zCoord, ModBlocks.corium_block, 5, 3); worldObj.markBlockForUpdate(xCoord, yCoord + i, zCoord); } - + int count = 1 + worldObj.rand.nextInt(RBMKDials.getColumnHeight(worldObj)); - + for(int i = 0; i < count; i++) { spawnDebris(DebrisType.FUEL); } } else { this.standardMelt(reduce); } - + if(moderated) { - + int count = 2 + worldObj.rand.nextInt(2); - + for(int i = 0; i < count; i++) { spawnDebris(DebrisType.GRAPHITE); } } - + spawnDebris(DebrisType.ELEMENT); - + if(this.getBlockMetadata() == RBMKBase.DIR_NORMAL_LID.ordinal() + RBMKBase.offset) spawnDebris(DebrisType.LID); } + @Override + public RBMKNeutronHandler.RBMKType getRBMKType() { + return RBMKNeutronHandler.RBMKType.ROD; + } + @Override public ColumnType getConsoleType() { return ColumnType.FUEL; @@ -352,9 +335,9 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM @Override public NBTTagCompound getNBTForConsole() { NBTTagCompound data = new NBTTagCompound(); - + if(slots[0] != null && slots[0].getItem() instanceof ItemRBMKRod) { - + ItemRBMKRod rod = ((ItemRBMKRod)slots[0].getItem()); data.setDouble("enrichment", rod.getEnrichment(slots[0])); data.setDouble("xenon", rod.getPoison(slots[0])); @@ -362,7 +345,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM data.setDouble("c_coreHeat", rod.getCoreHeat(slots[0])); data.setDouble("c_maxHeat", rod.meltingPoint); } - + return data; } @@ -392,7 +375,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM slots[0] = null; this.markDirty(); } - + // do some opencomputer stuff @Override @Optional.Method(modid = "OpenComputers") @@ -408,16 +391,16 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM @Callback(direct = true) @Optional.Method(modid = "OpenComputers") - public Object[] getFluxSlow(Context context, Arguments args) { - return new Object[] {fluxSlow}; + public Object[] getFluxQuantity(Context context, Arguments args) { + return new Object[] {fluxQuantity}; } @Callback(direct = true) @Optional.Method(modid = "OpenComputers") - public Object[] getFluxFast(Context context, Arguments args) { - return new Object[] {fluxFast}; + public Object[] getFluxRatio(Context context, Arguments args) { + return new Object[] {fluxRatio}; } - + @Callback(direct = true) @Optional.Method(modid = "OpenComputers") public Object[] getDepletion(Context context, Arguments args) { @@ -479,7 +462,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM return new Object[] { heat, returnValues.get(0), returnValues.get(1), - fluxSlow, fluxFast, returnValues.get(2), returnValues.get(3), returnValues.get(4), + fluxQuantity, fluxRatio, returnValues.get(2), returnValues.get(3), returnValues.get(4), ((RBMKRod)this.getBlockType()).moderated, xCoord, yCoord, zCoord}; } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java index e8e284a07..a23c5f2e3 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRodReaSim.java @@ -1,11 +1,16 @@ package com.hbm.tileentity.machine.rbmk; +import com.hbm.handler.neutron.NeutronNodeWorld; +import com.hbm.handler.neutron.RBMKNeutronHandler; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; +import com.hbm.util.fauxpointtwelve.BlockPos; import net.minecraft.util.Vec3; +import static com.hbm.handler.neutron.RBMKNeutronHandler.*; + public class TileEntityRBMKRodReaSim extends TileEntityRBMKRod { - + public TileEntityRBMKRodReaSim() { super(); } @@ -14,42 +19,37 @@ public class TileEntityRBMKRodReaSim extends TileEntityRBMKRod { public String getName() { return "container.rbmkReaSim"; } - + + private BlockPos pos; + @Override - protected void spreadFlux(NType type, double fluxOut) { + public void spreadFlux(double flux, double ratio) { + + if(pos == null) + pos = new BlockPos(this); + + if (flux == 0) { + // simple way to remove the node from the cache when no flux is going into it! + NeutronNodeWorld.removeNode(pos); + return; + } + + RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(pos); + + if(node == null) { + node = makeNode(this); + NeutronNodeWorld.addNode(node); + } - int range = RBMKDials.getReaSimRange(worldObj); int count = RBMKDials.getReaSimCount(worldObj); - - Vec3 dir = Vec3.createVectorHelper(1, 0, 0); - - for(int i = 0; i < count; i++) { - - stream = type; - double flux = fluxOut * RBMKDials.getReaSimOutputMod(worldObj); - - dir.rotateAroundY((float)(Math.PI * 2D * worldObj.rand.nextDouble())); - - for(int j = 1; j <= range; j++) { - int x = (int)Math.floor(0.5 + dir.xCoord * j); - int z = (int)Math.floor(0.5 + dir.zCoord * j); - int lastX = (int)Math.floor(0.5 + dir.xCoord * (j - 1)); - int lastZ = (int)Math.floor(0.5 + dir.zCoord * (j - 1)); - - //skip if the position is on the rod itself - if(x == 0 && z == 0) - continue; - - //skip if the current position is equal to the last position - if(x == lastX && z == lastZ) - continue; - - flux = runInteraction(xCoord + x, yCoord, zCoord + z, flux); - - if(flux <= 0) - break; - } + for (int i = 0; i < count; i++) { + Vec3 neutronVector = Vec3.createVectorHelper(1, 0, 0); + + neutronVector.rotateAroundY((float)(Math.PI * 2D * worldObj.rand.nextDouble())); + + new RBMKNeutronHandler.RBMKNeutronStream(makeNode(this), neutronVector, flux, ratio); + // Create new neutron streams } } diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKSlottedBase.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKSlottedBase.java index 5b2e0b519..0ebc3d3dc 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKSlottedBase.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKSlottedBase.java @@ -1,15 +1,11 @@ package com.hbm.tileentity.machine.rbmk; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; import com.hbm.tileentity.IGUIProvider; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.fluids.FluidTank; /** * Base class for RBMK components that have GUI slots and thus have to handle @@ -124,23 +120,6 @@ public abstract class TileEntityRBMKSlottedBase extends TileEntityRBMKActiveBase return new int[] {}; } - public int getGaugeScaled(int i, FluidTank tank) { - return tank.getFluidAmount() * i / tank.getCapacity(); - } - - public void networkPack(NBTTagCompound nbt, int range) { - - if(!worldObj.isRemote) - PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - } - - public void handleButtonPacket(int value, int meta) { - } - @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKStorage.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKStorage.java index 4177df02e..2fab338a9 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKStorage.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKStorage.java @@ -1,5 +1,6 @@ package com.hbm.tileentity.machine.rbmk; +import com.hbm.handler.neutron.RBMKNeutronHandler; import com.hbm.inventory.container.ContainerRBMKStorage; import com.hbm.inventory.gui.GUIRBMKStorage; import com.hbm.items.machine.ItemRBMKRod; @@ -39,6 +40,11 @@ public class TileEntityRBMKStorage extends TileEntityRBMKSlottedBase implements super.updateEntity(); } + @Override + public RBMKNeutronHandler.RBMKType getRBMKType() { + return RBMKNeutronHandler.RBMKType.OTHER; + } + @Override public ColumnType getConsoleType() { return ColumnType.STORAGE; diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java index 7b3a05182..fcffc21d1 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java @@ -44,7 +44,7 @@ import java.util.Set; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")}) public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiver, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { - + public FluidTank tank; public short mode = 0; public static final short modes = 4; @@ -75,12 +75,12 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom @Override public long getDemand(FluidType type, int pressure) { - + if(this.mode == 2 || this.mode == 3 || this.sendingBrake) return 0; - + if(tank.getPressure() != pressure) return 0; - + return type == tank.getTankType() ? tank.getMaxFill() - tank.getFill() : 0; } @@ -94,7 +94,7 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom @Override public void updateEntity() { - + if(!worldObj.isRemote) { byte comp = this.getComparatorPower(); //do comparator shenanigans @@ -107,15 +107,15 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom tank.setType(0, 1, slots); tank.loadTank(2, 3, slots); tank.unloadTank(4, 5, slots); - + this.sendingBrake = true; tank.setFill(transmitFluidFairly(worldObj, tank, this, tank.getFill(), this.mode == 0 || this.mode == 1, this.mode == 1 || this.mode == 2, getConPos())); this.sendingBrake = false; - + if(tank.getFill() > 0) { checkFluidInteraction(); } - + this.networkPackNT(50); } } @@ -126,14 +126,14 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom buf.writeShort(mode); tank.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); mode = buf.readShort(); tank.deserialize(buf); } - + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X), @@ -144,18 +144,18 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z) }; } - + protected static int transmitFluidFairly(World world, FluidTank tank, IFluidConnector that, int fill, boolean connect, boolean send, DirPos[] connections) { - + Set nets = new HashSet<>(); Set consumers = new HashSet<>(); FluidType type = tank.getTankType(); int pressure = tank.getPressure(); - + for(DirPos pos : connections) { - + TileEntity te = world.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); - + if(te instanceof IFluidConductor) { IFluidConductor con = (IFluidConductor) te; if(con.getPipeNet(type) != null) { @@ -163,13 +163,13 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom con.getPipeNet(type).unsubscribe(that); consumers.addAll(con.getPipeNet(type).getSubscribers()); } - + //if it's just a consumer, buffer it as a subscriber } else if(te instanceof IFluidConnector) { consumers.add((IFluidConnector) te); } } - + consumers.remove(that); if(fill > 0 && send) { @@ -177,24 +177,24 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom con.addAll(consumers); con.removeIf(x -> x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid()); - + if(PipeNet.trackingInstances == null) { PipeNet.trackingInstances = new ArrayList<>(); } - + PipeNet.trackingInstances.clear(); nets.forEach(x -> { if(x instanceof PipeNet) PipeNet.trackingInstances.add((PipeNet) x); }); - + fill = (int) PipeNet.fairTransfer(con, type, pressure, fill); } - + //resubscribe to buffered nets, if necessary if(connect) { nets.forEach(x -> x.subscribe(that)); } - + return fill; } @@ -208,7 +208,7 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom //if content is above 0 but still within capacity if(i == 2 && content > 0 && content <= tank.getMaxFill()) return true; - + return false; } @@ -221,23 +221,23 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom public int[] getAccessibleSlotsFromSide(int p_94128_1_) { return new int[] {2, 3, 4, 5}; } - + public void checkFluidInteraction() { - + Block b = this.getBlockType(); - + //for when you fill antimatter into a matter tank if(b != ModBlocks.barrel_antimatter && tank.getTankType().isAntimatter()) { worldObj.func_147480_a(xCoord, yCoord, zCoord, false); worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 5, true, true); } - + //for when you fill hot or corrosive liquids into a plastic tank if(b == ModBlocks.barrel_plastic && (tank.getTankType().isCorrosive() || tank.getTankType().isHot())) { worldObj.func_147480_a(xCoord, yCoord, zCoord, false); worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 1.0F, 1.0F); } - + //for when you fill corrosive liquid into an iron tank if((b == ModBlocks.barrel_iron && tank.getTankType().isCorrosive()) || (b == ModBlocks.barrel_steel && tank.getTankType().hasTrait(FT_Corrosive.class) && tank.getTankType().getTrait(FT_Corrosive.class).getRating() > 50)) { @@ -245,16 +245,16 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom this.slots = new ItemStack[6]; worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.barrel_corroded); TileEntityBarrel barrel = (TileEntityBarrel)worldObj.getTileEntity(xCoord, yCoord, zCoord); - + if(barrel != null) { barrel.tank.setTankType(tank.getTankType()); barrel.tank.setFill(Math.min(barrel.tank.getMaxFill(), tank.getFill())); barrel.slots = copy; } - + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 1.0F, 1.0F); } - + if(b == ModBlocks.barrel_corroded ) { if(worldObj.rand.nextInt(3) == 0) { tank.setFill(tank.getFill() - 1); @@ -262,29 +262,29 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom } if(worldObj.rand.nextInt(3 * 60 * 20) == 0) worldObj.func_147480_a(xCoord, yCoord, zCoord, false); } - + //For when Tom's firestorm hits a barrel full of water if(tank.getTankType() == Fluids.WATER && TomSaveData.forWorld(worldObj).fire > 1e-5) { int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord); - + if(light > 7) { worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 5, true, true); } } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + mode = nbt.getShort("mode"); tank.readFromNBT(nbt, "tank"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setShort("mode", mode); tank.writeToNBT(nbt, "tank"); } diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java index f9a00332e..61acde31f 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java @@ -2,12 +2,9 @@ package com.hbm.tileentity.machine.storage; import com.hbm.inventory.container.ContainerFileCabinet; import com.hbm.inventory.gui.GUIFileCabinet; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IGUIProvider; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -19,7 +16,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIProvider, IBufPacketReceiver { - + private int timer = 0; private int playersUsing = 0; //meh, it's literally just two extra variables @@ -27,16 +24,16 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr public float prevLowerExtent = 0; public float upperExtent = 0; public float prevUpperExtent = 0; - + public TileEntityFileCabinet() { super(8); } - + @Override public String getInventoryName() { return "container.fileCabinet"; } - + @Override public void openInventory() { if(!worldObj.isRemote) this.playersUsing++; @@ -51,64 +48,64 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr buf.writeInt(timer); buf.writeInt(playersUsing); } - + @Override public void deserialize(ByteBuf buf) { timer = buf.readInt(); playersUsing = buf.readInt(); } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(this.playersUsing > 0) { if(timer < 10) { timer++; } } else timer = 0; - - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 25)); + + networkPackNT(25); } else { this.prevLowerExtent = lowerExtent; this.prevUpperExtent = upperExtent; } - + float openSpeed = playersUsing > 0 ? 1F / 16F : 1F / 25F; float maxExtent = 0.8F; - + if(this.playersUsing > 0) { if(lowerExtent == 0F && upperExtent == 0F) this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.8F, 1.0F); else { if(upperExtent + openSpeed >= maxExtent && lowerExtent < maxExtent) this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F); - + if(lowerExtent + openSpeed >= maxExtent && lowerExtent < maxExtent) this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F); } - + this.lowerExtent += openSpeed; - + if(timer >= 10) this.upperExtent += openSpeed; - + } else if(lowerExtent > 0) { if(upperExtent - openSpeed < maxExtent / 2 && upperExtent >= maxExtent / 2 && upperExtent != lowerExtent) this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F); - + if(lowerExtent - openSpeed < maxExtent / 2 && lowerExtent >= maxExtent / 2) this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F); - + this.upperExtent -= openSpeed; this.lowerExtent -= openSpeed; } - + this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, maxExtent); this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, maxExtent); } - + @Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerFileCabinet(player.inventory, this); @@ -125,7 +122,7 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr public boolean isItemValidForSlot(int i, ItemStack stack) { return false; } - + @Override public boolean canInsertItem(int i, ItemStack itemStack, int j) { return false; @@ -135,12 +132,12 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr public boolean canExtractItem(int i, ItemStack itemStack, int j) { return false; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -151,10 +148,10 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr zCoord + 1 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMassStorage.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMassStorage.java index c01333108..d0d5abda5 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMassStorage.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMassStorage.java @@ -3,11 +3,13 @@ package com.hbm.tileentity.machine.storage; import com.hbm.inventory.container.ContainerMassStorage; import com.hbm.inventory.gui.GUIMassStorage; import com.hbm.items.ModItems; +import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IControlReceiverFilter; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.util.BufferUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -15,19 +17,19 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPacketReceiver, IControlReceiverFilter { - +public class TileEntityMassStorage extends TileEntityCrateBase implements IBufPacketReceiver, IControlReceiverFilter { + private int stack = 0; public boolean output = false; private int capacity; public int redstone = 0; - + @SideOnly(Side.CLIENT) public ItemStack type; - + public TileEntityMassStorage() { super(3); } - + public TileEntityMassStorage(int capacity) { this(); this.capacity = capacity; @@ -37,83 +39,85 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPa public String getInventoryName() { return "container.massStorage"; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + int newRed = this.getStockpile() * 15 / this.capacity; - + if(newRed != this.redstone) { this.redstone = newRed; this.markDirty(); } - + if(slots[0] != null && slots[0].getItem() == ModItems.fluid_barrel_infinite) { this.stack = this.getCapacity(); } - + if(this.getType() == null) this.stack = 0; - + if(getType() != null && getStockpile() < getCapacity() && slots[0] != null && slots[0].isItemEqual(getType()) && ItemStack.areItemStackTagsEqual(slots[0], getType())) { - + int remaining = getCapacity() - getStockpile(); int toRemove = Math.min(remaining, slots[0].stackSize); this.decrStackSize(0, toRemove); this.stack += toRemove; this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); } - + if(output && getType() != null) { - + if(slots[2] != null && !(slots[2].isItemEqual(getType()) && ItemStack.areItemStackTagsEqual(slots[2], getType()))) { return; } - + int amount = Math.min(getStockpile(), getType().getMaxStackSize()); - + if(amount > 0) { if(slots[2] == null) { slots[2] = slots[1].copy(); slots[2].stackSize = amount; - this.stack -= amount; } else { amount = Math.min(amount, slots[2].getMaxStackSize() - slots[2].stackSize); slots[2].stackSize += amount; - this.stack -= amount; } + this.stack -= amount; } } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("stack", getStockpile()); - data.setBoolean("output", output); - if(slots[1] != null) slots[1].writeToNBT(data); - INBTPacketReceiver.networkPack(this, data, 15); + + networkPackNT(15); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.stack = nbt.getInteger("stack"); - this.output = nbt.getBoolean("output"); - this.type = ItemStack.loadItemStackFromNBT(nbt); + public void serialize(ByteBuf buf) { + buf.writeInt(this.stack); + buf.writeBoolean(this.output); + BufferUtil.writeItemStack(buf, this.slots[1]); } - + + @Override + public void deserialize(ByteBuf buf) { + this.stack = buf.readInt(); + this.output = buf.readBoolean(); + this.type = BufferUtil.readItemStack(buf); + } + public int getCapacity() { return capacity; } - + public ItemStack getType() { return slots[1] == null ? null : slots[1].copy(); } - + public int getStockpile() { return stack; } - + public void setStockpile(int stack) { this.stack = stack; } @@ -140,7 +144,7 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPa this.output = nbt.getBoolean("output"); this.capacity = nbt.getInteger("capacity"); this.redstone = nbt.getByte("redstone"); - + if(this.capacity <= 0) { this.capacity = 10_000; } @@ -162,31 +166,30 @@ public class TileEntityMassStorage extends TileEntityCrateBase implements INBTPa @Override public void receiveControl(NBTTagCompound data) { - + if(data.hasKey("provide") && slots[1] != null) { - + if(this.getStockpile() == 0) { return; } - + int amount = data.getBoolean("provide") ? slots[1].getMaxStackSize() : 1; amount = Math.min(amount, getStockpile()); - + if(slots[2] != null && !(slots[2].isItemEqual(getType()) && ItemStack.areItemStackTagsEqual(slots[2], getType()))) { return; } - + if(slots[2] == null) { slots[2] = slots[1].copy(); slots[2].stackSize = amount; - this.stack -= amount; } else { amount = Math.min(amount, slots[2].getMaxStackSize() - slots[2].stackSize); slots[2].stackSize += amount; - this.stack -= amount; } + this.stack -= amount; } - + if(data.hasKey("toggle")) { this.output = !output; } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCableBaseNT.java b/src/main/java/com/hbm/tileentity/network/TileEntityCableBaseNT.java index 8afaeb73c..d88b68cc5 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCableBaseNT.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCableBaseNT.java @@ -3,23 +3,23 @@ package com.hbm.tileentity.network; import api.hbm.energymk2.IEnergyConductorMK2; import api.hbm.energymk2.Nodespace; import api.hbm.energymk2.Nodespace.PowerNode; -import net.minecraft.tileentity.TileEntity; +import com.hbm.tileentity.TileEntityLoadedBase; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityCableBaseNT extends TileEntity implements IEnergyConductorMK2 { - +public class TileEntityCableBaseNT extends TileEntityLoadedBase implements IEnergyConductorMK2 { + protected PowerNode node; @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(this.node == null || this.node.expired) { - + if(this.shouldCreateNode()) { this.node = Nodespace.getNode(worldObj, xCoord, yCoord, zCoord); - + if(this.node == null || this.node.expired) { this.node = this.createNode(); Nodespace.createNode(worldObj, this.node); @@ -28,11 +28,11 @@ public class TileEntityCableBaseNT extends TileEntity implements IEnergyConducto } } } - + public boolean shouldCreateNode() { return true; } - + public void onNodeDestroyedCallback() { this.node = null; } @@ -40,7 +40,7 @@ public class TileEntityCableBaseNT extends TileEntity implements IEnergyConducto @Override public void invalidate() { super.invalidate(); - + if(!worldObj.isRemote) { if(this.node != null) { Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord); diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneBoxer.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneBoxer.java index 32032c87d..01a312685 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneBoxer.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneBoxer.java @@ -8,6 +8,7 @@ import com.hbm.inventory.gui.GUICraneBoxer; import com.hbm.tileentity.IGUIProvider; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -142,17 +143,21 @@ public class TileEntityCraneBoxer extends TileEntityCraneBase implements IGUIPro worldObj.spawnEntityInWorld(moving); } } - - NBTTagCompound data = new NBTTagCompound(); - data.setByte("mode", mode); - this.networkPack(data, 15); + + this.networkPackNT(15); } } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.mode = nbt.getByte("mode"); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeByte(this.mode); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.mode = buf.readByte(); } @Override diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java index da1fba418..61d9df4de 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java @@ -14,6 +14,7 @@ import com.hbm.util.InventoryUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -54,9 +55,9 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP public void updateEntity() { super.updateEntity(); if(!worldObj.isRemote) { - + int delay = 20; - + if(slots[10] != null && slots[10].getItem() == ModItems.upgrade_ejector) { switch(slots[10].getItemDamage()) { case 0: delay = 10; break; @@ -64,10 +65,10 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP case 2: delay = 2; break; } } - + if(worldObj.getTotalWorldTime() >= lastGrabbedTick + delay && !this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { int amount = 1; - + if(slots[9] != null && slots[9].getItem() == ModItems.upgrade_stack) { switch(slots[9].getItemDamage()) { case 0: amount = 4; break; @@ -75,15 +76,15 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP case 2: amount = 64; break; } } - + ForgeDirection inputSide = getInputSide(); ForgeDirection outputSide = getOutputSide(); Block beltBlock = worldObj.getBlock(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ); - + //unholy copy paste bullshit because i can't be assed to rework the entire thing if(beltBlock instanceof IConveyorBelt) { IConveyorBelt belt = (IConveyorBelt) beltBlock; - + double reach = 1D; if(this.getBlockMetadata() > 1) { //ignore if pointing up or down Block b = worldObj.getBlock(xCoord + inputSide.offsetX, yCoord + inputSide.offsetY, zCoord + inputSide.offsetZ); @@ -94,14 +95,14 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP double x = xCoord + inputSide.offsetX * reach; double y = yCoord + inputSide.offsetY * reach; double z = zCoord + inputSide.offsetZ * reach; - + List items = worldObj.getEntitiesWithinAABB(EntityMovingItem.class, AxisAlignedBB.getBoundingBox(x + 0.1875D, y + 0.1875D, z + 0.1875D, x + 0.8125D, y + 0.8125D, z + 0.8125D)); - + for(EntityMovingItem item : items) { ItemStack stack = item.getItemStack(); boolean match = this.matchesFilter(stack); if(this.isWhitelist && !match || !this.isWhitelist && match) continue; - + lastGrabbedTick = worldObj.getTotalWorldTime(); Vec3 pos = Vec3.createVectorHelper(xCoord + 0.5 + outputSide.offsetX * 0.55, yCoord + 0.5 + outputSide.offsetY * 0.55, zCoord + 0.5 + outputSide.offsetZ * 0.55); @@ -109,21 +110,21 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP item.setPosition(snap.xCoord, snap.yCoord, snap.zCoord); break; } - + } else { - + TileEntity te = worldObj.getTileEntity(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ); - + int[] access = null; ISidedInventory sided = null; - + if(te instanceof ISidedInventory) { sided = (ISidedInventory) te; access = InventoryUtil.masquerade(sided, outputSide.getOpposite().ordinal()); } - + if(te instanceof IInventory) { - + /* * due to this really primitive way of just offsetting the AABB instead of contracting it, there's a wacky * edge-case where it's possible to feed the grabber by inserting items from the side if there's a triple @@ -136,30 +137,30 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP if(b == ModBlocks.conveyor_double) reach = 0.5D; if(b == ModBlocks.conveyor_triple) reach = 0.33D; } - + double x = xCoord + inputSide.offsetX * reach; double y = yCoord + inputSide.offsetY * reach; double z = zCoord + inputSide.offsetZ * reach; List items = worldObj.getEntitiesWithinAABB(EntityMovingItem.class, AxisAlignedBB.getBoundingBox(x + 0.1875D, y + 0.1875D, z + 0.1875D, x + 0.8125D, y + 0.8125D, z + 0.8125D)); - + for(EntityMovingItem item : items) { ItemStack stack = item.getItemStack(); boolean match = this.matchesFilter(stack); if(this.isWhitelist && !match || !this.isWhitelist && match) continue; - + lastGrabbedTick = worldObj.getTotalWorldTime(); - + ItemStack copy = stack.copy(); int toAdd = Math.min(stack.stackSize, amount); copy.stackSize = toAdd; ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, copy, outputSide.getOpposite().ordinal()); int didAdd = toAdd - (ret != null ? ret.stackSize : 0); stack.stackSize -= didAdd; - + if(stack.stackSize <= 0) { item.setDead(); } - + amount -= didAdd; if(amount <= 0) { break; @@ -168,32 +169,35 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP } } } - - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("isWhitelist", isWhitelist); - this.matcher.writeToNBT(data); - this.networkPack(data, 15); + + this.networkPackNT(15); } } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.isWhitelist = nbt.getBoolean("isWhitelist"); - this.matcher.modes = new String[matcher.modes.length]; - this.matcher.readFromNBT(nbt); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeBoolean(this.isWhitelist); + this.matcher.serialize(buf); } - + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.isWhitelist = buf.readBoolean(); + this.matcher.deserialize(buf); + } + public boolean matchesFilter(ItemStack stack) { - + for(int i = 0; i < 9; i++) { ItemStack filter = slots[i]; - + if(filter != null && this.matcher.isValidForFilter(filter, i, stack)) { return true; } } - + return false; } @@ -207,7 +211,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUICraneGrabber(player.inventory, this); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -215,7 +219,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP this.matcher.readFromNBT(nbt); this.lastGrabbedTick = nbt.getLong("lastGrabbedTick"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneRouter.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneRouter.java index 3307a4b76..6397584ea 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneRouter.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneRouter.java @@ -7,8 +7,10 @@ import com.hbm.tileentity.IControlReceiverFilter; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; @@ -45,26 +47,28 @@ public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUI if(!worldObj.isRemote) { - NBTTagCompound data = new NBTTagCompound(); - for(int i = 0; i < patterns.length; i++) { - NBTTagCompound compound = new NBTTagCompound(); - patterns[i].writeToNBT(compound); - data.setTag("pattern" + i, compound); - } - data.setIntArray("modes", this.modes); - this.networkPack(data, 15); + this.networkPackNT(15); } } - + @Override - public void networkUnpack(NBTTagCompound data) { - super.networkUnpack(data); - - for(int i = 0; i < patterns.length; i++) { - NBTTagCompound compound = data.getCompoundTag("pattern" + i); - patterns[i].readFromNBT(compound); + public void serialize(ByteBuf buf) { + super.serialize(buf); + for (ModulePatternMatcher pattern : patterns) { + pattern.serialize(buf); } - this.modes = data.getIntArray("modes"); + + BufferUtil.writeIntArray(buf, this.modes); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + for (ModulePatternMatcher pattern : patterns) { + pattern.deserialize(buf); + } + + this.modes = BufferUtil.readIntArray(buf); } @Override diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityDroneCrate.java b/src/main/java/com/hbm/tileentity/network/TileEntityDroneCrate.java index bb835d1a7..fb4058296 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityDroneCrate.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityDroneCrate.java @@ -11,14 +11,15 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.gui.GUIDroneCrate; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.ParticleUtil; import com.hbm.util.fauxpointtwelve.BlockPos; import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -27,7 +28,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIProvider, INBTPacketReceiver, IControlReceiver, IDroneLinkable, IFluidStandardTransceiver, IFluidCopiable { +public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, IDroneLinkable, IFluidStandardTransceiver, IFluidCopiable { public FluidTank tank; @@ -82,26 +83,31 @@ public class TileEntityDroneCrate extends TileEntityMachineBase implements IGUIP (nextX - pos.getX()), (nextY - pos.getY()), (nextZ - pos.getZ()), 0x00ffff); } - - - NBTTagCompound data = new NBTTagCompound(); - data.setIntArray("pos", new int[] {nextX, nextY, nextZ}); - data.setBoolean("mode", sendingMode); - data.setBoolean("type", itemType); - tank.writeToNBT(data, "t"); - INBTPacketReceiver.networkPack(this, data, 25); + networkPackNT(25); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - int[] pos = nbt.getIntArray("pos"); + public void serialize(ByteBuf buf) { + BufferUtil.writeIntArray(buf, new int[] { + this.nextX, + this.nextY, + this.nextZ + }); + buf.writeBoolean(this.sendingMode); + buf.writeBoolean(this.itemType); + tank.serialize(buf); + } + + @Override + public void deserialize(ByteBuf buf) { + int[] pos = BufferUtil.readIntArray(buf); this.nextX = pos[0]; this.nextY = pos[1]; this.nextZ = pos[2]; - this.sendingMode = nbt.getBoolean("mode"); - this.itemType = nbt.getBoolean("type"); - tank.readFromNBT(nbt, "t"); + this.sendingMode = buf.readBoolean(); + this.itemType = buf.readBoolean(); + tank.deserialize(buf); } protected void loadItems(EntityDeliveryDrone drone) { diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityDroneRequester.java b/src/main/java/com/hbm/tileentity/network/TileEntityDroneRequester.java index 0d4739c96..f9a6f0a0a 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityDroneRequester.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityDroneRequester.java @@ -11,13 +11,13 @@ import com.hbm.inventory.gui.GUIDroneRequester; import com.hbm.module.ModulePatternMatcher; import com.hbm.tileentity.IControlReceiverFilter; import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.INBTPacketReceiver; import com.hbm.tileentity.network.RequestNetwork.PathNode; import com.hbm.tileentity.network.RequestNetwork.RequestNode; import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -26,8 +26,8 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; -public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer implements INBTPacketReceiver, IGUIProvider, IControlReceiverFilter { - +public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer implements IGUIProvider, IControlReceiverFilter { + public ModulePatternMatcher matcher; public TileEntityDroneRequester() { @@ -39,22 +39,23 @@ public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer public String getName() { return "container.droneRequester"; } - + @Override public void updateEntity() { super.updateEntity(); - + if(!worldObj.isRemote) { - - NBTTagCompound data = new NBTTagCompound(); - this.matcher.writeToNBT(data); - INBTPacketReceiver.networkPack(this, data, 15); + + networkPackNT(15); } } - @Override - public void networkUnpack(NBTTagCompound nbt) { - this.matcher.readFromNBT(nbt); + @Override public void serialize(ByteBuf buf) { + this.matcher.serialize(buf); + } + + @Override public void deserialize(ByteBuf buf) { + this.matcher.deserialize(buf); } @Override @@ -76,13 +77,13 @@ public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer public boolean canExtractItem(int i, ItemStack stack, int j) { return true; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.matcher.readFromNBT(nbt); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -109,7 +110,7 @@ public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer if(filter == null) continue; String mode = this.matcher.modes[i]; AStack aStack = null; - + if(ModulePatternMatcher.MODE_EXACT.equals(mode)) { aStack = new ComparableStack(filter).makeSingular(); } else if(ModulePatternMatcher.MODE_WILDCARD.equals(mode)) { @@ -117,9 +118,9 @@ public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer } else if(mode != null) { aStack = new OreDictStack(mode); } - + if(aStack == null) continue; - + if(stock == null || !this.matcher.isValidForFilter(filter, i, stock)) request.add(aStack); } return new RequestNode(pos, this.reachableNodes, request); diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityDroneWaypoint.java b/src/main/java/com/hbm/tileentity/network/TileEntityDroneWaypoint.java index 33b68fc4e..99908ee14 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityDroneWaypoint.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityDroneWaypoint.java @@ -3,23 +3,19 @@ package com.hbm.tileentity.network; import java.util.List; import com.hbm.entity.item.EntityDeliveryDrone; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.ParticleUtil; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.BufPacket; -import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.util.fauxpointtwelve.BlockPos; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketReceiver, IDroneLinkable { - +public class TileEntityDroneWaypoint extends TileEntityLoadedBase implements IDroneLinkable { + public int height = 5; public int nextX = -1; public int nextY = -1; @@ -28,7 +24,7 @@ public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketRec @Override public void updateEntity() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); - + if(!worldObj.isRemote) { if(nextY != -1) { List drones = worldObj.getEntitiesWithinAABB(EntityDeliveryDrone.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).offset(dir.offsetX * height, dir.offsetY * height, dir.offsetZ * height)); @@ -39,14 +35,14 @@ public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketRec } } - PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15)); + networkPackNT(15); } else { BlockPos pos = getCoord(dir); if(nextY != -1 && worldObj.getTotalWorldTime() % 2 == 0) { double x = xCoord + height * dir.offsetX + 0.5; double y = yCoord + height * dir.offsetY + 0.5; double z = zCoord + height * dir.offsetZ + 0.5; - + worldObj.spawnParticle("reddust", x, y, z, 0, 0, 0); ParticleUtil.spawnDroneLine(worldObj, @@ -63,7 +59,7 @@ public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketRec buf.writeInt(nextY); buf.writeInt(nextZ); } - + @Override public void deserialize(ByteBuf buf) { height = buf.readInt(); @@ -85,12 +81,12 @@ public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketRec this.nextZ = z; this.markDirty(); } - + public void addHeight(int h) { height += h; height = MathHelper.clamp_int(height, 1, 15); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -101,7 +97,7 @@ public class TileEntityDroneWaypoint extends TileEntity implements IBufPacketRec this.nextY = pos[1]; this.nextZ = pos[2]; } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPipeBaseNT.java b/src/main/java/com/hbm/tileentity/network/TileEntityPipeBaseNT.java index 340a47ab0..ea26263ba 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPipeBaseNT.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPipeBaseNT.java @@ -11,6 +11,7 @@ import api.hbm.fluid.IPipeNet; import api.hbm.fluid.PipeNet; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.tileentity.IFluidCopiable; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.util.Compat; import net.minecraft.entity.player.EntityPlayer; @@ -23,8 +24,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, IFluidCopiable { - +public class TileEntityPipeBaseNT extends TileEntityLoadedBase implements IFluidConductor, IFluidCopiable { + protected IPipeNet network; protected FluidType type = Fluids.NONE; protected FluidType lastType = Fluids.NONE; @@ -36,59 +37,59 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); lastType = type; } - + if(!worldObj.isRemote && shouldConnect()) { - + //we got here either because the net doesn't exist or because it's not valid, so that's safe to assume this.setPipeNet(type, null); - + this.connect(); - + if(this.getPipeNet(type) == null) { this.setPipeNet(type, new PipeNet(type).joinLink(this)); } } } - + public FluidType getType() { return this.type; } - + public void setType(FluidType type) { this.type = type; this.markDirty(); - + if(worldObj instanceof WorldServer) { WorldServer world = (WorldServer) worldObj; world.getPlayerManager().markBlockForUpdate(xCoord, yCoord, zCoord); } - + if(this.network != null) this.network.destroy(); } - + @Override public boolean canConnect(FluidType type, ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && type == this.type; } - + protected void connect() { - + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - + TileEntity te = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); - + if(te instanceof IFluidConductor) { - + IFluidConductor conductor = (IFluidConductor) te; - + if(!conductor.canConnect(type, dir.getOpposite())) continue; - + if(this.getPipeNet(type) == null && conductor.getPipeNet(type) != null) { conductor.getPipeNet(type).joinLink(this); } - + if(this.getPipeNet(type) != null && conductor.getPipeNet(type) != null && this.getPipeNet(type) != conductor.getPipeNet(type)) { conductor.getPipeNet(type).joinNetworks(this.getPipeNet(type)); } @@ -99,7 +100,7 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, @Override public void invalidate() { super.invalidate(); - + if(!worldObj.isRemote) { if(this.network != null) { this.network.destroy(); @@ -116,10 +117,10 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, @Override public long transferFluid(FluidType type, int pressure, long fluid) { - + if(this.network == null) return fluid; - + return this.network.transferFluid(fluid, pressure); } @@ -144,7 +145,7 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, this.writeToNBT(nbt); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); @@ -163,7 +164,7 @@ public class TileEntityPipeBaseNT extends TileEntity implements IFluidConductor, } public boolean isLoaded = true; - + @Override public boolean isLoaded() { return isLoaded; diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java index 86a0fc4d4..3db91ad96 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java @@ -7,13 +7,15 @@ import com.hbm.handler.CompatHandler; import com.hbm.interfaces.IControlReceiver; import com.hbm.inventory.gui.GuiScreenRadioTelex; import com.hbm.tileentity.IGUIProvider; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.network.RTTYSystem.RTTYChannel; +import com.hbm.util.BufferUtil; import com.hbm.util.ItemStackUtil; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -24,12 +26,11 @@ import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiver, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent { +public class TileEntityRadioTelex extends TileEntityLoadedBase implements IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent { public static final int lineWidth = 33; public String txChannel = ""; @@ -51,24 +52,24 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv public static final char print = '\u000c'; public static final char pause = '\u0016'; public static final char clear = '\u007f'; - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + this.sendingChar = ' '; - + if(this.isSending && this.txChannel.isEmpty()) this.isSending = false; - + if(this.isSending) { - + if(sendingWait > 0) { sendingWait--; } else { - + String line = txBuffer[sendingLine]; - + if(line.length() > sendingIndex) { char c = line.charAt(sendingIndex); sendingIndex++; @@ -79,7 +80,7 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv this.sendingChar = c; } } else { - + if(sendingLine >= 4) { this.isSending = false; RTTYSystem.broadcast(worldObj, this.txChannel, eot); @@ -93,19 +94,19 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv } } } - + if(!this.rxChannel.isEmpty()) { RTTYChannel chan = RTTYSystem.listen(worldObj, this.rxChannel); - + if(chan != null && chan.signal instanceof Character && (chan.timeStamp > worldObj.getTotalWorldTime() - 2 && chan.timeStamp != -1)) { char c = (char) chan.signal; - + if(this.deleteOnReceive) { this.deleteOnReceive = false; for(int i = 0; i < 5; i++) this.rxBuffer[i] = ""; this.writingLine = 0; } - + if(c == eot) { if(this.printAfterRx) { this.printAfterRx = false; @@ -128,62 +129,66 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv } } } - - NBTTagCompound data = new NBTTagCompound(); - for(int i = 0; i < 5; i++) { - data.setString("tx" + i, txBuffer[i]); - data.setString("rx" + i, rxBuffer[i]); - } - data.setString("txChan", txChannel); - data.setString("rxChan", rxChannel); - data.setInteger("sending", sendingChar); - INBTPacketReceiver.networkPack(this, data, 16); + + networkPackNT(16); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - + public void serialize(ByteBuf buf) { for(int i = 0; i < 5; i++) { - txBuffer[i] = nbt.getString("tx" + i); - rxBuffer[i] = nbt.getString("rx" + i); + BufferUtil.writeString(buf, txBuffer[i]); + BufferUtil.writeString(buf, rxBuffer[i]); } - this.txChannel = nbt.getString("txChan"); - this.rxChannel = nbt.getString("rxChan"); - this.sendingChar = (char) nbt.getInteger("sending"); + + BufferUtil.writeString(buf, this.txChannel); + BufferUtil.writeString(buf, this.rxChannel); + buf.writeChar(this.sendingChar); + } + + @Override + public void deserialize(ByteBuf buf) { + for(int i = 0; i < 5; i++) { + txBuffer[i] = BufferUtil.readString(buf); + rxBuffer[i] = BufferUtil.readString(buf); + } + + this.txChannel = BufferUtil.readString(buf); + this.rxChannel = BufferUtil.readString(buf); + this.sendingChar = buf.readChar(); } @Override public void receiveControl(NBTTagCompound data) { - + for(int i = 0; i < 5; i++) { if(data.hasKey("tx" + i)) this.txBuffer[i] = data.getString("tx" + i); } - + String cmd = data.getString("cmd"); - + if("snd".equals(cmd) && !this.isSending) { this.isSending = true; this.sendingLine = 0; this.sendingIndex = 0; } - + if("rxprt".equals(cmd)) { print(); } - + if("rxcls".equals(cmd)) { for(int i = 0; i < 5; i++) this.rxBuffer[i] = ""; this.writingLine = 0; } - + if("sve".equals(cmd)) { this.txChannel = data.getString("txChan"); this.rxChannel = data.getString("rxChan"); this.markDirty(); } } - + public void print() { ItemStack stack = new ItemStack(Items.paper); List text = new ArrayList(); @@ -215,7 +220,7 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + for(int i = 0; i < 5; i++) { nbt.setString("tx" + i, txBuffer[i]); nbt.setString("rx" + i, rxBuffer[i]); @@ -231,12 +236,12 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GuiScreenRadioTelex(this); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 1, @@ -247,10 +252,10 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv zCoord + 2 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchBase.java b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchBase.java index e881b1ecf..e63a5b6e3 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchBase.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchBase.java @@ -1,16 +1,17 @@ package com.hbm.tileentity.network; import com.hbm.interfaces.IControlReceiver; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.TileEntityLoadedBase; +import com.hbm.util.BufferUtil; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; 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; -public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketReceiver, IControlReceiver { +public class TileEntityRadioTorchBase extends TileEntityLoadedBase implements IControlReceiver { /** channel we're broadcasting on/listening to */ public String channel = ""; @@ -29,13 +30,8 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe public void updateEntity() { if(!worldObj.isRemote) { - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("p", polling); - data.setBoolean("m", customMap); - if(channel != null) data.setString("c", channel); - for(int i = 0; i < 16; i++) if(mapping[i] != null) data.setString("m" + i, mapping[i]); - INBTPacketReceiver.networkPack(this, data, 50); + + networkPackNT(50); } } @@ -62,11 +58,19 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe } @Override - public void networkUnpack(NBTTagCompound nbt) { - this.polling = nbt.getBoolean("p"); - this.customMap = nbt.getBoolean("m"); - this.channel = nbt.getString("c"); - for(int i = 0; i < 16; i++) this.mapping[i] = nbt.getString("m" + i); + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.polling); + buf.writeBoolean(this.customMap); + BufferUtil.writeString(buf, this.channel); + for(int i = 0; i < 16; i++) BufferUtil.writeString(buf, this.mapping[i]); + } + + @Override + public void deserialize(ByteBuf buf) { + this.polling = buf.readBoolean(); + this.customMap = buf.readBoolean(); + this.channel = BufferUtil.readString(buf); + for(int i = 0; i < 16; i++) this.mapping[i] = BufferUtil.readString(buf); } @Override @@ -75,7 +79,7 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe nbt.setByte("l", (byte) this.lastState); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { int last = this.lastState; @@ -96,7 +100,7 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe if(data.hasKey("m")) this.customMap = data.getBoolean("m"); if(data.hasKey("c")) this.channel = data.getString("c"); for(int i = 0; i < 16; i++) if(data.hasKey("m" + i)) this.mapping[i] = data.getString("m" + i); - + this.markDirty(); } } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchCounter.java b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchCounter.java index efac13a13..0bb73a49c 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchCounter.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchCounter.java @@ -3,8 +3,10 @@ package com.hbm.tileentity.network; import com.hbm.module.ModulePatternMatcher; import com.hbm.tileentity.IControlReceiverFilter; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.Compat; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -68,24 +70,27 @@ public class TileEntityRadioTorchCounter extends TileEntityMachineBase implement this.lastCount[i] = count; } } - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("polling", polling); - data.setIntArray("last", lastCount); - this.matcher.writeToNBT(data); - for(int i = 0; i < 3; i++) if(channel[i] != null) data.setString("c" + i, channel[i]); - this.networkPack(data, 15); + + this.networkPackNT(15); } } - - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.polling = nbt.getBoolean("polling"); - this.lastCount = nbt.getIntArray("last"); - this.matcher.modes = new String[this.matcher.modes.length]; - this.matcher.readFromNBT(nbt); - for(int i = 0; i < 3; i++) this.channel[i] = nbt.getString("c" + i); + + @Override + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeBoolean(this.polling); + BufferUtil.writeIntArray(buf, this.lastCount); + this.matcher.serialize(buf); + for(int i = 0; i < 3; i++) BufferUtil.writeString(buf, this.channel[i]); + } + + @Override + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.polling = buf.readBoolean(); + this.lastCount = BufferUtil.readIntArray(buf); + this.matcher.deserialize(buf); + for(int i = 0; i < 3; i++) this.channel[i] = BufferUtil.readString(buf); } @Override diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchLogic.java b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchLogic.java index 4a44c3504..82f1134cb 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchLogic.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTorchLogic.java @@ -1,18 +1,19 @@ package com.hbm.tileentity.network; import com.hbm.interfaces.IControlReceiver; -import com.hbm.tileentity.INBTPacketReceiver; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.network.RTTYSystem.RTTYChannel; +import com.hbm.util.BufferUtil; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; 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; -public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketReceiver, IControlReceiver { - +public class TileEntityRadioTorchLogic extends TileEntityLoadedBase implements IControlReceiver { + /** channel we're broadcasting on/listening to */ public String channel = ""; /** previous redstone state for input/output, needed for state change detection */ @@ -27,34 +28,34 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR public String[] mapping; /** mapping for conditions through [1, 10], being (<, <=, >=, >, ==, !=, equals, !equals, contains, !contains) */ public int[] conditions; - + public TileEntityRadioTorchLogic() { this.mapping = new String[16]; for(int i = 0; i < 16; i++) this.mapping[i] = ""; this.conditions = new int[16]; for(int i = 0; i < 16; i++) this.conditions[i] = 0; } - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(!this.channel.isEmpty()) { - + RTTYChannel chan = RTTYSystem.listen(worldObj, this.channel); - + if(chan != null && (this.polling || (chan.timeStamp > this.lastUpdate - 1 && chan.timeStamp != -1))) { // if we're either polling or a new message has come in String msg = "" + chan.signal; this.lastUpdate = worldObj.getTotalWorldTime(); int nextState = 0; //if no remap apply, default to 0 - + if(chan.timeStamp < this.lastUpdate - 2 && this.polling) { /* the vast majority use-case for this is going to be inequalities, NOT parsing, and the input is undefined - not the output * if no signal => 0 for polling, advanced users parsing strings can easily accommodate this fact instead of breaking numerical torches */ msg = "0"; } - + if(descending) { for(int i = 15; i >= 0; i--) { if(!mapping[i].equals("") && parseSignal(msg, i)) { @@ -70,7 +71,7 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR } } } - + if(this.lastState != nextState) { this.lastState = nextState; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); @@ -79,17 +80,11 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR } } } - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("p", polling); - data.setBoolean("d", descending); - if(channel != null) data.setString("c", channel); - for(int i = 0; i < 16; i++) if(!mapping[i].equals("")) data.setString("m" + i, mapping[i]); - for(int i = 0; i < 16; i++) if(conditions[i] > 0) data.setInteger("c" + i, conditions[i]); - INBTPacketReceiver.networkPack(this, data, 50); + + networkPackNT(50); } } - + public boolean parseSignal(String signal, int index) { if(conditions[index] <= 5) { //if a non-string operator int sig = 0; @@ -97,7 +92,7 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR try { sig = Integer.parseInt(signal); map = Integer.parseInt(mapping[index]); } catch(Exception x) { return false; //not a valid input; skip! slightly annoying about the mapping but we'll restrict input anyway }; - + switch(conditions[index]) { default: return sig < map; @@ -113,7 +108,7 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR return sig != map; } } - + switch(conditions[index]) { default: return signal.equals(mapping[index]); @@ -150,12 +145,22 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR for(int i = 0; i < 16; i++) if(conditions[i] > 0) nbt.setInteger("c" + i, conditions[i]); } - public void networkUnpack(NBTTagCompound nbt) { - this.polling = nbt.getBoolean("p"); - this.channel = nbt.getString("c"); - this.descending = nbt.getBoolean("d"); - for(int i = 0; i < 16; i++) this.mapping[i] = nbt.getString("m" + i); - for(int i = 0; i < 16; i++) this.conditions[i] = nbt.getInteger("c" + i); + @Override + public void serialize(ByteBuf buf) { + buf.writeBoolean(this.polling); + BufferUtil.writeString(buf, this.channel); + buf.writeBoolean(this.descending); + for(int i = 0; i < 16; i++) BufferUtil.writeString(buf, this.mapping[i]); + for(int i = 0; i < 16; i++) buf.writeInt(this.conditions[i]); + } + + @Override + public void deserialize(ByteBuf buf) { + this.polling = buf.readBoolean(); + this.channel = BufferUtil.readString(buf); + this.descending = buf.readBoolean(); + for(int i = 0; i < 16; i++) this.mapping[i] = BufferUtil.readString(buf); + for(int i = 0; i < 16; i++) this.conditions[i] = buf.readInt(); } @Override @@ -164,7 +169,7 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR nbt.setByte("l", (byte) this.lastState); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt); } - + @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { int last = this.lastState; @@ -186,7 +191,7 @@ public class TileEntityRadioTorchLogic extends TileEntity implements INBTPacketR if(data.hasKey("d")) this.descending = data.getBoolean("d"); for(int i = 0; i < 16; i++) if(data.hasKey("m" + i)) this.mapping[i] = data.getString("m" + i); for(int i = 0; i < 16; i++) if(data.hasKey("c" + i)) this.conditions[i] = data.getInteger("c" + i); - + this.markDirty(); } } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetwork.java b/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetwork.java index 35a26b5a5..7da701b58 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetwork.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetwork.java @@ -4,12 +4,12 @@ import java.util.HashMap; import java.util.Iterator; import com.hbm.interfaces.NotableComments; +import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.network.RequestNetwork.PathNode; import com.hbm.util.HashedSet; import com.hbm.util.ParticleUtil; import com.hbm.util.fauxpointtwelve.BlockPos; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.ChunkCoordIntPair; @@ -21,22 +21,22 @@ import net.minecraft.world.World; * it is all spiraling out of control * in a giant mess of nested generics, magic numbers and static global variables * may god have mercy on my soul - * + * * @author hbm * */ @NotableComments -public abstract class TileEntityRequestNetwork extends TileEntity { +public abstract class TileEntityRequestNetwork extends TileEntityLoadedBase { public HashedSet reachableNodes = new HashedSet(); public HashedSet knownNodes = new HashedSet(); public static final int maxRange = 24; - + @Override public void updateEntity() { - + if(!worldObj.isRemote) { - + if(worldObj.getTotalWorldTime() % 20 == 0) { BlockPos pos = getCoord(); @@ -44,7 +44,7 @@ public abstract class TileEntityRequestNetwork extends TileEntity { if(this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) newNode.active = false; // push new node push(worldObj, newNode); - + // remove known nodes that no longer exist // since we can assume a sane number of nodes to exist at any given time, we can run this check in full every second Iterator it = knownNodes.iterator(); @@ -58,7 +58,7 @@ public abstract class TileEntityRequestNetwork extends TileEntity { it.remove(); } } - + // draw debug crap for(PathNode known : knownNodes) { if(reachableNodes.contains(known)) ParticleUtil.spawnDroneLine(worldObj, @@ -74,41 +74,41 @@ public abstract class TileEntityRequestNetwork extends TileEntity { data.setString("text", knownNodes.size() + " / " + reachableNodes.size() + " / " + localNodes.size()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); */ - + //both following checks run the `hasPath` function which is costly, so it only runs one op at a time - + //rescan known nodes for(PathNode known : knownNodes) { - + if(!hasPath(worldObj, pos, known.pos)) { reachableNodes.remove(known); } else { reachableNodes.add(known); } } - + //discover new nodes int newNodeLimit = 5; for(PathNode node : localNodes) { - + if(!knownNodes.contains(node) && !node.equals(pos)) { newNodeLimit--; knownNodes.add(node); if(hasPath(worldObj, pos, node.pos)) reachableNodes.add(node); } - + if(newNodeLimit <= 0) break; } } } } - + public abstract PathNode createNode(BlockPos pos); - + public BlockPos getCoord() { return new BlockPos(xCoord, yCoord + 1, zCoord); } - + /** * Performs a bidirectional scan to see if the nodes have line of sight * @param world @@ -128,34 +128,31 @@ public abstract class TileEntityRequestNetwork extends TileEntity { MovingObjectPosition mop2 = world.func_147447_a(vec2, vec1, false, true, false); return (mop0 == null || mop0.typeOfHit == mop0.typeOfHit.MISS) && (mop2 == null || mop2.typeOfHit == mop2.typeOfHit.MISS); } - + /** * Adds the position to that chunk's node list. * @param world - * @param x - * @param y - * @param z */ public static void push(World world, PathNode node) { - + HashMap> coordMap = RequestNetwork.activeWaypoints.get(world); - + if(coordMap == null) { coordMap = new HashMap(); RequestNetwork.activeWaypoints.put(world, coordMap); } - + ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(node.pos.getX() >> 4, node.pos.getZ() >> 4); HashedSet posList = coordMap.get(chunkPos); - + if(posList == null) { posList = new HashedSet(); coordMap.put(chunkPos, posList); } - + posList.add(node); } - + /** * Gets all active nodes in a 5x5 chunk area, centered around the given position. * Used for finding neighbors to check connections to. @@ -171,16 +168,16 @@ public abstract class TileEntityRequestNetwork extends TileEntity { x >>= 4; z >>= 4; - + HashMap> coordMap = RequestNetwork.activeWaypoints.get(world); - + if(coordMap == null) return nodes; - + for(int i = -range; i <= range; i++) { for(int j = -range; j <= range; j++) { - + HashedSet nodeList = coordMap.get(new ChunkCoordIntPair(x + i, z + j)); - + if(nodeList != null) for(PathNode node : nodeList) { if(!pos.contains(node.pos)) { nodes.add(node); @@ -189,7 +186,7 @@ public abstract class TileEntityRequestNetwork extends TileEntity { } } } - + return nodes; } } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetworkContainer.java b/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetworkContainer.java index 28c66c658..73e07b745 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetworkContainer.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRequestNetworkContainer.java @@ -1,9 +1,5 @@ package com.hbm.tileentity.network; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.NBTPacket; - -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -106,11 +102,7 @@ public abstract class TileEntityRequestNetworkContainer extends TileEntityReques return null; } } - - public void networkPack(NBTTagCompound nbt, int range) { - if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range)); - } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java index 65d816b2a..60d4fc53d 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java @@ -19,6 +19,7 @@ import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -316,9 +317,8 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen } this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower()); - - NBTTagCompound data = this.writePacket(); - this.networkPack(data, 250); + + this.networkPackNT(250); this.didJustShoot = false; @@ -408,20 +408,17 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen } @Override - protected NBTTagCompound writePacket() { - NBTTagCompound data = super.writePacket(); - data.setShort("mode", mode); - if(didJustShoot) - data.setBoolean("didJustShoot", didJustShoot); - return data; + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeShort(this.mode); + buf.writeBoolean(this.didJustShoot); } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.mode = nbt.getShort("mode"); - if(nbt.getBoolean("didJustShoot")) - this.retracting = true; + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.mode = buf.readShort(); + this.retracting = buf.readBoolean(); } @Override diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java index 9d81ff0a5..c5e41d3b7 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java @@ -25,6 +25,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.particle.SpentCasing; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.BufferUtil; import com.hbm.util.CompatExternal; import api.hbm.energymk2.IEnergyReceiverMK2; @@ -33,6 +34,7 @@ import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -73,10 +75,10 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple @Override public void receiveControl(NBTTagCompound data) { - + if(data.hasKey("del")) { this.removeName(data.getInteger("del")); - + } else if(data.hasKey("name")) { this.addName(data.getString("name")); } @@ -99,7 +101,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public boolean aligned = false; //how many ticks until the next check public int searchTimer; - + public long power; public boolean targetPlayers = false; @@ -109,32 +111,32 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public Entity target; public Vec3 tPos; - + //tally marks! public int stattrak; public int casingDelay; protected SpentCasing cachedCasingConfig = null; - + /** * X - * + * * YYY * YYY * YYY Z - * + * * X -> ai slot (0) * Y -> ammo slots (1 - 9) * Z -> battery slot (10) */ - + public TileEntityTurretBaseNT() { super(11); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + this.power = nbt.getLong("power"); this.isOn = nbt.getBoolean("isOn"); this.targetPlayers = nbt.getBoolean("targetPlayers"); @@ -143,11 +145,11 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple this.targetMachines = nbt.getBoolean("targetMachines"); this.stattrak = nbt.getInteger("stattrak"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", this.power); nbt.setBoolean("isOn", this.isOn); nbt.setBoolean("targetPlayers", this.targetPlayers); @@ -156,81 +158,80 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple nbt.setBoolean("targetMachines", this.targetMachines); nbt.setInteger("stattrak", this.stattrak); } - + public void manualSetup() { } - + @Override public void updateEntity() { - + if(worldObj.isRemote) { this.lastRotationPitch = this.rotationPitch; this.lastRotationYaw = this.rotationYaw; this.rotationPitch = this.syncRotationPitch; this.rotationYaw = this.syncRotationYaw; } - + if(!worldObj.isRemote) { this.aligned = false; this.updateConnections(); - + if(this.target != null && !target.isEntityAlive()) { this.target = null; this.stattrak++; } - + if(target != null) { if(!this.entityInLOS(this.target)) { this.target = null; } } - + if(target != null) { this.tPos = this.getEntityPos(target); } else { this.tPos = null; } - + if(isOn() && hasPower()) { - + if(tPos != null) this.alignTurret(); } else { - + this.target = null; this.tPos = null; } - + if(this.target != null && !target.isEntityAlive()) { this.target = null; this.tPos = null; this.stattrak++; } - + if(isOn() && hasPower()) { searchTimer--; - + this.setPower(this.getPower() - this.getConsumption()); - + if(searchTimer <= 0) { searchTimer = this.getDecetorInterval(); - + if(this.target == null) this.seekNewTarget(); } } else { searchTimer = 0; } - + if(this.aligned) { this.updateFiringTick(); } - + this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower()); - - NBTTagCompound data = this.writePacket(); - this.networkPack(data, 250); - + + this.networkPackNT(250); + if(usesCasings() && this.casingDelay() > 0) { if(casingDelay > 0) { casingDelay--; @@ -238,12 +239,12 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple spawnCasing(); } } - + } else { - + //this will fix the interpolation error when the turret crosses the 360° point if(Math.abs(this.lastRotationYaw - this.rotationYaw) > Math.PI) { - + if(this.lastRotationYaw < this.rotationYaw) this.lastRotationYaw += Math.PI * 2; else @@ -251,28 +252,36 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple } } } - - protected NBTTagCompound writePacket() { - - NBTTagCompound data = new NBTTagCompound(); - if(this.tPos != null) { - data.setDouble("tX", this.tPos.xCoord); - data.setDouble("tY", this.tPos.yCoord); - data.setDouble("tZ", this.tPos.zCoord); - } - data.setDouble("pitch", this.rotationPitch); - data.setDouble("yaw", this.rotationYaw); - data.setLong("power", this.power); - data.setBoolean("isOn", this.isOn); - data.setBoolean("targetPlayers", this.targetPlayers); - data.setBoolean("targetAnimals", this.targetAnimals); - data.setBoolean("targetMobs", this.targetMobs); - data.setBoolean("targetMachines", this.targetMachines); - data.setInteger("stattrak", this.stattrak); - - return data; + + @Override + public void serialize(ByteBuf buf) { + BufferUtil.writeVec3(buf, this.tPos); + buf.writeDouble(this.rotationPitch); + buf.writeDouble(this.rotationYaw); + buf.writeLong(this.power); + buf.writeBoolean(this.isOn); + buf.writeBoolean(this.targetPlayers); + buf.writeBoolean(this.targetAnimals); + buf.writeBoolean(this.targetMobs); + buf.writeBoolean(this.targetMachines); + buf.writeInt(this.stattrak); } - + + @Override + public void deserialize(ByteBuf buf) { + this.turnProgress = 2; + this.tPos = BufferUtil.readVec3(buf); + this.syncRotationPitch = buf.readDouble(); + this.syncRotationYaw = buf.readDouble(); + this.power = buf.readLong(); + this.isOn = buf.readBoolean(); + this.targetPlayers = buf.readBoolean(); + this.targetAnimals = buf.readBoolean(); + this.targetMobs = buf.readBoolean(); + this.targetMachines = buf.readBoolean(); + this.stattrak = buf.readInt(); + } + protected void updateConnections() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); @@ -291,31 +300,9 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple this.trySubscribe(worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * -1, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * -1, dir); } - @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - - this.turnProgress = 2; - this.syncRotationPitch = nbt.getDouble("pitch"); - this.syncRotationYaw = nbt.getDouble("yaw"); - this.power = nbt.getLong("power"); - this.isOn = nbt.getBoolean("isOn"); - this.targetPlayers = nbt.getBoolean("targetPlayers"); - this.targetAnimals = nbt.getBoolean("targetAnimals"); - this.targetMobs = nbt.getBoolean("targetMobs"); - this.targetMachines = nbt.getBoolean("targetMachines"); - this.stattrak = nbt.getInteger("stattrak"); - - if(nbt.hasKey("tX")) { - this.tPos = Vec3.createVectorHelper(nbt.getDouble("tX"), nbt.getDouble("tY"), nbt.getDouble("tZ")); - } else { - this.tPos = null; - } - } - @Override public void handleButtonPacket(int value, int meta) { - + switch(meta) { case 0:this.isOn = !this.isOn; break; case 1:this.targetPlayers = !this.targetPlayers; break; @@ -324,47 +311,47 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple case 4:this.targetMachines = !this.targetMachines; break; } } - + public abstract void updateFiringTick(); - + public boolean usesCasings() { return false; } public int casingDelay() { return 0; } - + public BulletConfig getFirstConfigLoaded() { - + List list = getAmmoList(); - + if(list == null || list.isEmpty()) return null; - + //doing it like this will fire slots in the right order, not in the order of the configs //you know, the weird thing the IItemGunBase does for(int i = 1; i < 10; i++) { - + if(slots[i] != null) { - + for(Integer c : list) { //we can afford all this extra iteration trash on the count that a turret has at most like 4 bullet configs - + BulletConfig conf = BulletConfig.configs.get(c); if(conf.ammo != null && conf.ammo.matchesRecipe(slots[i], true)) return conf; } } } - + return null; } - + public void spawnBullet(BulletConfig bullet, float baseDamage) { - + Vec3 pos = this.getTurretPos(); Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0); vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - + EntityBulletBaseMK4 proj = new EntityBulletBaseMK4(worldObj, bullet, baseDamage, bullet.spread, (float) rotationYaw, (float) rotationPitch); proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, proj.rotationYaw, proj.rotationPitch); worldObj.spawnEntityInWorld(proj); - + if(usesCasings()) { if(this.casingDelay() == 0) { spawnCasing(); @@ -373,118 +360,118 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple } } } - + public void conusmeAmmo(ComparableStack ammo) { - + for(int i = 1; i < 10; i++) { - + if(slots[i] != null && ammo.matchesRecipe(slots[i], true)) { - + this.decrStackSize(i, 1); return; } } - + this.markDirty(); } - + /** * Reads the namelist from the AI chip in slot 0 * @return null if there is either no chip to be found or if the name list is empty, otherwise it just reads the strings from the chip's NBT */ public List getWhitelist() { - + if(slots[0] != null && slots[0].getItem() == ModItems.turret_chip) { - + String[] array = ItemTurretBiometry.getNames(slots[0]); - + if(array == null) return null; - + return Arrays.asList(ItemTurretBiometry.getNames(slots[0])); } - + return null; } - + /** * Appends a new name to the chip * @param name */ public void addName(String name) { - + if(slots[0] != null && slots[0].getItem() == ModItems.turret_chip) { ItemTurretBiometry.addName(slots[0], name); } } - + /** - * Removes the chip's entry at a given + * Removes the chip's entry at a given * @param index */ public void removeName(int index) { - + if(slots[0] != null && slots[0].getItem() == ModItems.turret_chip) { - + String[] array = ItemTurretBiometry.getNames(slots[0]); - + if(array == null) return; - + List names = new ArrayList(Arrays.asList(array)); ItemTurretBiometry.clearNames(slots[0]); - + names.remove(index); - + for(String name : names) ItemTurretBiometry.addName(slots[0], name); } } - + /** * Finds the nearest acceptable target within range and in line of sight */ protected void seekNewTarget() { - + Vec3 pos = this.getTurretPos(); double range = this.getDecetorRange(); List entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(pos.xCoord, pos.yCoord, pos.zCoord, pos.xCoord, pos.yCoord, pos.zCoord).expand(range, range, range)); - + Entity target = null; double closest = range; - + for(Entity entity : entities) { Vec3 ent = this.getEntityPos(entity); Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord); - + double dist = delta.lengthVector(); - + //check if it's in range if(dist > range) continue; - + //check if we should even fire at this entity if(!entityAcceptableTarget(entity)) continue; - + //check for visibility if(!entityInLOS(entity)) continue; - + //replace current target if this one is closer if(dist < closest) { closest = dist; target = entity; } } - + this.target = target; - + if(target != null) this.tPos = this.getEntityPos(this.target); } - + /** * Turns the turret by a specific amount of degrees towards the target * Assumes that the target is not null @@ -492,7 +479,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple protected void alignTurret() { this.turnTowards(tPos); } - + /** * Turns the turret towards the specified position */ @@ -500,32 +487,32 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple Vec3 pos = this.getTurretPos(); Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord); - + double targetPitch = Math.asin(delta.yCoord / delta.lengthVector()); double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord); - + this.turnTowardsAngle(targetPitch, targetYaw); } - + public void turnTowardsAngle(double targetPitch, double targetYaw) { - + double turnYaw = Math.toRadians(this.getTurretYawSpeed()); double turnPitch = Math.toRadians(this.getTurretPitchSpeed()); double pi2 = Math.PI * 2; - + //if we are about to overshoot the target by turning, just snap to the correct rotation if(Math.abs(this.rotationPitch - targetPitch) < turnPitch || Math.abs(this.rotationPitch - targetPitch) > pi2 - turnPitch) { this.rotationPitch = targetPitch; } else { - + if(targetPitch > this.rotationPitch) this.rotationPitch += turnPitch; else this.rotationPitch -= turnPitch; } - + double deltaYaw = (targetYaw - this.rotationYaw) % pi2; - + //determines what direction the turret should turn //used to prevent situations where the turret would do almost a full turn when //the target is only a couple degrees off while being on the other side of the 360° line @@ -539,68 +526,68 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple dir = -1; else if(deltaYaw > 0) dir = 1; - + if(Math.abs(this.rotationYaw - targetYaw) < turnYaw || Math.abs(this.rotationYaw - targetYaw) > pi2 - turnYaw) { this.rotationYaw = targetYaw; } else { this.rotationYaw += turnYaw * dir; } - + double deltaPitch = targetPitch - this.rotationPitch; deltaYaw = targetYaw - this.rotationYaw; - + double deltaAngle = Math.sqrt(deltaYaw * deltaYaw + deltaPitch * deltaPitch); this.rotationYaw = this.rotationYaw % pi2; this.rotationPitch = this.rotationPitch % pi2; - + if(deltaAngle <= Math.toRadians(this.getAcceptableInaccuracy())) { this.aligned = true; } } - + /** * Checks line of sight to the passed entity along with whether the angle falls within swivel range * @return */ public boolean entityInLOS(Entity e) { - + if(e.isDead || !e.isEntityAlive()) return false; - + if(!hasThermalVision() && e instanceof EntityLivingBase && ((EntityLivingBase)e).isPotionActive(Potion.invisibility)) return false; - + Vec3 pos = this.getTurretPos(); Vec3 ent = this.getEntityPos(e); Vec3 delta = Vec3.createVectorHelper(ent.xCoord - pos.xCoord, ent.yCoord - pos.yCoord, ent.zCoord - pos.zCoord); double length = delta.lengthVector(); - + if(length < this.getDecetorGrace() || length > this.getDecetorRange() * 1.1) //the latter statement is only relevant for entities that have already been detected return false; - + delta = delta.normalize(); double pitch = Math.asin(delta.yCoord / delta.lengthVector()); double pitchDeg = Math.toDegrees(pitch); - + //check if the entity is within swivel range if(pitchDeg < -this.getTurretDepression() || pitchDeg > this.getTurretElevation()) return false; - + return !Library.isObstructedOpaque(worldObj, ent.xCoord, ent.yCoord, ent.zCoord, pos.xCoord, pos.yCoord, pos.zCoord); } - + /** * Returns true if the entity is considered for targeting * @return */ public boolean entityAcceptableTarget(Entity e) { - + if(e.isDead || !e.isEntityAlive()) return false; - + for(Class c : CompatExternal.turretTargetBlacklist) if(c.isAssignableFrom(e.getClass())) return false; - + for(Class c : CompatExternal.turretTargetCondition.keySet()) { if(c.isAssignableFrom(e.getClass())) { BiFunction lambda = CompatExternal.turretTargetCondition.get(c); @@ -613,9 +600,9 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple } List wl = getWhitelist(); - + if(wl != null) { - + if(e instanceof EntityPlayer) { if(wl.contains(((EntityPlayer)e).getDisplayName())) { return false; @@ -626,14 +613,14 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple } } } - + if(targetAnimals) { - + if(e instanceof IAnimals) return true; if(e instanceof INpc) return true; for(Class c : CompatExternal.turretTargetFriendly) if(c.isAssignableFrom(e.getClass())) return true; } - + if(targetMobs) { //never target the ender dragon directly @@ -642,7 +629,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple if(e instanceof IMob) return true; for(Class c : CompatExternal.turretTargetHostile) if(c.isAssignableFrom(e.getClass())) return true; } - + if(targetMachines) { if(e instanceof IRadarDetectableNT && !((IRadarDetectableNT)e).canBeSeenBy(this)) return false; @@ -653,17 +640,17 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple if(e instanceof EntityBomber) return true; for(Class c : CompatExternal.turretTargetMachine) if(c.isAssignableFrom(e.getClass())) return true; } - + if(targetPlayers ) { - + if(e instanceof FakePlayer) return false; if(e instanceof EntityPlayer) return true; for(Class c : CompatExternal.turretTargetPlayer) if(c.isAssignableFrom(e.getClass())) return true; } - + return false; } - + /** * How many degrees the turret can deviate from the target to be acceptable to fire at * @return @@ -671,7 +658,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public double getAcceptableInaccuracy() { return 5; } - + /** * How many degrees the turret can rotate per tick (4.5°/t = 90°/s or a half turn in two seconds) * @return @@ -679,7 +666,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public double getTurretYawSpeed() { return 4.5D; } - + /** * How many degrees the turret can lift per tick (3°/t = 60°/s or roughly the lowest to the highest point of an average turret in one second) * @return @@ -703,7 +690,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public double getTurretElevation() { return 30D; } - + /** * How many ticks until a target rescan is required * @return @@ -711,7 +698,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public int getDecetorInterval() { return 10; } - + /** * How far away an entity can be to be picked up * @return @@ -719,7 +706,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public double getDecetorRange() { return 32D; } - + /** * How far away an entity needs to be to be picked up * @return @@ -727,7 +714,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public double getDecetorGrace() { return 3D; } - + /** * The pivot point of the turret, larger models have a default of 1.5 * @return @@ -735,7 +722,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public double getHeightOffset() { return 1.5D; } - + /** * Horizontal offset for the spawn point of bullets * @return @@ -751,7 +738,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public boolean hasThermalVision() { return true; } - + /** * The pivot point of the turret, this position is used for LOS calculation and more * @return @@ -760,7 +747,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple Vec3 offset = getHorizontalOffset(); return Vec3.createVectorHelper(xCoord + offset.xCoord, yCoord + getHeightOffset(), zCoord + offset.zCoord); } - + /** * The XZ offset for a standard 2x2 turret base * @return @@ -774,10 +761,10 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple return Vec3.createVectorHelper(1, 0, 0); if(meta == 5) return Vec3.createVectorHelper(0, 0, 1); - + return Vec3.createVectorHelper(0, 0, 0); } - + /** * The pivot point of the turret, this position is used for LOS calculation and more * @return @@ -785,32 +772,32 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public Vec3 getEntityPos(Entity e) { return Vec3.createVectorHelper(e.posX, e.posY + e.height * 0.5 - e.getYOffset(), e.posZ); } - + /** * Yes, new turrets fire BulletNTs. * @return */ protected abstract List getAmmoList(); - + @SideOnly(Side.CLIENT) protected List ammoStacks; @SideOnly(Side.CLIENT) public List getAmmoTypesForDisplay() { - + if(ammoStacks != null) return ammoStacks; - + ammoStacks = new ArrayList(); - + for(Integer i : getAmmoList()) { BulletConfig config = BulletConfig.configs.get(i); - + if(config != null && config.ammo != null) { ammoStacks.add(config.ammo.toStack()); } } - + return ammoStacks; } @@ -827,11 +814,11 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public boolean hasPower() { return this.getPower() >= this.getConsumption(); } - + public boolean isOn() { return this.isOn; } - + @Override public void setPower(long i) { this.power = i; @@ -841,15 +828,15 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public long getPower() { return this.power; } - + public int getPowerScaled(int scale) { return (int)(power * scale / this.getMaxPower()); } - + public long getConsumption() { return 100; } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; @@ -870,20 +857,20 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple public void closeInventory() { this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.closeC", 1.0F, 1.0F); } - + protected Vec3 getCasingSpawnPos() { return this.getTurretPos(); } - + protected CasingEjector getEjector() { return null; } - + protected void spawnCasing() { - + if(cachedCasingConfig == null) return; CasingEjector ej = getEjector(); - + Vec3 spawn = this.getCasingSpawnPos(); NBTTagCompound data = new NBTTagCompound(); data.setString("type", "casing"); @@ -893,10 +880,10 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple data.setString("name", cachedCasingConfig.getName()); if(ej != null) data.setInteger("ej", ej.getId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, spawn.xCoord, spawn.yCoord, spawn.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - + cachedCasingConfig = null; } - + @Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerTurretBase(player.inventory, this); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java index eb0337a0d..ccd00b3e1 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java @@ -23,6 +23,7 @@ import com.hbm.tileentity.IFluidCopiable; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -149,18 +150,17 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl } } } - + @Override - protected NBTTagCompound writePacket() { - NBTTagCompound data = super.writePacket(); - tank.writeToNBT(data, "t"); - return data; + public void serialize(ByteBuf buf) { + super.serialize(buf); + tank.serialize(buf); } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - tank.readFromNBT(nbt, "t"); + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + tank.deserialize(buf); } @Override //TODO: clean this shit up diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretHIMARS.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretHIMARS.java index 728fa523e..30c24e571 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretHIMARS.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretHIMARS.java @@ -17,6 +17,7 @@ import com.hbm.tileentity.IGUIProvider; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; @@ -248,9 +249,8 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem } this.power = Library.chargeTEFromItems(slots, 10, this.power, this.getMaxPower()); - - NBTTagCompound data = this.writePacket(); - this.networkPack(data, 250); + + this.networkPackNT(250); } else { @@ -266,22 +266,21 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem } @Override - protected NBTTagCompound writePacket() { - NBTTagCompound data = super.writePacket(); - data.setShort("mode", this.mode); - data.setInteger("type", this.typeLoaded); - data.setInteger("ammo", this.ammo); - data.setFloat("crane", crane); - return data; + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeShort(this.mode); + buf.writeShort(this.typeLoaded); + buf.writeInt(this.ammo); + buf.writeFloat(this.crane); } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - this.mode = nbt.getShort("mode"); - this.typeLoaded = nbt.getShort("type"); - this.ammo = nbt.getInteger("ammo"); - this.crane = nbt.getFloat("crane"); + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.mode = buf.readShort(); + this.typeLoaded = buf.readShort(); + this.ammo = buf.readInt(); + this.crane = buf.readFloat(); } public boolean hasAmmo() { diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretMaxwell.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretMaxwell.java index e31f72dfb..5b8f99bbd 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretMaxwell.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretMaxwell.java @@ -1,6 +1,7 @@ package com.hbm.tileentity.turret; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import com.hbm.blocks.ModBlocks; @@ -19,6 +20,7 @@ import com.hbm.util.I18nUtil; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -43,10 +45,10 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I @SideOnly(Side.CLIENT) public List getAmmoTypesForDisplay() { - + if(ammoStacks != null) return ammoStacks; - + ammoStacks = new ArrayList(); ammoStacks.add(new ItemStack(ModItems.upgrade_speed_1)); @@ -66,7 +68,7 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I ammoStacks.add(new ItemStack(ModItems.upgrade_overdrive_3)); ammoStacks.add(new ItemStack(ModItems.upgrade_5g)); ammoStacks.add(new ItemStack(ModItems.upgrade_screm)); - + return ammoStacks; } @@ -96,15 +98,16 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I } @Override - public int getMaxLevel(UpgradeType type) { - if(type == UpgradeType.SPEED) return 27; - if(type == UpgradeType.POWER) return 27; - if(type == UpgradeType.EFFECT) return 27; - if(type == UpgradeType.AFTERBURN) return 27; - if(type == UpgradeType.OVERDRIVE) return 27; - return 0; + public HashMap getValidUpgrades() { + HashMap upgrades = new HashMap<>(); + upgrades.put(UpgradeType.SPEED, 27); + upgrades.put(UpgradeType.POWER, 27); + upgrades.put(UpgradeType.EFFECT, 27); + upgrades.put(UpgradeType.AFTERBURN, 27); + upgrades.put(UpgradeType.OVERDRIVE, 27); + return upgrades; } - + @Override public double getAcceptableInaccuracy() { return 2; @@ -159,28 +162,28 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I public double getHeightOffset() { return 2D; } - + public int beam; public double lastDist; - + @Override public void updateEntity() { - + if(worldObj.isRemote) { - + if(this.tPos != null) { Vec3 pos = this.getTurretPos(); double length = Vec3.createVectorHelper(tPos.xCoord - pos.xCoord, tPos.yCoord - pos.yCoord, tPos.zCoord - pos.zCoord).lengthVector(); this.lastDist = length; } - + if(beam > 0) beam--; } else { - + if(checkDelay <= 0) { checkDelay = 20; - + this.redLevel = 0; this.greenLevel = 0; this.blueLevel = 0; @@ -188,11 +191,11 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I this.pinkLevel = 0; this._5g = false; this.screm = false; - + for(int i = 1; i < 10; i++) { if(slots[i] != null) { Item item = slots[i].getItem(); - + if(item == ModItems.upgrade_speed_1) redLevel += 1; if(item == ModItems.upgrade_speed_2) redLevel += 2; if(item == ModItems.upgrade_speed_3) redLevel += 3; @@ -213,13 +216,13 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I } } } - + checkDelay--; } - + super.updateEntity(); } - + int redLevel; int greenLevel; int blueLevel; @@ -227,14 +230,14 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I int pinkLevel; boolean _5g; boolean screm; - + int checkDelay; @Override public void updateFiringTick() { - + long demand = this.getConsumption() * 10; - + if(this.target != null && this.getPower() >= demand) { if(_5g && target instanceof EntityPlayer) { @@ -243,37 +246,49 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I } else { EntityDamageUtil.attackEntityFromIgnoreIFrame(this.target, ModDamageSource.microwave, (this.blackLevel * 10 + this.redLevel + 1F) * 0.25F); } - + if(pinkLevel > 0) this.target.setFire(this.pinkLevel * 3); - + if(!this.target.isEntityAlive() && this.target instanceof EntityLivingBase) { NBTTagCompound vdat = new NBTTagCompound(); vdat.setString("type", "giblets"); vdat.setInteger("ent", this.target.getEntityId()); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(vdat, this.target.posX, this.target.posY + this.target.height * 0.5, this.target.posZ), new TargetPoint(this.target.dimension, this.target.posX, this.target.posY + this.target.height * 0.5, this.target.posZ, 150)); - + if(this.screm) worldObj.playSoundEffect(this.target.posX, this.target.posY, this.target.posZ, "hbm:block.screm", 20.0F, 1.0F); else worldObj.playSoundEffect(this.target.posX, this.target.posY, this.target.posZ, "mob.zombie.woodbreak", 2.0F, 0.95F + worldObj.rand.nextFloat() * 0.2F); } - + this.power -= demand; - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("shot", true); - this.networkPack(data, 250); + + this.shot = true; + this.networkPackNT(250); + this.shot = false; + } + } + + private boolean shot = false; + + @Override + public void serialize(ByteBuf buf) { + if (this.shot) + buf.writeBoolean(true); + else { + buf.writeBoolean(false); + super.serialize(buf); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - - if(nbt.hasKey("shot")) - beam = 5; + public void deserialize(ByteBuf buf) { + boolean shot = buf.readBoolean(); + if(shot) + this.beam = 5; else - super.networkUnpack(nbt); + super.deserialize(buf); } @Override diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java index 8cdddff40..9e2162412 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretRichard.java @@ -12,6 +12,7 @@ import cpw.mods.fml.relauncher.SideOnly; import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.factory.XFactoryRocket; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; @@ -20,11 +21,11 @@ import net.minecraft.world.World; public class TileEntityTurretRichard extends TileEntityTurretBaseNT { static List configs = new ArrayList(); - + static { for(BulletConfig cfg : XFactoryRocket.rocket_ml) configs.add(cfg.id); } - + @Override protected List getAmmoList() { return configs; @@ -54,7 +55,7 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT { public long getMaxPower() { return 10000; } - + @Override public double getDecetorGrace() { return 8D; @@ -64,67 +65,80 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT { public double getDecetorRange() { return 64D; } - + int timer; public int loaded; int reload; - + @Override public void updateEntity() { super.updateEntity(); - + if(!worldObj.isRemote) { - + if(reload > 0) { reload--; - + if(reload == 0) this.loaded = 17; } - + if(loaded <= 0 && reload <= 0 && this.getFirstConfigLoaded() != null) { reload = 100; } - + if(this.getFirstConfigLoaded() == null) { this.loaded = 0; } - - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("loaded", this.loaded); - this.networkPack(data, 250); + + this.isTurretPacket = true; + this.networkPackNT(250); + this.isTurretPacket = false; + } + } + + // wow so descriptive, i dont wanna hear it; it solves the problem + private boolean isTurretPacket = false; + + @Override + public void serialize(ByteBuf buf) { + if (this.isTurretPacket) { + buf.writeBoolean(true); + buf.writeInt(this.loaded); + } else { + buf.writeBoolean(false); + super.serialize(buf); } } @Override - public void networkUnpack(NBTTagCompound nbt) { - - if(nbt.hasKey("loaded")) - this.loaded = nbt.getInteger("loaded"); - else - super.networkUnpack(nbt); + public void deserialize(ByteBuf buf) { + if(buf.readBoolean()) { + this.loaded = buf.readInt(); + } else + super.deserialize(buf); } @Override public void updateFiringTick() { - + if(reload > 0) return; - + timer++; - + if(timer > 0 && timer % 10 == 0) { - + BulletConfig conf = this.getFirstConfigLoaded(); - + if(conf != null) { this.spawnBullet(conf, 30F); this.conusmeAmmo(conf.ammo); this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.richard_fire", 2.0F, 1.0F); this.loaded--; - + //if(conf.ammo.equals(new ComparableStack(ModItems.ammo_standard, EnumAmmo.ROCKET_DEMO))) timer = -50; - + } else { this.loaded = 0; } @@ -133,24 +147,24 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT { @Override public void spawnBullet(BulletConfig bullet, float baseDamage) { - + Vec3 pos = this.getTurretPos(); Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0); vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - + EntityBulletBaseMK4 proj = new EntityBulletBaseMK4(worldObj, bullet, baseDamage, bullet.spread, (float) rotationYaw, (float) rotationPitch); proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, proj.rotationYaw, proj.rotationPitch); proj.lockonTarget = this.target; worldObj.spawnEntityInWorld(proj); } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.loaded = nbt.getInteger("loaded"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java index ebaa3ad0d..0561ee499 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java @@ -15,6 +15,7 @@ import com.hbm.tileentity.IGUIProvider; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -35,14 +36,14 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG public double lastBarrelRightPos = 0; static List configs = new ArrayList(); - + static { configs.add(XFactory9mm.p9_sp.id); configs.add(XFactory9mm.p9_fmj.id); configs.add(XFactory9mm.p9_jhp.id); configs.add(XFactory9mm.p9_ap.id); } - + @Override protected List getAmmoList() { return configs; @@ -52,7 +53,7 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG public String getName() { return "container.turretSentry"; } - + @Override public double getTurretDepression() { return 20D; @@ -107,38 +108,38 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG public Vec3 getHorizontalOffset() { return Vec3.createVectorHelper(0.5, 0, 0.5); } - + @Override public void updateEntity() { - + if(worldObj.isRemote) { this.lastBarrelLeftPos = this.barrelLeftPos; this.lastBarrelRightPos = this.barrelRightPos; float retractSpeed = 0.5F; float pushSpeed = 0.25F; - + if(this.retractingLeft) { this.barrelLeftPos += retractSpeed; - + if(this.barrelLeftPos >= 1) { this.retractingLeft = false; } - + } else { this.barrelLeftPos -= pushSpeed; if(this.barrelLeftPos < 0) { this.barrelLeftPos = 0; } } - + if(this.retractingRight) { this.barrelRightPos += retractSpeed; - + if(this.barrelRightPos >= 1) { this.retractingRight = false; } - + } else { this.barrelRightPos -= pushSpeed; if(this.barrelRightPos < 0) { @@ -146,43 +147,43 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG } } } - + super.updateEntity(); } - + boolean shotSide = false; int timer; @Override public void updateFiringTick() { - + timer++; - + if(timer % 10 == 0) { - + BulletConfig conf = this.getFirstConfigLoaded(); - + if(conf != null) { this.cachedCasingConfig = conf.casing; this.spawnBullet(conf, 5F); this.conusmeAmmo(conf.ammo); this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:turret.sentry_fire", 2.0F, 1.0F); - + Vec3 pos = this.getTurretPos(); Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0); vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - + Vec3 side = Vec3.createVectorHelper(0.125 * (shotSide ? 1 : -1), 0, 0); side.rotateAroundY((float) -(this.rotationYaw)); - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "vanillaExt"); data.setString("mode", "largeexplode"); data.setFloat("size", 1F); data.setByte("count", (byte)1); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.xCoord + vec.xCoord + side.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord + side.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - + if(shotSide) { this.didJustShootLeft = true; } else { @@ -195,54 +196,53 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG @Override protected Vec3 getCasingSpawnPos() { - + Vec3 pos = this.getTurretPos(); Vec3 vec = Vec3.createVectorHelper(0, 0.25,-0.125); vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - + return Vec3.createVectorHelper(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord); } protected static CasingEjector ejector = new CasingEjector().setMotion(-0.3, 0.6, 0).setAngleRange(0.01F, 0.01F); - + @Override protected CasingEjector getEjector() { return ejector.setMotion(0.3, 0.6, 0); } - + @Override public boolean usesCasings() { return true; } - + @Override protected void seekNewTarget() { Entity lastTarget = this.target; super.seekNewTarget(); - + if(lastTarget != this.target && this.target != null) { worldObj.playSoundAtEntity(target, "hbm:turret.sentry_lockon", 2.0F, 1.5F); } } @Override - protected NBTTagCompound writePacket() { - NBTTagCompound data = super.writePacket(); - if(didJustShootLeft) data.setBoolean("justShotLeft", didJustShootLeft); - if(didJustShootRight) data.setBoolean("justShotRight", didJustShootRight); + public void serialize(ByteBuf buf) { + super.serialize(buf); + buf.writeBoolean(didJustShootLeft); + buf.writeBoolean(didJustShootRight); didJustShootLeft = false; didJustShootRight = false; - return data; } @Override - public void networkUnpack(NBTTagCompound nbt) { - super.networkUnpack(nbt); - if(nbt.getBoolean("justShotLeft")) this.retractingLeft = true; - if(nbt.getBoolean("justShotRight")) this.retractingRight = true; + public void deserialize(ByteBuf buf) { + super.deserialize(buf); + this.retractingLeft = buf.readBoolean(); + this.retractingRight = buf.readBoolean(); } - + protected void updateConnections() { this.trySubscribe(worldObj, xCoord, yCoord - 1, zCoord, ForgeDirection.DOWN); } diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretTauon.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretTauon.java index 9441252be..ea2b2f17d 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretTauon.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretTauon.java @@ -13,6 +13,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; @@ -21,11 +22,11 @@ import net.minecraft.world.World; public class TileEntityTurretTauon extends TileEntityTurretBaseNT { static List configs = new ArrayList(); - + static { configs.add(XFactoryAccelerator.tau_uranium.id); } - + @Override protected List getAmmoList() { return configs; @@ -80,65 +81,65 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT { public long getConsumption() { return 1000; } - + int timer; public int beam; public float spin; public float lastSpin; public double lastDist; - + @Override public void updateEntity() { - + if(worldObj.isRemote) { - + if(this.tPos != null) { Vec3 pos = this.getTurretPos(); double length = Vec3.createVectorHelper(tPos.xCoord - pos.xCoord, tPos.yCoord - pos.yCoord, tPos.zCoord - pos.zCoord).lengthVector(); this.lastDist = length; } - + if(beam > 0) beam--; - + this.lastSpin = this.spin; - + if(this.tPos != null) { this.spin += 45; } - + if(this.spin >= 360F) { this.spin -= 360F; this.lastSpin -= 360F; } } - + super.updateEntity(); } @Override public void updateFiringTick() { - + timer++; - + if(timer % 5 == 0) { - + BulletConfig conf = this.getFirstConfigLoaded(); - + if(conf != null && this.target != null) { this.target.attackEntityFrom(ModDamageSource.electricity, 30F + worldObj.rand.nextInt(11)); this.conusmeAmmo(conf.ammo); this.worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:weapon.tauShoot", 4.0F, 0.9F + worldObj.rand.nextFloat() * 0.3F); - - NBTTagCompound data = new NBTTagCompound(); - data.setBoolean("shot", true); - this.networkPack(data, 250); - + + this.shot = true; + this.networkPackNT(250); + this.shot = false; + Vec3 pos = this.getTurretPos(); Vec3 vec = Vec3.createVectorHelper(this.getBarrelLength(), 0, 0); vec.rotateAroundZ((float) -this.rotationPitch); vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5)); - + NBTTagCompound dPart = new NBTTagCompound(); dPart.setString("type", "tau"); dPart.setByte("count", (byte)5); @@ -147,13 +148,25 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT { } } + private boolean shot = false; + @Override - public void networkUnpack(NBTTagCompound nbt) { - - if(nbt.hasKey("shot")) - beam = 3; + public void serialize(ByteBuf buf) { + if (this.shot) + buf.writeBoolean(true); + else { + buf.writeBoolean(false); + super.serialize(buf); + } + } + + @Override + public void deserialize(ByteBuf buf) { + boolean shot = buf.readBoolean(); + if(shot) + this.beam = 3; else - super.networkUnpack(nbt); + super.deserialize(buf); } @Override diff --git a/src/main/java/com/hbm/util/AchievementHandler.java b/src/main/java/com/hbm/util/AchievementHandler.java index 6d74191c8..900509bfe 100644 --- a/src/main/java/com/hbm/util/AchievementHandler.java +++ b/src/main/java/com/hbm/util/AchievementHandler.java @@ -1,20 +1,19 @@ package com.hbm.util; -import java.util.HashMap; - import com.hbm.blocks.ModBlocks; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; +import java.util.HashMap; + public class AchievementHandler { public static HashMap craftingAchievements = new HashMap(); - + public static void register() { craftingAchievements.put(new ComparableStack(ModItems.piston_selenium), MainRegistry.achSelenium); craftingAchievements.put(new ComparableStack(ModItems.gun_b92), MainRegistry.achSelenium); @@ -51,7 +50,7 @@ public class AchievementHandler { craftingAchievements.put(new ComparableStack(ModBlocks.machine_assembler), MainRegistry.achAssembly); craftingAchievements.put(new ComparableStack(ModItems.billet_pu_mix), MainRegistry.achChicagoPile); } - + public static void fire(EntityPlayer player, ItemStack stack) { if(player.worldObj.isRemote) return; ComparableStack comp = new ComparableStack(stack).makeSingular(); diff --git a/src/main/java/com/hbm/util/ArmorRegistry.java b/src/main/java/com/hbm/util/ArmorRegistry.java index c098d6a89..98b863080 100644 --- a/src/main/java/com/hbm/util/ArmorRegistry.java +++ b/src/main/java/com/hbm/util/ArmorRegistry.java @@ -1,74 +1,73 @@ package com.hbm.util; +import api.hbm.item.IGasMask; +import com.hbm.handler.ArmorModHandler; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import com.hbm.handler.ArmorModHandler; - -import api.hbm.item.IGasMask; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - public class ArmorRegistry { public static HashMap> hazardClasses = new HashMap(); - + public static void registerHazard(Item item, HazardClass... hazards) { hazardClasses.put(item, new ArrayList(Arrays.asList(hazards))); } - + public static boolean hasAllProtection(EntityLivingBase entity, int slot, HazardClass... clazz) { - + if(ArmorUtil.checkArmorNull(entity, slot)) return false; - + List list = getProtectionFromItem(entity.getEquipmentInSlot(slot + 1), entity); return list.containsAll(Arrays.asList(clazz)); } - + public static boolean hasAnyProtection(EntityLivingBase entity, int slot, HazardClass... clazz) { - + if(ArmorUtil.checkArmorNull(entity, slot)) return false; - + List list = getProtectionFromItem(entity.getEquipmentInSlot(slot + 1), entity); - + if(list == null) return false; - + for(HazardClass haz : clazz) { if(list.contains(haz)) return true; } - + return false; } - + public static boolean hasProtection(EntityLivingBase entity, int slot, HazardClass clazz) { - + if(ArmorUtil.checkArmorNull(entity, slot)) return false; - + List list = getProtectionFromItem(entity.getEquipmentInSlot(slot + 1), entity); - + if(list == null) return false; - + return list.contains(clazz); } - + public static List getProtectionFromItem(ItemStack stack, EntityLivingBase entity) { List prot = new ArrayList(); - + Item item = stack.getItem(); - + //if the item has HazardClasses assigned to it, add those if(hazardClasses.containsKey(item)) prot.addAll(hazardClasses.get(item)); - + if(item instanceof IGasMask) { IGasMask mask = (IGasMask) item; ItemStack filter = mask.getFilter(stack, entity); @@ -76,29 +75,29 @@ public class ArmorRegistry { if(filter != null) { //add the HazardClasses from the filter, then remove the ones blacklisted by the mask List filProt = hazardClasses.get(filter.getItem()); - + for(HazardClass c : mask.getBlacklist(stack, entity)) filProt.remove(c); - + prot.addAll(filProt); } } - + if(ArmorModHandler.hasMods(stack)) { - + ItemStack[] mods = ArmorModHandler.pryMods(stack); - + for(ItemStack mod : mods) { - + //recursion! run the exact same procedure on every mod, in case future mods will have filter support if(mod != null) prot.addAll(getProtectionFromItem(mod, entity)); } } - + return prot; } - + public static enum HazardClass { GAS_LUNG("hazard.gasChlorine"), //also attacks eyes -> no half mask GAS_MONOXIDE("hazard.gasMonoxide"), //only affects lungs @@ -110,9 +109,9 @@ public class ArmorRegistry { GAS_BLISTERING("hazard.corrosive"), //corrosive substance, also attacks skin SAND("hazard.sand"), //blinding sand particles LIGHT("hazard.light"); //blinding light - + public final String lang; - + private HazardClass(String lang) { this.lang = lang; } diff --git a/src/main/java/com/hbm/util/ArmorUtil.java b/src/main/java/com/hbm/util/ArmorUtil.java index ece9306a9..9fe8be58c 100644 --- a/src/main/java/com/hbm/util/ArmorUtil.java +++ b/src/main/java/com/hbm/util/ArmorUtil.java @@ -1,17 +1,12 @@ package com.hbm.util; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - +import api.hbm.item.IGasMask; import com.hbm.handler.ArmorModHandler; import com.hbm.handler.HazmatRegistry; import com.hbm.items.ModItems; import com.hbm.lib.Library; import com.hbm.potion.HbmPotion; import com.hbm.util.ArmorRegistry.HazardClass; - -import api.hbm.item.IGasMask; import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -23,12 +18,16 @@ import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.ForgeEventFactory; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + public class ArmorUtil { - + /* * The less horrifying part */ - + public static void register() { ArmorRegistry.registerHazard(ModItems.gas_mask_filter, HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.GAS_BLISTERING, HazardClass.BACTERIA); ArmorRegistry.registerHazard(ModItems.gas_mask_filter_mono, HazardClass.PARTICLE_COARSE, HazardClass.GAS_MONOXIDE); @@ -40,7 +39,7 @@ public class ArmorUtil { ArmorRegistry.registerHazard(ModItems.gas_mask_m65, HazardClass.SAND); ArmorRegistry.registerHazard(ModItems.mask_rag, HazardClass.PARTICLE_COARSE); ArmorRegistry.registerHazard(ModItems.mask_piss, HazardClass.PARTICLE_COARSE, HazardClass.GAS_LUNG); - + ArmorRegistry.registerHazard(ModItems.goggles, HazardClass.LIGHT, HazardClass.SAND); ArmorRegistry.registerHazard(ModItems.ashglasses, HazardClass.LIGHT, HazardClass.SAND); @@ -64,151 +63,151 @@ public class ArmorUtil { ArmorRegistry.registerHazard(ModItems.rpa_helmet, HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.BACTERIA, HazardClass.GAS_BLISTERING, HazardClass.GAS_MONOXIDE, HazardClass.LIGHT, HazardClass.SAND); ArmorRegistry.registerHazard(ModItems.envsuit_helmet, HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.BACTERIA, HazardClass.GAS_BLISTERING, HazardClass.GAS_MONOXIDE, HazardClass.LIGHT, HazardClass.SAND); ArmorRegistry.registerHazard(ModItems.trenchmaster_helmet, HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.BACTERIA, HazardClass.GAS_BLISTERING, HazardClass.GAS_MONOXIDE, HazardClass.LIGHT, HazardClass.SAND); - + //Ob ihr wirklich richtig steht, seht ihr wenn das Licht angeht! registerIfExists(Compat.MOD_GT6, "gt.armor.hazmat.universal.head", HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.BACTERIA, HazardClass.GAS_BLISTERING, HazardClass.GAS_MONOXIDE, HazardClass.LIGHT, HazardClass.SAND); registerIfExists(Compat.MOD_GT6, "gt.armor.hazmat.biochemgas.head", HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.BACTERIA, HazardClass.GAS_BLISTERING, HazardClass.GAS_MONOXIDE, HazardClass.LIGHT, HazardClass.SAND); registerIfExists(Compat.MOD_GT6, "gt.armor.hazmat.radiation.head", HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_LUNG, HazardClass.BACTERIA, HazardClass.GAS_BLISTERING, HazardClass.GAS_MONOXIDE, HazardClass.LIGHT, HazardClass.SAND); } - + private static void registerIfExists(String domain, String name, HazardClass... classes) { Item item = Compat.tryLoadItem(domain, name); if(item != null) ArmorRegistry.registerHazard(item, classes); } - + public static boolean checkArmor(EntityLivingBase entity, Item... armor) { - + for(int i = 0; i < 4; i++) { if(!checkArmorPiece(entity, armor[i], 3 - i)) return false; } - + return true; } - + public static boolean checkArmorPiece(EntityLivingBase entity, Item armor, int slot) { return !checkArmorNull(entity, slot) && entity.getEquipmentInSlot(slot + 1).getItem() == armor; } - + public static boolean checkArmorNull(EntityLivingBase player, int slot) { return player.getEquipmentInSlot(slot + 1) == null; } - + public static void damageSuit(EntityLivingBase entity, int slot, int amount) { - + if(entity.getEquipmentInSlot(slot + 1) == null) return; - + entity.getEquipmentInSlot(slot + 1).damageItem(amount, entity); if(entity.getEquipmentInSlot(slot + 1).stackSize == 0) { entity.setCurrentItemOrArmor(slot + 1, null); } } - + public static void resetFlightTime(EntityPlayer player) { - + if(player instanceof EntityPlayerMP) { EntityPlayerMP mp = (EntityPlayerMP) player; ReflectionHelper.setPrivateValue(NetHandlerPlayServer.class, mp.playerNetServerHandler, 0, "floatingTickCount", "field_147365_f"); } } - + /* * The more horrifying part */ public static boolean checkForHazmat(EntityLivingBase player) { - - if(checkArmor(player, ModItems.hazmat_helmet, ModItems.hazmat_plate, ModItems.hazmat_legs, ModItems.hazmat_boots) || - checkArmor(player, ModItems.hazmat_helmet_red, ModItems.hazmat_plate_red, ModItems.hazmat_legs_red, ModItems.hazmat_boots_red) || - checkArmor(player, ModItems.hazmat_helmet_grey, ModItems.hazmat_plate_grey, ModItems.hazmat_legs_grey, ModItems.hazmat_boots_grey) || - checkArmor(player, ModItems.t45_helmet, ModItems.t45_plate, ModItems.t45_legs, ModItems.t45_boots) || - checkArmor(player, ModItems.schrabidium_helmet, ModItems.schrabidium_plate, ModItems.schrabidium_legs, ModItems.schrabidium_boots) || + + if(checkArmor(player, ModItems.hazmat_helmet, ModItems.hazmat_plate, ModItems.hazmat_legs, ModItems.hazmat_boots) || + checkArmor(player, ModItems.hazmat_helmet_red, ModItems.hazmat_plate_red, ModItems.hazmat_legs_red, ModItems.hazmat_boots_red) || + checkArmor(player, ModItems.hazmat_helmet_grey, ModItems.hazmat_plate_grey, ModItems.hazmat_legs_grey, ModItems.hazmat_boots_grey) || + checkArmor(player, ModItems.t45_helmet, ModItems.t45_plate, ModItems.t45_legs, ModItems.t45_boots) || + checkArmor(player, ModItems.schrabidium_helmet, ModItems.schrabidium_plate, ModItems.schrabidium_legs, ModItems.schrabidium_boots) || checkForHaz2(player)) { - + return true; } - + if(player.isPotionActive(HbmPotion.mutation)) return true; - + return false; } - + public static boolean checkForHaz2(EntityLivingBase player) { - - if(checkArmor(player, ModItems.hazmat_paa_helmet, ModItems.hazmat_paa_plate, ModItems.hazmat_paa_legs, ModItems.hazmat_paa_boots) || - checkArmor(player, ModItems.liquidator_helmet, ModItems.liquidator_plate, ModItems.liquidator_legs, ModItems.liquidator_boots) || - checkArmor(player, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots) || - checkArmor(player, ModItems.rpa_helmet, ModItems.rpa_plate, ModItems.rpa_legs, ModItems.rpa_boots) || - checkArmor(player, ModItems.fau_helmet, ModItems.fau_plate, ModItems.fau_legs, ModItems.fau_boots) || + + if(checkArmor(player, ModItems.hazmat_paa_helmet, ModItems.hazmat_paa_plate, ModItems.hazmat_paa_legs, ModItems.hazmat_paa_boots) || + checkArmor(player, ModItems.liquidator_helmet, ModItems.liquidator_plate, ModItems.liquidator_legs, ModItems.liquidator_boots) || + checkArmor(player, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots) || + checkArmor(player, ModItems.rpa_helmet, ModItems.rpa_plate, ModItems.rpa_legs, ModItems.rpa_boots) || + checkArmor(player, ModItems.fau_helmet, ModItems.fau_plate, ModItems.fau_legs, ModItems.fau_boots) || checkArmor(player, ModItems.dns_helmet, ModItems.dns_plate, ModItems.dns_legs, ModItems.dns_boots)) { return true; } - + return false; } - + public static boolean checkForAsbestos(EntityLivingBase player) { - + if(checkArmor(player, ModItems.asbestos_helmet, ModItems.asbestos_plate, ModItems.asbestos_legs, ModItems.asbestos_boots)) return true; return false; } - + public static boolean checkForDigamma(EntityPlayer player) { - + if(checkArmor(player, ModItems.fau_helmet, ModItems.fau_plate, ModItems.fau_legs, ModItems.fau_boots)) return true; - + if(checkArmor(player, ModItems.dns_helmet, ModItems.dns_plate, ModItems.dns_legs, ModItems.dns_boots)) return true; - - if(player.isPotionActive(HbmPotion.stability.id)) - return true; - - return false; - } - - public static boolean checkForDigamma2(EntityPlayer player) { - - if(!checkArmor(player, ModItems.robes_helmet, ModItems.robes_plate, ModItems.robes_legs, ModItems.robes_boots)) - return false; - + if(player.isPotionActive(HbmPotion.stability.id)) return true; - + + return false; + } + + public static boolean checkForDigamma2(EntityPlayer player) { + + if(!checkArmor(player, ModItems.robes_helmet, ModItems.robes_plate, ModItems.robes_legs, ModItems.robes_boots)) + return false; + + if(player.isPotionActive(HbmPotion.stability.id)) + return true; + for(int i = 0; i < 4; i++) { - + ItemStack armor = player.getCurrentArmor(i); - + if(armor != null && ArmorModHandler.hasMods(armor)) { - + ItemStack mods[] = ArmorModHandler.pryMods(armor); - + if(!(mods[ArmorModHandler.cladding] != null && mods[ArmorModHandler.cladding].getItem() == ModItems.cladding_iron)) return false; } } - + return player.getMaxHealth() < 3; } - + public static boolean checkForFaraday(EntityPlayer player) { - + ItemStack[] armor = player.inventory.armorInventory; - + if(armor[0] == null || armor[1] == null || armor[2] == null || armor[3] == null) return false; - + if(isFaradayArmor(armor[0]) && isFaradayArmor(armor[1]) && isFaradayArmor(armor[2]) && isFaradayArmor(armor[3])) return true; - + return false; } - + public static final String[] metals = new String[] { "chainmail", "iron", @@ -237,63 +236,63 @@ public class ArmorUtil { "rpa", "spacesuit" }; - + public static boolean isFaradayArmor(ItemStack item) { - + String name = item.getUnlocalizedName(); - + for(String metal : metals) { - + if(name.toLowerCase(Locale.US).contains(metal)) return true; } - + if(HazmatRegistry.getCladding(item) > 0) return true; - + return false; } - + public static boolean checkForFiend(EntityPlayer player) { - + return checkArmorPiece(player, ModItems.jackt, 2) && Library.checkForHeld(player, ModItems.shimmer_sledge); } - + public static boolean checkForFiend2(EntityPlayer player) { - + return checkArmorPiece(player, ModItems.jackt2, 2) && Library.checkForHeld(player, ModItems.shimmer_axe); } - + /* * Default implementations for IGasMask items */ public static final String FILTERK_KEY = "hfrFilter"; - + public static void installGasMaskFilter(ItemStack mask, ItemStack filter) { - + if(mask == null || filter == null) return; - + if(!mask.hasTagCompound()) mask.stackTagCompound = new NBTTagCompound(); - + NBTTagCompound attach = new NBTTagCompound(); filter.writeToNBT(attach); - + mask.stackTagCompound.setTag(FILTERK_KEY, attach); } - + public static void removeFilter(ItemStack mask) { - + if(mask == null) return; - + if(!mask.hasTagCompound()) return; - + mask.stackTagCompound.removeTag(FILTERK_KEY); } - + /** * Grabs the installed filter or the filter of the attachment, used for attachment rendering * @param mask @@ -301,126 +300,126 @@ public class ArmorUtil { * @return */ public static ItemStack getGasMaskFilterRecursively(ItemStack mask, EntityLivingBase entity) { - + ItemStack filter = getGasMaskFilter(mask); - + if(filter == null && ArmorModHandler.hasMods(mask)) { - + ItemStack mods[] = ArmorModHandler.pryMods(mask); - + if(mods[ArmorModHandler.helmet_only] != null && mods[ArmorModHandler.helmet_only].getItem() instanceof IGasMask) filter = ((IGasMask)mods[ArmorModHandler.helmet_only].getItem()).getFilter(mods[ArmorModHandler.helmet_only], entity); } - + return filter; } - + public static ItemStack getGasMaskFilter(ItemStack mask) { - + if(mask == null) return null; - + if(!mask.hasTagCompound()) return null; - + NBTTagCompound attach = mask.stackTagCompound.getCompoundTag(FILTERK_KEY); ItemStack filter = ItemStack.loadItemStackFromNBT(attach); - + return filter; } - + public static void damageGasMaskFilter(EntityLivingBase entity, int damage) { - + ItemStack mask = entity.getEquipmentInSlot(4); - + if(mask == null) return; - + if(!(mask.getItem() instanceof IGasMask)) { - + if(ArmorModHandler.hasMods(mask)) { - + ItemStack mods[] = ArmorModHandler.pryMods(mask); - + if(mods[ArmorModHandler.helmet_only] != null && mods[ArmorModHandler.helmet_only].getItem() instanceof IGasMask) mask = mods[ArmorModHandler.helmet_only]; } } - + if(mask != null) damageGasMaskFilter(mask, damage); } - + public static void damageGasMaskFilter(ItemStack mask, int damage) { ItemStack filter = getGasMaskFilter(mask); - + if(filter == null) { if(ArmorModHandler.hasMods(mask)) { ItemStack mods[] = ArmorModHandler.pryMods(mask); - + if(mods[ArmorModHandler.helmet_only] != null && mods[ArmorModHandler.helmet_only].getItem() instanceof IGasMask) filter = getGasMaskFilter(mods[ArmorModHandler.helmet_only]); } } - + if(filter == null || filter.getMaxDamage() == 0) return; - + filter.setItemDamage(filter.getItemDamage() + damage); - + if(filter.getItemDamage() > filter.getMaxDamage()) removeFilter(mask); else installGasMaskFilter(mask, filter); } - + public static void addGasMaskTooltip(ItemStack mask, EntityPlayer player, List list, boolean ext) { - + if(mask == null || !(mask.getItem() instanceof IGasMask)) return; - + ItemStack filter = ((IGasMask)mask.getItem()).getFilter(mask, player); - + if(filter == null) { list.add(EnumChatFormatting.RED + "No filter installed!"); return; } - + list.add(EnumChatFormatting.GOLD + "Installed filter:"); - + int meta = filter.getItemDamage(); int max = filter.getMaxDamage(); - + String append = ""; - + if(max > 0) { append = " (" + ((max - meta) * 100 / max) + "%)"; } - + List lore = new ArrayList(); list.add(" " + filter.getDisplayName() + append); filter.getItem().addInformation(filter, player, lore, ext); ForgeEventFactory.onItemTooltip(filter, player, lore, ext); lore.forEach(x -> list.add(EnumChatFormatting.YELLOW + " " + x)); } - + public static boolean isWearingEmptyMask(EntityPlayer player) { - + ItemStack mask = player.getEquipmentInSlot(4); - + if(mask == null) return false; - + if(mask.getItem() instanceof IGasMask) { return getGasMaskFilter(mask) == null; } - + ItemStack mod = ArmorModHandler.pryMods(mask)[ArmorModHandler.helmet_only]; - + if(mod != null && mod.getItem() instanceof IGasMask) { return getGasMaskFilter(mod) == null; } - + return false; } } diff --git a/src/main/java/com/hbm/util/BobMathUtil.java b/src/main/java/com/hbm/util/BobMathUtil.java index f9bfcc6f7..5fa0b93ee 100644 --- a/src/main/java/com/hbm/util/BobMathUtil.java +++ b/src/main/java/com/hbm/util/BobMathUtil.java @@ -1,5 +1,11 @@ package com.hbm.util; +import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraftforge.common.util.ForgeDirection; + +import javax.annotation.Nonnegative; import java.lang.reflect.Field; import java.math.BigDecimal; import java.math.RoundingMode; @@ -7,26 +13,19 @@ import java.text.NumberFormat; import java.util.*; import java.util.function.ToIntFunction; -import javax.annotation.Nonnegative; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; -import net.minecraftforge.common.util.ForgeDirection; - public class BobMathUtil { - + public static double safeClamp(double val, double min, double max) { val = MathHelper.clamp_double(val, min, max); - + if(val == Double.NaN) { val = (min + max) / 2D; } - + return val; } - + public static Vec3 interpVec(Vec3 vec1, Vec3 vec2, float interp) { return Vec3.createVectorHelper( interp(vec1.xCoord, vec2.xCoord, interp), @@ -34,73 +33,73 @@ public class BobMathUtil { interp(vec1.zCoord, vec2.zCoord, interp) ); } - + public static double interp(double x, double y, float interp) { return x + (y - x) * interp; } - + public static double getAngleFrom2DVecs(double x1, double z1, double x2, double z2) { - + double upper = x1 * x2 + z1 * z2; double lower = Math.sqrt(x1 * x1 + z1 * z1) * Math.sqrt(x2 * x2 + z2 * z2); - + double result = Math.toDegrees(Math.cos(upper / lower)); - + if(result >= 180) result -= 180; - + return result; } - + public static double getCrossAngle(Vec3 vel, Vec3 rel) { - + vel.normalize(); rel.normalize(); double vecProd = rel.xCoord * vel.xCoord + rel.yCoord * vel.yCoord + rel.zCoord * vel.zCoord; double bot = rel.lengthVector() * vel.lengthVector(); double angle = Math.acos(vecProd / bot) * 180 / Math.PI; - + if(angle >= 180) angle -= 180; - + return angle; } public static float remap(float num, float min1, float max1, float min2, float max2){ return ((num - min1) / (max1 - min1)) * (max2 - min2) + min2; } - + public static float remap01(float num, float min1, float max1){ return (num - min1) / (max1 - min1); } - + public static float remap01_clamp(float num, float min1, float max1){ return MathHelper.clamp_float((num - min1) / (max1 - min1), 0, 1); } - + public static ForgeDirection[] getShuffledDirs() { - + ForgeDirection[] dirs = new ForgeDirection[6]; List indices = new ArrayList() {{ add(0); add(1); add(2); add(3); add(4); add(5); }}; Collections.shuffle(indices); - + for(int i = 0; i < 6; i++) { dirs[i] = ForgeDirection.getOrientation(indices.get(i)); } - + return dirs; } public static String toPercentage(float amount, float total) { return NumberFormat.getPercentInstance().format(amount / total); } - + public static String[] ticksToDate(long ticks) { - + int tickDay = 48000; int tickYear = tickDay * 100; - + final String[] dateOut = new String[3]; long year = Math.floorDiv(ticks, tickYear); byte day = (byte) Math.floorDiv(ticks - tickYear * year, tickDay); @@ -111,7 +110,7 @@ public class BobMathUtil { dateOut[2] = String.valueOf(time); return dateOut; } - + /** * Rescale a number from one range to another * @param toScale - The integer to scale @@ -126,7 +125,7 @@ public class BobMathUtil { double newRange = newMax - newMin; return (((toScale - oldMin) * newRange) / prevRange) + newMin; } - + /** * Rounds a number to so many significant digits * @param num The number to round @@ -145,7 +144,7 @@ public class BobMathUtil { } public static String getShortNumber(long l) { - + if(l >= Math.pow(10, 18)) { double res = l / Math.pow(10, 18); res = Math.round(res * 100.0) / 100.0; @@ -176,31 +175,31 @@ public class BobMathUtil { res = Math.round(res * 100.0) / 100.0; return res + "k"; } - + return Long.toString(l); } - + /** * Adjusted sqrt, approaches standard sqrt but sqrt(x) is never bigger than x - * + * * ____________ * / 1 | 1 * _ / x + ―――――――― - ――――― * \/ (x + 2)² x + 2 - * + * * @param x * @return */ public static double squirt(double x) { return Math.sqrt(x + 1D / ((x + 2D) * (x + 2D))) - 1D / (x + 2D); } - + /** A convenient way to re-define the value of pi, should the laws of nature change. */ public static void setPi(double pi) { Field field = ReflectionHelper.findField(Math.class, "PI"); try { field.setDouble(null, pi); } catch(Exception e) { } } - + public static double angularDifference(double alpha, double beta) { double delta = (beta - alpha + 180) % 360 - 180; return delta < -180 ? delta + 360 : delta; @@ -225,7 +224,7 @@ public class BobMathUtil { public static double sps(double x) { return Math.sin(Math.PI / 2D * Math.cos(x)); } - + /** Square wave sine, make sure squarination is [0;1] */ public static double sws(double x, double squarination) { double s = Math.sin(x); diff --git a/src/main/java/com/hbm/util/BufferUtil.java b/src/main/java/com/hbm/util/BufferUtil.java index 3f50e7e54..4bdf26480 100644 --- a/src/main/java/com/hbm/util/BufferUtil.java +++ b/src/main/java/com/hbm/util/BufferUtil.java @@ -1,26 +1,34 @@ package com.hbm.util; -import java.nio.charset.Charset; - import io.netty.buffer.ByteBuf; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTSizeTracker; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.Vec3; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; public class BufferUtil { - private static final Charset CHARSET = Charset.forName("UTF-8"); - + private static final Charset CHARSET = StandardCharsets.UTF_8; + // Writes a string to a byte buffer by encoding the length and raw bytes - public static final void writeString(ByteBuf buf, String value) { + public static void writeString(ByteBuf buf, String value) { if(value == null) { buf.writeInt(-1); return; } - buf.writeInt(value.length()); + buf.writeInt(value.getBytes(CHARSET).length); buf.writeBytes(value.getBytes(CHARSET)); } // Reads a string from a byte buffer via the written length and raw bytes - public static final String readString(ByteBuf buf) { + public static String readString(ByteBuf buf) { final int count = buf.readInt(); if(count < 0) return null; @@ -30,4 +38,124 @@ public class BufferUtil { return new String(bytes, CHARSET); } + /** + * Writes an integer array to a buffer. + */ + public static void writeIntArray(ByteBuf buf, int[] array) { + buf.writeInt(array.length); + for (int value : array) { + buf.writeInt(value); + } + } + + /** + * Reads an integer array from a buffer. + */ + public static int[] readIntArray(ByteBuf buf) { + int length = buf.readInt(); + + int[] array = new int[length]; + + for (int i = 0; i < length; i++) { + array[i] = buf.readInt(); + } + + return array; + } + + /** + * Writes a vector to a buffer. + */ + public static void writeVec3(ByteBuf buf, Vec3 vector) { + buf.writeBoolean(vector != null); + if(vector == null) return; + buf.writeDouble(vector.xCoord); + buf.writeDouble(vector.yCoord); + buf.writeDouble(vector.zCoord); + } + + /** + * Reads a vector from a buffer. + */ + public static Vec3 readVec3(ByteBuf buf) { + boolean vectorExists = buf.readBoolean(); + if(!vectorExists) { + return null; + } + double x = buf.readDouble(); + double y = buf.readDouble(); + double z = buf.readDouble(); + + return Vec3.createVectorHelper(x, y, z); + } + + /** + * Writes a NBTTagCompound to a buffer. + */ + public static void writeNBT(ByteBuf buf, NBTTagCompound compound) { + if(compound != null) { + byte[] nbtData = new byte[0]; + try { + nbtData = CompressedStreamTools.compress(compound); + } catch(IOException e) { + e.printStackTrace(); + } + buf.writeShort((short) nbtData.length); + buf.writeBytes(nbtData); + } else + buf.writeShort(-1); + } + + /** + * Reads a NBTTagCompound from a buffer. + */ + public static NBTTagCompound readNBT(ByteBuf buf) { + short nbtLength = buf.readShort(); + + if (nbtLength == -1) // check if no compound was even given. + return new NBTTagCompound(); + byte[] tags = new byte[nbtLength]; + buf.readBytes(tags); + try { + return CompressedStreamTools.func_152457_a(tags, new NBTSizeTracker(2097152L)); + } catch(IOException e) { + e.printStackTrace(); + } + return new NBTTagCompound(); + } + + /** + * Writes the ItemStack to the buffer. + */ + public static void writeItemStack(ByteBuf buf, ItemStack item) { + if (item == null) + buf.writeShort(-1); + else { + buf.writeShort(Item.getIdFromItem(item.getItem())); + buf.writeByte(item.stackSize); + buf.writeShort(item.getItemDamage()); + NBTTagCompound nbtTagCompound = null; + + if (item.getItem().isDamageable() || item.getItem().getShareTag()) + nbtTagCompound = item.stackTagCompound; + + writeNBT(buf, nbtTagCompound); + } + } + + /** + * Reads an ItemStack from a buffer. + */ + public static ItemStack readItemStack(ByteBuf buf) { + ItemStack item = null; + short id = buf.readShort(); + + if (id >= 0) { + byte quantity = buf.readByte(); + short meta = buf.readShort(); + item = new ItemStack(Item.getItemById(id), quantity, meta); + item.stackTagCompound = readNBT(buf); + } + return item; + } } diff --git a/src/main/java/com/hbm/util/ChatBuilder.java b/src/main/java/com/hbm/util/ChatBuilder.java index fd269b5ad..84162877f 100644 --- a/src/main/java/com/hbm/util/ChatBuilder.java +++ b/src/main/java/com/hbm/util/ChatBuilder.java @@ -1,74 +1,69 @@ package com.hbm.util; +import net.minecraft.util.*; + import java.util.ArrayList; import java.util.List; import java.util.ListIterator; -import net.minecraft.util.ChatComponentStyle; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; - public class ChatBuilder { private ChatComponentText text; private ChatComponentStyle last; - + private ChatBuilder(String text) { this.text = new ChatComponentText(text); this.last = this.text; } - + public static ChatBuilder start(String text) { ChatBuilder builder = new ChatBuilder(text); return builder; } - + public static ChatBuilder startTranslation(String text, Object... o) { ChatBuilder builder = new ChatBuilder("").nextTranslation(text, o); return builder; } - + public ChatBuilder next(String text) { ChatComponentText append = new ChatComponentText(text); this.last.appendSibling(append); this.last = append; return this; } - + public ChatBuilder nextTranslation(String text, Object... o) { ChatComponentTranslation append = new ChatComponentTranslation(text, o); this.last.appendSibling(append); this.last = append; return this; } - + public ChatBuilder color(EnumChatFormatting format) { ChatStyle style = this.last.getChatStyle(); style.setColor(format); return this; } - + /** Will recursively go over all IChatComponents added to the root and then set the style */ public ChatBuilder colorAll(EnumChatFormatting format) { - + List list = new ArrayList(); list.add(text); - + ListIterator it = list.listIterator(); - + while(it.hasNext()) { Object o = it.next(); IChatComponent component = (IChatComponent) o; component.getChatStyle().setColor(format); for(Object s : component.getSiblings()) it.add(s); } - + return this; } - + public ChatComponentText flush() { return this.text; } diff --git a/src/main/java/com/hbm/util/ColorUtil.java b/src/main/java/com/hbm/util/ColorUtil.java index 2d0ad9378..c863c5d02 100644 --- a/src/main/java/com/hbm/util/ColorUtil.java +++ b/src/main/java/com/hbm/util/ColorUtil.java @@ -23,34 +23,34 @@ public class ColorUtil { public static BufferedImage getImageFromStack(ItemStack stack) throws IOException { String iconName = stack.getItem().getIconFromDamage(stack.getItemDamage()).getIconName(); String domain = "minecraft"; - + if(iconName.contains(":")) { String[] parts = iconName.split(":"); domain = parts[0]; iconName = parts[1]; } - + ResourceLocation loc = new ResourceLocation(domain, "textures/items/" + iconName + ".png"); - + return ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()); } @SideOnly(Side.CLIENT) public static int getAverageColorFromStack(ItemStack stack) { - + try { BufferedImage tex = getImageFromStack(stack); - + int r = 0; int g = 0; int b = 0; int pixels = 0; - + for(int i = 0; i < tex.getWidth(); i++) { for(int j = 0; j < tex.getHeight(); j++) { - + Color pixel = new Color(tex.getRGB(i, j)); - + if(pixel.getAlpha() == 255) { r += pixel.getRed(); g += pixel.getGreen(); @@ -63,9 +63,9 @@ public class ColorUtil { int avgR = r / pixels; int avgG = g / pixels; int avgB = b / pixels; - + return (avgR << 16) | (avgG << 8) | avgB; - + } catch(Exception ex) { return 0xFFFFFF; } @@ -73,34 +73,34 @@ public class ColorUtil { @SideOnly(Side.CLIENT) public static int getMedianBrightnessColorFromStack(ItemStack stack) { - + try { BufferedImage tex = getImageFromStack(stack); - + HashMap brightMap = new HashMap(); List brightnesses = new ArrayList(); - + for(int i = 0; i < tex.getWidth(); i++) { for(int j = 0; j < tex.getHeight(); j++) { - + Color pixel = new Color(tex.getRGB(i, j)); int brightness = pixel.getRed() * pixel.getRed() + pixel.getGreen() * pixel.getGreen() + pixel.getBlue() * pixel.getBlue(); brightnesses.add(brightness); brightMap.put(brightness, pixel); //overlap possible, but we don't differentiate between colors anyway. } } - + Collections.sort(brightnesses); int median = brightnesses.get(brightnesses.size() / 2); Color medianColor = brightMap.get(median); - + return medianColor.getRGB(); - + } catch(Exception ex) { return 0xFFFFFF; } } - + /** * Decides whether a color is considered "colorful", i.e. weeds out colors that are too dark or too close to gray. * @param hex @@ -108,11 +108,11 @@ public class ColorUtil { */ public static boolean isColorColorful(int hex) { Color color = new Color(hex); - + /*double r = color.getRed(); double g = color.getBlue(); double b = color.getGreen(); - + if(r < 50 && g < 50 && b < 50) return false; @@ -122,13 +122,13 @@ public class ColorUtil { if(g / b > 1.5) return true; if(b / r > 1.5) return true; if(b / g > 1.5) return true;*/ - + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); - + // saturation brightness return hsb[1] > 0.25 && hsb[2] > 0.25; } - + /** * Raises the highest RGB component to the specified limit, scaling the other components with it. * @param hex @@ -141,14 +141,14 @@ public class ColorUtil { int g = color.getGreen(); int b = color.getBlue(); int max = Math.max(Math.max(1, r), Math.max(g, b)); - + r = r * limit / max; g = g * limit / max; b = b * limit / max; - + return new Color(r, g, b).getRGB(); } - + /** * Same as the regular amplifyColor but it uses 255 as the limit. * @param hex @@ -157,7 +157,7 @@ public class ColorUtil { public static int amplifyColor(int hex) { return amplifyColor(hex, 255); } - + /** * Amplifies a given color by approaching all components to maximum by a given percentage. A percentage of 1 (100%) should always yield white. * @param hex @@ -169,21 +169,21 @@ public class ColorUtil { int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); - + r = (int) (r + (255 - r) * percent); g = (int) (g + (255 - g) * percent); b = (int) (b + (255 - b) * percent); - + return new Color(r, g, b).getRGB(); } - + /** Converts a color into HSB and then returns the brightness component [] */ public static double getColorBrightness(int hex) { Color color = new Color(hex); float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); return hsb[2]; } - + public static HashMap nameToColor = new HashMap() {{ put("black", 1973019); put("red", 11743532); @@ -202,17 +202,17 @@ public class ColorUtil { put("orange", 15435844); put("white", 15790320); }}; - + public static int getColorFromDye(ItemStack stack) { List oreNames = ItemStackUtil.getOreDictNames(stack); - + for(String dict : oreNames) { if(dict.length() > 3 && dict.startsWith("dye")) { String color = dict.substring(3).toLowerCase(Locale.US); if(nameToColor.containsKey(color)) return nameToColor.get(color); } } - + return 0; } } diff --git a/src/main/java/com/hbm/util/Compat.java b/src/main/java/com/hbm/util/Compat.java index 9d46d714b..cac127f1a 100644 --- a/src/main/java/com/hbm/util/Compat.java +++ b/src/main/java/com/hbm/util/Compat.java @@ -1,10 +1,5 @@ package com.hbm.util; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - import com.hbm.config.GeneralConfig; import com.hbm.handler.HazmatRegistry; import com.hbm.hazard.HazardRegistry; @@ -12,7 +7,6 @@ import com.hbm.inventory.FluidContainer; import com.hbm.inventory.FluidContainerRegistry; import com.hbm.inventory.fluid.Fluids; import com.hbm.main.MainRegistry; - import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.eventhandler.EventBus; @@ -26,8 +20,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + public class Compat { - + public static final String MOD_GT6 = "gregtech"; public static final String MOD_GCC = "GalacticraftCore"; public static final String MOD_AR = "advancedrocketry"; @@ -46,15 +45,15 @@ public class Compat { public static Block tryLoadBlock(String domain, String name) { return (Block) Block.blockRegistry.getObject(getReg(domain, name)); } - + private static String getReg(String domain, String name) { return domain + ":" + name; } - + public static boolean isModLoaded(String modid) { return Loader.isModLoaded(modid); } - + public static enum ReikaIsotope { C14(HazardRegistry.gen_10K), U235(HazardRegistry.u235), @@ -89,33 +88,33 @@ public class Compat { Ru103(HazardRegistry.gen_S), Pm149(HazardRegistry.gen_10D), Rh105(HazardRegistry.gen_H); - + private float rads; - + private ReikaIsotope(float rads) { this.rads = rads; } - + public float getRad() { return this.rads; } } - + public static List scrapeItemFromME(ItemStack meDrive) { List stacks = new ArrayList(); - + try { if(meDrive != null && meDrive.hasTagCompound()) { NBTTagCompound nbt = meDrive.getTagCompound(); int types = nbt.getShort("it"); //ITEM_TYPE_TAG - + for(int i = 0; i < types; i++) { NBTBase stackTag = nbt.getTag("#" + i); - + if(stackTag instanceof NBTTagCompound) { NBTTagCompound compound = (NBTTagCompound) stackTag; ItemStack stack = ItemStack.loadItemStackFromNBT(compound); - + int count = nbt.getInteger("@" + i); stack.stackSize = count; stacks.add(stack); @@ -123,66 +122,66 @@ public class Compat { } } } catch(Exception ex) { } - + return stacks; } - + public static void registerCompatHazmat() { - + double helmet = 0.2D; double chest = 0.4D; double legs = 0.3D; double boots = 0.1D; - + double p90 = 1.0D; // 90% double p99 = 2D; // 99% - + tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.radiation.head", p90 * helmet); tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.radiation.chest", p90 * chest); tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.radiation.legs", p90 * legs); tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.radiation.boots", p90 * boots); - + tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.universal.head", p99 * helmet); tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.universal.chest", p99 * chest); tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.universal.legs", p99 * legs); tryRegisterHazmat(Compat.MOD_GT6, "gt.armor.hazmat.universal.boots", p99 * boots); - + tryRegisterHazmat(Compat.MOD_REC, "reactorcraft_item_hazhelmet", p99 * helmet); tryRegisterHazmat(Compat.MOD_REC, "reactorcraft_item_hazchest", p99 * chest); tryRegisterHazmat(Compat.MOD_REC, "reactorcraft_item_hazlegs", p99 * legs); tryRegisterHazmat(Compat.MOD_REC, "reactorcraft_item_hazboots", p99 * boots); - + tryRegisterHazmat(Compat.MOD_EF, "netherite_helmet", p90 * helmet); tryRegisterHazmat(Compat.MOD_EF, "netherite_chestplate", p90 * chest); tryRegisterHazmat(Compat.MOD_EF, "netherite_leggings", p90 * legs); tryRegisterHazmat(Compat.MOD_EF, "netherite_boots", p90 * boots); } - + private static void tryRegisterHazmat(String mod, String name, double resistance) { Item item = Compat.tryLoadItem(mod, name); if(item != null) { HazmatRegistry.registerHazmat(item, resistance); } } - + public static void registerCompatFluidContainers() { - + if(Compat.isModLoaded(Compat.MOD_TC) && GeneralConfig.enableFluidContainerCompat) { Item canister = Compat.tryLoadItem(Compat.MOD_TC, "emptyCanister"); Item diesel = Compat.tryLoadItem(Compat.MOD_TC, "diesel"); if(diesel != null && canister != null) FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(diesel), new ItemStack(canister), Fluids.DIESEL, 1000)); } } - + public static void handleRailcraftNonsense() { - + if(!Loader.isModLoaded(MOD_RC)) return; MainRegistry.logger.info("#######################################################"); MainRegistry.logger.info("| Railcraft detected, deploying anti-nonsense measures..."); - + try { - + ConcurrentHashMap> listeners = ReflectionHelper.getPrivateValue(EventBus.class, FMLCommonHandler.instance().bus(), "listeners"); Object nonsense = null; for(Object o : listeners.keySet()) { @@ -192,16 +191,16 @@ public class Compat { break; } } - + FMLCommonHandler.instance().bus().unregister(nonsense); MainRegistry.logger.info("| Successfully removed Railcraft nonsense."); - + } catch(Exception x) { MainRegistry.logger.error("| Tried to remove Railcraft block but failed due to " + x.getMessage()); } MainRegistry.logger.info("#######################################################"); } - + public static Class getChunkBiomeHook() { try { return Class.forName("com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook"); @@ -209,9 +208,9 @@ public class Compat { return null; } } - + public static Method getBiomeShortArray; - + public static Method getBiomeShortArray() { if(getBiomeShortArray != null) return getBiomeShortArray; try { @@ -222,7 +221,7 @@ public class Compat { return null; } } - + public static short[] getBiomeShortArray(Object instance) { Method m = getBiomeShortArray(); if(m != null) { @@ -232,7 +231,7 @@ public class Compat { } return null; } - + /** A standard implementation of safely grabbing a tile entity without loading chunks, might have more fluff added to it later on. */ public static TileEntity getTileStandard(World world, int x, int y, int z) { if(!world.getChunkProvider().chunkExists(x >> 4, z >> 4)) return null; diff --git a/src/main/java/com/hbm/util/CompatEnergyControl.java b/src/main/java/com/hbm/util/CompatEnergyControl.java index 0de988733..3542cd5fd 100644 --- a/src/main/java/com/hbm/util/CompatEnergyControl.java +++ b/src/main/java/com/hbm/util/CompatEnergyControl.java @@ -1,8 +1,9 @@ package com.hbm.util; -import java.util.ArrayList; -import java.util.List; - +import api.hbm.energymk2.IBatteryItem; +import api.hbm.energymk2.IEnergyHandlerMK2; +import api.hbm.fluid.IFluidUser; +import api.hbm.tile.IInfoProviderEC; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; @@ -10,20 +11,18 @@ import com.hbm.items.ModItems; import com.hbm.tileentity.machine.TileEntityMachineGasCent; import com.hbm.tileentity.machine.TileEntityMachineGasCent.PseudoFluidTank; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase; - -import api.hbm.energymk2.IBatteryItem; -import api.hbm.energymk2.IEnergyHandlerMK2; -import api.hbm.fluid.IFluidUser; -import api.hbm.tile.IInfoProviderEC; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import java.util.ArrayList; +import java.util.List; + /** Provides data specified by EC's CrossModBase */ public class CompatEnergyControl { - + /** Returns the steel ingot to craft the sensor kit with */ public static ItemStack getCraftingMaterial() { return new ItemStack(ModItems.ingot_steel); //in the event that i do end up moving all ingots to metadata @@ -33,7 +32,7 @@ public class CompatEnergyControl { public static boolean isElectricItem(ItemStack stack) { return stack.getItem() instanceof IBatteryItem; } - + /** Standardized discharge for IBatteryItem, returns the amount that was removed */ public static double dischargeItem(ItemStack stack, double needed) { IBatteryItem battery = (IBatteryItem) stack.getItem(); @@ -41,97 +40,97 @@ public class CompatEnergyControl { battery.dischargeBattery(stack, toDischarge); return toDischarge; } - + /** Returns the power and maxPower values for IEnergyUser */ public static void getEnergyData(TileEntity tile, NBTTagCompound data) { - + data.setString(KEY_EUTYPE, "HE"); - + if(tile instanceof IEnergyHandlerMK2) { IEnergyHandlerMK2 user = (IEnergyHandlerMK2) tile; data.setDouble(L_ENERGY_HE, user.getPower()); data.setDouble(L_CAPACITY_HE, user.getMaxPower()); } } - + /** Returns the heat for RBMKs */ public static int getHeat(TileEntity tile) { if(tile instanceof TileEntityRBMKBase) return (int) ((TileEntityRBMKBase) tile).heat; //original implementation also used the SNR and LNR for some reason, but those no longer exist. neither ZINOX nor research reactor were part of the system. return -1; } - + /** Returns a list of Object arrays, one array for each fluid tank where the array contains fluid name, fill state and capacity (STRING, INTEGER, INTEGER) */ public static List getAllTanks(TileEntity tile) { - + List list = new ArrayList(); - + if(tile instanceof IFluidUser) { IFluidUser user = (IFluidUser) tile; - + for(FluidTank tank : user.getAllTanks()) { if(tank.getTankType() == Fluids.SMOKE || tank.getTankType() == Fluids.SMOKE_LEADED || tank.getTankType() == Fluids.SMOKE_POISON) continue; list.add(toFluidInfo(tank)); } } - + if(tile instanceof TileEntityMachineGasCent) { TileEntityMachineGasCent cent = (TileEntityMachineGasCent) tile; list.add(toFluidInfo(cent.inputTank)); list.add(toFluidInfo(cent.outputTank)); } - + if(!list.isEmpty()) return list; - + return null; } - + private static Object[] toFluidInfo(FluidTank tank) { return new Object[] {tank.getTankType().getName(), tank.getFill(), tank.getMaxFill()}; } - + private static Object[] toFluidInfo(PseudoFluidTank tank) { return new Object[] {tank.getTankType().getName(), tank.getFill(), tank.getMaxFill()}; } - + /** Returns any non-standard data like progress, unique stats and so forth. Data comes from the IInfoProviderEC implementation */ public static void getExtraData(TileEntity tile, NBTTagCompound data) { - + if(tile instanceof IInfoProviderEC) { IInfoProviderEC provider = (IInfoProviderEC) tile; provider.provideExtraInfo(data); } } - + /** Returns the core tile entity for that position, can resolve the MK1 "IMultiblock" and MK2 "BlockDummyable" systems. */ public static TileEntity findTileEntity(World world, int x, int y, int z) { return CompatExternal.getCoreFromPos(world, x, y, z); //CompatExternal you're just standing around, do something for once } - + /** Returns the ResourceLocation for the given fluid name */ public static ResourceLocation getFluidTexture(String name) { FluidType type = Fluids.fromName(name); return type == null ? null : type.getTexture(); } - + /* * [DATA TYPE] _ [NAME] _ [UNIT] */ public static final String KEY_EUTYPE = "euType"; - + public static final String L_ENERGY_HE = "energy"; public static final String L_ENERGY_TU = "energyTU"; public static final String L_ENERGY_ = "energy_"; // Blast Furnace fuel - + public static final String L_CAPACITY_HE = "capacity"; public static final String L_CAPACITY_TU = "capacityTU"; public static final String L_CAPACITY_ = "capacity_"; // Blast Furnace fuel capacity - + public static final String D_CONSUMPTION_HE = "consumptionHE"; public static final String D_CONSUMPTION_MB = "consumption"; @Deprecated public static final String S_CONSUMPTION_ = "consumption_"; // FWatz fluid consumption rates - + public static final String D_OUTPUT_HE = "output"; public static final String D_OUTPUT_MB = "outputmb"; public static final String D_OUTPUT_TU = "outputTU"; diff --git a/src/main/java/com/hbm/util/CompatExternal.java b/src/main/java/com/hbm/util/CompatExternal.java index aa029a34f..2a7f1177c 100644 --- a/src/main/java/com/hbm/util/CompatExternal.java +++ b/src/main/java/com/hbm/util/CompatExternal.java @@ -7,6 +7,9 @@ import java.util.Set; import java.util.function.BiFunction; import java.util.function.Consumer; +import api.hbm.energymk2.IEnergyHandlerMK2; +import api.hbm.energymk2.IEnergyReceiverMK2; +import api.hbm.fluid.IFluidUser; import com.hbm.blocks.BlockDummyable; import com.hbm.entity.missile.EntityMissileCustom; import com.hbm.explosion.ExplosionNukeSmall; @@ -15,10 +18,6 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.items.weapon.ItemCustomMissilePart.WarheadType; import com.hbm.tileentity.machine.TileEntityDummy; import com.hbm.tileentity.turret.TileEntityTurretSentry; - -import api.hbm.energymk2.IEnergyHandlerMK2; -import api.hbm.energymk2.IEnergyReceiverMK2; -import api.hbm.fluid.IFluidUser; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntityChicken; @@ -41,73 +40,73 @@ public class CompatExternal { * @return the core tile entity if the given position holds a dummy, the tile entity at that position if it doesn't or null if there is no tile entity */ public static TileEntity getCoreFromPos(World world, int x, int y, int z) { - + Block b = world.getBlock(x, y, z); - + //if the block at that pos is a Dummyable, use the mk2's system to find the core if(b instanceof BlockDummyable) { BlockDummyable dummy = (BlockDummyable) b; int[] pos = dummy.findCore(world, x, y, z); - + if(pos != null) { return world.getTileEntity(pos[0], pos[1], pos[2]); } } - + TileEntity tile = world.getTileEntity(x, y, z); - + //if the tile at that pos is an old dummy tile, use mk1 if(tile instanceof TileEntityDummy) { TileEntityDummy dummy = (TileEntityDummy) tile; return world.getTileEntity(dummy.targetX, dummy.targetY, dummy.targetZ); } - + //otherwise, return the tile at that position whihc could be null return tile; } - + /** * Returns the numeric value of the buffered energy held by that tile entity. Current implementation relies on IEnergyUser. * @param tile * @return power */ public static long getBufferedPowerFromTile(TileEntity tile) { - + if(tile instanceof IEnergyHandlerMK2) { return ((IEnergyHandlerMK2) tile).getPower(); } - + return 0L; } - + /** * Returns the numeric value of the energy capacity of this tile entity. Current implementation relies on IEnergyUser. * @param tile * @return max power */ public static long getMaxPowerFromTile(TileEntity tile) { - + if(tile instanceof IEnergyHandlerMK2) { return ((IEnergyHandlerMK2) tile).getMaxPower(); } - + return 0L; } - + /** * Returns the ordinal of the energy priority from the supplied tile entity. 0 = low, 1 = normal, 2 = high. Returns -1 if not applicable. * @param tile * @return priority */ public static int getEnergyPriorityFromTile(TileEntity tile) { - + if(tile instanceof IEnergyReceiverMK2) { return ((IEnergyReceiverMK2) tile).getPriority().ordinal(); } - + return -1; } - + /** * Returns a list of tank definitions from the supplied tile entity. Uses IFluidUser, if the tile is incompatible it returns an empty list. * @param tile @@ -120,13 +119,13 @@ public class CompatExternal { */ public static ArrayList getFluidInfoFromTile(TileEntity tile) { ArrayList list = new ArrayList(); - + if(!(tile instanceof IFluidUser)) { return list; } - + IFluidUser container = (IFluidUser) tile; - + for(FluidTank tank : container.getAllTanks()) { FluidType type = tank.getTankType(); list.add(new Object[] { @@ -137,7 +136,7 @@ public class CompatExternal { tank.getMaxFill() }); } - + return list; } @@ -145,14 +144,14 @@ public class CompatExternal { public static Set turretTargetFriendly = new HashSet(); public static Set turretTargetHostile = new HashSet(); public static Set turretTargetMachine = new HashSet(); - + /** * Registers a class for turret targeting * @param clazz is the class that should be targeted. * @param type determines what setting the turret needs to have enabled to target this class. 0 is player, 1 is friendly, 2 is hostile and 3 is machine. */ public static void registerTurretTargetSimple(Class clazz, int type) { - + switch(type) { case 0: turretTargetPlayer.add(clazz); break; case 1: turretTargetFriendly.add(clazz); break; @@ -160,9 +159,9 @@ public class CompatExternal { case 3: turretTargetMachine.add(clazz); break; } } - + public static Set turretTargetBlacklist = new HashSet(); - + /** * Registers a class to be fully ignored by turrets * @param clazz is the class that should be ignored. @@ -170,9 +169,9 @@ public class CompatExternal { public static void registerTurretTargetBlacklist(Class clazz) { turretTargetBlacklist.add(clazz); } - + public static HashMap> turretTargetCondition = new HashMap(); - + /** * Registers a BiFunction lambda for more complex targeting compatibility * @param clazz is the class that this rule should apply to @@ -187,7 +186,7 @@ public class CompatExternal { public static void setWarheadLabel(WarheadType type, String label) { type.labelCustom = label; } public static void setWarheadImpact(WarheadType type, Consumer impact) { type.impactCustom = impact; } public static void setWarheadUpdate(WarheadType type, Consumer update) { type.updateCustom = update; } - + public static void compatExamples() { // Makes all cows be targeted by turrets if player mode is active in addition to the existing rules. Applies to all entities that inherit EntityCow. CompatExternal.registerTurretTargetSimple(EntityCow.class, 0); diff --git a/src/main/java/com/hbm/util/CompatNER.java b/src/main/java/com/hbm/util/CompatNER.java index cb4b622dd..63ba2ae2e 100644 --- a/src/main/java/com/hbm/util/CompatNER.java +++ b/src/main/java/com/hbm/util/CompatNER.java @@ -1,13 +1,9 @@ package com.hbm.util; -import java.util.ArrayList; -import java.util.List; - import com.hbm.blocks.ModBlocks; import com.hbm.entity.mob.EntityCreeperNuclear; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; - import cpw.mods.fml.common.event.FMLInterModComms; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -15,23 +11,26 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; +import java.util.ArrayList; +import java.util.List; + public class CompatNER { - + /* * INIT */ - + public static void init() { sendRegisterOre(new ItemStack(ModBlocks.ore_alexandrite), false, 0xff00ff, new ItemStack(ModItems.gem_alexandrite)); sendRegisterMob(EntityCreeperNuclear.class, "-1", encodeDrops( new DropItem(new ItemStack(Blocks.tnt), 0, 2), new DropItem(new ItemStack(ModItems.coin_creeper), 1, 1, 0.33F))); } - + /* * REGISTERS */ - + public static void sendRegisterOre(ItemStack ore, boolean silk, int color, ItemStack... drops) { NBTTagCompound data = new NBTTagCompound(); data.setTag(stack, ore.writeToNBT(new NBTTagCompound())); @@ -41,16 +40,16 @@ public class CompatNER { int[] distribution = new int[256]; for(int i = 0; i < 256; i++) distribution[i] = 100; data.setIntArray("distribution", distribution); - + NBTTagCompound res = new NBTTagCompound(); NBTTagCompound block = new NBTTagCompound(); block.setTag("stack", new ItemStack(Blocks.stone).writeToNBT(new NBTTagCompound())); res.setTag("block", block); data.setTag(restriction, res); - + FMLInterModComms.sendMessage(notEnoughResources, registerOre, data); } - + public static void sendRegisterMob(Class clazz, String light, NBTTagList drops) { NBTTagCompound data = new NBTTagCompound(); data.setString(name, clazz.getName()); @@ -59,31 +58,31 @@ public class CompatNER { MainRegistry.logger.info("Sending " + registerMob + " to " + notEnoughResources); FMLInterModComms.sendMessage(notEnoughResources, registerMob, data); } - + /* * ENCODERS */ - + public static String encodeLightLevel(int level, boolean below) { return level + ":" + (below ? "b" : "a"); } - + public static NBTTagList encodeDrops(DropItem... stacks) { NBTTagList list = new NBTTagList(); for(DropItem stack : stacks) list.appendTag(stack.writeToNBT()); return list; } - + public static NBTTagList encodeStacks(ItemStack... stacks) { NBTTagList list = new NBTTagList(); for(ItemStack stack : stacks) list.appendTag(stack.writeToNBT(new NBTTagCompound())); return list; } - + /* * DROP SYSTEM */ - + public static class DropItem { public ItemStack drop; public int min = 1; @@ -112,11 +111,11 @@ public class CompatNER { return compound; } } - + /* * CONSTANTS */ - + public static final String notEnoughResources = "neresources"; public static final String registerDungeon = "registerDungeon"; public static final String registerMob = "registerMob"; @@ -154,7 +153,7 @@ public class CompatNER { public static final String blockRestriction = "block"; public static final String dimensionRestriction = "dimension"; public static final String biomeRestriction = "biome"; - + public static final String conditional_rareDrop = "ner.rareDrop.text"; public static final String conditional_silkTouch = "ner.ore.silkTouch"; public static final String conditional_equipmentDrop = "ner.equipmentDrop.text"; diff --git a/src/main/java/com/hbm/util/ContaminationUtil.java b/src/main/java/com/hbm/util/ContaminationUtil.java index 63689591b..35a8763e9 100644 --- a/src/main/java/com/hbm/util/ContaminationUtil.java +++ b/src/main/java/com/hbm/util/ContaminationUtil.java @@ -1,17 +1,14 @@ package com.hbm.util; -import java.util.HashSet; - -import com.hbm.entity.mob.EntityDuck; +import api.hbm.entity.IRadiationImmune; import com.hbm.entity.mob.EntityCreeperNuclear; +import com.hbm.entity.mob.EntityDuck; import com.hbm.entity.mob.EntityQuackos; import com.hbm.extprop.HbmLivingProps; import com.hbm.handler.HazmatRegistry; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.potion.HbmPotion; import com.hbm.util.ArmorRegistry.HazardClass; - -import api.hbm.entity.IRadiationImmune; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntitySkeleton; @@ -25,25 +22,27 @@ import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import java.util.HashSet; + public class ContaminationUtil { - + /** * Calculates how much radiation can be applied to this entity by calculating resistance * @param entity * @return */ public static float calculateRadiationMod(EntityLivingBase entity) { - + if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; - + float koeff = 10.0F; return (float) Math.pow(koeff, -HazmatRegistry.getResistance(player)); } - + return 1; } - + public static float getRads(Entity e) { if(!(e instanceof EntityLivingBase)) @@ -51,19 +50,19 @@ public class ContaminationUtil { if(isRadImmune(e)) return 0.0F; - + EntityLivingBase entity = (EntityLivingBase)e; - + return HbmLivingProps.getRadiation(entity); } - + public static HashSet immuneEntities = new HashSet(); - + public static boolean isRadImmune(Entity e) { if(e instanceof EntityLivingBase && ((EntityLivingBase)e).isPotionActive(HbmPotion.mutation)) return true; - + if(immuneEntities.isEmpty()) { immuneEntities.add(EntityCreeperNuclear.class); immuneEntities.add(EntityMooshroom.class); @@ -73,62 +72,62 @@ public class ContaminationUtil { immuneEntities.add(EntityOcelot.class); immuneEntities.add(IRadiationImmune.class); } - + Class entityClass = e.getClass(); - + for(Class clazz : immuneEntities) { if(clazz.isAssignableFrom(entityClass)) return true; } - + if("cyano.lootable.entities.EntityLootableBody".equals(entityClass.getName())) return true; - + return false; } - + /// ASBESTOS /// public static void applyAsbestos(Entity e, int i) { if(!(e instanceof EntityLivingBase)) return; - + if(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode) return; - + if(e instanceof EntityPlayer && e.ticksExisted < 200) return; - + EntityLivingBase entity = (EntityLivingBase)e; - + if(ArmorRegistry.hasAllProtection(entity, 3, HazardClass.PARTICLE_FINE)) ArmorUtil.damageGasMaskFilter(entity, i); else HbmLivingProps.incrementAsbestos(entity, i); } - + /// DIGAMMA /// public static void applyDigammaData(Entity e, float f) { if(!(e instanceof EntityLivingBase)) return; - + if(e instanceof EntityDuck || e instanceof EntityOcelot) return; - + if(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode) return; - + if(e instanceof EntityPlayer && e.ticksExisted < 200) return; - + EntityLivingBase entity = (EntityLivingBase)e; - + if(entity.isPotionActive(HbmPotion.stability.id)) return; - + if(!(entity instanceof EntityPlayer && ArmorUtil.checkForDigamma((EntityPlayer) entity))) HbmLivingProps.incrementDigamma(entity, f); } - + public static void applyDigammaDirect(Entity e, float f) { if(!(e instanceof EntityLivingBase)) @@ -136,23 +135,23 @@ public class ContaminationUtil { if(e instanceof IRadiationImmune) return; - + if(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode) return; - + EntityLivingBase entity = (EntityLivingBase)e; HbmLivingProps.incrementDigamma(entity, f); } - + public static float getDigamma(Entity e) { if(!(e instanceof EntityLivingBase)) return 0.0F; - + EntityLivingBase entity = (EntityLivingBase)e; return HbmLivingProps.getDigamma(entity); } - + public static void printGeigerData(EntityPlayer player) { World world = player.worldObj; @@ -161,7 +160,7 @@ public class ContaminationUtil { double rads = ((int)(ChunkRadiationManager.proxy.getRadiation(world, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ)) * 10)) / 10D; double env = ((int)(HbmLivingProps.getRadBuf(player) * 10D)) / 10D; - + double res = ((int)(10000D - ContaminationUtil.calculateRadiationMod(player) * 10000D)) / 100D; double resKoeff = ((int)(HazmatRegistry.getResistance(player) * 100D)) / 100D; @@ -169,7 +168,7 @@ public class ContaminationUtil { String envPrefix = getPreffixFromRad(env); String radPrefix = ""; String resPrefix = "" + EnumChatFormatting.WHITE; - + if(eRad < 200) radPrefix += EnumChatFormatting.GREEN; else if(eRad < 400) @@ -182,7 +181,7 @@ public class ContaminationUtil { radPrefix += EnumChatFormatting.DARK_RED; else radPrefix += EnumChatFormatting.DARK_GRAY; - + if(resKoeff > 0) resPrefix += EnumChatFormatting.GREEN; @@ -194,27 +193,27 @@ public class ContaminationUtil { player.addChatMessage(new ChatComponentTranslation("geiger.playerRad").appendSibling(new ChatComponentText(" " + radPrefix + eRad + " RAD")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); player.addChatMessage(new ChatComponentTranslation("geiger.playerRes").appendSibling(new ChatComponentText(" " + resPrefix + res + "% (" + resKoeff + ")")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); } - + public static void printDosimeterData(EntityPlayer player) { double env = ((int)(HbmLivingProps.getRadBuf(player) * 10D)) / 10D; boolean limit = false; - + if(env > 3.6D) { env = 3.6D; limit = true; } - + String envPrefix = getPreffixFromRad(env); - + player.addChatMessage(new ChatComponentText("===== ☢ ").appendSibling(new ChatComponentTranslation("geiger.title.dosimeter")).appendSibling(new ChatComponentText(" ☢ =====")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD))); player.addChatMessage(new ChatComponentTranslation("geiger.envRad").appendSibling(new ChatComponentText(" " + envPrefix + (limit ? ">" : "") + env + " RAD/s")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW))); } - + public static String getPreffixFromRad(double rads) { String chunkPrefix = ""; - + if(rads == 0) chunkPrefix += EnumChatFormatting.GREEN; else if(rads < 1) @@ -227,26 +226,26 @@ public class ContaminationUtil { chunkPrefix += EnumChatFormatting.DARK_RED; else chunkPrefix += EnumChatFormatting.DARK_GRAY; - + return chunkPrefix; } - + public static void printDiagnosticData(EntityPlayer player) { double digamma = ((int)(HbmLivingProps.getDigamma(player) * 100)) / 100D; double halflife = ((int)((1D - Math.pow(0.5, digamma)) * 10000)) / 100D; - + player.addChatMessage(new ChatComponentText("===== Ϝ ").appendSibling(new ChatComponentTranslation("digamma.title")).appendSibling(new ChatComponentText(" Ϝ =====")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_PURPLE))); player.addChatMessage(new ChatComponentTranslation("digamma.playerDigamma").appendSibling(new ChatComponentText(EnumChatFormatting.RED + " " + digamma + " DRX")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.LIGHT_PURPLE))); player.addChatMessage(new ChatComponentTranslation("digamma.playerHealth").appendSibling(new ChatComponentText(EnumChatFormatting.RED + " " + halflife + "%")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.LIGHT_PURPLE))); player.addChatMessage(new ChatComponentTranslation("digamma.playerRes").appendSibling(new ChatComponentText(EnumChatFormatting.BLUE + " " + "N/A")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.LIGHT_PURPLE))); } - + public static enum HazardType { RADIATION, DIGAMMA } - + public static enum ContaminationType { FARADAY, //preventable by metal armor HAZMAT, //preventable by hazmat @@ -257,23 +256,23 @@ public class ContaminationUtil { RAD_BYPASS, //same as creative but will not apply radiation resistance calculation NONE //not preventable } - + /* * This system is nice but the cont types are a bit confusing. Cont types should have much better names and multiple cont types should be applicable. */ @SuppressWarnings("incomplete-switch") //just shut up //instead of this does-everything-but-nothing-well solution, please use the ArmorRegistry to check for protection and the HBM Props for applying contamination. still good for regular radiation tho public static boolean contaminate(EntityLivingBase entity, HazardType hazard, ContaminationType cont, float amount) { - + if(hazard == HazardType.RADIATION) { float radEnv = HbmLivingProps.getRadEnv(entity); HbmLivingProps.setRadEnv(entity, radEnv + amount); } - + if(entity instanceof EntityPlayer) { - + EntityPlayer player = (EntityPlayer)entity; - + switch(cont) { case FARADAY: if(ArmorUtil.checkForFaraday(player)) return false; break; case HAZMAT: if(ArmorUtil.checkForHazmat(player)) return false; break; @@ -281,22 +280,22 @@ public class ContaminationUtil { case DIGAMMA: if(ArmorUtil.checkForDigamma(player)) return false; if(ArmorUtil.checkForDigamma2(player)) return false; break; case DIGAMMA2: if(ArmorUtil.checkForDigamma2(player)) return false; break; } - + if(player.capabilities.isCreativeMode && cont != ContaminationType.NONE && cont != ContaminationType.DIGAMMA2) return false; - + if(player.ticksExisted < 200) return false; } - + if(hazard == HazardType.RADIATION && isRadImmune(entity)) return false; - + switch(hazard) { case RADIATION: HbmLivingProps.incrementRadiation(entity, amount * (cont == ContaminationType.RAD_BYPASS ? 1 : calculateRadiationMod(entity))); break; case DIGAMMA: HbmLivingProps.incrementDigamma(entity, amount); break; } - + return true; } } diff --git a/src/main/java/com/hbm/util/CrashHelper.java b/src/main/java/com/hbm/util/CrashHelper.java index ed5198932..3eb440287 100644 --- a/src/main/java/com/hbm/util/CrashHelper.java +++ b/src/main/java/com/hbm/util/CrashHelper.java @@ -1,7 +1,6 @@ package com.hbm.util; import com.hbm.inventory.recipes.loader.SerializableRecipe; - import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ICrashCallable; @@ -10,7 +9,7 @@ public class CrashHelper { public static void init() { FMLCommonHandler.instance().registerCrashCallable(new CrashCallableRecipe()); } - + public static class CrashCallableRecipe implements ICrashCallable { @Override @@ -20,13 +19,13 @@ public class CrashHelper { @Override public String call() throws Exception { - + String call = ""; - + for(SerializableRecipe rec : SerializableRecipe.recipeHandlers) { if(rec.modified) call += "\n\t\t" + rec.getFileName(); } - + return call; } } diff --git a/src/main/java/com/hbm/util/CrucibleUtil.java b/src/main/java/com/hbm/util/CrucibleUtil.java index 9dc69dbba..222abab88 100644 --- a/src/main/java/com/hbm/util/CrucibleUtil.java +++ b/src/main/java/com/hbm/util/CrucibleUtil.java @@ -1,19 +1,18 @@ package com.hbm.util; -import java.util.List; - +import api.hbm.block.ICrucibleAcceptor; import com.hbm.inventory.material.Mats.MaterialStack; import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior; - -import api.hbm.block.ICrucibleAcceptor; import net.minecraft.block.Block; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.List; + public class CrucibleUtil { - + /** * Standard pouring, casting a hitscan straight down at the given coordinates with the given range. Returns the leftover material, just like ICrucibleAcceptor's pour. * The method directly modifies the original stack, so be careful and make a copy beforehand if you don't want that. @@ -21,21 +20,21 @@ public class CrucibleUtil { */ public static MaterialStack pourSingleStack(World world, double x, double y, double z, double range, boolean safe, MaterialStack stack, int quanta, Vec3 impactPosHolder) { - + Vec3 start = Vec3.createVectorHelper(x, y, z); Vec3 end = Vec3.createVectorHelper(x, y - range, z); - + MovingObjectPosition[] mopHolder = new MovingObjectPosition[1]; ICrucibleAcceptor acc = getPouringTarget(world, start, end, mopHolder); MovingObjectPosition mop = mopHolder[0]; - + if(acc == null) { spill(mop, safe, stack, quanta, impactPosHolder); return stack; } - + MaterialStack ret = tryPourStack(world, acc, mop, stack, impactPosHolder); - + if(ret != null) { return ret; } @@ -43,95 +42,95 @@ public class CrucibleUtil { spill(mop, safe, stack, quanta, impactPosHolder); return stack; } - + /** * Standard pouring, casting a hitscan straight down at the given coordinates with the given range. Returns the materialStack that has been removed. * The method doesn't make copies of the MaterialStacks in the list, so the materials being subtracted or outright removed will apply to the original list. * Pass an empty Vec3 instance in order to get the impact position of the stream. */ public static MaterialStack pourFullStack(World world, double x, double y, double z, double range, boolean safe, List stacks, int quanta, Vec3 impactPosHolder) { - + if(stacks.isEmpty()) return null; - + Vec3 start = Vec3.createVectorHelper(x, y, z); Vec3 end = Vec3.createVectorHelper(x, y - range, z); - + MovingObjectPosition[] mopHolder = new MovingObjectPosition[1]; ICrucibleAcceptor acc = getPouringTarget(world, start, end, mopHolder); MovingObjectPosition mop = mopHolder[0]; - + if(acc == null) { return spill(mop, safe, stacks, quanta, impactPosHolder); } - + for(MaterialStack stack : stacks) { if(stack.material == null) continue; - + int amountToPour = Math.min(stack.amount, quanta); MaterialStack toPour = new MaterialStack(stack.material, amountToPour); MaterialStack left = tryPourStack(world, acc, mop, toPour, impactPosHolder); - + if(left != null) { stack.amount -= (amountToPour - left.amount); return new MaterialStack(stack.material, stack.amount - left.amount); } } - + return spill(mop, safe, stacks, quanta, impactPosHolder); } - + /** * Tries to pour the stack onto the supplied crucible acceptor instance. Also features our friend the Vec3 dummy, which will be filled with the stream's impact position. * Returns whatever is left of the stack when successful or null when unsuccessful (potential spillage). */ public static MaterialStack tryPourStack(World world, ICrucibleAcceptor acc, MovingObjectPosition mop, MaterialStack stack, Vec3 impactPosHolder) { Vec3 hit = mop.hitVec; - + if(stack.material.smeltable != SmeltingBehavior.SMELTABLE) { return null; } - + if(acc.canAcceptPartialPour(world, mop.blockX, mop.blockY, mop.blockZ, hit.xCoord, hit.yCoord, hit.zCoord, ForgeDirection.getOrientation(mop.sideHit), stack)) { MaterialStack left = acc.pour(world, mop.blockX, mop.blockY, mop.blockZ, hit.xCoord, hit.yCoord, hit.zCoord, ForgeDirection.getOrientation(mop.sideHit), stack); if(left == null) { left = new MaterialStack(stack.material, 0); } - + impactPosHolder.xCoord = hit.xCoord; impactPosHolder.yCoord = hit.yCoord; impactPosHolder.zCoord = hit.zCoord; - + return left; } - + return null; } - + /** * Uses hitscan to find the target of the pour, from start (the top) to end (the bottom). Pass a single cell MOP array to get the reference of the MOP for later use. * Now we're thinking with reference types. */ public static ICrucibleAcceptor getPouringTarget(World world, Vec3 start, Vec3 end, MovingObjectPosition[] mopHolder) { - + MovingObjectPosition mop = world.func_147447_a(start, end, true, true, true); - + if(mopHolder != null) { mopHolder[0] = mop; } - + if(mop == null || mop.typeOfHit != mop.typeOfHit.BLOCK) { return null; } - + Block b = world.getBlock(mop.blockX, mop.blockY, mop.blockZ); - + if(!(b instanceof ICrucibleAcceptor)) { return null; } - + return (ICrucibleAcceptor) b; } - + /** * Regular spillage routine but accepts a stack list instead of a stack. simply uses the first available stack from the list. Assumes list is not empty. */ @@ -141,30 +140,30 @@ public class CrucibleUtil { MaterialStack ret = spill(mop, safe, top, quanta, impactPos); //remove all stacks with no content stacks.removeIf(o -> o.amount <= 0); - + return ret; } - + /** * The routine used for then there is no valid crucible acceptor found. Will NOP with safe mode on. Returns the MaterialStack that was lost. */ public static MaterialStack spill(MovingObjectPosition mop, boolean safe, MaterialStack stack, int quanta, Vec3 impactPos) { - + //do nothing if safe mode is on if(safe) { return null; } - + MaterialStack toWaste = new MaterialStack(stack.material, Math.min(stack.amount, quanta)); stack.amount -= toWaste.amount; - + //if there is a vec3 reference, set the impact coordinates if(impactPos != null && mop != null) { impactPos.xCoord = mop.hitVec.xCoord; impactPos.yCoord = mop.hitVec.yCoord; impactPos.zCoord = mop.hitVec.zCoord; } - + return toWaste; } } diff --git a/src/main/java/com/hbm/util/EntityDamageUtil.java b/src/main/java/com/hbm/util/EntityDamageUtil.java index 83caeb807..95193b3b4 100644 --- a/src/main/java/com/hbm/util/EntityDamageUtil.java +++ b/src/main/java/com/hbm/util/EntityDamageUtil.java @@ -20,14 +20,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; public class EntityDamageUtil { - + public static boolean attackEntityFromIgnoreIFrame(Entity victim, DamageSource src, float damage) { if(!victim.attackEntityFrom(src, damage)) { - + if(victim instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase) victim; - + if(living.hurtResistantTime > living.maxHurtResistantTime / 2.0F) { damage += living.lastDamage; } @@ -37,7 +37,7 @@ public class EntityDamageUtil { return true; } } - + public static boolean attackEntityFromNT(EntityLivingBase living, DamageSource source, float amount, boolean ignoreIFrame, boolean allowSpecialCancel, double knockbackMultiplier, float pierceDT, float pierce) { if(living instanceof EntityPlayerMP && source.getEntity() instanceof EntityPlayer) { EntityPlayerMP playerMP = (EntityPlayerMP) living; @@ -50,13 +50,13 @@ public class EntityDamageUtil { DamageResistanceHandler.reset(); return ret; } - + private static boolean attackEntityFromNTInternal(EntityLivingBase living, DamageSource source, float amount, boolean ignoreIFrame, boolean allowSpecialCancel, double knockbackMultiplier) { if(ForgeHooks.onLivingAttack(living, source, amount) && allowSpecialCancel) return false; if(living.isEntityInvulnerable()) return false; if(living.worldObj.isRemote) return false; if(living instanceof EntityPlayer && ((EntityPlayer) living).capabilities.disableDamage && !source.canHarmInCreative()) return false; - + living.entityAge = 0; if(living.getHealth() <= 0.0F) return false; if(source.isFireDamage() && living.isPotionActive(Potion.fireResistance)) return false; @@ -154,10 +154,10 @@ public class EntityDamageUtil { if(!living.isEntityInvulnerable()) { amount = ForgeHooks.onLivingHurt(living, source, amount); if(amount <= 0) return; - + amount = applyArmorCalculationsNT(living, source, amount); amount = applyPotionDamageCalculations(living, source, amount); - + float originalAmount = amount; amount = Math.max(amount - living.getAbsorptionAmount(), 0.0F); living.setAbsorptionAmount(living.getAbsorptionAmount() - (originalAmount - amount)); @@ -181,14 +181,14 @@ public class EntityDamageUtil { return amount; } - + public static void damageArmorNT(EntityLivingBase living, float amount) { - + } - + /** Currently just a copy of the vanilla damage code */ @Deprecated public static boolean attackEntityFromNT(EntityLivingBase living, DamageSource source, float amount) { - + if(ForgeHooks.onLivingAttack(living, source, amount)) return false; if(living.isEntityInvulnerable()) { @@ -292,23 +292,23 @@ public class EntityDamageUtil { } } } - + // in this household we drink gasoline and sniff glue public static String getDeathSound(EntityLivingBase living) { Method m = ReflectionHelper.findMethod(EntityLivingBase.class, living, new String[] {"func_70673_aS", "getDeathSound"}); try { return (String) m.invoke(living); } catch(Exception e) { } return "game.neutral.die"; } - + public static String getHurtSound(EntityLivingBase living) { Method m = ReflectionHelper.findMethod(EntityLivingBase.class, living, new String[] {"func_70621_aR", "getHurtSound"}); try { return (String) m.invoke(living); } catch(Exception e) { } return "game.neutral.hurt"; } - + public static float getSoundVolume(EntityLivingBase living) { Method m = ReflectionHelper.findMethod(EntityLivingBase.class, living, new String[] {"func_70599_aP", "getSoundVolume"}); try { return (float) m.invoke(living); } catch(Exception e) { } return 1F; } - + public static float getSoundPitch(EntityLivingBase living) { Method m = ReflectionHelper.findMethod(EntityLivingBase.class, living, new String[] {"func_70647_i", "getSoundPitch"}); try { return (float) m.invoke(living); } catch(Exception e) { } return 1F; @@ -344,7 +344,7 @@ public class EntityDamageUtil { return amount; } - + public static float applyPotionDamageCalculations(EntityLivingBase living, DamageSource source, float amount) { if(source.isDamageAbsolute()) { return amount; @@ -364,7 +364,7 @@ public class EntityDamageUtil { if(amount <= 0.0F) { return 0.0F; } else { - + resistance = EnchantmentHelper.getEnchantmentModifierDamage(living.getLastActiveItems(), source); if(resistance > 20) { @@ -407,7 +407,7 @@ public class EntityDamageUtil { Entity entity = (Entity) list.get(i); if(entity.canBeCollidedWith()) { - + float borderSize = entity.getCollisionBorderSize(); AxisAlignedBB axisalignedbb = entity.boundingBox.expand(borderSize, borderSize, borderSize); MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(pos, end); @@ -441,17 +441,17 @@ public class EntityDamageUtil { if(pointedEntity != null && (closest < reach || objectMouseOver == null)) { objectMouseOver = new MovingObjectPosition(pointedEntity, hitvec); } - + return objectMouseOver; } - + public static MovingObjectPosition rayTrace(EntityPlayer player, double dist, float interp) { Vec3 pos = getPosition(player); Vec3 look = player.getLook(interp); Vec3 end = pos.addVector(look.xCoord * dist, look.yCoord * dist, look.zCoord * dist); return player.worldObj.func_147447_a(pos, end, false, false, true); } - + public static Vec3 getPosition(EntityPlayer player) { return Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ); } diff --git a/src/main/java/com/hbm/util/GameRuleHelper.java b/src/main/java/com/hbm/util/GameRuleHelper.java index 0811aa2a1..1551d02d1 100644 --- a/src/main/java/com/hbm/util/GameRuleHelper.java +++ b/src/main/java/com/hbm/util/GameRuleHelper.java @@ -1,37 +1,54 @@ package com.hbm.util; +import com.hbm.tileentity.machine.rbmk.RBMKDials; import net.minecraft.util.MathHelper; +import net.minecraft.world.GameRules; import net.minecraft.world.World; public class GameRuleHelper { - - public static double getClampedDouble(World world, String rule, double def, double min, double max) { - return MathHelper.clamp_double(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(rule), def), min, max); - } - - public static double getDoubleMinimum(World world, String rule, double def, double min) { - return Math.max(GameRuleHelper.parseDouble(world.getGameRules().getGameRuleStringValue(rule), def), min); - } - - public static int getIntegerMinimum(World world, String rule, int def, int min) { - return Math.max(GameRuleHelper.parseInt(world.getGameRules().getGameRuleStringValue(rule), def), min); + + public static double getClampedDouble(World world, RBMKDials.RBMKKeys rule, double min, double max) { + return MathHelper.clamp_double(GameRuleHelper.parseDouble(world, world.getGameRules().getGameRuleStringValue(rule.keyString), (double) rule.defValue), min, max); } - public static double parseDouble(String s, double def) { - + public static int getClampedInt(World world, RBMKDials.RBMKKeys rule, int min, int max) { + return MathHelper.clamp_int(GameRuleHelper.parseInt(world, world.getGameRules().getGameRuleStringValue(rule.keyString), (int) rule.defValue), min, max); + } + + public static double getDoubleMinimum(World world, RBMKDials.RBMKKeys rule, double min) { + return Math.max(GameRuleHelper.parseDouble(world, world.getGameRules().getGameRuleStringValue(rule.keyString), (double) rule.defValue), min); + } + + public static int getIntegerMinimum(World world, RBMKDials.RBMKKeys rule, int min) { + return Math.max(GameRuleHelper.parseInt(world, world.getGameRules().getGameRuleStringValue(rule.keyString), (int) rule.defValue), min); + } + + public static double parseDouble(World world, String s, double def) { + + GameRules rules = world.getGameRules(); + if(s.isEmpty() && !rules.hasRule(s)) { + rules.addGameRule(s, String.valueOf(def)); + return def; + } + try { return Double.parseDouble(s); } catch(Exception ex) { } - + return def; } - public static int parseInt(String s, int def) { - + public static int parseInt(World world, String s, int def) { + + GameRules rules = world.getGameRules(); + if(s.isEmpty() && !rules.hasRule(s)) { + rules.addGameRule(s, String.valueOf(def)); + } + try { return Integer.parseInt(s); } catch(Exception ex) { } - + return def; } diff --git a/src/main/java/com/hbm/util/HashedSet.java b/src/main/java/com/hbm/util/HashedSet.java index 6a45c952b..72ab2c102 100644 --- a/src/main/java/com/hbm/util/HashedSet.java +++ b/src/main/java/com/hbm/util/HashedSet.java @@ -1,34 +1,34 @@ package com.hbm.util; +import org.apache.commons.lang3.NotImplementedException; + import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; -import org.apache.commons.lang3.NotImplementedException; - /** * A crude implementation of the HashSet with a few key differences: * - instead of being stored as the key, the objects are stored as values in the underlying HashMap with the hash being the key * - consequently, things with matching hash are considered the same, skipping the equals check * - no equals check means that collisions are possible, so be careful * - the underlying HashMap is accessible, which means that the instances can be grabbed out of the HashedSet if a hash is supplied - * + * * This sack of crap was only intended for the drone request network code - * + * * @author hbm * * @param */ public class HashedSet implements Set { - + HashMap map = new HashMap(); - + public static class HashedIterator implements Iterator { - + private Iterator> iterator; - + public HashedIterator(HashedSet set) { this.iterator = set.map.entrySet().iterator(); } @@ -54,7 +54,7 @@ public class HashedSet implements Set { public HashedSet(Set reachableNodes) { this.addAll(reachableNodes); } - + public HashMap getMap() { return this.map; } @@ -85,11 +85,11 @@ public class HashedSet implements Set { @Override public boolean containsAll(Collection c) { - + for(Object o : c) { if(!this.contains(o)) return false; } - + return true; } @@ -107,12 +107,12 @@ public class HashedSet implements Set { public boolean remove(Object o) { T obj = this.map.get(o.hashCode()); boolean rem = false; - + if(obj != null) { rem = true; this.map.remove(o.hashCode()); } - + return rem; } diff --git a/src/main/java/com/hbm/util/I18nUtil.java b/src/main/java/com/hbm/util/I18nUtil.java index a4460f6d9..13d4a2d36 100644 --- a/src/main/java/com/hbm/util/I18nUtil.java +++ b/src/main/java/com/hbm/util/I18nUtil.java @@ -1,13 +1,13 @@ package com.hbm.util; -import java.util.ArrayList; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; +import java.util.ArrayList; +import java.util.List; + @SideOnly(Side.CLIENT) public class I18nUtil { @@ -32,7 +32,7 @@ public class I18nUtil { public static String[] resolveKeyArray(String s, Object... args) { return resolveKey(s, args).split("\\$"); } - + /** * The same as autoBreak, but it also respects NTM's break character ($) for manual line breaking in addition to the automatic ones * @param fontRenderer @@ -45,14 +45,14 @@ public class I18nUtil { String[] paragraphs = text.split("\\$"); List lines = new ArrayList(); - + for(String paragraph : paragraphs) { lines.addAll(autoBreak(fontRenderer, paragraph, width)); } - + return lines; } - + /** * Turns one string into a list of strings, cutting sentences up to fit within the defined width if they were rendered in a GUI * @param fontRenderer @@ -66,17 +66,17 @@ public class I18nUtil { List lines = new ArrayList(); //split the text by all spaces String[] words = text.split(" "); - + //add the first word to the first line, no matter what lines.add(words[0]); //starting indent is the width of the first word int indent = fontRenderer.getStringWidth(words[0]); - + for(int w = 1; w < words.length; w++) { - + //increment the indent by the width of the next word + leading space indent += fontRenderer.getStringWidth(" " + words[w]); - + //if the indent is within bounds if(indent <= width) { //add the next word to the last line (i.e. the one in question) @@ -88,7 +88,7 @@ public class I18nUtil { indent = fontRenderer.getStringWidth(words[w]); } } - + return lines; } } diff --git a/src/main/java/com/hbm/util/InventoryUtil.java b/src/main/java/com/hbm/util/InventoryUtil.java index 97cc2bfe7..3a8135f62 100644 --- a/src/main/java/com/hbm/util/InventoryUtil.java +++ b/src/main/java/com/hbm/util/InventoryUtil.java @@ -1,11 +1,8 @@ package com.hbm.util; -import java.util.List; - import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.recipes.anvil.AnvilRecipes.AnvilOutput; import com.hbm.tileentity.machine.TileEntityFurnaceBrick; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; @@ -14,6 +11,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.oredict.OreDictionary; +import java.util.List; + //'t was about time public class InventoryUtil { @@ -21,7 +20,7 @@ public class InventoryUtil { if(sided instanceof TileEntityFurnace) return new int[] {1, 0}; if(sided instanceof TileEntityFurnaceBrick) return new int[] {1, 0, 3}; - + return sided.getAccessibleSlotsFromSide(side); } @@ -35,24 +34,24 @@ public class InventoryUtil { * @return the remainder of the stack that could not have been added, can return null */ public static ItemStack tryAddItemToInventory(ItemStack[] inv, int start, int end, ItemStack stack) { - + ItemStack rem = tryAddItemToExistingStack(inv, start, end, stack); - + if(rem == null) return null; - + boolean didAdd = tryAddItemToNewSlot(inv, start, end, rem); - + if(didAdd) return null; else return rem; } - + public static ItemStack tryAddItemToInventory(ItemStack[] inv, ItemStack stack) { return tryAddItemToInventory(inv, 0, inv.length - 1, stack); } - + /** * Functionally equal to tryAddItemToInventory, but will not try to create new stacks in empty slots * @param inv @@ -62,29 +61,29 @@ public class InventoryUtil { * @return */ public static ItemStack tryAddItemToExistingStack(ItemStack[] inv, int start, int end, ItemStack stack) { - + if(stack == null || stack.stackSize == 0) return null; - + for(int i = start; i <= end; i++) { if(doesStackDataMatch(inv[i], stack)) { - + int transfer = Math.min(stack.stackSize, inv[i].getMaxStackSize() - inv[i].stackSize); - + if(transfer > 0) { inv[i].stackSize += transfer; stack.stackSize -= transfer; - + if(stack.stackSize == 0) return null; } } } - + return stack; } - + /** * Will place the stack in the first empty slot * @param inv @@ -94,21 +93,21 @@ public class InventoryUtil { * @return whether the stack could be added or not */ public static boolean tryAddItemToNewSlot(ItemStack[] inv, int start, int end, ItemStack stack) { - + if(stack == null || stack.stackSize == 0) return true; - + for(int i = start; i <= end; i++) { - + if(inv[i] == null) { inv[i] = stack; return true; } } - + return false; } - + /** * Much of the same but with an ISidedInventory instance instead of a slot array * @param inv @@ -118,86 +117,86 @@ public class InventoryUtil { * @return */ public static ItemStack tryAddItemToInventory(IInventory inv, int start, int end, ItemStack stack) { - + ItemStack rem = tryAddItemToExistingStack(inv, start, end, stack); - + if(rem == null) return null; - + boolean didAdd = tryAddItemToNewSlot(inv, start, end, rem); - + if(didAdd) return null; else return rem; } - + public static ItemStack tryAddItemToExistingStack(IInventory inv, int start, int end, ItemStack stack) { - + if(stack == null || stack.stackSize == 0) return null; - + for(int i = start; i <= end; i++) { if(doesStackDataMatch(inv.getStackInSlot(i), stack)) { - + int transfer = Math.min(stack.stackSize, inv.getStackInSlot(i).getMaxStackSize() - inv.getStackInSlot(i).stackSize); - + if(transfer > 0) { inv.getStackInSlot(i).stackSize += transfer; stack.stackSize -= transfer; - + if(stack.stackSize == 0) return null; } } } - + return stack; } - + public static boolean tryAddItemToNewSlot(IInventory inv, int start, int end, ItemStack stack) { - + if(stack == null || stack.stackSize == 0) return true; - + for(int i = start; i <= end; i++) { - + if(inv.getStackInSlot(i) == null) { inv.setInventorySlotContents(i, stack); return true; } } - + return false; } - + public static boolean tryConsumeAStack(ItemStack[] inv, int start, int end, AStack stack) { - + if(stack == null) return true; - + AStack copy = stack.copy(); - + for(int i = start; i <= end; i++) { ItemStack in = inv[i]; - + if(stack.matchesRecipe(in, true)) { int size = Math.min(copy.stacksize, in.stackSize); - + in.stackSize -= size; copy.stacksize -= size; - + if(in.stackSize == 0) inv[i] = null; if(copy.stacksize == 0) return true; } } - + return false; } - + /** * Compares item, metadata and NBT data of two stacks. Also handles null values! * @param stack1 @@ -205,7 +204,7 @@ public class InventoryUtil { * @return */ public static boolean doesStackDataMatch(ItemStack stack1, ItemStack stack2) { - + if(stack1 == null && stack2 == null) return true; if(stack1 == null && stack2 != null) return false; if(stack1 != null && stack2 == null) return false; @@ -214,10 +213,10 @@ public class InventoryUtil { if(!stack1.hasTagCompound() && !stack2.hasTagCompound()) return true; if(stack1.hasTagCompound() && !stack2.hasTagCompound()) return false; if(!stack1.hasTagCompound() && stack2.hasTagCompound()) return false; - + return stack1.getTagCompound().equals(stack2.getTagCompound()); } - + /** * Checks if a player has matching item stacks in his inventory and removes them if so desired * @param player @@ -226,34 +225,34 @@ public class InventoryUtil { * @return whether the player has the required item stacks or not */ public static boolean doesPlayerHaveAStacks(EntityPlayer player, List stacks, boolean shouldRemove) { - + ItemStack[] original = player.inventory.mainInventory; ItemStack[] inventory = new ItemStack[original.length]; boolean[] modified = new boolean[original.length]; AStack[] input = new AStack[stacks.size()]; - + //first we copy the inputs into an array because 1. it's easier to deal with and 2. we can dick around with the stack sized with no repercussions for(int i = 0; i < input.length; i++) { input[i] = stacks.get(i).copy(); } - + //then we copy the inventory so we can dick around with it as well without making actual modifications to the player's inventory for(int i = 0; i < original.length; i++) { if(original[i] != null) { inventory[i] = original[i].copy(); } } - + //now we go through every ingredient... for(int i = 0; i < input.length; i++) { - + AStack stack = input[i]; - + //...and compare each ingredient to every stack in the inventory for(int j = 0; j < inventory.length; j++) { - + ItemStack inv = inventory[j]; - + //we check if it matches but ignore stack size for now if(stack.matchesRecipe(inv, true)) { //and NOW we care about the stack size @@ -261,29 +260,29 @@ public class InventoryUtil { stack.stacksize -= size; inv.stackSize -= size; modified[j] = true; - + //spent stacks are removed from the equation so that we don't cross ourselves later on if(stack.stacksize <= 0) { input[i] = null; break; } - + if(inv.stackSize <= 0) { inventory[j] = null; } } } } - + for(AStack stack : input) { if(stack != null) { return false; } } - + if(shouldRemove) { for(int i = 0; i < original.length; i++) { - + if(inventory[i] != null && inventory[i].stackSize <= 0) { original[i] = null; } else { @@ -291,12 +290,12 @@ public class InventoryUtil { } } } - + return true; } - + public static void giveChanceStacksToPlayer(EntityPlayer player, List stacks) { - + for(AnvilOutput out : stacks) { if(out.chance == 1.0F || player.getRNG().nextFloat() < out.chance) { if(!player.inventory.addItemStackToInventory(out.stack.copy())) { @@ -305,23 +304,23 @@ public class InventoryUtil { } } } - + public static boolean hasOreDictMatches(EntityPlayer player, String dict, int count) { return countOreDictMatches(player, dict) >= count; } - + public static int countOreDictMatches(EntityPlayer player, String dict) { - + int count = 0; - + for(int i = 0; i < player.inventory.mainInventory.length; i++) { - + ItemStack stack = player.inventory.mainInventory[i]; - + if(stack != null) { - + int[] ids = OreDictionary.getOreIDs(stack); - + for(int id : ids) { if(OreDictionary.getOreName(id).equals(dict)) { count += stack.stackSize; @@ -330,23 +329,23 @@ public class InventoryUtil { } } } - + return count; } - + public static void consumeOreDictMatches(EntityPlayer player, String dict, int count) { - + for(int i = 0; i < player.inventory.mainInventory.length; i++) { - + ItemStack stack = player.inventory.mainInventory[i]; - + if(stack != null) { - + int[] ids = OreDictionary.getOreIDs(stack); - + for(int id : ids) { if(OreDictionary.getOreName(id).equals(dict)) { - + int toConsume = Math.min(count, stack.stackSize); player.inventory.decrStackSize(i, toConsume); count -= toConsume; @@ -356,7 +355,7 @@ public class InventoryUtil { } } } - + /** * Turns objects into 2D ItemStack arrays. Index 1: Ingredient slot, index 2: variation (ore dict) * Handles:
@@ -370,13 +369,13 @@ public class InventoryUtil { * @return */ public static ItemStack[][] extractObject(Object o) { - + if(o instanceof ItemStack) { ItemStack[][] stacks = new ItemStack[1][1]; stacks[0][0] = ((ItemStack)o).copy(); return stacks; } - + if(o instanceof ItemStack[]) { ItemStack[] ingredients = (ItemStack[]) o; ItemStack[][] stacks = new ItemStack[ingredients.length][1]; @@ -385,11 +384,11 @@ public class InventoryUtil { } return stacks; } - + if(o instanceof ItemStack[][]) { return (ItemStack[][]) o; } - + if(o instanceof AStack) { AStack astack = (AStack) o; ItemStack[] ext = astack.extractForNEI().toArray(new ItemStack[0]); @@ -397,23 +396,23 @@ public class InventoryUtil { stacks[0] = ext; //untested, do java arrays allow that? the capacity set is 0 after all return stacks; } - + if(o instanceof AStack[]) { AStack[] ingredients = (AStack[]) o; ItemStack[][] stacks = new ItemStack[ingredients.length][0]; - + for(int i = 0; i < ingredients.length; i++) { stacks[i] = ingredients[i].extractForNEI().toArray(new ItemStack[0]); } - + return stacks; } - + /* in emergency situations with mixed types where AStacks coexist with NBT dependent ItemStacks, such as for fluid icons */ if(o instanceof Object[]) { Object[] ingredients = (Object[]) o; ItemStack[][] stacks = new ItemStack[ingredients.length][0]; - + for(int i = 0; i < ingredients.length; i++) { Object ingredient = ingredients[i]; @@ -425,67 +424,67 @@ public class InventoryUtil { stacks[i][0] = ((ItemStack) ingredient).copy(); } } - + return stacks; } - + return new ItemStack[0][0]; } - + public static boolean doesArrayHaveIngredients(ItemStack[] array, int start, int end, AStack... ingredients) { ItemStack[] copy = ItemStackUtil.carefulCopyArrayTruncate(array, start, end); - + AStack[] req = new AStack[ingredients.length]; for(int i = 0; i < req.length; i++) { req[i] = ingredients[i] == null ? null : ingredients[i].copy(); } - + for(AStack ingredient : req) { - + if(ingredient == null) continue; - + for(ItemStack input : copy) { - + if(input == null) continue; - + if(ingredient.matchesRecipe(input, true)) { int size = Math.min(input.stackSize, ingredient.stacksize); - + ingredient.stacksize -= size; input.stackSize -= size; - + if(ingredient.stacksize == 0) break; } } - + //we have iterated over the entire input array and removed all matching entries, yet the ingredient is still not exhausted, meaning the input wasn't enough if(ingredient.stacksize > 0) return false; } - + return true; } - + public static boolean doesArrayHaveSpace(ItemStack[] array, int start, int end, ItemStack[] items) { ItemStack[] copy = ItemStackUtil.carefulCopyArrayTruncate(array, start, end); - + for(ItemStack item : items) { - + if(item == null) continue; - + ItemStack remainder = tryAddItemToInventory(copy, item.copy()); if(remainder != null) { return false; } } - + return true; } - + /** * A fixed re-implementation of the original Container.mergeItemStack that repects stack size and slot restrictions. * @param slots @@ -496,7 +495,7 @@ public class InventoryUtil { * @return */ public static boolean mergeItemStack(List slots, ItemStack stack, int start, int end, boolean reverse) { - + boolean success = false; int index = start; @@ -508,7 +507,7 @@ public class InventoryUtil { ItemStack current; if(stack.isStackable()) { - + while(stack.stackSize > 0 && (!reverse && index < end || reverse && index >= start)) { slot = slots.get(index); current = slot.getStack(); @@ -516,10 +515,10 @@ public class InventoryUtil { if(current != null) { int max = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit()); int toRemove = Math.min(stack.stackSize, max); - + if(slot.isItemValid(ItemStackUtil.carefulCopyWithSize(stack, toRemove)) && current.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getItemDamage() == current.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack, current)) { - + int currentSize = current.stackSize + stack.stackSize; if(currentSize <= max) { stack.stackSize = 0; @@ -555,10 +554,10 @@ public class InventoryUtil { current = slot.getStack(); if(current == null) { - + int max = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit()); int toRemove = Math.min(stack.stackSize, max); - + if(slot.isItemValid(ItemStackUtil.carefulCopyWithSize(stack, toRemove))) { current = stack.splitStack(toRemove); slot.putStack(current); @@ -576,10 +575,10 @@ public class InventoryUtil { return success; } - + public static int countAStackMatches(ItemStack[] inventory, AStack stack, boolean ignoreSize) { int count = 0; - + for(ItemStack itemStack : inventory) { if(itemStack != null) { if(stack.matchesRecipe(itemStack, true)) { diff --git a/src/main/java/com/hbm/util/ItemStackUtil.java b/src/main/java/com/hbm/util/ItemStackUtil.java index 1ab7af389..c5cb6abd7 100644 --- a/src/main/java/com/hbm/util/ItemStackUtil.java +++ b/src/main/java/com/hbm/util/ItemStackUtil.java @@ -1,9 +1,5 @@ package com.hbm.util; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; @@ -15,22 +11,26 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + public class ItemStackUtil { - + public static ItemStack carefulCopy(ItemStack stack) { if(stack == null) return null; return stack.copy(); } - + public static ItemStack carefulCopyWithSize(ItemStack stack, int size) { if(stack == null) return null; - + ItemStack copy = stack.copy(); copy.stackSize = size; return copy; } - + /** * Runs carefulCopy over the entire ItemStack array. * @param array @@ -39,7 +39,7 @@ public class ItemStackUtil { public static ItemStack[] carefulCopyArray(ItemStack[] array) { return carefulCopyArray(array, 0, array.length - 1); } - + /** * Recreates the ItemStack array and only runs carefulCopy over the supplied range. All other fields remain null. * @param array @@ -50,16 +50,16 @@ public class ItemStackUtil { public static ItemStack[] carefulCopyArray(ItemStack[] array, int start, int end) { if(array == null) return null; - + ItemStack[] copy = new ItemStack[array.length]; - + for(int i = start; i <= end; i++) { copy[i] = carefulCopy(array[i]); } - + return copy; } - + /** * Creates a new array that only contains the copied range. * @param array @@ -70,14 +70,14 @@ public class ItemStackUtil { public static ItemStack[] carefulCopyArrayTruncate(ItemStack[] array, int start, int end) { if(array == null) return null; - + int length = end - start + 1; ItemStack[] copy = new ItemStack[length]; - + for(int i = 0; i < length; i++) { copy[i] = carefulCopy(array[start + i]); } - + return copy; } @@ -88,28 +88,28 @@ public class ItemStackUtil { * @param lines */ public static ItemStack addTooltipToStack(ItemStack stack, String... lines) { - + if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); - + NBTTagCompound display = new NBTTagCompound(); NBTTagList lore = new NBTTagList(); - + for(String line : lines) { lore.appendTag(new NBTTagString(EnumChatFormatting.RESET + "" + EnumChatFormatting.GRAY + line)); } - + display.setTag("Lore", lore); stack.stackTagCompound.setTag("display", display); - + return stack; } - + public static void addStacksToNBT(ItemStack stack, ItemStack... stacks) { - + if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); - + NBTTagList tags = new NBTTagList(); for(int i = 0; i < stacks.length; i++) { @@ -122,7 +122,7 @@ public class ItemStackUtil { } stack.stackTagCompound.setTag("items", tags); } - + public static ItemStack[] readStacksFromNBT(ItemStack stack, int count) { if(!stack.hasTagCompound()) @@ -143,14 +143,14 @@ public class ItemStackUtil { stacks[slot] = loadedStack; } } - + return stacks; } - + public static ItemStack[] readStacksFromNBT(ItemStack stack) { return readStacksFromNBT(stack, 0); } - + /** * Returns a List of all ore dict names for this stack. Stack cannot be null, list is empty when there are no ore dict entries. * @param stack @@ -158,15 +158,15 @@ public class ItemStackUtil { */ public static List getOreDictNames(ItemStack stack) { List list = new ArrayList(); - + int ids[] = OreDictionary.getOreIDs(stack); for(int i : ids) { list.add(OreDictionary.getOreName(i)); } - + return list; } - + public static void spillItems(World world, int x, int y, int z, Block block, Random rand) { IInventory tileentityfurnace = (IInventory) world.getTileEntity(x, y, z); @@ -183,7 +183,7 @@ public class ItemStackUtil { int j1 = rand.nextInt(21) + 10; if(j1 > itemstack.stackSize) j1 = itemstack.stackSize; itemstack.stackSize -= j1; - + EntityItem entityitem = new EntityItem(world, x + oX, y + oY, z + oZ, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); if(itemstack.hasTagCompound()) entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); diff --git a/src/main/java/com/hbm/util/LootGenerator.java b/src/main/java/com/hbm/util/LootGenerator.java index dfd3df78f..b55cc92c8 100644 --- a/src/main/java/com/hbm/util/LootGenerator.java +++ b/src/main/java/com/hbm/util/LootGenerator.java @@ -1,7 +1,5 @@ package com.hbm.util; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; import com.hbm.inventory.OreDictManager.DictFrame; @@ -15,31 +13,33 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import java.util.Random; + public class LootGenerator { public static void setBlock(World world, int x, int y, int z) { world.setBlock(x, y, z, ModBlocks.deco_loot); } - + public static void addItemWithDeviation(TileEntityLoot loot, Random rand, ItemStack stack, double x, double y, double z) { loot.addItem(stack, x + rand.nextGaussian() * 0.02, y, z + rand.nextGaussian() * 0.02); } - + public static void lootBooklet(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { loot.addItem(ItemBookLore.createBook("beacon", 12, 0x404040, 0xD637B3), 0, 0, 0);; } } - + public static void lootCapNuke(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { - + if(world.rand.nextInt(5) == 0) loot.addItem(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_STANDARD), -0.25, 0, -0.125); else @@ -50,27 +50,27 @@ public class LootGenerator { for(int i = 0; i < 6; i++) addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.cap_nuka, 2), 0.125, i * 0.03125, -0.25); } } - + public static void lootMedicine(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { for(int i = 0; i < 4; i++) addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_MED_SYRINGE, world.rand), 0.125, i * 0.03125, 0.25); addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_MED_PILLS, world.rand), -0.25, 0, -0.125); } } - + public static void lootCapStash(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { - + for(int i = -1; i <= 1; i++) { for(int j = -1; j <= 1; j++) { - + int count = world.rand.nextInt(5) + 3; for(int k = 0; k < count; k++) { addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_CAPS, world.rand), i * 0.3125, k * 0.03125, j * 0.3125); @@ -79,35 +79,35 @@ public class LootGenerator { } } } - + public static void lootMakeshiftGun(World world, int x, int y, int z) { TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { - + boolean r = world.rand.nextBoolean(); if(r) addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_MAKESHIFT_GUN, world.rand), 0.125, 0.025, 0.25); - + if(!r || world.rand.nextBoolean()) addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_MAKESHIFT_WRENCH, world.rand), -0.25, 0, -0.28125); - + int count = world.rand.nextInt(2) + 1; for(int i = 0; i < count; i++) addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_MAKESHIFT_PLATES, world.rand), -0.25, i * 0.03125, 0.3125); - + count = world.rand.nextInt(2) + 2; for(int i = 0; i < count; i++) addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPoolsPile.POOL_PILE_MAKESHIFT_WIRE, world.rand), 0.25, i * 0.03125, 0.1875); } } - + public static void lootNukeStorage(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { - + for(int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { - + if(world.rand.nextBoolean()) { loot.addItem(ItemPool.getStack(ItemPoolsPile.POOL_PILE_NUKE_STORAGE, world.rand), -0.375 + i * 0.25, 0, -0.375 + j * 0.25); } @@ -115,46 +115,46 @@ public class LootGenerator { } } } - + public static void lootBones(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { - + int limit = world.rand.nextInt(3) + 3; for(int i = 0; i < limit; i++) { addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPool.getPool(ItemPoolsPile.POOL_PILE_BONES), world.rand), world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5); } } } - + public static void lootGlyphidHive(World world, int x, int y, int z) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { - + int limit = world.rand.nextInt(3) + 3; for(int i = 0; i < limit; i++) { addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPool.getPool(ItemPoolsPile.POOL_PILE_HIVE), world.rand), world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5); } } } - + public static void lootBookLore(World world, int x, int y, int z, ItemStack book) { - + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - + if(loot != null && loot.items.isEmpty()) { addItemWithDeviation(loot, world.rand, book, 0, 0, -0.25); - + int count = world.rand.nextInt(3) + 2; for(int k = 0; k < count; k++) addItemWithDeviation(loot, world.rand, new ItemStack(Items.book), -0.25, k * 0.03125, 0.25); - + count = world.rand.nextInt(2) + 1; for(int k = 0; k < count; k++) addItemWithDeviation(loot, world.rand, new ItemStack(Items.paper), 0.25, k * 0.03125, 0.125); } } - + } diff --git a/src/main/java/com/hbm/util/ParticleUtil.java b/src/main/java/com/hbm/util/ParticleUtil.java index 2c654de56..b4eca3ac1 100644 --- a/src/main/java/com/hbm/util/ParticleUtil.java +++ b/src/main/java/com/hbm/util/ParticleUtil.java @@ -3,7 +3,6 @@ package com.hbm.util; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.AuxParticlePacketNT; - import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -17,7 +16,7 @@ public class ParticleUtil { data.setDouble("mX", mX); data.setDouble("mY", mY); data.setDouble("mZ", mZ); - + if(world.isRemote) { data.setDouble("posX", x); data.setDouble("posY", y); @@ -27,7 +26,7 @@ public class ParticleUtil { PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 150)); } } - + public static void spawnDroneLine(World world, double x, double y, double z, double x0, double y0, double z0, int color) { NBTTagCompound data = new NBTTagCompound(); diff --git a/src/main/java/com/hbm/util/RTGUtil.java b/src/main/java/com/hbm/util/RTGUtil.java index dfa9ce0b0..3d35e1e8b 100644 --- a/src/main/java/com/hbm/util/RTGUtil.java +++ b/src/main/java/com/hbm/util/RTGUtil.java @@ -3,47 +3,46 @@ package com.hbm.util; import com.hbm.config.VersatileConfig; import com.hbm.interfaces.ICustomWarhead.SaltedFuel.HalfLifeType; import com.hbm.items.machine.ItemRTGPellet; - import net.minecraft.item.ItemStack; public class RTGUtil { - + public static short getPower(ItemRTGPellet fuel, ItemStack stack) { return VersatileConfig.scaleRTGPower() ? ItemRTGPellet.getScaledPower(fuel, stack) : fuel.getHeat(); } - + public static boolean hasHeat(ItemStack[] inventory, int[] rtgSlots) { for(int slot : rtgSlots) { - + if(inventory[slot] == null) continue; - + if(inventory[slot].getItem() instanceof ItemRTGPellet) return true; } - + return false; } - + public static int updateRTGs(ItemStack[] inventory, int[] rtgSlots) { int newHeat = 0; for(int slot : rtgSlots) { - + if(inventory[slot] == null) continue; - + if(!(inventory[slot].getItem() instanceof ItemRTGPellet)) continue; - + final ItemRTGPellet pellet = (ItemRTGPellet) inventory[slot].getItem(); newHeat += getPower(pellet, inventory[slot]); inventory[slot] = ItemRTGPellet.handleDecay(inventory[slot], pellet); } - + return newHeat; - + } - + /** * Gets the lifespan of an RTG based on half-life * @author UFFR diff --git a/src/main/java/com/hbm/util/ShadyUtil.java b/src/main/java/com/hbm/util/ShadyUtil.java index df3fd7f8c..2c4c1c1f6 100644 --- a/src/main/java/com/hbm/util/ShadyUtil.java +++ b/src/main/java/com/hbm/util/ShadyUtil.java @@ -1,5 +1,10 @@ package com.hbm.util; +import com.google.common.collect.Sets; +import com.hbm.config.GeneralConfig; +import com.hbm.main.ModEventHandler; +import cpw.mods.fml.relauncher.ReflectionHelper; + import java.lang.reflect.Field; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -8,12 +13,6 @@ import java.util.HashSet; import java.util.Random; import java.util.Set; -import com.google.common.collect.Sets; -import com.hbm.config.GeneralConfig; -import com.hbm.main.ModEventHandler; - -import cpw.mods.fml.relauncher.ReflectionHelper; - /** * Handles anything regarding hashes, base64 encoding, etc. Shady looking stuff, that is * @author hbm @@ -54,13 +53,13 @@ public class ShadyUtil { public static String Alcater = "0b399a4a-8545-45a1-be3d-ece70d7d48e9"; public static String ege444 = "42ee978c-442a-4cd8-95b6-29e469b6df10"; public static String LePeeperSauvage = "433c2bb7-018c-4d51-acfe-27f907432b5e"; - + public static final Set hashes = new HashSet(); static { hashes.add("41de5c372b0589bbdb80571e87efa95ea9e34b0d74c6005b8eab495b7afd9994"); hashes.add("31da6223a100ed348ceb3254ceab67c9cc102cb2a04ac24de0df3ef3479b1036"); } - + public static final int c = 0x3d; public static String initializer = "Ur bp7mN-@UFZKXBx9N[/>M'k\\7\\9m3b"; public static String signature = "dYPq\\YzrNpfn[ZDxdk7PS2jhTY72cZT7SoH|\\WL3dIznfC"; @@ -74,11 +73,11 @@ public class ShadyUtil { "5bf069bc-5b46-4179-aafe-35c0a07dee8b", //JMF781 "ccd9aa1c-26b9-4dde-8f37-b96f8d99de22", //kakseao }); - + // simple cryptographic utils public static String encode(String msg) { return Base64.getEncoder().encodeToString(msg.getBytes()); } public static String decode(String msg) { return new String(Base64.getDecoder().decode(msg)); } - + public static String offset(String msg, int o) { byte[] bytes = msg.getBytes(); for(int i = 0; i < bytes.length; i++) { @@ -86,10 +85,10 @@ public class ShadyUtil { } return new String(bytes); } - + /** Encryptor for the h-cat answer strings */ public static String smoosh(String s1, String s2, String s3, String s4) { - + Random rand = new Random(); String s = ""; @@ -97,9 +96,9 @@ public class ShadyUtil { byte[] b2 = s2.getBytes(); byte[] b3 = s3.getBytes(); byte[] b4 = s4.getBytes(); - + if(b1.length == 0 || b2.length == 0 || b3.length == 0 || b4.length == 0) return ""; - + s += s1; rand.setSeed(b1[0]); s += rand.nextInt(0xffffff); @@ -117,7 +116,7 @@ public class ShadyUtil { s += rand.nextInt(0xffffff); return getHash(s); } - + /** Simple SHA256 call */ public static String getHash(String inp) { try { @@ -129,10 +128,10 @@ public class ShadyUtil { } catch(NoSuchAlgorithmException e) { } return ""; } - + public static void test() { if(!GeneralConfig.enableDebugMode) return; //only run in debug mode - + try { Class test = Class.forName(decode(offset(signature, -2))); Field field = ReflectionHelper.findField(test, decode(offset(checksum, -2))); diff --git a/src/main/java/com/hbm/util/StatHelper.java b/src/main/java/com/hbm/util/StatHelper.java index fbd7fec34..116a0d301 100644 --- a/src/main/java/com/hbm/util/StatHelper.java +++ b/src/main/java/com/hbm/util/StatHelper.java @@ -1,10 +1,6 @@ package com.hbm.util; -import java.util.Iterator; -import java.util.Map; - import com.hbm.interfaces.NotableComments; - import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -16,14 +12,17 @@ import net.minecraft.stats.StatCrafting; import net.minecraft.stats.StatList; import net.minecraft.util.ChatComponentTranslation; +import java.util.Iterator; +import java.util.Map; + @NotableComments public class StatHelper { - + /* * God is dead and we are pissing on his grave */ public static Map publicReferenceToOneshotStatListPleaseAllPointAndLaugh; - + /** * This is probably the worst fucking way of doing this, but it's the only one I could think of that works. * In short: stats are hilariously broken. @@ -32,22 +31,22 @@ public class StatHelper { * the system would break because modded items have dynamic IDs and the stats register fixed IDs instead of item instances. * What did forge do to solve this issue? Well nothing, of course! The injected bits comment on that in vanilla's stat * registering code, but instead of fixing anything it just slaps a fat "TODO" onto it. Wow! Really helpful! - * + * * So what do we do? Every time the world starts and we know the IDs are now correct, we smack that fucker up nice and good. * All ID-bound stats get deep-cleaned out of this mess and registered 1:1 again. Is this terrible and prone to breaking with * mods that do their own stat handling? Hard to say, but the possibility is there. */ public static void resetStatShitFuck() { - + publicReferenceToOneshotStatListPleaseAllPointAndLaugh = ReflectionHelper.getPrivateValue(StatList.class, null, "field_75942_a", "oneShotStats"); - + for(int i = 0; i < StatList.objectCraftStats.length; i++) StatList.objectCraftStats[i] = null; for(int i = 0; i < StatList.mineBlockStatArray.length; i++) StatList.mineBlockStatArray[i] = null; for(int i = 0; i < StatList.objectUseStats.length; i++) StatList.objectUseStats[i] = null; for(int i = 0; i < StatList.objectBreakStats.length; i++) StatList.objectBreakStats[i] = null; StatList.objectMineStats.clear(); StatList.itemStats.clear(); - + try { initCraftItemStats(); initBlockMineStats(); @@ -55,7 +54,7 @@ public class StatHelper { initItemBreakStats(); } catch(Throwable ex) { } // just to be sure } - + /** * For reasons beyond human comprehension, this bit originally only registered items that are the result * of an IRecipe instead of just all items outright like the item usage stats. The logical consequence of this is: @@ -168,12 +167,12 @@ public class StatHelper { stats[i] = stats[j]; } } - + private static StatBase registerStat(StatBase stat) { if(publicReferenceToOneshotStatListPleaseAllPointAndLaugh.containsKey(stat.statId)) { publicReferenceToOneshotStatListPleaseAllPointAndLaugh.remove(stat.statId); } - + StatList.allStats.add(stat); publicReferenceToOneshotStatListPleaseAllPointAndLaugh.put(stat.statId, stat); return stat; diff --git a/src/main/java/com/hbm/util/TimeAnalyzer.java b/src/main/java/com/hbm/util/TimeAnalyzer.java index ec856e301..8bbfba1d1 100644 --- a/src/main/java/com/hbm/util/TimeAnalyzer.java +++ b/src/main/java/com/hbm/util/TimeAnalyzer.java @@ -1,13 +1,13 @@ package com.hbm.util; +import com.hbm.util.Tuple.Pair; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map.Entry; -import com.hbm.util.Tuple.Pair; - /** A more lightweight, punctual version of the dreadfully slow vanilla profiler. */ public class TimeAnalyzer { @@ -15,34 +15,34 @@ public class TimeAnalyzer { private static List> deltas = new ArrayList(); private static String currentSection = ""; private static long sectionStartTime = 0; - + public static void startCount(String section) { currentSection = section; sectionStartTime = System.nanoTime(); } - + public static void endCount() { long delta = System.nanoTime() - sectionStartTime; deltas.add(new Pair(currentSection, delta)); } - + public static void startEndCount(String section) { endCount(); startCount(section); } - + public static void dump() { HashMap milliTime = new HashMap(); - + for(Pair delta : deltas) { Long total = milliTime.get(delta.getKey()); if(total == null) total = new Long(0); total += delta.getValue(); milliTime.put(delta.getKey(), total); } - + long total = 0; - + for(Entry entry : milliTime.entrySet()) { total += entry.getValue(); String time = String.format(Locale.US, "%,d", entry.getValue()); @@ -50,7 +50,7 @@ public class TimeAnalyzer { } System.out.println("Total time passed: " + String.format(Locale.US, "%,d", total) + "ns (" + (total / 1_000_000_000) + "s)"); - + currentSection = ""; sectionStartTime = 0; deltas.clear(); diff --git a/src/main/java/com/hbm/util/TrackerUtil.java b/src/main/java/com/hbm/util/TrackerUtil.java index 09577505a..5b9b7289f 100644 --- a/src/main/java/com/hbm/util/TrackerUtil.java +++ b/src/main/java/com/hbm/util/TrackerUtil.java @@ -1,7 +1,6 @@ package com.hbm.util; import com.hbm.interfaces.NotableComments; - import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityTracker; @@ -14,7 +13,7 @@ import net.minecraft.world.WorldServer; /** * This absolute fucking mess of a class is the direct consequence of mojank's terrible entity tracker that allows for 0 flexibility with how entities are synced. - * + * * @author hbm */ @NotableComments @@ -27,10 +26,10 @@ public class TrackerUtil { EntityTrackerEntry entry = (EntityTrackerEntry) map.lookup(entityId); return entry; } - + /** Force-teleports the given entity using the tracker, resetting the tick count to 0 to prevent movement during this tick */ public static void sendTeleport(World world, Entity e) { - + if(world instanceof WorldServer) { WorldServer server = (WorldServer) world; EntityTrackerEntry entry = getTrackerEntry(server, e.getEntityId()); @@ -44,9 +43,9 @@ public class TrackerUtil { entry.ticks = 0; } } - + public static void setTrackingRange(World world, Entity e, int range) { - + if(world instanceof WorldServer) { WorldServer server = (WorldServer) world; EntityTrackerEntry entry = getTrackerEntry(server, e.getEntityId()); diff --git a/src/main/java/com/hbm/util/fauxpointtwelve/Rotation.java b/src/main/java/com/hbm/util/fauxpointtwelve/Rotation.java index 7bbfa95a9..6b85cae68 100644 --- a/src/main/java/com/hbm/util/fauxpointtwelve/Rotation.java +++ b/src/main/java/com/hbm/util/fauxpointtwelve/Rotation.java @@ -1,7 +1,6 @@ package com.hbm.util.fauxpointtwelve; import com.hbm.interfaces.Spaghetti; - import net.minecraftforge.common.util.ForgeDirection; public enum Rotation { @@ -43,7 +42,7 @@ public enum Rotation { default: return this; } } - + /** * Adjusted code from NTM 1.12 (com.hbm.lib.ForgeDirection) * @param dir diff --git a/src/main/java/com/hbm/util/function/Function.java b/src/main/java/com/hbm/util/function/Function.java index 9dd32272c..a3b8162cc 100644 --- a/src/main/java/com/hbm/util/function/Function.java +++ b/src/main/java/com/hbm/util/function/Function.java @@ -1,19 +1,18 @@ package com.hbm.util.function; -import java.util.Locale; - import com.hbm.util.BobMathUtil; - import net.minecraft.util.EnumChatFormatting; +import java.util.Locale; + /** * A simple class for defining function types (linear, log, sqrt, etc.) for things like fuel reactivity. * Unlike current RBMK functions, constants used in the calculations have been removed - * + * * @author hbm */ public abstract class Function { - + protected double div = 1D; protected double off = 0; @@ -21,10 +20,10 @@ public abstract class Function { public abstract double effonix(double x); public abstract String getLabelForFuel(); public abstract String getDangerFromFuel(); - + public Function withDiv(double div) { this.div = div; return this; }; public Function withOff(double off) { this.off = off; return this; }; - + public double getX(double x) { return x / div + off; } public String getXName() { return getXName(true); } public String getXName(boolean brackets) { @@ -35,52 +34,52 @@ public abstract class Function { if(mod && brackets) x = "(" + x + ")"; return x; } - + public static abstract class FunctionSingleArg extends Function { protected double level; public FunctionSingleArg(double level) { this.level = level; } } - + public static abstract class FunctionDoubleArg extends Function { protected double level, vOff; public FunctionDoubleArg(double level, double vOff) { this.level = level; this.vOff = vOff; } } - + public static class FunctionLogarithmic extends FunctionSingleArg { public FunctionLogarithmic(double level) { super(level); this.withOff(1D); } @Override public double effonix(double x) { return Math.log10(getX(x)) * level; } @Override public String getLabelForFuel() { return "log10(" + getXName(false) + ") * " + String.format(Locale.US, "%,.1f", this.level); } @Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / LOGARITHMIC"; } } - + public static class FunctionPassive extends FunctionSingleArg { public FunctionPassive(double level) { super(level); } @Override public double effonix(double x) { return this.level; } @Override public String getLabelForFuel() { return "" + String.format(Locale.US, "%,.1f", this.level); } @Override public String getDangerFromFuel() { return EnumChatFormatting.DARK_GREEN + "SAFE / PASSIVE"; } } - + public static class FunctionSqrt extends FunctionSingleArg { public FunctionSqrt(double level) { super(level); } @Override public double effonix(double x) { return BobMathUtil.squirt(getX(x)) * this.level; } @Override public String getLabelForFuel() { return "sqrt(" + getXName(false) + ") * " + String.format(Locale.US, "%,.3f", this.level); } //not entirely correct but good enough @Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / SQUARE ROOT"; } } - + public static class FunctionSqrtFalling extends FunctionSqrt { public FunctionSqrtFalling(double fallFactor) { super(1D / fallFactor); this.withOff(fallFactor * fallFactor); } } - + public static class FunctionLinear extends FunctionSingleArg { public FunctionLinear(double level) { super(level); } @Override public double effonix(double x) { return getX(x) * this.level; } @Override public String getLabelForFuel() { return getXName(true) + " * " + String.format(Locale.US, "%,.1f", this.level); } @Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / LINEAR"; } } - + public static class FunctionQuadratic extends FunctionDoubleArg { public FunctionQuadratic(double level) { super(level, 0D); } public FunctionQuadratic(double level, double vOff) { super(level, vOff); } diff --git a/src/main/java/com/hbm/wiaj/actors/ActorVillager.java b/src/main/java/com/hbm/wiaj/actors/ActorVillager.java index 9eabd8e67..58e8e8dc3 100644 --- a/src/main/java/com/hbm/wiaj/actors/ActorVillager.java +++ b/src/main/java/com/hbm/wiaj/actors/ActorVillager.java @@ -1,22 +1,20 @@ package com.hbm.wiaj.actors; -import org.lwjgl.opengl.GL11; - import com.hbm.wiaj.JarScene; import com.hbm.wiaj.WorldInAJar; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.nbt.NBTTagCompound; +import org.lwjgl.opengl.GL11; public class ActorVillager implements ISpecialActor { - + EntityVillager villager = new EntityVillager(Minecraft.getMinecraft().theWorld); NBTTagCompound data = new NBTTagCompound(); - + public ActorVillager() { } - + public ActorVillager(NBTTagCompound data) { this.data = data; } @@ -43,11 +41,11 @@ public class ActorVillager implements ISpecialActor { @Override public void setActorData(NBTTagCompound data) { - + } @Override public void setDataPoint(String tag, Object o) { - + } } diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index fe0c76277..6cd397b09 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -1206,6 +1206,7 @@ item.ammo_standard.flame_napalm.name=Flammenwerferbrennstoff, Napalm item.ammo_standard.g10.name=Kaliber 10 Schrot item.ammo_standard.g10_du.name=Kaliber 10 Uranschrot item.ammo_standard.g10_shrapnel.name=Kaliber 10 Schrapnell-Schrot +item.ammo_standard.g10_slug.name=Kaliber 10 Laufgeschoss item.ammo_standard.g12.name=Kaliber 12 Schrot item.ammo_standard.g12_anthrax.name=Kaliber 12 Anthrax item.ammo_standard.g12_bp.name=Kaliber 12 Schwarzpulver @@ -2080,13 +2081,13 @@ item.folly_shell.name=Silberne Kanonenhülse item.fooditem.name=lebensmittel item.fragment_actinium.name=Actiniumfragment item.fragment_boron.name=Borfragment -item.fragment_cerium.name=Cerium Ffragment +item.fragment_cerium.name=Cerfragment item.fragment_cobalt.name=Cobaltfragment item.fragment_coltan.name=Coltan item.fragment_lanthanium.name=Lanthanfragment item.fragment_meteorite.name=Meteoritenfragment item.fragment_neodymium.name=Neodymfragment -item.fragment_niobium.name=Niobium Ffragment +item.fragment_niobium.name=Niobfragment item.fuel_additive.antiknock.name=Tetraethyblei-Antiklopfmittel item.fuel_additive.deicer.name=Enteisungsmittel item.fuel_tank_large.name=Großer Treibstofftank @@ -2181,6 +2182,7 @@ item.gun_am180.name=Schallgedämpfte Maschinenpistole item.gun_ar15.name=Josh item.gun_autoshotgun.name=Auto-Flinte item.gun_autoshotgun_sexy.name=Sexy +item.gun_autoshotgun_shredder.name=Shredder item.gun_avenger.name=CZ57 Avenger-Minigun item.gun_b92.name=§9B92 Energiepistole§r item.gun_b92_ammo.name=§9B92-Energiezelle§r @@ -2210,6 +2212,7 @@ item.gun_defabricator.name=Defabrikator item.gun_defabricator_ammo.name=Defabrikator-Energiezelle item.gun_detonator.name=Laserzünder item.gun_double_barrel.name=Ein alter Klassiker +item.gun_double_barrel_sacred_dragon.name=Sacred Dragon item.gun_emp.name=EMP-Waffe item.gun_emp_ammo.name=Energiezelle item.gun_euthanasia.name=Euthanasia diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 6948039bf..4b90f99f7 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1929,6 +1929,7 @@ item.ammo_standard.flame_napalm.name=Flamer Fuel, Napalm item.ammo_standard.g10.name=10 Gauge Buckshot item.ammo_standard.g10_du.name=10 Gauge Uranium Buckshot item.ammo_standard.g10_shrapnel.name=10 Gauge Shrapnel Buckshot +item.ammo_standard.g10_slug.name=10 Gauge Slug item.ammo_standard.g12.name=12 Gauge Buckshot item.ammo_standard.g12_anthrax.name=12 Gauge Anthrax Shell item.ammo_standard.g12_bp.name=12 Gauge Black Powder Buckshot @@ -2987,6 +2988,7 @@ item.gun_am180.name=Silenced Submachine Gun item.gun_ar15.name=Josh item.gun_autoshotgun.name=Auto Shotgun item.gun_autoshotgun_sexy.name=Sexy +item.gun_autoshotgun_shredder.name=Shredder item.gun_avenger.name=CZ57 Avenger Minigun item.gun_b92.name=§9B92 Energy Pistol§r item.gun_b92_ammo.name=§9B92 Energy Cell§r @@ -3018,6 +3020,7 @@ item.gun_defabricator.name=Defabricator item.gun_defabricator_ammo.name=Defabricator Energy Cell item.gun_detonator.name=Laser Detonator item.gun_double_barrel.name=An Old Classic +item.gun_double_barrel_sacred_dragon.name=Sacred Dragon item.gun_emp.name=EMP Gun item.gun_emp_ammo.name=Energy Cell item.gun_euthanasia.name=Euthanasia diff --git a/src/main/resources/assets/hbm/models/weapons/g3.obj b/src/main/resources/assets/hbm/models/weapons/g3.obj index b081699fc..3c68f4ea0 100644 --- a/src/main/resources/assets/hbm/models/weapons/g3.obj +++ b/src/main/resources/assets/hbm/models/weapons/g3.obj @@ -1,587 +1,4507 @@ -# Blender v3.2.0 OBJ File: 'g3.blend' +# Blender v2.79 (sub 0) OBJ File: '' # www.blender.org +mtllib g3.mtl +o Trigger_Rifle.002 +v 0.125000 -2.093750 -3.062500 +v 0.125000 -1.968750 -3.125000 +v 0.125000 -2.093750 -3.000000 +v 0.125000 -1.781250 -3.187500 +v 0.125000 -1.968750 -3.250000 +v 0.125000 -1.781250 -3.312500 +v 0.125000 -1.593750 -3.187500 +v 0.125000 -1.406250 -3.312500 +v 0.125000 -1.218750 -3.000000 +v 0.125000 -1.343750 -3.375000 +v -0.125000 -1.968750 -3.125000 +v -0.125000 -2.093750 -3.062500 +v -0.125000 -2.093750 -3.000000 +v -0.125000 -1.781250 -3.187500 +v -0.125000 -1.968750 -3.250000 +v -0.125000 -1.593750 -3.187500 +v -0.125000 -1.781250 -3.312500 +v -0.125000 -1.218750 -3.000000 +v -0.125000 -1.406250 -3.312500 +v -0.125000 -1.343750 -3.375000 +vt 0.656371 0.559846 +vt 0.667954 0.563707 +vt 0.656371 0.563707 +vt 0.629344 0.555985 +vt 0.640927 0.563707 +vt 0.629344 0.563707 +vt 0.617761 0.555985 +vt 0.606178 0.563707 +vt 0.691120 0.563707 +vt 0.698842 0.552124 +vt 0.718147 0.563707 +vt 0.602317 0.563707 +vt 0.606178 0.540541 +vt 0.667954 0.579151 +vt 0.656371 0.583012 +vt 0.656371 0.579151 +vt 0.629344 0.586873 +vt 0.640927 0.579151 +vt 0.640927 0.586873 +vt 0.617761 0.586873 +vt 0.629344 0.579151 +vt 0.691120 0.579151 +vt 0.718147 0.579151 +vt 0.698842 0.590734 +vt 0.606178 0.579151 +vt 0.606178 0.602317 +vt 0.602317 0.579151 +vt 0.667954 0.555985 +vt 0.640927 0.555985 +vt 0.667954 0.586873 +vt 0.652510 0.579151 +vt 0.652510 0.563707 +vt 0.679537 0.579151 +vt 0.679537 0.563707 +vn 1.0000 0.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 -0.4472 0.8944 +vn 0.0000 -0.2298 0.9732 +vn 0.0000 -0.1602 -0.9871 +vn 0.0000 -0.3827 -0.9239 +vn 0.0000 -0.3827 0.9239 +vn 0.0000 -0.9571 -0.2898 +vn 0.0000 0.1602 0.9871 +vn 0.0000 -0.7071 -0.7071 +vn 0.0000 -0.6070 -0.7947 +vn 0.0000 0.5257 0.8507 +usemtl None +s off +f 1/1/1 2/2/1 3/3/1 +f 4/4/1 5/5/1 6/6/1 +f 7/7/1 6/6/1 8/8/1 +f 7/9/1 8/10/1 9/11/1 +f 8/8/1 10/12/1 9/13/1 +f 11/14/2 12/15/2 13/16/2 +f 14/17/2 15/18/2 11/19/2 +f 16/20/2 17/21/2 14/17/2 +f 16/22/2 18/23/2 19/24/2 +f 19/25/2 18/26/2 20/27/2 +f 1/1/1 5/28/1 2/2/1 +f 4/4/1 2/29/1 5/5/1 +f 7/7/1 4/4/1 6/6/1 +f 11/14/2 15/30/2 12/15/2 +f 14/17/2 17/21/2 15/18/2 +f 16/20/2 19/25/2 17/21/2 +s 1 +f 9/11/3 16/22/4 7/9/4 +f 6/6/5 19/25/6 8/8/6 +f 3/3/7 12/31/8 1/32/8 +f 7/9/4 14/33/9 4/34/9 +f 8/8/6 20/27/10 10/12/10 +f 1/32/8 15/18/11 5/5/11 +f 4/34/9 11/14/12 2/2/12 +f 5/5/11 17/21/5 6/6/5 +f 2/2/12 13/16/7 3/3/7 +f 9/11/3 18/23/3 16/22/4 +f 6/6/5 17/21/5 19/25/6 +f 3/3/7 13/16/7 12/31/8 +f 7/9/4 16/22/4 14/33/9 +f 8/8/6 19/25/6 20/27/10 +f 1/32/8 12/31/8 15/18/11 +f 4/34/9 14/33/9 11/14/12 +f 5/5/11 15/18/11 17/21/5 +f 2/2/12 11/14/12 13/16/7 +o Selector_Rifle.001 +v 0.343750 -0.755365 -3.411612 +v 0.406250 -0.718753 -3.500000 +v 0.343750 -0.718753 -3.500000 +v 0.343750 -0.932141 -3.411612 +v 0.406250 -0.843753 -3.375000 +v 0.343750 -0.843753 -3.375000 +v 0.406250 -0.755365 -3.411612 +v 0.343750 -0.968753 -3.500000 +v 0.406250 -0.932141 -3.411612 +v 0.343750 -0.937503 -4.187500 +v 0.468750 -1.000003 -4.125000 +v 0.343750 -1.000003 -4.125000 +v 0.468750 -0.937503 -4.187500 +v 0.343750 -0.718753 -4.062500 +v 0.468750 -0.718753 -4.062500 +v 0.468750 -0.843753 -4.000000 +v 0.468750 -0.718753 -3.750000 +v 0.468750 -0.906253 -3.750000 +v 0.406250 -0.968753 -3.500000 +v 0.343750 -0.843753 -4.000000 +vt 0.725869 0.474903 +vt 0.722008 0.471042 +vt 0.725869 0.471042 +vt 0.725869 0.482625 +vt 0.722008 0.478764 +vt 0.725869 0.478764 +vt 0.722008 0.474903 +vt 0.725869 0.486486 +vt 0.722008 0.482625 +vt 0.725869 0.420849 +vt 0.718147 0.416988 +vt 0.725869 0.416988 +vt 0.718147 0.420849 +vt 0.725869 0.436293 +vt 0.718147 0.436293 +vt 0.718147 0.405405 +vt 0.710425 0.432432 +vt 0.712686 0.420849 +vt 0.718147 0.455598 +vt 0.718147 0.389961 +vt 0.722008 0.374517 +vt 0.725869 0.374517 +vt 0.710425 0.440154 +vt 0.706564 0.455598 +vt 0.718147 0.471042 +vt 0.715885 0.476503 +vt 0.710425 0.478764 +vt 0.722008 0.486486 +vt 0.725869 0.405405 +vt 0.704964 0.476503 +vt 0.702703 0.471042 +vn 0.0000 0.7071 0.7071 +vn 0.0000 0.9835 0.1810 +vn 0.0000 0.9808 0.1951 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 0.0000 1.0000 +vn 0.0000 -0.9973 0.0738 +vn 0.0000 -0.7071 -0.7071 +vn -0.0000 -0.9985 0.0553 +vn 0.0000 0.4961 -0.8682 +vn 0.0000 0.8649 -0.5019 +vn 0.0000 -0.6247 0.7809 +vn 1.0000 0.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 0.0000 -0.9701 -0.2425 +vn 0.0000 -0.9987 0.0506 +vn 0.9925 0.0000 0.1222 +vn 0.9900 0.0000 0.1410 +vn 0.9902 0.0000 0.1396 +vn 0.9916 0.0000 0.1297 +usemtl None +s 1 +f 21/35/13 22/36/14 23/37/15 +f 24/38/16 25/39/17 26/40/17 +f 26/40/17 27/41/13 21/35/13 +f 28/42/18 29/43/16 24/38/16 +f 30/44/19 31/45/20 32/46/20 +f 33/47/21 34/48/22 35/49/22 +f 36/50/23 32/46/20 31/45/20 +f 33/47/24 36/51/24 31/52/24 +f 23/37/15 22/36/14 37/53/25 +f 38/54/26 39/55/27 28/56/18 +f 36/57/24 37/53/28 38/58/29 +f 22/59/30 27/60/24 25/61/24 +f 22/59/30 38/58/29 37/53/28 +f 21/35/13 27/41/13 22/36/14 +f 24/38/16 29/43/16 25/39/17 +f 26/40/17 25/39/17 27/41/13 +f 28/42/18 39/62/27 29/43/16 +f 30/44/19 33/47/19 31/45/20 +f 33/47/21 30/44/21 34/48/22 +f 36/50/23 40/63/23 32/46/20 +f 33/47/24 35/49/24 36/51/24 +f 35/49/22 34/48/22 37/53/25 +f 34/48/22 23/37/15 37/53/25 +f 28/56/18 40/63/26 38/54/26 +f 40/63/26 36/50/26 38/54/26 +f 36/57/24 35/49/24 37/53/28 +f 25/61/24 29/64/24 39/65/31 +f 39/65/31 22/59/30 25/61/24 +f 22/59/30 39/65/31 38/58/29 +o Silencer +v -0.220972 0.220971 11.250000 +v -0.000001 0.312500 11.250000 +v -0.000000 -0.312500 11.250000 +v 0.312499 0.000000 11.250000 +v 0.220971 -0.220971 11.562500 +v 0.220971 -0.220971 11.250000 +v -0.220971 -0.220971 11.250000 +v -0.000000 -0.312500 11.562500 +v -0.220971 -0.220971 11.562500 +v -0.312501 -0.000000 11.562500 +v -0.220972 0.220971 11.562500 +v 0.220970 0.220971 11.562500 +v 0.220970 0.220971 11.250000 +v -0.312501 -0.000000 11.250000 +v -0.000001 0.312500 11.562500 +v 0.312499 0.000000 11.562500 +v 0.353552 -0.353553 15.312500 +v -0.000000 -0.500000 11.562500 +v 0.353553 -0.353553 11.562500 +v -0.353554 -0.353553 15.312500 +v -0.500000 -0.000000 11.562500 +v -0.353553 -0.353553 11.562500 +v -0.353554 0.353554 15.312500 +v -0.000001 0.500000 11.562500 +v -0.353554 0.353554 11.562500 +v 0.353552 0.353554 15.312500 +v 0.499999 0.000000 11.562500 +v 0.353552 0.353554 11.562500 +v 0.499999 0.000000 15.312500 +v -0.000001 -0.500000 15.312500 +v -0.500001 -0.000000 15.312500 +v -0.000001 0.500000 15.312500 +v 0.093749 0.000000 15.312500 +v 0.066290 0.066292 15.312500 +v -0.066292 0.066292 15.312500 +v -0.000001 0.093750 15.312500 +v -0.093751 -0.000000 15.312500 +v -0.066292 -0.066291 15.312500 +v -0.000001 -0.093750 15.312500 +v 0.066290 -0.066291 15.312500 +v -0.066292 -0.066291 14.812500 +v -0.066292 0.066292 14.812500 +v 0.066290 0.066292 14.812500 +v -0.000001 -0.093750 14.812500 +v -0.093751 -0.000000 14.812500 +v -0.000001 0.093750 14.812500 +v 0.093749 0.000000 14.812500 +v 0.066290 -0.066291 14.812500 +vt 0.865111 0.565111 +vt 0.853846 0.592308 +vt 0.930769 0.592308 +vt 1.000000 0.715385 +vt 0.961538 0.684615 +vt 1.000000 0.684615 +vt 1.000000 0.961538 +vt 0.961538 0.992308 +vt 0.961538 0.961538 +vt 1.000000 0.869231 +vt 0.961538 0.900000 +vt 0.961538 0.869231 +vt 1.000000 0.807692 +vt 0.961538 0.776923 +vt 1.000000 0.776923 +vt 1.000000 0.669231 +vt 0.961538 0.638462 +vt 1.000000 0.638462 +vt 1.000000 0.915385 +vt 0.961538 0.946154 +vt 0.961538 0.915385 +vt 1.000000 0.823077 +vt 0.961538 0.853846 +vt 0.961538 0.823077 +vt 1.000000 0.761538 +vt 0.961538 0.730769 +vt 1.000000 0.730769 +vt 0.476923 0.676923 +vt 0.938462 0.630769 +vt 0.938462 0.676923 +vt 0.476923 0.953846 +vt 0.938462 0.907692 +vt 0.938462 0.953846 +vt 0.476923 0.861538 +vt 0.938462 0.815385 +vt 0.938462 0.861538 +vt 0.476923 0.769231 +vt 0.938462 0.723077 +vt 0.938462 0.769231 +vt 0.476923 0.723077 +vt 0.476923 1.000000 +vt 0.938462 1.000000 +vt 0.476923 0.907692 +vt 0.476923 0.815385 +vt 0.961538 0.807692 +vt 0.430769 0.742308 +vt 0.430769 0.788462 +vt 0.430769 0.842308 +vt 0.430769 0.834615 +vt 0.430769 0.880769 +vt 0.430769 0.926923 +vt 0.430769 0.973077 +vt 0.430769 0.650000 +vt 0.476923 0.630769 +vt 0.430769 0.696154 +vt 0.930769 0.569231 +vt 0.992308 0.576923 +vt 0.930769 0.576923 +vt 0.930769 0.584615 +vt 0.992308 0.592308 +vt 0.930769 0.592308 +vt 0.930769 0.600000 +vt 0.992308 0.607692 +vt 0.930769 0.607692 +vt 0.930769 0.623077 +vt 0.992308 0.630769 +vt 0.930769 0.630769 +vt 0.992308 0.584615 +vt 0.992308 0.600000 +vt 0.992308 0.615385 +vt 0.930769 0.615385 +vt 0.992308 0.623077 +vt 0.980769 0.546154 +vt 0.992308 0.557692 +vt 0.980769 0.569231 +vt 0.865111 0.619504 +vt 0.892308 0.630769 +vt 0.919504 0.619504 +vt 0.919504 0.565111 +vt 0.892308 0.553846 +vt 0.961538 0.715385 +vt 1.000000 0.992308 +vt 1.000000 0.900000 +vt 0.961538 0.669231 +vt 1.000000 0.946154 +vt 1.000000 0.853846 +vt 0.961538 0.761538 +vt 0.430769 0.750000 +vt 0.430769 0.796154 +vt 0.430769 0.888462 +vt 0.430769 0.934615 +vt 0.430769 0.980769 +vt 0.430769 0.657692 +vt 0.430769 0.703846 +vt 0.992308 0.569231 +vt 0.972610 0.565851 +vt 0.969231 0.557692 +vt 0.972610 0.549533 +vt 0.988928 0.549533 +vt 0.988928 0.565851 +vn 0.0000 0.0000 -1.0000 +vn 1.0000 -0.0000 0.0000 +vn 0.7071 -0.7071 0.0000 +vn -0.7071 -0.7071 -0.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.7071 0.7071 -0.0000 +vn -1.0000 -0.0000 -0.0000 +vn 0.0000 1.0000 -0.0000 +vn 0.7071 0.7071 0.0000 +vn -0.0000 0.0000 1.0000 +usemtl None +s 1 +f 41/66/32 42/67/32 43/68/32 +f 44/69/33 45/70/34 46/71/34 +f 47/72/35 48/73/36 49/74/35 +f 41/75/37 50/76/38 51/77/37 +f 42/78/39 52/79/40 53/80/40 +f 46/81/34 48/82/36 43/83/36 +f 54/84/38 49/85/35 50/86/38 +f 42/87/39 51/88/37 55/89/39 +f 53/90/40 56/91/33 44/92/33 +f 57/93/34 58/94/36 59/95/34 +f 60/96/35 61/97/38 62/98/35 +f 63/99/37 64/100/39 65/101/37 +f 66/102/40 67/103/33 68/104/40 +f 69/105/33 59/95/34 67/103/33 +f 70/106/36 62/98/35 58/107/36 +f 71/108/38 65/101/37 61/97/38 +f 72/109/39 68/104/40 64/100/39 +f 48/82/32 59/95/32 58/94/32 +f 45/70/32 67/103/32 59/95/32 +f 56/91/32 68/104/32 67/103/32 +f 55/110/32 68/104/32 52/79/32 +f 51/88/32 64/100/32 55/89/32 +f 50/76/32 65/101/32 51/77/32 +f 49/85/32 61/97/32 50/86/32 +f 48/73/32 62/98/32 49/74/32 +f 66/102/41 73/111/41 69/105/41 +f 72/109/41 74/112/41 66/102/41 +f 72/109/41 75/113/41 76/114/41 +f 71/108/41 75/115/41 63/99/41 +f 60/96/41 77/116/41 71/108/41 +f 70/106/41 78/117/41 60/96/41 +f 57/93/41 79/118/41 70/119/41 +f 69/105/41 80/120/41 57/93/41 +f 79/121/39 81/122/40 78/123/40 +f 77/124/33 82/125/34 75/126/34 +f 76/127/36 83/128/35 74/129/35 +f 80/130/37 84/131/39 79/132/39 +f 78/123/40 85/133/33 77/124/33 +f 75/126/34 86/134/36 76/127/36 +f 74/129/35 87/135/38 73/136/38 +f 73/136/38 88/137/37 80/130/37 +f 85/138/41 84/139/41 87/140/41 +f 42/67/32 53/141/32 43/68/32 +f 53/141/32 44/142/32 43/68/32 +f 44/142/32 46/143/32 43/68/32 +f 43/68/32 47/144/32 54/145/32 +f 54/145/32 41/66/32 43/68/32 +f 44/69/33 56/146/33 45/70/34 +f 47/72/35 43/147/36 48/73/36 +f 41/75/37 54/148/38 50/76/38 +f 42/78/39 55/110/39 52/79/40 +f 46/81/34 45/149/34 48/82/36 +f 54/84/38 47/150/35 49/85/35 +f 42/87/39 41/151/37 51/88/37 +f 53/90/40 52/152/40 56/91/33 +f 57/93/34 70/119/36 58/94/36 +f 60/96/35 71/108/38 61/97/38 +f 63/99/37 72/109/39 64/100/39 +f 66/102/40 69/105/33 67/103/33 +f 69/105/33 57/93/34 59/95/34 +f 70/106/36 60/96/35 62/98/35 +f 71/108/38 63/99/37 65/101/37 +f 72/109/39 66/102/40 68/104/40 +f 48/82/32 45/149/32 59/95/32 +f 45/70/32 56/146/32 67/103/32 +f 56/91/32 52/152/32 68/104/32 +f 55/110/32 64/100/32 68/104/32 +f 51/88/32 65/101/32 64/100/32 +f 50/76/32 61/97/32 65/101/32 +f 49/85/32 62/98/32 61/97/32 +f 48/73/32 58/107/32 62/98/32 +f 66/102/41 74/153/41 73/111/41 +f 72/109/41 76/154/41 74/112/41 +f 72/109/41 63/99/41 75/113/41 +f 71/108/41 77/155/41 75/115/41 +f 60/96/41 78/156/41 77/116/41 +f 70/106/41 79/157/41 78/117/41 +f 57/93/41 80/158/41 79/118/41 +f 69/105/41 73/159/41 80/120/41 +f 79/121/39 84/160/39 81/122/40 +f 77/124/33 85/133/33 82/125/34 +f 76/127/36 86/134/36 83/128/35 +f 80/130/37 88/137/37 84/131/39 +f 78/123/40 81/122/40 85/133/33 +f 75/126/34 82/125/34 86/134/36 +f 74/129/35 83/128/35 87/135/38 +f 73/136/38 87/135/38 88/137/37 +f 87/140/41 83/161/41 86/162/41 +f 86/162/41 82/163/41 87/140/41 +f 82/163/41 85/138/41 87/140/41 +f 85/138/41 81/164/41 84/139/41 +f 84/139/41 88/165/41 87/140/41 +o Scope_Scope.001 +v 0.312500 2.156250 -3.312500 +v 0.312500 1.531250 -2.687500 +v 0.312500 1.531250 -3.312500 +v -0.312500 2.156250 -2.687500 +v -0.312500 1.531250 -3.312500 +v -0.312500 1.531250 -2.687500 +v 0.312500 2.156250 -2.687500 +v -0.250000 2.093750 -3.437500 +v -0.312500 2.156250 -3.312500 +v 0.250000 1.593750 -3.437500 +v 0.250000 2.093750 -3.437500 +v -0.250000 1.593750 -3.437500 +v 0.250000 2.093750 -2.562500 +v -0.250000 1.593750 -2.562500 +v 0.250000 1.593750 -2.562500 +v -0.250000 2.093750 -2.562500 +v -0.093750 1.468750 -1.875000 +v 0.093750 1.656250 -1.875000 +v -0.093750 1.656250 -1.875000 +v -0.093750 1.281250 -2.500000 +v 0.093750 1.281250 -4.000000 +v -0.093750 1.281250 -4.000000 +v -0.093750 1.468750 -2.000000 +v 0.093750 1.468750 -1.875000 +v 0.093750 1.281250 -2.187500 +v 0.093750 1.468750 -2.312500 +v 0.093750 1.468750 -2.000000 +v -0.093750 1.281250 -2.187500 +v -0.093750 1.468750 -2.312500 +v 0.093750 1.468750 -4.125000 +v 0.093750 1.281250 -4.312500 +v -0.093750 1.468750 -4.125000 +v -0.093750 1.281250 -4.312500 +v -0.093750 1.656250 -2.312500 +v 0.093750 1.281250 -4.875000 +v -0.156250 0.531250 -4.750000 +v -0.281250 0.531250 -5.062500 +v -0.156250 0.531250 -5.062500 +v -0.093750 1.093750 -5.062500 +v -0.093750 1.281250 -4.875000 +v 0.343750 0.531250 -2.500000 +v 0.343750 0.781250 -2.187500 +v 0.343750 0.531250 -2.187500 +v -0.156250 0.531250 -2.187500 +v -0.281250 0.531250 -2.500000 +v -0.156250 0.531250 -2.500000 +v 0.156250 0.531250 -5.062500 +v 0.343750 0.531250 -4.750000 +v 0.156250 0.531250 -4.750000 +v -0.093750 0.906250 -4.750000 +v -0.093750 1.031250 -4.562500 +v -0.093750 1.093750 -4.750000 +v 0.093750 0.906250 -4.750000 +v 0.093750 1.093750 -4.750000 +v 0.093750 1.031250 -4.562500 +v -0.093750 0.906250 -2.500000 +v -0.093750 1.093750 -2.500000 +v -0.093750 1.031250 -2.687500 +v 0.093750 0.906250 -2.500000 +v 0.093750 1.031250 -2.687500 +v 0.093750 1.093750 -2.500000 +v -0.281250 0.781250 -4.750000 +v -0.156250 0.718750 -4.750000 +v 0.093750 1.281250 -2.500000 +v 0.093750 1.093750 -5.062500 +v 0.406250 0.593750 -4.906250 +v 0.406250 0.612056 -4.950444 +v 0.406250 0.656250 -4.968750 +v 0.406250 0.656250 -2.406250 +v 0.406250 0.718750 -2.343750 +v 0.406250 0.656250 -2.281250 +v -0.156250 0.718750 -5.062500 +v -0.281250 0.781250 -5.062500 +v 0.343750 0.781250 -5.062500 +v 0.343750 0.531250 -5.062500 +v 0.281250 0.781250 -2.500000 +v 0.156250 0.718750 -2.500000 +v -0.156250 0.718750 -2.187500 +v 0.156250 0.718750 -2.187500 +v -0.093750 1.093750 -2.187500 +v 0.156250 0.531250 -2.187500 +v 0.093750 1.656250 -4.125000 +v -0.093750 1.656250 -4.125000 +v 0.093750 1.656250 -3.687500 +v 0.093750 1.468750 -3.687500 +v 0.093750 1.468750 -3.812500 +v -0.093750 1.656250 -3.687500 +v -0.093750 1.468750 -3.812500 +v -0.093750 1.468750 -3.687500 +v 0.093750 1.656250 -2.312500 +v -0.281250 0.531250 -4.750000 +v 0.343750 0.781250 -2.500000 +v -0.281250 0.531250 -2.187500 +v 0.281250 0.781250 -4.750000 +v 0.156250 0.718750 -4.750000 +v 0.343750 0.781250 -4.750000 +v 0.093750 1.093750 -2.187500 +v 0.406250 0.700444 -4.950444 +v 0.406250 0.718750 -4.906250 +v 0.406250 0.700444 -4.862056 +v 0.406250 0.656250 -4.843750 +v 0.406250 0.612056 -4.862056 +v 0.406250 0.700444 -2.387945 +v 0.406250 0.700444 -2.299556 +v 0.406250 0.612056 -2.299556 +v 0.406250 0.593750 -2.343750 +v 0.406250 0.612056 -2.387945 +v 0.281250 0.781250 -5.062500 +v 0.156250 0.718750 -5.062500 +v -0.281250 0.781250 -2.500000 +v -0.156250 0.718750 -2.500000 +v 0.156250 0.531250 -2.500000 +v 0.281250 0.781250 -2.187500 +v -0.281250 0.781250 -2.187500 +v 0.270633 1.687500 -5.750000 +v 0.312500 1.843750 -5.625000 +v 0.312500 1.843750 -5.750000 +v 0.270633 2.000000 -5.750000 +v 0.156250 2.114383 -5.625000 +v 0.156250 2.114383 -5.750000 +v -0.156250 1.573117 -5.750000 +v 0.000000 1.531250 -5.625000 +v 0.000000 1.531250 -5.750000 +v -0.270633 2.000000 -5.750000 +v -0.312500 1.843750 -5.625000 +v -0.312500 1.843750 -5.750000 +v 0.000000 2.156250 -5.625000 +v 0.000000 2.156250 -5.750000 +v 0.156250 1.573117 -5.625000 +v 0.156250 1.573117 -5.750000 +v -0.270633 1.687500 -5.625000 +v -0.270633 1.687500 -5.750000 +v -0.156250 2.114383 -5.625000 +v -0.156250 2.114383 -5.750000 +v 0.270633 1.687500 -5.625000 +v 0.270633 2.000000 -5.625000 +v -0.156250 1.573117 -5.625000 +v -0.270633 2.000000 -5.625000 +v 0.000000 2.218750 -5.750000 +v -0.324760 2.031250 -5.750000 +v -0.187500 2.168509 -5.750000 +v -0.324760 1.656250 -5.750000 +v -0.375000 1.843750 -5.750000 +v 0.000000 1.468750 -5.750000 +v -0.187500 1.518990 -5.750000 +v 0.187500 1.518990 -5.750000 +v 0.324759 1.656250 -5.750000 +v 0.324759 2.031250 -5.750000 +v 0.375000 1.843750 -5.750000 +v 0.187500 2.168509 -5.750000 +v 0.187500 1.518990 -4.500000 +v 0.375000 1.843750 -4.500000 +v -0.324760 1.656250 -4.500000 +v -0.187500 2.168509 -4.500000 +v 0.324759 1.656250 -4.500000 +v 0.324759 2.031250 -4.500000 +v -0.187500 1.518990 -4.500000 +v -0.324760 2.031250 -4.500000 +v 0.187500 2.168509 -4.500000 +v 0.000000 1.468750 -4.500000 +v -0.375000 1.843750 -4.500000 +v 0.000000 2.218750 -4.500000 +v 0.125000 2.060256 -4.312500 +v 0.216506 1.968750 -4.312500 +v 0.250000 1.843750 -4.312500 +v 0.216506 1.718750 -4.312500 +v 0.125000 1.627244 -4.312500 +v 0.000000 1.593750 -4.312500 +v -0.125000 1.627244 -4.312500 +v -0.216506 1.718750 -4.312500 +v -0.250000 1.843750 -4.312500 +v -0.216506 1.968750 -4.312500 +v -0.125000 2.060256 -4.312500 +v 0.000000 2.093750 -4.312500 +v 0.216506 1.968750 -1.687500 +v -0.125000 1.627244 -1.687500 +v -0.216506 1.968750 -1.687500 +v 0.125000 2.060256 -1.687500 +v 0.000000 1.593750 -1.687500 +v -0.250000 1.843750 -1.687500 +v -0.000000 2.093750 -1.687500 +v 0.125000 1.627244 -1.687500 +v 0.250000 1.843750 -1.687500 +v -0.216506 1.718750 -1.687500 +v -0.125000 2.060256 -1.687500 +v 0.216506 1.718750 -1.687500 +v -0.000000 2.468750 -0.187500 +v 0.312500 2.385015 -0.187500 +v 0.541266 2.156250 -0.187500 +v 0.625000 1.843750 -0.187500 +v 0.541266 1.531250 -0.187500 +v 0.312500 1.302484 -0.187500 +v -0.000000 1.218750 -0.187500 +v -0.312500 1.302484 -0.187500 +v -0.541266 1.531250 -0.187500 +v -0.625000 1.843750 -0.187500 +v -0.541266 2.156250 -0.187500 +v -0.312500 2.385015 -0.187500 +v 0.541266 2.156250 1.312500 +v -0.312500 1.302484 1.312500 +v -0.541266 2.156250 1.312500 +v 0.312500 2.385015 1.312500 +v -0.000000 1.218750 1.312500 +v -0.625000 1.843750 1.312500 +v -0.000000 2.468750 1.312500 +v 0.312500 1.302484 1.312500 +v 0.625000 1.843750 1.312500 +v -0.541266 1.531250 1.312500 +v -0.312500 2.385015 1.312500 +v 0.541266 1.531250 1.312500 +v -0.562500 1.843750 1.312500 +v -0.487139 2.125000 1.312500 +v -0.281250 2.330889 1.312500 +v -0.000000 2.406250 1.312500 +v 0.281250 2.330889 1.312500 +v 0.487139 2.125000 1.312500 +v 0.562500 1.843750 1.312500 +v 0.487139 1.562500 1.312500 +v 0.281250 1.356611 1.312500 +v -0.000000 1.281250 1.312500 +v -0.281250 1.356611 1.312500 +v -0.487139 1.562500 1.312500 +v 0.281250 2.330889 1.062500 +v -0.000000 1.281250 1.062500 +v -0.562500 1.843750 1.062500 +v -0.000000 2.406250 1.062500 +v 0.281250 1.356611 1.062500 +v 0.562500 1.843750 1.062500 +v -0.487139 1.562500 1.062500 +v -0.281250 2.330889 1.062500 +v 0.487139 1.562500 1.062500 +v 0.487139 2.125000 1.062500 +v -0.281250 1.356611 1.062500 +v -0.487139 2.125000 1.062500 +v 0.125000 2.218750 -3.216506 +v 0.216506 2.156250 -3.125000 +v 0.125000 2.156250 -3.216506 +v 0.000000 2.218750 -2.750000 +v -0.125000 2.156250 -2.783494 +v 0.000000 2.156250 -2.750000 +v -0.250000 2.218750 -3.000000 +v -0.216506 2.156250 -3.125000 +v -0.250000 2.156250 -3.000000 +v 0.000000 2.218750 -3.250000 +v 0.000000 2.156250 -3.250000 +v 0.125000 2.218750 -2.783494 +v 0.125000 2.156250 -2.783494 +v -0.216506 2.218750 -2.875000 +v -0.216506 2.156250 -2.875000 +v -0.125000 2.218750 -3.216506 +v -0.125000 2.156250 -3.216506 +v 0.216506 2.218750 -2.875000 +v 0.216506 2.156250 -2.875000 +v 0.216506 2.218750 -3.125000 +v 0.250000 2.156250 -3.000000 +v -0.125000 2.218750 -2.783494 +v -0.216506 2.218750 -3.125000 +v 0.250000 2.218750 -3.000000 +v -0.270633 2.406250 -3.156250 +v -0.156250 2.218750 -3.270633 +v -0.270633 2.218750 -3.156250 +v 0.312500 2.406250 -3.000000 +v 0.270633 2.218750 -2.843750 +v 0.312500 2.218750 -3.000000 +v 0.156250 2.406250 -3.270633 +v 0.270633 2.218750 -3.156250 +v 0.156250 2.218750 -3.270633 +v 0.000000 2.406250 -2.687500 +v -0.156250 2.218750 -2.729367 +v 0.000000 2.218750 -2.687500 +v -0.312500 2.406250 -3.000000 +v -0.312500 2.218750 -3.000000 +v 0.000000 2.406250 -3.312500 +v 0.000000 2.218750 -3.312500 +v 0.156250 2.406250 -2.729367 +v 0.156250 2.218750 -2.729367 +v -0.270633 2.406250 -2.843750 +v -0.270633 2.218750 -2.843750 +v -0.156250 2.406250 -3.270633 +v 0.270633 2.406250 -2.843750 +v 0.270633 2.406250 -3.156250 +v -0.156250 2.406250 -2.729367 +v -0.375000 1.627243 -3.125000 +v -0.312500 1.718750 -3.216506 +v -0.312500 1.627243 -3.125000 +v -0.375000 2.093750 -3.000000 +v -0.312500 2.060256 -2.875000 +v -0.312500 2.093750 -3.000000 +v -0.375000 1.968750 -3.216506 +v -0.312500 2.060256 -3.125000 +v -0.312500 1.968750 -3.216506 +v -0.375000 1.843750 -2.750000 +v -0.312500 1.718750 -2.783494 +v -0.312500 1.843750 -2.750000 +v -0.375000 1.593750 -3.000000 +v -0.312500 1.593750 -3.000000 +v -0.375000 1.843750 -3.250000 +v -0.312500 1.843750 -3.250000 +v -0.375000 1.968750 -2.783494 +v -0.312500 1.968750 -2.783494 +v -0.375000 1.627243 -2.875000 +v -0.312500 1.627243 -2.875000 +v -0.375000 1.718750 -3.216506 +v -0.375000 2.060256 -2.875000 +v -0.375000 2.060256 -3.125000 +v -0.375000 1.718750 -2.783494 +v -0.375000 2.114383 -3.156250 +v -0.375000 2.156250 -3.000000 +v -0.375000 2.000000 -3.270633 +v -0.375000 1.843750 -3.312500 +v -0.375000 1.687500 -3.270633 +v -0.375000 1.573117 -3.156250 +v -0.375000 1.531250 -3.000000 +v -0.375000 1.687500 -2.729367 +v -0.375000 1.573117 -2.843750 +v -0.375000 1.843750 -2.687500 +v -0.375000 2.000000 -2.729367 +v -0.375000 2.114383 -2.843750 +v -0.562500 1.531250 -3.000000 +v -0.562500 1.843750 -3.312500 +v -0.562500 2.000000 -2.729367 +v -0.562500 1.573117 -2.843750 +v -0.562500 1.687500 -3.270633 +v -0.562500 2.114383 -2.843750 +v -0.562500 2.114383 -3.156250 +v -0.562500 1.687500 -2.729367 +v -0.562500 1.573117 -3.156250 +v -0.562500 2.156250 -3.000000 +v -0.562500 2.000000 -3.270633 +v -0.562500 1.843750 -2.687500 +v 0.312500 1.968750 -3.216506 +v 0.375000 1.843750 -3.250000 +v 0.312500 1.843750 -3.250000 +v 0.312500 1.843750 -2.750000 +v 0.375000 1.968750 -2.783494 +v 0.312500 1.968750 -2.783494 +v 0.312500 1.593750 -3.000000 +v 0.375000 1.627243 -2.875000 +v 0.312500 1.627243 -2.875000 +v 0.375000 1.718750 -3.216506 +v 0.312500 1.718750 -3.216506 +v 0.375000 2.060256 -2.875000 +v 0.312500 2.060256 -2.875000 +v 0.312500 2.093750 -3.000000 +v 0.375000 2.060256 -3.125000 +v 0.312500 2.060256 -3.125000 +v 0.375000 1.718750 -2.783494 +v 0.312500 1.718750 -2.783494 +v 0.375000 1.627243 -3.125000 +v 0.312500 1.627243 -3.125000 +v 0.375000 2.093750 -3.000000 +v 0.375000 1.968750 -3.216506 +v 0.375000 1.843750 -2.750000 +v 0.375000 1.593750 -3.000000 +v 0.375000 2.000000 -3.270633 +v 0.500000 1.843750 -3.312500 +v 0.375000 1.843750 -3.312500 +v 0.375000 1.843750 -2.687500 +v 0.500000 2.000000 -2.729367 +v 0.375000 2.000000 -2.729367 +v 0.375000 1.531250 -3.000000 +v 0.500000 1.573117 -2.843750 +v 0.375000 1.573117 -2.843750 +v 0.500000 1.687500 -3.270633 +v 0.375000 1.687500 -3.270633 +v 0.500000 2.114383 -2.843750 +v 0.375000 2.114383 -2.843750 +v 0.375000 2.156250 -3.000000 +v 0.500000 2.114383 -3.156250 +v 0.375000 2.114383 -3.156250 +v 0.500000 1.687500 -2.729367 +v 0.375000 1.687500 -2.729367 +v 0.500000 1.573117 -3.156250 +v 0.375000 1.573117 -3.156250 +v 0.500000 2.156250 -3.000000 +v 0.500000 2.000000 -3.270633 +v 0.500000 1.843750 -2.687500 +v 0.500000 1.531250 -3.000000 +v 0.625000 1.843750 -3.250000 +v 0.625000 1.968750 -3.216506 +v 0.625000 2.060256 -3.125000 +v 0.625000 2.060256 -2.875000 +v 0.625000 1.968750 -2.783494 +v 0.625000 1.843750 -2.750000 +v 0.625000 1.718750 -2.783494 +v 0.625000 1.627244 -2.875000 +v 0.625000 1.593750 -3.000000 +v 0.625000 1.718750 -3.216506 +v 0.625000 1.627244 -3.125000 +v 0.625000 2.093750 -3.000000 +v 0.343750 0.700444 -4.862056 +v 0.343750 0.718750 -4.906250 +v 0.343750 0.612056 -4.862056 +v 0.343750 0.656250 -4.843750 +v 0.343750 0.612056 -4.950444 +v 0.343750 0.593750 -4.906250 +v 0.343750 0.700444 -4.950444 +v 0.343750 0.656250 -4.968750 +v 0.343750 0.700444 -2.299556 +v 0.343750 0.718750 -2.343750 +v 0.343750 0.612056 -2.299556 +v 0.343750 0.656250 -2.281250 +v 0.343750 0.612056 -2.387945 +v 0.343750 0.593750 -2.343750 +v 0.343750 0.700444 -2.387945 +v 0.343750 0.656250 -2.406250 +vt 0.815385 0.353846 +vt 0.738462 0.276923 +vt 0.815385 0.276923 +vt 0.738462 0.123077 +vt 0.815385 0.200000 +vt 0.738462 0.200000 +vt 0.815385 0.046154 +vt 0.738462 0.046154 +vt 0.830769 0.115385 +vt 0.815385 0.123077 +vt 0.830769 0.269231 +vt 0.830769 0.346154 +vt 0.830769 0.192308 +vt 0.830769 0.207692 +vt 0.892308 0.269231 +vt 0.661538 0.269231 +vt 0.723077 0.207692 +vt 0.723077 0.269231 +vt 0.738462 0.353846 +vt 0.723077 0.284615 +vt 0.723077 0.053846 +vt 0.723077 0.130769 +vt 0.938462 0.476923 +vt 0.961538 0.453846 +vt 0.961538 0.476923 +vt 0.923077 0.084615 +vt 0.946154 0.269231 +vt 0.923077 0.269231 +vt 0.923077 0.476923 +vt 0.938462 0.453846 +vt 0.192308 0.384615 +vt 0.215385 0.407692 +vt 0.169231 0.407692 +vt 0.115385 0.376923 +vt 0.100000 0.400000 +vt 0.076923 0.376923 +vt 0.900000 0.400000 +vt 0.876923 0.415385 +vt 0.876923 0.376923 +vt 0.876923 0.515385 +vt 0.900000 0.530769 +vt 0.876923 0.553846 +vt 0.946154 0.284615 +vt 0.923077 0.307692 +vt 0.923077 0.284615 +vt 0.961538 0.530769 +vt 0.938462 0.530769 +vt 0.938462 0.492308 +vt 0.938462 0.438462 +vt 0.946154 0.376923 +vt 0.946154 0.307692 +vt 0.115385 0.153846 +vt 0.076923 0.169231 +vt 0.076923 0.153846 +vt 0.030769 0.261538 +vt 0.053846 0.238462 +vt 0.053846 0.261538 +vt 0.230769 0.276923 +vt 0.192308 0.307692 +vt 0.192308 0.276923 +vt 0.115385 0.261538 +vt 0.076923 0.276923 +vt 0.076923 0.261538 +vt 0.230769 0.146154 +vt 0.192308 0.169231 +vt 0.192308 0.146154 +vt 0.876923 0.361538 +vt 0.892308 0.338462 +vt 0.900000 0.361538 +vt 0.992308 0.361538 +vt 0.969231 0.361538 +vt 0.976923 0.338462 +vt 0.876923 0.084615 +vt 0.900000 0.084615 +vt 0.892308 0.107692 +vt 0.992308 0.084615 +vt 0.976923 0.107692 +vt 0.969231 0.084615 +vt 0.138462 0.215385 +vt 0.115385 0.200000 +vt 0.130769 0.192308 +vt 0.230769 0.361538 +vt 0.230769 0.384615 +vt 0.969231 0.400000 +vt 0.900000 0.400000 +vt 0.923077 0.376923 +vt 0.076923 0.353846 +vt 0.423077 0.584615 +vt 0.420824 0.579176 +vt 0.415385 0.576923 +vt 0.415385 0.600000 +vt 0.407692 0.607692 +vt 0.415385 0.615385 +vt 0.061538 0.192308 +vt 0.076923 0.200000 +vt 0.230769 0.200000 +vt 0.230769 0.169231 +vt 0.030769 0.323077 +vt 0.007692 0.307692 +vt 0.023077 0.300000 +vt 0.130769 0.300000 +vt 0.169231 0.300000 +vt 0.138462 0.346154 +vt 0.192308 0.253846 +vt 0.923077 0.553846 +vt 0.923077 0.530769 +vt 0.923077 0.453846 +vt 0.900000 0.453846 +vt 0.900000 0.438462 +vt 0.923077 0.476923 +vt 0.900000 0.492308 +vt 0.900000 0.476923 +vt 0.830769 0.053846 +vt 0.830769 0.284615 +vt 0.830769 0.130769 +vt 0.892308 0.207692 +vt 0.661538 0.207692 +vt 0.723077 0.346154 +vt 0.723077 0.115385 +vt 0.723077 0.192308 +vt 0.946154 0.084615 +vt 0.923077 0.453846 +vt 0.138462 0.400000 +vt 0.938462 0.400000 +vt 0.961538 0.400000 +vt 0.115385 0.169231 +vt 0.030769 0.238462 +vt 0.230769 0.307692 +vt 0.115385 0.276923 +vt 0.184615 0.200000 +vt 0.161538 0.238462 +vt 0.161538 0.215385 +vt 0.138462 0.238462 +vt 0.169231 0.192308 +vt 0.192308 0.200000 +vt 0.169231 0.169231 +vt 0.130769 0.169231 +vt 0.192308 0.361538 +vt 0.115385 0.353846 +vt 0.409945 0.579176 +vt 0.407692 0.584615 +vt 0.409945 0.590055 +vt 0.415385 0.592308 +vt 0.420824 0.590055 +vt 0.409945 0.602253 +vt 0.409945 0.613132 +vt 0.420824 0.613132 +vt 0.423077 0.607692 +vt 0.420824 0.602253 +vt 0.007692 0.200000 +vt 0.000000 0.200000 +vt 0.000000 0.169231 +vt 0.023077 0.169231 +vt 0.023077 0.192308 +vt 0.061538 0.169231 +vt 0.076923 0.307692 +vt 0.061538 0.300000 +vt 0.053846 0.346154 +vt 0.053846 0.323077 +vt 0.061538 0.276923 +vt -0.000000 0.276923 +vt 0.023077 0.276923 +vt -0.000000 0.307692 +vt 0.030769 0.346154 +vt 0.169231 0.276923 +vt 0.184615 0.307692 +vt 0.161538 0.346154 +vt 0.115385 0.307692 +vt 0.130769 0.276923 +vt 0.230769 0.253846 +vt 0.900000 0.553846 +vt 0.923077 0.400000 +vt 0.300000 0.523077 +vt 0.323077 0.538462 +vt 0.323077 0.523077 +vt 0.346154 0.523077 +vt 0.369231 0.538462 +vt 0.369231 0.523077 +vt 0.507692 0.523077 +vt 0.530769 0.538462 +vt 0.530769 0.523077 +vt 0.438462 0.523077 +vt 0.461538 0.538462 +vt 0.461538 0.523077 +vt 0.392308 0.538462 +vt 0.392308 0.523077 +vt 0.253846 0.523077 +vt 0.276923 0.538462 +vt 0.276923 0.523077 +vt 0.484615 0.538462 +vt 0.484615 0.523077 +vt 0.415385 0.538462 +vt 0.415385 0.523077 +vt 0.300000 0.538462 +vt 0.346154 0.538462 +vt 0.507692 0.538462 +vt 0.438462 0.538462 +vt 0.248693 0.519231 +vt 0.215385 0.461538 +vt 0.182076 0.519231 +vt 0.413462 0.523077 +vt 0.392308 0.515385 +vt 0.394231 0.523077 +vt 0.417308 0.523077 +vt 0.438462 0.515385 +vt 0.415385 0.515385 +vt 0.459615 0.523077 +vt 0.440385 0.523077 +vt 0.463462 0.523077 +vt 0.484615 0.515385 +vt 0.461538 0.515385 +vt 0.505769 0.523077 +vt 0.486538 0.523077 +vt 0.509615 0.523077 +vt 0.530769 0.515385 +vt 0.507692 0.515385 +vt 0.275000 0.523077 +vt 0.253846 0.515385 +vt 0.255769 0.523077 +vt 0.298077 0.523077 +vt 0.276923 0.515385 +vt 0.278846 0.523077 +vt 0.321154 0.523077 +vt 0.300000 0.515385 +vt 0.301923 0.523077 +vt 0.325000 0.523077 +vt 0.346154 0.515385 +vt 0.323077 0.515385 +vt 0.390385 0.523077 +vt 0.369231 0.515385 +vt 0.371154 0.523077 +vt 0.367308 0.523077 +vt 0.348077 0.523077 +vt 0.276923 0.361538 +vt 0.323077 0.361538 +vt 0.484615 0.361538 +vt 0.415385 0.361538 +vt 0.300000 0.361538 +vt 0.346154 0.361538 +vt 0.507692 0.361538 +vt 0.438462 0.361538 +vt 0.369231 0.361538 +vt 0.253846 0.361538 +vt 0.461538 0.361538 +vt 0.392308 0.361538 +vt 0.373077 0.330769 +vt 0.365385 0.330769 +vt 0.350000 0.330769 +vt 0.342308 0.330769 +vt 0.326923 0.330769 +vt 0.303846 0.330769 +vt 0.280769 0.330769 +vt 0.257692 0.330769 +vt 0.530769 0.361538 +vt 0.511539 0.330769 +vt 0.503846 0.330769 +vt 0.488462 0.330769 +vt 0.480769 0.330769 +vt 0.465385 0.330769 +vt 0.442308 0.330769 +vt 0.419231 0.330769 +vt 0.411538 0.330769 +vt 0.396154 0.330769 +vt 0.853846 0.469231 +vt 0.530769 0.446154 +vt 0.853846 0.446154 +vt 0.853846 0.630769 +vt 0.530769 0.607692 +vt 0.853846 0.607692 +vt 0.853846 0.561538 +vt 0.530769 0.538462 +vt 0.853846 0.538462 +vt 0.853846 0.492308 +vt 0.530769 0.469231 +vt 0.853846 0.376923 +vt 0.530769 0.353846 +vt 0.853846 0.353846 +vt 0.853846 0.584615 +vt 0.530769 0.561538 +vt 0.853846 0.515385 +vt 0.530769 0.492308 +vt 0.853846 0.400000 +vt 0.530769 0.376923 +vt 0.530769 0.423077 +vt 0.853846 0.423077 +vt 0.530769 0.584615 +vt 0.530769 0.515385 +vt 0.530769 0.400000 +vt 0.407692 0.738462 +vt 0.223077 0.769231 +vt 0.223077 0.730769 +vt 0.407692 0.723077 +vt 0.223077 0.692308 +vt 0.407692 0.700000 +vt 0.407692 0.684615 +vt 0.223077 0.653846 +vt 0.407692 0.661538 +vt 0.407692 0.646154 +vt 0.223077 0.615385 +vt 0.407692 0.623077 +vt 0.407692 0.607692 +vt 0.223077 0.576923 +vt 0.407692 0.584615 +vt 0.407692 0.569231 +vt 0.223077 0.538462 +vt 0.407692 0.546154 +vt 0.407692 0.969231 +vt 0.223077 1.000000 +vt 0.223077 0.961538 +vt 0.407692 0.953846 +vt 0.223077 0.923077 +vt 0.407692 0.930769 +vt 0.407692 0.915385 +vt 0.223077 0.884615 +vt 0.407692 0.892308 +vt 0.407692 0.876923 +vt 0.223077 0.846154 +vt 0.407692 0.853846 +vt 0.407692 0.800000 +vt 0.407692 0.776923 +vt 0.407692 0.838462 +vt 0.223077 0.807692 +vt 0.407692 0.815385 +vt 0.038462 0.692308 +vt 0.038462 0.961538 +vt 0.038462 0.846154 +vt 0.038462 0.730769 +vt 0.038462 0.538462 +vt 0.038462 0.884615 +vt 0.038462 0.769231 +vt 0.038462 0.576923 +vt 0.038462 0.653846 +vt 0.038462 0.923077 +vt 0.038462 0.807692 +vt 0.038462 0.615385 +vt 0.030769 0.882692 +vt 0.030769 0.848077 +vt 0.030769 0.844231 +vt 0.030769 0.809615 +vt 0.030769 0.805769 +vt 0.030769 0.771154 +vt 0.030769 0.732692 +vt 0.030769 0.694231 +vt 0.030769 0.655769 +vt 0.030769 0.651923 +vt 0.030769 0.617308 +vt 0.030769 0.613461 +vt 0.030769 0.578846 +vt 0.030769 0.540385 +vt 0.038462 1.000000 +vt 0.030769 0.963462 +vt 0.030769 0.925000 +vt 0.030769 0.886539 +vt 0.030769 0.769231 +vt 0.000000 0.730769 +vt 0.030769 0.730769 +vt 0.030769 0.576923 +vt -0.000000 0.538462 +vt 0.030769 0.538462 +vt 0.030769 0.923077 +vt 0.000000 0.884615 +vt 0.030769 0.884615 +vt 0.030769 0.807692 +vt -0.000000 0.769231 +vt 0.030769 0.615385 +vt 0.000000 0.576923 +vt 0.030769 0.692308 +vt 0.000000 0.653846 +vt 0.030769 0.653846 +vt 0.030769 0.961538 +vt -0.000000 0.923077 +vt 0.030769 0.846154 +vt -0.000000 0.807692 +vt 0.000000 0.615385 +vt 0.000000 0.692308 +vt 0.030769 1.000000 +vt -0.000000 0.961538 +vt -0.000000 0.846154 +vt 0.009275 0.434615 +vt 0.129186 0.434615 +vt 0.069231 0.538462 +vt 0.515385 0.300000 +vt 0.500000 0.292308 +vt 0.515385 0.292308 +vt 0.438462 0.300000 +vt 0.423077 0.292308 +vt 0.438462 0.292308 +vt 0.392308 0.300000 +vt 0.376923 0.292308 +vt 0.392308 0.292308 +vt 0.530769 0.300000 +vt 0.530769 0.292308 +vt 0.453846 0.300000 +vt 0.453846 0.292308 +vt 0.407692 0.300000 +vt 0.407692 0.292308 +vt 0.361538 0.300000 +vt 0.346154 0.292308 +vt 0.361538 0.292308 +vt 0.469231 0.300000 +vt 0.469231 0.292308 +vt 0.500000 0.300000 +vt 0.484615 0.292308 +vt 0.423077 0.300000 +vt 0.376923 0.300000 +vt 0.484615 0.300000 +vt 0.376923 0.330769 +vt 0.361538 0.307692 +vt 0.376923 0.307692 +vt 0.484615 0.330769 +vt 0.469231 0.307692 +vt 0.484615 0.307692 +vt 0.515385 0.330769 +vt 0.500000 0.307692 +vt 0.515385 0.307692 +vt 0.438462 0.330769 +vt 0.423077 0.307692 +vt 0.438462 0.307692 +vt 0.392308 0.330769 +vt 0.392308 0.307692 +vt 0.530769 0.330769 +vt 0.530769 0.307692 +vt 0.453846 0.330769 +vt 0.453846 0.307692 +vt 0.407692 0.330769 +vt 0.407692 0.307692 +vt 0.361538 0.330769 +vt 0.346154 0.307692 +vt 0.469231 0.330769 +vt 0.500000 0.330769 +vt 0.423077 0.330769 +vt 0.550000 0.348693 +vt 0.588462 0.348693 +vt 0.607692 0.315385 +vt 0.452308 0.300000 +vt 0.440000 0.300000 +vt 0.467692 0.300000 +vt 0.455385 0.300000 +vt 0.483077 0.300000 +vt 0.470769 0.300000 +vt 0.498462 0.300000 +vt 0.486154 0.300000 +vt 0.501539 0.300000 +vt 0.516923 0.300000 +vt 0.360000 0.300000 +vt 0.347692 0.300000 +vt 0.375385 0.300000 +vt 0.363077 0.300000 +vt 0.390769 0.300000 +vt 0.378462 0.300000 +vt 0.406154 0.300000 +vt 0.393846 0.300000 +vt 0.424615 0.300000 +vt 0.409231 0.300000 +vt 0.615385 0.323077 +vt 0.607692 0.338462 +vt 0.607692 0.323077 +vt 0.615385 0.215385 +vt 0.607692 0.230769 +vt 0.607692 0.215385 +vt 0.615385 0.184615 +vt 0.607692 0.200000 +vt 0.607692 0.184615 +vt 0.615385 0.261538 +vt 0.607692 0.276923 +vt 0.607692 0.261538 +vt 0.615385 0.307692 +vt 0.607692 0.307692 +vt 0.615385 0.169231 +vt 0.607692 0.169231 +vt 0.615385 0.246154 +vt 0.607692 0.246154 +vt 0.615385 0.292308 +vt 0.607692 0.292308 +vt 0.615385 0.338462 +vt 0.607692 0.353846 +vt 0.615385 0.230769 +vt 0.615385 0.200000 +vt 0.615385 0.276923 +vt 0.615385 0.213846 +vt 0.623077 0.200000 +vt 0.623077 0.215385 +vt 0.615385 0.198462 +vt 0.623077 0.184615 +vt 0.615385 0.183077 +vt 0.623077 0.169231 +vt 0.615385 0.340000 +vt 0.623077 0.353846 +vt 0.615385 0.352308 +vt 0.615385 0.324615 +vt 0.623077 0.338462 +vt 0.615385 0.336923 +vt 0.615385 0.309231 +vt 0.623077 0.323077 +vt 0.615385 0.321538 +vt 0.615385 0.293846 +vt 0.623077 0.307692 +vt 0.615385 0.306154 +vt 0.615385 0.290769 +vt 0.623077 0.276923 +vt 0.623077 0.292308 +vt 0.615385 0.275385 +vt 0.623077 0.261538 +vt 0.615385 0.247692 +vt 0.615385 0.260000 +vt 0.615385 0.232308 +vt 0.623077 0.246154 +vt 0.615385 0.244615 +vt 0.615385 0.216923 +vt 0.623077 0.230769 +vt 0.615385 0.229231 +vt 0.646154 0.307692 +vt 0.646154 0.169231 +vt 0.646154 0.246154 +vt 0.646154 0.292308 +vt 0.646154 0.338462 +vt 0.646154 0.230769 +vt 0.646154 0.200000 +vt 0.646154 0.276923 +vt 0.646154 0.323077 +vt 0.646154 0.215385 +vt 0.646154 0.184615 +vt 0.646154 0.261538 +vt 0.703846 0.348693 +vt 0.665385 0.348693 +vt 0.646154 0.315385 +vt 0.676923 -0.000000 +vt 0.661538 0.007692 +vt 0.661538 -0.000000 +vt 0.753846 -0.000000 +vt 0.738462 0.007692 +vt 0.738462 0.000000 +vt 0.800000 0.000000 +vt 0.784615 0.007692 +vt 0.784615 -0.000000 +vt 0.846154 -0.000000 +vt 0.830769 0.007692 +vt 0.830769 -0.000000 +vt 0.723077 0.007692 +vt 0.723077 -0.000000 +vt 0.707692 -0.000000 +vt 0.692308 0.007692 +vt 0.692308 -0.000000 +vt 0.769231 0.007692 +vt 0.769231 -0.000000 +vt 0.815385 0.007692 +vt 0.815385 -0.000000 +vt 0.707692 0.007692 +vt 0.676923 0.007692 +vt 0.753846 0.007692 +vt 0.800000 0.007692 +vt 0.676923 0.015385 +vt 0.661538 0.030769 +vt 0.661538 0.015385 +vt 0.753846 0.015385 +vt 0.738462 0.030769 +vt 0.738462 0.015385 +vt 0.800000 0.015385 +vt 0.784615 0.030769 +vt 0.784615 0.015385 +vt 0.846154 0.015385 +vt 0.830769 0.030769 +vt 0.830769 0.015385 +vt 0.723077 0.030769 +vt 0.723077 0.015385 +vt 0.707692 0.015385 +vt 0.692308 0.030769 +vt 0.692308 0.015385 +vt 0.769231 0.030769 +vt 0.769231 0.015385 +vt 0.815385 0.030769 +vt 0.815385 0.015385 +vt 0.707692 0.030769 +vt 0.676923 0.030769 +vt 0.753846 0.030769 +vt 0.800000 0.030769 +vt 0.661538 0.046154 +vt 0.676923 0.046154 +vt 0.692308 0.046154 +vt 0.723077 0.046154 +vt 0.738462 0.046154 +vt 0.753846 0.046154 +vt 0.769231 0.046154 +vt 0.784615 0.046154 +vt 0.800000 0.046154 +vt 0.846154 0.030769 +vt 0.830769 0.046154 +vt 0.815385 0.046154 +vt 0.661538 0.076923 +vt 0.676923 0.103570 +vt 0.723077 0.076923 +vt 0.709231 0.007692 +vt 0.721538 0.007692 +vt 0.724615 0.007692 +vt 0.736923 0.007692 +vt 0.740000 0.007692 +vt 0.752308 0.007692 +vt 0.767692 0.007692 +vt 0.755385 0.007692 +vt 0.783077 0.007692 +vt 0.770769 0.007692 +vt 0.786154 0.007692 +vt 0.798462 0.007692 +vt 0.801538 0.007692 +vt 0.813846 0.007692 +vt 0.816923 0.007692 +vt 0.829231 0.007692 +vt 0.832308 0.007692 +vt 0.844615 0.007692 +vt 0.675385 0.007692 +vt 0.663077 0.007692 +vt 0.690769 0.007692 +vt 0.678462 0.007692 +vt 0.706154 0.007692 +vt 0.693846 0.007692 +vt 0.938462 0.553846 +vt 0.961538 0.553846 +vt 0.846154 0.476923 +vt 0.884615 0.453846 +vt 0.884615 0.476923 +vt 0.923077 0.061538 +vt 0.946154 0.061538 +vt 0.161538 0.392308 +vt 0.138462 0.369231 +vt 0.161538 0.369231 +vt 0.192308 0.253846 +vt 0.230769 0.207692 +vt 0.230769 0.253846 +vt 0.076923 0.246154 +vt 0.115385 0.246154 +vt 0.192308 0.315385 +vt 0.230769 0.315385 +vt 0.138462 0.246154 +vt 0.030769 0.353846 +vt 0.053846 0.353846 +vt 1.000000 0.338462 +vt 0.430769 0.576923 +vt 0.438462 0.569231 +vt 0.438462 0.576923 +vt 0.415385 0.576923 +vt 0.423077 0.569231 +vt 0.423077 0.576923 +vt 0.461538 0.576923 +vt 0.469231 0.569231 +vt 0.469231 0.576923 +vt 0.446154 0.576923 +vt 0.453846 0.569231 +vt 0.453846 0.576923 +vt 0.430769 0.569231 +vt 0.407692 0.576923 +vt 0.415385 0.569231 +vt 0.461538 0.569231 +vt 0.446154 0.569231 +vt 0.430769 0.600000 +vt 0.438462 0.592308 +vt 0.438462 0.600000 +vt 0.415385 0.600000 +vt 0.423077 0.592308 +vt 0.423077 0.600000 +vt 0.461538 0.600000 +vt 0.469231 0.592308 +vt 0.469231 0.600000 +vt 0.446154 0.600000 +vt 0.453846 0.592308 +vt 0.453846 0.600000 +vt 0.430769 0.592308 +vt 0.407692 0.600000 +vt 0.415385 0.592308 +vt 0.461538 0.592308 +vt 0.446154 0.592308 +vt 0.192308 0.207692 +vt 0.253846 0.538462 +vt 0.196154 0.533309 +vt 0.215385 0.538462 +vt 0.234615 0.533309 +vt 0.253846 0.500000 +vt 0.248693 0.480769 +vt 0.234615 0.466691 +vt 0.196154 0.466691 +vt 0.182076 0.480769 +vt 0.176923 0.500000 +vt 0.436538 0.523077 +vt 0.482692 0.523077 +vt 0.528846 0.523077 +vt 0.344231 0.523077 +vt 0.388462 0.330769 +vt 0.319231 0.330769 +vt 0.296154 0.330769 +vt 0.273077 0.330769 +vt 0.526923 0.330769 +vt 0.457692 0.330769 +vt 0.434615 0.330769 +vt 0.530769 0.630769 +vt 0.407692 0.761538 +vt 0.407692 0.992308 +vt 0.030769 0.767308 +vt 0.030769 0.728846 +vt 0.030769 0.690385 +vt 0.030769 0.575000 +vt 0.030769 0.998077 +vt 0.030769 0.959615 +vt 0.030769 0.921154 +vt 0.000000 1.000000 +vt 0.034615 0.529186 +vt 0.009275 0.503846 +vt 0.000000 0.469231 +vt 0.034615 0.409275 +vt 0.069231 0.400000 +vt 0.103846 0.409275 +vt 0.138462 0.469231 +vt 0.129186 0.503846 +vt 0.103846 0.529186 +vt 0.346154 0.300000 +vt 0.346154 0.330769 +vt 0.602539 0.296154 +vt 0.588462 0.282076 +vt 0.569231 0.276923 +vt 0.550000 0.282076 +vt 0.535922 0.296154 +vt 0.530769 0.315385 +vt 0.535922 0.334615 +vt 0.569231 0.353846 +vt 0.602539 0.334615 +vt 0.513846 0.300000 +vt 0.529231 0.300000 +vt 0.436923 0.300000 +vt 0.421538 0.300000 +vt 0.615385 0.353846 +vt 0.615385 0.201538 +vt 0.615385 0.186154 +vt 0.615385 0.170769 +vt 0.615385 0.278462 +vt 0.615385 0.263077 +vt 0.646154 0.353846 +vt 0.651307 0.296154 +vt 0.665385 0.282076 +vt 0.684615 0.276923 +vt 0.703846 0.282076 +vt 0.717924 0.296154 +vt 0.723077 0.315385 +vt 0.717924 0.334615 +vt 0.684615 0.353846 +vt 0.651307 0.334615 +vt 0.846154 0.007692 +vt 0.707692 0.046154 +vt 0.846154 0.046154 +vt 0.676923 0.050276 +vt 0.665661 0.061538 +vt 0.665661 0.092308 +vt 0.692308 0.107692 +vt 0.707692 0.103570 +vt 0.718955 0.092308 +vt 0.718955 0.061538 +vt 0.707692 0.050276 +vt 0.692308 0.046154 +vt 0.846154 0.453846 +vt 0.138462 0.392308 +vt 0.161538 0.246154 +vt 1.000000 0.107692 +vt 0.407692 0.569231 +vt 0.407692 0.592308 +vn 1.0000 0.0000 0.0000 +vn -1.0000 0.0000 -0.0000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 -0.0000 +vn 0.0000 0.8944 -0.4472 +vn 0.0000 -0.8944 -0.4472 +vn 0.8944 0.0000 -0.4472 +vn -0.8944 -0.0000 -0.4472 +vn 0.0000 0.0000 -1.0000 +vn 0.0000 0.0000 1.0000 +vn 0.8944 0.0000 0.4472 +vn 0.0000 0.8944 0.4472 +vn -0.8944 0.0000 0.4472 +vn 0.0000 -0.8944 0.4472 +vn 0.0000 0.7071 -0.7071 +vn -0.8660 0.5000 0.0000 +vn -0.8660 -0.5000 -0.0000 +vn -0.5000 -0.8660 -0.0000 +vn 0.5000 0.8660 -0.0000 +vn 0.8660 -0.5000 0.0000 +vn -0.5000 0.8660 0.0000 +vn 0.8660 0.5000 0.0000 +vn 0.5000 -0.8660 -0.0000 +vn 0.0000 0.8320 0.5547 +vn 0.4160 0.7206 0.5547 +vn 0.7206 0.4160 0.5547 +vn 0.8321 0.0000 0.5547 +vn 0.7206 -0.4160 0.5547 +vn 0.4160 -0.7206 0.5547 +vn -0.0000 -0.8321 0.5547 +vn -0.4160 -0.7206 0.5547 +vn -0.7206 -0.4160 0.5547 +vn -0.8320 -0.0000 0.5547 +vn -0.8321 -0.0000 0.5547 +vn -0.7206 0.4160 0.5547 +vn -0.4160 0.7206 0.5547 +vn -0.0000 0.8321 0.5547 +vn 0.4851 0.8402 -0.2425 +vn 0.0000 0.9701 -0.2425 +vn 0.8402 0.4851 -0.2425 +vn 0.9701 0.0000 -0.2425 +vn 0.8402 -0.4851 -0.2425 +vn 0.4851 -0.8402 -0.2425 +vn 0.0000 -0.9701 -0.2425 +vn -0.4851 -0.8402 -0.2425 +vn -0.8402 -0.4851 -0.2425 +vn -0.9701 -0.0000 -0.2425 +vn -0.8402 0.4851 -0.2425 +vn -0.4851 0.8402 -0.2425 +vn 0.5000 0.0000 -0.8660 +vn 0.8660 0.0000 -0.5000 +vn -0.5000 -0.0000 0.8660 +vn -0.8660 0.0000 -0.5000 +vn 0.5000 0.0000 0.8660 +vn -0.8660 0.0000 0.5000 +vn -0.5000 0.0000 -0.8660 +vn 0.8660 0.0000 0.5000 +vn 0.0000 -0.8660 -0.5000 +vn 0.0000 -0.5000 -0.8660 +vn 0.0000 0.8660 0.5000 +vn 0.0000 0.5000 -0.8660 +vn 0.0000 0.8660 -0.5000 +vn 0.0000 -0.5000 0.8660 +vn 0.0000 0.5000 0.8660 +vn 0.0000 -0.8660 0.5000 +vn 0.2217 -0.0000 -0.9751 +vn 0.2217 0.4876 0.8445 +vn 0.2217 -0.8445 0.4876 +vn 0.2217 -0.4876 -0.8445 +vn 0.2217 0.8445 0.4876 +vn 0.2217 0.8445 -0.4876 +vn 0.2217 -0.4876 0.8445 +vn 0.2217 -0.8445 -0.4876 +vn 0.2217 0.9751 -0.0000 +vn 0.2217 0.4876 -0.8445 +vn 0.2217 -0.0000 0.9751 +vn 0.2217 -0.9751 -0.0000 +vn 0.4472 -0.0000 -0.8944 +vn 0.4472 0.4472 -0.7746 +vn 0.4472 0.7746 -0.4472 +vn 0.4472 0.7746 0.4472 +vn 0.4472 0.4472 0.7746 +vn 0.4472 -0.0000 0.8944 +vn 0.4472 -0.4472 0.7746 +vn 0.4472 -0.7746 0.4472 +vn 0.4472 -0.8944 -0.0000 +vn 0.4472 -0.4472 -0.7746 +vn 0.4472 -0.7746 -0.4472 +vn 0.0000 0.3827 -0.9239 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.3827 0.9239 +vn 0.8575 0.5145 -0.0000 +vn 0.4927 0.8702 -0.0000 +vn -0.9637 0.2669 0.0000 +vn -0.8575 0.5145 0.0000 +vn 0.0000 -0.9571 0.2898 +vn 0.0000 -0.9571 -0.2898 +vn 0.0000 -0.8321 -0.5547 +vn 0.0000 0.7071 0.7071 +vn 0.0000 -0.7071 -0.7071 +vn 0.4472 0.8944 0.0000 +usemtl None +s off +f 89/166/42 90/167/42 91/168/42 +f 92/169/43 93/170/43 94/171/43 +f 90/167/44 93/170/44 91/168/44 +f 89/172/45 92/169/45 95/173/45 +f 89/172/46 96/174/46 97/175/46 +f 93/170/47 98/176/47 91/168/47 +f 91/168/48 99/177/48 89/166/48 +f 97/175/49 100/178/49 93/170/49 +f 100/179/50 99/180/50 98/176/50 +f 101/181/51 102/182/51 103/183/51 +f 95/184/52 103/185/52 90/167/52 +f 92/169/53 101/186/53 95/173/53 +f 94/171/54 104/187/54 92/169/54 +f 90/167/55 102/182/55 94/171/55 +f 105/188/51 106/189/51 107/190/51 +f 108/191/45 109/192/45 110/193/45 +f 111/194/44 112/195/44 105/188/44 +f 113/196/42 114/197/42 115/198/42 +f 116/199/43 117/200/43 108/201/43 +f 118/202/42 109/203/42 119/204/42 +f 110/205/43 120/206/43 121/207/43 +f 118/208/56 121/209/56 120/210/56 +f 122/211/43 117/212/43 111/213/43 +f 106/189/42 112/195/42 115/214/42 +f 123/215/45 121/209/45 119/216/45 +f 124/217/44 125/218/44 126/219/44 +f 123/220/56 127/221/56 128/222/56 +f 129/223/42 130/224/42 131/225/42 +f 132/226/44 133/227/44 134/228/44 +f 135/229/44 136/230/44 137/231/44 +f 138/232/43 139/233/43 140/234/43 +f 141/235/42 142/236/42 143/237/42 +f 144/238/43 145/239/43 146/240/43 +f 147/241/42 148/242/42 149/243/42 +f 138/244/51 150/245/51 151/246/51 +f 113/196/42 149/247/42 152/248/42 +f 153/249/42 123/215/42 142/236/42 +f 119/216/42 109/192/42 143/237/42 +f 127/250/43 140/234/43 128/251/43 +f 145/252/43 116/199/43 108/201/43 +f 110/193/43 146/240/43 108/191/43 +f 154/253/42 155/254/42 156/255/42 +f 157/256/42 158/257/42 159/258/42 +f 160/259/50 161/260/50 127/221/50 +f 162/261/42 136/230/42 163/262/42 +f 147/263/50 164/264/50 165/265/50 +f 166/266/51 167/267/51 168/268/51 +f 169/269/44 129/223/44 131/225/44 +f 170/270/50 120/206/50 171/271/50 +f 172/272/42 173/273/42 174/274/42 +f 175/275/51 173/273/51 172/272/51 +f 176/276/43 177/277/43 175/275/43 +f 89/166/42 95/184/42 90/167/42 +f 92/169/43 97/175/43 93/170/43 +f 90/167/44 94/171/44 93/170/44 +f 89/172/45 97/175/45 92/169/45 +f 89/172/46 99/278/46 96/174/46 +f 93/170/47 100/179/47 98/176/47 +f 91/168/48 98/279/48 99/177/48 +f 97/175/49 96/280/49 100/178/49 +f 100/179/50 96/281/50 99/180/50 +f 101/181/51 104/282/51 102/182/51 +f 95/184/52 101/283/52 103/185/52 +f 92/169/53 104/284/53 101/186/53 +f 94/171/54 102/285/54 104/187/54 +f 90/167/55 103/183/55 102/182/55 +f 105/188/51 112/195/51 106/189/51 +f 108/191/45 152/286/45 109/192/45 +f 111/194/44 115/287/44 112/195/44 +f 113/196/42 152/248/42 114/197/42 +f 116/199/43 111/288/43 117/200/43 +f 118/202/42 174/274/42 109/203/42 +f 110/205/43 176/276/43 120/206/43 +f 118/208/56 119/216/56 121/209/56 +f 105/188/43 107/190/43 111/213/43 +f 107/190/43 122/211/43 111/213/43 +f 114/289/42 178/290/42 115/214/42 +f 178/290/42 106/189/42 115/214/42 +f 123/215/45 128/251/45 121/209/45 +f 124/217/44 179/291/44 125/218/44 +f 123/220/56 153/292/56 127/221/56 +f 129/223/42 180/293/42 130/224/42 +f 132/226/44 181/294/44 133/227/44 +f 135/229/44 163/262/44 136/230/44 +f 182/295/51 142/296/51 141/297/51 +f 138/244/51 140/298/51 150/245/51 +f 182/295/51 141/297/51 183/299/51 +f 141/297/51 138/244/51 183/299/51 +f 136/230/51 184/300/51 182/295/51 +f 183/299/51 137/301/51 136/230/51 +f 179/291/51 124/302/51 151/246/51 +f 183/299/51 136/230/51 182/295/51 +f 150/245/51 179/291/51 151/246/51 +f 151/246/51 183/299/51 138/244/51 +f 113/196/42 185/303/42 149/247/42 +f 109/192/42 152/286/42 148/242/42 +f 152/286/42 149/243/42 148/242/42 +f 148/242/42 143/237/42 109/192/42 +f 143/237/42 142/236/42 119/216/42 +f 142/236/42 123/215/42 119/216/42 +f 145/252/43 168/304/43 116/199/43 +f 110/193/43 121/209/43 139/233/43 +f 121/209/43 128/251/43 140/234/43 +f 139/233/43 121/209/43 140/234/43 +f 139/233/43 146/240/43 110/193/43 +f 146/240/43 145/239/43 108/191/43 +f 156/255/42 186/305/42 187/306/42 +f 187/306/42 188/307/42 156/255/42 +f 188/307/42 189/308/42 156/255/42 +f 189/308/42 190/309/42 156/255/42 +f 190/309/42 154/253/42 156/255/42 +f 157/256/42 191/310/42 158/257/42 +f 158/257/42 192/311/42 159/258/42 +f 159/258/42 193/312/42 194/313/42 +f 194/313/42 195/314/42 159/258/42 +f 195/314/42 157/256/42 159/258/42 +f 196/315/50 162/316/50 163/317/50 +f 163/317/50 135/318/50 197/319/50 +f 160/259/50 126/320/50 125/218/50 +f 196/315/50 163/317/50 197/319/50 +f 160/259/50 125/218/50 161/260/50 +f 196/315/50 197/319/50 153/292/50 +f 197/319/50 160/259/50 127/221/50 +f 127/221/50 153/292/50 197/319/50 +f 162/261/42 184/300/42 136/230/42 +f 133/227/50 198/321/50 199/322/50 +f 198/321/50 145/323/50 144/324/50 +f 198/321/50 144/324/50 199/322/50 +f 199/322/50 134/325/50 133/227/50 +f 129/326/50 200/327/50 165/265/50 +f 180/328/50 129/326/50 164/264/50 +f 129/326/50 165/265/50 164/264/50 +f 165/265/50 199/322/50 144/324/50 +f 147/263/50 149/329/50 164/264/50 +f 165/265/50 144/324/50 147/263/50 +f 169/330/51 131/225/51 167/267/51 +f 131/225/51 130/224/51 201/331/51 +f 201/331/51 185/332/51 167/267/51 +f 185/332/51 168/268/51 167/267/51 +f 131/225/51 201/331/51 167/267/51 +f 168/268/51 202/333/51 166/266/51 +f 202/333/51 181/294/51 166/266/51 +f 181/294/51 132/334/51 166/266/51 +f 169/269/44 200/335/44 129/223/44 +f 170/270/50 118/336/50 120/206/50 +f 118/202/42 170/337/42 174/274/42 +f 170/337/42 172/272/42 174/274/42 +f 175/275/51 177/277/51 173/273/51 +f 175/275/43 171/271/43 176/276/43 +f 171/271/43 120/206/43 176/276/43 +s 1 +f 203/338/57 204/339/43 205/340/43 +f 206/341/58 207/342/59 208/343/59 +f 209/344/60 210/345/45 211/346/45 +f 212/347/61 213/348/42 214/349/42 +f 208/343/59 215/350/44 216/351/44 +f 211/352/45 217/353/62 218/354/62 +f 214/349/42 219/355/63 220/356/63 +f 216/351/44 221/357/64 222/358/64 +f 218/354/62 223/359/57 203/338/57 +f 205/340/43 224/360/58 206/341/58 +f 220/356/63 225/361/60 209/344/60 +f 222/358/64 226/362/61 212/347/61 +f 217/363/50 213/364/50 207/365/50 +f 222/366/50 227/367/50 216/368/50 +f 222/369/50 228/370/50 229/371/50 +f 214/372/50 228/370/50 212/373/50 +f 214/374/50 230/375/50 231/376/50 +f 209/377/50 230/375/50 220/378/50 +f 209/379/50 232/380/50 233/381/50 +f 218/382/50 232/383/50 211/384/50 +f 203/385/50 234/386/50 218/387/50 +f 205/388/50 235/389/50 203/390/50 +f 205/391/50 236/392/50 237/393/50 +f 216/394/50 238/395/50 208/396/50 +f 208/397/50 236/392/50 206/398/50 +f 235/389/61 239/399/64 234/386/64 +f 236/392/63 240/400/42 237/393/42 +f 233/381/59 241/401/58 230/375/58 +f 228/370/57 242/402/62 229/371/62 +f 237/393/42 243/403/61 235/389/61 +f 238/395/60 244/404/63 236/392/63 +f 232/380/44 245/405/59 233/381/59 +f 231/376/43 246/406/57 228/370/57 +f 227/367/45 247/407/60 238/395/60 +f 234/386/64 248/408/44 232/383/44 +f 230/375/58 249/409/43 231/376/43 +f 229/371/62 250/410/45 227/367/45 +f 250/410/65 251/411/66 247/407/66 +f 244/404/67 251/412/66 252/413/67 +f 240/400/68 252/414/67 253/415/68 +f 240/400/68 254/416/69 243/403/69 +f 243/403/69 255/417/70 239/399/70 +f 239/399/70 256/418/71 248/408/71 +f 248/419/71 257/420/72 245/405/72 +f 241/401/73 257/421/72 258/422/73 +f 249/409/74 258/423/73 259/424/75 +f 249/409/74 260/425/76 246/406/76 +f 246/406/76 261/426/77 242/402/77 +f 250/410/65 261/427/77 262/428/78 +f 251/429/60 263/430/63 252/431/63 +f 256/432/44 264/433/59 257/434/59 +f 259/435/43 265/436/57 260/437/57 +f 262/438/45 266/439/60 251/429/60 +f 255/440/64 267/441/44 256/442/44 +f 258/443/58 268/444/43 259/435/43 +f 261/445/62 269/446/45 262/438/45 +f 254/447/61 270/448/64 255/440/64 +f 252/431/63 271/449/42 253/450/42 +f 257/434/59 272/451/58 258/443/58 +f 260/437/57 273/452/62 261/445/62 +f 253/450/42 274/453/61 254/447/61 +f 266/454/79 275/455/80 276/456/79 +f 266/457/79 277/458/81 263/459/81 +f 263/460/81 278/461/82 271/462/82 +f 271/463/82 279/464/83 274/465/83 +f 274/466/83 280/467/84 270/468/84 +f 270/469/84 281/470/85 267/471/85 +f 264/472/86 281/473/85 282/474/86 +f 264/475/86 283/476/87 272/477/87 +f 272/478/87 284/479/88 268/480/88 +f 268/481/88 285/482/89 265/483/89 +f 273/484/90 275/455/80 269/485/80 +f 265/486/89 286/487/90 273/488/90 +f 276/456/60 287/489/63 277/458/63 +f 281/473/44 288/490/59 282/474/59 +f 284/479/43 289/491/57 285/482/57 +f 275/455/45 290/492/60 276/456/60 +f 280/467/64 291/493/44 281/470/44 +f 283/476/58 292/494/43 284/479/43 +f 286/487/62 293/495/45 275/455/45 +f 279/464/61 294/496/64 280/467/64 +f 278/461/42 287/489/63 295/497/42 +f 282/474/59 296/498/58 283/476/58 +f 285/482/57 297/499/62 286/487/62 +f 278/461/42 298/500/61 279/464/61 +f 289/491/51 299/501/51 300/502/51 +f 297/499/51 300/503/51 301/504/51 +f 293/495/51 301/505/51 302/506/51 +f 293/495/51 303/507/51 290/492/51 +f 290/492/51 304/508/51 287/489/51 +f 287/489/51 305/509/51 295/497/51 +f 298/500/51 305/510/51 306/511/51 +f 294/496/51 306/512/51 307/513/51 +f 294/496/51 308/514/51 291/493/51 +f 291/515/51 309/516/51 288/490/51 +f 288/490/51 310/517/51 296/498/51 +f 296/498/51 299/518/51 292/494/51 +f 302/519/44 311/520/59 303/521/59 +f 307/522/62 312/523/45 308/524/45 +f 310/525/63 313/526/42 299/527/42 +f 301/528/64 314/529/44 302/519/44 +f 306/530/57 315/531/62 307/522/62 +f 304/532/58 316/533/43 305/534/43 +f 309/535/60 317/536/63 310/525/63 +f 300/537/61 318/538/64 301/528/64 +f 305/534/43 319/539/57 306/530/57 +f 303/521/59 320/540/58 304/532/58 +f 308/541/45 321/542/60 309/535/60 +f 299/527/42 322/543/61 300/537/61 +f 318/544/51 321/545/51 316/546/51 +f 323/547/91 324/548/92 325/549/91 +f 326/550/51 327/551/93 328/552/51 +f 329/553/43 330/554/94 331/555/43 +f 332/556/50 325/549/91 333/557/50 +f 334/558/95 328/552/51 335/559/95 +f 336/560/96 331/555/43 337/561/96 +f 338/562/97 333/563/50 339/564/97 +f 340/565/98 335/559/95 341/566/98 +f 342/567/92 343/568/42 324/548/92 +f 344/569/93 337/561/96 327/551/93 +f 345/570/94 339/564/97 330/554/94 +f 346/571/42 341/566/98 343/568/42 +f 347/572/94 348/573/97 349/574/94 +f 350/575/42 351/576/98 352/577/42 +f 353/578/91 354/579/92 355/580/91 +f 356/581/51 357/582/93 358/583/51 +f 359/584/43 349/574/94 360/585/43 +f 361/586/50 355/580/91 362/587/50 +f 363/588/95 358/583/51 364/589/95 +f 365/590/96 360/585/43 366/591/96 +f 367/592/97 362/593/50 348/573/97 +f 368/594/98 364/589/95 351/576/98 +f 369/595/92 352/577/42 354/579/92 +f 370/596/93 366/591/96 357/582/93 +f 370/597/45 363/598/45 350/599/45 +f 334/600/44 358/583/44 326/601/44 +f 340/602/44 364/589/44 334/603/44 +f 346/604/44 351/576/44 340/605/44 +f 342/606/44 352/577/44 346/607/44 +f 342/608/44 355/580/44 354/579/44 +f 323/609/44 362/587/44 355/580/44 +f 338/610/44 362/593/44 332/611/44 +f 345/612/44 348/573/44 338/613/44 +f 329/614/44 349/574/44 345/615/44 +f 336/616/44 360/585/44 329/617/44 +f 344/618/44 358/583/44 357/582/44 +f 336/619/44 357/582/44 366/591/44 +f 371/620/99 372/621/100 373/622/99 +f 374/623/45 375/624/101 376/625/45 +f 377/626/102 378/627/103 379/628/102 +f 380/629/51 381/630/104 382/631/51 +f 383/632/44 373/622/99 384/633/44 +f 385/634/50 379/628/102 386/635/50 +f 387/636/105 382/631/51 388/637/105 +f 389/638/106 384/633/44 390/639/106 +f 391/640/100 386/641/50 372/621/100 +f 392/642/101 388/637/105 375/624/101 +f 393/643/103 376/625/45 378/627/103 +f 394/644/104 390/639/106 381/630/104 +f 374/645/42 395/646/42 396/647/42 +f 393/648/42 397/649/42 395/646/42 +f 377/650/42 398/651/42 397/649/42 +f 391/652/42 398/653/42 385/654/42 +f 371/655/42 399/656/42 391/657/42 +f 383/658/42 400/659/42 371/660/42 +f 389/661/42 401/662/42 383/663/42 +f 389/664/42 402/665/42 403/666/42 +f 394/667/42 404/668/42 402/665/42 +f 387/669/42 404/668/42 380/670/42 +f 392/671/42 405/672/42 387/673/42 +f 374/674/42 406/675/42 392/676/42 +f 407/677/44 400/659/99 401/662/44 +f 408/678/50 397/649/102 398/651/50 +f 409/679/105 404/668/51 405/672/105 +f 410/680/106 401/662/44 403/666/106 +f 411/681/100 398/653/50 399/656/100 +f 412/682/101 405/672/105 406/675/101 +f 413/683/103 396/647/45 395/646/103 +f 414/684/104 403/666/106 402/665/104 +f 415/685/99 399/656/100 400/659/99 +f 416/686/45 406/675/101 396/647/45 +f 417/687/102 395/646/103 397/649/102 +f 418/688/51 402/665/104 404/668/51 +f 414/689/43 409/690/43 416/691/43 +f 419/692/102 420/693/50 421/694/50 +f 422/695/51 423/696/105 424/697/105 +f 425/698/44 426/699/106 427/700/106 +f 421/701/50 428/702/100 429/703/100 +f 424/697/105 430/704/101 431/705/101 +f 432/706/45 433/707/103 434/708/103 +f 427/700/106 435/709/104 436/710/104 +f 429/703/100 437/711/99 438/712/99 +f 431/705/101 439/713/45 432/706/45 +f 434/708/103 440/714/102 419/692/102 +f 436/710/104 441/715/51 422/695/51 +f 438/712/99 442/716/44 425/698/44 +f 443/717/102 444/718/107 445/719/50 +f 446/720/51 447/721/108 448/722/105 +f 449/723/44 450/724/109 451/725/106 +f 445/726/50 452/727/110 453/728/100 +f 448/722/105 454/729/111 455/730/101 +f 456/731/45 457/732/112 458/733/103 +f 451/725/106 459/734/113 460/735/104 +f 453/728/100 461/736/114 462/737/99 +f 455/730/101 463/738/115 456/731/45 +f 458/733/103 464/739/116 443/717/102 +f 460/735/104 465/740/117 446/720/51 +f 462/737/99 466/741/118 449/723/44 +f 464/739/116 467/742/119 444/718/107 +f 457/732/112 468/743/120 464/739/116 +f 463/738/115 469/744/121 457/732/112 +f 470/745/122 463/738/115 454/729/111 +f 471/746/123 454/729/111 447/721/108 +f 472/747/124 447/721/108 465/740/117 +f 473/748/125 465/740/117 459/734/113 +f 474/749/126 459/734/113 450/724/109 +f 475/750/127 450/724/109 466/741/118 +f 461/736/114 475/750/127 466/741/118 +f 444/751/107 476/752/128 452/727/110 +f 452/727/110 477/753/129 461/736/114 +f 478/754/42 471/755/42 475/756/42 +f 455/730/43 439/757/43 430/758/43 +f 448/722/43 430/759/43 423/760/43 +f 446/720/43 423/761/43 441/762/43 +f 435/763/43 446/720/43 441/764/43 +f 426/765/43 460/735/43 435/766/43 +f 449/723/43 426/767/43 442/768/43 +f 462/737/43 442/769/43 437/770/43 +f 453/728/43 437/771/43 428/772/43 +f 445/726/43 428/773/43 420/774/43 +f 440/775/43 445/719/43 420/776/43 +f 433/777/43 443/717/43 440/778/43 +f 439/779/43 458/733/43 433/780/43 +f 114/781/130 122/211/50 178/782/50 +f 110/783/131 174/784/132 176/785/132 +f 152/286/56 117/786/130 114/787/130 +f 115/788/131 116/789/133 113/790/133 +f 142/791/134 196/792/135 153/793/134 +f 150/245/136 125/218/43 179/291/43 +f 127/794/137 150/245/136 140/795/137 +f 202/333/136 133/227/43 181/294/43 +f 198/321/136 168/304/137 145/252/137 +f 149/247/134 201/796/135 164/797/135 +f 141/297/71 139/798/138 138/244/71 +f 148/799/139 144/324/140 146/800/139 +f 116/789/133 185/332/51 113/790/133 +f 148/242/139 139/801/138 143/237/138 +f 479/802/141 187/803/45 480/804/45 +f 481/805/131 189/806/51 482/807/51 +f 483/808/142 154/809/44 484/810/44 +f 485/811/56 156/812/50 486/813/50 +f 482/807/51 188/814/141 479/802/141 +f 484/815/44 190/816/131 481/805/131 +f 486/813/50 155/817/142 483/808/142 +f 480/804/45 186/818/56 485/811/56 +f 487/819/141 158/820/45 488/821/45 +f 489/822/131 159/823/51 490/824/51 +f 491/825/142 194/826/44 492/827/44 +f 493/828/56 157/829/50 494/830/50 +f 490/824/51 192/831/141 487/819/141 +f 492/832/44 193/833/131 489/822/131 +f 494/830/50 195/834/142 491/825/142 +f 488/821/45 191/835/56 493/828/56 +f 130/224/45 164/797/135 201/796/135 +f 182/836/135 162/261/45 196/792/135 +f 174/784/132 177/277/44 176/785/132 +f 203/338/57 223/359/57 204/339/43 +f 206/341/58 224/360/58 207/342/59 +f 209/344/60 225/361/60 210/345/45 +f 212/347/61 226/362/61 213/348/42 +f 208/343/59 207/342/59 215/350/44 +f 211/352/45 210/837/45 217/353/62 +f 214/349/42 213/348/42 219/355/63 +f 216/351/44 215/350/44 221/357/64 +f 218/354/62 217/353/62 223/359/57 +f 205/340/43 204/339/43 224/360/58 +f 220/356/63 219/355/63 225/361/60 +f 222/358/64 221/357/64 226/362/61 +f 207/365/50 224/838/50 217/363/50 +f 224/838/50 204/839/50 217/363/50 +f 204/839/50 223/840/50 217/363/50 +f 217/363/50 210/841/50 213/364/50 +f 210/841/50 225/842/50 213/364/50 +f 225/842/50 219/843/50 213/364/50 +f 213/364/50 226/844/50 221/845/50 +f 221/845/50 215/846/50 213/364/50 +f 215/846/50 207/365/50 213/364/50 +f 222/366/50 229/371/50 227/367/50 +f 222/369/50 212/847/50 228/370/50 +f 214/372/50 231/376/50 228/370/50 +f 214/374/50 220/848/50 230/375/50 +f 209/377/50 233/381/50 230/375/50 +f 209/379/50 211/849/50 232/380/50 +f 218/382/50 234/386/50 232/383/50 +f 203/385/50 235/389/50 234/386/50 +f 205/388/50 237/393/50 235/389/50 +f 205/391/50 206/850/50 236/392/50 +f 216/394/50 227/367/50 238/395/50 +f 208/397/50 238/395/50 236/392/50 +f 235/389/61 243/403/61 239/399/64 +f 236/392/63 244/404/63 240/400/42 +f 233/381/59 245/405/59 241/401/58 +f 228/370/57 246/406/57 242/402/62 +f 237/393/42 240/400/42 243/403/61 +f 238/395/60 247/407/60 244/404/63 +f 232/380/44 248/419/44 245/405/59 +f 231/376/43 249/409/43 246/406/57 +f 227/367/45 250/410/45 247/407/60 +f 234/386/64 239/399/64 248/408/44 +f 230/375/58 241/401/58 249/409/43 +f 229/371/62 242/402/62 250/410/45 +f 250/410/65 262/851/78 251/411/66 +f 244/404/67 247/407/66 251/412/66 +f 240/400/68 244/404/67 252/414/67 +f 240/400/68 253/852/68 254/416/69 +f 243/403/69 254/853/69 255/417/70 +f 239/399/70 255/854/70 256/418/71 +f 248/419/71 256/855/71 257/420/72 +f 241/401/73 245/405/72 257/421/72 +f 249/409/74 241/401/73 258/423/73 +f 249/409/74 259/856/75 260/425/76 +f 246/406/76 260/857/76 261/426/77 +f 250/410/65 242/402/77 261/427/77 +f 251/429/60 266/439/60 263/430/63 +f 256/432/44 267/858/44 264/433/59 +f 259/435/43 268/444/43 265/436/57 +f 262/438/45 269/446/45 266/439/60 +f 255/440/64 270/448/64 267/441/44 +f 258/443/58 272/451/58 268/444/43 +f 261/445/62 273/452/62 269/446/45 +f 254/447/61 274/453/61 270/448/64 +f 252/431/63 263/430/63 271/449/42 +f 257/434/59 264/433/59 272/451/58 +f 260/437/57 265/436/57 273/452/62 +f 253/450/42 271/449/42 274/453/61 +f 266/454/79 269/859/80 275/455/80 +f 266/457/79 276/456/79 277/458/81 +f 263/460/81 277/458/81 278/461/82 +f 271/463/82 278/461/82 279/464/83 +f 274/466/83 279/464/83 280/467/84 +f 270/469/84 280/467/84 281/470/85 +f 264/472/86 267/860/85 281/473/85 +f 264/475/86 282/474/86 283/476/87 +f 272/478/87 283/476/87 284/479/88 +f 268/481/88 284/479/88 285/482/89 +f 273/484/90 286/487/90 275/455/80 +f 265/486/89 285/482/89 286/487/90 +f 276/456/60 290/492/60 287/489/63 +f 281/473/44 291/515/44 288/490/59 +f 284/479/43 292/494/43 289/491/57 +f 275/455/45 293/495/45 290/492/60 +f 280/467/64 294/496/64 291/493/44 +f 283/476/58 296/498/58 292/494/43 +f 286/487/62 297/499/62 293/495/45 +f 279/464/61 298/500/61 294/496/64 +f 278/461/42 277/458/63 287/489/63 +f 282/474/59 288/490/59 296/498/58 +f 285/482/57 289/491/57 297/499/62 +f 278/461/42 295/497/42 298/500/61 +f 289/491/51 292/494/51 299/501/51 +f 297/499/51 289/491/51 300/503/51 +f 293/495/51 297/499/51 301/505/51 +f 293/495/51 302/861/51 303/507/51 +f 290/492/51 303/862/51 304/508/51 +f 287/489/51 304/863/51 305/509/51 +f 298/500/51 295/497/51 305/510/51 +f 294/496/51 298/500/51 306/512/51 +f 294/496/51 307/864/51 308/514/51 +f 291/515/51 308/865/51 309/516/51 +f 288/490/51 309/866/51 310/517/51 +f 296/498/51 310/867/51 299/518/51 +f 302/519/44 314/529/44 311/520/59 +f 307/522/62 315/531/62 312/523/45 +f 310/525/63 317/536/63 313/526/42 +f 301/528/64 318/538/64 314/529/44 +f 306/530/57 319/539/57 315/531/62 +f 304/532/58 320/540/58 316/533/43 +f 309/535/60 321/542/60 317/536/63 +f 300/537/61 322/543/61 318/538/64 +f 305/534/43 316/533/43 319/539/57 +f 303/521/59 311/520/59 320/540/58 +f 308/541/45 312/868/45 321/542/60 +f 299/527/42 313/526/42 322/543/61 +f 316/546/51 320/869/51 311/870/51 +f 311/870/51 314/871/51 318/544/51 +f 318/544/51 322/872/51 313/873/51 +f 313/873/51 317/874/51 321/545/51 +f 321/545/51 312/875/51 315/876/51 +f 315/876/51 319/877/51 316/546/51 +f 316/546/51 311/870/51 318/544/51 +f 318/544/51 313/873/51 321/545/51 +f 321/545/51 315/876/51 316/546/51 +f 323/547/91 342/567/92 324/548/92 +f 326/550/51 344/569/93 327/551/93 +f 329/553/43 345/570/94 330/554/94 +f 332/556/50 323/547/91 325/549/91 +f 334/558/95 326/550/51 328/552/51 +f 336/560/96 329/553/43 331/555/43 +f 338/562/97 332/878/50 333/563/50 +f 340/565/98 334/558/95 335/559/95 +f 342/567/92 346/571/42 343/568/42 +f 344/569/93 336/560/96 337/561/96 +f 345/570/94 338/562/97 339/564/97 +f 346/571/42 340/565/98 341/566/98 +f 347/572/94 367/592/97 348/573/97 +f 350/575/42 368/594/98 351/576/98 +f 353/578/91 369/595/92 354/579/92 +f 356/581/51 370/596/93 357/582/93 +f 359/584/43 347/572/94 349/574/94 +f 361/586/50 353/578/91 355/580/91 +f 363/588/95 356/581/51 358/583/51 +f 365/590/96 359/584/43 360/585/43 +f 367/592/97 361/879/50 362/593/50 +f 368/594/98 363/588/95 364/589/95 +f 369/595/92 350/575/42 352/577/42 +f 370/596/93 365/590/96 366/591/96 +f 350/599/45 369/880/45 353/881/45 +f 353/881/45 361/882/45 367/883/45 +f 367/883/45 347/884/45 359/885/45 +f 359/885/45 365/886/45 370/597/45 +f 370/597/45 356/887/45 363/598/45 +f 363/598/45 368/888/45 350/599/45 +f 350/599/45 353/881/45 370/597/45 +f 353/881/45 367/883/45 370/597/45 +f 367/883/45 359/885/45 370/597/45 +f 334/600/44 364/589/44 358/583/44 +f 340/602/44 351/576/44 364/589/44 +f 346/604/44 352/577/44 351/576/44 +f 342/606/44 354/579/44 352/577/44 +f 342/608/44 323/889/44 355/580/44 +f 323/609/44 332/890/44 362/587/44 +f 338/610/44 348/573/44 362/593/44 +f 345/612/44 349/574/44 348/573/44 +f 329/614/44 360/585/44 349/574/44 +f 336/616/44 366/591/44 360/585/44 +f 344/618/44 326/891/44 358/583/44 +f 336/619/44 344/892/44 357/582/44 +f 371/620/99 391/640/100 372/621/100 +f 374/623/45 392/642/101 375/624/101 +f 377/626/102 393/643/103 378/627/103 +f 380/629/51 394/644/104 381/630/104 +f 383/632/44 371/620/99 373/622/99 +f 385/634/50 377/626/102 379/628/102 +f 387/636/105 380/629/51 382/631/51 +f 389/638/106 383/632/44 384/633/44 +f 391/640/100 385/893/50 386/641/50 +f 392/642/101 387/636/105 388/637/105 +f 393/643/103 374/623/45 376/625/45 +f 394/644/104 389/638/106 390/639/106 +f 374/645/42 393/894/42 395/646/42 +f 393/648/42 377/895/42 397/649/42 +f 377/650/42 385/896/42 398/651/42 +f 391/652/42 399/656/42 398/653/42 +f 371/655/42 400/659/42 399/656/42 +f 383/658/42 401/662/42 400/659/42 +f 389/661/42 403/666/42 401/662/42 +f 389/664/42 394/897/42 402/665/42 +f 394/667/42 380/898/42 404/668/42 +f 387/669/42 405/672/42 404/668/42 +f 392/671/42 406/675/42 405/672/42 +f 374/674/42 396/647/42 406/675/42 +f 407/677/44 415/685/99 400/659/99 +f 408/678/50 417/687/102 397/649/102 +f 409/679/105 418/688/51 404/668/51 +f 410/680/106 407/677/44 401/662/44 +f 411/681/100 408/899/50 398/653/50 +f 412/682/101 409/679/105 405/672/105 +f 413/683/103 416/686/45 396/647/45 +f 414/684/104 410/680/106 403/666/106 +f 415/685/99 411/681/100 399/656/100 +f 416/686/45 412/682/101 406/675/101 +f 417/687/102 413/683/103 395/646/103 +f 418/688/51 414/684/104 402/665/104 +f 416/691/43 413/900/43 417/901/43 +f 417/901/43 408/902/43 411/903/43 +f 411/903/43 415/904/43 407/905/43 +f 407/905/43 410/906/43 414/689/43 +f 414/689/43 418/907/43 409/690/43 +f 409/690/43 412/908/43 416/691/43 +f 416/691/43 417/901/43 414/689/43 +f 417/901/43 411/903/43 414/689/43 +f 411/903/43 407/905/43 414/689/43 +f 419/692/102 440/714/102 420/693/50 +f 422/695/51 441/715/51 423/696/105 +f 425/698/44 442/716/44 426/699/106 +f 421/701/50 420/909/50 428/702/100 +f 424/697/105 423/696/105 430/704/101 +f 432/706/45 439/713/45 433/707/103 +f 427/700/106 426/699/106 435/709/104 +f 429/703/100 428/702/100 437/711/99 +f 431/705/101 430/704/101 439/713/45 +f 434/708/103 433/707/103 440/714/102 +f 436/710/104 435/709/104 441/715/51 +f 438/712/99 437/711/99 442/716/44 +f 443/717/102 464/739/116 444/718/107 +f 446/720/51 465/740/117 447/721/108 +f 449/723/44 466/741/118 450/724/109 +f 445/726/50 444/751/107 452/727/110 +f 448/722/105 447/721/108 454/729/111 +f 456/731/45 463/738/115 457/732/112 +f 451/725/106 450/724/109 459/734/113 +f 453/728/100 452/727/110 461/736/114 +f 455/730/101 454/729/111 463/738/115 +f 458/733/103 457/732/112 464/739/116 +f 460/735/104 459/734/113 465/740/117 +f 462/737/99 461/736/114 466/741/118 +f 464/739/116 468/743/120 467/742/119 +f 457/732/112 469/744/121 468/743/120 +f 463/738/115 478/910/143 469/744/121 +f 470/745/122 478/910/143 463/738/115 +f 471/746/123 470/745/122 454/729/111 +f 472/747/124 471/746/123 447/721/108 +f 473/748/125 472/747/124 465/740/117 +f 474/749/126 473/748/125 459/734/113 +f 475/750/127 474/749/126 450/724/109 +f 461/736/114 477/753/129 475/750/127 +f 444/751/107 467/911/119 476/752/128 +f 452/727/110 476/752/128 477/753/129 +f 468/912/42 469/913/42 478/754/42 +f 478/754/42 470/914/42 471/755/42 +f 471/755/42 472/915/42 475/756/42 +f 472/915/42 473/916/42 475/756/42 +f 473/916/42 474/917/42 475/756/42 +f 475/756/42 477/918/42 476/919/42 +f 476/919/42 467/920/42 475/756/42 +f 467/920/42 468/912/42 475/756/42 +f 468/912/42 478/754/42 475/756/42 +f 455/730/43 456/731/43 439/757/43 +f 448/722/43 455/730/43 430/759/43 +f 446/720/43 448/722/43 423/761/43 +f 435/763/43 460/735/43 446/720/43 +f 426/765/43 451/725/43 460/735/43 +f 449/723/43 451/725/43 426/767/43 +f 462/737/43 449/723/43 442/769/43 +f 453/728/43 462/737/43 437/771/43 +f 445/726/43 453/728/43 428/773/43 +f 440/775/43 443/717/43 445/719/43 +f 433/777/43 458/733/43 443/717/43 +f 439/779/43 456/731/43 458/733/43 +f 114/781/130 117/212/130 122/211/50 +f 110/783/131 109/921/131 174/784/132 +f 152/286/56 108/191/56 117/786/130 +f 115/788/131 111/922/131 116/789/133 +f 142/791/134 182/836/135 196/792/135 +f 150/245/136 161/260/136 125/218/43 +f 127/794/137 161/260/136 150/245/136 +f 202/333/136 198/321/136 133/227/43 +f 198/321/136 202/333/136 168/304/137 +f 149/247/134 185/303/134 201/796/135 +f 141/297/71 143/923/138 139/798/138 +f 148/799/139 147/263/140 144/324/140 +f 116/789/133 168/268/51 185/332/51 +f 148/242/139 146/924/139 139/801/138 +f 479/802/141 188/814/141 187/803/45 +f 481/805/131 190/816/131 189/806/51 +f 483/808/142 155/817/142 154/809/44 +f 485/811/56 186/818/56 156/812/50 +f 482/807/51 189/806/51 188/814/141 +f 484/815/44 154/925/44 190/816/131 +f 486/813/50 156/812/50 155/817/142 +f 480/804/45 187/803/45 186/818/56 +f 487/819/141 192/831/141 158/820/45 +f 489/822/131 193/833/131 159/823/51 +f 491/825/142 195/834/142 194/826/44 +f 493/828/56 191/835/56 157/829/50 +f 490/824/51 159/823/51 192/831/141 +f 492/832/44 194/926/44 193/833/131 +f 494/830/50 157/829/50 195/834/142 +f 488/821/45 158/820/45 191/835/56 +f 130/224/45 180/293/45 164/797/135 +f 182/836/135 184/300/45 162/261/45 +f 174/784/132 173/273/44 177/277/44 +o Flash_Hider +v -0.250001 -0.000000 12.500000 +v -0.176778 0.176777 12.500000 +v -0.176778 0.176777 11.625000 +v -0.176778 0.176777 11.250000 +v -0.000001 0.250000 11.250000 +v -0.000000 -0.250000 11.250000 +v 0.249999 0.000000 12.500000 +v 0.176776 -0.176777 12.500000 +v 0.176776 -0.176777 11.625000 +v -0.000000 -0.250000 11.625000 +v -0.176778 -0.176777 12.500000 +v -0.176778 -0.176777 11.625000 +v -0.000001 0.250000 11.625000 +v 0.176776 0.176777 12.500000 +v 0.176776 0.176777 11.625000 +v 0.176776 0.176777 11.250000 +v 0.249999 0.000000 11.625000 +v 0.250000 0.000000 11.250000 +v 0.176777 -0.176777 11.250000 +v -0.176777 -0.176777 11.250000 +v -0.250001 -0.000000 11.625000 +v -0.250001 -0.000000 11.250000 +v 0.088387 -0.088388 12.437500 +v -0.000001 -0.125000 12.437500 +v -0.000001 -0.250000 12.500000 +v -0.088389 -0.088388 11.625000 +v -0.088389 -0.088388 12.437500 +v -0.000001 0.125000 12.437500 +v 0.088387 0.088388 12.437500 +v -0.088389 0.088388 12.437500 +v 0.124999 0.000000 12.437500 +v 0.088387 -0.088388 11.625000 +v -0.125001 -0.000000 12.437500 +v -0.088389 0.088388 11.625000 +v 0.088387 0.088388 11.625000 +v -0.000001 0.250000 12.500000 +v -0.000001 0.125000 11.625000 +v 0.124999 0.000000 11.625000 +v -0.000001 -0.125000 11.625000 +v -0.125001 -0.000000 11.625000 +vt 0.092664 0.494208 +vt 0.081081 0.494208 +vt 0.081081 0.548263 +vt 0.058577 0.684060 +vt 0.054054 0.694981 +vt 0.084942 0.694981 +vt 0.046332 0.494208 +vt 0.034749 0.494208 +vt 0.034749 0.548263 +vt 0.115830 0.548263 +vt 0.104247 0.494208 +vt 0.104247 0.548263 +vt 0.069498 0.548263 +vt 0.057915 0.494208 +vt 0.057915 0.548263 +vt 0.081081 0.571429 +vt 0.069498 0.571429 +vt 0.057915 0.571429 +vt 0.046332 0.548263 +vt 0.046332 0.571429 +vt 0.034749 0.571429 +vt 0.023166 0.548263 +vt 0.023166 0.571429 +vt 0.104247 0.571429 +vt 0.092664 0.548263 +vt 0.092664 0.571429 +vt 0.038610 0.486486 +vt 0.084942 0.640927 +vt 0.034749 0.648649 +vt 0.030888 0.640927 +vt 0.084942 0.652510 +vt 0.034749 0.652510 +vt 0.115830 0.494208 +vt 0.108108 0.486486 +vt 0.065637 0.486486 +vt 0.061776 0.486486 +vt 0.084942 0.486486 +vt 0.084942 0.660232 +vt 0.030888 0.660232 +vt 0.034749 0.667954 +vt 0.084942 0.671815 +vt 0.034749 0.671815 +vt 0.034749 0.629344 +vt 0.084942 0.633205 +vt 0.034749 0.633205 +vt 0.034749 0.610039 +vt 0.084942 0.613900 +vt 0.034749 0.613900 +vt 0.084942 0.640927 +vt 0.030888 0.640927 +vt 0.084942 0.602317 +vt 0.030888 0.602317 +vt 0.084942 0.621622 +vt 0.030888 0.621622 +vt 0.084942 0.660232 +vt 0.030888 0.660232 +vt 0.084942 0.679537 +vt 0.030888 0.679537 +vt 0.084942 0.621622 +vt 0.030888 0.621622 +vt 0.027689 0.684062 +vt 0.030888 0.694981 +vt 0.023166 0.694981 +vt 0.027689 0.705901 +vt 0.038610 0.702703 +vt 0.038610 0.710425 +vt 0.046332 0.694981 +vt 0.049531 0.705900 +vt 0.044070 0.700440 +vt 0.049531 0.684060 +vt 0.038610 0.687259 +vt 0.038610 0.679537 +vt 0.044070 0.689520 +vt 0.033150 0.700441 +vt 0.058577 0.705901 +vt 0.069498 0.710425 +vt 0.080419 0.705901 +vt 0.080419 0.684060 +vt 0.069498 0.679537 +vt 0.115830 0.571429 +vt 0.069498 0.494208 +vt 0.042471 0.486486 +vt 0.084942 0.648649 +vt 0.111969 0.486486 +vt 0.088803 0.486486 +vt 0.084942 0.667954 +vt 0.084942 0.629344 +vt 0.084942 0.610039 +vt 0.033150 0.689521 +vt 0.054054 0.694981 +vn -0.9239 0.3827 -0.0000 +vn -0.7972 0.6037 -0.0000 +vn 0.0000 0.0000 -1.0000 +vn 0.9239 -0.3827 0.0000 +vn 0.7972 -0.6037 0.0000 +vn -0.1368 -0.9906 -0.0000 +vn -0.3827 -0.9239 -0.0000 +vn -0.6037 -0.7972 -0.0000 +vn 0.1368 0.9906 0.0000 +vn 0.3827 0.9239 0.0000 +vn 0.6037 0.7972 0.0000 +vn -0.7071 0.7071 -0.0000 +vn -0.0000 1.0000 -0.0000 +vn 0.7071 0.7071 0.0000 +vn 0.9906 -0.1368 0.0000 +vn 1.0000 -0.0000 0.0000 +vn 0.7071 -0.7071 0.0000 +vn 0.0000 -1.0000 -0.0000 +vn -0.7071 -0.7071 -0.0000 +vn -0.9906 0.1368 -0.0000 +vn -1.0000 0.0000 -0.0000 +vn -0.4397 0.1821 0.8795 +vn 0.8760 0.4823 0.0000 +vn -0.1951 0.9808 -0.0000 +vn -0.2783 0.9605 -0.0000 +vn 0.1821 0.4397 0.8795 +vn -0.1821 -0.4397 0.8795 +vn -0.1822 -0.4397 0.8795 +vn 0.4397 -0.1821 0.8795 +vn -0.4823 0.8760 -0.0000 +vn -0.9808 -0.1951 -0.0000 +vn -0.9605 -0.2783 -0.0000 +vn 0.4823 -0.8760 0.0000 +vn 0.9808 0.1951 0.0000 +vn 0.9605 0.2783 0.0000 +vn -0.8760 -0.4823 -0.0000 +vn 0.1951 -0.9808 0.0000 +vn 0.2783 -0.9605 0.0000 +vn 0.0000 0.0000 1.0000 +vn 0.8315 0.5556 0.0000 +vn 0.1822 0.4397 0.8795 +vn -0.5556 0.8315 -0.0000 +vn 0.5556 -0.8315 0.0000 +vn -0.8315 -0.5556 -0.0000 +usemtl None +s 1 +f 495/927/144 496/928/144 497/929/145 +f 498/930/146 499/931/146 500/932/146 +f 501/933/147 502/934/147 503/935/148 +f 504/936/149 505/937/150 506/938/151 +f 507/939/152 508/940/153 509/941/154 +f 498/942/155 507/939/152 499/943/156 +f 510/944/157 511/945/158 512/946/159 +f 513/947/160 504/948/149 500/949/161 +f 514/950/162 515/951/163 516/952/164 +f 501/933/165 517/953/165 502/934/165 +f 504/954/159 518/955/166 519/956/159 +f 518/955/166 520/957/167 521/958/168 +f 519/959/169 521/960/169 505/937/169 +f 508/940/170 522/961/170 523/962/171 +f 495/927/172 524/963/172 496/928/172 +f 521/958/168 506/964/155 505/965/155 +f 525/966/173 526/967/174 517/968/175 +f 527/969/176 528/970/177 524/971/178 +f 522/972/179 529/973/180 523/974/181 +f 524/971/178 497/975/157 496/976/157 +f 507/977/164 522/972/179 530/978/164 +f 523/974/181 509/979/160 508/980/160 +f 511/981/156 525/966/173 501/982/156 +f 517/968/175 503/983/162 502/984/162 +f 515/985/161 527/969/176 495/986/161 +f 497/987/182 531/988/182 507/989/182 +f 509/990/182 532/991/182 511/992/182 +f 533/993/182 503/994/182 526/995/182 +f 506/996/182 534/997/182 515/998/182 +f 520/999/182 526/995/182 529/1000/182 +f 497/929/145 498/942/155 516/952/164 +f 516/952/164 515/951/163 497/929/145 +f 515/951/163 495/927/144 497/929/145 +f 499/931/146 510/1001/146 512/1002/146 +f 512/1002/146 513/1003/146 499/931/146 +f 513/1003/146 500/932/146 499/931/146 +f 500/932/146 514/1004/146 516/1005/146 +f 516/1005/146 498/930/146 500/932/146 +f 503/935/148 513/947/160 512/946/159 +f 512/946/159 511/945/158 503/935/148 +f 511/945/158 501/933/147 503/935/148 +f 506/938/151 514/950/162 500/1006/161 +f 504/936/149 519/959/150 505/937/150 +f 506/938/151 500/1006/161 504/936/149 +f 509/941/154 510/944/157 499/943/156 +f 507/939/152 530/1007/153 508/940/153 +f 509/941/154 499/943/156 507/939/152 +f 498/942/155 497/929/145 507/939/152 +f 510/944/157 509/941/154 511/945/158 +f 513/947/160 503/935/148 504/948/149 +f 514/950/162 506/938/151 515/951/163 +f 501/933/165 525/1008/165 517/953/165 +f 504/954/159 533/1009/183 518/955/166 +f 518/955/166 533/1009/183 520/957/167 +f 519/959/169 518/1010/184 521/960/169 +f 508/940/170 530/1007/170 522/961/170 +f 495/927/172 527/1011/172 524/963/172 +f 521/958/168 520/957/167 506/964/155 +f 525/966/173 532/1012/185 526/967/174 +f 527/969/176 534/1013/186 528/970/177 +f 522/972/179 531/1014/187 529/973/180 +f 524/971/178 528/970/177 497/975/157 +f 507/977/164 531/1014/187 522/972/179 +f 523/974/181 529/973/180 509/979/160 +f 511/981/156 532/1012/185 525/966/173 +f 517/968/175 526/967/174 503/983/162 +f 515/985/161 534/1013/186 527/969/176 +f 497/987/182 528/1015/182 531/988/182 +f 509/990/182 529/1000/182 532/991/182 +f 533/993/182 504/1016/182 503/994/182 +f 506/996/182 520/999/182 534/997/182 +f 520/999/182 533/993/182 526/995/182 +f 526/995/182 532/991/182 529/1000/182 +f 529/1000/182 531/988/182 528/1015/182 +f 528/1015/182 534/997/182 529/1000/182 +f 534/997/182 520/999/182 529/1000/182 +o Stock +v 0.154680 0.735485 -6.625000 +v 0.343750 0.343750 -6.625000 +v 0.156250 0.343750 -7.375000 +v -0.154680 0.735485 -6.625000 +v -0.156250 0.343750 -7.375000 +v -0.343750 0.343750 -6.625000 +v 0.000000 0.781250 -6.625000 +v 0.468750 -0.093750 -6.625000 +v 0.406250 0.093750 -7.375000 +v 0.468750 0.093750 -6.625000 +v 0.343750 -0.343750 -6.625000 +v 0.343750 -0.343750 -7.625000 +v 0.406250 -0.093750 -7.375000 +v -0.156250 0.218750 -7.625000 +v 0.156250 0.218750 -7.625000 +v -0.156250 0.156250 -8.000000 +v 0.156250 0.156250 -8.000000 +v -0.156249 0.156250 -12.125000 +v 0.343751 0.031250 -12.125000 +v 0.156251 0.156250 -12.125000 +v 0.343750 -0.656249 -7.250000 +v 0.343750 -0.718750 -6.625000 +v 0.218750 -0.781249 -7.250000 +v -0.343750 -0.718750 -6.625000 +v -0.218750 -0.781249 -7.250000 +v 0.156251 -2.406250 -12.125000 +v 0.343751 -2.218750 -12.125000 +v -0.156249 -2.406250 -12.125000 +v 0.343750 0.031250 -8.000000 +v 0.343750 0.031250 -7.625000 +v -0.343750 -0.656249 -7.250000 +v -0.343750 -0.343750 -7.625000 +v -0.343750 -0.343750 -6.625000 +v -0.343749 -2.218750 -12.125000 +v -0.343749 0.031250 -12.125000 +v -0.343750 0.031250 -8.000000 +v -0.406250 0.093750 -7.375000 +v -0.343750 0.031250 -7.625000 +v -0.468750 0.093750 -6.625000 +v -0.468750 -0.093750 -6.625000 +v -0.406250 -0.093750 -7.375000 +v 0.343751 -2.218750 -12.500000 +v -0.156249 0.156250 -12.500000 +v -0.343749 0.031250 -12.500000 +v 0.156251 0.156250 -12.500000 +v 0.156251 -2.406250 -12.500000 +v -0.156249 -2.406250 -12.500000 +v 0.343751 -0.718750 -12.312500 +v 0.343751 0.031250 -12.500000 +v 0.343751 -1.468750 -12.312500 +v -0.343749 -0.718750 -12.312500 +v -0.343749 -2.218750 -12.500000 +v -0.343749 -1.468750 -12.312500 +vt 0.980695 0.088803 +vt 0.980695 0.115830 +vt 0.934363 0.108108 +vt 0.980695 0.069498 +vt 0.934363 0.050193 +vt 0.980695 0.042471 +vt 0.988417 0.088803 +vt 0.934363 0.088803 +vt 0.988417 0.079151 +vt 0.934363 0.069498 +vt 0.988417 0.069498 +vt 0.660232 0.270270 +vt 0.706564 0.281853 +vt 0.660232 0.281853 +vt 0.660232 0.297297 +vt 0.934363 0.127413 +vt 0.660232 0.254826 +vt 0.722008 0.254826 +vt 0.706564 0.270270 +vt 0.918919 0.069498 +vt 0.918919 0.088803 +vt 0.895753 0.069498 +vt 0.895753 0.088803 +vt 0.640927 0.069498 +vt 0.640927 0.104247 +vt 0.640927 0.088803 +vt 0.698842 0.235521 +vt 0.660232 0.231660 +vt 0.610039 0.158301 +vt 0.571429 0.150579 +vt 0.610039 0.146718 +vt 0.571429 0.115830 +vt 0.610039 0.119691 +vt 0.926641 0.142857 +vt 1.000000 0.123552 +vt 1.000000 0.138996 +vt 0.926641 0.123552 +vt 0.745174 0.277992 +vt 1.000000 0.277992 +vt 0.918919 0.104247 +vt 0.934363 0.108108 +vt 0.722008 0.277992 +vt 0.610039 0.108108 +vt 0.660232 0.231660 +vt 0.722008 0.254826 +vt 0.698842 0.235521 +vt 0.660232 0.254826 +vt 1.000000 0.138996 +vt 1.000000 0.123552 +vt 1.000000 0.277992 +vt 0.895753 0.054054 +vt 0.745174 0.277992 +vt 0.895753 0.104247 +vt 0.934363 0.050193 +vt 0.918919 0.054054 +vt 0.934363 0.030888 +vt 0.660232 0.297297 +vt 0.706564 0.281853 +vt 0.660232 0.281853 +vt 0.660232 0.270270 +vt 0.706564 0.270270 +vt 0.722008 0.277992 +vt 0.057915 0.266409 +vt 0.042471 0.289575 +vt 0.042471 0.266409 +vt 0.266409 0.266409 +vt 0.247104 0.289575 +vt 0.247104 0.266409 +vt 0.231660 0.289575 +vt 0.231660 0.266409 +vt 0.281853 0.266409 +vt 0.266409 0.289575 +vt 0.077220 0.266409 +vt 0.057915 0.289575 +vt 0.092664 0.266409 +vt 0.077220 0.289575 +vt 0.328185 0.277992 +vt 0.281853 0.289575 +vt 0.420849 0.266409 +vt 0.420849 0.289575 +vt 0.374517 0.277992 +vt 0.362934 0.223938 +vt 0.316602 0.266409 +vt 0.316602 0.223938 +vt 0.420849 0.235521 +vt 0.409266 0.266409 +vt 0.409266 0.223938 +vt 0.262548 0.235521 +vt 0.270270 0.266409 +vt 0.262548 0.254826 +vt 0.270270 0.223938 +vt 0.185328 0.277992 +vt 0.092664 0.289575 +vt 0.138996 0.277992 +vt 0.640927 0.054054 +vt 0.362934 0.266409 +vt 0.420849 0.254826 +vn 0.5473 0.7423 -0.3866 +vn 0.8653 0.4760 -0.1572 +vn 0.4013 0.8284 -0.3908 +vn -0.5473 0.7423 -0.3866 +vn -0.4013 0.8284 -0.3908 +vn -0.8653 0.4760 -0.1572 +vn -0.0000 0.8838 -0.4679 +vn 0.9776 -0.2045 -0.0496 +vn 0.9031 0.3710 -0.2165 +vn 0.9707 0.2263 -0.0809 +vn 0.8944 -0.4472 0.0000 +vn 0.9987 -0.0335 -0.0381 +vn 0.9878 -0.0620 -0.1431 +vn 0.0000 0.9510 -0.3092 +vn 0.0000 0.9966 -0.0825 +vn -0.1922 0.9814 0.0000 +vn 0.5865 0.8096 -0.0234 +vn 0.8817 0.4719 0.0000 +vn 0.5547 0.8321 0.0000 +vn 0.9999 -0.0096 0.0031 +vn 1.0000 0.0000 0.0000 +vn 0.7056 -0.7056 0.0657 +vn 0.1245 -0.9895 0.0741 +vn 0.3705 -0.9144 0.1632 +vn -0.1245 -0.9895 0.0741 +vn -0.3705 -0.9144 0.1632 +vn 0.2585 -0.9591 0.1158 +vn 0.6896 -0.6896 0.2210 +vn 0.8875 -0.4389 0.1407 +vn -0.2585 -0.9591 0.1158 +vn 0.9090 0.3749 -0.1824 +vn 0.6863 0.6863 -0.2408 +vn 0.9987 -0.0335 -0.0380 +vn -0.7056 -0.7056 0.0657 +vn -1.0000 -0.0000 -0.0000 +vn -0.9987 -0.0335 -0.0380 +vn -0.9999 -0.0096 0.0031 +vn -0.8875 -0.4389 0.1407 +vn -0.6896 -0.6896 0.2210 +vn -0.8817 0.4719 -0.0000 +vn -0.5547 0.8321 -0.0000 +vn -0.5865 0.8096 -0.0234 +vn -0.6863 0.6863 -0.2408 +vn -0.9031 0.3710 -0.2165 +vn -0.9090 0.3749 -0.1824 +vn -0.9707 0.2263 -0.0809 +vn -0.9776 -0.2045 -0.0496 +vn -0.9878 -0.0620 -0.1431 +vn -0.8944 -0.4472 -0.0000 +vn 0.9099 -0.4148 0.0000 +vn 0.9239 -0.3827 -0.0000 +vn 0.1922 0.9814 0.0000 +vn -0.2898 0.9571 -0.0000 +vn -0.8594 0.5112 -0.0000 +vn 0.2898 0.9571 -0.0000 +vn 0.3827 -0.9239 0.0000 +vn -0.9239 -0.3827 -0.0000 +vn -0.3827 -0.9239 0.0000 +vn 0.8594 0.5112 0.0000 +vn 0.0000 0.1222 -0.9925 +vn 0.0000 -0.1222 -0.9925 +vn 0.0000 0.0000 -1.0000 +vn 0.0000 0.1628 -0.9867 +vn 0.0000 -0.1775 -0.9841 +vn -0.9099 -0.4148 -0.0000 +vn -0.1245 -0.9894 0.0741 +usemtl None +s 1 +f 535/1017/188 536/1018/189 537/1019/190 +f 538/1020/191 539/1021/192 540/1022/193 +f 535/1023/188 537/1024/190 541/1025/194 +f 541/1025/194 539/1026/192 538/1027/191 +f 537/1024/190 539/1026/192 541/1025/194 +f 542/1028/195 543/1029/196 544/1030/197 +f 544/1030/197 543/1029/196 536/1031/189 +f 537/1019/190 536/1018/189 543/1032/196 +f 542/1028/195 545/1033/198 546/1034/199 +f 547/1035/200 542/1028/195 546/1034/199 +f 537/1024/190 548/1036/201 539/1026/192 +f 549/1037/201 550/1038/202 548/1036/201 +f 551/1039/202 552/1040/203 550/1038/202 +f 551/1039/204 553/1041/205 554/1042/206 +f 555/1043/207 546/1034/199 556/1044/208 +f 555/1045/209 556/1046/210 557/1047/211 +f 557/1047/211 558/1048/212 559/1049/213 +f 557/1047/211 560/1050/214 555/1045/209 +f 560/1051/215 561/1052/216 555/1043/207 +f 562/1053/217 557/1047/211 559/1049/213 +f 555/1043/207 561/1052/216 546/1034/199 +f 563/1054/205 546/1034/199 553/1055/205 +f 561/1052/216 553/1055/205 546/1034/199 +f 564/1056/218 549/1037/219 543/1057/196 +f 543/1057/196 549/1037/219 537/1024/190 +f 546/1034/199 564/1058/218 547/1035/200 +f 563/1054/205 564/1058/218 546/1034/199 +f 543/1029/196 547/1035/200 564/1058/218 +f 545/1033/208 556/1044/208 546/1034/220 +f 559/1049/213 558/1048/212 565/1059/221 +f 558/1060/222 566/1061/223 565/1062/224 +f 558/1060/222 567/1063/222 566/1061/223 +f 562/1053/217 559/1049/213 565/1059/221 +f 568/1064/225 562/1065/226 565/1062/224 +f 565/1062/224 566/1061/223 568/1064/225 +f 568/1064/225 566/1061/223 569/1066/227 +f 552/1040/228 570/1067/227 550/1038/229 +f 569/1066/227 566/1061/223 570/1068/227 +f 563/1069/205 551/1039/204 564/1056/218 +f 548/1036/230 571/1070/231 539/1026/192 +f 572/1071/232 571/1070/231 548/1036/230 +f 539/1021/192 571/1072/231 540/1022/193 +f 540/1073/193 571/1074/231 573/1075/233 +f 574/1076/234 571/1074/231 575/1077/235 +f 567/1063/236 574/1076/234 566/1061/223 +f 575/1077/235 566/1061/223 574/1076/234 +f 571/1074/231 572/1078/232 575/1077/235 +f 575/1077/235 572/1078/232 566/1061/223 +f 570/1068/227 566/1061/223 572/1078/232 +f 560/1079/214 576/1080/237 561/1081/238 +f 554/1082/239 577/1083/240 552/1084/203 +f 552/1084/203 578/1085/241 569/1086/227 +f 553/1087/205 579/1088/242 554/1082/239 +f 562/1089/217 580/1090/243 560/1079/214 +f 568/1091/244 581/1092/245 562/1089/217 +f 553/1087/205 582/1093/208 583/1094/246 +f 561/1095/238 576/1096/237 584/1097/208 +f 561/1095/238 582/1093/208 553/1087/205 +f 584/1098/247 585/1099/248 582/1100/248 +f 580/1101/249 586/1102/250 576/1103/250 +f 586/1102/250 584/1098/247 576/1103/250 +f 579/1104/249 578/1105/251 577/1106/249 +f 582/1100/248 578/1105/251 583/1107/251 +f 578/1085/241 585/1108/222 569/1086/227 +f 586/1109/252 568/1091/244 587/1110/222 +f 585/1108/222 568/1091/244 569/1086/227 +f 551/1039/204 549/1037/219 564/1056/218 +f 570/1067/227 572/1071/232 550/1038/229 +f 548/1036/230 550/1038/229 572/1071/232 +f 542/1028/195 547/1035/200 543/1029/196 +f 537/1024/190 549/1037/201 548/1036/201 +f 549/1037/201 551/1039/202 550/1038/202 +f 551/1039/202 554/1042/239 552/1040/203 +f 551/1039/204 563/1069/205 553/1041/205 +f 557/1047/211 556/1046/210 558/1048/253 +f 562/1053/217 560/1050/214 557/1047/211 +f 552/1040/228 569/1111/227 570/1067/227 +f 574/1076/234 573/1075/233 571/1074/231 +f 560/1079/214 580/1090/243 576/1080/237 +f 554/1082/239 579/1088/242 577/1083/240 +f 552/1084/203 577/1083/240 578/1085/241 +f 553/1087/205 583/1094/246 579/1088/242 +f 562/1089/217 581/1092/245 580/1090/243 +f 568/1091/244 586/1109/252 581/1092/245 +f 561/1095/238 584/1097/208 582/1093/208 +f 584/1098/247 587/1112/247 585/1099/248 +f 580/1101/249 581/1113/249 586/1102/250 +f 586/1102/250 587/1112/247 584/1098/247 +f 579/1104/249 583/1107/251 578/1105/251 +f 582/1100/248 585/1099/248 578/1105/251 +f 585/1108/222 587/1110/222 568/1091/244 +o Magazine +v 0.312500 -3.843750 -1.312500 +v -0.312500 -3.593750 0.437500 +v -0.312500 -3.843750 -1.312500 +v 0.312500 -3.593750 0.437500 +v -0.312500 -0.218750 0.250000 +v 0.312500 -0.218750 -0.562500 +v 0.125000 -0.218750 -0.562500 +v 0.312500 -0.218750 0.250000 +v -0.312500 -0.218750 -0.562500 +v -0.125000 -0.218750 -0.562500 +v 0.125000 -0.218750 -1.437500 +v 0.125000 -0.093750 -0.687500 +v 0.125000 -0.093750 -1.437500 +v -0.125000 -0.093750 -0.687500 +v -0.125000 -0.218750 -1.437500 +v -0.125000 -0.093750 -1.437500 +v -0.187500 -0.093750 -1.437500 +v -0.312500 -0.218750 -1.437500 +v 0.187500 -0.093750 -1.437500 +v 0.312500 -0.218750 -1.437500 +v -0.187500 -0.093750 -0.687500 +v 0.187500 -0.093750 -0.687500 +vt 0.420849 0.328185 +vt 0.312741 0.289575 +vt 0.420849 0.289575 +vt 0.312741 0.328185 +vt 0.104247 0.289575 +vt 0.698842 0.328185 +vt 0.698842 0.316602 +vt 0.749035 0.328185 +vt 0.698842 0.289575 +vt 0.749035 0.289575 +vt 0.698842 0.301158 +vt 0.675676 0.316602 +vt 0.667954 0.359073 +vt 0.667954 0.316602 +vt 0.683398 0.359073 +vt 0.675676 0.316602 +vt 0.683398 0.316602 +vt 0.652510 0.297297 +vt 0.644788 0.301158 +vt 0.644788 0.289575 +vt 0.644788 0.316602 +vt 0.652510 0.320463 +vt 0.644788 0.328185 +vt 0.104247 0.328185 +vt 0.675676 0.366795 +vt 0.675676 0.366795 +vt 0.652510 0.301158 +vt 0.652510 0.316602 +vt 0.656371 0.243243 +vt 0.656371 0.289575 +vt 0.687259 0.362934 +vt 0.687259 0.316602 +vt 0.656371 0.374517 +vt 0.644788 0.382239 +vt 0.664093 0.362934 +vt 0.664093 0.316602 +vt 0.683398 0.374517 +vt 0.694981 0.374517 +vt 0.667954 0.374517 +vt 0.656371 0.374517 +vt 0.436293 0.185328 +vt 0.644788 0.185328 +vt 0.644788 0.235521 +vt 0.644788 0.432432 +vt 0.436293 0.432432 +vt 0.683398 0.362934 +vt 0.656371 0.328185 +vt 0.667954 0.362934 +vn 0.0000 -0.9899 0.1414 +vn 0.0000 0.0555 0.9985 +vn -0.0000 1.0000 0.0000 +vn -1.0000 -0.0000 -0.0000 +vn 1.0000 0.0000 0.0000 +vn -0.0000 0.0000 -1.0000 +vn 0.0000 -0.0345 -0.9994 +vn -0.9221 0.3869 -0.0000 +vn -0.7071 0.7071 -0.0000 +vn 0.0000 0.8959 0.4444 +vn 0.9221 0.3869 0.0000 +vn 0.7071 0.7071 0.0000 +vn 0.9847 0.1743 0.0000 +vn 0.0000 0.7071 0.7071 +vn -0.9847 0.1743 0.0000 +vn 0.0000 0.9239 0.3827 +usemtl None +s off +f 588/1114/254 589/1115/254 590/1116/254 +f 591/1117/255 592/1118/255 589/1115/255 +f 593/1119/256 594/1120/256 595/1121/256 +f 596/1122/256 592/1123/256 597/1124/256 +f 598/1125/257 599/1126/257 600/1127/257 +f 601/1128/258 602/1129/258 603/1130/258 +f 604/1131/259 602/1132/259 605/1133/259 +f 598/1134/259 606/1135/259 607/1136/259 +f 594/1120/256 592/1123/256 595/1121/256 +f 598/1134/256 597/1124/256 594/1120/256 +f 598/1134/260 607/1136/260 588/1114/260 +f 588/1114/254 591/1117/254 589/1115/254 +f 591/1117/255 595/1137/255 592/1118/255 +f 598/1125/257 594/1138/257 599/1126/257 +f 601/1128/258 597/1139/258 602/1129/258 +f 604/1131/259 603/1140/259 602/1132/259 +f 598/1134/259 600/1141/259 606/1135/259 +f 594/1120/256 597/1124/256 592/1123/256 +f 598/1134/256 602/1132/256 597/1124/256 +f 588/1114/260 590/1116/260 602/1132/260 +f 590/1116/260 605/1133/260 602/1132/260 +f 602/1132/260 598/1134/260 588/1114/260 +s 1 +f 605/1133/261 608/1142/262 604/1143/262 +f 608/1144/263 603/1130/256 604/1145/256 +f 607/1136/264 609/1146/265 593/1147/266 +f 600/1127/256 609/1148/263 606/1149/256 +f 597/1150/267 608/1144/263 596/1151/267 +f 609/1148/263 594/1152/267 593/1153/267 +f 589/1154/257 592/1155/257 596/1156/268 +f 593/1147/266 595/1157/258 591/1158/258 +f 605/1133/261 596/1156/268 608/1142/262 +f 608/1144/263 601/1159/269 603/1130/256 +f 607/1136/264 606/1160/265 609/1146/265 +f 600/1127/256 599/1161/269 609/1148/263 +f 597/1150/267 601/1159/269 608/1144/263 +f 609/1148/263 599/1161/269 594/1152/267 +f 605/1133/261 590/1116/257 596/1156/268 +f 590/1116/257 589/1154/257 596/1156/268 +f 591/1158/258 588/1114/258 593/1147/266 +f 588/1114/258 607/1136/264 593/1147/266 +o Mag_Paddle +v -0.093750 -1.307663 -1.505856 +v 0.093750 -1.477596 -1.585097 +v 0.093750 -1.307663 -1.505856 +v 0.093750 -1.451182 -1.641741 +v -0.093750 -1.281250 -1.562500 +v 0.093750 -1.281250 -1.562500 +v -0.093750 -1.477596 -1.585097 +v 0.156250 -1.734404 -1.773809 +v -0.156250 -1.734404 -1.773809 +v -0.156250 -1.507827 -1.668154 +v 0.156250 -1.534240 -1.611510 +v -0.156250 -1.534240 -1.611510 +v -0.093750 -1.451182 -1.641741 +v 0.156250 -1.507827 -1.668154 +v -0.156250 -1.760817 -1.717165 +v 0.156250 -1.760817 -1.717165 +vt 0.725869 0.664093 +vt 0.737452 0.652510 +vt 0.737452 0.664093 +vt 0.749035 0.652510 +vt 0.760618 0.664093 +vt 0.749035 0.664093 +vt 0.741313 0.652510 +vt 0.745174 0.664093 +vt 0.741313 0.664093 +vt 0.764479 0.664093 +vt 0.768340 0.652510 +vt 0.768340 0.664093 +vt 0.745174 0.633205 +vt 0.764479 0.633205 +vt 0.764479 0.648649 +vt 0.741313 0.648649 +vt 0.722008 0.648649 +vt 0.725869 0.652510 +vt 0.760618 0.652510 +vt 0.745174 0.652510 +vt 0.764479 0.652510 +vt 0.745174 0.648649 +vt 0.722008 0.633205 +vt 0.741313 0.633205 +vt 0.768340 0.648649 +vt 0.768340 0.633205 +vt 0.745174 0.629344 +vt 0.764479 0.629344 +vn 0.0000 -0.4226 0.9063 +vn 0.0000 0.4226 -0.9063 +vn 1.0000 0.0000 0.0000 +vn -1.0000 -0.0000 -0.0000 +vn 0.9239 0.3468 0.1617 +vn 0.7071 0.6409 0.2988 +vn -0.7071 0.6409 0.2988 +vn -0.9239 0.3468 0.1617 +vn 0.0000 -0.9063 -0.4226 +usemtl None +s off +f 610/1162/270 611/1163/270 612/1164/270 +f 613/1165/271 614/1166/271 615/1167/271 +f 611/1168/272 615/1169/272 612/1170/272 +f 614/1171/273 616/1172/273 610/1173/273 +f 617/1174/271 618/1175/271 619/1176/271 +f 620/1177/270 611/1163/270 621/1178/270 +f 610/1162/270 616/1179/270 611/1163/270 +f 613/1165/271 622/1180/271 614/1166/271 +f 611/1168/272 613/1181/272 615/1169/272 +f 614/1171/273 622/1182/273 616/1172/273 +f 619/1176/271 622/1180/271 613/1165/271 +f 613/1165/271 623/1183/271 619/1176/271 +f 623/1183/271 617/1174/271 619/1176/271 +f 611/1163/270 616/1179/270 621/1178/270 +f 621/1178/270 624/1184/270 625/1185/270 +f 625/1185/270 620/1177/270 621/1178/270 +s 1 +f 620/1177/274 613/1181/275 611/1168/275 +f 622/1182/276 621/1186/277 616/1172/276 +f 619/1176/277 624/1187/273 621/1186/277 +f 625/1185/272 623/1183/274 620/1177/274 +f 625/1188/278 618/1175/278 617/1174/278 +f 620/1177/274 623/1183/274 613/1181/275 +f 622/1182/276 619/1176/277 621/1186/277 +f 619/1176/277 618/1175/273 624/1187/273 +f 625/1185/272 617/1174/272 623/1183/274 +f 625/1188/278 624/1189/278 618/1175/278 +o Plug +v -0.000000 0.781250 5.125000 +v -0.156250 0.625000 5.125000 +v -0.110486 0.735485 5.125000 +v 0.156250 0.625000 5.437500 +v -0.110486 0.514515 5.125000 +v -0.110486 0.514515 5.687500 +v -0.156250 0.625000 5.687500 +v 0.110486 0.735485 5.437500 +v 0.110485 0.514515 5.125000 +v -0.000000 0.468750 5.125000 +v -0.110486 0.735485 6.000000 +v -0.110486 0.514515 6.000000 +v 0.110485 0.514515 6.000000 +v 0.110486 0.735485 5.125000 +v 0.156250 0.625000 5.125000 +v 0.110486 0.735485 6.000000 +v -0.000000 0.781250 6.000000 +v -0.156250 0.625000 6.000000 +v -0.000000 0.468750 6.000000 +v 0.156250 0.625000 6.000000 +vt 0.181467 0.602317 +vt 0.193050 0.598456 +vt 0.189189 0.602317 +vt 0.208494 0.579151 +vt 0.193050 0.598456 +vt 0.193050 0.563707 +vt 0.181467 0.509652 +vt 0.189189 0.486486 +vt 0.189189 0.509652 +vt 0.204633 0.602317 +vt 0.196911 0.602317 +vt 0.177606 0.579151 +vt 0.193050 0.563707 +vt 0.194084 0.547229 +vt 0.180433 0.547229 +vt 0.180433 0.560879 +vt 0.177606 0.598456 +vt 0.208494 0.598456 +vt 0.181467 0.486486 +vt 0.194084 0.560879 +vt 0.196911 0.554054 +vt 0.187259 0.544402 +vt 0.177606 0.554054 +vt 0.187259 0.563707 +vt 0.196911 0.544402 +vt 0.196911 0.490348 +vt 0.189189 0.544402 +vt 0.173745 0.544402 +vt 0.173745 0.490348 +vt 0.189189 0.490348 +vt 0.181467 0.490348 +vt 0.181467 0.544402 +vn 0.0000 0.0000 -1.0000 +vn -0.3827 0.9239 -0.0000 +vn -0.6048 -0.2505 -0.7560 +vn 0.3827 -0.9239 0.0000 +vn 0.0000 0.0000 1.0000 +vn 0.3827 0.9239 0.0000 +vn 0.6037 0.7972 0.0000 +vn 0.7071 0.7071 0.0000 +vn 0.9906 -0.1368 0.0000 +vn 0.9239 -0.3827 0.0000 +vn 1.0000 -0.0000 0.0000 +usemtl None +s off +f 626/1190/279 627/1191/279 628/1192/279 +f 629/1193/280 630/1194/280 631/1195/280 +f 629/1196/281 632/1197/281 633/1198/281 +f 630/1194/279 634/1199/279 635/1200/279 +f 627/1191/282 633/1201/282 632/1202/282 +f 636/1203/283 637/1204/283 638/1205/283 +f 626/1190/279 639/1206/279 627/1191/279 +f 629/1193/280 640/1207/280 630/1194/280 +f 629/1196/281 631/1208/281 632/1197/281 +f 630/1194/279 640/1207/279 634/1199/279 +f 627/1191/282 639/1206/282 633/1201/282 +f 641/1209/283 642/1210/283 636/1203/283 +f 636/1203/283 643/1211/283 637/1204/283 +f 637/1204/283 644/1212/283 638/1205/283 +f 638/1205/283 645/1213/283 641/1209/283 +f 641/1209/283 636/1203/283 638/1205/283 +s 1 +f 642/1214/284 633/1198/285 626/1215/284 +f 641/1216/286 629/1196/287 633/1198/285 +f 629/1196/287 638/1217/288 634/1218/288 +f 633/1198/285 639/1219/284 626/1215/284 +f 629/1196/287 634/1218/288 640/1220/288 +f 642/1214/284 641/1216/286 633/1198/285 +f 641/1216/286 645/1221/289 629/1196/287 +f 629/1196/287 645/1221/289 638/1217/288 +o Handle +v -0.034864 0.545839 5.343752 +v -0.080628 0.656323 5.218752 +v -0.034864 0.545839 5.218752 +v 0.208084 0.775912 5.343752 +v -0.080628 0.656323 5.343752 +v 0.253848 0.665427 5.593752 +v 0.253848 0.665427 5.343752 +v 0.450993 0.679438 5.656252 +v 0.427076 0.737180 5.593752 +v 0.381311 0.847665 5.593752 +v 0.357394 0.905408 5.656252 +v 0.184166 0.833655 5.968752 +v 0.357394 0.905408 6.031252 +v 0.277766 0.607685 5.968752 +v 0.450993 0.679438 6.031252 +v 0.208084 0.775912 5.593752 +v 0.184166 0.833655 5.656252 +v 0.277766 0.607685 5.656252 +v 0.080621 0.593674 5.156252 +v 0.427076 0.737180 5.343752 +v 0.323569 0.823748 5.156252 +v 0.034857 0.704159 5.156252 +v 0.381311 0.847665 5.343752 +v 0.369333 0.713263 5.156252 +vt 0.277992 0.416988 +vt 0.285714 0.409266 +vt 0.285714 0.416988 +vt 0.258687 0.409266 +vt 0.277992 0.409266 +vt 0.243243 0.416988 +vt 0.258687 0.416988 +vt 0.343629 0.420849 +vt 0.339768 0.416988 +vt 0.339768 0.409266 +vt 0.258687 0.378378 +vt 0.239382 0.389961 +vt 0.235521 0.378378 +vt 0.239382 0.436293 +vt 0.258687 0.447876 +vt 0.235521 0.447876 +vt 0.243243 0.409266 +vt 0.343629 0.405405 +vt 0.366795 0.405405 +vt 0.366795 0.420849 +vt 0.258687 0.389961 +vt 0.258687 0.436293 +vt 0.277992 0.436293 +vt 0.289575 0.424710 +vt 0.262548 0.447876 +vt 0.277992 0.447876 +vt 0.277992 0.389961 +vt 0.289575 0.382239 +vt 0.289575 0.401544 +vt 0.262548 0.378378 +vt 0.277992 0.378378 +vt 0.324324 0.416988 +vt 0.293436 0.416988 +vt 0.312741 0.409266 +vt 0.312741 0.416988 +vt 0.293436 0.409266 +vt 0.324324 0.409266 +vt 0.239382 0.405405 +vt 0.239382 0.420849 +vt 0.262548 0.389961 +vt 0.262548 0.436293 +vt 0.220077 0.420849 +vt 0.220077 0.405405 +vt 0.208494 0.420849 +vt 0.289575 0.444015 +vt 0.208494 0.405405 +vn -0.9239 -0.3827 0.0000 +vn 0.0000 0.0000 1.0000 +vn 0.9239 0.3827 0.0000 +vn -0.3827 0.9239 0.0000 +vn 0.3827 -0.9239 -0.0000 +vn 0.3536 -0.8536 -0.3827 +vn -0.3536 0.8535 -0.3827 +vn 0.9119 0.3777 -0.1602 +vn -0.2123 -0.0879 -0.9732 +vn -0.0000 0.0000 -1.0000 +vn -0.4132 -0.1711 -0.8944 +vn 0.8765 0.3630 -0.3162 +vn -0.2706 0.6533 -0.7071 +vn -0.3535 0.8536 -0.3827 +vn -0.3536 0.8536 -0.3827 +vn 0.2706 -0.6533 -0.7071 +vn -0.7495 -0.3104 0.5847 +vn -0.2922 -0.1210 0.9487 +usemtl None +s off +f 646/1222/290 647/1223/290 648/1224/290 +f 646/1222/291 649/1225/291 650/1226/291 +f 651/1227/290 649/1225/290 652/1228/290 +f 653/1229/292 654/1230/292 655/1231/292 +f 656/1232/293 657/1233/293 658/1234/293 +f 659/1235/294 653/1236/294 660/1237/294 +f 646/1222/290 650/1226/290 647/1223/290 +f 646/1222/291 652/1228/291 649/1225/291 +f 651/1227/290 661/1238/290 649/1225/290 +f 655/1231/292 656/1239/292 653/1229/292 +f 656/1239/292 658/1240/292 653/1229/292 +f 658/1240/292 660/1241/292 653/1229/292 +f 656/1232/293 662/1242/293 657/1233/293 +f 659/1235/294 663/1243/294 653/1236/294 +s 1 +f 652/1244/294 646/1222/294 664/1245/294 +f 654/1246/295 652/1244/294 665/1247/294 +f 649/1248/293 666/1249/293 667/1250/293 +f 649/1248/293 655/1251/296 668/1252/293 +f 665/1253/297 655/1231/292 654/1230/292 +f 664/1254/298 666/1255/299 669/1256/299 +f 648/1224/300 667/1257/298 664/1254/298 +f 669/1256/301 668/1258/297 665/1253/297 +f 662/1259/290 651/1227/290 663/1260/290 +f 662/1242/302 655/1251/303 661/1261/304 +f 654/1246/295 663/1243/305 651/1262/295 +f 662/1259/290 659/1263/306 657/1264/306 +f 660/1265/307 657/1264/306 659/1263/306 +f 646/1222/294 648/1224/294 664/1245/294 +f 664/1245/294 669/1266/294 652/1244/294 +f 669/1266/294 665/1247/294 652/1244/294 +f 654/1246/295 651/1262/295 652/1244/294 +f 667/1250/293 647/1223/293 650/1226/293 +f 649/1248/293 668/1252/293 666/1249/293 +f 667/1250/293 650/1226/293 649/1248/293 +f 649/1248/293 661/1261/296 655/1251/296 +f 665/1253/297 668/1258/297 655/1231/292 +f 664/1254/298 667/1257/298 666/1255/299 +f 648/1224/300 647/1223/300 667/1257/298 +f 669/1256/301 666/1255/301 668/1258/297 +f 662/1259/290 661/1238/290 651/1227/290 +f 662/1242/302 656/1232/302 655/1251/296 +f 654/1246/295 653/1236/305 663/1243/305 +f 662/1259/290 663/1260/290 659/1263/306 +f 660/1265/307 658/1267/307 657/1264/306 +o Guide_And_Bolt +v 0.093750 0.468750 0.125000 +v -0.156250 0.625000 0.125000 +v -0.093750 0.468750 0.125000 +v 0.281250 0.343750 0.125000 +v -0.281250 0.343750 0.125000 +v -0.218750 0.093750 0.125000 +v -0.093750 0.218750 0.125000 +v -0.343750 0.218750 0.125000 +v 0.218750 0.093750 0.125000 +v 0.343750 0.218750 0.125000 +v 0.093750 0.218750 0.125000 +v -0.093750 0.468750 -1.750000 +v 0.093750 0.218750 0.875000 +v -0.218750 0.093750 0.875000 +v -0.343750 0.218750 -1.750000 +v -0.093750 0.218750 0.875000 +v -0.281250 0.343750 -1.750000 +v -0.218750 -0.093750 0.875000 +v 0.093750 -0.218750 0.875000 +v -0.000000 0.468750 5.125000 +v -0.110486 0.514515 0.125000 +v -0.000000 0.468750 0.125000 +v -0.000000 0.781250 5.125000 +v 0.110486 0.735485 0.125000 +v -0.000000 0.781250 0.125000 +v 0.110485 0.514515 5.125000 +v 0.110485 0.514515 0.125000 +v -0.110486 0.514515 5.125000 +v 0.110486 0.735485 5.125000 +v 0.156250 0.625000 0.125000 +v -0.156250 0.625000 5.125000 +v -0.156250 0.625000 -1.750000 +v 0.218750 0.093750 0.875000 +v -0.093750 -0.218750 0.875000 +v 0.218750 -0.093750 0.875000 +v 0.156250 0.625000 5.125000 +v -0.110486 0.735485 5.125000 +vt 0.347490 0.509652 +vt 0.335907 0.494208 +vt 0.347490 0.498069 +vt 0.355212 0.521236 +vt 0.355212 0.486486 +vt 0.370656 0.490348 +vt 0.362934 0.498069 +vt 0.362934 0.482625 +vt 0.370656 0.517375 +vt 0.362934 0.525097 +vt 0.362934 0.509652 +vt 0.335907 0.517375 +vt 0.220077 0.505791 +vt 0.335907 0.505791 +vt 0.262548 0.471042 +vt 0.208494 0.482625 +vt 0.208494 0.471042 +vt 0.262548 0.447876 +vt 0.208494 0.459459 +vt 0.208494 0.447876 +vt 0.335907 0.490348 +vt 0.220077 0.482625 +vt 0.335907 0.482625 +vt 0.262548 0.459459 +vt 0.220077 0.490348 +vt 0.270270 0.474903 +vt 0.262548 0.455598 +vt 0.281853 0.447876 +vt 0.598456 0.440154 +vt 0.289575 0.447876 +vt 0.289575 0.440154 +vt 0.289575 0.471042 +vt 0.598456 0.463320 +vt 0.598456 0.471042 +vt 0.598456 0.432432 +vt 0.289575 0.432432 +vt 0.598456 0.447876 +vt 0.289575 0.455598 +vt 0.289575 0.463320 +vt 0.598456 0.455598 +vt 0.598456 0.461390 +vt 0.608108 0.451737 +vt 0.617761 0.461390 +vt 0.335907 0.513514 +vt 0.220077 0.517375 +vt 0.262548 0.482625 +vt 0.262548 0.467181 +vt 0.270270 0.447876 +vt 0.289575 0.455598 +vt 0.289575 0.467181 +vt 0.281853 0.474903 +vt 0.598456 0.455598 +vt 0.289575 0.455598 +vt 0.614933 0.468215 +vt 0.608108 0.471042 +vt 0.601283 0.468215 +vt 0.601283 0.454565 +vt 0.614933 0.454565 +vn -0.0000 0.0000 1.0000 +vn -0.9285 -0.3714 -0.0000 +vn -0.9550 0.2966 -0.0000 +vn 0.3827 0.9239 0.0000 +vn 0.7071 0.7071 0.0000 +vn -0.7071 0.7071 -0.0000 +vn -0.3827 0.9239 0.0000 +vn -0.7497 0.6618 -0.0000 +vn -0.8944 0.4472 -0.0000 +vn 0.0000 -1.0000 0.0000 +vn -0.7071 -0.7071 -0.0000 +vn 0.3827 -0.9239 0.0000 +vn -0.9239 -0.3827 -0.0000 +vn 0.9239 0.3827 0.0000 +vn 0.0000 0.0000 -1.0000 +usemtl None +s 1 +f 670/1268/308 671/1269/308 672/1270/308 +f 673/1271/308 672/1270/308 674/1272/308 +f 675/1273/308 676/1274/308 677/1275/308 +f 678/1276/308 679/1277/308 680/1278/308 +f 680/1278/308 679/1277/308 673/1271/308 +f 671/1279/309 681/1280/310 672/1281/310 +f 682/1282/311 678/1283/312 680/1284/311 +f 683/1285/313 676/1286/314 675/1287/313 +f 674/1288/315 684/1289/316 677/1290/316 +f 685/1291/314 680/1284/311 676/1286/314 +f 672/1281/310 686/1292/315 674/1288/315 +f 685/1293/308 687/1294/308 688/1295/308 +f 689/1296/317 690/1297/318 691/1298/317 +f 692/1299/311 693/1300/312 694/1301/311 +f 695/1302/319 691/1298/317 696/1303/319 +f 697/1304/318 671/1305/320 690/1297/318 +f 698/1306/312 699/1307/321 693/1300/312 +f 689/1308/322 700/1309/322 692/1310/322 +f 670/1268/308 699/1311/308 671/1269/308 +f 673/1271/308 670/1268/308 672/1270/308 +f 673/1271/308 674/1272/308 676/1274/308 +f 674/1272/308 677/1275/308 676/1274/308 +f 676/1274/308 680/1278/308 673/1271/308 +f 671/1279/309 701/1312/309 681/1280/310 +f 682/1282/311 702/1313/312 678/1283/312 +f 683/1285/313 685/1291/314 676/1286/314 +f 674/1288/315 686/1292/315 684/1289/316 +f 685/1291/314 682/1282/311 680/1284/311 +f 672/1281/310 681/1280/310 686/1292/315 +f 685/1293/308 683/1314/308 687/1294/308 +f 687/1294/308 703/1315/308 688/1295/308 +f 688/1295/308 704/1316/308 702/1317/308 +f 702/1317/308 682/1318/308 688/1295/308 +f 682/1318/308 685/1293/308 688/1295/308 +f 689/1296/317 697/1304/318 690/1297/318 +f 692/1299/311 698/1306/312 693/1300/312 +f 695/1302/319 689/1296/317 691/1298/317 +f 697/1304/318 700/1319/320 671/1305/320 +f 698/1306/312 705/1320/321 699/1307/321 +f 692/1310/322 698/1321/322 705/1322/322 +f 705/1322/322 695/1323/322 692/1310/322 +f 695/1323/322 689/1308/322 692/1310/322 +f 689/1308/322 697/1324/322 700/1309/322 +f 700/1309/322 706/1325/322 692/1310/322 +o Bullet +v 0.099841 -0.175376 -0.129965 +v 0.070825 -0.251737 -0.248711 +v 0.099231 -0.186101 -0.254503 +v 0.004758 -0.267392 -0.121575 +v -0.061742 -0.249788 -0.248230 +v 0.004148 -0.278117 -0.246113 +v -0.087637 -0.172620 -0.129284 +v -0.059841 -0.117709 -0.259614 +v -0.088247 -0.183345 -0.253822 +v 0.007446 -0.080604 -0.137674 +v 0.072726 -0.119658 -0.260095 +v 0.006836 -0.091329 -0.262212 +v 0.071436 -0.241012 -0.124174 +v -0.061132 -0.239063 -0.123692 +v -0.059231 -0.106984 -0.135076 +v 0.073336 -0.108933 -0.135558 +v 0.050573 -0.202586 0.060816 +v -0.037805 -0.201287 0.061137 +v -0.036538 -0.113234 0.053547 +v 0.051840 -0.114534 0.053226 +v 0.069510 -0.158829 0.056954 +v -0.055475 -0.156991 0.057409 +v 0.007913 -0.095648 0.051815 +v 0.007628 -0.147185 0.181719 +v 0.006122 -0.220173 0.062548 +v -0.108395 -0.325341 -0.617887 +v -0.156232 -0.278953 -1.374432 +v -0.112057 -0.389692 -1.365112 +v -0.105228 -0.105209 -0.636860 +v 0.002240 -0.125593 -1.388416 +v -0.108889 -0.169560 -1.384085 +v 0.115718 -0.108457 -0.637663 +v 0.156232 -0.283547 -1.375568 +v 0.112057 -0.172808 -1.384888 +v 0.159893 -0.219196 -0.628343 +v 0.108889 -0.392940 -1.365915 +v 0.001422 -0.372556 -0.614359 +v -0.002240 -0.436907 -1.361584 +v -0.152571 -0.214602 -0.627207 +v 0.005901 -0.061242 -0.641191 +v 0.112550 -0.328589 -0.618690 +v 0.007284 -0.060198 -0.264895 +v -0.082840 -0.116821 -0.510506 +v -0.081619 -0.095371 -0.261431 +v 0.130478 -0.186561 -0.254616 +v 0.093917 -0.119420 -0.511148 +v 0.095137 -0.097970 -0.262073 +v 0.092603 -0.274075 -0.246894 +v 0.129257 -0.208011 -0.503692 +v -0.084153 -0.271477 -0.246252 +v 0.002480 -0.330699 -0.492504 +v 0.003700 -0.309249 -0.243429 +v -0.120714 -0.204336 -0.502783 +v -0.119494 -0.182886 -0.253708 +v 0.006063 -0.081648 -0.513970 +v 0.091383 -0.295526 -0.495969 +v -0.085374 -0.292927 -0.495327 +vt 0.776062 0.513514 +vt 0.772201 0.505791 +vt 0.776062 0.505791 +vt 0.799228 0.513514 +vt 0.795367 0.505791 +vt 0.799228 0.505791 +vt 0.791506 0.513514 +vt 0.787645 0.505791 +vt 0.791506 0.505791 +vt 0.783784 0.513514 +vt 0.779923 0.505791 +vt 0.783784 0.505791 +vt 0.772201 0.513514 +vt 0.768340 0.505791 +vt 0.795367 0.513514 +vt 0.787645 0.513514 +vt 0.779923 0.513514 +vt 0.772201 0.525097 +vt 0.768340 0.513514 +vt 0.795367 0.525097 +vt 0.787645 0.525097 +vt 0.779923 0.525097 +vt 0.776062 0.525097 +vt 0.791506 0.525097 +vt 0.783784 0.525097 +vt 0.774131 0.532819 +vt 0.781853 0.532819 +vt 0.785714 0.532819 +vt 0.793436 0.532819 +vt 0.768340 0.525097 +vt 0.770270 0.532819 +vt 0.777992 0.532819 +vt 0.789575 0.532819 +vt 0.799228 0.525097 +vt 0.797297 0.532819 +vt 0.745174 0.494208 +vt 0.698842 0.501930 +vt 0.698842 0.494208 +vt 0.745174 0.509652 +vt 0.698842 0.517375 +vt 0.698842 0.509652 +vt 0.745174 0.525097 +vt 0.698842 0.532819 +vt 0.698842 0.525097 +vt 0.745174 0.532819 +vt 0.698842 0.540541 +vt 0.745174 0.486486 +vt 0.698842 0.486486 +vt 0.745174 0.501930 +vt 0.745174 0.517375 +vt 0.745174 0.540541 +vt 0.698842 0.548263 +vt 0.768340 0.517375 +vt 0.752896 0.509652 +vt 0.768340 0.509652 +vt 0.768340 0.532819 +vt 0.752896 0.525097 +vt 0.768340 0.525097 +vt 0.768340 0.540541 +vt 0.752896 0.532819 +vt 0.768340 0.494208 +vt 0.752896 0.486486 +vt 0.768340 0.486486 +vt 0.752896 0.501930 +vt 0.768340 0.501930 +vt 0.752896 0.517375 +vt 0.768340 0.548263 +vt 0.752896 0.540541 +vt 0.752896 0.494208 +vt 0.752896 0.494981 +vt 0.752896 0.501158 +vt 0.752896 0.502703 +vt 0.752896 0.508880 +vt 0.752896 0.516602 +vt 0.752896 0.524324 +vt 0.752896 0.525869 +vt 0.752896 0.532046 +vt 0.752896 0.539768 +vt 0.752896 0.547490 +vt 0.745174 0.548263 +vt 0.752896 0.493436 +vt 0.795367 0.501930 +vt 0.787645 0.494208 +vt 0.795367 0.486486 +vt 0.777992 0.486486 +vt 0.768340 0.496139 +vt 0.777992 0.505791 +vt 0.752896 0.548263 +vt 0.752896 0.510425 +vt 0.752896 0.518147 +vt 0.752896 0.533591 +vt 0.752896 0.541313 +vt 0.752896 0.487259 +vt 0.803089 0.494208 +vt 0.800827 0.499669 +vt 0.789907 0.499669 +vt 0.789907 0.488748 +vt 0.800827 0.488748 +vt 0.784818 0.502964 +vt 0.787645 0.496139 +vt 0.784818 0.489314 +vt 0.771167 0.489314 +vt 0.771167 0.502964 +vn 0.9970 -0.0077 0.0770 +vn 0.6969 -0.7148 0.0581 +vn 0.9999 -0.0147 -0.0036 +vn -0.0139 -0.9860 0.1662 +vn -0.7172 -0.6940 0.0633 +vn -0.0143 -0.9962 0.0859 +vn -0.9962 0.0216 0.0842 +vn -0.6969 0.7148 -0.0581 +vn -0.9999 0.0147 0.0036 +vn 0.0147 0.9999 -0.0050 +vn 0.7172 0.6940 -0.0633 +vn 0.0143 0.9962 -0.0859 +vn 0.6950 -0.7055 0.1385 +vn -0.7144 -0.6848 0.1437 +vn -0.6942 0.7194 0.0226 +vn 0.7152 0.6987 0.0175 +vn 0.6665 -0.6564 0.3534 +vn -0.6829 -0.6366 0.3583 +vn -0.6635 0.7078 0.2425 +vn 0.6858 0.6879 0.2376 +vn 0.9556 0.0116 0.2945 +vn -0.9527 0.0397 0.3014 +vn 0.0151 0.9763 0.2160 +vn 0.0049 0.0858 0.9963 +vn -0.0122 -0.9250 0.3799 +vn -0.7115 -0.6789 0.1811 +vn -0.6914 0.7199 0.0605 +vn 0.7127 0.6993 0.0554 +vn 0.9934 -0.0044 0.1147 +vn -0.0137 -0.9790 0.2035 +vn -0.9922 0.0248 0.1219 +vn 0.0148 0.9993 0.0330 +vn 0.6925 -0.6996 0.1760 +vn -0.6907 0.7199 0.0678 +vn 0.7121 0.6993 0.0627 +vn 0.9925 -0.0038 0.1219 +vn -0.0136 -0.9775 0.2107 +vn -0.9913 0.0254 0.1291 +vn 0.0148 0.9991 0.0403 +vn 0.6920 -0.6983 0.1832 +vn -0.7108 -0.6777 0.1883 +vn -0.0049 -0.0858 -0.9963 +usemtl None +s 1 +f 707/1326/323 708/1327/324 709/1328/325 +f 710/1329/326 711/1330/327 712/1331/328 +f 713/1332/329 714/1333/330 715/1334/331 +f 716/1335/332 717/1336/333 718/1337/334 +f 719/1338/335 712/1339/328 708/1327/324 +f 720/1340/336 715/1334/331 711/1330/327 +f 721/1341/337 718/1337/334 714/1333/330 +f 722/1342/338 709/1328/325 717/1336/333 +f 723/1343/339 710/1344/326 719/1338/335 +f 724/1345/340 713/1332/329 720/1340/336 +f 725/1346/341 716/1335/332 721/1341/337 +f 726/1347/342 707/1326/323 722/1342/338 +f 727/1348/343 719/1338/335 707/1326/323 +f 710/1329/326 724/1345/340 720/1340/336 +f 728/1349/344 721/1341/337 713/1332/329 +f 729/1350/345 722/1342/338 716/1335/332 +f 723/1343/339 727/1348/343 730/1351/346 +f 726/1347/342 729/1350/345 730/1352/346 +f 729/1350/345 725/1346/341 730/1353/346 +f 728/1349/344 724/1345/340 730/1354/346 +f 731/1355/347 723/1343/339 730/1356/346 +f 727/1348/343 726/1347/342 730/1357/346 +f 725/1346/341 728/1349/344 730/1358/346 +f 724/1345/340 731/1359/347 730/1360/346 +f 732/1361/348 733/1362/331 734/1363/327 +f 735/1364/349 736/1365/334 737/1366/330 +f 738/1367/350 739/1368/325 740/1369/333 +f 741/1370/351 742/1371/324 739/1368/325 +f 743/1372/352 734/1363/327 744/1373/328 +f 745/1374/353 737/1366/330 733/1362/331 +f 746/1375/354 740/1369/333 736/1365/334 +f 747/1376/355 744/1377/328 742/1371/324 +f 748/1378/334 749/1379/356 750/1380/330 +f 751/1381/325 752/1382/357 753/1383/333 +f 754/1384/324 755/1385/358 751/1381/325 +f 756/1386/327 757/1387/359 758/1388/328 +f 750/1380/330 759/1389/360 760/1390/331 +f 753/1383/333 761/1391/361 748/1378/334 +f 758/1392/328 762/1393/362 754/1384/324 +f 760/1390/331 763/1394/363 756/1386/327 +f 745/1374/353 763/1395/363 759/1396/360 +f 735/1364/349 759/1397/360 749/1398/356 +f 735/1364/349 761/1399/361 746/1375/354 +f 746/1375/354 752/1400/357 738/1367/350 +f 741/1370/351 752/1401/357 755/1402/358 +f 741/1370/351 762/1403/362 747/1376/355 +f 747/1376/355 757/1404/359 743/1405/352 +f 743/1372/352 763/1406/363 732/1361/348 +f 748/1407/346 760/1408/346 758/1409/346 +f 744/1410/364 733/1411/364 736/1412/364 +f 707/1326/323 719/1338/335 708/1327/324 +f 710/1329/326 720/1340/336 711/1330/327 +f 713/1332/329 721/1341/337 714/1333/330 +f 716/1335/332 722/1342/338 717/1336/333 +f 719/1338/335 710/1344/326 712/1339/328 +f 720/1340/336 713/1332/329 715/1334/331 +f 721/1341/337 716/1335/332 718/1337/334 +f 722/1342/338 707/1326/323 709/1328/325 +f 723/1343/339 731/1355/347 710/1344/326 +f 724/1345/340 728/1349/344 713/1332/329 +f 725/1346/341 729/1350/345 716/1335/332 +f 726/1347/342 727/1348/343 707/1326/323 +f 727/1348/343 723/1343/339 719/1338/335 +f 710/1329/326 731/1359/347 724/1345/340 +f 728/1349/344 725/1346/341 721/1341/337 +f 729/1350/345 726/1347/342 722/1342/338 +f 732/1361/348 745/1374/353 733/1362/331 +f 735/1364/349 746/1375/354 736/1365/334 +f 738/1367/350 741/1370/351 739/1368/325 +f 741/1370/351 747/1376/355 742/1371/324 +f 743/1372/352 732/1361/348 734/1363/327 +f 745/1374/353 735/1364/349 737/1366/330 +f 746/1375/354 738/1367/350 740/1369/333 +f 747/1376/355 743/1405/352 744/1377/328 +f 748/1378/334 761/1391/361 749/1379/356 +f 751/1381/325 755/1385/358 752/1382/357 +f 754/1384/324 762/1393/362 755/1385/358 +f 756/1386/327 763/1394/363 757/1387/359 +f 750/1380/330 749/1379/356 759/1389/360 +f 753/1383/333 752/1382/357 761/1391/361 +f 758/1392/328 757/1413/359 762/1393/362 +f 760/1390/331 759/1389/360 763/1394/363 +f 745/1374/353 732/1361/348 763/1395/363 +f 735/1364/349 745/1374/353 759/1397/360 +f 735/1364/349 749/1414/356 761/1399/361 +f 746/1375/354 761/1415/361 752/1400/357 +f 741/1370/351 738/1367/350 752/1401/357 +f 741/1370/351 755/1416/358 762/1403/362 +f 747/1376/355 762/1417/362 757/1404/359 +f 743/1372/352 757/1418/359 763/1406/363 +f 751/1419/346 753/1420/346 748/1407/346 +f 748/1407/346 750/1421/346 760/1408/346 +f 760/1408/346 756/1422/346 758/1409/346 +f 758/1409/346 754/1423/346 751/1419/346 +f 751/1419/346 748/1407/346 758/1409/346 +f 736/1412/364 740/1424/364 739/1425/364 +f 739/1425/364 742/1426/364 744/1410/364 +f 744/1410/364 734/1427/364 733/1411/364 +f 733/1411/364 737/1428/364 736/1412/364 +f 736/1412/364 739/1425/364 744/1410/364 o Rifle -v 2.000000 0.470320 0.154680 -v -6.625000 -0.343750 -0.343750 -v 2.000000 0.470320 -0.154680 -v -6.625000 -0.093750 0.468750 -v -6.625000 -0.468750 -0.093750 -v -6.625000 -0.468750 0.093750 -v -6.250000 0.470320 -0.154680 -v -6.250000 0.470320 0.154680 -v -6.250000 0.625000 0.218750 -v -6.250000 0.779680 0.154680 -v -6.250000 0.843750 0.000000 -v -6.250000 0.779680 -0.154680 -v -6.250000 0.625000 -0.218750 -v 2.000000 -0.468750 0.093750 -v 2.000000 -0.468750 -0.093750 -v 2.000000 -0.093750 0.468750 -v 2.000000 0.093750 0.468750 -v 2.000000 -0.343750 0.343750 -v 2.000000 -0.343750 -0.343750 -v 2.000000 -0.093750 -0.468750 -v 2.000000 0.093750 -0.468750 -v -6.625000 -0.343750 0.343750 -v -6.625000 0.093750 0.468750 -v 2.000000 0.343750 0.343750 -v 2.000000 0.343750 -0.343750 -v -6.625000 0.093750 -0.468750 -v -6.625000 -0.093750 -0.468750 -v -6.250000 0.343750 0.343750 -v -6.250000 0.343750 -0.343750 -v 0.125000 -0.093750 0.468750 -v 0.187500 -0.031250 0.468750 -v 0.125000 0.156250 0.437500 -v 0.187500 0.093750 0.468750 -v -6.187500 -0.093750 0.468750 -v -6.187500 0.156250 0.437500 -v -6.250000 -0.031250 0.468750 -v -6.250000 0.093750 0.468750 -v 0.125000 -0.093750 0.406250 -v 0.187500 -0.031250 0.406250 -v 0.125000 0.156250 0.406250 -v 0.187500 0.093750 0.406250 -v -6.187500 -0.093750 0.406250 -v -6.187500 0.156250 0.406250 -v -6.250000 -0.031250 0.406250 -v -6.250000 0.093750 0.406250 -v 0.125000 0.218750 0.406250 -v 0.125000 0.343750 0.343750 -v 0.125000 0.470320 0.154680 -v 0.125000 0.625000 0.218750 -v -1.750000 0.218750 0.406250 -v -1.750000 0.343750 0.343750 -v -1.750000 0.470320 0.154680 -v -1.750000 0.625000 0.218750 -v 5.375000 0.625000 -0.156250 -v 5.375000 0.735485 -0.110486 -v 6.000000 0.781250 0.000000 -v 6.000000 0.735485 0.110486 -v 6.000000 0.625000 0.156250 -v 6.000000 0.514515 0.110486 -v 6.000000 0.468750 0.000000 -v 6.000000 0.514515 -0.110485 -v 9.250000 0.470320 -0.154680 -v 9.250000 0.470320 0.154680 -v 9.250000 0.625000 0.218750 -v 9.250000 0.779680 0.154680 -v 9.250000 0.843750 0.000000 -v 9.250000 0.779680 -0.154680 -v 9.250000 0.625000 -0.218750 +v -0.375000 -0.656250 0.375000 v 0.375000 -0.281250 0.375000 +v -0.375000 -0.281250 0.375000 +v 0.375000 -0.281250 -1.750000 v 0.375000 -0.656250 0.375000 -v 0.375000 -0.281250 -0.375000 -v 0.375000 -0.656250 -0.375000 -v -1.750000 -0.281250 -0.375000 -v -1.500000 -1.343750 -0.375000 -v -1.500000 -1.343750 0.375000 -v -1.750000 -0.281250 0.375000 -v -4.250000 -1.343750 0.343750 -v -1.750000 -1.343750 0.343750 -v -4.250000 -1.343750 -0.343750 -v -1.750000 -1.343750 -0.343750 -v -4.437500 -1.218750 0.343750 -v -4.382583 -1.307138 0.343750 -v -4.437500 -1.031250 0.343750 -v -4.750000 -0.718750 0.343750 -v -4.479367 -0.875000 0.343750 -v -4.593750 -0.760617 0.343750 -v -6.625000 -0.718750 0.343750 -v -4.437500 -1.218750 -0.343750 -v -4.382583 -1.307138 -0.343750 -v -4.437500 -1.031250 -0.343750 -v -4.750000 -0.718750 -0.343750 -v -4.479367 -0.875000 -0.343750 -v -4.593750 -0.760617 -0.343750 -v -6.625000 -0.718750 -0.343750 -v -1.937500 -0.343750 0.343750 -v -1.750000 -1.031253 0.343750 -v -1.639515 -1.297988 0.343750 -v -1.593750 -1.187503 0.343750 -v -1.639515 -1.077017 0.343750 -v -1.937500 -0.906253 0.343750 -v -1.937500 -0.343750 -0.343750 -v -1.750000 -1.031253 -0.343750 -v -1.639515 -1.297988 -0.343750 -v -1.593750 -1.187503 -0.343750 -v -1.639515 -1.077017 -0.343750 -v -1.937500 -0.906253 -0.343750 -v -1.750000 -1.343750 0.281250 -v -1.500000 -1.343750 0.281250 -v -1.750000 -1.343750 -0.281250 -v -1.500000 -1.343750 -0.281250 -v -1.727942 -0.375001 -0.281250 -v -1.727942 -0.375001 0.281250 -v -1.937500 -0.375001 -0.281250 -v -1.937500 -0.375001 0.281250 -v -1.937500 -0.906250 -0.281250 -v -1.937500 -0.906250 0.281250 -v -1.750000 -1.093751 0.343750 -v -1.816291 -1.121210 0.343750 -v -1.843750 -1.187501 0.343750 -v -1.816291 -1.253792 0.343750 -v -1.750000 -1.281251 0.343750 -v -1.683709 -1.253792 0.343750 -v -1.656250 -1.187501 0.343750 -v -1.683709 -1.121210 0.343750 -v -1.750000 -1.093751 0.375000 -v -1.816291 -1.121210 0.375000 -v -1.843750 -1.187501 0.375000 -v -1.816291 -1.253792 0.375000 -v -1.750000 -1.281251 0.375000 -v -1.683709 -1.253792 0.375000 -v -1.656250 -1.187501 0.375000 -v -1.683709 -1.121210 0.375000 -v -1.750000 -0.593753 -0.281250 -v -1.860485 -0.639518 -0.281250 -v -1.906250 -0.750003 -0.281250 -v -1.860485 -0.860489 -0.281250 -v -1.750000 -0.906253 -0.281250 -v -1.125000 -0.593753 -0.281250 -v -1.125000 -0.906253 -0.281250 -v -1.125000 -0.593753 -0.468750 -v -1.125000 -0.906253 -0.468750 -v -1.716910 -0.593753 -0.468750 -v -1.643382 -0.906253 -0.468750 -v -1.716911 -0.593753 -0.343750 -v -1.643382 -0.906253 -0.343750 -v -1.750000 -0.593753 -0.343750 -v -1.860485 -0.639518 -0.343750 -v -1.906250 -0.750003 -0.343750 -v -1.860485 -0.860489 -0.343750 -v -1.750000 -0.906253 -0.343750 -v 0.125000 0.218750 0.343750 -v 0.125000 0.625000 -0.156250 -v 0.125000 0.468750 -0.093750 -v 0.125000 0.343750 -0.281250 -v 0.125000 0.218750 -0.343750 -v 0.125000 0.093750 0.218750 -v 0.125000 0.093750 -0.218750 -v 0.125000 0.218750 0.093750 -v 0.125000 0.218750 -0.093750 -v 0.750000 0.093750 0.218750 -v 0.750000 0.093750 -0.218750 -v 0.750000 -0.093750 0.218750 -v 0.750000 -0.093750 -0.218750 -v 0.750000 -0.218750 0.093750 -v 0.750000 -0.218750 -0.093750 -v 0.750000 0.218750 0.093750 -v 0.750000 0.218750 -0.093750 -v -1.750000 0.218750 0.343750 -v -1.750000 0.343750 0.281250 -v -1.750000 0.468750 0.093750 -v -1.750000 0.625000 0.156250 -v -6.250000 0.218750 0.343750 -v -6.250000 0.343750 0.281250 -v -6.250000 0.468750 0.093750 -v -6.250000 0.625000 0.156250 -v -6.250000 0.625000 -0.156250 -v -6.250000 0.468750 -0.093750 -v -6.250000 0.343750 -0.281250 -v -6.250000 0.218750 -0.343750 -v -6.250000 0.093750 -0.218750 -v -6.250000 -0.093750 0.218750 -v -6.250000 -0.093750 -0.218750 -v -6.250000 -0.218750 0.093750 -v -6.250000 -0.218750 -0.093750 -v -6.250000 0.093750 0.218750 -v 5.375000 0.647097 -0.209597 -v 5.375000 0.757582 -0.163832 -v 1.875000 0.647097 -0.209597 -v 1.875000 0.779680 -0.154680 -v 2.062500 0.757582 -0.163832 -v 2.062500 0.779680 -0.154680 -v 2.062500 0.834597 -0.022097 -v 1.875000 0.834597 -0.022097 -v 1.875000 0.625000 -0.156250 -v 1.875000 0.781250 0.000000 -v 1.812500 0.735485 0.110486 -v 1.812500 0.625000 0.156250 -v 1.812500 0.514515 0.110486 -v 1.812500 0.468750 0.000000 -v 1.812500 0.514515 -0.110485 -v 2.062500 0.781250 0.000000 -v 2.062500 0.735485 -0.110486 -v 6.000000 0.625000 -0.156250 -v 6.000000 0.735485 -0.110486 -v 1.875000 0.735485 -0.110486 -v 1.812500 0.625000 -0.156250 -v 1.812500 0.781250 0.000000 -v 1.812500 0.735485 -0.110486 -v 9.250000 0.406250 0.000000 -v 9.125000 0.000000 -0.218750 -v 9.125000 0.154680 -0.154680 -v 9.125000 0.218750 0.000000 -v 9.125000 0.154680 0.154680 -v 9.125000 -0.000000 0.218750 -v 9.125000 -0.154680 0.154680 -v 9.125000 -0.218750 0.000000 -v 9.125000 -0.154680 -0.154680 -v 9.437500 0.000000 -0.218750 -v 9.437500 0.154680 -0.154680 -v 9.437500 0.218750 0.000000 -v 9.437500 0.154680 0.154680 -v 9.437500 -0.000000 0.218750 -v 9.437500 -0.154680 0.154680 -v 9.437500 -0.218750 0.000000 -v 9.437500 -0.154680 -0.154680 -v 9.500000 0.000000 -0.187500 -v 9.500000 0.132583 -0.132582 -v 9.500000 0.187500 0.000000 -v 9.500000 0.132583 0.132582 -v 9.500000 -0.000000 0.187500 -v 9.500000 -0.132583 0.132582 -v 9.500000 -0.187500 0.000000 -v 9.500000 -0.132583 -0.132582 -v 11.250000 0.000000 -0.187500 -v 11.250000 0.132583 -0.132582 -v 11.250000 0.187500 0.000000 -v 11.250000 0.132583 0.132582 -v 11.250000 -0.000000 0.187500 -v 11.250000 -0.132583 0.132582 -v 11.250000 -0.187500 0.000000 -v 11.250000 -0.132583 -0.132582 -v 9.125000 0.625000 -0.281250 -v 9.125000 0.823874 -0.198874 -v 9.125000 0.823874 0.198874 -v 9.125000 0.625000 0.281250 -v 9.125000 0.426126 0.198874 -v 8.750000 0.198874 0.198874 -v 9.125000 0.426126 -0.198874 -v 8.750000 0.625000 -0.281250 -v 8.750000 0.823874 -0.198874 -v 8.750000 0.823874 0.198874 -v 8.750000 0.625000 0.281250 -v 8.750000 0.426126 0.198874 -v 8.750000 0.198874 -0.198874 -v 8.750000 0.426126 -0.198874 -v 9.125000 0.000000 -0.281250 -v 9.125000 0.198874 -0.198874 -v 8.750000 -0.000000 -0.281250 -v 9.125000 0.198874 0.198874 -v 9.125000 -0.000000 0.281250 -v 9.125000 -0.198874 0.198874 -v 9.125000 -0.281250 0.000000 -v 9.125000 -0.198874 -0.198874 -v 8.750000 -0.000000 0.281250 -v 8.750000 -0.198874 0.198874 -v 8.750000 -0.281250 0.000000 -v 8.750000 -0.198874 -0.198874 -v 0.125000 -0.093750 -0.468750 -v 0.187500 -0.031250 -0.468750 -v 0.187500 0.093750 -0.468750 -v -6.187500 -0.093750 -0.468750 -v -6.250000 -0.031250 -0.468750 -v -6.250000 0.093750 -0.468750 -v -6.187500 0.156250 -0.437500 -v 0.125000 0.156250 -0.437500 -v 0.125000 -0.093750 -0.406250 -v -6.187500 -0.093750 -0.406250 -v -6.250000 -0.031250 -0.406250 -v -6.250000 0.093750 -0.406250 -v -6.187500 0.156250 -0.406250 -v 0.125000 0.156250 -0.406250 -v 0.187500 -0.031250 -0.406250 -v 0.187500 0.093750 -0.406250 -v -1.750000 -0.718750 0.281250 -v -1.838388 -0.755362 0.281250 -v -1.875000 -0.843750 0.281250 -v -1.838388 -0.932138 0.281250 -v -1.750000 -0.968750 0.281250 -v -1.661612 -0.932138 0.281250 -v -1.625000 -0.843750 0.281250 -v -1.661612 -0.755362 0.281250 -v -1.750000 -0.718750 0.343750 -v -1.838388 -0.755362 0.343750 -v -1.875000 -0.843750 0.343750 -v -1.838388 -0.932138 0.343750 -v -1.750000 -0.968750 0.343750 -v -1.661612 -0.932138 0.343750 -v -1.625000 -0.843750 0.343750 -v -1.661612 -0.755362 0.343750 -v 0.250000 -0.093750 -0.218750 -v 0.250000 -0.281250 -0.218750 -v 0.250000 -0.281250 0.218750 -v 0.250000 -0.093750 0.218750 -v 0.250000 -0.218750 0.093750 -v 0.250000 -0.218750 -0.093750 -v -1.437500 -0.093750 -0.218750 -v -1.437500 -0.281250 -0.218750 -v -1.437500 -0.281250 0.218750 -v -1.437500 -0.093750 0.218750 -v -1.437500 -0.218750 0.093750 -v -1.437500 -0.218750 -0.093750 -v 8.750000 0.097057 -0.362222 -v 8.750000 0.265165 -0.265165 -v 8.750000 0.265165 0.265165 -v 8.750000 0.097057 0.362222 -v 8.750000 -0.097057 0.362222 -v 8.750000 -0.265165 0.265165 -v 8.750000 -0.362222 0.097057 -v 8.750000 -0.362222 -0.097057 -v 8.750000 -0.265165 -0.265165 -v 8.750000 -0.097057 -0.362222 -v 8.750000 0.470320 -0.250000 -v 8.750000 0.470320 0.250000 -v -6.625000 0.343750 0.343750 -v -6.625000 0.343750 -0.343750 -v -3.562500 -1.343750 -0.312500 -v -4.000000 -1.968750 -0.312500 -v -4.125000 -2.093750 -0.125000 -v -4.187500 -2.218750 -0.125000 -v -4.187500 -2.406250 -0.125000 -v -4.375000 -2.593750 -0.125000 -v -4.437500 -2.718750 -0.125000 -v -4.437500 -2.906250 -0.125000 -v -4.625000 -3.093750 -0.125000 -v -4.687500 -3.218750 -0.125000 -v -4.687500 -3.531250 -0.125000 -v -5.750000 -2.968750 -0.125000 -v -5.437500 -2.343750 -0.125000 -v -5.062500 -1.906249 -0.125000 -v -4.812500 -1.656250 -0.125000 -v -4.812500 -1.343750 -0.312500 -v -4.937500 -1.093749 -0.312500 -v -5.187500 -0.906249 -0.312500 -v -5.187500 -0.718750 -0.312500 -v -3.562500 -0.718750 -0.312500 -v -3.562500 -1.343750 0.312500 -v -4.000000 -1.968750 0.312500 -v -4.125000 -2.093750 0.125000 -v -4.187500 -2.218750 0.125000 -v -4.187500 -2.406250 0.125000 -v -4.375000 -2.593750 0.125000 -v -4.437500 -2.718750 0.125000 -v -4.437500 -2.906250 0.125000 -v -4.625000 -3.093750 0.125000 -v -4.687500 -3.218750 0.125000 -v -4.687500 -3.531250 0.125000 -v -5.750000 -2.968750 0.125000 -v -5.437500 -2.343750 0.125000 -v -5.062500 -1.906249 0.125000 -v -4.812500 -1.656250 0.125000 -v -4.812500 -1.343750 0.312500 -v -4.937500 -1.093749 0.312500 -v -5.187500 -0.906249 0.312500 -v -5.187500 -0.718750 0.312500 -v -3.562500 -0.718750 0.312500 -v -4.187500 -2.031250 -0.312500 -v -4.250000 -2.156250 -0.312500 -v -4.250000 -2.406250 -0.312500 -v -4.437500 -2.531250 -0.312500 -v -4.500000 -2.656250 -0.312500 -v -4.500000 -2.906250 -0.312500 -v -4.687500 -3.031250 -0.312500 -v -4.750000 -3.156250 -0.312500 -v -5.562500 -2.968750 -0.312500 -v -5.250000 -2.343750 -0.312500 -v -4.937500 -1.906250 -0.312500 -v -4.750000 -1.656250 -0.312500 -v -4.750000 -3.406250 -0.312500 -v -4.187500 -2.031250 0.312500 -v -4.250000 -2.156250 0.312500 -v -4.250000 -2.406250 0.312500 -v -4.437500 -2.531250 0.312500 -v -4.500000 -2.656250 0.312500 -v -4.500000 -2.906250 0.312500 -v -4.687500 -3.031250 0.312500 -v -4.750000 -3.156250 0.312500 -v -5.562500 -2.968750 0.312500 -v -5.250000 -2.343750 0.312500 -v -4.937500 -1.906250 0.312500 -v -4.750000 -1.656250 0.312500 -v -4.750000 -3.406250 0.312500 -v -2.312500 -1.343750 -0.187500 -v -2.312500 -1.906250 -0.187500 -v -2.375000 -2.093750 -0.187500 -v -2.500000 -2.218750 -0.187500 -v -2.687500 -2.281250 -0.187500 -v -3.437500 -2.281250 -0.187500 -v -4.000000 -1.906250 -0.187500 -v -2.312500 -1.343750 0.187500 -v -2.312500 -1.906250 0.187500 -v -2.375000 -2.093750 0.187500 -v -2.500000 -2.218750 0.187500 -v -2.687500 -2.281250 0.187500 -v -3.437500 -2.281250 0.187500 -v -4.000000 -1.906250 0.187500 -v -2.375000 -1.343750 -0.187500 -v -2.375000 -1.906250 -0.187500 -v -2.437500 -2.093750 -0.187500 -v -2.500000 -2.156250 -0.187500 -v -2.687500 -2.218750 -0.187500 -v -3.437500 -2.218750 -0.187500 -v -4.000000 -1.843750 -0.187500 -v -2.500000 -2.156250 0.187500 -v -2.687500 -2.218750 0.187500 -v -3.437500 -2.218750 0.187500 -v -4.000000 -1.843750 0.187500 -v -2.437500 -2.093750 0.187500 -v -2.375000 -1.906250 0.187500 -v -2.375000 -1.343750 0.187500 -v -6.625000 0.735485 -0.154680 -v -6.625000 0.781250 0.000000 -v -6.625000 0.735485 0.154680 -v 9.125000 1.187500 -0.281250 -v 9.125000 1.386374 -0.198874 -v 9.125000 1.468750 0.000000 -v 9.125000 1.386374 0.198874 -v 9.125000 1.187500 0.281250 -v 9.125000 0.988626 0.198874 -v 9.125000 0.988626 -0.198874 -v 9.125000 0.970971 -0.156250 -v 9.125000 0.841529 -0.156250 -v 9.125000 0.841529 0.156250 -v 9.125000 0.970971 0.156250 -v 8.750000 0.841529 0.156250 -v 8.750000 0.841529 -0.156250 -v 8.750000 1.187500 -0.281250 -v 8.750000 1.386374 -0.198874 -v 8.750000 1.468750 0.000000 -v 8.750000 1.386374 0.198874 -v 8.750000 1.187500 0.281250 -v 8.750000 0.988626 0.198874 -v 8.750000 0.988626 -0.198874 -v 8.750000 0.970971 -0.156250 -v 8.750000 0.970971 0.156250 -v 9.125000 1.187500 -0.218750 -v 9.125000 1.342180 -0.154680 -v 9.125000 1.406250 0.000000 -v 9.125000 1.342180 0.154680 -v 9.125000 1.187500 0.218750 -v 9.125000 1.032820 0.154680 -v 9.125000 0.968750 -0.000000 -v 9.125000 1.032820 -0.154680 -v 8.750000 1.187500 -0.218750 -v 8.750000 1.342180 -0.154680 -v 8.750000 1.406250 0.000000 -v 8.750000 1.342180 0.154680 -v 8.750000 1.187500 0.218750 -v 8.750000 1.032820 0.154680 -v 8.750000 0.968750 -0.000000 -v 8.750000 1.032820 -0.154680 -v 9.000000 1.187500 0.031250 -v 9.000000 1.031250 0.031250 -v 9.000000 1.187500 -0.031250 -v 9.000000 1.031250 -0.031250 -v 8.937500 1.187500 0.031250 -v 8.937500 1.187500 -0.031250 -v 9.000000 0.968750 0.093750 -v 9.000000 0.968750 -0.093750 -v 8.937500 1.031250 0.031250 -v 8.937500 1.031250 -0.031250 -v 8.937500 0.968750 -0.093750 -v 8.937500 0.968750 0.093750 -v -5.312500 1.187500 -0.156250 -v -5.437500 0.875000 0.156250 -v -5.437500 0.875000 -0.156250 -v -5.187500 1.187500 0.156250 -v -5.062500 0.875000 0.156250 -v -5.062500 0.875000 -0.156250 -v -5.187500 1.187500 -0.156250 -v -5.312500 1.187500 0.156250 -v -5.437500 0.750000 0.156250 -v -5.437500 0.750000 -0.156250 -v -5.062500 0.750000 0.156250 -v -5.062500 0.750000 -0.156250 -v -5.250000 1.250000 -0.156250 -v -5.294194 1.231694 -0.156250 -v -5.294194 1.231694 -0.125000 -v -5.250000 1.250000 -0.125000 -v -5.205806 1.231694 0.156250 -v -5.294194 1.231694 0.156250 -v -5.250000 1.250000 0.156250 -v -5.205806 1.231694 -0.156250 -v -5.205806 1.231694 -0.125000 -v -5.205806 1.231694 0.125000 -v -5.294194 1.231694 0.125000 -v -5.250000 1.250000 0.125000 -v -5.312500 1.187500 -0.125000 -v -5.187500 1.187500 -0.125000 -v -5.312500 1.187500 0.125000 -v -5.187500 1.187500 0.125000 -v -5.437500 0.875000 -0.125000 -v -5.437500 0.875000 0.125000 -v -5.062500 0.875000 0.125000 -v -5.062500 0.875000 -0.125000 -v -5.281250 1.187500 0.062500 -v -5.218750 1.187500 0.062500 -v -5.281250 1.187500 -0.062500 -v -5.218750 1.187500 -0.062500 -v -5.218750 1.250000 -0.062500 -v -5.281250 1.250000 -0.062500 -v -5.218750 1.250000 0.062500 -v -5.281250 1.250000 0.062500 -v -5.281250 1.250000 -0.125000 -v -5.218750 1.250000 -0.125000 -v -5.218750 1.250000 0.125000 -v -5.281250 1.250000 0.125000 -v -5.281250 1.125000 0.000000 -v -5.218750 1.125000 0.000000 -v -5.281250 0.875000 -0.125000 -v -5.281250 0.875000 0.125000 -v -5.281250 0.937500 -0.031250 -v -5.281250 0.959597 -0.022097 -v -5.281250 0.968750 0.000000 -v -5.281250 0.959597 0.022097 -v -5.281250 0.937500 0.031250 -v -5.281250 0.915403 0.022097 -v -5.281250 0.906250 -0.000000 -v -5.281250 0.915403 -0.022097 -v -5.218750 0.937500 -0.031250 -v -5.218750 0.959597 -0.022097 -v -5.218750 0.968750 0.000000 -v -5.218750 0.959597 0.022097 -v -5.218750 0.937500 0.031250 -v -5.218750 0.915403 0.022097 -v -5.218750 0.906250 -0.000000 -v -5.218750 0.915403 -0.022097 -v -5.218750 1.062500 0.125000 -v -5.218750 1.062500 -0.125000 -v -5.156250 1.062500 0.125000 -v -5.156250 1.062500 -0.125000 -v -5.093750 1.062500 -0.062500 -v -5.093750 1.062500 0.062500 -v -5.093750 1.000000 -0.062500 -v -5.093750 1.000000 0.062500 -v -5.156250 1.000000 0.125000 -v -5.156250 1.000000 -0.125000 -v -5.218750 1.000000 0.125000 -v -5.218750 1.000000 -0.125000 -v -5.218750 0.875000 0.125000 -v -5.218750 0.875000 -0.125000 -v -5.062500 0.843750 -0.093750 -v -5.062500 0.843750 0.093750 -v -4.750000 0.843750 -0.093750 -v -4.750000 0.843750 0.093750 -v -4.750000 0.875000 -0.031250 -v -4.750000 0.875000 0.031250 -v -4.687500 0.843750 -0.093750 -v -4.687500 0.875000 -0.031250 -v -4.687500 0.843750 0.093750 -v -4.687500 0.875000 0.031250 -v -4.687500 0.781250 -0.093750 -v -4.687500 0.781250 0.093750 -v -5.062500 0.781250 -0.093750 -v -5.062500 0.781250 0.093750 -v 2.000000 0.406250 0.000000 -v -1.750000 -1.093751 -0.343750 -v -1.683709 -1.121210 -0.343750 -v -1.656250 -1.187501 -0.343750 -v -1.683709 -1.253792 -0.343750 -v -1.750000 -1.281251 -0.343750 -v -1.816291 -1.253792 -0.343750 -v -1.843750 -1.187501 -0.343750 -v -1.816291 -1.121210 -0.343750 -v -1.750000 -1.093751 -0.375000 -v -1.683709 -1.121210 -0.375000 -v -1.656250 -1.187501 -0.375000 -v -1.683709 -1.253792 -0.375000 -v -1.750000 -1.281251 -0.375000 -v -1.816291 -1.253792 -0.375000 -v -1.843750 -1.187501 -0.375000 -v -1.816291 -1.121210 -0.375000 +v 0.375000 -1.343750 -1.500000 +v -0.375000 -0.281250 -1.750000 +v -0.375000 -1.343750 -1.500000 +v 0.281250 -1.343750 -1.750000 +v -0.281250 -1.343750 -1.500000 +v -0.281250 -1.343750 -1.750000 +v -0.281250 -0.375001 -1.727942 +v -0.281250 -0.906250 -1.937500 +v 0.281250 -0.906250 -1.937500 +v 0.281250 -0.375001 -1.727942 +v 0.281250 -1.343750 -1.500000 +v 0.468750 -0.906253 -1.643382 +v 0.468750 -0.593753 -1.125000 +v 0.468750 -0.906253 -1.125000 +v 0.343750 -0.906253 -1.643382 +v 0.468750 -0.593753 -1.716910 +v 0.343750 -0.906253 -1.750000 +v 0.343750 -0.860489 -1.860485 +v 0.343750 -0.750003 -1.906250 +v 0.343750 -0.593753 -1.716911 +v 0.281250 -0.906253 -1.125000 +v 0.281250 -0.593753 -1.125000 +v -0.156250 0.625000 -1.750000 +v -0.218750 0.625000 0.125000 +v -0.218750 0.625000 -1.750000 +v 0.156250 0.625000 -6.250000 +v -0.156250 0.625000 -6.250000 +v 0.110486 0.735485 5.375000 +v 0.209597 0.647097 5.375000 +v 0.156250 0.625000 5.375000 +v -0.110486 0.735485 1.812500 +v -0.000000 0.781250 1.875000 +v -0.000000 0.781250 2.062500 +v 0.110486 0.735485 2.062500 +v 0.163832 0.757582 5.375000 +v 0.154680 0.779680 2.062500 +v 0.163832 0.757582 2.062500 +v 0.022097 0.834597 2.062500 +v 0.022097 0.834597 1.875000 +v 0.156250 0.625000 1.875000 +v -0.110486 0.514515 1.812500 +v -0.000000 0.468750 1.812500 +v 0.110485 0.514515 1.812500 +v 0.110486 0.735485 1.875000 +v 0.209597 0.647097 1.875000 +v 0.154680 0.779680 1.875000 +v -0.156250 0.625000 6.000000 +v -0.000000 0.781250 6.000000 +v 0.156250 0.625000 6.000000 +v 0.198874 0.426126 9.125000 +v -0.198874 0.198874 9.125000 +v 0.198874 0.198874 9.125000 +v 0.281250 0.000000 9.125000 +v -0.198874 -0.198874 9.125000 +v 0.218750 -0.281250 0.250000 +v 0.093750 -0.218750 0.250000 +v 0.218750 -0.093750 0.250000 +v -0.218750 -0.093750 0.250000 +v -0.093750 -0.218750 0.250000 +v -0.218750 -0.281250 0.250000 +v -0.218750 -0.281250 -1.437500 +v 0.218750 -0.281250 -1.437500 +v -0.218750 -0.093750 -1.437500 +v 0.218750 -0.093750 -1.437500 +v 0.093750 -0.218750 -1.437500 +v -0.093750 -0.218750 -1.437500 +v 0.187500 -1.906250 -2.375000 +v 0.187500 -1.343750 -2.312500 +v 0.187500 -1.906250 -2.312500 +v 0.187500 -2.093750 -2.375000 +v 0.187500 -2.156250 -2.500000 +v 0.187500 -2.218750 -2.500000 +v 0.187500 -2.218750 -2.687500 +v 0.187500 -2.281250 -2.687500 +v 0.187500 -2.218750 -3.437500 +v 0.187500 -2.281250 -3.437500 +v 0.187500 -1.906250 -4.000000 +v -0.187500 -2.218750 -3.437500 +v -0.187500 -1.906250 -4.000000 +v -0.187500 -2.281250 -3.437500 +v -0.187500 -2.218750 -2.687500 +v -0.187500 -2.281250 -2.687500 +v -0.187500 -2.218750 -2.500000 +v -0.187500 -2.156250 -2.500000 +v -0.187500 -2.093750 -2.375000 +v -0.187500 -2.093750 -2.437500 +v -0.187500 -1.906250 -2.375000 +v -0.187500 -1.906250 -2.312500 +v -0.187500 -1.343750 -2.312500 +v -0.187500 -1.343750 -2.375000 +v -0.031250 1.031250 9.000000 +v 0.031250 1.187500 9.000000 +v -0.031250 1.187500 9.000000 +v -0.031250 1.187500 8.937500 +v 0.093750 0.968750 9.000000 +v 0.031250 1.031250 9.000000 +v 0.031250 1.187500 8.937500 +v -0.031250 1.031250 8.937500 +v 0.031250 1.031250 8.937500 +v -0.093750 0.968750 8.937500 +v -0.093750 0.968750 9.000000 +v 0.093750 0.968750 8.937500 +v 0.156250 1.187500 -5.187500 +v 0.156250 0.875000 -5.437500 +v 0.156250 1.187500 -5.312500 +v -0.156250 1.187500 -5.187500 +v -0.156250 0.875000 -5.437500 +v -0.156250 0.875000 -5.062500 +v 0.156250 0.750000 -5.062500 +v 0.156250 0.875000 -5.062500 +v -0.156250 0.750000 -5.062500 +v 0.156250 1.231694 -5.294194 +v 0.156250 1.250000 -5.250000 +v -0.156250 1.250000 -5.250000 +v -0.156250 1.187500 -5.312500 +v -0.125000 1.187500 -5.312500 +v -0.125000 1.231694 -5.294194 +v -0.125000 1.250000 -5.250000 +v 0.125000 1.187500 -5.187500 +v 0.125000 1.231694 -5.205806 +v 0.125000 1.250000 -5.250000 +v -0.125000 1.187500 -5.187500 +v -0.125000 0.875000 -5.437500 +v 0.125000 1.187500 -5.312500 +v 0.125000 0.875000 -5.062500 +v 0.125000 0.875000 -5.437500 +v 0.156250 0.750000 -5.437500 +v -0.125000 0.875000 -5.062500 +v 0.125000 1.250000 -5.281250 +v 0.062500 1.250000 -5.218750 +v 0.125000 1.250000 -5.218750 +v -0.125000 1.250000 -5.281250 +v -0.062500 1.250000 -5.218750 +v -0.062500 1.250000 -5.281250 +v 0.062500 1.187500 -5.281250 +v 0.125000 0.875000 -5.281250 +v -0.062500 1.187500 -5.281250 +v 0.000000 1.125000 -5.281250 +v -0.125000 0.875000 -5.281250 +v 0.022097 0.915403 -5.281250 +v 0.031250 0.937500 -5.281250 +v -0.031250 0.937500 -5.281250 +v -0.022097 0.915403 -5.281250 +v 0.000000 0.906250 -5.281250 +v 0.000000 0.968750 -5.281250 +v 0.022097 0.959597 -5.281250 +v -0.022097 0.959597 -5.281250 +v -0.125000 1.062500 -5.218750 +v 0.125000 1.062500 -5.156250 +v 0.125000 1.062500 -5.218750 +v -0.062500 1.062500 -5.093750 +v -0.125000 1.062500 -5.156250 +v 0.062500 1.187500 -5.218750 +v -0.125000 1.250000 -5.218750 +v -0.062500 1.187500 -5.218750 +v 0.000000 1.125000 -5.218750 +v -0.125000 1.000000 -5.156250 +v 0.062500 1.000000 -5.093750 +v -0.062500 1.000000 -5.093750 +v 0.125000 1.000000 -5.218750 +v 0.125000 1.000000 -5.156250 +v 0.125000 0.875000 -5.218750 +v 0.000000 0.906250 -5.218750 +v -0.125000 0.875000 -5.218750 +v -0.125000 1.000000 -5.218750 +v 0.000000 0.968750 -5.218750 +v 0.022097 0.959597 -5.218750 +v 0.022097 0.915403 -5.218750 +v -0.022097 0.915403 -5.218750 +v -0.022097 0.959597 -5.218750 +v -0.031250 0.937500 -5.218750 +v 0.031250 0.937500 -5.218750 +v -0.093750 0.843750 -5.062500 +v 0.093750 0.843750 -4.750000 +v 0.093750 0.843750 -5.062500 +v -0.093750 0.843750 -4.750000 +v 0.031250 0.875000 -4.750000 +v -0.093750 0.781250 -4.687500 +v 0.093750 0.781250 -4.687500 +v 0.031250 0.875000 -4.687500 +v 0.093750 0.781250 -5.062500 +v -0.093750 0.843750 -4.687500 +v -0.281250 -0.375001 -1.937500 +v 0.281250 -0.375001 -1.937500 +v 0.343750 -0.639518 -1.860485 +v 0.343750 -0.593753 -1.750000 +v 0.281250 -0.593753 -1.750000 +v 0.281250 -0.906253 -1.750000 +v 0.156250 0.625000 0.125000 +v -0.110486 0.735485 6.000000 +v -0.000000 0.781250 1.812500 +v 0.156250 0.625000 1.812500 +v 0.110486 0.735485 1.812500 +v -0.156250 0.625000 1.812500 +v 0.110486 0.735485 6.000000 +v 0.110485 0.514515 6.000000 +v -0.000000 0.468750 6.000000 +v -0.110486 0.514515 6.000000 +v -0.198874 0.426126 9.125000 +v -0.281250 -0.000000 9.125000 +v -0.000000 -0.281250 9.125000 +v 0.198874 -0.198874 9.125000 +v 0.187500 -1.343750 -2.375000 +v 0.187500 -2.093750 -2.437500 +v 0.187500 -1.843750 -4.000000 +v -0.187500 -1.843750 -4.000000 +v -0.156250 0.750000 -5.437500 +v 0.156250 1.231694 -5.205806 +v -0.156250 1.231694 -5.205806 +v -0.156250 1.231694 -5.294194 +v -0.125000 1.231694 -5.205806 +v 0.125000 1.231694 -5.294194 +v 0.062500 1.250000 -5.281250 +v 0.062500 1.062500 -5.093750 +v -0.031250 0.875000 -4.750000 +v 0.093750 0.843750 -4.687500 +v -0.031250 0.875000 -4.687500 +v -0.093750 0.781250 -5.062500 +v -0.343750 -0.343750 2.000000 +v -0.093750 -0.468750 -6.625000 +v -0.093750 -0.468750 2.000000 +v 0.154680 0.470320 2.000000 +v 0.343750 0.343750 -6.250000 +v 0.154680 0.470320 -6.250000 +v 0.468750 -0.093750 0.125000 +v 0.468750 -0.031250 0.187500 +v 0.468750 -0.093750 2.000000 +v -0.468750 -0.093750 0.125000 +v -0.468750 -0.093750 -6.187500 +v -0.343750 -0.343750 -6.625000 +v 0.093750 -0.468750 -6.625000 +v 0.343750 -0.343750 2.000000 +v 0.093750 -0.468750 2.000000 +v 0.468750 -0.093750 -6.187500 +v 0.343750 -0.343750 -6.625000 +v 0.468750 0.093750 2.000000 +v 0.468750 0.093750 0.187500 +v -0.468750 -0.031250 0.187500 +v -0.468750 -0.093750 2.000000 +v -0.406250 -0.093750 -6.187500 +v -0.468750 0.093750 0.187500 +v -0.406250 -0.031250 0.187500 +v -0.437500 0.156250 -6.187500 +v -0.406250 0.093750 -6.250000 +v -0.406250 0.156250 -6.187500 +v -0.406250 0.156250 0.125000 +v -0.437500 0.156250 0.125000 +v -0.406250 0.093750 0.187500 +v -0.406250 -0.093750 0.125000 +v -0.406250 -0.031250 -6.250000 +v -0.468750 0.093750 -6.250000 +v -0.468750 -0.031250 -6.250000 +v -0.468750 0.093750 -6.625000 +v -0.468750 -0.093750 -6.625000 +v -0.343750 0.343750 2.000000 +v -0.154680 0.470320 0.125000 +v -0.343750 0.343750 0.125000 +v -0.343750 0.343750 -6.250000 +v -0.154680 0.470320 -1.750000 +v -0.154680 0.470320 -6.250000 +v -0.406250 0.218750 0.125000 +v -0.343750 0.343750 -1.750000 +v -0.406250 0.218750 -1.750000 +v -0.468750 0.093750 2.000000 +v 0.343750 -1.343750 -4.250000 +v -0.343750 -1.343750 -1.750000 +v -0.343750 -1.343750 -4.250000 +v 0.343750 -0.760617 -4.593750 +v -0.343750 -0.875000 -4.479367 +v -0.343750 -0.760617 -4.593750 +v 0.343750 -0.718750 -4.750000 +v -0.343750 -0.718750 -4.750000 +v 0.343750 -1.218750 -4.437500 +v -0.343750 -1.307138 -4.382583 +v -0.343750 -1.218750 -4.437500 +v 0.343750 -0.718750 -6.625000 +v -0.343750 -0.718750 -6.625000 +v 0.343750 -0.875000 -4.479367 +v -0.343750 -1.031250 -4.437500 +v 0.343750 -1.031250 -4.437500 +v 0.343750 -1.307138 -4.382583 +v -0.343750 -0.343750 -1.937500 +v 0.343750 -1.031253 -1.750000 +v -0.343750 -0.906253 -1.937500 +v -0.343750 -1.031253 -1.750000 +v 0.343750 -1.187503 -1.593750 +v -0.343750 -1.077017 -1.639515 +v -0.343750 -1.187503 -1.593750 +v 0.343750 -0.906253 -1.937500 +v 0.343750 -1.077017 -1.639515 +v 0.343750 -1.297988 -1.639515 +v -0.343750 -1.297988 -1.639515 +v 0.343750 -0.343750 -1.937500 +v 0.343750 -1.343750 -1.750000 +v -0.375000 -1.121210 -1.683709 +v -0.343750 -1.187501 -1.656250 +v -0.343750 -1.121210 -1.683709 +v -0.375000 -1.253792 -1.683709 +v -0.343750 -1.281251 -1.750000 +v -0.343750 -1.253792 -1.683709 +v -0.375000 -1.253792 -1.816291 +v -0.343750 -1.187501 -1.843750 +v -0.343750 -1.253792 -1.816291 +v -0.375000 -1.121210 -1.816291 +v -0.343750 -1.093751 -1.750000 +v -0.343750 -1.121210 -1.816291 +v -0.375000 -1.093751 -1.750000 +v -0.375000 -1.187501 -1.656250 +v -0.375000 -1.281251 -1.750000 +v -0.375000 -1.187501 -1.843750 +v 0.281250 -0.639518 -1.860485 +v 0.281250 -0.750003 -1.906250 +v 0.281250 -0.860489 -1.860485 +v 0.093750 0.468750 0.125000 +v 0.281250 0.343750 0.125000 +v 0.218750 0.093750 0.125000 +v 0.093750 0.218750 0.125000 +v 0.343750 0.218750 0.125000 +v -0.343750 0.218750 0.125000 +v -0.093750 0.218750 0.125000 +v -0.218750 0.093750 0.125000 +v -0.218750 0.093750 -6.250000 +v -0.343750 0.218750 -6.250000 +v -0.343750 0.218750 -1.750000 +v 0.093750 -0.218750 0.750000 +v -0.093750 -0.218750 0.750000 +v 0.093750 0.218750 0.750000 +v -0.218750 0.093750 0.750000 +v 0.218750 -0.093750 0.750000 +v 0.218750 0.093750 0.750000 +v -0.093750 0.218750 0.750000 +v -0.281250 0.343750 -1.750000 +v -0.093750 0.468750 -1.750000 +v -0.281250 0.343750 -6.250000 +v -0.093750 0.468750 -6.250000 +v 0.343750 0.218750 -6.250000 +v 0.093750 0.468750 -6.250000 +v 0.218750 0.093750 -6.250000 +v 0.281250 0.343750 -6.250000 +v 0.093750 -0.218750 -6.250000 +v -0.218750 -0.093750 -6.250000 +v -0.218750 0.625000 9.250000 +v -0.154680 0.779680 9.250000 +v 0.000000 0.843750 -6.250000 +v -0.000000 0.843750 9.250000 +v -0.154680 0.470320 2.000000 +v 0.218750 0.625000 9.250000 +v 0.154680 0.470320 9.250000 +v 0.154680 0.779680 9.250000 +v 0.218750 0.625000 -6.250000 +v 0.154680 0.779680 -6.250000 +v -0.154680 0.470320 9.250000 +v 0.154680 -0.154680 9.437500 +v -0.000000 -0.218750 9.125000 +v 0.154680 -0.154680 9.125000 +v -0.154680 -0.154680 9.437500 +v -0.218750 -0.000000 9.125000 +v -0.154680 -0.154680 9.125000 +v -0.154680 0.154680 9.437500 +v -0.000000 0.218750 9.125000 +v -0.154680 0.154680 9.125000 +v 0.154680 0.154680 9.437500 +v 0.218750 0.000000 9.125000 +v 0.154680 0.154680 9.125000 +v 0.218750 0.000000 9.437500 +v -0.000000 -0.218750 9.437500 +v -0.218750 -0.000000 9.437500 +v -0.000000 0.218750 9.437500 +v -0.132582 0.132583 9.500000 +v 0.132582 0.132583 9.500000 +v 0.187500 0.000000 9.500000 +v -0.000000 -0.187500 9.500000 +v -0.000000 0.187500 9.500000 +v 0.132582 -0.132583 9.500000 +v -0.187500 -0.000000 9.500000 +v 0.187500 0.000000 11.250000 +v -0.000000 -0.187500 11.250000 +v -0.132582 -0.132583 9.500000 +v -0.187500 -0.000000 11.250000 +v -0.000000 0.187500 11.250000 +v 0.132582 -0.132583 11.250000 +v -0.132582 -0.132583 11.250000 +v -0.132582 0.132583 11.250000 +v 0.132582 0.132583 11.250000 +v 0.281250 0.625000 8.750000 +v 0.281250 0.625000 9.125000 +v 0.198874 -0.198874 8.750000 +v -0.198874 0.823874 9.125000 +v -0.281250 0.625000 8.750000 +v -0.281250 0.625000 9.125000 +v -0.198874 0.198874 8.750000 +v -0.281250 -0.000000 8.750000 +v -0.198874 0.426126 8.750000 +v 0.198874 0.823874 8.750000 +v 0.198874 0.823874 9.125000 +v -0.198874 -0.198874 8.750000 +v 0.198874 0.198874 8.750000 +v 0.281250 0.000000 8.750000 +v -0.000000 -0.281250 8.750000 +v 0.198874 0.426126 8.750000 +v 0.468750 -0.031250 -6.250000 +v 0.468750 -0.093750 -6.625000 +v 0.468750 0.093750 -6.625000 +v 0.343750 0.343750 2.000000 +v 0.437500 0.156250 0.125000 +v 0.468750 0.093750 -6.250000 +v 0.406250 -0.031250 -6.250000 +v 0.406250 -0.093750 -6.187500 +v 0.406250 -0.093750 0.125000 +v 0.406250 0.156250 -6.187500 +v 0.437500 0.156250 -6.187500 +v 0.406250 0.093750 0.187500 +v 0.406250 -0.031250 0.187500 +v 0.406250 0.156250 0.125000 +v 0.406250 0.093750 -6.250000 +v -0.343750 -0.755362 -1.661612 +v -0.281250 -0.843750 -1.625000 +v -0.281250 -0.755362 -1.661612 +v -0.343750 -0.932138 -1.661612 +v -0.281250 -0.968750 -1.750000 +v -0.281250 -0.932138 -1.661612 +v -0.343750 -0.932138 -1.838388 +v -0.281250 -0.843750 -1.875000 +v -0.281250 -0.932138 -1.838388 +v -0.343750 -0.755362 -1.838388 +v -0.281250 -0.718750 -1.750000 +v -0.281250 -0.755362 -1.838388 +v -0.343750 -0.718750 -1.750000 +v -0.343750 -0.843750 -1.625000 +v -0.343750 -0.968750 -1.750000 +v -0.343750 -0.843750 -1.875000 +v -0.218750 -0.093750 0.750000 +v -0.093750 -0.218750 -6.250000 +v 0.218750 -0.093750 -6.250000 +v -0.097057 -0.362222 8.750000 +v 0.097057 -0.362222 8.750000 +v 0.362222 -0.097057 8.750000 +v 0.265165 -0.265165 8.750000 +v 0.362222 0.097057 8.750000 +v 0.265165 0.265165 8.750000 +v 0.250000 0.470320 8.750000 +v -0.265165 -0.265165 8.750000 +v -0.362222 -0.097057 8.750000 +v -0.362222 0.097057 8.750000 +v -0.265165 0.265165 8.750000 +v -0.250000 0.470320 8.750000 +v 0.156250 0.841529 9.125000 +v -0.218750 0.625000 -6.250000 +v -0.343750 0.343750 -6.625000 +v 0.343750 0.343750 -6.625000 +v -0.125000 -2.406250 -4.187500 +v 0.125000 -2.593750 -4.375000 +v 0.125000 -2.406250 -4.187500 +v 0.125000 -2.343750 -5.437500 +v -0.125000 -1.906249 -5.062500 +v 0.125000 -1.906249 -5.062500 +v -0.125000 -2.593750 -4.375000 +v 0.125000 -2.718750 -4.437500 +v 0.125000 -1.656250 -4.812500 +v -0.125000 -2.718750 -4.437500 +v 0.125000 -2.906250 -4.437500 +v -0.312500 -1.343750 -4.812500 +v 0.312500 -1.343750 -4.812500 +v -0.125000 -2.906250 -4.437500 +v 0.125000 -3.093750 -4.625000 +v -0.312500 -1.343750 -3.562500 +v 0.312500 -1.968750 -4.000000 +v 0.312500 -1.343750 -3.562500 +v -0.312500 -1.093749 -4.937500 +v 0.312500 -1.093749 -4.937500 +v -0.125000 -3.093750 -4.625000 +v 0.125000 -3.218750 -4.687500 +v -0.312500 -1.968750 -4.000000 +v 0.125000 -2.093750 -4.125000 +v 0.312500 -0.906249 -5.187500 +v 0.312500 -3.406250 -4.750000 +v 0.125000 -3.531250 -4.687500 +v -0.125000 -2.093750 -4.125000 +v 0.125000 -2.218750 -4.187500 +v -0.312500 -0.906249 -5.187500 +v 0.312500 -0.718750 -5.187500 +v -0.125000 -3.531250 -4.687500 +v 0.125000 -2.968750 -5.750000 +v -0.125000 -2.218750 -4.187500 +v -0.125000 -2.968750 -5.750000 +v 0.312500 -2.031250 -4.187500 +v 0.312500 -2.156250 -4.250000 +v 0.312500 -2.406250 -4.250000 +v 0.312500 -2.656250 -4.500000 +v 0.312500 -2.531250 -4.437500 +v 0.312500 -2.906250 -4.500000 +v 0.312500 -3.156250 -4.750000 +v 0.312500 -3.031250 -4.687500 +v 0.312500 -2.968750 -5.562500 +v 0.312500 -2.343750 -5.250000 +v 0.312500 -1.906250 -4.937500 +v 0.312500 -1.656250 -4.750000 +v 0.312500 -0.718750 -3.562500 +v -0.125000 -3.218750 -4.687500 +v -0.312500 -3.406250 -4.750000 +v -0.312500 -3.156250 -4.750000 +v -0.312500 -2.968750 -5.562500 +v -0.312500 -2.906250 -4.500000 +v -0.312500 -2.656250 -4.500000 +v -0.312500 -3.031250 -4.687500 +v -0.312500 -2.406250 -4.250000 +v -0.312500 -2.156250 -4.250000 +v -0.312500 -2.531250 -4.437500 +v -0.312500 -2.343750 -5.250000 +v -0.312500 -1.906250 -4.937500 +v -0.312500 -2.031250 -4.187500 +v -0.312500 -1.656250 -4.750000 +v -0.125000 -2.343750 -5.437500 +v -0.125000 -1.656250 -4.812500 +v -0.312500 -0.718750 -3.562500 +v -0.312500 -0.718750 -5.187500 +v 0.154680 0.735485 -6.625000 +v -0.154680 0.735485 -6.625000 +v -0.154680 0.779680 -6.250000 +v 0.000000 0.781250 -6.625000 +v 0.156250 0.841529 8.750000 +v -0.156250 0.841529 8.750000 +v -0.198874 0.823874 8.750000 +v -0.000000 1.468750 9.125000 +v -0.154680 1.342180 9.125000 +v -0.000000 1.406250 9.125000 +v -0.281250 1.187500 8.750000 +v -0.198874 0.988626 9.125000 +v -0.281250 1.187500 9.125000 +v 0.198874 1.386374 8.750000 +v 0.198874 1.386374 9.125000 +v 0.198874 0.988626 8.750000 +v 0.281250 1.187500 9.125000 +v 0.198874 0.988626 9.125000 +v -0.198874 0.988626 8.750000 +v -0.156250 0.970971 9.125000 +v -0.000000 1.468750 8.750000 +v -0.198874 1.386374 9.125000 +v -0.156250 0.970971 8.750000 +v -0.156250 0.841529 9.125000 +v -0.198874 1.386374 8.750000 +v 0.156250 0.970971 8.750000 +v 0.156250 0.970971 9.125000 +v 0.281250 1.187500 8.750000 +v 0.218750 1.187500 8.750000 +v 0.154680 1.032820 9.125000 +v 0.218750 1.187500 9.125000 +v -0.218750 1.187500 9.125000 +v 0.154680 1.342180 9.125000 +v -0.000000 0.968750 9.125000 +v -0.154680 1.032820 9.125000 +v -0.000000 0.968750 8.750000 +v -0.218750 1.187500 8.750000 +v -0.000000 1.406250 8.750000 +v 0.154680 1.032820 8.750000 +v -0.154680 1.032820 8.750000 +v -0.154680 1.342180 8.750000 +v 0.154680 1.342180 8.750000 +v -0.000000 0.406250 9.250000 +v -0.000000 0.406250 2.000000 +v 0.375000 -1.121210 -1.816291 +v 0.343750 -1.187501 -1.843750 +v 0.343750 -1.121210 -1.816291 +v 0.375000 -1.253792 -1.816291 +v 0.343750 -1.281251 -1.750000 +v 0.343750 -1.253792 -1.816291 +v 0.375000 -1.253792 -1.683709 +v 0.343750 -1.187501 -1.656250 +v 0.343750 -1.253792 -1.683709 +v 0.375000 -1.121210 -1.683709 +v 0.343750 -1.093751 -1.750000 +v 0.343750 -1.121210 -1.683709 +v 0.375000 -1.093751 -1.750000 +v 0.375000 -1.187501 -1.843750 +v 0.375000 -1.281251 -1.750000 +v 0.375000 -1.187501 -1.656250 vt 0.810811 0.532819 vt 0.833977 0.486486 vt 0.833977 0.532819 @@ -1697,5147 +5617,1248 @@ vt 0.575290 0.789575 vt 0.573593 0.785480 vt 0.565403 0.785480 vt 0.563707 0.789575 -vn 1.0000 0.0000 0.0000 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 0.0000 1.0000 -vn -0.9734 -0.2290 0.0000 -vn 0.3443 -0.9389 0.0000 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -vn -1.0000 -0.0000 0.0000 -vn -0.0000 -0.9239 -0.3827 -vn 0.0000 -0.3827 -0.9239 -vn 0.0000 0.9239 0.3827 -vn 0.0000 0.7071 0.7071 -vn 0.0000 0.7071 -0.7071 -vn 0.0073 -0.7071 0.7071 -vn 0.0000 -0.9732 0.2298 -vn 0.0076 -0.9733 0.2295 -vn 0.0078 0.8267 -0.5626 -vn 0.0000 0.5474 -0.8369 -vn -0.0000 0.8310 -0.5563 -vn 0.0000 -0.3640 -0.9314 -vn 0.0076 -0.2295 -0.9733 -vn -0.0000 -0.3640 0.9314 -vn 0.0000 -0.7071 0.7071 -vn 0.0000 -0.9732 -0.2298 -vn 0.0073 -0.7071 -0.7071 -vn 0.0076 -0.9733 -0.2295 -vn -0.0000 -0.7071 -0.7071 -vn 0.0076 0.2295 -0.9733 -vn -0.0000 0.2728 -0.9621 -vn 0.0076 -0.2295 0.9733 -vn -0.3827 0.9239 0.0000 -vn 0.3827 0.9239 0.0000 -vn -0.9419 -0.3358 0.0000 -vn -0.9239 0.3827 0.0000 -vn 0.4197 -0.9077 0.0000 -vn 0.9239 -0.3827 0.0000 -vn 0.3827 -0.9239 0.0000 -vn -0.3827 -0.9239 0.0000 -vn -0.4197 -0.9077 0.0000 -vn -0.9239 -0.3827 0.0000 -vn 0.9239 0.3827 0.0000 -vn 0.9419 -0.3358 0.0000 -vn 0.0000 0.2298 0.9732 -vn 0.0000 -0.2298 0.9732 -vn 0.0078 0.6613 0.7501 -vn -0.0000 0.8310 0.5563 -vn -0.0000 0.6611 0.7503 -vn 0.0000 0.5474 0.8369 -vn 0.0000 0.1368 0.9906 -vn 0.0000 -0.3827 0.9239 -vn -0.0000 0.4472 0.8944 -vn -0.0000 0.2728 0.9621 -vn 0.0076 0.2295 0.9733 -vn -0.1343 -0.9909 0.0000 -vn 0.1951 -0.9808 0.0000 -vn -0.5000 -0.8660 0.0000 -vn -0.8660 -0.5000 0.0000 -vn -0.1305 -0.9914 0.0000 -vn -0.9616 -0.2744 0.0000 -vn -0.5989 -0.8008 0.0000 -vn -0.9914 -0.1305 0.0000 -vn 0.4709 0.8822 0.0000 -vn 0.8817 0.4719 0.0000 -vn 0.7071 0.7071 0.0000 -vn 0.7071 -0.7071 0.0000 -vn -0.7071 -0.7071 0.0000 -vn -0.7071 0.7071 0.0000 -vn -0.0000 0.1602 -0.9871 -vn -0.0000 0.3863 -0.9224 -vn 0.0000 0.9239 -0.3827 -vn 0.0000 -0.9239 0.3827 -vn 0.0000 -0.2527 -0.9675 -vn 0.0000 0.3827 0.9239 -vn -0.0000 -0.6618 -0.7497 -vn 0.0000 0.3714 -0.9285 -vn 0.0000 -0.8321 -0.5547 -vn -0.0000 -0.6618 0.7497 -vn -0.0000 0.1602 0.9871 -vn 0.0000 0.3714 0.9285 -vn -0.0000 -0.8321 0.5547 -vn 0.0000 -0.6037 0.7972 -vn 0.0000 -0.6037 -0.7972 -vn 0.0000 -0.7972 0.6037 -vn -0.0000 0.3827 -0.9239 -vn -0.0000 0.9239 -0.3828 -vn 0.2181 -0.6901 -0.6901 -vn 0.2181 -0.6901 0.6901 -vn 0.2181 0.6901 0.6901 -vn 0.2181 0.6901 -0.6901 -vn 0.2181 0.0000 -0.9759 -vn 0.2181 -0.9759 -0.0000 -vn 0.2181 0.0000 0.9759 -vn 0.2181 0.9759 0.0000 -vn 0.2434 0.6858 0.6858 -vn 0.2434 0.6858 -0.6858 -vn 0.2434 0.0000 -0.9699 -vn 0.2434 -0.9699 -0.0000 -vn 0.2434 0.9699 0.0000 -vn 0.2434 -0.6858 -0.6858 -vn 0.2434 0.0000 0.9699 -vn 0.2434 -0.6858 0.6858 -vn 0.0000 -0.1951 -0.9808 -vn 0.0000 0.1951 0.9808 -vn 0.0000 -0.1951 0.9808 -vn -0.0000 0.1951 -0.9808 -vn -0.0000 -0.2298 -0.9732 -vn 0.0000 0.2298 -0.9732 -vn 0.0078 0.6613 -0.7501 -vn -0.0000 0.4472 -0.8944 -vn -0.0000 0.2527 -0.9675 -vn 0.0000 0.2527 0.9675 -vn 0.0000 -0.2527 0.9675 -vn 0.0164 -0.9658 0.2587 -vn 0.0164 -0.9658 -0.2587 -vn 0.0164 -0.2587 -0.9658 -vn 0.0165 -0.7070 -0.7070 -vn 0.0164 0.2587 -0.9658 -vn 0.0013 0.3034 -0.9529 -vn -0.0141 0.0737 -0.9972 -vn 0.0165 -0.7070 0.7070 -vn 0.0164 -0.2587 0.9658 -vn 0.0164 0.2587 0.9658 -vn 0.0013 0.3034 0.9529 -vn 0.0078 0.8267 0.5626 -vn -0.0141 0.0737 0.9972 -vn -0.0073 0.4348 0.9005 -vn -0.0073 0.4348 -0.9005 -vn -0.0262 0.4060 -0.9135 -vn 0.9188 -0.3671 0.1452 -vn 0.7817 -0.5913 -0.1981 -vn 0.9188 -0.3671 -0.1452 -vn -0.7971 0.5046 -0.3316 -vn -0.7290 0.6491 0.2171 -vn -0.7290 0.6491 -0.2171 -vn 0.7817 -0.5913 0.1981 -vn 0.9592 -0.2085 -0.1909 -vn -0.9228 0.3641 -0.1257 -vn 0.9592 -0.2085 0.1909 -vn -0.9632 -0.2625 0.0577 -vn -0.9632 -0.2625 -0.0577 -vn 0.8192 -0.5735 0.0000 -vn -0.7678 -0.6407 0.0000 -vn 0.5024 -0.8356 0.2221 -vn 0.7665 -0.6204 -0.1664 -vn 0.5024 -0.8356 -0.2221 -vn -0.8944 -0.4472 0.0000 -vn 0.9487 0.0000 -0.3162 -vn 0.9921 0.0000 -0.1251 -vn 0.7665 -0.6204 0.1664 -vn -0.4634 -0.8707 0.1647 -vn -0.4621 -0.8728 -0.1574 -vn -0.4634 -0.8707 -0.1647 -vn -0.8487 0.4243 0.3158 -vn -0.8487 0.4243 -0.3158 -vn 0.5972 -0.6798 -0.4257 -vn 0.8941 -0.2402 -0.3781 -vn 0.8379 -0.4253 -0.3421 -vn 0.6760 -0.6015 -0.4258 -vn -0.3953 0.1977 -0.8970 -vn -0.3704 0.2330 -0.8992 -vn -0.4032 0.3129 -0.8599 -vn -0.4342 0.1096 -0.8941 -vn -0.4248 -0.8013 -0.4212 -vn -0.4357 -0.8092 -0.3942 -vn 0.9921 -0.0000 0.1251 -vn -0.3953 0.1977 0.8970 -vn -0.3704 0.2330 0.8992 -vn -0.4032 0.3129 0.8599 -vn -0.4342 0.1096 0.8941 -vn -0.4248 -0.8013 0.4213 -vn -0.4621 -0.8728 0.1574 -vn -0.4357 -0.8092 0.3942 -vn 0.9487 -0.0000 0.3162 -vn 0.8941 -0.2402 0.3781 -vn 0.6760 -0.6015 0.4258 -vn 0.8379 -0.4253 0.3421 -vn 0.5972 -0.6798 0.4257 -vn -0.7971 0.5046 0.3316 -vn -0.9228 0.3641 0.1257 -vn 0.9871 -0.1602 0.0000 -vn 0.8507 -0.5257 0.0000 -vn 0.1602 -0.9871 0.0000 -vn -0.2898 -0.9571 0.0000 -vn 0.5257 -0.8507 0.0000 -vn -0.5547 -0.8321 0.0000 -vn -0.9871 0.1602 0.0000 -vn -0.8507 0.5257 0.0000 -vn -0.5257 0.8507 0.0000 -vn -0.1602 0.9871 0.0000 -vn 0.2898 0.9571 0.0000 -vn 0.5547 0.8321 0.0000 -vn -0.0931 0.7307 -0.6763 -vn -0.1298 0.9915 -0.0000 -vn -0.0931 0.7307 0.6763 -vn -0.0846 0.7182 0.6906 -vn -0.1644 0.9864 -0.0000 -vn -0.0846 0.7182 -0.6906 -vn -0.0262 0.4060 0.9135 -vn 0.0000 0.5556 -0.8315 -vn 0.0000 0.5556 0.8315 -vn 0.0000 -0.5556 0.8315 -vn 0.0000 -0.5556 -0.8315 -vn -0.9262 0.3770 0.0000 -vn -0.9285 0.3714 0.0000 -vn 0.9262 0.3770 0.0000 -vn 0.9285 0.3714 0.0000 -vn 0.9239 0.0000 0.3827 -vn 0.9239 0.0000 -0.3827 -vn 0.7071 0.0000 -0.7071 -vn 0.7071 0.0000 0.7071 -vn 0.0000 0.9732 -0.2298 -vn 0.0000 0.8944 -0.4472 -vn 0.0000 0.8944 0.4472 -vn 0.0000 0.9732 0.2298 -s off -f 70/1/1 71/2/1 69/3/1 -f 73/4/2 72/5/2 74/6/2 -f 76/7/3 70/1/3 69/3/3 -f 74/8/4 76/7/4 73/9/4 -f 75/10/5 72/11/5 70/12/5 -f 109/13/6 108/14/6 107/15/6 -f 112/16/3 116/17/3 108/14/3 -f 115/18/2 111/19/2 110/20/2 -f 143/21/2 140/22/2 141/23/2 -f 145/24/4 142/25/4 143/26/4 -f 150/27/2 149/28/2 148/29/2 -f 140/22/7 142/30/7 144/31/7 -f 145/32/6 141/23/6 139/33/6 -f 139/34/1 140/22/1 138/35/1 -f 171/36/6 49/37/6 53/38/6 -f 176/39/6 171/36/6 175/40/6 -f 55/41/8 186/42/8 54/43/8 -f 196/44/9 195/45/9 201/46/9 -f 202/47/9 187/48/9 55/49/9 -f 191/50/8 190/51/8 202/52/8 -f 192/53/8 202/54/8 201/55/8 -f 192/53/10 195/56/10 193/57/10 -f 186/42/11 194/58/11 54/43/11 -f 198/59/1 199/60/1 200/61/1 -f 205/62/1 188/63/1 189/64/1 -f 58/65/8 56/66/8 203/67/8 -f 193/57/1 205/68/1 189/64/1 -f 248/69/1 259/70/1 257/71/1 -f 256/72/1 259/70/1 261/73/1 -f 301/74/8 305/75/8 300/76/8 -f 303/77/8 304/78/8 302/79/8 -f 305/75/8 302/79/8 304/78/8 -f 301/74/7 308/80/7 302/79/7 -f 300/81/3 307/82/3 301/74/3 -f 302/79/2 309/83/2 303/84/2 -f 307/82/1 306/85/1 311/86/1 -f 310/87/1 309/88/1 308/80/1 -f 307/82/1 310/87/1 308/80/1 -f 407/89/2 392/90/2 393/91/2 -f 394/92/2 407/89/2 393/91/2 -f 409/93/2 394/92/2 395/94/2 -f 410/95/2 395/94/2 396/96/2 -f 411/97/2 396/96/2 397/98/2 -f 398/99/2 411/97/2 397/98/2 -f 415/100/3 405/101/3 404/102/3 -f 414/103/3 404/102/3 403/104/3 -f 402/105/3 414/103/3 403/104/3 -f 413/106/3 401/107/3 417/108/3 -f 418/109/3 401/107/3 400/110/3 -f 418/109/3 399/111/3 419/112/3 -f 462/113/1 463/114/1 461/115/1 -f 463/114/7 465/116/7 461/115/7 -f 462/113/1 468/117/1 464/118/1 -f 466/119/8 469/120/8 465/116/8 -f 465/116/3 462/121/3 461/115/3 -f 470/122/2 463/114/2 464/123/2 -f 470/124/8 472/125/8 469/120/8 -f 462/121/12 472/126/12 467/127/12 -f 471/128/13 464/123/13 468/129/13 -f 479/130/2 475/131/2 473/132/2 -f 476/133/3 474/134/3 477/135/3 -f 484/136/2 475/131/2 478/137/2 -f 474/134/3 483/138/3 477/135/3 -f 473/132/2 486/139/2 485/140/2 -f 491/141/3 480/142/3 476/133/3 -f 499/143/2 495/144/2 496/145/2 -f 498/146/3 493/147/3 488/148/3 -f 500/149/2 502/150/2 499/143/2 -f 497/151/3 504/152/3 498/146/3 -f 502/153/8 501/154/8 482/155/8 -f 504/152/7 502/150/7 503/156/7 -f 513/157/7 509/158/7 514/159/7 -f 516/160/7 511/161/7 512/162/7 -f 507/163/8 513/164/8 519/165/8 -f 505/166/8 516/167/8 512/168/8 -f 517/169/8 520/170/8 505/166/8 -f 517/169/8 507/163/8 519/165/8 -f 519/165/8 528/171/8 521/172/8 -f 525/173/8 526/174/8 520/170/8 -f 520/170/8 527/175/8 519/165/8 -f 523/176/8 517/169/8 522/177/8 -f 519/165/8 522/177/8 517/169/8 -f 520/170/8 517/169/8 524/178/8 -f 537/179/7 540/180/7 538/181/7 -f 542/182/7 540/180/7 539/183/7 -f 508/184/1 514/185/1 509/186/1 -f 515/187/1 506/188/1 511/161/1 -f 506/188/1 537/189/1 518/190/1 -f 508/184/1 518/190/1 538/191/1 -f 538/191/1 518/190/1 537/189/1 -f 545/192/6 543/193/6 544/194/6 -f 545/192/6 548/195/6 546/196/6 -f 550/197/1 535/198/1 549/199/1 -f 547/200/1 531/201/1 548/195/1 -f 530/202/1 548/195/1 531/201/1 -f 550/197/1 536/203/1 535/198/1 -f 534/204/1 549/199/1 535/198/1 -f 547/200/1 532/205/1 531/201/1 -f 547/200/1 549/199/1 533/206/1 -f 548/195/1 529/207/1 550/197/1 -f 516/208/3 537/209/3 515/210/3 -f 538/211/2 513/212/2 514/213/2 -f 503/214/1 483/138/1 484/136/1 -f 552/215/7 553/216/7 551/217/7 -f 554/218/8 555/219/8 553/216/8 -f 562/220/1 561/221/1 558/222/1 -f 553/223/2 561/221/2 563/224/2 -f 562/220/3 559/225/3 554/218/3 -f 70/1/1 72/5/1 71/2/1 -f 73/4/2 71/2/2 72/5/2 -f 76/7/3 75/226/3 70/1/3 -f 74/8/4 75/10/4 76/7/4 -f 75/10/5 74/8/5 72/11/5 -f 109/13/6 110/20/6 108/14/6 -f 114/227/3 116/17/3 112/16/3 -f 116/17/3 107/15/3 108/14/3 -f 110/20/2 109/13/2 115/18/2 -f 115/18/2 113/228/2 111/19/2 -f 143/21/2 142/30/2 140/22/2 -f 145/24/4 144/229/4 142/25/4 -f 147/230/2 146/231/2 148/29/2 -f 146/231/2 144/232/2 150/27/2 -f 148/29/2 146/231/2 150/27/2 -f 144/232/2 145/233/2 150/27/2 -f 146/234/7 133/235/7 144/31/7 -f 133/235/7 138/236/7 144/31/7 -f 138/236/7 140/22/7 144/31/7 -f 139/33/6 137/237/6 145/32/6 -f 137/237/6 150/238/6 145/32/6 -f 145/32/6 143/21/6 141/23/6 -f 139/34/1 141/23/1 140/22/1 -f 171/36/6 152/239/6 49/37/6 -f 176/39/6 152/239/6 171/36/6 -f 55/41/8 187/240/8 186/42/8 -f 56/241/9 57/242/9 201/46/9 -f 57/242/9 196/44/9 201/46/9 -f 196/44/9 207/243/9 195/45/9 -f 202/47/9 190/244/9 187/48/9 -f 192/53/8 191/50/8 202/54/8 -f 192/53/10 201/245/10 195/56/10 -f 186/42/11 188/63/11 194/58/11 -f 200/61/1 206/246/1 208/247/1 -f 208/247/1 207/248/1 200/61/1 -f 207/248/1 196/249/1 200/61/1 -f 196/249/1 197/250/1 200/61/1 -f 197/250/1 198/59/1 200/61/1 -f 205/62/1 194/251/1 188/63/1 -f 58/65/8 57/252/8 56/66/8 -f 56/66/8 204/253/8 203/67/8 -f 203/67/8 61/254/8 58/65/8 -f 61/254/8 60/255/8 58/65/8 -f 60/255/8 59/256/8 58/65/8 -f 193/57/1 195/257/1 205/68/1 -f 248/69/1 246/258/1 259/70/1 -f 256/72/1 257/71/1 259/70/1 -f 259/70/1 260/259/1 261/73/1 -f 261/73/1 262/260/1 263/261/1 -f 263/261/1 256/72/1 261/73/1 -f 305/75/8 301/74/8 302/79/8 -f 301/74/7 307/82/7 308/80/7 -f 300/81/3 306/262/3 307/82/3 -f 302/79/2 308/80/2 309/83/2 -f 307/82/1 311/86/1 310/87/1 -f 407/89/2 406/263/2 392/90/2 -f 394/92/2 408/264/2 407/89/2 -f 409/93/2 408/265/2 394/92/2 -f 410/95/2 409/266/2 395/94/2 -f 411/97/2 410/95/2 396/96/2 -f 398/99/2 412/267/2 411/97/2 -f 415/100/3 416/268/3 405/101/3 -f 414/103/3 415/100/3 404/102/3 -f 402/105/3 413/269/3 414/103/3 -f 413/106/3 402/105/3 401/107/3 -f 418/109/3 417/270/3 401/107/3 -f 418/109/3 400/110/3 399/111/3 -f 462/113/1 464/118/1 463/114/1 -f 463/114/7 466/119/7 465/116/7 -f 462/113/1 467/271/1 468/117/1 -f 466/119/8 470/124/8 469/120/8 -f 465/116/3 469/272/3 462/121/3 -f 470/122/2 466/119/2 463/114/2 -f 470/124/8 471/273/8 472/125/8 -f 462/121/12 469/272/12 472/126/12 -f 471/128/13 470/122/13 464/123/13 -f 479/130/2 478/137/2 475/131/2 -f 476/133/3 480/142/3 474/134/3 -f 484/136/2 482/155/2 475/131/2 -f 474/134/3 481/274/3 483/138/3 -f 485/140/2 492/275/2 479/130/2 -f 479/130/2 473/132/2 485/140/2 -f 476/133/3 489/276/3 491/141/3 -f 491/141/3 490/277/3 480/142/3 -f 496/145/2 494/278/2 500/149/2 -f 500/149/2 499/143/2 496/145/2 -f 488/148/3 487/279/3 497/151/3 -f 497/151/3 498/146/3 488/148/3 -f 500/149/2 503/156/2 502/150/2 -f 497/151/3 501/280/3 504/152/3 -f 501/154/8 475/131/8 482/155/8 -f 482/155/8 481/281/8 502/153/8 -f 481/281/8 474/282/8 502/153/8 -f 504/152/7 501/280/7 502/150/7 -f 513/157/7 510/283/7 509/158/7 -f 516/160/7 515/187/7 511/161/7 -f 507/163/8 510/284/8 513/164/8 -f 505/166/8 520/170/8 516/167/8 -f 521/172/8 522/177/8 519/165/8 -f 519/165/8 527/175/8 528/171/8 -f 526/174/8 527/175/8 520/170/8 -f 520/170/8 524/178/8 525/173/8 -f 523/176/8 524/178/8 517/169/8 -f 537/179/7 539/183/7 540/180/7 -f 542/182/7 541/285/7 540/180/7 -f 508/184/1 538/191/1 514/185/1 -f 515/187/1 537/189/1 506/188/1 -f 545/192/6 546/196/6 543/193/6 -f 545/192/6 547/200/6 548/195/6 -f 530/202/1 529/207/1 548/195/1 -f 550/197/1 529/207/1 536/203/1 -f 534/204/1 533/206/1 549/199/1 -f 547/200/1 533/206/1 532/205/1 -f 516/208/3 520/286/3 537/209/3 -f 538/211/2 519/287/2 513/212/2 -f 484/136/1 478/137/1 504/288/1 -f 503/214/1 477/135/1 483/138/1 -f 484/136/1 504/288/1 503/214/1 -f 552/215/7 554/218/7 553/216/7 -f 554/218/8 556/289/8 555/219/8 -f 561/221/1 557/290/1 558/222/1 -f 558/222/1 560/291/1 562/220/1 -f 560/291/1 559/225/1 562/220/1 -f 563/224/2 551/292/2 553/223/2 -f 553/223/2 557/290/2 561/221/2 -f 554/218/3 552/215/3 564/293/3 -f 564/293/3 562/220/3 554/218/3 -s 1 -f 18/294/14 6/295/15 14/296/16 -f 3/297/17 29/298/18 7/299/19 -f 268/300/20 269/301/2 20/302/21 -f 30/303/22 34/304/22 22/305/23 -f 5/306/24 19/307/25 15/308/26 -f 271/309/20 268/300/20 2/310/27 -f 21/311/28 269/301/2 270/312/29 -f 6/295/15 15/308/26 14/296/16 -f 31/313/3 30/303/22 16/314/30 -f 30/315/31 42/316/32 34/317/32 -f 33/318/33 39/319/34 31/320/34 -f 35/321/35 45/322/36 43/323/37 -f 35/321/35 40/324/38 32/325/39 -f 32/326/39 41/327/40 33/318/33 -f 31/320/34 38/328/31 30/315/31 -f 44/329/41 37/330/42 36/331/41 -f 34/317/32 44/329/41 36/331/41 -f 45/332/3 44/333/3 42/334/3 -f 36/335/3 23/336/43 4/337/44 -f 24/338/45 48/339/46 47/340/47 -f 28/341/48 52/342/46 8/343/46 -f 53/344/49 8/345/50 52/346/50 -f 47/340/47 46/347/51 33/348/52 -f 37/349/52 28/341/48 23/336/43 -f 51/350/47 35/351/51 50/352/51 -f 32/353/51 50/352/51 35/351/51 -f 17/354/53 31/313/3 16/314/30 -f 79/355/54 78/356/55 77/357/54 -f 93/358/56 85/359/57 86/360/56 -f 91/361/58 86/360/56 84/362/58 -f 88/363/59 82/364/60 81/365/59 -f 94/366/6 84/362/58 87/367/6 -f 92/368/57 83/369/61 85/359/57 -f 90/370/61 81/365/59 83/369/61 -f 77/357/54 89/371/60 79/355/54 -f 85/372/3 77/357/3 95/373/3 -f 102/374/62 100/375/63 96/376/62 -f 104/377/1 99/378/64 98/379/1 -f 106/380/63 95/381/1 100/375/63 -f 105/382/64 96/376/62 99/378/64 -f 103/383/65 98/379/1 97/384/65 -f 92/385/2 93/386/2 101/387/2 -f 80/388/55 97/384/65 78/356/55 -f 132/389/64 123/390/1 124/391/64 -f 130/392/65 121/393/6 122/394/65 -f 128/395/66 119/396/8 120/397/66 -f 126/398/67 117/399/7 118/400/67 -f 125/401/7 124/391/64 117/399/7 -f 131/402/1 122/394/65 123/390/1 -f 129/403/6 120/397/66 121/404/6 -f 127/405/8 118/400/67 119/396/8 -f 132/406/3 125/407/3 129/408/3 -f 146/234/31 134/409/67 133/235/31 -f 134/409/67 148/410/8 135/411/8 -f 149/412/66 137/237/38 136/413/66 -f 135/414/8 149/412/66 136/413/66 -f 47/415/8 153/416/8 154/417/8 -f 157/418/8 159/419/8 155/420/8 -f 48/421/8 152/422/8 153/416/8 -f 151/423/8 158/424/8 156/425/8 -f 185/426/13 172/427/68 168/428/69 -f 165/429/11 304/430/70 164/431/70 -f 167/432/71 158/433/9 159/434/71 -f 158/433/9 160/435/10 156/436/72 -f 163/437/73 305/438/11 165/429/11 -f 159/434/71 161/439/50 167/432/71 -f 166/440/8 161/441/8 165/442/8 -f 46/443/8 47/415/8 151/423/8 -f 158/424/8 47/415/8 154/417/8 -f 46/444/7 168/428/7 50/445/7 -f 51/446/1 168/428/1 169/447/1 -f 52/448/1 169/447/1 170/449/1 -f 171/450/1 52/448/1 170/449/1 -f 168/451/69 173/452/74 169/453/74 -f 170/454/75 175/40/75 171/36/75 -f 169/453/74 174/455/76 170/454/76 -f 154/456/77 179/457/78 155/458/78 -f 152/239/79 177/459/79 153/460/79 -f 155/458/78 180/461/12 157/462/12 -f 153/460/80 178/463/77 154/456/77 -f 184/464/1 180/465/1 181/466/1 -f 178/467/1 173/468/1 180/465/1 -f 178/467/1 174/469/1 173/468/1 -f 175/470/1 177/471/1 176/472/1 -f 49/473/49 64/474/3 65/475/12 -f 11/476/7 65/475/12 66/477/7 -f 49/473/49 48/478/50 1/479/81 -f 68/480/2 62/481/27 3/482/82 -f 54/483/49 204/484/23 55/49/83 -f 199/485/7 59/486/13 60/487/7 -f 197/488/2 57/242/10 58/489/2 -f 200/490/12 60/487/7 61/491/12 -f 198/492/13 58/489/2 59/486/13 -f 191/493/13 187/494/84 190/495/84 -f 186/496/84 67/497/13 68/480/2 -f 188/498/84 68/480/2 13/499/2 -f 12/500/13 188/498/84 13/499/2 -f 67/497/13 192/501/85 66/477/7 -f 193/502/70 12/500/13 11/476/7 -f 66/477/7 193/502/70 11/476/7 -f 201/46/71 202/47/71 55/49/83 -f 195/45/71 208/503/23 205/504/23 -f 205/504/23 206/505/3 194/506/49 -f 200/490/12 61/491/12 54/43/49 -f 63/507/1 62/508/1 67/509/1 -f 225/510/86 216/511/6 217/512/27 -f 223/513/87 214/514/3 215/515/23 -f 221/516/88 212/517/7 213/518/12 -f 219/519/89 210/520/2 211/521/13 -f 218/522/90 217/512/27 210/520/2 -f 224/523/91 215/515/23 216/524/6 -f 222/525/92 213/518/12 214/514/3 -f 220/526/93 211/521/13 212/517/7 -f 229/527/94 220/526/93 221/516/88 -f 227/528/95 218/522/90 219/519/89 -f 226/529/96 225/510/86 218/522/90 -f 232/530/97 223/513/87 224/523/91 -f 222/525/92 229/531/94 221/516/88 -f 228/532/98 219/519/89 220/526/93 -f 233/533/99 224/534/91 225/510/86 -f 223/513/87 230/535/100 222/525/92 -f 234/536/2 233/537/99 226/538/96 -f 240/539/6 231/540/101 232/541/97 -f 238/542/3 229/543/94 230/544/100 -f 236/545/7 227/546/95 228/547/98 -f 241/548/27 232/549/97 233/537/99 -f 239/550/23 230/544/100 231/540/101 -f 237/551/12 228/547/98 229/543/94 -f 235/552/13 226/538/96 227/546/95 -f 248/553/102 249/554/2 242/555/2 -f 262/556/6 267/557/27 263/558/27 -f 244/559/12 252/560/3 245/561/3 -f 260/562/3 247/563/103 264/564/3 -f 245/561/3 253/565/104 246/566/104 -f 242/555/2 250/567/13 243/568/13 -f 260/562/3 265/569/23 261/570/23 -f 256/571/2 254/572/105 257/573/105 -f 263/558/27 258/574/2 256/571/2 -f 261/570/23 266/575/6 262/576/6 -f 247/563/103 246/566/104 253/565/104 -f 257/573/105 255/577/102 248/553/102 -f 272/578/2 27/579/106 26/580/107 -f 25/581/108 270/312/29 275/582/109 -f 275/582/109 29/298/18 25/581/108 -f 29/298/18 273/583/29 26/580/107 -f 273/584/42 278/585/41 272/586/41 -f 272/586/41 277/587/32 271/588/32 -f 271/588/32 276/589/31 268/590/31 -f 275/591/39 280/592/37 274/593/35 -f 269/594/34 283/595/40 270/596/33 -f 268/590/31 282/597/34 269/594/34 -f 283/595/40 275/598/39 270/596/33 -f 281/599/2 283/600/2 282/601/2 -f 274/593/35 279/602/36 273/584/42 -f 299/603/64 290/604/1 291/605/64 -f 297/606/65 288/607/6 289/608/65 -f 295/609/66 286/610/8 287/611/66 -f 293/612/67 284/613/7 285/614/67 -f 292/615/7 291/605/64 284/613/7 -f 298/616/1 289/608/65 290/604/1 -f 296/617/6 287/611/66 288/618/6 -f 294/619/8 285/614/67 286/610/8 -f 296/620/3 298/621/3 292/622/3 -f 304/430/70 162/623/84 164/431/70 -f 310/624/70 184/625/11 183/626/70 -f 311/627/11 182/628/73 184/625/11 -f 309/629/110 183/626/70 181/630/84 -f 306/631/111 300/632/111 157/462/112 -f 156/633/72 303/634/110 309/635/110 -f 15/636/26 318/637/113 14/638/16 -f 19/639/25 319/640/114 15/636/26 -f 19/639/25 321/641/115 320/642/116 -f 21/643/28 321/641/115 20/644/21 -f 25/645/108 312/646/117 21/643/28 -f 3/647/17 313/648/118 25/645/108 -f 313/648/118 3/647/17 322/649/119 -f 18/650/14 318/637/113 317/651/120 -f 18/650/14 316/652/121 16/653/30 -f 16/653/30 315/654/122 17/655/53 -f 24/656/45 315/654/122 314/657/123 -f 24/656/45 314/657/123 1/658/124 -f 314/657/123 323/659/125 1/658/124 -f 322/660/7 1/661/7 323/662/7 -f 314/663/1 317/664/1 321/665/1 -f 248/69/1 242/666/1 431/667/1 -f 8/668/1 9/669/1 28/670/1 -f 7/671/1 29/672/1 13/673/1 -f 28/341/48 324/674/126 23/336/43 -f 29/298/18 26/580/107 325/675/127 -f 13/673/128 29/672/18 325/676/127 -f 350/677/129 331/678/130 330/679/131 -f 338/680/132 359/681/133 339/682/134 -f 351/683/135 332/684/136 331/678/130 -f 359/681/133 340/685/137 339/682/134 -f 352/686/138 333/687/131 332/688/136 -f 340/685/137 361/689/139 341/690/140 -f 353/691/129 334/692/130 333/687/131 -f 346/693/141 327/694/141 326/695/141 -f 341/690/140 362/696/142 342/697/142 -f 354/698/135 335/699/136 334/692/130 -f 347/700/143 328/701/144 327/694/145 -f 362/696/142 343/702/146 342/697/142 -f 378/703/147 335/699/136 336/704/148 -f 348/705/149 329/706/136 328/701/144 -f 363/707/146 344/708/8 343/702/146 -f 356/709/150 337/710/151 336/704/152 -f 349/711/138 330/679/131 329/712/136 -f 357/713/153 338/680/132 337/710/154 -f 328/701/144 366/714/155 327/694/145 -f 367/715/156 328/701/144 329/706/136 -f 330/679/131 368/716/157 329/712/136 -f 367/715/156 329/712/136 368/716/157 -f 370/717/156 331/678/130 332/684/136 -f 331/678/130 368/716/157 330/679/131 -f 369/718/158 368/716/157 331/678/130 -f 333/687/131 371/719/157 332/688/136 -f 332/688/136 371/719/157 370/717/156 -f 373/720/156 334/692/130 335/699/136 -f 334/692/130 371/719/157 333/687/131 -f 372/721/158 371/719/157 334/692/130 -f 378/722/2 374/723/159 373/724/2 -f 338/680/132 375/725/160 337/710/154 -f 374/726/159 337/710/154 375/725/160 -f 339/682/134 376/727/161 338/680/132 -f 375/725/160 338/680/132 376/727/161 -f 340/685/137 377/728/162 339/682/134 -f 376/727/161 339/682/134 377/728/162 -f 341/690/140 377/728/162 340/685/137 -f 374/729/163 378/730/164 336/704/152 -f 335/699/136 378/703/147 373/720/156 -f 371/731/2 372/732/2 370/733/2 -f 368/734/2 369/735/2 367/736/2 -f 373/724/2 374/723/159 372/732/2 -f 374/723/159 375/737/160 372/732/2 -f 372/732/2 375/737/160 370/733/2 -f 370/733/2 375/737/160 369/735/2 -f 369/735/2 375/737/160 367/736/2 -f 375/737/160 376/738/161 367/736/2 -f 367/736/2 376/738/161 366/739/2 -f 376/738/161 377/740/162 366/739/2 -f 377/740/162 341/741/2 326/742/2 -f 327/743/2 366/739/2 326/742/2 -f 343/744/2 344/745/2 342/746/2 -f 344/745/2 345/747/2 342/746/2 -f 345/747/2 326/742/2 341/741/2 -f 342/746/2 345/747/2 341/741/2 -f 366/739/2 377/740/162 326/742/2 -f 337/710/151 374/729/163 336/704/152 -f 356/709/165 335/699/136 355/748/138 -f 391/749/3 386/750/3 387/751/166 -f 384/752/3 383/753/3 385/754/3 -f 381/755/3 380/756/3 382/757/3 -f 386/750/3 385/754/3 387/751/166 -f 387/751/166 385/754/3 388/758/167 -f 385/754/3 383/753/3 388/758/167 -f 383/753/3 382/757/3 388/758/167 -f 382/757/3 380/756/3 388/758/167 -f 388/758/167 380/756/3 389/759/168 -f 380/756/3 379/760/3 389/759/168 -f 389/759/168 379/760/3 390/761/169 -f 387/762/170 357/713/171 356/709/150 -f 387/762/170 356/709/150 391/763/172 -f 356/709/165 355/748/138 391/764/173 -f 391/764/173 355/748/138 386/765/174 -f 354/698/135 386/765/174 355/748/138 -f 385/766/175 354/698/135 384/767/176 -f 354/698/135 353/691/129 384/767/176 -f 353/691/129 352/686/138 384/767/176 -f 384/767/176 352/686/138 383/768/174 -f 351/683/135 383/768/174 352/769/138 -f 382/770/175 351/683/135 381/771/176 -f 351/683/135 350/677/129 381/771/176 -f 350/677/129 349/711/138 381/771/176 -f 381/771/176 349/711/138 380/772/174 -f 348/705/149 380/772/174 349/773/138 -f 348/705/149 347/700/143 379/774/177 -f 387/775/166 388/776/167 357/713/153 -f 357/713/153 388/776/167 358/777/178 -f 388/776/167 389/778/168 358/777/178 -f 358/777/178 389/778/168 359/681/133 -f 389/778/168 390/779/169 359/681/133 -f 359/681/133 390/779/169 360/780/179 -f 361/689/139 360/780/179 390/779/169 -f 347/781/3 346/782/3 379/760/3 -f 379/760/3 346/782/3 390/761/169 -f 390/761/169 346/782/3 361/783/3 -f 346/782/3 365/784/3 361/783/3 -f 361/783/3 365/784/3 362/785/3 -f 363/786/3 362/785/3 364/787/3 -f 364/787/3 362/785/3 365/784/3 -f 400/110/180 394/92/181 393/91/180 -f 403/104/182 397/98/183 396/96/182 -f 401/107/181 395/94/184 394/92/181 -f 399/111/1 393/91/180 392/90/1 -f 404/102/183 398/99/185 397/98/183 -f 402/105/184 396/96/182 395/94/184 -f 407/89/186 419/788/8 406/263/8 -f 408/264/187 418/789/186 407/89/186 -f 409/790/188 417/791/187 408/264/187 -f 414/792/189 409/790/188 410/793/189 -f 415/794/190 410/793/189 411/795/190 -f 416/796/191 411/795/190 412/797/191 -f 13/673/128 325/676/127 420/798/192 -f 11/799/193 422/800/194 10/801/195 -f 422/800/194 11/799/193 421/802/196 -f 420/798/192 421/802/196 11/799/193 -f 11/799/193 12/803/197 420/798/192 -f 13/673/128 420/798/192 12/803/197 -f 28/670/48 9/669/198 324/804/126 -f 10/801/195 422/800/194 9/669/198 -f 324/804/126 9/669/198 422/800/194 -f 435/805/199 243/568/13 250/567/13 -f 244/559/12 434/806/200 251/807/12 -f 434/808/8 435/809/8 253/810/8 -f 425/811/1 448/812/1 447/813/1 -f 440/814/3 428/815/23 427/816/3 -f 437/817/13 425/811/7 424/818/13 -f 442/819/27 423/820/2 429/821/27 -f 441/822/23 433/823/201 428/824/23 -f 438/825/7 426/826/12 425/811/7 -f 444/827/201 432/828/200 433/829/201 -f 439/830/12 427/816/3 426/826/12 -f 443/831/202 429/821/27 430/832/202 -f 436/833/2 424/818/13 423/820/2 -f 453/834/3 452/835/12 445/836/3 -f 431/837/199 443/831/202 430/832/202 -f 426/826/1 449/838/1 448/839/1 -f 428/815/1 449/840/1 427/816/1 -f 425/811/1 446/841/1 424/818/1 -f 424/818/1 445/842/1 423/820/1 -f 423/820/1 452/843/1 429/821/1 -f 430/844/1 452/845/1 451/846/1 -f 433/847/1 450/848/1 428/815/1 -f 451/849/1 433/850/1 432/851/1 -f 459/852/7 450/853/13 451/854/7 -f 457/855/2 448/856/27 449/857/2 -f 455/858/6 446/859/23 447/860/6 -f 460/861/12 451/862/7 452/835/12 -f 458/863/13 449/857/2 450/853/13 -f 456/864/27 447/860/6 448/856/27 -f 454/865/23 445/836/3 446/859/23 -f 454/866/8 438/825/8 437/817/8 -f 453/867/8 437/817/8 436/833/8 -f 460/868/8 436/833/8 442/819/8 -f 438/825/8 456/869/8 439/830/8 -f 439/830/8 457/870/8 440/814/8 -f 457/871/8 441/872/8 440/814/8 -f 443/873/8 460/874/8 442/819/8 -f 458/875/8 444/876/8 441/872/8 -f 459/877/8 443/878/8 435/809/8 -f 480/879/203 502/880/204 474/881/204 -f 488/882/7 492/883/64 485/884/7 -f 487/885/67 485/884/7 486/886/67 -f 491/887/7 495/888/67 490/889/67 -f 489/890/64 496/891/7 491/887/7 -f 480/879/203 495/888/67 499/892/203 -f 487/885/67 473/893/203 497/894/203 -f 479/895/205 493/896/64 498/897/205 -f 494/898/64 476/899/205 500/900/205 -f 503/901/206 476/899/205 477/135/206 -f 497/894/203 475/902/204 501/903/204 -f 479/895/205 504/904/206 478/137/206 -f 518/905/7 505/906/84 506/907/84 -f 512/162/2 506/907/84 505/906/84 -f 508/908/73 510/283/3 507/909/73 -f 508/908/73 517/910/7 518/905/7 -f 527/911/7 536/912/12 528/913/12 -f 525/914/2 534/915/13 526/916/13 -f 523/917/6 532/918/27 524/919/27 -f 521/920/3 530/921/23 522/922/23 -f 528/913/12 529/923/3 521/920/3 -f 526/916/13 535/924/7 527/925/7 -f 524/919/27 533/926/2 525/914/2 -f 522/922/23 531/927/6 523/917/6 -f 542/928/207 543/193/208 541/929/208 -f 540/930/209 543/193/208 546/931/209 -f 544/194/207 539/932/210 545/933/210 -f 23/934/8 324/935/8 325/936/8 -f 555/937/211 557/938/212 553/939/212 -f 554/940/213 560/941/214 556/942/214 -f 560/941/214 555/937/211 556/942/214 -f 3/482/82 209/943/6 565/944/6 -f 565/944/6 63/945/23 1/946/81 -f 581/947/67 572/948/8 573/949/67 -f 579/950/66 570/951/6 571/952/66 -f 577/953/65 568/954/1 569/955/65 -f 575/956/64 566/957/7 567/958/64 -f 574/959/7 573/949/67 566/957/7 -f 580/960/8 571/952/66 572/948/8 -f 578/961/6 569/955/65 570/962/6 -f 576/963/1 567/958/64 568/954/1 -f 581/964/2 574/965/2 578/966/2 -f 18/294/14 22/305/23 6/295/15 -f 3/297/17 25/581/108 29/298/18 -f 18/294/14 16/314/30 30/303/22 -f 34/304/22 4/337/44 22/305/23 -f 18/294/14 30/303/22 22/305/23 -f 5/306/24 2/310/27 19/307/25 -f 20/302/21 19/307/25 268/300/20 -f 19/307/25 2/310/27 268/300/20 -f 2/310/27 27/579/106 271/309/20 -f 21/311/28 20/302/21 269/301/2 -f 6/295/15 5/306/24 15/308/26 -f 30/315/31 38/328/31 42/316/32 -f 33/318/33 41/327/40 39/319/34 -f 35/321/35 37/330/42 45/322/36 -f 35/321/35 43/323/37 40/324/38 -f 32/326/39 40/967/38 41/327/40 -f 31/320/34 39/319/34 38/328/31 -f 44/329/41 45/322/36 37/330/42 -f 34/317/32 42/316/32 44/329/41 -f 42/334/3 38/968/3 40/969/3 -f 38/968/3 39/970/3 40/969/3 -f 39/970/3 41/971/3 40/969/3 -f 40/969/3 43/972/3 42/334/3 -f 43/972/3 45/332/3 42/334/3 -f 4/337/44 34/304/22 36/335/3 -f 36/335/3 37/349/52 23/336/43 -f 24/338/45 1/973/124 48/339/46 -f 28/341/48 51/350/47 52/342/46 -f 53/344/49 9/974/3 8/345/50 -f 17/354/53 24/338/45 33/348/52 -f 24/338/45 47/340/47 33/348/52 -f 46/347/51 32/353/51 33/348/52 -f 37/349/52 35/351/51 28/341/48 -f 51/350/47 28/341/48 35/351/51 -f 32/353/51 46/347/51 50/352/51 -f 17/354/53 33/348/52 31/313/3 -f 79/355/54 80/388/55 78/356/55 -f 93/358/56 92/368/57 85/359/57 -f 91/361/58 93/358/56 86/360/56 -f 88/363/59 89/371/60 82/364/60 -f 94/366/6 91/361/58 84/362/58 -f 92/368/57 90/370/61 83/369/61 -f 90/370/61 88/363/59 81/365/59 -f 77/357/54 82/364/60 89/371/60 -f 82/975/3 77/357/3 81/976/3 -f 77/357/3 78/356/3 100/977/3 -f 78/356/3 97/978/3 98/979/3 -f 98/979/3 99/980/3 96/981/3 -f 100/977/3 95/373/3 77/357/3 -f 95/373/3 22/982/3 84/983/3 -f 98/979/3 96/981/3 78/356/3 -f 96/981/3 100/977/3 78/356/3 -f 83/984/3 81/976/3 77/357/3 -f 83/984/3 77/357/3 85/372/3 -f 95/373/3 84/983/3 86/985/3 -f 22/982/3 87/986/3 84/983/3 -f 95/373/3 86/985/3 85/372/3 -f 102/374/62 106/380/63 100/375/63 -f 104/377/1 105/382/64 99/378/64 -f 106/380/63 101/987/1 95/381/1 -f 105/382/64 102/374/62 96/376/62 -f 103/383/65 104/377/1 98/379/1 -f 103/988/2 80/388/2 104/989/2 -f 80/388/2 79/355/2 106/990/2 -f 104/989/2 80/388/2 102/991/2 -f 79/355/2 89/992/2 88/993/2 -f 79/355/2 88/993/2 90/994/2 -f 102/991/2 105/995/2 104/989/2 -f 2/996/2 101/387/2 91/997/2 -f 101/387/2 106/990/2 79/355/2 -f 91/997/2 101/387/2 93/386/2 -f 106/990/2 102/991/2 80/388/2 -f 79/355/2 90/994/2 92/385/2 -f 79/355/2 92/385/2 101/387/2 -f 91/997/2 94/998/2 2/996/2 -f 80/388/55 103/383/65 97/384/65 -f 132/389/64 131/402/1 123/390/1 -f 130/392/65 129/999/6 121/393/6 -f 128/395/66 127/405/8 119/396/8 -f 126/398/67 125/401/7 117/399/7 -f 125/401/7 132/389/64 124/391/64 -f 131/402/1 130/392/65 122/394/65 -f 129/403/6 128/395/66 120/397/66 -f 127/405/8 126/398/67 118/400/67 -f 125/407/3 126/1000/3 129/408/3 -f 126/1000/3 127/1001/3 129/408/3 -f 127/1001/3 128/1002/3 129/408/3 -f 129/408/3 130/1003/3 131/1004/3 -f 131/1004/3 132/406/3 129/408/3 -f 146/234/31 147/1005/67 134/409/67 -f 134/409/67 147/1005/67 148/410/8 -f 149/412/66 150/238/38 137/237/38 -f 135/414/8 148/1006/8 149/412/66 -f 47/415/8 48/421/8 153/416/8 -f 48/421/8 49/1007/8 152/422/8 -f 151/1008/13 156/633/13 168/428/69 -f 156/633/13 185/426/13 168/428/69 -f 165/429/11 305/438/11 304/430/70 -f 167/432/71 166/1009/9 158/433/9 -f 158/433/9 166/1009/9 160/435/10 -f 163/437/73 300/1010/111 305/438/11 -f 159/434/71 157/462/112 161/439/50 -f 165/442/8 164/1011/8 162/1012/8 -f 162/1012/8 160/1013/8 166/440/8 -f 166/440/8 167/1014/8 161/441/8 -f 161/441/8 163/1015/8 165/442/8 -f 165/442/8 162/1012/8 166/440/8 -f 154/417/8 155/420/8 159/419/8 -f 158/424/8 151/423/8 47/415/8 -f 154/417/8 159/419/8 158/424/8 -f 46/444/7 151/1008/7 168/428/7 -f 51/446/1 50/445/1 168/428/1 -f 52/448/1 51/446/1 169/447/1 -f 171/450/1 53/1016/1 52/448/1 -f 168/451/69 172/1017/68 173/452/74 -f 170/454/75 174/455/75 175/40/75 -f 169/453/74 173/452/74 174/455/76 -f 154/456/77 178/463/77 179/457/78 -f 152/239/79 176/39/79 177/459/79 -f 155/458/78 179/457/78 180/461/12 -f 153/460/80 177/459/80 178/463/77 -f 181/466/1 183/1018/1 184/464/1 -f 184/464/1 182/1019/1 180/465/1 -f 180/465/1 185/1020/1 181/466/1 -f 172/1021/1 185/1020/1 173/468/1 -f 185/1020/1 180/465/1 173/468/1 -f 180/465/1 179/1022/1 178/467/1 -f 178/467/1 177/471/1 174/469/1 -f 175/470/1 174/469/1 177/471/1 -f 65/475/12 10/1023/12 49/473/49 -f 10/1023/12 9/974/3 53/344/49 -f 53/344/49 49/473/49 10/1023/12 -f 11/476/7 10/1023/12 65/475/12 -f 63/1024/23 64/474/3 1/479/81 -f 64/474/3 49/473/49 1/479/81 -f 7/1025/10 13/499/2 3/482/82 -f 13/499/2 68/480/2 3/482/82 -f 54/483/49 203/1026/3 204/484/23 -f 199/485/7 198/492/13 59/486/13 -f 197/488/2 196/44/10 57/242/10 -f 200/490/12 199/485/7 60/487/7 -f 198/492/13 197/488/2 58/489/2 -f 191/493/13 67/497/13 187/494/84 -f 186/496/84 187/494/84 67/497/13 -f 188/498/84 186/496/84 68/480/2 -f 12/500/13 189/1027/13 188/498/84 -f 67/497/13 191/493/13 192/501/85 -f 193/502/70 189/1027/13 12/500/13 -f 66/477/7 192/501/85 193/502/70 -f 55/49/83 204/484/23 56/241/71 -f 56/241/71 201/46/71 55/49/83 -f 195/45/71 207/243/71 208/503/23 -f 205/504/23 208/503/23 206/505/3 -f 203/1028/3 54/43/49 61/491/12 -f 54/43/49 194/58/49 200/490/12 -f 194/58/49 206/1029/3 200/490/12 -f 65/1030/1 64/1031/1 63/507/1 -f 63/507/1 209/1032/1 62/508/1 -f 62/508/1 68/1033/1 67/509/1 -f 67/509/1 66/1034/1 65/1030/1 -f 65/1030/1 63/507/1 67/509/1 -f 225/510/86 224/534/91 216/511/6 -f 223/513/87 222/525/92 214/514/3 -f 221/516/88 220/526/93 212/517/7 -f 219/519/89 218/522/90 210/520/2 -f 218/522/90 225/510/86 217/512/27 -f 224/523/91 223/513/87 215/515/23 -f 222/525/92 221/516/88 213/518/12 -f 220/526/93 219/519/89 211/521/13 -f 229/527/94 228/1035/98 220/526/93 -f 227/528/95 226/1036/96 218/522/90 -f 226/529/96 233/1037/99 225/510/86 -f 232/530/97 231/1038/101 223/513/87 -f 222/525/92 230/1039/100 229/531/94 -f 228/532/98 227/1040/95 219/519/89 -f 233/533/99 232/1041/97 224/534/91 -f 223/513/87 231/1042/101 230/535/100 -f 234/536/2 241/548/27 233/537/99 -f 240/539/6 239/550/23 231/540/101 -f 238/542/3 237/551/12 229/543/94 -f 236/545/7 235/552/13 227/546/95 -f 241/548/27 240/1043/6 232/549/97 -f 239/550/23 238/542/3 230/544/100 -f 237/551/12 236/545/7 228/547/98 -f 235/552/13 234/536/2 226/538/96 -f 248/553/102 255/577/102 249/554/2 -f 262/556/6 266/1044/6 267/557/27 -f 244/559/12 251/807/12 252/560/3 -f 260/562/3 259/1045/103 247/563/103 -f 245/561/3 252/560/3 253/565/104 -f 242/555/2 249/554/2 250/567/13 -f 260/562/3 264/564/3 265/569/23 -f 256/571/2 258/574/2 254/572/105 -f 263/558/27 267/557/27 258/574/2 -f 261/570/23 265/569/23 266/575/6 -f 247/563/103 259/1045/103 246/566/104 -f 257/573/105 254/572/105 255/577/102 -f 26/580/107 273/583/29 272/578/2 -f 272/578/2 271/309/20 27/579/106 -f 25/581/108 21/311/28 270/312/29 -f 275/582/109 274/1046/109 29/298/18 -f 29/298/18 274/1046/109 273/583/29 -f 273/584/42 279/602/36 278/585/41 -f 272/586/41 278/585/41 277/587/32 -f 271/588/32 277/587/32 276/589/31 -f 275/591/39 281/1047/38 280/592/37 -f 269/594/34 282/597/34 283/595/40 -f 268/590/31 276/589/31 282/597/34 -f 283/595/40 281/1048/38 275/598/39 -f 282/601/2 276/1049/2 281/599/2 -f 276/1049/2 277/1050/2 281/599/2 -f 277/1050/2 278/1051/2 279/1052/2 -f 279/1052/2 280/1053/2 277/1050/2 -f 280/1053/2 281/599/2 277/1050/2 -f 274/593/35 280/592/37 279/602/36 -f 299/603/64 298/616/1 290/604/1 -f 297/606/65 296/1054/6 288/607/6 -f 295/609/66 294/619/8 286/610/8 -f 293/612/67 292/615/7 284/613/7 -f 292/615/7 299/603/64 291/605/64 -f 298/616/1 297/606/65 289/608/65 -f 296/617/6 295/609/66 287/611/66 -f 294/619/8 293/612/67 285/614/67 -f 292/622/3 293/1055/3 294/1056/3 -f 294/1056/3 295/1057/3 296/620/3 -f 296/620/3 297/1058/3 298/621/3 -f 298/621/3 299/1059/3 292/622/3 -f 292/622/3 294/1056/3 296/620/3 -f 304/430/70 303/1060/110 162/623/84 -f 310/624/70 311/627/11 184/625/11 -f 311/627/11 306/631/111 182/628/73 -f 309/629/110 310/624/70 183/626/70 -f 300/632/111 163/437/73 161/439/50 -f 157/462/112 180/461/3 306/631/111 -f 180/461/3 182/628/73 306/631/111 -f 300/632/111 161/439/50 157/462/112 -f 156/633/72 160/1061/10 303/634/110 -f 160/1061/10 162/623/84 303/634/110 -f 181/630/84 185/426/2 309/635/110 -f 185/426/2 156/633/72 309/635/110 -f 15/636/26 319/640/114 318/637/113 -f 19/639/25 320/642/116 319/640/114 -f 19/639/25 20/644/21 321/641/115 -f 21/643/28 312/646/117 321/641/115 -f 25/645/108 313/648/118 312/646/117 -f 18/650/14 14/638/16 318/637/113 -f 18/650/14 317/651/120 316/652/121 -f 16/653/30 316/652/121 315/654/122 -f 24/656/45 17/655/53 315/654/122 -f 322/660/7 3/1062/7 1/661/7 -f 313/1063/1 322/660/1 323/662/1 -f 314/663/1 315/1064/1 317/664/1 -f 315/1064/1 316/1065/1 317/664/1 -f 313/1063/1 323/662/1 314/663/1 -f 321/665/1 312/1066/1 313/1063/1 -f 319/1067/1 320/1068/1 321/665/1 -f 317/664/1 318/1069/1 321/665/1 -f 318/1069/1 319/1067/1 321/665/1 -f 321/665/1 313/1063/1 314/663/1 -f 242/666/1 243/1070/1 431/667/1 -f 431/667/1 432/851/1 246/258/1 -f 432/851/1 244/1071/1 245/1072/1 -f 246/258/1 432/851/1 245/1072/1 -f 246/258/1 248/69/1 431/667/1 -f 350/677/129 351/683/135 331/678/130 -f 338/680/132 358/777/178 359/681/133 -f 351/683/135 352/769/138 332/684/136 -f 359/681/133 360/780/179 340/685/137 -f 352/686/138 353/691/129 333/687/131 -f 340/685/137 360/780/179 361/689/139 -f 353/691/129 354/698/135 334/692/130 -f 346/693/141 347/700/141 327/694/141 -f 341/690/140 361/689/139 362/696/142 -f 354/698/135 355/748/138 335/699/136 -f 347/700/143 348/705/149 328/701/144 -f 362/696/142 363/707/146 343/702/146 -f 348/705/149 349/773/138 329/706/136 -f 363/707/146 364/1073/8 344/708/8 -f 356/709/150 357/713/171 337/710/151 -f 349/711/138 350/677/129 330/679/131 -f 357/713/153 358/777/178 338/680/132 -f 367/715/156 366/714/155 328/701/144 -f 370/717/156 369/718/158 331/678/130 -f 373/720/156 372/721/158 334/692/130 -f 356/709/165 336/704/148 335/699/136 -f 354/698/135 385/766/175 386/765/174 -f 351/683/135 382/770/175 383/768/174 -f 348/705/149 379/774/177 380/772/174 -f 400/110/180 401/107/181 394/92/181 -f 403/104/182 404/102/183 397/98/183 -f 401/107/181 402/105/184 395/94/184 -f 399/111/1 400/110/180 393/91/180 -f 404/102/183 405/101/185 398/99/185 -f 402/105/184 403/104/182 396/96/182 -f 407/89/186 418/789/186 419/788/8 -f 408/264/187 417/791/187 418/789/186 -f 409/790/188 413/1074/188 417/791/187 -f 414/792/189 413/1074/188 409/790/188 -f 415/794/190 414/792/189 410/793/189 -f 416/796/191 415/794/190 411/795/190 -f 435/805/199 431/837/199 243/568/13 -f 244/559/12 432/828/200 434/806/200 -f 435/809/8 250/1075/8 249/1076/8 -f 249/1076/8 255/1077/8 435/809/8 -f 255/1077/8 253/810/8 435/809/8 -f 253/810/8 252/1078/8 434/808/8 -f 252/1078/8 251/1079/8 434/808/8 -f 425/811/1 426/826/1 448/812/1 -f 440/814/3 441/872/23 428/815/23 -f 437/817/13 438/825/7 425/811/7 -f 442/819/27 436/833/2 423/820/2 -f 441/822/23 444/1080/201 433/823/201 -f 438/825/7 439/830/12 426/826/12 -f 444/827/201 434/806/200 432/828/200 -f 439/830/12 440/814/3 427/816/3 -f 443/831/202 442/819/27 429/821/27 -f 436/833/2 437/817/13 424/818/13 -f 453/834/3 460/861/12 452/835/12 -f 431/837/199 435/805/199 443/831/202 -f 426/826/1 427/816/1 449/838/1 -f 428/815/1 450/1081/1 449/840/1 -f 425/811/1 447/1082/1 446/841/1 -f 424/818/1 446/1083/1 445/842/1 -f 423/820/1 445/1084/1 452/843/1 -f 430/844/1 429/821/1 452/845/1 -f 433/847/1 451/1085/1 450/848/1 -f 432/851/1 431/667/1 451/849/1 -f 431/667/1 430/1086/1 451/849/1 -f 459/852/7 458/863/13 450/853/13 -f 457/855/2 456/864/27 448/856/27 -f 455/858/6 454/865/23 446/859/23 -f 460/861/12 459/1087/7 451/862/7 -f 458/863/13 457/855/2 449/857/2 -f 456/864/27 455/858/6 447/860/6 -f 454/865/23 453/834/3 445/836/3 -f 454/866/8 455/1088/8 438/825/8 -f 453/867/8 454/1089/8 437/817/8 -f 460/868/8 453/1090/8 436/833/8 -f 438/825/8 455/1091/8 456/869/8 -f 439/830/8 456/1092/8 457/870/8 -f 457/871/8 458/1093/8 441/872/8 -f 443/873/8 459/1094/8 460/874/8 -f 458/875/8 459/1095/8 444/876/8 -f 435/809/8 434/808/8 459/877/8 -f 434/808/8 444/1096/8 459/877/8 -f 480/879/203 499/892/203 502/880/204 -f 488/882/7 493/896/64 492/883/64 -f 487/885/67 488/882/7 485/884/7 -f 491/887/7 496/891/7 495/888/67 -f 489/890/64 494/898/64 496/891/7 -f 480/879/203 490/889/67 495/888/67 -f 487/885/67 486/886/67 473/893/203 -f 479/895/205 492/883/64 493/896/64 -f 494/898/64 489/890/64 476/899/205 -f 503/901/206 500/900/205 476/899/205 -f 497/894/203 473/893/203 475/902/204 -f 479/895/205 498/897/205 504/904/206 -f 518/905/7 517/910/7 505/906/84 -f 512/162/2 511/161/2 506/907/84 -f 508/908/73 509/158/3 510/283/3 -f 508/908/73 507/909/73 517/910/7 -f 527/911/7 535/1097/7 536/912/12 -f 525/914/2 533/926/2 534/915/13 -f 523/917/6 531/927/6 532/918/27 -f 521/920/3 529/923/3 530/921/23 -f 528/913/12 536/912/12 529/923/3 -f 526/916/13 534/915/13 535/924/7 -f 524/919/27 532/918/27 533/926/2 -f 522/922/23 530/921/23 531/927/6 -f 542/928/207 544/194/207 543/193/208 -f 540/930/209 541/929/208 543/193/208 -f 544/194/207 542/928/207 539/932/210 -f 26/1098/8 27/1099/8 4/1100/8 -f 27/1099/8 2/1101/8 22/1102/8 -f 2/1101/8 94/1103/8 87/1104/8 -f 22/1102/8 4/1100/8 27/1099/8 -f 4/1100/8 23/934/8 26/1098/8 -f 2/1101/8 87/1104/8 22/1102/8 -f 325/936/8 26/1098/8 23/934/8 -f 421/1105/8 420/1106/8 422/1107/8 -f 420/1106/8 325/936/8 324/935/8 -f 324/935/8 422/1107/8 420/1106/8 -f 555/937/211 558/1108/211 557/938/212 -f 554/940/213 559/1109/213 560/941/214 -f 560/941/214 558/1108/211 555/937/211 -f 3/482/82 62/481/27 209/943/6 -f 565/944/6 209/943/6 63/945/23 -f 581/947/67 580/960/8 572/948/8 -f 579/950/66 578/1110/6 570/951/6 -f 577/953/65 576/963/1 568/954/1 -f 575/956/64 574/959/7 566/957/7 -f 574/959/7 581/947/67 573/949/67 -f 580/960/8 579/950/66 571/952/66 -f 578/961/6 577/953/65 569/955/65 -f 576/963/1 575/956/64 567/958/64 -f 574/965/2 575/1111/2 578/966/2 -f 575/1111/2 576/1112/2 578/966/2 -f 576/1112/2 577/1113/2 578/966/2 -f 578/966/2 579/1114/2 580/1115/2 -f 580/1115/2 581/964/2 578/966/2 -o Bullet -v -0.254503 -0.186101 -0.099231 -v -0.260095 -0.119658 -0.072726 -v -0.262212 -0.091329 -0.006836 -v -0.259614 -0.117709 0.059841 -v -0.253822 -0.183345 0.088247 -v -0.248230 -0.249788 0.061742 -v -0.246113 -0.278117 -0.004148 -v -0.248711 -0.251737 -0.070825 -v -0.129965 -0.175376 -0.099841 -v -0.135558 -0.108933 -0.073336 -v -0.137674 -0.080604 -0.007446 -v -0.135076 -0.106984 0.059231 -v -0.129284 -0.172620 0.087637 -v -0.123692 -0.239063 0.061132 -v -0.121575 -0.267392 -0.004758 -v -0.124174 -0.241012 -0.071436 -v 0.056954 -0.158829 -0.069510 -v 0.053226 -0.114534 -0.051840 -v 0.051815 -0.095648 -0.007913 -v 0.053547 -0.113234 0.036538 -v 0.057409 -0.156991 0.055475 -v 0.061137 -0.201287 0.037805 -v 0.062548 -0.220173 -0.006122 -v 0.060816 -0.202586 -0.050573 -v 0.181719 -0.147185 -0.007628 -v -1.375568 -0.283547 -0.156232 -v -1.384888 -0.172808 -0.112057 -v -1.388416 -0.125593 -0.002240 -v -1.384085 -0.169560 0.108889 -v -1.374432 -0.278953 0.156232 -v -1.365112 -0.389692 0.112057 -v -1.361584 -0.436907 0.002240 -v -1.365915 -0.392940 -0.108889 -v -0.628343 -0.219196 -0.159893 -v -0.637663 -0.108457 -0.115718 -v -0.641191 -0.061242 -0.005901 -v -0.636860 -0.105209 0.105228 -v -0.627207 -0.214602 0.152571 -v -0.617887 -0.325341 0.108395 -v -0.614359 -0.372556 -0.001422 -v -0.618690 -0.328589 -0.112550 -v -0.254616 -0.186561 -0.130478 -v -0.262073 -0.097970 -0.095137 -v -0.264895 -0.060198 -0.007284 -v -0.261431 -0.095371 0.081619 -v -0.253708 -0.182886 0.119494 -v -0.246252 -0.271477 0.084153 -v -0.243429 -0.309249 -0.003700 -v -0.246894 -0.274075 -0.092603 -v -0.503692 -0.208011 -0.129257 -v -0.511148 -0.119420 -0.093917 -v -0.513970 -0.081648 -0.006063 -v -0.510506 -0.116821 0.082840 -v -0.502783 -0.204336 0.120714 -v -0.495327 -0.292927 0.085374 -v -0.492504 -0.330699 -0.002480 -v -0.495969 -0.295526 -0.091383 -vt 0.776062 0.513514 -vt 0.772201 0.505791 -vt 0.776062 0.505791 -vt 0.799228 0.513514 -vt 0.795367 0.505791 -vt 0.799228 0.505791 -vt 0.791506 0.513514 -vt 0.787645 0.505791 -vt 0.791506 0.505791 -vt 0.783784 0.513514 -vt 0.779923 0.505791 -vt 0.783784 0.505791 -vt 0.772201 0.513514 -vt 0.768340 0.505791 -vt 0.795367 0.513514 -vt 0.787645 0.513514 -vt 0.779923 0.513514 -vt 0.772201 0.525097 -vt 0.768340 0.513514 -vt 0.795367 0.525097 -vt 0.787645 0.525097 -vt 0.779923 0.525097 -vt 0.776062 0.525097 -vt 0.791506 0.525097 -vt 0.783784 0.525097 -vt 0.774131 0.532819 -vt 0.781853 0.532819 -vt 0.785714 0.532819 -vt 0.793436 0.532819 -vt 0.768340 0.525097 -vt 0.770270 0.532819 -vt 0.777992 0.532819 -vt 0.789575 0.532819 -vt 0.799228 0.525097 -vt 0.797297 0.532819 -vt 0.745174 0.494208 -vt 0.698842 0.501930 -vt 0.698842 0.494208 -vt 0.745174 0.509652 -vt 0.698842 0.517375 -vt 0.698842 0.509652 -vt 0.745174 0.525097 -vt 0.698842 0.532819 -vt 0.698842 0.525097 -vt 0.745174 0.532819 -vt 0.698842 0.540541 -vt 0.745174 0.486486 -vt 0.698842 0.486486 -vt 0.745174 0.501930 -vt 0.745174 0.517375 -vt 0.745174 0.540541 -vt 0.698842 0.548263 -vt 0.768340 0.517375 -vt 0.752896 0.509652 -vt 0.768340 0.509652 -vt 0.768340 0.532819 -vt 0.752896 0.525097 -vt 0.768340 0.525097 -vt 0.768340 0.540541 -vt 0.752896 0.532819 -vt 0.768340 0.494208 -vt 0.752896 0.486486 -vt 0.768340 0.486486 -vt 0.752896 0.501930 -vt 0.768340 0.501930 -vt 0.752896 0.517375 -vt 0.768340 0.548263 -vt 0.752896 0.540541 -vt 0.752896 0.494208 -vt 0.752896 0.494981 -vt 0.752896 0.501158 -vt 0.752896 0.502703 -vt 0.752896 0.508880 -vt 0.752896 0.516602 -vt 0.752896 0.524324 -vt 0.752896 0.525869 -vt 0.752896 0.532046 -vt 0.752896 0.539768 -vt 0.752896 0.547490 -vt 0.745174 0.548263 -vt 0.752896 0.493436 -vt 0.795367 0.501930 -vt 0.787645 0.494208 -vt 0.795367 0.486486 -vt 0.777992 0.486486 -vt 0.768340 0.496139 -vt 0.777992 0.505791 -vt 0.752896 0.548263 -vt 0.752896 0.510425 -vt 0.752896 0.518147 -vt 0.752896 0.533591 -vt 0.752896 0.541313 -vt 0.752896 0.487259 -vt 0.803089 0.494208 -vt 0.800827 0.499669 -vt 0.789907 0.499669 -vt 0.789907 0.488748 -vt 0.800827 0.488748 -vt 0.784818 0.502964 -vt 0.787645 0.496139 -vt 0.784818 0.489314 -vt 0.771167 0.489314 -vt 0.771167 0.502964 -vn 0.0770 -0.0077 -0.9970 -vn 0.0581 -0.7148 -0.6969 -vn -0.0036 -0.0147 -0.9999 -vn 0.1662 -0.9860 0.0139 -vn 0.0633 -0.6940 0.7172 -vn 0.0859 -0.9962 0.0143 -vn 0.0842 0.0216 0.9962 -vn -0.0581 0.7148 0.6969 -vn 0.0036 0.0147 0.9999 -vn -0.0050 0.9999 -0.0147 -vn -0.0633 0.6940 -0.7172 -vn -0.0859 0.9962 -0.0143 -vn 0.1385 -0.7055 -0.6950 -vn 0.1437 -0.6848 0.7144 -vn 0.0226 0.7194 0.6942 -vn 0.0175 0.6987 -0.7152 -vn 0.3534 -0.6564 -0.6665 -vn 0.3583 -0.6366 0.6829 -vn 0.2425 0.7078 0.6635 -vn 0.2376 0.6879 -0.6858 -vn 0.2945 0.0116 -0.9556 -vn 0.3014 0.0397 0.9527 -vn 0.2160 0.9763 -0.0151 -vn 0.9963 0.0858 -0.0049 -vn 0.3799 -0.9250 0.0122 -vn 0.1811 -0.6789 0.7115 -vn 0.0605 0.7199 0.6914 -vn 0.0554 0.6993 -0.7127 -vn 0.1147 -0.0044 -0.9934 -vn 0.2035 -0.9790 0.0137 -vn 0.1219 0.0248 0.9922 -vn 0.0330 0.9993 -0.0148 -vn 0.1760 -0.6996 -0.6925 -vn 0.0678 0.7199 0.6907 -vn 0.0627 0.6993 -0.7121 -vn 0.1219 -0.0038 -0.9925 -vn 0.2107 -0.9775 0.0136 -vn 0.1291 0.0254 0.9913 -vn 0.0403 0.9991 -0.0148 -vn 0.1832 -0.6983 -0.6920 -vn 0.1883 -0.6777 0.7108 -vn -0.9963 -0.0858 0.0049 -s 1 -f 590/1116/215 589/1117/216 582/1118/217 -f 596/1119/218 587/1120/219 588/1121/220 -f 594/1122/221 585/1123/222 586/1124/223 -f 592/1125/224 583/1126/225 584/1127/226 -f 597/1128/227 588/1129/220 589/1117/216 -f 595/1130/228 586/1124/223 587/1120/219 -f 593/1131/229 584/1127/226 585/1123/222 -f 591/1132/230 582/1118/217 583/1126/225 -f 605/1133/231 596/1134/218 597/1128/227 -f 603/1135/232 594/1122/221 595/1130/228 -f 601/1136/233 592/1125/224 593/1131/229 -f 599/1137/234 590/1116/215 591/1132/230 -f 598/1138/235 597/1128/227 590/1116/215 -f 596/1119/218 603/1135/232 595/1130/228 -f 602/1139/236 593/1131/229 594/1122/221 -f 600/1140/237 591/1132/230 592/1125/224 -f 605/1133/231 598/1138/235 606/1141/238 -f 599/1137/234 600/1140/237 606/1142/238 -f 600/1140/237 601/1136/233 606/1143/238 -f 602/1139/236 603/1135/232 606/1144/238 -f 604/1145/239 605/1133/231 606/1146/238 -f 598/1138/235 599/1137/234 606/1147/238 -f 601/1136/233 602/1139/236 606/1148/238 -f 603/1135/232 604/1149/239 606/1150/238 -f 620/1151/240 611/1152/223 612/1153/219 -f 618/1154/241 609/1155/226 610/1156/222 -f 616/1157/242 607/1158/217 608/1159/225 -f 615/1160/243 614/1161/216 607/1158/217 -f 621/1162/244 612/1153/219 613/1163/220 -f 619/1164/245 610/1156/222 611/1152/223 -f 617/1165/246 608/1159/225 609/1155/226 -f 622/1166/247 613/1167/220 614/1161/216 -f 625/1168/226 634/1169/248 626/1170/222 -f 623/1171/217 632/1172/249 624/1173/225 -f 630/1174/216 631/1175/250 623/1171/217 -f 628/1176/219 637/1177/251 629/1178/220 -f 626/1170/222 635/1179/252 627/1180/223 -f 624/1173/225 633/1181/253 625/1168/226 -f 629/1182/220 638/1183/254 630/1174/216 -f 627/1180/223 636/1184/255 628/1176/219 -f 619/1164/245 636/1185/255 635/1186/252 -f 618/1154/241 635/1187/252 634/1188/248 -f 618/1154/241 633/1189/253 617/1165/246 -f 617/1165/246 632/1190/249 616/1157/242 -f 615/1160/243 632/1191/249 631/1192/250 -f 615/1160/243 638/1193/254 622/1166/247 -f 622/1166/247 637/1194/251 621/1195/244 -f 621/1162/244 636/1196/255 620/1151/240 -f 625/1197/238 627/1198/238 629/1199/238 -f 613/1200/256 611/1201/256 609/1202/256 -f 590/1116/215 597/1128/227 589/1117/216 -f 596/1119/218 595/1130/228 587/1120/219 -f 594/1122/221 593/1131/229 585/1123/222 -f 592/1125/224 591/1132/230 583/1126/225 -f 597/1128/227 596/1134/218 588/1129/220 -f 595/1130/228 594/1122/221 586/1124/223 -f 593/1131/229 592/1125/224 584/1127/226 -f 591/1132/230 590/1116/215 582/1118/217 -f 605/1133/231 604/1145/239 596/1134/218 -f 603/1135/232 602/1139/236 594/1122/221 -f 601/1136/233 600/1140/237 592/1125/224 -f 599/1137/234 598/1138/235 590/1116/215 -f 598/1138/235 605/1133/231 597/1128/227 -f 596/1119/218 604/1149/239 603/1135/232 -f 602/1139/236 601/1136/233 593/1131/229 -f 600/1140/237 599/1137/234 591/1132/230 -f 620/1151/240 619/1164/245 611/1152/223 -f 618/1154/241 617/1165/246 609/1155/226 -f 616/1157/242 615/1160/243 607/1158/217 -f 615/1160/243 622/1166/247 614/1161/216 -f 621/1162/244 620/1151/240 612/1153/219 -f 619/1164/245 618/1154/241 610/1156/222 -f 617/1165/246 616/1157/242 608/1159/225 -f 622/1166/247 621/1195/244 613/1167/220 -f 625/1168/226 633/1181/253 634/1169/248 -f 623/1171/217 631/1175/250 632/1172/249 -f 630/1174/216 638/1183/254 631/1175/250 -f 628/1176/219 636/1184/255 637/1177/251 -f 626/1170/222 634/1169/248 635/1179/252 -f 624/1173/225 632/1172/249 633/1181/253 -f 629/1182/220 637/1203/251 638/1183/254 -f 627/1180/223 635/1179/252 636/1184/255 -f 619/1164/245 620/1151/240 636/1185/255 -f 618/1154/241 619/1164/245 635/1187/252 -f 618/1154/241 634/1204/248 633/1189/253 -f 617/1165/246 633/1205/253 632/1190/249 -f 615/1160/243 616/1157/242 632/1191/249 -f 615/1160/243 631/1206/250 638/1193/254 -f 622/1166/247 638/1207/254 637/1194/251 -f 621/1162/244 637/1208/251 636/1196/255 -f 623/1209/238 624/1210/238 625/1197/238 -f 625/1197/238 626/1211/238 627/1198/238 -f 627/1198/238 628/1212/238 629/1199/238 -f 629/1199/238 630/1213/238 623/1209/238 -f 623/1209/238 625/1197/238 629/1199/238 -f 609/1202/256 608/1214/256 607/1215/256 -f 607/1215/256 614/1216/256 613/1200/256 -f 613/1200/256 612/1217/256 611/1201/256 -f 611/1201/256 610/1218/256 609/1202/256 -f 609/1202/256 607/1215/256 613/1200/256 -o Guide_And_Bolt -v 0.125000 0.625000 0.156250 -v 0.125000 0.468750 0.093750 -v 0.125000 0.343750 0.281250 -v 0.125000 0.218750 0.343750 -v 0.125000 0.625000 -0.156250 -v 0.125000 0.468750 -0.093750 -v 0.125000 0.343750 -0.281250 -v 0.125000 0.218750 -0.343750 -v 0.125000 0.218750 0.093750 -v 0.125000 0.093750 0.218750 -v 0.125000 0.218750 -0.093750 -v 0.125000 0.093750 -0.218750 -v -1.750000 0.218750 0.343750 -v -1.750000 0.343750 0.281250 -v -1.750000 0.468750 0.093750 -v -1.750000 0.625000 0.156250 -v 0.875000 0.218750 0.093750 -v 0.875000 0.093750 0.218750 -v 0.875000 0.218750 -0.093750 -v 0.875000 0.093750 -0.218750 -v 0.875000 -0.093750 0.218750 -v 0.875000 -0.093750 -0.218750 -v 0.875000 -0.218750 0.093750 -v 0.875000 -0.218750 -0.093750 -v 0.125000 0.735485 -0.110486 -v 0.125000 0.781250 0.000000 -v 0.125000 0.514515 0.110486 -v 0.125000 0.468750 0.000000 -v 0.125000 0.514515 -0.110485 -v 5.125000 0.625000 -0.156250 -v 5.125000 0.735485 -0.110486 -v 5.125000 0.781250 0.000000 -v 5.125000 0.735485 0.110486 -v 5.125000 0.625000 0.156250 -v 5.125000 0.514515 0.110486 -v 5.125000 0.468750 0.000000 -v 5.125000 0.514515 -0.110485 -vt 0.347490 0.509652 -vt 0.335907 0.494208 -vt 0.347490 0.498069 -vt 0.355212 0.521236 -vt 0.355212 0.486486 -vt 0.370656 0.490348 -vt 0.362934 0.498069 -vt 0.362934 0.482625 -vt 0.370656 0.517375 -vt 0.362934 0.525097 -vt 0.362934 0.509652 -vt 0.335907 0.517375 -vt 0.220077 0.505791 -vt 0.335907 0.505791 -vt 0.262548 0.471042 -vt 0.208494 0.482625 -vt 0.208494 0.471042 -vt 0.262548 0.447876 -vt 0.208494 0.459459 -vt 0.208494 0.447876 -vt 0.335907 0.490348 -vt 0.220077 0.482625 -vt 0.335907 0.482625 -vt 0.262548 0.459459 -vt 0.220077 0.490348 -vt 0.270270 0.474903 -vt 0.262548 0.455598 -vt 0.281853 0.447876 -vt 0.598456 0.440154 -vt 0.289575 0.447876 -vt 0.289575 0.440154 -vt 0.289575 0.471042 -vt 0.598456 0.463320 -vt 0.598456 0.471042 -vt 0.598456 0.432432 -vt 0.289575 0.432432 -vt 0.598456 0.447876 -vt 0.289575 0.455598 -vt 0.289575 0.463320 -vt 0.598456 0.455598 -vt 0.598456 0.461390 -vt 0.608108 0.451737 -vt 0.617761 0.461390 -vt 0.335907 0.513514 -vt 0.220077 0.517375 -vt 0.262548 0.482625 -vt 0.262548 0.467181 -vt 0.270270 0.447876 -vt 0.289575 0.455598 -vt 0.289575 0.467181 -vt 0.281853 0.474903 -vt 0.598456 0.455598 -vt 0.289575 0.455598 -vt 0.614933 0.468215 -vt 0.608108 0.471042 -vt 0.601283 0.468215 -vt 0.601283 0.454565 -vt 0.614933 0.454565 -vn 1.0000 0.0000 0.0000 -vn 0.0000 -0.3714 0.9285 -vn 0.0000 0.2966 0.9550 -vn 0.0000 0.9239 -0.3827 -vn 0.0000 0.7071 -0.7071 -vn 0.0000 0.7071 0.7071 -vn 0.0000 0.9239 0.3827 -vn 0.0000 0.6618 0.7497 -vn 0.0000 0.4472 0.8944 -vn 0.0000 -1.0000 -0.0000 -vn 0.0000 -0.7071 0.7071 -vn 0.0000 -0.9239 -0.3827 -vn 0.0000 -0.3827 0.9239 -vn 0.0000 0.3827 -0.9239 -vn -1.0000 0.0000 0.0000 -s 1 -f 644/1219/257 639/1220/257 640/1221/257 -f 645/1222/257 640/1221/257 641/1223/257 -f 648/1224/257 647/1225/257 642/1226/257 -f 650/1227/257 646/1228/257 649/1229/257 -f 649/1229/257 646/1228/257 645/1222/257 -f 639/1230/258 653/1231/259 640/1232/259 -f 657/1233/260 650/1234/261 649/1235/260 -f 656/1236/262 647/1237/263 648/1238/262 -f 641/1239/264 651/1240/265 642/1241/265 -f 655/1242/263 649/1235/260 647/1237/263 -f 640/1232/259 652/1243/264 641/1239/264 -f 655/1244/257 659/1245/257 662/1246/257 -f 674/1247/266 665/1248/267 666/1249/266 -f 670/1250/260 663/1251/261 664/1252/260 -f 675/1253/268 666/1249/266 667/1254/268 -f 673/1255/267 639/1256/269 665/1248/267 -f 669/1257/261 643/1258/270 663/1251/261 -f 674/1259/271 672/1260/271 670/1261/271 -f 644/1219/257 643/1262/257 639/1220/257 -f 645/1222/257 644/1219/257 640/1221/257 -f 645/1222/257 641/1223/257 647/1225/257 -f 641/1223/257 642/1226/257 647/1225/257 -f 647/1225/257 649/1229/257 645/1222/257 -f 639/1230/258 654/1263/258 653/1231/259 -f 657/1233/260 658/1264/261 650/1234/261 -f 656/1236/262 655/1242/263 647/1237/263 -f 641/1239/264 652/1243/264 651/1240/265 -f 655/1242/263 657/1233/260 649/1235/260 -f 640/1232/259 653/1231/259 652/1243/264 -f 655/1244/257 656/1265/257 659/1245/257 -f 659/1245/257 661/1266/257 662/1246/257 -f 662/1246/257 660/1267/257 658/1268/257 -f 658/1268/257 657/1269/257 662/1246/257 -f 657/1269/257 655/1244/257 662/1246/257 -f 674/1247/266 673/1255/267 665/1248/267 -f 670/1250/260 669/1257/261 663/1251/261 -f 675/1253/268 674/1247/266 666/1249/266 -f 673/1255/267 672/1270/269 639/1256/269 -f 669/1257/261 668/1271/270 643/1258/270 -f 670/1261/271 669/1272/271 668/1273/271 -f 668/1273/271 675/1274/271 670/1261/271 -f 675/1274/271 674/1259/271 670/1261/271 -f 674/1259/271 673/1275/271 672/1260/271 -f 672/1260/271 671/1276/271 670/1261/271 -o Handle -v 5.218752 0.545839 0.034864 -v 5.343752 0.545839 0.034864 -v 5.156252 0.593674 -0.080621 -v 5.343752 0.665427 -0.253848 -v 5.156252 0.713263 -0.369333 -v 5.343752 0.737180 -0.427076 -v 5.593752 0.665427 -0.253848 -v 5.593752 0.737180 -0.427076 -v 5.218752 0.656323 0.080628 -v 5.343752 0.656323 0.080628 -v 5.156252 0.704159 -0.034857 -v 5.343752 0.775912 -0.208084 -v 5.156252 0.823748 -0.323569 -v 5.343752 0.847665 -0.381311 -v 5.593752 0.775912 -0.208084 -v 5.593752 0.847665 -0.381311 -v 5.656252 0.905408 -0.357394 -v 5.656252 0.679438 -0.450993 -v 6.031252 0.905408 -0.357394 -v 6.031252 0.679438 -0.450993 -v 5.656252 0.833655 -0.184166 -v 5.656252 0.607685 -0.277766 -v 5.968752 0.833655 -0.184166 -v 5.968752 0.607685 -0.277766 -vt 0.277992 0.416988 -vt 0.285714 0.409266 -vt 0.285714 0.416988 -vt 0.258687 0.409266 -vt 0.277992 0.409266 -vt 0.243243 0.416988 -vt 0.258687 0.416988 -vt 0.343629 0.420849 -vt 0.339768 0.416988 -vt 0.339768 0.409266 -vt 0.258687 0.378378 -vt 0.239382 0.389961 -vt 0.235521 0.378378 -vt 0.239382 0.436293 -vt 0.258687 0.447876 -vt 0.235521 0.447876 -vt 0.243243 0.409266 -vt 0.343629 0.405405 -vt 0.366795 0.405405 -vt 0.366795 0.420849 -vt 0.258687 0.389961 -vt 0.258687 0.436293 -vt 0.277992 0.436293 -vt 0.289575 0.424710 -vt 0.262548 0.447876 -vt 0.277992 0.447876 -vt 0.277992 0.389961 -vt 0.289575 0.382239 -vt 0.289575 0.401544 -vt 0.262548 0.378378 -vt 0.277992 0.378378 -vt 0.324324 0.416988 -vt 0.293436 0.416988 -vt 0.312741 0.409266 -vt 0.312741 0.416988 -vt 0.293436 0.409266 -vt 0.324324 0.409266 -vt 0.239382 0.405405 -vt 0.239382 0.420849 -vt 0.262548 0.389961 -vt 0.262548 0.436293 -vt 0.220077 0.420849 -vt 0.220077 0.405405 -vt 0.208494 0.420849 -vt 0.289575 0.444015 -vt 0.208494 0.405405 -vn 0.0000 -0.3827 0.9239 -vn 1.0000 0.0000 0.0000 -vn 0.0000 0.3827 -0.9239 -vn -0.0000 0.9239 0.3827 -vn 0.0000 -0.9239 -0.3827 -vn -0.3827 -0.8536 -0.3536 -vn -0.3827 0.8536 0.3536 -vn -0.1602 0.3777 -0.9119 -vn -0.9732 -0.0879 0.2123 -vn -1.0000 -0.0000 0.0000 -vn -0.8944 -0.1711 0.4132 -vn -0.3162 0.3630 -0.8765 -vn -0.7071 0.6533 0.2706 -vn -0.7071 -0.6533 -0.2706 -vn 0.5847 -0.3104 0.7495 -vn 0.9487 -0.1210 0.2922 -s off -f 677/1277/272 684/1278/272 676/1279/272 -f 677/1277/273 687/1280/273 685/1281/273 -f 682/1282/272 687/1280/272 679/1283/272 -f 693/1284/274 683/1285/274 691/1286/274 -f 692/1287/275 698/1288/275 694/1289/275 -f 699/1290/276 693/1291/276 695/1292/276 -f 677/1277/272 685/1281/272 684/1278/272 -f 677/1277/273 679/1283/273 687/1280/273 -f 682/1282/272 690/1293/272 687/1280/272 -f 691/1286/274 692/1294/274 693/1284/274 -f 692/1294/274 694/1295/274 693/1284/274 -f 694/1295/274 695/1296/274 693/1284/274 -f 692/1287/275 696/1297/275 698/1288/275 -f 699/1290/276 697/1298/276 693/1291/276 -s 1 -f 679/1299/276 677/1277/276 678/1300/276 -f 683/1301/277 679/1299/276 681/1302/276 -f 687/1303/275 688/1304/275 686/1305/275 -f 687/1303/275 691/1306/278 689/1307/275 -f 681/1308/279 691/1286/274 683/1285/274 -f 678/1309/280 688/1310/281 680/1311/281 -f 676/1279/282 686/1312/280 678/1309/280 -f 680/1311/283 689/1313/279 681/1308/279 -f 696/1314/272 682/1282/272 697/1315/272 -f 696/1297/284 691/1306/278 690/1316/278 -f 683/1301/277 697/1298/285 682/1317/277 -f 696/1314/272 699/1318/286 698/1319/286 -f 695/1320/287 698/1319/286 699/1318/286 -f 677/1277/276 676/1279/276 678/1300/276 -f 678/1300/276 680/1321/276 679/1299/276 -f 680/1321/276 681/1302/276 679/1299/276 -f 683/1301/277 682/1317/277 679/1299/276 -f 686/1305/275 684/1278/275 685/1281/275 -f 687/1303/275 689/1307/275 688/1304/275 -f 686/1305/275 685/1281/275 687/1303/275 -f 687/1303/275 690/1316/278 691/1306/278 -f 681/1308/279 689/1313/279 691/1286/274 -f 678/1309/280 686/1312/280 688/1310/281 -f 676/1279/282 684/1278/282 686/1312/280 -f 680/1311/283 688/1310/283 689/1313/279 -f 696/1314/272 690/1293/272 682/1282/272 -f 696/1297/284 692/1287/284 691/1306/278 -f 683/1301/277 693/1291/285 697/1298/285 -f 696/1314/272 697/1315/272 699/1318/286 -f 695/1320/287 694/1322/287 698/1319/286 -o Plug -v 5.437500 0.625000 -0.156250 -v 5.437500 0.735485 -0.110486 -v 5.125000 0.781250 -0.000000 -v 5.125000 0.735485 0.110486 -v 5.125000 0.625000 0.156250 -v 5.125000 0.514515 0.110486 -v 5.125000 0.468750 -0.000000 -v 5.125000 0.514515 -0.110485 -v 6.000000 0.625000 -0.156250 -v 6.000000 0.735485 -0.110486 -v 6.000000 0.781250 -0.000000 -v 5.687500 0.514515 0.110486 -v 5.687500 0.625000 0.156250 -v 5.125000 0.735485 -0.110486 -v 5.125000 0.625000 -0.156250 -v 6.000000 0.514515 -0.110485 -v 6.000000 0.514515 0.110486 -v 6.000000 0.625000 0.156250 -v 6.000000 0.735485 0.110486 -v 6.000000 0.468750 -0.000000 -vt 0.181467 0.602317 -vt 0.193050 0.598456 -vt 0.189189 0.602317 -vt 0.208494 0.579151 -vt 0.193050 0.598456 -vt 0.193050 0.563707 -vt 0.181467 0.509652 -vt 0.189189 0.486486 -vt 0.189189 0.509652 -vt 0.204633 0.602317 -vt 0.196911 0.602317 -vt 0.177606 0.579151 -vt 0.193050 0.563707 -vt 0.194084 0.547229 -vt 0.180433 0.547229 -vt 0.180433 0.560879 -vt 0.177606 0.598456 -vt 0.208494 0.598456 -vt 0.181467 0.486486 -vt 0.194084 0.560879 -vt 0.196911 0.554054 -vt 0.187259 0.544402 -vt 0.177606 0.554054 -vt 0.187259 0.563707 -vt 0.196911 0.544402 -vt 0.196911 0.490348 -vt 0.189189 0.544402 -vt 0.173745 0.544402 -vt 0.173745 0.490348 -vt 0.189189 0.490348 -vt 0.181467 0.490348 -vt 0.181467 0.544402 -vn -1.0000 0.0000 0.0000 -vn -0.0000 0.9239 0.3827 -vn -0.7560 -0.2505 0.6048 -vn 0.0000 -0.9239 -0.3827 -vn 1.0000 0.0000 0.0000 -vn -0.0000 0.9239 -0.3827 -vn -0.0000 0.7972 -0.6037 -vn -0.0000 0.7071 -0.7071 -vn 0.0000 -0.1368 -0.9906 -vn 0.0000 -0.3827 -0.9239 -vn 0.0000 -0.0000 -1.0000 -s off -f 702/1323/288 704/1324/288 703/1325/288 -f 700/1326/289 705/1327/289 711/1328/289 -f 700/1329/290 712/1330/290 701/1331/290 -f 705/1327/288 707/1332/288 706/1333/288 -f 704/1324/291 701/1334/291 712/1335/291 -f 718/1336/292 716/1337/292 715/1338/292 -f 702/1323/288 713/1339/288 704/1324/288 -f 700/1326/289 714/1340/289 705/1327/289 -f 700/1329/290 711/1341/290 712/1330/290 -f 705/1327/288 714/1340/288 707/1332/288 -f 704/1324/291 713/1339/291 701/1334/291 -f 709/1342/292 710/1343/292 718/1336/292 -f 718/1336/292 717/1344/292 716/1337/292 -f 716/1337/292 719/1345/292 715/1338/292 -f 715/1338/292 708/1346/292 709/1342/292 -f 709/1342/292 718/1336/292 715/1338/292 -s 1 -f 710/1347/293 701/1331/294 702/1348/293 -f 709/1349/295 700/1329/296 701/1331/294 -f 700/1329/296 715/1350/297 707/1351/297 -f 701/1331/294 713/1352/293 702/1348/293 -f 700/1329/296 707/1351/297 714/1353/297 -f 710/1347/293 709/1349/295 701/1331/294 -f 709/1349/295 708/1354/298 700/1329/296 -f 700/1329/296 708/1354/298 715/1350/297 -o Mag_Paddle -v -1.505856 -1.307663 0.093750 -v -1.505856 -1.307663 -0.093750 -v -1.562500 -1.281250 -0.093750 -v -1.562500 -1.281250 0.093750 -v -1.585097 -1.477596 0.093750 -v -1.585097 -1.477596 -0.093750 -v -1.641741 -1.451182 -0.093750 -v -1.641741 -1.451182 0.093750 -v -1.611510 -1.534240 -0.156250 -v -1.668154 -1.507827 -0.156250 -v -1.611510 -1.534240 0.156250 -v -1.668154 -1.507827 0.156250 -v -1.717165 -1.760817 -0.156250 -v -1.773809 -1.734404 -0.156250 -v -1.717165 -1.760817 0.156250 -v -1.773809 -1.734404 0.156250 -vt 0.725869 0.664093 -vt 0.737452 0.652510 -vt 0.737452 0.664093 -vt 0.749035 0.652510 -vt 0.760618 0.664093 -vt 0.749035 0.664093 -vt 0.741313 0.652510 -vt 0.745174 0.664093 -vt 0.741313 0.664093 -vt 0.764479 0.664093 -vt 0.768340 0.652510 -vt 0.768340 0.664093 -vt 0.745174 0.633205 -vt 0.764479 0.633205 -vt 0.764479 0.648649 -vt 0.741313 0.648649 -vt 0.722008 0.648649 -vt 0.725869 0.652510 -vt 0.760618 0.652510 -vt 0.745174 0.652510 -vt 0.764479 0.652510 -vt 0.745174 0.648649 -vt 0.722008 0.633205 -vt 0.741313 0.633205 -vt 0.768340 0.648649 -vt 0.768340 0.633205 -vt 0.745174 0.629344 -vt 0.764479 0.629344 -vn 0.9063 -0.4226 0.0000 -vn -0.9063 0.4226 0.0000 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 0.0000 1.0000 -vn 0.1617 0.3468 -0.9239 -vn 0.2988 0.6409 -0.7071 -vn 0.2988 0.6409 0.7071 -vn 0.1617 0.3468 0.9239 -vn -0.4226 -0.9063 0.0000 -s off -f 720/1355/299 725/1356/299 721/1357/299 -f 726/1358/300 723/1359/300 722/1360/300 -f 725/1361/301 722/1362/301 721/1363/301 -f 723/1364/302 724/1365/302 720/1366/302 -f 733/1367/300 735/1368/300 731/1369/300 -f 728/1370/299 725/1356/299 730/1371/299 -f 720/1355/299 724/1372/299 725/1356/299 -f 726/1358/300 727/1373/300 723/1359/300 -f 725/1361/301 726/1374/301 722/1362/301 -f 723/1364/302 727/1375/302 724/1365/302 -f 731/1369/300 727/1373/300 726/1358/300 -f 726/1358/300 729/1376/300 731/1369/300 -f 729/1376/300 733/1367/300 731/1369/300 -f 725/1356/299 724/1372/299 730/1371/299 -f 730/1371/299 734/1377/299 732/1378/299 -f 732/1378/299 728/1370/299 730/1371/299 -s 1 -f 728/1370/303 726/1374/304 725/1361/304 -f 727/1375/305 730/1379/306 724/1365/305 -f 731/1369/306 734/1380/302 730/1379/306 -f 732/1378/301 729/1376/303 728/1370/303 -f 732/1381/307 735/1368/307 733/1367/307 -f 728/1370/303 729/1376/303 726/1374/304 -f 727/1375/305 731/1369/306 730/1379/306 -f 731/1369/306 735/1368/302 734/1380/302 -f 732/1378/301 733/1367/301 729/1376/303 -f 732/1381/307 734/1382/307 735/1368/307 -o Magazine -v -1.312500 -3.843750 0.312500 -v -1.312500 -3.843750 -0.312500 -v 0.437500 -3.593750 0.312500 -v 0.437500 -3.593750 -0.312500 -v -1.437500 -0.218750 0.312500 -v -1.437500 -0.218750 -0.312500 -v 0.250000 -0.218750 0.312500 -v 0.250000 -0.218750 -0.312500 -v -1.437500 -0.093750 -0.187500 -v -1.437500 -0.093750 0.187500 -v -1.437500 -0.093750 0.125000 -v -1.437500 -0.093750 -0.125000 -v -1.437500 -0.218750 -0.125000 -v -1.437500 -0.218750 0.125000 -v -0.562500 -0.218750 0.312500 -v -0.562500 -0.218750 -0.312500 -v -0.687500 -0.093750 -0.187500 -v -0.687500 -0.093750 0.187500 -v -0.687500 -0.093750 0.125000 -v -0.687500 -0.093750 -0.125000 -v -0.562500 -0.218750 -0.125000 -v -0.562500 -0.218750 0.125000 -vt 0.420849 0.328185 -vt 0.312741 0.289575 -vt 0.420849 0.289575 -vt 0.312741 0.328185 -vt 0.104247 0.289575 -vt 0.698842 0.328185 -vt 0.698842 0.316602 -vt 0.749035 0.328185 -vt 0.698842 0.289575 -vt 0.749035 0.289575 -vt 0.698842 0.301158 -vt 0.675676 0.316602 -vt 0.667954 0.359073 -vt 0.667954 0.316602 -vt 0.683398 0.359073 -vt 0.675676 0.316602 -vt 0.683398 0.316602 -vt 0.652510 0.297297 -vt 0.644788 0.301158 -vt 0.644788 0.289575 -vt 0.644788 0.316602 -vt 0.652510 0.320463 -vt 0.644788 0.328185 -vt 0.104247 0.328185 -vt 0.675676 0.366795 -vt 0.675676 0.366795 -vt 0.652510 0.301158 -vt 0.652510 0.316602 -vt 0.656371 0.243243 -vt 0.656371 0.289575 -vt 0.687259 0.362934 -vt 0.687259 0.316602 -vt 0.656371 0.374517 -vt 0.644788 0.382239 -vt 0.664093 0.362934 -vt 0.664093 0.316602 -vt 0.683398 0.374517 -vt 0.694981 0.374517 -vt 0.667954 0.374517 -vt 0.656371 0.374517 -vt 0.436293 0.185328 -vt 0.644788 0.185328 -vt 0.644788 0.235521 -vt 0.644788 0.432432 -vt 0.436293 0.432432 -vt 0.683398 0.362934 -vt 0.656371 0.328185 -vt 0.667954 0.362934 -vn 0.1414 -0.9899 0.0000 -vn 0.9985 0.0555 0.0000 -vn -0.0000 1.0000 0.0000 -vn 0.0000 0.0000 1.0000 -vn 0.0000 0.0000 -1.0000 -vn -1.0000 0.0000 0.0000 -vn -0.9994 -0.0345 0.0000 -vn -0.0000 0.3869 0.9221 -vn -0.0000 0.7071 0.7071 -vn 0.4444 0.8959 0.0000 -vn -0.0000 0.3869 -0.9221 -vn -0.0000 0.7071 -0.7071 -vn -0.0000 0.1743 -0.9847 -vn 0.7071 0.7071 0.0000 -vn -0.0000 0.1743 0.9847 -vn 0.3827 0.9239 0.0000 -s off -f 737/1383/308 738/1384/308 736/1385/308 -f 739/1386/309 742/1387/309 738/1384/309 -f 751/1388/310 756/1389/310 743/1390/310 -f 750/1391/310 742/1392/310 757/1393/310 -f 748/1394/311 755/1395/311 747/1396/311 -f 754/1397/312 749/1398/312 746/1399/312 -f 745/1400/313 749/1401/313 740/1402/313 -f 748/1403/313 744/1404/313 741/1405/313 -f 756/1389/310 742/1392/310 743/1390/310 -f 748/1403/310 757/1393/310 756/1389/310 -f 748/1403/314 741/1405/314 737/1383/314 -f 737/1383/308 739/1386/308 738/1384/308 -f 739/1386/309 743/1406/309 742/1387/309 -f 748/1394/311 756/1407/311 755/1395/311 -f 754/1397/312 757/1408/312 749/1398/312 -f 745/1400/313 746/1409/313 749/1401/313 -f 748/1403/313 747/1410/313 744/1404/313 -f 756/1389/310 757/1393/310 742/1392/310 -f 748/1403/310 749/1401/310 757/1393/310 -f 737/1383/314 736/1385/314 749/1401/314 -f 736/1385/314 740/1402/314 749/1401/314 -f 749/1401/314 748/1403/314 737/1383/314 -s 1 -f 740/1402/315 753/1411/316 745/1412/316 -f 753/1413/317 746/1399/310 745/1414/310 -f 741/1405/318 752/1415/319 751/1416/320 -f 747/1396/310 752/1417/317 744/1418/310 -f 757/1419/321 753/1413/317 750/1420/321 -f 752/1417/317 756/1421/321 751/1422/321 -f 738/1423/311 742/1424/311 750/1425/322 -f 751/1416/320 743/1426/312 739/1427/312 -f 740/1402/315 750/1425/322 753/1411/316 -f 753/1413/317 754/1428/323 746/1399/310 -f 741/1405/318 744/1429/319 752/1415/319 -f 747/1396/310 755/1430/323 752/1417/317 -f 757/1419/321 754/1428/323 753/1413/317 -f 752/1417/317 755/1430/323 756/1421/321 -f 740/1402/315 736/1385/311 750/1425/322 -f 736/1385/311 738/1423/311 750/1425/322 -f 739/1427/312 737/1383/312 751/1416/320 -f 737/1383/312 741/1405/318 751/1416/320 -o Stock -v -6.625000 -0.343750 -0.343750 -v -6.625000 -0.093750 0.468750 -v -6.625000 -0.343750 0.343750 -v -6.625000 0.093750 0.468750 -v -6.625000 0.093750 -0.468750 -v -6.625000 -0.093750 -0.468750 -v -6.625000 -0.718750 0.343750 -v -6.625000 -0.718750 -0.343750 -v -6.625000 0.343750 0.343750 -v -6.625000 0.343750 -0.343750 -v -6.625000 0.735485 -0.154680 -v -6.625000 0.781250 0.000000 -v -6.625000 0.735485 0.154680 -v -7.375000 0.343750 -0.156250 -v -7.375000 0.343750 0.156250 -v -7.375000 0.093750 -0.406250 -v -7.375000 -0.093750 -0.406250 -v -7.625000 -0.343750 -0.343750 -v -7.625000 0.218750 -0.156250 -v -7.625000 0.218750 0.156250 -v -8.000000 0.156250 -0.156250 -v -8.000000 0.156250 0.156250 -v -12.125000 0.156250 -0.156250 -v -12.125000 0.156250 0.156250 -v -8.000000 0.031250 -0.343750 -v -12.125000 0.031250 -0.343750 -v -7.250000 -0.656249 -0.343750 -v -7.250000 -0.781249 -0.218750 -v -7.250000 -0.781249 0.218750 -v -12.125000 -2.406250 -0.156250 -v -12.125000 -2.218750 -0.343750 -v -12.125000 -2.406250 0.156250 -v -7.625000 0.031250 -0.343750 -v -7.250000 -0.656249 0.343750 -v -7.625000 -0.343750 0.343750 -v -12.125000 -2.218750 0.343750 -v -12.125000 0.031250 0.343750 -v -8.000000 0.031250 0.343750 -v -7.625000 0.031250 0.343750 -v -7.375000 0.093750 0.406250 -v -7.375000 -0.093750 0.406250 -v -12.500000 0.156250 -0.156250 -v -12.500000 0.156250 0.156250 -v -12.500000 0.031250 -0.343750 -v -12.500000 -2.406250 -0.156250 -v -12.500000 -2.218750 -0.343750 -v -12.500000 -2.406250 0.156250 -v -12.500000 -2.218750 0.343750 -v -12.500000 0.031250 0.343750 -v -12.312500 -1.468750 -0.343750 -v -12.312500 -0.718750 -0.343750 -v -12.312500 -1.468750 0.343750 -v -12.312500 -0.718750 0.343750 -vt 0.980695 0.088803 -vt 0.980695 0.115830 -vt 0.934363 0.108108 -vt 0.980695 0.069498 -vt 0.934363 0.050193 -vt 0.980695 0.042471 -vt 0.988417 0.088803 -vt 0.934363 0.088803 -vt 0.988417 0.079151 -vt 0.934363 0.069498 -vt 0.988417 0.069498 -vt 0.660232 0.270270 -vt 0.706564 0.281853 -vt 0.660232 0.281853 -vt 0.660232 0.297297 -vt 0.934363 0.127413 -vt 0.660232 0.254826 -vt 0.722008 0.254826 -vt 0.706564 0.270270 -vt 0.918919 0.069498 -vt 0.918919 0.088803 -vt 0.895753 0.069498 -vt 0.895753 0.088803 -vt 0.640927 0.069498 -vt 0.640927 0.104247 -vt 0.640927 0.088803 -vt 0.698842 0.235521 -vt 0.660232 0.231660 -vt 0.610039 0.158301 -vt 0.571429 0.150579 -vt 0.610039 0.146718 -vt 0.571429 0.115830 -vt 0.610039 0.119691 -vt 0.926641 0.142857 -vt 1.000000 0.123552 -vt 1.000000 0.138996 -vt 0.926641 0.123552 -vt 0.745174 0.277992 -vt 1.000000 0.277992 -vt 0.918919 0.104247 -vt 0.934363 0.108108 -vt 0.722008 0.277992 -vt 0.610039 0.108108 -vt 0.660232 0.231660 -vt 0.722008 0.254826 -vt 0.698842 0.235521 -vt 0.660232 0.254826 -vt 1.000000 0.138996 -vt 1.000000 0.123552 -vt 1.000000 0.277992 -vt 0.895753 0.054054 -vt 0.745174 0.277992 -vt 0.895753 0.104247 -vt 0.934363 0.050193 -vt 0.918919 0.054054 -vt 0.934363 0.030888 -vt 0.660232 0.297297 -vt 0.706564 0.281853 -vt 0.660232 0.281853 -vt 0.660232 0.270270 -vt 0.706564 0.270270 -vt 0.722008 0.277992 -vt 0.057915 0.266409 -vt 0.042471 0.289575 -vt 0.042471 0.266409 -vt 0.266409 0.266409 -vt 0.247104 0.289575 -vt 0.247104 0.266409 -vt 0.231660 0.289575 -vt 0.231660 0.266409 -vt 0.281853 0.266409 -vt 0.266409 0.289575 -vt 0.077220 0.266409 -vt 0.057915 0.289575 -vt 0.092664 0.266409 -vt 0.077220 0.289575 -vt 0.328185 0.277992 -vt 0.281853 0.289575 -vt 0.420849 0.266409 -vt 0.420849 0.289575 -vt 0.374517 0.277992 -vt 0.362934 0.223938 -vt 0.316602 0.266409 -vt 0.316602 0.223938 -vt 0.420849 0.235521 -vt 0.409266 0.266409 -vt 0.409266 0.223938 -vt 0.262548 0.235521 -vt 0.270270 0.266409 -vt 0.262548 0.254826 -vt 0.270270 0.223938 -vt 0.185328 0.277992 -vt 0.092664 0.289575 -vt 0.138996 0.277992 -vt 0.640927 0.054054 -vt 0.362934 0.266409 -vt 0.420849 0.254826 -vn -0.3866 0.7423 -0.5473 -vn -0.1572 0.4760 -0.8653 -vn -0.3908 0.8284 -0.4013 -vn -0.3866 0.7423 0.5473 -vn -0.3908 0.8284 0.4013 -vn -0.1572 0.4760 0.8653 -vn -0.4679 0.8838 0.0000 -vn -0.0496 -0.2045 -0.9776 -vn -0.2165 0.3710 -0.9031 -vn -0.0809 0.2263 -0.9707 -vn 0.0000 -0.4472 -0.8944 -vn -0.0380 -0.0335 -0.9987 -vn -0.1431 -0.0620 -0.9878 -vn -0.3092 0.9510 0.0000 -vn -0.0825 0.9966 0.0000 -vn 0.0000 0.9814 0.1922 -vn -0.0234 0.8096 -0.5865 -vn -0.0000 0.4719 -0.8817 -vn 0.0000 0.8321 -0.5547 -vn 0.0031 -0.0096 -0.9999 -vn 0.0000 0.0000 -1.0000 -vn 0.0657 -0.7056 -0.7056 -vn 0.0741 -0.9895 -0.1245 -vn 0.1632 -0.9144 -0.3705 -vn 0.0741 -0.9895 0.1245 -vn 0.1632 -0.9144 0.3705 -vn 0.1158 -0.9591 -0.2585 -vn 0.2210 -0.6896 -0.6896 -vn 0.1407 -0.4389 -0.8875 -vn 0.1158 -0.9591 0.2585 -vn -0.1824 0.3749 -0.9090 -vn -0.2408 0.6863 -0.6863 -vn 0.0657 -0.7056 0.7056 -vn 0.0000 0.0000 1.0000 -vn -0.0380 -0.0335 0.9987 -vn 0.0031 -0.0096 0.9999 -vn 0.1407 -0.4389 0.8875 -vn 0.2210 -0.6896 0.6896 -vn -0.0000 0.4719 0.8817 -vn 0.0000 0.8321 0.5547 -vn -0.0234 0.8096 0.5865 -vn -0.2408 0.6863 0.6863 -vn -0.2165 0.3710 0.9031 -vn -0.1824 0.3749 0.9090 -vn -0.0809 0.2263 0.9707 -vn -0.0496 -0.2045 0.9776 -vn -0.1431 -0.0620 0.9878 -vn 0.0000 -0.4472 0.8944 -vn 0.0000 -0.4148 -0.9099 -vn 0.0000 -0.3827 -0.9239 -vn 0.0000 0.9814 -0.1922 -vn 0.0000 0.9571 0.2898 -vn 0.0000 0.5112 0.8594 -vn 0.0000 0.9571 -0.2898 -vn 0.0000 -0.9239 -0.3827 -vn 0.0000 -0.3827 0.9239 -vn 0.0000 -0.9239 0.3827 -vn 0.0000 0.5112 -0.8594 -vn -0.9925 0.1222 0.0000 -vn -0.9925 -0.1222 0.0000 -vn -1.0000 0.0000 0.0000 -vn -0.9867 0.1628 0.0000 -vn -0.9841 -0.1775 0.0000 -vn 0.0000 -0.4148 0.9099 -s 1 -f 768/1431/324 767/1432/325 771/1433/326 -f 770/1434/327 772/1435/328 766/1436/329 -f 768/1437/324 771/1438/326 769/1439/330 -f 769/1439/330 772/1440/328 770/1441/327 -f 771/1438/326 772/1440/328 769/1439/330 -f 763/1442/331 773/1443/332 762/1444/333 -f 762/1444/333 773/1443/332 767/1445/325 -f 771/1433/326 767/1432/325 773/1446/332 -f 763/1442/331 758/1447/334 775/1448/335 -f 774/1449/336 763/1442/331 775/1448/335 -f 771/1438/326 777/1450/337 772/1440/328 -f 776/1451/337 779/1452/338 777/1450/337 -f 778/1453/338 781/1454/339 779/1452/338 -f 778/1453/340 783/1455/341 780/1456/342 -f 784/1457/343 775/1448/335 765/1458/344 -f 784/1459/345 765/1460/346 785/1461/347 -f 785/1461/347 764/1462/348 786/1463/349 -f 785/1461/347 787/1464/350 784/1459/345 -f 787/1465/351 788/1466/352 784/1457/343 -f 789/1467/353 785/1461/347 786/1463/349 -f 784/1457/343 788/1466/352 775/1448/335 -f 782/1468/341 775/1448/335 783/1469/341 -f 788/1466/352 783/1469/341 775/1448/335 -f 790/1470/354 776/1451/355 773/1471/332 -f 773/1471/332 776/1451/355 771/1438/326 -f 775/1448/335 790/1472/354 774/1449/336 -f 782/1468/341 790/1472/354 775/1448/335 -f 773/1443/332 774/1449/336 790/1472/354 -f 758/1447/344 765/1458/344 775/1448/335 -f 786/1463/349 764/1462/348 791/1473/356 -f 764/1474/357 792/1475/358 791/1476/359 -f 764/1474/357 760/1477/357 792/1475/358 -f 789/1467/353 786/1463/349 791/1473/356 -f 793/1478/360 789/1479/361 791/1476/359 -f 791/1476/359 792/1475/358 793/1478/360 -f 793/1478/360 792/1475/358 794/1480/362 -f 781/1454/363 795/1481/362 779/1452/364 -f 794/1480/362 792/1475/358 795/1482/362 -f 782/1483/341 778/1453/340 790/1470/354 -f 777/1450/365 797/1484/366 772/1440/328 -f 796/1485/367 797/1484/366 777/1450/365 -f 772/1435/328 797/1486/366 766/1436/329 -f 766/1487/329 797/1488/366 761/1489/368 -f 759/1490/369 797/1488/366 798/1491/370 -f 760/1477/371 759/1490/369 792/1475/358 -f 798/1491/370 792/1475/358 759/1490/369 -f 797/1488/366 796/1492/367 798/1491/370 -f 798/1491/370 796/1492/367 792/1475/358 -f 795/1482/362 792/1475/358 796/1492/367 -f 787/1493/350 803/1494/372 788/1495/373 -f 780/1496/374 800/1497/375 781/1498/339 -f 781/1498/339 806/1499/376 794/1500/362 -f 783/1501/341 799/1502/377 780/1496/374 -f 789/1503/353 802/1504/378 787/1493/350 -f 793/1505/379 804/1506/380 789/1503/353 -f 783/1501/341 808/1507/344 801/1508/381 -f 788/1509/373 803/1510/372 807/1511/344 -f 788/1509/373 808/1507/344 783/1501/341 -f 807/1512/382 810/1513/383 808/1514/383 -f 802/1515/384 805/1516/385 803/1517/385 -f 805/1516/385 807/1512/382 803/1517/385 -f 799/1518/384 806/1519/386 800/1520/384 -f 808/1514/383 806/1519/386 801/1521/386 -f 806/1499/376 810/1522/357 794/1500/362 -f 805/1523/387 793/1505/379 809/1524/357 -f 810/1522/357 793/1505/379 794/1500/362 -f 778/1453/340 776/1451/355 790/1470/354 -f 795/1481/362 796/1485/367 779/1452/364 -f 777/1450/365 779/1452/364 796/1485/367 -f 763/1442/331 774/1449/336 773/1443/332 -f 771/1438/326 776/1451/337 777/1450/337 -f 776/1451/337 778/1453/338 779/1452/338 -f 778/1453/338 780/1456/374 781/1454/339 -f 778/1453/340 782/1483/341 783/1455/341 -f 785/1461/347 765/1460/346 764/1462/348 -f 789/1467/353 787/1464/350 785/1461/347 -f 781/1454/363 794/1525/362 795/1481/362 -f 759/1490/369 761/1489/368 797/1488/366 -f 787/1493/350 802/1504/378 803/1494/372 -f 780/1496/374 799/1502/377 800/1497/375 -f 781/1498/339 800/1497/375 806/1499/376 -f 783/1501/341 801/1508/381 799/1502/377 -f 789/1503/353 804/1506/380 802/1504/378 -f 793/1505/379 805/1523/387 804/1506/380 -f 788/1509/373 807/1511/344 808/1507/344 -f 807/1512/382 809/1526/382 810/1513/383 -f 802/1515/384 804/1527/384 805/1516/385 -f 805/1516/385 809/1526/382 807/1512/382 -f 799/1518/384 801/1521/386 806/1519/386 -f 808/1514/383 810/1513/383 806/1519/386 -f 810/1522/357 809/1524/357 793/1505/379 -o Flash_Hider -v 11.250000 -0.000000 -0.250000 -v 11.250000 0.176777 -0.176777 -v 11.250000 0.250000 0.000000 -v 11.250000 0.176777 0.176777 -v 11.250000 -0.000000 0.250000 -v 11.250000 -0.176777 0.176777 -v 11.250000 -0.250000 0.000000 -v 11.250000 -0.176777 -0.176777 -v 12.500000 0.000000 -0.250000 -v 12.500000 0.176777 -0.176777 -v 12.500000 0.250000 0.000000 -v 12.500000 0.176777 0.176777 -v 12.500000 -0.000000 0.250000 -v 12.500000 -0.176777 0.176777 -v 12.500000 -0.250000 0.000000 -v 12.500000 -0.176777 -0.176777 -v 11.625000 -0.000000 -0.250000 -v 11.625000 0.176777 -0.176777 -v 11.625000 0.250000 0.000000 -v 11.625000 0.176777 0.176777 -v 11.625000 -0.000000 0.250000 -v 11.625000 -0.176777 0.176777 -v 11.625000 -0.250000 0.000000 -v 11.625000 -0.176777 -0.176777 -v 11.625000 -0.125000 -0.000000 -v 11.625000 -0.088388 0.088388 -v 12.437500 -0.000000 -0.125000 -v 12.437500 0.088388 -0.088388 -v 12.437500 0.125000 0.000000 -v 12.437500 0.088388 0.088388 -v 12.437500 -0.000000 0.125000 -v 12.437500 -0.088388 0.088388 -v 12.437500 -0.125000 -0.000000 -v 12.437500 -0.088388 -0.088388 -v 11.625000 -0.000000 -0.125000 -v 11.625000 0.088388 -0.088388 -v 11.625000 0.125000 0.000000 -v 11.625000 0.088388 0.088388 -v 11.625000 -0.000000 0.125000 -v 11.625000 -0.088388 -0.088388 -vt 0.092664 0.494208 -vt 0.081081 0.494208 -vt 0.081081 0.548263 -vt 0.058577 0.684060 -vt 0.054054 0.694981 -vt 0.084942 0.694981 -vt 0.046332 0.494208 -vt 0.034749 0.494208 -vt 0.034749 0.548263 -vt 0.115830 0.548263 -vt 0.104247 0.494208 -vt 0.104247 0.548263 -vt 0.069498 0.548263 -vt 0.057915 0.494208 -vt 0.057915 0.548263 -vt 0.081081 0.571429 -vt 0.069498 0.571429 -vt 0.057915 0.571429 -vt 0.046332 0.548263 -vt 0.046332 0.571429 -vt 0.034749 0.571429 -vt 0.023166 0.548263 -vt 0.023166 0.571429 -vt 0.104247 0.571429 -vt 0.092664 0.548263 -vt 0.092664 0.571429 -vt 0.038610 0.486486 -vt 0.084942 0.640927 -vt 0.034749 0.648649 -vt 0.030888 0.640927 -vt 0.084942 0.652510 -vt 0.034749 0.652510 -vt 0.115830 0.494208 -vt 0.108108 0.486486 -vt 0.065637 0.486486 -vt 0.061776 0.486486 -vt 0.084942 0.486486 -vt 0.084942 0.660232 -vt 0.030888 0.660232 -vt 0.034749 0.667954 -vt 0.084942 0.671815 -vt 0.034749 0.671815 -vt 0.034749 0.629344 -vt 0.084942 0.633205 -vt 0.034749 0.633205 -vt 0.034749 0.610039 -vt 0.084942 0.613900 -vt 0.034749 0.613900 -vt 0.084942 0.640927 -vt 0.030888 0.640927 -vt 0.084942 0.602317 -vt 0.030888 0.602317 -vt 0.084942 0.621622 -vt 0.030888 0.621622 -vt 0.084942 0.660232 -vt 0.030888 0.660232 -vt 0.084942 0.679537 -vt 0.030888 0.679537 -vt 0.084942 0.621622 -vt 0.030888 0.621622 -vt 0.027689 0.684062 -vt 0.030888 0.694981 -vt 0.023166 0.694981 -vt 0.027689 0.705901 -vt 0.038610 0.702703 -vt 0.038610 0.710425 -vt 0.046332 0.694981 -vt 0.049531 0.705900 -vt 0.044070 0.700440 -vt 0.049531 0.684060 -vt 0.038610 0.687259 -vt 0.038610 0.679537 -vt 0.044070 0.689520 -vt 0.033150 0.700441 -vt 0.058577 0.705901 -vt 0.069498 0.710425 -vt 0.080419 0.705901 -vt 0.080419 0.684060 -vt 0.069498 0.679537 -vt 0.115830 0.571429 -vt 0.069498 0.494208 -vt 0.042471 0.486486 -vt 0.084942 0.648649 -vt 0.111969 0.486486 -vt 0.088803 0.486486 -vt 0.084942 0.667954 -vt 0.084942 0.629344 -vt 0.084942 0.610039 -vt 0.033150 0.689521 -vt 0.054054 0.694981 -vn 0.0000 0.3827 0.9239 -vn -0.0000 0.6037 0.7972 -vn -1.0000 0.0000 0.0000 -vn 0.0000 -0.3827 -0.9239 -vn 0.0000 -0.6037 -0.7972 -vn 0.0000 -0.9906 0.1368 -vn 0.0000 -0.9239 0.3827 -vn 0.0000 -0.7972 0.6037 -vn 0.0000 0.9906 -0.1368 -vn 0.0000 0.9239 -0.3827 -vn 0.0000 0.7972 -0.6037 -vn 0.0000 0.7071 0.7071 -vn 0.0000 1.0000 -0.0000 -vn 0.0000 0.7071 -0.7071 -vn 0.0000 -0.1368 -0.9906 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 -0.7071 -0.7071 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 -0.7071 0.7071 -vn -0.0000 0.1368 0.9906 -vn 0.0000 -0.0000 1.0000 -vn 0.8795 0.1821 0.4397 -vn 0.0000 0.4823 -0.8760 -vn 0.0000 0.9808 0.1951 -vn 0.0000 0.9605 0.2783 -vn 0.8795 0.4397 -0.1821 -vn 0.8795 -0.4397 0.1821 -vn 0.8795 -0.1821 -0.4397 -vn 0.8795 -0.1822 -0.4397 -vn -0.0000 0.8760 0.4823 -vn 0.0000 -0.1951 0.9808 -vn 0.0000 -0.2783 0.9605 -vn 0.0000 -0.8760 -0.4823 -vn -0.0000 0.1951 -0.9808 -vn 0.0000 0.2783 -0.9605 -vn 0.0000 -0.4823 0.8760 -vn 0.0000 -0.9808 -0.1951 -vn -0.0000 -0.9605 -0.2783 -vn 1.0000 0.0000 0.0000 -vn 0.8795 0.1822 0.4397 -vn 0.0000 0.5556 -0.8315 -vn 0.0000 0.8315 0.5556 -vn 0.0000 -0.8315 -0.5556 -vn 0.0000 -0.5556 0.8315 -s 1 -f 823/1528/388 822/1529/388 830/1530/389 -f 814/1531/390 813/1532/390 817/1533/390 -f 819/1534/391 826/1535/391 834/1536/392 -f 833/1537/393 824/1538/394 832/1539/395 -f 829/1540/396 820/1541/397 828/1542/398 -f 814/1543/399 829/1540/396 813/1544/400 -f 812/1545/401 827/1546/402 811/1547/403 -f 818/1548/404 833/1549/393 817/1550/405 -f 816/1551/406 831/1552/407 815/1553/408 -f 819/1534/409 844/1554/409 826/1535/409 -f 833/1555/403 843/1556/410 825/1557/403 -f 843/1556/410 836/1558/411 842/1559/412 -f 825/1560/413 842/1561/413 824/1538/413 -f 820/1541/414 839/1562/414 838/1563/414 -f 823/1528/415 840/1564/415 822/1529/416 -f 842/1559/412 832/1565/399 824/1566/399 -f 837/1567/417 850/1568/418 844/1569/419 -f 841/1570/420 848/1571/421 840/1572/422 -f 839/1573/423 846/1574/424 838/1575/425 -f 840/1572/422 830/1576/401 822/1577/401 -f 829/1578/408 839/1573/423 821/1579/408 -f 838/1575/425 828/1580/404 820/1581/404 -f 827/1582/400 837/1567/417 819/1583/400 -f 844/1569/419 834/1584/406 826/1585/406 -f 831/1586/405 841/1570/420 823/1587/405 -f 830/1588/426 847/1589/426 829/1590/426 -f 828/1591/426 845/1592/426 827/1593/426 -f 835/1594/426 834/1595/426 850/1596/426 -f 832/1597/426 849/1598/426 831/1599/426 -f 836/1600/426 850/1596/426 846/1601/426 -f 830/1530/389 814/1543/399 815/1553/408 -f 815/1553/408 831/1552/407 830/1530/389 -f 831/1552/407 823/1528/388 830/1530/389 -f 813/1532/390 812/1602/390 811/1603/390 -f 811/1603/390 818/1604/390 813/1532/390 -f 818/1604/390 817/1533/390 813/1532/390 -f 817/1533/390 816/1605/390 815/1606/390 -f 815/1606/390 814/1531/390 817/1533/390 -f 834/1536/392 818/1548/404 811/1547/403 -f 811/1547/403 827/1546/402 834/1536/392 -f 827/1546/402 819/1534/391 834/1536/392 -f 832/1539/395 816/1551/406 817/1607/405 -f 833/1537/393 825/1560/394 824/1538/394 -f 832/1539/395 817/1607/405 833/1537/393 -f 828/1542/398 812/1545/401 813/1544/400 -f 829/1540/396 821/1608/397 820/1541/397 -f 828/1542/398 813/1544/400 829/1540/396 -f 814/1543/399 830/1530/389 829/1540/396 -f 812/1545/401 828/1542/398 827/1546/402 -f 818/1548/404 834/1536/392 833/1549/393 -f 816/1551/406 832/1539/395 831/1552/407 -f 819/1534/409 837/1609/427 844/1554/409 -f 833/1555/403 835/1610/428 843/1556/410 -f 843/1556/410 835/1610/428 836/1558/411 -f 825/1560/413 843/1611/413 842/1561/413 -f 820/1541/414 821/1608/414 839/1562/414 -f 823/1528/415 841/1612/415 840/1564/415 -f 842/1559/412 836/1558/411 832/1565/399 -f 837/1567/417 845/1613/429 850/1568/418 -f 841/1570/420 849/1614/430 848/1571/421 -f 839/1573/423 847/1615/431 846/1574/424 -f 840/1572/422 848/1571/421 830/1576/401 -f 829/1578/408 847/1615/431 839/1573/423 -f 838/1575/425 846/1574/424 828/1580/404 -f 827/1582/400 845/1613/429 837/1567/417 -f 844/1569/419 850/1568/418 834/1584/406 -f 831/1586/405 849/1614/430 841/1570/420 -f 830/1588/426 848/1616/426 847/1589/426 -f 828/1591/426 846/1601/426 845/1592/426 -f 835/1594/426 833/1617/426 834/1595/426 -f 832/1597/426 836/1600/426 849/1598/426 -f 836/1600/426 835/1594/426 850/1596/426 -f 850/1596/426 845/1592/426 846/1601/426 -f 846/1601/426 847/1589/426 848/1616/426 -f 848/1616/426 849/1598/426 846/1601/426 -f 849/1598/426 836/1600/426 846/1601/426 -o Scope_Scope.001 -v -5.750000 1.843750 -0.312500 -v -5.750000 2.000000 -0.270633 -v -5.750000 2.114383 -0.156250 -v -5.750000 2.156250 0.000000 -v -5.750000 2.114383 0.156250 -v -5.750000 2.000000 0.270633 -v -5.750000 1.843750 0.312500 -v -5.750000 1.687500 0.270633 -v -5.750000 1.573117 0.156250 -v -5.750000 1.531250 -0.000000 -v -5.750000 1.573117 -0.156250 -v -5.750000 1.687500 -0.270633 -v -5.625000 1.843750 -0.312500 -v -5.625000 2.000000 -0.270633 -v -5.625000 2.114383 -0.156250 -v -5.625000 2.156250 0.000000 -v -5.625000 2.114383 0.156250 -v -5.625000 2.000000 0.270633 -v -5.625000 1.843750 0.312500 -v -5.625000 1.687500 0.270633 -v -5.625000 1.573117 0.156250 -v -5.625000 1.531250 -0.000000 -v -5.625000 1.573117 -0.156250 -v -5.625000 1.687500 -0.270633 -v -5.750000 1.843750 -0.375000 -v -5.750000 2.031250 -0.324759 -v -5.750000 2.168509 -0.187500 -v -5.750000 2.218750 0.000000 -v -5.750000 2.168509 0.187500 -v -5.750000 2.031250 0.324760 -v -5.750000 1.843750 0.375000 -v -5.750000 1.656250 0.324760 -v -5.750000 1.518990 0.187500 -v -5.750000 1.468750 -0.000000 -v -5.750000 1.518990 -0.187500 -v -5.750000 1.656250 -0.324759 -v -4.500000 1.843750 -0.375000 -v -4.500000 2.031250 -0.324759 -v -4.500000 2.168509 -0.187500 -v -4.500000 2.218750 0.000000 -v -4.500000 2.168509 0.187500 -v -4.500000 2.031250 0.324760 -v -4.500000 1.843750 0.375000 -v -4.500000 1.656250 0.324760 -v -4.500000 1.518990 0.187500 -v -4.500000 1.468750 -0.000000 -v -4.500000 1.518990 -0.187500 -v -4.500000 1.656250 -0.324759 -v -4.312500 1.843750 -0.250000 -v -4.312500 1.968750 -0.216506 -v -4.312500 2.060256 -0.125000 -v -4.312500 2.093750 0.000000 -v -4.312500 2.060256 0.125000 -v -4.312500 1.968750 0.216506 -v -4.312500 1.843750 0.250000 -v -4.312500 1.718750 0.216506 -v -4.312500 1.627244 0.125000 -v -4.312500 1.593750 0.000000 -v -4.312500 1.627244 -0.125000 -v -4.312500 1.718750 -0.216506 -v -1.687500 1.843750 -0.250000 -v -1.687500 1.968750 -0.216506 -v -1.687500 2.060256 -0.125000 -v -1.687500 2.093750 0.000000 -v -1.687500 2.060256 0.125000 -v -1.687500 1.968750 0.216506 -v -1.687500 1.843750 0.250000 -v -1.687500 1.718750 0.216506 -v -1.687500 1.627244 0.125000 -v -1.687500 1.593750 0.000000 -v -1.687500 1.627244 -0.125000 -v -1.687500 1.718750 -0.216506 -v -3.312500 1.531250 0.312500 -v -3.312500 2.156250 0.312500 -v -3.312500 1.531250 -0.312500 -v -3.312500 2.156250 -0.312500 -v -2.687500 1.531250 0.312500 -v -2.687500 2.156250 0.312500 -v -2.687500 1.531250 -0.312500 -v -2.687500 2.156250 -0.312500 -v -3.437500 1.593750 0.250000 -v -3.437500 2.093750 0.250000 -v -3.437500 1.593750 -0.250000 -v -3.437500 2.093750 -0.250000 -v -2.562500 1.593750 0.250000 -v -2.562500 2.093750 0.250000 -v -2.562500 1.593750 -0.250000 -v -2.562500 2.093750 -0.250000 -v -0.187500 1.843750 -0.625000 -v -0.187500 2.156250 -0.541266 -v -0.187500 2.385015 -0.312500 -v -0.187500 2.468750 0.000000 -v -0.187500 2.385015 0.312500 -v -0.187500 2.156250 0.541266 -v -0.187500 1.843750 0.625000 -v -0.187500 1.531250 0.541266 -v -0.187500 1.302484 0.312500 -v -0.187500 1.218750 -0.000000 -v -0.187500 1.302484 -0.312500 -v -0.187500 1.531250 -0.541266 -v 1.312500 1.843750 -0.625000 -v 1.312500 2.156250 -0.541266 -v 1.312500 2.385015 -0.312500 -v 1.312500 2.468750 0.000000 -v 1.312500 2.385015 0.312500 -v 1.312500 2.156250 0.541266 -v 1.312500 1.843750 0.625000 -v 1.312500 1.531250 0.541266 -v 1.312500 1.302484 0.312500 -v 1.312500 1.218750 -0.000000 -v 1.312500 1.302484 -0.312500 -v 1.312500 1.531250 -0.541266 -v 1.312500 1.843750 -0.562500 -v 1.312500 2.125000 -0.487139 -v 1.312500 2.330889 -0.281250 -v 1.312500 2.406250 0.000000 -v 1.312500 2.330889 0.281250 -v 1.312500 2.125000 0.487139 -v 1.312500 1.843750 0.562500 -v 1.312500 1.562500 0.487139 -v 1.312500 1.356611 0.281250 -v 1.312500 1.281250 -0.000000 -v 1.312500 1.356611 -0.281250 -v 1.312500 1.562500 -0.487139 -v 1.062500 1.843750 -0.562500 -v 1.062500 2.125000 -0.487139 -v 1.062500 2.330889 -0.281250 -v 1.062500 2.406250 0.000000 -v 1.062500 2.330889 0.281250 -v 1.062500 2.125000 0.487139 -v 1.062500 1.843750 0.562500 -v 1.062500 1.562500 0.487139 -v 1.062500 1.356611 0.281250 -v 1.062500 1.281250 -0.000000 -v 1.062500 1.356611 -0.281250 -v 1.062500 1.562500 -0.487139 -v -3.000000 2.156250 -0.250000 -v -3.125000 2.156250 -0.216506 -v -3.216506 2.156250 -0.125000 -v -3.250000 2.156250 0.000000 -v -3.216506 2.156250 0.125000 -v -3.125000 2.156250 0.216506 -v -3.000000 2.156250 0.250000 -v -2.875000 2.156250 0.216506 -v -2.783494 2.156250 0.125000 -v -2.750000 2.156250 -0.000000 -v -2.783494 2.156250 -0.125000 -v -2.875000 2.156250 -0.216506 -v -3.000000 2.218750 -0.250000 -v -3.125000 2.218750 -0.216506 -v -3.216506 2.218750 -0.125000 -v -3.250000 2.218750 0.000000 -v -3.216506 2.218750 0.125000 -v -3.125000 2.218750 0.216506 -v -3.000000 2.218750 0.250000 -v -2.875000 2.218750 0.216506 -v -2.783494 2.218750 0.125000 -v -2.750000 2.218750 -0.000000 -v -2.783494 2.218750 -0.125000 -v -2.875000 2.218750 -0.216506 -v -3.000000 2.218750 -0.312500 -v -3.156250 2.218750 -0.270633 -v -3.270633 2.218750 -0.156250 -v -3.312500 2.218750 0.000000 -v -3.270633 2.218750 0.156250 -v -3.156250 2.218750 0.270633 -v -3.000000 2.218750 0.312500 -v -2.843750 2.218750 0.270633 -v -2.729367 2.218750 0.156250 -v -2.687500 2.218750 0.000000 -v -2.729367 2.218750 -0.156250 -v -2.843750 2.218750 -0.270633 -v -3.000000 2.406250 -0.312500 -v -3.156250 2.406250 -0.270633 -v -3.270633 2.406250 -0.156250 -v -3.312500 2.406250 0.000000 -v -3.270633 2.406250 0.156250 -v -3.156250 2.406250 0.270633 -v -3.000000 2.406250 0.312500 -v -2.843750 2.406250 0.270633 -v -2.729367 2.406250 0.156250 -v -2.687500 2.406250 0.000000 -v -2.729367 2.406250 -0.156250 -v -2.843750 2.406250 -0.270633 -v -3.000000 2.093750 0.312500 -v -3.125000 2.060256 0.312500 -v -3.216506 1.968750 0.312500 -v -3.250000 1.843750 0.312500 -v -3.216506 1.718750 0.312500 -v -3.125000 1.627243 0.312500 -v -3.000000 1.593750 0.312500 -v -2.875000 1.627243 0.312500 -v -2.783494 1.718750 0.312500 -v -2.750000 1.843750 0.312500 -v -2.783494 1.968750 0.312500 -v -2.875000 2.060256 0.312500 -v -3.000000 2.093750 0.375000 -v -3.125000 2.060256 0.375000 -v -3.216506 1.968750 0.375000 -v -3.250000 1.843750 0.375000 -v -3.216506 1.718750 0.375000 -v -3.125000 1.627243 0.375000 -v -3.000000 1.593750 0.375000 -v -2.875000 1.627243 0.375000 -v -2.783494 1.718750 0.375000 -v -2.750000 1.843750 0.375000 -v -2.783494 1.968750 0.375000 -v -2.875000 2.060256 0.375000 -v -3.000000 2.156250 0.375000 -v -3.156250 2.114383 0.375000 -v -3.270633 2.000000 0.375000 -v -3.312500 1.843750 0.375000 -v -3.270633 1.687500 0.375000 -v -3.156250 1.573117 0.375000 -v -3.000000 1.531250 0.375000 -v -2.843750 1.573117 0.375000 -v -2.729367 1.687500 0.375000 -v -2.687500 1.843750 0.375000 -v -2.729367 2.000000 0.375000 -v -2.843750 2.114383 0.375000 -v -3.000000 2.156250 0.562500 -v -3.156250 2.114383 0.562500 -v -3.270633 2.000000 0.562500 -v -3.312500 1.843750 0.562500 -v -3.270633 1.687500 0.562500 -v -3.156250 1.573117 0.562500 -v -3.000000 1.531250 0.562500 -v -2.843750 1.573117 0.562500 -v -2.729367 1.687500 0.562500 -v -2.687500 1.843750 0.562500 -v -2.729367 2.000000 0.562500 -v -2.843750 2.114383 0.562500 -v -3.000000 2.093750 -0.312500 -v -3.125000 2.060256 -0.312500 -v -3.216506 1.968750 -0.312500 -v -3.250000 1.843750 -0.312500 -v -3.216506 1.718750 -0.312500 -v -3.125000 1.627243 -0.312500 -v -3.000000 1.593750 -0.312500 -v -2.875000 1.627243 -0.312500 -v -2.783494 1.718750 -0.312500 -v -2.750000 1.843750 -0.312500 -v -2.783494 1.968750 -0.312500 -v -2.875000 2.060256 -0.312500 -v -3.000000 2.093750 -0.375000 -v -3.125000 2.060256 -0.375000 -v -3.216506 1.968750 -0.375000 -v -3.250000 1.843750 -0.375000 -v -3.216506 1.718750 -0.375000 -v -3.125000 1.627243 -0.375000 -v -3.000000 1.593750 -0.375000 -v -2.875000 1.627243 -0.375000 -v -2.783494 1.718750 -0.375000 -v -2.750000 1.843750 -0.375000 -v -2.783494 1.968750 -0.375000 -v -2.875000 2.060256 -0.375000 -v -3.000000 2.156250 -0.375000 -v -3.156250 2.114383 -0.375000 -v -3.270633 2.000000 -0.375000 -v -3.312500 1.843750 -0.375000 -v -3.270633 1.687500 -0.375000 -v -3.156250 1.573117 -0.375000 -v -3.000000 1.531250 -0.375000 -v -2.843750 1.573117 -0.375000 -v -2.729367 1.687500 -0.375000 -v -2.687500 1.843750 -0.375000 -v -2.729367 2.000000 -0.375000 -v -2.843750 2.114383 -0.375000 -v -3.000000 2.156250 -0.500000 -v -3.156250 2.114383 -0.500000 -v -3.270633 2.000000 -0.500000 -v -3.312500 1.843750 -0.500000 -v -3.270633 1.687500 -0.500000 -v -3.156250 1.573117 -0.500000 -v -3.000000 1.531250 -0.500000 -v -2.843750 1.573117 -0.500000 -v -2.729367 1.687500 -0.500000 -v -2.687500 1.843750 -0.500000 -v -2.729367 2.000000 -0.500000 -v -2.843750 2.114383 -0.500000 -v -3.000000 2.093750 -0.625000 -v -3.125000 2.060256 -0.625000 -v -3.216506 1.968750 -0.625000 -v -3.250000 1.843750 -0.625000 -v -3.216506 1.718750 -0.625000 -v -3.125000 1.627244 -0.625000 -v -3.000000 1.593750 -0.625000 -v -2.875000 1.627244 -0.625000 -v -2.783494 1.718750 -0.625000 -v -2.750000 1.843750 -0.625000 -v -2.783494 1.968750 -0.625000 -v -2.875000 2.060256 -0.625000 -v -4.125000 1.656250 0.093750 -v -3.687500 1.656250 0.093750 -v -4.125000 1.656250 -0.093750 -v -3.687500 1.656250 -0.093750 -v -3.812500 1.468750 0.093750 -v -3.812500 1.468750 -0.093750 -v -2.312500 1.656250 0.093750 -v -1.875000 1.656250 0.093750 -v -2.312500 1.656250 -0.093750 -v -1.875000 1.656250 -0.093750 -v -2.312500 1.468750 0.093750 -v -1.875000 1.468750 0.093750 -v -2.312500 1.468750 -0.093750 -v -1.875000 1.468750 -0.093750 -v -4.312500 1.281250 0.093750 -v -4.312500 1.281250 -0.093750 -v -4.000000 1.281250 0.093750 -v -4.000000 1.281250 -0.093750 -v -2.500000 1.281250 0.093750 -v -2.187500 1.281250 0.093750 -v -2.500000 1.281250 -0.093750 -v -2.187500 1.281250 -0.093750 -v -2.000000 1.468750 0.093750 -v -2.000000 1.468750 -0.093750 -v -4.125000 1.468750 0.093750 -v -4.125000 1.468750 -0.093750 -v -4.875000 1.281250 0.093750 -v -4.875000 1.281250 -0.093750 -v -5.062500 1.093750 -0.093750 -v -5.062500 0.781250 -0.281250 -v -4.750000 1.093750 -0.093750 -v -4.750000 0.781250 -0.281250 -v -5.062500 0.531250 -0.156250 -v -4.750000 0.531250 -0.156250 -v -4.750000 0.718750 -0.156250 -v -4.750000 0.718750 0.156250 -v -4.750000 0.531250 0.156250 -v -5.062500 1.093750 0.093750 -v -4.750000 1.093750 0.093750 -v -4.750000 0.531250 0.281250 -v -4.750000 0.781250 0.281250 -v -5.062500 0.781250 0.281250 -v -5.062500 0.531250 0.281250 -v -5.062500 0.531250 0.156250 -v -5.062500 0.718750 0.156250 -v -5.062500 0.718750 -0.156250 -v -2.187500 1.093750 0.093750 -v -2.500000 1.093750 0.093750 -v -2.500000 0.781250 -0.281250 -v -2.187500 0.781250 -0.281250 -v -2.500000 0.531250 -0.156250 -v -2.187500 0.531250 -0.156250 -v -2.187500 0.718750 -0.156250 -v -2.187500 0.718750 0.156250 -v -2.187500 0.531250 0.156250 -v -2.187500 0.531250 0.281250 -v -2.187500 0.781250 0.281250 -v -2.500000 0.781250 0.281250 -v -2.500000 0.531250 0.281250 -v -2.500000 0.531250 0.156250 -v -2.500000 0.718750 0.156250 -v -2.500000 0.718750 -0.156250 -v -2.187500 1.093750 -0.093750 -v -2.500000 1.093750 -0.093750 -v -4.750000 0.906250 0.093750 -v -4.750000 0.906250 -0.093750 -v -4.562500 1.031250 0.093750 -v -4.562500 1.031250 -0.093750 -v -2.500000 0.906250 0.093750 -v -2.500000 0.906250 -0.093750 -v -2.687500 1.031250 0.093750 -v -2.687500 1.031250 -0.093750 -v -4.906250 0.718750 -0.343750 -v -4.950444 0.700444 -0.343750 -v -4.968750 0.656250 -0.343750 -v -4.950444 0.612056 -0.343750 -v -4.906250 0.593750 -0.343750 -v -4.862056 0.612056 -0.343750 -v -4.843750 0.656250 -0.343750 -v -4.862056 0.700444 -0.343750 -v -4.906250 0.718750 -0.406250 -v -4.950444 0.700444 -0.406250 -v -4.968750 0.656250 -0.406250 -v -4.950444 0.612056 -0.406250 -v -4.906250 0.593750 -0.406250 -v -4.862056 0.612056 -0.406250 -v -4.843750 0.656250 -0.406250 -v -4.862056 0.700444 -0.406250 -v -2.343750 0.718750 -0.343750 -v -2.387945 0.700444 -0.343750 -v -2.406250 0.656250 -0.343750 -v -2.387945 0.612056 -0.343750 -v -2.343750 0.593750 -0.343750 -v -2.299556 0.612056 -0.343750 -v -2.281250 0.656250 -0.343750 -v -2.299556 0.700444 -0.343750 -v -2.343750 0.718750 -0.406250 -v -2.387945 0.700444 -0.406250 -v -2.406250 0.656250 -0.406250 -v -2.387945 0.612056 -0.406250 -v -2.343750 0.593750 -0.406250 -v -2.299556 0.612056 -0.406250 -v -2.281250 0.656250 -0.406250 -v -2.299556 0.700444 -0.406250 -v -2.500000 0.531250 -0.343750 -v -2.187500 0.531250 -0.343750 -v -2.500000 0.781250 -0.343750 -v -2.187500 0.781250 -0.343750 -v -5.062500 0.781250 -0.343750 -v -5.062500 0.531250 -0.343750 -v -4.750000 0.781250 -0.343750 -v -4.750000 0.531250 -0.343750 -v -3.687500 1.468750 0.093750 -v -3.687500 1.468750 -0.093750 -vt 0.815385 0.353846 -vt 0.738462 0.276923 -vt 0.815385 0.276923 -vt 0.738462 0.123077 -vt 0.815385 0.200000 -vt 0.738462 0.200000 -vt 0.815385 0.046154 -vt 0.738462 0.046154 -vt 0.830769 0.115385 -vt 0.815385 0.123077 -vt 0.830769 0.269231 -vt 0.830769 0.346154 -vt 0.830769 0.192308 -vt 0.830769 0.207692 -vt 0.892308 0.269231 -vt 0.661538 0.269231 -vt 0.723077 0.207692 -vt 0.723077 0.269231 -vt 0.738462 0.353846 -vt 0.723077 0.284615 -vt 0.723077 0.053846 -vt 0.723077 0.130769 -vt 0.938462 0.476923 -vt 0.961538 0.453846 -vt 0.961538 0.476923 -vt 0.923077 0.084615 -vt 0.946154 0.269231 -vt 0.923077 0.269231 -vt 0.923077 0.476923 -vt 0.938462 0.453846 -vt 0.192308 0.384615 -vt 0.215385 0.407692 -vt 0.169231 0.407692 -vt 0.115385 0.376923 -vt 0.100000 0.400000 -vt 0.076923 0.376923 -vt 0.900000 0.400000 -vt 0.876923 0.415385 -vt 0.876923 0.376923 -vt 0.876923 0.515385 -vt 0.900000 0.530769 -vt 0.876923 0.553846 -vt 0.946154 0.284615 -vt 0.923077 0.307692 -vt 0.923077 0.284615 -vt 0.961538 0.530769 -vt 0.938462 0.530769 -vt 0.938462 0.492308 -vt 0.938462 0.438462 -vt 0.946154 0.376923 -vt 0.946154 0.307692 -vt 0.115385 0.153846 -vt 0.076923 0.169231 -vt 0.076923 0.153846 -vt 0.030769 0.261538 -vt 0.053846 0.238462 -vt 0.053846 0.261538 -vt 0.230769 0.276923 -vt 0.192308 0.307692 -vt 0.192308 0.276923 -vt 0.115385 0.261538 -vt 0.076923 0.276923 -vt 0.076923 0.261538 -vt 0.230769 0.146154 -vt 0.192308 0.169231 -vt 0.192308 0.146154 -vt 0.876923 0.361538 -vt 0.892308 0.338462 -vt 0.900000 0.361538 -vt 0.992308 0.361538 -vt 0.969231 0.361538 -vt 0.976923 0.338462 -vt 0.876923 0.084615 -vt 0.900000 0.084615 -vt 0.892308 0.107692 -vt 0.992308 0.084615 -vt 0.976923 0.107692 -vt 0.969231 0.084615 -vt 0.138462 0.215385 -vt 0.115385 0.200000 -vt 0.130769 0.192308 -vt 0.230769 0.361538 -vt 0.230769 0.384615 -vt 0.969231 0.400000 -vt 0.900000 0.400000 -vt 0.923077 0.376923 -vt 0.076923 0.353846 -vt 0.423077 0.584615 -vt 0.420824 0.579176 -vt 0.415385 0.576923 -vt 0.415385 0.600000 -vt 0.407692 0.607692 -vt 0.415385 0.615385 -vt 0.061538 0.192308 -vt 0.076923 0.200000 -vt 0.230769 0.200000 -vt 0.230769 0.169231 -vt 0.030769 0.323077 -vt 0.007692 0.307692 -vt 0.023077 0.300000 -vt 0.130769 0.300000 -vt 0.169231 0.300000 -vt 0.138462 0.346154 -vt 0.192308 0.253846 -vt 0.923077 0.553846 -vt 0.923077 0.530769 -vt 0.923077 0.453846 -vt 0.900000 0.453846 -vt 0.900000 0.438462 -vt 0.923077 0.476923 -vt 0.900000 0.492308 -vt 0.900000 0.476923 -vt 0.830769 0.053846 -vt 0.830769 0.284615 -vt 0.830769 0.130769 -vt 0.892308 0.207692 -vt 0.661538 0.207692 -vt 0.723077 0.346154 -vt 0.723077 0.115385 -vt 0.723077 0.192308 -vt 0.946154 0.084615 -vt 0.923077 0.453846 -vt 0.138462 0.400000 -vt 0.938462 0.400000 -vt 0.961538 0.400000 -vt 0.115385 0.169231 -vt 0.030769 0.238462 -vt 0.230769 0.307692 -vt 0.115385 0.276923 -vt 0.184615 0.200000 -vt 0.161538 0.238462 -vt 0.161538 0.215385 -vt 0.138462 0.238462 -vt 0.169231 0.192308 -vt 0.192308 0.200000 -vt 0.169231 0.169231 -vt 0.130769 0.169231 -vt 0.192308 0.361538 -vt 0.115385 0.353846 -vt 0.409945 0.579176 -vt 0.407692 0.584615 -vt 0.409945 0.590055 -vt 0.415385 0.592308 -vt 0.420824 0.590055 -vt 0.409945 0.602253 -vt 0.409945 0.613132 -vt 0.420824 0.613132 -vt 0.423077 0.607692 -vt 0.420824 0.602253 -vt 0.007692 0.200000 -vt 0.000000 0.200000 -vt 0.000000 0.169231 -vt 0.023077 0.169231 -vt 0.023077 0.192308 -vt 0.061538 0.169231 -vt 0.076923 0.307692 -vt 0.061538 0.300000 -vt 0.053846 0.346154 -vt 0.053846 0.323077 -vt 0.061538 0.276923 -vt -0.000000 0.276923 -vt 0.023077 0.276923 -vt -0.000000 0.307692 -vt 0.030769 0.346154 -vt 0.169231 0.276923 -vt 0.184615 0.307692 -vt 0.161538 0.346154 -vt 0.115385 0.307692 -vt 0.130769 0.276923 -vt 0.230769 0.253846 -vt 0.900000 0.553846 -vt 0.923077 0.400000 -vt 0.300000 0.523077 -vt 0.323077 0.538462 -vt 0.323077 0.523077 -vt 0.346154 0.523077 -vt 0.369231 0.538462 -vt 0.369231 0.523077 -vt 0.507692 0.523077 -vt 0.530769 0.538462 -vt 0.530769 0.523077 -vt 0.438462 0.523077 -vt 0.461538 0.538462 -vt 0.461538 0.523077 -vt 0.392308 0.538462 -vt 0.392308 0.523077 -vt 0.253846 0.523077 -vt 0.276923 0.538462 -vt 0.276923 0.523077 -vt 0.484615 0.538462 -vt 0.484615 0.523077 -vt 0.415385 0.538462 -vt 0.415385 0.523077 -vt 0.300000 0.538462 -vt 0.346154 0.538462 -vt 0.507692 0.538462 -vt 0.438462 0.538462 -vt 0.248693 0.519231 -vt 0.215385 0.461538 -vt 0.182076 0.519231 -vt 0.413462 0.523077 -vt 0.392308 0.515385 -vt 0.394231 0.523077 -vt 0.417308 0.523077 -vt 0.438462 0.515385 -vt 0.415385 0.515385 -vt 0.459615 0.523077 -vt 0.440385 0.523077 -vt 0.463462 0.523077 -vt 0.484615 0.515385 -vt 0.461538 0.515385 -vt 0.505769 0.523077 -vt 0.486538 0.523077 -vt 0.509615 0.523077 -vt 0.530769 0.515385 -vt 0.507692 0.515385 -vt 0.275000 0.523077 -vt 0.253846 0.515385 -vt 0.255769 0.523077 -vt 0.298077 0.523077 -vt 0.276923 0.515385 -vt 0.278846 0.523077 -vt 0.321154 0.523077 -vt 0.300000 0.515385 -vt 0.301923 0.523077 -vt 0.325000 0.523077 -vt 0.346154 0.515385 -vt 0.323077 0.515385 -vt 0.390385 0.523077 -vt 0.369231 0.515385 -vt 0.371154 0.523077 -vt 0.367308 0.523077 -vt 0.348077 0.523077 -vt 0.276923 0.361538 -vt 0.323077 0.361538 -vt 0.484615 0.361538 -vt 0.415385 0.361538 -vt 0.300000 0.361538 -vt 0.346154 0.361538 -vt 0.507692 0.361538 -vt 0.438462 0.361538 -vt 0.369231 0.361538 -vt 0.253846 0.361538 -vt 0.461538 0.361538 -vt 0.392308 0.361538 -vt 0.373077 0.330769 -vt 0.365385 0.330769 -vt 0.350000 0.330769 -vt 0.342308 0.330769 -vt 0.326923 0.330769 -vt 0.303846 0.330769 -vt 0.280769 0.330769 -vt 0.257692 0.330769 -vt 0.530769 0.361538 -vt 0.511539 0.330769 -vt 0.503846 0.330769 -vt 0.488462 0.330769 -vt 0.480769 0.330769 -vt 0.465385 0.330769 -vt 0.442308 0.330769 -vt 0.419231 0.330769 -vt 0.411538 0.330769 -vt 0.396154 0.330769 -vt 0.853846 0.469231 -vt 0.530769 0.446154 -vt 0.853846 0.446154 -vt 0.853846 0.630769 -vt 0.530769 0.607692 -vt 0.853846 0.607692 -vt 0.853846 0.561538 -vt 0.530769 0.538462 -vt 0.853846 0.538462 -vt 0.853846 0.492308 -vt 0.530769 0.469231 -vt 0.853846 0.376923 -vt 0.530769 0.353846 -vt 0.853846 0.353846 -vt 0.853846 0.584615 -vt 0.530769 0.561538 -vt 0.853846 0.515385 -vt 0.530769 0.492308 -vt 0.853846 0.400000 -vt 0.530769 0.376923 -vt 0.530769 0.423077 -vt 0.853846 0.423077 -vt 0.530769 0.584615 -vt 0.530769 0.515385 -vt 0.530769 0.400000 -vt 0.407692 0.738462 -vt 0.223077 0.769231 -vt 0.223077 0.730769 -vt 0.407692 0.723077 -vt 0.223077 0.692308 -vt 0.407692 0.700000 -vt 0.407692 0.684615 -vt 0.223077 0.653846 -vt 0.407692 0.661538 -vt 0.407692 0.646154 -vt 0.223077 0.615385 -vt 0.407692 0.623077 -vt 0.407692 0.607692 -vt 0.223077 0.576923 -vt 0.407692 0.584615 -vt 0.407692 0.569231 -vt 0.223077 0.538462 -vt 0.407692 0.546154 -vt 0.407692 0.969231 -vt 0.223077 1.000000 -vt 0.223077 0.961538 -vt 0.407692 0.953846 -vt 0.223077 0.923077 -vt 0.407692 0.930769 -vt 0.407692 0.915385 -vt 0.223077 0.884615 -vt 0.407692 0.892308 -vt 0.407692 0.876923 -vt 0.223077 0.846154 -vt 0.407692 0.853846 -vt 0.407692 0.800000 -vt 0.407692 0.776923 -vt 0.407692 0.838462 -vt 0.223077 0.807692 -vt 0.407692 0.815385 -vt 0.038462 0.692308 -vt 0.038462 0.961538 -vt 0.038462 0.846154 -vt 0.038462 0.730769 -vt 0.038462 0.538462 -vt 0.038462 0.884615 -vt 0.038462 0.769231 -vt 0.038462 0.576923 -vt 0.038462 0.653846 -vt 0.038462 0.923077 -vt 0.038462 0.807692 -vt 0.038462 0.615385 -vt 0.030769 0.882692 -vt 0.030769 0.848077 -vt 0.030769 0.844231 -vt 0.030769 0.809615 -vt 0.030769 0.805769 -vt 0.030769 0.771154 -vt 0.030769 0.732692 -vt 0.030769 0.694231 -vt 0.030769 0.655769 -vt 0.030769 0.651923 -vt 0.030769 0.617308 -vt 0.030769 0.613461 -vt 0.030769 0.578846 -vt 0.030769 0.540385 -vt 0.038462 1.000000 -vt 0.030769 0.963462 -vt 0.030769 0.925000 -vt 0.030769 0.886539 -vt 0.030769 0.769231 -vt 0.000000 0.730769 -vt 0.030769 0.730769 -vt 0.030769 0.576923 -vt -0.000000 0.538462 -vt 0.030769 0.538462 -vt 0.030769 0.923077 -vt 0.000000 0.884615 -vt 0.030769 0.884615 -vt 0.030769 0.807692 -vt -0.000000 0.769231 -vt 0.030769 0.615385 -vt 0.000000 0.576923 -vt 0.030769 0.692308 -vt 0.000000 0.653846 -vt 0.030769 0.653846 -vt 0.030769 0.961538 -vt -0.000000 0.923077 -vt 0.030769 0.846154 -vt -0.000000 0.807692 -vt 0.000000 0.615385 -vt 0.000000 0.692308 -vt 0.030769 1.000000 -vt -0.000000 0.961538 -vt -0.000000 0.846154 -vt 0.009275 0.434615 -vt 0.129186 0.434615 -vt 0.069231 0.538462 -vt 0.515385 0.300000 -vt 0.500000 0.292308 -vt 0.515385 0.292308 -vt 0.438462 0.300000 -vt 0.423077 0.292308 -vt 0.438462 0.292308 -vt 0.392308 0.300000 -vt 0.376923 0.292308 -vt 0.392308 0.292308 -vt 0.530769 0.300000 -vt 0.530769 0.292308 -vt 0.453846 0.300000 -vt 0.453846 0.292308 -vt 0.407692 0.300000 -vt 0.407692 0.292308 -vt 0.361538 0.300000 -vt 0.346154 0.292308 -vt 0.361538 0.292308 -vt 0.469231 0.300000 -vt 0.469231 0.292308 -vt 0.500000 0.300000 -vt 0.484615 0.292308 -vt 0.423077 0.300000 -vt 0.376923 0.300000 -vt 0.484615 0.300000 -vt 0.376923 0.330769 -vt 0.361538 0.307692 -vt 0.376923 0.307692 -vt 0.484615 0.330769 -vt 0.469231 0.307692 -vt 0.484615 0.307692 -vt 0.515385 0.330769 -vt 0.500000 0.307692 -vt 0.515385 0.307692 -vt 0.438462 0.330769 -vt 0.423077 0.307692 -vt 0.438462 0.307692 -vt 0.392308 0.330769 -vt 0.392308 0.307692 -vt 0.530769 0.330769 -vt 0.530769 0.307692 -vt 0.453846 0.330769 -vt 0.453846 0.307692 -vt 0.407692 0.330769 -vt 0.407692 0.307692 -vt 0.361538 0.330769 -vt 0.346154 0.307692 -vt 0.469231 0.330769 -vt 0.500000 0.330769 -vt 0.423077 0.330769 -vt 0.550000 0.348693 -vt 0.588462 0.348693 -vt 0.607692 0.315385 -vt 0.452308 0.300000 -vt 0.440000 0.300000 -vt 0.467692 0.300000 -vt 0.455385 0.300000 -vt 0.483077 0.300000 -vt 0.470769 0.300000 -vt 0.498462 0.300000 -vt 0.486154 0.300000 -vt 0.501539 0.300000 -vt 0.516923 0.300000 -vt 0.360000 0.300000 -vt 0.347692 0.300000 -vt 0.375385 0.300000 -vt 0.363077 0.300000 -vt 0.390769 0.300000 -vt 0.378462 0.300000 -vt 0.406154 0.300000 -vt 0.393846 0.300000 -vt 0.424615 0.300000 -vt 0.409231 0.300000 -vt 0.615385 0.323077 -vt 0.607692 0.338462 -vt 0.607692 0.323077 -vt 0.615385 0.215385 -vt 0.607692 0.230769 -vt 0.607692 0.215385 -vt 0.615385 0.184615 -vt 0.607692 0.200000 -vt 0.607692 0.184615 -vt 0.615385 0.261538 -vt 0.607692 0.276923 -vt 0.607692 0.261538 -vt 0.615385 0.307692 -vt 0.607692 0.307692 -vt 0.615385 0.169231 -vt 0.607692 0.169231 -vt 0.615385 0.246154 -vt 0.607692 0.246154 -vt 0.615385 0.292308 -vt 0.607692 0.292308 -vt 0.615385 0.338462 -vt 0.607692 0.353846 -vt 0.615385 0.230769 -vt 0.615385 0.200000 -vt 0.615385 0.276923 -vt 0.615385 0.213846 -vt 0.623077 0.200000 -vt 0.623077 0.215385 -vt 0.615385 0.198462 -vt 0.623077 0.184615 -vt 0.615385 0.183077 -vt 0.623077 0.169231 -vt 0.615385 0.340000 -vt 0.623077 0.353846 -vt 0.615385 0.352308 -vt 0.615385 0.324615 -vt 0.623077 0.338462 -vt 0.615385 0.336923 -vt 0.615385 0.309231 -vt 0.623077 0.323077 -vt 0.615385 0.321538 -vt 0.615385 0.293846 -vt 0.623077 0.307692 -vt 0.615385 0.306154 -vt 0.615385 0.290769 -vt 0.623077 0.276923 -vt 0.623077 0.292308 -vt 0.615385 0.275385 -vt 0.623077 0.261538 -vt 0.615385 0.247692 -vt 0.615385 0.260000 -vt 0.615385 0.232308 -vt 0.623077 0.246154 -vt 0.615385 0.244615 -vt 0.615385 0.216923 -vt 0.623077 0.230769 -vt 0.615385 0.229231 -vt 0.646154 0.307692 -vt 0.646154 0.169231 -vt 0.646154 0.246154 -vt 0.646154 0.292308 -vt 0.646154 0.338462 -vt 0.646154 0.230769 -vt 0.646154 0.200000 -vt 0.646154 0.276923 -vt 0.646154 0.323077 -vt 0.646154 0.215385 -vt 0.646154 0.184615 -vt 0.646154 0.261538 -vt 0.703846 0.348693 -vt 0.665385 0.348693 -vt 0.646154 0.315385 -vt 0.676923 -0.000000 -vt 0.661538 0.007692 -vt 0.661538 -0.000000 -vt 0.753846 -0.000000 -vt 0.738462 0.007692 -vt 0.738462 0.000000 -vt 0.800000 0.000000 -vt 0.784615 0.007692 -vt 0.784615 -0.000000 -vt 0.846154 -0.000000 -vt 0.830769 0.007692 -vt 0.830769 -0.000000 -vt 0.723077 0.007692 -vt 0.723077 -0.000000 -vt 0.707692 -0.000000 -vt 0.692308 0.007692 -vt 0.692308 -0.000000 -vt 0.769231 0.007692 -vt 0.769231 -0.000000 -vt 0.815385 0.007692 -vt 0.815385 -0.000000 -vt 0.707692 0.007692 -vt 0.676923 0.007692 -vt 0.753846 0.007692 -vt 0.800000 0.007692 -vt 0.676923 0.015385 -vt 0.661538 0.030769 -vt 0.661538 0.015385 -vt 0.753846 0.015385 -vt 0.738462 0.030769 -vt 0.738462 0.015385 -vt 0.800000 0.015385 -vt 0.784615 0.030769 -vt 0.784615 0.015385 -vt 0.846154 0.015385 -vt 0.830769 0.030769 -vt 0.830769 0.015385 -vt 0.723077 0.030769 -vt 0.723077 0.015385 -vt 0.707692 0.015385 -vt 0.692308 0.030769 -vt 0.692308 0.015385 -vt 0.769231 0.030769 -vt 0.769231 0.015385 -vt 0.815385 0.030769 -vt 0.815385 0.015385 -vt 0.707692 0.030769 -vt 0.676923 0.030769 -vt 0.753846 0.030769 -vt 0.800000 0.030769 -vt 0.661538 0.046154 -vt 0.676923 0.046154 -vt 0.692308 0.046154 -vt 0.723077 0.046154 -vt 0.738462 0.046154 -vt 0.753846 0.046154 -vt 0.769231 0.046154 -vt 0.784615 0.046154 -vt 0.800000 0.046154 -vt 0.846154 0.030769 -vt 0.830769 0.046154 -vt 0.815385 0.046154 -vt 0.661538 0.076923 -vt 0.676923 0.103570 -vt 0.723077 0.076923 -vt 0.709231 0.007692 -vt 0.721538 0.007692 -vt 0.724615 0.007692 -vt 0.736923 0.007692 -vt 0.740000 0.007692 -vt 0.752308 0.007692 -vt 0.767692 0.007692 -vt 0.755385 0.007692 -vt 0.783077 0.007692 -vt 0.770769 0.007692 -vt 0.786154 0.007692 -vt 0.798462 0.007692 -vt 0.801538 0.007692 -vt 0.813846 0.007692 -vt 0.816923 0.007692 -vt 0.829231 0.007692 -vt 0.832308 0.007692 -vt 0.844615 0.007692 -vt 0.675385 0.007692 -vt 0.663077 0.007692 -vt 0.690769 0.007692 -vt 0.678462 0.007692 -vt 0.706154 0.007692 -vt 0.693846 0.007692 -vt 0.938462 0.553846 -vt 0.961538 0.553846 -vt 0.846154 0.476923 -vt 0.884615 0.453846 -vt 0.884615 0.476923 -vt 0.923077 0.061538 -vt 0.946154 0.061538 -vt 0.161538 0.392308 -vt 0.138462 0.369231 -vt 0.161538 0.369231 -vt 0.192308 0.253846 -vt 0.230769 0.207692 -vt 0.230769 0.253846 -vt 0.076923 0.246154 -vt 0.115385 0.246154 -vt 0.192308 0.315385 -vt 0.230769 0.315385 -vt 0.138462 0.246154 -vt 0.030769 0.353846 -vt 0.053846 0.353846 -vt 1.000000 0.338462 -vt 0.430769 0.576923 -vt 0.438462 0.569231 -vt 0.438462 0.576923 -vt 0.415385 0.576923 -vt 0.423077 0.569231 -vt 0.423077 0.576923 -vt 0.461538 0.576923 -vt 0.469231 0.569231 -vt 0.469231 0.576923 -vt 0.446154 0.576923 -vt 0.453846 0.569231 -vt 0.453846 0.576923 -vt 0.430769 0.569231 -vt 0.407692 0.576923 -vt 0.415385 0.569231 -vt 0.461538 0.569231 -vt 0.446154 0.569231 -vt 0.430769 0.600000 -vt 0.438462 0.592308 -vt 0.438462 0.600000 -vt 0.415385 0.600000 -vt 0.423077 0.592308 -vt 0.423077 0.600000 -vt 0.461538 0.600000 -vt 0.469231 0.592308 -vt 0.469231 0.600000 -vt 0.446154 0.600000 -vt 0.453846 0.592308 -vt 0.453846 0.600000 -vt 0.430769 0.592308 -vt 0.407692 0.600000 -vt 0.415385 0.592308 -vt 0.461538 0.592308 -vt 0.446154 0.592308 -vt 0.192308 0.207692 -vt 0.253846 0.538462 -vt 0.196154 0.533309 -vt 0.215385 0.538462 -vt 0.234615 0.533309 -vt 0.253846 0.500000 -vt 0.248693 0.480769 -vt 0.234615 0.466691 -vt 0.196154 0.466691 -vt 0.182076 0.480769 -vt 0.176923 0.500000 -vt 0.436538 0.523077 -vt 0.482692 0.523077 -vt 0.528846 0.523077 -vt 0.344231 0.523077 -vt 0.388462 0.330769 -vt 0.319231 0.330769 -vt 0.296154 0.330769 -vt 0.273077 0.330769 -vt 0.526923 0.330769 -vt 0.457692 0.330769 -vt 0.434615 0.330769 -vt 0.530769 0.630769 -vt 0.407692 0.761538 -vt 0.407692 0.992308 -vt 0.030769 0.767308 -vt 0.030769 0.728846 -vt 0.030769 0.690385 -vt 0.030769 0.575000 -vt 0.030769 0.998077 -vt 0.030769 0.959615 -vt 0.030769 0.921154 -vt 0.000000 1.000000 -vt 0.034615 0.529186 -vt 0.009275 0.503846 -vt 0.000000 0.469231 -vt 0.034615 0.409275 -vt 0.069231 0.400000 -vt 0.103846 0.409275 -vt 0.138462 0.469231 -vt 0.129186 0.503846 -vt 0.103846 0.529186 -vt 0.346154 0.300000 -vt 0.346154 0.330769 -vt 0.602539 0.296154 -vt 0.588462 0.282076 -vt 0.569231 0.276923 -vt 0.550000 0.282076 -vt 0.535922 0.296154 -vt 0.530769 0.315385 -vt 0.535922 0.334615 -vt 0.569231 0.353846 -vt 0.602539 0.334615 -vt 0.513846 0.300000 -vt 0.529231 0.300000 -vt 0.436923 0.300000 -vt 0.421538 0.300000 -vt 0.615385 0.353846 -vt 0.615385 0.201538 -vt 0.615385 0.186154 -vt 0.615385 0.170769 -vt 0.615385 0.278462 -vt 0.615385 0.263077 -vt 0.646154 0.353846 -vt 0.651307 0.296154 -vt 0.665385 0.282076 -vt 0.684615 0.276923 -vt 0.703846 0.282076 -vt 0.717924 0.296154 -vt 0.723077 0.315385 -vt 0.717924 0.334615 -vt 0.684615 0.353846 -vt 0.651307 0.334615 -vt 0.846154 0.007692 -vt 0.707692 0.046154 -vt 0.846154 0.046154 -vt 0.676923 0.050276 -vt 0.665661 0.061538 -vt 0.665661 0.092308 -vt 0.692308 0.107692 -vt 0.707692 0.103570 -vt 0.718955 0.092308 -vt 0.718955 0.061538 -vt 0.707692 0.050276 -vt 0.692308 0.046154 -vt 0.846154 0.453846 -vt 0.138462 0.392308 -vt 0.161538 0.246154 -vt 1.000000 0.107692 -vt 0.407692 0.569231 -vt 0.407692 0.592308 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 0.0000 1.0000 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -vn -0.4472 0.8944 0.0000 -vn -0.4472 -0.8944 0.0000 -vn -0.4472 0.0000 -0.8944 -vn -0.4472 0.0000 0.8944 -vn -1.0000 0.0000 0.0000 -vn 1.0000 0.0000 0.0000 -vn 0.4472 0.0000 -0.8944 -vn 0.4472 0.8944 0.0000 -vn 0.4472 0.0000 0.8944 -vn 0.4472 -0.8944 0.0000 -vn -0.7071 0.7071 0.0000 -vn 0.0000 0.5000 0.8660 -vn 0.0000 -0.5000 0.8660 -vn 0.0000 -0.8660 0.5000 -vn 0.0000 0.8660 -0.5000 -vn 0.0000 -0.5000 -0.8660 -vn 0.0000 0.8660 0.5000 -vn 0.0000 0.5000 -0.8660 -vn 0.0000 -0.8660 -0.5000 -vn 0.5547 0.8321 0.0000 -vn 0.5547 0.7206 -0.4160 -vn 0.5547 0.4160 -0.7206 -vn 0.5547 -0.0000 -0.8321 -vn 0.5547 -0.4160 -0.7206 -vn 0.5547 -0.7206 -0.4160 -vn 0.5547 -0.8321 0.0000 -vn 0.5547 -0.7206 0.4160 -vn 0.5547 -0.4160 0.7206 -vn 0.5547 0.0000 0.8321 -vn 0.5547 0.4160 0.7206 -vn 0.5547 0.7206 0.4160 -vn -0.2425 0.8402 -0.4851 -vn -0.2425 0.9701 -0.0000 -vn -0.2425 0.4851 -0.8402 -vn -0.2425 0.0000 -0.9701 -vn -0.2425 -0.4851 -0.8402 -vn -0.2425 -0.8402 -0.4851 -vn -0.2425 -0.9701 0.0000 -vn -0.2425 -0.8402 0.4851 -vn -0.2425 -0.4851 0.8402 -vn -0.2425 -0.0000 0.9701 -vn -0.2425 0.4851 0.8402 -vn -0.2425 0.8402 0.4851 -vn -0.8660 0.0000 -0.5000 -vn -0.5000 0.0000 -0.8660 -vn 0.8660 0.0000 0.5000 -vn -0.5000 0.0000 0.8660 -vn 0.8660 0.0000 -0.5000 -vn 0.5000 0.0000 0.8660 -vn -0.8660 0.0000 0.5000 -vn 0.5000 0.0000 -0.8660 -vn -0.5000 -0.8660 0.0000 -vn -0.8660 -0.5000 0.0000 -vn 0.5000 0.8660 0.0000 -vn -0.8660 0.5000 0.0000 -vn -0.5000 0.8660 0.0000 -vn 0.8660 -0.5000 0.0000 -vn 0.8660 0.5000 0.0000 -vn 0.5000 -0.8660 0.0000 -vn -0.9751 0.0000 -0.2217 -vn 0.8445 0.4876 -0.2217 -vn 0.4876 -0.8445 -0.2217 -vn -0.8445 -0.4876 -0.2217 -vn 0.4876 0.8445 -0.2217 -vn -0.4876 0.8445 -0.2217 -vn 0.8445 -0.4876 -0.2217 -vn -0.4876 -0.8445 -0.2217 -vn 0.0000 0.9751 -0.2217 -vn -0.8445 0.4876 -0.2217 -vn 0.9751 0.0000 -0.2217 -vn -0.0000 -0.9751 -0.2217 -vn -0.8944 0.0000 -0.4472 -vn -0.7746 0.4472 -0.4472 -vn -0.4472 0.7746 -0.4472 -vn 0.4472 0.7746 -0.4472 -vn 0.7746 0.4472 -0.4472 -vn 0.8944 0.0000 -0.4472 -vn 0.7746 -0.4472 -0.4472 -vn 0.4472 -0.7746 -0.4472 -vn 0.0000 -0.8944 -0.4472 -vn -0.7746 -0.4472 -0.4472 -vn -0.4472 -0.7746 -0.4472 -vn -0.9239 0.3827 0.0000 -vn 0.7071 -0.7071 0.0000 -vn 0.3827 -0.9239 0.0000 -vn 0.9239 -0.3827 0.0000 -vn 0.0000 0.5145 -0.8575 -vn 0.0000 0.8702 -0.4927 -vn 0.0000 0.2669 0.9637 -vn 0.0000 0.5145 0.8575 -vn 0.2898 -0.9571 0.0000 -vn -0.2898 -0.9571 0.0000 -vn -0.5547 -0.8321 0.0000 -vn 0.7071 0.7071 0.0000 -vn -0.7071 -0.7071 0.0000 -vn 0.0000 0.8944 -0.4472 -s off -f 926/1618/432 929/1619/432 925/1620/432 -f 928/1621/433 923/1622/433 927/1623/433 -f 929/1619/434 923/1622/434 925/1620/434 -f 926/1624/435 928/1621/435 930/1625/435 -f 926/1624/436 932/1626/436 924/1627/436 -f 923/1622/437 933/1628/437 925/1620/437 -f 925/1620/438 934/1629/438 926/1618/438 -f 924/1627/439 931/1630/439 923/1622/439 -f 931/1631/440 934/1632/440 933/1628/440 -f 938/1633/441 935/1634/441 937/1635/441 -f 930/1636/442 937/1637/442 929/1619/442 -f 928/1621/443 938/1638/443 930/1625/443 -f 927/1623/444 936/1639/444 928/1621/444 -f 929/1619/445 935/1634/445 927/1623/445 -f 1154/1640/441 1152/1641/441 1150/1642/441 -f 1161/1643/435 1160/1644/435 1159/1645/435 -f 1165/1646/434 1156/1647/434 1154/1640/434 -f 1164/1648/432 1155/1649/432 1166/1650/432 -f 1162/1651/433 1153/1652/433 1161/1653/433 -f 1168/1654/432 1160/1655/432 1158/1656/432 -f 1159/1657/433 1167/1658/433 1157/1659/433 -f 1168/1660/446 1157/1661/446 1167/1662/446 -f 1149/1663/433 1153/1664/433 1165/1665/433 -f 1152/1641/432 1156/1647/432 1166/1666/432 -f 1170/1667/435 1157/1661/435 1158/1668/435 -f 1179/1669/434 1185/1670/434 1186/1671/434 -f 1170/1672/446 1180/1673/446 1169/1674/446 -f 1247/1675/432 1250/1676/432 1248/1677/432 -f 1197/1678/434 1201/1679/434 1202/1680/434 -f 1175/1681/434 1254/1682/434 1176/1683/434 -f 1207/1684/433 1209/1685/433 1181/1686/433 -f 1208/1687/432 1173/1688/432 1210/1689/432 -f 1211/1690/433 1190/1691/433 1213/1692/433 -f 1212/1693/432 1214/1694/432 1206/1695/432 -f 1207/1696/441 1183/1697/441 1178/1698/441 -f 1164/1648/432 1206/1699/432 1163/1700/432 -f 1171/1701/432 1170/1667/432 1173/1688/432 -f 1158/1668/432 1160/1644/432 1210/1689/432 -f 1180/1702/433 1181/1686/433 1169/1703/433 -f 1190/1704/433 1162/1651/433 1161/1653/433 -f 1159/1645/433 1213/1692/433 1161/1643/433 -f 1227/1705/432 1226/1706/432 1225/1707/432 -f 1241/1708/432 1239/1709/432 1245/1710/432 -f 1187/1711/440 1184/1712/440 1180/1673/440 -f 1251/1713/432 1254/1682/432 1252/1714/432 -f 1212/1715/440 1191/1716/440 1204/1717/440 -f 1196/1718/441 1195/1719/441 1189/1720/441 -f 1194/1721/434 1247/1675/434 1248/1677/434 -f 1145/1722/440 1167/1658/440 1143/1723/440 -f 1146/1724/432 1256/1725/432 1148/1726/432 -f 1144/1727/441 1256/1725/441 1146/1724/441 -f 1147/1728/433 1255/1729/433 1144/1727/433 -f 926/1618/432 930/1636/432 929/1619/432 -f 928/1621/433 924/1627/433 923/1622/433 -f 929/1619/434 927/1623/434 923/1622/434 -f 926/1624/435 924/1627/435 928/1621/435 -f 926/1624/436 934/1730/436 932/1626/436 -f 923/1622/437 931/1631/437 933/1628/437 -f 925/1620/438 933/1731/438 934/1629/438 -f 924/1627/439 932/1732/439 931/1630/439 -f 931/1631/440 932/1733/440 934/1632/440 -f 938/1633/441 936/1734/441 935/1634/441 -f 930/1636/442 938/1735/442 937/1637/442 -f 928/1621/443 936/1736/443 938/1638/443 -f 927/1623/444 935/1737/444 936/1639/444 -f 929/1619/445 937/1635/445 935/1634/445 -f 1154/1640/441 1156/1647/441 1152/1641/441 -f 1161/1643/435 1163/1738/435 1160/1644/435 -f 1165/1646/434 1166/1739/434 1156/1647/434 -f 1164/1648/432 1163/1700/432 1155/1649/432 -f 1162/1651/433 1165/1740/433 1153/1652/433 -f 1168/1654/432 1148/1726/432 1160/1655/432 -f 1159/1657/433 1147/1728/433 1167/1658/433 -f 1168/1660/446 1158/1668/446 1157/1661/446 -f 1154/1640/433 1150/1642/433 1165/1665/433 -f 1150/1642/433 1149/1663/433 1165/1665/433 -f 1155/1741/432 1151/1742/432 1166/1666/432 -f 1151/1742/432 1152/1641/432 1166/1666/432 -f 1170/1667/435 1169/1703/435 1157/1661/435 -f 1179/1669/434 1182/1743/434 1185/1670/434 -f 1170/1672/446 1171/1744/446 1180/1673/446 -f 1247/1675/432 1249/1745/432 1250/1676/432 -f 1197/1678/434 1198/1746/434 1201/1679/434 -f 1175/1681/434 1252/1714/434 1254/1682/434 -f 1174/1747/441 1173/1748/441 1208/1749/441 -f 1207/1696/441 1181/1750/441 1183/1697/441 -f 1174/1747/441 1208/1749/441 1177/1751/441 -f 1208/1749/441 1207/1696/441 1177/1751/441 -f 1254/1682/441 1253/1752/441 1174/1747/441 -f 1177/1751/441 1176/1753/441 1254/1682/441 -f 1182/1743/441 1179/1754/441 1178/1698/441 -f 1177/1751/441 1254/1682/441 1174/1747/441 -f 1183/1697/441 1182/1743/441 1178/1698/441 -f 1178/1698/441 1177/1751/441 1207/1696/441 -f 1164/1648/432 1205/1755/432 1206/1699/432 -f 1160/1644/432 1163/1738/432 1214/1694/432 -f 1163/1738/432 1206/1695/432 1214/1694/432 -f 1214/1694/432 1210/1689/432 1160/1644/432 -f 1210/1689/432 1173/1688/432 1158/1668/432 -f 1173/1688/432 1170/1667/432 1158/1668/432 -f 1190/1704/433 1189/1756/433 1162/1651/433 -f 1159/1645/433 1157/1661/433 1209/1685/433 -f 1157/1661/433 1169/1703/433 1181/1686/433 -f 1209/1685/433 1157/1661/433 1181/1686/433 -f 1209/1685/433 1213/1692/433 1159/1645/433 -f 1213/1692/433 1190/1691/433 1161/1643/433 -f 1225/1707/432 1224/1757/432 1223/1758/432 -f 1223/1758/432 1230/1759/432 1225/1707/432 -f 1230/1759/432 1229/1760/432 1225/1707/432 -f 1229/1760/432 1228/1761/432 1225/1707/432 -f 1228/1761/432 1227/1705/432 1225/1707/432 -f 1241/1708/432 1240/1762/432 1239/1709/432 -f 1239/1709/432 1246/1763/432 1245/1710/432 -f 1245/1710/432 1244/1764/432 1243/1765/432 -f 1243/1765/432 1242/1766/432 1245/1710/432 -f 1242/1766/432 1241/1708/432 1245/1710/432 -f 1172/1767/440 1251/1768/440 1252/1769/440 -f 1252/1769/440 1175/1770/440 1188/1771/440 -f 1187/1711/440 1186/1772/440 1185/1670/440 -f 1172/1767/440 1252/1769/440 1188/1771/440 -f 1187/1711/440 1185/1670/440 1184/1712/440 -f 1172/1767/440 1188/1771/440 1171/1744/440 -f 1188/1771/440 1187/1711/440 1180/1673/440 -f 1180/1673/440 1171/1744/440 1188/1771/440 -f 1251/1713/432 1253/1752/432 1254/1682/432 -f 1201/1679/440 1200/1773/440 1203/1774/440 -f 1200/1773/440 1190/1775/440 1211/1776/440 -f 1200/1773/440 1211/1776/440 1203/1774/440 -f 1203/1774/440 1202/1777/440 1201/1679/440 -f 1247/1778/440 1193/1779/440 1204/1717/440 -f 1249/1780/440 1247/1778/440 1191/1716/440 -f 1247/1778/440 1204/1717/440 1191/1716/440 -f 1204/1717/440 1203/1774/440 1211/1776/440 -f 1212/1715/440 1206/1781/440 1191/1716/440 -f 1204/1717/440 1211/1776/440 1212/1715/440 -f 1194/1782/441 1248/1677/441 1195/1719/441 -f 1248/1677/441 1250/1676/441 1192/1783/441 -f 1192/1783/441 1205/1784/441 1195/1719/441 -f 1205/1784/441 1189/1720/441 1195/1719/441 -f 1248/1677/441 1192/1783/441 1195/1719/441 -f 1189/1720/441 1199/1785/441 1196/1718/441 -f 1199/1785/441 1198/1746/441 1196/1718/441 -f 1198/1746/441 1197/1786/441 1196/1718/441 -f 1194/1721/434 1193/1787/434 1247/1675/434 -f 1145/1722/440 1168/1788/440 1167/1658/440 -f 1168/1654/432 1145/1789/432 1148/1726/432 -f 1145/1789/432 1146/1724/432 1148/1726/432 -f 1144/1727/441 1255/1729/441 1256/1725/441 -f 1144/1727/433 1143/1723/433 1147/1728/433 -f 1143/1723/433 1167/1658/433 1147/1728/433 -s 1 -f 862/1790/447 863/1791/433 851/1792/433 -f 852/1793/448 865/1794/449 853/1795/449 -f 859/1796/450 872/1797/435 860/1798/435 -f 856/1799/451 869/1800/432 857/1801/432 -f 853/1795/449 866/1802/434 854/1803/434 -f 860/1804/435 873/1805/452 861/1806/452 -f 857/1801/432 870/1807/453 858/1808/453 -f 854/1803/434 867/1809/454 855/1810/454 -f 861/1806/452 874/1811/447 862/1790/447 -f 851/1792/433 864/1812/448 852/1793/448 -f 858/1808/453 871/1813/450 859/1796/450 -f 855/1810/454 868/1814/451 856/1799/451 -f 873/1815/440 869/1816/440 865/1817/440 -f 855/1818/440 878/1819/440 854/1820/440 -f 855/1821/440 880/1822/440 879/1823/440 -f 857/1824/440 880/1822/440 856/1825/440 -f 857/1826/440 882/1827/440 881/1828/440 -f 859/1829/440 882/1827/440 858/1830/440 -f 859/1831/440 884/1832/440 883/1833/440 -f 861/1834/440 884/1835/440 860/1836/440 -f 862/1837/440 885/1838/440 861/1839/440 -f 851/1840/440 886/1841/440 862/1842/440 -f 851/1843/440 876/1844/440 875/1845/440 -f 854/1846/440 877/1847/440 853/1848/440 -f 853/1849/440 876/1844/440 852/1850/440 -f 886/1841/451 897/1851/454 885/1838/454 -f 876/1844/453 887/1852/432 875/1845/432 -f 883/1833/449 894/1853/448 882/1827/448 -f 880/1822/447 891/1854/452 879/1823/452 -f 875/1845/432 898/1855/451 886/1841/451 -f 877/1847/450 888/1856/453 876/1844/453 -f 884/1832/434 895/1857/449 883/1833/449 -f 881/1828/433 892/1858/447 880/1822/447 -f 878/1819/435 889/1859/450 877/1847/450 -f 885/1838/454 896/1860/434 884/1835/434 -f 882/1827/448 893/1861/433 881/1828/433 -f 879/1823/452 890/1862/435 878/1819/435 -f 890/1862/455 901/1863/456 889/1859/456 -f 888/1856/457 901/1864/456 900/1865/457 -f 887/1852/458 900/1866/457 899/1867/458 -f 887/1852/458 910/1868/459 898/1855/459 -f 898/1855/459 909/1869/460 897/1851/460 -f 897/1851/460 908/1870/461 896/1860/461 -f 896/1871/461 907/1872/462 895/1857/462 -f 894/1853/463 907/1873/462 906/1874/463 -f 893/1861/464 906/1875/463 905/1876/464 -f 893/1861/464 904/1877/465 892/1858/465 -f 892/1858/465 903/1878/466 891/1854/466 -f 890/1862/455 903/1879/466 902/1880/455 -f 901/1881/450 912/1882/453 900/1883/453 -f 908/1884/434 919/1885/449 907/1886/449 -f 905/1887/433 916/1888/447 904/1889/447 -f 902/1890/435 913/1891/450 901/1881/450 -f 909/1892/454 920/1893/434 908/1894/434 -f 906/1895/448 917/1896/433 905/1887/433 -f 903/1897/452 914/1898/435 902/1890/435 -f 910/1899/451 921/1900/454 909/1892/454 -f 900/1883/453 911/1901/432 899/1902/432 -f 907/1886/449 918/1903/448 906/1895/448 -f 904/1889/447 915/1904/452 903/1897/452 -f 899/1902/432 922/1905/451 910/1899/451 -f 913/1906/467 942/1907/468 941/1908/467 -f 913/1909/467 940/1910/469 912/1911/469 -f 912/1912/469 939/1913/470 911/1914/470 -f 911/1915/470 950/1916/471 922/1917/471 -f 922/1918/471 949/1919/472 921/1920/472 -f 921/1921/472 948/1922/473 920/1923/473 -f 919/1924/474 948/1925/473 947/1926/474 -f 919/1927/474 946/1928/475 918/1929/475 -f 918/1930/475 945/1931/476 917/1932/476 -f 917/1933/476 944/1934/477 916/1935/477 -f 915/1936/478 942/1907/468 914/1937/468 -f 916/1938/477 943/1939/478 915/1940/478 -f 941/1908/450 952/1941/453 940/1910/453 -f 948/1925/434 959/1942/449 947/1926/449 -f 945/1931/433 956/1943/447 944/1934/447 -f 942/1907/435 953/1944/450 941/1908/450 -f 949/1919/454 960/1945/434 948/1922/434 -f 946/1928/448 957/1946/433 945/1931/433 -f 943/1939/452 954/1947/435 942/1907/435 -f 950/1916/451 961/1948/454 949/1919/454 -f 939/1913/432 952/1941/453 951/1949/432 -f 947/1926/449 958/1950/448 946/1928/448 -f 944/1934/447 955/1951/452 943/1939/452 -f 939/1913/432 962/1952/451 950/1916/451 -f 956/1943/441 969/1953/441 968/1954/441 -f 955/1951/441 968/1955/441 967/1956/441 -f 954/1947/441 967/1957/441 966/1958/441 -f 954/1947/441 965/1959/441 953/1944/441 -f 953/1944/441 964/1960/441 952/1941/441 -f 952/1941/441 963/1961/441 951/1949/441 -f 962/1952/441 963/1962/441 974/1963/441 -f 961/1948/441 974/1964/441 973/1965/441 -f 961/1948/441 972/1966/441 960/1945/441 -f 960/1967/441 971/1968/441 959/1942/441 -f 959/1942/441 970/1969/441 958/1950/441 -f 958/1950/441 969/1970/441 957/1946/441 -f 966/1971/434 977/1972/449 965/1973/449 -f 973/1974/452 984/1975/435 972/1976/435 -f 970/1977/453 981/1978/432 969/1979/432 -f 967/1980/454 978/1981/434 966/1971/434 -f 974/1982/447 985/1983/452 973/1974/452 -f 964/1984/448 975/1985/433 963/1986/433 -f 971/1987/450 982/1988/453 970/1977/453 -f 968/1989/451 979/1990/454 967/1980/454 -f 963/1986/433 986/1991/447 974/1982/447 -f 965/1973/449 976/1992/448 964/1984/448 -f 972/1993/435 983/1994/450 971/1987/450 -f 969/1979/432 980/1995/451 968/1989/451 -f 979/1996/441 983/1997/441 975/1998/441 -f 1001/1999/479 988/2000/480 989/2001/479 -f 1008/2002/441 995/2003/481 996/2004/441 -f 1005/2005/433 992/2006/482 993/2007/433 -f 1002/2008/440 989/2001/479 990/2009/440 -f 1009/2010/483 996/2004/441 997/2011/483 -f 1006/2012/484 993/2007/433 994/2013/484 -f 1003/2014/485 990/2015/440 991/2016/485 -f 1010/2017/486 997/2011/483 998/2018/486 -f 1000/2019/480 987/2020/432 988/2000/480 -f 1007/2021/481 994/2013/484 995/2003/481 -f 1004/2022/482 991/2016/485 992/2006/482 -f 999/2023/432 998/2018/486 987/2020/432 -f 1028/2024/482 1015/2025/485 1016/2026/482 -f 1023/2027/432 1022/2028/486 1011/2029/432 -f 1025/2030/479 1012/2031/480 1013/2032/479 -f 1032/2033/441 1019/2034/481 1020/2035/441 -f 1029/2036/433 1016/2026/482 1017/2037/433 -f 1026/2038/440 1013/2032/479 1014/2039/440 -f 1033/2040/483 1020/2035/441 1021/2041/483 -f 1030/2042/484 1017/2037/433 1018/2043/484 -f 1027/2044/485 1014/2045/440 1015/2025/485 -f 1034/2046/486 1021/2041/483 1022/2028/486 -f 1024/2047/480 1011/2029/432 1012/2031/480 -f 1031/2048/481 1018/2043/484 1019/2034/481 -f 1031/2049/435 1033/2050/435 1023/2051/435 -f 1009/2052/434 1020/2035/434 1008/2053/434 -f 1010/2054/434 1021/2041/434 1009/2055/434 -f 999/2056/434 1022/2028/434 1010/2057/434 -f 1000/2058/434 1011/2029/434 999/2059/434 -f 1000/2060/434 1013/2032/434 1012/2031/434 -f 1001/2061/434 1014/2039/434 1013/2032/434 -f 1003/2062/434 1014/2045/434 1002/2063/434 -f 1004/2064/434 1015/2025/434 1003/2065/434 -f 1005/2066/434 1016/2026/434 1004/2067/434 -f 1006/2068/434 1017/2037/434 1005/2069/434 -f 1007/2070/434 1020/2035/434 1019/2034/434 -f 1006/2071/434 1019/2034/434 1018/2043/434 -f 1052/2072/487 1039/2073/488 1040/2074/487 -f 1047/2075/435 1046/2076/489 1035/2077/435 -f 1049/2078/490 1036/2079/491 1037/2080/490 -f 1056/2081/441 1043/2082/492 1044/2083/441 -f 1053/2084/434 1040/2074/487 1041/2085/434 -f 1050/2086/440 1037/2080/490 1038/2087/440 -f 1057/2088/493 1044/2083/441 1045/2089/493 -f 1054/2090/494 1041/2085/434 1042/2091/494 -f 1051/2092/488 1038/2093/440 1039/2073/488 -f 1058/2094/489 1045/2089/493 1046/2076/489 -f 1048/2095/491 1035/2077/435 1036/2079/491 -f 1055/2096/492 1042/2091/494 1043/2082/492 -f 1047/2097/432 1060/2098/432 1059/2099/432 -f 1048/2100/432 1061/2101/432 1060/2098/432 -f 1049/2102/432 1062/2103/432 1061/2101/432 -f 1051/2104/432 1062/2105/432 1050/2106/432 -f 1052/2107/432 1063/2108/432 1051/2109/432 -f 1053/2110/432 1064/2111/432 1052/2112/432 -f 1054/2113/432 1065/2114/432 1053/2115/432 -f 1054/2116/432 1067/2117/432 1066/2118/432 -f 1055/2119/432 1068/2120/432 1067/2117/432 -f 1057/2121/432 1068/2120/432 1056/2122/432 -f 1058/2123/432 1069/2124/432 1057/2125/432 -f 1047/2126/432 1070/2127/432 1058/2128/432 -f 1077/2129/434 1064/2111/487 1065/2114/434 -f 1074/2130/440 1061/2101/490 1062/2103/440 -f 1081/2131/493 1068/2120/441 1069/2124/493 -f 1078/2132/494 1065/2114/434 1066/2118/494 -f 1075/2133/488 1062/2105/440 1063/2108/488 -f 1082/2134/489 1069/2124/493 1070/2127/489 -f 1072/2135/491 1059/2099/435 1060/2098/491 -f 1079/2136/492 1066/2118/494 1067/2117/492 -f 1076/2137/487 1063/2108/488 1064/2111/487 -f 1071/2138/435 1070/2127/489 1059/2099/435 -f 1073/2139/490 1060/2098/491 1061/2101/490 -f 1080/2140/441 1067/2117/492 1068/2120/441 -f 1079/2141/433 1081/2142/433 1071/2143/433 -f 1085/2144/490 1098/2145/440 1086/2146/440 -f 1092/2147/441 1105/2148/493 1093/2149/493 -f 1089/2150/434 1102/2151/494 1090/2152/494 -f 1086/2153/440 1099/2154/488 1087/2155/488 -f 1093/2149/493 1106/2156/489 1094/2157/489 -f 1083/2158/435 1096/2159/491 1084/2160/491 -f 1090/2152/494 1103/2161/492 1091/2162/492 -f 1087/2155/488 1100/2163/487 1088/2164/487 -f 1094/2157/489 1095/2165/435 1083/2158/435 -f 1084/2160/491 1097/2166/490 1085/2144/490 -f 1091/2162/492 1104/2167/441 1092/2147/441 -f 1088/2164/487 1101/2168/434 1089/2150/434 -f 1109/2169/490 1122/2170/495 1110/2171/440 -f 1116/2172/441 1129/2173/496 1117/2174/493 -f 1113/2175/434 1126/2176/497 1114/2177/494 -f 1110/2178/440 1123/2179/498 1111/2180/488 -f 1117/2174/493 1130/2181/499 1118/2182/489 -f 1107/2183/435 1120/2184/500 1108/2185/491 -f 1114/2177/494 1127/2186/501 1115/2187/492 -f 1111/2180/488 1124/2188/502 1112/2189/487 -f 1118/2182/489 1119/2190/503 1107/2183/435 -f 1108/2185/491 1121/2191/504 1109/2169/490 -f 1115/2187/492 1128/2192/505 1116/2172/441 -f 1112/2189/487 1125/2193/506 1113/2175/434 -f 1121/2191/504 1134/2194/507 1122/2170/495 -f 1120/2184/500 1133/2195/508 1121/2191/504 -f 1119/2190/503 1132/2196/509 1120/2184/500 -f 1142/2197/510 1119/2190/503 1130/2181/499 -f 1141/2198/511 1130/2181/499 1129/2173/496 -f 1140/2199/512 1129/2173/496 1128/2192/505 -f 1139/2200/513 1128/2192/505 1127/2186/501 -f 1138/2201/514 1127/2186/501 1126/2176/497 -f 1137/2202/515 1126/2176/497 1125/2193/506 -f 1124/2188/502 1137/2202/515 1125/2193/506 -f 1122/2203/495 1135/2204/516 1123/2179/498 -f 1123/2179/498 1136/2205/517 1124/2188/502 -f 1131/2206/432 1141/2207/432 1137/2208/432 -f 1118/2182/433 1095/2209/433 1106/2210/433 -f 1117/2174/433 1106/2211/433 1105/2212/433 -f 1116/2172/433 1105/2213/433 1104/2214/433 -f 1103/2215/433 1116/2172/433 1104/2216/433 -f 1102/2217/433 1115/2187/433 1103/2218/433 -f 1113/2175/433 1102/2219/433 1101/2220/433 -f 1112/2189/433 1101/2221/433 1100/2222/433 -f 1111/2180/433 1100/2223/433 1099/2224/433 -f 1110/2178/433 1099/2225/433 1098/2226/433 -f 1097/2227/433 1110/2171/433 1098/2228/433 -f 1096/2229/433 1109/2169/433 1097/2230/433 -f 1095/2231/433 1108/2185/433 1096/2232/433 -f 1155/2233/518 1149/1663/440 1151/2234/440 -f 1159/2235/519 1148/2236/520 1147/2237/520 -f 1163/1738/446 1153/2238/518 1155/2239/518 -f 1166/2240/519 1162/2241/521 1164/2242/521 -f 1173/2243/522 1172/2244/523 1171/2245/522 -f 1183/1697/524 1185/1670/433 1182/1743/433 -f 1180/2246/525 1183/1697/524 1181/2247/525 -f 1199/1785/524 1201/1679/433 1198/1746/433 -f 1200/1773/524 1189/1756/525 1190/1704/525 -f 1206/1699/522 1192/2248/523 1191/2249/523 -f 1208/1749/461 1209/2250/526 1207/1696/461 -f 1214/2251/527 1211/1776/528 1213/2252/527 -f 1162/2241/521 1205/1784/441 1164/2242/521 -f 1214/1694/527 1209/2253/526 1210/1689/526 -f 1222/2254/529 1223/2255/435 1215/2256/435 -f 1220/2257/519 1229/2258/441 1221/2259/441 -f 1218/2260/530 1227/2261/434 1219/2262/434 -f 1216/2263/446 1225/2264/440 1217/2265/440 -f 1221/2259/441 1230/2266/529 1222/2254/529 -f 1219/2267/434 1228/2268/519 1220/2257/519 -f 1217/2265/440 1226/2269/530 1218/2260/530 -f 1215/2256/435 1224/2270/446 1216/2263/446 -f 1238/2271/529 1239/2272/435 1231/2273/435 -f 1236/2274/519 1245/2275/441 1237/2276/441 -f 1234/2277/530 1243/2278/434 1235/2279/434 -f 1232/2280/446 1241/2281/440 1233/2282/440 -f 1237/2276/441 1246/2283/529 1238/2271/529 -f 1235/2284/434 1244/2285/519 1236/2274/519 -f 1233/2282/440 1242/2286/530 1234/2277/530 -f 1231/2273/435 1240/2287/446 1232/2280/446 -f 1250/1676/435 1191/2249/523 1192/2248/523 -f 1174/2288/523 1251/1713/435 1172/2244/523 -f 1148/2236/520 1255/1729/434 1147/2237/520 -f 862/1790/447 874/1811/447 863/1791/433 -f 852/1793/448 864/1812/448 865/1794/449 -f 859/1796/450 871/1813/450 872/1797/435 -f 856/1799/451 868/1814/451 869/1800/432 -f 853/1795/449 865/1794/449 866/1802/434 -f 860/1804/435 872/2289/435 873/1805/452 -f 857/1801/432 869/1800/432 870/1807/453 -f 854/1803/434 866/1802/434 867/1809/454 -f 861/1806/452 873/1805/452 874/1811/447 -f 851/1792/433 863/1791/433 864/1812/448 -f 858/1808/453 870/1807/453 871/1813/450 -f 855/1810/454 867/1809/454 868/1814/451 -f 865/1817/440 864/2290/440 873/1815/440 -f 864/2290/440 863/2291/440 873/1815/440 -f 863/2291/440 874/2292/440 873/1815/440 -f 873/1815/440 872/2293/440 869/1816/440 -f 872/2293/440 871/2294/440 869/1816/440 -f 871/2294/440 870/2295/440 869/1816/440 -f 869/1816/440 868/2296/440 867/2297/440 -f 867/2297/440 866/2298/440 869/1816/440 -f 866/2298/440 865/1817/440 869/1816/440 -f 855/1818/440 879/1823/440 878/1819/440 -f 855/1821/440 856/2299/440 880/1822/440 -f 857/1824/440 881/1828/440 880/1822/440 -f 857/1826/440 858/2300/440 882/1827/440 -f 859/1829/440 883/1833/440 882/1827/440 -f 859/1831/440 860/2301/440 884/1832/440 -f 861/1834/440 885/1838/440 884/1835/440 -f 862/1837/440 886/1841/440 885/1838/440 -f 851/1840/440 875/1845/440 886/1841/440 -f 851/1843/440 852/2302/440 876/1844/440 -f 854/1846/440 878/1819/440 877/1847/440 -f 853/1849/440 877/1847/440 876/1844/440 -f 886/1841/451 898/1855/451 897/1851/454 -f 876/1844/453 888/1856/453 887/1852/432 -f 883/1833/449 895/1857/449 894/1853/448 -f 880/1822/447 892/1858/447 891/1854/452 -f 875/1845/432 887/1852/432 898/1855/451 -f 877/1847/450 889/1859/450 888/1856/453 -f 884/1832/434 896/1871/434 895/1857/449 -f 881/1828/433 893/1861/433 892/1858/447 -f 878/1819/435 890/1862/435 889/1859/450 -f 885/1838/454 897/1851/454 896/1860/434 -f 882/1827/448 894/1853/448 893/1861/433 -f 879/1823/452 891/1854/452 890/1862/435 -f 890/1862/455 902/2303/455 901/1863/456 -f 888/1856/457 889/1859/456 901/1864/456 -f 887/1852/458 888/1856/457 900/1866/457 -f 887/1852/458 899/2304/458 910/1868/459 -f 898/1855/459 910/2305/459 909/1869/460 -f 897/1851/460 909/2306/460 908/1870/461 -f 896/1871/461 908/2307/461 907/1872/462 -f 894/1853/463 895/1857/462 907/1873/462 -f 893/1861/464 894/1853/463 906/1875/463 -f 893/1861/464 905/2308/464 904/1877/465 -f 892/1858/465 904/2309/465 903/1878/466 -f 890/1862/455 891/1854/466 903/1879/466 -f 901/1881/450 913/1891/450 912/1882/453 -f 908/1884/434 920/2310/434 919/1885/449 -f 905/1887/433 917/1896/433 916/1888/447 -f 902/1890/435 914/1898/435 913/1891/450 -f 909/1892/454 921/1900/454 920/1893/434 -f 906/1895/448 918/1903/448 917/1896/433 -f 903/1897/452 915/1904/452 914/1898/435 -f 910/1899/451 922/1905/451 921/1900/454 -f 900/1883/453 912/1882/453 911/1901/432 -f 907/1886/449 919/1885/449 918/1903/448 -f 904/1889/447 916/1888/447 915/1904/452 -f 899/1902/432 911/1901/432 922/1905/451 -f 913/1906/467 914/2311/468 942/1907/468 -f 913/1909/467 941/1908/467 940/1910/469 -f 912/1912/469 940/1910/469 939/1913/470 -f 911/1915/470 939/1913/470 950/1916/471 -f 922/1918/471 950/1916/471 949/1919/472 -f 921/1921/472 949/1919/472 948/1922/473 -f 919/1924/474 920/2312/473 948/1925/473 -f 919/1927/474 947/1926/474 946/1928/475 -f 918/1930/475 946/1928/475 945/1931/476 -f 917/1933/476 945/1931/476 944/1934/477 -f 915/1936/478 943/1939/478 942/1907/468 -f 916/1938/477 944/1934/477 943/1939/478 -f 941/1908/450 953/1944/450 952/1941/453 -f 948/1925/434 960/1967/434 959/1942/449 -f 945/1931/433 957/1946/433 956/1943/447 -f 942/1907/435 954/1947/435 953/1944/450 -f 949/1919/454 961/1948/454 960/1945/434 -f 946/1928/448 958/1950/448 957/1946/433 -f 943/1939/452 955/1951/452 954/1947/435 -f 950/1916/451 962/1952/451 961/1948/454 -f 939/1913/432 940/1910/453 952/1941/453 -f 947/1926/449 959/1942/449 958/1950/448 -f 944/1934/447 956/1943/447 955/1951/452 -f 939/1913/432 951/1949/432 962/1952/451 -f 956/1943/441 957/1946/441 969/1953/441 -f 955/1951/441 956/1943/441 968/1955/441 -f 954/1947/441 955/1951/441 967/1957/441 -f 954/1947/441 966/2313/441 965/1959/441 -f 953/1944/441 965/2314/441 964/1960/441 -f 952/1941/441 964/2315/441 963/1961/441 -f 962/1952/441 951/1949/441 963/1962/441 -f 961/1948/441 962/1952/441 974/1964/441 -f 961/1948/441 973/2316/441 972/1966/441 -f 960/1967/441 972/2317/441 971/1968/441 -f 959/1942/441 971/2318/441 970/1969/441 -f 958/1950/441 970/2319/441 969/1970/441 -f 966/1971/434 978/1981/434 977/1972/449 -f 973/1974/452 985/1983/452 984/1975/435 -f 970/1977/453 982/1988/453 981/1978/432 -f 967/1980/454 979/1990/454 978/1981/434 -f 974/1982/447 986/1991/447 985/1983/452 -f 964/1984/448 976/1992/448 975/1985/433 -f 971/1987/450 983/1994/450 982/1988/453 -f 968/1989/451 980/1995/451 979/1990/454 -f 963/1986/433 975/1985/433 986/1991/447 -f 965/1973/449 977/1972/449 976/1992/448 -f 972/1993/435 984/2320/435 983/1994/450 -f 969/1979/432 981/1978/432 980/1995/451 -f 975/1998/441 976/2321/441 977/2322/441 -f 977/2322/441 978/2323/441 979/1996/441 -f 979/1996/441 980/2324/441 981/2325/441 -f 981/2325/441 982/2326/441 983/1997/441 -f 983/1997/441 984/2327/441 985/2328/441 -f 985/2328/441 986/2329/441 975/1998/441 -f 975/1998/441 977/2322/441 979/1996/441 -f 979/1996/441 981/2325/441 983/1997/441 -f 983/1997/441 985/2328/441 975/1998/441 -f 1001/1999/479 1000/2019/480 988/2000/480 -f 1008/2002/441 1007/2021/481 995/2003/481 -f 1005/2005/433 1004/2022/482 992/2006/482 -f 1002/2008/440 1001/1999/479 989/2001/479 -f 1009/2010/483 1008/2002/441 996/2004/441 -f 1006/2012/484 1005/2005/433 993/2007/433 -f 1003/2014/485 1002/2330/440 990/2015/440 -f 1010/2017/486 1009/2010/483 997/2011/483 -f 1000/2019/480 999/2023/432 987/2020/432 -f 1007/2021/481 1006/2012/484 994/2013/484 -f 1004/2022/482 1003/2014/485 991/2016/485 -f 999/2023/432 1010/2017/486 998/2018/486 -f 1028/2024/482 1027/2044/485 1015/2025/485 -f 1023/2027/432 1034/2046/486 1022/2028/486 -f 1025/2030/479 1024/2047/480 1012/2031/480 -f 1032/2033/441 1031/2048/481 1019/2034/481 -f 1029/2036/433 1028/2024/482 1016/2026/482 -f 1026/2038/440 1025/2030/479 1013/2032/479 -f 1033/2040/483 1032/2033/441 1020/2035/441 -f 1030/2042/484 1029/2036/433 1017/2037/433 -f 1027/2044/485 1026/2331/440 1014/2045/440 -f 1034/2046/486 1033/2040/483 1021/2041/483 -f 1024/2047/480 1023/2027/432 1011/2029/432 -f 1031/2048/481 1030/2042/484 1018/2043/484 -f 1023/2051/435 1024/2332/435 1025/2333/435 -f 1025/2333/435 1026/2334/435 1027/2335/435 -f 1027/2335/435 1028/2336/435 1029/2337/435 -f 1029/2337/435 1030/2338/435 1031/2049/435 -f 1031/2049/435 1032/2339/435 1033/2050/435 -f 1033/2050/435 1034/2340/435 1023/2051/435 -f 1023/2051/435 1025/2333/435 1031/2049/435 -f 1025/2333/435 1027/2335/435 1031/2049/435 -f 1027/2335/435 1029/2337/435 1031/2049/435 -f 1009/2052/434 1021/2041/434 1020/2035/434 -f 1010/2054/434 1022/2028/434 1021/2041/434 -f 999/2056/434 1011/2029/434 1022/2028/434 -f 1000/2058/434 1012/2031/434 1011/2029/434 -f 1000/2060/434 1001/2341/434 1013/2032/434 -f 1001/2061/434 1002/2342/434 1014/2039/434 -f 1003/2062/434 1015/2025/434 1014/2045/434 -f 1004/2064/434 1016/2026/434 1015/2025/434 -f 1005/2066/434 1017/2037/434 1016/2026/434 -f 1006/2068/434 1018/2043/434 1017/2037/434 -f 1007/2070/434 1008/2343/434 1020/2035/434 -f 1006/2071/434 1007/2344/434 1019/2034/434 -f 1052/2072/487 1051/2092/488 1039/2073/488 -f 1047/2075/435 1058/2094/489 1046/2076/489 -f 1049/2078/490 1048/2095/491 1036/2079/491 -f 1056/2081/441 1055/2096/492 1043/2082/492 -f 1053/2084/434 1052/2072/487 1040/2074/487 -f 1050/2086/440 1049/2078/490 1037/2080/490 -f 1057/2088/493 1056/2081/441 1044/2083/441 -f 1054/2090/494 1053/2084/434 1041/2085/434 -f 1051/2092/488 1050/2345/440 1038/2093/440 -f 1058/2094/489 1057/2088/493 1045/2089/493 -f 1048/2095/491 1047/2075/435 1035/2077/435 -f 1055/2096/492 1054/2090/494 1042/2091/494 -f 1047/2097/432 1048/2346/432 1060/2098/432 -f 1048/2100/432 1049/2347/432 1061/2101/432 -f 1049/2102/432 1050/2348/432 1062/2103/432 -f 1051/2104/432 1063/2108/432 1062/2105/432 -f 1052/2107/432 1064/2111/432 1063/2108/432 -f 1053/2110/432 1065/2114/432 1064/2111/432 -f 1054/2113/432 1066/2118/432 1065/2114/432 -f 1054/2116/432 1055/2349/432 1067/2117/432 -f 1055/2119/432 1056/2350/432 1068/2120/432 -f 1057/2121/432 1069/2124/432 1068/2120/432 -f 1058/2123/432 1070/2127/432 1069/2124/432 -f 1047/2126/432 1059/2099/432 1070/2127/432 -f 1077/2129/434 1076/2137/487 1064/2111/487 -f 1074/2130/440 1073/2139/490 1061/2101/490 -f 1081/2131/493 1080/2140/441 1068/2120/441 -f 1078/2132/494 1077/2129/434 1065/2114/434 -f 1075/2133/488 1074/2351/440 1062/2105/440 -f 1082/2134/489 1081/2131/493 1069/2124/493 -f 1072/2135/491 1071/2138/435 1059/2099/435 -f 1079/2136/492 1078/2132/494 1066/2118/494 -f 1076/2137/487 1075/2133/488 1063/2108/488 -f 1071/2138/435 1082/2134/489 1070/2127/489 -f 1073/2139/490 1072/2135/491 1060/2098/491 -f 1080/2140/441 1079/2136/492 1067/2117/492 -f 1071/2143/433 1072/2352/433 1073/2353/433 -f 1073/2353/433 1074/2354/433 1075/2355/433 -f 1075/2355/433 1076/2356/433 1077/2357/433 -f 1077/2357/433 1078/2358/433 1079/2141/433 -f 1079/2141/433 1080/2359/433 1081/2142/433 -f 1081/2142/433 1082/2360/433 1071/2143/433 -f 1071/2143/433 1073/2353/433 1079/2141/433 -f 1073/2353/433 1075/2355/433 1079/2141/433 -f 1075/2355/433 1077/2357/433 1079/2141/433 -f 1085/2144/490 1097/2166/490 1098/2145/440 -f 1092/2147/441 1104/2167/441 1105/2148/493 -f 1089/2150/434 1101/2168/434 1102/2151/494 -f 1086/2153/440 1098/2361/440 1099/2154/488 -f 1093/2149/493 1105/2148/493 1106/2156/489 -f 1083/2158/435 1095/2165/435 1096/2159/491 -f 1090/2152/494 1102/2151/494 1103/2161/492 -f 1087/2155/488 1099/2154/488 1100/2163/487 -f 1094/2157/489 1106/2156/489 1095/2165/435 -f 1084/2160/491 1096/2159/491 1097/2166/490 -f 1091/2162/492 1103/2161/492 1104/2167/441 -f 1088/2164/487 1100/2163/487 1101/2168/434 -f 1109/2169/490 1121/2191/504 1122/2170/495 -f 1116/2172/441 1128/2192/505 1129/2173/496 -f 1113/2175/434 1125/2193/506 1126/2176/497 -f 1110/2178/440 1122/2203/495 1123/2179/498 -f 1117/2174/493 1129/2173/496 1130/2181/499 -f 1107/2183/435 1119/2190/503 1120/2184/500 -f 1114/2177/494 1126/2176/497 1127/2186/501 -f 1111/2180/488 1123/2179/498 1124/2188/502 -f 1118/2182/489 1130/2181/499 1119/2190/503 -f 1108/2185/491 1120/2184/500 1121/2191/504 -f 1115/2187/492 1127/2186/501 1128/2192/505 -f 1112/2189/487 1124/2188/502 1125/2193/506 -f 1121/2191/504 1133/2195/508 1134/2194/507 -f 1120/2184/500 1132/2196/509 1133/2195/508 -f 1119/2190/503 1131/2362/531 1132/2196/509 -f 1142/2197/510 1131/2362/531 1119/2190/503 -f 1141/2198/511 1142/2197/510 1130/2181/499 -f 1140/2199/512 1141/2198/511 1129/2173/496 -f 1139/2200/513 1140/2199/512 1128/2192/505 -f 1138/2201/514 1139/2200/513 1127/2186/501 -f 1137/2202/515 1138/2201/514 1126/2176/497 -f 1124/2188/502 1136/2205/517 1137/2202/515 -f 1122/2203/495 1134/2363/507 1135/2204/516 -f 1123/2179/498 1135/2204/516 1136/2205/517 -f 1133/2364/432 1132/2365/432 1131/2206/432 -f 1131/2206/432 1142/2366/432 1141/2207/432 -f 1141/2207/432 1140/2367/432 1137/2208/432 -f 1140/2367/432 1139/2368/432 1137/2208/432 -f 1139/2368/432 1138/2369/432 1137/2208/432 -f 1137/2208/432 1136/2370/432 1135/2371/432 -f 1135/2371/432 1134/2372/432 1137/2208/432 -f 1134/2372/432 1133/2364/432 1137/2208/432 -f 1133/2364/432 1131/2206/432 1137/2208/432 -f 1118/2182/433 1107/2183/433 1095/2209/433 -f 1117/2174/433 1118/2182/433 1106/2211/433 -f 1116/2172/433 1117/2174/433 1105/2213/433 -f 1103/2215/433 1115/2187/433 1116/2172/433 -f 1102/2217/433 1114/2177/433 1115/2187/433 -f 1113/2175/433 1114/2177/433 1102/2219/433 -f 1112/2189/433 1113/2175/433 1101/2221/433 -f 1111/2180/433 1112/2189/433 1100/2223/433 -f 1110/2178/433 1111/2180/433 1099/2225/433 -f 1097/2227/433 1109/2169/433 1110/2171/433 -f 1096/2229/433 1108/2185/433 1109/2169/433 -f 1095/2231/433 1107/2183/433 1108/2185/433 -f 1155/2233/518 1153/1664/518 1149/1663/440 -f 1159/2235/519 1160/2373/519 1148/2236/520 -f 1163/1738/446 1161/1643/446 1153/2238/518 -f 1166/2240/519 1165/2374/519 1162/2241/521 -f 1173/2243/522 1174/2288/523 1172/2244/523 -f 1183/1697/524 1184/1712/524 1185/1670/433 -f 1180/2246/525 1184/1712/524 1183/1697/524 -f 1199/1785/524 1200/1773/524 1201/1679/433 -f 1200/1773/524 1199/1785/524 1189/1756/525 -f 1206/1699/522 1205/1755/522 1192/2248/523 -f 1208/1749/461 1210/2375/526 1209/2250/526 -f 1214/2251/527 1212/1715/528 1211/1776/528 -f 1162/2241/521 1189/1720/441 1205/1784/441 -f 1214/1694/527 1213/2376/527 1209/2253/526 -f 1222/2254/529 1230/2266/529 1223/2255/435 -f 1220/2257/519 1228/2268/519 1229/2258/441 -f 1218/2260/530 1226/2269/530 1227/2261/434 -f 1216/2263/446 1224/2270/446 1225/2264/440 -f 1221/2259/441 1229/2258/441 1230/2266/529 -f 1219/2267/434 1227/2377/434 1228/2268/519 -f 1217/2265/440 1225/2264/440 1226/2269/530 -f 1215/2256/435 1223/2255/435 1224/2270/446 -f 1238/2271/529 1246/2283/529 1239/2272/435 -f 1236/2274/519 1244/2285/519 1245/2275/441 -f 1234/2277/530 1242/2286/530 1243/2278/434 -f 1232/2280/446 1240/2287/446 1241/2281/440 -f 1237/2276/441 1245/2275/441 1246/2283/529 -f 1235/2284/434 1243/2378/434 1244/2285/519 -f 1233/2282/440 1241/2281/440 1242/2286/530 -f 1231/2273/435 1239/2272/435 1240/2287/446 -f 1250/1676/435 1249/1745/435 1191/2249/523 -f 1174/2288/523 1253/1752/435 1251/1713/435 -f 1148/2236/520 1256/1725/434 1255/1729/434 -o Silencer -v 11.250000 -0.000000 -0.312500 -v 11.250000 0.220971 -0.220971 -v 11.250000 0.312500 0.000000 -v 11.250000 0.220971 0.220971 -v 11.250000 -0.000000 0.312500 -v 11.250000 -0.220971 0.220971 -v 11.250000 -0.312500 -0.000000 -v 11.250000 -0.220971 -0.220971 -v 11.562500 0.000000 -0.312500 -v 11.562500 0.220971 -0.220971 -v 11.562500 0.312500 0.000000 -v 11.562500 0.220971 0.220971 -v 11.562500 0.000000 0.312500 -v 11.562500 -0.220971 0.220971 -v 11.562500 -0.312500 -0.000000 -v 11.562500 -0.220971 -0.220971 -v 11.562500 0.000000 -0.500000 -v 11.562500 0.353554 -0.353553 -v 11.562500 0.500000 0.000000 -v 11.562500 0.353554 0.353553 -v 11.562500 0.000000 0.500000 -v 11.562500 -0.353553 0.353553 -v 11.562500 -0.500000 -0.000000 -v 11.562500 -0.353553 -0.353553 -v 15.312500 0.000000 -0.500000 -v 15.312500 0.353554 -0.353553 -v 15.312500 0.500000 0.000000 -v 15.312500 0.353554 0.353553 -v 15.312500 0.000000 0.500000 -v 15.312500 -0.353553 0.353553 -v 15.312500 -0.500000 -0.000000 -v 15.312500 -0.353553 -0.353553 -v 15.312500 0.000000 -0.093750 -v 15.312500 0.066292 -0.066291 -v 15.312500 0.093750 0.000000 -v 15.312500 0.066292 0.066291 -v 15.312500 0.000000 0.093750 -v 15.312500 -0.066291 0.066291 -v 15.312500 -0.093750 -0.000000 -v 15.312500 -0.066291 -0.066291 -v 14.812500 0.000000 -0.093750 -v 14.812500 0.066292 -0.066291 -v 14.812500 0.093750 0.000000 -v 14.812500 0.066292 0.066291 -v 14.812500 0.000000 0.093750 -v 14.812500 -0.066291 0.066291 -v 14.812500 -0.093750 -0.000000 -v 14.812500 -0.066291 -0.066291 -vt 0.865111 0.565111 -vt 0.853846 0.592308 -vt 0.930769 0.592308 -vt 1.000000 0.715385 -vt 0.961538 0.684615 -vt 1.000000 0.684615 -vt 1.000000 0.961538 -vt 0.961538 0.992308 -vt 0.961538 0.961538 -vt 1.000000 0.869231 -vt 0.961538 0.900000 -vt 0.961538 0.869231 -vt 1.000000 0.807692 -vt 0.961538 0.776923 -vt 1.000000 0.776923 -vt 1.000000 0.669231 -vt 0.961538 0.638462 -vt 1.000000 0.638462 -vt 1.000000 0.915385 -vt 0.961538 0.946154 -vt 0.961538 0.915385 -vt 1.000000 0.823077 -vt 0.961538 0.853846 -vt 0.961538 0.823077 -vt 1.000000 0.761538 -vt 0.961538 0.730769 -vt 1.000000 0.730769 -vt 0.476923 0.676923 -vt 0.938462 0.630769 -vt 0.938462 0.676923 -vt 0.476923 0.953846 -vt 0.938462 0.907692 -vt 0.938462 0.953846 -vt 0.476923 0.861538 -vt 0.938462 0.815385 -vt 0.938462 0.861538 -vt 0.476923 0.769231 -vt 0.938462 0.723077 -vt 0.938462 0.769231 -vt 0.476923 0.723077 -vt 0.476923 1.000000 -vt 0.938462 1.000000 -vt 0.476923 0.907692 -vt 0.476923 0.815385 -vt 0.961538 0.807692 -vt 0.430769 0.742308 -vt 0.430769 0.788462 -vt 0.430769 0.842308 -vt 0.430769 0.834615 -vt 0.430769 0.880769 -vt 0.430769 0.926923 -vt 0.430769 0.973077 -vt 0.430769 0.650000 -vt 0.476923 0.630769 -vt 0.430769 0.696154 -vt 0.930769 0.569231 -vt 0.992308 0.576923 -vt 0.930769 0.576923 -vt 0.930769 0.584615 -vt 0.992308 0.592308 -vt 0.930769 0.592308 -vt 0.930769 0.600000 -vt 0.992308 0.607692 -vt 0.930769 0.607692 -vt 0.930769 0.623077 -vt 0.992308 0.630769 -vt 0.930769 0.630769 -vt 0.992308 0.584615 -vt 0.992308 0.600000 -vt 0.992308 0.615385 -vt 0.930769 0.615385 -vt 0.992308 0.623077 -vt 0.980769 0.546154 -vt 0.992308 0.557692 -vt 0.980769 0.569231 -vt 0.865111 0.619504 -vt 0.892308 0.630769 -vt 0.919504 0.619504 -vt 0.919504 0.565111 -vt 0.892308 0.553846 -vt 0.961538 0.715385 -vt 1.000000 0.992308 -vt 1.000000 0.900000 -vt 0.961538 0.669231 -vt 1.000000 0.946154 -vt 1.000000 0.853846 -vt 0.961538 0.761538 -vt 0.430769 0.750000 -vt 0.430769 0.796154 -vt 0.430769 0.888462 -vt 0.430769 0.934615 -vt 0.430769 0.980769 -vt 0.430769 0.657692 -vt 0.430769 0.703846 -vt 0.992308 0.569231 -vt 0.972610 0.565851 -vt 0.969231 0.557692 -vt 0.972610 0.549533 -vt 0.988928 0.549533 -vt 0.988928 0.565851 -vn -1.0000 -0.0000 0.0000 -vn -0.0000 0.0000 -1.0000 -vn 0.0000 -0.7071 -0.7071 -vn 0.0000 -0.7071 0.7071 -vn 0.0000 -1.0000 0.0000 -vn -0.0000 0.7071 0.7071 vn -0.0000 0.0000 1.0000 -vn -0.0000 1.0000 0.0000 -vn -0.0000 0.7071 -0.7071 -vn 1.0000 -0.0000 0.0000 -s 1 -f 1260/2379/532 1259/2380/532 1263/2381/532 -f 1257/2382/533 1272/2383/534 1264/2384/534 -f 1262/2385/535 1271/2386/536 1270/2387/535 -f 1260/2388/537 1269/2389/538 1268/2390/537 -f 1259/2391/539 1266/2392/540 1258/2393/540 -f 1264/2394/534 1271/2395/536 1263/2396/536 -f 1261/2397/538 1270/2398/535 1269/2399/538 -f 1259/2400/539 1268/2401/537 1267/2402/539 -f 1258/2403/540 1265/2404/533 1257/2405/533 -f 1288/2406/534 1279/2407/536 1280/2408/534 -f 1286/2409/535 1277/2410/538 1278/2411/535 -f 1284/2412/537 1275/2413/539 1276/2414/537 -f 1282/2415/540 1273/2416/533 1274/2417/540 -f 1281/2418/533 1280/2408/534 1273/2416/533 -f 1287/2419/536 1278/2411/535 1279/2420/536 -f 1285/2421/538 1276/2414/537 1277/2410/538 -f 1283/2422/539 1274/2417/540 1275/2413/539 -f 1271/2395/532 1280/2408/532 1279/2407/532 -f 1272/2383/532 1273/2416/532 1280/2408/532 -f 1265/2404/532 1274/2417/532 1273/2416/532 -f 1267/2423/532 1274/2417/532 1266/2392/532 -f 1268/2401/532 1275/2413/532 1267/2402/532 -f 1269/2389/532 1276/2414/532 1268/2390/532 -f 1270/2398/532 1277/2410/532 1269/2399/532 -f 1271/2386/532 1278/2411/532 1270/2387/532 -f 1282/2415/541 1289/2424/541 1281/2418/541 -f 1283/2422/541 1290/2425/541 1282/2415/541 -f 1283/2422/541 1292/2426/541 1291/2427/541 -f 1285/2421/541 1292/2428/541 1284/2412/541 -f 1286/2409/541 1293/2429/541 1285/2421/541 -f 1287/2419/541 1294/2430/541 1286/2409/541 -f 1288/2406/541 1295/2431/541 1287/2432/541 -f 1281/2418/541 1296/2433/541 1288/2406/541 -f 1295/2434/539 1302/2435/540 1294/2436/540 -f 1293/2437/533 1300/2438/534 1292/2439/534 -f 1291/2440/536 1298/2441/535 1290/2442/535 -f 1296/2443/537 1303/2444/539 1295/2445/539 -f 1294/2436/540 1301/2446/533 1293/2437/533 -f 1292/2439/534 1299/2447/536 1291/2440/536 -f 1290/2442/535 1297/2448/538 1289/2449/538 -f 1289/2449/538 1304/2450/537 1296/2443/537 -f 1301/2451/541 1303/2452/541 1297/2453/541 -f 1259/2380/532 1258/2454/532 1263/2381/532 -f 1258/2454/532 1257/2455/532 1263/2381/532 -f 1257/2455/532 1264/2456/532 1263/2381/532 -f 1263/2381/532 1262/2457/532 1261/2458/532 -f 1261/2458/532 1260/2379/532 1263/2381/532 -f 1257/2382/533 1265/2459/533 1272/2383/534 -f 1262/2385/535 1263/2460/536 1271/2386/536 -f 1260/2388/537 1261/2461/538 1269/2389/538 -f 1259/2391/539 1267/2423/539 1266/2392/540 -f 1264/2394/534 1272/2462/534 1271/2395/536 -f 1261/2397/538 1262/2463/535 1270/2398/535 -f 1259/2400/539 1260/2464/537 1268/2401/537 -f 1258/2403/540 1266/2465/540 1265/2404/533 -f 1288/2406/534 1287/2432/536 1279/2407/536 -f 1286/2409/535 1285/2421/538 1277/2410/538 -f 1284/2412/537 1283/2422/539 1275/2413/539 -f 1282/2415/540 1281/2418/533 1273/2416/533 -f 1281/2418/533 1288/2406/534 1280/2408/534 -f 1287/2419/536 1286/2409/535 1278/2411/535 -f 1285/2421/538 1284/2412/537 1276/2414/537 -f 1283/2422/539 1282/2415/540 1274/2417/540 -f 1271/2395/532 1272/2462/532 1280/2408/532 -f 1272/2383/532 1265/2459/532 1273/2416/532 -f 1265/2404/532 1266/2465/532 1274/2417/532 -f 1267/2423/532 1275/2413/532 1274/2417/532 -f 1268/2401/532 1276/2414/532 1275/2413/532 -f 1269/2389/532 1277/2410/532 1276/2414/532 -f 1270/2398/532 1278/2411/532 1277/2410/532 -f 1271/2386/532 1279/2420/532 1278/2411/532 -f 1282/2415/541 1290/2466/541 1289/2424/541 -f 1283/2422/541 1291/2467/541 1290/2425/541 -f 1283/2422/541 1284/2412/541 1292/2426/541 -f 1285/2421/541 1293/2468/541 1292/2428/541 -f 1286/2409/541 1294/2469/541 1293/2429/541 -f 1287/2419/541 1295/2470/541 1294/2430/541 -f 1288/2406/541 1296/2471/541 1295/2431/541 -f 1281/2418/541 1289/2472/541 1296/2433/541 -f 1295/2434/539 1303/2473/539 1302/2435/540 -f 1293/2437/533 1301/2446/533 1300/2438/534 -f 1291/2440/536 1299/2447/536 1298/2441/535 -f 1296/2443/537 1304/2450/537 1303/2444/539 -f 1294/2436/540 1302/2435/540 1301/2446/533 -f 1292/2439/534 1300/2438/534 1299/2447/536 -f 1290/2442/535 1298/2441/535 1297/2448/538 -f 1289/2449/538 1297/2448/538 1304/2450/537 -f 1297/2453/541 1298/2474/541 1299/2475/541 -f 1299/2475/541 1300/2476/541 1297/2453/541 -f 1300/2476/541 1301/2451/541 1297/2453/541 -f 1301/2451/541 1302/2477/541 1303/2452/541 -f 1303/2452/541 1304/2478/541 1297/2453/541 -o Selector_Rifle.001 -v -4.000000 -0.843753 -0.343750 -v -4.125000 -1.000003 -0.343750 -v -4.187500 -0.937503 -0.343750 -v -4.062500 -0.718753 -0.343750 -v -3.500000 -0.718753 -0.343750 -v -3.500000 -0.968753 -0.343750 -v -3.411612 -0.932141 -0.343750 -v -3.375000 -0.843753 -0.343750 -v -3.411612 -0.755365 -0.343750 -v -3.500000 -0.718753 -0.406250 -v -3.500000 -0.968753 -0.406250 -v -3.411612 -0.932141 -0.406250 -v -3.375000 -0.843753 -0.406250 -v -3.411612 -0.755365 -0.406250 -v -4.000000 -0.843753 -0.468750 -v -4.062500 -0.718753 -0.468750 -v -4.125000 -1.000003 -0.468750 -v -4.187500 -0.937503 -0.468750 -v -3.750000 -0.718753 -0.468750 -v -3.750000 -0.906253 -0.468750 -vt 0.725869 0.474903 -vt 0.722008 0.471042 -vt 0.725869 0.471042 -vt 0.725869 0.482625 -vt 0.722008 0.478764 -vt 0.725869 0.478764 -vt 0.722008 0.474903 -vt 0.725869 0.486486 -vt 0.722008 0.482625 -vt 0.725869 0.420849 -vt 0.718147 0.416988 -vt 0.725869 0.416988 -vt 0.718147 0.420849 -vt 0.725869 0.436293 -vt 0.718147 0.436293 -vt 0.718147 0.405405 -vt 0.710425 0.432432 -vt 0.712686 0.420849 -vt 0.718147 0.455598 -vt 0.718147 0.389961 -vt 0.722008 0.374517 -vt 0.725869 0.374517 -vt 0.710425 0.440154 -vt 0.706564 0.455598 -vt 0.718147 0.471042 -vt 0.715885 0.476503 -vt 0.710425 0.478764 -vt 0.722008 0.486486 -vt 0.725869 0.405405 -vt 0.704964 0.476503 -vt 0.702703 0.471042 -vn 0.7071 0.7071 0.0000 -vn 0.1810 0.9835 0.0000 -vn 0.1951 0.9808 0.0000 -vn 0.7071 -0.7071 0.0000 -vn 1.0000 -0.0000 0.0000 -vn 0.0738 -0.9973 0.0000 -vn -0.7071 -0.7071 0.0000 -vn 0.0553 -0.9985 0.0000 -vn -0.8682 0.4961 0.0000 -vn -0.5019 0.8649 0.0000 -vn 0.7809 -0.6247 0.0000 -vn 0.0000 0.0000 -1.0000 -vn -0.0000 1.0000 0.0000 -vn -0.2425 -0.9701 0.0000 -vn 0.0506 -0.9987 0.0000 -vn 0.1222 0.0000 -0.9925 -vn 0.1410 0.0000 -0.9900 -vn 0.1396 0.0000 -0.9902 -vn 0.1297 0.0000 -0.9916 -s 1 -f 1313/2479/542 1314/2480/543 1309/2481/544 -f 1311/2482/545 1317/2483/546 1312/2484/546 -f 1312/2484/546 1318/2485/542 1313/2479/542 -f 1310/2486/547 1316/2487/545 1311/2482/545 -f 1307/2488/548 1321/2489/549 1306/2490/549 -f 1322/2491/550 1308/2492/551 1320/2493/551 -f 1319/2494/552 1306/2490/549 1321/2489/549 -f 1322/2491/553 1319/2495/553 1321/2496/553 -f 1309/2481/544 1314/2480/543 1323/2497/554 -f 1324/2498/555 1315/2499/556 1310/2500/547 -f 1319/2501/553 1323/2497/557 1324/2502/558 -f 1314/2503/559 1318/2504/553 1317/2505/553 -f 1314/2503/559 1324/2502/558 1323/2497/557 -f 1313/2479/542 1318/2485/542 1314/2480/543 -f 1311/2482/545 1316/2487/545 1317/2483/546 -f 1312/2484/546 1317/2483/546 1318/2485/542 -f 1310/2486/547 1315/2506/556 1316/2487/545 -f 1307/2488/548 1322/2491/548 1321/2489/549 -f 1322/2491/550 1307/2488/550 1308/2492/551 -f 1319/2494/552 1305/2507/552 1306/2490/549 -f 1322/2491/553 1320/2493/553 1319/2495/553 -f 1320/2493/551 1308/2492/551 1323/2497/554 -f 1308/2492/551 1309/2481/544 1323/2497/554 -f 1310/2500/547 1305/2507/555 1324/2498/555 -f 1305/2507/555 1319/2494/555 1324/2498/555 -f 1319/2501/553 1320/2493/553 1323/2497/557 -f 1317/2505/553 1316/2508/553 1315/2509/560 -f 1315/2509/560 1314/2503/559 1317/2505/553 -f 1314/2503/559 1315/2509/560 1324/2502/558 -o Trigger_Rifle.002 -v -3.000000 -1.218750 -0.125000 -v -3.187500 -1.593750 -0.125000 -v -3.187500 -1.781250 -0.125000 -v -3.125000 -1.968750 -0.125000 -v -3.000000 -2.093750 -0.125000 -v -3.062500 -2.093750 -0.125000 -v -3.250000 -1.968750 -0.125000 -v -3.312500 -1.781250 -0.125000 -v -3.312500 -1.406250 -0.125000 -v -3.375000 -1.343750 -0.125000 -v -3.000000 -1.218750 0.125000 -v -3.187500 -1.593750 0.125000 -v -3.187500 -1.781250 0.125000 -v -3.125000 -1.968750 0.125000 -v -3.000000 -2.093750 0.125000 -v -3.062500 -2.093750 0.125000 -v -3.250000 -1.968750 0.125000 -v -3.312500 -1.781250 0.125000 -v -3.312500 -1.406250 0.125000 -v -3.375000 -1.343750 0.125000 -vt 0.656371 0.559846 -vt 0.667954 0.563707 -vt 0.656371 0.563707 -vt 0.629344 0.555985 -vt 0.640927 0.563707 -vt 0.629344 0.563707 -vt 0.617761 0.555985 -vt 0.606178 0.563707 -vt 0.691120 0.563707 -vt 0.698842 0.552124 -vt 0.718147 0.563707 -vt 0.602317 0.563707 -vt 0.606178 0.540541 -vt 0.667954 0.579151 -vt 0.656371 0.583012 -vt 0.656371 0.579151 -vt 0.629344 0.586873 -vt 0.640927 0.579151 -vt 0.640927 0.586873 -vt 0.617761 0.586873 -vt 0.629344 0.579151 -vt 0.691120 0.579151 -vt 0.718147 0.579151 -vt 0.698842 0.590734 -vt 0.606178 0.579151 -vt 0.606178 0.602317 -vt 0.602317 0.579151 -vt 0.667954 0.555985 -vt 0.640927 0.555985 -vt 0.667954 0.586873 -vt 0.652510 0.579151 -vt 0.652510 0.563707 -vt 0.679537 0.579151 -vt 0.679537 0.563707 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 0.0000 1.0000 -vn 0.8944 -0.4472 0.0000 -vn 0.9732 -0.2298 0.0000 -vn -0.9871 -0.1602 0.0000 -vn -0.9239 -0.3827 0.0000 +vn 1.0000 0.0000 0.0000 +vn -1.0000 0.0000 -0.0000 +vn 0.0000 -0.2290 -0.9734 +vn 0.0000 -0.9389 0.3443 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn -0.0000 0.0000 -1.0000 +vn 0.3827 -0.9239 -0.0000 vn 0.9239 -0.3827 0.0000 -vn -0.2898 -0.9571 0.0000 +vn -0.3827 0.9239 -0.0000 +vn -0.7071 0.7071 0.0000 +vn 0.7071 0.7071 0.0000 +vn -0.7071 -0.7071 0.0073 +vn -0.2298 -0.9732 -0.0000 +vn -0.2295 -0.9733 0.0076 +vn 0.5626 0.8267 0.0078 +vn 0.8369 0.5474 0.0000 +vn 0.5563 0.8310 0.0000 +vn 0.9314 -0.3640 0.0000 +vn 0.9733 -0.2295 0.0076 +vn -0.9314 -0.3640 -0.0000 +vn -0.7071 -0.7071 -0.0000 +vn 0.2298 -0.9732 0.0000 +vn 0.7071 -0.7071 0.0073 +vn 0.2295 -0.9733 0.0076 +vn 0.7071 -0.7071 0.0000 +vn 0.9733 0.2295 0.0076 +vn 0.9621 0.2728 0.0000 +vn -0.9733 -0.2295 0.0076 +vn -0.0000 0.9239 -0.3827 +vn 0.0000 0.9239 0.3827 +vn -0.0000 -0.3358 -0.9419 +vn -0.0000 0.3827 -0.9239 +vn -0.0000 -0.9077 0.4197 +vn -0.0000 -0.3827 0.9239 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.9239 -0.3827 +vn 0.0000 -0.9077 -0.4197 +vn -0.0000 -0.3827 -0.9239 +vn -0.0000 0.3827 0.9239 +vn -0.0000 -0.3358 0.9419 +vn -0.9732 0.2298 -0.0000 +vn -0.9732 -0.2298 -0.0000 +vn -0.7501 0.6613 0.0078 +vn -0.5563 0.8310 -0.0000 +vn -0.7503 0.6611 0.0000 +vn -0.8369 0.5474 -0.0000 +vn -0.9906 0.1368 -0.0000 +vn -0.9239 -0.3827 -0.0000 +vn -0.8944 0.4472 0.0000 +vn -0.9621 0.2728 -0.0000 +vn -0.9733 0.2295 0.0076 +vn 0.0000 -0.9909 -0.1343 +vn 0.0000 -0.9808 0.1951 +vn 0.0000 -0.8660 -0.5000 +vn 0.0000 -0.5000 -0.8660 +vn 0.0000 -0.9914 -0.1305 +vn 0.0000 -0.2744 -0.9616 +vn 0.0000 -0.8008 -0.5989 +vn 0.0000 -0.1305 -0.9914 +vn 0.0000 0.8822 0.4709 +vn 0.0000 0.4719 0.8817 +vn 0.0000 0.7071 0.7071 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.7071 -0.7071 +vn 0.0000 0.7071 -0.7071 vn 0.9871 0.1602 0.0000 -vn -0.7071 -0.7071 0.0000 -vn -0.7947 -0.6070 0.0000 -vn 0.8507 0.5257 0.0000 +vn 0.9224 0.3863 0.0000 +vn 0.3827 0.9239 -0.0000 +vn -0.3827 -0.9239 -0.0000 +vn 0.9675 -0.2527 0.0000 +vn -0.9239 0.3827 -0.0000 +vn 0.7497 -0.6618 0.0000 +vn 0.9285 0.3714 0.0000 +vn 0.5547 -0.8321 0.0000 +vn -0.7497 -0.6618 -0.0000 +vn -0.9871 0.1602 -0.0000 +vn -0.9285 0.3714 -0.0000 +vn -0.5547 -0.8321 -0.0000 +vn -0.9906 0.1367 -0.0000 +vn -0.7972 -0.6037 -0.0000 +vn 0.7972 -0.6037 0.0000 +vn -0.6037 -0.7972 -0.0000 +vn 0.9239 0.3827 -0.0000 +vn 0.9239 0.3826 0.0000 +vn 0.6901 -0.6901 0.2181 +vn -0.6901 -0.6901 0.2181 +vn -0.6901 0.6901 0.2181 +vn 0.6901 0.6901 0.2181 +vn 0.9759 0.0000 0.2181 +vn -0.0000 -0.9759 0.2181 +vn -0.9759 0.0000 0.2181 +vn 0.0000 0.9759 0.2181 +vn -0.6858 0.6859 0.2434 +vn 0.6858 0.6859 0.2434 +vn 0.9699 0.0000 0.2434 +vn -0.0000 -0.9699 0.2434 +vn 0.0000 0.9699 0.2434 +vn 0.6858 -0.6859 0.2434 +vn -0.9699 0.0000 0.2434 +vn -0.6858 -0.6859 0.2434 +vn 0.9808 -0.1951 0.0000 +vn -0.9808 0.1951 -0.0000 +vn -0.9808 -0.1951 -0.0000 +vn 0.9808 0.1951 0.0000 +vn 0.9732 -0.2298 0.0000 +vn 0.9732 0.2298 0.0000 +vn 0.7501 0.6613 0.0078 +vn 0.8944 0.4472 0.0000 +vn 0.9675 0.2527 0.0000 +vn -0.9675 0.2527 -0.0000 +vn -0.9675 -0.2527 -0.0000 +vn -0.2587 -0.9658 0.0164 +vn 0.2587 -0.9658 0.0164 +vn 0.9658 -0.2587 0.0164 +vn 0.7070 -0.7070 0.0165 +vn 0.9658 0.2587 0.0164 +vn 0.9529 0.3034 0.0013 +vn 0.9972 0.0737 -0.0141 +vn -0.7070 -0.7070 0.0165 +vn -0.9658 -0.2587 0.0164 +vn -0.9658 0.2587 0.0164 +vn -0.9529 0.3034 0.0013 +vn -0.5626 0.8267 0.0078 +vn -0.9972 0.0737 -0.0141 +vn -0.9005 0.4348 -0.0073 +vn 0.9005 0.4348 -0.0073 +vn 0.9135 0.4060 -0.0262 +vn -0.1452 -0.3671 0.9188 +vn 0.1981 -0.5913 0.7817 +vn 0.1452 -0.3671 0.9188 +vn 0.3316 0.5046 -0.7971 +vn -0.2171 0.6491 -0.7290 +vn 0.2171 0.6491 -0.7290 +vn -0.1981 -0.5913 0.7817 +vn 0.1909 -0.2085 0.9592 +vn 0.1257 0.3641 -0.9228 +vn -0.1909 -0.2085 0.9592 +vn -0.0577 -0.2625 -0.9632 +vn 0.0577 -0.2625 -0.9632 +vn 0.0000 -0.5735 0.8192 +vn 0.0000 -0.6407 -0.7678 +vn -0.2221 -0.8356 0.5024 +vn 0.1664 -0.6204 0.7665 +vn 0.2221 -0.8356 0.5024 +vn 0.0000 -0.4472 -0.8944 +vn 0.3162 0.0000 0.9487 +vn 0.1251 0.0000 0.9921 +vn -0.1664 -0.6204 0.7665 +vn -0.1647 -0.8707 -0.4634 +vn 0.1574 -0.8728 -0.4621 +vn 0.1647 -0.8707 -0.4634 +vn -0.3158 0.4243 -0.8487 +vn 0.3158 0.4243 -0.8487 +vn 0.4257 -0.6798 0.5972 +vn 0.3781 -0.2402 0.8941 +vn 0.3421 -0.4253 0.8379 +vn 0.4258 -0.6015 0.6760 +vn 0.8970 0.1977 -0.3953 +vn 0.8992 0.2330 -0.3704 +vn 0.8599 0.3129 -0.4032 +vn 0.8941 0.1096 -0.4342 +vn 0.4212 -0.8013 -0.4248 +vn 0.3942 -0.8092 -0.4357 +vn -0.1251 0.0000 0.9921 +vn -0.8970 0.1977 -0.3953 +vn -0.8992 0.2330 -0.3704 +vn -0.8599 0.3129 -0.4032 +vn -0.8941 0.1096 -0.4342 +vn -0.4212 -0.8013 -0.4248 +vn -0.1574 -0.8728 -0.4621 +vn -0.3942 -0.8092 -0.4357 +vn -0.3162 0.0000 0.9487 +vn -0.3781 -0.2402 0.8941 +vn -0.4258 -0.6015 0.6760 +vn -0.3421 -0.4253 0.8379 +vn -0.4257 -0.6798 0.5972 +vn -0.3316 0.5046 -0.7971 +vn -0.1257 0.3641 -0.9228 +vn 0.0000 -0.1602 0.9871 +vn 0.0000 -0.5257 0.8507 +vn 0.0000 -0.9871 0.1602 +vn 0.0000 -0.9571 -0.2898 +vn 0.0000 -0.8507 0.5257 +vn 0.0000 -0.8321 -0.5547 +vn 0.0000 0.1602 -0.9871 +vn 0.0000 0.5257 -0.8507 +vn 0.0000 0.8507 -0.5257 +vn 0.0000 0.9871 -0.1602 +vn 0.0000 0.9571 0.2898 +vn 0.0000 0.8321 0.5547 +vn 0.6763 0.7307 -0.0931 +vn 0.0000 0.9915 -0.1298 +vn -0.6763 0.7307 -0.0931 +vn -0.6906 0.7182 -0.0846 +vn 0.0000 0.9864 -0.1644 +vn 0.6906 0.7182 -0.0846 +vn -0.9135 0.4060 -0.0262 +vn 0.8315 0.5556 -0.0000 +vn -0.8315 0.5556 -0.0000 +vn -0.8315 -0.5556 -0.0000 +vn 0.8315 -0.5556 0.0000 +vn 0.0000 0.3770 -0.9262 +vn 0.0000 0.3714 -0.9285 +vn 0.0000 0.3770 0.9262 +vn 0.0000 0.3714 0.9285 +vn -0.3827 0.0000 0.9239 +vn 0.3827 0.0000 0.9239 +vn 0.7071 0.0000 0.7071 +vn -0.7071 0.0000 0.7071 +vn 0.2298 0.9732 0.0000 +vn 0.4472 0.8944 0.0000 +vn -0.4472 0.8944 0.0000 +vn -0.2298 0.9732 0.0000 +usemtl None s off -f 1330/2510/561 1328/2511/561 1329/2512/561 -f 1327/2513/561 1331/2514/561 1332/2515/561 -f 1326/2516/561 1332/2515/561 1333/2517/561 -f 1326/2518/561 1333/2519/561 1325/2520/561 -f 1333/2517/561 1334/2521/561 1325/2522/561 -f 1338/2523/562 1340/2524/562 1339/2525/562 -f 1337/2526/562 1341/2527/562 1338/2528/562 -f 1336/2529/562 1342/2530/562 1337/2526/562 -f 1336/2531/562 1335/2532/562 1343/2533/562 -f 1343/2534/562 1335/2535/562 1344/2536/562 -f 1330/2510/561 1331/2537/561 1328/2511/561 -f 1327/2513/561 1328/2538/561 1331/2514/561 -f 1326/2516/561 1327/2513/561 1332/2515/561 -f 1338/2523/562 1341/2539/562 1340/2524/562 -f 1337/2526/562 1342/2530/562 1341/2527/562 -f 1336/2529/562 1343/2534/562 1342/2530/562 +f 764/1429/365 765/1430/365 766/1431/365 +f 767/1432/366 768/1433/366 769/1434/366 +f 770/1435/367 764/1429/367 766/1431/367 +f 769/1436/368 770/1435/368 767/1437/368 +f 771/1438/369 768/1439/369 764/1440/369 +f 772/1441/370 773/1442/370 774/1443/370 +f 775/1444/367 776/1445/367 773/1442/367 +f 777/1446/366 778/1447/366 779/1448/366 +f 780/1449/366 781/1450/366 782/1451/366 +f 783/1452/368 784/1453/368 780/1454/368 +f 785/1455/366 786/1456/366 787/1457/366 +f 781/1450/371 784/1458/371 788/1459/371 +f 783/1460/370 782/1451/370 789/1461/370 +f 789/1462/365 781/1450/365 790/1463/365 +f 791/1464/370 792/1465/370 793/1466/370 +f 794/1467/370 791/1464/370 795/1468/370 +f 796/1469/372 797/1470/372 798/1471/372 +f 799/1472/373 800/1473/373 801/1474/373 +f 802/1475/373 803/1476/373 796/1477/373 +f 804/1478/372 805/1479/372 802/1480/372 +f 806/1481/372 802/1482/372 801/1483/372 +f 806/1481/374 800/1484/374 807/1485/374 +f 797/1470/375 808/1486/375 798/1471/375 +f 809/1487/365 810/1488/365 811/1489/365 +f 812/1490/365 813/1491/365 814/1492/365 +f 815/1493/372 816/1494/372 817/1495/372 +f 807/1485/365 812/1496/365 814/1492/365 +f 818/1497/365 819/1498/365 820/1499/365 +f 821/1500/365 819/1498/365 822/1501/365 +f 823/1502/372 824/1503/372 825/1504/372 +f 826/1505/372 827/1506/372 828/1507/372 +f 824/1503/372 828/1507/372 827/1506/372 +f 823/1502/371 829/1508/371 828/1507/371 +f 825/1509/367 830/1510/367 823/1502/367 +f 828/1507/366 831/1511/366 826/1512/366 +f 830/1510/365 832/1513/365 833/1514/365 +f 834/1515/365 831/1516/365 829/1508/365 +f 830/1510/365 834/1515/365 829/1508/365 +f 835/1517/366 836/1518/366 837/1519/366 +f 838/1520/366 835/1517/366 837/1519/366 +f 839/1521/366 838/1520/366 840/1522/366 +f 841/1523/366 840/1522/366 842/1524/366 +f 843/1525/366 842/1524/366 844/1526/366 +f 845/1527/366 843/1525/366 844/1526/366 +f 846/1528/367 847/1529/367 848/1530/367 +f 849/1531/367 848/1530/367 850/1532/367 +f 851/1533/367 849/1531/367 850/1532/367 +f 852/1534/367 853/1535/367 854/1536/367 +f 855/1537/367 853/1535/367 856/1538/367 +f 855/1537/367 857/1539/367 858/1540/367 +f 859/1541/365 860/1542/365 861/1543/365 +f 860/1542/371 862/1544/371 861/1543/371 +f 859/1541/365 863/1545/365 864/1546/365 +f 865/1547/372 866/1548/372 862/1544/372 +f 862/1544/367 859/1549/367 861/1543/367 +f 867/1550/366 860/1542/366 864/1551/366 +f 867/1552/372 868/1553/372 866/1548/372 +f 859/1549/376 868/1554/376 869/1555/376 +f 870/1556/377 864/1551/377 863/1557/377 +f 871/1558/366 872/1559/366 873/1560/366 +f 874/1561/367 875/1562/367 876/1563/367 +f 877/1564/366 872/1559/366 878/1565/366 +f 875/1562/367 879/1566/367 876/1563/367 +f 873/1560/366 880/1567/366 881/1568/366 +f 882/1569/367 883/1570/367 874/1561/367 +f 884/1571/366 885/1572/366 886/1573/366 +f 887/1574/367 888/1575/367 889/1576/367 +f 890/1577/366 891/1578/366 884/1571/366 +f 892/1579/367 893/1580/367 887/1574/367 +f 891/1581/372 894/1582/372 895/1583/372 +f 893/1580/371 891/1578/371 896/1584/371 +f 897/1585/371 898/1586/371 899/1587/371 +f 900/1588/371 901/1589/371 902/1590/371 +f 903/1591/372 897/1592/372 904/1593/372 +f 905/1594/372 900/1595/372 902/1596/372 +f 906/1597/372 907/1598/372 905/1594/372 +f 906/1597/372 903/1591/372 904/1593/372 +f 904/1593/372 908/1599/372 909/1600/372 +f 910/1601/372 911/1602/372 907/1598/372 +f 907/1598/372 912/1603/372 904/1593/372 +f 913/1604/372 906/1597/372 914/1605/372 +f 904/1593/372 914/1605/372 906/1597/372 +f 907/1598/372 906/1597/372 915/1606/372 +f 916/1607/371 917/1608/371 918/1609/371 +f 919/1610/371 917/1608/371 920/1611/371 +f 921/1612/365 899/1613/365 898/1614/365 +f 922/1615/365 923/1616/365 901/1589/365 +f 923/1616/365 916/1617/365 924/1618/365 +f 921/1612/365 924/1618/365 918/1619/365 +f 918/1619/365 924/1618/365 916/1617/365 +f 925/1620/370 926/1621/370 927/1622/370 +f 925/1620/370 928/1623/370 929/1624/370 +f 930/1625/365 931/1626/365 932/1627/365 +f 933/1628/365 934/1629/365 928/1623/365 +f 935/1630/365 928/1623/365 934/1629/365 +f 930/1625/365 936/1631/365 931/1626/365 +f 937/1632/365 932/1627/365 931/1626/365 +f 933/1628/365 938/1633/365 934/1629/365 +f 933/1628/365 932/1627/365 939/1634/365 +f 928/1623/365 940/1635/365 930/1625/365 +f 900/1636/367 916/1637/367 922/1638/367 +f 918/1639/366 897/1640/366 899/1641/366 +f 896/1642/365 879/1566/365 877/1564/365 +f 941/1643/371 942/1644/371 943/1645/371 +f 944/1646/372 945/1647/372 942/1644/372 +f 946/1648/365 947/1649/365 948/1650/365 +f 942/1651/366 947/1649/366 949/1652/366 +f 946/1648/367 950/1653/367 944/1646/367 +f 764/1429/365 768/1433/365 765/1430/365 +f 767/1432/366 765/1430/366 768/1433/366 +f 770/1435/367 771/1654/367 764/1429/367 +f 769/1436/368 771/1438/368 770/1435/368 +f 771/1438/369 769/1436/369 768/1439/369 +f 772/1441/370 779/1448/370 773/1442/370 +f 951/1655/367 776/1445/367 775/1444/367 +f 776/1445/367 774/1443/367 773/1442/367 +f 779/1448/366 772/1441/366 777/1446/366 +f 777/1446/366 952/1656/366 778/1447/366 +f 780/1449/366 784/1458/366 781/1450/366 +f 783/1452/368 788/1657/368 784/1453/368 +f 953/1658/366 954/1659/366 787/1457/366 +f 954/1659/366 788/1660/366 785/1455/366 +f 787/1457/366 954/1659/366 785/1455/366 +f 788/1660/366 783/1661/366 785/1455/366 +f 954/1662/371 955/1663/371 788/1459/371 +f 955/1663/371 790/1664/371 788/1459/371 +f 790/1664/371 781/1450/371 788/1459/371 +f 789/1461/370 956/1665/370 783/1460/370 +f 956/1665/370 785/1666/370 783/1460/370 +f 783/1460/370 780/1449/370 782/1451/370 +f 789/1462/365 782/1451/365 781/1450/365 +f 791/1464/370 957/1667/370 792/1465/370 +f 794/1467/370 957/1667/370 791/1464/370 +f 796/1469/372 803/1668/372 797/1470/372 +f 816/1669/373 958/1670/373 801/1474/373 +f 958/1670/373 799/1472/373 801/1474/373 +f 799/1472/373 959/1671/373 800/1473/373 +f 802/1475/373 805/1672/373 803/1476/373 +f 806/1481/372 804/1478/372 802/1482/372 +f 806/1481/374 801/1673/374 800/1484/374 +f 797/1470/375 813/1491/375 808/1486/375 +f 811/1489/365 960/1674/365 961/1675/365 +f 961/1675/365 959/1676/365 811/1489/365 +f 959/1676/365 799/1677/365 811/1489/365 +f 799/1677/365 962/1678/365 811/1489/365 +f 962/1678/365 809/1487/365 811/1489/365 +f 812/1490/365 808/1679/365 813/1491/365 +f 815/1493/372 958/1680/372 816/1494/372 +f 816/1494/372 963/1681/372 817/1495/372 +f 817/1495/372 964/1682/372 815/1493/372 +f 964/1682/372 965/1683/372 815/1493/372 +f 965/1683/372 966/1684/372 815/1493/372 +f 807/1485/365 800/1685/365 812/1496/365 +f 818/1497/365 967/1686/365 819/1498/365 +f 821/1500/365 820/1499/365 819/1498/365 +f 819/1498/365 968/1687/365 822/1501/365 +f 822/1501/365 969/1688/365 970/1689/365 +f 970/1689/365 821/1500/365 822/1501/365 +f 824/1503/372 823/1502/372 828/1507/372 +f 823/1502/371 830/1510/371 829/1508/371 +f 825/1509/367 832/1690/367 830/1510/367 +f 828/1507/366 829/1508/366 831/1511/366 +f 830/1510/365 833/1514/365 834/1515/365 +f 835/1517/366 971/1691/366 836/1518/366 +f 838/1520/366 972/1692/366 835/1517/366 +f 839/1521/366 972/1693/366 838/1520/366 +f 841/1523/366 839/1694/366 840/1522/366 +f 843/1525/366 841/1523/366 842/1524/366 +f 845/1527/366 973/1695/366 843/1525/366 +f 846/1528/367 974/1696/367 847/1529/367 +f 849/1531/367 846/1528/367 848/1530/367 +f 851/1533/367 852/1697/367 849/1531/367 +f 852/1534/367 851/1533/367 853/1535/367 +f 855/1537/367 854/1698/367 853/1535/367 +f 855/1537/367 856/1538/367 857/1539/367 +f 859/1541/365 864/1546/365 860/1542/365 +f 860/1542/371 865/1547/371 862/1544/371 +f 859/1541/365 869/1699/365 863/1545/365 +f 865/1547/372 867/1552/372 866/1548/372 +f 862/1544/367 866/1700/367 859/1549/367 +f 867/1550/366 865/1547/366 860/1542/366 +f 867/1552/372 870/1701/372 868/1553/372 +f 859/1549/376 866/1700/376 868/1554/376 +f 870/1556/377 867/1550/377 864/1551/377 +f 871/1558/366 878/1565/366 872/1559/366 +f 874/1561/367 883/1570/367 875/1562/367 +f 877/1564/366 895/1583/366 872/1559/366 +f 875/1562/367 975/1702/367 879/1566/367 +f 881/1568/366 976/1703/366 871/1558/366 +f 871/1558/366 873/1560/366 881/1568/366 +f 874/1561/367 977/1704/367 882/1569/367 +f 882/1569/367 978/1705/367 883/1570/367 +f 886/1573/366 979/1706/366 890/1577/366 +f 890/1577/366 884/1571/366 886/1573/366 +f 889/1576/367 980/1707/367 892/1579/367 +f 892/1579/367 887/1574/367 889/1576/367 +f 890/1577/366 896/1584/366 891/1578/366 +f 892/1579/367 894/1708/367 893/1580/367 +f 894/1582/372 872/1559/372 895/1583/372 +f 895/1583/372 975/1709/372 891/1581/372 +f 975/1709/372 875/1710/372 891/1581/372 +f 893/1580/371 894/1708/371 891/1578/371 +f 897/1585/371 981/1711/371 898/1586/371 +f 900/1588/371 922/1615/371 901/1589/371 +f 903/1591/372 981/1712/372 897/1592/372 +f 905/1594/372 907/1598/372 900/1595/372 +f 909/1600/372 914/1605/372 904/1593/372 +f 904/1593/372 912/1603/372 908/1599/372 +f 911/1602/372 912/1603/372 907/1598/372 +f 907/1598/372 915/1606/372 910/1601/372 +f 913/1604/372 915/1606/372 906/1597/372 +f 916/1607/371 920/1611/371 917/1608/371 +f 919/1610/371 982/1713/371 917/1608/371 +f 921/1612/365 918/1619/365 899/1613/365 +f 922/1615/365 916/1617/365 923/1616/365 +f 925/1620/370 929/1624/370 926/1621/370 +f 925/1620/370 933/1628/370 928/1623/370 +f 935/1630/365 940/1635/365 928/1623/365 +f 930/1625/365 940/1635/365 936/1631/365 +f 937/1632/365 939/1634/365 932/1627/365 +f 933/1628/365 939/1634/365 938/1633/365 +f 900/1636/367 907/1714/367 916/1637/367 +f 918/1639/366 904/1715/366 897/1640/366 +f 877/1564/365 878/1565/365 893/1716/365 +f 896/1642/365 876/1563/365 879/1566/365 +f 877/1564/365 893/1716/365 896/1642/365 +f 941/1643/371 944/1646/371 942/1644/371 +f 944/1646/372 983/1717/372 945/1647/372 +f 947/1649/365 984/1718/365 948/1650/365 +f 948/1650/365 985/1719/365 946/1648/365 +f 985/1719/365 950/1653/365 946/1648/365 +f 949/1652/366 943/1720/366 942/1651/366 +f 942/1651/366 984/1718/366 947/1649/366 +f 944/1646/367 941/1643/367 986/1721/367 +f 986/1721/367 946/1648/367 944/1646/367 s 1 -f 1325/2520/563 1336/2531/564 1326/2518/564 -f 1332/2515/565 1343/2534/566 1333/2517/566 -f 1329/2512/567 1340/2540/568 1330/2541/568 -f 1326/2518/564 1337/2542/569 1327/2543/569 -f 1333/2517/566 1344/2536/570 1334/2521/570 -f 1330/2541/568 1341/2527/571 1331/2514/571 -f 1327/2543/569 1338/2523/572 1328/2511/572 -f 1331/2514/571 1342/2530/565 1332/2515/565 -f 1328/2511/572 1339/2525/567 1329/2512/567 -f 1325/2520/563 1335/2532/563 1336/2531/564 -f 1332/2515/565 1342/2530/565 1343/2534/566 -f 1329/2512/567 1339/2525/567 1340/2540/568 -f 1326/2518/564 1336/2531/564 1337/2542/569 -f 1333/2517/566 1343/2534/566 1344/2536/570 -f 1330/2541/568 1340/2540/568 1341/2527/571 -f 1327/2543/569 1337/2542/569 1338/2523/572 -f 1331/2514/571 1341/2527/571 1342/2530/565 -f 1328/2511/572 1338/2523/572 1339/2525/567 +f 987/1722/378 988/1723/379 989/1724/380 +f 990/1725/381 991/1726/382 992/1727/383 +f 993/1728/384 994/1729/366 995/1730/385 +f 996/1731/386 997/1732/386 998/1733/387 +f 999/1734/388 1000/1735/389 1001/1736/390 +f 1002/1737/384 993/1728/384 1003/1738/391 +f 1004/1739/392 994/1729/366 1005/1740/393 +f 988/1723/379 1001/1736/390 989/1724/380 +f 1006/1741/367 996/1731/386 1007/1742/394 +f 996/1743/395 1008/1744/396 997/1745/396 +f 1009/1746/397 1010/1747/398 1006/1748/398 +f 1011/1749/399 1012/1750/400 1013/1751/401 +f 1011/1749/399 1014/1752/402 1015/1753/403 +f 1015/1754/403 1016/1755/404 1009/1746/397 +f 1006/1748/398 1017/1756/395 996/1743/395 +f 1018/1757/405 1019/1758/406 1020/1759/405 +f 997/1745/396 1018/1757/405 1020/1759/405 +f 1012/1760/367 1018/1761/367 1008/1762/367 +f 1020/1763/367 1021/1764/407 1022/1765/408 +f 1023/1766/409 1024/1767/410 1025/1768/411 +f 1026/1769/412 1027/1770/410 1028/1771/410 +f 793/1772/413 1028/1773/414 1027/1774/414 +f 1025/1768/411 1029/1775/415 1009/1776/416 +f 1019/1777/416 1026/1769/412 1021/1764/407 +f 1030/1778/411 1011/1779/415 1031/1780/415 +f 1015/1781/415 1031/1780/415 1011/1779/415 +f 1032/1782/417 1006/1741/367 1007/1742/394 +f 1033/1783/418 1034/1784/419 1035/1785/418 +f 1036/1786/420 1037/1787/421 1038/1788/420 +f 1039/1789/422 1038/1788/420 1040/1790/422 +f 1041/1791/423 1042/1792/424 1043/1793/423 +f 1044/1794/370 1040/1790/422 1045/1795/370 +f 1046/1796/421 1047/1797/425 1037/1787/421 +f 1048/1798/425 1043/1793/423 1047/1797/425 +f 1035/1785/418 1049/1799/424 1033/1783/418 +f 1037/1800/367 1035/1785/367 1050/1801/367 +f 1051/1802/426 1052/1803/427 1053/1804/426 +f 1054/1805/365 1055/1806/428 1056/1807/365 +f 1057/1808/427 1050/1809/365 1052/1803/427 +f 1058/1810/428 1053/1804/426 1055/1806/428 +f 1059/1811/429 1056/1807/365 1060/1812/429 +f 1046/1813/366 1036/1814/366 1061/1815/366 +f 1062/1816/419 1060/1812/429 1034/1784/419 +f 1063/1817/428 1064/1818/365 1065/1819/428 +f 1066/1820/429 1067/1821/370 1068/1822/429 +f 1069/1823/430 1070/1824/372 1071/1825/430 +f 1072/1826/431 1073/1827/371 1074/1828/431 +f 1075/1829/371 1065/1819/428 1073/1827/371 +f 1076/1830/365 1068/1822/429 1064/1818/365 +f 1077/1831/370 1071/1825/430 1067/1832/370 +f 1078/1833/372 1074/1828/431 1070/1824/372 +f 1063/1834/367 1075/1835/367 1077/1836/367 +f 954/1662/395 1079/1837/431 955/1663/395 +f 1079/1837/431 787/1838/372 1080/1839/372 +f 786/1840/430 956/1665/402 1081/1841/430 +f 1080/1842/372 786/1840/430 1081/1841/430 +f 1025/1843/372 1082/1844/372 1083/1845/372 +f 1084/1846/372 1085/1847/372 1086/1848/372 +f 1024/1849/372 957/1850/372 1082/1844/372 +f 1087/1851/372 1088/1852/372 1089/1853/372 +f 1090/1854/377 1091/1855/432 1092/1856/433 +f 1093/1857/375 827/1858/434 1094/1859/434 +f 1095/1860/435 1088/1861/373 1085/1862/435 +f 1088/1861/373 1096/1863/374 1089/1864/436 +f 1097/1865/437 824/1866/375 1093/1857/375 +f 1085/1862/435 1098/1867/414 1095/1860/435 +f 1099/1868/372 1098/1869/372 1093/1870/372 +f 1029/1871/372 1025/1843/372 1087/1851/372 +f 1088/1852/372 1025/1843/372 1083/1845/372 +f 1029/1872/371 1092/1856/371 1031/1873/371 +f 1030/1874/365 1092/1856/365 1100/1875/365 +f 1027/1876/365 1100/1875/365 1101/1877/365 +f 791/1878/365 1027/1876/365 1101/1877/365 +f 1092/1879/433 1102/1880/438 1100/1881/438 +f 1101/1882/439 795/1468/439 791/1464/439 +f 1100/1881/438 1103/1883/440 1101/1882/440 +f 1083/1884/441 1104/1885/442 1086/1886/442 +f 957/1667/443 1105/1887/443 1082/1888/443 +f 1086/1886/442 1106/1889/376 1084/1890/376 +f 1082/1888/444 1107/1891/441 1083/1884/441 +f 1108/1892/365 1106/1893/365 1109/1894/365 +f 1107/1895/365 1102/1896/365 1106/1893/365 +f 1107/1895/365 1103/1897/365 1102/1896/365 +f 795/1898/365 1105/1899/365 794/1900/365 +f 792/1901/445 1110/1902/367 1111/1903/376 +f 1112/1904/371 1111/1903/376 1113/1905/371 +f 792/1901/445 1024/1906/414 1114/1907/446 +f 1115/1908/366 1116/1909/391 990/1910/447 +f 798/1911/413 963/1912/387 796/1477/448 +f 810/1913/371 966/1914/377 965/1915/371 +f 962/1916/366 958/1670/374 815/1917/366 +f 811/1918/376 965/1915/371 964/1919/376 +f 809/1920/377 815/1917/366 966/1914/377 +f 804/1921/377 803/1922/449 805/1923/450 +f 797/1924/449 1117/1925/377 1115/1908/366 +f 813/1926/449 1115/1908/366 1118/1927/366 +f 1119/1928/377 813/1926/449 1118/1927/366 +f 1117/1925/377 806/1929/434 1113/1905/371 +f 807/1930/434 1119/1928/377 1112/1904/371 +f 1113/1905/371 807/1930/434 1112/1904/371 +f 801/1474/435 802/1475/435 796/1477/448 +f 800/1473/435 961/1931/387 812/1932/387 +f 812/1932/387 960/1933/367 808/1934/413 +f 811/1918/376 964/1919/376 798/1471/413 +f 1120/1935/365 1116/1936/365 1117/1937/365 +f 1121/1938/451 1122/1939/370 1123/1940/391 +f 1124/1941/452 1125/1942/367 1126/1943/387 +f 1127/1944/453 1128/1945/371 1129/1946/376 +f 1130/1947/454 1131/1948/366 1132/1949/377 +f 1133/1950/455 1123/1940/391 1131/1948/366 +f 1134/1951/456 1126/1943/387 1122/1952/370 +f 1135/1953/457 1129/1946/376 1125/1942/367 +f 1136/1954/458 1132/1949/377 1128/1945/371 +f 1137/1955/459 1136/1954/458 1127/1944/453 +f 1138/1956/460 1133/1950/455 1130/1947/454 +f 1139/1957/461 1121/1938/451 1133/1950/455 +f 1140/1958/462 1124/1941/452 1134/1951/456 +f 1135/1953/457 1137/1959/459 1127/1944/453 +f 1141/1960/463 1130/1947/454 1136/1954/458 +f 1142/1961/464 1134/1962/456 1121/1938/451 +f 1124/1941/452 1143/1963/465 1135/1953/457 +f 1144/1964/366 1142/1965/464 1139/1966/461 +f 1145/1967/370 1146/1968/466 1140/1969/462 +f 1147/1970/367 1137/1971/459 1143/1972/465 +f 1148/1973/371 1138/1974/460 1141/1975/463 +f 1149/1976/391 1140/1977/462 1142/1965/464 +f 1150/1978/387 1143/1972/465 1146/1968/466 +f 1151/1979/376 1141/1975/463 1137/1971/459 +f 1152/1980/377 1139/1966/461 1138/1974/460 +f 818/1981/467 1153/1982/366 1154/1983/366 +f 969/1984/370 1155/1985/391 970/1986/391 +f 1156/1987/376 1157/1988/367 1158/1989/367 +f 968/1990/367 1159/1991/468 1160/1992/367 +f 1158/1989/367 1161/1993/469 967/1994/469 +f 1154/1983/366 1162/1995/377 1163/1996/377 +f 968/1990/367 1164/1997/387 822/1998/387 +f 821/1999/366 1165/2000/470 820/2001/470 +f 970/1986/391 1166/2002/366 821/1999/366 +f 822/1998/387 1167/2003/370 969/2004/370 +f 1159/1991/468 967/1994/469 1161/1993/469 +f 820/2001/470 1168/2005/467 818/1981/467 +f 1169/2006/366 1170/2007/471 1171/2008/472 +f 1172/2009/473 1005/1740/393 1173/2010/474 +f 1173/2010/474 991/1726/382 1172/2009/473 +f 991/1726/382 1174/2011/393 1171/2008/472 +f 1174/2012/406 1175/2013/405 1169/2014/405 +f 1169/2014/405 1176/2015/396 1002/2016/396 +f 1002/2016/396 1177/2017/395 993/2018/395 +f 1173/2019/403 1178/2020/401 1179/2021/399 +f 994/2022/398 1180/2023/404 1005/2024/397 +f 993/2018/395 1181/2025/398 994/2022/398 +f 1180/2023/404 1173/2026/403 1005/2024/397 +f 1182/2027/366 1180/2028/366 1181/2029/366 +f 1179/2021/399 1183/2030/400 1174/2012/406 +f 1184/2031/428 1185/2032/365 1186/2033/428 +f 1187/2034/429 1188/2035/370 1189/2036/429 +f 1190/2037/430 1191/2038/372 1192/2039/430 +f 1193/2040/431 1194/2041/371 1195/2042/431 +f 1196/2043/371 1186/2033/428 1194/2041/371 +f 1197/2044/365 1189/2036/429 1185/2032/365 +f 1198/2045/370 1192/2039/430 1188/2046/370 +f 1199/2047/372 1195/2042/431 1191/2038/372 +f 1198/2048/367 1197/2049/367 1196/2050/367 +f 827/1858/434 1200/2051/449 1094/1859/434 +f 834/2052/434 1108/2053/375 1201/2054/434 +f 833/2055/375 1202/2056/437 1108/2053/375 +f 831/2057/475 1201/2054/434 1109/2058/449 +f 832/2059/476 825/2060/476 1084/1890/477 +f 1089/2061/436 826/2062/475 831/2063/475 +f 1001/2064/390 1203/2065/478 989/2066/380 +f 1000/2067/389 1204/2068/479 1001/2064/390 +f 1000/2067/389 1205/2069/480 1206/2070/481 +f 1004/2071/392 1205/2069/480 995/2072/385 +f 1172/2073/473 1207/2074/482 1004/2071/392 +f 990/2075/381 1208/2076/483 1172/2073/473 +f 1208/2076/483 990/2075/381 1209/2077/484 +f 987/2078/378 1203/2065/478 1210/2079/485 +f 987/2078/378 1211/2080/486 1007/2081/394 +f 1007/2081/394 1212/2082/487 1032/2083/417 +f 1023/2084/409 1212/2082/487 1213/2085/488 +f 1023/2084/409 1213/2085/488 1114/2086/489 +f 1213/2085/488 1214/2087/490 1114/2086/489 +f 1209/2088/371 1114/2089/371 1214/2090/371 +f 1213/2091/365 1210/2092/365 1205/2093/365 +f 818/1497/365 1154/2094/365 1215/2095/365 +f 1028/2096/365 1216/2097/365 1026/2098/365 +f 992/2099/365 991/2100/365 1118/2101/365 +f 1026/1769/412 1217/2102/491 1021/1764/407 +f 991/1726/382 1171/2008/472 1218/2103/492 +f 1118/2101/493 991/2100/382 1218/2104/492 +f 1219/2105/494 1220/2106/495 1221/2107/496 +f 1222/2108/497 1223/2109/498 1224/2110/499 +f 1225/2111/500 1226/2112/501 1220/2106/495 +f 1223/2109/498 1227/2113/502 1224/2110/499 +f 1228/2114/503 1229/2115/496 1226/2116/501 +f 1227/2113/502 1230/2117/504 1231/2118/505 +f 1232/2119/494 1233/2120/495 1229/2115/496 +f 1234/2121/506 1235/2122/506 1236/2123/506 +f 1231/2118/505 1237/2124/507 1238/2125/507 +f 1239/2126/500 1240/2127/501 1233/2120/495 +f 1241/2128/508 1242/2129/509 1235/2122/510 +f 1237/2124/507 1243/2130/511 1238/2125/507 +f 1244/2131/512 1240/2127/501 1245/2132/513 +f 1246/2133/514 1247/2134/501 1242/2129/509 +f 1248/2135/511 1249/2136/372 1243/2130/511 +f 1250/2137/515 1251/2138/516 1245/2132/517 +f 1252/2139/503 1221/2107/496 1247/2140/501 +f 1253/2141/518 1222/2108/497 1251/2138/519 +f 1242/2129/509 1254/2142/520 1235/2122/510 +f 1255/2143/521 1242/2129/509 1247/2134/501 +f 1221/2107/496 1256/2144/522 1247/2140/501 +f 1255/2143/521 1247/2140/501 1256/2144/522 +f 1257/2145/521 1220/2106/495 1226/2112/501 +f 1220/2106/495 1256/2144/522 1221/2107/496 +f 1258/2146/523 1256/2144/522 1220/2106/495 +f 1229/2115/496 1259/2147/522 1226/2116/501 +f 1226/2116/501 1259/2147/522 1257/2145/521 +f 1260/2148/521 1233/2120/495 1240/2127/501 +f 1233/2120/495 1259/2147/522 1229/2115/496 +f 1261/2149/523 1259/2147/522 1233/2120/495 +f 1244/2150/366 1262/2151/524 1260/2152/366 +f 1222/2108/497 1263/2153/525 1251/2138/519 +f 1262/2154/524 1251/2138/519 1263/2153/525 +f 1224/2110/499 1264/2155/526 1222/2108/497 +f 1263/2153/525 1222/2108/497 1264/2155/526 +f 1227/2113/502 1265/2156/527 1224/2110/499 +f 1264/2155/526 1224/2110/499 1265/2156/527 +f 1231/2118/505 1265/2156/527 1227/2113/502 +f 1262/2157/528 1244/2158/529 1245/2132/517 +f 1240/2127/501 1244/2131/512 1260/2148/521 +f 1259/2159/366 1261/2160/366 1257/2161/366 +f 1256/2162/366 1258/2163/366 1255/2164/366 +f 1260/2152/366 1262/2151/524 1261/2160/366 +f 1262/2151/524 1263/2165/525 1261/2160/366 +f 1261/2160/366 1263/2165/525 1257/2161/366 +f 1257/2161/366 1263/2165/525 1258/2163/366 +f 1258/2163/366 1263/2165/525 1255/2164/366 +f 1263/2165/525 1264/2166/526 1255/2164/366 +f 1255/2164/366 1264/2166/526 1254/2167/366 +f 1264/2166/526 1265/2168/527 1254/2167/366 +f 1265/2168/527 1231/2169/366 1236/2170/366 +f 1235/2171/366 1254/2167/366 1236/2170/366 +f 1243/2172/366 1249/2173/366 1238/2174/366 +f 1249/2173/366 1266/2175/366 1238/2174/366 +f 1266/2175/366 1236/2170/366 1231/2169/366 +f 1238/2174/366 1266/2175/366 1231/2169/366 +f 1254/2167/366 1265/2168/527 1236/2170/366 +f 1251/2138/516 1262/2157/528 1245/2132/517 +f 1250/2137/530 1240/2127/501 1267/2176/503 +f 1268/2177/367 1269/2178/367 1270/2179/531 +f 1271/2180/367 1272/2181/367 1273/2182/367 +f 1274/2183/367 1275/2184/367 1276/2185/367 +f 1269/2178/367 1273/2182/367 1270/2179/531 +f 1270/2179/531 1273/2182/367 1277/2186/532 +f 1273/2182/367 1272/2181/367 1277/2186/532 +f 1272/2181/367 1276/2185/367 1277/2186/532 +f 1276/2185/367 1275/2184/367 1277/2186/532 +f 1277/2186/532 1275/2184/367 1278/2187/533 +f 1275/2184/367 1279/2188/367 1278/2187/533 +f 1278/2187/533 1279/2188/367 1280/2189/534 +f 1270/2190/535 1253/2141/536 1250/2137/515 +f 1270/2190/535 1250/2137/515 1268/2191/537 +f 1250/2137/530 1267/2176/503 1268/2192/538 +f 1268/2192/538 1267/2176/503 1269/2193/539 +f 1239/2126/500 1269/2193/539 1267/2176/503 +f 1273/2194/540 1239/2126/500 1271/2195/541 +f 1239/2126/500 1232/2119/494 1271/2195/541 +f 1232/2119/494 1228/2114/503 1271/2195/541 +f 1271/2195/541 1228/2114/503 1272/2196/539 +f 1225/2111/500 1272/2196/539 1228/2197/503 +f 1276/2198/540 1225/2111/500 1274/2199/541 +f 1225/2111/500 1219/2105/494 1274/2199/541 +f 1219/2105/494 1252/2139/503 1274/2199/541 +f 1274/2199/541 1252/2139/503 1275/2200/539 +f 1246/2133/514 1275/2200/539 1252/2201/503 +f 1246/2133/514 1241/2128/508 1279/2202/542 +f 1270/2203/531 1277/2204/532 1253/2141/518 +f 1253/2141/518 1277/2204/532 1281/2205/543 +f 1277/2204/532 1278/2206/533 1281/2205/543 +f 1281/2205/543 1278/2206/533 1223/2109/498 +f 1278/2206/533 1280/2207/534 1223/2109/498 +f 1223/2109/498 1280/2207/534 1282/2208/544 +f 1230/2117/504 1282/2208/544 1280/2207/534 +f 1241/2209/367 1234/2210/367 1279/2188/367 +f 1279/2188/367 1234/2210/367 1280/2189/534 +f 1280/2189/534 1234/2210/367 1230/2211/367 +f 1234/2210/367 1283/2212/367 1230/2211/367 +f 1230/2211/367 1283/2212/367 1237/2213/367 +f 1248/2214/367 1237/2213/367 1284/2215/367 +f 1284/2215/367 1237/2213/367 1283/2212/367 +f 856/1538/545 838/1520/546 837/1519/545 +f 850/1532/547 844/1526/548 842/1524/547 +f 853/1535/546 840/1522/549 838/1520/546 +f 857/1539/365 837/1519/545 836/1518/365 +f 848/1530/548 845/1527/550 844/1526/548 +f 851/1533/549 842/1524/547 840/1522/549 +f 835/1517/551 858/2216/372 971/1691/372 +f 972/1692/552 855/2217/551 835/1517/551 +f 839/2218/553 854/2219/552 972/1692/552 +f 849/2220/554 839/2218/553 841/2221/554 +f 846/2222/555 841/2221/554 843/2223/555 +f 974/2224/556 843/2223/555 973/2225/556 +f 1118/2101/493 1218/2104/492 1285/2226/557 +f 1112/2227/558 1286/2228/559 1287/2229/560 +f 1286/2228/559 1112/2227/558 1288/2230/561 +f 1285/2226/557 1288/2230/561 1112/2227/558 +f 1112/2227/558 1119/2231/562 1285/2226/557 +f 1118/2101/493 1285/2226/557 1119/2231/562 +f 1026/2098/412 1216/2097/563 1217/2232/491 +f 1287/2229/560 1286/2228/559 1216/2097/563 +f 1217/2232/491 1216/2097/563 1286/2228/559 +f 1289/2233/564 1163/1996/377 1162/1995/377 +f 1156/1987/376 1290/2234/565 1291/2235/376 +f 1290/2236/372 1289/2237/372 1161/2238/372 +f 1292/2239/365 1293/2240/365 1294/2241/365 +f 1295/2242/367 1296/2243/387 1297/2244/367 +f 1298/2245/377 1292/2239/371 1299/2246/377 +f 1300/2247/391 1301/2248/366 1302/2249/391 +f 1303/2250/387 1304/2251/566 1296/2252/387 +f 1305/2253/371 1306/2254/376 1292/2239/371 +f 1307/2255/566 1308/2256/565 1304/2257/566 +f 1309/2258/376 1297/2244/367 1306/2254/376 +f 1310/2259/567 1302/2249/391 1311/2260/567 +f 1312/2261/366 1299/2246/377 1301/2248/366 +f 1313/2262/367 1314/2263/376 1315/2264/367 +f 1215/2265/564 1310/2259/567 1311/2260/567 +f 1306/2254/365 1316/2266/365 1293/2267/365 +f 1296/2243/365 1316/2268/365 1297/2244/365 +f 1292/2239/365 1317/2269/365 1299/2246/365 +f 1299/2246/365 1315/2270/365 1301/2248/365 +f 1301/2248/365 1314/2271/365 1302/2249/365 +f 1311/2272/365 1314/2273/365 1318/2274/365 +f 1304/2275/365 1319/2276/365 1296/2243/365 +f 1318/2277/365 1304/2278/365 1308/2279/365 +f 1320/2280/371 1319/2281/377 1318/2282/371 +f 1321/2283/366 1293/2284/391 1316/2285/366 +f 1322/2286/370 1317/2287/387 1294/2288/370 +f 1323/2289/376 1318/2290/371 1314/2263/376 +f 1324/2291/377 1316/2285/366 1319/2281/377 +f 1325/2292/391 1294/2288/370 1293/2284/391 +f 1326/2293/387 1315/2264/367 1317/2287/387 +f 1326/2294/372 1305/2253/372 1298/2245/372 +f 1313/2295/372 1298/2245/372 1312/2261/372 +f 1323/2296/372 1312/2261/372 1300/2247/372 +f 1305/2253/372 1325/2297/372 1309/2258/372 +f 1309/2258/372 1321/2298/372 1295/2242/372 +f 1321/2299/372 1303/2300/372 1295/2242/372 +f 1310/2301/372 1323/2302/372 1300/2247/372 +f 1324/2303/372 1307/2304/372 1303/2300/372 +f 1320/2305/372 1310/2306/372 1289/2237/372 +f 883/2307/568 891/2308/569 875/2309/569 +f 889/2310/371 976/2311/428 881/2312/371 +f 980/2313/431 881/2312/371 880/2314/431 +f 882/2315/371 885/2316/431 978/2317/431 +f 977/2318/428 886/2319/371 882/2315/371 +f 883/2307/568 885/2316/431 884/2320/568 +f 980/2313/431 873/2321/568 892/2322/568 +f 871/2323/570 888/2324/428 887/2325/570 +f 979/2326/428 874/2327/570 890/2328/570 +f 896/2329/571 874/2327/570 876/1563/571 +f 892/2322/568 872/2330/569 894/2331/569 +f 871/2323/570 893/2332/571 878/1565/571 +f 924/2333/371 905/2334/449 923/2335/449 +f 902/1590/366 923/2335/449 905/2334/449 +f 921/2336/437 981/1711/367 903/2337/437 +f 921/2336/437 906/2338/371 924/2333/371 +f 912/2339/371 936/2340/376 908/2341/376 +f 910/2342/366 937/2343/377 911/2344/377 +f 913/2345/370 938/2346/391 915/2347/391 +f 909/2348/367 935/2349/387 914/2350/387 +f 908/2341/376 940/2351/367 909/2348/367 +f 911/2344/377 931/2352/371 912/2353/371 +f 915/2347/391 939/2354/366 910/2342/366 +f 914/2350/387 934/2355/370 913/2345/370 +f 919/2356/572 926/1621/573 982/2357/573 +f 917/2358/574 926/1621/573 929/2359/574 +f 927/1622/572 920/2360/575 925/2361/575 +f 1021/2362/372 1217/2363/372 1218/2364/372 +f 945/2365/576 984/2366/577 942/2367/577 +f 944/2368/578 985/2369/579 983/2370/579 +f 985/2369/579 945/2365/576 983/2370/579 +f 990/1910/447 1327/2371/370 1328/2372/370 +f 1328/2372/370 1120/2373/387 1114/2374/446 +f 1329/2375/431 1330/2376/372 1331/2377/431 +f 1332/2378/430 1333/2379/370 1334/2380/430 +f 1335/2381/429 1336/2382/365 1337/2383/429 +f 1338/2384/428 1339/2385/371 1340/2386/428 +f 1341/2387/371 1331/2377/431 1339/2385/371 +f 1342/2388/372 1334/2380/430 1330/2376/372 +f 1343/2389/370 1337/2383/429 1333/2390/370 +f 1344/2391/365 1340/2386/428 1336/2382/365 +f 1329/2392/366 1341/2393/366 1343/2394/366 +f 987/1722/378 998/1733/387 988/1723/379 +f 990/1725/381 1172/2009/473 991/1726/382 +f 987/1722/378 1007/1742/394 996/1731/386 +f 997/1732/386 1022/1765/408 998/1733/387 +f 987/1722/378 996/1731/386 998/1733/387 +f 999/1734/388 1003/1738/391 1000/1735/389 +f 995/1730/385 1000/1735/389 993/1728/384 +f 1000/1735/389 1003/1738/391 993/1728/384 +f 1003/1738/391 1170/2007/471 1002/1737/384 +f 1004/1739/392 995/1730/385 994/1729/366 +f 988/1723/379 999/1734/388 1001/1736/390 +f 996/1743/395 1017/1756/395 1008/1744/396 +f 1009/1746/397 1016/1755/404 1010/1747/398 +f 1011/1749/399 1019/1758/406 1012/1750/400 +f 1011/1749/399 1013/1751/401 1014/1752/402 +f 1015/1754/403 1014/2395/402 1016/1755/404 +f 1006/1748/398 1010/1747/398 1017/1756/395 +f 1018/1757/405 1012/1750/400 1019/1758/406 +f 997/1745/396 1008/1744/396 1018/1757/405 +f 1008/1762/367 1017/2396/367 1014/2397/367 +f 1017/2396/367 1010/2398/367 1014/2397/367 +f 1010/2398/367 1016/2399/367 1014/2397/367 +f 1014/2397/367 1013/2400/367 1008/1762/367 +f 1013/2400/367 1012/1760/367 1008/1762/367 +f 1022/1765/408 997/1732/386 1020/1763/367 +f 1020/1763/367 1019/1777/416 1021/1764/407 +f 1023/1766/409 1114/2401/489 1024/1767/410 +f 1026/1769/412 1030/1778/411 1027/1770/410 +f 793/1772/413 1216/2402/367 1028/1773/414 +f 1032/1782/417 1023/1766/409 1009/1776/416 +f 1023/1766/409 1025/1768/411 1009/1776/416 +f 1029/1775/415 1015/1781/415 1009/1776/416 +f 1019/1777/416 1011/1779/415 1026/1769/412 +f 1030/1778/411 1026/1769/412 1011/1779/415 +f 1015/1781/415 1029/1775/415 1031/1780/415 +f 1032/1782/417 1009/1776/416 1006/1741/367 +f 1033/1783/418 1062/1816/419 1034/1784/419 +f 1036/1786/420 1046/1796/421 1037/1787/421 +f 1039/1789/422 1036/1786/420 1038/1788/420 +f 1041/1791/423 1049/1799/424 1042/1792/424 +f 1044/1794/370 1039/1789/422 1040/1790/422 +f 1046/1796/421 1048/1798/425 1047/1797/425 +f 1048/1798/425 1041/1791/423 1043/1793/423 +f 1035/1785/418 1042/1792/424 1049/1799/424 +f 1042/2403/367 1035/1785/367 1043/2404/367 +f 1035/1785/367 1034/1784/367 1052/2405/367 +f 1034/1784/367 1060/2406/367 1056/2407/367 +f 1056/2407/367 1055/2408/367 1053/2409/367 +f 1052/2405/367 1050/1801/367 1035/1785/367 +f 1050/1801/367 998/2410/367 1040/2411/367 +f 1056/2407/367 1053/2409/367 1034/1784/367 +f 1053/2409/367 1052/2405/367 1034/1784/367 +f 1047/2412/367 1043/2404/367 1035/1785/367 +f 1047/2412/367 1035/1785/367 1037/1800/367 +f 1050/1801/367 1040/2411/367 1038/2413/367 +f 998/2410/367 1045/2414/367 1040/2411/367 +f 1050/1801/367 1038/2413/367 1037/1800/367 +f 1051/1802/426 1057/1808/427 1052/1803/427 +f 1054/1805/365 1058/1810/428 1055/1806/428 +f 1057/1808/427 1061/2415/365 1050/1809/365 +f 1058/1810/428 1051/1802/426 1053/1804/426 +f 1059/1811/429 1054/1805/365 1056/1807/365 +f 1059/2416/366 1062/1816/366 1054/2417/366 +f 1062/1816/366 1033/1783/366 1057/2418/366 +f 1054/2417/366 1062/1816/366 1051/2419/366 +f 1033/1783/366 1049/2420/366 1041/2421/366 +f 1033/1783/366 1041/2421/366 1048/2422/366 +f 1051/2419/366 1058/2423/366 1054/2417/366 +f 1003/2424/366 1061/1815/366 1039/2425/366 +f 1061/1815/366 1057/2418/366 1033/1783/366 +f 1039/2425/366 1061/1815/366 1036/1814/366 +f 1057/2418/366 1051/2419/366 1062/1816/366 +f 1033/1783/366 1048/2422/366 1046/1813/366 +f 1033/1783/366 1046/1813/366 1061/1815/366 +f 1039/2425/366 1044/2426/366 1003/2424/366 +f 1062/1816/419 1059/1811/429 1060/1812/429 +f 1063/1817/428 1076/1830/365 1064/1818/365 +f 1066/1820/429 1077/2427/370 1067/1821/370 +f 1069/1823/430 1078/1833/372 1070/1824/372 +f 1072/1826/431 1075/1829/371 1073/1827/371 +f 1075/1829/371 1063/1817/428 1065/1819/428 +f 1076/1830/365 1066/1820/429 1068/1822/429 +f 1077/1831/370 1069/1823/430 1071/1825/430 +f 1078/1833/372 1072/1826/431 1074/1828/431 +f 1075/1835/367 1072/2428/367 1077/1836/367 +f 1072/2428/367 1078/2429/367 1077/1836/367 +f 1078/2429/367 1069/2430/367 1077/1836/367 +f 1077/1836/367 1066/2431/367 1076/2432/367 +f 1076/2432/367 1063/1834/367 1077/1836/367 +f 954/1662/395 953/2433/431 1079/1837/431 +f 1079/1837/431 953/2433/431 787/1838/372 +f 786/1840/430 785/1666/402 956/1665/402 +f 1080/1842/372 787/2434/372 786/1840/430 +f 1025/1843/372 1024/1849/372 1082/1844/372 +f 1024/1849/372 792/2435/372 957/1850/372 +f 1087/2436/377 1089/2061/377 1092/1856/433 +f 1089/2061/377 1090/1854/377 1092/1856/433 +f 1093/1857/375 824/1866/375 827/1858/434 +f 1095/1860/435 1099/2437/373 1088/1861/373 +f 1088/1861/373 1099/2437/373 1096/1863/374 +f 1097/1865/437 825/2438/476 824/1866/375 +f 1085/1862/435 1084/1890/477 1098/1867/414 +f 1093/1870/372 1094/2439/372 1200/2440/372 +f 1200/2440/372 1096/2441/372 1099/1868/372 +f 1099/1868/372 1095/2442/372 1098/1869/372 +f 1098/1869/372 1097/2443/372 1093/1870/372 +f 1093/1870/372 1200/2440/372 1099/1868/372 +f 1083/1845/372 1086/1848/372 1085/1847/372 +f 1088/1852/372 1087/1851/372 1025/1843/372 +f 1083/1845/372 1085/1847/372 1088/1852/372 +f 1029/1872/371 1087/2436/371 1092/1856/371 +f 1030/1874/365 1031/1873/365 1092/1856/365 +f 1027/1876/365 1030/1874/365 1100/1875/365 +f 791/1878/365 793/2444/365 1027/1876/365 +f 1092/1879/433 1091/2445/432 1102/1880/438 +f 1101/1882/439 1103/1883/439 795/1468/439 +f 1100/1881/438 1102/1880/438 1103/1883/440 +f 1083/1884/441 1107/1891/441 1104/1885/442 +f 957/1667/443 794/1467/443 1105/1887/443 +f 1086/1886/442 1104/1885/442 1106/1889/376 +f 1082/1888/444 1105/1887/444 1107/1891/441 +f 1109/1894/365 1201/2446/365 1108/1892/365 +f 1108/1892/365 1202/2447/365 1106/1893/365 +f 1106/1893/365 1090/2448/365 1109/1894/365 +f 1091/2449/365 1090/2448/365 1102/1896/365 +f 1090/2448/365 1106/1893/365 1102/1896/365 +f 1106/1893/365 1104/2450/365 1107/1895/365 +f 1107/1895/365 1105/1899/365 1103/1897/365 +f 795/1898/365 1103/1897/365 1105/1899/365 +f 1111/1903/376 1287/2451/376 792/1901/445 +f 1287/2451/376 1216/2402/367 793/1772/413 +f 793/1772/413 792/1901/413 1287/2451/376 +f 1112/1904/371 1287/2451/376 1111/1903/376 +f 1120/2452/387 1110/1902/367 1114/1907/446 +f 1110/1902/367 792/1901/445 1114/1907/446 +f 992/2453/374 1118/1927/366 990/1910/447 +f 1118/1927/366 1115/1908/366 990/1910/447 +f 798/1911/413 817/2454/367 963/1912/387 +f 810/1913/371 809/1920/377 966/1914/377 +f 962/1916/366 799/1472/374 958/1670/374 +f 811/1918/376 810/1913/371 965/1915/371 +f 809/1920/377 962/1916/366 815/1917/366 +f 804/1921/377 1117/1925/377 803/1922/449 +f 797/1924/449 803/1922/449 1117/1925/377 +f 813/1926/449 797/1924/449 1115/1908/366 +f 1119/1928/377 814/2455/377 813/1926/449 +f 1117/1925/377 804/1921/377 806/1929/434 +f 807/1930/434 814/2455/377 1119/1928/377 +f 1113/1905/371 806/1929/434 807/1930/434 +f 796/1477/448 963/1912/387 816/1669/435 +f 816/1669/435 801/1474/435 796/1477/448 +f 800/1473/435 959/1671/435 961/1931/387 +f 812/1932/387 961/1931/387 960/1933/367 +f 817/2456/367 798/1471/413 964/1919/376 +f 798/1471/413 808/1486/413 811/1918/376 +f 808/1486/413 960/2457/367 811/1918/376 +f 1111/2458/365 1110/2459/365 1120/1935/365 +f 1120/1935/365 1327/2460/365 1116/1936/365 +f 1116/1936/365 1115/2461/365 1117/1937/365 +f 1117/1937/365 1113/2462/365 1111/2458/365 +f 1111/2458/365 1120/1935/365 1117/1937/365 +f 1121/1938/451 1134/1962/456 1122/1939/370 +f 1124/1941/452 1135/1953/457 1125/1942/367 +f 1127/1944/453 1136/1954/458 1128/1945/371 +f 1130/1947/454 1133/1950/455 1131/1948/366 +f 1133/1950/455 1121/1938/451 1123/1940/391 +f 1134/1951/456 1124/1941/452 1126/1943/387 +f 1135/1953/457 1127/1944/453 1129/1946/376 +f 1136/1954/458 1130/1947/454 1132/1949/377 +f 1137/1955/459 1141/2463/463 1136/1954/458 +f 1138/1956/460 1139/2464/461 1133/1950/455 +f 1139/1957/461 1142/2465/464 1121/1938/451 +f 1140/1958/462 1146/2466/466 1124/1941/452 +f 1135/1953/457 1143/2467/465 1137/1959/459 +f 1141/1960/463 1138/2468/460 1130/1947/454 +f 1142/1961/464 1140/2469/462 1134/1962/456 +f 1124/1941/452 1146/2470/466 1143/1963/465 +f 1144/1964/366 1149/1976/391 1142/1965/464 +f 1145/1967/370 1150/1978/387 1146/1968/466 +f 1147/1970/367 1151/1979/376 1137/1971/459 +f 1148/1973/371 1152/1980/377 1138/1974/460 +f 1149/1976/391 1145/2471/370 1140/1977/462 +f 1150/1978/387 1147/1970/367 1143/1972/465 +f 1151/1979/376 1148/1973/371 1141/1975/463 +f 1152/1980/377 1144/1964/366 1139/1966/461 +f 818/1981/467 1168/2005/467 1153/1982/366 +f 969/1984/370 1167/2472/370 1155/1985/391 +f 1156/1987/376 1291/2235/376 1157/1988/367 +f 968/1990/367 819/2473/468 1159/1991/468 +f 1158/1989/367 1157/1988/367 1161/1993/469 +f 1154/1983/366 1153/1982/366 1162/1995/377 +f 968/1990/367 1160/1992/367 1164/1997/387 +f 821/1999/366 1166/2002/366 1165/2000/470 +f 970/1986/391 1155/1985/391 1166/2002/366 +f 822/1998/387 1164/1997/387 1167/2003/370 +f 1159/1991/468 819/2473/468 967/1994/469 +f 820/2001/470 1165/2000/470 1168/2005/467 +f 1171/2008/472 1174/2011/393 1169/2006/366 +f 1169/2006/366 1002/1737/384 1170/2007/471 +f 1172/2009/473 1004/1739/392 1005/1740/393 +f 1173/2010/474 1179/2474/474 991/1726/382 +f 991/1726/382 1179/2474/474 1174/2011/393 +f 1174/2012/406 1183/2030/400 1175/2013/405 +f 1169/2014/405 1175/2013/405 1176/2015/396 +f 1002/2016/396 1176/2015/396 1177/2017/395 +f 1173/2019/403 1182/2475/402 1178/2020/401 +f 994/2022/398 1181/2025/398 1180/2023/404 +f 993/2018/395 1177/2017/395 1181/2025/398 +f 1180/2023/404 1182/2476/402 1173/2026/403 +f 1181/2029/366 1177/2477/366 1182/2027/366 +f 1177/2477/366 1176/2478/366 1182/2027/366 +f 1176/2478/366 1175/2479/366 1183/2480/366 +f 1183/2480/366 1178/2481/366 1176/2478/366 +f 1178/2481/366 1182/2027/366 1176/2478/366 +f 1179/2021/399 1178/2020/401 1183/2030/400 +f 1184/2031/428 1197/2044/365 1185/2032/365 +f 1187/2034/429 1198/2482/370 1188/2035/370 +f 1190/2037/430 1199/2047/372 1191/2038/372 +f 1193/2040/431 1196/2043/371 1194/2041/371 +f 1196/2043/371 1184/2031/428 1186/2033/428 +f 1197/2044/365 1187/2034/429 1189/2036/429 +f 1198/2045/370 1190/2037/430 1192/2039/430 +f 1199/2047/372 1193/2040/431 1195/2042/431 +f 1196/2050/367 1193/2483/367 1199/2484/367 +f 1199/2484/367 1190/2485/367 1198/2048/367 +f 1198/2048/367 1187/2486/367 1197/2049/367 +f 1197/2049/367 1184/2487/367 1196/2050/367 +f 1196/2050/367 1199/2484/367 1198/2048/367 +f 827/1858/434 826/2488/475 1200/2051/449 +f 834/2052/434 833/2055/375 1108/2053/375 +f 833/2055/375 832/2059/476 1202/2056/437 +f 831/2057/475 834/2052/434 1201/2054/434 +f 825/2060/476 1097/1865/437 1098/1867/414 +f 1084/1890/477 1106/1889/367 832/2059/476 +f 1106/1889/367 1202/2056/437 832/2059/476 +f 825/2060/476 1098/1867/414 1084/1890/477 +f 1089/2061/436 1096/2489/374 826/2062/475 +f 1096/2489/374 1200/2051/449 826/2062/475 +f 1109/2058/449 1090/1854/366 831/2063/475 +f 1090/1854/366 1089/2061/436 831/2063/475 +f 1001/2064/390 1204/2068/479 1203/2065/478 +f 1000/2067/389 1206/2070/481 1204/2068/479 +f 1000/2067/389 995/2072/385 1205/2069/480 +f 1004/2071/392 1207/2074/482 1205/2069/480 +f 1172/2073/473 1208/2076/483 1207/2074/482 +f 987/2078/378 989/2066/380 1203/2065/478 +f 987/2078/378 1210/2079/485 1211/2080/486 +f 1007/2081/394 1211/2080/486 1212/2082/487 +f 1023/2084/409 1032/2083/417 1212/2082/487 +f 1209/2088/371 990/2490/371 1114/2089/371 +f 1208/2491/365 1209/2088/365 1214/2090/365 +f 1213/2091/365 1212/2492/365 1210/2092/365 +f 1212/2492/365 1211/2493/365 1210/2092/365 +f 1208/2491/365 1214/2090/365 1213/2091/365 +f 1205/2093/365 1207/2494/365 1208/2491/365 +f 1204/2495/365 1206/2496/365 1205/2093/365 +f 1210/2092/365 1203/2497/365 1205/2093/365 +f 1203/2497/365 1204/2495/365 1205/2093/365 +f 1205/2093/365 1208/2491/365 1213/2091/365 +f 1154/2094/365 1163/2498/365 1215/2095/365 +f 1215/2095/365 1308/2279/365 967/1686/365 +f 1308/2279/365 1156/2499/365 1158/2500/365 +f 967/1686/365 1308/2279/365 1158/2500/365 +f 967/1686/365 818/1497/365 1215/2095/365 +f 1219/2105/494 1225/2111/500 1220/2106/495 +f 1222/2108/497 1281/2205/543 1223/2109/498 +f 1225/2111/500 1228/2197/503 1226/2112/501 +f 1223/2109/498 1282/2208/544 1227/2113/502 +f 1228/2114/503 1232/2119/494 1229/2115/496 +f 1227/2113/502 1282/2208/544 1230/2117/504 +f 1232/2119/494 1239/2126/500 1233/2120/495 +f 1234/2121/506 1241/2128/506 1235/2122/506 +f 1231/2118/505 1230/2117/504 1237/2124/507 +f 1239/2126/500 1267/2176/503 1240/2127/501 +f 1241/2128/508 1246/2133/514 1242/2129/509 +f 1237/2124/507 1248/2135/511 1243/2130/511 +f 1246/2133/514 1252/2201/503 1247/2134/501 +f 1248/2135/511 1284/2501/372 1249/2136/372 +f 1250/2137/515 1253/2141/536 1251/2138/516 +f 1252/2139/503 1219/2105/494 1221/2107/496 +f 1253/2141/518 1281/2205/543 1222/2108/497 +f 1255/2143/521 1254/2142/520 1242/2129/509 +f 1257/2145/521 1258/2146/523 1220/2106/495 +f 1260/2148/521 1261/2149/523 1233/2120/495 +f 1250/2137/530 1245/2132/513 1240/2127/501 +f 1239/2126/500 1273/2194/540 1269/2193/539 +f 1225/2111/500 1276/2198/540 1272/2196/539 +f 1246/2133/514 1279/2202/542 1275/2200/539 +f 856/1538/545 853/1535/546 838/1520/546 +f 850/1532/547 848/1530/548 844/1526/548 +f 853/1535/546 851/1533/549 840/1522/549 +f 857/1539/365 856/1538/545 837/1519/545 +f 848/1530/548 847/1529/550 845/1527/550 +f 851/1533/549 850/1532/547 842/1524/547 +f 835/1517/551 855/2217/551 858/2216/372 +f 972/1692/552 854/2219/552 855/2217/551 +f 839/2218/553 852/2502/553 854/2219/552 +f 849/2220/554 852/2502/553 839/2218/553 +f 846/2222/555 849/2220/554 841/2221/554 +f 974/2224/556 846/2222/555 843/2223/555 +f 1289/2233/564 1215/2265/564 1163/1996/377 +f 1156/1987/376 1308/2256/565 1290/2234/565 +f 1289/2237/372 1162/2503/372 1153/2504/372 +f 1153/2504/372 1168/2505/372 1289/2237/372 +f 1168/2505/372 1161/2238/372 1289/2237/372 +f 1161/2238/372 1157/2506/372 1290/2236/372 +f 1157/2506/372 1291/2507/372 1290/2236/372 +f 1292/2239/365 1306/2254/365 1293/2240/365 +f 1295/2242/367 1303/2300/387 1296/2243/387 +f 1298/2245/377 1305/2253/371 1292/2239/371 +f 1300/2247/391 1312/2261/366 1301/2248/366 +f 1303/2250/387 1307/2508/566 1304/2251/566 +f 1305/2253/371 1309/2258/376 1306/2254/376 +f 1307/2255/566 1290/2234/565 1308/2256/565 +f 1309/2258/376 1295/2242/367 1297/2244/367 +f 1310/2259/567 1300/2247/391 1302/2249/391 +f 1312/2261/366 1298/2245/377 1299/2246/377 +f 1313/2262/367 1323/2289/376 1314/2263/376 +f 1215/2265/564 1289/2233/564 1310/2259/567 +f 1306/2254/365 1297/2244/365 1316/2266/365 +f 1296/2243/365 1319/2509/365 1316/2268/365 +f 1292/2239/365 1294/2510/365 1317/2269/365 +f 1299/2246/365 1317/2511/365 1315/2270/365 +f 1301/2248/365 1315/2512/365 1314/2271/365 +f 1311/2272/365 1302/2249/365 1314/2273/365 +f 1304/2275/365 1318/2513/365 1319/2276/365 +f 1308/2279/365 1215/2095/365 1318/2277/365 +f 1215/2095/365 1311/2514/365 1318/2277/365 +f 1320/2280/371 1324/2291/377 1319/2281/377 +f 1321/2283/366 1325/2292/391 1293/2284/391 +f 1322/2286/370 1326/2293/387 1317/2287/387 +f 1323/2289/376 1320/2515/371 1318/2290/371 +f 1324/2291/377 1321/2283/366 1316/2285/366 +f 1325/2292/391 1322/2286/370 1294/2288/370 +f 1326/2293/387 1313/2262/367 1315/2264/367 +f 1326/2294/372 1322/2516/372 1305/2253/372 +f 1313/2295/372 1326/2517/372 1298/2245/372 +f 1323/2296/372 1313/2518/372 1312/2261/372 +f 1305/2253/372 1322/2519/372 1325/2297/372 +f 1309/2258/372 1325/2520/372 1321/2298/372 +f 1321/2299/372 1324/2521/372 1303/2300/372 +f 1310/2301/372 1320/2522/372 1323/2302/372 +f 1324/2303/372 1320/2523/372 1307/2304/372 +f 1289/2237/372 1290/2236/372 1320/2305/372 +f 1290/2236/372 1307/2524/372 1320/2305/372 +f 883/2307/568 884/2320/568 891/2308/569 +f 889/2310/371 888/2324/428 976/2311/428 +f 980/2313/431 889/2310/371 881/2312/371 +f 882/2315/371 886/2319/371 885/2316/431 +f 977/2318/428 979/2326/428 886/2319/371 +f 883/2307/568 978/2317/431 885/2316/431 +f 980/2313/431 880/2314/431 873/2321/568 +f 871/2323/570 976/2311/428 888/2324/428 +f 979/2326/428 977/2318/428 874/2327/570 +f 896/2329/571 890/2328/570 874/2327/570 +f 892/2322/568 873/2321/568 872/2330/569 +f 871/2323/570 887/2325/570 893/2332/571 +f 924/2333/371 906/2338/371 905/2334/449 +f 902/1590/366 901/1589/366 923/2335/449 +f 921/2336/437 898/1586/367 981/1711/367 +f 921/2336/437 903/2337/437 906/2338/371 +f 912/2339/371 931/2525/371 936/2340/376 +f 910/2342/366 939/2354/366 937/2343/377 +f 913/2345/370 934/2355/370 938/2346/391 +f 909/2348/367 940/2351/367 935/2349/387 +f 908/2341/376 936/2340/376 940/2351/367 +f 911/2344/377 937/2343/377 931/2352/371 +f 915/2347/391 938/2346/391 939/2354/366 +f 914/2350/387 935/2349/387 934/2355/370 +f 919/2356/572 927/1622/572 926/1621/573 +f 917/2358/574 982/2357/573 926/1621/573 +f 927/1622/572 919/2356/572 920/2360/575 +f 1171/2526/372 1170/2527/372 1022/2528/372 +f 1170/2527/372 1003/2529/372 998/2530/372 +f 1003/2529/372 1044/2531/372 1045/2532/372 +f 998/2530/372 1022/2528/372 1170/2527/372 +f 1022/2528/372 1021/2362/372 1171/2526/372 +f 1003/2529/372 1045/2532/372 998/2530/372 +f 1218/2364/372 1171/2526/372 1021/2362/372 +f 1288/2533/372 1285/2534/372 1286/2535/372 +f 1285/2534/372 1218/2364/372 1217/2363/372 +f 1217/2363/372 1286/2535/372 1285/2534/372 +f 945/2365/576 948/2536/576 984/2366/577 +f 944/2368/578 950/2537/578 985/2369/579 +f 985/2369/579 948/2536/576 945/2365/576 +f 990/1910/447 1116/1909/391 1327/2371/370 +f 1328/2372/370 1327/2371/370 1120/2373/387 +f 1329/2375/431 1342/2388/372 1330/2376/372 +f 1332/2378/430 1343/2538/370 1333/2379/370 +f 1335/2381/429 1344/2391/365 1336/2382/365 +f 1338/2384/428 1341/2387/371 1339/2385/371 +f 1341/2387/371 1329/2375/431 1331/2377/431 +f 1342/2388/372 1332/2378/430 1334/2380/430 +f 1343/2389/370 1335/2381/429 1337/2383/429 +f 1344/2391/365 1338/2384/428 1340/2386/428 +f 1341/2393/366 1338/2539/366 1343/2394/366 +f 1338/2539/366 1344/2540/366 1343/2394/366 +f 1344/2540/366 1335/2541/366 1343/2394/366 +f 1343/2394/366 1332/2542/366 1342/2543/366 +f 1342/2543/366 1329/2392/366 1343/2394/366 diff --git a/src/main/resources/assets/hbm/textures/items/ammo_folly.png b/src/main/resources/assets/hbm/textures/items/ammo_folly.png deleted file mode 100644 index aa7e1cee2..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_folly.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_folly_du.png b/src/main/resources/assets/hbm/textures/items/ammo_folly_du.png deleted file mode 100644 index ca37c31ee..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_folly_du.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_folly_nuclear.png b/src/main/resources/assets/hbm/textures/items/ammo_folly_nuclear.png deleted file mode 100644 index 6c18843d8..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_folly_nuclear.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_fuel.png b/src/main/resources/assets/hbm/textures/items/ammo_fuel.png deleted file mode 100644 index d4bf581a4..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_fuel.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_fuel_gas.png b/src/main/resources/assets/hbm/textures/items/ammo_fuel_gas.png deleted file mode 100644 index 6c11f2185..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_fuel_gas.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_fuel_napalm.png b/src/main/resources/assets/hbm/textures/items/ammo_fuel_napalm.png deleted file mode 100644 index 44b359f1e..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_fuel_napalm.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_fuel_phosphorus.png b/src/main/resources/assets/hbm/textures/items/ammo_fuel_phosphorus.png deleted file mode 100644 index bb94f482a..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_fuel_phosphorus.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_fuel_vaporizer.png b/src/main/resources/assets/hbm/textures/items/ammo_fuel_vaporizer.png deleted file mode 100644 index 837d2dd5f..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_fuel_vaporizer.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade.png deleted file mode 100644 index fef56db60..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_FG.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_FG.png deleted file mode 100644 index 12db05159..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_FG.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_concussion.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_concussion.png deleted file mode 100644 index 1751e2c62..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_concussion.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_finned.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_finned.png deleted file mode 100644 index 25a48819d..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_finned.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_he.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_he.png deleted file mode 100644 index 6392c9fbd..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_he.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_incendiary.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_incendiary.png deleted file mode 100644 index 97d7bfa08..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_incendiary.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_nuclear.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_nuclear.png deleted file mode 100644 index 4e165c970..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_nuclear.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_phosphorus.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_phosphorus.png deleted file mode 100644 index 2881d2f4c..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_phosphorus.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_sleek.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_sleek.png deleted file mode 100644 index 5873c51d9..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_sleek.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_toxic.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_toxic.png deleted file mode 100644 index 28e62d022..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_toxic.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_grenade_tracer.png b/src/main/resources/assets/hbm/textures/items/ammo_grenade_tracer.png deleted file mode 100644 index 265f2cda9..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_grenade_tracer.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_luna.png b/src/main/resources/assets/hbm/textures/items/ammo_luna.png deleted file mode 100644 index 7b826c3eb..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_luna.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_luna_explosive.png b/src/main/resources/assets/hbm/textures/items/ammo_luna_explosive.png deleted file mode 100644 index 822eb02b1..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_luna_explosive.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_luna_incendiary.png b/src/main/resources/assets/hbm/textures/items/ammo_luna_incendiary.png deleted file mode 100644 index 3d15da550..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_luna_incendiary.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_mirv.png b/src/main/resources/assets/hbm/textures/items/ammo_mirv.png deleted file mode 100644 index 1caf3b6c9..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_mirv.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_mirv_high.png b/src/main/resources/assets/hbm/textures/items/ammo_mirv_high.png deleted file mode 100644 index 8266ae872..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_mirv_high.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_mirv_low.png b/src/main/resources/assets/hbm/textures/items/ammo_mirv_low.png deleted file mode 100644 index 8feece87e..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_mirv_low.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_mirv_safe.png b/src/main/resources/assets/hbm/textures/items/ammo_mirv_safe.png deleted file mode 100644 index a90ebb3be..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_mirv_safe.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_mirv_special.png b/src/main/resources/assets/hbm/textures/items/ammo_mirv_special.png deleted file mode 100644 index bdadb290b..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_mirv_special.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke.png deleted file mode 100644 index 212010e52..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_barrel.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_barrel.png deleted file mode 100644 index 68e1e79fa..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_barrel.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_high.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_high.png deleted file mode 100644 index 592de0bec..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_high.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_hive.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_hive.png deleted file mode 100644 index 788454adb..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_hive.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_low.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_low.png deleted file mode 100644 index d19c8310c..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_low.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_pumpkin.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_pumpkin.png deleted file mode 100644 index c110f2a81..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_pumpkin.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_safe.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_safe.png deleted file mode 100644 index e20a170ed..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_safe.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_nuke_tots.png b/src/main/resources/assets/hbm/textures/items/ammo_nuke_tots.png deleted file mode 100644 index 5ba9c2c74..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_nuke_tots.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket.png deleted file mode 100644 index 7fec64353..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_balefire.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_balefire.png deleted file mode 100644 index a5a42216a..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_balefire.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_canister.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_canister.png deleted file mode 100644 index 9ecc19e40..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_canister.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_digamma.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_digamma.png deleted file mode 100644 index 785b7dd16..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_digamma.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_emp.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_emp.png deleted file mode 100644 index 57f7b245e..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_emp.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_glare.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_glare.png deleted file mode 100644 index 2da9af3c1..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_glare.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_he.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_he.png deleted file mode 100644 index be341237d..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_he.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_incendiary.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_incendiary.png deleted file mode 100644 index 06c6ad789..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_incendiary.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_nuclear.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_nuclear.png deleted file mode 100644 index 7a8112095..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_nuclear.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_phosphorus.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_phosphorus.png deleted file mode 100644 index 5798976d4..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_phosphorus.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_rpc.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_rpc.png deleted file mode 100644 index 0b16c9758..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_rpc.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_shrapnel.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_shrapnel.png deleted file mode 100644 index 7f9cd9a15..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_shrapnel.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_sleek.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_sleek.png deleted file mode 100644 index 8eff0d768..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_sleek.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_rocket_toxic.png b/src/main/resources/assets/hbm/textures/items/ammo_rocket_toxic.png deleted file mode 100644 index 1cad57c5b..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/ammo_rocket_toxic.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_standard.g10_slug.png b/src/main/resources/assets/hbm/textures/items/ammo_standard.g10_slug.png new file mode 100644 index 000000000..efc9655b5 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_standard.g10_slug.png differ diff --git a/src/main/resources/assets/hbm/textures/models/weapons/sacred_dragon.png b/src/main/resources/assets/hbm/textures/models/weapons/double_barrel.png similarity index 100% rename from src/main/resources/assets/hbm/textures/models/weapons/sacred_dragon.png rename to src/main/resources/assets/hbm/textures/models/weapons/double_barrel.png diff --git a/src/main/resources/assets/hbm/textures/models/weapons/double_barrel_sacred_dragon.png b/src/main/resources/assets/hbm/textures/models/weapons/double_barrel_sacred_dragon.png new file mode 100644 index 000000000..9ccf01cb1 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/weapons/double_barrel_sacred_dragon.png differ diff --git a/src/main/resources/assets/hbm/textures/models/weapons/shredder_orig.png b/src/main/resources/assets/hbm/textures/models/weapons/shredder_orig.png new file mode 100644 index 000000000..98f6bcc34 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/weapons/shredder_orig.png differ