mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0676030d6 | ||
|
|
0c76e22b8a | ||
|
|
1a8f1751d9 | ||
|
|
b95bb8315f |
No files matched your search
+3
-3
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.0.2005-1.10.0
|
||||
forgeversion=12.18.1.2044
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
tesla_version=1.9.4-1.1.0.24
|
||||
tesla_version=1.10.2-1.2.1.41
|
||||
jei_version=3.7.3.221
|
||||
ic2_version=2.6.5-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=2
|
||||
version_patch=3
|
||||
version_patch=5
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -38,7 +39,7 @@ public interface IModelBaker {
|
||||
|
||||
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex);
|
||||
|
||||
void addBakedModel(@Nonnull IBakedModel model);
|
||||
void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model);
|
||||
|
||||
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
|
||||
|
||||
|
||||
@@ -15,21 +15,13 @@ import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -48,6 +40,13 @@ import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
|
||||
|
||||
@@ -355,8 +354,11 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(this);
|
||||
if (beeModifier.isHellish() && tempChange >= 0) {
|
||||
return EnumTemperature.HELLISH;
|
||||
Biome biome = getBiome();
|
||||
if (beeModifier.isHellish() || BiomeHelper.isBiomeHellish(biome)) {
|
||||
if (tempChange >= 0) {
|
||||
return EnumTemperature.HELLISH;
|
||||
}
|
||||
}
|
||||
|
||||
return EnumTemperature.getFromValue(getExactTemperature());
|
||||
|
||||
@@ -23,6 +23,8 @@ public class Constants implements IForestryConstants {
|
||||
public static final String VERSION = "@VERSION@";
|
||||
public static final String BUILD_NUMBER = "@BUILD_NUMBER@";
|
||||
|
||||
public static final String TESLA_MOD_ID = "tesla";
|
||||
|
||||
public static final int FLAG_BLOCK_UPDATE = 1;
|
||||
public static final int FLAG_BLOCK_SYNC = 2;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.core.models.baker;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -48,7 +49,7 @@ public class ModelBaker implements IModelBaker {
|
||||
|
||||
private static final float quadsUV[] = new float[]{0, 0, 1, 1, 0, 0, 1, 1};
|
||||
private final List<ModelBakerFace> faces = new ArrayList<>();
|
||||
private final List<IBakedModel> bakedModels = new ArrayList<>();
|
||||
private final List<Pair<IBlockState, IBakedModel>> bakedModels = new ArrayList<>();
|
||||
|
||||
protected AxisAlignedBB renderBounds;
|
||||
|
||||
@@ -126,8 +127,10 @@ public class ModelBaker implements IModelBaker {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBakedModel(@Nonnull IBakedModel model) {
|
||||
this.bakedModels.add(model);
|
||||
public void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model) {
|
||||
if(model != null){
|
||||
this.bakedModels.add(Pair.of(state, model));
|
||||
}
|
||||
}
|
||||
|
||||
protected static float[] getFaceUvs(final EnumFacing face, final Vector3f to_16, final Vector3f from_16) {
|
||||
@@ -217,7 +220,7 @@ public class ModelBaker implements IModelBaker {
|
||||
}
|
||||
|
||||
//Add baked models to the current model.
|
||||
for(IBakedModel bakedModel : bakedModels){
|
||||
for(Pair<IBlockState, IBakedModel> bakedModel : bakedModels){
|
||||
currentModel.addModelQuads(bakedModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
|
||||
private final Map<EnumFacing, List<BakedQuad>> faceQuads;
|
||||
private final List<BakedQuad> generalQuads;
|
||||
private final List<IBakedModel> models;
|
||||
private final List<Pair<IBlockState, IBakedModel>> models;
|
||||
|
||||
private float[] rotation = getDefaultRotation();
|
||||
private float[] translation = getDefaultTranslation();
|
||||
@@ -68,7 +68,7 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
}
|
||||
}
|
||||
|
||||
private ModelBakerModel(List<IBakedModel> models, Map<EnumFacing, List<BakedQuad>> faceQuads, List<BakedQuad> generalQuads, boolean isGui3d, boolean isAmbientOcclusion, IModelState modelState, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) {
|
||||
private ModelBakerModel(List<Pair<IBlockState, IBakedModel>> models, Map<EnumFacing, List<BakedQuad>> faceQuads, List<BakedQuad> generalQuads, boolean isGui3d, boolean isAmbientOcclusion, IModelState modelState, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) {
|
||||
this.models = models;
|
||||
this.faceQuads = faceQuads;
|
||||
this.generalQuads = generalQuads;
|
||||
@@ -178,8 +178,10 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
return modelState;
|
||||
}
|
||||
|
||||
public void addModelQuads(IBakedModel model) {
|
||||
this.models.add(model);
|
||||
public void addModelQuads(Pair<IBlockState, IBakedModel> model) {
|
||||
if(model != null){
|
||||
this.models.add(model);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,8 +196,11 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
List<BakedQuad> quads = new ArrayList<>();
|
||||
for (IBakedModel model : this.models) {
|
||||
quads.addAll(model.getQuads(state, side, rand));
|
||||
for (Pair<IBlockState, IBakedModel> model : this.models) {
|
||||
List<BakedQuad> modelQuads = model.getRight().getQuads(model.getLeft(), side, rand);
|
||||
if(modelQuads != null && !modelQuads.isEmpty()){
|
||||
quads.addAll(modelQuads);
|
||||
}
|
||||
}
|
||||
if(side != null){
|
||||
quads.addAll(faceQuads.get(side));
|
||||
|
||||
@@ -64,15 +64,15 @@ public class CamouflageUtil {
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof ICamouflageHandler){
|
||||
return (ICamouflageHandler) tile;
|
||||
}
|
||||
if(tile instanceof IMultiblockComponent){
|
||||
IMultiblockComponent component = (IMultiblockComponent) tile;
|
||||
if(component.getMultiblockLogic().getController() instanceof ICamouflageHandler){
|
||||
return (ICamouflageHandler) component.getMultiblockLogic().getController();
|
||||
}
|
||||
}
|
||||
if(tile instanceof ICamouflageHandler){
|
||||
return (ICamouflageHandler) tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package forestry.energy;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
@@ -14,7 +15,6 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
@@ -23,9 +23,9 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = "Tesla"),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaProducer", modid = "Tesla"),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaHolder", modid = "Tesla")
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = Constants.TESLA_MOD_ID),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaProducer", modid = Constants.TESLA_MOD_ID),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaHolder", modid = Constants.TESLA_MOD_ID)
|
||||
})
|
||||
public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaProducer, ITeslaHolder, IEnergyProvider, IStreamable {
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
@@ -259,13 +259,13 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return null;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
public static int sendEnergyTesla(TileEntity tile, EnumFacing side, int amount, boolean simulate) {
|
||||
ITeslaConsumer consumer = tile.getCapability(TESLA_CONSUMER, side);
|
||||
return (int) consumer.givePower(amount, simulate);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long givePower(long power, boolean simulated) {
|
||||
if (!canReceive()) {
|
||||
@@ -274,7 +274,7 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return energyStorage.receiveEnergy(power, simulated);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long takePower(long power, boolean simulated) {
|
||||
if (!canExtract()) {
|
||||
@@ -283,13 +283,13 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return energyStorage.extractEnergy(power, simulated);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long getStoredPower() {
|
||||
return energyStorage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long getCapacity() {
|
||||
return energyStorage.getMaxEnergyStored();
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockModelShapes;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -51,8 +52,9 @@ public class ModelGreenhouse extends ModelBlockDefault<BlockGreenhouse> {
|
||||
private static void bakeBlockModel(@Nonnull BlockGreenhouse block, @Nullable IBlockAccess world, @Nullable BlockPos pos, @Nullable IExtendedBlockState stateExtended, @Nonnull IModelBaker baker, @Nullable ItemStack camouflageStack) {
|
||||
if (camouflageStack != null) {
|
||||
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
|
||||
IBlockState state = Block.getBlockFromItem(camouflageStack.getItem()).getStateFromMeta(camouflageStack.getItemDamage());
|
||||
|
||||
baker.addBakedModel(modelShapes.getModelForState(Block.getBlockFromItem(camouflageStack.getItem()).getStateFromMeta(camouflageStack.getItemDamage())));
|
||||
baker.addBakedModel(state, modelShapes.getModelForState(state));
|
||||
baker.setParticleSprite(modelShapes.getModelForState(Block.getBlockFromItem(camouflageStack.getItem()).getStateFromMeta(camouflageStack.getItemDamage())).getParticleTexture());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user