Add greenhouse logics

This commit is contained in:
Nedelosk committed 2016-03-18 19:29:08 +01:00
1 parent ad69242a40
commit eebd9c6ecf
33 files changed
+586 -243

No files matched your search

@@ -0,0 +1,41 @@
/*******************************************************************************
* 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);
}
}
}
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraft.nbt.NBTTagCompound;
public class DefaultGreenhouseLogic implements IGreenhouseLogic {
public final IGreenhouseController controller;
private final String name;
public DefaultGreenhouseLogic(IGreenhouseController controller, String name) {
this.controller = controller;
this.name = name;
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
}
@Override
public void onWork() {
}
@Override
public void onChange(EnumGreenhouseChangeType type, Object event) {
}
@Override
public IGreenhouseController getController() {
return controller;
}
@Override
public String getName() {
return null;
}
}
@@ -0,0 +1,12 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
public enum EnumGreenhouseChangeType {
CAMOUFLAGE
}
@@ -1,7 +1,17 @@
/*******************************************************************************
* 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.ArrayList;
import java.util.List;
public class GreenhouseManager {
public static IGreenhouseItemAccess greenhouseItemAccess;
public static IGreenhouseAccess greenhouseAccess;
public static List<Class<? extends IGreenhouseLogic>> greenhouseLogics = new ArrayList();
}
@@ -10,12 +10,14 @@ import javax.annotation.Nonnull;
import forestry.api.core.EnumCamouflageType;
import net.minecraft.item.ItemStack;
public interface IGreenhouseItemAccess {
public interface IGreenhouseAccess {
void registerGreenhouseGlass(@Nonnull ItemStack glass);
void registerGreenhouseGlass(@Nonnull ItemStack glass, float lightTransmittance);
boolean isGreenhouseGlass(@Nonnull ItemStack glass);
float getGreenhouseGlassLightTransmittance(@Nonnull ItemStack glass);
void addToCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock);
boolean isOnCamouflageBlockBlackList(@Nonnull EnumCamouflageType type, @Nonnull ItemStack camouflageBlock);
@@ -0,0 +1,11 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.greenhouse;
public interface IGreenhouseClimaLogic extends IGreenhouseLogic {
}
@@ -0,0 +1,27 @@
/*******************************************************************************
* 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 forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import forestry.api.multiblock.IGreenhouseController;
public interface IGreenhouseLogic extends INbtWritable, INbtReadable {
void onWork();
void onChange(EnumGreenhouseChangeType type, Object event);
IGreenhouseController getController();
String getName();
}
@@ -5,8 +5,18 @@
******************************************************************************/
package forestry.api.multiblock;
import forestry.api.greenhouse.IGreenhouseHousing;
import java.util.List;
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing {
import forestry.api.core.ICamouflageHandler;
import forestry.api.core.IClimateControlled;
import forestry.api.greenhouse.EnumGreenhouseChangeType;
import forestry.api.greenhouse.IGreenhouseHousing;
import forestry.api.greenhouse.IGreenhouseLogic;
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlled {
void onChange(EnumGreenhouseChangeType type, Object event);
List<IGreenhouseLogic> getLogics();
}