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
|
||||||
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.
|
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
|
### 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:
|
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).
|
* 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
|
### 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:
|
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
|
* 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
|
### 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`.
|
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
|
## Added
|
||||||
* Double barrel shotgun
|
* 10 gauge slug
|
||||||
* Special weapon, spawns as part of certain loot pools
|
* Shredder
|
||||||
* Uses the new 10 gauge caliber
|
* A b-side for the autoshotgun
|
||||||
* Will reload after each shot, however it is not belt-fed, if ammo is depleted, the next reload must be triggered manually
|
* 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
|
## Changed
|
||||||
* Removed the old casing items
|
* Black powder bullets now have 75% base damage instead of 50%
|
||||||
* Reduced the flicker on the autoshotgun's holo sights
|
* Ball and powder type rounds no longer have a bonus on headshot
|
||||||
* Leviathan Turbine now has an info overlay displaying steam and energy buffer values
|
* 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
|
||||||
* Fixed the bullet casing molds being unobtainable
|
* Fixed `ITEM_TOOLTIP_SHOW_CUSTOM_NUKE` client config overriding `ITEM_TOOLTIP_SHOW_OREDICT` due to name overlap
|
||||||
* Fixed instant crash caused by smelting certain things in the crucible
|
* Fixed certain secret weapon creation condition not working properly
|
||||||
* Fixed the SPAS' alt fire having a delay of only 10 ticks instead of 20
|
* Fixed artillery rockets getting stuck in the air when their target is not set to a block
|
||||||
* Fixed 240mm nuclear shells not triggering properly if they hit their target within 3 ticks of being spawned
|
* Fixed potential issue of ABMs getting stuck mid-flight when their target is destroyed prematurely
|
||||||
* Fixed some items that are supposed to be hidden in NEI being visible
|
* Fixed mistakes in the fragment names for de_DE
|
||||||
* Fixed dual lever action shotguns having inconsistent damage
|
* Fixed nitra rocket duplication only yielding one rocket
|
||||||
* Fixed entities (especially players) not being affected at all by their own explosions (rockets, 40mm grenades, etc)
|
* Fixed rotary furnace not always properly showing the metal pouring effect
|
||||||
* To keep rocket jumping at least somewhat viable, self-damage from explosions is reduced by 50%, the knockback remains the same
|
* Fixed T45 model not lifting its arms when a new gun is held
|
||||||
* Fixed missing localization for the casing molds
|
* 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
|
||||||
* Fixed the broken CIWS turret crashing instantly
|
* Potentially fixed an issue where cargo planes do not successfully spawn on lower render distances
|
||||||
* Added safeguards to prevent any unnamed casing config from crashing
|
* Fixed glyphids not calling their `onDeath` function properly, causing them to not drop anything and preventing the appropriate forge events from firing
|
||||||
* Fixed one of the break action revolver's faces having incorrect normals, making it invisible
|
* Fixed GL state leak caused by plasma blast particles, causing other particles (especially bones) to render weird
|
||||||
* Fixed the fluid trait config not loading correctly
|
|
||||||
* Fluids are now subject to the /ntmreload command
|
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package api.hbm.fluid;
|
package api.hbm.fluid;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
|
||||||
@ -18,18 +15,18 @@ public class PipeNet implements IPipeNet {
|
|||||||
private FluidType type;
|
private FluidType type;
|
||||||
private List<IFluidConductor> links = new ArrayList();
|
private List<IFluidConductor> links = new ArrayList();
|
||||||
private HashSet<IFluidConnector> subscribers = new HashSet();
|
private HashSet<IFluidConnector> subscribers = new HashSet();
|
||||||
|
|
||||||
public static List<PipeNet> trackingInstances = null;
|
public static List<PipeNet> trackingInstances = null;
|
||||||
protected BigInteger totalTransfer = BigInteger.ZERO;
|
protected BigInteger totalTransfer = BigInteger.ZERO;
|
||||||
public List<String> debug = new ArrayList();
|
public List<String> debug = new ArrayList();
|
||||||
|
|
||||||
public PipeNet(FluidType type) {
|
public PipeNet(FluidType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void joinNetworks(IPipeNet network) {
|
public void joinNetworks(IPipeNet network) {
|
||||||
|
|
||||||
if(network == this)
|
if(network == this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -38,11 +35,11 @@ public class PipeNet implements IPipeNet {
|
|||||||
this.getLinks().add(conductor);
|
this.getLinks().add(conductor);
|
||||||
}
|
}
|
||||||
network.getLinks().clear();
|
network.getLinks().clear();
|
||||||
|
|
||||||
for(IFluidConnector connector : network.getSubscribers()) {
|
for(IFluidConnector connector : network.getSubscribers()) {
|
||||||
this.subscribe(connector);
|
this.subscribe(connector);
|
||||||
}
|
}
|
||||||
|
|
||||||
network.destroy();
|
network.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +55,10 @@ public class PipeNet implements IPipeNet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPipeNet joinLink(IFluidConductor conductor) {
|
public IPipeNet joinLink(IFluidConductor conductor) {
|
||||||
|
|
||||||
if(conductor.getPipeNet(type) != null)
|
if(conductor.getPipeNet(type) != null)
|
||||||
conductor.getPipeNet(type).leaveLink(conductor);
|
conductor.getPipeNet(type).leaveLink(conductor);
|
||||||
|
|
||||||
conductor.setPipeNet(type, this);
|
conductor.setPipeNet(type, this);
|
||||||
this.links.add(conductor);
|
this.links.add(conductor);
|
||||||
return this;
|
return this;
|
||||||
@ -91,53 +88,54 @@ public class PipeNet implements IPipeNet {
|
|||||||
@Override
|
@Override
|
||||||
public long transferFluid(long fill, int pressure) {
|
public long transferFluid(long fill, int pressure) {
|
||||||
|
|
||||||
subscribers.removeIf(x ->
|
subscribers.removeIf(x ->
|
||||||
x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid() || !x.isLoaded()
|
x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid() || !x.isLoaded()
|
||||||
);
|
);
|
||||||
|
|
||||||
if(this.subscribers.isEmpty())
|
if(this.subscribers.isEmpty())
|
||||||
return fill;
|
return fill;
|
||||||
|
|
||||||
trackingInstances = new ArrayList();
|
trackingInstances = new ArrayList();
|
||||||
trackingInstances.add(this);
|
trackingInstances.add(this);
|
||||||
List<IFluidConnector> subList = new ArrayList(subscribers);
|
List<IFluidConnector> subList = new ArrayList(subscribers);
|
||||||
return fairTransfer(subList, type, pressure, fill);
|
return fairTransfer(subList, type, pressure, fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, int pressure, long fill) {
|
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, int pressure, long fill) {
|
||||||
|
|
||||||
if(fill <= 0) return 0;
|
if(fill <= 0) return 0;
|
||||||
|
|
||||||
List<Long> weight = new ArrayList();
|
List<Long> weight = new ArrayList();
|
||||||
long totalReq = 0;
|
long totalReq = 0;
|
||||||
|
|
||||||
for(IFluidConnector con : subList) {
|
for(IFluidConnector con : subList) {
|
||||||
long req = con.getDemand(type, pressure);
|
long req = con.getDemand(type, pressure);
|
||||||
weight.add(req);
|
weight.add(req);
|
||||||
totalReq += req;
|
totalReq += req;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(totalReq == 0)
|
if(totalReq == 0)
|
||||||
return fill;
|
return fill;
|
||||||
|
|
||||||
long totalGiven = 0;
|
long totalGiven = 0;
|
||||||
|
|
||||||
for(int i = 0; i < subList.size(); i++) {
|
for(int i = 0; i < subList.size(); i++) {
|
||||||
IFluidConnector con = subList.get(i);
|
IFluidConnector con = subList.get(i);
|
||||||
long req = weight.get(i);
|
long req = weight.get(i);
|
||||||
double fraction = (double)req / (double)totalReq;
|
double fraction = (double)req / (double)totalReq;
|
||||||
|
|
||||||
long given = (long) Math.floor(fraction * fill);
|
long given = (long) Math.floor(fraction * fill);
|
||||||
|
|
||||||
if(given > 0) {
|
if(given > 0) {
|
||||||
|
|
||||||
totalGiven += (given - con.transferFluid(type, pressure, given));
|
totalGiven += (given - con.transferFluid(type, pressure, given));
|
||||||
|
|
||||||
if(con instanceof TileEntity) {
|
if(con instanceof TileEntity) {
|
||||||
TileEntity tile = (TileEntity) con;
|
TileEntity tile = (TileEntity) con;
|
||||||
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
|
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* debug code
|
||||||
if(trackingInstances != null) {
|
if(trackingInstances != null) {
|
||||||
for(int j = 0; j < trackingInstances.size(); j++) {
|
for(int j = 0; j < trackingInstances.size(); j++) {
|
||||||
PipeNet net = trackingInstances.get(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));
|
log(net, sdf.format(new Date(System.currentTimeMillis())) + " Sending " + given + "mB to " + conToString(con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trackingInstances != null) {
|
if(trackingInstances != null) {
|
||||||
|
|
||||||
for(int i = 0; i < trackingInstances.size(); i++) {
|
for(int i = 0; i < trackingInstances.size(); i++) {
|
||||||
PipeNet net = trackingInstances.get(i);
|
PipeNet net = trackingInstances.get(i);
|
||||||
net.totalTransfer = net.totalTransfer.add(BigInteger.valueOf(totalGiven));
|
net.totalTransfer = net.totalTransfer.add(BigInteger.valueOf(totalGiven));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fill - totalGiven;
|
return fill - totalGiven;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,10 +168,10 @@ public class PipeNet implements IPipeNet {
|
|||||||
public void destroy() {
|
public void destroy() {
|
||||||
this.valid = false;
|
this.valid = false;
|
||||||
this.subscribers.clear();
|
this.subscribers.clear();
|
||||||
|
|
||||||
for(IFluidConductor con : this.links)
|
for(IFluidConductor con : this.links)
|
||||||
con.setPipeNet(type, null);
|
con.setPipeNet(type, null);
|
||||||
|
|
||||||
this.links.clear();
|
this.links.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,22 +184,22 @@ public class PipeNet implements IPipeNet {
|
|||||||
public BigInteger getTotalTransfer() {
|
public BigInteger getTotalTransfer() {
|
||||||
return this.totalTransfer;
|
return this.totalTransfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(PipeNet net, String msg) {
|
public static void log(PipeNet net, String msg) {
|
||||||
net.debug.add(msg);
|
net.debug.add(msg);
|
||||||
|
|
||||||
while(net.debug.size() > 50) {
|
while(net.debug.size() > 50) {
|
||||||
net.debug.remove(0);
|
net.debug.remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String conToString(IFluidConnector con) {
|
public static String conToString(IFluidConnector con) {
|
||||||
|
|
||||||
if(con instanceof TileEntity) {
|
if(con instanceof TileEntity) {
|
||||||
TileEntity tile = (TileEntity) con;
|
TileEntity tile = (TileEntity) con;
|
||||||
return tile.getClass().getSimpleName() + " @ " + tile.xCoord + "/" + tile.yCoord + "/" + tile.zCoord;
|
return tile.getClass().getSimpleName() + " @ " + tile.xCoord + "/" + tile.yCoord + "/" + tile.zCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "" + con;
|
return "" + con;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
@ -11,7 +10,7 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockBase extends Block {
|
public class BlockBase extends Block {
|
||||||
|
|
||||||
private boolean beaconable = false;
|
private boolean beaconable = false;
|
||||||
private boolean canSpawn = true;
|
private boolean canSpawn = true;
|
||||||
|
|
||||||
@ -22,14 +21,14 @@ public class BlockBase extends Block {
|
|||||||
public BlockBase(Material material) {
|
public BlockBase(Material material) {
|
||||||
super(material);
|
super(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block setBlockName(String name) {
|
public Block setBlockName(String name) {
|
||||||
super.setBlockName(name);
|
super.setBlockName(name);
|
||||||
this.setBlockTextureName(RefStrings.MODID + ":" + name);
|
this.setBlockTextureName(RefStrings.MODID + ":" + name);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Daisychainable setter for making the block a beacon base block
|
* Daisychainable setter for making the block a beacon base block
|
||||||
* @return
|
* @return
|
||||||
@ -38,7 +37,7 @@ public class BlockBase extends Block {
|
|||||||
this.beaconable = true;
|
this.beaconable = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockBase noMobSpawn() {
|
public BlockBase noMobSpawn() {
|
||||||
this.canSpawn = false;
|
this.canSpawn = false;
|
||||||
return this;
|
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) {
|
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
||||||
return this.beaconable;
|
return this.beaconable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the block to air and drops it
|
* Sets the block to air and drops it
|
||||||
* @param world
|
* @param world
|
||||||
@ -62,7 +61,7 @@ public class BlockBase extends Block {
|
|||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public void dismantle(World world, int x, int y, int z) {
|
public void dismantle(World world, int x, int y, int z) {
|
||||||
|
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
|
|
||||||
ItemStack itemstack = new ItemStack(this, 1);
|
ItemStack itemstack = new ItemStack(this, 1);
|
||||||
|
|||||||
@ -1,15 +1,10 @@
|
|||||||
package com.hbm.blocks;
|
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.MultiblockHandlerXR;
|
||||||
import com.hbm.handler.ThreeInts;
|
import com.hbm.handler.ThreeInts;
|
||||||
import com.hbm.interfaces.ICopiable;
|
import com.hbm.interfaces.ICopiable;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.IPersistentNBT;
|
import com.hbm.tileentity.IPersistentNBT;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -33,6 +28,10 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable {
|
||||||
|
|
||||||
public BlockDummyable(Material mat) {
|
public BlockDummyable(Material mat) {
|
||||||
@ -50,7 +49,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
|||||||
public static final int offset = 10;
|
public static final int offset = 10;
|
||||||
// meta offset from dummy to extra rotation
|
// meta offset from dummy to extra rotation
|
||||||
public static final int extra = 6;
|
public static final int extra = 6;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An extra integer that can be set before block set operations (such as makeExtra) and intercepted in createNewTileEntity.
|
* 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.
|
* 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 int overrideTileMeta = 0;
|
||||||
|
|
||||||
public static boolean safeRem = false;
|
public static boolean safeRem = false;
|
||||||
|
|
||||||
public static void setOverride(int i) {
|
public static void setOverride(int i) {
|
||||||
overrideTileMeta = i;
|
overrideTileMeta = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void resetOverride() {
|
public static void resetOverride() {
|
||||||
overrideTileMeta = 0;
|
overrideTileMeta = 0;
|
||||||
}
|
}
|
||||||
@ -179,7 +178,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
|||||||
if(i == 3) {
|
if(i == 3) {
|
||||||
dir = ForgeDirection.getOrientation(4);
|
dir = ForgeDirection.getOrientation(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = getDirModified(dir);
|
dir = getDirModified(dir);
|
||||||
|
|
||||||
if(!checkRequirement(world, x, y, z, dir, o)) {
|
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) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
lastBlockSet = new BlockPos(x, y, 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.
|
* 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
|
* 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) {
|
protected int getMetaForCore(World world, int x, int y, int z, EntityPlayer player, int original) {
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows to modify the general placement direction as if the player had another rotation.
|
* 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
|
* 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);
|
world.setBlock(x, y, z, this, meta + extra, 3);
|
||||||
this.safeRem = false;
|
this.safeRem = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeExtra(World world, int x, int y, int z) {
|
public void removeExtra(World world, int x, int y, int z) {
|
||||||
|
|
||||||
if(world.getBlock(x, y, z) != this)
|
if(world.getBlock(x, y, z) != this)
|
||||||
@ -310,7 +309,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
|||||||
// if(pos != null) {
|
// if(pos != null) {
|
||||||
|
|
||||||
ForgeDirection d = ForgeDirection.getOrientation(i);
|
ForgeDirection d = ForgeDirection.getOrientation(i);
|
||||||
|
|
||||||
if(world.getBlock(x - d.offsetX, y - d.offsetY, z - d.offsetZ) == this)
|
if(world.getBlock(x - d.offsetX, y - d.offsetY, z - d.offsetZ) == this)
|
||||||
world.setBlockToAir(x - d.offsetX, y - d.offsetY, z - d.offsetZ);
|
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) {
|
protected boolean standardOpenBehavior(World world, int x, int y, int z, EntityPlayer player, int id) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
@ -403,14 +402,14 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||||
|
|
||||||
if(!player.capabilities.isCreativeMode) {
|
if(!player.capabilities.isCreativeMode) {
|
||||||
harvesters.set(player);
|
harvesters.set(player);
|
||||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||||
harvesters.set(null);
|
harvesters.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called after the block and TE are already gone, so this method is of no use to us.
|
* 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.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||||
player.addExhaustion(0.025F);
|
player.addExhaustion(0.025F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useDetailedHitbox() {
|
public boolean useDetailedHitbox() {
|
||||||
return !bounding.isEmpty();
|
return !bounding.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AxisAlignedBB> bounding = new ArrayList();
|
public List<AxisAlignedBB> bounding = new ArrayList();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||||
|
|
||||||
if(!this.useDetailedHitbox()) {
|
if(!this.useDetailedHitbox()) {
|
||||||
super.addCollisionBoxesToList(world, x, y, z, entityBounding, list, entity);
|
super.addCollisionBoxesToList(world, x, y, z, entityBounding, list, entity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x = pos[0];
|
x = pos[0];
|
||||||
y = pos[1];
|
y = pos[1];
|
||||||
z = pos[2];
|
z = pos[2];
|
||||||
|
|
||||||
for(AxisAlignedBB aabb :this.bounding) {
|
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));
|
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)) {
|
if(entityBounding.intersectsWith(boxlet)) {
|
||||||
list.add(boxlet);
|
list.add(boxlet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AxisAlignedBB getAABBRotationOffset(AxisAlignedBB aabb, double x, double y, double z, ForgeDirection dir) {
|
public static AxisAlignedBB getAABBRotationOffset(AxisAlignedBB aabb, double x, double y, double z, ForgeDirection dir) {
|
||||||
|
|
||||||
AxisAlignedBB newBox = null;
|
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.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.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.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(dir == ForgeDirection.WEST) newBox = AxisAlignedBB.getBoundingBox(aabb.minZ, aabb.minY, -aabb.maxX, aabb.maxZ, aabb.maxY, -aabb.minX);
|
||||||
|
|
||||||
if(newBox != null) {
|
if(newBox != null) {
|
||||||
newBox.offset(x, y, z);
|
newBox.offset(x, y, z);
|
||||||
return newBox;
|
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);
|
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
|
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
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldDrawHighlight(World world, int x, int y, int z) {
|
public boolean shouldDrawHighlight(World world, int x, int y, int z) {
|
||||||
return !this.bounding.isEmpty();
|
return !this.bounding.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z) {
|
public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
if(pos == null) return;
|
if(pos == null) return;
|
||||||
|
|
||||||
x = pos[0];
|
x = pos[0];
|
||||||
y = pos[1];
|
y = pos[1];
|
||||||
z = pos[2];
|
z = pos[2];
|
||||||
|
|
||||||
EntityPlayer player = event.player;
|
EntityPlayer player = event.player;
|
||||||
float interp = event.partialTicks;
|
float interp = event.partialTicks;
|
||||||
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp;
|
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp;
|
||||||
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp;
|
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp;
|
||||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||||
float exp = 0.002F;
|
float exp = 0.002F;
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
ICustomBlockHighlight.setup();
|
ICustomBlockHighlight.setup();
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.hbm.util.EnumUtil;
|
import com.hbm.util.EnumUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.material.Material;
|
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.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BlockEnumMulti extends BlockMulti {
|
public class BlockEnumMulti extends BlockMulti {
|
||||||
|
|
||||||
public Class<? extends Enum> theEnum;
|
public Class<? extends Enum> theEnum;
|
||||||
@ -23,17 +22,17 @@ public class BlockEnumMulti extends BlockMulti {
|
|||||||
this.multiName = multiName;
|
this.multiName = multiName;
|
||||||
this.multiTexture = multiTexture;
|
this.multiTexture = multiTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IIcon[] icons;
|
protected IIcon[] icons;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
|
|
||||||
if(multiTexture) {
|
if(multiTexture) {
|
||||||
Enum[] enums = theEnum.getEnumConstants();
|
Enum[] enums = theEnum.getEnumConstants();
|
||||||
this.icons = new IIcon[enums.length];
|
this.icons = new IIcon[enums.length];
|
||||||
|
|
||||||
for(int i = 0; i < icons.length; i++) {
|
for(int i = 0; i < icons.length; i++) {
|
||||||
Enum num = enums[i];
|
Enum num = enums[i];
|
||||||
this.icons[i] = reg.registerIcon(this.getTextureMultiName(num));
|
this.icons[i] = reg.registerIcon(this.getTextureMultiName(num));
|
||||||
@ -42,25 +41,25 @@ public class BlockEnumMulti extends BlockMulti {
|
|||||||
this.blockIcon = reg.registerIcon(this.getTextureName());
|
this.blockIcon = reg.registerIcon(this.getTextureName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnlocalizedName(ItemStack stack) {
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
|
|
||||||
if(this.multiName) {
|
if(this.multiName) {
|
||||||
Enum num = EnumUtil.grabEnumSafely(this.theEnum, stack.getItemDamage());
|
Enum num = EnumUtil.grabEnumSafely(this.theEnum, stack.getItemDamage());
|
||||||
return getUnlocalizedMultiName(num);
|
return getUnlocalizedMultiName(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getUnlocalizedName();
|
return this.getUnlocalizedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTextureMultiName(Enum num) {
|
public String getTextureMultiName(Enum num) {
|
||||||
return this.getTextureName() + "." + num.name().toLowerCase(Locale.US);
|
return this.getTextureName() + "." + num.name().toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnlocalizedMultiName(Enum num) {
|
public String getUnlocalizedMultiName(Enum num) {
|
||||||
return super.getUnlocalizedName() + "." + num.name().toLowerCase(Locale.US);
|
return super.getUnlocalizedName() + "." + num.name().toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.entity.item.EntityFallingBlockNT;
|
import com.hbm.entity.item.EntityFallingBlockNT;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -14,6 +11,8 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockFallingNT extends Block {
|
public class BlockFallingNT extends Block {
|
||||||
|
|
||||||
public static boolean fallInstantly;
|
public static boolean fallInstantly;
|
||||||
@ -45,7 +44,7 @@ public class BlockFallingNT extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void fall(World world, int x, int y, int z) {
|
protected void fall(World world, int x, int y, int z) {
|
||||||
|
|
||||||
if(canFallThrough(world, x, y - 1, z) && y >= 0) {
|
if(canFallThrough(world, x, y - 1, z) && y >= 0) {
|
||||||
byte range = 32;
|
byte range = 32;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -9,6 +7,8 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class BlockMulti extends BlockBase implements IBlockMulti {
|
public abstract class BlockMulti extends BlockBase implements IBlockMulti {
|
||||||
|
|
||||||
public BlockMulti() {
|
public BlockMulti() {
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -12,8 +9,11 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockRemap extends Block implements ILookOverlay {
|
public class BlockRemap extends Block implements ILookOverlay {
|
||||||
|
|
||||||
public Block remapBlock;
|
public Block remapBlock;
|
||||||
public int remapMeta;
|
public int remapMeta;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public class BlockRemap extends Block implements ILookOverlay {
|
|||||||
public IIcon getIcon(int meta, int side) {
|
public IIcon getIcon(int meta, int side) {
|
||||||
return this.remapBlock.getIcon(meta, side);
|
return this.remapBlock.getIcon(meta, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int meta, Random rand, int fortune) {
|
public Item getItemDropped(int meta, Random rand, int fortune) {
|
||||||
return this.remapBlock.getItemDropped(meta, rand, fortune);
|
return this.remapBlock.getItemDropped(meta, rand, fortune);
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface IAnalyzable {
|
public interface IAnalyzable {
|
||||||
|
|
||||||
public List<String> getDebugInfo(World world, int x, int y, int z);
|
public List<String> getDebugInfo(World world, int x, int y, int z);
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public interface ICustomBlockHighlight {
|
public interface ICustomBlockHighlight {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) public boolean shouldDrawHighlight(World world, int x, int y, int z);
|
@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 void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z);
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
@ -22,7 +21,7 @@ public interface ICustomBlockHighlight {
|
|||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
GL11.glDepthMask(false);
|
GL11.glDepthMask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void cleanup() {
|
public static void cleanup() {
|
||||||
GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@ -11,6 +7,9 @@ import net.minecraft.client.gui.Gui;
|
|||||||
import net.minecraft.client.gui.ScaledResolution;
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ILookOverlay {
|
public interface ILookOverlay {
|
||||||
|
|
||||||
@ -33,14 +32,14 @@ public interface ILookOverlay {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for(String line : text) {
|
for(String line : text) {
|
||||||
|
|
||||||
int color = 0xFFFFFF;
|
int color = 0xFFFFFF;
|
||||||
if(line.startsWith("&[")) {
|
if(line.startsWith("&[")) {
|
||||||
int end = line.lastIndexOf("&]");
|
int end = line.lastIndexOf("&]");
|
||||||
color = Integer.parseInt(line.substring(2, end));
|
color = Integer.parseInt(line.substring(2, end));
|
||||||
line = line.substring(end + 2);
|
line = line.substring(end + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.fontRenderer.drawStringWithShadow(line, pX, pZ, color);
|
mc.fontRenderer.drawStringWithShadow(line, pX, pZ, color);
|
||||||
pZ += 10;
|
pZ += 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface IPersistentInfoProvider {
|
public interface IPersistentInfoProvider {
|
||||||
|
|
||||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext);
|
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext);
|
||||||
|
|||||||
@ -1,23 +1,21 @@
|
|||||||
package com.hbm.blocks;
|
package com.hbm.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ITooltipProvider {
|
public interface ITooltipProvider {
|
||||||
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext);
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext);
|
||||||
|
|
||||||
public default void addStandardInfo(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)) {
|
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||||
for(String s : I18nUtil.resolveKeyArray(((Block)this).getUnlocalizedName() + ".desc")) list.add(EnumChatFormatting.YELLOW + s);
|
for(String s : I18nUtil.resolveKeyArray(((Block)this).getUnlocalizedName() + ".desc")) list.add(EnumChatFormatting.YELLOW + s);
|
||||||
} else {
|
} else {
|
||||||
@ -26,7 +24,7 @@ public interface ITooltipProvider {
|
|||||||
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public default EnumRarity getRarity(ItemStack stack) {
|
public default EnumRarity getRarity(ItemStack stack) {
|
||||||
return EnumRarity.common;
|
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) {
|
public Item getItemDropped(int i, Random rand, int j) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
|
|
||||||
TileEntityBobble entity = (TileEntityBobble) world.getTileEntity(x, y, z);
|
TileEntityBobble entity = (TileEntityBobble) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(entity != null) {
|
if(entity != null) {
|
||||||
return new ItemStack(this, 1, entity.type.ordinal());
|
return new ItemStack(this, 1, entity.type.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getPickBlock(target, world, x, y, z, player);
|
return super.getPickBlock(target, world, x, y, z, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||||
|
|
||||||
if(!player.capabilities.isCreativeMode) {
|
if(!player.capabilities.isCreativeMode) {
|
||||||
harvesters.set(player);
|
harvesters.set(player);
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
@ -87,7 +87,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
|||||||
harvesters.set(null);
|
harvesters.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||||
@ -96,11 +96,11 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
|
|
||||||
for(int i = 1; i < BobbleType.values().length; i++)
|
for(int i = 1; i < BobbleType.values().length; i++)
|
||||||
list.add(new ItemStack(item, 1, 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) {
|
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;
|
int meta = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
|
|
||||||
TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(x, y, z);
|
TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(x, y, z);
|
||||||
bobble.type = BobbleType.values()[Math.abs(stack.getItemDamage()) % BobbleType.values().length];
|
bobble.type = BobbleType.values()[Math.abs(stack.getItemDamage()) % BobbleType.values().length];
|
||||||
bobble.markDirty();
|
bobble.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
@ -142,7 +142,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityBobble extends TileEntity {
|
public static class TileEntityBobble extends TileEntity {
|
||||||
|
|
||||||
public BobbleType type = BobbleType.NONE;
|
public BobbleType type = BobbleType.NONE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -156,7 +156,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
|||||||
this.writeToNBT(nbt);
|
this.writeToNBT(nbt);
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
this.readFromNBT(pkt.func_148857_g());
|
this.readFromNBT(pkt.func_148857_g());
|
||||||
@ -174,9 +174,9 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
|||||||
nbt.setByte("type", (byte) type.ordinal());
|
nbt.setByte("type", (byte) type.ordinal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum BobbleType {
|
public static enum BobbleType {
|
||||||
|
|
||||||
NONE( "null", "null", null, null, false, ScrapType.BOARD_BLANK),
|
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),
|
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),
|
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),
|
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),
|
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),
|
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),
|
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);
|
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 String inscription; //the flavor text
|
||||||
public boolean skinLayers;
|
public boolean skinLayers;
|
||||||
public ScrapType scrap;
|
public ScrapType scrap;
|
||||||
|
|
||||||
private BobbleType(String name, String label, String contribution, String inscription, boolean layers, ScrapType scrap) {
|
private BobbleType(String name, String label, String contribution, String inscription, boolean layers, ScrapType scrap) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
|||||||
@ -6,13 +6,13 @@ import java.util.List;
|
|||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||||
import com.hbm.packet.toclient.NBTPacket;
|
|
||||||
import com.hbm.tileentity.INBTPacketReceiver;
|
|
||||||
|
|
||||||
import api.hbm.block.IToolable;
|
import api.hbm.block.IToolable;
|
||||||
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
@ -41,7 +41,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityEmitter();
|
return new TileEntityEmitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
@ -56,12 +56,12 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) {
|
||||||
|
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z);
|
TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(player.getHeldItem() != null) {
|
if(player.getHeldItem() != null) {
|
||||||
|
|
||||||
if(player.getHeldItem().getItem() instanceof ItemDye) {
|
if(player.getHeldItem().getItem() instanceof ItemDye) {
|
||||||
@ -72,7 +72,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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) {
|
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);
|
TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tool == ToolType.SCREWDRIVER) {
|
if(tool == ToolType.SCREWDRIVER) {
|
||||||
te.girth += 0.125F;
|
te.girth += 0.125F;
|
||||||
te.markDirty();
|
te.markDirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tool == ToolType.DEFUSER) {
|
if(tool == ToolType.DEFUSER) {
|
||||||
te.girth -= 0.125F;
|
te.girth -= 0.125F;
|
||||||
if(te.girth < 0.125F) te.girth = 0.125F;
|
if(te.girth < 0.125F) te.girth = 0.125F;
|
||||||
te.markDirty();
|
te.markDirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tool == ToolType.HAND_DRILL) {
|
if(tool == ToolType.HAND_DRILL) {
|
||||||
te.effect = (te.effect + 1) % te.effectCount;
|
te.effect = (te.effect + 1) % te.effectCount;
|
||||||
te.markDirty();
|
te.markDirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityEmitter extends TileEntity implements INBTPacketReceiver {
|
public static class TileEntityEmitter extends TileEntityLoadedBase {
|
||||||
|
|
||||||
public static final int range = 100;
|
public static final int range = 100;
|
||||||
public int color;
|
public int color;
|
||||||
public int beam;
|
public int beam;
|
||||||
@ -114,39 +114,39 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||||
|
|
||||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
for(int i = 1; i <= range; i++) {
|
for(int i = 1; i <= range; i++) {
|
||||||
|
|
||||||
beam = i;
|
beam = i;
|
||||||
|
|
||||||
int x = xCoord + dir.offsetX * i;
|
int x = xCoord + dir.offsetX * i;
|
||||||
int y = yCoord + dir.offsetY * i;
|
int y = yCoord + dir.offsetY * i;
|
||||||
int z = zCoord + dir.offsetZ * i;
|
int z = zCoord + dir.offsetZ * i;
|
||||||
|
|
||||||
Block b = worldObj.getBlock(x, y, z);
|
Block b = worldObj.getBlock(x, y, z);
|
||||||
if(b.isBlockSolid(worldObj, x, y, z, dir.ordinal())) {
|
if(b.isBlockSolid(worldObj, x, y, z, dir.ordinal())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(effect == 4 && beam > 0) {
|
if(effect == 4 && beam > 0) {
|
||||||
|
|
||||||
if(worldObj.getTotalWorldTime() % 5 == 0) {
|
if(worldObj.getTotalWorldTime() % 5 == 0) {
|
||||||
double x = (int) (xCoord + dir.offsetX * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
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 y = (int) (yCoord + dir.offsetY * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
||||||
double z = (int) (zCoord + dir.offsetZ * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
double z = (int) (zCoord + dir.offsetZ * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
||||||
|
|
||||||
int prevColor = color;
|
int prevColor = color;
|
||||||
if(color == 0) {
|
if(color == 0) {
|
||||||
color = Color.HSBtoRGB(worldObj.getTotalWorldTime() / 50.0F, 0.5F, 0.25F) & 16777215;
|
color = Color.HSBtoRGB(worldObj.getTotalWorldTime() / 50.0F, 0.5F, 0.25F) & 16777215;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setString("type", "plasmablast");
|
data.setString("type", "plasmablast");
|
||||||
data.setFloat("r", ((float)((color & 0xff0000) >> 16)) / 256F);
|
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("pitch", -90);
|
||||||
data.setFloat("yaw", 90);
|
data.setFloat("yaw", 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z),
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z),
|
||||||
new TargetPoint(worldObj.provider.dimensionId, x, y, z, 100));
|
new TargetPoint(worldObj.provider.dimensionId, x, y, z, 100));
|
||||||
|
|
||||||
color = prevColor;
|
color = prevColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(150);
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +187,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
this.writeToNBT(nbt);
|
this.writeToNBT(nbt);
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
this.readFromNBT(pkt.func_148857_g());
|
this.readFromNBT(pkt.func_148857_g());
|
||||||
@ -212,7 +208,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
nbt.setFloat("girth", this.girth);
|
nbt.setFloat("girth", this.girth);
|
||||||
nbt.setInteger("effect", this.effect);
|
nbt.setInteger("effect", this.effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return TileEntity.INFINITE_EXTENT_AABB;
|
return TileEntity.INFINITE_EXTENT_AABB;
|
||||||
@ -225,11 +221,19 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
this.beam = nbt.getInteger("beam");
|
buf.writeInt(this.beam);
|
||||||
this.color = nbt.getInteger("color");
|
buf.writeInt(this.color);
|
||||||
this.girth = nbt.getFloat("girth");
|
buf.writeFloat(this.girth);
|
||||||
this.effect = nbt.getInteger("effect");
|
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(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++) {
|
for(int i = 0; i < 9; i++) {
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.hbm.blocks.machine;
|
|||||||
|
|
||||||
import com.hbm.blocks.BlockEnumMulti;
|
import com.hbm.blocks.BlockEnumMulti;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -10,7 +9,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public class BlockICFLaserComponent extends BlockEnumMulti {
|
public class BlockICFLaserComponent extends BlockEnumMulti {
|
||||||
|
|
||||||
protected IIcon[] iconsTop;
|
protected IIcon[] iconsTop;
|
||||||
|
|
||||||
public BlockICFLaserComponent() {
|
public BlockICFLaserComponent() {
|
||||||
@ -20,7 +19,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
|
|
||||||
Enum[] enums = theEnum.getEnumConstants();
|
Enum[] enums = theEnum.getEnumConstants();
|
||||||
this.icons = new IIcon[enums.length];
|
this.icons = new IIcon[enums.length];
|
||||||
this.iconsTop = 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.icons[5] = reg.registerIcon(RefStrings.MODID + ":icf_turbocharger");
|
||||||
this.iconsTop[4] = this.iconsTop[5] = reg.registerIcon(RefStrings.MODID + ":icf_capacitor_top");
|
this.iconsTop[4] = this.iconsTop[5] = reg.registerIcon(RefStrings.MODID + ":icf_capacitor_top");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
@ -44,7 +43,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti {
|
|||||||
public int getSubCount() {
|
public int getSubCount() {
|
||||||
return EnumICFPart.values().length;
|
return EnumICFPart.values().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum EnumICFPart {
|
public static enum EnumICFPart {
|
||||||
CASING,
|
CASING,
|
||||||
PORT,
|
PORT,
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -26,7 +25,7 @@ public class DummyBlockAssembler extends DummyOldBase {
|
|||||||
{
|
{
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_assembler);
|
return Item.getItemFromBlock(ModBlocks.machine_assembler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -39,7 +38,7 @@ public class DummyBlockAssembler extends DummyOldBase {
|
|||||||
int a = ((TileEntityDummy)te).targetX;
|
int a = ((TileEntityDummy)te).targetX;
|
||||||
int b = ((TileEntityDummy)te).targetY;
|
int b = ((TileEntityDummy)te).targetY;
|
||||||
int c = ((TileEntityDummy)te).targetZ;
|
int c = ((TileEntityDummy)te).targetZ;
|
||||||
|
|
||||||
TileEntityMachineAssembler entity = (TileEntityMachineAssembler) world.getTileEntity(a, b, c);
|
TileEntityMachineAssembler entity = (TileEntityMachineAssembler) world.getTileEntity(a, b, c);
|
||||||
if(entity != null)
|
if(entity != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -26,7 +25,7 @@ public class DummyBlockRefinery extends DummyOldBase {
|
|||||||
{
|
{
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_refinery);
|
return Item.getItemFromBlock(ModBlocks.machine_refinery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -39,7 +38,7 @@ public class DummyBlockRefinery extends DummyOldBase {
|
|||||||
int a = ((TileEntityDummy)te).targetX;
|
int a = ((TileEntityDummy)te).targetX;
|
||||||
int b = ((TileEntityDummy)te).targetY;
|
int b = ((TileEntityDummy)te).targetY;
|
||||||
int c = ((TileEntityDummy)te).targetZ;
|
int c = ((TileEntityDummy)te).targetZ;
|
||||||
|
|
||||||
TileEntityMachineRefinery entity = (TileEntityMachineRefinery) world.getTileEntity(a, b, c);
|
TileEntityMachineRefinery entity = (TileEntityMachineRefinery) world.getTileEntity(a, b, c);
|
||||||
if(entity != null)
|
if(entity != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -26,7 +25,7 @@ public class DummyBlockTurbofan extends DummyOldBase {
|
|||||||
{
|
{
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_turbofan);
|
return Item.getItemFromBlock(ModBlocks.machine_turbofan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -39,7 +38,7 @@ public class DummyBlockTurbofan extends DummyOldBase {
|
|||||||
int a = ((TileEntityDummy)te).targetX;
|
int a = ((TileEntityDummy)te).targetX;
|
||||||
int b = ((TileEntityDummy)te).targetY;
|
int b = ((TileEntityDummy)te).targetY;
|
||||||
int c = ((TileEntityDummy)te).targetZ;
|
int c = ((TileEntityDummy)te).targetZ;
|
||||||
|
|
||||||
TileEntityMachineTurbofan entity = (TileEntityMachineTurbofan) world.getTileEntity(a, b, c);
|
TileEntityMachineTurbofan entity = (TileEntityMachineTurbofan) world.getTileEntity(a, b, c);
|
||||||
if(entity != null)
|
if(entity != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.block.ICrucibleAcceptor;
|
||||||
import java.util.List;
|
import api.hbm.block.IToolable;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||||
import com.hbm.items.ModItems;
|
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.items.machine.ItemScraps;
|
||||||
import com.hbm.tileentity.machine.TileEntityFoundryCastingBase;
|
import com.hbm.tileentity.machine.TileEntityFoundryCastingBase;
|
||||||
import com.hbm.util.I18nUtil;
|
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.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -30,6 +25,10 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 {
|
public abstract class FoundryCastingBase extends BlockContainer implements ICrucibleAcceptor, IToolable, ILookOverlay {
|
||||||
|
|
||||||
protected FoundryCastingBase() {
|
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) {
|
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);
|
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
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);
|
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
//remove casted item
|
//remove casted item
|
||||||
if(cast.slots[1] != null) {
|
if(cast.slots[1] != null) {
|
||||||
if(!player.inventory.addItemStackToInventory(cast.slots[1].copy())) {
|
if(!player.inventory.addItemStackToInventory(cast.slots[1].copy())) {
|
||||||
@ -87,17 +86,17 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
|||||||
} else {
|
} else {
|
||||||
player.inventoryContainer.detectAndSendChanges();
|
player.inventoryContainer.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
cast.slots[1] = null;
|
cast.slots[1] = null;
|
||||||
cast.markDirty();
|
cast.markDirty();
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//insert mold
|
//insert mold
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.mold && cast.slots[0] == null) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.mold && cast.slots[0] == null) {
|
||||||
Mold mold = ((ItemMold) player.getHeldItem().getItem()).getMold(player.getHeldItem());
|
Mold mold = ((ItemMold) player.getHeldItem().getItem()).getMold(player.getHeldItem());
|
||||||
|
|
||||||
if(mold.size == cast.getMoldSize()) {
|
if(mold.size == cast.getMoldSize()) {
|
||||||
cast.slots[0] = player.getHeldItem().copy();
|
cast.slots[0] = player.getHeldItem().copy();
|
||||||
cast.slots[0].stackSize = 1;
|
cast.slots[0].stackSize = 1;
|
||||||
@ -108,7 +107,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
||||||
if(cast.amount > 0) {
|
if(cast.amount > 0) {
|
||||||
ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount));
|
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 true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block b, int i) {
|
public void breakBlock(World world, int x, int y, int z, Block b, int i) {
|
||||||
|
|
||||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||||
if(cast.amount > 0) {
|
if(cast.amount > 0) {
|
||||||
ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount));
|
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);
|
world.spawnEntityInWorld(item);
|
||||||
cast.amount = 0; //just for safety
|
cast.amount = 0; //just for safety
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ItemStack stack : cast.slots) {
|
for(ItemStack stack : cast.slots) {
|
||||||
if(stack != null) {
|
if(stack != null) {
|
||||||
EntityItem drop = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, stack.copy());
|
EntityItem drop = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, stack.copy());
|
||||||
world.spawnEntityInWorld(drop);
|
world.spawnEntityInWorld(drop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, x, y, z, b, i);
|
super.breakBlock(world, x, y, z, b, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +153,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||||
super.randomDisplayTick(world, x, y, z, rand);
|
super.randomDisplayTick(world, x, y, z, rand);
|
||||||
|
|
||||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(cast.amount > 0 && cast.amount >= cast.getCapacity()) {
|
if(cast.amount > 0 && cast.amount >= cast.getCapacity()) {
|
||||||
@ -164,28 +163,28 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
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)
|
if(tool != ToolType.SCREWDRIVER)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(cast.slots[0] == null) return false;
|
if(cast.slots[0] == null) return false;
|
||||||
if(cast.amount > 0) return false;
|
if(cast.amount > 0) return false;
|
||||||
|
|
||||||
if(!player.inventory.addItemStackToInventory(cast.slots[0].copy())) {
|
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());
|
EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, cast.slots[0].copy());
|
||||||
world.spawnEntityInWorld(item);
|
world.spawnEntityInWorld(item);
|
||||||
} else {
|
} else {
|
||||||
player.inventoryContainer.detectAndSendChanges();
|
player.inventoryContainer.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
cast.markDirty();
|
cast.markDirty();
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
|
|
||||||
cast.slots[0] = null;
|
cast.slots[0] = null;
|
||||||
cast.markDirty();
|
cast.markDirty();
|
||||||
|
|
||||||
return true;
|
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) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
if(cast.slots[0] == null) {
|
if(cast.slots[0] == null) {
|
||||||
text.add(EnumChatFormatting.RED + I18nUtil.resolveKey("foundry.noCast"));
|
text.add(EnumChatFormatting.RED + I18nUtil.resolveKey("foundry.noCast"));
|
||||||
} else if(cast.slots[0].getItem() == ModItems.mold){
|
} else if(cast.slots[0].getItem() == ModItems.mold){
|
||||||
Mold mold = ((ItemMold) cast.slots[0].getItem()).getMold(cast.slots[0]);
|
Mold mold = ((ItemMold) cast.slots[0].getItem()).getMold(cast.slots[0]);
|
||||||
text.add(EnumChatFormatting.BLUE + mold.getTitle());
|
text.add(EnumChatFormatting.BLUE + mold.getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cast.type != null && cast.amount > 0) {
|
if(cast.type != null && cast.amount > 0) {
|
||||||
text.add(EnumChatFormatting.YELLOW + cast.type.names[0] + ": " + cast.amount + " / " + cast.getCapacity());
|
text.add(EnumChatFormatting.YELLOW + cast.type.names[0] + ": " + cast.amount + " / " + cast.getCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
|
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FurnaceCombination extends BlockDummyable implements ITooltipProvider {
|
public class FurnaceCombination extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public FurnaceCombination() {
|
public FurnaceCombination() {
|
||||||
@ -25,7 +24,7 @@ public class FurnaceCombination extends BlockDummyable implements ITooltipProvid
|
|||||||
return new TileEntityFurnaceCombination();
|
return new TileEntityFurnaceCombination();
|
||||||
return new TileEntityProxyCombo().inventory().fluid();
|
return new TileEntityProxyCombo().inventory().fluid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
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.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
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) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, 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);
|
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);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
x += dir.offsetX * o;
|
x += dir.offsetX * o;
|
||||||
z += dir.offsetZ * 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 + 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);
|
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);
|
||||||
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
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
@ -77,7 +76,7 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
|
|||||||
return false;
|
return false;
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
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]);
|
TileEntityMachineArcFurnaceLarge crucible = (TileEntityMachineArcFurnaceLarge) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
for(MaterialStack stack : crucible.liquids) {
|
for(MaterialStack stack : crucible.liquids) {
|
||||||
ItemStack scrap = ItemScraps.create(new MaterialStack(stack.material, stack.amount));
|
ItemStack scrap = ItemScraps.create(new MaterialStack(stack.material, stack.amount));
|
||||||
if(!player.inventory.addItemStackToInventory(scrap)) {
|
if(!player.inventory.addItemStackToInventory(scrap)) {
|
||||||
@ -85,11 +84,11 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
|
|||||||
world.spawnEntityInWorld(item);
|
world.spawnEntityInWorld(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.inventoryContainer.detectAndSendChanges();
|
player.inventoryContainer.detectAndSendChanges();
|
||||||
crucible.liquids.clear();
|
crucible.liquids.clear();
|
||||||
crucible.markDirty();
|
crucible.markDirty();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter;
|
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -22,6 +19,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineAutocrafter extends BlockContainer {
|
public class MachineAutocrafter extends BlockContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||||
@ -72,7 +71,7 @@ public class MachineAutocrafter extends BlockContainer {
|
|||||||
ISidedInventory tile = (ISidedInventory) world.getTileEntity(x, y, z);
|
ISidedInventory tile = (ISidedInventory) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile != null) {
|
if(tile != null) {
|
||||||
|
|
||||||
for(int i1 = 10; i1 < tile.getSizeInventory(); ++i1) {
|
for(int i1 = 10; i1 < tile.getSizeInventory(); ++i1) {
|
||||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.IPersistentInfoProvider;
|
import com.hbm.blocks.IPersistentInfoProvider;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
@ -14,7 +11,6 @@ import com.hbm.main.MainRegistry;
|
|||||||
import com.hbm.tileentity.IPersistentNBT;
|
import com.hbm.tileentity.IPersistentNBT;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.storage.TileEntityMachineBAT9000;
|
import com.hbm.tileentity.machine.storage.TileEntityMachineBAT9000;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -28,6 +24,9 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineBigAssTank9000 extends BlockDummyable implements IPersistentInfoProvider {
|
public class MachineBigAssTank9000 extends BlockDummyable implements IPersistentInfoProvider {
|
||||||
|
|
||||||
public MachineBigAssTank9000(Material mat) {
|
public MachineBigAssTank9000(Material mat) {
|
||||||
@ -36,7 +35,7 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12) return new TileEntityMachineBAT9000();
|
if(meta >= 12) return new TileEntityMachineBAT9000();
|
||||||
if(meta >= 6) return new TileEntityProxyCombo(false, false, true);
|
if(meta >= 6) return new TileEntityProxyCombo(false, false, true);
|
||||||
return null;
|
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, 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;
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
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
|
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;
|
return true;
|
||||||
} else if(player.isSneaking()){
|
} else if(player.isSneaking()){
|
||||||
@ -97,9 +96,9 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
|||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityMachineBAT9000 trialEntity = (TileEntityMachineBAT9000) world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntityMachineBAT9000 trialEntity = (TileEntityMachineBAT9000) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(trialEntity != null) {
|
if(trialEntity != null) {
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
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());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
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) {
|
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if(meta >= 6) {
|
if(meta >= 6) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
if(pos == null) return 0;
|
if(pos == null) return 0;
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityMachineBAT9000))
|
if(!(te instanceof TileEntityMachineBAT9000))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TileEntityMachineBAT9000 tank = (TileEntityMachineBAT9000) te;
|
TileEntityMachineBAT9000 tank = (TileEntityMachineBAT9000) te;
|
||||||
return tank.getComparatorPower();
|
return tank.getComparatorPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityFurnaceBrick;
|
import com.hbm.tileentity.machine.TileEntityFurnaceBrick;
|
||||||
import com.hbm.util.ItemStackUtil;
|
import com.hbm.util.ItemStackUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -24,6 +21,8 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineBrickFurnace extends BlockContainer {
|
public class MachineBrickFurnace extends BlockContainer {
|
||||||
|
|
||||||
private final Random rand = new Random();
|
private final Random rand = new Random();
|
||||||
@ -38,7 +37,7 @@ public class MachineBrickFurnace extends BlockContainer {
|
|||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
isActive = blockState;
|
isActive = blockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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.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");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_furnace_brick_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
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) {
|
public Item getItem(World world, int x, int y, int z) {
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_furnace_brick_off);
|
return Item.getItemFromBlock(ModBlocks.machine_furnace_brick_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, int x, int y, int z) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
super.onBlockAdded(world, x, y, z);
|
super.onBlockAdded(world, x, y, z);
|
||||||
this.setDefaultDirection(world, x, y, z);
|
this.setDefaultDirection(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
Block nZ = world.getBlock(x, y, z - 1);
|
Block nZ = world.getBlock(x, y, z - 1);
|
||||||
Block pZ = world.getBlock(x, y, z + 1);
|
Block pZ = world.getBlock(x, y, z + 1);
|
||||||
Block nX = world.getBlock(x - 1, y, z);
|
Block nX = world.getBlock(x - 1, y, z);
|
||||||
Block pX = world.getBlock(x + 1, y, z);
|
Block pX = world.getBlock(x + 1, y, z);
|
||||||
|
|
||||||
byte meta = 3;
|
byte meta = 3;
|
||||||
|
|
||||||
if(nZ.func_149730_j() && !pZ.func_149730_j()) 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(pZ.func_149730_j() && !nZ.func_149730_j()) meta = 2;
|
||||||
if(nX.func_149730_j() && !pX.func_149730_j()) meta = 5;
|
if(nX.func_149730_j() && !pX.func_149730_j()) meta = 5;
|
||||||
if(pX.func_149730_j() && !nX.func_149730_j()) meta = 4;
|
if(pX.func_149730_j() && !nX.func_149730_j()) meta = 4;
|
||||||
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
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 == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
|
|
||||||
if(itemStack.hasDisplayName()) ((TileEntityFurnaceBrick)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
if(itemStack.hasDisplayName()) ((TileEntityFurnaceBrick)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
@ -119,22 +118,22 @@ public class MachineBrickFurnace extends BlockContainer {
|
|||||||
int i = world.getBlockMetadata(x, y, z);
|
int i = world.getBlockMetadata(x, y, z);
|
||||||
TileEntity entity = world.getTileEntity(x, y, z);
|
TileEntity entity = world.getTileEntity(x, y, z);
|
||||||
keepInventory = true;
|
keepInventory = true;
|
||||||
|
|
||||||
if(isProcessing) {
|
if(isProcessing) {
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_on);
|
world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_on);
|
||||||
} else {
|
} else {
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_off);
|
world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
keepInventory = false;
|
keepInventory = false;
|
||||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||||
|
|
||||||
if(entity != null) {
|
if(entity != null) {
|
||||||
entity.validate();
|
entity.validate();
|
||||||
world.setTileEntity(x, y, z, entity);
|
world.setTileEntity(x, y, z, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
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);
|
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.ITooltipProvider;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
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.IPersistentNBT;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
@ -22,7 +19,6 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
|||||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
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.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
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 iconBottom;
|
||||||
@SideOnly(Side.CLIENT) public IIcon iconInnerTop;
|
@SideOnly(Side.CLIENT) public IIcon iconInnerTop;
|
||||||
@SideOnly(Side.CLIENT) public IIcon iconInnerSide;
|
@SideOnly(Side.CLIENT) public IIcon iconInnerSide;
|
||||||
|
|
||||||
protected long power;
|
protected long power;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
@ -57,7 +53,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
this.power = power;
|
this.power = power;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -87,23 +83,23 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityCapacitor))
|
if(!(te instanceof TileEntityCapacitor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityCapacitor battery = (TileEntityCapacitor) te;
|
TileEntityCapacitor battery = (TileEntityCapacitor) te;
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add(BobMathUtil.getShortNumber(battery.getPower()) + " / " + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE");
|
text.add(BobMathUtil.getShortNumber(battery.getPower()) + " / " + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE");
|
||||||
|
|
||||||
double percent = (double) battery.getPower() / (double) battery.getMaxPower();
|
double percent = (double) battery.getPower() / (double) battery.getMaxPower();
|
||||||
int charge = (int) Math.floor(percent * 10_000D);
|
int charge = (int) Math.floor(percent * 10_000D);
|
||||||
int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8);
|
int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8);
|
||||||
text.add("&[" + color + "&]" + (charge / 100D) + "%");
|
text.add("&[" + color + "&]" + (charge / 100D) + "%");
|
||||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + "+" + BobMathUtil.getShortNumber(battery.powerReceived) + "HE/t");
|
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + "+" + BobMathUtil.getShortNumber(battery.powerReceived) + "HE/t");
|
||||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + "-" + BobMathUtil.getShortNumber(battery.powerSent) + "HE/t");
|
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + "-" + BobMathUtil.getShortNumber(battery.powerSent) + "HE/t");
|
||||||
|
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +113,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||||
|
|
||||||
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||||
for(String s : I18nUtil.resolveKeyArray("tile.capacitor.desc")) list.add(EnumChatFormatting.YELLOW + s);
|
for(String s : I18nUtil.resolveKeyArray("tile.capacitor.desc")) list.add(EnumChatFormatting.YELLOW + s);
|
||||||
} else {
|
} else {
|
||||||
@ -126,7 +122,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||||
@ -139,68 +135,68 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||||
|
|
||||||
if(!player.capabilities.isCreativeMode) {
|
if(!player.capabilities.isCreativeMode) {
|
||||||
harvesters.set(player);
|
harvesters.set(player);
|
||||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||||
harvesters.set(null);
|
harvesters.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||||
player.addExhaustion(0.025F);
|
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;
|
public long power;
|
||||||
protected long maxPower;
|
protected long maxPower;
|
||||||
public long powerReceived;
|
public long powerReceived;
|
||||||
public long powerSent;
|
public long powerSent;
|
||||||
|
|
||||||
public TileEntityCapacitor() { }
|
public TileEntityCapacitor() { }
|
||||||
|
|
||||||
public TileEntityCapacitor(long maxPower) {
|
public TileEntityCapacitor(long maxPower) {
|
||||||
this.maxPower = maxPower;
|
this.maxPower = maxPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
ForgeDirection opp = ForgeDirection.getOrientation(this.getBlockMetadata());
|
ForgeDirection opp = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||||
ForgeDirection dir = opp.getOpposite();
|
ForgeDirection dir = opp.getOpposite();
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
BlockPos pos = new BlockPos(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||||
|
|
||||||
boolean didStep = false;
|
boolean didStep = false;
|
||||||
ForgeDirection last = null;
|
ForgeDirection last = null;
|
||||||
|
|
||||||
while(worldObj.getBlock(pos.getX(), pos.getY(), pos.getZ()) == ModBlocks.capacitor_bus) {
|
while(worldObj.getBlock(pos.getX(), pos.getY(), pos.getZ()) == ModBlocks.capacitor_bus) {
|
||||||
ForgeDirection current = ForgeDirection.getOrientation(worldObj.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ()));
|
ForgeDirection current = ForgeDirection.getOrientation(worldObj.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ()));
|
||||||
if(!didStep) last = current;
|
if(!didStep) last = current;
|
||||||
didStep = true;
|
didStep = true;
|
||||||
|
|
||||||
if(last != current) {
|
if(last != current) {
|
||||||
pos = null;
|
pos = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = pos.offset(current);
|
pos = pos.offset(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pos != null && last != null) {
|
if(pos != null && last != null) {
|
||||||
this.tryUnsubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ());
|
this.tryUnsubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ());
|
||||||
this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), last);
|
this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), last);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.trySubscribe(worldObj, xCoord + opp.offsetX, yCoord + opp.offsetY, zCoord + opp.offsetZ, opp);
|
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.powerSent = 0;
|
||||||
this.powerReceived = 0;
|
this.powerReceived = 0;
|
||||||
}
|
}
|
||||||
@ -213,7 +209,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
buf.writeLong(powerReceived);
|
buf.writeLong(powerReceived);
|
||||||
buf.writeLong(powerSent);
|
buf.writeLong(powerSent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deserialize(ByteBuf buf) {
|
public void deserialize(ByteBuf buf) {
|
||||||
power = buf.readLong();
|
power = buf.readLong();
|
||||||
@ -235,7 +231,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
this.setPower(this.getMaxPower());
|
this.setPower(this.getMaxPower());
|
||||||
return overshoot;
|
return overshoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void usePower(long power) {
|
public void usePower(long power) {
|
||||||
this.powerSent += Math.min(this.getPower(), power);
|
this.powerSent += Math.min(this.getPower(), power);
|
||||||
@ -255,7 +251,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
@Override public long getProviderSpeed() {
|
@Override public long getProviderSpeed() {
|
||||||
return this.getMaxPower() / 300;
|
return this.getMaxPower() / 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public long getReceiverSpeed() {
|
@Override public long getReceiverSpeed() {
|
||||||
return this.getMaxPower() / 100;
|
return this.getMaxPower() / 100;
|
||||||
}
|
}
|
||||||
@ -269,7 +265,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
public void setPower(long power) {
|
public void setPower(long power) {
|
||||||
this.power = power;
|
this.power = power;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnect(ForgeDirection dir) {
|
public boolean canConnect(ForgeDirection dir) {
|
||||||
return dir == ForgeDirection.getOrientation(this.getBlockMetadata());
|
return dir == ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||||
@ -289,14 +285,14 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
|||||||
this.power = data.getLong("power");
|
this.power = data.getLong("power");
|
||||||
this.maxPower = data.getLong("maxPower");
|
this.maxPower = data.getLong("maxPower");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
this.power = nbt.getLong("power");
|
this.power = nbt.getLong("power");
|
||||||
this.maxPower = nbt.getLong("maxPower");
|
this.maxPower = nbt.getLong("maxPower");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbt) {
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||||
|
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -20,8 +17,10 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock, ITooltipProvider {
|
public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) private IIcon topIcon;
|
@SideOnly(Side.CLIENT) private IIcon topIcon;
|
||||||
|
|
||||||
public MachineCapacitorBus(Material mat) {
|
public MachineCapacitorBus(Material mat) {
|
||||||
@ -38,7 +37,7 @@ public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock,
|
|||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return side == meta ? topIcon : blockIcon;
|
return side == meta ? topIcon : blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
@ -11,7 +8,6 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
|||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticCracker;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticCracker;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -23,6 +19,9 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineCatalyticCracker extends BlockDummyable implements ILookOverlay {
|
public class MachineCatalyticCracker extends BlockDummyable implements ILookOverlay {
|
||||||
|
|
||||||
public MachineCatalyticCracker(Material mat) {
|
public MachineCatalyticCracker(Material mat) {
|
||||||
@ -31,12 +30,12 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityMachineCatalyticCracker();
|
return new TileEntityMachineCatalyticCracker();
|
||||||
if(meta >= extra)
|
if(meta >= extra)
|
||||||
return new TileEntityProxyCombo(false, false, true);
|
return new TileEntityProxyCombo(false, false, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,33 +48,33 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(!world.isRemote && !player.isSneaking()) {
|
||||||
|
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityMachineCatalyticCracker))
|
if(!(te instanceof TileEntityMachineCatalyticCracker))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te;
|
TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te;
|
||||||
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
||||||
cracker.tanks[0].setTankType(type);
|
cracker.tanks[0].setTankType(type);
|
||||||
cracker.markDirty();
|
cracker.markDirty();
|
||||||
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
|
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
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[]{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[]{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);
|
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);
|
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);
|
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
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityMachineCatalyticCracker))
|
if(!(te instanceof TileEntityMachineCatalyticCracker))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te;
|
TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
for(int i = 0; i < cracker.tanks.length; i++)
|
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");
|
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);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.IPersistentInfoProvider;
|
import com.hbm.blocks.IPersistentInfoProvider;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
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.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -19,6 +16,8 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineCatalyticReformer extends BlockDummyable implements IPersistentInfoProvider {
|
public class MachineCatalyticReformer extends BlockDummyable implements IPersistentInfoProvider {
|
||||||
|
|
||||||
public MachineCatalyticReformer(Material mat) {
|
public MachineCatalyticReformer(Material mat) {
|
||||||
@ -31,7 +30,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist
|
|||||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
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);
|
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[] {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);
|
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);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1);
|
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1);
|
||||||
@ -72,7 +71,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
||||||
tank.readFromNBT(persistentTag, "" + i);
|
tank.readFromNBT(persistentTag, "" + i);
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityChimneyBrick;
|
import com.hbm.tileentity.machine.TileEntityChimneyBrick;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvider {
|
public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public MachineChimneyBrick(Material mat) {
|
public MachineChimneyBrick(Material mat) {
|
||||||
@ -22,7 +21,7 @@ public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12) return new TileEntityChimneyBrick();
|
if(meta >= 12) return new TileEntityChimneyBrick();
|
||||||
if(meta >= 6) return new TileEntityProxyCombo().fluid();
|
if(meta >= 6) return new TileEntityProxyCombo().fluid();
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityChimneyIndustrial;
|
import com.hbm.tileentity.machine.TileEntityChimneyIndustrial;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineChimneyIndustrial extends BlockDummyable implements ITooltipProvider {
|
public class MachineChimneyIndustrial extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public MachineChimneyIndustrial(Material mat) {
|
public MachineChimneyIndustrial(Material mat) {
|
||||||
@ -22,7 +21,7 @@ public class MachineChimneyIndustrial extends BlockDummyable implements ITooltip
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12) return new TileEntityChimneyIndustrial();
|
if(meta >= 12) return new TileEntityChimneyIndustrial();
|
||||||
if(meta >= 6) return new TileEntityProxyCombo().fluid();
|
if(meta >= 6) return new TileEntityProxyCombo().fluid();
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.hbm.blocks.machine;
|
|||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineCombustionEngine;
|
import com.hbm.tileentity.machine.TileEntityMachineCombustionEngine;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -34,15 +33,15 @@ public class MachineCombustionEngine extends BlockDummyable {
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ);
|
this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ);
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityCondenserPowered;
|
import com.hbm.tileentity.machine.TileEntityCondenserPowered;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
@ -17,6 +13,9 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineCondenserPowered extends BlockDummyable implements ILookOverlay {
|
public class MachineCondenserPowered extends BlockDummyable implements ILookOverlay {
|
||||||
|
|
||||||
public MachineCondenserPowered(Material mat) {
|
public MachineCondenserPowered(Material mat) {
|
||||||
@ -43,7 +42,7 @@ public class MachineCondenserPowered extends BlockDummyable implements ILookOver
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x = x + dir.offsetX * o;
|
x = x + dir.offsetX * o;
|
||||||
z = z + dir.offsetZ * o;
|
z = z + dir.offsetZ * o;
|
||||||
|
|
||||||
@ -70,7 +69,7 @@ public class MachineCondenserPowered extends BlockDummyable implements ILookOver
|
|||||||
|
|
||||||
TileEntityCondenserPowered tower = (TileEntityCondenserPowered) te;
|
TileEntityCondenserPowered tower = (TileEntityCondenserPowered) te;
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
text.add(BobMathUtil.getShortNumber(tower.power) + "HE / " + BobMathUtil.getShortNumber(tower.maxPower) + "HE");
|
text.add(BobMathUtil.getShortNumber(tower.power) + "HE / " + BobMathUtil.getShortNumber(tower.maxPower) + "HE");
|
||||||
|
|
||||||
for(int i = 0; i < tower.tanks.length; i++)
|
for(int i = 0; i < tower.tanks.length; i++)
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.block.IToolable;
|
||||||
import java.util.List;
|
import api.hbm.conveyor.IConveyorBelt;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
@ -10,9 +9,6 @@ import com.hbm.items.machine.ItemStamp;
|
|||||||
import com.hbm.tileentity.machine.TileEntityConveyorPress;
|
import com.hbm.tileentity.machine.TileEntityConveyorPress;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import api.hbm.block.IToolable;
|
|
||||||
import api.hbm.conveyor.IConveyorBelt;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
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.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 class MachineConveyorPress extends BlockDummyable implements IConveyorBelt, ILookOverlay, IToolable, ITooltipProvider {
|
||||||
|
|
||||||
public MachineConveyorPress(Material mat) {
|
public MachineConveyorPress(Material mat) {
|
||||||
@ -46,25 +45,25 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityConveyorPress))
|
if(!(te instanceof TileEntityConveyorPress))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
||||||
|
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemStamp && press.slots[0] == null) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemStamp && press.slots[0] == null) {
|
||||||
press.slots[0] = player.getHeldItem().copy();
|
press.slots[0] = player.getHeldItem().copy();
|
||||||
press.slots[0].stackSize = 1;
|
press.slots[0].stackSize = 1;
|
||||||
@ -75,39 +74,39 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
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;
|
if(tool != ToolType.SCREWDRIVER) return false;
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityConveyorPress))
|
if(!(te instanceof TileEntityConveyorPress))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
||||||
|
|
||||||
if(press.slots[0] == null) return false;
|
if(press.slots[0] == null) return false;
|
||||||
|
|
||||||
if(!player.inventory.addItemStackToInventory(press.slots[0].copy())) {
|
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());
|
EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, press.slots[0].copy());
|
||||||
world.spawnEntityInWorld(item);
|
world.spawnEntityInWorld(item);
|
||||||
} else {
|
} else {
|
||||||
player.inventoryContainer.detectAndSendChanges();
|
player.inventoryContainer.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
press.slots[0] = null;
|
press.slots[0] = null;
|
||||||
press.markChanged();
|
press.markChanged();
|
||||||
|
|
||||||
return true;
|
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);
|
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
||||||
int meta = world.getBlockMetadata(x, y - 1, z) - offset;
|
int meta = world.getBlockMetadata(x, y - 1, z) - offset;
|
||||||
return ForgeDirection.getOrientation(meta).getRotation(ForgeDirection.UP);
|
return ForgeDirection.getOrientation(meta).getRotation(ForgeDirection.UP);
|
||||||
@ -148,21 +147,21 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
|||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityConveyorPress))
|
if(!(te instanceof TileEntityConveyorPress))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
text.add(BobMathUtil.getShortNumber(press.power) + "HE / " + BobMathUtil.getShortNumber(press.maxPower) + "HE");
|
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()));
|
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);
|
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.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineCrystallizer;
|
import com.hbm.tileentity.machine.TileEntityMachineCrystallizer;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -16,7 +15,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class MachineCrystallizer extends BlockDummyable {
|
public class MachineCrystallizer extends BlockDummyable {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ public class MachineCrystallizer extends BlockDummyable {
|
|||||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
@ -60,7 +59,7 @@ public class MachineCrystallizer extends BlockDummyable {
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.machine.TileEntityDeuteriumExtractor;
|
import com.hbm.tileentity.machine.TileEntityDeuteriumExtractor;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@ -20,6 +16,9 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineDeuteriumExtractor extends BlockContainer implements ILookOverlay {
|
public class MachineDeuteriumExtractor extends BlockContainer implements ILookOverlay {
|
||||||
|
|
||||||
public MachineDeuteriumExtractor(Material mat) {
|
public MachineDeuteriumExtractor(Material mat) {
|
||||||
@ -54,20 +53,20 @@ public class MachineDeuteriumExtractor extends BlockContainer implements ILookOv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityDeuteriumExtractor))
|
if(!(te instanceof TileEntityDeuteriumExtractor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityDeuteriumExtractor extractor = (TileEntityDeuteriumExtractor) te;
|
TileEntityDeuteriumExtractor extractor = (TileEntityDeuteriumExtractor) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add((extractor.power < extractor.getMaxPower() / 20 ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + "Power: " + BobMathUtil.getShortNumber(extractor.power) + "HE");
|
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++)
|
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");
|
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);
|
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.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityDiFurnace;
|
import com.hbm.tileentity.machine.TileEntityDiFurnace;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -20,7 +19,7 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class MachineDiFurnaceExtension extends BlockContainer implements IProxyController {
|
public class MachineDiFurnaceExtension extends BlockContainer implements IProxyController {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||||
@SideOnly(Side.CLIENT) private IIcon iconBottom;
|
@SideOnly(Side.CLIENT) private IIcon iconBottom;
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityProxyCombo().inventory().fluid();
|
return new TileEntityProxyCombo().inventory().fluid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":difurnace_extension");
|
||||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":brick_fire");
|
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":brick_fire");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(!player.isSneaking()) {
|
if(!player.isSneaking()) {
|
||||||
@ -52,7 +51,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon;
|
return side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon;
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityDiFurnaceRTG;
|
import com.hbm.tileentity.machine.TileEntityDiFurnaceRTG;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -25,8 +22,10 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineDiFurnaceRTG extends BlockContainer {
|
public class MachineDiFurnaceRTG extends BlockContainer {
|
||||||
|
|
||||||
private final Random rand = new Random();
|
private final Random rand = new Random();
|
||||||
private final boolean isActive;
|
private final boolean isActive;
|
||||||
private static boolean keepInventory;
|
private static boolean keepInventory;
|
||||||
@ -116,7 +115,7 @@ public class MachineDiFurnaceRTG extends BlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
@ -145,7 +144,7 @@ public class MachineDiFurnaceRTG extends BlockContainer {
|
|||||||
} else {
|
} else {
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_difurnace_rtg_off);
|
world.setBlock(x, y, z, ModBlocks.machine_difurnace_rtg_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
keepInventory = false;
|
keepInventory = false;
|
||||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
|
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -25,12 +22,14 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineElectricFurnace extends BlockContainer {
|
public class MachineElectricFurnace extends BlockContainer {
|
||||||
|
|
||||||
private final Random field_149933_a = new Random();
|
private final Random field_149933_a = new Random();
|
||||||
private final boolean isActive;
|
private final boolean isActive;
|
||||||
private static boolean keepInventory;
|
private static boolean keepInventory;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconFront;
|
private IIcon iconFront;
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
@ -40,7 +39,7 @@ public class MachineElectricFurnace extends BlockContainer {
|
|||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
isActive = blockState;
|
isActive = blockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_top");
|
||||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_bottom");
|
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_bottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
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 : this.iconTop);
|
||||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon);
|
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||||
{
|
{
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off);
|
return Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, int x, int y, int z) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
super.onBlockAdded(world, x, y, z);
|
super.onBlockAdded(world, x, y, z);
|
||||||
this.setDefaultDirection(world, x, y, z);
|
this.setDefaultDirection(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||||
if(!world.isRemote)
|
if(!world.isRemote)
|
||||||
{
|
{
|
||||||
@ -77,9 +76,9 @@ public class MachineElectricFurnace extends BlockContainer {
|
|||||||
Block block2 = world.getBlock(x, y, z + 1);
|
Block block2 = world.getBlock(x, y, z + 1);
|
||||||
Block block3 = world.getBlock(x - 1, y, z);
|
Block block3 = world.getBlock(x - 1, y, z);
|
||||||
Block block4 = world.getBlock(x + 1, y, z);
|
Block block4 = world.getBlock(x + 1, y, z);
|
||||||
|
|
||||||
byte b0 = 3;
|
byte b0 = 3;
|
||||||
|
|
||||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||||
{
|
{
|
||||||
b0 = 3;
|
b0 = 3;
|
||||||
@ -96,15 +95,15 @@ public class MachineElectricFurnace extends BlockContainer {
|
|||||||
{
|
{
|
||||||
b0 = 4;
|
b0 = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
@ -121,13 +120,13 @@ public class MachineElectricFurnace extends BlockContainer {
|
|||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemStack.hasDisplayName())
|
if(itemStack.hasDisplayName())
|
||||||
{
|
{
|
||||||
((TileEntityMachineElectricFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
((TileEntityMachineElectricFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -155,23 +154,23 @@ public class MachineElectricFurnace extends BlockContainer {
|
|||||||
int i = world.getBlockMetadata(x, y, z);
|
int i = world.getBlockMetadata(x, y, z);
|
||||||
TileEntity entity = world.getTileEntity(x, y, z);
|
TileEntity entity = world.getTileEntity(x, y, z);
|
||||||
keepInventory = true;
|
keepInventory = true;
|
||||||
|
|
||||||
if(isProcessing)
|
if(isProcessing)
|
||||||
{
|
{
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_on);
|
world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_on);
|
||||||
}else{
|
}else{
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_off);
|
world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
keepInventory = false;
|
keepInventory = false;
|
||||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||||
|
|
||||||
if(entity != null) {
|
if(entity != null) {
|
||||||
entity.validate();
|
entity.validate();
|
||||||
world.setTileEntity(x, y, z, entity);
|
world.setTileEntity(x, y, z, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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_)
|
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_);
|
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
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_)
|
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);}
|
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.handler.MultiblockHandlerXR;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -33,19 +32,19 @@ public class MachineElectrolyser extends BlockDummyable {
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x += dir.offsetX * o;
|
x += dir.offsetX * o;
|
||||||
z += dir.offsetZ * 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[] {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, -3, 5, 5, 0, 0}, this, dir);
|
||||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, 4, -4, -3, 3}, 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, 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 * 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);
|
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);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
this.makeExtra(world, x - dir.offsetX * 5, y, z - dir.offsetZ * 5);
|
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, 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, -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, 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 * 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 + 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, 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 * 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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable;
|
|||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineExposureChamber;
|
import com.hbm.tileentity.machine.TileEntityMachineExposureChamber;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -37,10 +36,10 @@ public class MachineExposureChamber extends BlockDummyable {
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x += dir.offsetX * o;
|
x += dir.offsetX * o;
|
||||||
z += dir.offsetZ * o;
|
z += dir.offsetZ * o;
|
||||||
|
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
|
||||||
|
|
||||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, 0, 0, 0, -3, 8}, this, dir);
|
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
|
@Override
|
||||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
|
|
||||||
x += dir.offsetX * o;
|
x += dir.offsetX * o;
|
||||||
z += dir.offsetZ * o;
|
z += dir.offsetZ * o;
|
||||||
|
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
|
||||||
|
|
||||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir)) return false;
|
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, 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;
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return super.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
|
|||||||
@ -1,20 +1,19 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||||
import com.hbm.entity.logic.EntityNukeExplosionMK3.ATEntry;
|
import com.hbm.entity.logic.EntityNukeExplosionMK3.ATEntry;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineFieldDisturber extends Block {
|
public class MachineFieldDisturber extends Block {
|
||||||
|
|
||||||
public MachineFieldDisturber() {
|
public MachineFieldDisturber() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int tickRate(World world) {
|
public int tickRate(World world) {
|
||||||
return 10;
|
return 10;
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.IPersistentInfoProvider;
|
import com.hbm.blocks.IPersistentInfoProvider;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
@ -13,7 +10,6 @@ import com.hbm.tileentity.IPersistentNBT;
|
|||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineFrackingTower;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineFrackingTower;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -24,6 +20,9 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineFrackingTower extends BlockDummyable implements IPersistentInfoProvider {
|
public class MachineFrackingTower extends BlockDummyable implements IPersistentInfoProvider {
|
||||||
|
|
||||||
public MachineFrackingTower() {
|
public MachineFrackingTower() {
|
||||||
@ -32,7 +31,7 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12) return new TileEntityMachineFrackingTower();
|
if(meta >= 12) return new TileEntityMachineFrackingTower();
|
||||||
if(meta >= 6) return new TileEntityProxyCombo(false, true, true);
|
if(meta >= 6) return new TileEntityProxyCombo(false, true, true);
|
||||||
return null;
|
return null;
|
||||||
@ -50,9 +49,9 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
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, 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 - 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 - 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;
|
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, 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;
|
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);
|
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[] {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, 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);
|
MultiblockHandlerXR.fillSpace(world, x, y + 15, z, new int[] {1, 0, 1, 1, -2, 3}, this, ForgeDirection.WEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
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.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -22,6 +18,9 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineFractionTower extends BlockDummyable implements ILookOverlay {
|
public class MachineFractionTower extends BlockDummyable implements ILookOverlay {
|
||||||
|
|
||||||
public MachineFractionTower(Material mat) {
|
public MachineFractionTower(Material mat) {
|
||||||
@ -30,12 +29,12 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityMachineFractionTower();
|
return new TileEntityMachineFractionTower();
|
||||||
if(meta >= extra)
|
if(meta >= extra)
|
||||||
return new TileEntityProxyCombo(false, false, true);
|
return new TileEntityProxyCombo(false, false, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,25 +47,25 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(!world.isRemote && !player.isSneaking()) {
|
||||||
|
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityMachineFractionTower))
|
if(!(te instanceof TileEntityMachineFractionTower))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityMachineFractionTower frac = (TileEntityMachineFractionTower) te;
|
TileEntityMachineFractionTower frac = (TileEntityMachineFractionTower) te;
|
||||||
|
|
||||||
if(world.getTileEntity(pos[0], pos[1] - 3, pos[2]) instanceof TileEntityMachineFractionTower) {
|
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!"));
|
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "You can only change the type in the bottom segment!"));
|
||||||
} else {
|
} else {
|
||||||
@ -75,11 +74,11 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
|||||||
frac.markDirty();
|
frac.markDirty();
|
||||||
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
|
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -88,7 +87,7 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x = x + dir.offsetX * o;
|
x = x + dir.offsetX * o;
|
||||||
z = z + dir.offsetZ * o;
|
z = z + dir.offsetZ * o;
|
||||||
|
|
||||||
@ -101,22 +100,22 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
|||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityMachineFractionTower))
|
if(!(te instanceof TileEntityMachineFractionTower))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityMachineFractionTower cracker = (TileEntityMachineFractionTower) te;
|
TileEntityMachineFractionTower cracker = (TileEntityMachineFractionTower) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
for(int i = 0; i < cracker.tanks.length; i++)
|
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");
|
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);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
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.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
@ -14,7 +10,6 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
|||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityHeatBoilerIndustrial;
|
import com.hbm.tileentity.machine.TileEntityHeatBoilerIndustrial;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -27,6 +22,10 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 class MachineHeatBoilerIndustrial extends BlockDummyable implements ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
public MachineHeatBoilerIndustrial() {
|
public MachineHeatBoilerIndustrial() {
|
||||||
@ -35,32 +34,32 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12) return new TileEntityHeatBoilerIndustrial();
|
if(meta >= 12) return new TileEntityHeatBoilerIndustrial();
|
||||||
if(meta >= extra) return new TileEntityProxyCombo().fluid();
|
if(meta >= extra) return new TileEntityProxyCombo().fluid();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(!world.isRemote && !player.isSneaking()) {
|
||||||
|
|
||||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
||||||
|
|
||||||
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
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) {
|
if(type.hasTrait(FT_Heatable.class) && type.getTrait(FT_Heatable.class).getEfficiency(HeatingType.BOILER) > 0) {
|
||||||
boiler.tanks[0].setTankType(type);
|
boiler.tanks[0].setTankType(type);
|
||||||
boiler.markDirty();
|
boiler.markDirty();
|
||||||
@ -69,7 +68,7 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -98,24 +97,24 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add(String.format(Locale.US, "%,d", boiler.heat) + "TU");
|
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.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");
|
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);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.IPersistentInfoProvider;
|
import com.hbm.blocks.IPersistentInfoProvider;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -18,6 +15,8 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineHydrotreater extends BlockDummyable implements IPersistentInfoProvider {
|
public class MachineHydrotreater extends BlockDummyable implements IPersistentInfoProvider {
|
||||||
|
|
||||||
public MachineHydrotreater(Material mat) {
|
public MachineHydrotreater(Material mat) {
|
||||||
@ -30,7 +29,7 @@ public class MachineHydrotreater extends BlockDummyable implements IPersistentIn
|
|||||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return standardOpenBehavior(world, x, y, z, player, side);
|
||||||
@ -51,7 +50,7 @@ public class MachineHydrotreater extends BlockDummyable implements IPersistentIn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
||||||
tank.readFromNBT(persistentTag, "" + i);
|
tank.readFromNBT(persistentTag, "" + i);
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
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.ILookOverlay;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.blocks.machine.BlockICF.TileEntityBlockICF;
|
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.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -36,8 +29,14 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 {
|
public class MachineICFController extends BlockContainer implements ILookOverlay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconFront;
|
private IIcon iconFront;
|
||||||
|
|
||||||
@ -49,43 +48,43 @@ public class MachineICFController extends BlockContainer implements ILookOverlay
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityICFController();
|
return new TileEntityICFController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
super.registerBlockIcons(iconRegister);
|
super.registerBlockIcons(iconRegister);
|
||||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":icf_controller");
|
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":icf_controller");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
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 == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
|
|
||||||
TileEntityICFController controller = (TileEntityICFController) world.getTileEntity(x, y, z);
|
TileEntityICFController controller = (TileEntityICFController) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!controller.assembled) {
|
if(!controller.assembled) {
|
||||||
assemble(world, x, y, z, player);
|
assemble(world, x, y, z, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -101,7 +100,7 @@ public class MachineICFController extends BlockContainer implements ILookOverlay
|
|||||||
private static HashSet<BlockPos> turbochargers = new HashSet();
|
private static HashSet<BlockPos> turbochargers = new HashSet();
|
||||||
private static boolean errored;
|
private static boolean errored;
|
||||||
private static final int maxSize = 1024;
|
private static final int maxSize = 1024;
|
||||||
|
|
||||||
public void assemble(World world, int x, int y, int z, EntityPlayer player) {
|
public void assemble(World world, int x, int y, int z, EntityPlayer player) {
|
||||||
assembly.clear();
|
assembly.clear();
|
||||||
casings.clear();
|
casings.clear();
|
||||||
@ -111,27 +110,27 @@ public class MachineICFController extends BlockContainer implements ILookOverlay
|
|||||||
capacitors.clear();
|
capacitors.clear();
|
||||||
turbochargers.clear();
|
turbochargers.clear();
|
||||||
assembly.put(new BlockPos(x, y, z), 0);
|
assembly.put(new BlockPos(x, y, z), 0);
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
|
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
|
||||||
|
|
||||||
errored = false;
|
errored = false;
|
||||||
floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player);
|
floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player);
|
||||||
assembly.remove(new BlockPos(x, y, z));
|
assembly.remove(new BlockPos(x, y, z));
|
||||||
|
|
||||||
TileEntityICFController controller = (TileEntityICFController) world.getTileEntity(x, y, z);
|
TileEntityICFController controller = (TileEntityICFController) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!errored) {
|
if(!errored) {
|
||||||
|
|
||||||
for(Entry<BlockPos, Integer> entry : assembly.entrySet()) {
|
for(Entry<BlockPos, Integer> entry : assembly.entrySet()) {
|
||||||
|
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
|
|
||||||
if(ports.contains(pos)) {
|
if(ports.contains(pos)) {
|
||||||
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.icf_block, 1, 3);
|
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.icf_block, 1, 3);
|
||||||
} else {
|
} else {
|
||||||
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.icf_block, 0, 3);
|
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.icf_block, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityBlockICF icf = (TileEntityBlockICF) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
TileEntityBlockICF icf = (TileEntityBlockICF) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||||
icf.block = ModBlocks.icf_laser_component;
|
icf.block = ModBlocks.icf_laser_component;
|
||||||
icf.meta = entry.getValue();
|
icf.meta = entry.getValue();
|
||||||
@ -140,12 +139,12 @@ public class MachineICFController extends BlockContainer implements ILookOverlay
|
|||||||
icf.coreZ = z;
|
icf.coreZ = z;
|
||||||
icf.markDirty();
|
icf.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.setup(ports, cells, emitters, capacitors, turbochargers);
|
controller.setup(ports, cells, emitters, capacitors, turbochargers);
|
||||||
controller.markDirty();
|
controller.markDirty();
|
||||||
}
|
}
|
||||||
controller.assembled = !errored;
|
controller.assembled = !errored;
|
||||||
|
|
||||||
assembly.clear();
|
assembly.clear();
|
||||||
casings.clear();
|
casings.clear();
|
||||||
ports.clear();
|
ports.clear();
|
||||||
@ -154,24 +153,24 @@ public class MachineICFController extends BlockContainer implements ILookOverlay
|
|||||||
capacitors.clear();
|
capacitors.clear();
|
||||||
turbochargers.clear();
|
turbochargers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void floodFill(World world, int x, int y, int z, EntityPlayer player) {
|
private void floodFill(World world, int x, int y, int z, EntityPlayer player) {
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
if(assembly.containsKey(pos)) return;
|
if(assembly.containsKey(pos)) return;
|
||||||
if(assembly.size() >= maxSize) {
|
if(assembly.size() >= maxSize) {
|
||||||
errored = true;
|
errored = true;
|
||||||
sendError(world, x, y, z, "Max size exceeded", player);
|
sendError(world, x, y, z, "Max size exceeded", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
boolean validCasing = false;
|
boolean validCasing = false;
|
||||||
boolean validCore = false;
|
boolean validCore = false;
|
||||||
|
|
||||||
if(block == ModBlocks.icf_laser_component) {
|
if(block == ModBlocks.icf_laser_component) {
|
||||||
if(meta == EnumICFPart.CASING.ordinal()) { casings.add(pos); validCasing = true; }
|
if(meta == EnumICFPart.CASING.ordinal()) { casings.add(pos); validCasing = true; }
|
||||||
if(meta == EnumICFPart.PORT.ordinal()) { ports.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.CAPACITOR.ordinal()) { capacitors.add(pos); validCore = true; }
|
||||||
if(meta == EnumICFPart.TURBO.ordinal()) { turbochargers.add(pos); validCore = true; }
|
if(meta == EnumICFPart.TURBO.ordinal()) { turbochargers.add(pos); validCore = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(validCasing) {
|
if(validCasing) {
|
||||||
assembly.put(pos, meta);
|
assembly.put(pos, meta);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(validCore) {
|
if(validCore) {
|
||||||
assembly.put(pos, meta);
|
assembly.put(pos, meta);
|
||||||
floodFill(world, x + 1, y, z, player);
|
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);
|
sendError(world, x, y, z, "Non-laser block", player);
|
||||||
errored = true;
|
errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) {
|
private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) {
|
||||||
|
|
||||||
if(player instanceof EntityPlayerMP) {
|
if(player instanceof EntityPlayerMP) {
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineLargeTurbine;
|
import com.hbm.tileentity.machine.TileEntityMachineLargeTurbine;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@ -18,6 +15,8 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvider {
|
public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public MachineLargeTurbine(Material mat) {
|
public MachineLargeTurbine(Material mat) {
|
||||||
@ -26,13 +25,13 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityMachineLargeTurbine();
|
return new TileEntityMachineLargeTurbine();
|
||||||
|
|
||||||
if(meta >= 6)
|
if(meta >= 6)
|
||||||
return new TileEntityProxyCombo(false, true, true);
|
return new TileEntityProxyCombo(false, true, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -54,20 +53,20 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi
|
|||||||
} else if(!player.isSneaking())
|
} else if(!player.isSneaking())
|
||||||
{
|
{
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||||
|
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
|
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
|
||||||
|
|
||||||
if(world.isRemote)
|
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;
|
int k = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
ForgeDirection dir = ForgeDirection.NORTH;
|
ForgeDirection dir = ForgeDirection.NORTH;
|
||||||
|
|
||||||
if(k == 0)
|
if(k == 0)
|
||||||
dir = ForgeDirection.getOrientation(2);
|
dir = ForgeDirection.getOrientation(2);
|
||||||
if(k == 1)
|
if(k == 1)
|
||||||
@ -84,9 +83,9 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi
|
|||||||
dir = ForgeDirection.getOrientation(3);
|
dir = ForgeDirection.getOrientation(3);
|
||||||
if(k == 3)
|
if(k == 3)
|
||||||
dir = ForgeDirection.getOrientation(4);
|
dir = ForgeDirection.getOrientation(4);
|
||||||
|
|
||||||
ForgeDirection dir2 = dir.getRotation(ForgeDirection.UP);
|
ForgeDirection dir2 = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
//back connector
|
//back connector
|
||||||
this.makeExtra(world, x + dir.offsetX * -4, y, z + dir.offsetZ * -4);
|
this.makeExtra(world, x + dir.offsetX * -4, y, z + dir.offsetZ * -4);
|
||||||
//front connector
|
//front connector
|
||||||
@ -94,7 +93,7 @@ public class MachineLargeTurbine extends BlockDummyable implements ITooltipProvi
|
|||||||
|
|
||||||
int xc = x - dir.offsetX;
|
int xc = x - dir.offsetX;
|
||||||
int zc = z - dir.offsetZ;
|
int zc = z - dir.offsetZ;
|
||||||
|
|
||||||
//side connectors
|
//side connectors
|
||||||
this.makeExtra(world, xc + dir2.offsetX, y, zc + dir2.offsetZ);
|
this.makeExtra(world, xc + dir2.offsetX, y, zc + dir2.offsetZ);
|
||||||
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;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineLiquefactor;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineLiquefactor;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineLiquefactor extends BlockDummyable implements ITooltipProvider {
|
public class MachineLiquefactor extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public MachineLiquefactor() {
|
public MachineLiquefactor() {
|
||||||
@ -22,13 +21,13 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityMachineLiquefactor();
|
return new TileEntityMachineLiquefactor();
|
||||||
|
|
||||||
if(meta >= extra)
|
if(meta >= extra)
|
||||||
return new TileEntityProxyCombo(true, true, true);
|
return new TileEntityProxyCombo(true, true, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid
|
|||||||
public int[] getDimensions() {
|
public int[] getDimensions() {
|
||||||
return new int[] {3, 0, 1, 1, 1, 1};
|
return new int[] {3, 0, 1, 1, 1, 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
@ -50,12 +49,12 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x = x + dir.offsetX * o;
|
x = x + dir.offsetX * o;
|
||||||
z = z + dir.offsetZ * o;
|
z = z + dir.offsetZ * o;
|
||||||
|
|
||||||
this.makeExtra(world, x, y + 3, z);
|
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 - 1, y + 1, z);
|
this.makeExtra(world, x - 1, y + 1, z);
|
||||||
this.makeExtra(world, x, y + 1, z + 1);
|
this.makeExtra(world, x, y + 1, z + 1);
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.TileEntityProxyEnergy;
|
import com.hbm.tileentity.TileEntityProxyEnergy;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineMiningLaser;
|
import com.hbm.tileentity.machine.TileEntityMachineMiningLaser;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -17,6 +14,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineMiningLaser extends BlockDummyable implements ITooltipProvider {
|
public class MachineMiningLaser extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public MachineMiningLaser(Material mat) {
|
public MachineMiningLaser(Material mat) {
|
||||||
@ -29,7 +28,7 @@ public class MachineMiningLaser extends BlockDummyable implements ITooltipProvid
|
|||||||
if(meta >= 12) return new TileEntityMachineMiningLaser();
|
if(meta >= 12) return new TileEntityMachineMiningLaser();
|
||||||
if(meta == 7) return new TileEntityProxyEnergy();
|
if(meta == 7) return new TileEntityProxyEnergy();
|
||||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid();
|
if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,26 +46,26 @@ public class MachineMiningLaser extends BlockDummyable implements ITooltipProvid
|
|||||||
public int getHeightOffset() {
|
public int getHeightOffset() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
|
|
||||||
super.fillSpace(world, x, y, z, dir, 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 - 1, y, z);
|
||||||
this.makeExtra(world, x, y, z + 1);
|
this.makeExtra(world, x, y, z + 1);
|
||||||
this.makeExtra(world, x, y, z - 1);
|
this.makeExtra(world, x, y, z - 1);
|
||||||
|
|
||||||
this.makeExtra(world, x, y + 1, z);
|
this.makeExtra(world, x, y + 1, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.handler.BossSpawnHandler;
|
import com.hbm.handler.BossSpawnHandler;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineMissileAssembly;
|
import com.hbm.tileentity.machine.TileEntityMachineMissileAssembly;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@ -20,6 +17,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineMissileAssembly extends BlockContainer {
|
public class MachineMissileAssembly extends BlockContainer {
|
||||||
|
|
||||||
public MachineMissileAssembly(Material p_i45386_1_) {
|
public MachineMissileAssembly(Material p_i45386_1_) {
|
||||||
@ -45,7 +44,7 @@ public class MachineMissileAssembly extends BlockContainer {
|
|||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
@ -65,7 +64,7 @@ public class MachineMissileAssembly extends BlockContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final Random field_149933_a = new Random();
|
private final Random field_149933_a = new Random();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_,
|
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_) {
|
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_);
|
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
@ -132,7 +131,7 @@ public class MachineMissileAssembly extends BlockContainer {
|
|||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemStack.hasDisplayName())
|
if(itemStack.hasDisplayName())
|
||||||
{
|
{
|
||||||
((TileEntityMachineMissileAssembly)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
((TileEntityMachineMissileAssembly)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
|
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -25,12 +22,14 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineNukeFurnace extends BlockContainer {
|
public class MachineNukeFurnace extends BlockContainer {
|
||||||
|
|
||||||
private final Random field_149933_a = new Random();
|
private final Random field_149933_a = new Random();
|
||||||
private final boolean isActive;
|
private final boolean isActive;
|
||||||
private static boolean keepInventory;
|
private static boolean keepInventory;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -40,7 +39,7 @@ public class MachineNukeFurnace extends BlockContainer {
|
|||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
isActive = blockState;
|
isActive = blockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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.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");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_nuke_furnace_side_alt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
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)));
|
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : (side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||||
{
|
{
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_nuke_furnace_off);
|
return Item.getItemFromBlock(ModBlocks.machine_nuke_furnace_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, int x, int y, int z) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
super.onBlockAdded(world, x, y, z);
|
super.onBlockAdded(world, x, y, z);
|
||||||
this.setDefaultDirection(world, x, y, z);
|
this.setDefaultDirection(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||||
if(!world.isRemote)
|
if(!world.isRemote)
|
||||||
{
|
{
|
||||||
@ -74,9 +73,9 @@ public class MachineNukeFurnace extends BlockContainer {
|
|||||||
Block block2 = world.getBlock(x, y, z + 1);
|
Block block2 = world.getBlock(x, y, z + 1);
|
||||||
Block block3 = world.getBlock(x - 1, y, z);
|
Block block3 = world.getBlock(x - 1, y, z);
|
||||||
Block block4 = world.getBlock(x + 1, y, z);
|
Block block4 = world.getBlock(x + 1, y, z);
|
||||||
|
|
||||||
byte b0 = 3;
|
byte b0 = 3;
|
||||||
|
|
||||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||||
{
|
{
|
||||||
b0 = 3;
|
b0 = 3;
|
||||||
@ -93,15 +92,15 @@ public class MachineNukeFurnace extends BlockContainer {
|
|||||||
{
|
{
|
||||||
b0 = 4;
|
b0 = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
@ -118,13 +117,13 @@ public class MachineNukeFurnace extends BlockContainer {
|
|||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemStack.hasDisplayName())
|
if(itemStack.hasDisplayName())
|
||||||
{
|
{
|
||||||
((TileEntityNukeFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
((TileEntityNukeFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -152,23 +151,23 @@ public class MachineNukeFurnace extends BlockContainer {
|
|||||||
int i = world.getBlockMetadata(x, y, z);
|
int i = world.getBlockMetadata(x, y, z);
|
||||||
TileEntity entity = world.getTileEntity(x, y, z);
|
TileEntity entity = world.getTileEntity(x, y, z);
|
||||||
keepInventory = true;
|
keepInventory = true;
|
||||||
|
|
||||||
if(isProcessing)
|
if(isProcessing)
|
||||||
{
|
{
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_nuke_furnace_on);
|
world.setBlock(x, y, z, ModBlocks.machine_nuke_furnace_on);
|
||||||
}else{
|
}else{
|
||||||
world.setBlock(x, y, z, ModBlocks.machine_nuke_furnace_off);
|
world.setBlock(x, y, z, ModBlocks.machine_nuke_furnace_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
keepInventory = false;
|
keepInventory = false;
|
||||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||||
|
|
||||||
if(entity != null) {
|
if(entity != null) {
|
||||||
entity.validate();
|
entity.validate();
|
||||||
world.setTileEntity(x, y, z, entity);
|
world.setTileEntity(x, y, z, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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_)
|
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_);
|
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package com.hbm.blocks.machine;
|
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.ITooltipProvider;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.blocks.machine.BlockPWR.TileEntityBlockPWR;
|
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.packet.toclient.AuxParticlePacketNT;
|
||||||
import com.hbm.tileentity.machine.TileEntityPWRController;
|
import com.hbm.tileentity.machine.TileEntityPWRController;
|
||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -32,8 +27,12 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 {
|
public class MachinePWRController extends BlockContainer implements ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconFront;
|
private IIcon iconFront;
|
||||||
|
|
||||||
@ -45,45 +44,45 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityPWRController();
|
return new TileEntityPWRController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
super.registerBlockIcons(iconRegister);
|
super.registerBlockIcons(iconRegister);
|
||||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":pwr_controller");
|
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":pwr_controller");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
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 == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
|
|
||||||
TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z);
|
TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!controller.assembled) {
|
if(!controller.assembled) {
|
||||||
assemble(world, x, y, z, player);
|
assemble(world, x, y, z, player);
|
||||||
} else {
|
} else {
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -95,44 +94,44 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
|||||||
private static HashMap<BlockPos, Block> sources = new HashMap();
|
private static HashMap<BlockPos, Block> sources = new HashMap();
|
||||||
private static boolean errored;
|
private static boolean errored;
|
||||||
private static final int maxSize = 4096;
|
private static final int maxSize = 4096;
|
||||||
|
|
||||||
public void assemble(World world, int x, int y, int z, EntityPlayer player) {
|
public void assemble(World world, int x, int y, int z, EntityPlayer player) {
|
||||||
assembly.clear();
|
assembly.clear();
|
||||||
fuelRods.clear();
|
fuelRods.clear();
|
||||||
sources.clear();
|
sources.clear();
|
||||||
assembly.put(new BlockPos(x, y, z), this);
|
assembly.put(new BlockPos(x, y, z), this);
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
|
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
|
||||||
|
|
||||||
errored = false;
|
errored = false;
|
||||||
floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player);
|
floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player);
|
||||||
|
|
||||||
if(fuelRods.size() == 0){
|
if(fuelRods.size() == 0){
|
||||||
sendError(world, x, y, z, "Fuel rods required", player);
|
sendError(world, x, y, z, "Fuel rods required", player);
|
||||||
errored = true;
|
errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sources.size() == 0) {
|
if(sources.size() == 0) {
|
||||||
sendError(world, x, y, z, "Neutron sources required", player);
|
sendError(world, x, y, z, "Neutron sources required", player);
|
||||||
errored = true;
|
errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z);
|
TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!errored) {
|
if(!errored) {
|
||||||
for(Entry<BlockPos, Block> entry : assembly.entrySet()) {
|
for(Entry<BlockPos, Block> entry : assembly.entrySet()) {
|
||||||
|
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
Block block = entry.getValue();
|
Block block = entry.getValue();
|
||||||
|
|
||||||
if(block != ModBlocks.pwr_controller) {
|
if(block != ModBlocks.pwr_controller) {
|
||||||
|
|
||||||
if(block == ModBlocks.pwr_port) {
|
if(block == ModBlocks.pwr_port) {
|
||||||
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 1, 3);
|
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 1, 3);
|
||||||
} else {
|
} else {
|
||||||
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 0, 3);
|
world.setBlock(pos.getX(), pos.getY(), pos.getZ(), ModBlocks.pwr_block, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityBlockPWR pwr = (TileEntityBlockPWR) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
TileEntityBlockPWR pwr = (TileEntityBlockPWR) world.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||||
pwr.block = block;
|
pwr.block = block;
|
||||||
pwr.coreX = x;
|
pwr.coreX = x;
|
||||||
@ -141,34 +140,34 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
|||||||
pwr.markDirty();
|
pwr.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.setup(assembly, fuelRods);
|
controller.setup(assembly, fuelRods);
|
||||||
}
|
}
|
||||||
controller.assembled = !errored;
|
controller.assembled = !errored;
|
||||||
|
|
||||||
assembly.clear();
|
assembly.clear();
|
||||||
fuelRods.clear();
|
fuelRods.clear();
|
||||||
sources.clear();
|
sources.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void floodFill(World world, int x, int y, int z, EntityPlayer player) {
|
private void floodFill(World world, int x, int y, int z, EntityPlayer player) {
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
if(assembly.containsKey(pos)) return;
|
if(assembly.containsKey(pos)) return;
|
||||||
if(assembly.size() >= maxSize) {
|
if(assembly.size() >= maxSize) {
|
||||||
errored = true;
|
errored = true;
|
||||||
sendError(world, x, y, z, "Max size exceeded", player);
|
sendError(world, x, y, z, "Max size exceeded", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
|
|
||||||
if(isValidCasing(block)) {
|
if(isValidCasing(block)) {
|
||||||
assembly.put(pos, block);
|
assembly.put(pos, block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isValidCore(block)) {
|
if(isValidCore(block)) {
|
||||||
assembly.put(pos, block);
|
assembly.put(pos, block);
|
||||||
if(block == ModBlocks.pwr_fuel) fuelRods.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);
|
sendError(world, x, y, z, "Non-reactor block", player);
|
||||||
errored = true;
|
errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) {
|
private void sendError(World world, int x, int y, int z, String message, EntityPlayer player) {
|
||||||
|
|
||||||
if(player instanceof EntityPlayerMP) {
|
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);
|
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(data, x, y, z), (EntityPlayerMP) player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidCore(Block block) {
|
private boolean isValidCore(Block block) {
|
||||||
if(block == ModBlocks.pwr_fuel ||
|
if(block == ModBlocks.pwr_fuel ||
|
||||||
block == ModBlocks.pwr_control ||
|
block == ModBlocks.pwr_control ||
|
||||||
@ -209,7 +208,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidCasing(Block block) {
|
private boolean isValidCasing(Block block) {
|
||||||
if(block == ModBlocks.pwr_casing || block == ModBlocks.pwr_reflector || block == ModBlocks.pwr_port) return true;
|
if(block == ModBlocks.pwr_casing || block == ModBlocks.pwr_reflector || block == ModBlocks.pwr_port) return true;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
|
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -22,6 +19,8 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachinePlasmaHeater extends BlockDummyable {
|
public class MachinePlasmaHeater extends BlockDummyable {
|
||||||
|
|
||||||
public MachinePlasmaHeater() {
|
public MachinePlasmaHeater() {
|
||||||
@ -36,7 +35,7 @@ public class MachinePlasmaHeater extends BlockDummyable {
|
|||||||
|
|
||||||
if(meta >= 6)
|
if(meta >= 6)
|
||||||
return new TileEntityProxyCombo(false, true, true);
|
return new TileEntityProxyCombo(false, true, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ public class MachinePlasmaHeater extends BlockDummyable {
|
|||||||
public Item getItemDropped(int i, Random rand, int j) {
|
public Item getItemDropped(int i, Random rand, int j) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -53,10 +52,10 @@ public class MachinePlasmaHeater extends BlockDummyable {
|
|||||||
} else if(!player.isSneaking())
|
} else if(!player.isSneaking())
|
||||||
{
|
{
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityMachinePlasmaHeater entity = (TileEntityMachinePlasmaHeater) world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntityMachinePlasmaHeater entity = (TileEntityMachinePlasmaHeater) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
if(entity != null)
|
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 + 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);
|
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);
|
ForgeDirection side = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
for(int i = 1; i < 4; i++) {
|
for(int i = 1; i < 4; i++) {
|
||||||
for(int j = -1; j < 2; j++) {
|
for(int j = -1; j < 2; j++) {
|
||||||
|
|
||||||
this.makeExtra(world, x + side.offsetX * j, y + i, z + side.offsetZ * 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) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
|
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
|
|
||||||
if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) {
|
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);
|
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) {
|
} 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);
|
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
|
|
||||||
if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) {
|
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);
|
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) {
|
} 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);
|
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) {
|
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))
|
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir))
|
||||||
return false;
|
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))
|
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;
|
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))
|
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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,12 +133,12 @@ public class MachinePlasmaHeater extends BlockDummyable {
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
|
||||||
|
|
||||||
if(i >= 12) {
|
if(i >= 12) {
|
||||||
|
|
||||||
for(int l = 0; l < 2; l++)
|
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)));
|
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.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineRadarNT;
|
import com.hbm.tileentity.machine.TileEntityMachineRadarNT;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineRadarScreen;
|
import com.hbm.tileentity.machine.TileEntityMachineRadarScreen;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -34,18 +33,18 @@ public class MachineRadarScreen extends BlockDummyable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(world.isRemote && !player.isSneaking()) {
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null) return false;
|
if(pos == null) return false;
|
||||||
|
|
||||||
TileEntityMachineRadarScreen screen = (TileEntityMachineRadarScreen) world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntityMachineRadarScreen screen = (TileEntityMachineRadarScreen) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(screen.linked && world.getTileEntity(screen.refX, screen.refY, screen.refZ) instanceof TileEntityMachineRadarNT) {
|
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);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, screen.refX, screen.refY, screen.refZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityProxyInventory;
|
import com.hbm.tileentity.TileEntityProxyInventory;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineReactorBreeding;
|
import com.hbm.tileentity.machine.TileEntityMachineReactorBreeding;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -12,20 +11,20 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class MachineReactorBreeding extends BlockDummyable {
|
public class MachineReactorBreeding extends BlockDummyable {
|
||||||
|
|
||||||
public MachineReactorBreeding(Material mat) {
|
public MachineReactorBreeding(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityMachineReactorBreeding();
|
return new TileEntityMachineReactorBreeding();
|
||||||
|
|
||||||
return new TileEntityProxyInventory();
|
return new TileEntityProxyInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -34,10 +33,10 @@ public class MachineReactorBreeding extends BlockDummyable {
|
|||||||
} else if(!player.isSneaking())
|
} else if(!player.isSneaking())
|
||||||
{
|
{
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TileEntityMachineReactorBreeding entity = (TileEntityMachineReactorBreeding) world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntityMachineReactorBreeding entity = (TileEntityMachineReactorBreeding) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
if(entity != null)
|
if(entity != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityReactorControl;
|
import com.hbm.tileentity.machine.TileEntityReactorControl;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -25,8 +22,10 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineReactorControl extends BlockContainer {
|
public class MachineReactorControl extends BlockContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -40,7 +39,7 @@ public class MachineReactorControl extends BlockContainer {
|
|||||||
public MachineReactorControl(Material p_i45386_1_) {
|
public MachineReactorControl(Material p_i45386_1_) {
|
||||||
super(p_i45386_1_);
|
super(p_i45386_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -49,33 +48,33 @@ public class MachineReactorControl extends BlockContainer {
|
|||||||
this.iconBack = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_back");
|
this.iconBack = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_back");
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_side");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_controller_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
|
|
||||||
if(metadata == 0)
|
if(metadata == 0)
|
||||||
metadata = 3;
|
metadata = 3;
|
||||||
|
|
||||||
if(metadata == side)
|
if(metadata == side)
|
||||||
return iconFront;
|
return iconFront;
|
||||||
|
|
||||||
if(side == 0 || side == 1)
|
if(side == 0 || side == 1)
|
||||||
return iconTop;
|
return iconTop;
|
||||||
|
|
||||||
if(metadata == 2 && side == 3 ||
|
if(metadata == 2 && side == 3 ||
|
||||||
metadata == 3 && side == 2 ||
|
metadata == 3 && side == 2 ||
|
||||||
metadata == 4 && side == 5 ||
|
metadata == 4 && side == 5 ||
|
||||||
metadata == 5 && side == 4)
|
metadata == 5 && side == 4)
|
||||||
return iconBack;
|
return iconBack;
|
||||||
|
|
||||||
return blockIcon;
|
return blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||||
@ -92,7 +91,7 @@ public class MachineReactorControl extends BlockContainer {
|
|||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemStack.hasDisplayName())
|
if(itemStack.hasDisplayName())
|
||||||
{
|
{
|
||||||
((TileEntityReactorControl)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
((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_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
return new TileEntityReactorControl();
|
return new TileEntityReactorControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||||
{
|
{
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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_)
|
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_);
|
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
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_)
|
public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_)
|
||||||
{
|
{
|
||||||
TileEntityReactorControl entity = (TileEntityReactorControl) world.getTileEntity(x, y, z);
|
TileEntityReactorControl entity = (TileEntityReactorControl) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(entity != null)
|
if(entity != null)
|
||||||
{
|
{
|
||||||
return (int)Math.ceil((double)entity.heat * 15D / 50000D);
|
return (int)Math.ceil((double)entity.heat * 15D / 50000D);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.hbm.blocks.machine;
|
|||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace;
|
import com.hbm.tileentity.machine.TileEntityMachineRotaryFurnace;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -22,7 +21,7 @@ public class MachineRotaryFurnace extends BlockDummyable {
|
|||||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid();
|
if(meta >= 6) return new TileEntityProxyCombo().inventory().fluid();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
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);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
x += dir.offsetX * o;
|
x += dir.offsetX * o;
|
||||||
z += dir.offsetZ * o;
|
z += dir.offsetZ * o;
|
||||||
|
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||||
|
|
||||||
//back
|
//back
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator;
|
import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -23,16 +20,18 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class MachineSchrabidiumTransmutator extends BlockContainer {
|
public class MachineSchrabidiumTransmutator extends BlockContainer {
|
||||||
|
|
||||||
private final Random field_149933_a = new Random();
|
private final Random field_149933_a = new Random();
|
||||||
private static boolean keepInventory;
|
private static boolean keepInventory;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
//private IIcon iconFront;
|
//private IIcon iconFront;
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
private IIcon iconBottom;
|
private IIcon iconBottom;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -40,7 +39,7 @@ public class MachineSchrabidiumTransmutator extends BlockContainer {
|
|||||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (":transmutator_bottom"));
|
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (":transmutator_bottom"));
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":transmutator_side");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":transmutator_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
@ -50,13 +49,13 @@ public class MachineSchrabidiumTransmutator extends BlockContainer {
|
|||||||
public MachineSchrabidiumTransmutator(Material p_i45386_1_) {
|
public MachineSchrabidiumTransmutator(Material p_i45386_1_) {
|
||||||
super(p_i45386_1_);
|
super(p_i45386_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||||
{
|
{
|
||||||
return Item.getItemFromBlock(ModBlocks.machine_schrabidium_transmutator);
|
return Item.getItemFromBlock(ModBlocks.machine_schrabidium_transmutator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -79,7 +78,7 @@ public class MachineSchrabidiumTransmutator extends BlockContainer {
|
|||||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
return new TileEntityMachineSchrabidiumTransmutator();
|
return new TileEntityMachineSchrabidiumTransmutator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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_)
|
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;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntitySolarBoiler;
|
import com.hbm.tileentity.machine.TileEntitySolarBoiler;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
@ -17,6 +13,9 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay {
|
public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay {
|
||||||
|
|
||||||
public MachineSolarBoiler(Material mat) {
|
public MachineSolarBoiler(Material mat) {
|
||||||
@ -25,12 +24,12 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntitySolarBoiler();
|
return new TileEntitySolarBoiler();
|
||||||
if(meta >= extra)
|
if(meta >= extra)
|
||||||
return new TileEntityProxyCombo(false, false, true);
|
return new TileEntityProxyCombo(false, false, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,10 +46,10 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay {
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x = x + dir.offsetX * o;
|
x = x + dir.offsetX * o;
|
||||||
z = z + dir.offsetZ * o;
|
z = z + dir.offsetZ * o;
|
||||||
|
|
||||||
this.makeExtra(world, x, y + 2, z);
|
this.makeExtra(world, x, y + 2, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,19 +61,19 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntitySolarBoiler))
|
if(!(te instanceof TileEntitySolarBoiler))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntitySolarBoiler boiler = (TileEntitySolarBoiler) te;
|
TileEntitySolarBoiler boiler = (TileEntitySolarBoiler) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList<>();
|
List<String> text = new ArrayList<>();
|
||||||
|
|
||||||
FluidTank[] tanks = boiler.getAllTanks();
|
FluidTank[] tanks = boiler.getAllTanks();
|
||||||
|
|
||||||
for(int i = 0; i < tanks.length; i++)
|
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");
|
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);
|
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.blocks.BlockDummyable;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineSolderingStation;
|
import com.hbm.tileentity.machine.TileEntityMachineSolderingStation;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -20,7 +19,7 @@ public class MachineSolderingStation extends BlockDummyable {
|
|||||||
if(meta >= 12) return new TileEntityMachineSolderingStation();
|
if(meta >= 12) return new TileEntityMachineSolderingStation();
|
||||||
return new TileEntityProxyCombo().inventory().power().fluid();
|
return new TileEntityProxyCombo().inventory().power().fluid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
|
|||||||
@ -1,16 +1,11 @@
|
|||||||
package com.hbm.blocks.machine;
|
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.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.TileEntitySteamEngine;
|
import com.hbm.tileentity.machine.TileEntitySteamEngine;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -20,6 +15,10 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 class MachineSteamEngine extends BlockDummyable implements ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
public MachineSteamEngine() {
|
public MachineSteamEngine() {
|
||||||
@ -46,10 +45,10 @@ public class MachineSteamEngine extends BlockDummyable implements ILookOverlay,
|
|||||||
@Override
|
@Override
|
||||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||||
super.fillSpace(world, x, y, z, dir, o);
|
super.fillSpace(world, x, y, z, dir, o);
|
||||||
|
|
||||||
x = x + dir.offsetX * o;
|
x = x + dir.offsetX * o;
|
||||||
z = z + dir.offsetZ * o;
|
z = z + dir.offsetZ * o;
|
||||||
|
|
||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
this.makeExtra(world, x + rot.offsetX, y + 1, z + rot.offsetZ);
|
this.makeExtra(world, x + rot.offsetX, y + 1, z + rot.offsetZ);
|
||||||
@ -59,23 +58,23 @@ public class MachineSteamEngine extends BlockDummyable implements ILookOverlay,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
int[] pos = this.findCore(world, x, y, z);
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
|
||||||
if(pos == null)
|
if(pos == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
if(!(te instanceof TileEntitySteamEngine))
|
if(!(te instanceof TileEntitySteamEngine))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntitySteamEngine engine = (TileEntitySteamEngine) te;
|
TileEntitySteamEngine engine = (TileEntitySteamEngine) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
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.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");
|
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);
|
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.blocks.ModBlocks;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineTransformer;
|
import com.hbm.tileentity.machine.TileEntityMachineTransformer;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@ -17,7 +16,7 @@ public class MachineTransformer extends BlockContainer {
|
|||||||
|
|
||||||
long buffer;
|
long buffer;
|
||||||
int delay;
|
int delay;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon iconTop;
|
private IIcon iconTop;
|
||||||
|
|
||||||
@ -26,11 +25,11 @@ public class MachineTransformer extends BlockContainer {
|
|||||||
buffer = b;
|
buffer = b;
|
||||||
delay = d;
|
delay = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
|
|
||||||
if(this == ModBlocks.machine_transformer || this == ModBlocks.machine_transformer_20) {
|
if(this == ModBlocks.machine_transformer || this == ModBlocks.machine_transformer_20) {
|
||||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_transformer_top_iron");
|
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_transformer_top_iron");
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_transformer_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.blocks.BlockDummyable;
|
||||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
import com.hbm.tileentity.machine.oil.TileEntityMachineVacuumDistill;
|
import com.hbm.tileentity.machine.oil.TileEntityMachineVacuumDistill;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -22,7 +21,7 @@ public class MachineVacuumDistill extends BlockDummyable {
|
|||||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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);
|
return standardOpenBehavior(world, x, y, z, player, side);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.hbm.blocks.machine;
|
package com.hbm.blocks.machine;
|
||||||
|
|
||||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
||||||
|
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
return new TileEntityBroadcaster();
|
return new TileEntityBroadcaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
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;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||||
@ -59,13 +58,13 @@ public class PinkCloudBroadcaster extends BlockContainer {
|
|||||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
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_);
|
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
|
|
||||||
this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f);
|
this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f);
|
||||||
switch(te)
|
switch(te)
|
||||||
{
|
{
|
||||||
@ -83,13 +82,13 @@ public class PinkCloudBroadcaster extends BlockContainer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
|
|
||||||
int te = world.getBlockMetadata(x, y, z);
|
int te = world.getBlockMetadata(x, y, z);
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
|
|
||||||
this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f);
|
this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f);
|
||||||
switch(te)
|
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);
|
this.setBlockBounds(1*f, 0.0F, 4*f, 15*f, 10*f, 12*f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
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.BlockContainerBase;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.INBTPacketReceiver;
|
|
||||||
|
|
||||||
import api.hbm.block.IInsertable;
|
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.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -34,112 +36,112 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityPistonInserter();
|
return new TileEntityPistonInserter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
|
||||||
this.updateState(world, x, y, z);
|
this.updateState(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateState(World world, int x, int y, int z) {
|
protected void updateState(World world, int x, int y, int z) {
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
||||||
|
|
||||||
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).isNormalCube())
|
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).isNormalCube())
|
||||||
return; //no obstructions allowed!
|
return; //no obstructions allowed!
|
||||||
|
|
||||||
boolean flag = checkRedstone(world, x, y, z);
|
boolean flag = checkRedstone(world, x, y, z);
|
||||||
TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z);
|
TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(flag && !piston.lastState && piston.extend <= 0)
|
if(flag && !piston.lastState && piston.extend <= 0)
|
||||||
piston.isRetracting = false;
|
piston.isRetracting = false;
|
||||||
|
|
||||||
piston.lastState = flag;
|
piston.lastState = flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkRedstone(World world, int x, int y, int z) {
|
protected boolean checkRedstone(World world, int x, int y, int z) {
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
if(world.getIndirectPowerOutput(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.ordinal()))
|
if(world.getIndirectPowerOutput(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.ordinal()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(side != world.getBlockMetadata(x, y, z)) return false;
|
||||||
|
|
||||||
if(player.isSneaking()) {
|
if(player.isSneaking()) {
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z);
|
TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(piston.slot != null && piston.isRetracting) {
|
if(piston.slot != null && piston.isRetracting) {
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(piston.getBlockMetadata());
|
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);
|
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;
|
piston.slot = null;
|
||||||
|
|
||||||
dust.motionX = dir.offsetX * 0.25;
|
dust.motionX = dir.offsetX * 0.25;
|
||||||
dust.motionY = dir.offsetY * 0.25;
|
dust.motionY = dir.offsetY * 0.25;
|
||||||
dust.motionZ = dir.offsetZ * 0.25;
|
dust.motionZ = dir.offsetZ * 0.25;
|
||||||
world.spawnEntityInWorld(dust);
|
world.spawnEntityInWorld(dust);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if(player.getHeldItem() != null) {
|
} else if(player.getHeldItem() != null) {
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z);
|
TileEntityPistonInserter piston = (TileEntityPistonInserter)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(piston.slot == null) {
|
if(piston.slot == null) {
|
||||||
piston.slot = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
piston.slot = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
player.inventoryContainer.detectAndSendChanges();
|
player.inventoryContainer.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
return meta != side.ordinal() && meta != side.getOpposite().ordinal();
|
return meta != side.ordinal() && meta != side.getOpposite().ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
IInventory tileentityfurnace = (IInventory) world.getTileEntity(x, y, z);
|
IInventory tileentityfurnace = (IInventory) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tileentityfurnace != null) {
|
if(tileentityfurnace != null) {
|
||||||
|
|
||||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(0);
|
ItemStack itemstack = tileentityfurnace.getStackInSlot(0);
|
||||||
|
|
||||||
if(itemstack != null) {
|
if(itemstack != null) {
|
||||||
float f = world.rand.nextFloat() * 0.8F + 0.1F;
|
float f = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float f1 = 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;
|
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
|
||||||
while(itemstack.stackSize > 0) {
|
while(itemstack.stackSize > 0) {
|
||||||
int j1 = world.rand.nextInt(21) + 10;
|
int j1 = world.rand.nextInt(21) + 10;
|
||||||
|
|
||||||
if(j1 > itemstack.stackSize) {
|
if(j1 > itemstack.stackSize) {
|
||||||
j1 = itemstack.stackSize;
|
j1 = itemstack.stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
itemstack.stackSize -= j1;
|
itemstack.stackSize -= j1;
|
||||||
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||||
|
|
||||||
if(itemstack.hasTagCompound()) {
|
if(itemstack.hasTagCompound()) {
|
||||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
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);
|
super.breakBlock(world, x, y, z, block, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $%&#$&
|
// $%&#$&
|
||||||
// %$&&@$%%#%
|
// %$&&@$%%#%
|
||||||
//______ $%@--$@@%&$%$
|
//______ $%@--$@@%&$%$
|
||||||
@ -203,73 +205,65 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
|||||||
// |--' / /| |/ .^ ,^\ \ )
|
// |--' / /| |/ .^ ,^\ \ )
|
||||||
// | |_|| || |(_( ) | |
|
// | |_|| || |(_( ) | |
|
||||||
// | \_/`-``-`----'___/_____ |
|
// | \_/`-``-`----'___/_____ |
|
||||||
// |___..---' _|____`-----..-----'\
|
// |___..---' _|____`-----..-----'\
|
||||||
// |_____________________| @ | )
|
// |_____________________| @ | )
|
||||||
// average coding session involving tile entities
|
// 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 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 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 static final int maxExtend = 25;
|
||||||
public boolean isRetracting = true;
|
public boolean isRetracting = true;
|
||||||
public int delay;
|
public int delay;
|
||||||
|
|
||||||
//prevents funkies from happening with block updates or loading into a server
|
//prevents funkies from happening with block updates or loading into a server
|
||||||
private boolean lastState;
|
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 renderExtend;
|
||||||
@SideOnly(Side.CLIENT) public double lastExtend;
|
@SideOnly(Side.CLIENT) public double lastExtend;
|
||||||
@SideOnly(Side.CLIENT) private int syncExtend; //what are these for?
|
@SideOnly(Side.CLIENT) private int syncExtend; //what are these for?
|
||||||
@SideOnly(Side.CLIENT) private int turnProgress;
|
@SideOnly(Side.CLIENT) private int turnProgress;
|
||||||
|
|
||||||
public TileEntityPistonInserter() { }
|
public TileEntityPistonInserter() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
if(delay <= 0) {
|
if(delay <= 0) {
|
||||||
|
|
||||||
if(this.isRetracting && this.extend > 0) {
|
if(this.isRetracting && this.extend > 0) {
|
||||||
this.extend--;
|
this.extend--;
|
||||||
} else if(!this.isRetracting) {
|
} else if(!this.isRetracting) {
|
||||||
this.extend++;
|
this.extend++;
|
||||||
|
|
||||||
if(this.extend >= this.maxExtend) {
|
if(this.extend >= this.maxExtend) {
|
||||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.pressOperate", 1.0F, 1.5F);
|
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "hbm:block.pressOperate", 1.0F, 1.5F);
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||||
Block b = worldObj.getBlock(xCoord + dir.offsetX * 2, yCoord + dir.offsetY * 2, zCoord + dir.offsetZ * 2);
|
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)) {
|
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.decrStackSize(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isRetracting = true;
|
this.isRetracting = true;
|
||||||
this.delay = 5;
|
this.delay = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
delay--;
|
delay--;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(25);
|
||||||
data.setInteger("extend", extend);
|
|
||||||
if(this.slot != null) {
|
|
||||||
NBTTagCompound stack = new NBTTagCompound();
|
|
||||||
slot.writeToNBT(stack);
|
|
||||||
data.setTag("stack", stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
INBTPacketReceiver.networkPack(this, data, 25);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.lastExtend = this.renderExtend;
|
this.lastExtend = this.renderExtend;
|
||||||
|
|
||||||
if(this.turnProgress > 0) {
|
if(this.turnProgress > 0) {
|
||||||
this.renderExtend += (this.syncExtend - this.renderExtend) / (double) this.turnProgress;
|
this.renderExtend += (this.syncExtend - this.renderExtend) / (double) this.turnProgress;
|
||||||
this.turnProgress--;
|
this.turnProgress--;
|
||||||
@ -277,24 +271,34 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
|||||||
this.renderExtend = this.syncExtend;
|
this.renderExtend = this.syncExtend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
this.syncExtend = nbt.getInteger("extend");
|
buf.writeInt(extend);
|
||||||
|
|
||||||
if(nbt.hasKey("stack")) {
|
buf.writeBoolean(this.slot != null);
|
||||||
NBTTagCompound stack = nbt.getCompoundTag("stack");
|
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);
|
this.slot = ItemStack.loadItemStackFromNBT(stack);
|
||||||
} else
|
} else
|
||||||
this.slot = null;
|
this.slot = null;
|
||||||
|
|
||||||
this.turnProgress = 2;
|
this.turnProgress = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* :3 NBT stuff */
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbt) {
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
@ -307,7 +311,7 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
|||||||
nbt.setTag("stack", stack);
|
nbt.setTag("stack", stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
@ -321,27 +325,27 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
|||||||
this.slot = null;
|
this.slot = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private AxisAlignedBB aabb;
|
private AxisAlignedBB aabb;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
|
|
||||||
if(aabb != null)
|
if(aabb != null)
|
||||||
return aabb;
|
return aabb;
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
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);
|
aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).addCoord(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BS inventory stuff */
|
/* BS inventory stuff */
|
||||||
|
|
||||||
@Override public int getSizeInventory() { return 1; }
|
@Override public int getSizeInventory() { return 1; }
|
||||||
|
|
||||||
@Override public ItemStack getStackInSlot(int slot) { return this.slot; }
|
@Override public ItemStack getStackInSlot(int slot) { return this.slot; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int slot, int amount) {
|
public ItemStack decrStackSize(int slot, int amount) {
|
||||||
if(this.slot != null) {
|
if(this.slot != null) {
|
||||||
@ -350,41 +354,41 @@ public class PistonInserter extends BlockContainerBase implements ITooltipProvid
|
|||||||
this.slot = null;
|
this.slot = null;
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = this.slot.splitStack(amount);
|
ItemStack stack = this.slot.splitStack(amount);
|
||||||
if(this.slot.stackSize == 0)
|
if(this.slot.stackSize == 0)
|
||||||
this.slot = null;
|
this.slot = null;
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlotOnClosing(int slot) { return null; }
|
public ItemStack getStackInSlotOnClosing(int slot) { return null; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
this.slot = stack;
|
this.slot = stack;
|
||||||
if(stack != null && stack.stackSize > this.getInventoryStackLimit())
|
if(stack != null && stack.stackSize > this.getInventoryStackLimit())
|
||||||
stack.stackSize = this.getInventoryStackLimit();
|
stack.stackSize = this.getInventoryStackLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String getInventoryName() { return null; }
|
@Override public String getInventoryName() { return null; }
|
||||||
|
|
||||||
@Override public boolean hasCustomInventoryName() { return false; }
|
@Override public boolean hasCustomInventoryName() { return false; }
|
||||||
|
|
||||||
@Override public int getInventoryStackLimit() { return 1; }
|
@Override public int getInventoryStackLimit() { return 1; }
|
||||||
|
|
||||||
@Override public boolean isUseableByPlayer(EntityPlayer player) { return false; }
|
@Override public boolean isUseableByPlayer(EntityPlayer player) { return false; }
|
||||||
|
|
||||||
@Override public void openInventory() {}
|
@Override public void openInventory() {}
|
||||||
|
|
||||||
@Override public void closeInventory() {}
|
@Override public void closeInventory() {}
|
||||||
|
|
||||||
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; }
|
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return true; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.hbm.blocks.machine.rbmk;
|
|||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
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.ModItems;
|
||||||
import com.hbm.items.machine.ItemRBMKLid;
|
import com.hbm.items.machine.ItemRBMKLid;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
@ -11,6 +13,7 @@ import com.hbm.tileentity.machine.rbmk.RBMKDials;
|
|||||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
|
||||||
|
|
||||||
import api.hbm.block.IToolable;
|
import api.hbm.block.IToolable;
|
||||||
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -170,6 +173,10 @@ public abstract class RBMKBase extends BlockDummyable implements IToolable, ILoo
|
|||||||
int i = rbmk.getBlockMetadata();
|
int i = rbmk.getBlockMetadata();
|
||||||
|
|
||||||
if(rbmk.hasLid() && rbmk.isLidRemovable()) {
|
if(rbmk.hasLid() && rbmk.isLidRemovable()) {
|
||||||
|
|
||||||
|
RBMKNeutronNode node = (RBMKNeutronNode) NeutronNodeWorld.getNode(new BlockPos(te));
|
||||||
|
if (node != null)
|
||||||
|
node.removeLid();
|
||||||
|
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
if(i == DIR_NORMAL_LID.ordinal() + offset) {
|
if(i == DIR_NORMAL_LID.ordinal() + offset) {
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.hbm.blocks.network;
|
|||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -28,26 +27,26 @@ public class BlockCable extends BlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
|
|
||||||
if(this == ModBlocks.red_cable_classic)
|
if(this == ModBlocks.red_cable_classic)
|
||||||
return renderIDClassic;
|
return renderIDClassic;
|
||||||
|
|
||||||
return renderID;
|
return renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
|
|
||||||
boolean posX = Library.canConnect(world, x + 1, y, z, Library.POS_X);
|
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 negX = Library.canConnect(world, x - 1, y, z, Library.NEG_X);
|
||||||
boolean posY = Library.canConnect(world, x, y + 1, z, Library.POS_Y);
|
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);
|
boolean negZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z);
|
||||||
|
|
||||||
setBlockBounds(posX, negX, posY, negY, posZ, negZ);
|
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);
|
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|
||||||
boolean posX = Library.canConnect(world, x + 1, y, z, Library.POS_X);
|
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 negX = Library.canConnect(world, x - 1, y, z, Library.NEG_X);
|
||||||
boolean posY = Library.canConnect(world, x, y + 1, z, Library.POS_Y);
|
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 negY = Library.canConnect(world, x, y - 1, z, Library.NEG_Y);
|
||||||
boolean posZ = Library.canConnect(world, x, y, z + 1, Library.POS_Z);
|
boolean posZ = Library.canConnect(world, x, y, z + 1, Library.POS_Z);
|
||||||
boolean negZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z);
|
boolean negZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z);
|
||||||
|
|
||||||
setBlockBounds(posX, negX, posY, negY, posZ, negZ);
|
setBlockBounds(posX, negX, posY, negY, posZ, negZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBlockBounds(boolean posX, boolean negX, boolean posY, boolean negY, boolean posZ, boolean negZ) {
|
private void setBlockBounds(boolean posX, boolean negX, boolean posY, boolean negY, boolean posZ, boolean negZ) {
|
||||||
|
|
||||||
float pixel = 0.0625F;
|
float pixel = 0.0625F;
|
||||||
float min = pixel * 5.5F;
|
float min = pixel * 5.5F;
|
||||||
float max = pixel * 10.5F;
|
float max = pixel * 10.5F;
|
||||||
|
|
||||||
float minX = negX ? 0F : min;
|
float minX = negX ? 0F : min;
|
||||||
float maxX = posX ? 1F : max;
|
float maxX = posX ? 1F : max;
|
||||||
float minY = negY ? 0F : min;
|
float minY = negY ? 0F : min;
|
||||||
|
|||||||
@ -1,23 +1,19 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.energymk2.PowerNetMK2;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.IBlockMultiPass;
|
import com.hbm.blocks.IBlockMultiPass;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.handler.CompatHandler;
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.render.block.RenderBlockMultipass;
|
import com.hbm.render.block.RenderBlockMultipass;
|
||||||
import com.hbm.tileentity.INBTPacketReceiver;
|
|
||||||
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import api.hbm.energymk2.PowerNetMK2;
|
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, ILookOverlay, ITooltipProvider {
|
public class BlockCableGauge extends BlockContainer implements IBlockMultiPass, ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) protected IIcon overlayGauge;
|
@SideOnly(Side.CLIENT) protected IIcon overlayGauge;
|
||||||
|
|
||||||
public BlockCableGauge() {
|
public BlockCableGauge() {
|
||||||
@ -48,7 +46,7 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCableGauge();
|
return new TileEntityCableGauge();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
@ -59,11 +57,11 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
|
|
||||||
if(RenderBlockMultipass.currentPass == 0) {
|
if(RenderBlockMultipass.currentPass == 0) {
|
||||||
return blockIcon;
|
return blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
return side == world.getBlockMetadata(x, y, z) ? this.overlayGauge : this.blockIcon;
|
return side == world.getBlockMetadata(x, y, z) ? this.overlayGauge : this.blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,42 +83,42 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityCableGauge))
|
if(!(te instanceof TileEntityCableGauge))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityCableGauge duct = (TileEntityCableGauge) te;
|
TileEntityCableGauge duct = (TileEntityCableGauge) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add(BobMathUtil.getShortNumber(duct.deltaTick) + "HE/t");
|
text.add(BobMathUtil.getShortNumber(duct.deltaTick) + "HE/t");
|
||||||
text.add(BobMathUtil.getShortNumber(duct.deltaLastSecond) + "HE/s");
|
text.add(BobMathUtil.getShortNumber(duct.deltaLastSecond) + "HE/s");
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return IBlockMultiPass.getRenderType();
|
return IBlockMultiPass.getRenderType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@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 deltaTick = 0;
|
||||||
private long deltaSecond = 0;
|
private long deltaSecond = 0;
|
||||||
private long deltaLastSecond = 0;
|
private long deltaLastSecond = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
if(this.node != null && this.node.net != null) {
|
if(this.node != null && this.node.net != null) {
|
||||||
|
|
||||||
PowerNetMK2 net = this.node.net;
|
PowerNetMK2 net = this.node.net;
|
||||||
|
|
||||||
this.deltaTick = net.energyTracker;
|
this.deltaTick = net.energyTracker;
|
||||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
this.deltaLastSecond = this.deltaSecond;
|
this.deltaLastSecond = this.deltaSecond;
|
||||||
@ -128,18 +126,21 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
|||||||
}
|
}
|
||||||
this.deltaSecond += deltaTick;
|
this.deltaSecond += deltaTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(25);
|
||||||
data.setLong("deltaT", deltaTick);
|
|
||||||
data.setLong("deltaS", deltaLastSecond);
|
|
||||||
INBTPacketReceiver.networkPack(this, data, 25);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
this.deltaTick = Math.max(nbt.getLong("deltaT"), 0);
|
buf.writeLong(deltaTick);
|
||||||
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
|
buf.writeLong(deltaLastSecond);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserialize(ByteBuf buf) {
|
||||||
|
this.deltaTick = Math.max(buf.readLong(), 0);
|
||||||
|
this.deltaLastSecond = Math.max(buf.readLong(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
|
import api.hbm.block.IToolable;
|
||||||
import com.hbm.blocks.IBlockMultiPass;
|
import com.hbm.blocks.IBlockMultiPass;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.render.block.RenderBlockMultipass;
|
import com.hbm.render.block.RenderBlockMultipass;
|
||||||
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
||||||
|
|
||||||
import api.hbm.block.IToolable;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -36,7 +35,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCablePaintable();
|
return new TileEntityCablePaintable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
@ -48,10 +47,10 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityCablePaintable) {
|
if(tile instanceof TileEntityCablePaintable) {
|
||||||
TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile;
|
TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block != null) {
|
if(pipe.block != null) {
|
||||||
if(RenderBlockMultipass.currentPass == 1) {
|
if(RenderBlockMultipass.currentPass == 1) {
|
||||||
return this.overlay;
|
return this.overlay;
|
||||||
@ -60,26 +59,26 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RenderBlockMultipass.currentPass == 1 ? this.overlay : this.blockIcon;
|
return RenderBlockMultipass.currentPass == 1 ? this.overlay : this.blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
|
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();
|
ItemStack stack = player.getHeldItem();
|
||||||
|
|
||||||
if(stack != null && stack.getItem() instanceof ItemBlock) {
|
if(stack != null && stack.getItem() instanceof ItemBlock) {
|
||||||
ItemBlock ib = (ItemBlock) stack.getItem();
|
ItemBlock ib = (ItemBlock) stack.getItem();
|
||||||
Block block = ib.field_150939_a;
|
Block block = ib.field_150939_a;
|
||||||
|
|
||||||
if(block.renderAsNormalBlock() && block != this) {
|
if(block.renderAsNormalBlock() && block != this) {
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityCablePaintable) {
|
if(tile instanceof TileEntityCablePaintable) {
|
||||||
TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile;
|
TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block == null) {
|
if(pipe.block == null) {
|
||||||
pipe.block = block;
|
pipe.block = block;
|
||||||
pipe.meta = stack.getItemDamage() & 15;
|
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);
|
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
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;
|
if(tool != ToolType.SCREWDRIVER) return false;
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityCablePaintable) {
|
if(tile instanceof TileEntityCablePaintable) {
|
||||||
TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile;
|
TileEntityCablePaintable pipe = (TileEntityCablePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block != null) {
|
if(pipe.block != null) {
|
||||||
pipe.block = null;
|
pipe.block = null;
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
@ -111,7 +110,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +118,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB
|
|||||||
public int getPasses() {
|
public int getPasses() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return IBlockMultiPass.getRenderType();
|
return IBlockMultiPass.getRenderType();
|
||||||
@ -149,7 +148,7 @@ public class BlockCablePaintable extends BlockContainer implements IToolable, IB
|
|||||||
this.writeToNBT(nbt);
|
this.writeToNBT(nbt);
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
this.readFromNBT(pkt.func_148857_g());
|
this.readFromNBT(pkt.func_148857_g());
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.List;
|
import api.hbm.conveyor.IConveyorBelt;
|
||||||
|
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.entity.item.EntityMovingItem;
|
import com.hbm.entity.item.EntityMovingItem;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
import api.hbm.conveyor.IConveyorBelt;
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -26,6 +23,8 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class BlockConveyorBase extends Block implements IConveyorBelt, ITooltipProvider {
|
public abstract class BlockConveyorBase extends Block implements IConveyorBelt, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -34,14 +33,14 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt,
|
|||||||
public BlockConveyorBase() {
|
public BlockConveyorBase() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
super.registerBlockIcons(iconRegister);
|
super.registerBlockIcons(iconRegister);
|
||||||
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
|
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
@ -50,7 +49,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt,
|
|||||||
return this.sideIcon;
|
return this.sideIcon;
|
||||||
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
|
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
|
||||||
return this.sideIcon;
|
return this.sideIcon;
|
||||||
|
|
||||||
return super.getIcon(side, metadata);
|
return super.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
|
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
|
||||||
|
|
||||||
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
|
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
|
||||||
//snapping point
|
//snapping point
|
||||||
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos);
|
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);
|
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
||||||
return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
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) {
|
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
|
||||||
|
|
||||||
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
|
ForgeDirection dir = this.getTravelDirection(world, x, y, z, itemPos);
|
||||||
|
|
||||||
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
|
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
|
||||||
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
|
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
|
||||||
|
|
||||||
double posX = x + 0.5;
|
double posX = x + 0.5;
|
||||||
double posZ = z + 0.5;
|
double posZ = z + 0.5;
|
||||||
|
|
||||||
@ -96,7 +95,7 @@ public abstract class BlockConveyorBase extends Block implements IConveyorBelt,
|
|||||||
if(dir.offsetZ != 0) {
|
if(dir.offsetZ != 0) {
|
||||||
posZ = itemPos.zCoord;
|
posZ = itemPos.zCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
|
import api.hbm.conveyor.IConveyorBelt;
|
||||||
import com.hbm.entity.item.EntityMovingItem;
|
import com.hbm.entity.item.EntityMovingItem;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
|
|
||||||
import api.hbm.conveyor.IConveyorBelt;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -29,14 +28,14 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt {
|
|||||||
public BlockConveyorClassic() {
|
public BlockConveyorClassic() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
super.registerBlockIcons(iconRegister);
|
super.registerBlockIcons(iconRegister);
|
||||||
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
|
this.sideIcon = iconRegister.registerIcon(RefStrings.MODID + ":conveyor_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
@ -45,7 +44,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt {
|
|||||||
return this.sideIcon;
|
return this.sideIcon;
|
||||||
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
|
if((metadata == 4 || metadata == 5) && (side == 2 || side == 3))
|
||||||
return this.sideIcon;
|
return this.sideIcon;
|
||||||
|
|
||||||
return super.getIcon(side, metadata);
|
return super.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
|
public Vec3 getTravelLocation(World world, int x, int y, int z, Vec3 itemPos, double speed) {
|
||||||
|
|
||||||
ForgeDirection dir = getTravelDirection(world, x, y, z, itemPos, speed);
|
ForgeDirection dir = getTravelDirection(world, x, y, z, itemPos, speed);
|
||||||
//snapping point
|
//snapping point
|
||||||
Vec3 snap = this.getClosestSnappingPosition(world, x, y, z, itemPos);
|
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);
|
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) {
|
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos, double speed) {
|
||||||
return ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
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) {
|
public Vec3 getClosestSnappingPosition(World world, int x, int y, int z, Vec3 itemPos) {
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
||||||
|
|
||||||
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
|
itemPos.xCoord = MathHelper.clamp_double(itemPos.xCoord, x, x + 1);
|
||||||
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
|
itemPos.zCoord = MathHelper.clamp_double(itemPos.zCoord, z, z + 1);
|
||||||
|
|
||||||
double posX = x + 0.5;
|
double posX = x + 0.5;
|
||||||
double posZ = z + 0.5;
|
double posZ = z + 0.5;
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ public class BlockConveyorClassic extends Block implements IConveyorBelt {
|
|||||||
if(dir.offsetZ != 0) {
|
if(dir.offsetZ != 0) {
|
||||||
posZ = itemPos.zCoord;
|
posZ = itemPos.zCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
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.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -21,14 +20,14 @@ public class CableDetector extends BlockContainer {
|
|||||||
public CableDetector(Material p_i45386_1_) {
|
public CableDetector(Material p_i45386_1_) {
|
||||||
super(p_i45386_1_);
|
super(p_i45386_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_on");
|
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_on");
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_off");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_detector_off");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
@ -42,18 +41,18 @@ public class CableDetector extends BlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
|
||||||
boolean on = world.isBlockIndirectlyGettingPowered(x, y, z);
|
boolean on = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
boolean update = false;
|
boolean update = false;
|
||||||
|
|
||||||
if(on && meta == 0) {
|
if(on && meta == 0) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||||
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F);
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F);
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!on && meta == 1) {
|
if(!on && meta == 1) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||||
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
||||||
|
|||||||
@ -1,22 +1,18 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.block.IToolable;
|
||||||
import java.util.List;
|
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.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
import com.hbm.util.I18nUtil;
|
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.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 class CableDiode extends BlockContainer implements IEnergyConnectorBlock, ILookOverlay, IToolable, ITooltipProvider {
|
||||||
|
|
||||||
public CableDiode(Material mat) {
|
public CableDiode(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
@ -49,23 +48,23 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return renderID;
|
return renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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_) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
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) {
|
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);
|
TileEntityDiode te = (TileEntityDiode)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(tool == ToolType.SCREWDRIVER) {
|
if(tool == ToolType.SCREWDRIVER) {
|
||||||
if(te.level < 11)
|
if(te.level < 11)
|
||||||
te.level++;
|
te.level++;
|
||||||
@ -91,7 +90,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tool == ToolType.HAND_DRILL) {
|
if(tool == ToolType.HAND_DRILL) {
|
||||||
if(te.level > 1)
|
if(te.level > 1)
|
||||||
te.level--;
|
te.level--;
|
||||||
@ -99,7 +98,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tool == ToolType.DEFUSER) {
|
if(tool == ToolType.DEFUSER) {
|
||||||
int p = te.priority.ordinal() + 1;
|
int p = te.priority.ordinal() + 1;
|
||||||
if(p > 4) p = 0;
|
if(p > 4) p = 0;
|
||||||
@ -108,7 +107,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,18 +121,18 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityDiode))
|
if(!(te instanceof TileEntityDiode))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityDiode diode = (TileEntityDiode) te;
|
TileEntityDiode diode = (TileEntityDiode) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("Max.: " + BobMathUtil.getShortNumber(diode.getMaxPower()) + "HE/t");
|
text.add("Max.: " + BobMathUtil.getShortNumber(diode.getMaxPower()) + "HE/t");
|
||||||
text.add("Priority: " + diode.priority.name());
|
text.add("Priority: " + diode.priority.name());
|
||||||
|
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
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) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityDiode();
|
return new TileEntityDiode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyReceiverMK2 {
|
public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyReceiverMK2 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
level = nbt.getInteger("level");
|
level = nbt.getInteger("level");
|
||||||
priority = ConnectionPriority.values()[nbt.getByte("p")];
|
priority = ConnectionPriority.values()[nbt.getByte("p")];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbt) {
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
@ -164,30 +163,30 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
this.writeToNBT(nbt);
|
this.writeToNBT(nbt);
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
this.readFromNBT(pkt.func_148857_g());
|
this.readFromNBT(pkt.func_148857_g());
|
||||||
}
|
}
|
||||||
|
|
||||||
int level = 1;
|
int level = 1;
|
||||||
|
|
||||||
private ForgeDirection getDir() {
|
private ForgeDirection getDir() {
|
||||||
return ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
|
return ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
|
|
||||||
if(dir == getDir())
|
if(dir == getDir())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
pulses = 0;
|
pulses = 0;
|
||||||
this.setPower(0); //tick is over, reset our allowed transfe
|
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) {
|
public boolean canConnect(ForgeDirection dir) {
|
||||||
return dir != getDir();
|
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 */
|
/** 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 long power;
|
||||||
private boolean recursionBrake = false;
|
private boolean recursionBrake = false;
|
||||||
@ -209,23 +208,23 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
|
|
||||||
if(recursionBrake)
|
if(recursionBrake)
|
||||||
return power;
|
return power;
|
||||||
|
|
||||||
pulses++;
|
pulses++;
|
||||||
if(this.getPower() >= this.getMaxPower() || pulses > 10) return power; //if we have already maxed out transfer or max pulses, abort
|
if(this.getPower() >= this.getMaxPower() || pulses > 10) return power; //if we have already maxed out transfer or max pulses, abort
|
||||||
|
|
||||||
recursionBrake = true;
|
recursionBrake = true;
|
||||||
|
|
||||||
ForgeDirection dir = getDir();
|
ForgeDirection dir = getDir();
|
||||||
PowerNode node = Nodespace.getNode(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
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);
|
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())) {
|
if(node != null && !node.expired && node.hasValidNet() && te instanceof IEnergyConnectorMK2 && ((IEnergyConnectorMK2) te).canConnect(dir.getOpposite())) {
|
||||||
long toTransfer = Math.min(power, this.getReceiverSpeed());
|
long toTransfer = Math.min(power, this.getReceiverSpeed());
|
||||||
long remainder = node.net.sendPowerDiode(toTransfer);
|
long remainder = node.net.sendPowerDiode(toTransfer);
|
||||||
long transferred = (toTransfer - remainder);
|
long transferred = (toTransfer - remainder);
|
||||||
this.power += transferred;
|
this.power += transferred;
|
||||||
power -= transferred;
|
power -= transferred;
|
||||||
|
|
||||||
} else if(te instanceof IEnergyReceiverMK2 && te != this) {
|
} else if(te instanceof IEnergyReceiverMK2 && te != this) {
|
||||||
IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te;
|
IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te;
|
||||||
if(rec.canConnect(dir.getOpposite())) {
|
if(rec.canConnect(dir.getOpposite())) {
|
||||||
@ -236,7 +235,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
return power;
|
return power;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recursionBrake = false;
|
recursionBrake = false;
|
||||||
return power;
|
return power;
|
||||||
}
|
}
|
||||||
@ -255,7 +254,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
|||||||
public long getPower() {
|
public long getPower() {
|
||||||
return Math.min(power, this.getMaxPower());
|
return Math.min(power, this.getMaxPower());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPower(long power) {
|
public void setPower(long power) {
|
||||||
this.power = power;
|
this.power = power;
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.hbm.blocks.network;
|
|||||||
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
import com.hbm.tileentity.network.TileEntityCableSwitch;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@ -21,14 +20,14 @@ public class CableSwitch extends BlockContainer {
|
|||||||
public CableSwitch(Material p_i45386_1_) {
|
public CableSwitch(Material p_i45386_1_) {
|
||||||
super(p_i45386_1_);
|
super(p_i45386_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_switch_on");
|
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":cable_switch_on");
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_switch_off");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":cable_switch_off");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
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_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
return new TileEntityCableSwitch();
|
return new TileEntityCableSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
@ -55,10 +54,10 @@ public class CableSwitch extends BlockContainer {
|
|||||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||||
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityCableSwitch te = (TileEntityCableSwitch) world.getTileEntity(x, y, z);
|
TileEntityCableSwitch te = (TileEntityCableSwitch) world.getTileEntity(x, y, z);
|
||||||
te.updateState();
|
te.updateState();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.tileentity.network.TileEntityConnector;
|
import com.hbm.tileentity.network.TileEntityConnector;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -15,6 +12,8 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ConnectorRedWire extends PylonBase {
|
public class ConnectorRedWire extends PylonBase {
|
||||||
|
|
||||||
public ConnectorRedWire(Material mat) {
|
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) {
|
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
|
||||||
return side;
|
return side;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
setBlockBounds(world.getBlockMetadata(x, y, 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);
|
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||||
setBlockBounds(world.getBlockMetadata(x, y, z));
|
setBlockBounds(world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBlockBounds(int meta) {
|
private void setBlockBounds(int meta) {
|
||||||
|
|
||||||
float pixel = 0.0625F;
|
float pixel = 0.0625F;
|
||||||
float min = pixel * 5F;
|
float min = pixel * 5F;
|
||||||
float max = pixel * 11F;
|
float max = pixel * 11F;
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(meta).getOpposite();
|
ForgeDirection dir = ForgeDirection.getOrientation(meta).getOpposite();
|
||||||
|
|
||||||
float minX = dir == Library.NEG_X ? 0F : min;
|
float minX = dir == Library.NEG_X ? 0F : min;
|
||||||
float maxX = dir == Library.POS_X ? 1F : max;
|
float maxX = dir == Library.POS_X ? 1F : max;
|
||||||
float minY = dir == Library.NEG_Y ? 0F : min;
|
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.TileEntityCraneBase;
|
||||||
import com.hbm.tileentity.network.TileEntityCraneInserter;
|
import com.hbm.tileentity.network.TileEntityCraneInserter;
|
||||||
import com.hbm.util.InventoryUtil;
|
import com.hbm.util.InventoryUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -32,7 +31,7 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
|
|||||||
public TileEntityCraneBase createNewTileEntity(World world, int meta) {
|
public TileEntityCraneBase createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCraneInserter();
|
return new TileEntityCraneInserter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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) {
|
public void onItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) {
|
||||||
ForgeDirection outputDirection = getOutputSide(world, x, y, z);
|
ForgeDirection outputDirection = getOutputSide(world, x, y, z);
|
||||||
TileEntity te = world.getTileEntity(x + outputDirection.offsetX, y + outputDirection.offsetY, z + outputDirection.offsetZ);
|
TileEntity te = world.getTileEntity(x + outputDirection.offsetX, y + outputDirection.offsetY, z + outputDirection.offsetZ);
|
||||||
|
|
||||||
if(entity == null || entity.getItemStack() == null || entity.getItemStack().stackSize <= 0) {
|
if(entity == null || entity.getItemStack() == null || entity.getItemStack().stackSize <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack toAdd = entity.getItemStack().copy();
|
ItemStack toAdd = entity.getItemStack().copy();
|
||||||
|
|
||||||
int[] access = null;
|
int[] access = null;
|
||||||
|
|
||||||
if(te instanceof ISidedInventory) {
|
if(te instanceof ISidedInventory) {
|
||||||
ISidedInventory sided = (ISidedInventory) te;
|
ISidedInventory sided = (ISidedInventory) te;
|
||||||
access = InventoryUtil.masquerade(sided, outputDirection.getOpposite().ordinal());
|
access = InventoryUtil.masquerade(sided, outputDirection.getOpposite().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(te instanceof IInventory) {
|
if(te instanceof IInventory) {
|
||||||
IInventory inv = (IInventory) te;
|
IInventory inv = (IInventory) te;
|
||||||
|
|
||||||
addToInventory(inv, access, toAdd, outputDirection.getOpposite().ordinal());
|
addToInventory(inv, access, toAdd, outputDirection.getOpposite().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityCraneInserter inserter = null;
|
TileEntityCraneInserter inserter = null;
|
||||||
|
|
||||||
if(toAdd.stackSize > 0) {
|
if(toAdd.stackSize > 0) {
|
||||||
inserter = (TileEntityCraneInserter) world.getTileEntity(x, y, z);
|
inserter = (TileEntityCraneInserter) world.getTileEntity(x, y, z);
|
||||||
addToInventory(inserter, null, toAdd, outputDirection.getOpposite().ordinal());
|
addToInventory(inserter, null, toAdd, outputDirection.getOpposite().ordinal());
|
||||||
@ -93,54 +92,54 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
|
|||||||
world.spawnEntityInWorld(drop);
|
world.spawnEntityInWorld(drop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack addToInventory(IInventory inv, int[] access, ItemStack toAdd, int side) {
|
public static ItemStack addToInventory(IInventory inv, int[] access, ItemStack toAdd, int side) {
|
||||||
|
|
||||||
ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null;
|
ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null;
|
||||||
int limit = inv.getInventoryStackLimit();
|
int limit = inv.getInventoryStackLimit();
|
||||||
|
|
||||||
int size = access == null ? inv.getSizeInventory() : access.length;
|
int size = access == null ? inv.getSizeInventory() : access.length;
|
||||||
|
|
||||||
for(int i = 0; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
int index = access == null ? i : access[i];
|
int index = access == null ? i : access[i];
|
||||||
ItemStack stack = inv.getStackInSlot(index);
|
ItemStack stack = inv.getStackInSlot(index);
|
||||||
|
|
||||||
if(stack != null && toAdd.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(toAdd, stack) && stack.stackSize < Math.min(stack.getMaxStackSize(), limit)
|
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))) {
|
&& ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) {
|
||||||
|
|
||||||
int stackLimit = Math.min(stack.getMaxStackSize(), limit);
|
int stackLimit = Math.min(stack.getMaxStackSize(), limit);
|
||||||
int amount = Math.min(toAdd.stackSize, stackLimit - stack.stackSize);
|
int amount = Math.min(toAdd.stackSize, stackLimit - stack.stackSize);
|
||||||
|
|
||||||
stack.stackSize += amount;
|
stack.stackSize += amount;
|
||||||
toAdd.stackSize -= amount;
|
toAdd.stackSize -= amount;
|
||||||
inv.markDirty();
|
inv.markDirty();
|
||||||
|
|
||||||
if(toAdd.stackSize == 0) {
|
if(toAdd.stackSize == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
int index = access == null ? i : access[i];
|
int index = access == null ? i : access[i];
|
||||||
ItemStack stack = inv.getStackInSlot(index);
|
ItemStack stack = inv.getStackInSlot(index);
|
||||||
|
|
||||||
if(stack == null && ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) {
|
if(stack == null && ((sided == null || sided.canInsertItem(index, toAdd, side)) && inv.isItemValidForSlot(index, toAdd))) {
|
||||||
|
|
||||||
int amount = Math.min(toAdd.stackSize, limit);
|
int amount = Math.min(toAdd.stackSize, limit);
|
||||||
|
|
||||||
ItemStack newStack = toAdd.copy();
|
ItemStack newStack = toAdd.copy();
|
||||||
newStack.stackSize = amount;
|
newStack.stackSize = amount;
|
||||||
inv.setInventorySlotContents(index, newStack);
|
inv.setInventorySlotContents(index, newStack);
|
||||||
toAdd.stackSize -= amount;
|
toAdd.stackSize -= amount;
|
||||||
inv.markDirty();
|
inv.markDirty();
|
||||||
|
|
||||||
if(toAdd.stackSize == 0) {
|
if(toAdd.stackSize == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return toAdd;
|
return toAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +155,7 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock {
|
|||||||
public boolean hasComparatorInputOverride() {
|
public boolean hasComparatorInputOverride() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||||
return Container.calcRedstoneFromInventory((TileEntityCraneInserter)world.getTileEntity(x, y, z));
|
return Container.calcRedstoneFromInventory((TileEntityCraneInserter)world.getTileEntity(x, y, z));
|
||||||
|
|||||||
@ -1,21 +1,15 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.conveyor.IConveyorBelt;
|
||||||
import java.util.Comparator;
|
import api.hbm.conveyor.IConveyorItem;
|
||||||
import java.util.List;
|
import api.hbm.conveyor.IConveyorPackage;
|
||||||
import java.util.Random;
|
import api.hbm.conveyor.IEnterableBlock;
|
||||||
|
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.entity.item.EntityMovingItem;
|
import com.hbm.entity.item.EntityMovingItem;
|
||||||
import com.hbm.inventory.recipes.CrystallizerRecipes;
|
import com.hbm.inventory.recipes.CrystallizerRecipes;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import com.hbm.util.InventoryUtil;
|
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.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -37,6 +31,11 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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 {
|
public class CranePartitioner extends BlockContainer implements IConveyorBelt, IEnterableBlock, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
@SideOnly(Side.CLIENT) public IIcon iconTop;
|
||||||
@ -48,7 +47,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
|||||||
public CranePartitioner() {
|
public CranePartitioner() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -116,7 +115,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
|||||||
if(dir.offsetZ != 0) posZ = itemPos.zCoord;
|
if(dir.offsetZ != 0) posZ = itemPos.zCoord;
|
||||||
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
return ForgeDirection.getOrientation(meta);
|
return ForgeDirection.getOrientation(meta);
|
||||||
@ -137,7 +136,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
|||||||
world.spawnEntityInWorld(item);
|
world.spawnEntityInWorld(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityCranePartitioner extends TileEntityMachineBase {
|
public static class TileEntityCranePartitioner extends TileEntityMachineBase {
|
||||||
|
|
||||||
public TileEntityCranePartitioner() {
|
public TileEntityCranePartitioner() {
|
||||||
@ -148,14 +147,14 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
List<ItemStack> stacks = new ArrayList();
|
List<ItemStack> stacks = new ArrayList();
|
||||||
for(int i = 0; i < 9; i++) if(slots[i] != null) stacks.add(slots[i]);
|
for(int i = 0; i < 9; i++) if(slots[i] != null) stacks.add(slots[i]);
|
||||||
stacks.sort(stackSizeComparator);
|
stacks.sort(stackSizeComparator);
|
||||||
boolean markDirty = false;
|
boolean markDirty = false;
|
||||||
|
|
||||||
for(ItemStack stack : stacks) {
|
for(ItemStack stack : stacks) {
|
||||||
int amount = CrystallizerRecipes.getAmount(stack);
|
int amount = CrystallizerRecipes.getAmount(stack);
|
||||||
while(stack.stackSize >= amount) {
|
while(stack.stackSize >= amount) {
|
||||||
@ -168,12 +167,12 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
|||||||
worldObj.spawnEntityInWorld(item);
|
worldObj.spawnEntityInWorld(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 9; i++) if(slots[i] != null && slots[i].stackSize <= 0) slots[i] = null;
|
for(int i = 0; i < 9; i++) if(slots[i] != null && slots[i].stackSize <= 0) slots[i] = null;
|
||||||
if(markDirty) this.markDirty();
|
if(markDirty) this.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Comparator<ItemStack> stackSizeComparator = new Comparator<ItemStack>() {
|
public static Comparator<ItemStack> stackSizeComparator = new Comparator<ItemStack>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -204,7 +203,7 @@ public class CranePartitioner extends BlockContainer implements IConveyorBelt, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final Random dropRandom = new Random();
|
private final Random dropRandom = new Random();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.conveyor.IConveyorBelt;
|
||||||
import java.util.List;
|
import api.hbm.conveyor.IConveyorItem;
|
||||||
|
import api.hbm.conveyor.IConveyorPackage;
|
||||||
|
import api.hbm.conveyor.IEnterableBlock;
|
||||||
import com.hbm.blocks.IBlockMultiPass;
|
import com.hbm.blocks.IBlockMultiPass;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.entity.item.EntityMovingItem;
|
import com.hbm.entity.item.EntityMovingItem;
|
||||||
@ -11,11 +12,6 @@ import com.hbm.main.MainRegistry;
|
|||||||
import com.hbm.module.ModulePatternMatcher;
|
import com.hbm.module.ModulePatternMatcher;
|
||||||
import com.hbm.render.block.RenderBlockMultipass;
|
import com.hbm.render.block.RenderBlockMultipass;
|
||||||
import com.hbm.tileentity.network.TileEntityCraneRouter;
|
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.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -33,6 +29,9 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnterableBlock, ITooltipProvider {
|
public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnterableBlock, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) protected IIcon iconOverlay;
|
@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) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCraneRouter();
|
return new TileEntityCraneRouter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -59,7 +58,7 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt
|
|||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return RenderBlockMultipass.currentPass == 0 ? this.blockIcon : this.iconOverlay;
|
return RenderBlockMultipass.currentPass == 0 ? this.blockIcon : this.iconOverlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
@ -75,10 +74,10 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|
||||||
if(RenderBlockMultipass.currentPass == 0)
|
if(RenderBlockMultipass.currentPass == 0)
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
|
|
||||||
switch(RenderBlockMultipass.currentPass - 1) {
|
switch(RenderBlockMultipass.currentPass - 1) {
|
||||||
case 0: return 0xff0000;
|
case 0: return 0xff0000;
|
||||||
case 1: return 0xff8000;
|
case 1: return 0xff8000;
|
||||||
@ -89,7 +88,7 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt
|
|||||||
default: return 0xffffff;
|
default: return 0xffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return IBlockMultiPass.getRenderType();
|
return IBlockMultiPass.getRenderType();
|
||||||
@ -101,10 +100,10 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
|
|
||||||
if(RenderBlockMultipass.currentPass == 0)
|
if(RenderBlockMultipass.currentPass == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return side == RenderBlockMultipass.currentPass - 1;
|
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) {
|
public void onItemEnter(World world, int x, int y, int z, ForgeDirection dir, IConveyorItem entity) {
|
||||||
TileEntityCraneRouter router = (TileEntityCraneRouter) world.getTileEntity(x, y, z);
|
TileEntityCraneRouter router = (TileEntityCraneRouter) world.getTileEntity(x, y, z);
|
||||||
ItemStack stack = entity.getItemStack();
|
ItemStack stack = entity.getItemStack();
|
||||||
|
|
||||||
List<ForgeDirection> validDirs = new ArrayList();
|
List<ForgeDirection> validDirs = new ArrayList();
|
||||||
|
|
||||||
//check filters for all sides
|
//check filters for all sides
|
||||||
for(int side = 0; side < 6; side++) {
|
for(int side = 0; side < 6; side++) {
|
||||||
|
|
||||||
ModulePatternMatcher matcher = router.patterns[side];
|
ModulePatternMatcher matcher = router.patterns[side];
|
||||||
int mode = router.modes[side];
|
int mode = router.modes[side];
|
||||||
|
|
||||||
//if the side is disabled or wildcard, skip
|
//if the side is disabled or wildcard, skip
|
||||||
if(mode == router.MODE_NONE || mode == router.MODE_WILDCARD)
|
if(mode == router.MODE_NONE || mode == router.MODE_WILDCARD)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
boolean matchesFilter = false;
|
boolean matchesFilter = false;
|
||||||
|
|
||||||
for(int slot = 0; slot < 5; slot++) {
|
for(int slot = 0; slot < 5; slot++) {
|
||||||
ItemStack filter = router.slots[side * 5 + slot];
|
ItemStack filter = router.slots[side * 5 + slot];
|
||||||
|
|
||||||
if(filter == null)
|
if(filter == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//the filter kicks in so long as one entry matches
|
//the filter kicks in so long as one entry matches
|
||||||
if(matcher.isValidForFilter(filter, slot, stack)) {
|
if(matcher.isValidForFilter(filter, slot, stack)) {
|
||||||
matchesFilter = true;
|
matchesFilter = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//add dir if matches with whitelist on or doesn't match with blacklist on
|
//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)) {
|
if((mode == router.MODE_WHITELIST && matchesFilter) || (mode == router.MODE_BLACKLIST && !matchesFilter)) {
|
||||||
validDirs.add(ForgeDirection.getOrientation(side));
|
validDirs.add(ForgeDirection.getOrientation(side));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if no valid dirs have yet been found, use wildcard
|
//if no valid dirs have yet been found, use wildcard
|
||||||
if(validDirs.isEmpty()) {
|
if(validDirs.isEmpty()) {
|
||||||
for(int side = 0; side < 6; side++) {
|
for(int side = 0; side < 6; side++) {
|
||||||
@ -164,25 +163,25 @@ public class CraneRouter extends BlockContainer implements IBlockMultiPass, IEnt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(validDirs.isEmpty()) {
|
if(validDirs.isEmpty()) {
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy()));
|
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack.copy()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = world.rand.nextInt(validDirs.size());
|
int i = world.rand.nextInt(validDirs.size());
|
||||||
sendOnRoute(world, x, y, z, entity, validDirs.get(i));
|
sendOnRoute(world, x, y, z, entity, validDirs.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendOnRoute(World world, int x, int y, int z, IConveyorItem item, ForgeDirection dir) {
|
protected void sendOnRoute(World world, int x, int y, int z, IConveyorItem item, ForgeDirection dir) {
|
||||||
|
|
||||||
IConveyorBelt belt = null;
|
IConveyorBelt belt = null;
|
||||||
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||||
|
|
||||||
if(block instanceof IConveyorBelt) {
|
if(block instanceof IConveyorBelt) {
|
||||||
belt = (IConveyorBelt) block;
|
belt = (IConveyorBelt) block;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(belt != null) {
|
if(belt != null) {
|
||||||
EntityMovingItem moving = new EntityMovingItem(world);
|
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);
|
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;
|
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.IConveyorBelt;
|
||||||
import api.hbm.conveyor.IConveyorItem;
|
import api.hbm.conveyor.IConveyorItem;
|
||||||
import api.hbm.conveyor.IConveyorPackage;
|
import api.hbm.conveyor.IConveyorPackage;
|
||||||
import api.hbm.conveyor.IEnterableBlock;
|
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.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -26,6 +23,8 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnterableBlock, ITooltipProvider {
|
public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnterableBlock, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) public IIcon iconTopLeft;
|
@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 iconBelt;
|
||||||
@SideOnly(Side.CLIENT) public IIcon iconInner;
|
@SideOnly(Side.CLIENT) public IIcon iconInner;
|
||||||
@SideOnly(Side.CLIENT) public IIcon iconInnerSide;
|
@SideOnly(Side.CLIENT) public IIcon iconInnerSide;
|
||||||
|
|
||||||
public CraneSplitter() {
|
public CraneSplitter() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
}
|
}
|
||||||
@ -58,7 +57,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt
|
|||||||
public int getOffset() {
|
public int getOffset() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -100,7 +99,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt
|
|||||||
boolean pos = splitter.getPosition();
|
boolean pos = splitter.getPosition();
|
||||||
ItemStack stack = entity.getItemStack();
|
ItemStack stack = entity.getItemStack();
|
||||||
ForgeDirection rot = ForgeDirection.getOrientation(splitter.getBlockMetadata() - offset).getRotation(ForgeDirection.DOWN);
|
ForgeDirection rot = ForgeDirection.getOrientation(splitter.getBlockMetadata() - offset).getRotation(ForgeDirection.DOWN);
|
||||||
|
|
||||||
if(stack.stackSize % 2 == 0) {
|
if(stack.stackSize % 2 == 0) {
|
||||||
stack.stackSize /= 2;
|
stack.stackSize /= 2;
|
||||||
spawnMovingItem(world, x, y, z, stack.copy());
|
spawnMovingItem(world, x, y, z, stack.copy());
|
||||||
@ -114,7 +113,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt
|
|||||||
splitter.setPosition(!pos);
|
splitter.setPosition(!pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnMovingItem(World world, int x, int y, int z, ItemStack stack) {
|
private void spawnMovingItem(World world, int x, int y, int z, ItemStack stack) {
|
||||||
if(stack.stackSize <= 0) return;
|
if(stack.stackSize <= 0) return;
|
||||||
EntityMovingItem moving = new EntityMovingItem(world);
|
EntityMovingItem moving = new EntityMovingItem(world);
|
||||||
@ -152,7 +151,7 @@ public class CraneSplitter extends BlockDummyable implements IConveyorBelt, IEnt
|
|||||||
if(dir.offsetZ != 0) posZ = itemPos.zCoord;
|
if(dir.offsetZ != 0) posZ = itemPos.zCoord;
|
||||||
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
return Vec3.createVectorHelper(posX, y + 0.25, posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
if(meta >= 12) return ForgeDirection.getOrientation(meta - offset);
|
if(meta >= 12) return ForgeDirection.getOrientation(meta - offset);
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package com.hbm.blocks.network;
|
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.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
@ -11,7 +7,6 @@ import com.hbm.lib.RefStrings;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.network.TileEntityDroneCrate;
|
import com.hbm.tileentity.network.TileEntityDroneCrate;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -28,8 +23,12 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
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 {
|
public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
private static Random rand = new Random();
|
private static Random rand = new Random();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||||
@ -60,9 +59,9 @@ public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltip
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.drone_linker) return false;
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking()) {
|
} else if(!player.isSneaking()) {
|
||||||
@ -72,7 +71,7 @@ public class DroneCrate extends BlockContainer implements ILookOverlay, ITooltip
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
TileEntityDroneCrate tileentityfurnace = (TileEntityDroneCrate) world.getTileEntity(x, y, z);
|
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) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
TileEntityDroneCrate tile = (TileEntityDroneCrate) world.getTileEntity(x, y, z);
|
TileEntityDroneCrate tile = (TileEntityDroneCrate) world.getTileEntity(x, y, z);
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
if(tile.nextY != -1) {
|
if(tile.nextY != -1) {
|
||||||
text.add("Next waypoint: " + tile.nextX + " / " + tile.nextY + " / " + tile.nextZ);
|
text.add("Next waypoint: " + tile.nextX + " / " + tile.nextY + " / " + tile.nextZ);
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.network.TileEntityDroneDock;
|
import com.hbm.tileentity.network.TileEntityDroneDock;
|
||||||
import com.hbm.tileentity.network.TileEntityDroneProvider;
|
import com.hbm.tileentity.network.TileEntityDroneProvider;
|
||||||
import com.hbm.tileentity.network.TileEntityDroneRequester;
|
import com.hbm.tileentity.network.TileEntityDroneRequester;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -21,6 +18,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DroneDock extends BlockContainer implements ITooltipProvider {
|
public class DroneDock extends BlockContainer implements ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
@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_dock) return new TileEntityDroneDock();
|
||||||
if(this == ModBlocks.drone_crate_provider) return new TileEntityDroneProvider();
|
if(this == ModBlocks.drone_crate_provider) return new TileEntityDroneProvider();
|
||||||
if(this == ModBlocks.drone_crate_requester) return new TileEntityDroneRequester();
|
if(this == ModBlocks.drone_crate_requester) return new TileEntityDroneRequester();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ public class DroneDock extends BlockContainer implements ITooltipProvider {
|
|||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
|
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.tileentity.network.TileEntityDroneWaypoint;
|
import com.hbm.tileentity.network.TileEntityDroneWaypoint;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -25,6 +21,9 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITooltipProvider {
|
public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
public DroneWaypoint() {
|
public DroneWaypoint() {
|
||||||
@ -40,34 +39,34 @@ public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITool
|
|||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RadioTorchBase.renderID;
|
return RadioTorchBase.renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) {
|
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) {
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z) & 7;
|
int meta = world.getBlockMetadata(x, y, z) & 7;
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||||
|
|
||||||
this.setBlockBounds(
|
this.setBlockBounds(
|
||||||
dir.offsetX == 1 ? 0F : 0.375F,
|
dir.offsetX == 1 ? 0F : 0.375F,
|
||||||
dir.offsetY == 1 ? 0F : 0.375F,
|
dir.offsetY == 1 ? 0F : 0.375F,
|
||||||
@ -87,34 +86,34 @@ public class DroneWaypoint extends BlockContainer implements ILookOverlay, ITool
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||||
Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ);
|
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))) {
|
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);
|
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) {
|
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) {
|
||||||
if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false;
|
if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false;
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
||||||
Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ);
|
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));
|
return b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) || (b.renderAsNormalBlock() && !b.isAir(world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.drone_linker) return false;
|
||||||
|
|
||||||
if(world.isRemote) return true;
|
if(world.isRemote) return true;
|
||||||
|
|
||||||
TileEntityDroneWaypoint tile = (TileEntityDroneWaypoint) world.getTileEntity(x, y, z);
|
TileEntityDroneWaypoint tile = (TileEntityDroneWaypoint) world.getTileEntity(x, y, z);
|
||||||
tile.addHeight(player.isSneaking() ? - 1 : 1);
|
tile.addHeight(player.isSneaking() ? - 1 : 1);
|
||||||
return true;
|
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) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
TileEntityDroneWaypoint tile = (TileEntityDroneWaypoint) world.getTileEntity(x, y, z);
|
TileEntityDroneWaypoint tile = (TileEntityDroneWaypoint) world.getTileEntity(x, y, z);
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
|
|
||||||
text.add("Waypoint distance: " + tile.height);
|
text.add("Waypoint distance: " + tile.height);
|
||||||
|
|
||||||
if(tile.nextY != -1) {
|
if(tile.nextY != -1) {
|
||||||
text.add("Next waypoint: " + tile.nextX + " / " + tile.nextY + " / " + tile.nextZ);
|
text.add("Next waypoint: " + tile.nextX + " / " + tile.nextY + " / " + tile.nextZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import com.hbm.tileentity.network.TileEntityDroneWaypointRequest;
|
import com.hbm.tileentity.network.TileEntityDroneWaypointRequest;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -30,34 +29,34 @@ public class DroneWaypointRequest extends BlockContainer {
|
|||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RadioTorchBase.renderID;
|
return RadioTorchBase.renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) {
|
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) {
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z) & 7;
|
int meta = world.getBlockMetadata(x, y, z) & 7;
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||||
|
|
||||||
this.setBlockBounds(
|
this.setBlockBounds(
|
||||||
dir.offsetX == 1 ? 0F : 0.375F,
|
dir.offsetX == 1 ? 0F : 0.375F,
|
||||||
dir.offsetY == 1 ? 0F : 0.375F,
|
dir.offsetY == 1 ? 0F : 0.375F,
|
||||||
@ -77,24 +76,24 @@ public class DroneWaypointRequest extends BlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||||
Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ);
|
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))) {
|
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);
|
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) {
|
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) {
|
||||||
if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false;
|
if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false;
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
||||||
Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ);
|
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));
|
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;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.fluid.IPipeNet;
|
||||||
import java.util.List;
|
import api.hbm.fluid.PipeNet;
|
||||||
|
|
||||||
import com.hbm.blocks.IAnalyzable;
|
import com.hbm.blocks.IAnalyzable;
|
||||||
import com.hbm.extprop.HbmPlayerProps;
|
import com.hbm.extprop.HbmPlayerProps;
|
||||||
import com.hbm.handler.HbmKeybinds;
|
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.IItemFluidIdentifier;
|
||||||
import com.hbm.items.machine.ItemFluidIDMulti;
|
import com.hbm.items.machine.ItemFluidIDMulti;
|
||||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
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.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -22,6 +18,9 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IAnalyzable {
|
public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IAnalyzable {
|
||||||
|
|
||||||
public FluidDuctBase(Material mat) {
|
public FluidDuctBase(Material mat) {
|
||||||
@ -35,15 +34,15 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
|
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) {
|
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||||
IItemFluidIdentifier id = (IItemFluidIdentifier) player.getHeldItem().getItem();
|
IItemFluidIdentifier id = (IItemFluidIdentifier) player.getHeldItem().getItem();
|
||||||
FluidType type = id.getType(world, x, y, z, player.getHeldItem());
|
FluidType type = id.getType(world, x, y, z, player.getHeldItem());
|
||||||
|
|
||||||
if(!HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_CTRL) && !player.isSneaking()) {
|
if(!HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_CTRL) && !player.isSneaking()) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te instanceof TileEntityPipeBaseNT) {
|
if(te instanceof TileEntityPipeBaseNT) {
|
||||||
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
||||||
|
|
||||||
@ -64,7 +63,7 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te instanceof TileEntityPipeBaseNT) {
|
if(te instanceof TileEntityPipeBaseNT) {
|
||||||
@ -86,25 +85,25 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeTypeRecursively(World world, int x, int y, int z, FluidType prevType, FluidType type, int loopsRemaining) {
|
public void changeTypeRecursively(World world, int x, int y, int z, FluidType prevType, FluidType type, int loopsRemaining) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te instanceof TileEntityPipeBaseNT) {
|
if(te instanceof TileEntityPipeBaseNT) {
|
||||||
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
||||||
|
|
||||||
if(pipe.getType() == prevType && pipe.getType() != type) {
|
if(pipe.getType() == prevType && pipe.getType() != type) {
|
||||||
pipe.setType(type);
|
pipe.setType(type);
|
||||||
|
|
||||||
if(loopsRemaining > 0) {
|
if(loopsRemaining > 0) {
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
Block b = world.getBlock(x, y, z);
|
Block b = world.getBlock(x, y, z);
|
||||||
|
|
||||||
if(b instanceof IBlockFluidDuct) {
|
if(b instanceof IBlockFluidDuct) {
|
||||||
((IBlockFluidDuct) b).changeTypeRecursively(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, prevType, type, loopsRemaining - 1);
|
((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
|
@Override
|
||||||
public List<String> getDebugInfo(World world, int x, int y, int z) {
|
public List<String> getDebugInfo(World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te instanceof TileEntityPipeBaseNT) {
|
if(te instanceof TileEntityPipeBaseNT) {
|
||||||
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
||||||
FluidType type = pipe.getType();
|
FluidType type = pipe.getType();
|
||||||
|
|
||||||
if(type != null) {
|
if(type != null) {
|
||||||
|
|
||||||
IPipeNet net = pipe.getPipeNet(type);
|
IPipeNet net = pipe.getPipeNet(type);
|
||||||
|
|
||||||
if(net instanceof PipeNet) {
|
if(net instanceof PipeNet) {
|
||||||
PipeNet pipeNet = (PipeNet) net;
|
PipeNet pipeNet = (PipeNet) net;
|
||||||
|
|
||||||
List<String> debug = new ArrayList();
|
List<String> debug = new ArrayList();
|
||||||
debug.add("=== DEBUG START ===");
|
debug.add("=== DEBUG START ===");
|
||||||
debug.addAll(pipeNet.debug);
|
debug.addAll(pipeNet.debug);
|
||||||
@ -141,7 +140,7 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.IBlockMulti;
|
import com.hbm.blocks.IBlockMulti;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOverlay {
|
public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOverlay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) public IIcon[] iconStraight;
|
@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[] iconCurveBL;
|
||||||
@SideOnly(Side.CLIENT) public IIcon[] iconCurveBR;
|
@SideOnly(Side.CLIENT) public IIcon[] iconCurveBR;
|
||||||
@SideOnly(Side.CLIENT) public IIcon[][] iconJunction;
|
@SideOnly(Side.CLIENT) public IIcon[][] iconJunction;
|
||||||
|
|
||||||
private static final String[] materials = new String[] { "silver", "copper", "white" };
|
private static final String[] materials = new String[] { "silver", "copper", "white" };
|
||||||
|
|
||||||
public FluidDuctBox(Material mat) {
|
public FluidDuctBox(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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 pY = canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||||
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_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 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 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 meta = world.getBlockMetadata(x, y, z);
|
||||||
int m = rectify(meta);
|
int m = rectify(meta);
|
||||||
|
|
||||||
if((mask & 0b001111) == 0 && mask > 0) {
|
if((mask & 0b001111) == 0 && mask > 0) {
|
||||||
return (side == 4 || side == 5) ? iconEnd[m] : iconStraight[m];
|
return (side == 4 || side == 5) ? iconEnd[m] : iconStraight[m];
|
||||||
} else if((mask & 0b111100) == 0 && mask > 0) {
|
} 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(pX && pZ) return side == 0 ? iconCurveBR[m] : iconCurveBR[m];
|
||||||
if(nX && nZ) return side == 0 ? iconCurveTL[m] : iconCurveTL[m];
|
if(nX && nZ) return side == 0 ? iconCurveTL[m] : iconCurveTL[m];
|
||||||
if(nX && pZ) return side == 0 ? iconCurveBL[m] : iconCurveBL[m];
|
if(nX && pZ) return side == 0 ? iconCurveBL[m] : iconCurveBL[m];
|
||||||
|
|
||||||
return iconJunction[m][meta / 3];
|
return iconJunction[m][meta / 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
return iconJunction[m][meta / 3];
|
return iconJunction[m][meta / 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for(int i = 0; i < 15; ++i) {
|
for(int i = 0; i < 15; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int damageDropped(int meta) {
|
public int damageDropped(int meta) {
|
||||||
return meta % 15;
|
return meta % 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return renderID;
|
return renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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_) {
|
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
|
@Override
|
||||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||||
|
|
||||||
List<AxisAlignedBB> bbs = new ArrayList();
|
List<AxisAlignedBB> bbs = new ArrayList();
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
@ -170,9 +169,9 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
|
|||||||
double jLower = 0.0625D;
|
double jLower = 0.0625D;
|
||||||
double jUpper = 0.9375D;
|
double jUpper = 0.9375D;
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
for(int i = 2; i < 13; i += 3) {
|
for(int i = 2; i < 13; i += 3) {
|
||||||
|
|
||||||
if(meta > i) {
|
if(meta > i) {
|
||||||
lower += 0.0625D;
|
lower += 0.0625D;
|
||||||
upper -= 0.0625D;
|
upper -= 0.0625D;
|
||||||
@ -180,7 +179,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
|
|||||||
jUpper -= 0.0625D;
|
jUpper -= 0.0625D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, 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);
|
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 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 count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);
|
||||||
|
|
||||||
if(mask == 0) {
|
if(mask == 0) {
|
||||||
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
|
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
|
||||||
} else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) {
|
} 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) {
|
} 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));
|
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + 1.0D));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(count != 2) {
|
if(count != 2) {
|
||||||
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
|
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
|
||||||
} else {
|
} else {
|
||||||
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + lower, x + upper, y + upper, z + upper));
|
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(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(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));
|
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(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));
|
if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + lower));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(AxisAlignedBB bb : bbs) {
|
for(AxisAlignedBB bb : bbs) {
|
||||||
if(entityBounding.intersectsWith(bb)) {
|
if(entityBounding.intersectsWith(bb)) {
|
||||||
list.add(bb);
|
list.add(bb);
|
||||||
@ -244,9 +243,9 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
|
|||||||
float jLower = 0.0625F;
|
float jLower = 0.0625F;
|
||||||
float jUpper = 0.9375F;
|
float jUpper = 0.9375F;
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
for(int i = 2; i < 13; i += 3) {
|
for(int i = 2; i < 13; i += 3) {
|
||||||
|
|
||||||
if(meta > i) {
|
if(meta > i) {
|
||||||
lower += 0.0625F;
|
lower += 0.0625F;
|
||||||
upper -= 0.0625F;
|
upper -= 0.0625F;
|
||||||
@ -254,7 +253,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
|
|||||||
jUpper -= 0.0625F;
|
jUpper -= 0.0625F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, 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);
|
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 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 count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);
|
||||||
|
|
||||||
if(mask == 0) {
|
if(mask == 0) {
|
||||||
this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper);
|
this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper);
|
||||||
} else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) {
|
} 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) {
|
} else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) {
|
||||||
this.setBlockBounds(lower, lower, 0F, upper, upper, 1F);
|
this.setBlockBounds(lower, lower, 0F, upper, upper, 1F);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(count != 2) {
|
if(count != 2) {
|
||||||
this.setBlockBounds(
|
this.setBlockBounds(
|
||||||
nX ? 0F : jLower,
|
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) {
|
public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) {
|
||||||
if(tile instanceof TileEntityPipeBaseNT) {
|
if(tile instanceof TileEntityPipeBaseNT) {
|
||||||
return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, ((TileEntityPipeBaseNT) tile).getType());
|
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
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityPipeBaseNT))
|
if(!(te instanceof TileEntityPipeBaseNT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te;
|
TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int cachedColor = 0xffffff;
|
public static int cachedColor = 0xffffff;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityPipeExhaust;
|
import com.hbm.tileentity.network.TileEntityPipeExhaust;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.material.Material;
|
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.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidDuctBoxExhaust extends FluidDuctBox {
|
public class FluidDuctBoxExhaust extends FluidDuctBox {
|
||||||
|
|
||||||
public FluidDuctBoxExhaust(Material mat) {
|
public FluidDuctBoxExhaust(Material mat) {
|
||||||
@ -34,7 +33,7 @@ public class FluidDuctBoxExhaust extends FluidDuctBox {
|
|||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityPipeExhaust();
|
return new TileEntityPipeExhaust();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
@ -56,7 +55,7 @@ public class FluidDuctBoxExhaust extends FluidDuctBox {
|
|||||||
iconCurveBR[0] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_exhaust_curve_br");
|
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);
|
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) {
|
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) ||
|
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) ||
|
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() {
|
public int getSubCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for(int i = 0; i < 15; i += 3) {
|
for(int i = 0; i < 15; i += 3) {
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import api.hbm.fluid.IPipeNet;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.hbm.blocks.IBlockMultiPass;
|
import com.hbm.blocks.IBlockMultiPass;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
@ -12,14 +8,12 @@ import com.hbm.handler.CompatHandler;
|
|||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.render.block.RenderBlockMultipass;
|
import com.hbm.render.block.RenderBlockMultipass;
|
||||||
import com.hbm.tileentity.INBTPacketReceiver;
|
|
||||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import api.hbm.fluid.IPipeNet;
|
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import li.cil.oc.api.machine.Arguments;
|
import li.cil.oc.api.machine.Arguments;
|
||||||
import li.cil.oc.api.machine.Callback;
|
import li.cil.oc.api.machine.Callback;
|
||||||
import li.cil.oc.api.machine.Context;
|
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.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
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 {
|
public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, ILookOverlay, ITooltipProvider {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) protected IIcon overlay;
|
@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) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityPipeGauge();
|
return new TileEntityPipeGauge();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
@ -62,11 +60,11 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
|
|
||||||
if(RenderBlockMultipass.currentPass == 0) {
|
if(RenderBlockMultipass.currentPass == 0) {
|
||||||
return blockIcon;
|
return blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
return side == world.getBlockMetadata(x, y, z) ? this.overlayGauge : this.overlay;
|
return side == world.getBlockMetadata(x, y, z) ? this.overlayGauge : this.overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,34 +86,34 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityPipeBaseNT))
|
if(!(te instanceof TileEntityPipeBaseNT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityPipeGauge duct = (TileEntityPipeGauge) te;
|
TileEntityPipeGauge duct = (TileEntityPipeGauge) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
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.deltaTick) + " mB/t");
|
||||||
text.add(String.format(Locale.US, "%,d", duct.deltaLastSecond) + " mB/s");
|
text.add(String.format(Locale.US, "%,d", duct.deltaLastSecond) + " mB/s");
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return IBlockMultiPass.getRenderType();
|
return IBlockMultiPass.getRenderType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@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 BigInteger lastMeasurement = BigInteger.valueOf(10);
|
||||||
private long deltaTick = 0;
|
private long deltaTick = 0;
|
||||||
private long deltaSecond = 0;
|
private long deltaSecond = 0;
|
||||||
private long deltaLastSecond = 0;
|
private long deltaLastSecond = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
@ -123,12 +121,12 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
|||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
IPipeNet net = this.getPipeNet(this.getType());
|
IPipeNet net = this.getPipeNet(this.getType());
|
||||||
|
|
||||||
if(net != null && this.getType() != Fluids.NONE) {
|
if(net != null && this.getType() != Fluids.NONE) {
|
||||||
BigInteger total = net.getTotalTransfer();
|
BigInteger total = net.getTotalTransfer();
|
||||||
BigInteger delta = total.subtract(this.lastMeasurement);
|
BigInteger delta = total.subtract(this.lastMeasurement);
|
||||||
this.lastMeasurement = total;
|
this.lastMeasurement = total;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.deltaTick = delta.longValueExact();
|
this.deltaTick = delta.longValueExact();
|
||||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
@ -136,21 +134,24 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
|
|||||||
this.deltaSecond = 0;
|
this.deltaSecond = 0;
|
||||||
}
|
}
|
||||||
this.deltaSecond += deltaTick;
|
this.deltaSecond += deltaTick;
|
||||||
|
|
||||||
} catch(Exception ex) { }
|
} catch(Exception ex) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
networkPackNT(25);
|
||||||
data.setLong("deltaT", deltaTick);
|
|
||||||
data.setLong("deltaS", deltaLastSecond);
|
|
||||||
INBTPacketReceiver.networkPack(this, data, 25);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void networkUnpack(NBTTagCompound nbt) {
|
public void serialize(ByteBuf buf) {
|
||||||
this.deltaTick = Math.max(nbt.getLong("deltaT"), 0);
|
buf.writeLong(deltaTick);
|
||||||
this.deltaLastSecond = Math.max(nbt.getLong("deltaS"), 0);
|
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")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
|||||||
@ -1,16 +1,12 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import api.hbm.block.IToolable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.IBlockMultiPass;
|
import com.hbm.blocks.IBlockMultiPass;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.render.block.RenderBlockMultipass;
|
import com.hbm.render.block.RenderBlockMultipass;
|
||||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import api.hbm.block.IToolable;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -26,6 +22,9 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlockMultiPass, ILookOverlay {
|
public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlockMultiPass, ILookOverlay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT) protected IIcon overlay;
|
@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) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityPipePaintable();
|
return new TileEntityPipePaintable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
@ -52,10 +51,10 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityPipePaintable) {
|
if(tile instanceof TileEntityPipePaintable) {
|
||||||
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block != null) {
|
if(pipe.block != null) {
|
||||||
if(RenderBlockMultipass.currentPass == 1) {
|
if(RenderBlockMultipass.currentPass == 1) {
|
||||||
return this.overlay;
|
return this.overlay;
|
||||||
@ -64,46 +63,46 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RenderBlockMultipass.currentPass == 1 ? this.overlayColor : this.blockIcon;
|
return RenderBlockMultipass.currentPass == 1 ? this.overlayColor : this.blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|
||||||
if(RenderBlockMultipass.currentPass == 0)
|
if(RenderBlockMultipass.currentPass == 0)
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityPipePaintable) {
|
if(tile instanceof TileEntityPipePaintable) {
|
||||||
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block == null) {
|
if(pipe.block == null) {
|
||||||
return pipe.getType().getColor();
|
return pipe.getType().getColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
|
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();
|
ItemStack stack = player.getHeldItem();
|
||||||
|
|
||||||
if(stack != null && stack.getItem() instanceof ItemBlock) {
|
if(stack != null && stack.getItem() instanceof ItemBlock) {
|
||||||
ItemBlock ib = (ItemBlock) stack.getItem();
|
ItemBlock ib = (ItemBlock) stack.getItem();
|
||||||
Block block = ib.field_150939_a;
|
Block block = ib.field_150939_a;
|
||||||
|
|
||||||
if(block.renderAsNormalBlock() && block != this) {
|
if(block.renderAsNormalBlock() && block != this) {
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityPipePaintable) {
|
if(tile instanceof TileEntityPipePaintable) {
|
||||||
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block == null) {
|
if(pipe.block == null) {
|
||||||
pipe.block = block;
|
pipe.block = block;
|
||||||
pipe.meta = stack.getItemDamage() & 15;
|
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);
|
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
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;
|
if(tool != ToolType.SCREWDRIVER) return false;
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tile instanceof TileEntityPipePaintable) {
|
if(tile instanceof TileEntityPipePaintable) {
|
||||||
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
TileEntityPipePaintable pipe = (TileEntityPipePaintable) tile;
|
||||||
|
|
||||||
if(pipe.block != null) {
|
if(pipe.block != null) {
|
||||||
pipe.block = null;
|
pipe.block = null;
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
@ -135,7 +134,7 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo
|
|||||||
public int getPasses() {
|
public int getPasses() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return IBlockMultiPass.getRenderType();
|
return IBlockMultiPass.getRenderType();
|
||||||
@ -151,19 +150,19 @@ public class FluidDuctPaintable extends FluidDuctBase implements IToolable, IBlo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityPipeBaseNT))
|
if(!(te instanceof TileEntityPipeBaseNT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te;
|
TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityPipePaintable extends TileEntityPipeBaseNT {
|
public static class TileEntityPipePaintable extends TileEntityPipeBaseNT {
|
||||||
|
|
||||||
private Block block;
|
private Block block;
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.IBlockMulti;
|
import com.hbm.blocks.IBlockMulti;
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
@ -11,7 +8,6 @@ import com.hbm.lib.Library;
|
|||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.client.event.RenderGameOverlayEvent.Pre;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILookOverlay {
|
public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILookOverlay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -41,7 +40,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo
|
|||||||
public FluidDuctStandard(Material mat) {
|
public FluidDuctStandard(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
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[1] = iconRegister.registerIcon(RefStrings.MODID + ":pipe_silver_overlay");
|
||||||
this.overlay[2] = iconRegister.registerIcon(RefStrings.MODID + ":pipe_colored_overlay");
|
this.overlay[2] = iconRegister.registerIcon(RefStrings.MODID + ":pipe_colored_overlay");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return side == 0 ? this.icon[rectify(metadata)] : this.overlay[rectify(metadata)];
|
return side == 0 ? this.icon[rectify(metadata)] : this.overlay[rectify(metadata)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for(int i = 0; i < 3; ++i) {
|
for(int i = 0; i < 3; ++i) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int damageDropped(int meta) {
|
public int damageDropped(int meta) {
|
||||||
return rectify(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();
|
return new ItemStack(ModItems.fluid_duct, 1, metadata).getItem();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
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);
|
return super.getPickBlock(target, world, x, y, z, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return renderID;
|
return renderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
@ -134,7 +133,7 @@ public class FluidDuctStandard extends FluidDuctBase implements IBlockMulti, ILo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||||
|
|
||||||
List<AxisAlignedBB> bbs = new ArrayList();
|
List<AxisAlignedBB> bbs = new ArrayList();
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
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 nZ = canConnectTo(world, x, y, z, Library.NEG_Z, type);
|
||||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_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);
|
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
|
||||||
|
|
||||||
if(mask == 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.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));
|
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) {
|
} 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));
|
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.0D, x + 0.6875D, y + 0.6875D, z + 1.0D));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.3125D, x + 0.6875D, y + 0.6875D, z + 0.6875D));
|
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(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(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));
|
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));
|
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) {
|
for(AxisAlignedBB bb : bbs) {
|
||||||
if(entityBounding.intersectsWith(bb)) {
|
if(entityBounding.intersectsWith(bb)) {
|
||||||
list.add(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 nZ = canConnectTo(world, x, y, z, Library.NEG_Z, type);
|
||||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_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);
|
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
|
||||||
|
|
||||||
if(mask == 0) {
|
if(mask == 0) {
|
||||||
this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F);
|
this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F);
|
||||||
} else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) {
|
} 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) {
|
} else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) {
|
||||||
this.setBlockBounds(0.3125F, 0.3125F, 0F, 0.6875F, 0.6875F, 1F);
|
this.setBlockBounds(0.3125F, 0.3125F, 0F, 0.6875F, 0.6875F, 1F);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.setBlockBounds(
|
this.setBlockBounds(
|
||||||
nX ? 0F : 0.3125F,
|
nX ? 0F : 0.3125F,
|
||||||
nY ? 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) {
|
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);
|
return Library.canConnectFluid(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityPipeBaseNT))
|
if(!(te instanceof TileEntityPipeBaseNT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te;
|
TileEntityPipeBaseNT duct = (TileEntityPipeBaseNT) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityFluidValve;
|
import com.hbm.tileentity.network.TileEntityFluidValve;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@ -18,6 +14,9 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidSwitch extends FluidDuctBase implements ILookOverlay {
|
public class FluidSwitch extends FluidDuctBase implements ILookOverlay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -26,14 +25,14 @@ public class FluidSwitch extends FluidDuctBase implements ILookOverlay {
|
|||||||
public FluidSwitch(Material mat) {
|
public FluidSwitch(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_on");
|
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_on");
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_off");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_switch_off");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
@ -47,18 +46,18 @@ public class FluidSwitch extends FluidDuctBase implements ILookOverlay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
|
||||||
boolean on = world.isBlockIndirectlyGettingPowered(x, y, z);
|
boolean on = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
boolean update = false;
|
boolean update = false;
|
||||||
|
|
||||||
if(on && meta == 0) {
|
if(on && meta == 0) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||||
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F);
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 1.0F);
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!on && meta == 1) {
|
if(!on && meta == 1) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||||
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
||||||
@ -73,14 +72,14 @@ public class FluidSwitch extends FluidDuctBase implements ILookOverlay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityFluidValve))
|
if(!(te instanceof TileEntityFluidValve))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityFluidValve duct = (TileEntityFluidValve) te;
|
TileEntityFluidValve duct = (TileEntityFluidValve) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ILookOverlay;
|
import com.hbm.blocks.ILookOverlay;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.tileentity.network.TileEntityFluidValve;
|
import com.hbm.tileentity.network.TileEntityFluidValve;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -18,6 +14,9 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidValve extends FluidDuctBase implements ILookOverlay {
|
public class FluidValve extends FluidDuctBase implements ILookOverlay {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ -26,14 +25,14 @@ public class FluidValve extends FluidDuctBase implements ILookOverlay {
|
|||||||
public FluidValve(Material mat) {
|
public FluidValve(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_on");
|
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_on");
|
||||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_off");
|
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":fluid_valve_off");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
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_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
return new TileEntityFluidValve();
|
return new TileEntityFluidValve();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
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(world.isRemote) return true;
|
||||||
|
|
||||||
if(super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ)) return true;
|
if(super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ)) return true;
|
||||||
|
|
||||||
if(!player.isSneaking()) {
|
if(!player.isSneaking()) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
TileEntityFluidValve te = (TileEntityFluidValve) world.getTileEntity(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.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||||
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
world.playSoundEffect(x, y, z, "hbm:block.reactorStart", 1.0F, 0.85F);
|
||||||
}
|
}
|
||||||
|
|
||||||
te.updateState();
|
te.updateState();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -73,14 +72,14 @@ public class FluidValve extends FluidDuctBase implements ILookOverlay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(!(te instanceof TileEntityFluidValve))
|
if(!(te instanceof TileEntityFluidValve))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityFluidValve duct = (TileEntityFluidValve) te;
|
TileEntityFluidValve duct = (TileEntityFluidValve) te;
|
||||||
|
|
||||||
List<String> text = new ArrayList();
|
List<String> text = new ArrayList();
|
||||||
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
text.add("&[" + duct.getType().getColor() + "&]" + duct.getType().getLocalizedName());
|
||||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IBlockFluidDuct {
|
public interface IBlockFluidDuct {
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.hbm.blocks.network;
|
|||||||
|
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.network.TileEntityPylonBase;
|
import com.hbm.tileentity.network.TileEntityPylonBase;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@ -18,31 +17,31 @@ public abstract class PylonBase extends BlockContainer implements ITooltipProvid
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block b, int m) {
|
public void breakBlock(World world, int x, int y, int z, Block b, int m) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te instanceof TileEntityPylonBase) {
|
if(te instanceof TileEntityPylonBase) {
|
||||||
((TileEntityPylonBase)te).disconnectAll();
|
((TileEntityPylonBase)te).disconnectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, x, y, z, b, m);
|
super.breakBlock(world, x, y, z, b, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.network.TileEntityPylonBase;
|
import com.hbm.tileentity.network.TileEntityPylonBase;
|
||||||
import com.hbm.tileentity.network.TileEntityPylonLarge;
|
import com.hbm.tileentity.network.TileEntityPylonLarge;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -17,6 +14,8 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PylonLarge extends BlockDummyable implements ITooltipProvider {
|
public class PylonLarge extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public PylonLarge(Material mat) {
|
public PylonLarge(Material mat) {
|
||||||
@ -25,7 +24,7 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityPylonLarge();
|
return new TileEntityPylonLarge();
|
||||||
return null;
|
return null;
|
||||||
@ -50,19 +49,19 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block b, int m) {
|
public void breakBlock(World world, int x, int y, int z, Block b, int m) {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te instanceof TileEntityPylonBase) {
|
if(te instanceof TileEntityPylonBase) {
|
||||||
((TileEntityPylonBase)te).disconnectAll();
|
((TileEntityPylonBase)te).disconnectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, x, y, z, b, m);
|
super.breakBlock(world, x, y, z, b, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getMetaForCore(World world, int x, int y, int z, EntityPlayer player, int original) {
|
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;
|
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 180.0F + 0.5D) & 3;
|
||||||
|
|
||||||
ForgeDirection dir = ForgeDirection.NORTH;
|
ForgeDirection dir = ForgeDirection.NORTH;
|
||||||
@ -79,10 +78,10 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider {
|
|||||||
if(i == 3) {
|
if(i == 3) {
|
||||||
dir = ForgeDirection.getOrientation(4);
|
dir = ForgeDirection.getOrientation(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir.ordinal() + offset;
|
return dir.ordinal() + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ITooltipProvider;
|
import com.hbm.blocks.ITooltipProvider;
|
||||||
import com.hbm.tileentity.network.TileEntityPylonBase;
|
import com.hbm.tileentity.network.TileEntityPylonBase;
|
||||||
import com.hbm.tileentity.network.TileEntityPylonMedium;
|
import com.hbm.tileentity.network.TileEntityPylonMedium;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -15,6 +12,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PylonMedium extends BlockDummyable implements ITooltipProvider {
|
public class PylonMedium extends BlockDummyable implements ITooltipProvider {
|
||||||
|
|
||||||
public PylonMedium(Material mat) {
|
public PylonMedium(Material mat) {
|
||||||
@ -23,7 +22,7 @@ public class PylonMedium extends BlockDummyable implements ITooltipProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(meta >= 12) return new TileEntityPylonMedium();
|
if(meta >= 12) return new TileEntityPylonMedium();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -50,7 +49,7 @@ public class PylonMedium extends BlockDummyable implements ITooltipProvider {
|
|||||||
if(te instanceof TileEntityPylonBase) ((TileEntityPylonBase)te).disconnectAll();
|
if(te instanceof TileEntityPylonBase) ((TileEntityPylonBase)te).disconnectAll();
|
||||||
super.breakBlock(world, x, y, z, b, m);
|
super.breakBlock(world, x, y, z, b, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hbm.tileentity.network.TileEntityPylon;
|
import com.hbm.tileentity.network.TileEntityPylon;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -11,6 +8,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PylonRedWire extends PylonBase {
|
public class PylonRedWire extends PylonBase {
|
||||||
|
|
||||||
public PylonRedWire(Material material) {
|
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