Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -1,40 +1,36 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffect;
|
||||
import WayofTime.bloodmagic.api.iface.IAlchemyArray;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffect;
|
||||
import WayofTime.bloodmagic.api.iface.IAlchemyArray;
|
||||
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
|
||||
|
||||
public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray
|
||||
{
|
||||
public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray {
|
||||
public boolean isActive = false;
|
||||
public int activeCounter = 0;
|
||||
public EnumFacing rotation = EnumFacing.HORIZONTALS[0];;
|
||||
public EnumFacing rotation = EnumFacing.HORIZONTALS[0];
|
||||
;
|
||||
|
||||
private String key = "empty";
|
||||
private AlchemyArrayEffect arrayEffect;
|
||||
|
||||
public TileAlchemyArray()
|
||||
{
|
||||
public TileAlchemyArray() {
|
||||
super(2, "alchemyArray");
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(IBlockState state, Entity entity)
|
||||
{
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(IBlockState state, Entity entity) {
|
||||
if (arrayEffect != null) {
|
||||
arrayEffect.onEntityCollidedWithBlock(this, getWorld(), pos, state, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tagCompound) {
|
||||
super.deserialize(tagCompound);
|
||||
this.isActive = tagCompound.getBoolean("isActive");
|
||||
this.activeCounter = tagCompound.getInteger("activeCounter");
|
||||
|
@ -43,15 +39,13 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
|
||||
NBTTagCompound arrayTag = tagCompound.getCompoundTag("arrayTag");
|
||||
arrayEffect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(key);
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
arrayEffect.readFromNBT(arrayTag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
|
||||
super.serialize(tagCompound);
|
||||
tagCompound.setBoolean("isActive", isActive);
|
||||
tagCompound.setInteger("activeCounter", activeCounter);
|
||||
|
@ -59,8 +53,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
tagCompound.setInteger(Constants.NBT.DIRECTION, rotation.getHorizontalIndex());
|
||||
|
||||
NBTTagCompound arrayTag = new NBTTagCompound();
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
arrayEffect.writeToNBT(arrayTag);
|
||||
}
|
||||
tagCompound.setTag("arrayTag", arrayTag);
|
||||
|
@ -69,19 +62,15 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (isActive && attemptCraft())
|
||||
{
|
||||
public void update() {
|
||||
if (isActive && attemptCraft()) {
|
||||
activeCounter++;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
isActive = false;
|
||||
activeCounter = 0;
|
||||
arrayEffect = null;
|
||||
|
@ -93,49 +82,38 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
|
|||
* This occurs when the block is destroyed.
|
||||
*/
|
||||
@Override
|
||||
public void dropItems()
|
||||
{
|
||||
public void dropItems() {
|
||||
super.dropItems();
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attemptCraft()
|
||||
{
|
||||
public boolean attemptCraft() {
|
||||
AlchemyArrayEffect effect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(this.getStackInSlot(0), this.getStackInSlot(1));
|
||||
if (effect != null)
|
||||
{
|
||||
if (arrayEffect == null)
|
||||
{
|
||||
if (effect != null) {
|
||||
if (arrayEffect == null) {
|
||||
arrayEffect = effect;
|
||||
key = effect.getKey();
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
String effectKey = effect.getKey();
|
||||
if (effectKey.equals(key))
|
||||
{
|
||||
if (effectKey.equals(key)) {
|
||||
//Good! Moving on.
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
//Something has changed, therefore we have to move our stuffs.
|
||||
//TODO: Add an AlchemyArrayEffect.onBreak(); ?
|
||||
arrayEffect = effect;
|
||||
key = effect.getKey();
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
if (arrayEffect != null) {
|
||||
isActive = true;
|
||||
|
||||
if (arrayEffect.update(this, this.activeCounter))
|
||||
{
|
||||
if (arrayEffect.update(this, this.activeCounter)) {
|
||||
this.decrStackSize(0, 1);
|
||||
this.decrStackSize(1, 1);
|
||||
this.getWorld().setBlockToAir(getPos());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue