mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41ab1ea374 | ||
|
|
52b8d56ff0 | ||
|
|
a61879daff | ||
|
|
e71edd5855 | ||
|
|
321e316665 | ||
|
|
aca6ed1fd8 | ||
|
|
b135593733 | ||
|
|
ac7fe4b2d2 | ||
|
|
5e0e045053 | ||
|
|
f01dab6f58 | ||
|
|
9385a4caca | ||
|
|
582c8d64df | ||
|
|
26c40b2006 | ||
|
|
b7eaaf6804 | ||
|
|
3f07e68952 | ||
|
|
2b40762934 | ||
|
|
dcaf6e144f | ||
|
|
413e1b9a0d | ||
|
|
64f64f2b5c | ||
|
|
2d25754731 | ||
|
|
2df6cfb7f7 | ||
|
|
2d0ca49359 | ||
|
|
d567138365 | ||
|
|
72380251f3 | ||
|
|
05a263826e | ||
|
|
61aa8bdcf0 | ||
|
|
e0694842b6 | ||
|
|
ff9942d0bc | ||
|
|
dcf7776cc1 | ||
|
|
a0d355d0aa | ||
|
|
649a061b6e | ||
|
|
2ca743a931 | ||
|
|
76a34a603b | ||
|
|
68651939e7 | ||
|
|
9dcc818a17 | ||
|
|
5e3c23e4eb | ||
|
|
d8ffc5c4b8 | ||
|
|
737f64eeab | ||
|
|
0db27d83b0 | ||
|
|
f57de19b06 | ||
|
|
1fed58fae5 | ||
|
|
1d8d61daf1 | ||
|
|
65bd93749c | ||
|
|
ac48b4b5c6 | ||
|
|
3be3ecfc8a | ||
|
|
10aae6b6bc | ||
|
|
d84560926c | ||
|
|
ab3de49198 | ||
|
|
b2b743398c | ||
|
|
52f233e84a | ||
|
|
2f2ec91670 | ||
|
|
2e2fa8e6df | ||
|
|
3de6e0c5b7 | ||
|
|
0f4ba8d8fa | ||
|
|
9570d26c83 | ||
|
|
01dc4f2bfe | ||
|
|
80de4d6490 | ||
|
|
253e9f18ed | ||
|
|
bbda5c8ba9 | ||
|
|
c289590740 | ||
|
|
714858be99 | ||
|
|
5bb60cad8a | ||
|
|
b8cf4ef1cf | ||
|
|
d35075d681 | ||
|
|
79c56311c2 | ||
|
|
77cea8a645 | ||
|
|
ed00ca3158 | ||
|
|
418f00abf2 | ||
|
|
0fa8fdad39 | ||
|
|
0a110eb761 | ||
|
|
9feb5cb114 | ||
|
|
7aa44fb1fa | ||
|
|
84fa956ce4 | ||
|
|
0c14a85c31 | ||
|
|
a20fbbe60f | ||
|
|
27d932ee34 | ||
|
|
52b1784f25 | ||
|
|
154f4f2712 |
No files matched your search
+1
-7
@@ -108,13 +108,7 @@ allprojects {
|
||||
}
|
||||
|
||||
jar {
|
||||
// Copy redstone api into the jar, should shade this as a maven dep...
|
||||
from (sourceSets.api.allSource) {
|
||||
include 'cofh/**/*.txt'
|
||||
}
|
||||
from (sourceSets.api.output.classesDir) {
|
||||
include 'cofh/**/*.*'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.1.2060
|
||||
forgeversion=12.18.1.2094
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
tesla_version=1.10.2-1.2.1.42
|
||||
jei_version=3.8.1.242
|
||||
ic2_version=2.6.38-ex110
|
||||
tesla_version=1.10.2-1.2.1.49
|
||||
jei_version=3.12.2.290
|
||||
ic2_version=2.6.76-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=2
|
||||
version_patch=9
|
||||
version_patch=15
|
||||
+1
-1
Submodule lang updated: 4c93562cb9...6a30635d3f.
@@ -12,20 +12,6 @@ package forestry;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.climate.ClimateEventHandler;
|
||||
@@ -40,6 +26,19 @@ import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -52,8 +51,8 @@ import forestry.plugins.PluginManager;
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.10]",
|
||||
dependencies = "required-after:Forge@[12.18.0.1989,);"
|
||||
+ "after:JEI@[3.8.0,);"
|
||||
dependencies = "required-after:Forge@[12.18.1.2080,);"
|
||||
+ "after:JEI@[3.11.2.278,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
public class ApicultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorApiarist}.
|
||||
* The {@link Capability#getDefaultInstance()} will always protect the wearer with no side effects.
|
||||
*/
|
||||
@CapabilityInject(IArmorApiarist.class)
|
||||
public static Capability<IArmorApiarist> ARMOR_APIARIST;
|
||||
}
|
||||
@@ -5,21 +5,24 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* When implemented by armor piece items, allows them to act as apiarist's armor.
|
||||
* When implemented as a capability by armor items, protects the wearer from negative bee effects.
|
||||
* @see ApicultureCapabilities#ARMOR_APIARIST
|
||||
*/
|
||||
public interface IArmorApiarist {
|
||||
/**
|
||||
* Called when the apiarist's armor acts as protection against an attack.
|
||||
*
|
||||
* @param entity Entity being attacked
|
||||
* @param armor Armor item
|
||||
* @param cause Optional cause of attack, such as a bee effect identifier
|
||||
* @param entity Entity being attacked
|
||||
* @param armor Armor item
|
||||
* @param cause Optional cause of attack, such as a bee effect identifier
|
||||
* @param doProtect Whether or not to actually do the side effects of protection
|
||||
* @return Whether or not the armor should protect the player from that attack
|
||||
*/
|
||||
boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect);
|
||||
boolean protectEntity(EntityLivingBase entity, ItemStack armor, @Nullable String cause, boolean doProtect);
|
||||
}
|
||||
@@ -5,33 +5,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.core.ILocatable;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider {
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider, ILocatable {
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
|
||||
* Used by {@link IBeeRoot#createBeeHousingModifier(IBeeHousing)}
|
||||
* to combine bee modifiers from several sources that can change over time.
|
||||
* @return IBeeModifiers from the housing, frames, etc.
|
||||
*/
|
||||
Iterable<IBeeModifier> getBeeModifiers();
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingListener(IBeeHousing housing)
|
||||
* Used by {@link IBeeRoot#createBeeHousingListener(IBeeHousing)}
|
||||
* to combine bee listeners from several sources that can change over time.
|
||||
* @return IBeeListeners from the housing, multiblock parts, etc.
|
||||
*/
|
||||
Iterable<IBeeListener> getBeeListeners();
|
||||
|
||||
@Nonnull
|
||||
IBeeHousingInventory getBeeInventory();
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
@@ -40,14 +36,11 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvid
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.2
|
||||
* @return exact coordinates where bee FX should spawn from
|
||||
* @return exact coordinates where bee particle FX should spawn from
|
||||
*/
|
||||
Vec3d getBeeFXCoordinates();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
public class ArboricultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorNaturalist}.
|
||||
* The {@link Capability#getDefaultInstance()} will always show pollination with no side effects.
|
||||
*/
|
||||
@CapabilityInject(IArmorNaturalist.class)
|
||||
public static Capability<IArmorNaturalist> ARMOR_NATURALIST;
|
||||
}
|
||||
@@ -10,53 +10,51 @@ import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
public enum EnumForestryWoodType implements IWoodType {
|
||||
LARCH(4, 20),
|
||||
TEAK(4, 20),
|
||||
ACACIA(4, 20),
|
||||
LIME(4, 19),
|
||||
CHESTNUT(4, 21),
|
||||
WENGE(4, 20),
|
||||
BAOBAB(4, 20),
|
||||
SEQUOIA(3, 18, 4.0f),
|
||||
LARCH(4),
|
||||
TEAK(4),
|
||||
ACACIA(4),
|
||||
LIME(4),
|
||||
CHESTNUT(4),
|
||||
WENGE(4),
|
||||
BAOBAB(4),
|
||||
SEQUOIA(3, 4.0f),
|
||||
|
||||
KAPOK(4, 20),
|
||||
EBONY(4, 20),
|
||||
MAHOGANY(4, 20),
|
||||
BALSA(4, 20, 1.0f),
|
||||
WILLOW(4, 20),
|
||||
WALNUT(4, 21),
|
||||
GREENHEART(4, 20, 7.5f),
|
||||
CHERRY(4, 20),
|
||||
KAPOK(4),
|
||||
EBONY(4),
|
||||
MAHOGANY(4),
|
||||
BALSA(4, 1.0f),
|
||||
WILLOW(4),
|
||||
WALNUT(4),
|
||||
GREENHEART(4, 7.5f),
|
||||
CHERRY(4),
|
||||
|
||||
MAHOE(4, 20),
|
||||
POPLAR(4, 20),
|
||||
PALM(4, 20),
|
||||
PAPAYA(4, 20),
|
||||
PINE(4, 20, 3.0f),
|
||||
PLUM(4, 20),
|
||||
MAPLE(4, 20),
|
||||
CITRUS(4, 20),
|
||||
MAHOE(4),
|
||||
POPLAR(4),
|
||||
PALM(4),
|
||||
PAPAYA(4),
|
||||
PINE(4, 3.0f),
|
||||
PLUM(4),
|
||||
MAPLE(4),
|
||||
CITRUS(4),
|
||||
|
||||
GIGANTEUM(3, 18, 4.0f),
|
||||
IPE(4, 20),
|
||||
PADAUK(4, 20),
|
||||
COCOBOLO(4, 20),
|
||||
ZEBRAWOOD(4, 20);
|
||||
GIGANTEUM(3, 4.0f),
|
||||
IPE(4),
|
||||
PADAUK(4),
|
||||
COCOBOLO(4),
|
||||
ZEBRAWOOD(4);
|
||||
|
||||
public static final float DEFAULT_HARDNESS = 2.0f;
|
||||
public static final EnumForestryWoodType[] VALUES = values();
|
||||
|
||||
private final int carbonization;
|
||||
private final int combustability;
|
||||
private final float hardness;
|
||||
|
||||
EnumForestryWoodType(int carbonization, int combustability) {
|
||||
this(carbonization, combustability, DEFAULT_HARDNESS);
|
||||
EnumForestryWoodType(int carbonization) {
|
||||
this(carbonization, DEFAULT_HARDNESS);
|
||||
}
|
||||
|
||||
EnumForestryWoodType(int carbonization, int combustability, float hardness) {
|
||||
EnumForestryWoodType(int carbonization, float hardness) {
|
||||
this.carbonization = carbonization;
|
||||
this.combustability = combustability;
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
@@ -96,10 +94,17 @@ public enum EnumForestryWoodType implements IWoodType {
|
||||
public int getCarbonization() {
|
||||
return carbonization;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCombustability() {
|
||||
return combustability;
|
||||
public float getCharcoalChance(int numberOfCharcoal) {
|
||||
if(numberOfCharcoal == 3){
|
||||
return 0.75F;
|
||||
}else if(numberOfCharcoal == 4){
|
||||
return 0.5F;
|
||||
}else if(numberOfCharcoal == 5){
|
||||
return 0.25F;
|
||||
}
|
||||
return 0.15F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,12 +7,12 @@ import java.util.Random;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
|
||||
public enum EnumVanillaWoodType implements IWoodType {
|
||||
OAK(BlockPlanks.EnumType.OAK, 5, 20),
|
||||
SPRUCE(BlockPlanks.EnumType.SPRUCE, 4, 19),
|
||||
BIRCH(BlockPlanks.EnumType.BIRCH, 4, 19),
|
||||
JUNGLE(BlockPlanks.EnumType.JUNGLE, 5, 20),
|
||||
ACACIA(BlockPlanks.EnumType.ACACIA, 4, 20),
|
||||
DARK_OAK(BlockPlanks.EnumType.DARK_OAK, 5, 20);
|
||||
OAK(BlockPlanks.EnumType.OAK, 5),
|
||||
SPRUCE(BlockPlanks.EnumType.SPRUCE, 4),
|
||||
BIRCH(BlockPlanks.EnumType.BIRCH, 4),
|
||||
JUNGLE(BlockPlanks.EnumType.JUNGLE, 5),
|
||||
ACACIA(BlockPlanks.EnumType.ACACIA, 4),
|
||||
DARK_OAK(BlockPlanks.EnumType.DARK_OAK, 5);
|
||||
|
||||
public static final EnumVanillaWoodType[] VALUES = values();
|
||||
|
||||
@@ -22,12 +22,10 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
|
||||
private final BlockPlanks.EnumType vanillaType;
|
||||
private final int carbonization;
|
||||
private final int combustability;
|
||||
|
||||
EnumVanillaWoodType(BlockPlanks.EnumType vanillaType, int carbonization, int combustability) {
|
||||
EnumVanillaWoodType(BlockPlanks.EnumType vanillaType, int carbonization) {
|
||||
this.vanillaType = vanillaType;
|
||||
this.carbonization = carbonization;
|
||||
this.combustability = combustability;
|
||||
}
|
||||
|
||||
public BlockPlanks.EnumType getVanillaType() {
|
||||
@@ -66,10 +64,17 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
public int getCarbonization() {
|
||||
return carbonization;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCombustability() {
|
||||
return combustability;
|
||||
public float getCharcoalChance(int numberOfCharcoal) {
|
||||
if(numberOfCharcoal == 3){
|
||||
return 0.75F;
|
||||
}else if(numberOfCharcoal == 4){
|
||||
return 0.5F;
|
||||
}else if(numberOfCharcoal == 5){
|
||||
return 0.25F;
|
||||
}
|
||||
return 0.15F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,13 +31,13 @@ public interface IWoodProvider {
|
||||
*/
|
||||
ItemStack getWoodStack();
|
||||
|
||||
/**
|
||||
* @return how long this wood's charcoal burns / 1000
|
||||
*/
|
||||
int getCombustibility();
|
||||
|
||||
/**
|
||||
* The amount of charcoal dropped from a charcoal pile of this wood.
|
||||
*/
|
||||
int getCarbonization();
|
||||
|
||||
/**
|
||||
* The chance that a pile has to drop a extra charcoal
|
||||
*/
|
||||
float getCharcoalChance(int numberOfCharcoal);
|
||||
}
|
||||
@@ -12,8 +12,8 @@ public interface IWoodType extends IStringSerializable {
|
||||
float getHardness();
|
||||
|
||||
int getCarbonization();
|
||||
|
||||
int getCombustability();
|
||||
|
||||
float getCharcoalChance(int numberOfCharcoal);
|
||||
|
||||
String getPlankTexture();
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserModes {
|
||||
|
||||
POSITIVE, NEGATIVE, NONE
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package forestry.api.climate;
|
||||
|
||||
public enum EnumClimatiserTypes {
|
||||
|
||||
TEMPERATURE, HUMIDITY, NONE
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimateControl {
|
||||
|
||||
float getControlTemperature();
|
||||
|
||||
float getControlHumidity();
|
||||
|
||||
void setControlTemperature(float temperature);
|
||||
|
||||
void setControlHumidity(float humidity);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
|
||||
public interface IClimateControlProvider extends ILocatable {
|
||||
|
||||
IClimateControl getClimateControl();
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core.climate;
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimateControlled {
|
||||
/**
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core.climate;
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -21,15 +20,19 @@ public interface IClimateManager {
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
@Nonnull
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
void addRegion(IClimateRegion region);
|
||||
|
||||
void removeRegion(IClimateRegion region);
|
||||
|
||||
void addSource(IClimateSource source);
|
||||
void addSource(IClimateSourceProvider source);
|
||||
|
||||
void removeSource(IClimateSource source);
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegionForPos(World world, BlockPos pos);
|
||||
@@ -37,7 +40,4 @@ public interface IClimateManager {
|
||||
@Nonnull
|
||||
Map<Integer, List<IClimateRegion>> getRegions();
|
||||
|
||||
@Nonnull
|
||||
Map<Integer, Map<BlockPos, IClimateSource>> getSources();
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core.climate;
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
}
|
||||
+16
-6
@@ -3,9 +3,9 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core.climate;
|
||||
package forestry.api.climate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -21,15 +21,25 @@ public interface IClimateRegion extends INbtReadable, INbtWritable {
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
* Update the climate in a region, all 20 world ticks.
|
||||
* Update the climate in a region.
|
||||
*/
|
||||
void updateClimate();
|
||||
void updateClimate(int ticks);
|
||||
|
||||
int getTicksPerUpdate();
|
||||
|
||||
@Nonnull
|
||||
Map<BlockPos, IClimatePosition> getPositions();
|
||||
|
||||
int getTicksPerUpdate();
|
||||
void addSource(IClimateSource source);
|
||||
|
||||
List<BlockPos> getOtherPositions();
|
||||
void removeSource(IClimateSource source);
|
||||
|
||||
Collection<IClimateSource> getSources();
|
||||
|
||||
Collection<BlockPos> getOtherPositions();
|
||||
|
||||
float getTemperature();
|
||||
|
||||
float getHumidity();
|
||||
|
||||
}
|
||||
+4
-9
@@ -3,29 +3,24 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core.climate;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
package forestry.api.climate;
|
||||
|
||||
/**
|
||||
* A climate source is used to change the climate in a region.
|
||||
*/
|
||||
public interface IClimateSource {
|
||||
|
||||
|
||||
/**
|
||||
* @param tickCount The current tick count.
|
||||
* @param region The climate region, in that the source stands.
|
||||
*/
|
||||
void changeClimate(int tickCount, IClimateRegion region);
|
||||
|
||||
|
||||
/**
|
||||
* @return The ticks that are required for one change.
|
||||
*/
|
||||
int getTicksForChange(IClimateRegion region);
|
||||
|
||||
World getWorld();
|
||||
|
||||
BlockPos getPos();
|
||||
IClimateSourceProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import forestry.api.core.ILocatable;
|
||||
|
||||
public interface IClimateSourceProvider extends ILocatable {
|
||||
|
||||
IClimateSource getClimateSource();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
public interface IClimatiserDefinition {
|
||||
|
||||
float getChange();
|
||||
|
||||
double getRange();
|
||||
|
||||
EnumClimatiserModes getMode();
|
||||
|
||||
EnumClimatiserTypes getType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
package forestry.api.climate;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -60,15 +60,15 @@ public enum EnumTemperature {
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumTemperature getFromBiome(Biome Biome) {
|
||||
if (BiomeHelper.isBiomeHellish(Biome)) {
|
||||
public static EnumTemperature getFromBiome(Biome biome) {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
return getFromValue(Biome.getTemperature());
|
||||
return getFromValue(biome.getTemperature());
|
||||
}
|
||||
|
||||
public static EnumTemperature getFromBiome(Biome Biome, World world, BlockPos pos) {
|
||||
if (BiomeHelper.isBiomeHellish(Biome)) {
|
||||
public static EnumTemperature getFromBiome(Biome biome, World world, BlockPos pos) {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
float temperature = ForestryAPI.climateManager.getTemperature(world, pos);
|
||||
|
||||
@@ -7,7 +7,7 @@ package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.climate.IClimateManager;
|
||||
import forestry.api.climate.IClimateManager;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@@ -5,20 +5,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import forestry.api.arboriculture.ArboricultureCapabilities;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Naturalist armor allows players to see pollinated tree leaves.
|
||||
*
|
||||
* @see ArboricultureCapabilities#ARMOR_NATURALIST
|
||||
*/
|
||||
public interface IArmorNaturalist {
|
||||
|
||||
/**
|
||||
* Called when the naturalist's armor acts as spectacles for seeing pollinated tree leaves/flowers.
|
||||
* Called to see if this naturalist's armor allows for seeing pollinated tree leaves/flowers.
|
||||
*
|
||||
* @param player
|
||||
* Player doing the viewing
|
||||
* @param armor
|
||||
* Armor item
|
||||
* @param doSee
|
||||
* Whether or not to actually do the side effects of viewing
|
||||
* @param player Player doing the viewing
|
||||
* @param armor Armor item
|
||||
* @param doSee Whether or not to actually do the side effects of viewing
|
||||
* @return true if the armor actually allows the player to see pollination.
|
||||
*/
|
||||
boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee);
|
||||
|
||||
@@ -28,6 +28,10 @@ public interface ICamouflageAccess {
|
||||
|
||||
void addItemToBlackList(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
|
||||
|
||||
void addModIdToBlackList(@Nonnull String type, @Nonnull String modID);
|
||||
|
||||
boolean isItemBlackListed(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
|
||||
|
||||
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -6,21 +6,19 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICamouflageHandler{
|
||||
public interface ICamouflageHandler extends ILocatable {
|
||||
|
||||
/**
|
||||
* @return The item of the block that is the camouflage of this handler for the type.
|
||||
*/
|
||||
ItemStack getCamouflageBlock(String type);
|
||||
|
||||
|
||||
/**
|
||||
* @return The default camouflage block item for the type.
|
||||
*/
|
||||
ItemStack getDefaultCamouflageBlock(String type);
|
||||
|
||||
|
||||
/**
|
||||
* @return True if the handler can handle this type of camouflage.
|
||||
*/
|
||||
@@ -28,13 +26,7 @@ public interface ICamouflageHandler{
|
||||
|
||||
/**
|
||||
* Set the camouflage block item for the type.
|
||||
* @return True if the block has chanced.
|
||||
*/
|
||||
void setCamouflageBlock(String type, ItemStack camouflageBlock);
|
||||
|
||||
/**
|
||||
* @return The coordinates of the handler as a BlockPos.
|
||||
*/
|
||||
BlockPos getCoordinates();
|
||||
|
||||
World getWorld();
|
||||
boolean setCamouflageBlock(String type, ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ICamouflageItemHandler {
|
||||
|
||||
boolean canHandle(ItemStack stack, ICamouflageHandler camouflageHandler);
|
||||
boolean canHandle(ItemStack stack);
|
||||
|
||||
String getType();
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
}
|
||||
+21
-21
@@ -1,21 +1,21 @@
|
||||
/*******************************************************************************
|
||||
* 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.tiles;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ILocatable {
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
}
|
||||
/*******************************************************************************
|
||||
* 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 net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ILocatable {
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his species alleles of a individual.
|
||||
*/
|
||||
public class AlleleSpeciesRegisterEvent extends Event {
|
||||
|
||||
private final ISpeciesRoot root;
|
||||
|
||||
public AlleleSpeciesRegisterEvent(ISpeciesRoot root) {
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
public ISpeciesRoot getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,23 +3,22 @@ package forestry.api.genetics;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
|
||||
public interface IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack);
|
||||
void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack);
|
||||
void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack);
|
||||
void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack);
|
||||
|
||||
Map<String, ItemStack> getIconStacks();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
|
||||
@API(apiVersion = "5.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ package forestry.api.multiblock;
|
||||
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
import forestry.api.climate.IClimateControlled;
|
||||
|
||||
/**
|
||||
* Needs to be implemented by TileEntities that want to be part of an alveary.
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import forestry.api.core.climate.IClimateSource;
|
||||
import forestry.api.climate.IClimateControl;
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateSourceProvider;
|
||||
import forestry.api.climate.IClimatiserDefinition;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,10 +21,17 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
|
||||
IGreenhouseListener getGreenhouseListener();
|
||||
}
|
||||
|
||||
interface ClimateControl extends IGreenhouseComponent, IClimateControlProvider {
|
||||
|
||||
@Override
|
||||
IClimateControl getClimateControl();
|
||||
}
|
||||
|
||||
interface Door extends IGreenhouseComponent {
|
||||
}
|
||||
|
||||
interface Climatiser extends IGreenhouseComponent, IClimateSource {
|
||||
interface Climatiser extends IGreenhouseComponent, IClimateSourceProvider {
|
||||
IClimatiserDefinition getDefinition();
|
||||
}
|
||||
|
||||
interface ButterflyHatch extends IGreenhouseComponent {
|
||||
|
||||
@@ -7,15 +7,18 @@ package forestry.api.multiblock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.climate.IClimateControl;
|
||||
import forestry.api.climate.IClimateControlProvider;
|
||||
import forestry.api.climate.IClimateRegion;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.climate.IClimateRegion;
|
||||
import forestry.api.greenhouse.EnumGreenhouseEventType;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IGreenhouseLogic;
|
||||
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler {
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
|
||||
|
||||
/**
|
||||
* Handle change events.
|
||||
@@ -29,5 +32,9 @@ public interface IGreenhouseController extends IMultiblockController, IGreenhous
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegion();
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IClimateControl getClimateControl();
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@ package forestry.api.recipes;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface ICarpenterRecipe extends IForestryRecipe {
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
/**
|
||||
@@ -30,4 +33,7 @@ public interface IDescriptiveRecipe extends IRecipe {
|
||||
*/
|
||||
Object[] getIngredients();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ItemStack getRecipeOutput();
|
||||
}
|
||||
@@ -10,13 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IArmorApiaristHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IArmorApiaristHelper;
|
||||
|
||||
public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
|
||||
@Override
|
||||
@@ -25,12 +25,16 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = stack.getItem();
|
||||
if (!(item instanceof IArmorApiarist)) {
|
||||
final Item item = stack.getItem();
|
||||
final IArmorApiarist armorApiarist;
|
||||
if (item instanceof IArmorApiarist) { // legacy
|
||||
armorApiarist = (IArmorApiarist) item;
|
||||
} else if (stack.hasCapability(ApicultureCapabilities.ARMOR_APIARIST, null)) {
|
||||
armorApiarist = stack.getCapability(ApicultureCapabilities.ARMOR_APIARIST, null);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
IArmorApiarist armorApiarist = (IArmorApiarist) item;
|
||||
return armorApiarist.protectEntity(entity, stack, cause, doProtect);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHiveRegistry.HiveType;
|
||||
@@ -36,6 +37,7 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.capabilities.ArmorApiarist;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
@@ -72,6 +74,7 @@ import forestry.apiculture.worldgen.HiveRegistry;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.PluginFluids;
|
||||
import forestry.core.capabilities.NullStorage;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
@@ -106,6 +109,7 @@ import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
@@ -161,6 +165,9 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hard);
|
||||
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hardcore);
|
||||
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.insane);
|
||||
|
||||
// Capabilities
|
||||
CapabilityManager.INSTANCE.register(IArmorApiarist.class, new NullStorage<>(), () -> ArmorApiarist.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -556,7 +563,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{items.honeydew.getItemStack()}, honeyDropFluid);
|
||||
|
||||
ItemStack phosphor = PluginCore.items.phosphor.getItemStack(2);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, new FluidStack(FluidRegistry.WATER, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, new FluidStack(FluidRegistry.LAVA, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND, 1, 1)}, new FluidStack(FluidRegistry.LAVA, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.DIRT)}, new FluidStack(FluidRegistry.LAVA, 1600));
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
|
||||
private static List<IHiveDrop> getDropsForHive(int meta) {
|
||||
String hiveName = getHiveNameForMeta(meta);
|
||||
if (hiveName == null) {
|
||||
if (hiveName == null || hiveName.equals(HiveType.SWARM.getHiveUid())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return PluginApiculture.hiveRegistry.getDrops(hiveName);
|
||||
|
||||
@@ -286,6 +286,11 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
boolean isLit = isLit(stack);
|
||||
tileCandle.setColour(colour);
|
||||
tileCandle.setLit(isLit);
|
||||
if (tileCandle.isLit()) {
|
||||
world.theProfiler.startSection("checkLight");
|
||||
world.checkLight(pos);
|
||||
world.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,19 +327,11 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
}
|
||||
|
||||
public ItemStack getUnlitCandle(int amount) {
|
||||
ItemStack itemStack = new ItemStack(this, amount, 0);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger(BlockCandle.colourTagName, 0xffffff);
|
||||
itemStack.setTagCompound(tag);
|
||||
return itemStack;
|
||||
return new ItemStack(this, amount, 0);
|
||||
}
|
||||
|
||||
public ItemStack getLitCandle(int amount) {
|
||||
ItemStack itemStack = new ItemStack(this, amount, 1);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger(BlockCandle.colourTagName, 0xffffff);
|
||||
itemStack.setTagCompound(tag);
|
||||
return itemStack;
|
||||
return new ItemStack(this, amount, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,10 +60,11 @@ public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
if (heldItem != null && BlockCandle.lightingItems.contains(heldItem.getItem())) {
|
||||
IBlockState blockState = worldIn.getBlockState(pos);
|
||||
Block block = blockState.getBlock();
|
||||
IBlockState activatedState = PluginApiculture.blocks.candle.getStateFromMeta(block.getMetaFromState(blockState) | 0x08);
|
||||
IBlockState activatedState = PluginApiculture.blocks.candle.getStateFromMeta(block.getMetaFromState(blockState));
|
||||
worldIn.setBlockState(pos, activatedState, Constants.FLAG_BLOCK_SYNC);
|
||||
TileCandle tc = new TileCandle();
|
||||
tc.setColour(0); // default to white
|
||||
tc.setColour(16777215); // default to white
|
||||
tc.setLit(true);
|
||||
worldIn.setTileEntity(pos, tc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, AxisAlignedBB boundingBox) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0", false);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package forestry.apiculture.capabilities;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ArmorApiarist implements IArmorApiarist {
|
||||
public static final ArmorApiarist INSTANCE = new ArmorApiarist();
|
||||
|
||||
protected ArmorApiarist() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, @Nullable String cause, boolean doProtect) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package forestry.apiculture.compat;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
@@ -13,10 +12,23 @@ import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
ItemRegistryApiculture items = PluginApiculture.items;
|
||||
|
||||
ISubtypeRegistry.ISubtypeInterpreter beeSubtypeInterpreter = itemStack -> {
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
return species == null ? null : species.getUID();
|
||||
};
|
||||
|
||||
subtypeRegistry.registerNbtInterpreter(items.beeDroneGE, beeSubtypeInterpreter);
|
||||
subtypeRegistry.registerNbtInterpreter(items.beePrincessGE, beeSubtypeInterpreter);
|
||||
subtypeRegistry.registerNbtInterpreter(items.beeQueenGE, beeSubtypeInterpreter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@Nonnull IModRegistry registry) {
|
||||
ItemRegistryApiculture items = PluginApiculture.items;
|
||||
@@ -39,21 +51,5 @@ public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
items.scoop,
|
||||
items.imprinter
|
||||
);
|
||||
|
||||
ISubtypeRegistry subtypeRegistry = registry.getJeiHelpers().getSubtypeRegistry();
|
||||
subtypeRegistry.registerNbtInterpreter(items.beeDroneGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
subtypeRegistry.registerNbtInterpreter(items.beePrincessGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
subtypeRegistry.registerNbtInterpreter(items.beeQueenGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
}
|
||||
|
||||
private static class BeeSubtypeInterpreter implements ISubtypeRegistry.ISubtypeInterpreter {
|
||||
public static BeeSubtypeInterpreter INSTANCE = new BeeSubtypeInterpreter();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getSubtypeInfo(@Nonnull ItemStack itemStack) {
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
return species == null ? null : species.getUID();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,6 @@ import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorState;
|
||||
@@ -248,7 +247,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public Set<IErrorState> getCanWork(IBeeHousing housing) {
|
||||
World world = housing.getWorldObj();
|
||||
Biome biome = housing.getBiome();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
|
||||
Set<IErrorState> errorStates = new HashSet<>();
|
||||
@@ -282,7 +280,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// / Check for the sky, except if in hell
|
||||
if (biome != null && !BiomeHelper.isBiomeHellish(biome)) {
|
||||
if (!world.provider.getHasNoSky()) {
|
||||
if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NO_SKY);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -47,208 +48,217 @@ public class BeeAlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
|
||||
String customSecondaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
|
||||
|
||||
gui.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryBeeKey), GuiAlyzer.checkCustomName(customSecondaryBeeKey));
|
||||
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
|
||||
String customSecondaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
|
||||
|
||||
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryBeeKey), GuiAlyzer.checkCustomName(customSecondaryBeeKey));
|
||||
textLayout.newLine();
|
||||
}
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
textLayout.newLine();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
guiAlyzer.drawFertilityInfo(primaryFertility.getValue(), GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(primaryFertility.isDominant()), 0);
|
||||
guiAlyzer.drawFertilityInfo(secondaryFertility.getValue(), GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(secondaryFertility.isDominant()), 0);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
textLayout.newLine();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
gui.drawFertilityInfo(primaryFertility.getValue(), GuiAlyzer.COLUMN_1, gui.getColorCoding(primaryFertility.isDominant()), 0);
|
||||
gui.drawFertilityInfo(secondaryFertility.getValue(), GuiAlyzer.COLUMN_2, gui.getColorCoding(secondaryFertility.isDominant()), 0);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
gui.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
gui.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
String yes = Translator.translateToLocal("for.yes");
|
||||
String no = Translator.translateToLocal("for.no");
|
||||
|
||||
String diurnal0, diurnal1, nocturnal0, nocturnal1;
|
||||
if (bee.getGenome().getNeverSleeps()) {
|
||||
nocturnal0 = diurnal0 = yes;
|
||||
} else {
|
||||
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
String displayText;
|
||||
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
|
||||
String displayTextKey = "for.bees.stock.pristine";
|
||||
if (!bee.isNatural()) {
|
||||
displayTextKey = "for.bees.stock.ignoble";
|
||||
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
displayText = Translator.translateToLocal(displayTextKey);
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, gui.getFontColor().get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
if (bee.getGeneration() >= 0) {
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
String yes = Translator.translateToLocal("for.yes");
|
||||
String no = Translator.translateToLocal("for.no");
|
||||
|
||||
String diurnal0, diurnal1, nocturnal0, nocturnal1;
|
||||
if (bee.getGenome().getNeverSleeps()) {
|
||||
nocturnal0 = diurnal0 = yes;
|
||||
} else {
|
||||
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, gui.getFontColor().get("gui.beealyzer.binomial"));
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
String displayText;
|
||||
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
|
||||
String displayTextKey = "for.bees.stock.pristine";
|
||||
if (!bee.isNatural()) {
|
||||
displayTextKey = "for.bees.stock.ignoble";
|
||||
}
|
||||
displayText = Translator.translateToLocal(displayTextKey);
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
if (bee.getGeneration() >= 0) {
|
||||
textLayout.newLineCompressed();
|
||||
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
WidgetManager widgetManager = gui.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getProduceList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getSpecialtyList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
WidgetManager widgetManager = guiAlyzer.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getProduceList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getSpecialtyList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -32,6 +32,7 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
@@ -1019,6 +1020,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
for (BeeDefinition bee : values()) {
|
||||
bee.registerMutations();
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(BeeManager.beeRoot));
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
|
||||
@@ -180,7 +180,7 @@ public class BeeRoot extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public IBee getMember(ItemStack stack) {
|
||||
if (!isMember(stack)) {
|
||||
if (!isMember(stack) || !stack.hasTagCompound()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import forestry.apiculture.gui.widgets.HabitatSlot;
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.render.ColourProperties;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, ItemInventoryHabitatLocator> {
|
||||
@@ -85,7 +86,7 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, Item
|
||||
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
|
||||
|
||||
String str = Translator.translateToLocal("item.for.habitatLocator.name").toUpperCase();
|
||||
fontRendererObj.drawString(str, startX + 8 + textLayout.getCenteredOffset(str, 138), startY + 16, fontColor.get("gui.screen"));
|
||||
fontRendererObj.drawString(str, startX + 8 + textLayout.getCenteredOffset(str, 138), startY + 16, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
// Set active according to valid biomes.
|
||||
Set<BiomeDictionary.Type> activeBiomeTypes = EnumSet.noneOf(BiomeDictionary.Type.class);
|
||||
|
||||
@@ -28,6 +28,7 @@ import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.gui.GuiUtil;
|
||||
import forestry.core.network.packets.PacketGuiSelectRequest;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.ColourProperties;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class GuiImprinter extends GuiForestry<ContainerImprinter, ItemInventoryImprinter> {
|
||||
@@ -58,19 +59,19 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ItemInventoryI
|
||||
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
|
||||
|
||||
int offset = (138 - fontRendererObj.getStringWidth(Translator.translateToLocal("for.gui.imprinter.name"))) / 2;
|
||||
fontRendererObj.drawString(Translator.translateToLocal("for.gui.imprinter.name"), startX + 8 + offset, startY + 16, fontColor.get("gui.screen"));
|
||||
fontRendererObj.drawString(Translator.translateToLocal("for.gui.imprinter.name"), startX + 8 + offset, startY + 16, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
IAlleleBeeSpecies primary = inventory.getPrimary();
|
||||
drawBeeSpeciesIcon(primary, startX + 12, startY + 32);
|
||||
fontRendererObj.drawString(primary.getName(), startX + 32, startY + 36, fontColor.get("gui.screen"));
|
||||
fontRendererObj.drawString(primary.getName(), startX + 32, startY + 36, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
IAlleleBeeSpecies secondary = inventory.getSecondary();
|
||||
drawBeeSpeciesIcon(secondary, startX + 12, startY + 52);
|
||||
fontRendererObj.drawString(secondary.getName(), startX + 32, startY + 56, fontColor.get("gui.screen"));
|
||||
fontRendererObj.drawString(secondary.getName(), startX + 32, startY + 56, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
String youCheater = Translator.translateToLocal("for.gui.imprinter.cheater");
|
||||
offset = (138 - fontRendererObj.getStringWidth(youCheater)) / 2;
|
||||
fontRendererObj.drawString(youCheater, startX + 8 + offset, startY + 76, fontColor.get("gui.screen"));
|
||||
fontRendererObj.drawString(youCheater, startX + 8 + offset, startY + 76, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,26 +10,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.arboriculture.ArboricultureCapabilities;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArmorNaturalist, IItemModelRegister {
|
||||
public class ItemArmorApiarist extends ItemArmor implements IItemModelRegister {
|
||||
|
||||
public ItemArmorApiarist(EntityEquipmentSlot equipmentSlotIn) {
|
||||
super(ArmorMaterial.LEATHER, 0, equipmentSlotIn);
|
||||
@@ -57,14 +60,28 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect) {
|
||||
return true;
|
||||
}
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return new ICapabilityProvider() {
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ArboricultureCapabilities.ARMOR_NATURALIST) {
|
||||
return armorType == EntityEquipmentSlot.HEAD;
|
||||
}
|
||||
return capability == ApicultureCapabilities.ARMOR_APIARIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
|
||||
return armorType == EntityEquipmentSlot.HEAD;
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ApicultureCapabilities.ARMOR_APIARIST) {
|
||||
return capability.getDefaultInstance();
|
||||
} else if (capability == ArboricultureCapabilities.ARMOR_NATURALIST &&
|
||||
armorType == EntityEquipmentSlot.HEAD) {
|
||||
return capability.getDefaultInstance();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemForestry;
|
||||
@@ -9,6 +12,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
@@ -18,8 +22,10 @@ import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
||||
public class ItemSmoker extends ItemForestry implements IArmorApiarist {
|
||||
public class ItemSmoker extends ItemForestry {
|
||||
public ItemSmoker() {
|
||||
super(Tabs.tabApiculture);
|
||||
setMaxStackSize(1);
|
||||
@@ -102,8 +108,22 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect) {
|
||||
return true;
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return new ICapabilityProvider() {
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == ApicultureCapabilities.ARMOR_APIARIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ApicultureCapabilities.ARMOR_APIARIST) {
|
||||
return capability.getDefaultInstance();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,12 @@ import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.climate.IClimateControlled;
|
||||
import forestry.api.climate.IClimatePosition;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.AlvearyBeeModifier;
|
||||
@@ -39,6 +40,7 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -54,7 +56,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
private final InventoryBeeHousing inventory;
|
||||
private final IBeekeepingLogic beekeepingLogic;
|
||||
|
||||
private Biome cachedBiome;
|
||||
private float tempChange = 0.0f;
|
||||
private float humidChange = 0.0f;
|
||||
|
||||
@@ -381,11 +382,8 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
if (cachedBiome == null) {
|
||||
BlockPos coords = getReferenceCoord();
|
||||
cachedBiome = worldObj.getBiome(coords);
|
||||
}
|
||||
return cachedBiome;
|
||||
BlockPos coords = getReferenceCoord();
|
||||
return worldObj.getBiome(coords);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -429,6 +427,10 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
data.writeVarInt(beekeepingLogic.getBeeProgressPercent());
|
||||
data.writeVarInt(Math.round(tempChange * 100));
|
||||
data.writeVarInt(Math.round(humidChange * 100));
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(worldObj, getReferenceCoord());
|
||||
if(position != null){
|
||||
ClimateUtil.writePositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -436,5 +438,10 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
breedingProgressPercent = data.readVarInt();
|
||||
tempChange = data.readVarInt() / 100.0F;
|
||||
humidChange = data.readVarInt() / 100.0F;
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(worldObj, getReferenceCoord());
|
||||
if(position != null){
|
||||
ClimateUtil.readPositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,19 +13,20 @@ package forestry.apiculture.multiblock;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
import forestry.api.climate.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.network.packets.PacketActiveUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.energy.EnergyHelper;
|
||||
import forestry.energy.EnergyManager;
|
||||
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import forestry.energy.EnergyTransferMode;
|
||||
import forestry.energy.compat.rf.IEnergyReceiverDelegated;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
public abstract class TileAlvearyClimatiser extends TileAlveary implements IEnergyReceiver, IActivatable, IAlvearyComponent.Climatiser {
|
||||
public abstract class TileAlvearyClimatiser extends TileAlveary implements IEnergyReceiverDelegated, IActivatable, IAlvearyComponent.Climatiser {
|
||||
|
||||
private static final int WORK_CYCLES = 1;
|
||||
private static final int ENERGY_PER_OPERATION = 50;
|
||||
@@ -50,13 +51,13 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
|
||||
this.definition = definition;
|
||||
|
||||
this.energyManager = new EnergyManager(1000, 2000);
|
||||
this.energyManager.setReceiveOnly();
|
||||
this.energyManager.setExternalMode(EnergyTransferMode.RECEIVE);
|
||||
}
|
||||
|
||||
/* UPDATING */
|
||||
@Override
|
||||
public void changeClimate(int tick, IClimateControlled climateControlled) {
|
||||
if (workingTime < 20 && energyManager.consumeEnergyToDoWork(WORK_CYCLES, ENERGY_PER_OPERATION)) {
|
||||
if (workingTime < 20 && EnergyHelper.consumeEnergyToDoWork(energyManager, WORK_CYCLES, ENERGY_PER_OPERATION)) {
|
||||
// one tick of work for every 10 RF
|
||||
workingTime += ENERGY_PER_OPERATION / 10;
|
||||
}
|
||||
@@ -123,25 +124,9 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@Override
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
|
||||
return energyManager.receiveEnergy(from, maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(EnumFacing from) {
|
||||
return energyManager.getEnergyStored(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(EnumFacing from) {
|
||||
return energyManager.getMaxEnergyStored(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(EnumFacing from) {
|
||||
return energyManager.canConnectEnergy(from);
|
||||
public EnergyManager getEnergyManager() {
|
||||
return energyManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import forestry.api.core.climate.IClimateControlled;
|
||||
import forestry.api.climate.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.climate.IClimatePosition;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -30,6 +31,7 @@ import forestry.core.owner.OwnerHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
@@ -38,7 +40,6 @@ import net.minecraft.world.biome.Biome;
|
||||
public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IOwnedTile, IClimatised, IGuiBeeHousingInventory, IStreamableGui {
|
||||
private final OwnerHandler ownerHandler = new OwnerHandler();
|
||||
private final IBeekeepingLogic beeLogic;
|
||||
private Biome cachedBiome;
|
||||
|
||||
// CLIENT
|
||||
private int breedingProgressPercent = 0;
|
||||
@@ -154,20 +155,25 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeVarInt(beeLogic.getBeeProgressPercent());
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(worldObj, getPos());
|
||||
if(position != null){
|
||||
ClimateUtil.writePositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
breedingProgressPercent = data.readVarInt();
|
||||
IClimatePosition position = ForestryAPI.climateManager.getPosition(worldObj, getPos());
|
||||
if(position != null){
|
||||
ClimateUtil.readPositionData(position, data);
|
||||
}
|
||||
}
|
||||
|
||||
// / IBEEHOUSING
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
if (cachedBiome == null) {
|
||||
cachedBiome = worldObj.getBiome(getPos());
|
||||
}
|
||||
return cachedBiome;
|
||||
return worldObj.getBiome(getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,6 +47,8 @@ import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -55,6 +57,7 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -65,20 +68,6 @@ import net.minecraft.world.biome.Biome;
|
||||
|
||||
public class TileHive extends TileEntity implements ITickable, IHiveTile, IActivatable, IBeeHousing {
|
||||
private static final DamageSource damageSourceBeeHive = new DamageSourceForestry("bee.hive");
|
||||
private static final Predicate<EntityLivingBase> BEE_TARGET_PREDICATE = new Predicate<EntityLivingBase>() {
|
||||
@Override
|
||||
public boolean apply(@Nullable EntityLivingBase input) {
|
||||
if (input != null && input.isEntityAlive() && !input.isInvisible()) {
|
||||
if (input instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) input;
|
||||
return !player.isSpectator() && !player.isCreative();
|
||||
} else if (input instanceof IMob) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@Nonnull
|
||||
private final InventoryAdapter contained = new InventoryAdapter(2, "Contained");
|
||||
@@ -88,6 +77,9 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
private final BeekeepingLogic beeLogic;
|
||||
@Nonnull
|
||||
private final IErrorLogic errorLogic;
|
||||
@Nonnull
|
||||
private final Predicate<EntityLivingBase> beeTargetPredicate;
|
||||
|
||||
private IBee containedBee = null;
|
||||
private boolean active = false;
|
||||
private boolean angry = false;
|
||||
@@ -103,6 +95,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
inventory = new HiveBeeHousingInventory(this);
|
||||
beeLogic = new BeekeepingLogic(this);
|
||||
errorLogic = ForestryAPI.errorStateRegistry.createErrorLogic();
|
||||
beeTargetPredicate = new BeeTargetPredicate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +120,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
if (calmTime == 0) {
|
||||
if (canWork) {
|
||||
AxisAlignedBB boundingBox = AlleleEffect.getBounding(getContainedBee().getGenome(), this);
|
||||
List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, BEE_TARGET_PREDICATE);
|
||||
List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, beeTargetPredicate);
|
||||
if (!entities.isEmpty()) {
|
||||
Collections.shuffle(entities);
|
||||
EntityLivingBase entity = entities.get(0);
|
||||
@@ -371,4 +364,28 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
return getPos();
|
||||
}
|
||||
|
||||
private static class BeeTargetPredicate implements Predicate<EntityLivingBase> {
|
||||
@Nonnull
|
||||
private final IHiveTile hive;
|
||||
|
||||
public BeeTargetPredicate(@Nonnull IHiveTile hive) {
|
||||
this.hive = hive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(@Nullable EntityLivingBase input) {
|
||||
if (input != null && input.isEntityAlive() && !input.isInvisible()) {
|
||||
if (input instanceof EntityPlayer) {
|
||||
return EntitySelectors.CAN_AI_TARGET.apply(input);
|
||||
} else if (hive.isAngry()) {
|
||||
return true;
|
||||
} else if (input instanceof IMob) {
|
||||
// don't attack semi-passive vanilla mobs
|
||||
return !(input instanceof EntityEnderman) && !(input instanceof EntityPigZombie);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public enum HiveDescription implements IHiveDescription {
|
||||
}
|
||||
},
|
||||
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
|
||||
END(IHiveRegistry.HiveType.END, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
|
||||
END(IHiveRegistry.HiveType.END, 2.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
|
||||
@Override
|
||||
public boolean isGoodBiome(Biome biome) {
|
||||
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
|
||||
|
||||
@@ -15,6 +15,8 @@ import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.arboriculture.items.ItemBlockWoodDoor;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -23,15 +25,15 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class CamouflageHandlerArbDoor implements ICamouflageItemHandler {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(ItemStack stack, ICamouflageHandler camouflageHandler) {
|
||||
if(camouflageHandler == null || stack == null || stack.getItem() == null || stack.stackSize <= 0){
|
||||
public boolean canHandle(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() == null || stack.stackSize <= 0){
|
||||
return false;
|
||||
}
|
||||
if(stack.getItem() instanceof ItemBlockWoodDoor){
|
||||
@@ -56,22 +58,22 @@ public class CamouflageHandlerArbDoor implements ICamouflageItemHandler {
|
||||
if(camouflageHandler == null || stack == null || stack.getItem() == null || stack.stackSize <= 0 || !(stack.getItem() instanceof ItemBlockWoodDoor)){
|
||||
return null;
|
||||
}
|
||||
World world = camouflageHandler.getWorld();
|
||||
World world = camouflageHandler.getWorldObj();
|
||||
BlockPos pos = camouflageTile.getCoordinates();
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
IBlockState currentState = blockState.getActualState(world, pos);
|
||||
|
||||
|
||||
ItemBlockWoodDoor itemDoor = (ItemBlockWoodDoor) stack.getItem();
|
||||
|
||||
|
||||
IBlockState doorState = itemDoor.block.getDefaultState()
|
||||
.withProperty(BlockDoor.FACING, currentState.getValue(BlockDoor.FACING))
|
||||
.withProperty(BlockDoor.HINGE, currentState.getValue(BlockDoor.HINGE))
|
||||
.withProperty(BlockDoor.OPEN, currentState.getValue(BlockDoor.OPEN))
|
||||
.withProperty(BlockDoor.POWERED, currentState.getValue(BlockDoor.POWERED))
|
||||
.withProperty(BlockDoor.HALF, currentState.getValue(BlockDoor.HALF));
|
||||
|
||||
|
||||
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
|
||||
|
||||
|
||||
return Pair.of(doorState, modelShapes.getModelForState(doorState));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
@@ -30,6 +30,7 @@ import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ILeafTranslator;
|
||||
import forestry.api.genetics.ISaplingTranslator;
|
||||
@@ -41,6 +42,7 @@ import forestry.arboriculture.blocks.BlockPile;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.blocks.log.BlockArbLog;
|
||||
import forestry.arboriculture.blocks.slab.BlockArbSlab;
|
||||
import forestry.arboriculture.capabilities.ArmorNaturalist;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
import forestry.arboriculture.genetics.TreeBranchDefinition;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
@@ -51,7 +53,6 @@ import forestry.arboriculture.genetics.TreekeepingMode;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleFruit;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleGrowth;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleLeafEffect;
|
||||
import forestry.arboriculture.items.ItemCharcoal;
|
||||
import forestry.arboriculture.items.ItemGrafter;
|
||||
import forestry.arboriculture.items.ItemRegistryArboriculture;
|
||||
import forestry.arboriculture.models.TextureLeaves;
|
||||
@@ -64,6 +65,7 @@ import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.arboriculture.tiles.TilePile;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.capabilities.NullStorage;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
@@ -98,6 +100,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -140,6 +143,9 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.hard);
|
||||
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.hardcore);
|
||||
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.insane);
|
||||
|
||||
// Capabilities
|
||||
CapabilityManager.INSTANCE.register(IArmorNaturalist.class, new NullStorage<>(), () -> ArmorNaturalist.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -419,7 +425,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
//Dirt Pile Block
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.DIRT)), OreDictUtil.DUST_ASH, Items.CLAY_BALL, OreDictUtil.DUST_ASH, OreDictUtil.DIRT, OreDictUtil.DIRT, OreDictUtil.DIRT, OreDictUtil.TREE_LEAVES, Items.CLAY_BALL, OreDictUtil.TREE_LEAVES);
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.DIRT)), PluginCore.items.fertilizerBio, Items.CLAY_BALL, PluginCore.items.fertilizerBio, OreDictUtil.DIRT, OreDictUtil.DIRT, OreDictUtil.DIRT, PluginCore.items.fertilizerBio, Items.CLAY_BALL, PluginCore.items.fertilizerBio);
|
||||
|
||||
}
|
||||
|
||||
@@ -533,10 +539,6 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
return 100;
|
||||
}
|
||||
|
||||
if(items.charcoal == item){
|
||||
return ItemCharcoal.getBurnTime(fuel);
|
||||
}
|
||||
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
|
||||
if (block instanceof IWoodTyped) {
|
||||
|
||||
@@ -41,7 +41,6 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public abstract class BlockDecorativeLeaves extends Block implements IItemModelRegister, IColoredBlock, IShearable {
|
||||
private static final int VARIANTS_PER_BLOCK = 16;
|
||||
private static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
|
||||
|
||||
public static List<BlockDecorativeLeaves> create() {
|
||||
List<BlockDecorativeLeaves> blocks = new ArrayList<>();
|
||||
@@ -148,7 +147,8 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR
|
||||
|
||||
@Nonnull
|
||||
public TreeDefinition getTreeType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + blockNumber * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + blockNumber * VARIANTS_PER_BLOCK;
|
||||
return TreeDefinition.byMetadata(variantMeta);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -414,9 +415,17 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
if (getPileType() == EnumPileType.ASH) {
|
||||
if (pile.getTreeSpecies() != null) {
|
||||
IWoodProvider woodProvider = pile.getTreeSpecies().getWoodProvider();
|
||||
ItemStack charcoal = new ItemStack(PluginArboriculture.items.charcoal, woodProvider.getCarbonization(), woodProvider.getCombustibility());
|
||||
int charcoalAmount = woodProvider.getCarbonization();
|
||||
ItemStack charcoal = new ItemStack(Items.COAL, charcoalAmount, 1);
|
||||
while(RANDOM.nextFloat() < woodProvider.getCharcoalChance(charcoalAmount)){
|
||||
charcoal.stackSize++;
|
||||
}
|
||||
list.add(charcoal);
|
||||
list.add(new ItemStack(PluginCore.items.ash, 3));
|
||||
int ashAmount = (int)(charcoalAmount / 1.5);
|
||||
if(ashAmount <= 0){
|
||||
ashAmount = 1;
|
||||
}
|
||||
list.add(new ItemStack(PluginCore.items.ash, ashAmount));
|
||||
} else {
|
||||
list.add(new ItemStack(Blocks.DIRT, 2));
|
||||
list.add(new ItemStack(PluginCore.items.ash, 2));
|
||||
|
||||
@@ -37,7 +37,7 @@ public enum BlockTypeArboricultureTesr implements IBlockTypeTesr {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ public abstract class BlockArbFence extends BlockForestryFence<EnumForestryWoodT
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumForestryWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumForestryWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,8 @@ public abstract class BlockFireproofVanillaFence extends BlockForestryFence<Enum
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumVanillaWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumVanillaWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,6 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends BlockFence implements IWoodTyped, IItemModelRegister, IStateMapperRegister {
|
||||
protected static final int VARIANTS_PER_BLOCK = 16;
|
||||
protected static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
|
||||
|
||||
private final boolean fireproof;
|
||||
private final int blockNumber;
|
||||
|
||||
@@ -42,7 +42,8 @@ public abstract class BlockArbLog extends BlockForestryLog<EnumForestryWoodType>
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumForestryWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumForestryWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,8 @@ public abstract class BlockFireproofVanillaLog extends BlockForestryLog<EnumVani
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumVanillaWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumVanillaWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends BlockLog implements IWoodTyped, IStateMapperRegister, IItemModelRegister {
|
||||
protected static final int VARIANTS_PER_BLOCK = 4;
|
||||
protected static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
|
||||
|
||||
private final boolean fireproof;
|
||||
private final int blockNumber;
|
||||
|
||||
@@ -42,7 +42,8 @@ public abstract class BlockArbPlanks extends BlockForestryPlanks<EnumForestryWoo
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumForestryWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumForestryWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,8 @@ public abstract class BlockFireproofVanillaPlanks extends BlockForestryPlanks<En
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumVanillaWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumVanillaWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,6 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public abstract class BlockForestryPlanks<T extends Enum<T> & IWoodType> extends Block implements IWoodTyped, IStateMapperRegister, IItemModelRegister {
|
||||
protected static final int VARIANTS_PER_BLOCK = 16;
|
||||
protected static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
|
||||
|
||||
private final boolean fireproof;
|
||||
private final int blockNumber;
|
||||
|
||||
@@ -50,7 +50,9 @@ public abstract class BlockArbSlab extends BlockForestrySlab<EnumForestryWoodTyp
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumForestryWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
meta &= ~8; // unset the top/bottom slab bit
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumForestryWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,9 @@ public abstract class BlockFireproofVanillaSlab extends BlockForestrySlab<EnumVa
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumVanillaWoodType getWoodType(int meta) {
|
||||
int variantMeta = (meta & VARIANTS_META_MASK) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
meta &= ~8; // unset the top/bottom slab bit
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + getBlockNumber() * VARIANTS_PER_BLOCK;
|
||||
return EnumVanillaWoodType.byMetadata(variantMeta);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,6 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends BlockSlab implements IWoodTyped, IItemModelRegister, IStateMapperRegister {
|
||||
protected static final int VARIANTS_PER_BLOCK = 8;
|
||||
protected static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
|
||||
|
||||
private final boolean fireproof;
|
||||
private final int blockNumber;
|
||||
@@ -77,11 +76,13 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
return blockNumber;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return this.isDouble() ? new BlockStateContainer(this, getVariant()) : new BlockStateContainer(this, HALF, getVariant());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
T woodType = getWoodType(meta);
|
||||
@@ -100,8 +101,7 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
T woodType = state.getValue(getVariant());
|
||||
int meta = woodType.getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
int meta = damageDropped(state);
|
||||
|
||||
if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) {
|
||||
meta |= 8;
|
||||
@@ -112,7 +112,8 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return state.getValue(getVariant()).getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
T woodType = state.getValue(getVariant());
|
||||
return woodType.getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package forestry.arboriculture.capabilities;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ArmorNaturalist implements IArmorNaturalist {
|
||||
public static final ArmorNaturalist INSTANCE = new ArmorNaturalist();
|
||||
|
||||
protected ArmorNaturalist() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -273,12 +273,11 @@ public class Tree extends Individual implements ITree, IPlantable {
|
||||
String girth = TextFormatting.AQUA + "G: " + String.format("%sx%s", genome.getGirth(), genome.getGirth());
|
||||
String saplings = TextFormatting.YELLOW + "S: " + genome.getActiveAllele(EnumTreeChromosome.FERTILITY).getName();
|
||||
String yield = TextFormatting.WHITE + "Y: " + genome.getActiveAllele(EnumTreeChromosome.YIELD).getName();
|
||||
String combustibility = TextFormatting.DARK_GRAY + "CO: " + primary.getWoodProvider().getCombustibility();
|
||||
String carbonization = TextFormatting.GRAY + "CA: " + secondary.getWoodProvider().getCarbonization();
|
||||
list.add(String.format("%s, %s", saplings, maturation));
|
||||
list.add(String.format("%s, %s", height, girth));
|
||||
list.add(String.format("%s, %s", yield, sappiness));
|
||||
list.add(String.format("%s, %s", combustibility, carbonization));
|
||||
list.add(String.format("%s", carbonization));
|
||||
|
||||
IAlleleBoolean primaryFireproof = (IAlleleBoolean) genome.getActiveAllele(EnumTreeChromosome.FIREPROOF);
|
||||
if (primaryFireproof.getValue()) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import forestry.core.gui.widgets.ItemStackWidget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -58,204 +59,205 @@ public class TreeAlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack) {
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
EnumGermlingType type = TreeManager.treeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.", "");
|
||||
String customSecondaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getSecondary().getUnlocalizedName().replace("trees.species.", "");
|
||||
|
||||
gui.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), tree, EnumTreeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryTreeKey), GuiAlyzer.checkCustomName(customSecondaryTreeKey));
|
||||
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
EnumGermlingType type = TreeManager.treeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.", "");
|
||||
String customSecondaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getSecondary().getUnlocalizedName().replace("trees.species.", "");
|
||||
|
||||
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), tree, EnumTreeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryTreeKey), GuiAlyzer.checkCustomName(customSecondaryTreeKey));
|
||||
textLayout.newLine();
|
||||
}
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.saplings"), tree, EnumTreeChromosome.FERTILITY);
|
||||
textLayout.newLineCompressed();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.maturity"), tree, EnumTreeChromosome.MATURATION);
|
||||
textLayout.newLineCompressed();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.height"), tree, EnumTreeChromosome.HEIGHT);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
IAlleleInteger activeGirth = (IAlleleInteger) tree.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH);
|
||||
IAlleleInteger inactiveGirth = (IAlleleInteger) tree.getGenome().getInactiveAllele(EnumTreeChromosome.GIRTH);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.girth"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawLine(String.format("%sx%s", activeGirth.getValue(), activeGirth.getValue()), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.GIRTH, false);
|
||||
guiAlyzer.drawLine(String.format("%sx%s", inactiveGirth.getValue(), inactiveGirth.getValue()), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.GIRTH, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.yield"), tree, EnumTreeChromosome.YIELD);
|
||||
textLayout.newLineCompressed();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.sappiness"), tree, EnumTreeChromosome.SAPPINESS);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), tree, EnumTreeChromosome.EFFECT);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.saplings"), tree, EnumTreeChromosome.FERTILITY);
|
||||
textLayout.newLineCompressed();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.maturity"), tree, EnumTreeChromosome.MATURATION);
|
||||
textLayout.newLineCompressed();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.height"), tree, EnumTreeChromosome.HEIGHT);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
IAlleleInteger activeGirth = (IAlleleInteger) tree.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH);
|
||||
IAlleleInteger inactiveGirth = (IAlleleInteger) tree.getGenome().getInactiveAllele(EnumTreeChromosome.GIRTH);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.girth"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawLine(String.format("%sx%s", activeGirth.getValue(), activeGirth.getValue()), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.GIRTH, false);
|
||||
gui.drawLine(String.format("%sx%s", inactiveGirth.getValue(), inactiveGirth.getValue()), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.GIRTH, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.yield"), tree, EnumTreeChromosome.YIELD);
|
||||
textLayout.newLineCompressed();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.sappiness"), tree, EnumTreeChromosome.SAPPINESS);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), tree, EnumTreeChromosome.EFFECT);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack) {
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage();
|
||||
|
||||
int speciesDominance0 = gui.getColorCoding(tree.getGenome().getPrimary().isDominant());
|
||||
int speciesDominance1 = gui.getColorCoding(tree.getGenome().getSecondary().isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTreeSpecies activeSpecies = (IAlleleTreeSpecies) tree.getGenome().getActiveAllele(EnumTreeChromosome.SPECIES);
|
||||
IAlleleTreeSpecies inActiveSpecies = (IAlleleTreeSpecies) tree.getGenome().getInactiveAllele(EnumTreeChromosome.SPECIES);
|
||||
|
||||
int activeCombustibility = activeSpecies.getWoodProvider().getCombustibility();
|
||||
int inactiveCombustibility = inActiveSpecies.getWoodProvider().getCombustibility();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.combustibility"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawLine(Integer.toString(activeCombustibility), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
gui.drawLine(Integer.toString(inactiveCombustibility), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
int activeCarbonization = activeSpecies.getWoodProvider().getCarbonization();
|
||||
int inactiveCarbonization = inActiveSpecies.getWoodProvider().getCarbonization();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.carbonization"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawLine(Integer.toString(activeCarbonization), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
gui.drawLine(Integer.toString(inactiveCarbonization), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.native"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_1,
|
||||
speciesDominance0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getSecondary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_2,
|
||||
speciesDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
// FRUITS
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.supports"), GuiAlyzer.COLUMN_0);
|
||||
List<IFruitFamily> families0 = new ArrayList<>(tree.getGenome().getPrimary().getSuitableFruit());
|
||||
List<IFruitFamily> families1 = new ArrayList<>(tree.getGenome().getSecondary().getSuitableFruit());
|
||||
|
||||
int max = Math.max(families0.size(), families1.size());
|
||||
for (int i = 0; i < max; i++) {
|
||||
if (i > 0) {
|
||||
textLayout.newLineCompressed();
|
||||
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (families0.size() > i) {
|
||||
textLayout.drawLine(families0.get(i).getName(), GuiAlyzer.COLUMN_1, speciesDominance0);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage();
|
||||
|
||||
int speciesDominance0 = guiAlyzer.getColorCoding(tree.getGenome().getPrimary().isDominant());
|
||||
int speciesDominance1 = guiAlyzer.getColorCoding(tree.getGenome().getSecondary().isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTreeSpecies activeSpecies = (IAlleleTreeSpecies) tree.getGenome().getActiveAllele(EnumTreeChromosome.SPECIES);
|
||||
IAlleleTreeSpecies inActiveSpecies = (IAlleleTreeSpecies) tree.getGenome().getInactiveAllele(EnumTreeChromosome.SPECIES);
|
||||
|
||||
int activeCarbonization = activeSpecies.getWoodProvider().getCarbonization();
|
||||
int inactiveCarbonization = inActiveSpecies.getWoodProvider().getCarbonization();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.carbonization"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawLine(Integer.toString(activeCarbonization), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
guiAlyzer.drawLine(Integer.toString(inactiveCarbonization), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.native"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_1,
|
||||
speciesDominance0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getSecondary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_2,
|
||||
speciesDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
// FRUITS
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.supports"), GuiAlyzer.COLUMN_0);
|
||||
List<IFruitFamily> families0 = new ArrayList<>(tree.getGenome().getPrimary().getSuitableFruit());
|
||||
List<IFruitFamily> families1 = new ArrayList<>(tree.getGenome().getSecondary().getSuitableFruit());
|
||||
|
||||
int max = Math.max(families0.size(), families1.size());
|
||||
for (int i = 0; i < max; i++) {
|
||||
if (i > 0) {
|
||||
textLayout.newLineCompressed();
|
||||
}
|
||||
|
||||
if (families0.size() > i) {
|
||||
textLayout.drawLine(families0.get(i).getName(), GuiAlyzer.COLUMN_1, speciesDominance0);
|
||||
}
|
||||
if (families1.size() > i) {
|
||||
textLayout.drawLine(families1.get(i).getName(), GuiAlyzer.COLUMN_2, speciesDominance1);
|
||||
}
|
||||
|
||||
}
|
||||
if (families1.size() > i) {
|
||||
textLayout.drawLine(families1.get(i).getName(), GuiAlyzer.COLUMN_2, speciesDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int fruitDominance0 = guiAlyzer.getColorCoding(tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
int fruitDominance1 = guiAlyzer.getColorCoding(tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fruits"), GuiAlyzer.COLUMN_0);
|
||||
String strike = "";
|
||||
IAllele fruit0 = tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.canBearFruit() && fruit0 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
|
||||
textLayout.drawLine(strike + tree.getGenome().getFruitProvider().getDescription(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
|
||||
strike = "";
|
||||
IAlleleFruit fruit1 = (IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.getGenome().getSecondary().getSuitableFruit().contains(fruit1.getProvider().getFamily()) && fruit1 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
textLayout.drawLine(strike + fruit1.getProvider().getDescription(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.family"), GuiAlyzer.COLUMN_0);
|
||||
IFruitFamily primary = tree.getGenome().getFruitProvider().getFamily();
|
||||
IFruitFamily secondary = ((IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS)).getProvider().getFamily();
|
||||
|
||||
if (primary != null) {
|
||||
textLayout.drawLine(primary.getName(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
}
|
||||
if (secondary != null) {
|
||||
textLayout.drawLine(secondary.getName(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int fruitDominance0 = gui.getColorCoding(tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
int fruitDominance1 = gui.getColorCoding(tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fruits"), GuiAlyzer.COLUMN_0);
|
||||
String strike = "";
|
||||
IAllele fruit0 = tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.canBearFruit() && fruit0 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
textLayout.drawLine(strike + tree.getGenome().getFruitProvider().getDescription(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
|
||||
strike = "";
|
||||
IAlleleFruit fruit1 = (IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.getGenome().getSecondary().getSuitableFruit().contains(fruit1.getProvider().getFamily()) && fruit1 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
textLayout.drawLine(strike + fruit1.getProvider().getDescription(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.family"), GuiAlyzer.COLUMN_0);
|
||||
IFruitFamily primary = tree.getGenome().getFruitProvider().getFamily();
|
||||
IFruitFamily secondary = ((IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS)).getProvider().getFamily();
|
||||
|
||||
if (primary != null) {
|
||||
textLayout.drawLine(primary.getName(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
}
|
||||
if (secondary != null) {
|
||||
textLayout.drawLine(secondary.getName(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack) {
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
WidgetManager widgetManager = gui.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getProducts().keySet()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getSpecialties().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, gui.getGuiLeft() + x, gui.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
WidgetManager widgetManager = guiAlyzer.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getProducts().keySet()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getSpecialties().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, guiAlyzer.getGuiLeft() + x, guiAlyzer.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,6 +35,7 @@ import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
@@ -91,6 +92,7 @@ import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSerializable {
|
||||
Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), EnumVanillaWoodType.OAK) {
|
||||
@@ -1066,6 +1068,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(TreeManager.treeRoot));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,14 +60,14 @@ public class WoodProvider implements IWoodProvider {
|
||||
return TreeManager.woodAccess.getStack(woodType, WoodBlockKind.LOG, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombustibility() {
|
||||
return woodType.getCombustability();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCarbonization() {
|
||||
return woodType.getCarbonization();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCharcoalChance(int numberOfCharcoal){
|
||||
return woodType.getCharcoalChance(numberOfCharcoal);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,10 +79,10 @@ public class WoodProviderVanilla implements IWoodProvider {
|
||||
public ItemStack getWoodStack() {
|
||||
return TreeManager.woodAccess.getStack(woodType, WoodBlockKind.LOG, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCombustibility() {
|
||||
return woodType.getCombustability();
|
||||
public float getCharcoalChance(int numberOfCharcoal){
|
||||
return woodType.getCharcoalChance(numberOfCharcoal);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemCharcoal extends ItemForestry {
|
||||
|
||||
public ItemCharcoal() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
for(int i = 1;i < 25;i++){
|
||||
subItems.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for(int i = 1;i < 25;i++){
|
||||
manager.registerItemModel(item, i);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getBurnTime(ItemStack fuel) {
|
||||
return fuel.getMetadata() * 100;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
@@ -21,7 +19,6 @@ import forestry.core.utils.OreDictUtil;
|
||||
public class ItemRegistryArboriculture extends ItemRegistry {
|
||||
public final ItemGermlingGE sapling;
|
||||
public final ItemGermlingGE pollenFertile;
|
||||
public final ItemCharcoal charcoal;
|
||||
public final ItemGrafter grafter;
|
||||
public final ItemGrafter grafterProven;
|
||||
|
||||
@@ -31,10 +28,6 @@ public class ItemRegistryArboriculture extends ItemRegistry {
|
||||
|
||||
pollenFertile = registerItem(new ItemGermlingGE(EnumGermlingType.POLLEN), "pollenFertile");
|
||||
|
||||
charcoal = registerItem(new ItemCharcoal(), "charcoal");
|
||||
registerOreDict(OreDictUtil.CHARCOAL, new ItemStack(charcoal, 1, OreDictionary.WILDCARD_VALUE));
|
||||
registerOreDict(OreDictUtil.CHARCOAL, new ItemStack(Items.COAL, 1, 1));
|
||||
|
||||
grafter = registerItem(new ItemGrafter(9), "grafter");
|
||||
grafterProven = registerItem(new ItemGrafter(149), "grafterProven");
|
||||
}
|
||||
|
||||
@@ -11,25 +11,7 @@
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ILeafSpriteProvider;
|
||||
@@ -37,80 +19,44 @@ import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockDecorativeLeaves;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import forestry.core.models.baker.ModelBaker;
|
||||
import forestry.core.proxy.Proxies;
|
||||
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.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ModelDecorativeLeaves extends ModelBlockDefault<BlockDecorativeLeaves> {
|
||||
|
||||
public class ModelDecorativeLeaves extends ModelBlockCached<BlockDecorativeLeaves, TreeDefinition> {
|
||||
public ModelDecorativeLeaves() {
|
||||
super(BlockDecorativeLeaves.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
IModelBaker baker = new ModelBaker();
|
||||
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
@Override
|
||||
protected TreeDefinition getInventoryKey(@Nonnull ItemStack stack) {
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if (!(block instanceof BlockDecorativeLeaves)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
TreeDefinition tree = state.getValue(bBlock.getVariant());
|
||||
|
||||
baker.setRenderBounds(Block.FULL_BLOCK_AABB);
|
||||
bakeBlock(bBlock, tree, baker);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
return blockModel.getQuads(state, side, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemOverrideList createOverrides() {
|
||||
return new LeaveOverideList(this);
|
||||
}
|
||||
|
||||
private static class LeaveOverideList extends ItemOverrideList{
|
||||
|
||||
private final ModelDecorativeLeaves modelDecorativeLeaves;
|
||||
|
||||
public LeaveOverideList(ModelDecorativeLeaves modelDecorativeLeaves) {
|
||||
super(Collections.emptyList());
|
||||
this.modelDecorativeLeaves = modelDecorativeLeaves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
||||
IModelBaker baker = new ModelBaker();
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if (!modelDecorativeLeaves.blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = modelDecorativeLeaves.blockClass.cast(block);
|
||||
TreeDefinition tree = bBlock.getTreeType(stack.getMetadata());
|
||||
|
||||
baker.setRenderBounds(Block.FULL_BLOCK_AABB);
|
||||
bakeBlock(bBlock, tree, baker);
|
||||
|
||||
return modelDecorativeLeaves.itemModel = baker.bakeModel(true);
|
||||
}
|
||||
|
||||
BlockDecorativeLeaves bBlock = (BlockDecorativeLeaves) block;
|
||||
return bBlock.getTreeType(stack.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bakeInventoryBlock(@Nonnull BlockDecorativeLeaves block, @Nonnull ItemStack item, @Nonnull IModelBaker baker) {
|
||||
|
||||
protected TreeDefinition getWorldKey(@Nonnull IBlockState state) {
|
||||
Block block = state.getBlock();
|
||||
if (!(block instanceof BlockDecorativeLeaves)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = (BlockDecorativeLeaves) block;
|
||||
return state.getValue(bBlock.getVariant());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bakeWorldBlock(@Nonnull BlockDecorativeLeaves block, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker) {
|
||||
}
|
||||
|
||||
public static void bakeBlock(BlockDecorativeLeaves block, TreeDefinition treeDefinition, IModelBaker baker) {
|
||||
if (treeDefinition == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected void bakeBlock(@Nonnull BlockDecorativeLeaves block, @Nonnull TreeDefinition treeDefinition, @Nonnull IModelBaker baker, boolean inventory) {
|
||||
TextureMap map = Proxies.common.getClientInstance().getTextureMapBlocks();
|
||||
|
||||
ITreeGenome genome = treeDefinition.getGenome();
|
||||
@@ -119,7 +65,7 @@ public class ModelDecorativeLeaves extends ModelBlockDefault<BlockDecorativeLeav
|
||||
|
||||
ResourceLocation leafSpriteLocation = leafSpriteProvider.getSprite(false, Proxies.render.fancyGraphicsEnabled());
|
||||
TextureAtlasSprite leafSprite = map.getAtlasSprite(leafSpriteLocation.toString());
|
||||
|
||||
|
||||
// Render the plain leaf block.
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, leafSprite, 0);
|
||||
|
||||
@@ -129,8 +75,31 @@ public class ModelDecorativeLeaves extends ModelBlockDefault<BlockDecorativeLeav
|
||||
TextureAtlasSprite fruitSprite = map.getAtlasSprite(fruitSpriteLocation.toString());
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, fruitSprite, 1);
|
||||
}
|
||||
|
||||
|
||||
// Set the particle sprite
|
||||
baker.setParticleSprite(leafSprite);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected IBakedModel bakeModel(@Nonnull IBlockState state, @Nonnull TreeDefinition key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IModelBaker baker = new ModelBaker();
|
||||
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
|
||||
baker.setRenderBounds(Block.FULL_BLOCK_AABB);
|
||||
bakeBlock(bBlock, key, baker, false);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
onCreateModel(blockModel);
|
||||
return blockModel;
|
||||
}
|
||||
}
|
||||
@@ -11,40 +11,60 @@
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import java.util.Objects;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.arboriculture.genetics.TreeRoot;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
public class ModelLeaves extends ModelBlockDefault<BlockForestryLeaves> {
|
||||
public class ModelLeaves extends ModelBlockCached<BlockForestryLeaves, ModelLeaves.Key> {
|
||||
public static class Key {
|
||||
public final TextureAtlasSprite leafSprite, fruitSprite;
|
||||
public final boolean fancy;
|
||||
private final int hashCode;
|
||||
|
||||
public ModelLeaves() {
|
||||
super(BlockForestryLeaves.class);
|
||||
public Key(TextureAtlasSprite leafSprite, TextureAtlasSprite fruitSprite, boolean fancy) {
|
||||
this.leafSprite = leafSprite;
|
||||
this.fruitSprite = fruitSprite;
|
||||
this.fancy = fancy;
|
||||
this.hashCode = Objects.hash(leafSprite, fruitSprite, fancy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null || !(other instanceof Key)) {
|
||||
return false;
|
||||
} else {
|
||||
Key otherKey = (Key) other;
|
||||
return otherKey.leafSprite == leafSprite && otherKey.fruitSprite == fruitSprite && otherKey.fancy == fancy;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bakeInventoryBlock(@Nonnull BlockForestryLeaves block, @Nonnull ItemStack itemStack, @Nonnull IModelBaker baker) {
|
||||
if (!(itemStack.getItem() instanceof ItemBlockLeaves) || block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected Key getInventoryKey(@Nonnull ItemStack itemStack) {
|
||||
TextureMap map = Proxies.common.getClientInstance().getTextureMapBlocks();
|
||||
|
||||
TileLeaves leaves = new TileLeaves();
|
||||
@@ -54,55 +74,55 @@ public class ModelLeaves extends ModelBlockDefault<BlockForestryLeaves> {
|
||||
leaves.setTree(TreeRoot.treeTemplates.get(0));
|
||||
}
|
||||
|
||||
ResourceLocation leafSpriteLocation = leaves.getLeaveSprite(Proxies.render.fancyGraphicsEnabled());
|
||||
TextureAtlasSprite leavesIcon = map.getAtlasSprite(leafSpriteLocation.toString());
|
||||
if (leavesIcon == null) {
|
||||
return;
|
||||
}
|
||||
boolean fancy = Proxies.render.fancyGraphicsEnabled();
|
||||
ResourceLocation leafLocation = leaves.getLeaveSprite(fancy);
|
||||
ResourceLocation fruitLocation = leaves.getFruitSprite();
|
||||
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, leavesIcon, 0);
|
||||
|
||||
// add fruit
|
||||
if (!leaves.hasFruit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ResourceLocation fruitSpriteLocation = leaves.getFruitSprite();
|
||||
if (fruitSpriteLocation != null) {
|
||||
TextureAtlasSprite fruitTexture = map.getAtlasSprite(fruitSpriteLocation.toString());
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, fruitTexture, 1);
|
||||
}
|
||||
return new Key(map.getAtlasSprite(leafLocation.toString()),
|
||||
fruitLocation != null ? map.getAtlasSprite(fruitLocation.toString()) : null,
|
||||
fancy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bakeWorldBlock(@Nonnull BlockForestryLeaves block, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker) {
|
||||
protected Key getWorldKey(@Nonnull IBlockState state) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
|
||||
TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class);
|
||||
boolean fancy = Proxies.render.fancyGraphicsEnabled();
|
||||
|
||||
TextureMap map = Proxies.common.getClientInstance().getTextureMapBlocks();
|
||||
|
||||
if (tile == null) {
|
||||
IAlleleTreeSpecies oakSpecies = TreeDefinition.Oak.getIndividual().getGenome().getPrimary();
|
||||
ResourceLocation spriteLocation = oakSpecies.getLeafSpriteProvider().getSprite(false, Proxies.render.fancyGraphicsEnabled());
|
||||
ResourceLocation spriteLocation = oakSpecies.getLeafSpriteProvider().getSprite(false, fancy);
|
||||
TextureAtlasSprite sprite = map.getAtlasSprite(spriteLocation.toString());
|
||||
baker.setParticleSprite(sprite);
|
||||
return;
|
||||
return new Key(sprite, null, fancy);
|
||||
}
|
||||
|
||||
ResourceLocation leafSpriteLocation = tile.getLeaveSprite(Proxies.render.fancyGraphicsEnabled());
|
||||
TextureAtlasSprite leafSprite = map.getAtlasSprite(leafSpriteLocation.toString());
|
||||
|
||||
ResourceLocation leafLocation = tile.getLeaveSprite(fancy);
|
||||
ResourceLocation fruitLocation = tile.getFruitSprite();
|
||||
|
||||
return new Key(map.getAtlasSprite(leafLocation.toString()),
|
||||
fruitLocation != null ? map.getAtlasSprite(fruitLocation.toString()) : null,
|
||||
fancy);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bakeBlock(@Nonnull BlockForestryLeaves block, @Nonnull Key key, @Nonnull IModelBaker baker, boolean inventory) {
|
||||
// Render the plain leaf block.
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, leafSprite, 0);
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, key.leafSprite, 0);
|
||||
|
||||
// Render overlay for fruit leaves.
|
||||
ResourceLocation fruitSpriteLocation = tile.getFruitSprite();
|
||||
|
||||
if (fruitSpriteLocation != null) {
|
||||
TextureAtlasSprite fruitSprite = map.getAtlasSprite(fruitSpriteLocation.toString());
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, fruitSprite, 1);
|
||||
if (key.fruitSprite != null) {
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, key.fruitSprite, 1);
|
||||
}
|
||||
|
||||
|
||||
// Set the particle sprite
|
||||
baker.setParticleSprite(leafSprite);
|
||||
baker.setParticleSprite(key.leafSprite);
|
||||
}
|
||||
|
||||
public ModelLeaves() {
|
||||
super(BlockForestryLeaves.class);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
@@ -31,6 +32,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.ModelProcessingHelper;
|
||||
@@ -38,14 +40,22 @@ import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelWoodPile extends BlankModel{
|
||||
|
||||
private final Function<ResourceLocation, TextureAtlasSprite> textureGetter = new DefaultTextureGetter();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IModel modelWoodPileItem;
|
||||
private IModel modelWoodPileBlock;
|
||||
private static final Map<String, IBakedModel> blockCache = new HashMap<>();
|
||||
private static final Map<String, IBakedModel> itemCache = new HashMap<>();
|
||||
private static IModel modelWoodPileItem;
|
||||
private static IModel modelWoodPileBlock;
|
||||
private static final Cache<String, IBakedModel> blockCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).build();
|
||||
private static final Cache<String, IBakedModel> itemCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).build();
|
||||
|
||||
/**
|
||||
* Init the model with datas from the ModelBakeEvent.
|
||||
*/
|
||||
public static void onModelBake(ModelBakeEvent event){
|
||||
blockCache.invalidateAll();
|
||||
itemCache.invalidateAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
@@ -103,16 +113,19 @@ public class ModelWoodPile extends BlankModel{
|
||||
}
|
||||
|
||||
private IBakedModel bakeModel(IAlleleTreeSpecies treeSpecies, boolean isItem) {
|
||||
if(treeSpecies == null || treeSpecies.getWoodProvider() == null || treeSpecies.getWoodProvider().getSprite(false) == null){
|
||||
return null;
|
||||
}
|
||||
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
|
||||
String treeUID = treeSpecies.getUID();
|
||||
Map<String, IBakedModel> map = isItem ? itemCache : blockCache;
|
||||
if(!map.containsKey(treeUID)){
|
||||
Cache<String, IBakedModel> map = isItem ? itemCache : blockCache;
|
||||
if(map.getIfPresent(treeUID) == null){
|
||||
textures.put("woodBark", treeSpecies.getWoodProvider().getSprite(false).getIconName());
|
||||
textures.put("woodTop", treeSpecies.getWoodProvider().getSprite(true).getIconName());
|
||||
IModel retextureWoodPile = ModelProcessingHelper.retexture(isItem ? modelWoodPileItem : modelWoodPileBlock, textures.build());
|
||||
map.put(treeUID, retextureWoodPile.bake(ModelRotation.X0_Y0, isItem ? DefaultVertexFormats.ITEM : DefaultVertexFormats.BLOCK, textureGetter));
|
||||
}
|
||||
return map.get(treeUID);
|
||||
return map.getIfPresent(treeUID);
|
||||
}
|
||||
|
||||
private class PileItemOverrideList extends ItemOverrideList {
|
||||
|
||||
@@ -20,9 +20,7 @@ import com.google.gson.stream.JsonReader;
|
||||
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.core.render.FontColour;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -111,18 +111,26 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase
|
||||
if (!isActive()) {
|
||||
return false;
|
||||
}
|
||||
if(woodBurnTime == 0){
|
||||
int comps = 0;
|
||||
if(woodBurnTime == 0 && tickCount % 20 == 0){
|
||||
int validComps = 0;
|
||||
int newBurnTime = 0;
|
||||
for (IMultiblockComponent part : connectedParts) {
|
||||
ICharcoalPileComponent comp = (ICharcoalPileComponent) part;
|
||||
if (comp.getTreeSpecies() != null) {
|
||||
comps++;
|
||||
validComps++;
|
||||
IWoodProvider woodProvider = comp.getTreeSpecies().getWoodProvider();
|
||||
newBurnTime += woodProvider.getCombustibility() * 1000;
|
||||
int charcoalAmount = woodProvider.getCarbonization();
|
||||
while(worldObj.rand.nextFloat() < woodProvider.getCharcoalChance(charcoalAmount)){
|
||||
charcoalAmount++;
|
||||
}
|
||||
newBurnTime += charcoalAmount * 500;
|
||||
}
|
||||
}
|
||||
woodBurnTime = newBurnTime / comps;
|
||||
if(validComps <= 0){
|
||||
woodBurnTime = newBurnTime / validComps;
|
||||
}else{
|
||||
woodBurnTime = 0;
|
||||
}
|
||||
}
|
||||
if (burnTime >= woodBurnTime) {
|
||||
for(IMultiblockComponent part : connectedParts) {
|
||||
@@ -156,8 +164,12 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase
|
||||
|
||||
@Override
|
||||
protected void isMachineWhole() throws MultiblockValidationException {
|
||||
int minX = getSizeLimits().getMinimumXSize();
|
||||
int minY = getSizeLimits().getMinimumYSize();
|
||||
int minZ = getSizeLimits().getMinimumZSize();
|
||||
|
||||
if (connectedParts.size() < getSizeLimits().getMinimumNumberOfBlocksForAssembledMachine()) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocal("multiblock.error.small"));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.small", minX, minY, minZ));
|
||||
}
|
||||
BlockPos maximumCoord = getMaximumCoord();
|
||||
BlockPos minimumCoord = getMinimumCoord();
|
||||
@@ -168,26 +180,23 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase
|
||||
int maxX = getSizeLimits().getMaximumXSize();
|
||||
int maxY = getSizeLimits().getMaximumYSize();
|
||||
int maxZ = getSizeLimits().getMaximumZSize();
|
||||
int minX = getSizeLimits().getMinimumXSize();
|
||||
int minY = getSizeLimits().getMinimumYSize();
|
||||
int minZ = getSizeLimits().getMinimumZSize();
|
||||
if (maxX > 0 && deltaX > maxX) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("multiblock.error.large.x", maxX));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.large.x", maxX));
|
||||
}
|
||||
if (maxY > 0 && deltaY > maxY) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("multiblock.error.large.y", maxY));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.large.y", maxY));
|
||||
}
|
||||
if (maxZ > 0 && deltaZ > maxZ) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("multiblock.error.large.z", maxZ));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.large.z", maxZ));
|
||||
}
|
||||
if (deltaX < minX) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("multiblock.error.small.x", minX));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.small.x", minX));
|
||||
}
|
||||
if (deltaY < minY) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("multiblock.error.small.y", minY));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.small.y", minY));
|
||||
}
|
||||
if (deltaZ < minZ) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("multiblock.error.small.z", minZ));
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.small.z", minZ));
|
||||
}
|
||||
|
||||
TileEntity te;
|
||||
|
||||
@@ -153,6 +153,7 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
}
|
||||
|
||||
loadingExceptions.putAll(WoodModelLoader.loadingExceptions);
|
||||
ModelWoodPile.onModelBake(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ public class WorldGenAcacia extends WorldGenTree {
|
||||
public WorldGenAcacia(ITreeGenData tree) {
|
||||
super(tree, 5, 2);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<BlockPos> generateTrunk(World world, Random rand, TreeBlockTypeLog wood, BlockPos startPos) {
|
||||
@@ -41,20 +41,21 @@ public class WorldGenAcacia extends WorldGenTree {
|
||||
treeTops.addAll(treeTops2);
|
||||
}
|
||||
|
||||
Set<BlockPos> branchEnds = new HashSet<>(treeTops);
|
||||
Set<BlockPos> branchEnds = new HashSet<>();
|
||||
|
||||
for (BlockPos treeTop : treeTops) {
|
||||
int xOffset = treeTop.getX();
|
||||
int yOffset = treeTop.getY() + 1;
|
||||
int yOffset = treeTop.getY() - startPos.getY() + 1;
|
||||
int zOffset = treeTop.getZ();
|
||||
float canopyMultiplier = (1.5f * height - yOffset + 2) / 4.0f;
|
||||
int canopyThickness = Math.max(1, Math.round(yOffset / 10.0f));
|
||||
|
||||
|
||||
branchEnds.add(new BlockPos(xOffset, startPos.getY() + yOffset--, zOffset));
|
||||
yOffset--;
|
||||
|
||||
float canopyWidth = rand.nextBoolean() ? 3.0f : 2.5f;
|
||||
int radius = Math.round(canopyMultiplier * canopyWidth - 4);
|
||||
BlockPos pos = startPos.add(xOffset, yOffset - canopyThickness, zOffset);
|
||||
BlockPos pos = new BlockPos(xOffset, startPos.getY() + yOffset - canopyThickness, zOffset);
|
||||
branchEnds.addAll(WorldGenHelper.generateBranches(world, rand, wood, pos, girth, 0.0f, 0.1f, radius, 2, 1.0f));
|
||||
}
|
||||
|
||||
@@ -64,11 +65,11 @@ public class WorldGenAcacia extends WorldGenTree {
|
||||
@Override
|
||||
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
|
||||
for (BlockPos branchEnd : branchEnds) {
|
||||
int leafSpawn = branchEnd.getY();
|
||||
int leafSpawn = branchEnd.getY() - startPos.getY();
|
||||
int canopyThickness = Math.max(1, Math.round(leafSpawn / 10.0f));
|
||||
float canopyMultiplier = (1.5f * height - leafSpawn + 2) / 4.0f;
|
||||
float canopyWidth = rand.nextBoolean() ? 2.0f : 4.5f;
|
||||
BlockPos center = new BlockPos(branchEnd.getX(), leafSpawn - canopyThickness + 1, branchEnd.getZ());
|
||||
float canopyWidth = rand.nextBoolean() ? 1.0f : 1.5f;
|
||||
BlockPos center = new BlockPos(branchEnd.getX(), leafSpawn - canopyThickness + 1 + startPos.getY(), branchEnd.getZ());
|
||||
float radius = Math.max(1, canopyMultiplier * canopyWidth + girth);
|
||||
WorldGenHelper.generateCylinderFromPos(world, leaf, center, radius, canopyThickness, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import forestry.api.core.ICamouflageAccess;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.core.utils.Log;
|
||||
|
||||
@@ -28,6 +27,7 @@ public class CamouflageAccess implements ICamouflageAccess {
|
||||
|
||||
private static final Map<String, List<ICamouflageItemHandler>> camouflageItemHandlers = new HashMap<>();
|
||||
private static final Map<String, List<ItemStack>> camouflageItemBlacklist = new HashMap<>();
|
||||
private static final Map<String, List<String>> blacklistedMods = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void registerCamouflageItemHandler(@Nonnull ICamouflageItemHandler itemHandler) {
|
||||
@@ -48,12 +48,29 @@ public class CamouflageAccess implements ICamouflageAccess {
|
||||
|
||||
@Override
|
||||
public List<ICamouflageItemHandler> getCamouflageItemHandler(String type) {
|
||||
if(type == null){
|
||||
List<ICamouflageItemHandler> handlers = new ArrayList<>();
|
||||
for(List<ICamouflageItemHandler> handler : camouflageItemHandlers.values()){
|
||||
handlers.addAll(handler);
|
||||
}
|
||||
return handlers;
|
||||
}
|
||||
if(!camouflageItemHandlers.containsKey(type)){
|
||||
return null;
|
||||
}
|
||||
return camouflageItemHandlers.get(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addModIdToBlackList(String type, String modID) {
|
||||
if(!blacklistedMods.containsKey(type)){
|
||||
blacklistedMods.put(type, new ArrayList<>());
|
||||
}
|
||||
if(!blacklistedMods.get(type).contains(modID)){
|
||||
blacklistedMods.get(type).add(modID);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addItemToBlackList(String type, ItemStack camouflageBlock) {
|
||||
if (camouflageBlock == null || camouflageBlock.getItem() == null) {
|
||||
@@ -71,26 +88,44 @@ public class CamouflageAccess implements ICamouflageAccess {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(!camouflageItemBlacklist.containsKey(type)){
|
||||
camouflageItemBlacklist.put(type, new ArrayList<>());
|
||||
}
|
||||
camouflageItemBlacklist.get(type).add(camouflageBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemBlackListed(String type, ItemStack camouflageBlock) {
|
||||
if (camouflageBlock == null || camouflageBlock.getItem() == null || Block.getBlockFromItem(camouflageBlock.getItem()) == null || !camouflageItemBlacklist.containsKey(type)) {
|
||||
if (camouflageBlock == null || camouflageBlock.getItem() == null || Block.getBlockFromItem(camouflageBlock.getItem()) == null || type != null && !camouflageItemBlacklist.containsKey(type)) {
|
||||
return false;
|
||||
}
|
||||
for (ItemStack camouflageBlacklisted : camouflageItemBlacklist.get(type)) {
|
||||
String modId = camouflageBlock.getItem().getRegistryName().getResourceDomain();
|
||||
if(blacklistedMods.get(type) != null && blacklistedMods.get(type).contains(modId)){
|
||||
return true;
|
||||
}
|
||||
List<ItemStack> camouflageItemBlacklisted;
|
||||
if(type == null){
|
||||
camouflageItemBlacklisted = new ArrayList<>();
|
||||
for(List<ItemStack> stacks : camouflageItemBlacklist.values()){
|
||||
camouflageItemBlacklisted.addAll(stacks);
|
||||
}
|
||||
}else{
|
||||
camouflageItemBlacklisted = camouflageItemBlacklist.get(type);
|
||||
}
|
||||
for (ItemStack camouflageBlacklisted : camouflageItemBlacklisted) {
|
||||
if (camouflageBlacklisted.getItem() == camouflageBlock.getItem() && camouflageBlacklisted.getItemDamage() == camouflageBlock.getItemDamage() && ItemStack.areItemStackTagsEqual(camouflageBlock, camouflageBlacklisted)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ICamouflageItemHandler getHandlerFromItem(@Nonnull ItemStack camouflageItem, ICamouflageHandler camouflageHandler){
|
||||
|
||||
@Override
|
||||
public ICamouflageItemHandler getHandlerFromItem(ItemStack stack) {
|
||||
for(List<ICamouflageItemHandler> handlers : camouflageItemHandlers.values()){
|
||||
for(ICamouflageItemHandler handler : handlers){
|
||||
if(handler.canHandle(camouflageItem, camouflageHandler)){
|
||||
if(handler.canHandle(stack)){
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,32 +10,33 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
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.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CamouflageHandlerDefault implements ICamouflageItemHandler {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(ItemStack stack, ICamouflageHandler camouflageHandler) {
|
||||
if(camouflageHandler == null || stack == null || stack.getItem() == null || stack.stackSize <= 0 || Block.getBlockFromItem(stack.getItem()) == null){
|
||||
public boolean canHandle(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() == null || stack.stackSize <= 0 || Block.getBlockFromItem(stack.getItem()) == null){
|
||||
return false;
|
||||
}
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
IBlockState stateFromMeta = block.getStateFromMeta(stack.getItemDamage());
|
||||
|
||||
return stateFromMeta.isOpaqueCube() && !block.hasTileEntity(stateFromMeta) && block.isNormalCube(stateFromMeta, camouflageHandler.getWorld(), camouflageHandler.getCoordinates());
|
||||
return stateFromMeta.isOpaqueCube() && !block.hasTileEntity(stateFromMeta) && block.isNormalCube(stateFromMeta) && block.isFullCube(stateFromMeta) && block.isBlockNormalCube(stateFromMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +58,7 @@ public class CamouflageHandlerDefault implements ICamouflageItemHandler {
|
||||
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
IBlockState state = block.getStateFromMeta(stack.getItemDamage());
|
||||
|
||||
|
||||
return Pair.of(state, modelShapes.getModelForState(state));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import jline.internal.Log;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -26,6 +28,7 @@ import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -33,8 +36,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class CamouflageHandlerDoor implements ICamouflageItemHandler {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(ItemStack stack, ICamouflageHandler camouflageHandler) {
|
||||
if(camouflageHandler == null || stack == null || stack.getItem() == null || stack.stackSize <= 0){
|
||||
public boolean canHandle(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() == null || stack.stackSize <= 0){
|
||||
return false;
|
||||
}
|
||||
if(stack.getItem() instanceof ItemDoor){
|
||||
@@ -59,23 +62,27 @@ public class CamouflageHandlerDoor implements ICamouflageItemHandler {
|
||||
if(camouflageHandler == null || stack == null || stack.getItem() == null || stack.stackSize <= 0 || !(stack.getItem() instanceof ItemDoor)){
|
||||
return null;
|
||||
}
|
||||
World world = camouflageHandler.getWorld();
|
||||
World world = camouflageHandler.getWorldObj();
|
||||
BlockPos pos = camouflageTile.getCoordinates();
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
IBlockState currentState = blockState.getActualState(world, pos);
|
||||
|
||||
|
||||
ItemDoor itemDoor = (ItemDoor) stack.getItem();
|
||||
Block doorBlock = ObfuscationReflectionHelper.getPrivateValue(ItemDoor.class, itemDoor, 0);
|
||||
|
||||
|
||||
if(doorBlock == null){
|
||||
Log.error("Can't render Door : block is null for" + stack);
|
||||
return null;
|
||||
}
|
||||
IBlockState doorState = doorBlock.getDefaultState()
|
||||
.withProperty(BlockDoor.FACING, currentState.getValue(BlockDoor.FACING))
|
||||
.withProperty(BlockDoor.HINGE, currentState.getValue(BlockDoor.HINGE))
|
||||
.withProperty(BlockDoor.OPEN, currentState.getValue(BlockDoor.OPEN))
|
||||
.withProperty(BlockDoor.POWERED, currentState.getValue(BlockDoor.POWERED))
|
||||
.withProperty(BlockDoor.HALF, currentState.getValue(BlockDoor.HALF));
|
||||
|
||||
|
||||
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
|
||||
|
||||
|
||||
return Pair.of(doorState, modelShapes.getModelForState(doorState));
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 322 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user