mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
cc1b56fa9f
@ -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`.
|
||||
|
||||
51
changelog
51
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
|
||||
|
||||
@ -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<IFluidConductor> links = new ArrayList();
|
||||
private HashSet<IFluidConnector> subscribers = new HashSet();
|
||||
|
||||
|
||||
public static List<PipeNet> trackingInstances = null;
|
||||
protected BigInteger totalTransfer = BigInteger.ZERO;
|
||||
public List<String> 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<IFluidConnector> subList = new ArrayList(subscribers);
|
||||
return fairTransfer(subList, type, pressure, fill);
|
||||
}
|
||||
|
||||
|
||||
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, int pressure, long fill) {
|
||||
|
||||
|
||||
if(fill <= 0) return 0;
|
||||
|
||||
|
||||
List<Long> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<AxisAlignedBB> 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();
|
||||
|
||||
@ -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<? extends Enum> 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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> getDebugInfo(World world, int x, int y, int z);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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++) {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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]);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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<ItemStack> 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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> 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<ItemStack> 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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> text = new ArrayList();
|
||||
|
||||
|
||||
text.add(BobMathUtil.getShortNumber(tower.power) + "HE / " + BobMathUtil.getShortNumber(tower.maxPower) + "HE");
|
||||
|
||||
for(int i = 0; i < tower.tanks.length; i++)
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<BlockPos> 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<BlockPos, Integer> 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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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<BlockPos, Block> 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<BlockPos, Block> 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;
|
||||
|
||||
@ -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)));
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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_)
|
||||
{
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<String> 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
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> 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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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<ItemStack> 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<ItemStack> stackSizeComparator = new Comparator<ItemStack>() {
|
||||
|
||||
@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);
|
||||
|
||||
@ -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<ForgeDirection> 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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<String> 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);
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<String> 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<String> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<AxisAlignedBB> 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<String> 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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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<String> 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")
|
||||
|
||||
@ -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<String> 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;
|
||||
|
||||
@ -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<AxisAlignedBB> 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<String> text = new ArrayList();
|
||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
|
||||
@ -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<String> text = new ArrayList();
|
||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
|
||||
@ -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<String> text = new ArrayList();
|
||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockFluidDuct {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user