mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 12:32:23 +00:00
Make Climate state creation only accessible through ClimateStates
This commit is contained in:
1 parent
e07f10d981
commit
4d0dfd837e
36 files changed
+331
-114
No files matched your search
@@ -76,7 +76,7 @@ public class Forestry {
|
||||
ForestryAPI.instance = this;
|
||||
ForestryAPI.forestryConstants = new Constants();
|
||||
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
|
||||
ForestryAPI.states = new ClimateStates();
|
||||
ForestryAPI.states = ClimateStates.INSTANCE;
|
||||
EnumErrorCode.init();
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.function.Function;
|
||||
@@ -10,8 +15,11 @@ public enum ClimateStateType {
|
||||
CHANGE(-3.0F, 3.0F);
|
||||
|
||||
public final Function<Float, Float> bounds;
|
||||
public final Float boundDown, boundUp;
|
||||
|
||||
ClimateStateType(Float boundDown, Float boundUp) {
|
||||
this.bounds = v -> MathHelper.clamp(v, boundDown, boundUp);
|
||||
this.boundDown = boundDown;
|
||||
this.boundUp = boundUp;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -19,6 +19,6 @@ public interface ICamouflageItemHandler {
|
||||
boolean canHandle(ItemStack stack);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile);
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.climate;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.climate;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.climate;
|
||||
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
|
||||
@@ -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.core.climate;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.climate.IClimateState;
|
||||
|
||||
@Deprecated
|
||||
public class ClimateInfo implements IClimateInfo {
|
||||
private final float temperature;
|
||||
private final float humidity;
|
||||
|
||||
public ClimateInfo(float temperature, float humidity) {
|
||||
this.temperature = ClimateStateType.IMMUTABLE.bounds.apply(temperature);
|
||||
this.humidity = ClimateStateType.IMMUTABLE.bounds.apply(humidity);
|
||||
}
|
||||
|
||||
public ClimateInfo(IClimateState climateState) {
|
||||
this.temperature = climateState.toState(ClimateStateType.IMMUTABLE).getTemperature();
|
||||
this.humidity = climateState.toState(ClimateStateType.IMMUTABLE).getHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
@@ -28,8 +27,8 @@ import forestry.core.utils.World2ObjectMap;
|
||||
public class ClimateManager implements IClimateManager {
|
||||
|
||||
private static final ClimateManager INSTANCE = new ClimateManager();
|
||||
|
||||
private static final Map<Biome, ClimateState> BIOME_STATES = new HashMap<>();
|
||||
|
||||
private static final Map<Biome, IClimateState> BIOME_STATES = new HashMap<>();
|
||||
|
||||
private final World2ObjectMap<ClimateWorldManager> managers;
|
||||
|
||||
@@ -43,23 +42,23 @@ public class ClimateManager implements IClimateManager {
|
||||
|
||||
@Override
|
||||
public IClimateInfo createInfo(float temperature, float humidity) {
|
||||
return new ClimateState(temperature, humidity, ClimateStateType.IMMUTABLE);
|
||||
return new ClimateInfo(temperature, humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateInfo getInfo(World world, BlockPos pos) {
|
||||
return getBiomeState(world, pos);
|
||||
return new ClimateInfo(getBiomeState(world, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClimateState getBiomeState(World world, BlockPos pos) {
|
||||
public IClimateState getBiomeState(World world, BlockPos pos) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
return getBiomeState(biome);
|
||||
}
|
||||
|
||||
private ClimateState getBiomeState(Biome biome) {
|
||||
|
||||
private IClimateState getBiomeState(Biome biome) {
|
||||
if (!BIOME_STATES.containsKey(biome)) {
|
||||
BIOME_STATES.put(biome, new ClimateState(biome.getTemperature(), biome.getRainfall(), ClimateStateType.IMMUTABLE));
|
||||
BIOME_STATES.put(biome, ClimateStates.immutableOf(biome.getTemperature(), biome.getRainfall()));
|
||||
}
|
||||
return BIOME_STATES.get(biome);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.climate;
|
||||
|
||||
public enum ClimateSourceMode {
|
||||
|
||||
POSITIVE, NEGATIVE, NONE;
|
||||
POSITIVE, NEGATIVE, NONE
|
||||
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
* 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
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.climate;
|
||||
|
||||
@@ -15,7 +20,7 @@ import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.climate.IClimateState;
|
||||
|
||||
public class ClimateState implements IClimateState, IClimateInfo {
|
||||
class ClimateState implements IClimateState, IClimateInfo {
|
||||
|
||||
// The minimum climate state.
|
||||
public static final ClimateState MIN = new ClimateState(0.0F, 0.0F, ClimateStateType.IMMUTABLE);
|
||||
@@ -39,8 +44,8 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
public ClimateState(float temperature, float humidity, ClimateStateType type) {
|
||||
this.type = type;
|
||||
this.bounds = type.bounds;
|
||||
addTemperature(temperature);
|
||||
addHumidity(humidity);
|
||||
this.temperature = bounds.apply(temperature);
|
||||
this.humidity = bounds.apply(humidity);
|
||||
}
|
||||
|
||||
public ClimateState(NBTTagCompound compound, ClimateStateType type) {
|
||||
@@ -65,14 +70,14 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.temperature = compound.getFloat(TEMPERATURE_NBT_KEY);
|
||||
this.humidity = compound.getFloat(HUMIDITY_NBT_KEY);
|
||||
this.temperature = bounds.apply(compound.getFloat(TEMPERATURE_NBT_KEY));
|
||||
this.humidity = bounds.apply(compound.getFloat(HUMIDITY_NBT_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateState setHumidity(float humidity) {
|
||||
if(type == ClimateStateType.IMMUTABLE){
|
||||
return new ClimateState(getTemperature(), humidity, ClimateStateType.IMMUTABLE);
|
||||
return ClimateStates.immutableOf(getTemperature(), humidity);
|
||||
}
|
||||
this.humidity = bounds.apply(humidity);
|
||||
if(!isPresent()){
|
||||
@@ -84,7 +89,7 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
@Override
|
||||
public IClimateState setTemperature(float temperature) {
|
||||
if(type == ClimateStateType.IMMUTABLE){
|
||||
return new ClimateState(temperature, getHumidity(), ClimateStateType.IMMUTABLE);
|
||||
return ClimateStates.immutableOf(temperature, getHumidity());
|
||||
}
|
||||
this.temperature = bounds.apply(temperature);
|
||||
if(!isPresent()){
|
||||
@@ -100,7 +105,10 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
|
||||
@Override
|
||||
public IClimateState addTemperature(float temperature){
|
||||
this.temperature= bounds.apply(this.temperature + temperature);
|
||||
if (type == ClimateStateType.IMMUTABLE) {
|
||||
return ClimateStates.immutableOf(this.temperature + temperature, humidity);
|
||||
}
|
||||
this.temperature = bounds.apply(this.temperature + temperature);
|
||||
if(!isPresent()){
|
||||
return AbsentClimateState.INSTANCE;
|
||||
}
|
||||
@@ -109,6 +117,9 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
|
||||
@Override
|
||||
public IClimateState addHumidity(float humidity){
|
||||
if (type == ClimateStateType.IMMUTABLE) {
|
||||
return ClimateStates.immutableOf(temperature, this.humidity + humidity);
|
||||
}
|
||||
this.humidity= bounds.apply(this.humidity + humidity);
|
||||
if(!isPresent()){
|
||||
return AbsentClimateState.INSTANCE;
|
||||
@@ -118,6 +129,9 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
|
||||
@Override
|
||||
public IClimateState add(IClimateState state){
|
||||
if (type == ClimateStateType.IMMUTABLE) {
|
||||
return ClimateStates.immutableOf(this.temperature + state.getTemperature(), this.humidity + state.getHumidity());
|
||||
}
|
||||
addTemperature(state.getTemperature());
|
||||
addHumidity(state.getHumidity());
|
||||
if(!isPresent()){
|
||||
@@ -128,6 +142,9 @@ public class ClimateState implements IClimateState, IClimateInfo {
|
||||
|
||||
@Override
|
||||
public IClimateState remove(IClimateState state){
|
||||
if (type == ClimateStateType.IMMUTABLE) {
|
||||
return ClimateStates.immutableOf(this.temperature - state.getTemperature(), this.humidity - state.getHumidity());
|
||||
}
|
||||
addTemperature(-state.getTemperature());
|
||||
addHumidity(-state.getHumidity());
|
||||
if(!isPresent()){
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.climate;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -6,7 +16,44 @@ import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.climate.IClimateStates;
|
||||
|
||||
public class ClimateStates implements IClimateStates {
|
||||
public final class ClimateStates implements IClimateStates {
|
||||
|
||||
public static final ClimateStates INSTANCE = new ClimateStates();
|
||||
|
||||
private ClimateStates() {
|
||||
}
|
||||
|
||||
public static IClimateState of(float temperature, float humidity, ClimateStateType type) {
|
||||
IClimateState state = INSTANCE.create(temperature, humidity, type);
|
||||
if (!state.isPresent()) {
|
||||
return INSTANCE.absent();
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public static IClimateState of(float temperature, float humidity) {
|
||||
IClimateState state = INSTANCE.create(temperature, humidity, ClimateStateType.MUTABLE);
|
||||
if (!state.isPresent()) {
|
||||
return INSTANCE.absent();
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public static IClimateState immutableOf(float temperature, float humidity) {
|
||||
IClimateState state = INSTANCE.create(temperature, humidity, ClimateStateType.IMMUTABLE);
|
||||
if (!state.isPresent()) {
|
||||
return INSTANCE.absent();
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public static IClimateState changeOf(float temperature, float humidity) {
|
||||
IClimateState state = INSTANCE.create(temperature, humidity, ClimateStateType.CHANGE);
|
||||
if (!state.isPresent()) {
|
||||
return INSTANCE.absent();
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateState create(IClimateState climateState, ClimateStateType type) {
|
||||
|
||||
@@ -46,6 +46,7 @@ import forestry.factory.tiles.TileStill;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
import forestry.greenhouse.items.ItemCamouflageSprayCan;
|
||||
import forestry.greenhouse.tiles.TileClimatiser;
|
||||
import forestry.greenhouse.tiles.TileGreenhouse;
|
||||
import forestry.greenhouse.tiles.TileHygroregulator;
|
||||
import forestry.mail.items.ItemCatalogue;
|
||||
@@ -87,6 +88,7 @@ public class GuiIdRegistry {
|
||||
TileFarm.class,
|
||||
|
||||
TileGreenhouse.class,
|
||||
TileClimatiser.class,
|
||||
TileHygroregulator.class,
|
||||
|
||||
TileEngineBiogas.class,
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.core.climate.AbsentClimateState;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.greenhouse.api.greenhouse.Position2D;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -195,7 +195,7 @@ public class PacketBufferForestry extends PacketBuffer {
|
||||
public IClimateState readClimateState(){
|
||||
if(readBoolean()){
|
||||
ClimateStateType type = ClimateStateType.values()[readByte()];
|
||||
return new ClimateState(readFloat(), readFloat(), type);
|
||||
return ClimateStates.of(readFloat(), readFloat(), type);
|
||||
}else{
|
||||
return AbsentClimateState.INSTANCE;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ import forestry.greenhouse.multiblock.blocks.ChunkEvents;
|
||||
import forestry.greenhouse.multiblock.blocks.world.GreenhouseBlockManager;
|
||||
import forestry.greenhouse.network.PacketRegistryGreenhouse;
|
||||
import forestry.greenhouse.proxy.ProxyGreenhouse;
|
||||
import forestry.greenhouse.tiles.TileClimatiser;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseControl;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseGearbox;
|
||||
import forestry.greenhouse.tiles.TileGreenhousePlain;
|
||||
@@ -134,6 +135,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
GameRegistry.registerTileEntity(TileGreenhouseGearbox.class, "forestry.GreenhouseGearbox");
|
||||
GameRegistry.registerTileEntity(TileGreenhouseControl.class, "forestry.GreenhouseController");
|
||||
GameRegistry.registerTileEntity(TileGreenhouseWindow.class, "forestry.ClimateSourceWindow");
|
||||
GameRegistry.registerTileEntity(TileClimatiser.class, "forestry.Climatiser");
|
||||
|
||||
helper.registerWindowGlass("glass", new ItemStack(Blocks.GLASS), "blocks/glass");
|
||||
for (EnumDyeColor dye : EnumDyeColor.values()) {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -102,12 +102,13 @@ public class BlockClimatiser extends Block implements IBlockWithMeta, ISpriteReg
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
TileEntity tile = TileUtil.getTile(worldIn, pos, TileEntity.class);
|
||||
if (tile instanceof IActivatable) {
|
||||
state = state.withProperty(State.PROPERTY, ((IActivatable) tile).isActive() ? State.ON : State.OFF);
|
||||
public IBlockState getActualState(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
IActivatable tile = TileUtil.getTile(worldIn, pos, IActivatable.class);
|
||||
State state = State.OFF;
|
||||
if (tile != null) {
|
||||
state = tile.isActive() ? State.ON : State.OFF;
|
||||
}
|
||||
return super.getActualState(state, worldIn, pos);
|
||||
return super.getActualState(blockState, worldIn, pos).withProperty(State.PROPERTY, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,8 +169,7 @@ public class BlockClimatiser extends Block implements IBlockWithMeta, ISpriteReg
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos)
|
||||
.withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
|
||||
return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos).withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.blocks;
|
||||
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -27,9 +27,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
|
||||
public class CamouflageHandlerBlock implements ICamouflageItemHandler {
|
||||
@Override
|
||||
@@ -45,8 +43,7 @@ public class CamouflageHandlerBlock implements ICamouflageItemHandler {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile) {
|
||||
Preconditions.checkNotNull(camouflageHandler);
|
||||
public Pair<IBlockState, IBakedModel> getModel(ItemStack stack) {
|
||||
Preconditions.checkArgument(!stack.isEmpty(), "Stack cannot be empty");
|
||||
|
||||
BlockRendererDispatcher rendererDispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
|
||||
@@ -30,7 +30,7 @@ import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.core.climate.AbsentClimateState;
|
||||
import forestry.core.climate.ClimateData;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.network.packets.PacketUpdateClimate;
|
||||
@@ -65,8 +65,8 @@ public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
this.delay = 20;
|
||||
this.state = parent.getDefaultClimate().toState(ClimateStateType.MUTABLE);
|
||||
this.modifierData = new NBTTagCompound();
|
||||
this.boundaryUp = ClimateState.MIN;
|
||||
this.boundaryDown = ClimateState.MIN;
|
||||
this.boundaryUp = ClimateStates.INSTANCE.min();
|
||||
this.boundaryDown = ClimateStates.INSTANCE.min();
|
||||
this.targetedState = AbsentClimateState.INSTANCE;
|
||||
this.canWork = canWork;
|
||||
}
|
||||
@@ -120,8 +120,8 @@ public class ClimateContainer implements IClimateContainer, IStreamable {
|
||||
if(humidityBoundaryDown != 0){
|
||||
humidityBoundaryDown/=sizeModifier;
|
||||
}
|
||||
boundaryUp = parent.getDefaultClimate().add(new ClimateState(temperatureBoundaryUp, humidityBoundaryUp, ClimateStateType.MUTABLE));
|
||||
boundaryDown = parent.getDefaultClimate().remove(new ClimateState(temperatureBoundaryDown, humidityBoundaryDown, ClimateStateType.MUTABLE));
|
||||
boundaryUp = parent.getDefaultClimate().add(ClimateStates.of(temperatureBoundaryUp, humidityBoundaryUp));
|
||||
boundaryDown = parent.getDefaultClimate().remove(ClimateStates.of(temperatureBoundaryDown, humidityBoundaryDown));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.core.climate.ClimateSourceMode;
|
||||
import forestry.core.climate.ClimateSourceType;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.energy.EnergyManager;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
@@ -94,7 +93,7 @@ public class ClimateSourceClimatiser<O extends TileClimatiser> extends ClimateSo
|
||||
if (type.canChangeTemperature()) {
|
||||
temperature += getChange(ClimateType.TEMPERATURE);
|
||||
}
|
||||
return new ClimateState(temperature, humidity, ClimateStateType.CHANGE);
|
||||
return ClimateStates.changeOf(temperature, humidity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,13 +12,12 @@ package forestry.greenhouse.climate;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.core.climate.ClimateSourceMode;
|
||||
import forestry.core.climate.ClimateSourceType;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.fluids.FilteredTank;
|
||||
import forestry.core.recipes.HygroregulatorRecipe;
|
||||
@@ -88,7 +87,7 @@ public class ClimateSourceHygroregulator extends ClimateSourceCircuitable<TileHy
|
||||
if (type.canChangeTemperature()) {
|
||||
temperature += currentRecipe.tempChange * getChangeMultiplier(ClimateType.TEMPERATURE);
|
||||
}
|
||||
return new ClimateState(temperature, humidity, ClimateStateType.CHANGE);
|
||||
return ClimateStates.changeOf(temperature, humidity);
|
||||
}
|
||||
|
||||
private void createRecipe() {
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse.climate;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.climate.ClimateSource;
|
||||
import forestry.core.climate.ClimateSourceMode;
|
||||
import forestry.core.climate.ClimateSourceType;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseWindow;
|
||||
import forestry.greenhouse.tiles.TileGreenhouseWindow.WindowMode;
|
||||
|
||||
@@ -73,7 +72,7 @@ public class ClimateSourceWindow extends ClimateSource<TileGreenhouseWindow> {
|
||||
temperature += change;
|
||||
}
|
||||
}
|
||||
return new ClimateState(temperature, humidity, ClimateStateType.CHANGE);
|
||||
return ClimateStates.changeOf(temperature, humidity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.climate;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.greenhouse.IClimateHousing;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.greenhouse.api.climate.IClimateContainer;
|
||||
@@ -45,7 +45,7 @@ public class ClimateSourceModifier implements IClimateModifier {
|
||||
double sizeModifier = housing.getSize() / Config.climateSourceRange;
|
||||
sizeModifier = Math.max(sizeModifier, 1.0D);
|
||||
|
||||
IClimateState changeState = new ClimateState(data.getCompoundTag("change"), ClimateStateType.CHANGE);
|
||||
IClimateState changeState = ClimateStates.INSTANCE.create(data.getCompoundTag("change"), ClimateStateType.CHANGE);
|
||||
if (!container.canWork()) {
|
||||
IClimateState defaultState = container.getParent().getDefaultClimate();
|
||||
float defaultTemperature = defaultState.getTemperature();
|
||||
@@ -114,9 +114,9 @@ public class ClimateSourceModifier implements IClimateModifier {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addData(IClimateContainer container, IClimateState climateState, NBTTagCompound nbtData, IClimateData data) {
|
||||
IClimateState rangeDown = new ClimateState(nbtData.getCompoundTag("rangeDown"), ClimateStateType.MUTABLE);
|
||||
IClimateState rangeUp = new ClimateState(nbtData.getCompoundTag("rangeUp"), ClimateStateType.MUTABLE);
|
||||
IClimateState change = new ClimateState(nbtData.getCompoundTag("change"), ClimateStateType.MUTABLE);
|
||||
IClimateState rangeDown = ClimateStates.INSTANCE.create(nbtData.getCompoundTag("rangeDown"), ClimateStateType.MUTABLE);
|
||||
IClimateState rangeUp = ClimateStates.INSTANCE.create(nbtData.getCompoundTag("rangeUp"), ClimateStateType.MUTABLE);
|
||||
IClimateState change = ClimateStates.INSTANCE.create(nbtData.getCompoundTag("change"), ClimateStateType.MUTABLE);
|
||||
|
||||
data.addData(ClimateType.HUMIDITY, Translator.translateToLocal("for.gui.modifier.sources.range.up"), rangeUp.getHumidity())
|
||||
.addData(ClimateType.HUMIDITY, Translator.translateToLocal("for.gui.modifier.sources.range.down"), rangeDown.getHumidity())
|
||||
@@ -137,20 +137,16 @@ public class ClimateSourceModifier implements IClimateModifier {
|
||||
float humidity = climateState.getHumidity();
|
||||
float targetTemperature = targetedState.getTemperature();
|
||||
float targetHumidity = targetedState.getHumidity();
|
||||
float humidityBoundaryUp = boundaryUp.getHumidity();
|
||||
float humidityBoundaryDown = boundaryDown.getHumidity();
|
||||
float temperatureBoundaryUp = boundaryUp.getTemperature();
|
||||
float temperatureBoundaryDown = boundaryDown.getTemperature();
|
||||
if (targetTemperature > temperature) {
|
||||
temperature = Math.min(targetTemperature, temperatureBoundaryUp);
|
||||
temperature = Math.min(targetTemperature, boundaryUp.getTemperature());
|
||||
} else if (targetTemperature < temperature) {
|
||||
temperature = Math.max(targetTemperature, temperatureBoundaryDown);
|
||||
temperature = Math.max(targetTemperature, boundaryDown.getTemperature());
|
||||
}
|
||||
if (targetHumidity > humidity) {
|
||||
humidity = Math.min(targetHumidity, humidityBoundaryUp);
|
||||
humidity = Math.min(targetHumidity, boundaryUp.getHumidity());
|
||||
} else if (targetHumidity < humidity) {
|
||||
humidity = Math.max(targetHumidity, humidityBoundaryDown);
|
||||
humidity = Math.max(targetHumidity, boundaryDown.getHumidity());
|
||||
}
|
||||
return new ClimateState(temperature, humidity, ClimateStateType.IMMUTABLE);
|
||||
return ClimateStates.immutableOf(temperature, humidity);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.gui;
|
||||
|
||||
import forestry.core.gui.ledgers.Ledger;
|
||||
|
||||
@@ -15,10 +15,9 @@ import java.io.IOException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.ClimateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.TextLayoutHelper;
|
||||
@@ -73,7 +72,7 @@ public class GuiGreenhouse extends GuiForestryTitled<ContainerGreenhouse> {
|
||||
public void setClimate(IClimateContainer container, float temp, float hum) {
|
||||
temperaturePanel.setValue(temp);
|
||||
humidityPanel.setValue(hum);
|
||||
container.setTargetedState(new ClimateState(temp, hum, ClimateStateType.IMMUTABLE));
|
||||
container.setTargetedState(ClimateStates.immutableOf(temp, hum));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,10 +23,9 @@ import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.climate.ClimateStateType;
|
||||
import forestry.api.climate.IClimateState;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
@@ -105,7 +104,7 @@ public class WidgetClimateBar extends Widget {
|
||||
String spriteName;
|
||||
|
||||
EnumClimate(String spriteName, Biome biome) {
|
||||
climateState = new ClimateState(biome.getTemperature(), biome.getRainfall(), ClimateStateType.IMMUTABLE);
|
||||
climateState = ClimateStates.immutableOf(biome.getTemperature(), biome.getRainfall());
|
||||
this.spriteName = spriteName;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.models;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -32,14 +31,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseSprite;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
import forestry.greenhouse.blocks.IBlockCamouflaged;
|
||||
@@ -80,58 +76,40 @@ public class ModelCamouflaged<B extends Block & IBlockCamouflaged> extends Model
|
||||
IBlockAccess world = key.world;
|
||||
BlockPos pos = key.pos;
|
||||
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
|
||||
addCamouflageModel(block, baker, layer, world, pos);
|
||||
/*if (layer == BlockRenderLayer.CUTOUT || layer == null) {
|
||||
for (int overlayLayer = 0; overlayLayer < block.getLayers(); overlayLayer++) {
|
||||
addOverlaySprite(block, baker, world, pos, key.state, key.meta, overlayLayer);
|
||||
}
|
||||
}*/
|
||||
IBakedModel model;
|
||||
if (key.state != null) {
|
||||
model = overlayModel.getModel(key.state);
|
||||
} else {
|
||||
model = overlayModel.getModel(key.itemStack, Minecraft.getMinecraft().world);
|
||||
if (layer != BlockRenderLayer.CUTOUT) {
|
||||
addCamouflageModel(block, baker, layer, world, pos);
|
||||
}
|
||||
if (layer == BlockRenderLayer.CUTOUT || layer == null) {
|
||||
IBakedModel model;
|
||||
if (key.state != null) {
|
||||
model = overlayModel.getModel(key.state);
|
||||
} else {
|
||||
model = overlayModel.getModel(key.itemStack, Minecraft.getMinecraft().world);
|
||||
}
|
||||
baker.addBakedModelPost(key.state, model);
|
||||
}
|
||||
baker.addBakedModelPost(key.state, model);
|
||||
}
|
||||
|
||||
/*private void addOverlaySprite(B block, IModelBaker baker, IBlockAccess world, BlockPos pos, IBlockState state, int meta, int layer) {
|
||||
if (block.hasOverlaySprite(world, pos, meta, layer)) {
|
||||
TextureAtlasSprite[] sprite = new TextureAtlasSprite[6];
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
sprite[facing.ordinal()] = block.getOverlaySprite(facing, state, meta, layer);
|
||||
}
|
||||
baker.addBlockModel(pos, sprite, OVERLAY_COLOR_INDEX + layer);
|
||||
}
|
||||
}*/
|
||||
|
||||
private void addCamouflageModel(B block, IModelBaker baker, BlockRenderLayer layer, IBlockAccess world, BlockPos pos) {
|
||||
if (world == null || pos == null) {
|
||||
TextureAtlasSprite defaultSprite = block.getDefaultSprite();
|
||||
|
||||
baker.addBlockModel(pos, defaultSprite, DEFAULT_COLOR_INDEX);
|
||||
baker.setParticleSprite(defaultSprite);
|
||||
ItemStack camouflageStack = GreenhouseController.createDefaultCamouflageBlock();
|
||||
} else {
|
||||
ItemStack camouflageStack = block.getCamouflageBlock(world, pos);
|
||||
Block camouflageBlock = Block.getBlockFromItem(camouflageStack.getItem());
|
||||
if (camouflageStack.isEmpty() || camouflageBlock == Blocks.AIR) {
|
||||
if (camouflageStack.isEmpty()) {
|
||||
camouflageStack = GreenhouseController.createDefaultCamouflageBlock();
|
||||
}
|
||||
Block camouflageBlock = Block.getBlockFromItem(camouflageStack.getItem());
|
||||
ICamouflageItemHandler itemHandler = CamouflageManager.camouflageAccess.getHandler(camouflageStack);
|
||||
if (itemHandler != null) {
|
||||
ICamouflageHandler camouflageHandler = block.getCamouflageHandler(world, pos);
|
||||
if (camouflageHandler != null) {
|
||||
ICamouflagedTile camouflageTile = TileUtil.getTile(world, pos, ICamouflagedTile.class);
|
||||
if (camouflageTile != null) {
|
||||
Pair<IBlockState, IBakedModel> modelPair = itemHandler.getModel(camouflageStack, camouflageHandler, camouflageTile);
|
||||
IBlockState blockState = modelPair.getLeft();
|
||||
if (camouflageBlock.canRenderInLayer(blockState, layer)) {
|
||||
IBakedModel bakedModel = modelPair.getRight();
|
||||
baker.addBakedModel(blockState, bakedModel);
|
||||
baker.setParticleSprite(bakedModel.getParticleTexture());
|
||||
}
|
||||
}
|
||||
Pair<IBlockState, IBakedModel> modelPair = itemHandler.getModel(camouflageStack);
|
||||
IBlockState blockState = modelPair.getLeft();
|
||||
if (camouflageBlock.canRenderInLayer(blockState, layer)) {
|
||||
IBakedModel bakedModel = modelPair.getRight();
|
||||
baker.addBakedModel(blockState, bakedModel);
|
||||
baker.setParticleSprite(bakedModel.getParticleTexture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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.models;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
@@ -38,7 +38,7 @@ import forestry.api.multiblock.IGreenhouseComponent.Active;
|
||||
import forestry.api.multiblock.IGreenhouseComponent.Listener;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.climate.ClimateState;
|
||||
import forestry.core.climate.ClimateStates;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.multiblock.IMultiblockControllerInternal;
|
||||
import forestry.core.multiblock.MultiblockValidationException;
|
||||
@@ -87,7 +87,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
private ItemStack camouflage;
|
||||
//Climate
|
||||
private ClimateContainer climateContainer;
|
||||
private IClimateState defaultState = ClimateState.MIN;
|
||||
private IClimateState defaultState = ClimateStates.INSTANCE.min();
|
||||
private BlockPos centerPos;
|
||||
private int assembleTickCount;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -460,7 +460,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
biomes++;
|
||||
}
|
||||
}
|
||||
defaultState = new ClimateState((float) (temperature / biomes), (float) (humidity / biomes), ClimateStateType.IMMUTABLE);
|
||||
defaultState = ClimateStates.immutableOf((float) (temperature / biomes), (float) (humidity / biomes));
|
||||
}
|
||||
|
||||
/* RectangularMultiblockControllerBase */
|
||||
|
||||
Reference in new issue
Block a user