Moved to RebornCore

This commit is contained in:
modmuss50 2015-11-08 12:15:45 +00:00
parent 50a830a101
commit 8abf6e5282
313 changed files with 3987 additions and 16508 deletions

View file

@ -116,8 +116,9 @@ dependencies {
compile 'Azanor:Thaumcraft:4.2.3.5:deobf@jar'
compile "com.github.azanor:baubles:1.0.1.10:deobf@jar"
compile name: "MineTweaker3", version: "1.7.10-3.0.9C", classifier: "Dev"
shade 'IC2-Classic-API-STANDALONE:IC2-Classic-API-STANDALONE:1.1.0.19-5:api'
shade 'IC2-Classic-API-STANDALONE:IC2-Classic-API-STANDALONE:0.0.0.1:dev'
compile 'RebornCore:RebornCore:1.1.0.19-5:api'
testCompile 'junit:junit:4.12'
}
@ -151,10 +152,6 @@ task deobfJar(type: Jar) {
}
jar {
manifest {
attributes 'FMLCorePlugin': 'techreborn.asm.LoadingPlugin'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
exclude "**/*.psd"
classifier = 'universal'
configurations.shade.each { dep ->

View file

@ -1,2 +1,2 @@
gource -f -1920x1080 --seconds-per-day 4 --auto-skip-seconds 1 --key --title "TechReborn"
gource -f -1920x1080 --seconds-per-day 1 --auto-skip-seconds 1 --key --title "TechReborn" --camera-mode overview --multi-sampling --hide filenames,mouse --file-idle-time 0 --bloom-multiplier 0.05 --bloom-intensity 0.75
pause

View file

@ -1,11 +0,0 @@
package cofh.api;
public class CoFHAPIProps {
private CoFHAPIProps() {
}
public static final String VERSION = "1.7.10R1.0.2";
}

View file

@ -1,158 +0,0 @@
package cofh.api.energy;
import net.minecraft.nbt.NBTTagCompound;
/**
* Reference implementation of {@link cofh.api.energy.IEnergyStorage}. Use/extend this or implement your own.
*
* @author King Lemming
*
*/
public class EnergyStorage implements IEnergyStorage {
protected int energy;
protected int capacity;
protected int maxReceive;
protected int maxExtract;
public EnergyStorage(int capacity) {
this(capacity, capacity, capacity);
}
public EnergyStorage(int capacity, int maxTransfer) {
this(capacity, maxTransfer, maxTransfer);
}
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
this.capacity = capacity;
this.maxReceive = maxReceive;
this.maxExtract = maxExtract;
}
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
this.energy = nbt.getInteger("Energy");
if (energy > capacity) {
energy = capacity;
}
return this;
}
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
if (energy < 0) {
energy = 0;
}
nbt.setInteger("Energy", energy);
return nbt;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
if (energy > capacity) {
energy = capacity;
}
}
public void setMaxTransfer(int maxTransfer) {
setMaxReceive(maxTransfer);
setMaxExtract(maxTransfer);
}
public void setMaxReceive(int maxReceive) {
this.maxReceive = maxReceive;
}
public void setMaxExtract(int maxExtract) {
this.maxExtract = maxExtract;
}
public int getMaxReceive() {
return maxReceive;
}
public int getMaxExtract() {
return maxExtract;
}
/**
* This function is included to allow for server -&gt; client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
* are guaranteed to have it.
*
* @param energy
*/
public void setEnergyStored(int energy) {
this.energy = energy;
if (this.energy > capacity) {
this.energy = capacity;
} else if (this.energy < 0) {
this.energy = 0;
}
}
/**
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
* externally, as not all IEnergyHandlers are guaranteed to have it.
*
* @param energy
*/
public void modifyEnergyStored(int energy) {
this.energy += energy;
if (this.energy > capacity) {
this.energy = capacity;
} else if (this.energy < 0) {
this.energy = 0;
}
}
/* IEnergyStorage */
@Override
public int receiveEnergy(int maxReceive, boolean simulate) {
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
}
return energyReceived;
}
@Override
public int extractEnergy(int maxExtract, boolean simulate) {
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
}
return energyExtracted;
}
@Override
public int getEnergyStored() {
return energy;
}
@Override
public int getMaxEnergyStored() {
return capacity;
}
}

View file

@ -1,21 +0,0 @@
package cofh.api.energy;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
* accept it; otherwise just use IEnergyHandler.
* <p>
* Note that {@link cofh.api.energy.IEnergyHandler} is an extension of this.
*
* @author King Lemming
*
*/
public interface IEnergyConnection {
/**
* Returns TRUE if the TileEntity can connect on a given side.
*/
boolean canConnectEnergy(ForgeDirection from);
}

View file

@ -1,52 +0,0 @@
package cofh.api.energy;
import net.minecraft.item.ItemStack;
/**
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
* <p>
* A reference implementation is provided {@link cofh.api.energy.ItemEnergyContainer}.
*
* @author King Lemming
*
*/
public interface IEnergyContainerItem {
/**
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
*
* @param container
* ItemStack to be charged.
* @param maxReceive
* Maximum amount of energy to be sent into the item.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received by the item.
*/
int receiveEnergy(ItemStack container, int maxReceive, boolean simulate);
/**
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
* discharged.
*
* @param container
* ItemStack to be discharged.
* @param maxExtract
* Maximum amount of energy to be extracted from the item.
* @param simulate
* If TRUE, the discharge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
*/
int extractEnergy(ItemStack container, int maxExtract, boolean simulate);
/**
* Get the amount of energy currently stored in the container item.
*/
int getEnergyStored(ItemStack container);
/**
* Get the max amount of energy that can be stored in the container item.
*/
int getMaxEnergyStored(ItemStack container);
}

View file

@ -1,58 +0,0 @@
package cofh.api.energy;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link cofh.api.energy.IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link cofh.api.energy.TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
// merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things)
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
*
* @param from
* Orientation the energy is received from.
* @param maxReceive
* Maximum amount of energy to receive.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
@Override
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
/**
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
*
* @param from
* Orientation the energy is extracted from.
* @param maxExtract
* Maximum amount of energy to extract.
* @param simulate
* If TRUE, the extraction will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted.
*/
@Override
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
@Override
int getEnergyStored(ForgeDirection from);
/**
* Returns the maximum amount of energy that can be stored.
*/
@Override
int getMaxEnergyStored(ForgeDirection from);
}

View file

@ -1,38 +0,0 @@
package cofh.api.energy;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link cofh.api.energy.IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link cofh.api.energy.TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyProvider extends IEnergyConnection {
/**
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
*
* @param from
* Orientation the energy is extracted from.
* @param maxExtract
* Maximum amount of energy to extract.
* @param simulate
* If TRUE, the extraction will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted.
*/
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(ForgeDirection from);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(ForgeDirection from);
}

View file

@ -1,38 +0,0 @@
package cofh.api.energy;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link cofh.api.energy.IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link cofh.api.energy.TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyReceiver extends IEnergyConnection {
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
*
* @param from
* Orientation the energy is received from.
* @param maxReceive
* Maximum amount of energy to receive.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(ForgeDirection from);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(ForgeDirection from);
}

View file

@ -1,46 +0,0 @@
package cofh.api.energy;
/**
* An energy storage is the unit of interaction with Energy inventories.<br>
* This is not to be implemented on TileEntities. This is for internal use only.
* <p>
* A reference implementation can be found at {@link cofh.api.energy.EnergyStorage}.
*
* @author King Lemming
*
*/
public interface IEnergyStorage {
/**
* Adds energy to the storage. Returns quantity of energy that was accepted.
*
* @param maxReceive
* Maximum amount of energy to be inserted.
* @param simulate
* If TRUE, the insertion will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
*/
int receiveEnergy(int maxReceive, boolean simulate);
/**
* Removes energy from the storage. Returns quantity of energy that was removed.
*
* @param maxExtract
* Maximum amount of energy to be extracted.
* @param simulate
* If TRUE, the extraction will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
*/
int extractEnergy(int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored();
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored();
}

View file

@ -1,117 +0,0 @@
package cofh.api.energy;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.List;
/**
* Reference implementation of {@link cofh.api.energy.IEnergyContainerItem}. Use/extend this or implement your own.
*
* @author King Lemming
*
*/
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
protected int capacity;
protected int maxReceive;
protected int maxExtract;
public ItemEnergyContainer() {
}
public ItemEnergyContainer(int capacity) {
this(capacity, capacity, capacity);
}
public ItemEnergyContainer(int capacity, int maxTransfer) {
this(capacity, maxTransfer, maxTransfer);
}
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
this.capacity = capacity;
this.maxReceive = maxReceive;
this.maxExtract = maxExtract;
}
public ItemEnergyContainer setCapacity(int capacity) {
this.capacity = capacity;
return this;
}
public void setMaxTransfer(int maxTransfer) {
setMaxReceive(maxTransfer);
setMaxExtract(maxTransfer);
}
public void setMaxReceive(int maxReceive) {
this.maxReceive = maxReceive;
}
public void setMaxExtract(int maxExtract) {
this.maxExtract = maxExtract;
}
/* IEnergyContainerItem */
@Override
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("Energy");
}
@Override
public int getMaxEnergyStored(ItemStack container) {
return capacity;
}
@Override
public void addInformation(ItemStack itemStack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
list.add(Integer.toString(getEnergyStored(itemStack)) + "/");
}
}

View file

@ -1,65 +0,0 @@
package cofh.api.energy;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Reference implementation of {@link cofh.api.energy.IEnergyHandler}. Use/extend this or implement your own.
*
* @author King Lemming
*
*/
public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
protected EnergyStorage storage = new EnergyStorage(32000);
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
storage.readFromNBT(nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
storage.writeToNBT(nbt);
}
/* IEnergyConnection */
@Override
public boolean canConnectEnergy(ForgeDirection from) {
return true;
}
/* IEnergyReceiver */
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
return storage.receiveEnergy(maxReceive, simulate);
}
/* IEnergyProvider */
@Override
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
return storage.extractEnergy(maxExtract, simulate);
}
/* IEnergyReceiver and IEnergyProvider */
@Override
public int getEnergyStored(ForgeDirection from) {
return storage.getEnergyStored();
}
@Override
public int getMaxEnergyStored(ForgeDirection from) {
return storage.getMaxEnergyStored();
}
}

View file

@ -1,10 +0,0 @@
/**
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
* http://www.teamcofh.com
*/
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
package cofh.api.energy;
import cofh.api.CoFHAPIProps;
import cpw.mods.fml.common.API;

View file

@ -1,9 +0,0 @@
/**
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
* http://www.teamcofh.com
*/
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
package cofh.api;
import cpw.mods.fml.common.API;

View file

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2013 "Erogenous Beef"
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,5 +0,0 @@
This code is not ours! We are using BeefCore.
https://github.com/erogenousbeef/BeefCore
For Licence infomation look at https://github.com/erogenousbeef/BeefCore/blob/master/README.md

View file

@ -1,45 +0,0 @@
package erogenousbeef.coreTR.common;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog;
public class BeefCoreLog {
private static final String CHANNEL = "BeefCore";
public static void log(Level level, String format, Object... data)
{
FMLLog.log(level, format, data);
}
public static void fatal(String format, Object... data)
{
log(Level.FATAL, format, data);
}
public static void error(String format, Object... data)
{
log(Level.ERROR, format, data);
}
public static void warning(String format, Object... data)
{
log(Level.WARN, format, data);
}
public static void info(String format, Object... data)
{
log(Level.INFO, format, data);
}
public static void debug(String format, Object... data)
{
log(Level.DEBUG, format, data);
}
public static void trace(String format, Object... data)
{
log(Level.TRACE, format, data);
}
}

View file

@ -1,213 +0,0 @@
package erogenousbeef.coreTR.common;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.util.ForgeDirection;
/*
* Simple wrapper class for XYZ coordinates.
*/
public class CoordTriplet implements Comparable {
public int x, y, z;
public CoordTriplet(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public int getChunkX()
{
return x >> 4;
}
public int getChunkZ()
{
return z >> 4;
}
public long getChunkXZHash()
{
return ChunkCoordIntPair.chunkXZ2Int(x >> 4, z >> 4);
}
@Override
public boolean equals(Object other)
{
if (other == null)
{
return false;
} else if (other instanceof CoordTriplet)
{
CoordTriplet otherTriplet = (CoordTriplet) other;
return this.x == otherTriplet.x && this.y == otherTriplet.y
&& this.z == otherTriplet.z;
} else
{
return false;
}
}
public void translate(ForgeDirection dir)
{
this.x += dir.offsetX;
this.y += dir.offsetY;
this.z += dir.offsetZ;
}
public boolean equals(int x, int y, int z)
{
return this.x == x && this.y == y && this.z == z;
}
// Suggested implementation from NetBeans 7.1
public int hashCode()
{
int hash = 7;
hash = 71 * hash + this.x;
hash = 71 * hash + this.y;
hash = 71 * hash + this.z;
return hash;
}
public CoordTriplet copy()
{
return new CoordTriplet(x, y, z);
}
public void copy(CoordTriplet other)
{
this.x = other.x;
this.y = other.y;
this.z = other.z;
}
public CoordTriplet[] getNeighbors()
{
return new CoordTriplet[]
{ new CoordTriplet(x + 1, y, z), new CoordTriplet(x - 1, y, z),
new CoordTriplet(x, y + 1, z), new CoordTriplet(x, y - 1, z),
new CoordTriplet(x, y, z + 1), new CoordTriplet(x, y, z - 1) };
}
// /// IComparable
@Override
public int compareTo(Object o)
{
if (o instanceof CoordTriplet)
{
CoordTriplet other = (CoordTriplet) o;
if (this.x < other.x)
{
return -1;
} else if (this.x > other.x)
{
return 1;
} else if (this.y < other.y)
{
return -1;
} else if (this.y > other.y)
{
return 1;
} else if (this.z < other.z)
{
return -1;
} else if (this.z > other.z)
{
return 1;
} else
{
return 0;
}
}
return 0;
}
// /// Really confusing code that should be cleaned up
public ForgeDirection getDirectionFromSourceCoords(int x, int y, int z)
{
if (this.x < x)
{
return ForgeDirection.WEST;
} else if (this.x > x)
{
return ForgeDirection.EAST;
} else if (this.y < y)
{
return ForgeDirection.DOWN;
} else if (this.y > y)
{
return ForgeDirection.UP;
} else if (this.z < z)
{
return ForgeDirection.SOUTH;
} else if (this.z > z)
{
return ForgeDirection.NORTH;
} else
{
return ForgeDirection.UNKNOWN;
}
}
public ForgeDirection getOppositeDirectionFromSourceCoords(int x, int y,
int z)
{
if (this.x < x)
{
return ForgeDirection.EAST;
} else if (this.x > x)
{
return ForgeDirection.WEST;
} else if (this.y < y)
{
return ForgeDirection.UP;
} else if (this.y > y)
{
return ForgeDirection.DOWN;
} else if (this.z < z)
{
return ForgeDirection.NORTH;
} else if (this.z > z)
{
return ForgeDirection.SOUTH;
} else
{
return ForgeDirection.UNKNOWN;
}
}
@Override
public String toString()
{
return String.format("(%d, %d, %d)", this.x, this.y, this.z);
}
public int compareTo(int xCoord, int yCoord, int zCoord)
{
if (this.x < xCoord)
{
return -1;
} else if (this.x > xCoord)
{
return 1;
} else if (this.y < yCoord)
{
return -1;
} else if (this.y > yCoord)
{
return 1;
} else if (this.z < zCoord)
{
return -1;
} else if (this.z > zCoord)
{
return 1;
} else
{
return 0;
}
}
}

View file

@ -1,16 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
/*
* Base class for multiblock-capable blocks. This is only a reference implementation
* and can be safely ignored.
*/
public abstract class BlockMultiblockBase extends BlockContainer {
protected BlockMultiblockBase(Material material)
{
super(material);
}
}

View file

@ -1,231 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import erogenousbeef.coreTR.common.CoordTriplet;
/**
* Basic interface for a multiblock machine part. This is defined as an abstract
* class as we need the basic functionality of a TileEntity as well. Preferably,
* you should derive from MultiblockTileEntityBase, which does all the hard work
* for you.
*
* {@link erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase}
*/
public abstract class IMultiblockPart extends TileEntity {
public static final int INVALID_DISTANCE = Integer.MAX_VALUE;
/**
* @return True if this block is connected to a multiblock controller. False
* otherwise.
*/
public abstract boolean isConnected();
/**
* @return The attached multiblock controller for this tile entity.
*/
public abstract MultiblockControllerBase getMultiblockController();
/**
* Returns the location of this tile entity in the world, in CoordTriplet
* form.
*
* @return A CoordTriplet with its x,y,z members set to the location of this
* tile entity in the world.
*/
public abstract CoordTriplet getWorldLocation();
// Multiblock connection-logic callbacks
/**
* Called after this block has been attached to a new multiblock controller.
*
* @param newController
* The new multiblock controller to which this tile entity is
* attached.
*/
public abstract void onAttached(MultiblockControllerBase newController);
/**
* Called after this block has been detached from a multiblock controller.
*
* @param multiblockController
* The multiblock controller that no longer controls this tile
* entity.
*/
public abstract void onDetached(
MultiblockControllerBase multiblockController);
/**
* Called when this block is being orphaned. Use this to copy game-data
* values that should persist despite a machine being broken. This should
* NOT mark the part as disconnected. onDetached will be called immediately
* afterwards.
*
* @see #onDetached(MultiblockControllerBase)
* @param oldController
* The controller which is orphaning this block.
* @param oldControllerSize
* The number of connected blocks in the controller prior to
* shedding orphans.
* @param newControllerSize
* The number of connected blocks in the controller after
* shedding orphans.
*/
public abstract void onOrphaned(MultiblockControllerBase oldController,
int oldControllerSize, int newControllerSize);
// Multiblock fuse/split helper methods. Here there be dragons.
/**
* Factory method. Creates a new multiblock controller and returns it. Does
* not attach this tile entity to it. Override this in your game code!
*
* @return A new Multiblock Controller, derived from
* MultiblockControllerBase.
*/
public abstract MultiblockControllerBase createNewMultiblock();
/**
* Retrieve the type of multiblock controller which governs this part. Used
* to ensure that incompatible multiblocks are not merged.
*
* @return The class/type of the multiblock controller which governs this
* type of part.
*/
public abstract Class<? extends MultiblockControllerBase> getMultiblockControllerType();
/**
* Called when this block is moved from its current controller into a new
* controller. A special case of attach/detach, done here for efficiency to
* avoid triggering lots of recalculation logic.
*
* @param newController
* The new controller into which this tile entity is being
* merged.
*/
public abstract void onAssimilated(MultiblockControllerBase newController);
// Multiblock connection data access.
// You generally shouldn't toy with these!
// They're for use by Multiblock Controllers.
/**
* Set that this block has been visited by your validation algorithms.
*/
public abstract void setVisited();
/**
* Set that this block has not been visited by your validation algorithms;
*/
public abstract void setUnvisited();
/**
* @return True if this block has been visited by your validation algorithms
* since the last reset.
*/
public abstract boolean isVisited();
/**
* Called when this block becomes the designated block for saving data and
* transmitting data across the wire.
*/
public abstract void becomeMultiblockSaveDelegate();
/**
* Called when this block is no longer the designated block for saving data
* and transmitting data across the wire.
*/
public abstract void forfeitMultiblockSaveDelegate();
/**
* Is this block the designated save/load & network delegate?
*/
public abstract boolean isMultiblockSaveDelegate();
/**
* Returns an array containing references to neighboring IMultiblockPart
* tile entities. Primarily a utility method. Only works after tileentity
* construction, so it cannot be used in
* MultiblockControllerBase::attachBlock.
*
* This method is chunk-safe on the server; it will not query for parts in
* chunks that are unloaded. Note that no method is chunk-safe on the
* client, because ChunkProviderClient is stupid.
*
* @return An array of references to neighboring IMultiblockPart tile
* entities.
*/
public abstract IMultiblockPart[] getNeighboringParts();
// Multiblock business-logic callbacks - implement these!
/**
* Called when a machine is fully assembled from the disassembled state,
* meaning it was broken by a player/entity action, not by chunk unloads.
* Note that, for non-square machines, the min/max coordinates may not
* actually be part of the machine! They form an outer bounding box for the
* whole machine itself.
*
* @param multiblockControllerBase
* The controller to which this part is being assembled.
*/
public abstract void onMachineAssembled(
MultiblockControllerBase multiblockControllerBase);
/**
* Called when the machine is broken for game reasons, e.g. a player removed
* a block or an explosion occurred.
*/
public abstract void onMachineBroken();
/**
* Called when the user activates the machine. This is not called by
* default, but is included as most machines have this game-logical concept.
*/
public abstract void onMachineActivated();
/**
* Called when the user deactivates the machine. This is not called by
* default, but is included as most machines have this game-logical concept.
*/
public abstract void onMachineDeactivated();
// Block events
/**
* Called when this part should check its neighbors. This method MUST NOT
* cause additional chunks to load. ALWAYS check to see if a chunk is loaded
* before querying for its tile entity This part should inform the
* controller that it is attaching at this time.
*
* @return A Set of multiblock controllers to which this object would like
* to attach. It should have attached to one of the controllers in
* this list. Return null if there are no compatible controllers
* nearby.
*/
public abstract Set<MultiblockControllerBase> attachToNeighbors();
/**
* Assert that this part is detached. If not, log a warning and set the
* part's controller to null. Do NOT fire the full disconnection logic.
*/
public abstract void assertDetached();
/**
* @return True if a part has multiblock game-data saved inside it.
*/
public abstract boolean hasMultiblockSaveData();
/**
* @return The part's saved multiblock game-data in NBT format, or null if
* there isn't any.
*/
public abstract NBTTagCompound getMultiblockSaveData();
/**
* Called after a block is added and the controller has incorporated the
* part's saved multiblock game-data into itself. Generally, you should
* clear the saved data here.
*/
public abstract void onMultiblockDataAssimilated();
}

View file

@ -1,17 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import net.minecraft.client.Minecraft;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
public class MultiblockClientTickHandler {
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event)
{
if (event.phase == TickEvent.Phase.START)
{
MultiblockRegistry.tickStart(Minecraft.getMinecraft().theWorld);
}
}
}

View file

@ -1,32 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
/**
* In your mod, subscribe this on both the client and server sides side to
* handle chunk load events for your multiblock machines. Chunks can load
* asynchronously in environments like MCPC+, so we cannot process any blocks
* that are in chunks which are still loading.
*/
public class MultiblockEventHandler {
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onChunkLoad(ChunkEvent.Load loadEvent)
{
Chunk chunk = loadEvent.getChunk();
World world = loadEvent.world;
MultiblockRegistry.onChunkLoaded(world, chunk.xPosition,
chunk.zPosition);
}
// Cleanup, for nice memory usageness
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onWorldUnload(WorldEvent.Unload unloadWorldEvent)
{
MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.world);
}
}

View file

@ -1,179 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import java.util.HashMap;
import java.util.Set;
import net.minecraft.world.World;
import erogenousbeef.coreTR.common.BeefCoreLog;
/**
* This is a very static singleton registry class which directs incoming events
* to sub-objects, which actually manage each individual world's multiblocks.
*
* @author Erogenous Beef
*/
public class MultiblockRegistry {
// World > WorldRegistry map
private static HashMap<World, MultiblockWorldRegistry> registries = new HashMap<World, MultiblockWorldRegistry>();
/**
* Called before Tile Entities are ticked in the world. Do bookkeeping here.
*
* @param world
* The world being ticked
*/
public static void tickStart(World world)
{
if (registries.containsKey(world))
{
MultiblockWorldRegistry registry = registries.get(world);
registry.processMultiblockChanges();
registry.tickStart();
}
}
/**
* Called when the world has finished loading a chunk.
*
* @param world
* The world which has finished loading a chunk
* @param chunkX
* The X coordinate of the chunk
* @param chunkZ
* The Z coordinate of the chunk
*/
public static void onChunkLoaded(World world, int chunkX, int chunkZ)
{
if (registries.containsKey(world))
{
registries.get(world).onChunkLoaded(chunkX, chunkZ);
}
}
/**
* Register a new part in the system. The part has been created either
* through user action or via a chunk loading.
*
* @param world
* The world into which this part is loading.
* @param part
* The part being loaded.
*/
public static void onPartAdded(World world, IMultiblockPart part)
{
MultiblockWorldRegistry registry = getOrCreateRegistry(world);
registry.onPartAdded(part);
}
/**
* Call to remove a part from world lists.
*
* @param world
* The world from which a multiblock part is being removed.
* @param part
* The part being removed.
*/
public static void onPartRemovedFromWorld(World world, IMultiblockPart part)
{
if (registries.containsKey(world))
{
registries.get(world).onPartRemovedFromWorld(part);
}
}
/**
* Called whenever a world is unloaded. Unload the relevant registry, if we
* have one.
*
* @param world
* The world being unloaded.
*/
public static void onWorldUnloaded(World world)
{
if (registries.containsKey(world))
{
registries.get(world).onWorldUnloaded();
registries.remove(world);
}
}
/**
* Call to mark a controller as dirty. Dirty means that parts have been
* added or removed this tick.
*
* @param world
* The world containing the multiblock
* @param controller
* The dirty controller
*/
public static void addDirtyController(World world,
MultiblockControllerBase controller)
{
if (registries.containsKey(world))
{
registries.get(world).addDirtyController(controller);
} else
{
throw new IllegalArgumentException(
"Adding a dirty controller to a world that has no registered controllers!");
}
}
/**
* Call to mark a controller as dead. It should only be marked as dead when
* it has no connected parts. It will be removed after the next world tick.
*
* @param world
* The world formerly containing the multiblock
* @param controller
* The dead controller
*/
public static void addDeadController(World world,
MultiblockControllerBase controller)
{
if (registries.containsKey(world))
{
registries.get(world).addDeadController(controller);
} else
{
BeefCoreLog
.warning(
"Controller %d in world %s marked as dead, but that world is not tracked! Controller is being ignored.",
controller.hashCode(), world);
}
}
/**
* @param world
* The world whose controllers you wish to retrieve.
* @return An unmodifiable set of controllers active in the given world, or
* null if there are none.
*/
public static Set<MultiblockControllerBase> getControllersFromWorld(
World world)
{
if (registries.containsKey(world))
{
return registries.get(world).getControllers();
}
return null;
}
// / *** PRIVATE HELPERS *** ///
private static MultiblockWorldRegistry getOrCreateRegistry(World world)
{
if (registries.containsKey(world))
{
return registries.get(world);
} else
{
MultiblockWorldRegistry newRegistry = new MultiblockWorldRegistry(
world);
registries.put(world, newRegistry);
return newRegistry;
}
}
}

View file

@ -1,24 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
/**
* This is a generic multiblock tick handler. If you are using this code on your
* own, you will need to register this with the Forge TickRegistry on both the
* client AND server sides. Note that different types of ticks run on different
* parts of the system. CLIENT ticks only run on the client, at the start/end of
* each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
* ticks run only on the server, and only when worlds are loaded.
*/
public class MultiblockServerTickHandler {
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event)
{
if (event.phase == TickEvent.Phase.START)
{
MultiblockRegistry.tickStart(event.world);
}
}
}

View file

@ -1,437 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.chunk.IChunkProvider;
import erogenousbeef.coreTR.common.BeefCoreLog;
import erogenousbeef.coreTR.common.CoordTriplet;
/**
* Base logic class for Multiblock-connected tile entities. Most multiblock
* machines should derive from this and implement their game logic in certain
* abstract methods.
*/
public abstract class MultiblockTileEntityBase extends IMultiblockPart {
private MultiblockControllerBase controller;
private boolean visited;
private boolean saveMultiblockData;
private NBTTagCompound cachedMultiblockData;
private boolean paused;
public MultiblockTileEntityBase()
{
super();
controller = null;
visited = false;
saveMultiblockData = false;
paused = false;
cachedMultiblockData = null;
}
// /// Multiblock Connection Base Logic
@Override
public Set<MultiblockControllerBase> attachToNeighbors()
{
Set<MultiblockControllerBase> controllers = null;
MultiblockControllerBase bestController = null;
// Look for a compatible controller in our neighboring parts.
IMultiblockPart[] partsToCheck = getNeighboringParts();
for (IMultiblockPart neighborPart : partsToCheck)
{
if (neighborPart.isConnected())
{
MultiblockControllerBase candidate = neighborPart
.getMultiblockController();
if (!candidate.getClass().equals(
this.getMultiblockControllerType()))
{
// Skip multiblocks with incompatible types
continue;
}
if (controllers == null)
{
controllers = new HashSet<MultiblockControllerBase>();
bestController = candidate;
} else if (!controllers.contains(candidate)
&& candidate.shouldConsume(bestController))
{
bestController = candidate;
}
controllers.add(candidate);
}
}
// If we've located a valid neighboring controller, attach to it.
if (bestController != null)
{
// attachBlock will call onAttached, which will set the controller.
this.controller = bestController;
bestController.attachBlock(this);
}
return controllers;
}
@Override
public void assertDetached()
{
if (this.controller != null)
{
BeefCoreLog
.info("[assert] Part @ (%d, %d, %d) should be detached already, but detected that it was not. This is not a fatal error, and will be repaired, but is unusual.",
xCoord, yCoord, zCoord);
this.controller = null;
}
}
// /// Overrides from base TileEntity methods
@Override
public void readFromNBT(NBTTagCompound data)
{
super.readFromNBT(data);
// We can't directly initialize a multiblock controller yet, so we cache
// the data here until
// we receive a validate() call, which creates the controller and hands
// off the cached data.
if (data.hasKey("multiblockData"))
{
this.cachedMultiblockData = data.getCompoundTag("multiblockData");
}
}
@Override
public void writeToNBT(NBTTagCompound data)
{
super.writeToNBT(data);
if (isMultiblockSaveDelegate() && isConnected())
{
NBTTagCompound multiblockData = new NBTTagCompound();
this.controller.writeToNBT(multiblockData);
data.setTag("multiblockData", multiblockData);
}
}
/**
* Generally, TileEntities that are part of a multiblock should not
* subscribe to updates from the main game loop. Instead, you should have
* lists of TileEntities which need to be notified during an update() in
* your Controller and perform callbacks from there.
*
* @see net.minecraft.tileentity.TileEntity#canUpdate()
*/
@Override
public boolean canUpdate()
{
return false;
}
/**
* Called when a block is removed by game actions, such as a player breaking
* the block or the block being changed into another block.
*
* @see net.minecraft.tileentity.TileEntity#invalidate()
*/
@Override
public void invalidate()
{
super.invalidate();
detachSelf(false);
}
/**
* Called from Minecraft's tile entity loop, after all tile entities have
* been ticked, as the chunk in which this tile entity is contained is
* unloading. Happens before the Forge TickEnd event.
*
* @see net.minecraft.tileentity.TileEntity#onChunkUnload()
*/
@Override
public void onChunkUnload()
{
super.onChunkUnload();
detachSelf(true);
}
/**
* This is called when a block is being marked as valid by the chunk, but
* has not yet fully been placed into the world's TileEntity cache.
* this.worldObj, xCoord, yCoord and zCoord have been initialized, but any
* attempts to read data about the world can cause infinite loops - if you
* call getTileEntity on this TileEntity's coordinate from within
* validate(), you will blow your call stack.
*
* TL;DR: Here there be dragons.
*
* @see net.minecraft.tileentity.TileEntity#validate()
*/
@Override
public void validate()
{
super.validate();
MultiblockRegistry.onPartAdded(this.worldObj, this);
}
// Network Communication
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound packetData = new NBTTagCompound();
encodeDescriptionPacket(packetData);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0,
packetData);
}
@Override
public void onDataPacket(NetworkManager network,
S35PacketUpdateTileEntity packet)
{
decodeDescriptionPacket(packet.func_148857_g());
}
// /// Things to override in most implementations (IMultiblockPart)
/**
* Override this to easily modify the description packet's data without
* having to worry about sending the packet itself. Decode this data in
* decodeDescriptionPacket.
*
* @param packetData
* An NBT compound tag into which you should write your custom
* description data.
* @see erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase#decodeDescriptionPacket(NBTTagCompound)
*/
protected void encodeDescriptionPacket(NBTTagCompound packetData)
{
if (this.isMultiblockSaveDelegate() && isConnected())
{
NBTTagCompound tag = new NBTTagCompound();
getMultiblockController().formatDescriptionPacket(tag);
packetData.setTag("multiblockData", tag);
}
}
/**
* Override this to easily read in data from a TileEntity's description
* packet. Encoded in encodeDescriptionPacket.
*
* @param packetData
* The NBT data from the tile entity's description packet.
* @see erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase#encodeDescriptionPacket(NBTTagCompound)
*/
protected void decodeDescriptionPacket(NBTTagCompound packetData)
{
if (packetData.hasKey("multiblockData"))
{
NBTTagCompound tag = packetData.getCompoundTag("multiblockData");
if (isConnected())
{
getMultiblockController().decodeDescriptionPacket(tag);
} else
{
// This part hasn't been added to a machine yet, so cache the
// data.
this.cachedMultiblockData = tag;
}
}
}
@Override
public boolean hasMultiblockSaveData()
{
return this.cachedMultiblockData != null;
}
@Override
public NBTTagCompound getMultiblockSaveData()
{
return this.cachedMultiblockData;
}
@Override
public void onMultiblockDataAssimilated()
{
this.cachedMultiblockData = null;
}
// /// Game logic callbacks (IMultiblockPart)
@Override
public abstract void onMachineAssembled(
MultiblockControllerBase multiblockControllerBase);
@Override
public abstract void onMachineBroken();
@Override
public abstract void onMachineActivated();
@Override
public abstract void onMachineDeactivated();
// /// Miscellaneous multiblock-assembly callbacks and support methods
// (IMultiblockPart)
@Override
public boolean isConnected()
{
return (controller != null);
}
@Override
public MultiblockControllerBase getMultiblockController()
{
return controller;
}
@Override
public CoordTriplet getWorldLocation()
{
return new CoordTriplet(this.xCoord, this.yCoord, this.zCoord);
}
@Override
public void becomeMultiblockSaveDelegate()
{
this.saveMultiblockData = true;
}
@Override
public void forfeitMultiblockSaveDelegate()
{
this.saveMultiblockData = false;
}
@Override
public boolean isMultiblockSaveDelegate()
{
return this.saveMultiblockData;
}
@Override
public void setUnvisited()
{
this.visited = false;
}
@Override
public void setVisited()
{
this.visited = true;
}
@Override
public boolean isVisited()
{
return this.visited;
}
@Override
public void onAssimilated(MultiblockControllerBase newController)
{
assert (this.controller != newController);
this.controller = newController;
}
@Override
public void onAttached(MultiblockControllerBase newController)
{
this.controller = newController;
}
@Override
public void onDetached(MultiblockControllerBase oldController)
{
this.controller = null;
}
@Override
public abstract MultiblockControllerBase createNewMultiblock();
@Override
public IMultiblockPart[] getNeighboringParts()
{
CoordTriplet[] neighbors = new CoordTriplet[]
{ new CoordTriplet(this.xCoord - 1, this.yCoord, this.zCoord),
new CoordTriplet(this.xCoord, this.yCoord - 1, this.zCoord),
new CoordTriplet(this.xCoord, this.yCoord, this.zCoord - 1),
new CoordTriplet(this.xCoord, this.yCoord, this.zCoord + 1),
new CoordTriplet(this.xCoord, this.yCoord + 1, this.zCoord),
new CoordTriplet(this.xCoord + 1, this.yCoord, this.zCoord) };
TileEntity te;
List<IMultiblockPart> neighborParts = new ArrayList<IMultiblockPart>();
IChunkProvider chunkProvider = worldObj.getChunkProvider();
for (CoordTriplet neighbor : neighbors)
{
if (!chunkProvider.chunkExists(neighbor.getChunkX(),
neighbor.getChunkZ()))
{
// Chunk not loaded, skip it.
continue;
}
te = this.worldObj
.getTileEntity(neighbor.x, neighbor.y, neighbor.z);
if (te instanceof IMultiblockPart)
{
neighborParts.add((IMultiblockPart) te);
}
}
IMultiblockPart[] tmp = new IMultiblockPart[neighborParts.size()];
return neighborParts.toArray(tmp);
}
@Override
public void onOrphaned(MultiblockControllerBase controller, int oldSize,
int newSize)
{
this.markDirty();
worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
}
// // Helper functions for notifying neighboring blocks
protected void notifyNeighborsOfBlockChange()
{
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord,
getBlockType());
}
protected void notifyNeighborsOfTileChange()
{
worldObj.func_147453_f(xCoord, yCoord, zCoord, getBlockType());
}
// /// Private/Protected Logic Helpers
/*
* Detaches this block from its controller. Calls detachBlock() and clears
* the controller member.
*/
protected void detachSelf(boolean chunkUnloading)
{
if (this.controller != null)
{
// Clean part out of controller
this.controller.detachBlock(this, chunkUnloading);
// The above should call onDetached, but, just in case...
this.controller = null;
}
// Clean part out of lists in the registry
MultiblockRegistry.onPartRemovedFromWorld(worldObj, this);
}
}

View file

@ -1,15 +0,0 @@
package erogenousbeef.coreTR.multiblock;
/**
* An exception thrown when trying to validate a multiblock. Requires a string
* describing why the multiblock could not assemble.
*
* @author Erogenous Beef
*/
public class MultiblockValidationException extends Exception {
public MultiblockValidationException(String reason)
{
super(reason);
}
}

View file

@ -1,538 +0,0 @@
package erogenousbeef.coreTR.multiblock;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import erogenousbeef.coreTR.common.BeefCoreLog;
import erogenousbeef.coreTR.common.CoordTriplet;
/**
* This class manages all the multiblock controllers that exist in a given
* world, either client- or server-side. You must create different registries
* for server and client worlds.
*
* @author Erogenous Beef
*/
public class MultiblockWorldRegistry {
private World worldObj;
private Set<MultiblockControllerBase> controllers; // Active controllers
private Set<MultiblockControllerBase> dirtyControllers; // Controllers whose
// parts lists have
// changed
private Set<MultiblockControllerBase> deadControllers; // Controllers which
// are empty
// A list of orphan parts - parts which currently have no master, but should
// seek one this tick
// Indexed by the hashed chunk coordinate
// This can be added-to asynchronously via chunk loads!
private Set<IMultiblockPart> orphanedParts;
// A list of parts which have been detached during internal operations
private Set<IMultiblockPart> detachedParts;
// A list of parts whose chunks have not yet finished loading
// They will be added to the orphan list when they are finished loading.
// Indexed by the hashed chunk coordinate
// This can be added-to asynchronously via chunk loads!
private HashMap<Long, Set<IMultiblockPart>> partsAwaitingChunkLoad;
// Mutexes to protect lists which may be changed due to asynchronous events,
// such as chunk loads
private Object partsAwaitingChunkLoadMutex;
private Object orphanedPartsMutex;
public MultiblockWorldRegistry(World world)
{
worldObj = world;
controllers = new HashSet<MultiblockControllerBase>();
deadControllers = new HashSet<MultiblockControllerBase>();
dirtyControllers = new HashSet<MultiblockControllerBase>();
detachedParts = new HashSet<IMultiblockPart>();
orphanedParts = new HashSet<IMultiblockPart>();
partsAwaitingChunkLoad = new HashMap<Long, Set<IMultiblockPart>>();
partsAwaitingChunkLoadMutex = new Object();
orphanedPartsMutex = new Object();
}
/**
* Called before Tile Entities are ticked in the world. Run game logic.
*/
public void tickStart()
{
if (controllers.size() > 0)
{
for (MultiblockControllerBase controller : controllers)
{
if (controller.worldObj == worldObj
&& controller.worldObj.isRemote == worldObj.isRemote)
{
if (controller.isEmpty())
{
// This happens on the server when the user breaks the
// last block. It's fine.
// Mark 'er dead and move on.
deadControllers.add(controller);
} else
{
// Run the game logic for this world
controller.updateMultiblockEntity();
}
}
}
}
}
/**
* Called prior to processing multiblock controllers. Do bookkeeping.
*/
public void processMultiblockChanges()
{
IChunkProvider chunkProvider = worldObj.getChunkProvider();
CoordTriplet coord;
// Merge pools - sets of adjacent machines which should be merged later
// on in processing
List<Set<MultiblockControllerBase>> mergePools = null;
if (orphanedParts.size() > 0)
{
Set<IMultiblockPart> orphansToProcess = null;
// Keep the synchronized block small. We can't iterate over
// orphanedParts directly
// because the client does not know which chunks are actually
// loaded, so attachToNeighbors()
// is not chunk-safe on the client, because Minecraft is stupid.
// It's possible to polyfill this, but the polyfill is too slow for
// comfort.
synchronized (orphanedPartsMutex)
{
if (orphanedParts.size() > 0)
{
orphansToProcess = orphanedParts;
orphanedParts = new HashSet<IMultiblockPart>();
}
}
if (orphansToProcess != null && orphansToProcess.size() > 0)
{
Set<MultiblockControllerBase> compatibleControllers;
// Process orphaned blocks
// These are blocks that exist in a valid chunk and require a
// controller
for (IMultiblockPart orphan : orphansToProcess)
{
coord = orphan.getWorldLocation();
if (!chunkProvider.chunkExists(coord.getChunkX(),
coord.getChunkZ()))
{
continue;
}
// This can occur on slow machines.
if (orphan.isInvalid())
{
continue;
}
if (worldObj.getTileEntity(coord.x, coord.y, coord.z) != orphan)
{
// This block has been replaced by another.
continue;
}
// THIS IS THE ONLY PLACE WHERE PARTS ATTACH TO MACHINES
// Try to attach to a neighbor's master controller
compatibleControllers = orphan.attachToNeighbors();
if (compatibleControllers == null)
{
// FOREVER ALONE! Create and register a new controller.
// THIS IS THE ONLY PLACE WHERE NEW CONTROLLERS ARE
// CREATED.
MultiblockControllerBase newController = orphan
.createNewMultiblock();
newController.attachBlock(orphan);
this.controllers.add(newController);
} else if (compatibleControllers.size() > 1)
{
if (mergePools == null)
{
mergePools = new ArrayList<Set<MultiblockControllerBase>>();
}
// THIS IS THE ONLY PLACE WHERE MERGES ARE DETECTED
// Multiple compatible controllers indicates an
// impending merge.
// Locate the appropriate merge pool(s)
boolean hasAddedToPool = false;
List<Set<MultiblockControllerBase>> candidatePools = new ArrayList<Set<MultiblockControllerBase>>();
for (Set<MultiblockControllerBase> candidatePool : mergePools)
{
if (!Collections.disjoint(candidatePool,
compatibleControllers))
{
// They share at least one element, so that
// means they will all touch after the merge
candidatePools.add(candidatePool);
}
}
if (candidatePools.size() <= 0)
{
// No pools nearby, create a new merge pool
mergePools.add(compatibleControllers);
} else if (candidatePools.size() == 1)
{
// Only one pool nearby, simply add to that one
candidatePools.get(0).addAll(compatibleControllers);
} else
{
// Multiple pools- merge into one, then add the
// compatible controllers
Set<MultiblockControllerBase> masterPool = candidatePools
.get(0);
Set<MultiblockControllerBase> consumedPool;
for (int i = 1; i < candidatePools.size(); i++)
{
consumedPool = candidatePools.get(i);
masterPool.addAll(consumedPool);
mergePools.remove(consumedPool);
}
masterPool.addAll(compatibleControllers);
}
}
}
}
}
if (mergePools != null && mergePools.size() > 0)
{
// Process merges - any machines that have been marked for merge
// should be merged
// into the "master" machine.
// To do this, we combine lists of machines that are touching one
// another and therefore
// should voltron the fuck up.
for (Set<MultiblockControllerBase> mergePool : mergePools)
{
// Search for the new master machine, which will take over all
// the blocks contained in the other machines
MultiblockControllerBase newMaster = null;
for (MultiblockControllerBase controller : mergePool)
{
if (newMaster == null
|| controller.shouldConsume(newMaster))
{
newMaster = controller;
}
}
if (newMaster == null)
{
BeefCoreLog
.fatal("Multiblock system checked a merge pool of size %d, found no master candidates. This should never happen.",
mergePool.size());
} else
{
// Merge all the other machines into the master machine,
// then unregister them
addDirtyController(newMaster);
for (MultiblockControllerBase controller : mergePool)
{
if (controller != newMaster)
{
newMaster.assimilate(controller);
addDeadController(controller);
addDirtyController(newMaster);
}
}
}
}
}
// Process splits and assembly
// Any controllers which have had parts removed must be checked to see
// if some parts are no longer
// physically connected to their master.
if (dirtyControllers.size() > 0)
{
Set<IMultiblockPart> newlyDetachedParts = null;
for (MultiblockControllerBase controller : dirtyControllers)
{
// Tell the machine to check if any parts are disconnected.
// It should return a set of parts which are no longer
// connected.
// POSTCONDITION: The controller must have informed those parts
// that
// they are no longer connected to this machine.
newlyDetachedParts = controller.checkForDisconnections();
if (!controller.isEmpty())
{
controller.recalculateMinMaxCoords();
controller.checkIfMachineIsWhole();
} else
{
addDeadController(controller);
}
if (newlyDetachedParts != null && newlyDetachedParts.size() > 0)
{
// Controller has shed some parts - add them to the detached
// list for delayed processing
detachedParts.addAll(newlyDetachedParts);
}
}
dirtyControllers.clear();
}
// Unregister dead controllers
if (deadControllers.size() > 0)
{
for (MultiblockControllerBase controller : deadControllers)
{
// Go through any controllers which have marked themselves as
// potentially dead.
// Validate that they are empty/dead, then unregister them.
if (!controller.isEmpty())
{
BeefCoreLog
.fatal("Found a non-empty controller. Forcing it to shed its blocks and die. This should never happen!");
detachedParts.addAll(controller.detachAllBlocks());
}
// THIS IS THE ONLY PLACE WHERE CONTROLLERS ARE UNREGISTERED.
this.controllers.remove(controller);
}
deadControllers.clear();
}
// Process detached blocks
// Any blocks which have been detached this tick should be moved to the
// orphaned
// list, and will be checked next tick to see if their chunk is still
// loaded.
for (IMultiblockPart part : detachedParts)
{
// Ensure parts know they're detached
part.assertDetached();
}
addAllOrphanedPartsThreadsafe(detachedParts);
detachedParts.clear();
}
/**
* Called when a multiblock part is added to the world, either via
* chunk-load or user action. If its chunk is loaded, it will be processed
* during the next tick. If the chunk is not loaded, it will be added to a
* list of objects waiting for a chunkload.
*
* @param part
* The part which is being added to this world.
*/
public void onPartAdded(IMultiblockPart part)
{
CoordTriplet worldLocation = part.getWorldLocation();
if (!worldObj.getChunkProvider().chunkExists(worldLocation.getChunkX(),
worldLocation.getChunkZ()))
{
// Part goes into the waiting-for-chunk-load list
Set<IMultiblockPart> partSet;
long chunkHash = worldLocation.getChunkXZHash();
synchronized (partsAwaitingChunkLoadMutex)
{
if (!partsAwaitingChunkLoad.containsKey(chunkHash))
{
partSet = new HashSet<IMultiblockPart>();
partsAwaitingChunkLoad.put(chunkHash, partSet);
} else
{
partSet = partsAwaitingChunkLoad.get(chunkHash);
}
partSet.add(part);
}
} else
{
// Part goes into the orphan queue, to be checked this tick
addOrphanedPartThreadsafe(part);
}
}
/**
* Called when a part is removed from the world, via user action or via
* chunk unloads. This part is removed from any lists in which it may be,
* and its machine is marked for recalculation.
*
* @param part
* The part which is being removed.
*/
public void onPartRemovedFromWorld(IMultiblockPart part)
{
CoordTriplet coord = part.getWorldLocation();
if (coord != null)
{
long hash = coord.getChunkXZHash();
if (partsAwaitingChunkLoad.containsKey(hash))
{
synchronized (partsAwaitingChunkLoadMutex)
{
if (partsAwaitingChunkLoad.containsKey(hash))
{
partsAwaitingChunkLoad.get(hash).remove(part);
if (partsAwaitingChunkLoad.get(hash).size() <= 0)
{
partsAwaitingChunkLoad.remove(hash);
}
}
}
}
}
detachedParts.remove(part);
if (orphanedParts.contains(part))
{
synchronized (orphanedPartsMutex)
{
orphanedParts.remove(part);
}
}
part.assertDetached();
}
/**
* Called when the world which this World Registry represents is fully
* unloaded from the system. Does some housekeeping just to be nice.
*/
public void onWorldUnloaded()
{
controllers.clear();
deadControllers.clear();
dirtyControllers.clear();
detachedParts.clear();
synchronized (partsAwaitingChunkLoadMutex)
{
partsAwaitingChunkLoad.clear();
}
synchronized (orphanedPartsMutex)
{
orphanedParts.clear();
}
worldObj = null;
}
/**
* Called when a chunk has finished loading. Adds all of the parts which are
* awaiting load to the list of parts which are orphans and therefore will
* be added to machines after the next world tick.
*
* @param chunkX
* Chunk X coordinate (world coordate >> 4) of the chunk that was
* loaded
* @param chunkZ
* Chunk Z coordinate (world coordate >> 4) of the chunk that was
* loaded
*/
public void onChunkLoaded(int chunkX, int chunkZ)
{
long chunkHash = ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ);
if (partsAwaitingChunkLoad.containsKey(chunkHash))
{
synchronized (partsAwaitingChunkLoadMutex)
{
if (partsAwaitingChunkLoad.containsKey(chunkHash))
{
addAllOrphanedPartsThreadsafe(partsAwaitingChunkLoad
.get(chunkHash));
partsAwaitingChunkLoad.remove(chunkHash);
}
}
}
}
/**
* Registers a controller as dead. It will be cleaned up at the end of the
* next world tick. Note that a controller must shed all of its blocks
* before being marked as dead, or the system will complain at you.
*
* @param deadController
* The controller which is dead.
*/
public void addDeadController(MultiblockControllerBase deadController)
{
this.deadControllers.add(deadController);
}
/**
* Registers a controller as dirty - its list of attached blocks has
* changed, and it must be re-checked for assembly and, possibly, for
* orphans.
*
* @param dirtyController
* The dirty controller.
*/
public void addDirtyController(MultiblockControllerBase dirtyController)
{
this.dirtyControllers.add(dirtyController);
}
/**
* Use this only if you know what you're doing. You should rarely need to
* iterate over all controllers in a world!
*
* @return An (unmodifiable) set of controllers which are active in this
* world.
*/
public Set<MultiblockControllerBase> getControllers()
{
return Collections.unmodifiableSet(controllers);
}
/* *** PRIVATE HELPERS *** */
private void addOrphanedPartThreadsafe(IMultiblockPart part)
{
synchronized (orphanedPartsMutex)
{
orphanedParts.add(part);
}
}
private void addAllOrphanedPartsThreadsafe(
Collection<? extends IMultiblockPart> parts)
{
synchronized (orphanedPartsMutex)
{
orphanedParts.addAll(parts);
}
}
private String clientOrServer()
{
return worldObj.isRemote ? "CLIENT" : "SERVER";
}
}

View file

@ -1,22 +0,0 @@
package erogenousbeef.coreTR.multiblock.rectangular;
public enum PartPosition
{
Unknown, Interior, FrameCorner, Frame, TopFace, BottomFace, NorthFace, SouthFace, EastFace, WestFace;
public boolean isFace(PartPosition position)
{
switch (position)
{
case TopFace:
case BottomFace:
case NorthFace:
case SouthFace:
case EastFace:
case WestFace:
return true;
default:
return false;
}
}
}

View file

@ -1,206 +0,0 @@
package erogenousbeef.coreTR.multiblock.rectangular;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import erogenousbeef.coreTR.common.CoordTriplet;
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
import erogenousbeef.coreTR.multiblock.MultiblockValidationException;
public abstract class RectangularMultiblockControllerBase extends
MultiblockControllerBase {
protected RectangularMultiblockControllerBase(World world)
{
super(world);
}
/**
* @return True if the machine is "whole" and should be assembled. False
* otherwise.
*/
protected void isMachineWhole() throws MultiblockValidationException
{
if (connectedParts.size() < getMinimumNumberOfBlocksForAssembledMachine())
{
throw new MultiblockValidationException("Machine is too small.");
}
CoordTriplet maximumCoord = getMaximumCoord();
CoordTriplet minimumCoord = getMinimumCoord();
// Quickly check for exceeded dimensions
int deltaX = maximumCoord.x - minimumCoord.x + 1;
int deltaY = maximumCoord.y - minimumCoord.y + 1;
int deltaZ = maximumCoord.z - minimumCoord.z + 1;
int maxX = getMaximumXSize();
int maxY = getMaximumYSize();
int maxZ = getMaximumZSize();
int minX = getMinimumXSize();
int minY = getMinimumYSize();
int minZ = getMinimumZSize();
if (maxX > 0 && deltaX > maxX)
{
throw new MultiblockValidationException(
String.format(
"Machine is too large, it may be at most %d blocks in the X dimension",
maxX));
}
if (maxY > 0 && deltaY > maxY)
{
throw new MultiblockValidationException(
String.format(
"Machine is too large, it may be at most %d blocks in the Y dimension",
maxY));
}
if (maxZ > 0 && deltaZ > maxZ)
{
throw new MultiblockValidationException(
String.format(
"Machine is too large, it may be at most %d blocks in the Z dimension",
maxZ));
}
if (deltaX < minX)
{
throw new MultiblockValidationException(
String.format(
"Machine is too small, it must be at least %d blocks in the X dimension",
minX));
}
if (deltaY < minY)
{
throw new MultiblockValidationException(
String.format(
"Machine is too small, it must be at least %d blocks in the Y dimension",
minY));
}
if (deltaZ < minZ)
{
throw new MultiblockValidationException(
String.format(
"Machine is too small, it must be at least %d blocks in the Z dimension",
minZ));
}
// Now we run a simple check on each block within that volume.
// Any block deviating = NO DEAL SIR
TileEntity te;
RectangularMultiblockTileEntityBase part;
Class<? extends RectangularMultiblockControllerBase> myClass = this
.getClass();
for (int x = minimumCoord.x; x <= maximumCoord.x; x++)
{
for (int y = minimumCoord.y; y <= maximumCoord.y; y++)
{
for (int z = minimumCoord.z; z <= maximumCoord.z; z++)
{
// Okay, figure out what sort of block this should be.
te = this.worldObj.getTileEntity(x, y, z);
if (te instanceof RectangularMultiblockTileEntityBase)
{
part = (RectangularMultiblockTileEntityBase) te;
// Ensure this part should actually be allowed within a
// cube of this controller's type
if (!myClass.equals(part.getMultiblockControllerType()))
{
throw new MultiblockValidationException(
String.format(
"Part @ %d, %d, %d is incompatible with machines of type %s",
x, y, z, myClass.getSimpleName()));
}
} else
{
// This is permitted so that we can incorporate certain
// non-multiblock parts inside interiors
part = null;
}
// Validate block type against both part-level and
// material-level validators.
int extremes = 0;
if (x == minimumCoord.x)
{
extremes++;
}
if (y == minimumCoord.y)
{
extremes++;
}
if (z == minimumCoord.z)
{
extremes++;
}
if (x == maximumCoord.x)
{
extremes++;
}
if (y == maximumCoord.y)
{
extremes++;
}
if (z == maximumCoord.z)
{
extremes++;
}
if (extremes >= 2)
{
if (part != null)
{
part.isGoodForFrame();
} else
{
isBlockGoodForFrame(this.worldObj, x, y, z);
}
} else if (extremes == 1)
{
if (y == maximumCoord.y)
{
if (part != null)
{
part.isGoodForTop();
} else
{
isBlockGoodForTop(this.worldObj, x, y, z);
}
} else if (y == minimumCoord.y)
{
if (part != null)
{
part.isGoodForBottom();
} else
{
isBlockGoodForBottom(this.worldObj, x, y, z);
}
} else
{
// Side
if (part != null)
{
part.isGoodForSides();
} else
{
isBlockGoodForSides(this.worldObj, x, y, z);
}
}
} else
{
if (part != null)
{
part.isGoodForInterior();
} else
{
isBlockGoodForInterior(this.worldObj, x, y, z);
}
}
}
}
}
}
}

View file

@ -1,132 +0,0 @@
package erogenousbeef.coreTR.multiblock.rectangular;
import net.minecraftforge.common.util.ForgeDirection;
import erogenousbeef.coreTR.common.CoordTriplet;
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
import erogenousbeef.coreTR.multiblock.MultiblockTileEntityBase;
import erogenousbeef.coreTR.multiblock.MultiblockValidationException;
public abstract class RectangularMultiblockTileEntityBase extends
MultiblockTileEntityBase {
PartPosition position;
ForgeDirection outwards;
public RectangularMultiblockTileEntityBase()
{
super();
position = PartPosition.Unknown;
outwards = ForgeDirection.UNKNOWN;
}
// Positional Data
public ForgeDirection getOutwardsDir()
{
return outwards;
}
public PartPosition getPartPosition()
{
return position;
}
// Handlers from MultiblockTileEntityBase
@Override
public void onAttached(MultiblockControllerBase newController)
{
super.onAttached(newController);
recalculateOutwardsDirection(newController.getMinimumCoord(),
newController.getMaximumCoord());
}
@Override
public void onMachineAssembled(MultiblockControllerBase controller)
{
CoordTriplet maxCoord = controller.getMaximumCoord();
CoordTriplet minCoord = controller.getMinimumCoord();
// Discover where I am on the reactor
recalculateOutwardsDirection(minCoord, maxCoord);
}
@Override
public void onMachineBroken()
{
position = PartPosition.Unknown;
outwards = ForgeDirection.UNKNOWN;
}
// Positional helpers
public void recalculateOutwardsDirection(CoordTriplet minCoord,
CoordTriplet maxCoord)
{
outwards = ForgeDirection.UNKNOWN;
position = PartPosition.Unknown;
int facesMatching = 0;
if (maxCoord.x == this.xCoord || minCoord.x == this.xCoord)
{
facesMatching++;
}
if (maxCoord.y == this.yCoord || minCoord.y == this.yCoord)
{
facesMatching++;
}
if (maxCoord.z == this.zCoord || minCoord.z == this.zCoord)
{
facesMatching++;
}
if (facesMatching <= 0)
{
position = PartPosition.Interior;
} else if (facesMatching >= 3)
{
position = PartPosition.FrameCorner;
} else if (facesMatching == 2)
{
position = PartPosition.Frame;
} else
{
// 1 face matches
if (maxCoord.x == this.xCoord)
{
position = PartPosition.EastFace;
outwards = ForgeDirection.EAST;
} else if (minCoord.x == this.xCoord)
{
position = PartPosition.WestFace;
outwards = ForgeDirection.WEST;
} else if (maxCoord.z == this.zCoord)
{
position = PartPosition.SouthFace;
outwards = ForgeDirection.SOUTH;
} else if (minCoord.z == this.zCoord)
{
position = PartPosition.NorthFace;
outwards = ForgeDirection.NORTH;
} else if (maxCoord.y == this.yCoord)
{
position = PartPosition.TopFace;
outwards = ForgeDirection.UP;
} else
{
position = PartPosition.BottomFace;
outwards = ForgeDirection.DOWN;
}
}
}
// /// Validation Helpers (IMultiblockPart)
public abstract void isGoodForFrame() throws MultiblockValidationException;
public abstract void isGoodForSides() throws MultiblockValidationException;
public abstract void isGoodForTop() throws MultiblockValidationException;
public abstract void isGoodForBottom() throws MultiblockValidationException;
public abstract void isGoodForInterior()
throws MultiblockValidationException;
}

View file

@ -1,35 +0,0 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
public interface IDeepStorageUnit {
/**
* @return A populated ItemStack with stackSize for the full amount of
* materials in the DSU. <br>
* May have a stackSize > getMaxStackSize(). May have a stackSize of
* 0 (indicating locked contents).
*/
ItemStack getStoredItemType();
/**
* Sets the total amount of the item currently being stored, or zero if all
* items are to be removed.
*/
void setStoredItemCount(int amount);
/**
* Sets the type of the stored item and initializes the number of stored
* items to amount.
* <p>
* Will overwrite any existing stored items.
*/
void setStoredItemType(ItemStack type, int amount);
/**
* @return The maximum number of items the DSU can hold. <br>
* May change based on the current type stored.
*/
int getMaxStoredCount();
}

View file

@ -11,10 +11,13 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import erogenousbeef.coreTR.multiblock.MultiblockEventHandler;
import erogenousbeef.coreTR.multiblock.MultiblockServerTickHandler;
import net.minecraftforge.common.MinecraftForge;
import org.apache.commons.lang3.time.StopWatch;
import reborncore.common.multiblock.MultiblockEventHandler;
import reborncore.common.multiblock.MultiblockServerTickHandler;
import reborncore.common.packets.AddDiscriminatorEvent;
import reborncore.common.util.LogHelper;
import reborncore.common.util.VersionChecker;
import techreborn.achievement.TRAchievements;
import techreborn.api.recipe.RecipeHandler;
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
@ -26,12 +29,10 @@ import techreborn.config.ConfigTechReborn;
import techreborn.events.TRTickHandler;
import techreborn.init.*;
import techreborn.lib.ModInfo;
import techreborn.packets.PacketHandler;
import techreborn.packets.PacketPipeline;
import techreborn.packets.PacketAesu;
import techreborn.packets.PacketIdsu;
import techreborn.proxies.CommonProxy;
import techreborn.tiles.idsu.IDSUManager;
import techreborn.util.LogHelper;
import techreborn.util.VersionChecker;
import techreborn.world.TROreGen;
import java.io.File;
@ -46,14 +47,17 @@ public class Core {
@Mod.Instance
public static Core INSTANCE;
public static final PacketPipeline packetPipeline = new PacketPipeline();
public VersionChecker versionChecker;
public static LogHelper logHelper = new LogHelper(new ModInfo());
@Mod.EventHandler
public void preinit(FMLPreInitializationEvent event) {
event.getModMetadata().version = ModInfo.MOD_VERSION;
INSTANCE = this;
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
String path = event.getSuggestedConfigurationFile().getAbsolutePath()
.replace(ModInfo.MOD_ID, "TechReborn");
@ -64,9 +68,9 @@ public class Core {
}
RecipeConfigManager.load(event.getModConfigurationDirectory());
versionChecker = new VersionChecker("TechReborn");
versionChecker = new VersionChecker("TechReborn", new ModInfo());
versionChecker.checkVersionThreaded();
LogHelper.info("PreInitialization Complete");
logHelper.info("PreInitialization Complete");
}
@Mod.EventHandler
@ -83,7 +87,7 @@ public class Core {
StopWatch watch = new StopWatch();
watch.start();
ModRecipes.init();
LogHelper.all(watch + " : main recipes");
logHelper.all(watch + " : main recipes");
watch.stop();
//Client only init, needs to be done before parts system
proxy.init();
@ -96,9 +100,7 @@ public class Core {
// DungeonLoot.init();
// Register Gui Handler
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
// packets
PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel(
ModInfo.MOD_ID + "_packets", new PacketHandler()));
// Achievements
TRAchievements.init();
// Multiblock events
@ -108,8 +110,7 @@ public class Core {
MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE);
FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler());
FMLCommonHandler.instance().bus().register(new TRTickHandler());
packetPipeline.initalise();
LogHelper.info("Initialization Complete");
logHelper.info("Initialization Complete");
}
@Mod.EventHandler
@ -118,8 +119,7 @@ public class Core {
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.postInit(event);
}
packetPipeline.postInitialise();
LogHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
// RecipeHandler.scanForDupeRecipes();
@ -140,4 +140,11 @@ public class Core {
ConfigTechReborn.Configs();
}
}
@SubscribeEvent
public void addDiscriminator(AddDiscriminatorEvent event) {
event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketAesu.class);
event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketIdsu.class);
}
}

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import reborncore.common.achievement.ICraftAchievement;
import reborncore.common.achievement.IPickupAchievement;
public class AchievementTriggerer {

View file

@ -1,13 +0,0 @@
package techreborn.achievement;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public interface ICraftAchievement {
public Achievement getAchievementOnCraft(ItemStack stack,
EntityPlayer player, IInventory matrix);
}

View file

@ -1,13 +0,0 @@
package techreborn.achievement;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public interface IPickupAchievement {
public Achievement getAchievementOnPickup(ItemStack stack,
EntityPlayer player, EntityItem item);
}

View file

@ -1,9 +0,0 @@
package techreborn.api;
import java.util.List;
public interface IListInfoProvider {
void addInfo(List<String> info, boolean isRealTile);
}

View file

@ -5,10 +5,10 @@ import net.minecraft.block.Block;
public class TechRebornBlocks {
public static Block getBlock(String name){
public static Block getBlock(String name) {
try {
Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null);
return e instanceof Block ?(Block)e:null;
return e instanceof Block ? (Block) e : null;
} catch (NoSuchFieldException e1) {
e1.printStackTrace();
return null;

View file

@ -4,10 +4,10 @@ import net.minecraft.item.Item;
public class TechRebornItems {
public static Item getItem(String name){
public static Item getItem(String name) {
try {
Object e = Class.forName("techreborn.init.ModItems").getField(name).get(null);
return e instanceof Item ?(Item)e:null;
return e instanceof Item ? (Item) e : null;
} catch (NoSuchFieldException e1) {
e1.printStackTrace();
return null;

View file

@ -1,14 +0,0 @@
package techreborn.api.fuel;
import net.minecraftforge.fluids.Fluid;
import java.util.HashMap;
public class FluidPowerManager {
/**
* Use this to register a fluid with a power value
*/
public static HashMap<Fluid, Double> fluidPowerValues = new HashMap<Fluid, Double>();
}

View file

@ -1,4 +0,0 @@
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api.fuel;
import cpw.mods.fml.common.API;

View file

@ -77,7 +77,7 @@ public interface IEnergyInterfaceItem {
/**
* @return if it can provide energy
*/
public boolean canProvideEnergy(ItemStack stack );
public boolean canProvideEnergy(ItemStack stack);
public double getMaxTransfer(ItemStack stack);

View file

@ -2,13 +2,10 @@ package techreborn.api.recipe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.api.power.IEnergyInterfaceTile;
import techreborn.packets.PacketHandler;
import techreborn.tiles.TileMachineBase;
import techreborn.util.Inventory;
import techreborn.util.ItemUtils;
import java.util.ArrayList;
@ -283,7 +280,7 @@ public class RecipeCrafter {
private boolean isActive() {
return currentRecipe != null && energy.getEnergy() >= currentRecipe.euPerTick();
}
}
public void addSpeedMulti(double amount) {
if (speedMultiplier + amount <= 0.99) {
@ -319,11 +316,11 @@ public class RecipeCrafter {
public void setIsActive() {
if(isActive()){
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 1, 2);
} else {
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 0, 2);
}
if (isActive()) {
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 1, 2);
} else {
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 0, 2);
}
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
}

View file

@ -2,9 +2,9 @@ package techreborn.api.recipe;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.time.StopWatch;
import reborncore.common.util.ItemUtils;
import techreborn.Core;
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
import techreborn.util.ItemUtils;
import techreborn.util.LogHelper;
import java.util.ArrayList;
import java.util.HashMap;
@ -89,14 +89,14 @@ public class RecipeHandler {
for (ItemStack inputs : baseRecipeType.getInputs()) {
itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + "," + inputs.getDisplayName() + "," + inputs.stackSize);
}
LogHelper.all(stackMap.get(baseRecipeType));
Core.logHelper.all(stackMap.get(baseRecipeType));
// throw new Exception("Found a duplicate recipe for " + baseRecipeType.getRecipeName() + " with inputs " + itemInfo.toString());
}
}
}
}
}
LogHelper.all(watch + " : Scanning dupe recipes");
Core.logHelper.all(watch + " : Scanning dupe recipes");
watch.stop();
}

View file

@ -1,8 +1,8 @@
package techreborn.api.upgrade;
import net.minecraft.item.ItemStack;
import reborncore.common.util.Inventory;
import techreborn.api.recipe.RecipeCrafter;
import techreborn.util.Inventory;
import java.util.ArrayList;

View file

@ -1,129 +0,0 @@
package techreborn.asm;
import cpw.mods.fml.common.Loader;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
import java.util.Iterator;
import java.util.List;
public class ClassTransformation implements IClassTransformer {
private static final String[] emptyList = {};
static String strippableDesc;
public ClassTransformation() {
strippableDesc = Type.getDescriptor(Strippable.class);
}
static boolean strip(ClassNode cn) {
boolean altered = false;
if (cn.methods != null) {
Iterator<MethodNode> iter = cn.methods.iterator();
while (iter.hasNext()) {
MethodNode mn = iter.next();
if (mn.visibleAnnotations != null) {
for (AnnotationNode node : mn.visibleAnnotations) {
if (checkRemove(parseAnnotation(node, strippableDesc), iter)) {
altered = true;
break;
}
}
}
}
}
if (cn.fields != null) {
Iterator<FieldNode> iter = cn.fields.iterator();
while (iter.hasNext()) {
FieldNode fn = iter.next();
if (fn.visibleAnnotations != null) {
for (AnnotationNode node : fn.visibleAnnotations) {
if (checkRemove(parseAnnotation(node, strippableDesc), iter)) {
altered = true;
break;
}
}
}
}
}
return altered;
}
static AnnotationInfo parseAnnotation(AnnotationNode node, String desc) {
AnnotationInfo info = null;
if (node.desc.equals(desc)) {
info = new AnnotationInfo();
if (node.values != null) {
List<Object> values = node.values;
for (int i = 0, e = values.size(); i < e; ) {
Object k = values.get(i++);
Object v = values.get(i++);
if ("value".equals(k)) {
if (!(v instanceof List && ((List<?>) v).size() > 0 && ((List<?>) v).get(0) instanceof String)) {
continue;
}
info.values = ((List<?>) v).toArray(emptyList);
}
}
}
}
return info;
}
static boolean checkRemove(AnnotationInfo node, Iterator<? extends Object> iter) {
if (node != null) {
boolean needsRemoved = false;
String[] value = node.values;
for (int j = 0, l = value.length; j < l; ++j) {
String clazz = value[j];
String mod = clazz.substring(4);
if (clazz.startsWith("mod:")) {
int i = mod.indexOf('@');
if (i > 0) {
mod = mod.substring(0, i);
}
if (!Loader.isModLoaded(mod)) {
needsRemoved = true;
}
}
if (needsRemoved) {
break;
}
}
if (needsRemoved) {
iter.remove();
return true;
}
}
return false;
}
@Override
public byte[] transform(String name, String transformedName, byte[] bytes) {
if (bytes == null) {
return null;
}
ClassReader cr = new ClassReader(bytes);
ClassNode cn = new ClassNode();
cr.accept(cn, 0);
if (strip(cn)) {
ClassWriter cw = new ClassWriter(0);
cn.accept(cw);
bytes = cw.toByteArray();
LoadingPlugin.stripedClases++;
}
return bytes;
}
static class AnnotationInfo {
public String side = "NONE";
public String[] values = emptyList;
}
}

View file

@ -1,63 +0,0 @@
package techreborn.asm;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.relauncher.IFMLCallHook;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import techreborn.lib.ModInfo;
import java.util.Map;
@IFMLLoadingPlugin.MCVersion("1.7.10")
public class LoadingPlugin implements IFMLLoadingPlugin {
public static boolean runtimeDeobfEnabled = false;
public static int stripedClases = 0;
@Override
public String[] getASMTransformerClass() {
return new String[]{"techreborn.asm.ClassTransformation"};
}
@Override
public String getModContainerClass() {
return DummyMod.class.getName();
}
@Override
public String getSetupClass() {
return DummyMod.class.getName();
}
@Override
public void injectData(Map<String, Object> data) {
runtimeDeobfEnabled = (Boolean) data.get("runtimeDeobfuscationEnabled");
}
@Override
public String getAccessTransformerClass() {
return null;
}
public static class DummyMod extends DummyModContainer implements IFMLCallHook {
public DummyMod() {
super(new ModMetadata());
ModMetadata md = getMetadata();
md.autogenerated = true;
md.modId = ModInfo.MOD_ID + "asm";
md.name = md.description = "Techreborn-ASM";
md.parent = ModInfo.MOD_ID;
md.version = "000";
}
@Override
public void injectData(Map<String, Object> data) {
}
@Override
public Void call() throws Exception {
return null;
}
}
}

View file

@ -1,18 +0,0 @@
package techreborn.asm;
import java.lang.annotation.*;
/**
* When used on a class, methods from referenced interfaces will not be removed <br>
* When using this annotation on methods, ensure you do not switch on an enum inside that method. JavaC implementation details means this will cause crashes.
* <p/>
* Can also strip on modid using "mod:<MODID>" as a value <br>
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE})
public @interface Strippable {
public String[] value();
}

View file

@ -6,7 +6,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockComputerCube extends BlockMachineBase {

View file

@ -2,7 +2,10 @@ package techreborn.blocks;
import cpw.mods.fml.common.Loader;
import ic2.api.item.IC2Items;
import net.minecraft.block.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.BlockStaticLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
@ -20,7 +23,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.BlockFluidBase;
import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModBlocks;
import techreborn.lib.Functions;
import techreborn.tiles.TileMachineBase;
import java.util.ArrayList;
@ -149,48 +151,48 @@ public class BlockMachineBase extends BlockContainer {
}
}
public void setTileRotation(World world, int x, int y, int z, int meta){
if(world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase){
public void setTileRotation(World world, int x, int y, int z, int meta) {
if (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase) {
((TileMachineBase) world.getTileEntity(x, y, z)).setRotation(meta);
}
}
public int getTileRotation(World world, int x, int y, int z){
if(world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase){
public int getTileRotation(World world, int x, int y, int z) {
if (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileMachineBase) {
return ((TileMachineBase) world.getTileEntity(x, y, z)).getRotation();
}
return 0;
}
public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z){
public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z) {
return blockAccess.getTileEntity(x, y, z) != null ? getTileRotation(blockAccess.getTileEntity(x, y, z).getWorldObj(), x, y, z) : 0;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
if(Loader.isModLoaded("IC2")){
if (Loader.isModLoaded("IC2")) {
ItemStack stack = IC2Items.getItem(isAdvanced() ? "advancedMachine" : "machine").copy();
stack.stackSize = 1;
items.add(stack);
} else {
items.add(isAdvanced()? new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 2) : new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 0));
items.add(isAdvanced() ? new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 2) : new ItemStack(Item.getItemFromBlock(ModBlocks.MachineCasing), 1, 0));
}
System.out.println(items.toString());
return items;
}
public boolean isAdvanced(){
public boolean isAdvanced() {
return false;
}
@Override
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
if(axis == ForgeDirection.UNKNOWN){
if (axis == ForgeDirection.UNKNOWN) {
return false;
} else {
TileEntity tile = worldObj.getTileEntity(x, y, z);
if(tile != null && tile instanceof TileMachineBase){
if (tile != null && tile instanceof TileMachineBase) {
TileMachineBase machineBase = (TileMachineBase) tile;
machineBase.setRotation(ForgeDirection.getOrientation(machineBase.getRotation()).getRotation(axis).ordinal());
return true;

View file

@ -2,7 +2,6 @@ package techreborn.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -13,8 +12,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import reborncore.client.texture.ConnectedTexture;
import reborncore.common.multiblock.BlockMultiblockBase;
import techreborn.client.TechRebornCreativeTab;
import techreborn.client.texture.ConnectedTexture;
import techreborn.client.texture.CasingConnectedTextureGenerator;
import techreborn.config.ConfigTechReborn;
import techreborn.tiles.TileMachineCasing;
@ -69,7 +69,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.icons = new IIcon[types.length][16];
if(!ConfigTechReborn.useConnectedTextures){
if (!ConfigTechReborn.useConnectedTextures) {
for (int i = 0; i < types.length; i++) {
for (int j = 0; j < 15; j++) {
icons[i][j] = iconRegister.registerIcon("techreborn:" + "machine/casing"
@ -79,7 +79,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
return;
}
for (int i = 0; i < types.length; i++) {
// up down left right
// up down left right
icons[i][0] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i, types);
icons[i][1] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i, types);
icons[i][2] = CasingConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i, types);
@ -120,501 +120,301 @@ public class BlockMachineCasing extends BlockMultiblockBase {
/**
* This is taken from https://github.com/SlimeKnights/TinkersConstruct/blob/a7405a3d10318bb5c486ec75fb62897a8149d1a6/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java
*/
public IIcon getConnectedBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons)
{
public IIcon getConnectedBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons) {
boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false;
switch (par5)
{
switch (par5) {
case 0:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[11];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[12];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[13];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[14];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[5];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[6];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[8];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[9];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[3];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[4];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[2];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[1];
}
break;
case 1:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[11];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[12];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[13];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[14];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[5];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[6];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[8];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[9];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[3];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[4];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[2];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[1];
}
break;
case 2:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[13];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[14];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[9];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[8];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[4];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[3];
}
break;
case 3:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[14];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[13];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[10];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[9];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[8];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[7];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[3];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[4];
}
break;
case 4:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[14];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[13];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[10];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[9];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[8];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[7];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[3];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[4];
}
break;
case 5:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[13];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[14];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[9];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[8];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[4];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[3];
}
break;
@ -624,8 +424,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
}
@Override
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
Block b = par1IBlockAccess.getBlock(par2, par3, par4);
return b == (Block) this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
}

View file

@ -15,12 +15,13 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import reborncore.common.util.OreDrop;
import reborncore.common.util.OreDropSet;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.items.ItemDusts;
import techreborn.items.ItemGems;
import techreborn.util.OreDrop;
import techreborn.util.OreDropSet;
import java.util.ArrayList;
import java.util.List;
@ -60,7 +61,7 @@ public class BlockOre extends Block {
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
//Ruby
if (metadata == 2) {
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"));
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
OreDropSet set = new OreDropSet(ruby, redGarnet);
return set.drop(fortune, world.rand);
@ -68,7 +69,7 @@ public class BlockOre extends Block {
//Sapphire
if (metadata == 3) {
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"));
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
OreDropSet set = new OreDropSet(sapphire, peridot);
return set.drop(fortune, world.rand);
@ -76,14 +77,14 @@ public class BlockOre extends Block {
//Pyrite
if (metadata == 5) {
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"));
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
OreDropSet set = new OreDropSet(pyriteDust);
return set.drop(fortune, world.rand);
}
//Sodolite
if (metadata == 11) {
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6));
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
OreDropSet set = new OreDropSet(sodalite, aluminum);
return set.drop(fortune, world.rand);
@ -91,7 +92,7 @@ public class BlockOre extends Block {
//Cinnabar
if (metadata == 6) {
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"));
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
OreDrop redstone = new OreDrop(new ItemStack(Items.redstone), 0.25);
OreDropSet set = new OreDropSet(cinnabar, redstone);
return set.drop(fortune, world.rand);
@ -99,7 +100,7 @@ public class BlockOre extends Block {
//Sphalerite 1, 1/8 yellow garnet
if (metadata == 7) {
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"));
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
return set.drop(fortune, world.rand);

View file

@ -2,11 +2,9 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileDieselGenerator;
import java.util.Random;
public class BlockDieselGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,18 +2,14 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import techreborn.blocks.BlockMachineBase;
import techreborn.tiles.TileDragonEggSiphoner;
import java.util.Random;
public class BlockDragonEggSiphoner extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,11 +2,9 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileGasTurbine;
import java.util.Random;
public class BlockGasTurbine extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,18 +2,14 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import techreborn.blocks.BlockMachineBase;
import techreborn.tiles.TileHeatGenerator;
import java.util.Random;
public class BlockHeatGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,15 +2,11 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import techreborn.blocks.BlockMachineBase;
import java.util.Random;
public class BlockLightningRod extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,15 +2,11 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import techreborn.blocks.BlockMachineBase;
import java.util.Random;
public class BlockMagicEnergyAbsorber extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,15 +2,11 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import techreborn.blocks.BlockMachineBase;
import java.util.Random;
public class BlockMagicEnergyConverter extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,15 +2,11 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import techreborn.blocks.BlockMachineBase;
import java.util.Random;
public class BlockPlasmaGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,11 +2,9 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileSemifluidGenerator;
import java.util.Random;
public class BlockSemiFluidGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,11 +2,9 @@ package techreborn.blocks.generator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -15,8 +13,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileThermalGenerator;
import java.util.Random;
public class BlockThermalGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -72,9 +72,9 @@ public class BlockAlloyFurnace extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileAlloySmelter;
import java.util.Random;
public class BlockAlloySmelter extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -76,9 +72,9 @@ public class BlockAlloySmelter extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileAssemblingMachine;
import java.util.Random;
public class BlockAssemblingMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -76,9 +72,9 @@ public class BlockAssemblingMachine extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileBlastFurnace;
import java.util.Random;
public class BlockBlastFurnace extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -81,9 +77,9 @@ public class BlockBlastFurnace extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileCentrifuge;
import java.util.Random;
public class BlockCentrifuge extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -69,31 +65,31 @@ public class BlockCentrifuge extends BlockMachineBase {
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileRotation(blockAccess, x, y, z);
if (blockAccess.getBlockMetadata(x, y, z) == 1) {
if(side == 1){
return this.iconTopOn;
} else if(side == 0){
return this.iconBottom;
}
return this.iconFrontOn;
if (side == 1) {
return this.iconTopOn;
} else if (side == 0) {
return this.iconBottom;
}
return this.iconFrontOn;
} else {
if(side == 1){
return this.iconTop;
} else if(side == 0){
return this.iconBottom;
}
return this.iconFront;
}
if (side == 1) {
return this.iconTop;
} else if (side == 0) {
return this.iconBottom;
}
return this.iconFront;
}
}
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.iconFront;
return this.iconFront;
}
}

View file

@ -71,9 +71,9 @@ public class BlockChargeBench extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileChemicalReactor;
import java.util.Random;
public class BlockChemicalReactor extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -76,9 +72,9 @@ public class BlockChemicalReactor extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,16 +2,12 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import techreborn.blocks.BlockMachineBase;
import java.util.Random;
public class BlockDistillationTower extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -50,9 +46,9 @@ public class BlockDistillationTower extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileGrinder;
import java.util.Random;
public class BlockGrinder extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -80,9 +76,9 @@ public class BlockGrinder extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileImplosionCompressor;
import java.util.Random;
public class BlockImplosionCompressor extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -81,9 +77,9 @@ public class BlockImplosionCompressor extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileIndustrialElectrolyzer;
import java.util.Random;
public class BlockIndustrialElectrolyzer extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -78,9 +74,9 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileIndustrialSawmill;
import java.util.Random;
public class BlockIndustrialSawmill extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -81,9 +77,9 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileMatterFabricator;
import java.util.Random;
public class BlockMatterFabricator extends BlockMachineBase {
@SideOnly(Side.CLIENT)

View file

@ -2,11 +2,9 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
@ -16,8 +14,6 @@ import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileRollingMachine;
import java.util.Random;
public class BlockRollingMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -69,9 +65,9 @@ public class BlockRollingMachine extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -2,16 +2,12 @@ package techreborn.blocks.machine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.IC2Items;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import techreborn.blocks.BlockMachineBase;
import java.util.Random;
public class BlockVacuumFreezer extends BlockMachineBase {
@SideOnly(Side.CLIENT)
@ -54,9 +50,9 @@ public class BlockVacuumFreezer extends BlockMachineBase {
@Override
public IIcon getIcon(int side, int meta) {
if(side == 1){
if (side == 1) {
return this.iconTop;
} else if(side == 3){
} else if (side == 3) {
return this.iconFront;
} else {
return this.blockIcon;

View file

@ -11,8 +11,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import reborncore.client.texture.ConnectedTexture;
import techreborn.blocks.BlockMachineBase;
import techreborn.client.texture.ConnectedTexture;
import techreborn.client.texture.LesuConnectedTextureGenerator;
import techreborn.config.ConfigTechReborn;
import techreborn.tiles.lesu.TileLesuStorage;
@ -30,8 +30,8 @@ public class BlockLesuStorage extends BlockMachineBase {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.icons = new IIcon[1][16];
// up down left right
if(!ConfigTechReborn.useConnectedTextures){
// up down left right
if (!ConfigTechReborn.useConnectedTextures) {
for (int j = 0; j < 15; j++) {
icons[0][j] = iconRegister.registerIcon("techreborn:" + "machine/lesu_block");
}
@ -39,22 +39,22 @@ public class BlockLesuStorage extends BlockMachineBase {
}
int i = 0;
icons[i][0] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i);
icons[i][1] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i);
icons[i][2] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i);
icons[i][3] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i);
icons[i][4] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i);
icons[i][5] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i);
icons[i][6] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i);
icons[i][7] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i);
icons[i][8] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i);
icons[i][9] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i);
icons[i][10] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i);
icons[i][11] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i);
icons[i][12] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i);
icons[i][13] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i);
icons[i][14] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i);
icons[i][15] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i);
icons[i][0] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, true), iconRegister, 0, i);
icons[i][1] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, true), iconRegister, 1, i);
icons[i][2] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, true), iconRegister, 2, i);
icons[i][3] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, true, false), iconRegister, 3, i);
icons[i][4] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, true), iconRegister, 4, i);
icons[i][5] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, true, false, false), iconRegister, 5, i);
icons[i][6] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, true), iconRegister, 6, i);
icons[i][7] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, true), iconRegister, 7, i);
icons[i][8] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, true, false), iconRegister, 8, i);
icons[i][9] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, true), iconRegister, 9, i);
icons[i][10] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, true, false), iconRegister, 10, i);
icons[i][11] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, true, false, false), iconRegister, 11, i);
icons[i][12] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(true, false, false, false), iconRegister, 12, i);
icons[i][13] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, true), iconRegister, 13, i);
icons[i][14] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, true, false), iconRegister, 14, i);
icons[i][15] = LesuConnectedTextureGenerator.genIcon(new ConnectedTexture(false, false, false, false), iconRegister, 15, i);
}
@Override
@ -69,8 +69,6 @@ public class BlockLesuStorage extends BlockMachineBase {
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
@ -97,501 +95,301 @@ public class BlockLesuStorage extends BlockMachineBase {
/**
* This is taken from https://github.com/SlimeKnights/TinkersConstruct/blob/a7405a3d10318bb5c486ec75fb62897a8149d1a6/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java
*/
public IIcon getConnectedBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons)
{
public IIcon getConnectedBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, IIcon[] icons) {
boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false;
switch (par5)
{
switch (par5) {
case 0:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[11];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[12];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[13];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[14];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[5];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[6];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[8];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[9];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[3];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[4];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[2];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[1];
}
break;
case 1:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[11];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[12];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[13];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[14];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[5];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[6];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[8];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[9];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[3];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[4];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[2];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[1];
}
break;
case 2:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[13];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[14];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[9];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[8];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[4];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[3];
}
break;
case 3:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[14];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[13];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[10];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[9];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[8];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[7];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[3];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[4];
}
break;
case 4:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[14];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[13];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[10];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[9];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[8];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[7];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[3];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[4];
}
break;
case 5:
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) {
isOpenDown = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) {
isOpenUp = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) {
isOpenLeft = true;
}
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1)))
{
if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlock(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) {
isOpenRight = true;
}
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
{
if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) {
return icons[15];
}
else if (isOpenUp && isOpenDown && isOpenLeft)
{
} else if (isOpenUp && isOpenDown && isOpenLeft) {
return icons[13];
}
else if (isOpenUp && isOpenDown && isOpenRight)
{
} else if (isOpenUp && isOpenDown && isOpenRight) {
return icons[14];
}
else if (isOpenUp && isOpenLeft && isOpenRight)
{
} else if (isOpenUp && isOpenLeft && isOpenRight) {
return icons[11];
}
else if (isOpenDown && isOpenLeft && isOpenRight)
{
} else if (isOpenDown && isOpenLeft && isOpenRight) {
return icons[12];
}
else if (isOpenDown && isOpenUp)
{
} else if (isOpenDown && isOpenUp) {
return icons[6];
}
else if (isOpenLeft && isOpenRight)
{
} else if (isOpenLeft && isOpenRight) {
return icons[5];
}
else if (isOpenDown && isOpenLeft)
{
} else if (isOpenDown && isOpenLeft) {
return icons[9];
}
else if (isOpenDown && isOpenRight)
{
} else if (isOpenDown && isOpenRight) {
return icons[10];
}
else if (isOpenUp && isOpenLeft)
{
} else if (isOpenUp && isOpenLeft) {
return icons[7];
}
else if (isOpenUp && isOpenRight)
{
} else if (isOpenUp && isOpenRight) {
return icons[8];
}
else if (isOpenDown)
{
} else if (isOpenDown) {
return icons[1];
}
else if (isOpenUp)
{
} else if (isOpenUp) {
return icons[2];
}
else if (isOpenLeft)
{
} else if (isOpenLeft) {
return icons[4];
}
else if (isOpenRight)
{
} else if (isOpenRight) {
return icons[3];
}
break;

View file

@ -6,7 +6,6 @@ import net.minecraft.world.World;
import techreborn.client.container.*;
import techreborn.client.gui.*;
import techreborn.pda.GuiManual;
import techreborn.pda.pages.BasePage;
import techreborn.tiles.*;
import techreborn.tiles.idsu.TileIDSU;
import techreborn.tiles.lesu.TileLesu;
@ -89,7 +88,7 @@ public class GuiHandler implements IGuiHandler {
} else if (ID == assemblingmachineID) {
return new ContainerAssemblingMachine(
(TileAssemblingMachine) world.getTileEntity(x, y, z), player);
}else if (ID == dieselGeneratorID) {
} else if (ID == dieselGeneratorID) {
return new ContainerDieselGenerator(
(TileDieselGenerator) world.getTileEntity(x, y, z), player);
} else if (ID == industrialElectrolyzerID) {
@ -171,7 +170,7 @@ public class GuiHandler implements IGuiHandler {
} else if (ID == assemblingmachineID) {
return new GuiAssemblingMachine(player,
(TileAssemblingMachine) world.getTileEntity(x, y, z));
}else if (ID == dieselGeneratorID) {
} else if (ID == dieselGeneratorID) {
return new GuiDieselGenerator(player,
(TileDieselGenerator) world.getTileEntity(x, y, z));
} else if (ID == industrialElectrolyzerID) {

View file

@ -1,60 +0,0 @@
package techreborn.client;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
public class GuiUtil {
public static void drawRepeated(IIcon icon, double x, double y, double width, double height, double z) {
double iconWidthStep = (icon.getMaxU() - icon.getMinU()) / 16.0D;
double iconHeightStep = (icon.getMaxV() - icon.getMinV()) / 16.0D;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
for (double cy = y; cy < y + height; cy += 16.0D) {
double quadHeight = Math.min(16.0D, height + y - cy);
double maxY = cy + quadHeight;
double maxV = icon.getMinV() + iconHeightStep * quadHeight;
for (double cx = x; cx < x + width; cx += 16.0D) {
double quadWidth = Math.min(16.0D, width + x - cx);
double maxX = cx + quadWidth;
double maxU = icon.getMinU() + iconWidthStep * quadWidth;
tessellator.addVertexWithUV(cx, maxY, z, icon.getMinU(), maxV);
tessellator.addVertexWithUV(maxX, maxY, z, maxU, maxV);
tessellator.addVertexWithUV(maxX, cy, z, maxU, icon.getMinV());
tessellator.addVertexWithUV(cx, cy, z, icon.getMinU(), icon.getMinV());
}
}
tessellator.draw();
}
public static void drawTooltipBox(int x, int y, int w, int h) {
int bg = 0xf0100010;
drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center
drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
int grad1 = 0x505000ff;
int grad2 = 0x5028007F;
drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
}
public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) {
new GuiHook().drawGradientRect(x, y, x + w, y + h, colour1, colour2);
}
public static class GuiHook extends Gui {
@Override
public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
super.drawGradientRect(par1, par2, par3, par4, par5, par6);
}
}
}

View file

@ -1,36 +0,0 @@
package techreborn.client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotFake extends Slot {
public boolean mCanInsertItem;
public boolean mCanStackItem;
public int mMaxStacksize = 127;
public SlotFake(IInventory par1iInventory, int par2, int par3, int par4,
boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) {
super(par1iInventory, par2, par3, par4);
this.mCanInsertItem = aCanInsertItem;
this.mCanStackItem = aCanStackItem;
this.mMaxStacksize = aMaxStacksize;
}
public boolean isItemValid(ItemStack par1ItemStack) {
return this.mCanInsertItem;
}
public int getSlotStackLimit() {
return this.mMaxStacksize;
}
public boolean getHasStack() {
return false;
}
public ItemStack decrStackSize(int par1) {
return !this.mCanStackItem ? null : super.decrStackSize(par1);
}
}

View file

@ -1,37 +0,0 @@
package techreborn.client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class SlotFilteredVoid extends Slot {
private List<ItemStack> filter = new ArrayList<ItemStack>();
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y) {
super(par1iInventory, id, x, y);
}
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y, ItemStack[] filterList) {
super(par1iInventory, id, x, y);
for (ItemStack itemStack : filterList)
this.filter.add(itemStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
for (ItemStack itemStack : filter)
if (itemStack.getItem().equals(stack.getItem()) && itemStack.getItemDamage() == stack.getItemDamage())
return false;
return super.isItemValid(stack);
}
@Override
public void putStack(ItemStack arg0) {
}
}

View file

@ -1,21 +0,0 @@
package techreborn.client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.IFluidContainerItem;
public class SlotFluid extends Slot {
public SlotFluid(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
}
@Override
public boolean isItemValid(ItemStack stack) {
return FluidContainerRegistry.isContainer(stack) || (stack != null && stack.getItem() instanceof IFluidContainerItem);
}
}

View file

@ -1,20 +0,0 @@
package techreborn.client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotInput extends Slot {
public SlotInput(IInventory par1iInventory, int par2, int par3, int par4) {
super(par1iInventory, par2, par3, par4);
}
public boolean isItemValid(ItemStack par1ItemStack) {
return false;
}
public int getSlotStackLimit() {
return 64;
}
}

View file

@ -1,20 +0,0 @@
package techreborn.client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotOutput extends Slot {
public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4) {
super(par1iInventory, par2, par3, par4);
}
public boolean isItemValid(ItemStack par1ItemStack) {
return false;
}
public int getSlotStackLimit() {
return 64;
}
}

View file

@ -8,9 +8,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import org.lwjgl.input.Keyboard;
import techreborn.api.IListInfoProvider;
import reborncore.api.IListInfoProvider;
import reborncore.common.util.Color;
import techreborn.api.power.IEnergyInterfaceItem;
import techreborn.util.Color;
public class StackToolTipEvent {

View file

@ -4,6 +4,7 @@ import cpw.mods.fml.client.GuiModList;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent;
import reborncore.client.gui.GuiUtil;
import techreborn.Core;
import java.awt.*;

View file

@ -5,9 +5,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileAesu;
public class ContainerAesu extends TechRebornContainer {
public class ContainerAesu extends RebornContainer {
EntityPlayer player;
@ -29,7 +30,7 @@ public class ContainerAesu extends TechRebornContainer {
// input
//this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23));
// this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
// this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
int i;

View file

@ -3,10 +3,11 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileAlloyFurnace;
public class ContainerAlloyFurnace extends TechRebornContainer {
public class ContainerAlloyFurnace extends RebornContainer {
EntityPlayer player;
@ -69,7 +70,7 @@ public class ContainerAlloyFurnace extends TechRebornContainer {
if (this.burnTime != tile.burnTime) {
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
}
if (this.cookTime != tile.cookTime) {
if (this.cookTime != tile.cookTime) {
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
}
}
@ -79,11 +80,11 @@ public class ContainerAlloyFurnace extends TechRebornContainer {
@Override
public void updateProgressBar(int id, int value) {
super.updateProgressBar(id, value);
if(id == 0){
if (id == 0) {
this.currentItemBurnTime = value;
} else if(id ==1){
} else if (id == 1) {
this.burnTime = value;
} else if(id == 2){
} else if (id == 2) {
this.cookTime = value;
}
this.tile.currentItemBurnTime = this.currentItemBurnTime;

View file

@ -2,7 +2,7 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileAlloySmelter;
public class ContainerAlloySmelter extends ContainerCrafting {

View file

@ -2,7 +2,7 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileAssemblingMachine;
public class ContainerAssemblingMachine extends ContainerCrafting {

View file

@ -3,7 +3,7 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileBlastFurnace;
public class ContainerBlastFurnace extends ContainerCrafting {

View file

@ -2,7 +2,7 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileCentrifuge;
public class ContainerCentrifuge extends ContainerCrafting {
@ -19,8 +19,8 @@ public class ContainerCentrifuge extends ContainerCrafting {
}
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player) {
super(tileCentrifuge.crafter);
tile = tileCentrifuge;
super(tileCentrifuge.crafter);
tile = tileCentrifuge;
this.player = player;
// input

View file

@ -2,9 +2,10 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileChargeBench;
public class ContainerChargeBench extends TechRebornContainer {
public class ContainerChargeBench extends RebornContainer {
EntityPlayer player;

View file

@ -2,7 +2,7 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileChemicalReactor;
public class ContainerChemicalReactor extends ContainerCrafting {

View file

@ -2,9 +2,10 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileChunkLoader;
public class ContainerChunkloader extends TechRebornContainer {
public class ContainerChunkloader extends RebornContainer {
EntityPlayer player;

View file

@ -3,9 +3,10 @@ package techreborn.client.container;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.inventory.ICrafting;
import reborncore.common.container.RebornContainer;
import techreborn.api.recipe.RecipeCrafter;
public abstract class ContainerCrafting extends TechRebornContainer {
public abstract class ContainerCrafting extends RebornContainer {
RecipeCrafter crafter;

View file

@ -3,11 +3,12 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import techreborn.client.SlotFilteredVoid;
import reborncore.client.gui.SlotFilteredVoid;
import reborncore.common.container.RebornContainer;
import reborncore.common.util.Inventory;
import techreborn.init.ModItems;
import techreborn.util.Inventory;
public class ContainerDestructoPack extends TechRebornContainer {
public class ContainerDestructoPack extends RebornContainer {
private EntityPlayer player;
private Inventory inv;

View file

@ -5,11 +5,12 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotFake;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotFake;
import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileDieselGenerator;
public class ContainerDieselGenerator extends TechRebornContainer {
public class ContainerDieselGenerator extends RebornContainer {
public TileDieselGenerator tiledieselGenerator;
public EntityPlayer player;
public int energy;
@ -74,8 +75,7 @@ public class ContainerDieselGenerator extends TechRebornContainer {
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.energy = value;
}else
if (id == 1) {
} else if (id == 1) {
this.fluid = value;
}
}

View file

@ -2,11 +2,12 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotFake;
import techreborn.client.SlotOutput;
import reborncore.client.gui.SlotFake;
import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileDigitalChest;
public class ContainerDigitalChest extends TechRebornContainer {
public class ContainerDigitalChest extends RebornContainer {
public TileDigitalChest tileDigitalChest;
public EntityPlayer player;

Some files were not shown because too many files have changed in this diff Show more