Improve greenhouse api and add events

This commit is contained in:
Nedelosk committed 2016-03-19 19:49:45 +01:00
1 parent 7924e9fa83
commit 336d388b4b
21 files changed
+362 -123

No files matched your search

@@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.core;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraftforge.fml.common.eventhandler.Event;
public class CamouflageEvents extends Event {
@Nullable
public ICamouflagedBlock camouflagedBlock;
@Nonnull
public ICamouflageHandler camouflageHandler;
@Nonnull
public final EnumCamouflageType camouflageType;
private CamouflageEvents(ICamouflagedBlock camouflagedBlock, ICamouflageHandler camouflageHandler, EnumCamouflageType camouflageType) {
this.camouflagedBlock = camouflagedBlock;
this.camouflageHandler = camouflageHandler;
this.camouflageType = camouflageType;
}
public static class CamouflageChangeEvent extends CamouflageEvents{
public CamouflageChangeEvent(ICamouflagedBlock camouflagedBlock, ICamouflageHandler camouflageHandler, EnumCamouflageType camouflageType) {
super(camouflagedBlock, camouflageHandler, camouflageType);
}
}
}
@@ -31,7 +31,7 @@ public class DefaultGreenhouseLogic implements IGreenhouseLogic {
}
@Override
public void onChange(EnumGreenhouseChangeType type, Object event) {
public void onEvent(EnumGreenhouseEventType type, Object event) {
}
@Override
@@ -5,7 +5,7 @@
******************************************************************************/
package forestry.api.greenhouse;
public enum EnumGreenhouseChangeType {
public enum EnumGreenhouseEventType {
CAMOUFLAGE
@@ -0,0 +1,79 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import forestry.api.core.EnumCamouflageType;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedBlock;
import net.minecraftforge.fml.common.eventhandler.Event;
public class GreenhouseEvents extends Event {
@Nullable
public final IGreenhouseState state;
public GreenhouseEvents(IGreenhouseState state) {
this.state = state;
}
public static class CamouflageChangeEvent extends GreenhouseEvents{
@Nullable
public ICamouflagedBlock camouflagedBlock;
@Nonnull
public ICamouflageHandler camouflageHandler;
@Nonnull
public final EnumCamouflageType camouflageType;
public CamouflageChangeEvent(IGreenhouseState state, ICamouflagedBlock camouflagedBlock, ICamouflageHandler camouflageHandler, EnumCamouflageType camouflageType) {
super(state);
this.camouflagedBlock = camouflagedBlock;
this.camouflageHandler = camouflageHandler;
this.camouflageType = camouflageType;
}
}
public static class InternalBlockEvent extends GreenhouseEvents{
@Nonnull
public IInternalBlock internalBlock;
public InternalBlockEvent(IGreenhouseState state, IInternalBlock internalBlock) {
super(state);
this.internalBlock = internalBlock;
}
}
public static class CreateInternalBlockEvent extends InternalBlockEvent{
public CreateInternalBlockEvent(IGreenhouseState state, IInternalBlock internalBlock) {
super(state, internalBlock);
}
}
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent{
@Nonnull
public final IInternalBlockFace face;
public CheckInternalBlockFaceEvent(IGreenhouseState state, IInternalBlock internalBlock, IInternalBlockFace face) {
super(state, internalBlock);
this.face = face;
}
}
}
@@ -18,7 +18,7 @@ public interface IGreenhouseLogic extends INbtWritable, INbtReadable {
void work();
void onChange(EnumGreenhouseChangeType type, Object event);
void onEvent(EnumGreenhouseEventType type, Object event);
IGreenhouseController getController();
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.greenhouse;
import java.util.List;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import net.minecraft.world.World;
@@ -18,6 +20,8 @@ public interface IGreenhouseState {
float getExactTemperature();
float getExactHumidity();
List<IInternalBlock> getInternalBlocks();
/**
* @return The world in that the greenhouse standing
@@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public interface IInternalBlock {
@Nonnull
World getWorld();
@Nonnull
BlockPos getPos();
@Nullable
IInternalBlock getRoot();
@Nonnull
Collection<IInternalBlockFace> getFaces();
}
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import javax.annotation.Nonnull;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public interface IInternalBlockFace {
boolean isTested();
void setTested(boolean tested);
@Nonnull
EnumFacing getFace();
@Nonnull
BlockPos getPos();
}
@@ -9,7 +9,7 @@ import java.util.List;
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.IClimateControlled;
import forestry.api.greenhouse.EnumGreenhouseChangeType;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.greenhouse.IGreenhouseLogic;
@@ -18,7 +18,7 @@ public interface IGreenhouseController extends IMultiblockController, IGreenhous
/**
* Handle change events
*/
void onChange(EnumGreenhouseChangeType type, Object event);
void onChange(EnumGreenhouseEventType type, Object event);
/**
* @return The logics of the greenhouse
@@ -25,7 +25,6 @@ import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import forestry.core.PluginFluids;
import forestry.core.config.Constants;
import forestry.core.utils.InventoryUtil;
@@ -20,7 +20,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import net.minecraftforge.fluids.FluidStack;
import forestry.core.PluginFluids;
import forestry.core.config.Constants;
import forestry.core.items.EnumContainerType;
@@ -10,9 +10,9 @@
******************************************************************************/
package forestry.greenhouse;
import forestry.api.core.CamouflageEvents.CamouflageChangeEvent;
import forestry.api.core.ICamouflageHandler;
import forestry.api.greenhouse.EnumGreenhouseChangeType;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.GreenhouseEvents.CamouflageChangeEvent;
import forestry.api.multiblock.IGreenhouseComponent;
import forestry.api.multiblock.IGreenhouseController;
import forestry.greenhouse.blocks.BlockGreenhouseType;
@@ -38,7 +38,7 @@ public class EventHandlerGreenhouse {
}
if(controller != null){
controller.onChange(EnumGreenhouseChangeType.CAMOUFLAGE, event);
controller.onChange(EnumGreenhouseEventType.CAMOUFLAGE, event);
}
}
@@ -10,21 +10,31 @@
******************************************************************************/
package forestry.greenhouse;
import java.util.List;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.greenhouse.IGreenhouseState;
import forestry.api.greenhouse.IInternalBlock;
import forestry.greenhouse.multiblock.GreenhouseController;
import net.minecraft.world.World;
public class GreenhouseState implements IGreenhouseState {
public final class GreenhouseState implements IGreenhouseState {
private final float humidity;
private final float temperature;
private final World world;
private final List<IInternalBlock> internalBlocks;
public GreenhouseState(World world, float humidity, float temperature) {
public GreenhouseState(World world, float humidity, float temperature, List<IInternalBlock> internalBlocks) {
this.world = world;
this.humidity = humidity;
this.temperature = temperature;
this.internalBlocks = internalBlocks;
}
public GreenhouseState(GreenhouseController controller) {
this(controller.getWorld(), controller.getExactHumidity(), controller.getExactTemperature(), controller.getInternalBlocks());
}
@Override
@@ -52,4 +62,9 @@ public class GreenhouseState implements IGreenhouseState {
return world;
}
@Override
public List<IInternalBlock> getInternalBlocks() {
return internalBlocks;
}
}
@@ -13,7 +13,7 @@ package forestry.greenhouse.logics;
import forestry.api.core.EnumCamouflageType;
import forestry.api.core.ICamouflagedBlock;
import forestry.api.greenhouse.DefaultGreenhouseLogic;
import forestry.api.greenhouse.EnumGreenhouseChangeType;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.GreenhouseManager;
import forestry.api.greenhouse.IGreenhouseClimaLogic;
import forestry.api.multiblock.IGreenhouseController;
@@ -59,8 +59,8 @@ public class GreenhouseLogicGreenhouseEffect extends DefaultGreenhouseLogic impl
}
@Override
public void onChange(EnumGreenhouseChangeType type, Object event) {
if(type == EnumGreenhouseChangeType.CAMOUFLAGE){
public void onEvent(EnumGreenhouseEventType type, Object event) {
if(type == EnumGreenhouseEventType.CAMOUFLAGE){
if(controller == null || !controller.isAssembled()) {
return;
}
@@ -14,9 +14,10 @@ import java.util.Collections;
import java.util.List;
import forestry.api.core.EnumCamouflageType;
import forestry.api.greenhouse.EnumGreenhouseChangeType;
import forestry.api.greenhouse.EnumGreenhouseEventType;
import forestry.api.greenhouse.IGreenhouseLogic;
import forestry.api.greenhouse.IGreenhouseState;
import forestry.api.greenhouse.IInternalBlock;
import forestry.core.fluids.FakeTankManager;
import forestry.core.fluids.ITankManager;
import forestry.core.inventory.FakeInventoryAdapter;
@@ -78,7 +79,7 @@ public class FakeGreenhouseController extends FakeMultiblockController implement
}
@Override
public void onChange(EnumGreenhouseChangeType type, Object event) {
public void onChange(EnumGreenhouseEventType type, Object event) {
}
@Override
@@ -93,5 +94,10 @@ public class FakeGreenhouseController extends FakeMultiblockController implement
public IGreenhouseState createState() {
return null;
}
@Override
public List<IInternalBlock> getInternalBlocks() {
return Collections.emptyList();
}
}
@@ -13,20 +13,20 @@ package forestry.greenhouse.multiblock;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forestry.api.core.CamouflageEvents.CamouflageChangeEvent;
import forestry.api.greenhouse.EnumGreenhouseChangeType;
import forestry.api.greenhouse.EnumGreenhouseEventType;
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;
@@ -71,7 +71,7 @@ import net.minecraftforge.fluids.FluidRegistry;
public class GreenhouseController extends RectangularMultiblockControllerBase implements IGreenhouseControllerInternal, ILiquidTankTile {
private final List<InternalBlock> internalBlocks = 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();
@@ -302,7 +302,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
}
}
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(null, this, type));
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(createState(), null, this, type));
}
@Override
@@ -336,8 +336,8 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
/* GREENHOUSE */
@Override
public boolean isInGreenhouse(BlockPos pos) {
for(InternalBlock inerBlock : internalBlocks){
if(inerBlock.pos.equals(pos)){
for(IInternalBlock inerBlock : internalBlocks){
if(inerBlock.getPos().equals(pos)){
return true;
}
}
@@ -346,13 +346,13 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
@Override
public IGreenhouseState createState() {
return new GreenhouseState(worldObj, getBiome().rainfall + humidChange, getBiome().temperature + tempChange);
return new GreenhouseState(this);
}
@Override
public void onChange(EnumGreenhouseChangeType type, Object event) {
public void onChange(EnumGreenhouseEventType type, Object event) {
for(IGreenhouseLogic logic : logics){
logic.onChange(type, event);
logic.onEvent(type, event);
}
}
@@ -547,7 +547,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
boolean isNextRoof = false;
Class<? extends RectangularMultiblockControllerBase> myClass = this.getClass();
List<InternalBlock> internalBlocks = Lists.newArrayList();
List<IInternalBlock> internalBlocks = Lists.newArrayList();
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++) {
@@ -625,9 +625,11 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
}
}
if(isNextRoof){
InternalBlock iB = new InternalBlock(getMinimumCoord().add(1, 1, 1));
internalBlocks.add(iB);
addInternalBlock(iB, internalBlocks);
CreateInternalBlockEvent event = new CreateInternalBlockEvent(createState(), new InternalBlock(worldObj, getMinimumCoord().add(1, 1, 1)));
MinecraftForge.EVENT_BUS.post(event);
checkInternalBlock(event.internalBlock, internalBlocks);
}else if(internalBlocks.isEmpty()){
throw new MultiblockValidationException(StatCollector.translateToLocalFormatted("for.multiblock.error.space.closed"));
}
@@ -652,67 +654,55 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
protected void isBlockGoodForInterior(World world, BlockPos pos) throws MultiblockValidationException {
}
private void addInternalBlock(InternalBlock internalBlock, List<InternalBlock> internalBlocks) throws MultiblockValidationException{
isBlockGoodForInterior(worldObj, internalBlock.pos);
for(Map.Entry<EnumFacing, Boolean> entry : internalBlock.testetFaces.entrySet()){
if(!entry.getValue()){
BlockPos posFacing = new BlockPos(internalBlock.pos.getX() + entry.getKey().getFrontOffsetX(), internalBlock.pos.getY() + entry.getKey().getFrontOffsetY(), internalBlock.pos.getZ() + entry.getKey().getFrontOffsetZ());
private void checkInternalBlock(IInternalBlock blockToCheck, List<IInternalBlock> internalBlocks) throws MultiblockValidationException{
internalBlocks.add(blockToCheck);
BlockPos posRoot = blockToCheck.getPos();
isBlockGoodForInterior(worldObj, posRoot);
for(IInternalBlockFace faceToCheck : blockToCheck.getFaces()){
CheckInternalBlockFaceEvent checkEvent = new CheckInternalBlockFaceEvent(createState(), blockToCheck, faceToCheck);
MinecraftForge.EVENT_BUS.post(checkEvent);
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()){
throw new MultiblockValidationException(StatCollector.translateToLocalFormatted("for.multiblock.error.space.closed"));
}
TileEntity tile = worldObj.getTileEntity(posFacing);
TileEntity tileFace = worldObj.getTileEntity(posFacing);
if(tile instanceof IGreenhouseComponent){
if(((IGreenhouseComponent) tile).getMultiblockLogic().getController() != this){
if(tileFace instanceof IGreenhouseComponent){
if(((IGreenhouseComponent) tileFace).getMultiblockLogic().getController() != this){
throw new MultiblockValidationException(StatCollector.translateToLocalFormatted("for.multiblock.error.not.connected.part", posFacing.getX(), posFacing.getY(), posFacing.getZ()));
}
else if(!(tile instanceof TileGreenhouseSprinkler)){
entry.setValue(true);
else if(!(tileFace instanceof TileGreenhouseSprinkler)){
faceToCheck.setTested(true);
}
}else{
InternalBlock iB = new InternalBlock(posFacing, entry.getKey().getOpposite(), internalBlock);
if(internalBlocks.contains(iB)){
entry.setValue(true);
CreateInternalBlockEvent createEvent = new CreateInternalBlockEvent(createState(), new InternalBlock(worldObj, posFacing, face.getOpposite(), blockToCheck));
MinecraftForge.EVENT_BUS.post(createEvent);
IInternalBlock internalBlock = createEvent.internalBlock;
// Check is the internal block in the list
if(internalBlocks.contains(internalBlock)){
faceToCheck.setTested(true);
}else{
internalBlocks.add(iB);
addInternalBlock(iB, internalBlocks);
checkInternalBlock(internalBlock, internalBlocks);
}
}
}
}
}
private static class InternalBlock{
public BlockPos pos;
public EnumMap<EnumFacing, Boolean> testetFaces = Maps.newEnumMap(EnumFacing.class);
public InternalBlock root;
private InternalBlock(BlockPos pos) {
this.pos = pos;
for(EnumFacing facing : EnumFacing.VALUES){
testetFaces.put(facing, false);
}
}
private InternalBlock(BlockPos pos, EnumFacing facing, InternalBlock root) {
this.pos = pos;
for(EnumFacing f : EnumFacing.VALUES){
testetFaces.put(f, f == facing);
}
this.root = root;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof InternalBlock)){
return false;
}
InternalBlock ib = (InternalBlock) obj;
return ib.pos.equals(pos);
}
@Override
public List<IInternalBlock> getInternalBlocks() {
return internalBlocks;
}
}
@@ -10,10 +10,13 @@
******************************************************************************/
package forestry.greenhouse.multiblock;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import forestry.api.greenhouse.IGreenhouseState;
import forestry.api.greenhouse.IInternalBlock;
import forestry.api.multiblock.IGreenhouseController;
import forestry.core.access.IRestrictedAccess;
import forestry.core.fluids.ITankManager;
@@ -24,14 +27,19 @@ import forestry.energy.EnergyManager;
public interface IGreenhouseControllerInternal extends IGreenhouseController, IMultiblockControllerInternal, IRestrictedAccess, IStreamableGui {
@Nonnull
IInventoryAdapter getInternalInventory();
@Nonnull
ITankManager getTankManager();
@Nullable
EnergyManager getEnergyManager();
@Nonnull
@Nullable
IGreenhouseState createState();
@Nonnull
List<IInternalBlock> getInternalBlocks();
}
@@ -0,0 +1,77 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.greenhouse.multiblock;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import forestry.api.greenhouse.IInternalBlock;
import forestry.api.greenhouse.IInternalBlockFace;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class InternalBlock implements IInternalBlock {
private final BlockPos pos;
private final World world;
private final List<IInternalBlockFace> faces = new ArrayList();
private final IInternalBlock root;
public InternalBlock(World world, BlockPos pos) {
this.world = world;
this.pos = pos;
this.root = null;
for(EnumFacing facing : EnumFacing.VALUES){
this.faces.add(new InternalBlockFace(facing, getPos().offset(facing), false));
}
}
public InternalBlock(World world, BlockPos pos, EnumFacing rootFace, IInternalBlock root) {
this.world = world;
this.pos = pos;
this.root = root;
for(EnumFacing face : EnumFacing.VALUES){
this.faces.add(new InternalBlockFace(face, getPos().offset(face), face == rootFace));
}
}
@Override
public World getWorld() {
return world;
}
@Override
public BlockPos getPos() {
return pos;
}
@Override
public Collection<IInternalBlockFace> getFaces() {
return faces;
}
@Override
public IInternalBlock getRoot() {
return root;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof IInternalBlock)){
return false;
}
IInternalBlock internalBlock = (IInternalBlock) obj;
return internalBlock.getPos().equals(getPos());
}
}
@@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.greenhouse.multiblock;
import forestry.api.greenhouse.IInternalBlockFace;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public class InternalBlockFace implements IInternalBlockFace {
private final EnumFacing face;
private final BlockPos pos;
private boolean isTested;
public InternalBlockFace(EnumFacing face, BlockPos pos, boolean isTested) {
this.face = face;
this.pos = pos;
this.isTested = isTested;
}
@Override
public boolean isTested() {
return isTested;
}
@Override
public void setTested(boolean tested) {
this.isTested = tested;
}
@Override
public EnumFacing getFace() {
return face;
}
@Override
public BlockPos getPos() {
return pos;
}
}
@@ -23,7 +23,7 @@ import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedBlock;
import forestry.api.core.IErrorLogic;
import forestry.api.core.IErrorLogicSource;
import forestry.api.core.CamouflageEvents.CamouflageChangeEvent;
import forestry.api.greenhouse.GreenhouseEvents.CamouflageChangeEvent;
import forestry.api.multiblock.IGreenhouseComponent;
import forestry.api.multiblock.IMultiblockController;
import forestry.core.access.EnumAccess;
@@ -103,7 +103,7 @@ public abstract class TileGreenhouse extends MultiblockTileEntityForestry<Multib
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type));
}
}
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(this, this, type));
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(getMultiblockLogic().getController().createState(), this, this, type));
}
@Override
@@ -25,7 +25,7 @@ import forestry.api.core.ICamouflageHandler;
import forestry.api.core.ICamouflagedBlock;
import forestry.api.core.IErrorLogic;
import forestry.api.core.IErrorLogicSource;
import forestry.api.core.CamouflageEvents.CamouflageChangeEvent;
import forestry.api.greenhouse.GreenhouseEvents.CamouflageChangeEvent;
import forestry.api.multiblock.IGreenhouseComponent;
import forestry.api.multiblock.IMultiblockController;
import forestry.api.multiblock.MultiblockTileEntityBase;
@@ -143,7 +143,7 @@ public class TileGreenhouseHatch extends MultiblockTileEntityBase<MultiblockLogi
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type));
}
}
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(this, this, type));
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(getMultiblockLogic().getController().createState(), this, this, type));
}
@Override