mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'HbmMods:master' into bob
This commit is contained in:
commit
b4a7d5a197
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = crlf
|
||||
indent_style = tab
|
||||
indent_size = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
max_line_length = off
|
||||
|
||||
[{*.info,*.json,*.mcmeta,*.md,*.cfg,*.yml,*.toml}]
|
||||
tab_width = 2
|
||||
|
||||
[{*.info,*.mcmeta,*.cfg}]
|
||||
end_of_line = lf
|
||||
33
.gitignore
vendored
33
.gitignore
vendored
@ -1,25 +1,28 @@
|
||||
# eclipse
|
||||
eclipse
|
||||
bin
|
||||
*.launch
|
||||
.settings
|
||||
.metadata
|
||||
.classpath
|
||||
.project
|
||||
/eclipse
|
||||
/bin
|
||||
/*.launch
|
||||
/.settings
|
||||
/.metadata
|
||||
/.classpath
|
||||
/.project
|
||||
|
||||
# idea
|
||||
out
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
.idea
|
||||
/out
|
||||
/*.ipr
|
||||
/*.iws
|
||||
/*.iml
|
||||
/.idea
|
||||
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
/build
|
||||
/.gradle
|
||||
|
||||
# vscode
|
||||
/.vscode
|
||||
|
||||
# other
|
||||
run
|
||||
/run
|
||||
|
||||
# CurseForge configuration
|
||||
/curseforge.properties
|
||||
|
||||
@ -30,11 +30,9 @@ This ties together with the previous point - there's no guarantees that your PR
|
||||
|
||||
## I want to help but don't know where to start
|
||||
|
||||
If you want to help the project, consider getting involved with the [wiki](ntm.fandom.com) first. Writing an article is the easiest and quickest way of helping, and requires no programming knowledge. If you do know Java and want to help, consider these places first:
|
||||
If you want to help the project, consider getting involved with the [wiki](https://nucleartech.wiki/) first. Writing an article is the easiest and quickest way of helping, and requires no programming knowledge. If you do know Java and want to help, consider these places first:
|
||||
|
||||
* Localization, i.e. translations in different language are always accepted.
|
||||
* `IConfigurableMachine`, an interface that allows machines to be added to the `hbmMachines.json` config, is still not used by many machines.
|
||||
* F1 Presentations, also known as "Stare" or "Jar Presentations", is a neat system of creating a short movie explaining functionality. All the relevant code can be found in `com.hbm.wiaj`.
|
||||
* Some guns still use the old "bow-style" systems and not `ItemGunBase`.
|
||||
* Many guns don't have any animations whatsoever, just adding a minor recoil would already improve them by a lot.
|
||||
* Adding tooltips to more machines, explaining some of the basics.
|
||||
|
||||
10
README.md
10
README.md
@ -6,6 +6,8 @@
|
||||
|
||||
[Official NTM Wiki](https://nucleartech.wiki/wiki/Main_Page)
|
||||
|
||||
[Bobcat's Blog (the blag)](https://hbmmods.github.io/), you can find lengthy yapping, upcoming features and some secrets here.
|
||||
|
||||
**This is for 1.7.10!** For 1.12, check out these projects:
|
||||
|
||||
* NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases
|
||||
@ -93,12 +95,18 @@ If you want to make some changes to the mod, follow this guide:
|
||||
* Click **Add Standard VM**; in the JRE home, navigate to the directory where the JDK is installed, then click finish and select it.
|
||||
10. Code!
|
||||
|
||||
## Contributing animations
|
||||
Weapon animations in NTM are stored in JSON files, which are used alongside OBJ models to produce high quality animations with reasonable filesizes. Import/Export Blender addons are available for versions 2.79, 3.2, and 4.0 in `tools`, and they should function reasonably well in newer versions as well. See the comments in the header of the export scripts for usage instructions.
|
||||
|
||||
## Compatibility notice
|
||||
NTM has certain behaviors intended to fix vanilla code or to increase compatibility in certain cases where it otherwise would not be possible. These behaviors have the potential of not playing well with other mods, and while no such cases are currently known, here's a list of them.
|
||||
|
||||
### Thermos
|
||||
Thermos servers (along with its forks such as Crucible) have a "performance" feature that causes all tile entity ticking to slow down if there's no player present in the same chunk. For obvious reasons, this will heavily impact machines and cause phantom issues that, not having knowledge of this "performance" feature, are near impossible to diagnose. By default, NTM will crash on servers running the Thermos base code and print a lengthy message informing server owners about this "performance" feature as well as how to fix the issues it causes. The error message is printed in plain English on the top of the crash log, failure to read (as well as understand) it will leave the server inoperable.
|
||||
|
||||
### Shaders
|
||||
Shaders (loaded by either Optifine, Iris or otherwise) will in all likelihood break when a gun is held. This is because guns need to skip vanilla's first person item setup for the rendering, however shaders apparently use the setup step for setting certain GL states, and skipping that will break rendering. [Shader Fixer](https://modrinth.com/mod/shader-fixer) is a mod with various fixes, among which is explicit compatibility for NTM's guns.
|
||||
|
||||
### Optifine
|
||||
One of the most common "performance" mods on 1.7.10, Optifine, achieves an increase in performance by breaking small things in spots that are usually hard to notice, although this can cause severe issues with NTM. A short list of problems, along with some solutions, follows:
|
||||
* Get rid of Optifine and use one of the many [other, less intrusive performance mods](https://gist.github.com/makamys/7cb74cd71d93a4332d2891db2624e17c).
|
||||
@ -108,7 +116,7 @@ One of the most common "performance" mods on 1.7.10, Optifine, achieves an incre
|
||||
### Angelica
|
||||
In older versions, Angelica caused issues regarding model rendering, often times making 3D models transparent. Ever since the switch to VBOs, models work fine. Another issue was blocks with connected textures not rendering at all, but this too was fixed, meaning as of time of writing there are no major incompatibilities known with Angelica. However there a few minor issues that persist, but those can be fixed:
|
||||
* Often times when making a new world, all items appear as white squares. Somehow, scrolling though the NEI pages fixes this permanently
|
||||
* Reeds will render weirdly, this is an incompatibility with the "Compact Vertex Format" feature. Disabling it will make reeds look normal
|
||||
* Reeds will render weirdly, this is an incompatibility with the "Compact Vertex Format" feature. Disabling it will make reeds look normal. Alternatively, reed rendering can be disabled by using `/ntmclient set RENDER_REEDS false`, which works around the issue by not rendering the underwater portion of reeds at all.
|
||||
|
||||
### Skybox chainloader
|
||||
NTM adds a few small things to the skybox using a custom skybox renderer. Minecraft can only have a single skybox renderer loaded, so setting the skybox to the NTM custom one would break compatibility with other mods' skyboxes. To mend this, NTM employs a **chainloader**. This chainloader will detect if a different skybox is loaded, save a reference to that skybox and then use NTM's skybox, which when used will also make sure to run the previous modded skybox renderer. In the event that NTM's skybox were to cause trouble, it can be disabled with the config option `1.31_enableSkyboxes`.
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
## Changed
|
||||
* Changed the multi fluid ID recipe, they now use analog circuits instead of silicon based ones, no longer requiring plastic to make
|
||||
* Blast doors will now pulverize any block that gets in their way during closing
|
||||
* The nuclear and RTG furnaces will be retired, their recipes have been removed but they remain operational for now
|
||||
|
||||
## Fixed
|
||||
* Fixed pumpjack gauges not syncing properly
|
||||
* Fixed some concrete variants not being revertable into uncolored concrete
|
||||
* Fixed the CCGT's steam output breaking as soon as the steam buffer runs full
|
||||
* Fixed crash caused by mobs holding belt-fed guns
|
||||
* Fixed boiler heat input being way too low due to operation order (diffusion was applied AFTER the input heat was capped)
|
||||
@ -1,6 +1,6 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=5061
|
||||
mod_build_number=5224
|
||||
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
@ -11,15 +11,25 @@ credits=HbMinecraft,\
|
||||
\ Alcater (GUI textures, porting),\
|
||||
\ MellowArpeggiation (new animation system, turbine sounds, sound fixes, industrial lights, better particle diodes),\
|
||||
\ Pheo (textures, various machines, models, weapons),\
|
||||
\ Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide, new cyclotron),\
|
||||
\ Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide, new cyclotron, weapon animations),\
|
||||
\ LePeep (coilgun model, BDCL QC),\
|
||||
\ Adam29 (liquid petroleum, ethanol, electric furnace),\
|
||||
\ Pvndols (thorium fuel recipe, gas turbine),\
|
||||
\ JamesH2 (blood mechanics, nitric acid, particle emitter),\
|
||||
\ PastaBaguette (coal horse decal),\
|
||||
\ Doctor17 (russian localization)),\
|
||||
\ Pashtet (russian localization),\
|
||||
\ Bismarck (chinese localization),\
|
||||
\ Creeper-banner (chinese localization),\
|
||||
\ 5467864 (chinese localization),\
|
||||
\ eeeeee0a (chinese localization),\
|
||||
\ hz0909adc (chinese localization),\
|
||||
\ LSKLW (chinese localization),\
|
||||
\ R-Kaenbyou (chinese localization),\
|
||||
\ scp-000000000 (chinese localization),\
|
||||
\ UnnameTokiko (chinese localization),\
|
||||
\ Herobrine 457985 (chinese localization),\
|
||||
\ xxwinhere (chinese localization),\
|
||||
\ Maksymisio (polish localization)\
|
||||
\ el3ctro4ndre (italian localization),\
|
||||
\ Pu-238 (Tom impact effects),\
|
||||
@ -39,6 +49,7 @@ credits=HbMinecraft,\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup),\
|
||||
\ BallOfEnergy1 (OpenComputers integration),\
|
||||
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
|
||||
\ Abel1502 (optimization, crate upgrade recipes, strand caster improvements, varous tweaks),\
|
||||
\ SuperCraftAlex (tooltips)\
|
||||
\ Ice-Arrow (research reactor tweaks),\
|
||||
\ 245tt (anvil GUI improvements),\
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
@ -12,6 +13,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/** If it receives energy, use this */
|
||||
@NotableComments
|
||||
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
|
||||
|
||||
public default long transferPower(long power) {
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -147,7 +148,8 @@ public class Nodespace {
|
||||
if(node != null) popNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NotableComments
|
||||
public static class PowerNode {
|
||||
|
||||
public BlockPos[] positions;
|
||||
|
||||
16
src/main/java/api/hbm/entity/IResistanceProvider.java
Normal file
16
src/main/java/api/hbm/entity/IResistanceProvider.java
Normal file
@ -0,0 +1,16 @@
|
||||
package api.hbm.entity;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
/**
|
||||
* Allows custom entities to specify threshold and resistance values based on incoming damage, type and piercing values, along with whatever other internal stats
|
||||
* the entity has (like glyphid armor). Obviously only works for our own custom entities implementing this, everything else will have to work with the less powerful
|
||||
* (but still very useful) entity stats in the DamageResistanceHandler.
|
||||
*
|
||||
* @author hbm
|
||||
*/
|
||||
public interface IResistanceProvider {
|
||||
|
||||
public float[] getCurrentDTDR(DamageSource damage, float amount, float pierceDT, float pierce);
|
||||
public void onDamageDealt(DamageSource damage, float amount);
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package api.hbm.fluid;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import api.hbm.tile.ILoadedTile;
|
||||
|
||||
@ -2,8 +2,8 @@ package api.hbm.fluid;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
package api.hbm.fluid;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
|
||||
@ -18,18 +15,18 @@ public class PipeNet implements IPipeNet {
|
||||
private FluidType type;
|
||||
private List<IFluidConductor> links = new ArrayList();
|
||||
private HashSet<IFluidConnector> subscribers = new HashSet();
|
||||
|
||||
|
||||
public static List<PipeNet> trackingInstances = null;
|
||||
protected BigInteger totalTransfer = BigInteger.ZERO;
|
||||
public List<String> debug = new ArrayList();
|
||||
|
||||
|
||||
public PipeNet(FluidType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void joinNetworks(IPipeNet network) {
|
||||
|
||||
|
||||
if(network == this)
|
||||
return;
|
||||
|
||||
@ -38,11 +35,11 @@ public class PipeNet implements IPipeNet {
|
||||
this.getLinks().add(conductor);
|
||||
}
|
||||
network.getLinks().clear();
|
||||
|
||||
|
||||
for(IFluidConnector connector : network.getSubscribers()) {
|
||||
this.subscribe(connector);
|
||||
}
|
||||
|
||||
|
||||
network.destroy();
|
||||
}
|
||||
|
||||
@ -58,10 +55,10 @@ public class PipeNet implements IPipeNet {
|
||||
|
||||
@Override
|
||||
public IPipeNet joinLink(IFluidConductor conductor) {
|
||||
|
||||
|
||||
if(conductor.getPipeNet(type) != null)
|
||||
conductor.getPipeNet(type).leaveLink(conductor);
|
||||
|
||||
|
||||
conductor.setPipeNet(type, this);
|
||||
this.links.add(conductor);
|
||||
return this;
|
||||
@ -91,53 +88,54 @@ public class PipeNet implements IPipeNet {
|
||||
@Override
|
||||
public long transferFluid(long fill, int pressure) {
|
||||
|
||||
subscribers.removeIf(x ->
|
||||
subscribers.removeIf(x ->
|
||||
x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid() || !x.isLoaded()
|
||||
);
|
||||
|
||||
|
||||
if(this.subscribers.isEmpty())
|
||||
return fill;
|
||||
|
||||
|
||||
trackingInstances = new ArrayList();
|
||||
trackingInstances.add(this);
|
||||
List<IFluidConnector> subList = new ArrayList(subscribers);
|
||||
return fairTransfer(subList, type, pressure, fill);
|
||||
}
|
||||
|
||||
|
||||
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, int pressure, long fill) {
|
||||
|
||||
|
||||
if(fill <= 0) return 0;
|
||||
|
||||
|
||||
List<Long> weight = new ArrayList();
|
||||
long totalReq = 0;
|
||||
|
||||
|
||||
for(IFluidConnector con : subList) {
|
||||
long req = con.getDemand(type, pressure);
|
||||
weight.add(req);
|
||||
totalReq += req;
|
||||
}
|
||||
|
||||
|
||||
if(totalReq == 0)
|
||||
return fill;
|
||||
|
||||
|
||||
long totalGiven = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < subList.size(); i++) {
|
||||
IFluidConnector con = subList.get(i);
|
||||
long req = weight.get(i);
|
||||
double fraction = (double)req / (double)totalReq;
|
||||
|
||||
|
||||
long given = (long) Math.floor(fraction * fill);
|
||||
|
||||
|
||||
if(given > 0) {
|
||||
|
||||
|
||||
totalGiven += (given - con.transferFluid(type, pressure, given));
|
||||
|
||||
|
||||
if(con instanceof TileEntity) {
|
||||
TileEntity tile = (TileEntity) con;
|
||||
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
|
||||
}
|
||||
|
||||
|
||||
/* debug code
|
||||
if(trackingInstances != null) {
|
||||
for(int j = 0; j < trackingInstances.size(); j++) {
|
||||
PipeNet net = trackingInstances.get(j);
|
||||
@ -146,17 +144,18 @@ public class PipeNet implements IPipeNet {
|
||||
log(net, sdf.format(new Date(System.currentTimeMillis())) + " Sending " + given + "mB to " + conToString(con));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(trackingInstances != null) {
|
||||
|
||||
|
||||
for(int i = 0; i < trackingInstances.size(); i++) {
|
||||
PipeNet net = trackingInstances.get(i);
|
||||
net.totalTransfer = net.totalTransfer.add(BigInteger.valueOf(totalGiven));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return fill - totalGiven;
|
||||
}
|
||||
|
||||
@ -169,10 +168,10 @@ public class PipeNet implements IPipeNet {
|
||||
public void destroy() {
|
||||
this.valid = false;
|
||||
this.subscribers.clear();
|
||||
|
||||
|
||||
for(IFluidConductor con : this.links)
|
||||
con.setPipeNet(type, null);
|
||||
|
||||
|
||||
this.links.clear();
|
||||
}
|
||||
|
||||
@ -185,22 +184,22 @@ public class PipeNet implements IPipeNet {
|
||||
public BigInteger getTotalTransfer() {
|
||||
return this.totalTransfer;
|
||||
}
|
||||
|
||||
|
||||
public static void log(PipeNet net, String msg) {
|
||||
net.debug.add(msg);
|
||||
|
||||
|
||||
while(net.debug.size() > 50) {
|
||||
net.debug.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String conToString(IFluidConnector con) {
|
||||
|
||||
|
||||
if(con instanceof TileEntity) {
|
||||
TileEntity tile = (TileEntity) con;
|
||||
return tile.getClass().getSimpleName() + " @ " + tile.xCoord + "/" + tile.yCoord + "/" + tile.zCoord;
|
||||
}
|
||||
|
||||
|
||||
return "" + con;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
package api.hbm.item;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IButtonReceiver {
|
||||
|
||||
/**
|
||||
* Called in ModEventHandlerClient for any keyboard input related to this item
|
||||
* @param stack
|
||||
* @param player
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleKeyboardInput(ItemStack stack, EntityPlayer player);
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package api.hbm.item;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IClickReceiver {
|
||||
|
||||
/**
|
||||
* Called in ModEventHandlerClient for any mouse input related to this item
|
||||
* @param stack
|
||||
* @param player
|
||||
* @param button
|
||||
* @param state
|
||||
* @return true if the event should be canceled
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean handleMouseInput(ItemStack stack, EntityPlayer player, int button, boolean state);
|
||||
}
|
||||
@ -8,6 +8,7 @@ public interface IRORInteractive extends IRORInfo {
|
||||
public static String EX_NULL = "Exception: Null Command";
|
||||
public static String EX_NAME = "Exception: Multiple Name Separators";
|
||||
|
||||
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are optional. */
|
||||
public Object runRORFunction(String name, String[] params);
|
||||
|
||||
/** Extracts the command name from a full command string */
|
||||
|
||||
@ -2,5 +2,6 @@ package api.hbm.redstoneoverradio;
|
||||
|
||||
public interface IRORValueProvider extends IRORInfo {
|
||||
|
||||
/** Grabs the specified value from this ROR component, operations should not cause any changes with the component itself */
|
||||
public Object provideRORValue(String name);
|
||||
}
|
||||
|
||||
@ -6,17 +6,41 @@ package api.hbm.redstoneoverradio;
|
||||
|
||||
/*
|
||||
|
||||
__ __ __ _______ ________ __ __ __ __ ______ __
|
||||
/_/| /_/\ /_/| /______/\ /_______/| /_/| /_/| /_/|_____ /_/| /_____/| /_/|
|
||||
| || | \\ | || | ___ \\ | ______|/ | ||| || | |/_____| || |___ || | ||
|
||||
| || | \ \\ | || | | \ \\ | ||___ | |/| |/ | ______ || /__| || | ||__
|
||||
| || | |\ \\| || | | \ || | |/__/| \ // | |/_____| || | ___|/ | |/_/|
|
||||
| || | ||\ \| || | | | || | ____|/ > </\ |____ ____|/_ | |/__/| | __|/
|
||||
| || | || \ | || | | / || | ||_____ / _ \/| /_____| |______/| |______|/ | ||
|
||||
| || | || \ || | |___/ // | |/____/| | / \ || |________________|/ | ||
|
||||
|__|/ |__|/ \__|/ |________// |________|/ |__| |__|/ |__|/
|
||||
__ __ __ _________ ________ __ __ __ __ ______ __
|
||||
/_/| /_/\ /_/| /________/\ /_______/| /_/| /_/| /_/|_____ /_/| /_____/| /_/|
|
||||
| || | \\ | || | ___ \ \ | ______|/ | |\_| || | |/_____| || |___ || | ||
|
||||
| || | \ \\ | || | || \ \/ | ||___ | \/_/ |/ | ______ || /__| || | ||__
|
||||
| || | |\ \\| || | || \ || | |/__/| \ // | |/_____| || | ___|/ | |/_/|
|
||||
| || | ||\ \| || | || | || | ____|/ > </\ |____ ____|/_ | |/__/| | __|/
|
||||
| || | || \ | || | ||___/ |/ | ||_____ / __ \/| /_____| |______/| |______|/ | ||
|
||||
| || | || \ || | |/__/ / | |/____/| | /| \ || |________________|/ | ||
|
||||
|__|/ |__|/ \__|/ |_________/ |________|/ |__|/ |__|/ |__|/
|
||||
|
||||
(not AN index, INDEX is just the codename)
|
||||
(also no i did not use an ASCII font generator i spent like half an hour on this)
|
||||
|
||||
INDEX includes Redstone-over-Radio APIs for interacting with ROR torches in ways more complex than simple comparator output,
|
||||
simply put, certain ROR torches may run functions on the ROR component or read more complex values. This means that with the ROR
|
||||
system alone, one can make complex monitoring and logic systems controlling machines via redstone automation.
|
||||
|
||||
INDEX includes:
|
||||
- IRORInfo, an interface that provides a list of all valid functions. This interface should never be implemented directly because
|
||||
it is worthless on its own, rather it is extended by all other ROR API interfaces
|
||||
- IRORValueProvider, a simple interface that returns values based on names, serving as a simple getter. Get operations should never
|
||||
cause changes within the ROR component, and should be kept simple
|
||||
- IRORInteractive, an interface providing functions equivalent to java, usually performing a state change within the component and
|
||||
optionally returning a value
|
||||
|
||||
On the implementation side we can expect:
|
||||
- ROR readers, torches which have a list of named values which are read, as well as frequencies on which these values are broadcasted
|
||||
- ROR controllers, torches which have one frequency and can receive commands with parameters which will be executed on the component
|
||||
- ROR programmers, torches which have a list of frequencies and return frequencies which can receive commands with parameters and
|
||||
then send the return value on the return frequency
|
||||
- ROR logic receivers, torches which can turn signals into redstone based on various factors like arithmetic comparison and string
|
||||
operators like matches, matches not and substring (thanks to vær for taking care of that)
|
||||
|
||||
ROR programmers can indeed do everything that the readers and controllers can, but their added complexity requires more GUI elements
|
||||
which are more time-consuming to set up and limits the amount of command channels available, hence why readers and controllers exist
|
||||
when only a simple solution is required
|
||||
|
||||
*/
|
||||
@ -1,7 +1,6 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
@ -11,7 +10,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBase extends Block {
|
||||
|
||||
|
||||
private boolean beaconable = false;
|
||||
private boolean canSpawn = true;
|
||||
|
||||
@ -22,14 +21,14 @@ public class BlockBase extends Block {
|
||||
public BlockBase(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String name) {
|
||||
super.setBlockName(name);
|
||||
this.setBlockTextureName(RefStrings.MODID + ":" + name);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Daisychainable setter for making the block a beacon base block
|
||||
* @return
|
||||
@ -38,7 +37,7 @@ public class BlockBase extends Block {
|
||||
this.beaconable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public BlockBase noMobSpawn() {
|
||||
this.canSpawn = false;
|
||||
return this;
|
||||
@ -53,7 +52,7 @@ public class BlockBase extends Block {
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
||||
return this.beaconable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the block to air and drops it
|
||||
* @param world
|
||||
@ -62,7 +61,7 @@ public class BlockBase extends Block {
|
||||
* @param z
|
||||
*/
|
||||
public void dismantle(World world, int x, int y, int z) {
|
||||
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
ItemStack itemstack = new ItemStack(this, 1);
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.handler.ThreeInts;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -32,7 +28,11 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight, ICopiable {
|
||||
|
||||
public BlockDummyable(Material mat) {
|
||||
super(mat);
|
||||
@ -49,7 +49,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
public static final int offset = 10;
|
||||
// meta offset from dummy to extra rotation
|
||||
public static final int extra = 6;
|
||||
|
||||
|
||||
/*
|
||||
* An extra integer that can be set before block set operations (such as makeExtra) and intercepted in createNewTileEntity.
|
||||
* This way we can inelegantly add variation to the tiles created even if the metadata would be the same.
|
||||
@ -59,11 +59,11 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
public static int overrideTileMeta = 0;
|
||||
|
||||
public static boolean safeRem = false;
|
||||
|
||||
|
||||
public static void setOverride(int i) {
|
||||
overrideTileMeta = i;
|
||||
}
|
||||
|
||||
|
||||
public static void resetOverride() {
|
||||
overrideTileMeta = 0;
|
||||
}
|
||||
@ -178,7 +178,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
if(i == 3) {
|
||||
dir = ForgeDirection.getOrientation(4);
|
||||
}
|
||||
|
||||
|
||||
dir = getDirModified(dir);
|
||||
|
||||
if(!checkRequirement(world, x, y, z, dir, o)) {
|
||||
@ -220,7 +220,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
lastBlockSet = new BlockPos(x, y, z);
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* A bit more advanced than the dir modifier, but it is important that the resulting direction meta is in the core range.
|
||||
* Using the "extra" metas is technically possible but requires a bit of tinkering, e.g. preventing a recursive loop
|
||||
@ -236,7 +236,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
protected int getMetaForCore(World world, int x, int y, int z, EntityPlayer player, int original) {
|
||||
return original;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allows to modify the general placement direction as if the player had another rotation.
|
||||
* Quite basic due to only having 1 param but it's more meant to fix/limit the amount of directions
|
||||
@ -271,7 +271,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
world.setBlock(x, y, z, this, meta + extra, 3);
|
||||
this.safeRem = false;
|
||||
}
|
||||
|
||||
|
||||
public void removeExtra(World world, int x, int y, int z) {
|
||||
|
||||
if(world.getBlock(x, y, z) != this)
|
||||
@ -309,7 +309,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
// if(pos != null) {
|
||||
|
||||
ForgeDirection d = ForgeDirection.getOrientation(i);
|
||||
|
||||
|
||||
if(world.getBlock(x - d.offsetX, y - d.offsetY, z - d.offsetZ) == this)
|
||||
world.setBlockToAir(x - d.offsetX, y - d.offsetY, z - d.offsetZ);
|
||||
// }
|
||||
@ -384,7 +384,7 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
}
|
||||
|
||||
protected boolean standardOpenBehavior(World world, int x, int y, int z, EntityPlayer player, int id) {
|
||||
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
@ -402,14 +402,14 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
harvesters.set(player);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
harvesters.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called after the block and TE are already gone, so this method is of no use to us.
|
||||
*/
|
||||
@ -418,53 +418,53 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
|
||||
public boolean useDetailedHitbox() {
|
||||
return !bounding.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public List<AxisAlignedBB> bounding = new ArrayList();
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
|
||||
if(!this.useDetailedHitbox()) {
|
||||
super.addCollisionBoxesToList(world, x, y, z, entityBounding, list, entity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
|
||||
x = pos[0];
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
|
||||
|
||||
for(AxisAlignedBB aabb :this.bounding) {
|
||||
AxisAlignedBB boxlet = getAABBRotationOffset(aabb, x + 0.5, y, z + 0.5, ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - this.offset).getRotation(ForgeDirection.UP));
|
||||
|
||||
|
||||
if(entityBounding.intersectsWith(boxlet)) {
|
||||
list.add(boxlet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static AxisAlignedBB getAABBRotationOffset(AxisAlignedBB aabb, double x, double y, double z, ForgeDirection dir) {
|
||||
|
||||
|
||||
AxisAlignedBB newBox = null;
|
||||
|
||||
if(dir == ForgeDirection.NORTH) newBox = AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
|
||||
if(dir == ForgeDirection.EAST) newBox = AxisAlignedBB.getBoundingBox(-aabb.maxZ, aabb.minY, aabb.minX, -aabb.minZ, aabb.maxY, aabb.maxX);
|
||||
if(dir == ForgeDirection.SOUTH) newBox = AxisAlignedBB.getBoundingBox(-aabb.maxX, aabb.minY, -aabb.maxZ, -aabb.minX, aabb.maxY, -aabb.minZ);
|
||||
if(dir == ForgeDirection.WEST) newBox = AxisAlignedBB.getBoundingBox(aabb.minZ, aabb.minY, -aabb.maxX, aabb.maxZ, aabb.maxY, -aabb.minX);
|
||||
|
||||
|
||||
if(newBox != null) {
|
||||
newBox.offset(x, y, z);
|
||||
return newBox;
|
||||
}
|
||||
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5);
|
||||
}
|
||||
|
||||
@ -476,35 +476,62 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.999F, 1.0F); //for some fucking reason setting maxY to something that isn't 1 magically fixes item collisions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldDrawHighlight(World world, int x, int y, int z) {
|
||||
return !this.bounding.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z) {
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
|
||||
|
||||
x = pos[0];
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
|
||||
|
||||
EntityPlayer player = event.player;
|
||||
float interp = event.partialTicks;
|
||||
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp;
|
||||
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp;
|
||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||
float exp = 0.002F;
|
||||
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
ICustomBlockHighlight.setup();
|
||||
for(AxisAlignedBB aabb : this.bounding) event.context.drawOutlinedBoundingBox(getAABBRotationOffset(aabb.expand(exp, exp, exp), 0, 0, 0, ForgeDirection.getOrientation(meta - offset).getRotation(ForgeDirection.UP)).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1);
|
||||
ICustomBlockHighlight.cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
int[] pos = findCore(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if (tile instanceof ICopiable)
|
||||
return ((ICopiable) tile).getSettings(world, pos[0], pos[1], pos[2]);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
int[] pos = findCore(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if (tile instanceof ICopiable)
|
||||
((ICopiable) tile).pasteSettings(nbt, index, world, player, pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] infoForDisplay(World world, int x, int y, int z) {
|
||||
int[] pos = findCore(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if (tile instanceof ICopiable)
|
||||
return ((ICopiable) tile).infoForDisplay(world, x, y, z);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -11,6 +8,8 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class BlockEnumMulti extends BlockMulti {
|
||||
|
||||
public Class<? extends Enum> theEnum;
|
||||
@ -23,17 +22,17 @@ public class BlockEnumMulti extends BlockMulti {
|
||||
this.multiName = multiName;
|
||||
this.multiTexture = multiTexture;
|
||||
}
|
||||
|
||||
|
||||
protected IIcon[] icons;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
|
||||
|
||||
if(multiTexture) {
|
||||
Enum[] enums = theEnum.getEnumConstants();
|
||||
this.icons = new IIcon[enums.length];
|
||||
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
Enum num = enums[i];
|
||||
this.icons[i] = reg.registerIcon(this.getTextureMultiName(num));
|
||||
@ -42,25 +41,25 @@ public class BlockEnumMulti extends BlockMulti {
|
||||
this.blockIcon = reg.registerIcon(this.getTextureName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
|
||||
|
||||
if(this.multiName) {
|
||||
Enum num = EnumUtil.grabEnumSafely(this.theEnum, stack.getItemDamage());
|
||||
return getUnlocalizedMultiName(num);
|
||||
}
|
||||
|
||||
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
|
||||
public String getTextureMultiName(Enum num) {
|
||||
return this.getTextureName() + "." + num.name().toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
|
||||
public String getUnlocalizedMultiName(Enum num) {
|
||||
return super.getUnlocalizedName() + "." + num.name().toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.entity.item.EntityFallingBlockNT;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -14,6 +11,8 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFallingNT extends Block {
|
||||
|
||||
public static boolean fallInstantly;
|
||||
@ -45,7 +44,7 @@ public class BlockFallingNT extends Block {
|
||||
}
|
||||
|
||||
protected void fall(World world, int x, int y, int z) {
|
||||
|
||||
|
||||
if(canFallThrough(world, x, y - 1, z) && y >= 0) {
|
||||
byte range = 32;
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -9,6 +7,8 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BlockMulti extends BlockBase implements IBlockMulti {
|
||||
|
||||
public BlockMulti() {
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -12,8 +9,11 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockRemap extends Block implements ILookOverlay {
|
||||
|
||||
|
||||
public Block remapBlock;
|
||||
public int remapMeta;
|
||||
|
||||
@ -29,7 +29,7 @@ public class BlockRemap extends Block implements ILookOverlay {
|
||||
public IIcon getIcon(int meta, int side) {
|
||||
return this.remapBlock.getIcon(meta, side);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int fortune) {
|
||||
return this.remapBlock.getItemDropped(meta, rand, fortune);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAnalyzable {
|
||||
|
||||
public List<String> getDebugInfo(World world, int x, int y, int z);
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public interface ICustomBlockHighlight {
|
||||
|
||||
@SideOnly(Side.CLIENT) public boolean shouldDrawHighlight(World world, int x, int y, int z);
|
||||
@SideOnly(Side.CLIENT) public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z);
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void setup() {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@ -22,7 +21,7 @@ public interface ICustomBlockHighlight {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(false);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void cleanup() {
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -11,6 +7,9 @@ import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ILookOverlay {
|
||||
|
||||
@ -33,14 +32,14 @@ public interface ILookOverlay {
|
||||
|
||||
try {
|
||||
for(String line : text) {
|
||||
|
||||
|
||||
int color = 0xFFFFFF;
|
||||
if(line.startsWith("&[")) {
|
||||
int end = line.lastIndexOf("&]");
|
||||
color = Integer.parseInt(line.substring(2, end));
|
||||
line = line.substring(end + 2);
|
||||
}
|
||||
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(line, pX, pZ, color);
|
||||
pZ += 10;
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPersistentInfoProvider {
|
||||
|
||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext);
|
||||
|
||||
@ -1,23 +1,21 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITooltipProvider {
|
||||
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext);
|
||||
|
||||
public default void addStandardInfo(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
for(String s : I18nUtil.resolveKeyArray(((Block)this).getUnlocalizedName() + ".desc")) list.add(EnumChatFormatting.YELLOW + s);
|
||||
} else {
|
||||
@ -26,7 +24,7 @@ public interface ITooltipProvider {
|
||||
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public default EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,9 @@ import java.util.List;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -22,10 +25,13 @@ public class BlockChargeC4 extends BlockChargeBase {
|
||||
world.setBlockToAir(x, y, z);
|
||||
safe = false;
|
||||
|
||||
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F).makeStandard();
|
||||
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F);
|
||||
xnt.setBlockAllocator(new BlockAllocatorStandard(32));
|
||||
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop());
|
||||
xnt.setEntityProcessor(new EntityProcessorStandard());
|
||||
xnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
xnt.explode();
|
||||
ExplosionCreator.composeEffectSmall(world, x + 0.5, y + 1, z + 0.5);
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.particle.helper.ExplosionSmallCreator;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.world.World;
|
||||
@ -17,7 +17,7 @@ public class BlockChargeDynamite extends BlockChargeBase {
|
||||
safe = false;
|
||||
ExplosionNT exp = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 4F);
|
||||
exp.explode();
|
||||
ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 20);
|
||||
ExplosionSmallCreator.composeEffect(world, x + 0.5, y + 0.5, z + 0.5, 15, 3F, 1.25F);
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ package com.hbm.blocks.bomb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.particle.helper.ExplosionSmallCreator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -23,7 +23,7 @@ public class BlockChargeMiner extends BlockChargeBase {
|
||||
ExplosionNT exp = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 4F);
|
||||
exp.addAllAttrib(ExAttrib.NOHURT, ExAttrib.ALLDROP);
|
||||
exp.explode();
|
||||
ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 20);
|
||||
ExplosionSmallCreator.composeEffect(world, x + 0.5, y + 0.5, z + 0.5, 15, 3F, 1.25F);
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -27,8 +27,8 @@ public class BlockChargeSemtex extends BlockChargeBase {
|
||||
xnt.setBlockProcessor(new BlockProcessorStandard()
|
||||
.setAllDrop()
|
||||
.setFortune(3));
|
||||
xnt.setSFX(new ExplosionEffectStandard());
|
||||
xnt.explode();
|
||||
ExplosionCreator.composeEffectSmall(world, x + 0.5, y + 1, z + 0.5);
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.logic.EntityBalefire;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.bomb.TileEntityCrashedBomb;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
|
||||
@ -9,8 +9,8 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.projectile.EntityShrapnel;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -5,10 +5,10 @@ import com.hbm.config.BombConfig;
|
||||
import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.item.EntityTNTPrimedBase;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK5;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.particle.helper.ExplosionCreator;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -65,7 +65,7 @@ public class ExplosiveCharge extends BlockDetonatable implements IBomb, IDetConn
|
||||
}
|
||||
if(this == ModBlocks.det_charge) {
|
||||
new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 15).overrideResolution(64).explode();
|
||||
ExplosionLarge.spawnParticles(world, x, y, z, ExplosionLarge.cloudFunction(15));
|
||||
ExplosionCreator.composeEffectStandard(world, x + 0.5, y + 1, z + 0.5);
|
||||
}
|
||||
if(this == ModBlocks.det_nuke) {
|
||||
world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5));
|
||||
|
||||
@ -5,6 +5,12 @@ import java.util.Random;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNukeSmall;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.bomb.TileEntityLandmine;
|
||||
@ -31,7 +37,6 @@ public class Landmine extends BlockContainer implements IBomb {
|
||||
|
||||
public Landmine(Material mat, double range, double height) {
|
||||
super(mat);
|
||||
|
||||
this.range = range;
|
||||
this.height = height;
|
||||
}
|
||||
@ -41,20 +46,9 @@ public class Landmine extends BlockContainer implements IBomb {
|
||||
return new TileEntityLandmine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override public int getRenderType() { return -1; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random rand, int j) {
|
||||
@ -64,14 +58,10 @@ public class Landmine extends BlockContainer implements IBomb {
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
float f = 0.0625F;
|
||||
if(this == ModBlocks.mine_ap)
|
||||
this.setBlockBounds(6 * f, 0.0F, 6 * f, 10 * f, 2 * f, 10 * f);
|
||||
if(this == ModBlocks.mine_he)
|
||||
this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f);
|
||||
if(this == ModBlocks.mine_shrap)
|
||||
this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f);
|
||||
if(this == ModBlocks.mine_fat)
|
||||
this.setBlockBounds(5 * f, 0.0F, 4 * f, 11 * f, 6 * f, 12 * f);
|
||||
if(this == ModBlocks.mine_ap) this.setBlockBounds(5 * f, 0.0F, 5 * f, 11 * f, 1 * f, 11 * f);
|
||||
if(this == ModBlocks.mine_he) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f);
|
||||
if(this == ModBlocks.mine_shrap) this.setBlockBounds(5 * f, 0.0F, 5 * f, 11 * f, 1 * f, 11 * f);
|
||||
if(this == ModBlocks.mine_fat) this.setBlockBounds(5 * f, 0.0F, 4 * f, 11 * f, 6 * f, 12 * f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -147,12 +137,26 @@ public class Landmine extends BlockContainer implements IBomb {
|
||||
Landmine.safeMode = false;
|
||||
|
||||
if(this == ModBlocks.mine_ap) {
|
||||
world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 2.5F, false, false);
|
||||
ExplosionVNT vnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 3F);
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(0.5, 10F).setupPiercing(5F, 0.2F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.setSFX(new ExplosionEffectWeapon(5, 1F, 0.5F));
|
||||
vnt.explode();
|
||||
} else if(this == ModBlocks.mine_he) {
|
||||
ExplosionLarge.explode(world, x + 0.5, y + 0.5, z + 0.5, 3F, true, false, false);
|
||||
world.newExplosion(null, x + 0.5, y + 2, z + 0.5, 15F, false, false);
|
||||
ExplosionVNT vnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 4F);
|
||||
vnt.setBlockAllocator(new BlockAllocatorStandard());
|
||||
vnt.setBlockProcessor(new BlockProcessorStandard());
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 35).setupPiercing(15F, 0.2F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.setSFX(new ExplosionEffectWeapon(15, 3.5F, 1.25F));
|
||||
vnt.explode();
|
||||
} else if(this == ModBlocks.mine_shrap) {
|
||||
ExplosionLarge.explode(world, x + 0.5, y + 0.5, z + 0.5, 1, true, false, false);
|
||||
ExplosionVNT vnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 3F);
|
||||
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(0.5, 7.5F));
|
||||
vnt.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
vnt.setSFX(new ExplosionEffectWeapon(5, 1F, 0.5F));
|
||||
vnt.explode();
|
||||
|
||||
ExplosionLarge.spawnShrapnelShower(world, x + 0.5, y + 0.5, z + 0.5, 0, 1D, 0, 45, 0.2D);
|
||||
ExplosionLarge.spawnShrapnels(world, x + 0.5, y + 0.5, z + 0.5, 5);
|
||||
} else if(this == ModBlocks.mine_fat) {
|
||||
@ -162,5 +166,4 @@ public class Landmine extends BlockContainer implements IBomb {
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.blocks.generic;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.items.ItemAmmoEnums.*;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -69,27 +69,22 @@ public class BlockAmmoCrate extends Block {
|
||||
|
||||
ret.add(new ItemStack(ModItems.cap_nuka, 12 + rand.nextInt(21)));
|
||||
ret.add(new ItemStack(ModItems.syringe_metal_stimpak, 1 + rand.nextInt(3)));
|
||||
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.P9_SP.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.P9_FMJ.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.M357_SP.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.M357_FMJ.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.M44_SP.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.M44_FMJ.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.R556_SP.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.R556_FMJ.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.R762_SP.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.R762_FMJ.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.G12.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 16 + rand.nextInt(17), EnumAmmo.G12_SLUG.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 2 + rand.nextInt(3), EnumAmmo.G40_HE.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_standard, 2 + rand.nextInt(3), EnumAmmo.ROCKET_HE.ordinal()));
|
||||
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_22lr, 16 + rand.nextInt(17)));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_9mm, 6 + rand.nextInt(13)));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_12gauge, 6 + rand.nextInt(4)));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_20gauge, 3 + rand.nextInt(4)));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_357, 10 + rand.nextInt(11)));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_357, 12 + rand.nextInt(15), Ammo357Magnum.IRON.ordinal()));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_50bmg, 2 + rand.nextInt(7)));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_rocket, 1));
|
||||
if(rand.nextBoolean()) ret.add(new ItemStack(ModItems.ammo_grenade, 1 + rand.nextInt(2)));
|
||||
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_12gauge, 3, Ammo12Gauge.INCENDIARY.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_20gauge, 3, Ammo20Gauge.INCENDIARY.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_20gauge, 3, Ammo20Gauge.CAUSTIC.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_20gauge, 3, Ammo20Gauge.FLECHETTE.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_9mm, 7, Ammo9mm.AP.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_rocket, 1, AmmoRocket.INCENDIARY.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_rocket, 1, AmmoRocket.SLEEK.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_grenade, 1, AmmoGrenade.HE.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_grenade, 1, AmmoGrenade.INCENDIARY.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.ammo_grenade, 1, AmmoGrenade.SLEEK.ordinal()));
|
||||
if(rand.nextInt(10) == 0) ret.add(new ItemStack(ModItems.syringe_metal_super, 2));
|
||||
|
||||
return ret;
|
||||
|
||||
@ -9,7 +9,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@ -57,22 +56,22 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
public Item getItemDropped(int i, Random rand, int j) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
|
||||
|
||||
TileEntityBobble entity = (TileEntityBobble) world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(entity != null) {
|
||||
return new ItemStack(this, 1, entity.type.ordinal());
|
||||
}
|
||||
|
||||
|
||||
return super.getPickBlock(target, world, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
harvesters.set(player);
|
||||
if(!world.isRemote) {
|
||||
@ -88,7 +87,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
harvesters.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
@ -97,11 +96,11 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(world.isRemote) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -110,7 +109,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
|
||||
|
||||
for(int i = 1; i < BobbleType.values().length; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
@ -119,12 +118,12 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int meta = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
|
||||
|
||||
TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(x, y, z);
|
||||
bobble.type = BobbleType.values()[Math.abs(stack.getItemDamage()) % BobbleType.values().length];
|
||||
bobble.markDirty();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
float f = 0.0625F;
|
||||
@ -143,7 +142,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
}
|
||||
|
||||
public static class TileEntityBobble extends TileEntity {
|
||||
|
||||
|
||||
public BobbleType type = BobbleType.NONE;
|
||||
|
||||
@Override
|
||||
@ -157,7 +156,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
@ -175,9 +174,9 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
nbt.setByte("type", (byte) type.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static enum BobbleType {
|
||||
|
||||
|
||||
NONE( "null", "null", null, null, false, ScrapType.BOARD_BLANK),
|
||||
STRENGTH( "Strength", "Strength", null, "It's essential to give your arguments impact.", false, ScrapType.BRIDGE_BIOS),
|
||||
PERCEPTION( "Perception", "Perception", null, "Only through observation will you perceive weakness.", false, ScrapType.BRIDGE_NORTH),
|
||||
@ -199,7 +198,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
NOS( "Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true, ScrapType.BOARD_TRANSISTOR),
|
||||
DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC),
|
||||
CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK),
|
||||
MICROWAVE( "Microwave", "Microwave", "OC Compatibility", "they call me the food heater", true, ScrapType.BOARD_CONVERTER),
|
||||
MICROWAVE( "Microwave", "Microwave", "OC Compatibility and massive RBMK/packet optimizations", "they call me the food heater$john optimization", true, ScrapType.BOARD_CONVERTER),
|
||||
PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CARD_BOARD),
|
||||
MELLOW( "MELLOWARPEGGIATION", "Mellow", "Industrial lighting, animation tools", "Make something cool now, ask for permission later.", true, ScrapType.CARD_PROCESSOR);
|
||||
|
||||
@ -209,7 +208,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
public String inscription; //the flavor text
|
||||
public boolean skinLayers;
|
||||
public ScrapType scrap;
|
||||
|
||||
|
||||
private BobbleType(String name, String label, String contribution, String inscription, boolean layers, ScrapType scrap) {
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
@ -227,7 +226,7 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIScreenBobble((TileEntityBobble) world.getTileEntity(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,20 +3,12 @@ package com.hbm.blocks.generic;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.tool.ItemToolAbility;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockCoalOil extends Block {
|
||||
|
||||
@ -24,19 +16,6 @@ public class BlockCoalOil extends Block {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
Block n = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
|
||||
if(n == ModBlocks.ore_coal_oil_burning || n == ModBlocks.balefire || n == Blocks.fire || n.getMaterial() == Material.lava) {
|
||||
world.scheduleBlockUpdate(x, y, z, this, world.rand.nextInt(20) + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
world.setBlock(x, y, z, ModBlocks.ore_coal_oil_burning);
|
||||
@ -51,58 +30,4 @@ public class BlockCoalOil extends Block {
|
||||
public int quantityDropped(Random rand) {
|
||||
return 2 + rand.nextInt(2);
|
||||
}
|
||||
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||
|
||||
if(doesToolIgnite(player)) {
|
||||
if(world.rand.nextInt(10) == 0)
|
||||
world.setBlock(x, y, z, Blocks.fire);
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
|
||||
if(!world.isRemote)
|
||||
return;
|
||||
|
||||
if(doesToolIgnite(player)) {
|
||||
|
||||
Random rand = world.rand;
|
||||
for(int i = 0; i < 15; i++) {
|
||||
Vec3 vec = Vec3.createVectorHelper(1, 0, 0);
|
||||
vec.rotateAroundZ((float)(Math.PI * rand.nextDouble() * 2D));
|
||||
vec.rotateAroundY((float)(Math.PI * rand.nextDouble() * 2D));
|
||||
|
||||
double dX = vec.xCoord;
|
||||
double dY = vec.yCoord;
|
||||
double dZ = vec.zCoord;
|
||||
|
||||
if(Math.abs(dX) > 1)
|
||||
dX /= Math.abs(dX);
|
||||
if(Math.abs(dY) > 1)
|
||||
dY /= Math.abs(dY);
|
||||
if(Math.abs(dX) > 1)
|
||||
dZ /= Math.abs(dZ);
|
||||
|
||||
world.spawnParticle("flame", x + 0.5 + dX * 0.75, y + 0.5 + dY * 0.75, z + 0.5 + dZ * 0.75, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||
world.setBlock(x, y, z, Blocks.fire);
|
||||
}
|
||||
|
||||
private boolean doesToolIgnite(EntityPlayer player) {
|
||||
|
||||
if(player.getHeldItem() == null)
|
||||
return false;
|
||||
|
||||
if(!(player.getHeldItem().getItem() instanceof ItemTool || player.getHeldItem().getItem() instanceof ItemToolAbility))
|
||||
return false;
|
||||
|
||||
ItemTool tool = (ItemTool) player.getHeldItem().getItem();
|
||||
|
||||
return tool.func_150913_i() != ToolMaterial.WOOD;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ItemAmmoEnums.Ammo44Magnum;
|
||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import net.minecraft.block.BlockFalling;
|
||||
@ -52,18 +52,6 @@ public class BlockCrate extends BlockFalling {
|
||||
// Supply Crate
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.syringe_metal_stimpak, 10);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.syringe_antidote, 5);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_revolver_iron, 9);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_revolver, 7);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_revolver_gold, 4);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_revolver_lead, 6);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_revolver_cursed, 5);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_rpg, 5);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_fatman, 1);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_mp40, 7);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_uzi, 7);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_uboinik, 7);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_lever_action, 5);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.clip_bolt_action, 5);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.grenade_generic, 8);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.grenade_strong, 6);
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.grenade_mk2, 4);
|
||||
@ -71,21 +59,13 @@ public class BlockCrate extends BlockFalling {
|
||||
BlockCrate.addToListWithWeight(crateList, ModItems.ammo_container, 2);
|
||||
|
||||
// Weapon Crate
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_revolver, 9);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_revolver_gold, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_revolver_cursed, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_calamity, 3);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_rpg, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_karl, 4);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_panzerschreck, 6);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_hk69, 8);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_stinger, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_mp40, 9);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_uzi, 6);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_uzi_silencer, 5);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_uboinik, 8);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_lever_action, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_bolt_action, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_light_revolver, 10);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_maresleg, 7);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_heavy_revolver, 5);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_greasegun, 5);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_liberator, 2);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_flaregun, 8);
|
||||
BlockCrate.addToListWithWeight(weaponList, ModItems.gun_panzerschreck, 1);
|
||||
|
||||
// Lead Crate
|
||||
BlockCrate.addToListWithWeight(leadList, ModItems.ingot_uranium, 10);
|
||||
@ -144,12 +124,12 @@ public class BlockCrate extends BlockFalling {
|
||||
|
||||
// Red Crate
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.mysteryshovel, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.gun_revolver_pip, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.gun_revolver_blackjack, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.gun_revolver_silver, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.ammo_44.stackFromEnum(Ammo44Magnum.PIP), 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.ammo_44.stackFromEnum(Ammo44Magnum.BJ), 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.ammo_44.stackFromEnum(Ammo44Magnum.SILVER), 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.gun_heavy_revolver_lilmac, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.gun_autoshotgun_sexy, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.gun_maresleg_broken, 1);
|
||||
BlockCrate.addToListWithWeight(redList, new ItemStack(ModItems.ammo_secret, 1, EnumAmmoSecret.M44_EQUESTRIAN.ordinal()), 1);
|
||||
BlockCrate.addToListWithWeight(redList, new ItemStack(ModItems.ammo_secret, 1, EnumAmmoSecret.G12_EQUESTRIAN.ordinal()), 1);
|
||||
BlockCrate.addToListWithWeight(redList, new ItemStack(ModItems.ammo_secret, 1, EnumAmmoSecret.BMG50_EQUESTRIAN.ordinal()), 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.battery_spark, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.bottle_sparkle, 1);
|
||||
BlockCrate.addToListWithWeight(redList, ModItems.bottle_rad, 1);
|
||||
|
||||
@ -135,7 +135,7 @@ public class BlockDynamicSlag extends BlockContainer {
|
||||
TileEntitySlag self = (TileEntitySlag) s;
|
||||
|
||||
/* Flow down */
|
||||
if(world.getBlock(x, y - 1, z).isReplaceable(world, x, y - 1, z)) {
|
||||
if(world.getBlock(x, y - 1, z).isReplaceable(world, x, y - 1, z) && y > 0) {
|
||||
world.setBlock(x, y - 1, z, ModBlocks.slag);
|
||||
TileEntitySlag tile = (TileEntitySlag) Compat.getTileStandard(world, x, y - 1, z);
|
||||
tile.mat = self.mat;
|
||||
|
||||
@ -4,15 +4,15 @@ import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
@ -41,7 +41,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityEmitter();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
@ -56,12 +56,12 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) {
|
||||
|
||||
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
|
||||
|
||||
TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(player.getHeldItem() != null) {
|
||||
|
||||
if(player.getHeldItem().getItem() instanceof ItemDye) {
|
||||
@ -72,7 +72,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -80,31 +80,31 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
TileEntityEmitter te = (TileEntityEmitter)world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(tool == ToolType.SCREWDRIVER) {
|
||||
te.girth += 0.125F;
|
||||
te.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(tool == ToolType.DEFUSER) {
|
||||
te.girth -= 0.125F;
|
||||
if(te.girth < 0.125F) te.girth = 0.125F;
|
||||
te.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(tool == ToolType.HAND_DRILL) {
|
||||
te.effect = (te.effect + 1) % te.effectCount;
|
||||
te.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TileEntityEmitter extends TileEntity implements INBTPacketReceiver {
|
||||
|
||||
public static class TileEntityEmitter extends TileEntityLoadedBase {
|
||||
|
||||
public static final int range = 100;
|
||||
public int color;
|
||||
public int beam;
|
||||
@ -114,39 +114,39 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
for(int i = 1; i <= range; i++) {
|
||||
|
||||
|
||||
beam = i;
|
||||
|
||||
|
||||
int x = xCoord + dir.offsetX * i;
|
||||
int y = yCoord + dir.offsetY * i;
|
||||
int z = zCoord + dir.offsetZ * i;
|
||||
|
||||
|
||||
Block b = worldObj.getBlock(x, y, z);
|
||||
if(b.isBlockSolid(worldObj, x, y, z, dir.ordinal())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(effect == 4 && beam > 0) {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
double x = (int) (xCoord + dir.offsetX * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
||||
double y = (int) (yCoord + dir.offsetY * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
||||
double z = (int) (zCoord + dir.offsetZ * (worldObj.getTotalWorldTime() / 5L) % beam) + 0.5;
|
||||
|
||||
|
||||
int prevColor = color;
|
||||
if(color == 0) {
|
||||
color = Color.HSBtoRGB(worldObj.getTotalWorldTime() / 50.0F, 0.5F, 0.25F) & 16777215;
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "plasmablast");
|
||||
data.setFloat("r", ((float)((color & 0xff0000) >> 16)) / 256F);
|
||||
@ -168,20 +168,16 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
data.setFloat("pitch", -90);
|
||||
data.setFloat("yaw", 90);
|
||||
}
|
||||
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z),
|
||||
new TargetPoint(worldObj.provider.dimensionId, x, y, z, 100));
|
||||
|
||||
|
||||
color = prevColor;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("beam", this.beam);
|
||||
data.setInteger("color", this.color);
|
||||
data.setFloat("girth", this.girth);
|
||||
data.setInteger("effect", this.effect);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
||||
|
||||
networkPackNT(150);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +187,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
@ -212,7 +208,7 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
nbt.setFloat("girth", this.girth);
|
||||
nbt.setInteger("effect", this.effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
@ -225,11 +221,19 @@ public class BlockEmitter extends BlockContainer implements IToolable, ITooltipP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.beam = nbt.getInteger("beam");
|
||||
this.color = nbt.getInteger("color");
|
||||
this.girth = nbt.getFloat("girth");
|
||||
this.effect = nbt.getInteger("effect");
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(this.beam);
|
||||
buf.writeInt(this.color);
|
||||
buf.writeFloat(this.girth);
|
||||
buf.writeInt(this.effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.beam = buf.readInt();
|
||||
this.color = buf.readInt();
|
||||
this.girth = buf.readFloat();
|
||||
this.effect = buf.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ public class BlockGlyphid extends Block implements IBlockMulti {
|
||||
|
||||
public IIcon[] iconsStandard = new IIcon[2];
|
||||
public IIcon[] iconsInfested = new IIcon[2];
|
||||
public IIcon[] iconsRad = new IIcon[2];
|
||||
|
||||
public BlockGlyphid(Material mat) {
|
||||
super(mat);
|
||||
@ -57,16 +58,19 @@ public class BlockGlyphid extends Block implements IBlockMulti {
|
||||
iconsStandard[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_alt");
|
||||
iconsInfested[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_infested");
|
||||
iconsInfested[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_infested_alt");
|
||||
iconsRad[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_rad");
|
||||
iconsRad[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_rad_alt");
|
||||
}
|
||||
|
||||
protected IIcon[] getIconArray(int meta) {
|
||||
if(meta == 1) return this.iconsInfested;
|
||||
if(meta == 2) return this.iconsRad;
|
||||
return this.iconsStandard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubCount() {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -38,7 +38,7 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
|
||||
|
||||
public IIcon[] icons = new IIcon[2];
|
||||
public IIcon[] icons = new IIcon[3];
|
||||
|
||||
public BlockGlyphidSpawner(Material mat) {
|
||||
super(mat);
|
||||
@ -61,11 +61,12 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
icons[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_alt");
|
||||
icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_infested");
|
||||
icons[2] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_rad");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubCount() {
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,15 +123,16 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
|
||||
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 5, yCoord + 1, zCoord - 5, xCoord + 6, yCoord + 7, zCoord + 6));
|
||||
float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT);
|
||||
|
||||
if(list.size() <= 3) {
|
||||
int subtype = this.getBlockMetadata();
|
||||
if(list.size() <= 3 || subtype == EntityGlyphid.TYPE_RADIOACTIVE) {
|
||||
|
||||
ArrayList<EntityGlyphid> currentSwarm = createSwarm(soot, this.getBlockMetadata());
|
||||
ArrayList<EntityGlyphid> currentSwarm = createSwarm(soot, subtype);
|
||||
|
||||
for(EntityGlyphid glyphid : currentSwarm) {
|
||||
trySpawnEntity(glyphid);
|
||||
}
|
||||
|
||||
if(!initialSpawn && worldObj.rand.nextInt(MobConfig.scoutSwarmSpawnChance + 1) == 0 && soot >= MobConfig.scoutThreshold) {
|
||||
if(!initialSpawn && worldObj.rand.nextInt(MobConfig.scoutSwarmSpawnChance + 1) == 0 && soot >= MobConfig.scoutThreshold && subtype != EntityGlyphid.TYPE_RADIOACTIVE) {
|
||||
EntityGlyphidScout scout = new EntityGlyphidScout(worldObj);
|
||||
if(this.getBlockMetadata() == 1) scout.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED);
|
||||
trySpawnEntity(scout);
|
||||
@ -168,6 +170,7 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
|
||||
if(soot >= chance[2] && rand.nextInt(100) <= adjustedChance) {
|
||||
EntityGlyphid entity = glyphid.getKey().apply(worldObj);
|
||||
if(meta == 1) entity.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED);
|
||||
if(meta == 2) entity.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_RADIOACTIVE);
|
||||
currentSpawns.add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
127
src/main/java/com/hbm/blocks/generic/BlockHangingVine.java
Normal file
127
src/main/java/com/hbm/blocks/generic/BlockHangingVine.java
Normal file
@ -0,0 +1,127 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockHangingVine extends Block implements IShearable {
|
||||
|
||||
public BlockHangingVine(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
entity.motionX *= 0.5;
|
||||
entity.motionY *= 0.5;
|
||||
entity.motionZ *= 0.5;
|
||||
entity.fallDistance = 0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||
return this.canBlockStay(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, int x, int y, int z) {
|
||||
Block b = world.getBlock(x, y + 1, z);
|
||||
return b.isSideSolid(world, x, y + 1, z, ForgeDirection.UP) || b == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
this.checkAndDropBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, int x, int y, int z) {
|
||||
if(!this.canBlockStay(world, x, y, z)) {
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected boolean canSilkHarvest() { return true; }
|
||||
|
||||
@Override
|
||||
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(new ItemStack(this)); //placeholder
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconItem;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconGround; //when touching a solid face below
|
||||
@SideOnly(Side.CLIENT) public IIcon iconHang; //when hanging mid-air
|
||||
@SideOnly(Side.CLIENT) public IIcon iconGlow; //regular phosphor
|
||||
@SideOnly(Side.CLIENT) public IIcon iconHangGlow; //phosphor in different position when hanging for variety
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
this.iconItem = reg.registerIcon(RefStrings.MODID + ":vine_phosphor_item");
|
||||
this.blockIcon = reg.registerIcon(RefStrings.MODID + ":vine_phosphor");
|
||||
this.iconGround = reg.registerIcon(RefStrings.MODID + ":vine_phosphor_ground");
|
||||
this.iconHang = reg.registerIcon(RefStrings.MODID + ":vine_phosphor_hang");
|
||||
this.iconGlow = reg.registerIcon(RefStrings.MODID + ":vine_phosphor_spots");
|
||||
this.iconHangGlow = reg.registerIcon(RefStrings.MODID + ":vine_phosphor_spots_hang");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, boolean pass) {
|
||||
Block b = world.getBlock(x, y - 1, z);
|
||||
|
||||
if(!pass)
|
||||
return b.isSideSolid(world, x, y, z, ForgeDirection.UP) ? iconGround : b == this ? blockIcon : iconHang;
|
||||
else
|
||||
return b.isAir(world, x, y, z) ? iconHangGlow : iconGlow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.iconItem;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
}
|
||||
@ -108,6 +108,14 @@ public class BlockKeyhole extends BlockStone {
|
||||
}
|
||||
}
|
||||
|
||||
if(world.rand.nextInt(1) == 0) {
|
||||
int r = world.rand.nextInt(4);
|
||||
if(r == 0) world.setBlock(x + width, y + 2, z, ModBlocks.stone_keyhole_meta, 4, 3);
|
||||
if(r == 1) world.setBlock(x - width, y + 2, z, ModBlocks.stone_keyhole_meta, 5, 3);
|
||||
if(r == 2) world.setBlock(x, y + 2, z + width, ModBlocks.stone_keyhole_meta, 2, 3);
|
||||
if(r == 3) world.setBlock(x, y + 2, z - width, ModBlocks.stone_keyhole_meta, 3, 3);
|
||||
}
|
||||
|
||||
for(int i = -width + 1; i <= width - 1; i++) {
|
||||
for(int j = -width + 1; j <= width - 1; j++) {
|
||||
//Floor and ceiling
|
||||
|
||||
@ -1,319 +0,0 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.hbm.blocks.IBlockMultiPass;
|
||||
import com.hbm.config.WorldConfig;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.util.ColorUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class BlockMotherOfAllOres extends BlockContainer implements IBlockMultiPass {
|
||||
|
||||
public static int override = -1;
|
||||
|
||||
public static void shuffleOverride(Random rand) {
|
||||
override = rand.nextInt(uniqueItems.size());
|
||||
}
|
||||
|
||||
public static void resetOverride() {
|
||||
override = -1;
|
||||
}
|
||||
|
||||
public BlockMotherOfAllOres() {
|
||||
super(Material.rock);
|
||||
this.setBlockTextureName("stone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityRandomOre();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
|
||||
for(int i = 0; i < uniqueItems.size(); i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityRandomOre) {
|
||||
TileEntityRandomOre ore = (TileEntityRandomOre) te;
|
||||
return new ItemStack(this, 1, ore.getStackId());
|
||||
}
|
||||
|
||||
return new ItemStack(ModItems.nothing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
if(fortune == 0xFECE00) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityRandomOre) {
|
||||
TileEntityRandomOre ore = (TileEntityRandomOre) te;
|
||||
ComparableStack item = ore.getCompStack();
|
||||
ret.add(item.toStack());
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
this.dropBlockAsItemWithChance(world, x, y, z, meta, 1, 0xFECE00);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
((TileEntityRandomOre)world.getTileEntity(x, y, z)).setItem(stack.getItemDamage());
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return IBlockMultiPass.getRenderType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPasses() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
private IIcon[] overlays = new IIcon[10];
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
|
||||
this.blockIcon = reg.registerIcon("stone");
|
||||
for(int i = 0; i < overlays.length; i++) {
|
||||
overlays[i] = reg.registerIcon(RefStrings.MODID + ":ore_random_" + (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
|
||||
if(RenderBlockMultipass.currentPass == 0)
|
||||
return Blocks.stone.getIcon(0, 0);
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityRandomOre) {
|
||||
TileEntityRandomOre ore = (TileEntityRandomOre) te;
|
||||
int index = ore.getStackId() % overlays.length;
|
||||
return overlays[index];
|
||||
}
|
||||
|
||||
return Blocks.stone.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
if(RenderBlockMultipass.currentPass == 0)
|
||||
return Blocks.stone.getIcon(0, 0);
|
||||
|
||||
int index = meta % overlays.length;
|
||||
return overlays[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
|
||||
if(RenderBlockMultipass.currentPass == 0)
|
||||
return 0xffffff;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityRandomOre) {
|
||||
TileEntityRandomOre ore = (TileEntityRandomOre) te;
|
||||
ItemStack stack = ore.getStack();
|
||||
int color = ColorUtil.getAverageColorFromStack(stack);
|
||||
color = ColorUtil.amplifyColor(color);
|
||||
|
||||
Color col = new Color(color);
|
||||
int r = col.getRed();
|
||||
int g = col.getGreen();
|
||||
int b = col.getBlue();
|
||||
|
||||
float[] hsb = new Color(color).RGBtoHSB(r, g, b, new float[3]);
|
||||
|
||||
if(hsb[1] > 0F && hsb[1] < 0.75F)
|
||||
hsb[1] = 0.75F;
|
||||
|
||||
color = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
return super.colorMultiplier(world, x, y, z);
|
||||
}
|
||||
|
||||
public static class TileEntityRandomOre extends TileEntity {
|
||||
|
||||
private ComparableStack stack;
|
||||
|
||||
public TileEntityRandomOre() {
|
||||
if(override != -1) {
|
||||
setItem(override);
|
||||
}
|
||||
}
|
||||
|
||||
public void setItem(int id) {
|
||||
ComparableStack comp = itemMap.get(id);
|
||||
this.stack = comp != null ? ((ComparableStack) comp.copy()) : null;
|
||||
|
||||
if(this.worldObj != null)
|
||||
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
|
||||
}
|
||||
|
||||
public int getStackId() {
|
||||
return itemMap.inverse().get(getCompStack());
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return getCompStack().toStack();
|
||||
}
|
||||
|
||||
public ComparableStack getCompStack() {
|
||||
|
||||
if(stack == null) {
|
||||
int rand = worldObj.rand.nextInt(uniqueItems.size());
|
||||
stack = (ComparableStack) itemMap.get(rand).copy();
|
||||
this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
|
||||
}
|
||||
|
||||
return stack != null ? stack : new ComparableStack(ModItems.nothing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
int key = nbt.getInteger("item");
|
||||
this.setItem(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
try {
|
||||
Integer key = itemMap.inverse().get(getCompStack());
|
||||
nbt.setInteger("item", key != null ? key : 0);
|
||||
} catch(Exception ex) { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemRandomOreBlock extends ItemBlock {
|
||||
|
||||
public ItemRandomOreBlock(Block block) {
|
||||
super(block);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
ComparableStack comp = itemMap.get(stack.getItemDamage());
|
||||
ItemStack name = comp != null ? comp.toStack() : new ItemStack(ModItems.nothing);
|
||||
if(name.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
name.setItemDamage(0);
|
||||
}
|
||||
return StatCollector.translateToLocalFormatted(this.getUnlocalizedName() + ".name", name.getItem().getItemStackDisplayName(name));
|
||||
}
|
||||
}
|
||||
|
||||
public static HashSet<ComparableStack> uniqueItems = new HashSet();
|
||||
public static HashBiMap<Integer, ComparableStack> itemMap = HashBiMap.create();
|
||||
|
||||
public static void init() {
|
||||
|
||||
if(WorldConfig.enableRandom) {
|
||||
for(Object b : Block.blockRegistry.getKeys()) {
|
||||
Block block = Block.getBlockFromName((String) b);
|
||||
if(block != null && Item.getItemFromBlock(block) != null)
|
||||
uniqueItems.add(new ComparableStack(block));
|
||||
}
|
||||
|
||||
for(Object i : Item.itemRegistry.getKeys()) {
|
||||
Item item = (Item) Item.itemRegistry.getObject((String) i);
|
||||
uniqueItems.add(new ComparableStack(item));
|
||||
}
|
||||
|
||||
for(String i : OreDictionary.getOreNames()) {
|
||||
for(ItemStack stack : OreDictionary.getOres(i)) {
|
||||
uniqueItems.add(new ComparableStack(stack));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uniqueItems.add(new ComparableStack(ModItems.nothing));
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for(ComparableStack stack : uniqueItems) {
|
||||
itemMap.put(i++, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
@ -7,15 +8,21 @@ import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockOreBasalt extends BlockEnumMulti {
|
||||
|
||||
protected IIcon[] topIcons;
|
||||
|
||||
public BlockOreBasalt() {
|
||||
super(Material.rock, EnumBasaltOreType.class, true, true);
|
||||
@ -47,11 +54,6 @@ public class BlockOreBasalt extends BlockEnumMulti {
|
||||
return super.getItemDropped(meta, rand, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@ -62,18 +64,38 @@ public class BlockOreBasalt extends BlockEnumMulti {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta == EnumBasaltOreType.ASBESTOS.ordinal()) for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == Blocks.air) {
|
||||
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.gas_asbestos);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { } //no more BUD outgassing for you, mister
|
||||
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune) {
|
||||
if(meta == EnumBasaltOreType.ASBESTOS.ordinal()) world.setBlock(x, y, z, ModBlocks.gas_asbestos);
|
||||
super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return ModBlocks.getDropsWithoutDamage(world, this, metadata, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
super.registerBlockIcons(reg);
|
||||
|
||||
Enum[] enums = theEnum.getEnumConstants();
|
||||
this.topIcons = new IIcon[enums.length];
|
||||
|
||||
for(int i = 0; i < topIcons.length; i++) {
|
||||
Enum num = enums[i];
|
||||
this.topIcons[i] = reg.registerIcon(this.getTextureMultiName(num) + "_top");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if(side <= 1) return this.topIcons[meta % this.topIcons.length];
|
||||
return super.getIcon(side, meta);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ public class BlockOutgas extends BlockOre {
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
|
||||
if(onNeighbour) {
|
||||
if(onNeighbour && world.rand.nextInt(3) == 0) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.inventory.recipes.PedestalRecipes;
|
||||
import com.hbm.inventory.recipes.PedestalRecipes.PedestalRecipe;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.particle.helper.ExplosionSmallCreator;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -20,6 +24,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockPedestal extends BlockContainer {
|
||||
|
||||
@ -108,6 +113,73 @@ public class BlockPedestal extends BlockContainer {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
|
||||
if(!world.isRemote) {
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
|
||||
TileEntityPedestal nw = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.NORTH.offsetX * 2 + ForgeDirection.WEST.offsetX * 2, y, z + ForgeDirection.NORTH.offsetZ * 2 + ForgeDirection.WEST.offsetZ * 2));
|
||||
TileEntityPedestal n = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.NORTH.offsetX * 3, y, z + ForgeDirection.NORTH.offsetZ * 3));
|
||||
TileEntityPedestal ne = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.NORTH.offsetX * 2 + ForgeDirection.EAST.offsetX * 2, y, z + ForgeDirection.NORTH.offsetZ * 2 + ForgeDirection.EAST.offsetZ * 2));
|
||||
TileEntityPedestal w = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.WEST.offsetX * 3, y, z + ForgeDirection.WEST.offsetZ * 3));
|
||||
TileEntityPedestal center = (TileEntityPedestal) world.getTileEntity(x, y, z);
|
||||
TileEntityPedestal e = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.EAST.offsetX * 3, y, z + ForgeDirection.EAST.offsetZ * 3));
|
||||
TileEntityPedestal sw = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.SOUTH.offsetX * 2 + ForgeDirection.WEST.offsetX * 2, y, z + ForgeDirection.SOUTH.offsetZ * 2 + ForgeDirection.WEST.offsetZ * 2));
|
||||
TileEntityPedestal s = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.SOUTH.offsetX * 3, y, z + ForgeDirection.SOUTH.offsetZ * 3));
|
||||
TileEntityPedestal se = castOrNull(Compat.getTileStandard(world, x + ForgeDirection.SOUTH.offsetX * 2 + ForgeDirection.EAST.offsetX * 2, y, z + ForgeDirection.SOUTH.offsetZ * 2 + ForgeDirection.EAST.offsetZ * 2));
|
||||
|
||||
TileEntityPedestal[] tileArray = new TileEntityPedestal[] {nw, n, ne, w, center, e, sw, s, se};
|
||||
|
||||
outer: for(PedestalRecipe recipe : PedestalRecipes.recipes) {
|
||||
|
||||
if(recipe.extra == recipe.extra.FULL_MOON) {
|
||||
if(world.getCelestialAngle(0) < 0.35 || world.getCelestialAngle(0) > 0.65) continue;
|
||||
if(world.provider.getMoonPhase(world.getWorldInfo().getWorldTime()) != 0) continue;
|
||||
}
|
||||
|
||||
if(recipe.extra == recipe.extra.NEW_MOON) {
|
||||
if(world.getCelestialAngle(0) < 0.35 || world.getCelestialAngle(0) > 0.65) continue;
|
||||
if(world.provider.getMoonPhase(world.getWorldInfo().getWorldTime()) != 4) continue;
|
||||
}
|
||||
|
||||
if(recipe.extra == recipe.extra.SUN) {
|
||||
if(world.getCelestialAngle(0) > 0.15 && world.getCelestialAngle(0) < 0.85) continue;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack pedestal = tileArray[i] != null ? tileArray[i].item : null;
|
||||
if(pedestal == null && recipe.input[i] != null) continue outer;
|
||||
if(pedestal != null && recipe.input[i] == null) continue outer;
|
||||
if(pedestal == null && recipe.input[i] == null) continue;
|
||||
|
||||
if(!recipe.input[i].matchesRecipe(pedestal, true) || recipe.input[i].stacksize != pedestal.stackSize) continue outer;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
if(i == 4) continue;
|
||||
ItemStack pedestal = tileArray[i] != null ? tileArray[i].item : null;
|
||||
if(pedestal == null && recipe.input[i] == null) continue;
|
||||
tileArray[i].item = null;
|
||||
tileArray[i].markDirty();
|
||||
world.markBlockForUpdate(tileArray[i].xCoord, tileArray[i].yCoord, tileArray[i].zCoord);
|
||||
}
|
||||
|
||||
center.item = recipe.output.copy();
|
||||
center.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
ExplosionSmallCreator.composeEffect(world, x + 0.5, y + 1.5, z + 0.5, 10, 2.5F, 1F);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static TileEntityPedestal castOrNull(TileEntity tile) {
|
||||
if(tile instanceof TileEntityPedestal) return (TileEntityPedestal) tile;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class TileEntityPedestal extends TileEntity {
|
||||
|
||||
public ItemStack item;
|
||||
|
||||
@ -140,9 +140,10 @@ public class BlockPlushie extends BlockContainer implements IBlockMulti, IToolti
|
||||
}
|
||||
|
||||
public static enum PlushieType {
|
||||
NONE( "NONE", null),
|
||||
YOMI( "Yomi", "Hi! Can I be your rabbit friend?"),
|
||||
NUMBERNINE( "Number Nine", "None of y'all deserve coal.");
|
||||
NONE( "NONE", null),
|
||||
YOMI( "Yomi", "Hi! Can I be your rabbit friend?"),
|
||||
NUMBERNINE( "Number Nine", "None of y'all deserve coal."),
|
||||
POOH( "Winnie the Pooh", "Beloved children's character with no malicious intent.");
|
||||
|
||||
public String label;
|
||||
public String inscription;
|
||||
|
||||
161
src/main/java/com/hbm/blocks/generic/BlockRedBrickKeyhole.java
Normal file
161
src/main/java/com/hbm/blocks/generic/BlockRedBrickKeyhole.java
Normal file
@ -0,0 +1,161 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockPedestal.TileEntityPedestal;
|
||||
import com.hbm.itempool.ItemPool;
|
||||
import com.hbm.itempool.ItemPoolsRedRoom;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemModDoor;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockRedBrickKeyhole extends Block {
|
||||
|
||||
protected IIcon iconFront;
|
||||
protected IIcon iconTop;
|
||||
|
||||
public BlockRedBrickKeyhole(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":stone_keyhole_meta");
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":brick_red_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":brick_base");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == meta ? (side == 0 || side == 1 ? this.iconTop : this.iconFront) : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random rand, int j) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return new ItemStack(ModBlocks.brick_red);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(player.getHeldItem() != null) {
|
||||
boolean cracked = player.getHeldItem().getItem() == ModItems.key_red_cracked;
|
||||
if((player.getHeldItem().getItem() == ModItems.key_red || cracked) && side != 0 && side != 1) {
|
||||
if(cracked) player.getHeldItem().stackSize--;
|
||||
if(world.isRemote) return true;
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(side);
|
||||
generateRoom(world, x - dir.offsetX * 4, y - 2, z - dir.offsetZ * 4, dir);
|
||||
int b = 0;
|
||||
if(side == 2) b = 1;
|
||||
if(side == 5) b = 2;
|
||||
if(side == 3) b = 3;
|
||||
if(side == 4) b = 0;
|
||||
ItemModDoor.placeDoorBlock(world, x, y - 1, z, b, ModBlocks.door_red);
|
||||
world.playSoundAtEntity(player, "hbm:block.lockOpen", 1.0F, 1.0F);
|
||||
player.triggerAchievement(MainRegistry.achRedRoom);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void generateRoom(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
int size = 9;
|
||||
int height = 5;
|
||||
int width = size / 2;
|
||||
|
||||
//Outer Edges, top and bottom
|
||||
for(int i = -width; i <= width; i++) {
|
||||
world.setBlock(x + i, y, z + width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + i, y, z - width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + width, y, z + i, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x - width, y, z + i, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + i, y + height - 1, z + width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + i, y + height - 1, z - width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + width, y + height - 1, z + i, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x - width, y + height - 1, z + i, ModBlocks.brick_red, 6, 3);
|
||||
}
|
||||
|
||||
for(int i = 1; i <= height - 2; i++) {
|
||||
//Outer edges, sides
|
||||
world.setBlock(x + width, y + i, z + width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + width, y + i, z - width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x - width, y + i, z + width, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x - width, y + i, z - width, ModBlocks.brick_red, 6, 3);
|
||||
|
||||
//Walls
|
||||
for(int j = -width + 1; j <= width - 1; j++) {
|
||||
if(dir != Library.POS_X) world.setBlock(x + width, y + i, z + j, ModBlocks.brick_red, 6, 3);
|
||||
if(dir != Library.NEG_X) world.setBlock(x - width, y + i, z + j, ModBlocks.brick_red, 6, 3);
|
||||
if(dir != Library.POS_Z) world.setBlock(x + j, y + i, z + width, ModBlocks.brick_red, 6, 3);
|
||||
if(dir != Library.NEG_Z) world.setBlock(x + j, y + i, z - width, ModBlocks.brick_red, 6, 3);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = -width + 1; i <= width - 1; i++) {
|
||||
for(int j = -width + 1; j <= width - 1; j++) {
|
||||
//Floor and ceiling
|
||||
world.setBlock(x + i, y, z + j, ModBlocks.brick_red, 6, 3);
|
||||
world.setBlock(x + i, y + height - 1, z + j, ModBlocks.brick_red, 6, 3);
|
||||
|
||||
for(int k = 1; k <= height - 2; k++) {
|
||||
world.setBlock(x + i, y + k, z + j, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spawnPedestalItem(world, x, y + 1, z, ItemPool.getPool(ItemPoolsRedRoom.POOL_BLACK_SLAB));
|
||||
if(world.rand.nextBoolean()) spawnPedestalItem(world, x + 2, y + 1, z, ItemPool.getPool(ItemPoolsRedRoom.POOL_BLACK_PART));
|
||||
if(world.rand.nextBoolean()) spawnPedestalItem(world, x - 2, y + 1, z, ItemPool.getPool(ItemPoolsRedRoom.POOL_BLACK_PART));
|
||||
if(world.rand.nextBoolean()) spawnPedestalItem(world, x, y + 1, z + 2, ItemPool.getPool(ItemPoolsRedRoom.POOL_BLACK_PART));
|
||||
if(world.rand.nextBoolean()) spawnPedestalItem(world, x, y + 1, z - 2, ItemPool.getPool(ItemPoolsRedRoom.POOL_BLACK_PART));
|
||||
|
||||
//Clear dropped items
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x + 0.5, y, z + 0.5, x + 0.5, y + height, z + 0.5).expand(size / 2D, 0, size / 2D));
|
||||
for(EntityItem item : items) item.setDead();
|
||||
}
|
||||
|
||||
public static void spawnPedestalItem(World world, int x, int y, int z, WeightedRandomChestContent[] pool) {
|
||||
world.setBlock(x, y, z, ModBlocks.pedestal);
|
||||
TileEntityPedestal pedestal = (TileEntityPedestal) world.getTileEntity(x, y, z);
|
||||
pedestal.item = ItemPool.getStack(pool, world.rand).copy();
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,16 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.blocks.BlockEnums;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.items.ItemEnums.EnumChunkType;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockResourceStone extends BlockEnumMulti {
|
||||
@ -22,4 +28,16 @@ public class BlockResourceStone extends BlockEnumMulti {
|
||||
|
||||
super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
|
||||
|
||||
if(meta == BlockEnums.EnumStoneType.MALACHITE.ordinal()) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(DictFrame.fromOne(ModItems.chunk_ore, EnumChunkType.MALACHITE, 3 + fortune + world.rand.nextInt(fortune + 2)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return super.getDrops(world, x, y, z, meta, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockScaffold extends BlockMulti {
|
||||
|
||||
@ -59,22 +60,34 @@ public class BlockScaffold extends BlockMulti {
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return this.icons[this.damageDropped(meta)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float fx, float fy, float fz, int meta) {
|
||||
return side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
ForgeDirection placed = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
|
||||
int meta = stack.getItemDamage();
|
||||
|
||||
if(i % 2 == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
|
||||
if(placed == ForgeDirection.UP || placed == ForgeDirection.DOWN) {
|
||||
int rot = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
if(rot % 2 == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
} else {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 8, 2);
|
||||
}
|
||||
} else if(placed == ForgeDirection.NORTH || placed == ForgeDirection.SOUTH) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 4, 2);
|
||||
} else {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 8, 2);
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 12, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return rectify(meta) & 7;
|
||||
return rectify(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -83,27 +96,24 @@ public class BlockScaffold extends BlockMulti {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
|
||||
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
float f = 0.0625F;
|
||||
|
||||
if((te & 8) != 0)
|
||||
if(meta >= 12) {
|
||||
this.setBlockBounds(0.0F, 2 * f, 0.0F, 1.0F, 14 * f, 1.0F);
|
||||
} else if(meta >= 8) {
|
||||
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||
else
|
||||
} else if(meta >= 4) {
|
||||
this.setBlockBounds(0.0F, 2 * f, 0.0F, 1.0F, 14 * f, 1.0F);
|
||||
} else {
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
|
||||
int te = world.getBlockMetadata(x, y, z);
|
||||
float f = 0.0625F;
|
||||
|
||||
if((te & 8) != 0)
|
||||
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||
else
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@ -193,7 +192,7 @@ public class BlockSnowglobe extends BlockContainer implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIScreenSnowglobe((TileEntitySnowglobe) world.getTileEntity(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
@ -10,6 +11,7 @@ import com.hbm.items.ModItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -45,11 +47,6 @@ public class BlockStalagmite extends BlockEnumMulti {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getMetaFromResource(int meta) {
|
||||
return meta;
|
||||
@ -75,4 +72,10 @@ public class BlockStalagmite extends BlockEnumMulti {
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return ModBlocks.getDropsWithoutDamage(world, this, metadata, fortune);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
130
src/main/java/com/hbm/blocks/generic/BlockSupplyCrate.java
Normal file
130
src/main/java/com/hbm/blocks/generic/BlockSupplyCrate.java
Normal file
@ -0,0 +1,130 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSupplyCrate extends BlockContainer {
|
||||
|
||||
public BlockSupplyCrate(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntitySupplyCrate();
|
||||
}
|
||||
|
||||
@Override public int getRenderType() { return BlockCanCrate.renderID; }
|
||||
@Override public boolean isOpaqueCube() { return false; }
|
||||
@Override public boolean renderAsNormalBlock() { return false; }
|
||||
|
||||
@Override public Item getItemDropped(int i, Random rand, int j) { return null; }
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
|
||||
if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) {
|
||||
|
||||
ItemStack drop = new ItemStack(this);
|
||||
TileEntitySupplyCrate inv = (TileEntitySupplyCrate) world.getTileEntity(x, y, z);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
if(inv != null) {
|
||||
for(int i = 0; i < inv.items.size(); i++) {
|
||||
ItemStack stack = inv.items.get(i);
|
||||
if(stack == null) continue;
|
||||
NBTTagCompound slot = new NBTTagCompound();
|
||||
stack.writeToNBT(slot);
|
||||
nbt.setTag("slot" + i, slot);
|
||||
}
|
||||
nbt.setInteger("amount", inv.items.size());
|
||||
}
|
||||
|
||||
if(!nbt.hasNoTags()) drop.stackTagCompound = nbt;
|
||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop));
|
||||
}
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
TileEntitySupplyCrate inv = (TileEntitySupplyCrate) world.getTileEntity(x, y, z);
|
||||
|
||||
if(inv != null && stack.hasTagCompound()) {
|
||||
int amount = stack.stackTagCompound.getInteger("amount");
|
||||
for(int i = 0; i < amount; i++) {
|
||||
inv.items.add(ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("slot" + i)));
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem().equals(ModItems.crowbar)) {
|
||||
if(!world.isRemote) {
|
||||
dropContents(world, x, y, z);
|
||||
world.func_147480_a(x, y, z, false);
|
||||
world.playSoundEffect(x, y, z, "hbm:block.crateBreak", 0.5F, 1.0F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void dropContents(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileEntitySupplyCrate) {
|
||||
TileEntitySupplyCrate crate = (TileEntitySupplyCrate) tile;
|
||||
|
||||
for(ItemStack item : crate.items) {
|
||||
this.dropBlockAsItem(world, x, y, z, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TileEntitySupplyCrate extends TileEntity {
|
||||
|
||||
public List<ItemStack> items = new ArrayList();
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
items.clear();
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
items.add(ItemStack.loadItemStackFromNBT(nbt1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(int i = 0; i < items.size(); i++) {
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
items.get(i).writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,21 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.deco.TileEntityDecoBlock;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -17,7 +24,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DecoBlock extends BlockContainer {
|
||||
public class DecoBlock extends BlockContainer implements IToolable {
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
@ -25,20 +32,46 @@ public class DecoBlock extends BlockContainer {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
if(tool != ToolType.SCREWDRIVER) return false;
|
||||
if(this != ModBlocks.steel_wall && this != ModBlocks.steel_corner) return false;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(!player.isSneaking()) {
|
||||
if(meta == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 3);
|
||||
else if(meta == 4) world.setBlockMetadataWithNotify(x, y, z, 2, 3);
|
||||
else if(meta == 2) world.setBlockMetadataWithNotify(x, y, z, 5, 3);
|
||||
else if(meta == 5) world.setBlockMetadataWithNotify(x, y, z, 3, 3);
|
||||
} else {
|
||||
if(meta == 3) world.setBlockMetadataWithNotify(x, y, z, 5, 3);
|
||||
else if(meta == 4) world.setBlockMetadataWithNotify(x, y, z, 3, 3);
|
||||
else if(meta == 2) world.setBlockMetadataWithNotify(x, y, z, 4, 3);
|
||||
else if(meta == 5) world.setBlockMetadataWithNotify(x, y, z, 2, 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { return true; }
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
if(this == ModBlocks.steel_scaffold || this == ModBlocks.steel_beam) return null;
|
||||
if(this == ModBlocks.steel_scaffold || this == ModBlocks.steel_beam || this == ModBlocks.steel_wall || this == ModBlocks.steel_corner) return null;
|
||||
return new TileEntityDecoBlock();
|
||||
}
|
||||
|
||||
public static int renderIDBeam = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int renderIDWall = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int renderIDCorner = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
if(this == ModBlocks.steel_beam)
|
||||
return renderIDBeam;
|
||||
else
|
||||
return -1;
|
||||
if(this == ModBlocks.steel_wall) return renderIDWall;
|
||||
if(this == ModBlocks.steel_corner) return renderIDCorner;
|
||||
if(this == ModBlocks.steel_beam) return renderIDBeam;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,95 +93,23 @@ public class DecoBlock extends BlockContainer {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
if(i == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 0) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
|
||||
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
|
||||
float f = 0.0625F;
|
||||
|
||||
if(this == ModBlocks.steel_wall) {
|
||||
switch(te) {
|
||||
case 4:
|
||||
this.setBlockBounds(14 * f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 14 * f, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 2 * f, 1.0F, 1.0F);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2 * f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(this == ModBlocks.steel_corner) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if(this == ModBlocks.steel_roof) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1 * f, 1.0F);
|
||||
}
|
||||
|
||||
if(this == ModBlocks.steel_beam) {
|
||||
this.setBlockBounds(7 * f, 0.0F, 7 * f, 9 * f, 1.0F, 9 * f);
|
||||
}
|
||||
|
||||
if(this == ModBlocks.steel_scaffold) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
switch(te) {
|
||||
case 4:
|
||||
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int te = world.getBlockMetadata(x, y, z);
|
||||
float f = 0.0625F;
|
||||
|
||||
if(this == ModBlocks.steel_wall) {
|
||||
switch(te) {
|
||||
case 4:
|
||||
this.setBlockBounds(14 * f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 14 * f, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 2 * f, 1.0F, 1.0F);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2 * f);
|
||||
break;
|
||||
case 4: this.setBlockBounds(14 * f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); break;
|
||||
case 2: this.setBlockBounds(0.0F, 0.0F, 14 * f, 1.0F, 1.0F, 1.0F); break;
|
||||
case 5: this.setBlockBounds(0.0F, 0.0F, 0.0F, 2 * f, 1.0F, 1.0F); break;
|
||||
case 3: this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2 * f); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,21 +128,57 @@ public class DecoBlock extends BlockContainer {
|
||||
if(this == ModBlocks.steel_scaffold) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
switch(te) {
|
||||
case 4:
|
||||
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||
break;
|
||||
case 4: this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F); break;
|
||||
case 2: this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f); break;
|
||||
case 5: this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F); break;
|
||||
case 3: this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity collider) {
|
||||
|
||||
if(this == ModBlocks.steel_corner) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
List<AxisAlignedBB> bbs = new ArrayList();
|
||||
|
||||
switch(meta) {
|
||||
case 2:
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0D, z + 0.875D, x + 1D, y + 1D, z + 1D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0D, y + 0D, z + 0.75D, x + 0.25D, y + 1D, z + 1D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0D, y + 0D, z + 0D, x + 0.125D, y + 1D, z + 0.75D));
|
||||
break;
|
||||
case 3:
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0D, y + 0D, z + 0D, x + 0.75D, y + 1D, z + 0.125D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.75D, y + 0D, z + 0D, x + 1D, y + 1D, z + 0.25D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.875D, y + 0D, z + 0.25D, x + 1D, y + 1D, z + 1D));
|
||||
break;
|
||||
case 4:
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.875D, y + 0D, z + 0D, x + 1D, y + 1D, z + 0.75D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.75D, y + 0D, z + 0.75D, x + 1D, y + 1D, z + 1D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0D, y + 0D, z + 0.875D, x + 0.75D, y + 1D, z + 1D));
|
||||
break;
|
||||
case 5:
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0D, y + 0D, z + 0.25D, x + 0.125D, y + 1D, z + 1D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0D, y + 0D, z + 0D, x + 0.25D, y + 1D, z + 0.25D));
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.25D, y + 0D, z + 0D, x + 1D, y + 1D, z + 0.125D));
|
||||
break;
|
||||
}
|
||||
|
||||
for(AxisAlignedBB bb : bbs) {
|
||||
if(aabb.intersectsWith(bb)) {
|
||||
list.add(bb);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, collider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,9 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.deco.TileEntityDecoBlockAlt;
|
||||
import com.hbm.tileentity.deco.TileEntityDecoBlockAltF;
|
||||
import com.hbm.tileentity.deco.TileEntityDecoBlockAltG;
|
||||
import com.hbm.tileentity.deco.TileEntityDecoBlockAltW;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -17,7 +12,6 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -34,28 +28,14 @@ public class DecoBlockAlt extends BlockContainer {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
//this.blockIcon = iconRegister.registerIcon("stone");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":code");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
if(this == ModBlocks.statue_elb)
|
||||
return new TileEntityDecoBlockAlt();
|
||||
if(this == ModBlocks.statue_elb_g)
|
||||
return new TileEntityDecoBlockAltG();
|
||||
if(this == ModBlocks.statue_elb_w)
|
||||
return new TileEntityDecoBlockAltW();
|
||||
if(this == ModBlocks.statue_elb_f)
|
||||
return new TileEntityDecoBlockAltF();
|
||||
if(this == ModBlocks.statue_elb_f) return new TileEntityDecoBlockAltF();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.statue_elb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
@ -75,83 +55,34 @@ public class DecoBlockAlt extends BlockContainer {
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
|
||||
if(i == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
if(i == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
if(i == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
if(i == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
if(player.getCurrentEquippedItem() != null)
|
||||
{
|
||||
if(this == ModBlocks.statue_elb)
|
||||
{
|
||||
if(player.getCurrentEquippedItem().getItem() == ModItems.gun_revolver_cursed)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.statue_elb_g, world.getBlockMetadata(x, y, z), 2);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
if(player.getCurrentEquippedItem() != null) {
|
||||
boolean cracked = player.getHeldItem().getItem() == ModItems.key_red_cracked;
|
||||
|
||||
if(player.getCurrentEquippedItem().getItem() == ModItems.watch)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.statue_elb_w, world.getBlockMetadata(x, y, z), 2);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(this == ModBlocks.statue_elb_g)
|
||||
{
|
||||
if(player.getCurrentEquippedItem().getItem() == ModItems.watch)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.statue_elb_f, world.getBlockMetadata(x, y, z), 2);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(this == ModBlocks.statue_elb_w)
|
||||
{
|
||||
if(player.getCurrentEquippedItem().getItem() == ModItems.gun_revolver_cursed)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.statue_elb_f, world.getBlockMetadata(x, y, z), 2);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--player.getCurrentEquippedItem().stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if((player.getHeldItem().getItem() == ModItems.key_red || cracked)) {
|
||||
if(cracked) player.getHeldItem().stackSize--;
|
||||
world.func_147480_a(x, y, z, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,17 +90,15 @@ public class DecoBlockAlt extends BlockContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8*f, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8*f, 1.0F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8 * f, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8 * f, 1.0F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ package com.hbm.blocks.generic;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
|
||||
@ -11,7 +11,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -65,7 +64,7 @@ public class BlockArmorTable extends Block implements IGUIProvider {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIArmorTable(player.inventory);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -10,7 +9,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockICFLaserComponent extends BlockEnumMulti {
|
||||
|
||||
|
||||
protected IIcon[] iconsTop;
|
||||
|
||||
public BlockICFLaserComponent() {
|
||||
@ -20,7 +19,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
|
||||
|
||||
Enum[] enums = theEnum.getEnumConstants();
|
||||
this.icons = new IIcon[enums.length];
|
||||
this.iconsTop = new IIcon[enums.length];
|
||||
@ -33,7 +32,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti {
|
||||
this.icons[5] = reg.registerIcon(RefStrings.MODID + ":icf_turbocharger");
|
||||
this.iconsTop[4] = this.iconsTop[5] = reg.registerIcon(RefStrings.MODID + ":icf_capacitor_top");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
@ -44,7 +43,7 @@ public class BlockICFLaserComponent extends BlockEnumMulti {
|
||||
public int getSubCount() {
|
||||
return EnumICFPart.values().length;
|
||||
}
|
||||
|
||||
|
||||
public static enum EnumICFPart {
|
||||
CASING,
|
||||
PORT,
|
||||
|
||||
@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -26,7 +25,7 @@ public class DummyBlockAssembler extends DummyOldBase {
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_assembler);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
@ -39,7 +38,7 @@ public class DummyBlockAssembler extends DummyOldBase {
|
||||
int a = ((TileEntityDummy)te).targetX;
|
||||
int b = ((TileEntityDummy)te).targetY;
|
||||
int c = ((TileEntityDummy)te).targetZ;
|
||||
|
||||
|
||||
TileEntityMachineAssembler entity = (TileEntityMachineAssembler) world.getTileEntity(a, b, c);
|
||||
if(entity != null)
|
||||
{
|
||||
|
||||
@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -26,7 +25,7 @@ public class DummyBlockRefinery extends DummyOldBase {
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_refinery);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
@ -39,7 +38,7 @@ public class DummyBlockRefinery extends DummyOldBase {
|
||||
int a = ((TileEntityDummy)te).targetX;
|
||||
int b = ((TileEntityDummy)te).targetY;
|
||||
int c = ((TileEntityDummy)te).targetZ;
|
||||
|
||||
|
||||
TileEntityMachineRefinery entity = (TileEntityMachineRefinery) world.getTileEntity(a, b, c);
|
||||
if(entity != null)
|
||||
{
|
||||
|
||||
@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -26,7 +25,7 @@ public class DummyBlockTurbofan extends DummyOldBase {
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_turbofan);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
@ -39,7 +38,7 @@ public class DummyBlockTurbofan extends DummyOldBase {
|
||||
int a = ((TileEntityDummy)te).targetX;
|
||||
int b = ((TileEntityDummy)te).targetY;
|
||||
int c = ((TileEntityDummy)te).targetZ;
|
||||
|
||||
|
||||
TileEntityMachineTurbofan entity = (TileEntityMachineTurbofan) world.getTileEntity(a, b, c);
|
||||
if(entity != null)
|
||||
{
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FactoryHatch extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
public FactoryHatch(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.factory_titanium_furnace ? ":factory_titanium_furnace" : ":factory_advanced_furnace"));
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.factory_titanium_furnace ? ":factory_titanium_hull" : ":factory_advanced_hull"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import api.hbm.block.IToolable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -12,9 +10,6 @@ import com.hbm.items.machine.ItemMold.Mold;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.tileentity.machine.TileEntityFoundryCastingBase;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.block.ICrucibleAcceptor;
|
||||
import api.hbm.block.IToolable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -30,6 +25,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class FoundryCastingBase extends BlockContainer implements ICrucibleAcceptor, IToolable, ILookOverlay {
|
||||
|
||||
protected FoundryCastingBase() {
|
||||
@ -55,30 +54,30 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
public boolean canAcceptPartialFlow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).canAcceptPartialFlow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MaterialStack flow(World world, int x, int y, int z, ForgeDirection side, MaterialStack stack) {
|
||||
return ((ICrucibleAcceptor) world.getTileEntity(x, y, z)).flow(world, x, y, z, side, stack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
//remove casted item
|
||||
if(cast.slots[1] != null) {
|
||||
if(!player.inventory.addItemStackToInventory(cast.slots[1].copy())) {
|
||||
@ -87,17 +86,17 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
} else {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
|
||||
cast.slots[1] = null;
|
||||
cast.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//insert mold
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.mold && cast.slots[0] == null) {
|
||||
Mold mold = ((ItemMold) player.getHeldItem().getItem()).getMold(player.getHeldItem());
|
||||
|
||||
|
||||
if(mold.size == cast.getMoldSize()) {
|
||||
cast.slots[0] = player.getHeldItem().copy();
|
||||
cast.slots[0].stackSize = 1;
|
||||
@ -108,7 +107,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
||||
if(cast.amount > 0) {
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount));
|
||||
@ -125,13 +124,13 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block b, int i) {
|
||||
|
||||
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
if(cast.amount > 0) {
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(cast.type, cast.amount));
|
||||
@ -139,14 +138,14 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
world.spawnEntityInWorld(item);
|
||||
cast.amount = 0; //just for safety
|
||||
}
|
||||
|
||||
|
||||
for(ItemStack stack : cast.slots) {
|
||||
if(stack != null) {
|
||||
EntityItem drop = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, stack.copy());
|
||||
world.spawnEntityInWorld(drop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.breakBlock(world, x, y, z, b, i);
|
||||
}
|
||||
|
||||
@ -154,7 +153,7 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
super.randomDisplayTick(world, x, y, z, rand);
|
||||
|
||||
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
|
||||
if(cast.amount > 0 && cast.amount >= cast.getCapacity()) {
|
||||
@ -164,28 +163,28 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
|
||||
if(tool != ToolType.SCREWDRIVER)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(cast.slots[0] == null) return false;
|
||||
if(cast.amount > 0) return false;
|
||||
|
||||
|
||||
if(!player.inventory.addItemStackToInventory(cast.slots[0].copy())) {
|
||||
EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, cast.slots[0].copy());
|
||||
world.spawnEntityInWorld(item);
|
||||
} else {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
|
||||
cast.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
|
||||
cast.slots[0] = null;
|
||||
cast.markDirty();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -193,18 +192,18 @@ public abstract class FoundryCastingBase extends BlockContainer implements ICruc
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
TileEntityFoundryCastingBase cast = (TileEntityFoundryCastingBase) world.getTileEntity(x, y, z);
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
|
||||
if(cast.slots[0] == null) {
|
||||
text.add(EnumChatFormatting.RED + I18nUtil.resolveKey("foundry.noCast"));
|
||||
} else if(cast.slots[0].getItem() == ModItems.mold){
|
||||
Mold mold = ((ItemMold) cast.slots[0].getItem()).getMold(cast.slots[0]);
|
||||
text.add(EnumChatFormatting.BLUE + mold.getTitle());
|
||||
}
|
||||
|
||||
|
||||
if(cast.type != null && cast.amount > 0) {
|
||||
text.add(EnumChatFormatting.YELLOW + cast.type.names[0] + ": " + cast.amount + " / " + cast.getCapacity());
|
||||
}
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xFF4000, 0x401000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,6 +176,7 @@ public class FoundryChannel extends BlockContainer implements ICrucibleAcceptor
|
||||
}
|
||||
cast.amount = 0;
|
||||
cast.type = null;
|
||||
cast.propagateMaterial(null);
|
||||
cast.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FurnaceCombination extends BlockDummyable implements ITooltipProvider {
|
||||
|
||||
public FurnaceCombination() {
|
||||
@ -25,7 +24,7 @@ public class FurnaceCombination extends BlockDummyable implements ITooltipProvid
|
||||
return new TileEntityFurnaceCombination();
|
||||
return new TileEntityProxyCombo().inventory().fluid();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
|
||||
30
src/main/java/com/hbm/blocks/machine/MachineAmmoPress.java
Normal file
30
src/main/java/com/hbm/blocks/machine/MachineAmmoPress.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAmmoPress;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineAmmoPress extends BlockDummyable {
|
||||
|
||||
public MachineAmmoPress() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return meta >= 12 ? new TileEntityMachineAmmoPress() : new TileEntityProxyCombo().inventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {1, 0, 0, 0, 1, 1}; }
|
||||
@Override public int getOffset() { return 0; }
|
||||
}
|
||||
@ -7,7 +7,6 @@ import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@ -52,11 +51,11 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y, z + dir.offsetZ * o, new int[] {4, 0, 3, -2, 1, 1}, this, dir);
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
|
||||
this.makeExtra(world, x + dir.offsetX * 2 + rot.offsetX, y, z + dir.offsetZ * 2 + rot.offsetZ);
|
||||
this.makeExtra(world, x + dir.offsetX * 2 - rot.offsetX, y, z + dir.offsetZ * 2 - rot.offsetZ);
|
||||
this.makeExtra(world, x + rot.offsetX * 2 + dir.offsetX, y, z + rot.offsetZ * 2 + dir.offsetZ);
|
||||
@ -64,10 +63,10 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
|
||||
this.makeExtra(world, x - rot.offsetX * 2 + dir.offsetX, y, z - rot.offsetZ * 2 + dir.offsetZ);
|
||||
this.makeExtra(world, x - rot.offsetX * 2 - dir.offsetX, y, z - rot.offsetZ * 2 - dir.offsetZ);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
@ -77,7 +76,7 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
|
||||
return false;
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool && ((ItemTool) player.getHeldItem().getItem()).getToolClasses(player.getHeldItem()).contains("shovel")) {
|
||||
TileEntityMachineArcFurnaceLarge crucible = (TileEntityMachineArcFurnaceLarge) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
for(MaterialStack stack : crucible.liquids) {
|
||||
ItemStack scrap = ItemScraps.create(new MaterialStack(stack.material, stack.amount));
|
||||
if(!player.inventory.addItemStackToInventory(scrap)) {
|
||||
@ -85,11 +84,11 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
crucible.liquids.clear();
|
||||
crucible.markDirty();
|
||||
|
||||
|
||||
} else {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -22,6 +19,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MachineAutocrafter extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||
@ -72,7 +71,7 @@ public class MachineAutocrafter extends BlockContainer {
|
||||
ISidedInventory tile = (ISidedInventory) world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null) {
|
||||
|
||||
|
||||
for(int i1 = 10; i1 < tile.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tile.getStackInSlot(i1);
|
||||
|
||||
|
||||
@ -280,6 +280,9 @@ public class MachineBattery extends BlockContainer implements ILookOverlay, IPer
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.GOLD + "Stores up to "+ BobMathUtil.getShortNumber(this.maxPower) + "HE");
|
||||
list.add(EnumChatFormatting.GOLD + "Charge speed: "+ BobMathUtil.getShortNumber(this.maxPower / 200) + "HE");
|
||||
list.add(EnumChatFormatting.GOLD + "Discharge speed: "+ BobMathUtil.getShortNumber(this.maxPower / 600) + "HE");
|
||||
list.add(EnumChatFormatting.YELLOW + "" + BobMathUtil.getShortNumber(persistentTag.getLong("power")) + "/" + BobMathUtil.getShortNumber(this.maxPower) + "HE");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.IPersistentInfoProvider;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
@ -14,7 +11,6 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMachineBAT9000;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -28,6 +24,9 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineBigAssTank9000 extends BlockDummyable implements IPersistentInfoProvider {
|
||||
|
||||
public MachineBigAssTank9000(Material mat) {
|
||||
@ -36,7 +35,7 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12) return new TileEntityMachineBAT9000();
|
||||
if(meta >= 6) return new TileEntityProxyCombo(false, false, true);
|
||||
return null;
|
||||
@ -74,22 +73,22 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, 0, 1, 1, 2, -2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, 0, 1, 1, -2, 2}, x, y, z, dir)) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); //we can do this because nobody is stopping me from doing this
|
||||
return true;
|
||||
} else if(player.isSneaking()){
|
||||
@ -97,9 +96,9 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityMachineBAT9000 trialEntity = (TileEntityMachineBAT9000) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(trialEntity != null) {
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
||||
@ -115,7 +114,7 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||
@ -130,19 +129,19 @@ public class MachineBigAssTank9000 extends BlockDummyable implements IPersistent
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
|
||||
if(meta >= 6) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return 0;
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityMachineBAT9000))
|
||||
return 0;
|
||||
|
||||
|
||||
TileEntityMachineBAT9000 tank = (TileEntityMachineBAT9000) te;
|
||||
return tank.getComparatorPower();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityFurnaceBrick;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -24,6 +21,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MachineBrickFurnace extends BlockContainer {
|
||||
|
||||
private final Random rand = new Random();
|
||||
@ -38,7 +37,7 @@ public class MachineBrickFurnace extends BlockContainer {
|
||||
super(Material.iron);
|
||||
isActive = blockState;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
@ -47,7 +46,7 @@ public class MachineBrickFurnace extends BlockContainer {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_furnace_brick_front_on" : ":machine_furnace_brick_front_off"));
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_furnace_brick_side");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
@ -64,31 +63,31 @@ public class MachineBrickFurnace extends BlockContainer {
|
||||
public Item getItem(World world, int x, int y, int z) {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_furnace_brick_off);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote) {
|
||||
Block nZ = world.getBlock(x, y, z - 1);
|
||||
Block pZ = world.getBlock(x, y, z + 1);
|
||||
Block nX = world.getBlock(x - 1, y, z);
|
||||
Block pX = world.getBlock(x + 1, y, z);
|
||||
|
||||
|
||||
byte meta = 3;
|
||||
|
||||
|
||||
if(nZ.func_149730_j() && !pZ.func_149730_j()) meta = 3;
|
||||
if(pZ.func_149730_j() && !nZ.func_149730_j()) meta = 2;
|
||||
if(nX.func_149730_j() && !pX.func_149730_j()) meta = 5;
|
||||
if(pX.func_149730_j() && !nX.func_149730_j()) meta = 4;
|
||||
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
@ -96,10 +95,10 @@ public class MachineBrickFurnace extends BlockContainer {
|
||||
if(i == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
if(i == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
if(i == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
|
||||
|
||||
if(itemStack.hasDisplayName()) ((TileEntityFurnaceBrick)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
@ -119,22 +118,22 @@ public class MachineBrickFurnace extends BlockContainer {
|
||||
int i = world.getBlockMetadata(x, y, z);
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
keepInventory = true;
|
||||
|
||||
|
||||
if(isProcessing) {
|
||||
world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_on);
|
||||
} else {
|
||||
world.setBlock(x, y, z, ModBlocks.machine_furnace_brick_off);
|
||||
}
|
||||
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
|
||||
if(entity != null) {
|
||||
entity.validate();
|
||||
world.setTileEntity(x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if(!keepInventory) ItemStackUtil.spillItems(world, x, y, z, block, rand);
|
||||
|
||||
@ -10,9 +10,6 @@ import com.hbm.blocks.IPersistentInfoProvider;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
@ -22,7 +19,6 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -48,7 +44,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
@SideOnly(Side.CLIENT) public IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInnerTop;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconInnerSide;
|
||||
|
||||
|
||||
protected long power;
|
||||
String name;
|
||||
|
||||
@ -57,7 +53,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
this.power = power;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
@ -87,34 +83,37 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityCapacitor))
|
||||
return;
|
||||
|
||||
|
||||
TileEntityCapacitor battery = (TileEntityCapacitor) te;
|
||||
List<String> text = new ArrayList();
|
||||
text.add(BobMathUtil.getShortNumber(battery.getPower()) + " / " + BobMathUtil.getShortNumber(battery.getMaxPower()) + "HE");
|
||||
|
||||
|
||||
double percent = (double) battery.getPower() / (double) battery.getMaxPower();
|
||||
int charge = (int) Math.floor(percent * 10_000D);
|
||||
int color = ((int) (0xFF - 0xFF * percent)) << 16 | ((int)(0xFF * percent) << 8);
|
||||
text.add("&[" + color + "&]" + (charge / 100D) + "%");
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + "+" + BobMathUtil.getShortNumber(battery.powerReceived) + "HE/t");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + "-" + BobMathUtil.getShortNumber(battery.powerSent) + "HE/t");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.GOLD + "Stores up to "+ BobMathUtil.getShortNumber(this.power) + "HE");
|
||||
list.add(EnumChatFormatting.GOLD + "Charge speed: "+ BobMathUtil.getShortNumber(this.power / 200) + "HE");
|
||||
list.add(EnumChatFormatting.GOLD + "Discharge speed: "+ BobMathUtil.getShortNumber(this.power / 600) + "HE");
|
||||
list.add(EnumChatFormatting.YELLOW + "" + BobMathUtil.getShortNumber(persistentTag.getLong("power")) + "/" + BobMathUtil.getShortNumber(persistentTag.getLong("maxPower")) + "HE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
for(String s : I18nUtil.resolveKeyArray("tile.capacitor.desc")) list.add(EnumChatFormatting.YELLOW + s);
|
||||
} else {
|
||||
@ -123,7 +122,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||
@ -136,68 +135,68 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
|
||||
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
harvesters.set(player);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
harvesters.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, IBufPacketReceiver, IPersistentNBT {
|
||||
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, IPersistentNBT {
|
||||
|
||||
public long power;
|
||||
protected long maxPower;
|
||||
public long powerReceived;
|
||||
public long powerSent;
|
||||
|
||||
|
||||
public TileEntityCapacitor() { }
|
||||
|
||||
|
||||
public TileEntityCapacitor(long maxPower) {
|
||||
this.maxPower = maxPower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
ForgeDirection opp = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
ForgeDirection dir = opp.getOpposite();
|
||||
|
||||
|
||||
BlockPos pos = new BlockPos(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
|
||||
|
||||
boolean didStep = false;
|
||||
ForgeDirection last = null;
|
||||
|
||||
|
||||
while(worldObj.getBlock(pos.getX(), pos.getY(), pos.getZ()) == ModBlocks.capacitor_bus) {
|
||||
ForgeDirection current = ForgeDirection.getOrientation(worldObj.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ()));
|
||||
if(!didStep) last = current;
|
||||
didStep = true;
|
||||
|
||||
|
||||
if(last != current) {
|
||||
pos = null;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
pos = pos.offset(current);
|
||||
}
|
||||
|
||||
|
||||
if(pos != null && last != null) {
|
||||
this.tryUnsubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ());
|
||||
this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), last);
|
||||
}
|
||||
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + opp.offsetX, yCoord + opp.offsetY, zCoord + opp.offsetZ, opp);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 15));
|
||||
|
||||
networkPackNT(15);
|
||||
|
||||
this.powerSent = 0;
|
||||
this.powerReceived = 0;
|
||||
}
|
||||
@ -210,7 +209,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
buf.writeLong(powerReceived);
|
||||
buf.writeLong(powerSent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
power = buf.readLong();
|
||||
@ -232,7 +231,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
this.setPower(this.getMaxPower());
|
||||
return overshoot;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void usePower(long power) {
|
||||
this.powerSent += Math.min(this.getPower(), power);
|
||||
@ -249,6 +248,14 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override public long getProviderSpeed() {
|
||||
return this.getMaxPower() / 300;
|
||||
}
|
||||
|
||||
@Override public long getReceiverSpeed() {
|
||||
return this.getMaxPower() / 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionPriority getPriority() {
|
||||
return ConnectionPriority.LOW;
|
||||
@ -258,7 +265,7 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir == ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
@ -278,14 +285,14 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
this.power = data.getLong("power");
|
||||
this.maxPower = data.getLong("maxPower");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.power = nbt.getLong("power");
|
||||
this.maxPower = nbt.getLong("maxPower");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -20,8 +17,10 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock, ITooltipProvider {
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon topIcon;
|
||||
|
||||
public MachineCapacitorBus(Material mat) {
|
||||
@ -38,7 +37,7 @@ public class MachineCapacitorBus extends Block implements IEnergyConnectorBlock,
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == meta ? topIcon : blockIcon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
@ -11,7 +8,6 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticCracker;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -23,6 +19,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineCatalyticCracker extends BlockDummyable implements ILookOverlay {
|
||||
|
||||
public MachineCatalyticCracker(Material mat) {
|
||||
@ -31,12 +30,12 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityMachineCatalyticCracker();
|
||||
if(meta >= extra)
|
||||
return new TileEntityProxyCombo(false, false, true);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -49,33 +48,33 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver
|
||||
public int getOffset() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(!world.isRemote && !player.isSneaking()) {
|
||||
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityMachineCatalyticCracker))
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te;
|
||||
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
||||
cracker.tanks[0].setTankType(type);
|
||||
cracker.markDirty();
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -98,7 +97,7 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[]{13, 0, 0, 3, 2, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[]{14, -13, -1, 2, 1, 0}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[]{3, -1, 2, 3, -1, 3}, this, dir);
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
this.makeExtra(world, x + dir.offsetX * o + dir.offsetX * 3 + rot.offsetX, y + dir.offsetY * o, z + dir.offsetZ * o + dir.offsetZ * 3 + rot.offsetZ);
|
||||
@ -115,22 +114,22 @@ public class MachineCatalyticCracker extends BlockDummyable implements ILookOver
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityMachineCatalyticCracker))
|
||||
return;
|
||||
|
||||
|
||||
TileEntityMachineCatalyticCracker cracker = (TileEntityMachineCatalyticCracker) te;
|
||||
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
for(int i = 0; i < cracker.tanks.length; i++)
|
||||
text.add((i < 2 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + cracker.tanks[i].getTankType().getLocalizedName() + ": " + cracker.tanks[i].getFill() + "/" + cracker.tanks[i].getMaxFill() + "mB");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.IPersistentInfoProvider;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
@ -9,7 +7,6 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -19,6 +16,8 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MachineCatalyticReformer extends BlockDummyable implements IPersistentInfoProvider {
|
||||
|
||||
public MachineCatalyticReformer(Material mat) {
|
||||
@ -31,7 +30,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist
|
||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return standardOpenBehavior(world, x, y, z, player, side);
|
||||
@ -49,7 +48,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -3, 1, 0, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {6, -3, 1, 1, 2, 0}, this, dir);
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1);
|
||||
@ -72,7 +71,7 @@ public class MachineCatalyticReformer extends BlockDummyable implements IPersist
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
||||
tank.readFromNBT(persistentTag, "" + i);
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityChimneyBrick;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvider {
|
||||
|
||||
public MachineChimneyBrick(Material mat) {
|
||||
@ -22,7 +21,7 @@ public class MachineChimneyBrick extends BlockDummyable implements ITooltipProvi
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12) return new TileEntityChimneyBrick();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().fluid();
|
||||
return null;
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityChimneyIndustrial;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -14,6 +11,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MachineChimneyIndustrial extends BlockDummyable implements ITooltipProvider {
|
||||
|
||||
public MachineChimneyIndustrial(Material mat) {
|
||||
@ -22,7 +21,7 @@ public class MachineChimneyIndustrial extends BlockDummyable implements ITooltip
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12) return new TileEntityChimneyIndustrial();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().fluid();
|
||||
return null;
|
||||
|
||||
@ -1,23 +1,31 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Coolable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityChungus;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineChungus extends BlockDummyable implements ITooltipProvider {
|
||||
public class MachineChungus extends BlockDummyable implements ITooltipProvider, ILookOverlay {
|
||||
|
||||
public MachineChungus(Material mat) {
|
||||
super(mat);
|
||||
@ -135,4 +143,33 @@ public class MachineChungus extends BlockDummyable implements ITooltipProvider {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
this.addStandardInfo(stack, player, list, ext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!(te instanceof TileEntityChungus)) return;
|
||||
|
||||
TileEntityChungus chungus = (TileEntityChungus) te;
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
FluidTank tankInput = chungus.tanks[0];
|
||||
FluidTank tankOutput = chungus.tanks[1];
|
||||
|
||||
FluidType inputType = tankInput.getTankType();
|
||||
FluidType outputType = Fluids.NONE;
|
||||
|
||||
if(inputType.hasTrait(FT_Coolable.class)) {
|
||||
outputType = inputType.getTrait(FT_Coolable.class).coolsTo;
|
||||
}
|
||||
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + inputType.getLocalizedName() + ": " + tankInput.getFill() + "/" + tankInput.getMaxFill() + "mB");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + outputType.getLocalizedName() + ": " + tankOutput.getFill() + "/" + tankOutput.getMaxFill() + "mB");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(chungus.power) + "/" + BobMathUtil.getShortNumber(chungus.getMaxPower()) + "HE");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.blocks.machine;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCombustionEngine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -34,15 +33,15 @@ public class MachineCombustionEngine extends BlockDummyable {
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ);
|
||||
|
||||
@ -1,15 +1,11 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityCondenserPowered;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -17,6 +13,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineCondenserPowered extends BlockDummyable implements ILookOverlay {
|
||||
|
||||
public MachineCondenserPowered(Material mat) {
|
||||
@ -43,7 +42,7 @@ public class MachineCondenserPowered extends BlockDummyable implements ILookOver
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
|
||||
x = x + dir.offsetX * o;
|
||||
z = z + dir.offsetZ * o;
|
||||
|
||||
@ -70,7 +69,7 @@ public class MachineCondenserPowered extends BlockDummyable implements ILookOver
|
||||
|
||||
TileEntityCondenserPowered tower = (TileEntityCondenserPowered) te;
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
|
||||
text.add(BobMathUtil.getShortNumber(tower.power) + "HE / " + BobMathUtil.getShortNumber(tower.maxPower) + "HE");
|
||||
|
||||
for(int i = 0; i < tower.tanks.length; i++)
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import api.hbm.conveyor.IConveyorBelt;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
@ -10,9 +9,6 @@ import com.hbm.items.machine.ItemStamp;
|
||||
import com.hbm.tileentity.machine.TileEntityConveyorPress;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import api.hbm.conveyor.IConveyorBelt;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -25,6 +21,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineConveyorPress extends BlockDummyable implements IConveyorBelt, ILookOverlay, IToolable, ITooltipProvider {
|
||||
|
||||
public MachineConveyorPress(Material mat) {
|
||||
@ -46,25 +45,25 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityConveyorPress))
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
||||
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemStamp && press.slots[0] == null) {
|
||||
press.slots[0] = player.getHeldItem().copy();
|
||||
press.slots[0].stackSize = 1;
|
||||
@ -75,39 +74,39 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
|
||||
if(tool != ToolType.SCREWDRIVER) return false;
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityConveyorPress))
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
||||
|
||||
|
||||
if(press.slots[0] == null) return false;
|
||||
|
||||
|
||||
if(!player.inventory.addItemStackToInventory(press.slots[0].copy())) {
|
||||
EntityItem item = new EntityItem(world, x + 0.5, y + this.maxY, z + 0.5, press.slots[0].copy());
|
||||
world.spawnEntityInWorld(item);
|
||||
} else {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
|
||||
press.slots[0] = null;
|
||||
press.markChanged();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -121,7 +120,7 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
||||
Vec3 ret = Vec3.createVectorHelper(itemPos.xCoord + motion.xCoord / len * speed, itemPos.yCoord + motion.yCoord / len * speed, itemPos.zCoord + motion.zCoord / len * speed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public ForgeDirection getTravelDirection(World world, int x, int y, int z, Vec3 itemPos) {
|
||||
int meta = world.getBlockMetadata(x, y - 1, z) - offset;
|
||||
return ForgeDirection.getOrientation(meta).getRotation(ForgeDirection.UP);
|
||||
@ -148,21 +147,21 @@ public class MachineConveyorPress extends BlockDummyable implements IConveyorBel
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityConveyorPress))
|
||||
return;
|
||||
|
||||
|
||||
TileEntityConveyorPress press = (TileEntityConveyorPress) te;
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
text.add(BobMathUtil.getShortNumber(press.power) + "HE / " + BobMathUtil.getShortNumber(press.maxPower) + "HE");
|
||||
text.add("Installed stamp: " + ((press.syncStack == null || press.syncStack.getItem() == null) ? (EnumChatFormatting.RED + "NONE") : press.syncStack.getDisplayName()));
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCrystallizer;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -16,7 +15,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineCrystallizer extends BlockDummyable {
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@ -30,7 +29,7 @@ public class MachineCrystallizer extends BlockDummyable {
|
||||
if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
@ -60,7 +59,7 @@ public class MachineCrystallizer extends BlockDummyable {
|
||||
public int getOffset() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityDeuteriumExtractor;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@ -20,6 +16,9 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineDeuteriumExtractor extends BlockContainer implements ILookOverlay {
|
||||
|
||||
public MachineDeuteriumExtractor(Material mat) {
|
||||
@ -54,20 +53,20 @@ public class MachineDeuteriumExtractor extends BlockContainer implements ILookOv
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityDeuteriumExtractor))
|
||||
return;
|
||||
|
||||
|
||||
TileEntityDeuteriumExtractor extractor = (TileEntityDeuteriumExtractor) te;
|
||||
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add((extractor.power < extractor.getMaxPower() / 20 ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + "Power: " + BobMathUtil.getShortNumber(extractor.power) + "HE");
|
||||
|
||||
for(int i = 0; i < extractor.tanks.length; i++)
|
||||
text.add((i < 1 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + extractor.tanks[i].getTankType().getLocalizedName() + ": " + extractor.tanks[i].getFill() + "/" + extractor.tanks[i].getMaxFill() + "mB");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityDiFurnace;
|
||||
import com.hbm.util.Compat;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -20,7 +19,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineDiFurnaceExtension extends BlockContainer implements IProxyController {
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) private IIcon iconBottom;
|
||||
|
||||
@ -32,7 +31,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityProxyCombo().inventory().fluid();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
@ -40,7 +39,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":difurnace_extension");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":brick_fire");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(!player.isSneaking()) {
|
||||
@ -52,7 +51,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon;
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityDiFurnaceRTG;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -25,8 +22,10 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MachineDiFurnaceRTG extends BlockContainer {
|
||||
|
||||
|
||||
private final Random rand = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepInventory;
|
||||
@ -116,7 +115,7 @@ public class MachineDiFurnaceRTG extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
@ -145,7 +144,7 @@ public class MachineDiFurnaceRTG extends BlockContainer {
|
||||
} else {
|
||||
world.setBlock(x, y, z, ModBlocks.machine_difurnace_rtg_off);
|
||||
}
|
||||
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -25,12 +22,14 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MachineElectricFurnace extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepInventory;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
private IIcon iconTop;
|
||||
@ -40,7 +39,7 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
super(Material.iron);
|
||||
isActive = blockState;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
@ -49,7 +48,7 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_top");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_electric_furnace_bottom");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
@ -57,19 +56,19 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
//return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.iconTop);
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : side == 0 ? this.iconBottom : side == 1 ? this.iconTop : this.blockIcon);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
@ -77,9 +76,9 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 3;
|
||||
@ -96,15 +95,15 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
@ -121,13 +120,13 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
|
||||
if(itemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityMachineElectricFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
@ -155,23 +154,23 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
int i = world.getBlockMetadata(x, y, z);
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
keepInventory = true;
|
||||
|
||||
|
||||
if(isProcessing)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_on);
|
||||
}else{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_electric_furnace_off);
|
||||
}
|
||||
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
|
||||
if(entity != null) {
|
||||
entity.validate();
|
||||
world.setTileEntity(x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
@ -223,7 +222,7 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
||||
@ -265,4 +264,4 @@ public class MachineElectricFurnace extends BlockContainer {
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off);}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -33,19 +32,19 @@ public class MachineElectrolyser extends BlockDummyable {
|
||||
public int getOffset() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {2, -1, 5, 5, 1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -3, 5, 5, 0, 0}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, 4, -4, -3, 3}, this, dir);
|
||||
@ -58,7 +57,7 @@ public class MachineElectrolyser extends BlockDummyable {
|
||||
MultiblockHandlerXR.fillSpace(world, x, y + 3, z, new int[] {0, 0, 0, 0, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x - dir.offsetX * 2, y + 3, z - dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x - dir.offsetX * 4, y + 3, z - dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, this, dir);
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
this.makeExtra(world, x - dir.offsetX * 5, y, z - dir.offsetZ * 5);
|
||||
@ -84,13 +83,13 @@ public class MachineElectrolyser extends BlockDummyable {
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, 0, 0, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, -2, 2, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, -4, 4, -3, 3}, x, y, z, dir)) return false;
|
||||
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * 4, y + 3, z + dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * 2, y + 3, z + dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y + 3, z, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x - dir.offsetX * 2, y + 3, z - dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x - dir.offsetX * 4, y + 3, z - dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineExposureChamber;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -37,10 +36,10 @@ public class MachineExposureChamber extends BlockDummyable {
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, 0, 0, 0, -3, 8}, this, dir);
|
||||
@ -58,10 +57,10 @@ public class MachineExposureChamber extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP).getOpposite();
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, getDimensions(), x, y, z, dir)) return false;
|
||||
@ -70,10 +69,10 @@ public class MachineExposureChamber extends BlockDummyable {
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {0, 0, -1, 1, -3, 6}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, 1, -1, 0, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + rot.offsetX * 7, y, z + rot.offsetZ * 7, new int[] {3, 0, -1, 1, 0, 1}, x, y, z, dir)) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return super.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3;
|
||||
import com.hbm.entity.logic.EntityNukeExplosionMK3.ATEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MachineFieldDisturber extends Block {
|
||||
|
||||
public MachineFieldDisturber() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int tickRate(World world) {
|
||||
return 10;
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.IPersistentInfoProvider;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
@ -13,7 +10,6 @@ import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineFrackingTower;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -24,6 +20,9 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineFrackingTower extends BlockDummyable implements IPersistentInfoProvider {
|
||||
|
||||
public MachineFrackingTower() {
|
||||
@ -32,7 +31,7 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12) return new TileEntityMachineFrackingTower();
|
||||
if(meta >= 6) return new TileEntityProxyCombo(false, true, true);
|
||||
return null;
|
||||
@ -50,9 +49,9 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y + 2, z, new int[] {1, 0, 3, 3, 3, 3}, x, y, z, dir)) return false;
|
||||
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x - 2, y + 2, z - 2, new int[] {-1, 2, 0, 1, 0, 1}, x, y, z, ForgeDirection.NORTH)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x - 2, y + 2, z + 3, new int[] {-1, 2, 0, 1, 0, 1}, x, y, z, ForgeDirection.NORTH)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + 3, y + 2, z - 2, new int[] {-1, 2, 0, 1, 0, 1}, x, y, z, ForgeDirection.NORTH)) return false;
|
||||
@ -62,7 +61,7 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {24, -9, 1, 1, 1, 1}, x, y, z, dir)) return false;
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x, y + 15, z, new int[] {1, 0, 1, 1, -2, 3}, x, y, z, dir)) return false;
|
||||
|
||||
|
||||
return super.checkRequirement(world, x, y, z, dir, o);
|
||||
}
|
||||
|
||||
@ -78,29 +77,29 @@ public class MachineFrackingTower extends BlockDummyable implements IPersistentI
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {10, -4, 2, 2, 2, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {24, -9, 1, 1, 1, 1}, this, dir);
|
||||
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x, y + 15, z, new int[] {1, 0, 1, 1, -2, 3}, this, ForgeDirection.WEST);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return IPersistentNBT.getDrops(world, x, y, z, this);
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
@ -10,7 +7,6 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -22,6 +18,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MachineFractionTower extends BlockDummyable implements ILookOverlay {
|
||||
|
||||
public MachineFractionTower(Material mat) {
|
||||
@ -30,12 +29,12 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityMachineFractionTower();
|
||||
if(meta >= extra)
|
||||
return new TileEntityProxyCombo(false, false, true);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -48,25 +47,25 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
||||
public int getOffset() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(!world.isRemote && !player.isSneaking()) {
|
||||
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityMachineFractionTower))
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityMachineFractionTower frac = (TileEntityMachineFractionTower) te;
|
||||
|
||||
|
||||
if(world.getTileEntity(pos[0], pos[1] - 3, pos[2]) instanceof TileEntityMachineFractionTower) {
|
||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "You can only change the type in the bottom segment!"));
|
||||
} else {
|
||||
@ -75,11 +74,11 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
||||
frac.markDirty();
|
||||
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -88,7 +87,7 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
|
||||
x = x + dir.offsetX * o;
|
||||
z = z + dir.offsetZ * o;
|
||||
|
||||
@ -101,22 +100,22 @@ public class MachineFractionTower extends BlockDummyable implements ILookOverlay
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityMachineFractionTower))
|
||||
return;
|
||||
|
||||
|
||||
TileEntityMachineFractionTower cracker = (TileEntityMachineFractionTower) te;
|
||||
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
|
||||
for(int i = 0; i < cracker.tanks.length; i++)
|
||||
text.add((i == 0 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + cracker.tanks[i].getTankType().getLocalizedName() + ": " + cracker.tanks[i].getFill() + "/" + cracker.tanks[i].getMaxFill() + "mB");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
@ -14,7 +10,6 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityHeatBoilerIndustrial;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -27,6 +22,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILookOverlay, ITooltipProvider {
|
||||
|
||||
public MachineHeatBoilerIndustrial() {
|
||||
@ -35,32 +34,32 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
|
||||
if(meta >= 12) return new TileEntityHeatBoilerIndustrial();
|
||||
if(meta >= extra) return new TileEntityProxyCombo().fluid();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
|
||||
if(!world.isRemote && !player.isSneaking()) {
|
||||
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
||||
return false;
|
||||
|
||||
|
||||
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
||||
|
||||
|
||||
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, pos[0], pos[1], pos[2], player.getHeldItem());
|
||||
|
||||
|
||||
if(type.hasTrait(FT_Heatable.class) && type.getTrait(FT_Heatable.class).getEfficiency(HeatingType.BOILER) > 0) {
|
||||
boiler.tanks[0].setTankType(type);
|
||||
boiler.markDirty();
|
||||
@ -69,7 +68,7 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -98,24 +97,24 @@ public class MachineHeatBoilerIndustrial extends BlockDummyable implements ILook
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
|
||||
if(!(te instanceof TileEntityHeatBoilerIndustrial))
|
||||
return;
|
||||
|
||||
|
||||
TileEntityHeatBoilerIndustrial boiler = (TileEntityHeatBoilerIndustrial) te;
|
||||
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add(String.format(Locale.US, "%,d", boiler.heat) + "TU");
|
||||
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + boiler.tanks[0].getTankType().getLocalizedName() + ": " + String.format(Locale.US, "%,d", boiler.tanks[0].getFill()) + " / " + String.format(Locale.US, "%,d", boiler.tanks[0].getMaxFill()) + "mB");
|
||||
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + boiler.tanks[1].getTankType().getLocalizedName() + ": " + String.format(Locale.US, "%,d", boiler.tanks[1].getFill()) + " / " + String.format(Locale.US, "%,d", boiler.tanks[1].getMaxFill()) + "mB");
|
||||
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.IPersistentInfoProvider;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -18,6 +15,8 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MachineHydrotreater extends BlockDummyable implements IPersistentInfoProvider {
|
||||
|
||||
public MachineHydrotreater(Material mat) {
|
||||
@ -30,7 +29,7 @@ public class MachineHydrotreater extends BlockDummyable implements IPersistentIn
|
||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return standardOpenBehavior(world, x, y, z, player, side);
|
||||
@ -51,7 +50,7 @@ public class MachineHydrotreater extends BlockDummyable implements IPersistentIn
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
||||
tank.readFromNBT(persistentTag, "" + i);
|
||||
|
||||
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