mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
202d19df93 | ||
|
|
333334190a | ||
|
|
7c00ea2965 | ||
|
|
79cf866a96 | ||
|
|
504ec8acfc | ||
|
|
44a926f897 | ||
|
|
30d7365518 | ||
|
|
56800af94d | ||
|
|
043571b659 | ||
|
|
7fd2776147 | ||
|
|
d4c2d7220d | ||
|
|
d392666dc4 | ||
|
|
07b88d36fc | ||
|
|
408d1dc7c3 | ||
|
|
7b1aead339 | ||
|
|
21969649a2 | ||
|
|
f9b8b89340 | ||
|
|
65712adcb3 | ||
|
|
9864a84a13 | ||
|
|
8f9ae45147 | ||
|
|
2965f28403 | ||
|
|
cb93c217e0 | ||
|
|
219e9bf355 | ||
|
|
43a2f0ae76 | ||
|
|
098b739dca | ||
|
|
4dfa29b1ad | ||
|
|
60d2820ed6 | ||
|
|
91ec6cff9b | ||
|
|
1775e59880 | ||
|
|
f62745b233 | ||
|
|
1d6293c788 | ||
|
|
3fd07f2a7a | ||
|
|
856e800e0e | ||
|
|
d9561fd7af | ||
|
|
e0623f7d57 | ||
|
|
d48b979ac3 | ||
|
|
63494c40a7 | ||
|
|
2c57aef3b3 | ||
|
|
1392823fae | ||
|
|
67693961ac | ||
|
|
8ad8597ff0 | ||
|
|
4c8d5e2f43 | ||
|
|
d04713339c | ||
|
|
844aea7431 | ||
|
|
53a9bf458e | ||
|
|
2ae52451b2 | ||
|
|
d3054c33e7 | ||
|
|
bf61462a2a | ||
|
|
41f3ae4b1f | ||
|
|
b1d7c1721d | ||
|
|
2944165741 | ||
|
|
e316526675 | ||
|
|
411cbd913c | ||
|
|
2191d00f3d | ||
|
|
a02af0ddf2 | ||
|
|
a8e4f5dde7 | ||
|
|
85718b1df8 | ||
|
|
781b4d883b | ||
|
|
c5c056750a | ||
|
|
3b8af4e4c9 | ||
|
|
f58938ff32 | ||
|
|
a05bc13852 | ||
|
|
1cd3e15ef9 | ||
|
|
1ac7a7de42 | ||
|
|
90ed57c742 | ||
|
|
94b0b44f51 | ||
|
|
c0fafc20da | ||
|
|
4f85236475 | ||
|
|
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 |
No files matched your search
+8
-11
@@ -1,14 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
@@ -16,11 +9,10 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "net.minecraftforge.gradle.forge" version "2.0.2"
|
||||
id "com.matthewprenger.cursegradle" version "1.0.7"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'maven'
|
||||
|
||||
version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
|
||||
@@ -98,6 +90,9 @@ processResources {
|
||||
exclude 'mcmod.info'
|
||||
exclude '**/*.md'
|
||||
}
|
||||
|
||||
// Move access transformers to META-INF
|
||||
rename '(.+_at.cfg)', 'META-INF/$1'
|
||||
}
|
||||
|
||||
// prevent java 8's strict doclint for javadocs from failing builds
|
||||
@@ -108,7 +103,9 @@ allprojects {
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
manifest {
|
||||
attributes 'FMLAT': 'forestry_at.cfg'
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.1.2080
|
||||
mcp_mappings=snapshot_20160525
|
||||
forgeversion=12.18.2.2125
|
||||
mcp_mappings=snapshot_20161111
|
||||
|
||||
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.13.2.349
|
||||
ic2_version=2.6.76-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=2
|
||||
version_patch=12
|
||||
version_patch=17
|
||||
+1
-1
Submodule lang updated: a31d99f6f6...e919e4ad51.
@@ -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
|
||||
@@ -53,7 +52,7 @@ import forestry.plugins.PluginManager;
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.10]",
|
||||
dependencies = "required-after:Forge@[12.18.1.2080,);"
|
||||
+ "after:JEI@[3.8.0,);"
|
||||
+ "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);
|
||||
}
|
||||
@@ -13,9 +13,9 @@ import java.util.Set;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
|
||||
/**
|
||||
@@ -85,8 +85,8 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
ITree retrievePollen(IBeeHousing housing);
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
|
||||
boolean pollinateRandom(IBeeHousing housing, ITree pollen);
|
||||
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
@@ -20,9 +22,11 @@ import forestry.api.genetics.IGenome;
|
||||
public interface IBeeGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleBeeSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleBeeSpecies getSecondary();
|
||||
|
||||
float getSpeed();
|
||||
|
||||
@@ -5,33 +5,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
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();
|
||||
@@ -39,15 +35,14 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvid
|
||||
int getBlockLightValue();
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
boolean isRaining();
|
||||
|
||||
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
|
||||
|
||||
@@ -26,4 +26,12 @@ public interface IGermlingModelProvider {
|
||||
|
||||
@Nonnull
|
||||
ModelResourceLocation getModel(EnumGermlingType type);
|
||||
|
||||
/**
|
||||
* Provides color for sapling. See {@link ILeafSpriteProvider} for pollen color.
|
||||
* @param type the germling type to render
|
||||
* @param renderPass renderPass of rendering
|
||||
* @return sapling color for renderPass
|
||||
*/
|
||||
int getSpriteColor(EnumGermlingType type, int renderPass);
|
||||
}
|
||||
@@ -12,9 +12,11 @@ import forestry.api.genetics.IGenome;
|
||||
public interface ITreeGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleTreeSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleTreeSpecies getSecondary();
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -13,13 +14,13 @@ import java.util.List;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesRootPollinatable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ITreeRoot extends ISpeciesRoot {
|
||||
public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
|
||||
@Override
|
||||
boolean isMember(ItemStack itemstack);
|
||||
@@ -78,7 +79,7 @@ public interface ITreeRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, BlockPos pos);
|
||||
boolean setFruitBlock(@Nonnull World world, @Nonnull IAlleleFruit allele, float sappiness, BlockPos pos);
|
||||
|
||||
/* GAME MODE */
|
||||
List<ITreekeepingMode> getTreekeepingModes();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ public interface IClimateManager {
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
@Nonnull
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
void addRegion(IClimateRegion region);
|
||||
@@ -30,6 +31,9 @@ public interface IClimateManager {
|
||||
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegionForPos(World world, BlockPos pos);
|
||||
|
||||
|
||||
@@ -13,8 +13,9 @@ public interface IClimateSource {
|
||||
/**
|
||||
* @param tickCount The current tick count.
|
||||
* @param region The climate region, in that the source stands.
|
||||
* @return Return true if the the climate has changed.
|
||||
*/
|
||||
void changeClimate(int tickCount, IClimateRegion region);
|
||||
boolean changeClimate(int tickCount, IClimateRegion region);
|
||||
|
||||
/**
|
||||
* @return The ticks that are required for one change.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,8 @@ 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);
|
||||
|
||||
@@ -26,6 +26,7 @@ public interface ICamouflageHandler extends ILocatable {
|
||||
|
||||
/**
|
||||
* Set the camouflage block item for the type.
|
||||
* @return True if the block has chanced.
|
||||
*/
|
||||
void setCamouflageBlock(String type, ItemStack camouflageBlock);
|
||||
boolean setCamouflageBlock(String type, ItemStack camouflageBlock, boolean sendClientUpdate);
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -27,7 +26,10 @@ public interface IErrorState {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerSprite();
|
||||
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
/**
|
||||
* Sprite registered to the Gui Texture Map at {@link ITextureManager}
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSprite();
|
||||
|
||||
}
|
||||
@@ -6,13 +6,29 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Get the instance from {@link ForestryAPI#textureManager}.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface ITextureManager {
|
||||
|
||||
/**
|
||||
* Location of the Forestry Gui Texture Map.
|
||||
* Used for binding with {@link net.minecraft.client.renderer.texture.TextureManager#bindTexture(ResourceLocation)}
|
||||
*/
|
||||
ResourceLocation getGuiTextureMap();
|
||||
|
||||
/**
|
||||
* Get a texture atlas sprite that has been registered by Forestry, for Forestry's Gui Texture Map.
|
||||
*/
|
||||
TextureAtlasSprite getDefault(String ident);
|
||||
|
||||
/**
|
||||
* Register a sprite with Forestry's Gui Texture Map.
|
||||
*/
|
||||
TextureAtlasSprite registerGuiSprite(ResourceLocation location);
|
||||
}
|
||||
@@ -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 = "Forestry", provides = "ForestryAPI|core")
|
||||
@API(apiVersion = "5.1.0", owner = "Forestry", provides = "ForestryAPI|core")
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -8,6 +8,10 @@ package forestry.api.farming;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class Farmables {
|
||||
@@ -18,5 +22,8 @@ public class Farmables {
|
||||
*/
|
||||
@Nonnull
|
||||
public static final Multimap<String, IFarmable> farmables = HashMultimap.create();
|
||||
|
||||
@Nonnull
|
||||
public static final LinkedHashMap<ItemStack, Integer> fertilizers = new LinkedHashMap();
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
/**
|
||||
@@ -28,7 +27,7 @@ public interface ICheckPollinatable {
|
||||
/**
|
||||
* @return IIndividual containing the genetic information of this IPollinatable
|
||||
*/
|
||||
ITree getPollen();
|
||||
IIndividual getPollen();
|
||||
|
||||
/**
|
||||
* Checks whether this can mate with the given pollen.
|
||||
@@ -38,7 +37,7 @@ public interface ICheckPollinatable {
|
||||
* @param pollen IIndividual representing the pollen.
|
||||
* @return true if mating is possible, false otherwise.
|
||||
*/
|
||||
boolean canMateWith(ITree pollen);
|
||||
boolean canMateWith(IIndividual pollen);
|
||||
|
||||
/**
|
||||
* @return true if this has already been pollinated.
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
@@ -14,17 +16,23 @@ import forestry.api.core.INbtWritable;
|
||||
*/
|
||||
public interface IGenome extends INbtWritable {
|
||||
|
||||
@Nonnull
|
||||
IAlleleSpecies getPrimary();
|
||||
|
||||
@Nonnull
|
||||
IAlleleSpecies getSecondary();
|
||||
|
||||
@Nonnull
|
||||
IChromosome[] getChromosomes();
|
||||
|
||||
@Nonnull
|
||||
IAllele getActiveAllele(IChromosomeType chromosomeType);
|
||||
|
||||
@Nonnull
|
||||
IAllele getInactiveAllele(IChromosomeType chromosomeType);
|
||||
|
||||
boolean isGeneticEqual(IGenome other);
|
||||
|
||||
|
||||
@Nonnull
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
}
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
/**
|
||||
* Can be implemented by tile entities, if they wish to be pollinatable.
|
||||
*
|
||||
@@ -20,5 +18,5 @@ public interface IPollinatable extends ICheckPollinatable {
|
||||
* @param pollen
|
||||
* IIndividual representing the pollen.
|
||||
*/
|
||||
void mateWith(ITree pollen);
|
||||
void mateWith(IIndividual pollen);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* @since 5.12.16
|
||||
* @author Nedelosk
|
||||
*/
|
||||
public interface ISpeciesRootPollinatable extends ISpeciesRoot {
|
||||
|
||||
ICheckPollinatable createPollinatable(IIndividual individual);
|
||||
|
||||
IPollinatable tryConvertToPollinatable(GameProfile owner, World world, final BlockPos pos, final IIndividual pollen);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IGenome;
|
||||
@@ -12,9 +14,11 @@ import forestry.api.genetics.IGenome;
|
||||
public interface IButterflyGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleButterflySpecies getPrimary();
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleButterflySpecies getSecondary();
|
||||
|
||||
float getSize();
|
||||
|
||||
@@ -8,7 +8,7 @@ package forestry.api.lepidopterology;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IEntityButterfly extends IAnimals {
|
||||
|
||||
@@ -23,9 +23,9 @@ public interface IEntityButterfly extends IAnimals {
|
||||
*/
|
||||
EntityCreature getEntity();
|
||||
|
||||
ITree getPollen();
|
||||
IIndividual getPollen();
|
||||
|
||||
void setPollen(ITree pollen);
|
||||
void setPollen(IIndividual pollen);
|
||||
|
||||
boolean canMateWith(IEntityButterfly butterfly);
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -31,6 +31,10 @@ public interface IPostalCarrier {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sprite registered to the Gui Texture Map at {@link ITextureManager}.
|
||||
* Must be 26 pixels wide and 15 pixels tall. The texture itself must be 32x32 square.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSprite();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|mail")
|
||||
@API(apiVersion = "3.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|mail")
|
||||
package forestry.api.mail;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,10 +39,10 @@ import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -195,7 +196,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
queenStack = null;
|
||||
}
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(this.queenStack, queenStack)) {
|
||||
if (this.queenStack != queenStack) {
|
||||
this.queen = BeeManager.beeRoot.getMember(queenStack);
|
||||
this.queenStack = queenStack;
|
||||
hasFlowersCache.clear();
|
||||
@@ -486,6 +487,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
@Override
|
||||
public boolean canDoBeeFX() {
|
||||
if(Proxies.common.getClientInstance().isGamePaused()){
|
||||
return false;
|
||||
}
|
||||
return active;
|
||||
}
|
||||
|
||||
@@ -528,7 +532,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
private static class PollenHandler {
|
||||
private static final int MAX_POLLINATION_ATTEMPTS = 20;
|
||||
|
||||
private ITree pollen;
|
||||
private IIndividual pollen;
|
||||
private int attemptedPollinations = 0;
|
||||
|
||||
public void doPollination(IBee queen, IBeeHousing beeHousing, IBeeListener beeListener) {
|
||||
|
||||
@@ -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
|
||||
@@ -313,6 +320,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
// Register acceptable plants
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DRAGON_EGG, FlowerManager.FlowerTypeEnd);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.CHORUS_PLANT, FlowerManager.FlowerTypeEnd);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.CHORUS_FLOWER, FlowerManager.FlowerTypeEnd);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.VINE, FlowerManager.FlowerTypeJungle);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.TALLGRASS, FlowerManager.FlowerTypeJungle);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.WHEAT, FlowerManager.FlowerTypeWheat);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -120,7 +120,8 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if (((TileCandle) world.getTileEntity(pos)).isLit()) {
|
||||
TileCandle tileCandle = TileUtil.getTile(world, pos, TileCandle.class);
|
||||
if (tileCandle != null && tileCandle.isLit()) {
|
||||
state = state.withProperty(STATE, State.ON);
|
||||
}
|
||||
return super.getActualState(state, world, pos);
|
||||
@@ -286,6 +287,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 +328,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,12 +129,17 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
|
||||
@Override
|
||||
public int getBlockLightValue() {
|
||||
return worldObj.getLightFromNeighbors(getPosition().add(0, +1, 0));
|
||||
return worldObj.getLightFromNeighbors(getPosition().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return worldObj.canBlockSeeSky(getPosition().add(0, +1, 0));
|
||||
return worldObj.canBlockSeeSky(getPosition().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaining() {
|
||||
return worldObj.isRainingAt(getPosition().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -167,6 +167,9 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
for (BlockPos.MutableBlockPos posBlock : VectUtil.getAllInBoxFromCenterMutable(world, minPos, beeHousing.getCoordinates(), maxPos)) {
|
||||
if (!world.isBlockLoaded(posBlock)) {
|
||||
continue;
|
||||
}
|
||||
IBlockState blockState = world.getBlockState(posBlock);
|
||||
if (blockState.getBlock().isAir(blockState, world, posBlock)) {
|
||||
continue;
|
||||
@@ -194,6 +197,9 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(String flowerType, World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos)) {
|
||||
return true; // Avoid actually checking until the flower's position is loaded.
|
||||
}
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
Set<IFlowerAcceptableRule> acceptedCustom = this.registeredRules.get(flowerType);
|
||||
for (IFlowerAcceptableRule acceptableFlower : acceptedCustom) {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
if (!world.isAirBlock(pos)) {
|
||||
if (!world.isBlockLoaded(pos) || !world.isAirBlock(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ public class GrowthRuleFertilize implements IFlowerGrowthRule {
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, BlockPos pos) {
|
||||
if (!world.isBlockLoaded(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block ground = state.getBlock();
|
||||
int groundMeta;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GrowthRuleMycelium implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
if (!world.isAirBlock(pos)) {
|
||||
if (!world.isBlockLoaded(pos) || !world.isAirBlock(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GrowthRuleSnow implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
if (world.getBlockState(pos).getBlock() != Blocks.SNOW) {
|
||||
if (!world.isBlockLoaded(pos) || world.getBlockState(pos).getBlock() != Blocks.SNOW) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
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 +246,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<>();
|
||||
@@ -256,7 +253,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
// / Rain needs tolerant flyers
|
||||
if (world.isRainingAt(housingCoords.up()) && !canFlyInRain(beeModifier)) {
|
||||
if (housing.isRaining() && !canFlyInRain(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.IS_RAINING);
|
||||
}
|
||||
|
||||
@@ -282,7 +279,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);
|
||||
}
|
||||
@@ -668,7 +665,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
/* FLOWERS */
|
||||
@Override
|
||||
public ITree retrievePollen(IBeeHousing housing) {
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
@@ -686,7 +683,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Vec3i offset = new Vec3i(-area.getX() / 2, -area.getY() / 4, -area.getZ() / 2);
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
|
||||
ITree pollen = null;
|
||||
IIndividual pollen = null;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
BlockPos randomPos = VectUtil.getRandomPositionInArea(random, area);
|
||||
@@ -711,7 +708,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pollinateRandom(IBeeHousing housing, ITree pollen) {
|
||||
public boolean pollinateRandom(IBeeHousing housing, IIndividual pollen) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
|
||||
@@ -98,11 +98,13 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
|
||||
// / INFORMATION RETRIEVAL
|
||||
@Override
|
||||
@Nonnull
|
||||
public IAlleleBeeSpecies getPrimary() {
|
||||
return (IAlleleBeeSpecies) getActiveAllele(EnumBeeChromosome.SPECIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IAlleleBeeSpecies getSecondary() {
|
||||
return (IAlleleBeeSpecies) getInactiveAllele(EnumBeeChromosome.SPECIES);
|
||||
}
|
||||
@@ -168,6 +170,7 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,13 @@ public class AlleleEffectFertile extends AlleleEffectThrottled {
|
||||
int blockMinY = housingCoordinates.getY() - area.getY() / 2 - 1;
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
if (tryTickColumn(world, blockX, blockZ, blockMaxY, blockMinY)) {
|
||||
break;
|
||||
if (world.getChunkProvider().getLoadedChunk(blockX >> 4, blockZ >> 4) != null) {
|
||||
if (tryTickColumn(world, blockX, blockZ, blockMaxY, blockMinY)) {
|
||||
break;
|
||||
}
|
||||
blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
|
||||
blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
|
||||
}
|
||||
blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
|
||||
blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
|
||||
}
|
||||
|
||||
return storedData;
|
||||
|
||||
@@ -61,12 +61,14 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
BlockPos pos = VectUtil.getRandomPositionInArea(world.rand, area).subtract(halfArea).add(housingCoordinates);
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
if (world.isBlockLoaded(pos)) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
|
||||
if (convertToMycelium(world, blockState, pos)) {
|
||||
return;
|
||||
} else if (growGiantMushroom(world, blockState, pos)) {
|
||||
return;
|
||||
if (convertToMycelium(world, blockState, pos)) {
|
||||
return;
|
||||
} else if (growGiantMushroom(world, blockState, pos)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,16 +52,14 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
BlockPos posBlock = VectUtil.add(randomPos, housingCoords, offset);
|
||||
|
||||
// Freeze water
|
||||
Block block = world.getBlockState(posBlock).getBlock();
|
||||
if (block != Blocks.WATER) {
|
||||
continue;
|
||||
if (world.isBlockLoaded(posBlock)) {
|
||||
Block block = world.getBlockState(posBlock).getBlock();
|
||||
if (block == Blocks.WATER) {
|
||||
if (world.isAirBlock(new BlockPos(posBlock.getX(), posBlock.getY() + 1, posBlock.getZ()))) {
|
||||
world.setBlockState(posBlock, Blocks.ICE.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isAirBlock(new BlockPos(posBlock.getX(), posBlock.getY() + 1, posBlock.getZ()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.setBlockState(posBlock, Blocks.ICE.getDefaultState());
|
||||
}
|
||||
|
||||
return storedData;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (world.isAirBlock(posBlock)) {
|
||||
if (!world.isBlockLoaded(posBlock) || world.isAirBlock(posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
|
||||
BlockPos posBlock = randomPos.add(housing.getCoordinates());
|
||||
posBlock = posBlock.add(offset);
|
||||
if (!world.isBlockLoaded(posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Put snow on the ground
|
||||
if (!world.isSideSolid(new BlockPos(posBlock.getX(), posBlock.getY() - 1, posBlock.getZ()), EnumFacing.UP, false)) {
|
||||
|
||||
@@ -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"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,6 @@ import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -70,7 +68,7 @@ public class HabitatSlot extends Widget {
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Proxies.render.bindTexture(TextureManager.getInstance().getGuiTextureMap());
|
||||
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, getIcon(), 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ 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;
|
||||
@@ -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
|
||||
@@ -399,6 +397,12 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
BlockPos topCenter = getTopCenterCoord();
|
||||
return worldObj.canBlockSeeSky(topCenter.add(0, 2, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaining() {
|
||||
BlockPos topCenter = getTopCenterCoord();
|
||||
return worldObj.isRainingAt(topCenter.add(0, 2, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTemperatureChange(float change, float boundaryDown, float boundaryUp) {
|
||||
@@ -429,6 +433,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 +444,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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,6 +66,11 @@ public class FakeAlvearyController extends FakeMultiblockController implements I
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaining() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
|
||||
@@ -135,6 +135,11 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return getMultiblockLogic().getController().canBlockSeeTheSky();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaining() {
|
||||
return getMultiblockLogic().getController().isRaining();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
|
||||
@@ -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
|
||||
@@ -179,6 +185,11 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return worldObj.canBlockSeeSky(getPos().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaining() {
|
||||
return worldObj.isRainingAt(getPos().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
|
||||
@@ -331,6 +331,11 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return true; // hives may have the sky obstructed but should still be active
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaining() {
|
||||
return worldObj.isRainingAt(getPos().up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorldObj() {
|
||||
|
||||
@@ -15,27 +15,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
@@ -62,6 +41,25 @@ import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
|
||||
public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
@@ -88,13 +86,15 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
}
|
||||
|
||||
private void createBuildingBlocks(Random random) {
|
||||
boolean fireproof = random.nextInt(4) == 0;
|
||||
IWoodType woodType;
|
||||
boolean fireproof;
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
woodType = EnumForestryWoodType.getRandom(random);
|
||||
fireproof = random.nextInt(4) == 0;
|
||||
} else {
|
||||
woodType = EnumVanillaWoodType.getRandom(random);
|
||||
fireproof = false;
|
||||
}
|
||||
|
||||
IWoodAccess woodAccess = TreeManager.woodAccess;
|
||||
@@ -107,9 +107,9 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
this.fenceGate = woodAccess.getBlock(woodType, WoodBlockKind.FENCE_GATE, fireproof);
|
||||
}
|
||||
|
||||
public static VillageApiaristHouse buildComponent(StructureVillagePieces.Start startPiece, List<StructureComponent> par1List, Random random, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType) {
|
||||
public static VillageApiaristHouse buildComponent(StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType) {
|
||||
StructureBoundingBox bbox = StructureBoundingBox.getComponentToAddBoundingBox(structureMinX, structureMinY, structureMinZ, -4, 0, 0, 12, 9, 12, facing);
|
||||
if (!canVillageGoDeeper(bbox) || StructureComponent.findIntersecting(par1List, bbox) != null) {
|
||||
if (!canVillageGoDeeper(bbox) || StructureComponent.findIntersecting(pieces, bbox) != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
private void buildGarden(World world, StructureBoundingBox box) {
|
||||
|
||||
Block ground = Blocks.DIRT;
|
||||
if (field_189928_h == 1) { // desert
|
||||
if (structureType == 1) { // desert
|
||||
ground = Blocks.SAND;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
private void plantFlowerGarden(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
||||
|
||||
if (field_189928_h == 1) { // desert
|
||||
if (structureType == 1) { // desert
|
||||
setBlockState(world, Blocks.CACTUS.getDefaultState(), 4, 1, 7, box);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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,17 @@ 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
|
||||
public void disabledSetupAPI() {
|
||||
TreeManager.woodAccess = new WoodAccess();
|
||||
|
||||
// Capabilities
|
||||
CapabilityManager.INSTANCE.register(IArmorNaturalist.class, new NullStorage<>(), () -> ArmorNaturalist.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -419,7 +433,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
//Dirt Pile Block
|
||||
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);
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.DIRT), 4), Items.CLAY_BALL, PluginCore.items.fertilizerBio, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, PluginCore.items.fertilizerBio, Items.CLAY_BALL);
|
||||
|
||||
}
|
||||
|
||||
@@ -533,10 +547,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) {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package forestry.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
@@ -19,16 +18,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockNewLog;
|
||||
import net.minecraft.block.BlockOldLog;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.BlockWoodSlab;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
import forestry.api.arboriculture.IWoodAccess;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
@@ -41,7 +30,15 @@ import forestry.arboriculture.blocks.log.BlockForestryLog;
|
||||
import forestry.arboriculture.blocks.planks.BlockForestryPlanks;
|
||||
import forestry.arboriculture.blocks.property.PropertyWoodType;
|
||||
import forestry.arboriculture.blocks.slab.BlockForestrySlab;
|
||||
import forestry.core.utils.Log;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockNewLog;
|
||||
import net.minecraft.block.BlockOldLog;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.BlockWoodSlab;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class WoodAccess implements IWoodAccess {
|
||||
private static final Map<WoodBlockKind, WoodMap> woodMaps = new EnumMap<>(WoodBlockKind.class);
|
||||
@@ -242,8 +239,8 @@ public class WoodAccess implements IWoodAccess {
|
||||
WoodMap woodMap = woodMaps.get(woodBlockKind);
|
||||
ItemStack itemStack = woodMap.getItem(fireproof).get(woodType);
|
||||
if (itemStack == null) {
|
||||
Log.error("No stack found for {} {} {}", woodType, woodMap.getName(), fireproof ? "fireproof" : "");
|
||||
return null;
|
||||
String errMessage = String.format("No stack found for %s %s %s", woodType, woodMap.getName(), fireproof ? "fireproof" : "non-fireproof");
|
||||
throw new IllegalStateException(errMessage);
|
||||
}
|
||||
return itemStack.copy();
|
||||
}
|
||||
@@ -256,8 +253,8 @@ public class WoodAccess implements IWoodAccess {
|
||||
WoodMap woodMap = woodMaps.get(woodBlockKind);
|
||||
IBlockState blockState = woodMap.getBlock(fireproof).get(woodType);
|
||||
if (blockState == null) {
|
||||
Log.error("No block found for {} {} {}", woodType, woodMap.getName(), fireproof ? "fireproof" : "non-fireproof");
|
||||
return null;
|
||||
String errMessage = String.format("No block found for %s %s %s", woodType, woodMap.getName(), fireproof ? "fireproof" : "non-fireproof");
|
||||
throw new IllegalStateException(errMessage);
|
||||
}
|
||||
return blockState;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -52,10 +52,6 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
protected static final AxisAlignedBB SAPLING_AABB = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
|
||||
/* PROPERTYS */
|
||||
public static final PropertyTree TREE = new PropertyTree("tree");
|
||||
|
||||
public static TileSapling getSaplingTile(IBlockAccess world, BlockPos pos) {
|
||||
return TileUtil.getTile(world, pos, TileSapling.class);
|
||||
}
|
||||
|
||||
public BlockSapling() {
|
||||
super(Material.PLANTS);
|
||||
@@ -105,7 +101,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileSapling sapling = getSaplingTile(world, pos);
|
||||
TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
if(sapling != null && sapling.getTree() != null){
|
||||
state = state.withProperty(TREE, sapling.getTree().getGenome().getPrimary());
|
||||
}else{
|
||||
@@ -135,7 +131,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
|
||||
/* PLANTING */
|
||||
public static boolean canBlockStay(IBlockAccess world, BlockPos pos) {
|
||||
TileSapling tile = getSaplingTile(world, pos);
|
||||
TileSapling tile = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -165,7 +161,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
TileSapling sapling = getSaplingTile(world, pos);
|
||||
TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
if (sapling == null || sapling.getTree() == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -188,7 +184,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
return;
|
||||
}
|
||||
|
||||
TileSapling sapling = getSaplingTile(world, pos);
|
||||
TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
if (sapling != null && sapling.getTree() != null) {
|
||||
ItemStack saplingStack = TreeManager.treeRoot.getMemberStack(sapling.getTree(), EnumGermlingType.SAPLING);
|
||||
ItemStackUtil.dropItemStackAsEntity(saplingStack, world, pos);
|
||||
@@ -202,7 +198,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
if (world.rand.nextFloat() >= 0.45F) {
|
||||
return false;
|
||||
}
|
||||
TileSapling saplingTile = getSaplingTile(world, pos);
|
||||
TileSapling saplingTile = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
if (saplingTile != null) {
|
||||
return saplingTile.canAcceptBoneMeal(rand);
|
||||
}
|
||||
@@ -216,7 +212,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
|
||||
@Override
|
||||
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
TileSapling saplingTile = getSaplingTile(world, pos);
|
||||
TileSapling saplingTile = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
if (saplingTile != null) {
|
||||
saplingTile.tryGrow(rand, true);
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -138,14 +138,6 @@ public class TreeAlyzerPlugin implements IAlyzerPlugin {
|
||||
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);
|
||||
guiAlyzer.drawLine(Integer.toString(activeCombustibility), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
guiAlyzer.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);
|
||||
|
||||
@@ -967,7 +967,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
this.branch = branch;
|
||||
|
||||
ILeafSpriteProvider leafIconProvider = TreeManager.treeFactory.getLeafIconProvider(leafType, primary, secondary);
|
||||
IGermlingModelProvider germlingIconProvider = ModelProviderFactory.create(woodType, uid);
|
||||
IGermlingModelProvider germlingIconProvider = ModelProviderFactory.create(woodType, uid, leafIconProvider);
|
||||
IWoodProvider woodProvider = WoodProviderFactory.create(woodType);
|
||||
|
||||
IAlleleTreeSpeciesBuilder speciesBuilder = TreeManager.treeFactory.createSpecies(uid, unlocalizedName, "Sengir", unlocalizedDescription, dominant, branch.getBranch(), binomial, Constants.MOD_ID, leafIconProvider, germlingIconProvider, woodProvider, this);
|
||||
|
||||
@@ -53,11 +53,13 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IAlleleTreeSpecies getPrimary() {
|
||||
return (IAlleleTreeSpecies) getActiveAllele(EnumTreeChromosome.SPECIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IAlleleTreeSpecies getSecondary() {
|
||||
return (IAlleleTreeSpecies) getInactiveAllele(EnumTreeChromosome.SPECIES);
|
||||
}
|
||||
@@ -104,6 +106,7 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return TreeManager.treeRoot;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -34,15 +35,19 @@ import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlyzerPlugin;
|
||||
import forestry.api.genetics.ICheckPollinatable;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.arboriculture.blocks.BlockFruitPod;
|
||||
import forestry.arboriculture.blocks.BlockSapling;
|
||||
import forestry.arboriculture.genetics.pollination.CheckPollinatableTree;
|
||||
import forestry.arboriculture.tiles.TileFruitPod;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -235,7 +240,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, BlockPos pos) {
|
||||
public boolean setFruitBlock(@Nonnull World world, @Nonnull IAlleleFruit allele, float sappiness, BlockPos pos) {
|
||||
|
||||
EnumFacing facing = BlockUtil.getValidPodFacing(world, pos);
|
||||
if (facing == null) {
|
||||
@@ -428,4 +433,23 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot {
|
||||
return TreeAlyzerPlugin.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICheckPollinatable createPollinatable(IIndividual individual) {
|
||||
if(individual instanceof ITree){
|
||||
return new CheckPollinatableTree((ITree)individual);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPollinatable tryConvertToPollinatable(GameProfile owner, World world, BlockPos pos, IIndividual pollen) {
|
||||
if(pollen instanceof ITree){
|
||||
if (Config.pollinateVanillaTrees) {
|
||||
((ITree)pollen).setLeaves(world, owner, pos);
|
||||
return (IPollinatable) world.getTileEntity(pos);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -140,10 +140,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getGermlingColour(EnumGermlingType type, int renderPass) {
|
||||
if (type != EnumGermlingType.POLLEN) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
return getSpriteColour(renderPass);
|
||||
return germlingModelProvider.getSpriteColor(type, renderPass);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
+9
-5
@@ -12,6 +12,7 @@ package forestry.arboriculture.genetics.pollination;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.ICheckPollinatable;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
@@ -33,12 +34,15 @@ public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(ITree pollen) {
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
public boolean canMateWith(IIndividual pollen) {
|
||||
if(pollen instanceof ITree){
|
||||
if (tree.getMate() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !tree.isGeneticEqual(pollen);
|
||||
}
|
||||
|
||||
return !tree.isGeneticEqual(pollen);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loaded 100 of 332 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user