Compare commits

..
84 Commits
Author SHA1 Message Date
mezz 0a37ad0666 First beta version 2017-07-28 23:31:04 -07:00
mezz 13d4907bff #1687 Fix crash when genetics items are missing nbt 2017-07-28 23:28:43 -07:00
mezz 78725009c1 Fix #1777 crash on load from backpacks 2017-07-28 23:13:51 -07:00
mezz a1bc9144bd Fix #1768 fix serious issues with the worktable 2017-07-27 22:39:49 -07:00
Nedelosk b897056824 Fix #1772 crash if forestry.factory=false 2017-07-28 00:11:03 +02:00
Nedelosk 87563b6c97 Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2017-07-25 16:01:11 +02:00
Nedelosk 62d6294da2 Fix Fertilizer Config from 1.10 to 1.11 / 1.12 2017-07-25 16:01:01 +02:00
Robert Obermeier b4d71543db Move hives into biome decoration generation
fixes #1760
2017-07-24 22:33:21 -07:00
mezz 73db1a608a Fix #1741 Fix recipes for farm blocks only allow quartz 2017-07-17 23:41:18 -07:00
Brennan Ward 1c6b60122e Update to AA r115 2017-07-15 17:51:15 -07:00
mezz 1e7a042b53 Fix missing item/block event handling 2017-07-12 22:47:26 -07:00
mezz bf08336bc5 Fix JEI dependency info 2017-07-09 21:02:15 -07:00
mezz 62cbf31ac2 Version 5.4.3 2017-07-03 17:22:56 -07:00
mezz a2eac214b4 Minor cleanup 2017-07-03 17:22:39 -07:00
Nedelosk 32933ce90b Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2017-07-04 02:15:42 +02:00
Nedelosk 44cdc191fc Fix #1732 Forestry - Blocks all look the same when placed 2017-07-04 02:15:30 +02:00
mezz e4f77e42d3 Fix #1237 Fireproof blocks work as fuel 2017-07-03 16:52:45 -07:00
mezz 9f91832c7e Experiment updating Gradle Wrapper to 4.0 2017-07-03 15:26:50 -07:00
mezz 6d4af0fb5d Version 5.4.2 2017-07-03 00:17:10 -07:00
mezz 4345739a87 Merge remote-tracking branch 'origin/mc-1.11' into mc-1.12 2017-07-03 00:15:34 -07:00
mezz 0a881a81f8 Fix worktable crafting (#1728) 2017-07-03 00:12:58 -07:00
mezz b066f7ad4c Create proper recipe registry names 2017-07-03 00:06:31 -07:00
mezz a19380347a Fix missing textures on butterfly items (#1730) 2017-07-02 21:31:49 -07:00
mezz 9bc1211e57 Fix missing textures on machine tabs (#1730) 2017-07-02 21:31:29 -07:00
mezz cbce5d0fc0 Cleanup 2017-07-02 21:31:03 -07:00
mezz b20b56c5d4 Update Forge 2017-07-02 21:30:40 -07:00
mezz 27041c205c Fix #1723 Items show in the wrong creative tabs 2017-07-02 01:00:28 -07:00
mezz 00504d4096 Version 5.4.1 2017-07-02 00:51:29 -07:00
mezz ed0c5e1a7e Move away from deprecated JEI classes 2017-07-02 00:51:06 -07:00
mezz ddf90f4ee0 Update Forge to Recommended Build 2017-07-02 00:47:37 -07:00
mezz 39290512cf Fix GUIs drawing without the black background 2017-06-26 20:02:45 -07:00
Nedelosk 09ea20729d Improve Wood Model Loader 2017-06-26 14:00:41 +02:00
Nedelosk 736e6c5fa2 Change wood texture json file name 2017-06-25 15:33:00 +02:00
Nedelosk e96f4fc8a0 Fix Fence Gate Model 2017-06-25 11:55:25 +02:00
mezz bbe1f539dd Update cursegradle plugin 2017-06-24 22:22:42 -07:00
mezz 1fcaacd41b Stop using some deprecated methods and classes 2017-06-24 22:10:55 -07:00
mezz 7306764c51 Initial update to Minecraft 1.12 2017-06-24 21:49:47 -07:00
Nedelosk d3c7280f3f Fix #1712 1.11.2 Ferementer does not work when sappinessHigh 2017-06-23 20:23:38 +02:00
Nedelosk 2c6ed06574 More Recipe Clean Up 2017-06-23 18:56:30 +02:00
Nedelosk 81e2e18089 Clean Up Carpenter and Fabricator RecipeManagers 2017-06-23 18:50:51 +02:00
Nedelosk 7b7e7eb7e7 Update formatting-settings to 1.11.2
Changed IMPORT_LAYOUT cpw.mods.fml to net.minecraftforge.fml
2017-06-23 18:30:39 +02:00
Nedelosk 944aaf3297 Fix #1715 Forestry 1.11.2 trees spawn even when disabled in config 2017-06-22 14:57:47 +02:00
Nedelosk 5a5793f243 Fix forestry slab brightness 2017-06-22 14:54:40 +02:00
Nedelosk 5e41a4d2c0 Fix #1676 Soldering Iron usage has insufficient server-side validation 2017-06-21 22:01:46 +02:00
Nedelosk c4ac0bc7a5 Fix #1685 1.11.2 crashing when rendering item 2017-06-21 21:53:11 +02:00
Nedelosk 5549cfaaa1 Fix #1674 Forestry logs do not triggers Getting Wood Achievement 2017-06-21 21:45:56 +02:00
Nedelosk ae4d246c59 Fix #1690 Backpack does not resupply the offhand 2017-06-21 21:45:22 +02:00
Nedelosk 2622557a00 Fix #1702 Slabs not blocking light 2017-06-21 20:58:42 +02:00
Nedelosk 339abedeee Fix 1.11 Bees do damage on peaceful mode 2017-06-21 20:47:03 +02:00
Nedelosk 149b35224a Fix #1714 Wax cast negative durability 2017-06-21 20:34:38 +02:00
Nedelosk d148279224 Fix Bottler JEI integration 2017-06-18 01:45:53 +02:00
Nedelosk 554fe8bad1 Add tintindex to the door models 2017-06-17 13:59:00 +02:00
Nedelosk 27e8259ff6 Move the bee allele register event to the preInit 2017-06-15 19:50:48 +02:00
mezz 3a51df154a Update JEI integration 2017-06-06 23:50:11 -07:00
mezz a3c79c0427 Fix leaves spawning near 0,0,0 2017-06-04 13:34:59 -07:00
mezz f569a04797 Fix backpack pickup handler 2017-05-10 15:27:01 -07:00
mezz 610ddfed12 Update dependencies 2017-05-10 15:18:53 -07:00
mezz 438883bb8e Change IAllele.getName to IAllele.getAlleleName to fix obfuscation bugs 2017-05-10 00:06:30 -07:00
mezz 828dd63acd Fix #1681 Worldgen leaves are not decaying 2017-05-07 17:40:31 -07:00
mezz f7cc35d949 Add new default leaf block without tile entity for worldgen trees #1661 2017-05-03 17:15:58 -07:00
AlexIIL ec9004b50b Fix names in BC|Transport compat
As with the update to 1.11 BC|Transport now has a modid of "buildcrafttransport", and the pipeWaterproof has been renamed to "waterproof".

You *might* want to rename this plugin from "BuildCraft 6 Transport" to "BuildCraft 8 Transport" - but that's minor.

The api for getting BC items is [here](https://github.com/BuildCraft/BuildCraftAPI/blob/8.0.x/api/buildcraft/api/BCItems.java#L123), so thet's where the registry names came from (and they won't be changed in 8.0.x or 7.99.x) in case I've made a mistake.
2017-04-29 13:19:25 -07:00
Nedelosk 8b4c1a5dab Fix #1667 Unable to open Electrical Engine GUI 2017-04-22 00:18:02 +02:00
Nedelosk 853355062e Fix #1666 Crash 1.11.2 2017-04-21 22:34:00 +02:00
Nedelosk 834e3ed55a Readd Ic2 Integration 2017-04-21 22:30:37 +02:00
Nedelosk 5b2b0bfc95 Fix #1657 Charcoal Pit - Silk Touch 2017-04-11 21:35:02 +02:00
Nedelosk 4fae8c26d9 Allow other mods to register fruit blocks 2017-04-10 01:19:49 +02:00
Nedelosk 0aa4a0f794 Add AlleleRegisterEvent 2017-04-10 00:23:39 +02:00
Nedelosk ac0864303c Clean Up Climate Region 2017-04-08 20:46:57 +02:00
Nedelosk 8811b24811 Merge branch 'mc-1.11' of https://github.com/ForestryMC/ForestryMC into mc-1.11 2017-04-08 19:37:15 +02:00
Nedelosk 904293f407 Move go home to get getBlockPathWeight 2017-04-08 19:37:07 +02:00
mezz 3e175aa8e6 Use improved Forge LootTableLoadEvent, remove hacky LootTableLoader 2017-04-07 22:09:44 -07:00
Nedelosk c4ecdde110 Fix #1426 A way to change how much sand an tree multifarm gives when a tree grows 2017-04-07 21:44:20 +02:00
Nedelosk 4aa978023d Fix #1539 Immersive engineering Ethanol doesn’t work with Bio Generator 2017-04-07 19:46:46 +02:00
Nedelosk 50009786d8 Fix #1546 Electric Engine via MFSU 2017-04-07 19:10:19 +02:00
Nedelosk 032d706fc4 Fix #1594 EnderLillySeeds not accept for farm 2017-04-07 18:37:52 +02:00
Nedelosk dcd9e90898 Fix butterfly pollen 2017-04-07 18:29:03 +02:00
Nedelosk bab3479cde Add Cache to greenhouse nursery and clean up 2017-04-07 17:45:45 +02:00
Nedelosk a5b79c97d2 Improve greenhouse recipes 2017-04-07 14:12:42 +02:00
Nedelosk 05d6dc3d4a Fix greenhouse door model 2017-04-07 13:29:25 +02:00
Nedelosk 6e2ed37e80 Fix #1652 A way to make Cobwebs out of Silk Wisps and fix greenhouse item models 2017-04-07 13:21:39 +02:00
Nedelosk c840945706 Add missing changes 2017-04-07 13:10:28 +02:00
Nedelosk ca7d6dbc66 Add honey comb blocks and improve greenhouse nursery 2017-04-07 12:55:34 +02:00
Nedelosk 81ef5d536f Add missing changes 2017-04-06 01:11:27 +02:00
Nedelosk f911100c3d Clean Up and update version 2017-04-06 00:17:41 +02:00
487 changed files with 7255 additions and 5382 deletions

No files matched your search

+11 -20
View File
@@ -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 "net.darkhax.tesla:Tesla-${mcversion}:${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.industrial-craft:industrialcraft-2:${ic2_version}:api"
}
configurations {
@@ -149,18 +151,7 @@ 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 {
@@ -169,7 +160,7 @@ curseforge {
id = '59751'
changelog = file('changelog.html')
changelogType = 'html'
releaseType = 'alpha'
releaseType = 'beta'
}
}
+9
View File
@@ -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
+8 -8
View File
@@ -1,11 +1,11 @@
mcversion=1.11.2
forgeversion=13.20.0.2262
mcp_mappings=snapshot_20161220
mcversion=1.12
forgeversion=14.21.1.2424
mcp_mappings=snapshot_20170703
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
jei_version=4.7.2.77
ic2_version=2.7.30-ex111
version_major=5
version_minor=3
version_patch=2
version_minor=5
version_patch=0
Binary file not shown.
+6 -6
View File
@@ -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
Vendored
+1 -5
View File
@@ -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...f5300f059b.
+22 -25
View File
@@ -10,10 +10,25 @@
******************************************************************************/
package forestry;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import java.io.File;
import com.google.common.base.Preconditions;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.core.EventHandlerCore;
import forestry.core.climate.ClimateEventHandler;
@@ -26,22 +41,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 +52,13 @@ 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]",
dependencies = "required-after:forge@[14.21.1.2395,);"
+ "after:jei@[4.7.0,);"
+ "after:" + PluginIC2.modId + ";")
public class Forestry {
@SuppressWarnings("NullableProblems")
@@ -145,9 +147,4 @@ public class Forestry {
public void processIMCMessages(IMCEvent event) {
PluginManager.processIMCMessages(event.getMessages());
}
@EventHandler
public void onMissingMappings(FMLMissingMappingsEvent event) {
MigrationHelper.onMissingMappings(event);
}
}
@@ -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();
}
+3 -3
View File
@@ -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));
}
}
+3 -2
View File
@@ -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 {
@@ -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();
+1 -1
View File
@@ -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();
+4 -2
View File
@@ -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.
+87 -70
View File
@@ -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,40 @@ 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.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.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 net.minecraftforge.registries.IForgeRegistry;
import forestry.Forestry;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeType;
@@ -38,6 +73,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 +131,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 +311,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 +437,87 @@ 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 i = 0;i < blocks.beeCombs.length;i++){
BlockHoneyComb block = blocks.beeCombs[i];
for(int m = 0;m < EnumHoneyComb.VALUES.length - i * 16;m++){
RecipeUtil.addRecipe("comb." + m, new ItemStack(block, 1, m),
"###",
"###",
"###", '#', items.beeComb.get(EnumHoneyComb.get(i * 16 + m), 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 +529,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 +563,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 +578,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 +586,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 +594,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 +602,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 +657,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 +758,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 +766,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 +774,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#",
"###",
@@ -883,9 +898,11 @@ public class PluginApiculture extends BlankForestryPlugin {
}
@Override
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
public void decorateBiome(World world, Random rand, BlockPos pos) {
if (Config.getBeehivesAmount() > 0.0) {
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
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 {
+23 -20
View File
@@ -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"));
}
}
+20 -23
View File
@@ -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();
}
}
+21 -21
View File
@@ -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");
}
}
}
@@ -13,6 +13,7 @@ package forestry.apiculture.blocks;
import java.util.Map;
import forestry.api.core.Tabs;
import forestry.apiculture.items.ItemBlockHoneyComb;
import forestry.apiculture.items.ItemBlockCandle;
import forestry.core.blocks.BlockBase;
import forestry.core.blocks.BlockRegistry;
@@ -27,6 +28,7 @@ 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() {
@@ -48,6 +50,12 @@ public class BlockRegistryApiculture extends BlockRegistry {
registerBlock(candle, new ItemBlockCandle(candle), "candle");
stump = new BlockStump();
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()) {
+9 -7
View File
@@ -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();
+5 -5
View File
@@ -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();
}
+16 -15
View File
@@ -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
+16 -15
View File
@@ -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
+16 -15
View File
@@ -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
+3 -1
View File
@@ -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 {
+20 -17
View File
@@ -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.
+8 -6
View File
@@ -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;
}
+8 -6
View File
@@ -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;
}
@@ -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"));
}
@@ -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) {
@@ -0,0 +1,29 @@
package forestry.apiculture.items;
import forestry.apiculture.blocks.BlockHoneyComb;
import forestry.core.items.IColoredItem;
import forestry.core.items.ItemBlockForestry;
import net.minecraft.block.Block;
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(Block 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;
}
}
}
+32 -23
View File
@@ -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 {
@@ -55,9 +59,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 +86,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));
}
}
}
}
+12 -8
View File
@@ -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));
}
}
}
+13 -11
View File
@@ -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 {
@@ -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 {
+25 -22
View File
@@ -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;
}
+12 -8
View File
@@ -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;
+66 -100
View File
@@ -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)
+15 -12
View File
@@ -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();
}
}
}
+22 -44
View File
@@ -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));
}
+14 -12
View File
@@ -13,17 +13,6 @@ package forestry.arboriculture.blocks;
import java.util.Collection;
import java.util.Collections;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.WoodHelper.WoodMeshDefinition;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockPlanks.EnumType;
import net.minecraft.block.SoundType;
@@ -37,9 +26,22 @@ 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;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.WoodHelper.WoodMeshDefinition;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends BlockFenceGate implements IWoodTyped, IItemModelRegister, IStateMapperRegister {
private final boolean fireproof;
@@ -99,7 +101,7 @@ public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends Block
}
@Override
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
list.add(TreeManager.woodAccess.getStack(woodType, getBlockKind(), fireproof));
}
@@ -11,36 +11,9 @@
package forestry.arboriculture.blocks;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.IToolGrafter;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IToolScoop;
import forestry.api.core.Tabs;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.arboriculture.LeafDecayHelper;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.blocks.IColoredBlock;
import forestry.core.blocks.properties.UnlistedBlockAccess;
import forestry.core.blocks.properties.UnlistedBlockPos;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.IGrowable;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.properties.IProperty;
@@ -48,46 +21,81 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
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.tileentity.TileEntity;
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.client.model.ModelLoader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvider, IGrowable, IItemModelRegister, IColoredBlock {
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.TreeManager;
import forestry.api.core.IModelManager;
import forestry.api.core.IToolScoop;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.blocks.properties.UnlistedBlockAccess;
import forestry.core.blocks.properties.UnlistedBlockPos;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ItemStackUtil;
public class BlockForestryLeaves extends BlockAbstractLeaves implements ITileEntityProvider, IGrowable {
public BlockForestryLeaves() {
setCreativeTab(Tabs.tabArboriculture);
setDefaultState(this.blockState.getBaseState().withProperty(CHECK_DECAY, false).withProperty(DECAYABLE, true));
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos)
.withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
setDefaultState(this.blockState.getBaseState()
.withProperty(CHECK_DECAY, false)
.withProperty(DECAYABLE, true));
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, new IProperty[]{DECAYABLE, CHECK_DECAY}, new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS});
return new ExtendedBlockState(this,
new IProperty[]{DECAYABLE, CHECK_DECAY},
new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS}
);
}
@Override
protected ITree getTree(IBlockAccess world, BlockPos pos) {
TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class);
if (leaves != null) {
ITree tree = leaves.getTree();
if (tree != null) {
return tree;
}
}
return null;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
super.updateTick(world, pos, state, rand);
TileLeaves tileLeaves = TileUtil.getTile(world, pos, TileLeaves.class);
// check leaves tile because they might have decayed
if (tileLeaves != null && !tileLeaves.isInvalid() && rand.nextFloat() <= 0.1) {
tileLeaves.onBlockTick(world, pos, state, rand);
}
}
@Override
@@ -109,6 +117,12 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
return this.getDefaultState().withProperty(DECAYABLE, (meta & 4) == 0).withProperty(CHECK_DECAY, (meta & 8) > 0);
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos)
.withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
}
/* TILE ENTITY */
@Override
public TileEntity createNewTileEntity(World world, int meta) {
@@ -116,168 +130,30 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
}
@Override
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
}
/* DROP HANDLING */
// Hack: When harvesting leaves we need to get the drops in onBlockHarvested,
// because Mojang destroys the block and tile before calling getDrops.
private final ThreadLocal<List<ItemStack>> drops = new ThreadLocal<>();
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
TileLeaves leafTile = TileUtil.getTile(world, pos, TileLeaves.class);
if (leafTile == null) {
return;
}
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getActiveItemStack());
float saplingModifier = 1.0f;
ItemStack held = player.inventory.getCurrentItem();
if (held.getItem() instanceof IToolGrafter) {
saplingModifier = ((IToolGrafter) held.getItem()).getSaplingModifier(held, world, player, pos);
held.damageItem(1, player);
if (held.isEmpty()) {
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, held, EnumHand.MAIN_HAND);
}
}
GameProfile playerProfile = player.getGameProfile();
List<ItemStack> leafDrops = getLeafDrop(world, playerProfile, pos, saplingModifier, fortune);
drops.set(leafDrops);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> ret = drops.get();
drops.remove();
// leaves not harvested, get drops normally
if (ret == null) {
ret = getLeafDrop(world, null, pos, 1.0f, fortune);
}
return ret;
}
private static List<ItemStack> getLeafDrop(IBlockAccess world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
List<ItemStack> prod = new ArrayList<>();
protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class);
if (tile == null) {
return prod;
return;
}
ITree tree = tile.getTree();
if (tree == null) {
return prod;
return;
}
// Add saplings
List<ITree> saplings = tree.getSaplings((World) world, playerProfile, pos, saplingModifier);
List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier);
for (ITree sapling : saplings) {
if (sapling != null) {
prod.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
}
}
// Add fruits
if (tile.hasFruit()) {
prod.addAll(tree.produceStacks((World) world, pos, tile.getRipeningTime()));
drops.addAll(tree.produceStacks(world, pos, tile.getRipeningTime()));
}
return prod;
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class);
if (leaves == null) {
return ItemStack.EMPTY;
}
ITree tree = leaves.getTree();
if (tree == null) {
return ItemStack.EMPTY;
}
return tree.getGenome().getDecorativeLeaves();
}
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
ITree tree = null;
TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class);
if (leaves != null) {
tree = leaves.getTree();
}
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 AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
TileLeaves tileLeaves = TileUtil.getTile(worldIn, pos, TileLeaves.class);
if (tileLeaves != null && TreeDefinition.Willow.getUID().equals(tileLeaves.getSpeciesUID())) {
return null;
}
return super.getCollisionBoundingBox(blockState, worldIn, pos);
}
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn);
entityIn.motionX *= 0.4D;
entityIn.motionZ *= 0.4D;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
LeafDecayHelper.leafDecay(this, world, pos);
TileLeaves tileLeaves = TileUtil.getTile(world, pos, TileLeaves.class);
// check leaves tile because they might have decayed
if (tileLeaves != null && !tileLeaves.isInvalid() && rand.nextFloat() <= 0.1) {
tileLeaves.onBlockTick(world, pos, state, rand);
}
}
/* RENDERING */
@Override
public boolean isOpaqueCube(IBlockState state) {
return !Proxies.render.fancyGraphicsEnabled();
}
@SideOnly(Side.CLIENT)
@Override
public 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 BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT_MIPPED; // fruit overlays require CUTOUT_MIPPED, even in Fast graphics
}
@Override
public BlockPlanks.EnumType getWoodType(int meta) {
return BlockPlanks.EnumType.OAK;
}
/* MODELS */
@@ -287,28 +163,6 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("forestry:leaves", "inventory"));
}
/* PROPERTIES */
@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
return 60;
}
@Override
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
return true;
}
@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
if (face == EnumFacing.DOWN) {
return 20;
} else if (face != EnumFacing.UP) {
return 10;
} else {
return 5;
}
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class);
+13 -11
View File
@@ -2,16 +2,6 @@ package forestry.arboriculture.blocks;
import java.util.Collection;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
import net.minecraft.block.BlockLog;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@@ -25,9 +15,21 @@ 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;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends BlockLog implements IWoodTyped, IStateMapperRegister, IItemModelRegister {
protected static final int VARIANTS_PER_BLOCK = 4;
@@ -127,7 +129,7 @@ public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends Bl
}
@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));
}
+13 -11
View File
@@ -2,16 +2,6 @@ package forestry.arboriculture.blocks;
import java.util.Collection;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@@ -28,9 +18,21 @@ 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;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
public abstract class BlockForestryPlanks<T extends Enum<T> & IWoodType> extends Block implements IWoodTyped, IStateMapperRegister, IItemModelRegister {
protected static final int VARIANTS_PER_BLOCK = 16;
@@ -103,7 +105,7 @@ public abstract class BlockForestryPlanks<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));
}
+14 -12
View File
@@ -3,16 +3,6 @@ package forestry.arboriculture.blocks;
import java.util.Collection;
import java.util.Random;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@@ -28,9 +18,21 @@ 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;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.proxy.ProxyArboricultureClient;
public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends BlockSlab implements IWoodTyped, IItemModelRegister, IStateMapperRegister {
protected static final int VARIANTS_PER_BLOCK = 8;
@@ -52,11 +54,11 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
setDefaultState(iblockstate.withProperty(variant, variant.getFirstType()));
setCreativeTab(Tabs.tabArboriculture);
setLightOpacity(0);
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.WOOD);
setHarvestLevel("axe", 0);
useNeighborBrightness = true;
}
@Override
@@ -136,7 +138,7 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
}
@Override
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
if (!isDouble()) {
for (T woodType : getVariant().getAllowedValues()) {
list.add(TreeManager.woodAccess.getStack(woodType, getBlockKind(), fireproof));
@@ -11,10 +11,27 @@
package forestry.arboriculture.blocks;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
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.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.core.IStateMapperRegister;
import forestry.arboriculture.genetics.alleles.AlleleFruits;
@@ -23,20 +40,6 @@ import forestry.arboriculture.tiles.TileFruitPod;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
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.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, ITileEntityProvider {
@@ -99,8 +102,8 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I
}
@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
@@ -15,9 +15,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Preconditions;
import forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumVanillaWoodType;
import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.genetics.AlleleRegisterEvent;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.genetics.alleles.AlleleFruits;
import forestry.arboriculture.items.ItemBlockDecorativeLeaves;
@@ -29,8 +32,10 @@ import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
import forestry.core.utils.OreDictUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
public class BlockRegistryArboriculture extends BlockRegistry {
public final List<BlockArbLog> logs;
@@ -58,6 +63,8 @@ public class BlockRegistryArboriculture extends BlockRegistry {
public final BlockSapling saplingGE;
public final BlockForestryLeaves leaves;
public final List<BlockDefaultLeaves> leavesDefault;
public final Map<String, IBlockState> speciesToLeavesDefault;
public final List<BlockDecorativeLeaves> leavesDecorative;
private final Map<String, ItemStack> speciesToLeavesDecorative;
public final Map<String, BlockFruitPod> podsMap;
@@ -234,6 +241,21 @@ public class BlockRegistryArboriculture extends BlockRegistry {
registerBlock(leaves, new ItemBlockLeaves(leaves), "leaves");
registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
leavesDefault = BlockDefaultLeaves.create();
speciesToLeavesDefault = new HashMap<>();
for (BlockDefaultLeaves leaves : leavesDefault) {
registerBlock(leaves, new ItemBlockLeaves(leaves), "leaves.default." + leaves.getBlockNumber());
registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
PropertyTreeType treeType = leaves.getVariant();
for (TreeDefinition treeDefinition : treeType.getAllowedValues()) {
Preconditions.checkNotNull(treeDefinition);
String speciesUid = treeDefinition.getUID();
IBlockState blockState = leaves.getDefaultState().withProperty(treeType, treeDefinition);
speciesToLeavesDefault.put(speciesUid, blockState);
}
}
leavesDecorative = BlockDecorativeLeaves.create();
speciesToLeavesDecorative = new HashMap<>();
for (BlockDecorativeLeaves leaves : leavesDecorative) {
@@ -249,16 +271,29 @@ public class BlockRegistryArboriculture extends BlockRegistry {
}
charcoal = new BlockCharcoal();
registerBlock(charcoal, new ItemBlockForestry(charcoal), "charcoal");
ItemBlockForestry itemBlockCharcoal = new ItemBlockForestry(charcoal) {
@Override
public int getItemBurnTime(ItemStack itemStack) {
return 16000;
}
};
registerBlock(charcoal, itemBlockCharcoal, "charcoal");
woodPile = new BlockWoodPile();
registerBlock(woodPile, new ItemBlockForestry(woodPile), "wood_pile");
ItemBlockForestry itemBlockWoodPile = new ItemBlockForestry(woodPile) {
@Override
public int getItemBurnTime(ItemStack itemStack) {
return 1200;
}
};
registerBlock(woodPile, itemBlockWoodPile, "wood_pile");
loam = new BlockLoam();
registerBlock(loam, new ItemBlockForestry(loam), "loam");
// Pods
AlleleFruits.registerAlleles();
MinecraftForge.EVENT_BUS.post(new AlleleRegisterEvent(IAlleleFruit.class));
podsMap = new HashMap<>();
for (BlockFruitPod pod : BlockFruitPod.create()) {
IAlleleFruit fruit = pod.getFruit();
@@ -279,6 +314,10 @@ public class BlockRegistryArboriculture extends BlockRegistry {
return itemStack.copy();
}
public IBlockState getDefaultLeaves(String speciesUid) {
return speciesToLeavesDefault.get(speciesUid);
}
@Nullable
public BlockFruitPod getFruitPod(IAlleleFruit fruit) {
return podsMap.get(fruit.getUID());
@@ -11,10 +11,31 @@
package forestry.arboriculture.blocks;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
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 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.ITree;
import forestry.api.arboriculture.TreeManager;
@@ -26,25 +47,6 @@ import forestry.arboriculture.render.SaplingStateMapper;
import forestry.arboriculture.tiles.TileSapling;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
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.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
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 net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockSapling extends BlockTreeContainer implements IGrowable, IStateMapperRegister, IItemModelRegister {
protected static final AxisAlignedBB SAPLING_AABB = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -149,10 +151,10 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
/* REMOVING */
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return new ArrayList<>();
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class);
Loaded 100 of 487 files, more files were not shown because too many files have changed in this diff. Show more