mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76f09be39d | ||
|
|
e6cb758e0e | ||
|
|
b3549edf51 | ||
|
|
e09d159935 | ||
|
|
4cb2610b1c | ||
|
|
c44f11cf09 | ||
|
|
b69c31ed8a | ||
|
|
6a2231f8fb | ||
|
|
a3a6c71c42 | ||
|
|
8d5c0c6f8b | ||
|
|
56603fd00c | ||
|
|
ed69411d2e | ||
|
|
e1d017f077 | ||
|
|
9269af7a13 | ||
|
|
8ffdba5021 | ||
|
|
e00aecd886 | ||
|
|
98f859f2fb | ||
|
|
55a15d23b2 | ||
|
|
307580aed8 | ||
|
|
d2d93004e0 | ||
|
|
e1df424bfd | ||
|
|
6a75347b05 | ||
|
|
cfd513ea80 | ||
|
|
edcc47a6b3 | ||
|
|
6593118f3d | ||
|
|
fd724d147a | ||
|
|
b2e1b2dc9b | ||
|
|
defc47000b | ||
|
|
0a37ad0666 | ||
|
|
13d4907bff | ||
|
|
78725009c1 | ||
|
|
a1bc9144bd | ||
|
|
b897056824 | ||
|
|
87563b6c97 | ||
|
|
62d6294da2 | ||
|
|
b4d71543db | ||
|
|
73db1a608a | ||
|
|
1c6b60122e | ||
|
|
1e7a042b53 | ||
|
|
bf08336bc5 | ||
|
|
62cbf31ac2 | ||
|
|
a2eac214b4 | ||
|
|
32933ce90b | ||
|
|
44cdc191fc | ||
|
|
e4f77e42d3 | ||
|
|
9f91832c7e | ||
|
|
6d4af0fb5d | ||
|
|
4345739a87 | ||
|
|
0a881a81f8 | ||
|
|
b066f7ad4c | ||
|
|
a19380347a | ||
|
|
9bc1211e57 | ||
|
|
cbce5d0fc0 | ||
|
|
b20b56c5d4 | ||
|
|
27041c205c | ||
|
|
00504d4096 | ||
|
|
ed0c5e1a7e | ||
|
|
ddf90f4ee0 | ||
|
|
39290512cf | ||
|
|
09ea20729d | ||
|
|
736e6c5fa2 | ||
|
|
e96f4fc8a0 | ||
|
|
bbe1f539dd | ||
|
|
1fcaacd41b | ||
|
|
7306764c51 | ||
|
|
d3c7280f3f | ||
|
|
2c6ed06574 | ||
|
|
81e2e18089 | ||
|
|
7b7e7eb7e7 | ||
|
|
944aaf3297 | ||
|
|
5a5793f243 | ||
|
|
5e41a4d2c0 | ||
|
|
c4ac0bc7a5 | ||
|
|
5549cfaaa1 | ||
|
|
ae4d246c59 | ||
|
|
2622557a00 | ||
|
|
339abedeee | ||
|
|
149b35224a | ||
|
|
d148279224 | ||
|
|
554fe8bad1 | ||
|
|
27e8259ff6 | ||
|
|
3a51df154a | ||
|
|
a3c79c0427 | ||
|
|
f569a04797 | ||
|
|
610ddfed12 | ||
|
|
438883bb8e | ||
|
|
828dd63acd | ||
|
|
f7cc35d949 | ||
|
|
ec9004b50b | ||
|
|
8b4c1a5dab | ||
|
|
853355062e | ||
|
|
834e3ed55a | ||
|
|
5b2b0bfc95 | ||
|
|
4fae8c26d9 | ||
|
|
0aa4a0f794 | ||
|
|
ac0864303c | ||
|
|
8811b24811 | ||
|
|
904293f407 | ||
|
|
3e175aa8e6 | ||
|
|
c4ecdde110 | ||
|
|
4aa978023d | ||
|
|
50009786d8 | ||
|
|
032d706fc4 | ||
|
|
dcd9e90898 | ||
|
|
bab3479cde | ||
|
|
a5b79c97d2 | ||
|
|
05d6dc3d4a | ||
|
|
6e2ed37e80 | ||
|
|
c840945706 | ||
|
|
ca7d6dbc66 | ||
|
|
81ef5d536f | ||
|
|
f911100c3d |
No files matched your search
Executable → Regular
+15
-23
@@ -4,16 +4,18 @@ buildscript {
|
||||
maven { url = "http://files.minecraftforge.net/maven" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.47"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.matthewprenger.cursegradle" version "1.0.7"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
id "com.matthewprenger.cursegradle" version "1.0.9"
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"
|
||||
|
||||
version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
|
||||
if (project.hasProperty('buildQualifier')) {
|
||||
@@ -26,8 +28,8 @@ ext.dirDest = './build/dist'
|
||||
ext.dirLang = "./lang"
|
||||
|
||||
// java version
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
minecraft {
|
||||
version = mcversion + "-" + forgeversion
|
||||
@@ -60,10 +62,10 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "net.darkhax.tesla:Tesla:${tesla_version}"
|
||||
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api"
|
||||
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
|
||||
// deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
deobfCompile "net.darkhax.tesla:Tesla-${tesla_mcversion}:${tesla_version}"
|
||||
deobfCompile "mezz.jei:jei_${jei_mcversion}:${jei_version}:api"
|
||||
runtime "mezz.jei:jei_${jei_mcversion}:${jei_version}"
|
||||
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -149,27 +151,17 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
untaggedName = "Current release ${project.version}"
|
||||
fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331"
|
||||
toRef = "HEAD"
|
||||
templateContent = """
|
||||
Alpha version, still buggy. Do not create a world you care about with this version, it can and will break things severely.<br/>
|
||||
Please help the project by trying it out and <a href="https://github.com/ForestryMC/ForestryMC/issues">reporting issues here.</a><br/>
|
||||
{{#tags}}
|
||||
<h3>{{name}}</h3>
|
||||
<ul>
|
||||
{{#commits}}
|
||||
<li>{{{message}}} - {{authorName}}</li>
|
||||
{{/commits}}
|
||||
</ul>
|
||||
{{/tags}}
|
||||
"""
|
||||
templateContent = file('changelog.mustache').getText('UTF-8')
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
|
||||
project {
|
||||
id = '59751'
|
||||
id = curse_project_id
|
||||
changelog = file('changelog.html')
|
||||
changelogType = 'html'
|
||||
releaseType = 'alpha'
|
||||
releaseType = 'beta'
|
||||
addGameVersion '1.12'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Please help the Forestry project by <a href="https://github.com/ForestryMC/ForestryMC/issues">reporting issues here.</a><br/>
|
||||
{{#tags}}
|
||||
<h3>{{name}}</h3>
|
||||
<ul>
|
||||
{{#commits}}
|
||||
<li>{{{message}}} - {{authorName}}</li>
|
||||
{{/commits}}
|
||||
</ul>
|
||||
{{/tags}}
|
||||
Binary file not shown.
Regular → Executable
+11
-8
@@ -1,11 +1,14 @@
|
||||
mcversion=1.11.2
|
||||
forgeversion=13.20.0.2262
|
||||
mcp_mappings=snapshot_20161220
|
||||
mcversion=1.12.1
|
||||
forgeversion=14.22.0.2462
|
||||
mcp_mappings=snapshot_20170826
|
||||
curse_project_id=59751
|
||||
|
||||
tesla_version=1.11-1.3.0.51
|
||||
jei_version=4.3.0.252
|
||||
#ic2_version=2.6.76-ex110
|
||||
tesla_version=1.0.60
|
||||
tesla_mcversion=1.12
|
||||
jei_version=4.7.8.91
|
||||
jei_mcversion=1.12.1
|
||||
ic2_version=2.8.17-ex112
|
||||
|
||||
version_major=5
|
||||
version_minor=3
|
||||
version_patch=2
|
||||
version_minor=5
|
||||
version_patch=1
|
||||
Vendored
BIN
Binary file not shown.
+6
-6
@@ -1,6 +1,6 @@
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
#Mon Jul 03 15:24:47 PDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
|
||||
@@ -42,11 +42,6 @@ case "`uname`" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@@ -114,6 +109,7 @@ fi
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
|
||||
+1
-1
Submodule lang updated: addea45c4f...192d6f8584.
Regular → Executable
+32
-25
@@ -10,10 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.plugins.compat.PluginNatura;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
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.eventhandler.SubscribeEvent;
|
||||
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;
|
||||
@@ -26,22 +44,9 @@ import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.multiblock.MultiblockEventHandler;
|
||||
import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.MigrationHelper;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
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.FMLMissingMappingsEvent;
|
||||
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.plugins.compat.PluginIC2;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -50,13 +55,14 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
*/
|
||||
@Mod(
|
||||
modid = Constants.MOD_ID,
|
||||
name = "Forestry",
|
||||
name = Constants.MOD_NAME,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.11]",
|
||||
dependencies = "required-after:forge@[13.20.0.2230,);"
|
||||
+ "after:JEI@[4.3.0,);")
|
||||
// + "after:" + PluginIC2.modId + ";")
|
||||
acceptedMinecraftVersions = "[1.12, 1.12.1]",
|
||||
dependencies = "required-after:forge@[14.21.1.2395,);"
|
||||
+ "after:jei@[4.7.0,);"
|
||||
+ "after:" + PluginIC2.modId + ";"
|
||||
+ "after:" + PluginNatura.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -71,6 +77,7 @@ public class Forestry {
|
||||
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
|
||||
EnumErrorCode.init();
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -103,6 +110,11 @@ public class Forestry {
|
||||
|
||||
PluginManager.runPreInit(event.getSide());
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerModels(ModelRegistryEvent event) {
|
||||
PluginManager.runRegisterBackpacksAndCrates();
|
||||
Proxies.render.registerModels();
|
||||
}
|
||||
|
||||
@@ -145,9 +157,4 @@ public class Forestry {
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
PluginManager.processIMCMessages(event.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingMappings(FMLMissingMappingsEvent event) {
|
||||
MigrationHelper.onMissingMappings(event);
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,18 @@ public interface IHiveFrame {
|
||||
*/
|
||||
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
|
||||
|
||||
/**
|
||||
* @param frame ItemStack containing the actual frame.
|
||||
* @return the {@link IBeeModifier} for this frame.
|
||||
* @since Forestry 5.5.1
|
||||
*/
|
||||
default IBeeModifier getBeeModifier(ItemStack frame) {
|
||||
return getBeeModifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 5.5.1. Use {@link #getBeeModifier(ItemStack)}
|
||||
*/
|
||||
@Deprecated
|
||||
IBeeModifier getBeeModifier();
|
||||
}
|
||||
@@ -44,4 +44,9 @@ public interface ITreeGenome extends IGenome {
|
||||
* @return A ItemStack that is used in getPickBlock of the leave block.
|
||||
*/
|
||||
ItemStack getDecorativeLeaves();
|
||||
|
||||
/**
|
||||
* @return true if this genome matches one of the default template genomes
|
||||
*/
|
||||
boolean matchesTemplateGenome();
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRootPollinatable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -101,4 +102,6 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
List<ITreeMutation> getMutations(boolean shuffle);
|
||||
|
||||
Collection<IFruitProvider> getFruitProvidersForFruitFamily(IFruitFamily fruitFamily);
|
||||
}
|
||||
Regular → Executable
+3
-3
@@ -1,12 +1,12 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelProcessingHelper;
|
||||
|
||||
public enum WoodBlockKind {
|
||||
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR;
|
||||
@@ -57,6 +57,6 @@ public enum WoodBlockKind {
|
||||
break;
|
||||
}
|
||||
textures.putAll(customTextures);
|
||||
return ModelProcessingHelper.retexture(model, new ImmutableMap.Builder<String, String>().putAll(textures).build());
|
||||
return model.retexture(ImmutableMap.copyOf(textures));
|
||||
}
|
||||
}
|
||||
Regular → Executable
+3
-2
@@ -8,14 +8,15 @@ package forestry.api.core;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBakerModel extends IPerspectiveAwareModel {
|
||||
public interface IModelBakerModel extends IBakedModel {
|
||||
|
||||
void setGui3d(boolean gui3d);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Farmables {
|
||||
|
||||
@@ -7,6 +7,7 @@ package forestry.api.farming;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -33,6 +34,8 @@ public interface IFarmLogic {
|
||||
|
||||
IFarmLogic setManual(boolean manual);
|
||||
|
||||
void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ResourceLocation getTextureMap();
|
||||
|
||||
|
||||
@@ -11,6 +11,13 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Registers farming logic in registry under given identifier
|
||||
* @param identifier Valid identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
* @param logic corresponding instance of logic
|
||||
*/
|
||||
void registerFarmLogic(String identifier, IFarmLogic logic);
|
||||
|
||||
/**
|
||||
* Can be used to add IFarmables to some of the vanilla farm logics.
|
||||
* <p>
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
@API(apiVersion = "2.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his alleles of an specific type. Like IAlleleFruit or IAlleleSpecies
|
||||
* @since 5.3.3
|
||||
*/
|
||||
public class AlleleRegisterEvent<A extends IAllele> extends Event {
|
||||
|
||||
private final Class<? extends A> alleleClass;
|
||||
|
||||
public AlleleRegisterEvent(Class<? extends A> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
public Class<? extends A> getAlleleClass() {
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his species alleles of a individual.
|
||||
*/
|
||||
public class AlleleSpeciesRegisterEvent extends Event {
|
||||
public class AlleleSpeciesRegisterEvent<A extends IAlleleSpecies> extends AlleleRegisterEvent<A> {
|
||||
|
||||
private final ISpeciesRoot root;
|
||||
|
||||
public AlleleSpeciesRegisterEvent(ISpeciesRoot root) {
|
||||
public AlleleSpeciesRegisterEvent(ISpeciesRoot root, Class<? extends A> alleleClass) {
|
||||
super(alleleClass);
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,20 @@ public interface IAllele {
|
||||
|
||||
/**
|
||||
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
|
||||
* @deprecated since Forestry 5.3.4. Use {@link #getAlleleName()}.
|
||||
*/
|
||||
@Deprecated
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
|
||||
* @since Forestry 5.3.4
|
||||
* @apiNote This can't be named "getName" or it can conflict during obfuscation. https://github.com/md-5/SpecialSource/issues/12
|
||||
*/
|
||||
default String getAlleleName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The unlocalized identifier
|
||||
*/
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -48,6 +51,27 @@ public interface IButterfly extends IIndividualLiving {
|
||||
*/
|
||||
@Nullable
|
||||
IButterfly spawnCaterpillar(World world, IButterflyNursery nursery);
|
||||
|
||||
/**
|
||||
* Determines whether the caterpillar can grow.
|
||||
*
|
||||
* @param cocoon the {@link IButterflyCocoon} the caterpillar resides in.
|
||||
* @param nursery the {@link IButterflyNursery} of the caterpillar.
|
||||
* @return an empty set if the caterpillar can grow, a set of error states if the caterpillar can not grow
|
||||
* @since 5.3.3
|
||||
*/
|
||||
Set<IErrorState> getCanGrow(IButterflyNursery nursery, @Nullable IButterflyCocoon cocoon);
|
||||
|
||||
/**
|
||||
* Determines whether the caterpillar can spawn. (Used to auto-spawn butterflies out of a cocoon.)
|
||||
*
|
||||
* @param cocoon the {@link IButterflyCocoon} the caterpillar resides in.
|
||||
* @param nursery the {@link IButterflyNursery} of the caterpillar.
|
||||
* @return an empty set if the caterpillar can spawn, a set of error states if the caterpillar can not spawn
|
||||
* @since 5.3.3
|
||||
*/
|
||||
Set<IErrorState> getCanSpawn(IButterflyNursery nursery, @Nullable IButterflyCocoon cocoon);
|
||||
|
||||
|
||||
/**
|
||||
* @param playerKill Whether or not the butterfly was killed by a player.
|
||||
|
||||
@@ -13,7 +13,7 @@ package forestry.api.lepidopterology;
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
public interface IButterflyCocoon extends IHousing {
|
||||
|
||||
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
void setCaterpillar(IButterfly butterfly);
|
||||
|
||||
@@ -10,15 +10,19 @@ import javax.annotation.Nullable;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IButterflyNursery extends IHousing, IClimateProvider {
|
||||
@Nullable
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
@Nullable
|
||||
IIndividual getNanny();
|
||||
|
||||
void setCaterpillar(@Nullable IButterfly caterpillar);
|
||||
|
||||
boolean canNurse(IButterfly caterpillar);
|
||||
|
||||
World getWorldObj();
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "1.3.0", owner = "ForestryAPI|core", provides = "ForestryAPI|lepidopterology")
|
||||
@API(apiVersion = "1.4.0", owner = "ForestryAPI|core", provides = "ForestryAPI|lepidopterology")
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -10,6 +10,7 @@ import forestry.api.climate.IClimateSourceProvider;
|
||||
import forestry.api.climate.IClimatiserDefinition;
|
||||
import forestry.api.greenhouse.IGreenhouseListener;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
@@ -32,7 +33,7 @@ public interface IGreenhouseComponent<T extends IMultiblockLogicGreenhouse> exte
|
||||
IClimatiserDefinition getDefinition();
|
||||
}
|
||||
|
||||
interface Nursery extends IGreenhouseComponent {
|
||||
interface Nursery extends IGreenhouseComponent, IButterflyNursery {
|
||||
void addCocoonLoot(IButterflyCocoon cocoon, NonNullList<ItemStack> loot);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.greenhouse.IGreenhouseHousing;
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.lepidopterology.IButterflyCocoon;
|
||||
|
||||
public interface IGreenhouseController extends IMultiblockController, IGreenhouseHousing, ICamouflageHandler, IClimateControlProvider {
|
||||
|
||||
@@ -21,6 +22,16 @@ public interface IGreenhouseController extends IMultiblockController, IGreenhous
|
||||
*/
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
|
||||
/**
|
||||
* spawns a butterfly in a greenhouse
|
||||
* @return true if it has spawned it, and false if it has not
|
||||
*/
|
||||
boolean spawnButterfly(IGreenhouseComponent.Nursery nursery);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawnButterfly(IButterflyCocoon)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean spawnButterfly(IButterfly butterfly);
|
||||
|
||||
IClimateRegion getRegion();
|
||||
|
||||
Regular → Executable
+1
-1
@@ -30,7 +30,7 @@ public interface IDescriptiveRecipe {
|
||||
* @return array of all the ingredients in the crafting table.
|
||||
* Each inner list represents one slot's accepted ItemStacks
|
||||
*/
|
||||
NonNullList<NonNullList<ItemStack>> getIngredients();
|
||||
NonNullList<NonNullList<ItemStack>> getRawIngredients();
|
||||
|
||||
NonNullList<String> getOreDicts();
|
||||
|
||||
|
||||
Regular → Executable
+4
-2
@@ -8,12 +8,14 @@ package forestry.api.storage;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
/**
|
||||
* The Backpack Interface allows you to add items to Forestry backpacks or create your own backpacks.
|
||||
|
||||
Regular → Executable
+97
-69
@@ -10,6 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -18,8 +21,42 @@ import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.PotionTypes;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
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.brewing.BrewingRecipeRegistry;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -38,6 +75,7 @@ import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockHoneyComb;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.capabilities.ArmorApiarist;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
@@ -95,37 +133,6 @@ import forestry.food.items.ItemRegistryFood;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.PotionTypes;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
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.brewing.BrewingRecipeRegistry;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
public class PluginApiculture extends BlankForestryPlugin {
|
||||
@@ -306,7 +313,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
villagerRegistry.registerVillageCreationHandler(villageHandler);
|
||||
|
||||
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
|
||||
villagerRegistry.register(villagerApiarist);
|
||||
IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
|
||||
villagerProfessions.register(villagerApiarist);
|
||||
|
||||
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
|
||||
ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
|
||||
@@ -431,78 +439,88 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
// / APIARIST'S ARMOR
|
||||
|
||||
ItemStack wovenSilk = coreItems.craftingMaterial.getWovenSilk();
|
||||
RecipeUtil.addRecipe(items.apiaristHat,
|
||||
RecipeUtil.addRecipe("apiarist_hat", items.apiaristHat,
|
||||
"###", "# #",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristChest,
|
||||
RecipeUtil.addRecipe("apiarist_chest", items.apiaristChest,
|
||||
"# #", "###", "###",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristLegs,
|
||||
RecipeUtil.addRecipe("apiarist_legs", items.apiaristLegs,
|
||||
"###", "# #", "# #",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristBoots,
|
||||
RecipeUtil.addRecipe("apiarist_boots", items.apiaristBoots,
|
||||
"# #", "# #",
|
||||
'#', wovenSilk);
|
||||
|
||||
// / HABITAT LOCATOR
|
||||
RecipeUtil.addRecipe(items.habitatLocator,
|
||||
RecipeUtil.addRecipe("habitat_locator", items.habitatLocator,
|
||||
" X ",
|
||||
"X#X",
|
||||
" X ",
|
||||
'#', OreDictUtil.DUST_REDSTONE, 'X', OreDictUtil.INGOT_BRONZE);
|
||||
|
||||
// Bees
|
||||
RecipeUtil.addRecipe(items.scoop,
|
||||
RecipeUtil.addRecipe("scoop", items.scoop,
|
||||
"#X#", "###", " # ",
|
||||
'#', OreDictUtil.STICK_WOOD,
|
||||
'X', Blocks.WOOL);
|
||||
RecipeUtil.addRecipe(items.smoker,
|
||||
RecipeUtil.addRecipe("smoker", items.smoker,
|
||||
"LS#",
|
||||
"LF#",
|
||||
"###",
|
||||
'#', "ingotTin", 'S', OreDictUtil.STICK_WOOD, 'F', Items.FLINT_AND_STEEL, 'L', OreDictUtil.LEATHER);
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.SLIME_BALL),
|
||||
RecipeUtil.addRecipe("propolis_to_slime", new ItemStack(Items.SLIME_BALL),
|
||||
"#X#", "#X#", "#X#",
|
||||
'#', items.propolis,
|
||||
'X', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1));
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.SPECKLED_MELON),
|
||||
RecipeUtil.addRecipe("honey_melon", new ItemStack(Items.SPECKLED_MELON),
|
||||
"#X#", "#Y#", "#X#",
|
||||
'#', items.honeyDrop,
|
||||
'X', items.honeydew,
|
||||
'Y', Items.MELON);
|
||||
RecipeUtil.addRecipe(items.frameUntreated,
|
||||
RecipeUtil.addRecipe("frame_untreated", items.frameUntreated,
|
||||
"###", "#S#", "###",
|
||||
'#', OreDictUtil.STICK_WOOD,
|
||||
'S', Items.STRING);
|
||||
RecipeUtil.addRecipe(items.frameImpregnated,
|
||||
RecipeUtil.addRecipe("frame_impregnated", items.frameImpregnated,
|
||||
"###", "#S#", "###",
|
||||
'#', coreItems.stickImpregnated,
|
||||
'S', Items.STRING);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
RecipeUtil.addRecipe("bee_house_minecart", items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', new ItemStack(blocks.beeHouse),
|
||||
'C', Items.MINECART);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(),
|
||||
RecipeUtil.addRecipe("apiary_minecart", items.minecartBeehouse.getApiaryMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', new ItemStack(blocks.apiary),
|
||||
'C', Items.MINECART);
|
||||
for(int blockCount = 0;blockCount < blocks.beeCombs.length;blockCount++){
|
||||
BlockHoneyComb block = blocks.beeCombs[blockCount];
|
||||
for(int blockMeta = 0;blockMeta < EnumHoneyComb.VALUES.length - blockCount * 16;blockMeta++){
|
||||
int itemMeta = blockMeta + blockCount * 16;
|
||||
RecipeUtil.addRecipe("comb." + itemMeta, new ItemStack(block, 1, blockMeta),
|
||||
"###",
|
||||
"###",
|
||||
"###", '#', items.beeComb.get(EnumHoneyComb.get(itemMeta), 1));
|
||||
}
|
||||
}
|
||||
|
||||
// FOOD STUFF
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FOOD)) {
|
||||
ItemRegistryFood foodItems = PluginFood.getItems();
|
||||
RecipeUtil.addRecipe(new ItemStack(foodItems.honeyedSlice, 4),
|
||||
RecipeUtil.addRecipe("honeyed_slice", new ItemStack(foodItems.honeyedSlice, 4),
|
||||
"###", "#X#", "###",
|
||||
'#', items.honeyDrop,
|
||||
'X', Items.BREAD);
|
||||
|
||||
RecipeUtil.addRecipe(foodItems.honeyPot,
|
||||
RecipeUtil.addRecipe("honey_pot", foodItems.honeyPot,
|
||||
"# #", " X ", "# #",
|
||||
'#', items.honeyDrop,
|
||||
'X', fluidItems.waxCapsuleEmpty);
|
||||
|
||||
RecipeUtil.addRecipe(foodItems.ambrosia,
|
||||
RecipeUtil.addRecipe("ambrosia", foodItems.ambrosia,
|
||||
"#Y#", "XXX", "###",
|
||||
'#', items.honeydew,
|
||||
'X', items.royalJelly,
|
||||
@@ -514,33 +532,33 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
int outputCapsuleAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule");
|
||||
if (outputCapsuleAmount > 0) {
|
||||
ItemStack capsule = fluidItems.waxCapsuleEmpty.getItemStack(outputCapsuleAmount);
|
||||
RecipeUtil.addRecipe(capsule, "###", '#', coreItems.beeswax);
|
||||
RecipeUtil.addRecipe("wax_capsule", capsule, "###", '#', coreItems.beeswax);
|
||||
}
|
||||
|
||||
int outputRefractoryAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.refractory");
|
||||
if (outputRefractoryAmount > 0) {
|
||||
ItemStack capsule = fluidItems.refractoryEmpty.getItemStack(outputRefractoryAmount);
|
||||
RecipeUtil.addRecipe(capsule, "###", '#', coreItems.refractoryWax);
|
||||
RecipeUtil.addRecipe("refractory_capsule", capsule, "###", '#', coreItems.refractoryWax);
|
||||
}
|
||||
|
||||
// / BITUMINOUS PEAT
|
||||
RecipeUtil.addRecipe(coreItems.bituminousPeat.getItemStack(),
|
||||
RecipeUtil.addRecipe("bituminous_peat", coreItems.bituminousPeat.getItemStack(),
|
||||
" # ", "XYX", " # ",
|
||||
'#', OreDictUtil.DUST_ASH,
|
||||
'X', coreItems.peat,
|
||||
'Y', items.propolis);
|
||||
|
||||
// / TORCHES
|
||||
RecipeUtil.addRecipe(new ItemStack(Blocks.TORCH, 3),
|
||||
RecipeUtil.addRecipe("beeswax_worth", new ItemStack(Blocks.TORCH, 3),
|
||||
" # ", " # ", " Y ",
|
||||
'#', coreItems.beeswax,
|
||||
'Y', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addRecipe(coreItems.craftingMaterial.getPulsatingMesh(),
|
||||
RecipeUtil.addRecipe("pulsating_mesh", coreItems.craftingMaterial.getPulsatingMesh(),
|
||||
"# #", " # ", "# #",
|
||||
'#', items.propolis.get(EnumPropolis.PULSATING, 1));
|
||||
|
||||
// / WAX CAST
|
||||
RecipeUtil.addRecipe(items.waxCast,
|
||||
RecipeUtil.addRecipe("wax_cast", items.waxCast,
|
||||
"###",
|
||||
"# #",
|
||||
"###",
|
||||
@@ -548,14 +566,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
// / ALVEARY
|
||||
ItemStack alvearyPlainBlock = blocks.getAlvearyBlock(BlockAlvearyType.PLAIN);
|
||||
RecipeUtil.addRecipe(alvearyPlainBlock,
|
||||
RecipeUtil.addRecipe("alveary_plain", alvearyPlainBlock,
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'X', coreItems.impregnatedCasing,
|
||||
'#', coreItems.craftingMaterial.getScentedPaneling());
|
||||
// SWARMER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
|
||||
RecipeUtil.addRecipe("alveary_swarmer", blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
|
||||
"#G#",
|
||||
" X ",
|
||||
"#G#",
|
||||
@@ -563,7 +581,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'G', OreDictUtil.INGOT_GOLD);
|
||||
// FAN
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.FAN),
|
||||
RecipeUtil.addRecipe("alveary_fan", blocks.getAlvearyBlock(BlockAlvearyType.FAN),
|
||||
"I I",
|
||||
" X ",
|
||||
"I#I",
|
||||
@@ -571,7 +589,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'I', OreDictUtil.INGOT_IRON);
|
||||
// HEATER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
|
||||
RecipeUtil.addRecipe("alveary_heater", blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
|
||||
"#I#",
|
||||
" X ",
|
||||
"YYY",
|
||||
@@ -579,7 +597,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'I', OreDictUtil.INGOT_IRON, 'Y', OreDictUtil.STONE);
|
||||
// HYGROREGULATOR
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
|
||||
RecipeUtil.addRecipe("alveary_hygro", blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
|
||||
"GIG",
|
||||
"GXG",
|
||||
"GIG",
|
||||
@@ -587,14 +605,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'I', OreDictUtil.INGOT_IRON,
|
||||
'G', OreDictUtil.BLOCK_GLASS);
|
||||
// STABILISER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
|
||||
RecipeUtil.addRecipe("alveary_stabiliser", blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
|
||||
"G G",
|
||||
"GXG",
|
||||
"G G",
|
||||
'X', alvearyPlainBlock,
|
||||
'G', OreDictUtil.GEM_QUARTZ);
|
||||
// SIEVE
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
|
||||
RecipeUtil.addRecipe("alveary_sieve", blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
|
||||
"III",
|
||||
" X ",
|
||||
"WWW",
|
||||
@@ -642,8 +660,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
"#X#",
|
||||
'#', coreItems.beeswax,
|
||||
'X', coreItems.craftingMaterial.getSilkWisp());
|
||||
RecipeUtil.addShapelessRecipe(blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe(blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe("candle_unlit_reset", blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe("candle_lit_reset", blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1));
|
||||
|
||||
// / CENTRIFUGE
|
||||
// Honey combs
|
||||
@@ -743,7 +761,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.fermenterManager.addRecipe(items.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.getFluid(1), Fluids.FOR_HONEY.getFluid(1));
|
||||
}
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiary,
|
||||
RecipeUtil.addRecipe("apiary", blocks.apiary,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -751,7 +769,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'#', OreDictUtil.PLANK_WOOD,
|
||||
'C', coreItems.impregnatedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.beeChest,
|
||||
RecipeUtil.addRecipe("bee_chest", blocks.beeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -759,7 +777,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', OreDictUtil.BEE_COMB,
|
||||
'Y', OreDictUtil.CHEST_WOOD);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.beeHouse,
|
||||
RecipeUtil.addRecipe("bee_house", blocks.beeHouse,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -884,8 +902,18 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
|
||||
if(!world.provider.getDimensionType().equals(DimensionType.THE_END)) return;
|
||||
if (Config.getBeehivesAmount() > 0.0) {
|
||||
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
if (Config.getBeehivesAmount() > 0.0) {
|
||||
int chunkX = pos.getX() >> 4;
|
||||
int chunkZ = pos.getZ() >> 4;
|
||||
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SaveEventHandlerApiculture implements ISaveEventHandler {
|
||||
|
||||
|
||||
Regular → Executable
+23
-20
@@ -10,12 +10,34 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -36,25 +58,6 @@ import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BlockAlveary extends BlockStructure implements IStateMapperRegister {
|
||||
private static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
|
||||
@@ -259,7 +262,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||
tooltip.add(Translator.translateToLocal("tile.for.alveary.tooltip"));
|
||||
}
|
||||
}
|
||||
Regular → Executable
+20
-23
@@ -11,11 +11,28 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -30,22 +47,6 @@ import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBeeHives extends BlockContainer implements IItemModelRegister, IBlockWithMeta {
|
||||
private static final PropertyEnum<HiveType> HIVE_TYPES = PropertyEnum.create("hive", HiveType.class);
|
||||
@@ -96,9 +97,7 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
Random random = world instanceof World ? ((World) world).rand : RANDOM;
|
||||
|
||||
List<IHiveDrop> hiveDrops = getDropsForHive(getMetaFromState(state));
|
||||
@@ -142,8 +141,6 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
// / CREATIVE INVENTORY
|
||||
@@ -173,7 +170,7 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (IBlockState blockState : getBlockState().getValidStates()) {
|
||||
if (getHiveType(blockState) != HiveType.SWARM) {
|
||||
int meta = getMetaFromState(blockState);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum BlockBeeProductType implements IStringSerializable {
|
||||
BEE_COMBS,
|
||||
BEESWAX;
|
||||
|
||||
public static final BlockBeeProductType[] VALUES = values();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+21
-21
@@ -10,24 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -51,9 +43,19 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class BlockCandle extends BlockTorch implements IItemModelRegister, ITileEntityProvider, IColoredBlock {
|
||||
|
||||
@@ -148,7 +150,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
@@ -200,9 +202,9 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
if (toggleLitState) {
|
||||
tileCandle.setLit(!isLit);
|
||||
worldIn.markBlockRangeForRenderUpdate(pos, pos);
|
||||
worldIn.theProfiler.startSection("checkLight");
|
||||
worldIn.profiler.startSection("checkLight");
|
||||
worldIn.checkLight(pos);
|
||||
worldIn.theProfiler.endSection();
|
||||
worldIn.profiler.endSection();
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
@@ -238,9 +240,9 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
drop.set(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ItemStack dropStack = drop.get();
|
||||
drop.remove();
|
||||
|
||||
@@ -249,10 +251,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
dropStack = getCandleDrop(world, pos);
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> drops = new ArrayList<>(1);
|
||||
drops.add(dropStack);
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -287,9 +286,9 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
tileCandle.setColour(colour);
|
||||
tileCandle.setLit(isLit);
|
||||
if (tileCandle.isLit()) {
|
||||
world.theProfiler.startSection("checkLight");
|
||||
world.profiler.startSection("checkLight");
|
||||
world.checkLight(pos);
|
||||
world.theProfiler.endSection();
|
||||
world.profiler.endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,6 +331,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
return new ItemStack(this, amount, 1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (worldIn != null && pos != null) {
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.EnumHoneyComb;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public abstract class BlockHoneyComb extends Block implements IItemModelRegister, IBlockWithMeta, IColoredBlock, IStateMapperRegister {
|
||||
public final int minMeta;
|
||||
|
||||
public static final BlockHoneyComb[] create(){
|
||||
BlockHoneyComb[] blocks = new BlockHoneyComb[2];
|
||||
for(int i = 0;i < blocks.length;i++){
|
||||
HoneyCombPredicate filter = new HoneyCombPredicate(i, 16);
|
||||
PropertyEnum<EnumHoneyComb> variant = PropertyEnum.create("type", EnumHoneyComb.class, filter);
|
||||
blocks[i] = new BlockHoneyComb(filter.minMeta) {
|
||||
@Override
|
||||
protected PropertyEnum<EnumHoneyComb> getVariant() {
|
||||
return variant;
|
||||
}
|
||||
};
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public BlockHoneyComb(int minMeta) {
|
||||
super(Material.CLOTH);
|
||||
setHardness(1F);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setDefaultState(this.blockState.getBaseState().withProperty(getVariant(), getVariant().getAllowedValues().iterator().next()));
|
||||
this.minMeta = minMeta;
|
||||
}
|
||||
|
||||
protected abstract PropertyEnum<EnumHoneyComb> getVariant();
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, getVariant());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(getVariant()).ordinal()-minMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(getVariant(), EnumHoneyComb.get(minMeta + meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (EnumHoneyComb honeyComb : getVariant().getAllowedValues()) {
|
||||
if(!honeyComb.isSecret() || Config.isDebug){
|
||||
list.add(get(honeyComb));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "tile.for.bee_combs";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (EnumHoneyComb comb : getVariant().getAllowedValues()) {
|
||||
manager.registerItemModel(item, comb.ordinal()-minMeta, "block_bee_combs");
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack get(EnumHoneyComb honeyComb) {
|
||||
return new ItemStack(this, 1, honeyComb.ordinal() - minMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameFromMeta(int meta) {
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(minMeta + meta);
|
||||
return honeyComb.name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
|
||||
int meta = getMetaFromState(state);
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(minMeta + meta);
|
||||
if (tintIndex == 1) {
|
||||
return honeyComb.primaryColor;
|
||||
} else {
|
||||
return honeyComb.secondaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new HoneyCombStateMapper());
|
||||
}
|
||||
|
||||
private static class HoneyCombPredicate implements Predicate<EnumHoneyComb> {
|
||||
private final int minMeta;
|
||||
private final int maxMeta;
|
||||
|
||||
public HoneyCombPredicate(int blockNumber, int variantsPerBlock) {
|
||||
this.minMeta = blockNumber * variantsPerBlock;
|
||||
this.maxMeta = minMeta + variantsPerBlock - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(@Nullable EnumHoneyComb honeyComb) {
|
||||
return honeyComb != null && honeyComb.ordinal() >= minMeta && honeyComb.ordinal() <= maxMeta;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class HoneyCombStateMapper extends StateMapperBase {
|
||||
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(Constants.MOD_ID + ":bee_combs", "normal");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.ItemBlockCandle;
|
||||
import forestry.apiculture.items.ItemBlockHoneyComb;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
@@ -27,31 +28,38 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public final BlockBeeHives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
public final BlockHoneyComb[] beeCombs;
|
||||
private final Map<BlockAlvearyType, BlockAlveary> alvearyBlockMap;
|
||||
|
||||
public BlockRegistryApiculture() {
|
||||
apiary = new BlockApiculture(BlockTypeApiculture.APIARY);
|
||||
registerBlock(apiary, new ItemBlockForestry(apiary), "apiary");
|
||||
registerBlock(apiary, new ItemBlockForestry<>(apiary), "apiary");
|
||||
|
||||
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
|
||||
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
|
||||
registerBlock(beeHouse, new ItemBlockForestry<>(beeHouse), "bee_house");
|
||||
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST, Material.WOOD);
|
||||
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
|
||||
registerBlock(beeChest, new ItemBlockForestry<>(beeChest), "bee_chest");
|
||||
beeChest.setCreativeTab(Tabs.tabApiculture);
|
||||
beeChest.setHarvestLevel("axe", 0);
|
||||
|
||||
beehives = new BlockBeeHives();
|
||||
registerBlock(beehives, new ItemBlockForestry(beehives), "beehives");
|
||||
registerBlock(beehives, new ItemBlockForestry<>(beehives), "beehives");
|
||||
|
||||
candle = new BlockCandle();
|
||||
registerBlock(candle, new ItemBlockCandle(candle), "candle");
|
||||
stump = new BlockStump();
|
||||
registerBlock(stump, new ItemBlockForestry(stump), "stump");
|
||||
registerBlock(stump, new ItemBlockForestry<>(stump), "stump");
|
||||
|
||||
beeCombs = BlockHoneyComb.create();
|
||||
for(int i = 0;i < beeCombs.length;i++){
|
||||
BlockHoneyComb block = beeCombs[i];
|
||||
registerBlock(block, new ItemBlockHoneyComb(block), "bee_combs_" + i);
|
||||
}
|
||||
|
||||
alvearyBlockMap = BlockAlveary.create();
|
||||
for (BlockAlveary block : alvearyBlockMap.values()) {
|
||||
registerBlock(block, new ItemBlockForestry(block), "alveary." + block.getAlvearyType());
|
||||
registerBlock(block, new ItemBlockForestry<>(block), "alveary." + block.getAlvearyType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+9
-7
@@ -12,12 +12,6 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -31,9 +25,17 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
|
||||
public BlockStump() {
|
||||
@@ -49,7 +51,7 @@ public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
ItemStack beeStack = BeeManager.beeRoot.getMemberStack(bee, beeType);
|
||||
player.dropItem(beeStack, false, true);
|
||||
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getName(), bee.getGenome().getPrimary().getName(), beeType.getName());
|
||||
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getName(), bee.getGenome().getPrimary().getAlleleName(), beeType.getName());
|
||||
}
|
||||
|
||||
private static IBeeGenome getBeeGenome(String speciesName) throws SpeciesNotFoundException, TemplateNotFoundException {
|
||||
@@ -115,7 +115,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
|
||||
if (species == null) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies && allele.getName().equals(speciesName)) {
|
||||
if (allele instanceof IAlleleBeeSpecies && allele.getAlleleName().equals(speciesName)) {
|
||||
species = (IAlleleBeeSpecies) allele;
|
||||
break;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies) {
|
||||
species.add(allele.getName());
|
||||
species.add(allele.getAlleleName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.utils.JeiUtil;
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
|
||||
@JEIPlugin
|
||||
public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
public class ApicultureJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
ItemRegistryApiculture items = PluginApiculture.getItems();
|
||||
@@ -21,7 +21,7 @@ public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
|
||||
ISubtypeRegistry.ISubtypeInterpreter beeSubtypeInterpreter = itemStack -> {
|
||||
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
|
||||
return species == null ? null : species.getUID();
|
||||
return species == null ? ISubtypeRegistry.ISubtypeInterpreter.NONE : species.getUID();
|
||||
};
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter(items.beeDroneGE, beeSubtypeInterpreter);
|
||||
|
||||
Regular → Executable
+5
-5
@@ -63,17 +63,17 @@ public class AIAvoidPlayers extends EntityAIBase {
|
||||
if (randomTarget == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.getDistanceSq(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord) < player.getDistanceSqToEntity(mob)) {
|
||||
|
||||
if (player.getDistanceSq(randomTarget.x, randomTarget.y, randomTarget.z) < player.getDistanceSqToEntity(mob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
path = pathNavigator.getPathToXYZ(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord);
|
||||
|
||||
path = pathNavigator.getPathToXYZ(randomTarget.x, randomTarget.y, randomTarget.z);
|
||||
return path != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting() {
|
||||
public boolean shouldContinueExecuting() {
|
||||
return !this.pathNavigator.noPath();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -89,8 +90,11 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
|
||||
beeModifiers.add(beeModifier);
|
||||
|
||||
for (IHiveFrame frame : inventory.getFrames()) {
|
||||
beeModifiers.add(frame.getBeeModifier());
|
||||
for (Tuple<IHiveFrame, ItemStack> frame : inventory.getFrames()) {
|
||||
IHiveFrame hiveFrame = frame.getFirst();
|
||||
ItemStack stack = frame.getSecond();
|
||||
IBeeModifier beeModifier = hiveFrame.getBeeModifier(stack);
|
||||
beeModifiers.add(beeModifier);
|
||||
}
|
||||
|
||||
return beeModifiers;
|
||||
|
||||
Regular → Executable
+16
-15
@@ -10,19 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
public class ParticleBeeExplore extends Particle {
|
||||
private final Vec3d origin;
|
||||
|
||||
public ParticleBeeExplore(World world, Vec3d origin, BlockPos destination, int color) {
|
||||
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
|
||||
super(world, origin.x, origin.y, origin.z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(PluginApiculture.getBeeSprite());
|
||||
this.origin = origin;
|
||||
|
||||
@@ -54,9 +55,9 @@ public class ParticleBeeExplore extends Particle {
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
@@ -72,15 +73,15 @@ public class ParticleBeeExplore extends Particle {
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.95;
|
||||
} else {
|
||||
// get to origin
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -89,7 +90,7 @@ public class ParticleBeeExplore extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
@@ -110,10 +111,10 @@ public class ParticleBeeExplore extends Particle {
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
|
||||
Regular → Executable
+16
-15
@@ -10,20 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
public class ParticleBeeRoundTrip extends Particle {
|
||||
private final Vec3d origin;
|
||||
private final BlockPos destination;
|
||||
|
||||
public ParticleBeeRoundTrip(World world, Vec3d origin, BlockPos destination, int color) {
|
||||
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
|
||||
super(world, origin.x, origin.y, origin.z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(PluginApiculture.getBeeSprite());
|
||||
this.origin = origin;
|
||||
|
||||
@@ -56,9 +57,9 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionX = (origin.x - this.posX) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionY = (origin.y - this.posY) * 0.03 + 0.1 * rand.nextFloat();
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03 + 0.1 * rand.nextFloat();
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
@@ -75,15 +76,15 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.95;
|
||||
} else {
|
||||
// get to origin
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -92,7 +93,7 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
@@ -113,10 +114,10 @@ public class ParticleBeeRoundTrip extends Particle {
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
|
||||
Regular → Executable
+16
-15
@@ -10,19 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
|
||||
public class ParticleBeeTargetEntity extends Particle {
|
||||
private final Vec3d origin;
|
||||
private final Entity entity;
|
||||
|
||||
public ParticleBeeTargetEntity(World world, Vec3d origin, Entity entity, int color) {
|
||||
super(world, origin.xCoord, origin.yCoord, origin.zCoord, 0.0D, 0.0D, 0.0D);
|
||||
super(world, origin.x, origin.y, origin.z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(PluginApiculture.getBeeSprite());
|
||||
|
||||
this.origin = origin;
|
||||
@@ -56,9 +57,9 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
@@ -72,15 +73,15 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.95;
|
||||
} else {
|
||||
// get to origin
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionX = (origin.x - this.posX) * 0.03;
|
||||
this.motionY = (origin.y - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.z - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -89,7 +90,7 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
@@ -110,10 +111,10 @@ public class ParticleBeeTargetEntity extends Particle {
|
||||
int i = this.getBrightnessForRender(partialTicks);
|
||||
int j = i >> 16 & 65535;
|
||||
int k = i & 65535;
|
||||
worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
buffer.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
|
||||
Regular → Executable
+3
-1
@@ -10,7 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public final class Flower {
|
||||
@@ -57,7 +59,7 @@ public final class Flower {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("blockState", blockState).add("weight", weight).toString();
|
||||
return MoreObjects.toStringHelper(this).add("blockState", blockState).add("weight", weight).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
@@ -18,8 +21,6 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ApiaristTracker extends BreedingTracker implements IApiaristTracker {
|
||||
|
||||
|
||||
Regular → Executable
+20
-17
@@ -19,7 +19,21 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
@@ -56,17 +70,6 @@ import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@@ -269,7 +272,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// / Check for the sky, except if in hell
|
||||
if (!world.provider.hasNoSky()) {
|
||||
if (!world.provider.isNether()) {
|
||||
if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NO_SKY);
|
||||
}
|
||||
@@ -361,7 +364,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
IAlleleBeeSpecies secondary = genome.getSecondary();
|
||||
if (!isPureBred(EnumBeeChromosome.SPECIES)) {
|
||||
list.add(TextFormatting.BLUE + Translator.translateToLocal("for.bees.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName()));
|
||||
list.add(TextFormatting.BLUE + Translator.translateToLocal("for.bees.hybrid").replaceAll("%PRIMARY", primary.getAlleleName()).replaceAll("%SECONDARY", secondary.getAlleleName()));
|
||||
}
|
||||
|
||||
if (generation > 0) {
|
||||
@@ -389,12 +392,12 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
if (Translator.canTranslateToLocal(unlocalizedCustomSpeed)) {
|
||||
speed = Translator.translateToLocal(unlocalizedCustomSpeed);
|
||||
} else {
|
||||
speed = speedAllele.getName() + ' ' + Translator.translateToLocal("for.gui.worker");
|
||||
speed = speedAllele.getAlleleName() + ' ' + Translator.translateToLocal("for.gui.worker");
|
||||
}
|
||||
|
||||
String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getName() + ' ' + Translator.translateToLocal("for.gui.life");
|
||||
String tempTolerance = TextFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getName();
|
||||
String humidTolerance = TextFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getName();
|
||||
String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getAlleleName() + ' ' + Translator.translateToLocal("for.gui.life");
|
||||
String tempTolerance = TextFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getAlleleName();
|
||||
String humidTolerance = TextFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getAlleleName();
|
||||
String flowers = genome.getFlowerProvider().getDescription();
|
||||
|
||||
list.add(lifespan);
|
||||
|
||||
@@ -1021,11 +1021,10 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
for (BeeDefinition bee : values()) {
|
||||
bee.registerMutations();
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(BeeManager.beeRoot));
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent<>(BeeManager.beeRoot, IAlleleBeeSpecies.class));
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
@@ -10,12 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
@@ -33,9 +38,6 @@ import forestry.core.genetics.Genome;
|
||||
import forestry.core.genetics.alleles.AlleleArea;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AlleleTolerance;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
public class BeeGenome extends Genome implements IBeeGenome {
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -23,8 +26,6 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
|
||||
@@ -12,13 +12,14 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
private final IBeeDefinition beeTemplate;
|
||||
|
||||
@@ -12,11 +12,12 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
/**
|
||||
* Hermits will not produce if there are any other living creatures nearby.
|
||||
|
||||
Regular → Executable
+8
-6
@@ -12,16 +12,18 @@ package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.render.ParticleRender;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
private static final int ignitionChance = 50;
|
||||
@@ -72,7 +74,7 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
super.doFX(genome, storedData, housing);
|
||||
} else {
|
||||
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
|
||||
ParticleRender.addEntityIgnitionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord);
|
||||
ParticleRender.addEntityIgnitionFX(world, beeFXCoordinates.x, beeFXCoordinates.y + 0.5, beeFXCoordinates.z);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
Regular → Executable
+8
-6
@@ -14,11 +14,6 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.render.ParticleRender;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -26,9 +21,16 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.render.ParticleRender;
|
||||
|
||||
public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
|
||||
private final Potion potion;
|
||||
@@ -93,7 +95,7 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
super.doFX(genome, storedData, housing);
|
||||
} else {
|
||||
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
|
||||
ParticleRender.addEntityPotionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor);
|
||||
ParticleRender.addEntityPotionFX(world, beeFXCoordinates.x, beeFXCoordinates.y + 0.5, beeFXCoordinates.z, potionFXColor);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
Regular → Executable
+7
-6
@@ -14,11 +14,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -34,6 +29,12 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
|
||||
public static class Resurrectable {
|
||||
@@ -97,7 +98,7 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
if (entity.isDead) {
|
||||
return false;
|
||||
}
|
||||
ItemStack contained = entity.getEntityItem();
|
||||
ItemStack contained = entity.getItem();
|
||||
for (Resurrectable entry : resurrectables) {
|
||||
if (ItemStackUtil.isIdenticalItem(entry.res, contained)) {
|
||||
EntityUtil.spawnEntity(entity.world, entry.risen, entity.posX, entity.posY, entity.posZ);
|
||||
|
||||
@@ -33,4 +33,8 @@ public class AlleleFlowers extends AlleleCategorized implements IAlleleFlowers {
|
||||
return getProvider().getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName() {
|
||||
return getProvider().getDescription();
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerAlveary extends ContainerTile<TileAlveary> {
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.inventory.InventoryHygroregulator;
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotLiquidIn;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks<TileAlvearyHygroregulator> {
|
||||
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.inventory.InventoryAlvearySieve;
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerAlvearySieve extends ContainerTile<TileAlvearySieve> {
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerAlvearySwarmer extends ContainerTile<TileAlvearySwarmer> {
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class ContainerHabitatLocator extends ContainerItemInventory<ItemInventoryHabitatLocator> {
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.inventory.ItemInventoryImprinter;
|
||||
import forestry.apiculture.network.packets.PacketImprintSelectionResponse;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
@@ -17,8 +20,6 @@ import forestry.core.gui.IGuiSelectable;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerImprinter extends ContainerItemInventory<ItemInventoryImprinter> implements IGuiSelectable {
|
||||
|
||||
|
||||
@@ -10,12 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.IAlvearyControllerInternal;
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.render.EnumTankLevel;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlveary extends GuiForestryTitled<ContainerAlveary> {
|
||||
private final TileAlveary tile;
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.widgets.TankWidget;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlvearyHygroregulator extends GuiForestryTitled<ContainerAlvearyHygroregulator> {
|
||||
private final TileAlvearyHygroregulator tile;
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlvearySieve extends GuiForestryTitled<ContainerAlvearySieve> {
|
||||
private final TileAlvearySieve tile;
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiAlvearySwarmer extends GuiForestryTitled<ContainerAlvearySwarmer> {
|
||||
private final TileAlvearySwarmer tile;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import com.google.common.collect.LinkedListMultimap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -17,16 +19,17 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.LinkedListMultimap;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
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;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator> {
|
||||
private static final LinkedListMultimap<String, BiomeDictionary.Type> habitats = LinkedListMultimap.create();
|
||||
@@ -83,7 +86,7 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator> {
|
||||
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, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
fontRenderer.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 = new HashSet<>();
|
||||
|
||||
@@ -14,6 +14,10 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.genetics.BeeGenome;
|
||||
@@ -25,9 +29,6 @@ import forestry.core.network.packets.PacketGuiSelectRequest;
|
||||
import forestry.core.render.ColourProperties;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class GuiImprinter extends GuiForestry<ContainerImprinter> {
|
||||
private final ItemInventoryImprinter itemInventory;
|
||||
@@ -56,21 +57,21 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter> {
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
|
||||
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, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
int offset = (138 - fontRenderer.getStringWidth(Translator.translateToLocal("for.gui.imprinter.name"))) / 2;
|
||||
fontRenderer.drawString(Translator.translateToLocal("for.gui.imprinter.name"), startX + 8 + offset, startY + 16, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
IAlleleBeeSpecies primary = itemInventory.getPrimary();
|
||||
drawBeeSpeciesIcon(primary, startX + 12, startY + 32);
|
||||
fontRendererObj.drawString(primary.getName(), startX + 32, startY + 36, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
fontRenderer.drawString(primary.getAlleleName(), startX + 32, startY + 36, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
IAlleleBeeSpecies secondary = itemInventory.getSecondary();
|
||||
drawBeeSpeciesIcon(secondary, startX + 12, startY + 52);
|
||||
fontRendererObj.drawString(secondary.getName(), startX + 32, startY + 56, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
fontRenderer.drawString(secondary.getAlleleName(), 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, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
offset = (138 - fontRenderer.getStringWidth(youCheater)) / 2;
|
||||
fontRenderer.drawString(youCheater, startX + 8 + offset, startY + 76, ColourProperties.INSTANCE.get("gui.screen"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Tuple;
|
||||
|
||||
public class InventoryApiary extends InventoryBeeHousing implements IApiaryInventory {
|
||||
public static final int SLOT_FRAMES_1 = 9;
|
||||
@@ -47,14 +48,15 @@ public class InventoryApiary extends InventoryBeeHousing implements IApiaryInven
|
||||
super.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
public Collection<IHiveFrame> getFrames() {
|
||||
Collection<IHiveFrame> hiveFrames = new ArrayList<>(SLOT_FRAMES_COUNT);
|
||||
public Collection<Tuple<IHiveFrame, ItemStack>> getFrames() {
|
||||
Collection<Tuple<IHiveFrame, ItemStack>> hiveFrames = new ArrayList<>(SLOT_FRAMES_COUNT);
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
ItemStack stackInSlot = getStackInSlot(i);
|
||||
Item itemInSlot = stackInSlot.getItem();
|
||||
if (itemInSlot instanceof IHiveFrame) {
|
||||
hiveFrames.add((IHiveFrame) itemInSlot);
|
||||
IHiveFrame frame = (IHiveFrame) itemInSlot;
|
||||
hiveFrames.add(new Tuple<>(frame, stackInSlot.copy()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ package forestry.apiculture.items;
|
||||
import java.awt.Color;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumHoneyComb {
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumHoneyComb implements IStringSerializable {
|
||||
HONEY(new Color(0xe8d56a), new Color(0xffa12b)),
|
||||
COCOA(new Color(0x674016), new Color(0xffb62b), true),
|
||||
SIMMERING(new Color(0x981919), new Color(0xffb62b)),
|
||||
@@ -50,6 +52,11 @@ public enum EnumHoneyComb {
|
||||
this.secondaryColor = secondary.getRGB();
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isSecret() {
|
||||
return secret;
|
||||
|
||||
@@ -12,13 +12,6 @@ package forestry.apiculture.items;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
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;
|
||||
@@ -26,11 +19,20 @@ 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;
|
||||
|
||||
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;
|
||||
|
||||
public class ItemArmorApiarist extends ItemArmor implements IItemModelRegister {
|
||||
|
||||
public ItemArmorApiarist(EntityEquipmentSlot equipmentSlotIn) {
|
||||
|
||||
@@ -13,6 +13,19 @@ package forestry.apiculture.items;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -28,16 +41,6 @@ import forestry.core.config.Config;
|
||||
import forestry.core.genetics.ItemGE;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBeeGE extends ItemGE implements IColoredItem {
|
||||
|
||||
@@ -81,7 +84,7 @@ public class ItemBeeGE extends ItemGE implements IColoredItem {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
|
||||
public void addInformation(ItemStack itemstack, @Nullable World world, List<String> list, ITooltipFlag flag) {
|
||||
if (itemstack.getTagCompound() == null) {
|
||||
return;
|
||||
}
|
||||
@@ -94,13 +97,15 @@ public class ItemBeeGE extends ItemGE implements IColoredItem {
|
||||
list.add(TextFormatting.YELLOW + Translator.translateToLocal("for.bees.stock.ignoble"));
|
||||
}
|
||||
}
|
||||
|
||||
super.addInformation(itemstack, player, list, flag);
|
||||
|
||||
super.addInformation(itemstack, world, list, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
addCreativeItems(subItems, true);
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
addCreativeItems(subItems, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCreativeItems(NonNullList<ItemStack> subItems, boolean hideSecrets) {
|
||||
|
||||
@@ -13,7 +13,6 @@ package forestry.apiculture.items;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -21,7 +20,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockCandle extends ItemBlockForestry<BlockCandle> implements IColoredItem {
|
||||
|
||||
public ItemBlockCandle(Block block) {
|
||||
public ItemBlockCandle(BlockCandle block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import forestry.apiculture.blocks.BlockHoneyComb;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockHoneyComb extends ItemBlockForestry<BlockHoneyComb> implements IColoredItem {
|
||||
|
||||
public ItemBlockHoneyComb(BlockHoneyComb block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
int meta = stack.getMetadata();
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(getBlock().minMeta + meta);
|
||||
if (tintIndex == 1) {
|
||||
return honeyComb.primaryColor;
|
||||
} else {
|
||||
return honeyComb.secondaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+32
-23
@@ -10,8 +10,24 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
@@ -25,17 +41,6 @@ import forestry.apiculture.render.TextureHabitatLocator;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
|
||||
private static final String iconName = "forestry:items/biomefinder";
|
||||
@@ -69,18 +74,22 @@ public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
|
||||
super.addInformation(itemstack, player, list, flag);
|
||||
|
||||
Biome currentBiome = player.world.getBiome(player.getPosition());
|
||||
|
||||
float temperatureValue = ClimateUtil.getTemperature(player.world, player.getPosition());
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(ClimateUtil.getHumidity(player.world, player.getPosition()));
|
||||
|
||||
list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.getBiomeName());
|
||||
list.add(Translator.translateToLocal("for.gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature));
|
||||
list.add(Translator.translateToLocal("for.gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
|
||||
public void addInformation(ItemStack itemstack, @Nullable World world, List<String> list, ITooltipFlag flag) {
|
||||
super.addInformation(itemstack, world, list, flag);
|
||||
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (world != null && minecraft.player != null) {
|
||||
EntityPlayerSP player = minecraft.player;
|
||||
Biome currentBiome = player.world.getBiome(player.getPosition());
|
||||
|
||||
float temperatureValue = ClimateUtil.getTemperature(world, player.getPosition());
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(ClimateUtil.getHumidity(world, player.getPosition()));
|
||||
|
||||
list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.getBiomeName());
|
||||
list.add(Translator.translateToLocal("for.gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature));
|
||||
list.add(Translator.translateToLocal("for.gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,8 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
@@ -21,10 +29,6 @@ import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
|
||||
|
||||
@@ -48,6 +52,11 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier(ItemStack frame) {
|
||||
return beeModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return beeModifier;
|
||||
@@ -55,9 +64,9 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
super.addInformation(stack, playerIn, tooltip, advanced);
|
||||
beeModifier.addInformation(stack, playerIn, tooltip, advanced);
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||
super.addInformation(stack, world, tooltip, advanced);
|
||||
beeModifier.addInformation(stack, world, tooltip, advanced);
|
||||
if (!stack.isItemDamaged()) {
|
||||
tooltip.add(Translator.translateToLocalFormatted("item.for.durability", stack.getMaxDamage()));
|
||||
}
|
||||
@@ -82,7 +91,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||
tooltip.add(Translator.translateToLocalFormatted("item.for.bee.modifier.production", production));
|
||||
tooltip.add(Translator.translateToLocalFormatted("item.for.bee.modifier.genetic.decay", geneticDecay));
|
||||
}
|
||||
|
||||
@@ -15,17 +15,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.items.IColoredItem;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemHoneyComb extends ItemForestry implements IColoredItem {
|
||||
public ItemHoneyComb() {
|
||||
@@ -59,11 +61,13 @@ public class ItemHoneyComb extends ItemForestry implements IColoredItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(i);
|
||||
if (!honeyComb.isSecret() || Config.isDebug) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(i);
|
||||
if (!honeyComb.isSecret() || Config.isDebug) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+12
-8
@@ -10,11 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeeHousingBase;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -30,9 +25,16 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeeHousingBase;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
|
||||
public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegister {
|
||||
private final String[] definition = new String[]{"cart.beehouse", "cart.apiary"};
|
||||
|
||||
@@ -94,9 +96,11 @@ public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < definition.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < definition.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+13
-11
@@ -2,12 +2,6 @@ package forestry.apiculture.items;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.render.ParticleRender;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -21,9 +15,17 @@ 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;
|
||||
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.render.ParticleRender;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class ItemSmoker extends ItemForestry {
|
||||
public ItemSmoker() {
|
||||
super(Tabs.tabApiculture);
|
||||
@@ -72,16 +74,16 @@ public class ItemSmoker extends ItemForestry {
|
||||
} else {
|
||||
handOffset = look.crossProduct(new Vec3d(0, -1, 0));
|
||||
}
|
||||
|
||||
Vec3d lookDistance = new Vec3d(look.xCoord * distance, look.yCoord * distance, look.zCoord * distance);
|
||||
|
||||
Vec3d lookDistance = new Vec3d(look.x * distance, look.y * distance, look.z * distance);
|
||||
Vec3d scaledOffset = handOffset.scale(1.0 / distance);
|
||||
Vec3d smokePos = lookDistance.add(entity.getPositionVector()).add(scaledOffset);
|
||||
|
||||
if (world.isRemote) {
|
||||
ParticleRender.addEntitySmokeFX(world, smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord);
|
||||
ParticleRender.addEntitySmokeFX(world, smokePos.x, smokePos.y + 1, smokePos.z);
|
||||
}
|
||||
|
||||
BlockPos blockPos = new BlockPos(smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord);
|
||||
|
||||
BlockPos blockPos = new BlockPos(smokePos.x, smokePos.y + 1, smokePos.z);
|
||||
TileUtil.actOnTile(world, blockPos, IHiveTile.class, IHiveTile::calmBees);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ICraftingPlan;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemWaxCast extends ItemForestry implements ICraftingPlan {
|
||||
|
||||
@@ -27,7 +28,11 @@ public class ItemWaxCast extends ItemForestry implements ICraftingPlan {
|
||||
@Override
|
||||
public ItemStack planUsed(ItemStack plan, ItemStack result) {
|
||||
plan.setItemDamage(plan.getItemDamage() + result.getCount());
|
||||
return plan;
|
||||
if (plan.getItemDamage() >= plan.getMaxDamage()) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
return plan;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.render;
|
||||
|
||||
import forestry.core.render.ForestryResource;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
@@ -18,9 +17,12 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelAnalyzer extends ModelBase {
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ import forestry.apiculture.inventory.InventoryApiary;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -58,8 +60,11 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
|
||||
beeModifiers.add(beeModifier);
|
||||
|
||||
for (IHiveFrame frame : inventory.getFrames()) {
|
||||
beeModifiers.add(frame.getBeeModifier());
|
||||
for (Tuple<IHiveFrame, ItemStack> frame : inventory.getFrames()) {
|
||||
IHiveFrame hiveFrame = frame.getFirst();
|
||||
ItemStack stack = frame.getSecond();
|
||||
IBeeModifier beeModifier = hiveFrame.getBeeModifier(stack);
|
||||
beeModifiers.add(beeModifier);
|
||||
}
|
||||
|
||||
return beeModifiers;
|
||||
|
||||
@@ -10,12 +10,40 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
@@ -44,29 +72,6 @@ import forestry.core.utils.DamageSourceForestry;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileHive extends TileEntity implements ITickable, IHiveTile, IActivatable, IBeeHousing {
|
||||
private static final DamageSource damageSourceBeeHive = new DamageSourceForestry("bee.hive");
|
||||
@@ -117,12 +122,14 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
if (world.rand.nextInt(angry ? 10 : 200) == 0) {
|
||||
if (calmTime == 0) {
|
||||
if (canWork) {
|
||||
AxisAlignedBB boundingBox = AlleleEffect.getBounding(getContainedBee().getGenome(), this);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, beeTargetPredicate);
|
||||
if (!entities.isEmpty()) {
|
||||
Collections.shuffle(entities);
|
||||
EntityLivingBase entity = entities.get(0);
|
||||
attack(entity, 2);
|
||||
if(world.getWorldInfo().getDifficulty() != EnumDifficulty.PEACEFUL) {
|
||||
AxisAlignedBB boundingBox = AlleleEffect.getBounding(getContainedBee().getGenome(), this);
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, beeTargetPredicate);
|
||||
if (!entities.isEmpty()) {
|
||||
Collections.shuffle(entities);
|
||||
EntityLivingBase entity = entities.get(0);
|
||||
attack(entity, 2);
|
||||
}
|
||||
}
|
||||
beeLogic.doWork();
|
||||
}
|
||||
|
||||
@@ -14,21 +14,23 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Log;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
|
||||
public abstract class HiveDecorator {
|
||||
|
||||
|
||||
Regular → Executable
+25
-22
@@ -15,6 +15,28 @@ 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.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
@@ -41,25 +63,6 @@ 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 {
|
||||
|
||||
@@ -372,12 +375,12 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
@Override
|
||||
protected int chooseProfession(int villagerCount, int currentVillagerProfession) {
|
||||
FMLControlledNamespacedRegistry<VillagerRegistry.VillagerProfession> registry = (FMLControlledNamespacedRegistry<VillagerRegistry.VillagerProfession>) VillagerRegistry.instance().getRegistry();
|
||||
ForgeRegistry<VillagerRegistry.VillagerProfession> registry = (ForgeRegistry<VillagerRegistry.VillagerProfession>) ForgeRegistries.VILLAGER_PROFESSIONS;
|
||||
|
||||
if (villagerCount <= 0) {
|
||||
return registry.getId(PluginApiculture.villagerApiarist);
|
||||
return registry.getID(PluginApiculture.villagerApiarist);
|
||||
} else if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
return registry.getId(PluginArboriculture.villagerArborist);
|
||||
return registry.getID(PluginArboriculture.villagerArborist);
|
||||
} else {
|
||||
return currentVillagerProfession;
|
||||
}
|
||||
|
||||
Regular → Executable
+12
-8
@@ -11,11 +11,9 @@
|
||||
package forestry.arboriculture;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.arboriculture.items.ItemBlockWoodDoor;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -24,9 +22,15 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.arboriculture.items.ItemBlockWoodDoor;
|
||||
|
||||
public class CamouflageHandlerArbDoor implements ICamouflageItemHandler {
|
||||
|
||||
@@ -57,8 +61,8 @@ public class CamouflageHandlerArbDoor implements ICamouflageItemHandler {
|
||||
IBlockState currentState = blockState.getActualState(world, pos);
|
||||
|
||||
ItemBlockWoodDoor itemDoor = (ItemBlockWoodDoor) stack.getItem();
|
||||
|
||||
IBlockState doorState = itemDoor.block.getDefaultState()
|
||||
|
||||
IBlockState doorState = itemDoor.getBlock().getDefaultState()
|
||||
.withProperty(BlockDoor.FACING, currentState.getValue(BlockDoor.FACING))
|
||||
.withProperty(BlockDoor.HINGE, currentState.getValue(BlockDoor.HINGE))
|
||||
.withProperty(BlockDoor.OPEN, currentState.getValue(BlockDoor.OPEN))
|
||||
|
||||
@@ -16,11 +16,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -29,9 +24,16 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class FruitProviderNone implements IFruitProvider {
|
||||
|
||||
private static class OverlayType {
|
||||
|
||||
@@ -17,21 +17,23 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
public class FruitProviderPod extends FruitProviderNone {
|
||||
|
||||
public enum EnumPodType {
|
||||
|
||||
@@ -15,15 +15,16 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
/**
|
||||
* Simple fruit provider which drops from any leaf block according to yield and either marks all leave blocks as fruit leaves or none.
|
||||
*/
|
||||
|
||||
@@ -15,15 +15,16 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public class FruitProviderRipening extends FruitProviderNone {
|
||||
private final Map<ItemStack, Float> products = new HashMap<>();
|
||||
private int colourCallow = 0xffffff;
|
||||
|
||||
@@ -2,6 +2,7 @@ package forestry.arboriculture;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.arboriculture.blocks.BlockAbstractLeaves;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -23,12 +24,19 @@ public class LeafDecayHelper {
|
||||
leafDecayValues = new byte[ARRAY_SIZE][ARRAY_SIZE][ARRAY_SIZE];
|
||||
}
|
||||
|
||||
public static void leafDecay(BlockLeaves leaves, World world, BlockPos pos) {
|
||||
public static void leafDecay(BlockAbstractLeaves leaves, World world, BlockPos pos) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
// Fix a bug where Forestry leaves were not decayable.
|
||||
// The non-decayable Forestry leaves are all BlockDecorativeLeaves.
|
||||
if (!state.getValue(BlockLeaves.DECAYABLE)) {
|
||||
state = state.withProperty(BlockLeaves.DECAYABLE, true);
|
||||
world.setBlockState(pos, state);
|
||||
}
|
||||
|
||||
if (state.getValue(BlockLeaves.CHECK_DECAY) && state.getValue(BlockLeaves.DECAYABLE)) {
|
||||
byte radius = 4;
|
||||
int arrayOffset = ARRAY_SIZE / 2;
|
||||
|
||||
Regular → Executable
+66
-100
@@ -10,16 +10,48 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockNewLeaf;
|
||||
import net.minecraft.block.BlockOldLeaf;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
@@ -33,12 +65,13 @@ import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IBlockTranslator;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IItemTranslator;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.blocks.BlockArbLog;
|
||||
import forestry.arboriculture.blocks.BlockArbSlab;
|
||||
import forestry.arboriculture.blocks.BlockDefaultLeaves;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.capabilities.ArmorNaturalist;
|
||||
@@ -52,7 +85,6 @@ import forestry.arboriculture.genetics.TreeRoot;
|
||||
import forestry.arboriculture.genetics.TreekeepingMode;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleFruits;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleLeafEffects;
|
||||
import forestry.arboriculture.items.ItemGermlingGE;
|
||||
import forestry.arboriculture.items.ItemGrafter;
|
||||
import forestry.arboriculture.items.ItemRegistryArboriculture;
|
||||
import forestry.arboriculture.models.TextureLeaves;
|
||||
@@ -81,36 +113,6 @@ import forestry.core.utils.VillagerTradeLists;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockNewLeaf;
|
||||
import net.minecraft.block.BlockOldLeaf;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.ARBORICULTURE, name = "Arboriculture", author = "Binnie & SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.arboriculture.description")
|
||||
public class PluginArboriculture extends BlankForestryPlugin {
|
||||
@@ -252,7 +254,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
if (Config.enableVillagers) {
|
||||
villagerArborist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_ARBORIST, Constants.TEXTURE_SKIN_LUMBERJACK, Constants.TEXTURE_SKIN_ZOMBIE_LUMBERJACK);
|
||||
VillagerRegistry.instance().register(villagerArborist);
|
||||
ForgeRegistries.VILLAGER_PROFESSIONS.register(villagerArborist);
|
||||
|
||||
VillagerRegistry.VillagerCareer arboristCareer = new VillagerRegistry.VillagerCareer(villagerArborist, "arborist");
|
||||
arboristCareer.addTrade(1,
|
||||
@@ -322,29 +324,29 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
if (woodType instanceof EnumForestryWoodType) {
|
||||
planks.setCount(4);
|
||||
logs.setCount(1);
|
||||
RecipeUtil.addShapelessRecipe(planks.copy(), logs.copy());
|
||||
RecipeUtil.addShapelessRecipe("planks_" + woodType.getName(), planks.copy(), logs.copy());
|
||||
|
||||
slabs.setCount(6);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(slabs.copy(), "###", '#', planks.copy());
|
||||
RecipeUtil.addRecipe("slabs_" + woodType.getName(), slabs.copy(), "###", '#', planks.copy());
|
||||
|
||||
fences.setCount(3);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(fences.copy(),
|
||||
RecipeUtil.addRecipe("fences_" + woodType.getName(), fences.copy(),
|
||||
"#X#",
|
||||
"#X#",
|
||||
'#', planks.copy(), 'X', "stickWood");
|
||||
|
||||
fenceGates.setCount(1);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(fenceGates.copy(),
|
||||
RecipeUtil.addRecipe("fence_gates_" + woodType.getName(), fenceGates.copy(),
|
||||
"X#X",
|
||||
"X#X",
|
||||
'#', planks.copy(), 'X', "stickWood");
|
||||
|
||||
stairs.setCount(4);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(stairs.copy(),
|
||||
RecipeUtil.addRecipe("stairs_" + woodType.getName(), stairs.copy(),
|
||||
"# ",
|
||||
"## ",
|
||||
"###",
|
||||
@@ -352,7 +354,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
doors.setCount(3);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(doors.copy(),
|
||||
RecipeUtil.addRecipe("doors_" + woodType.getName(), doors.copy(),
|
||||
"## ",
|
||||
"## ",
|
||||
"## ",
|
||||
@@ -361,31 +363,31 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
fireproofPlanks.setCount(4);
|
||||
fireproofLogs.setCount(1);
|
||||
RecipeUtil.addShapelessRecipe(fireproofPlanks.copy(), fireproofLogs.copy());
|
||||
RecipeUtil.addShapelessRecipe("fireproof_planks_" + woodType.getName(), fireproofPlanks.copy(), fireproofLogs.copy());
|
||||
|
||||
fireproofSlabs.setCount(6);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(fireproofSlabs.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_slabs_" + woodType.getName(), fireproofSlabs.copy(),
|
||||
"###",
|
||||
'#', fireproofPlanks.copy());
|
||||
|
||||
fireproofFences.setCount(3);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(fireproofFences.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_fences_" + woodType.getName(), fireproofFences.copy(),
|
||||
"#X#",
|
||||
"#X#",
|
||||
'#', fireproofPlanks.copy(), 'X', "stickWood");
|
||||
|
||||
fireproofFenceGates.setCount(1);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(fireproofFenceGates.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_fence_gates_" + woodType.getName(), fireproofFenceGates.copy(),
|
||||
"X#X",
|
||||
"X#X",
|
||||
'#', fireproofPlanks.copy(), 'X', "stickWood");
|
||||
|
||||
fireproofStairs.setCount(4);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(fireproofStairs.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_stairs_" + woodType.getName(), fireproofStairs.copy(),
|
||||
"# ",
|
||||
"## ",
|
||||
"###",
|
||||
@@ -393,7 +395,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
doors.setCount(3);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(doors.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_doors_" + woodType.getName(), doors.copy(),
|
||||
"## ",
|
||||
"## ",
|
||||
"## ",
|
||||
@@ -435,23 +437,19 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.PLUM.getStack(), Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.5f)), mulch, mulchMultiplier * 3);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.PAPAYA.getStack(), Fluids.JUICE.getFluid(juiceMultiplier * 3), mulch, (int) Math.floor(mulchMultiplier * 0.5f));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, EnumFruit.DATES.getStack(), Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.25)), mulch, mulchMultiplier);
|
||||
|
||||
NonNullList<ItemStack> saplings = NonNullList.create();
|
||||
items.sapling.addCreativeItems(saplings, false);
|
||||
for (ItemStack sapling : saplings) {
|
||||
RecipeUtil.addFermenterRecipes(sapling, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
|
||||
}
|
||||
|
||||
RecipeUtil.addFermenterRecipes(new ItemStack(items.sapling, 1, OreDictionary.WILDCARD_VALUE), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
|
||||
}
|
||||
|
||||
// Grafter
|
||||
RecipeUtil.addRecipe(items.grafter.getItemStack(),
|
||||
RecipeUtil.addRecipe("grafter", items.grafter.getItemStack(),
|
||||
" B",
|
||||
" # ",
|
||||
"# ",
|
||||
'B', "ingotBronze",
|
||||
'#', "stickWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.treeChest,
|
||||
RecipeUtil.addRecipe("tree_chest", blocks.treeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -460,10 +458,10 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
'Y', "chestWood");
|
||||
|
||||
//Wood Pile
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(blocks.woodPile), OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD);
|
||||
RecipeUtil.addShapelessRecipe("wood_pile", new ItemStack(blocks.woodPile), OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD);
|
||||
|
||||
//Dirt Pile Block
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(blocks.loam, 4), Items.CLAY_BALL, coreItems.fertilizerBio, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, coreItems.fertilizerBio, Items.CLAY_BALL);
|
||||
RecipeUtil.addShapelessRecipe("loam", new ItemStack(blocks.loam, 4), Items.CLAY_BALL, coreItems.compost, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, coreItems.compost, Items.CLAY_BALL);
|
||||
}
|
||||
|
||||
private static void registerAlleles() {
|
||||
@@ -530,11 +528,17 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new FuelHandler(getItems().sapling);
|
||||
for (BlockDefaultLeaves leaves : getBlocks().leavesDefault) {
|
||||
TreeManager.treeRoot.registerTranslator(leaves, (IBlockTranslator<IIndividual>) blockState -> {
|
||||
TreeDefinition treeDefinition = leaves.getTreeDefinition(blockState);
|
||||
if (treeDefinition != null) {
|
||||
return treeDefinition.getIndividual();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -563,49 +567,11 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
hiddenItems.add(new ItemStack(getBlocks().saplingGE));
|
||||
}
|
||||
|
||||
private static class FuelHandler implements IFuelHandler {
|
||||
private final ItemGermlingGE sapling;
|
||||
|
||||
public FuelHandler(ItemGermlingGE sapling) {
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
Item item = fuel.getItem();
|
||||
if (sapling == item) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
if(Item.getItemFromBlock(blocks.charcoal) == item){
|
||||
return 16000;
|
||||
}
|
||||
if(Item.getItemFromBlock(blocks.woodPile) == item){
|
||||
return 1200;
|
||||
}
|
||||
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
|
||||
if (block instanceof IWoodTyped) {
|
||||
IWoodTyped woodTypedBlock = (IWoodTyped) block;
|
||||
if (woodTypedBlock.isFireproof()) {
|
||||
return 0;
|
||||
} else if (block instanceof BlockArbSlab) {
|
||||
return 150;
|
||||
} else {
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(TextureStitchEvent.Pre event) {
|
||||
TextureLeaves.registerAllSprites();
|
||||
WoodTextureManager.parseFile(Minecraft.getMinecraft().getResourceManager());
|
||||
WoodTextureManager.parseFile();
|
||||
for (IAlleleFruit alleleFruit : AlleleFruits.getFruitAlleles()) {
|
||||
alleleFruit.getProvider().registerSprites();
|
||||
}
|
||||
|
||||
@@ -3,21 +3,22 @@ package forestry.arboriculture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
import forestry.api.arboriculture.IWoodItemMeshDefinition;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.arboriculture.models.WoodModelLoader;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class WoodHelper {
|
||||
|
||||
@@ -77,16 +78,18 @@ public class WoodHelper {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
if (!WoodModelLoader.INSTANCE.isEnabled) {
|
||||
return new ModelResourceLocation(getDefaultModelLocation(stack), "inventory");
|
||||
}
|
||||
int meta = stack.getMetadata();
|
||||
IWoodType woodType = wood.getWoodType(meta);
|
||||
WoodBlockKind blockKind = wood.getBlockKind();
|
||||
if (woodType instanceof EnumVanillaWoodType) {
|
||||
return new ModelResourceLocation("minecraft:" + woodType + "_" + blockKind, "inventory");
|
||||
} else {
|
||||
return ModelManager.getInstance().getModelLocation(blockKind + "/" + woodType);
|
||||
String modID = Constants.MOD_ID;
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if(block != null){
|
||||
modID = block.getRegistryName().getResourceDomain();
|
||||
}
|
||||
return new ModelResourceLocation(modID + ":" + blockKind + "/" + woodType, "inventory");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IToolGrafter;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.arboriculture.LeafDecayHelper;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
/**
|
||||
* Parent class for shared behavior between {@link BlockDefaultLeaves} and {@link BlockForestryLeaves}
|
||||
*/
|
||||
public abstract class BlockAbstractLeaves extends BlockLeaves implements IItemModelRegister, IColoredBlock {
|
||||
@Nullable
|
||||
protected abstract ITree getTree(IBlockAccess world, BlockPos pos);
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
LeafDecayHelper.leafDecay(this, world, pos);
|
||||
}
|
||||
|
||||
public abstract int getMetaFromState(IBlockState state);
|
||||
|
||||
public abstract IBlockState getStateFromMeta(int meta);
|
||||
|
||||
@Override
|
||||
public final void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
// creative menu shows BlockDecorativeLeaves instead of these
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
ITree tree = getTree(world, pos);
|
||||
if (tree == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return tree.getGenome().getDecorativeLeaves();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
ITree tree = getTree(world, pos);
|
||||
if (tree == null) {
|
||||
tree = TreeDefinition.Oak.getIndividual();
|
||||
}
|
||||
|
||||
ItemStack decorativeLeaves = tree.getGenome().getDecorativeLeaves();
|
||||
if (decorativeLeaves.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
return Collections.singletonList(decorativeLeaves);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
ITree tree = getTree(worldIn, pos);
|
||||
if (tree != null && TreeDefinition.Willow.getUID().equals(tree.getIdent())) {
|
||||
return null;
|
||||
}
|
||||
return super.getCollisionBoundingBox(blockState, worldIn, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for walking through willow leaves.
|
||||
*/
|
||||
@Override
|
||||
public final void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
|
||||
super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn);
|
||||
entityIn.motionX *= 0.4D;
|
||||
entityIn.motionZ *= 0.4D;
|
||||
}
|
||||
|
||||
/* RENDERING */
|
||||
@Override
|
||||
public final boolean isOpaqueCube(IBlockState state) {
|
||||
return !Proxies.render.fancyGraphicsEnabled();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
return (Proxies.render.fancyGraphicsEnabled() || blockAccess.getBlockState(pos.offset(side)).getBlock() != this) &&
|
||||
BlockUtil.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED; // fruit overlays require CUTOUT_MIPPED, even in Fast graphics
|
||||
}
|
||||
|
||||
/**
|
||||
* unused, just here to satisfy BlockLeaves
|
||||
*/
|
||||
@Override
|
||||
public final BlockPlanks.EnumType getWoodType(int meta) {
|
||||
return BlockPlanks.EnumType.OAK;
|
||||
}
|
||||
|
||||
/* PROPERTIES */
|
||||
@Override
|
||||
public final int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 60;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
if (face == EnumFacing.DOWN) {
|
||||
return 20;
|
||||
} else if (face != EnumFacing.UP) {
|
||||
return 10;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
/* DROP HANDLING */
|
||||
// Hack: When harvesting leaves we need to get the drops in onBlockHarvested,
|
||||
// because there is no Player parameter in getDrops()
|
||||
// and Mojang destroys the block and tile before calling getDrops.
|
||||
private final ThreadLocal<NonNullList<ItemStack>> drops = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* {@link IToolGrafter}'s drop bonus handling is done here.
|
||||
*/
|
||||
@Override
|
||||
public final void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getActiveItemStack());
|
||||
float saplingModifier = 1.0f;
|
||||
|
||||
ItemStack heldStack = player.inventory.getCurrentItem();
|
||||
Item heldItem = heldStack.getItem();
|
||||
if (heldItem instanceof IToolGrafter) {
|
||||
IToolGrafter grafter = (IToolGrafter) heldItem;
|
||||
saplingModifier = grafter.getSaplingModifier(heldStack, world, player, pos);
|
||||
heldStack.damageItem(1, player);
|
||||
if (heldStack.isEmpty()) {
|
||||
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldStack, EnumHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
|
||||
GameProfile playerProfile = player.getGameProfile();
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
getLeafDrop(drops, world, playerProfile, pos, saplingModifier, fortune);
|
||||
this.drops.set(drops);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> ret = this.drops.get();
|
||||
this.drops.remove();
|
||||
if (ret != null) {
|
||||
drops.addAll(ret);
|
||||
} else {
|
||||
// leaves not harvested, get drops normally
|
||||
getLeafDrop(drops, (World) world, null, pos, 1.0f, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune);
|
||||
}
|
||||
@@ -1,12 +1,5 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
@@ -18,12 +11,20 @@ import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
public class BlockCharcoal extends Block implements IStateMapperRegister, IItemModelRegister {
|
||||
|
||||
public static final PropertyInteger AMOUNT = PropertyInteger.create("amount", 0, 15);
|
||||
@@ -44,7 +45,9 @@ public class BlockCharcoal extends Block implements IStateMapperRegister, IItemM
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0);
|
||||
for(int i = 0;i < 16;i++){
|
||||
manager.registerItemModel(item, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,11 +61,11 @@ public class BlockCharcoal extends Block implements IStateMapperRegister, IItemM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if(state.getValue(AMOUNT) > 0){
|
||||
return Collections.singletonList(new ItemStack(Items.COAL, state.getValue(AMOUNT) + 9, 1));
|
||||
drops.add(new ItemStack(Items.COAL, state.getValue(AMOUNT) + 9, 1));
|
||||
}
|
||||
return super.getDrops(world, pos, state, fortune);
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
Regular → Executable
+15
-12
@@ -5,14 +5,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -32,11 +24,22 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public abstract class BlockDecorativeLeaves extends Block implements IItemModelRegister, IColoredBlock, IShearable {
|
||||
private static final int VARIANTS_PER_BLOCK = 16;
|
||||
|
||||
@@ -79,10 +82,10 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (IBlockState state : getBlockState().getValidStates()) {
|
||||
int meta = getMetaFromState(state);
|
||||
ItemStack itemStack = new ItemStack(itemIn, 1, meta);
|
||||
ItemStack itemStack = new ItemStack(this, 1, meta);
|
||||
list.add(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -158,8 +161,8 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
|
||||
/**
|
||||
* Genetic leaves with no tile entity, used for worldgen trees.
|
||||
* Similar to decorative leaves, but these will drop saplings and can be used for pollination.
|
||||
*/
|
||||
public abstract class BlockDefaultLeaves extends BlockAbstractLeaves {
|
||||
private static final int VARIANTS_PER_BLOCK = 4;
|
||||
|
||||
public static List<BlockDefaultLeaves> create() {
|
||||
List<BlockDefaultLeaves> blocks = new ArrayList<>();
|
||||
final int blockCount = PropertyTreeType.getBlockCount(VARIANTS_PER_BLOCK);
|
||||
for (int blockNumber = 0; blockNumber < blockCount; blockNumber++) {
|
||||
final PropertyTreeType variant = PropertyTreeType.create("variant", blockNumber, VARIANTS_PER_BLOCK);
|
||||
BlockDefaultLeaves block = new BlockDefaultLeaves(blockNumber) {
|
||||
@Override
|
||||
public PropertyTreeType getVariant() {
|
||||
return variant;
|
||||
}
|
||||
};
|
||||
blocks.add(block);
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
private final int blockNumber;
|
||||
|
||||
public BlockDefaultLeaves(int blockNumber) {
|
||||
this.blockNumber = blockNumber;
|
||||
PropertyTreeType variant = getVariant();
|
||||
setDefaultState(this.blockState.getBaseState()
|
||||
.withProperty(variant, variant.getFirstType())
|
||||
.withProperty(CHECK_DECAY, false)
|
||||
.withProperty(DECAYABLE, true));
|
||||
}
|
||||
|
||||
public int getBlockNumber() {
|
||||
return blockNumber;
|
||||
}
|
||||
|
||||
protected abstract PropertyTreeType getVariant();
|
||||
|
||||
@Nullable
|
||||
public TreeDefinition getTreeDefinition(IBlockState blockState) {
|
||||
if (blockState.getBlock() == this) {
|
||||
return blockState.getValue(getVariant());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
TreeDefinition treeDefinition = getTreeDefinition(state);
|
||||
if (treeDefinition == null) {
|
||||
return 0;
|
||||
}
|
||||
return treeDefinition.getMetadata() - blockNumber * VARIANTS_PER_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState()
|
||||
.withProperty(getVariant(), getTreeType(meta))
|
||||
.withProperty(DECAYABLE, (meta & 4) == 0)
|
||||
.withProperty(CHECK_DECAY, (meta & 8) > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = damageDropped(state);
|
||||
|
||||
if (!state.getValue(DECAYABLE)) {
|
||||
i |= 4;
|
||||
}
|
||||
|
||||
if (state.getValue(CHECK_DECAY)) {
|
||||
i |= 8;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, getVariant(), CHECK_DECAY, DECAYABLE);
|
||||
}
|
||||
|
||||
public TreeDefinition getTreeType(int meta) {
|
||||
int variantCount = getVariant().getAllowedValues().size();
|
||||
int variantMeta = (meta % variantCount) + blockNumber * VARIANTS_PER_BLOCK;
|
||||
return TreeDefinition.byMetadata(variantMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
|
||||
ITree tree = getTree(world, pos);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add saplings
|
||||
List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier);
|
||||
for (ITree sapling : saplings) {
|
||||
if (sapling != null) {
|
||||
drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
|
||||
}
|
||||
}
|
||||
|
||||
// Add fruits
|
||||
ITreeGenome genome = tree.getGenome();
|
||||
IFruitProvider fruitProvider = genome.getFruitProvider();
|
||||
if (fruitProvider.isFruitLeaf(genome, world, pos)) {
|
||||
NonNullList<ItemStack> produceStacks = tree.produceStacks(world, pos, Integer.MAX_VALUE);
|
||||
drops.addAll(produceStacks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
TreeDefinition type = getTreeType(meta);
|
||||
return getDefaultState().withProperty(getVariant(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (IBlockState state : blockState.getValidStates()) {
|
||||
int meta = getMetaFromState(state);
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation("forestry:leaves.default." + blockNumber, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ITree getTree(IBlockAccess world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
TreeDefinition treeDefinition = getTreeDefinition(blockState);
|
||||
if (treeDefinition != null) {
|
||||
return treeDefinition.getIndividual();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
|
||||
TreeDefinition treeDefinition = getTreeDefinition(state);
|
||||
if (treeDefinition == null) {
|
||||
treeDefinition = TreeDefinition.Oak;
|
||||
}
|
||||
ITreeGenome genome = treeDefinition.getGenome();
|
||||
|
||||
if (tintIndex == 0) {
|
||||
return genome.getPrimary().getLeafSpriteProvider().getColor(false);
|
||||
} else {
|
||||
IFruitProvider fruitProvider = genome.getFruitProvider();
|
||||
return fruitProvider.getDecorativeColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
Regular → Executable
+22
-44
@@ -2,6 +2,27 @@ package forestry.arboriculture.blocks;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
@@ -10,31 +31,8 @@ import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.proxy.ProxyArboricultureClient;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends BlockFence implements IWoodTyped, IItemModelRegister, IStateMapperRegister {
|
||||
protected static final int VARIANTS_PER_BLOCK = 16;
|
||||
@@ -74,26 +72,6 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
|
||||
return blockNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
||||
IBlockState blockState = worldIn.getBlockState(pos);
|
||||
Block block = blockState.getBlock();
|
||||
if (PluginArboriculture.validFences.contains(block)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block != Blocks.BARRIER) {
|
||||
Material blockMaterial = blockState.getMaterial();
|
||||
if (block instanceof BlockFence || block instanceof BlockFenceGate) {
|
||||
return blockMaterial == this.blockMaterial;
|
||||
}
|
||||
if (blockMaterial.isOpaque() && blockState.isFullCube() && blockMaterial != Material.GOURD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Models */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
@@ -166,7 +144,7 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (T woodType : getVariant().getAllowedValues()) {
|
||||
list.add(TreeManager.woodAccess.getStack(woodType, getBlockKind(), fireproof));
|
||||
}
|
||||
|
||||
Loaded 100 of 514 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user