mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 06:14:46 +00:00
Big code cleanup
This commit is contained in:
1 parent
1b58077904
commit
a3363fb4bc
132 files changed
+1587
-1863
No files matched your search
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
@@ -17,23 +18,36 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import forestry.api.core.EnumCamouflageType;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ICamouflagedBlock;
|
||||
import forestry.api.greenhouse.EnumGreenhouseEventType;
|
||||
import forestry.api.greenhouse.GreenhouseEvents.CamouflageChangeEvent;
|
||||
import forestry.api.greenhouse.GreenhouseEvents.CheckInternalBlockFaceEvent;
|
||||
import forestry.api.greenhouse.GreenhouseEvents.CreateInternalBlockEvent;
|
||||
import forestry.api.greenhouse.GreenhouseManager;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
import forestry.api.greenhouse.IGreenhouseState;
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.greenhouse.IInternalBlockFace;
|
||||
import forestry.api.greenhouse.GreenhouseEvents.CamouflageChangeEvent;
|
||||
import forestry.api.greenhouse.GreenhouseEvents.CheckInternalBlockFaceEvent;
|
||||
import forestry.api.greenhouse.GreenhouseEvents.CreateInternalBlockEvent;
|
||||
import forestry.api.core.EnumCamouflageType;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ICamouflagedBlock;
|
||||
import forestry.api.multiblock.IGreenhouseComponent;
|
||||
import forestry.api.multiblock.IGreenhouseComponent.ButterflyHatch;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.api.multiblock.IGreenhouseComponent.ButterflyHatch;
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.TankManager;
|
||||
@@ -58,25 +72,14 @@ import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
import forestry.greenhouse.inventory.InventoryGreenhouse;
|
||||
import forestry.greenhouse.network.packets.PacketCamouflageUpdate;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseSprinkler;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class GreenhouseController extends RectangularMultiblockControllerBase implements IGreenhouseControllerInternal, ILiquidTankTile {
|
||||
|
||||
private final List<IInternalBlock> internalBlocks = new ArrayList();
|
||||
private final Set<IGreenhouseComponent.Listener> listenerComponents = new HashSet();
|
||||
private final Set<IGreenhouseComponent.Climatiser> climatiserComponents = new HashSet();
|
||||
private final Set<IGreenhouseComponent.Active> activeComponents = new HashSet();
|
||||
private final List<IGreenhouseLogic> logics = new ArrayList();
|
||||
private final List<IInternalBlock> internalBlocks = new ArrayList<>();
|
||||
private final Set<IGreenhouseComponent.Listener> listenerComponents = new HashSet<>();
|
||||
private final Set<IGreenhouseComponent.Climatiser> climatiserComponents = new HashSet<>();
|
||||
private final Set<IGreenhouseComponent.Active> activeComponents = new HashSet<>();
|
||||
private final List<IGreenhouseLogic> logics = new ArrayList<>();
|
||||
|
||||
private float tempChange;
|
||||
private float humidChange;
|
||||
@@ -201,7 +204,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
CamouflageUtil.writeCamouflageBlockToNBT(data, this, EnumCamouflageType.GLASS);
|
||||
CamouflageUtil.writeCamouflageBlockToNBT(data, this, EnumCamouflageType.DOOR);
|
||||
|
||||
for(IGreenhouseLogic logic : getLogics()){
|
||||
for (IGreenhouseLogic logic : getLogics()) {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
logic.writeToNBT(nbtTag);
|
||||
data.setTag("logic" + logic.getName(), nbtTag);
|
||||
@@ -222,11 +225,11 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
CamouflageUtil.readCamouflageBlockFromNBT(data, this, EnumCamouflageType.GLASS);
|
||||
CamouflageUtil.readCamouflageBlockFromNBT(data, this, EnumCamouflageType.DOOR);
|
||||
|
||||
if(logics.isEmpty()){
|
||||
if (logics.isEmpty()) {
|
||||
createLogics();
|
||||
}
|
||||
|
||||
for(IGreenhouseLogic logic : getLogics()){
|
||||
for (IGreenhouseLogic logic : getLogics()) {
|
||||
logic.readFromNBT(data.getCompoundTag("logic" + logic.getName()));
|
||||
}
|
||||
}
|
||||
@@ -289,25 +292,25 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
@Override
|
||||
public void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock) {
|
||||
switch (type) {
|
||||
case DEFAULT:
|
||||
camouflagePlainBlock = camouflageBlock;
|
||||
break;
|
||||
case GLASS:
|
||||
camouflageGlassBlock = camouflageBlock;
|
||||
break;
|
||||
case DOOR:
|
||||
camouflageDoorBlock = camouflageBlock;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
case DEFAULT:
|
||||
camouflagePlainBlock = camouflageBlock;
|
||||
break;
|
||||
case GLASS:
|
||||
camouflageGlassBlock = camouflageBlock;
|
||||
break;
|
||||
case DOOR:
|
||||
camouflageDoorBlock = camouflageBlock;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldObj != null) {
|
||||
if(worldObj.isRemote){
|
||||
for(IMultiblockComponent comp : connectedParts){
|
||||
if(comp instanceof ICamouflagedBlock){
|
||||
if (worldObj.isRemote) {
|
||||
for (IMultiblockComponent comp : connectedParts) {
|
||||
if (comp instanceof ICamouflagedBlock) {
|
||||
ICamouflagedBlock camBlock = (ICamouflagedBlock) comp;
|
||||
if(camBlock.getCamouflageType() == type){
|
||||
if (camBlock.getCamouflageType() == type) {
|
||||
worldObj.markBlockForUpdate(camBlock.getCoordinates());
|
||||
}
|
||||
}
|
||||
@@ -322,32 +325,33 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
@Override
|
||||
public ItemStack getCamouflageBlock(EnumCamouflageType type) {
|
||||
switch (type) {
|
||||
case DEFAULT:
|
||||
return camouflagePlainBlock;
|
||||
case GLASS:
|
||||
return camouflageGlassBlock;
|
||||
case DOOR:
|
||||
return camouflageDoorBlock;
|
||||
default:
|
||||
return null;
|
||||
case DEFAULT:
|
||||
return camouflagePlainBlock;
|
||||
case GLASS:
|
||||
return camouflageGlassBlock;
|
||||
case DOOR:
|
||||
return camouflageDoorBlock;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDefaultCamouflageBlock(EnumCamouflageType type) {
|
||||
switch (type) {
|
||||
case DEFAULT:
|
||||
return new ItemStack(Blocks.brick_block);
|
||||
case GLASS:
|
||||
return new ItemStack(Blocks.stained_glass, 1, 13);
|
||||
case DOOR:
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
case DEFAULT:
|
||||
return new ItemStack(Blocks.brick_block);
|
||||
case GLASS:
|
||||
return new ItemStack(Blocks.stained_glass, 1, 13);
|
||||
case DOOR:
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* GREENHOUSE */
|
||||
@Nonnull
|
||||
@Override
|
||||
public IGreenhouseState createState() {
|
||||
return new GreenhouseState(this);
|
||||
@@ -355,7 +359,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
|
||||
@Override
|
||||
public void onChange(EnumGreenhouseEventType type, Object event) {
|
||||
for(IGreenhouseLogic logic : logics){
|
||||
for (IGreenhouseLogic logic : logics) {
|
||||
logic.onEvent(type, event);
|
||||
}
|
||||
}
|
||||
@@ -363,9 +367,9 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
/* GREENHOUSE LOGICS */
|
||||
private void createLogics() {
|
||||
logics.clear();
|
||||
for(Class<? extends IGreenhouseLogic> logicClass : GreenhouseManager.greenhouseLogics){
|
||||
for (Class<? extends IGreenhouseLogic> logicClass : GreenhouseManager.greenhouseLogics) {
|
||||
IGreenhouseLogic logic = createLogic(logicClass);
|
||||
if(logic != null){
|
||||
if (logic != null) {
|
||||
logics.add(logic);
|
||||
}
|
||||
}
|
||||
@@ -376,8 +380,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
return logicClass.getConstructor(IGreenhouseController.class).newInstance(this);
|
||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||
| NoSuchMethodException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Log.error("Fail to create a greenhouse logic with the class: " + logicClass);
|
||||
Log.error("Fail to create a greenhouse logic with the class: {}", logicClass, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -388,6 +391,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
}
|
||||
|
||||
/* MANAGERS */
|
||||
@Nonnull
|
||||
@Override
|
||||
public TankManager getTankManager() {
|
||||
return tankManager;
|
||||
@@ -398,6 +402,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
return energyManager;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IInventoryAdapter getInternalInventory() {
|
||||
if (isAssembled()) {
|
||||
@@ -425,22 +430,22 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
|
||||
@Override
|
||||
protected void onBlockAdded(IMultiblockComponent newPart) {
|
||||
if(newPart instanceof IGreenhouseComponent.Listener){
|
||||
if (newPart instanceof IGreenhouseComponent.Listener) {
|
||||
listenerComponents.add((IGreenhouseComponent.Listener) newPart);
|
||||
}else if(newPart instanceof IGreenhouseComponent.Climatiser){
|
||||
} else if (newPart instanceof IGreenhouseComponent.Climatiser) {
|
||||
climatiserComponents.add((IGreenhouseComponent.Climatiser) newPart);
|
||||
}else if(newPart instanceof IGreenhouseComponent.Active){
|
||||
} else if (newPart instanceof IGreenhouseComponent.Active) {
|
||||
activeComponents.add((IGreenhouseComponent.Active) newPart);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBlockRemoved(IMultiblockComponent oldPart) {
|
||||
if(oldPart instanceof IGreenhouseComponent.Listener){
|
||||
if (oldPart instanceof IGreenhouseComponent.Listener) {
|
||||
listenerComponents.remove(oldPart);
|
||||
}else if(oldPart instanceof IGreenhouseComponent.Climatiser){
|
||||
} else if (oldPart instanceof IGreenhouseComponent.Climatiser) {
|
||||
climatiserComponents.remove(oldPart);
|
||||
}else if(oldPart instanceof IGreenhouseComponent.Active){
|
||||
} else if (oldPart instanceof IGreenhouseComponent.Active) {
|
||||
activeComponents.remove(oldPart);
|
||||
}
|
||||
}
|
||||
@@ -455,33 +460,33 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
|
||||
@Override
|
||||
protected boolean updateServer(int tickCount) {
|
||||
if(!isAssembled()){
|
||||
if (!isAssembled()) {
|
||||
boolean hasChangeClima = false;
|
||||
if (updateOnInterval(45)) {
|
||||
if(humidChange > 0F){
|
||||
if(humidChange > 0.25F){
|
||||
humidChange=- 0.25F;
|
||||
}else{
|
||||
if (humidChange > 0F) {
|
||||
if (humidChange > 0.25F) {
|
||||
humidChange = -0.25F;
|
||||
} else {
|
||||
humidChange = 0F;
|
||||
}
|
||||
hasChangeClima = true;
|
||||
}
|
||||
if(tempChange > 0F){
|
||||
if(tempChange > 0.25F){
|
||||
tempChange=- 0.25F;
|
||||
}else{
|
||||
if (tempChange > 0F) {
|
||||
if (tempChange > 0.25F) {
|
||||
tempChange = -0.25F;
|
||||
} else {
|
||||
tempChange = 0F;
|
||||
}
|
||||
hasChangeClima = true;
|
||||
}
|
||||
}
|
||||
return hasChangeClima;
|
||||
}else{
|
||||
} else {
|
||||
if (updateOnInterval(20)) {
|
||||
inventory.drainCan(tankManager);
|
||||
}
|
||||
|
||||
for(IGreenhouseLogic logic : logics){
|
||||
for (IGreenhouseLogic logic : logics) {
|
||||
logic.work();
|
||||
}
|
||||
|
||||
@@ -494,16 +499,16 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
canWork = listenerComponent.getGreenhouseListener().canWork(this, canWork);
|
||||
}
|
||||
|
||||
if(canWork){
|
||||
|
||||
if (canWork) {
|
||||
|
||||
for (IGreenhouseComponent.Climatiser climatiser : climatiserComponents) {
|
||||
climatiser.changeClimate(tickCount, this);
|
||||
}
|
||||
|
||||
|
||||
tempChange = equalizeChange(tempChange);
|
||||
humidChange = equalizeChange(humidChange);
|
||||
}
|
||||
|
||||
|
||||
return canWork;
|
||||
}
|
||||
}
|
||||
@@ -556,7 +561,8 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
boolean isNextRoof = false;
|
||||
Class<? extends RectangularMultiblockControllerBase> myClass = this.getClass();
|
||||
|
||||
height: for (int y = minimumCoord.getY(); y <= maximumCoord.getY(); y++) {
|
||||
height:
|
||||
for (int y = minimumCoord.getY(); y <= maximumCoord.getY(); y++) {
|
||||
for (int x = minimumCoord.getX(); x <= maximumCoord.getX(); x++) {
|
||||
for (int z = minimumCoord.getZ(); z <= maximumCoord.getZ(); z++) {
|
||||
// Okay, figure out what sort of block this should be.
|
||||
@@ -599,9 +605,9 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
// Side
|
||||
BlockPos posUp = pos.add(0, 1, 0);
|
||||
TileEntity tileUp = worldObj.getTileEntity(posUp);
|
||||
if(sides >= 1 && !(tileUp instanceof IGreenhouseComponent)){
|
||||
if (sides >= 1 && !(tileUp instanceof IGreenhouseComponent)) {
|
||||
int delta = y - minimumCoord.getY();
|
||||
if(y - minimumCoord.getY() >= minY){
|
||||
if (y - minimumCoord.getY() >= minY) {
|
||||
isNextRoof = true;
|
||||
}
|
||||
break height;
|
||||
@@ -620,9 +626,9 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
} else {
|
||||
if (part != null) {
|
||||
IBlockState state = worldObj.getBlockState(part.getCoordinates());
|
||||
if(state.getBlock() instanceof BlockGreenhouse && ((BlockGreenhouse)state.getBlock()).getGreenhouseType() == BlockGreenhouseType.SPRINKLER || !myClass.equals(part.getMultiblockLogic().getController().getClass())){
|
||||
if (state.getBlock() instanceof BlockGreenhouse && ((BlockGreenhouse) state.getBlock()).getGreenhouseType() == BlockGreenhouseType.SPRINKLER || !myClass.equals(part.getMultiblockLogic().getController().getClass())) {
|
||||
isGoodForInterior(part);
|
||||
}else{
|
||||
} else {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.invalid.part", Translator.translateToLocal(getUnlocalizedType())));
|
||||
}
|
||||
} else {
|
||||
@@ -634,21 +640,21 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
}
|
||||
internalBlocks.clear();
|
||||
|
||||
if(isNextRoof){
|
||||
if (isNextRoof) {
|
||||
checkInternalBlock(createInternalBlock(new InternalBlock(worldObj, getMinimumCoord().add(1, 1, 1))));
|
||||
}
|
||||
if(internalBlocks.isEmpty()){
|
||||
if (internalBlocks.isEmpty()) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.space.closed"));
|
||||
}
|
||||
this.internalBlocks.addAll(internalBlocks);
|
||||
|
||||
int hatches = 0;
|
||||
for(IMultiblockComponent comp : connectedParts){
|
||||
if(comp instanceof IGreenhouseComponent.ButterflyHatch){
|
||||
for (IMultiblockComponent comp : connectedParts) {
|
||||
if (comp instanceof IGreenhouseComponent.ButterflyHatch) {
|
||||
hatches++;
|
||||
}
|
||||
}
|
||||
if(hatches > 1){
|
||||
if (hatches > 1) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.butterflyhatch.toomany"));
|
||||
}
|
||||
}
|
||||
@@ -657,42 +663,41 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
protected void updateClient(int tickCount) {
|
||||
}
|
||||
|
||||
private void checkInternalBlock(IInternalBlock blockToCheck) throws MultiblockValidationException{
|
||||
private void checkInternalBlock(IInternalBlock blockToCheck) throws MultiblockValidationException {
|
||||
internalBlocks.add(blockToCheck);
|
||||
BlockPos posRoot = blockToCheck.getPos();
|
||||
|
||||
isBlockGoodForInterior(worldObj, posRoot);
|
||||
for(IInternalBlockFace faceToCheck : blockToCheck.getFaces()){
|
||||
for (IInternalBlockFace faceToCheck : blockToCheck.getFaces()) {
|
||||
CheckInternalBlockFaceEvent checkEvent = new CheckInternalBlockFaceEvent(createState(), blockToCheck, faceToCheck);
|
||||
MinecraftForge.EVENT_BUS.post(checkEvent);
|
||||
|
||||
if(!faceToCheck.isTested()){
|
||||
if (!faceToCheck.isTested()) {
|
||||
EnumFacing face = faceToCheck.getFace();
|
||||
BlockPos posFacing = posRoot.offset(face);
|
||||
|
||||
BlockPos minPos = getMinimumCoord();
|
||||
BlockPos maxPos = getMaximumCoord();
|
||||
|
||||
if(minPos.getX() > posFacing.getX() || minPos.getY() > posFacing.getY() || minPos.getZ() > posFacing.getZ() || maxPos.getX() < posFacing.getX() || maxPos.getY() < posFacing.getY() || maxPos.getZ() < posFacing.getZ()){
|
||||
if (minPos.getX() > posFacing.getX() || minPos.getY() > posFacing.getY() || minPos.getZ() > posFacing.getZ() || maxPos.getX() < posFacing.getX() || maxPos.getY() < posFacing.getY() || maxPos.getZ() < posFacing.getZ()) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.space.closed"));
|
||||
}
|
||||
|
||||
TileEntity tileFace = worldObj.getTileEntity(posFacing);
|
||||
|
||||
if(tileFace instanceof IGreenhouseComponent){
|
||||
if(((IGreenhouseComponent) tileFace).getMultiblockLogic().getController() != this){
|
||||
if (tileFace instanceof IGreenhouseComponent) {
|
||||
if (((IGreenhouseComponent) tileFace).getMultiblockLogic().getController() != this) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.not.connected.part"));
|
||||
}
|
||||
else if(!(tileFace instanceof TileGreenhouseSprinkler)){
|
||||
} else if (!(tileFace instanceof TileGreenhouseSprinkler)) {
|
||||
faceToCheck.setTested(true);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
IInternalBlock internalBlock = createInternalBlock(new InternalBlock(worldObj, posFacing, face.getOpposite(), blockToCheck));
|
||||
|
||||
// Check is the internal block in the list
|
||||
if(internalBlocks.contains(internalBlock)){
|
||||
if (internalBlocks.contains(internalBlock)) {
|
||||
faceToCheck.setTested(true);
|
||||
}else{
|
||||
} else {
|
||||
checkInternalBlock(internalBlock);
|
||||
}
|
||||
}
|
||||
@@ -700,7 +705,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
}
|
||||
}
|
||||
|
||||
private IInternalBlock createInternalBlock(IInternalBlock internalBlock){
|
||||
private IInternalBlock createInternalBlock(IInternalBlock internalBlock) {
|
||||
CreateInternalBlockEvent createEvent = new CreateInternalBlockEvent(createState(), internalBlock);
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(createEvent);
|
||||
@@ -714,19 +719,19 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
return internalBlocks;
|
||||
}
|
||||
|
||||
public static ButterflyHatch getGreenhouseButterflyHatch(World world, BlockPos pos){
|
||||
if(GreenhouseManager.greenhouseHelper.getGreenhouseState(world, pos) == null){
|
||||
return null;
|
||||
}
|
||||
IGreenhouseState state = GreenhouseManager.greenhouseHelper.getGreenhouseState(world, pos);
|
||||
for(IMultiblockComponent greenhouse : state.getGreenhouseComponents()){
|
||||
if(greenhouse instanceof ButterflyHatch){
|
||||
return (ButterflyHatch) greenhouse;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ButterflyHatch getGreenhouseButterflyHatch(World world, BlockPos pos) {
|
||||
if (GreenhouseManager.greenhouseHelper.getGreenhouseState(world, pos) == null) {
|
||||
return null;
|
||||
}
|
||||
IGreenhouseState state = GreenhouseManager.greenhouseHelper.getGreenhouseState(world, pos);
|
||||
for (IMultiblockComponent greenhouse : state.getGreenhouseComponents()) {
|
||||
if (greenhouse instanceof ButterflyHatch) {
|
||||
return (ButterflyHatch) greenhouse;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void isGoodForExteriorLevel(IMultiblockComponent part, int level) throws MultiblockValidationException {
|
||||
|
||||
|
||||
Reference in new issue
Block a user