Fixed some compile errors again, sorry :(
This commit is contained in:
parent
8d8814bb77
commit
c4dd21b39e
5 changed files with 52 additions and 17 deletions
|
@ -8,7 +8,10 @@ public abstract class BaseMultiBlock implements IMultiBlock {
|
||||||
|
|
||||||
TileEntity parent;
|
TileEntity parent;
|
||||||
|
|
||||||
public BaseMultiBlock(TileEntity parent) {
|
public BaseMultiBlock() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(TileEntity parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,13 @@ public class MultiBlockController extends TileEntity implements IMultiBlockContr
|
||||||
public IMultiBlock getMultiBlock() {
|
public IMultiBlock getMultiBlock() {
|
||||||
return multiBlock;
|
return multiBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMultiBlock(TileEntity tileEntity, BaseMultiBlock multiBlock){
|
||||||
|
this.multiBlock = multiBlock;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(TileEntity tileEntity){
|
||||||
|
multiBlock.setParent(tileEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,51 @@
|
||||||
package techreborn.event;
|
package techreborn.event;
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import techreborn.api.multiblock.IMultiBlockController;
|
||||||
import techreborn.api.multiblock.IMultiblockComponent;
|
import techreborn.api.multiblock.IMultiblockComponent;
|
||||||
|
|
||||||
public class MultiblockEvent {
|
public class MultiblockEvent {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void blockBreakEvent(net.minecraftforge.event.world.BlockEvent.BreakEvent event){
|
public void blockBreakEvent(net.minecraftforge.event.world.BlockEvent.BreakEvent event) {
|
||||||
if(event.world.getTileEntity(event.x, event.y, event.z) instanceof IMultiblockComponent){
|
if (event.world.getTileEntity(event.x, event.y, event.z) instanceof IMultiblockComponent) {
|
||||||
IMultiblockComponent component = (IMultiblockComponent) event.world.getTileEntity(event.x, event.y, event.z);
|
IMultiblockComponent component = (IMultiblockComponent) event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
// if(component.getMultiblock() != null)
|
for (int x = -3; x < 3; x++) {
|
||||||
// component.getMultiblock().recompute();
|
for (int y = -3; y < 3; y++) {
|
||||||
//TODO find all multiblock controllers fo the same type that are near this location and recompute.
|
for (int z = -3; z < 3; z++) {
|
||||||
|
//TODO have a quicker way of doing this, Arraylist with all controllers?
|
||||||
|
TileEntity tile = event.world.getTileEntity(x + event.x, y + event.y, z + event.z);
|
||||||
|
if (tile != null && tile instanceof IMultiBlockController) {
|
||||||
|
IMultiBlockController controller = (IMultiBlockController) tile;
|
||||||
|
controller.getMultiBlock().recompute();
|
||||||
|
System.out.println(controller.getMultiBlock().isComplete());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void blockPlaceEvent(net.minecraftforge.event.world.BlockEvent.PlaceEvent event){
|
@SubscribeEvent(priority =)
|
||||||
if(event.world.getTileEntity(event.x, event.y, event.z) instanceof IMultiblockComponent){
|
public void blockPlaceEvent(net.minecraftforge.event.world.BlockEvent.PlaceEvent event) {
|
||||||
|
if (event.world.getTileEntity(event.x, event.y, event.z) instanceof IMultiblockComponent) {
|
||||||
IMultiblockComponent component = (IMultiblockComponent) event.world.getTileEntity(event.x, event.y, event.z);
|
IMultiblockComponent component = (IMultiblockComponent) event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
// if(component.getMultiblock() != null)
|
for (int x = -3; x < 3; x++) {
|
||||||
// component.getMultiblock().recompute();
|
for (int y = -3; y < 3; y++) {
|
||||||
|
for (int z = -3; z < 3; z++) {
|
||||||
|
//TODO have a quicker way of doing this
|
||||||
|
TileEntity tile = event.world.getTileEntity(x + event.x, y + event.y, z + event.z);
|
||||||
|
if (tile != null && tile instanceof IMultiBlockController) {
|
||||||
|
IMultiBlockController controller = (IMultiBlockController) tile;
|
||||||
|
controller.getMultiBlock().recompute();
|
||||||
|
System.out.println(controller.getMultiBlock().isComplete());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class MultiBlastfurnace extends BaseMultiBlock {
|
public class MultiBlastfurnace extends BaseMultiBlock {
|
||||||
|
|
||||||
public MultiBlastfurnace(TileEntity parent) {
|
|
||||||
super(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -30,6 +27,6 @@ public class MultiBlastfurnace extends BaseMultiBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recompute() {
|
public void recompute() {
|
||||||
|
setIsComplete(checkIfComplete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
|
||||||
import ic2.api.tile.IWrenchable;
|
import ic2.api.tile.IWrenchable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import techreborn.api.multiblock.IMultiBlock;
|
import techreborn.api.multiblock.BaseMultiBlock;
|
||||||
import techreborn.api.multiblock.MultiBlockController;
|
import techreborn.api.multiblock.MultiBlockController;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.util.Inventory;
|
import techreborn.util.Inventory;
|
||||||
|
@ -15,8 +15,9 @@ public class TileBlastFurnace extends MultiBlockController implements IWrenchabl
|
||||||
public BasicSink energy;
|
public BasicSink energy;
|
||||||
public Inventory inventory = new Inventory(3, "TileBlastFurnace", 64);
|
public Inventory inventory = new Inventory(3, "TileBlastFurnace", 64);
|
||||||
|
|
||||||
public TileBlastFurnace(IMultiBlock multiBlock) {
|
public TileBlastFurnace(BaseMultiBlock multiBlock) {
|
||||||
super(multiBlock);
|
super(multiBlock);
|
||||||
|
setParent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue