mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 17:44:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
856322b208 | ||
|
|
42425e3500 | ||
|
|
cde076e702 | ||
|
|
b5f60d73e3 | ||
|
|
f82d123b7f | ||
|
|
ca17801c86 | ||
|
|
33d1685713 | ||
|
|
69c024811f | ||
|
|
4dd95625e1 | ||
|
|
6adcde4a75 | ||
|
|
2f06c777b2 | ||
|
|
32f295b16c | ||
|
|
ef4c65c6e6 | ||
|
|
ba313a9dfe | ||
|
|
8f36c2a6fc | ||
|
|
149a5b6128 | ||
|
|
56b871eca1 | ||
|
|
c09cdcdb64 | ||
|
|
2f66d0ea82 | ||
|
|
ac224823be | ||
|
|
1eca6e41af | ||
|
|
94bd65ee8e | ||
|
|
795b154eb5 | ||
|
|
358e7853c2 | ||
|
|
4f7b77abb4 | ||
|
|
aff15b34d6 | ||
|
|
55cf7b5c16 | ||
|
|
d4cfbe9f29 | ||
|
|
4fc731c7c8 | ||
|
|
bd2af7fa13 | ||
|
|
f3d88fea3c | ||
|
|
1d642cf9c5 | ||
|
|
b187815415 | ||
|
|
5c7150ad62 | ||
|
|
d84f708a98 | ||
|
|
2117be96cd | ||
|
|
96f941f6e6 | ||
|
|
d3c7d7141d |
No files matched your search
@@ -17,6 +17,8 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id "net.minecraftforge.gradle.forge" version "2.0.2"
|
||||
id "com.matthewprenger.cursegradle" version "1.0.7"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
}
|
||||
|
||||
apply plugin: 'maven'
|
||||
@@ -148,3 +150,35 @@ def getBuildNumber() {
|
||||
return "$System.env.BUILD_NUMBER" != "null" ? "$System.env.BUILD_NUMBER" : "0"
|
||||
}
|
||||
|
||||
task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
filePath = "changelog.html"
|
||||
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}}
|
||||
"""
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
|
||||
project {
|
||||
id = '59751'
|
||||
changelog = file('changelog.html')
|
||||
changelogType = 'html'
|
||||
releaseType = 'alpha'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.curseforge59751.dependsOn.add(makeChangelog)
|
||||
}
|
||||
@@ -4,3 +4,4 @@ GenuineSounds;[email protected];2015-02-26
|
||||
airbreather;[email protected];2015-04-10
|
||||
ganymedes01;[email protected];2015-05-27
|
||||
infinityraider;theoneandonlyraider@gmail;com;2015-10-03
|
||||
girafistudios;[email protected];2016-06-02
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
mcversion=1.9.4
|
||||
forgeversion=12.17.0.1932-1.9.4
|
||||
forgeversion=12.17.0.1944
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
jei_version=3.4.0.+
|
||||
|
||||
version_major=5
|
||||
version_minor=0
|
||||
version_patch=0
|
||||
version_patch=5
|
||||
+1
-1
Submodule lang updated: 53d7c93f90...0e7f1e47f1.
@@ -46,10 +46,10 @@ import forestry.plugins.PluginManager;
|
||||
*/
|
||||
@Mod(
|
||||
modid = Constants.MOD_ID,
|
||||
name = Constants.MOD_ID,
|
||||
name = "Forestry",
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[12.17.0.1932,);"
|
||||
dependencies = "required-after:Forge@[12.17.0.1941,);"
|
||||
+ "after:Buildcraft|Core@[7.2,);"
|
||||
+ "after:BuildCraft|Energy@[7.2,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
@@ -83,7 +83,7 @@ public class Forestry {
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.RESOURCE_ID);
|
||||
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
|
||||
Config.load();
|
||||
|
||||
PluginManager.runSetup(event);
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -39,8 +40,7 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
/* CLIENT */
|
||||
|
||||
/**
|
||||
* Call this when the housing comes into view of the client.
|
||||
* (i.e. when {@link TileEntity#getUpdateTag()} is called)
|
||||
* Sync to client by using {@link #writeToNBT(NBTTagCompound)} in your {@link TileEntity#getUpdateTag()}
|
||||
*/
|
||||
void syncToClient();
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ public interface IHiveTile {
|
||||
*/
|
||||
void calmBees();
|
||||
|
||||
boolean isAngry();
|
||||
|
||||
/**
|
||||
* Called when the hive is attacked.
|
||||
*/
|
||||
|
||||
@@ -17,14 +17,14 @@ public interface IHiveRegistry {
|
||||
|
||||
/* Forestry Hive Names */
|
||||
enum HiveType implements IStringSerializable {
|
||||
FOREST("Forestry:forest", "Forestry.speciesForest"),
|
||||
MEADOWS("Forestry:meadows", "Forestry.speciesMeadows"),
|
||||
DESERT("Forestry:desert", "Forestry.speciesModest"),
|
||||
JUNGLE("Forestry:jungle", "Forestry.speciesTropical"),
|
||||
END("Forestry:end", "Forestry.speciesEnded"),
|
||||
SNOW("Forestry:snow", "Forestry.speciesWintry"),
|
||||
SWAMP("Forestry:swamp", "Forestry.speciesMarshy"),
|
||||
SWARM("Forestry:swarm", "Forestry.speciesForest");
|
||||
FOREST("forestry:forest", "forestry.speciesForest"),
|
||||
MEADOWS("forestry:meadows", "forestry.speciesMeadows"),
|
||||
DESERT("forestry:desert", "forestry.speciesModest"),
|
||||
JUNGLE("forestry:jungle", "forestry.speciesTropical"),
|
||||
END("forestry:end", "forestry.speciesEnded"),
|
||||
SNOW("forestry:snow", "forestry.speciesWintry"),
|
||||
SWAMP("forestry:swamp", "forestry.speciesMarshy"),
|
||||
SWARM("forestry:swarm", "forestry.speciesForest");
|
||||
|
||||
public static final HiveType[] VALUES = values();
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.block.BlockPlanks;
|
||||
|
||||
public enum EnumVanillaWoodType implements IWoodType {
|
||||
OAK(BlockPlanks.EnumType.OAK),
|
||||
BIRCH(BlockPlanks.EnumType.BIRCH),
|
||||
SPRUCE(BlockPlanks.EnumType.SPRUCE),
|
||||
BIRCH(BlockPlanks.EnumType.BIRCH),
|
||||
JUNGLE(BlockPlanks.EnumType.JUNGLE),
|
||||
ACACIA(BlockPlanks.EnumType.ACACIA),
|
||||
DARK_OAK(BlockPlanks.EnumType.DARK_OAK);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -13,5 +14,5 @@ public interface IFlowerAcceptableRule {
|
||||
* Checks if the flower at this position is accepted by this rule.
|
||||
* flowerType is passed in case this rule is registered for multiple flower types.
|
||||
*/
|
||||
boolean isAcceptableFlower(String flowerType, World world, BlockPos pos);
|
||||
boolean isAcceptableFlower(IBlockState blockState, World world, BlockPos pos, String flowerType);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -29,14 +30,14 @@ public interface IFlowerRegistry {
|
||||
void registerGrowthRule(IFlowerGrowthRule rule, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Registers an accepted flower with any meta value.
|
||||
* Registers an accepted flower with any state.
|
||||
*/
|
||||
void registerAcceptableFlower(Block flowerBlock, String... flowerTypes);
|
||||
void registerAcceptableFlower(Block block, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Registers an accepted flower with a specific meta value.
|
||||
* Registers an accepted flower with a particular state.
|
||||
*/
|
||||
void registerAcceptableFlower(Block flowerBlock, int flowerMeta, String... flowerTypes);
|
||||
void registerAcceptableFlower(IBlockState blockState, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Registers custom logic for accepted flowers.
|
||||
@@ -53,7 +54,7 @@ public interface IFlowerRegistry {
|
||||
* @param weight Weight for the Flower (Vanilla = 1.0, Modded flowers < 1.0)
|
||||
* @param flowerTypes See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
|
||||
*/
|
||||
void registerPlantableFlower(Block flowerBlock, int flowerMeta, double weight, String... flowerTypes);
|
||||
void registerPlantableFlower(IBlockState blockState, double weight, String... flowerTypes);
|
||||
|
||||
/**
|
||||
* Calls the appropriate IFlowerGrowthRule to grow a flower at a specified position.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -22,7 +22,7 @@ public interface IGreenhouseState {
|
||||
|
||||
float getExactHumidity();
|
||||
|
||||
List<IInternalBlock> getInternalBlocks();
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
|
||||
Collection<IMultiblockComponent> getGreenhouseComponents();
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
|
||||
BlockPos flowerPos = new BlockPos(flowersList[i], flowersList[i + 1], flowersList[i + 2]);
|
||||
flowerCoords.add(flowerPos);
|
||||
}
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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;
|
||||
@@ -37,7 +38,6 @@ 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.config.Property;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -47,7 +47,6 @@ 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;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -70,8 +69,6 @@ import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
import forestry.apiculture.entities.ParticleBee;
|
||||
import forestry.apiculture.flowers.Flower;
|
||||
import forestry.apiculture.flowers.FlowerRegistry;
|
||||
import forestry.apiculture.genetics.BeeBranchDefinition;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
@@ -95,6 +92,7 @@ import forestry.apiculture.multiblock.TileAlvearyStabiliser;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.network.PacketRegistryApiculture;
|
||||
import forestry.apiculture.proxy.ProxyApiculture;
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
@@ -114,11 +112,8 @@ import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.OreDictUtil;
|
||||
import forestry.core.utils.Stack;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.core.utils.VillagerTradeLists;
|
||||
import forestry.food.PluginFood;
|
||||
import forestry.food.items.ItemRegistryFood;
|
||||
@@ -208,19 +203,17 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
@Override
|
||||
public void doInit() {
|
||||
File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
|
||||
if (!configFile.exists()) {
|
||||
setDefaultsForConfig();
|
||||
}
|
||||
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "2.0.0");
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "3.0.0");
|
||||
if (!Objects.equals(config.getLoadedConfigVersion(), config.getDefinedConfigVersion())) {
|
||||
boolean deleted = configFile.delete();
|
||||
if (deleted) {
|
||||
config = new LocalizedConfiguration(configFile, "2.0.0");
|
||||
setDefaultsForConfig();
|
||||
config = new LocalizedConfiguration(configFile, "3.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
initFlowerRegistry();
|
||||
|
||||
List<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
|
||||
String[] validBeekeepingModeNames = new String[beekeepingModes.size()];
|
||||
for (int i = 0; i < beekeepingModes.size(); i++) {
|
||||
@@ -232,34 +225,6 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
|
||||
|
||||
String acceptedFlowerMessage = Translator.translateToLocal("for.config.beekeeping.flowers.accepted.comment");
|
||||
String plantableFlowerMessage = Translator.translateToLocal("for.config.beekeeping.flowers.plantable.comment");
|
||||
|
||||
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
|
||||
|
||||
for (String flowerType : flowerRegistry.getFlowerTypes()) {
|
||||
String[] defaultAccepted = defaultAcceptedFlowers.get(flowerType);
|
||||
if (defaultAccepted == null) {
|
||||
defaultAccepted = Constants.EMPTY_STRINGS;
|
||||
}
|
||||
Property property = config.get("beekeeping.flowers." + flowerType, "accepted", defaultAccepted);
|
||||
property.setComment(acceptedFlowerMessage);
|
||||
parseAcceptedFlowers(property.getStringList(), flowerType);
|
||||
|
||||
String[] defaultPlantable = defaultPlantableFlowers.get(flowerType);
|
||||
if (defaultPlantable == null) {
|
||||
defaultPlantable = Constants.EMPTY_STRINGS;
|
||||
}
|
||||
property = config.get("beekeeping.flowers." + flowerType, "plantable", defaultPlantable);
|
||||
property.setComment(plantableFlowerMessage);
|
||||
parsePlantableFlowers(property, flowerType);
|
||||
|
||||
Set<Flower> acceptableFlowers = flowerRegistry.getAcceptableFlowers(flowerType);
|
||||
if (acceptableFlowers == null || acceptableFlowers.isEmpty()) {
|
||||
Log.error("Flower type '" + flowerType + "' has no valid flowers set in apiculture.cfg. Add valid flowers or delete the config to set it to default.");
|
||||
}
|
||||
}
|
||||
|
||||
String[] blacklist = config.getStringListLocalized("species", "blacklist", Constants.EMPTY_STRINGS);
|
||||
parseBeeBlacklist(blacklist);
|
||||
|
||||
@@ -346,8 +311,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
registerDungeonLoot();
|
||||
}
|
||||
|
||||
private void setDefaultsForConfig() {
|
||||
|
||||
private void initFlowerRegistry() {
|
||||
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
|
||||
|
||||
flowerRegistry.registerAcceptableFlowerRule(new EndFlowerAcceptableRule(), FlowerManager.FlowerTypeEnd);
|
||||
@@ -361,53 +325,26 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.MELON_STEM, FlowerManager.FlowerTypeGourd);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.NETHER_WART, FlowerManager.FlowerTypeNether);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.CACTUS, FlowerManager.FlowerTypeCacti);
|
||||
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 1, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 4, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 5, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
|
||||
|
||||
// Register plantable plants
|
||||
for (int meta = 0; meta <= 8; meta++) {
|
||||
flowerRegistry.registerPlantableFlower(Blocks.RED_FLOWER, meta, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
}
|
||||
|
||||
flowerRegistry.registerPlantableFlower(Blocks.YELLOW_FLOWER, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.BROWN_MUSHROOM, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.RED_MUSHROOM, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.CACTUS, 0, 1.0, FlowerManager.FlowerTypeCacti);
|
||||
|
||||
for (String flowerType : flowerRegistry.getFlowerTypes()) {
|
||||
Set<Flower> flowers = flowerRegistry.getAcceptableFlowers(flowerType);
|
||||
List<String> acceptedFlowerNames = new ArrayList<>();
|
||||
List<String> plantableFlowerNames = new ArrayList<>();
|
||||
if (flowers != null) {
|
||||
for (Flower flower : flowers) {
|
||||
String name = ItemStackUtil.getBlockNameFromRegistryAsSting(flower.getBlock());
|
||||
if (name == null) {
|
||||
Log.warning("Could not find name for flower: " + flower + " with type: " + flowerType);
|
||||
continue;
|
||||
}
|
||||
|
||||
int meta = flower.getMeta();
|
||||
if (flower.getMeta() != OreDictionary.WILDCARD_VALUE) {
|
||||
name = name + ':' + meta;
|
||||
}
|
||||
|
||||
if (flower.isPlantable()) {
|
||||
plantableFlowerNames.add(name);
|
||||
} else {
|
||||
acceptedFlowerNames.add(name);
|
||||
}
|
||||
}
|
||||
for (BlockFlower.EnumFlowerType flowerType : BlockFlower.EnumFlowerType.values()) {
|
||||
IBlockState blockState;
|
||||
switch (flowerType.getBlockType()) {
|
||||
case RED:
|
||||
blockState = Blocks.RED_FLOWER.getDefaultState().withProperty(Blocks.RED_FLOWER.getTypeProperty(), flowerType);
|
||||
break;
|
||||
case YELLOW:
|
||||
blockState = Blocks.YELLOW_FLOWER.getDefaultState().withProperty(Blocks.YELLOW_FLOWER.getTypeProperty(), flowerType);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] acceptedFlowerNamesArray = acceptedFlowerNames.toArray(new String[acceptedFlowerNames.size()]);
|
||||
defaultAcceptedFlowers.put(flowerType, acceptedFlowerNamesArray);
|
||||
|
||||
String[] plantableFlowerNamesArray = plantableFlowerNames.toArray(new String[plantableFlowerNames.size()]);
|
||||
defaultPlantableFlowers.put(flowerType, plantableFlowerNamesArray);
|
||||
flowerRegistry.registerPlantableFlower(blockState, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
}
|
||||
|
||||
flowerRegistry.registerPlantableFlower(Blocks.BROWN_MUSHROOM.getDefaultState(), 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.RED_MUSHROOM.getDefaultState(), 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
flowerRegistry.registerPlantableFlower(Blocks.CACTUS.getDefaultState(), 1.0, FlowerManager.FlowerTypeCacti);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -866,36 +803,6 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseAcceptedFlowers(String[] acceptedFlowers, String flowerType) {
|
||||
List<Stack> acceptedFlowerItemStacks = Stack.parseStackStrings(acceptedFlowers, OreDictionary.WILDCARD_VALUE);
|
||||
for (Stack acceptedFlower : acceptedFlowerItemStacks) {
|
||||
Block acceptedFlowerBlock = acceptedFlower.getBlock();
|
||||
int meta = acceptedFlower.getMeta();
|
||||
if (acceptedFlowerBlock != null) {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(acceptedFlowerBlock, meta, flowerType);
|
||||
} else {
|
||||
Log.warning("No block found for '" + acceptedFlower + "' in apiculture config for '" + flowerType + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void parsePlantableFlowers(Property property, String flowerType) {
|
||||
for (String string : property.getStringList()) {
|
||||
Stack plantableFlower = Stack.parseStackString(string, OreDictionary.WILDCARD_VALUE);
|
||||
if (plantableFlower == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block plantableFlowerBlock = plantableFlower.getBlock();
|
||||
int meta = plantableFlower.getMeta();
|
||||
if (plantableFlowerBlock != null) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(plantableFlowerBlock, meta, 1.0, flowerType);
|
||||
} else {
|
||||
Log.warning("No block found for '" + string + "' in config '" + property.getName() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return new SaveEventHandlerApiculture();
|
||||
@@ -941,12 +848,12 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
for (int i = 0; i < ParticleSnow.sprites.length; i++) {
|
||||
ParticleSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
|
||||
}
|
||||
ParticleBee.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
|
||||
ProxyApicultureClient.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
|
||||
}
|
||||
|
||||
private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule {
|
||||
@Override
|
||||
public boolean isAcceptableFlower(String flowerType, World world, BlockPos pos) {
|
||||
public boolean isAcceptableFlower(IBlockState blockState, World world, BlockPos pos, String flowerType) {
|
||||
Biome biomeGenForCoords = world.getBiome(pos);
|
||||
return BiomeDictionary.isBiomeOfType(biomeGenForCoords, BiomeDictionary.Type.END);
|
||||
}
|
||||
|
||||
@@ -33,12 +33,8 @@ public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, AxisAlignedBB boundingBox) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
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.proxy.ProxyApicultureClient;
|
||||
|
||||
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);
|
||||
setParticleTexture(ProxyApicultureClient.beeSprite);
|
||||
this.origin = origin;
|
||||
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015;
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.015;
|
||||
|
||||
particleRed = (color >> 16 & 255) / 255.0F;
|
||||
particleGreen = (color >> 8 & 255) / 255.0F;
|
||||
particleBlue = (color & 255) / 255.0F;
|
||||
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.particleScale *= 0.2F;
|
||||
this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D));
|
||||
|
||||
this.motionX *= 0.9D;
|
||||
this.motionY *= 0.015D;
|
||||
this.motionZ *= 0.9D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.moveEntity(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;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
// venture out
|
||||
this.motionX *= 0.92 + 0.3D * rand.nextFloat();
|
||||
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.92 + 0.3D * rand.nextFloat();
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
// slow down
|
||||
this.motionX *= 0.75 + 0.3D * rand.nextFloat();
|
||||
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.75 + 0.3D * rand.nextFloat();
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - 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.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
float maxV = 1;
|
||||
|
||||
if (this.particleTexture != null) {
|
||||
minU = particleTexture.getMinU();
|
||||
maxU = particleTexture.getMaxU();
|
||||
minV = particleTexture.getMinV();
|
||||
maxV = particleTexture.getMaxV();
|
||||
}
|
||||
|
||||
float f10 = 0.1F * particleScale;
|
||||
float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
|
||||
float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
|
||||
float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
@Override
|
||||
public int getBrightnessForRender(float p_189214_1_) {
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+25
-30
@@ -12,30 +12,26 @@ package forestry.apiculture.entities;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ParticleBee extends Particle {
|
||||
private final double originX;
|
||||
private final double originY;
|
||||
private final double originZ;
|
||||
private final BlockPos destination;
|
||||
|
||||
public static TextureAtlasSprite beeSprite;
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
|
||||
public ParticleBee(World world, double x, double y, double z, int color, BlockPos destination) {
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
setParticleTexture(beeSprite);
|
||||
this.originX = x;
|
||||
this.originY = y;
|
||||
this.originZ = z;
|
||||
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);
|
||||
setParticleTexture(ProxyApicultureClient.beeSprite);
|
||||
this.origin = origin;
|
||||
|
||||
this.destination = destination;
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.015;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015;
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.015;
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.02 + 0.1 * rand.nextFloat();
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.015 + 0.1 * rand.nextFloat();
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.02 + 0.1 * rand.nextFloat();
|
||||
|
||||
particleRed = (color >> 16 & 255) / 255.0F;
|
||||
particleGreen = (color >> 8 & 255) / 255.0F;
|
||||
@@ -61,34 +57,34 @@ public class ParticleBee extends Particle {
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.particleAge == this.particleMaxAge / 2) {
|
||||
this.motionX = (this.originX - this.posX) * 0.03;
|
||||
this.motionY = (this.originY - this.posY) * 0.03;
|
||||
this.motionZ = (this.originZ - this.posZ) * 0.03;
|
||||
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();
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.25) {
|
||||
// venture out
|
||||
this.motionX *= 0.92 + 0.2D * rand.nextFloat();
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionY = (this.motionY + 0.3 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ *= 0.92 + 0.2D * rand.nextFloat();
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
// get to flower destination
|
||||
this.motionX = (destination.getX() + 0.5 - this.posX) * 0.03;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.03;
|
||||
this.motionY = (destination.getY() + 0.5 - this.posY) * 0.1;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (destination.getZ() + 0.5 - this.posZ) * 0.03;
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (this.originY - this.posY) * 0.03;
|
||||
this.motionY = (origin.yCoord - 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 = (this.originX - this.posX) * 0.03;
|
||||
this.motionY = (this.originY - this.posY) * 0.03;
|
||||
this.motionX = (origin.xCoord - this.posX) * 0.03;
|
||||
this.motionY = (origin.yCoord - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (this.originZ - this.posZ) * 0.03;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
@@ -124,11 +120,10 @@ public class ParticleBee extends Particle {
|
||||
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();
|
||||
}
|
||||
|
||||
// avoid calculating collisions for bees, it is too much processing
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
@Override
|
||||
public void moveEntity(double x, double y, double z) {
|
||||
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
|
||||
this.resetPositionToBB();
|
||||
public int getBrightnessForRender(float p_189214_1_) {
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,137 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.proxy.ProxyApicultureClient;
|
||||
|
||||
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);
|
||||
setParticleTexture(ProxyApicultureClient.beeSprite);
|
||||
|
||||
this.origin = origin;
|
||||
this.entity = entity;
|
||||
|
||||
this.motionX = (entity.posX - this.posX) * 0.015;
|
||||
this.motionY = (entity.posY + 1.62F - this.posY) * 0.015;
|
||||
this.motionZ = (entity.posZ - this.posZ) * 0.015;
|
||||
|
||||
particleRed = (color >> 16 & 255) / 255.0F;
|
||||
particleGreen = (color >> 8 & 255) / 255.0F;
|
||||
particleBlue = (color & 255) / 255.0F;
|
||||
|
||||
this.setSize(0.1F, 0.1F);
|
||||
this.particleScale *= 0.2F;
|
||||
this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D));
|
||||
|
||||
this.motionX *= 0.9D;
|
||||
this.motionY *= 0.9D;
|
||||
this.motionZ *= 0.9D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.moveEntity(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;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge * 0.5) {
|
||||
// fly near the entity
|
||||
this.motionX = (entity.posX - this.posX) * 0.09;
|
||||
this.motionX = (this.motionX + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionY = (entity.posY + 1.62F - this.posY) * 0.03;
|
||||
this.motionY = (this.motionY + 0.4 * (-0.5 + rand.nextFloat())) / 4;
|
||||
this.motionZ = (entity.posZ - this.posZ) * 0.09;
|
||||
this.motionZ = (this.motionZ + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
} else if (this.particleAge < this.particleMaxAge * 0.75) {
|
||||
// venture back
|
||||
this.motionX *= 0.95;
|
||||
this.motionY = (origin.yCoord - 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.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2;
|
||||
this.motionZ = (origin.zCoord - this.posZ) * 0.03;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
float minU = 0;
|
||||
float maxU = 1;
|
||||
float minV = 0;
|
||||
float maxV = 1;
|
||||
|
||||
if (this.particleTexture != null) {
|
||||
minU = particleTexture.getMinU();
|
||||
maxU = particleTexture.getMaxU();
|
||||
minV = particleTexture.getMinV();
|
||||
maxV = particleTexture.getMaxV();
|
||||
}
|
||||
|
||||
float f10 = 0.1F * particleScale;
|
||||
float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
|
||||
float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
|
||||
float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// avoid calculating lighting for bees, it is too much processing
|
||||
@Override
|
||||
public int getBrightnessForRender(float p_189214_1_) {
|
||||
return 15728880;
|
||||
}
|
||||
|
||||
// avoid calculating collisions
|
||||
@Override
|
||||
public void moveEntity(double x, double y, double z) {
|
||||
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
|
||||
this.resetPositionToBB();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -12,19 +12,15 @@ package forestry.apiculture.flowers;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public final class Flower {
|
||||
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
private final IBlockState blockState;
|
||||
private Double weight;
|
||||
|
||||
public Flower(Block block, int meta, double weight) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
public Flower(IBlockState blockState, double weight) {
|
||||
this.blockState = blockState;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
@@ -40,20 +36,16 @@ public final class Flower {
|
||||
|
||||
Flower flower = (Flower) obj;
|
||||
|
||||
return Block.isEqualTo(this.block, flower.getBlock()) && (this.meta == OreDictionary.WILDCARD_VALUE || flower.getMeta() == OreDictionary.WILDCARD_VALUE || this.meta == flower.getMeta());
|
||||
return this.blockState == flower.getBlockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(block);
|
||||
return Objects.hashCode(blockState);
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
public IBlockState getBlockState() {
|
||||
return blockState;
|
||||
}
|
||||
|
||||
public double getWeight() {
|
||||
@@ -66,7 +58,7 @@ public final class Flower {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("block", block).add("meta", meta).add("weight", weight).toString();
|
||||
return Objects.toStringHelper(this).add("blockState", blockState).add("weight", weight).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,12 +13,9 @@ package forestry.apiculture.flowers;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,18 +24,12 @@ import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowerPot;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -50,7 +41,7 @@ import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.VectUtil;
|
||||
|
||||
public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelper {
|
||||
@@ -67,17 +58,19 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
FlowerManager.FlowerTypeGourd
|
||||
);
|
||||
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules; // custom check
|
||||
private final HashMultimap<String, Block> registeredBlocks; // quick first check
|
||||
private final HashMultimap<String, Flower> registeredFlowers; // full check
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules;
|
||||
private final HashMultimap<String, Block> acceptableBlocks;
|
||||
private final HashMultimap<String, IBlockState> acceptableBlockStates;
|
||||
private final HashMultimap<String, Flower> plantableFlowers;
|
||||
|
||||
private final ArrayListMultimap<String, IFlowerGrowthRule> growthRules;
|
||||
private final Map<String, TreeMap<Double, Flower>> chances;
|
||||
|
||||
public FlowerRegistry() {
|
||||
this.registeredRules = HashMultimap.create();
|
||||
this.registeredBlocks = HashMultimap.create();
|
||||
this.registeredFlowers = HashMultimap.create();
|
||||
this.acceptableBlocks = HashMultimap.create();
|
||||
this.acceptableBlockStates = HashMultimap.create();
|
||||
this.plantableFlowers = HashMultimap.create();
|
||||
this.growthRules = ArrayListMultimap.create();
|
||||
this.chances = new HashMap<>();
|
||||
|
||||
@@ -86,28 +79,40 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlower(Block block, String... flowerTypes) {
|
||||
registerFlower(block, OreDictionary.WILDCARD_VALUE, 0.0, flowerTypes);
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + block);
|
||||
}
|
||||
|
||||
this.acceptableBlocks.get(flowerType).add(block);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlower(Block block, int meta, String... flowerTypes) {
|
||||
registerFlower(block, meta, 0.0, flowerTypes);
|
||||
public void registerAcceptableFlower(IBlockState blockState, String... flowerTypes) {
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + blockState);
|
||||
}
|
||||
|
||||
this.acceptableBlockStates.get(flowerType).add(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlowerRule(IFlowerAcceptableRule acceptableFlower, String... flowerTypes) {
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + acceptableFlower);
|
||||
}
|
||||
|
||||
registeredRules.put(flowerType, acceptableFlower);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPlantableFlower(Block block, int meta, double weight, String... flowerTypes) {
|
||||
registerFlower(block, meta, weight, flowerTypes);
|
||||
}
|
||||
|
||||
private void registerFlower(Block block, int meta, double weight, String... flowerTypes) {
|
||||
if (block == null) {
|
||||
public void registerPlantableFlower(IBlockState blockState, double weight, String... flowerTypes) {
|
||||
if (blockState == null) {
|
||||
return;
|
||||
}
|
||||
if (weight <= 0.0) {
|
||||
@@ -117,18 +122,22 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
weight = 1.0;
|
||||
}
|
||||
|
||||
Flower newFlower = new Flower(block, meta, weight);
|
||||
if (blockState.getBlock() == Blocks.AIR) {
|
||||
Log.error("Tried to register AIR as a flower. Bad idea.");
|
||||
}
|
||||
|
||||
Flower newFlower = new Flower(blockState, weight);
|
||||
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (flowerType == null) {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + block);
|
||||
throw new NullPointerException("Tried to register flower with null type. " + blockState);
|
||||
}
|
||||
|
||||
Set<Flower> flowers = this.registeredFlowers.get(flowerType);
|
||||
Set<Flower> flowers = this.plantableFlowers.get(flowerType);
|
||||
flowers.add(newFlower);
|
||||
|
||||
Set<Block> blocks = this.registeredBlocks.get(flowerType);
|
||||
blocks.add(block);
|
||||
Set<IBlockState> blocks = this.acceptableBlockStates.get(flowerType);
|
||||
blocks.add(blockState);
|
||||
|
||||
if (this.chances.containsKey(flowerType)) {
|
||||
this.chances.remove(flowerType);
|
||||
@@ -145,13 +154,9 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
@Override
|
||||
@Nonnull
|
||||
public List<BlockPos> getAcceptedFlowerCoordinates(IBeeHousing beeHousing, IBee bee, String flowerType, int maxFlowers) {
|
||||
if (!this.registeredFlowers.containsKey(flowerType)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
Set<IBlockState> acceptedBlockStates = this.acceptableBlockStates.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.acceptableBlocks.get(flowerType);
|
||||
World world = beeHousing.getWorldObj();
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
@@ -161,9 +166,14 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
BlockPos maxPos = minPos.add(area);
|
||||
|
||||
List<BlockPos> flowerCoords = new ArrayList<>();
|
||||
for (BlockPos.MutableBlockPos posBlock : BlockPos.getAllInBoxMutable(minPos, maxPos)) {
|
||||
for (BlockPos.MutableBlockPos posBlock : VectUtil.getAllInBoxFromCenterMutable(world, minPos, beeHousing.getCoordinates(), maxPos)) {
|
||||
IBlockState blockState = world.getBlockState(posBlock);
|
||||
if (blockState.getBlock().isAir(blockState, world, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
|
||||
if (acceptableRule.isAcceptableFlower(flowerType, world, posBlock)) {
|
||||
if (acceptableRule.isAcceptableFlower(blockState, world, posBlock, flowerType)) {
|
||||
flowerCoords.add(posBlock.toImmutable());
|
||||
if (flowerCoords.size() >= maxFlowers) {
|
||||
return flowerCoords;
|
||||
@@ -171,7 +181,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
}
|
||||
}
|
||||
|
||||
if (isAcceptedFlower(acceptedBlocks, acceptedFlowers, world, posBlock)) {
|
||||
if (isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates)) {
|
||||
flowerCoords.add(posBlock.toImmutable());
|
||||
if (flowerCoords.size() >= maxFlowers) {
|
||||
return flowerCoords;
|
||||
@@ -184,44 +194,23 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(String flowerType, World world, BlockPos pos) {
|
||||
if (!this.registeredFlowers.containsKey(flowerType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
Set<IFlowerAcceptableRule> acceptedCustom = this.registeredRules.get(flowerType);
|
||||
for (IFlowerAcceptableRule acceptableFlower : acceptedCustom) {
|
||||
if (acceptableFlower.isAcceptableFlower(flowerType, world, pos)) {
|
||||
if (acceptableFlower.isAcceptableFlower(blockState, world, pos, flowerType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
Set<IBlockState> acceptedBlockStates = this.acceptableBlockStates.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.acceptableBlocks.get(flowerType);
|
||||
|
||||
return isAcceptedFlower(acceptedBlocks, acceptedFlowers, world, pos);
|
||||
return isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates);
|
||||
}
|
||||
|
||||
private static boolean isAcceptedFlower(Set<Block> acceptedBlocks, Set<Flower> acceptedFlowers, World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
private static boolean isAcceptedFlower(IBlockState blockState, Set<Block> acceptedBlocks, Set<IBlockState> acceptedBlockStates) {
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
final int meta;
|
||||
|
||||
if (block instanceof BlockFlowerPot) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
TileEntityFlowerPot tileFlowerPot = (TileEntityFlowerPot) tile;
|
||||
Item item = tileFlowerPot.getFlowerPotItem();
|
||||
block = Block.getBlockFromItem(item);
|
||||
meta = tileFlowerPot.getFlowerPotData();
|
||||
} else {
|
||||
if (!acceptedBlocks.contains(block)) {
|
||||
return false;
|
||||
}
|
||||
meta = block.getMetaFromState(blockState);
|
||||
}
|
||||
|
||||
Flower flower = new Flower(block, meta, 0);
|
||||
return acceptedFlowers.contains(flower);
|
||||
return acceptedBlocks.contains(block) || acceptedBlockStates.contains(blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,10 +228,6 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<Flower> getAcceptableFlowers(String flowerType) {
|
||||
return ImmutableSet.copyOf(this.registeredFlowers.get(flowerType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGrowthRule(IFlowerGrowthRule rule, String... flowerTypes) {
|
||||
if (rule == null) {
|
||||
@@ -260,15 +245,11 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
return chancesMap.get(chancesMap.lowerKey(rand.nextDouble() * maxKey));
|
||||
}
|
||||
|
||||
public Collection<String> getFlowerTypes() {
|
||||
return new ArrayList<>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
|
||||
}
|
||||
|
||||
private TreeMap<Double, Flower> getChancesMap(String flowerType) {
|
||||
if (!this.chances.containsKey(flowerType)) {
|
||||
TreeMap<Double, Flower> flowerChances = new TreeMap<>();
|
||||
double count = 0.0;
|
||||
for (Flower flower : this.registeredFlowers.get(flowerType)) {
|
||||
for (Flower flower : this.plantableFlowers.get(flowerType)) {
|
||||
if (flower.isPlantable()) {
|
||||
flowerChances.put(count, flower);
|
||||
count += flower.getWeight();
|
||||
@@ -282,8 +263,6 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
private void registerVanillaGrowthRules() {
|
||||
registerGrowthRule(new GrowthRuleDirtGrass(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new GrowthRuleSnow(), FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new GrowthRuleFlowerPot(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms, FlowerManager.FlowerTypeCacti,
|
||||
FlowerManager.FlowerTypeJungle);
|
||||
registerGrowthRule(new GrowthRuleMycelium(), FlowerManager.FlowerTypeMushrooms);
|
||||
registerGrowthRule(new GrowthRuleNone(), FlowerManager.FlowerTypeEnd);
|
||||
registerGrowthRule(new GrowthRuleFertilize(Blocks.MELON_STEM, Blocks.PUMPKIN_STEM), FlowerManager.FlowerTypeGourd);
|
||||
@@ -293,6 +272,6 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
@Override
|
||||
public boolean plantRandomFlower(String flowerType, World world, BlockPos pos) {
|
||||
Flower flower = getRandomPlantableFlower(flowerType, world.rand);
|
||||
return world.setBlockState(pos, flower.getBlock().getStateFromMeta(flower.getMeta()), Constants.FLAG_BLOCK_SYNC);
|
||||
return world.setBlockState(pos, flower.getBlockState());
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowerPot;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
|
||||
public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
|
||||
return growFlower(flowerType, world, pos);
|
||||
}
|
||||
|
||||
private static boolean growFlower(String flowerType, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlowerPot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityFlowerPot flowerPotTile = (TileEntityFlowerPot) tile;
|
||||
if (flowerPotTile.getFlowerPotItem() != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (!(block instanceof BlockFlowerPot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockFlowerPot flowerPot = (BlockFlowerPot) block;
|
||||
|
||||
int flower;
|
||||
switch (flowerType) {
|
||||
case FlowerManager.FlowerTypeVanilla:
|
||||
case FlowerManager.FlowerTypeSnow:
|
||||
flower = world.rand.nextInt(2) + 1;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeJungle:
|
||||
flower = 6;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeCacti:
|
||||
flower = world.rand.nextInt(2) + 9;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeMushrooms:
|
||||
flower = world.rand.nextInt(2) + 7;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityFlowerPot newTile = (TileEntityFlowerPot) flowerPot.createNewTileEntity(world, flower);
|
||||
|
||||
flowerPotTile.setFlowerPotData(newTile.getFlowerPotItem(), newTile.getFlowerPotData());
|
||||
flowerPotTile.markDirty();
|
||||
|
||||
if (!world.setBlockState(pos, world.getBlockState(pos).getBlock().getStateFromMeta(1), 2)) {
|
||||
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -105,16 +104,14 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
Vec3d origin = housing.getBeeFXCoordinates();
|
||||
IBeekeepingLogic beekeepingLogic = housing.getBeekeepingLogic();
|
||||
List<BlockPos> flowerPositions = beekeepingLogic.getFlowerPositions();
|
||||
|
||||
int beeColor = genome.getPrimary().getSpriteColour(0);
|
||||
Proxies.render.addBeeHiveFX(housing.getWorldObj(), origin.xCoord, origin.yCoord, origin.zCoord, beeColor, flowerPositions);
|
||||
Proxies.render.addBeeHiveFX(housing, genome, flowerPositions);
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected Vec3i getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
public static Vec3i getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
if (stack != null && stack.getItem() == PluginApiculture.items.apiaristLegs) {
|
||||
return Constants.RESOURCE_ID + ":" + Constants.TEXTURE_APIARIST_ARMOR_SECONDARY;
|
||||
return Constants.MOD_ID + ":" + Constants.TEXTURE_APIARIST_ARMOR_SECONDARY;
|
||||
} else {
|
||||
return Constants.RESOURCE_ID + ":" + Constants.TEXTURE_APIARIST_ARMOR_PRIMARY;
|
||||
return Constants.MOD_ID + ":" + Constants.TEXTURE_APIARIST_ARMOR_PRIMARY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -317,12 +317,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
@Override
|
||||
public void formatDescriptionPacket(NBTTagCompound data) {
|
||||
writeToNBT(data);
|
||||
beekeepingLogic.syncToClient();
|
||||
beekeepingLogic.writeToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeDescriptionPacket(NBTTagCompound data) {
|
||||
readFromNBT(data);
|
||||
beekeepingLogic.readFromNBT(data);
|
||||
}
|
||||
|
||||
/* IActivatable */
|
||||
|
||||
@@ -10,8 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.proxy;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
public class ProxyApicultureClient extends ProxyApiculture {
|
||||
|
||||
public static TextureAtlasSprite beeSprite;
|
||||
|
||||
@Override
|
||||
public void initializeRendering() {
|
||||
// TODO: remove unused bee entity model completely
|
||||
|
||||
@@ -69,8 +69,15 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
beeLogic.syncToClient();
|
||||
return super.getUpdateTag();
|
||||
NBTTagCompound updateTag = super.getUpdateTag();
|
||||
beeLogic.writeToNBT(updateTag);
|
||||
return updateTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
|
||||
super.handleUpdateTag(tag);
|
||||
beeLogic.readFromNBT(tag);
|
||||
}
|
||||
|
||||
/* ICLIMATISED */
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
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;
|
||||
@@ -74,7 +75,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
@Nonnull
|
||||
private final IErrorLogic errorLogic;
|
||||
private IBee containedBee = null;
|
||||
private boolean active = true;
|
||||
private boolean active = false;
|
||||
private boolean angry = false;
|
||||
private int calmTime;
|
||||
|
||||
@@ -97,7 +98,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
if (!updatedLight && worldObj.getWorldTime() % 20 == 0) {
|
||||
if (!updatedLight && worldObj.getWorldTime() % 100 == 0) {
|
||||
updatedLight = worldObj.checkLightFor(EnumSkyBlock.BLOCK, getPos());
|
||||
}
|
||||
if (active && worldObj.rand.nextInt(4) == 0) {
|
||||
@@ -108,7 +109,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
} else {
|
||||
boolean canWork = beeLogic.canWork(); // must be called every tick to stay updated
|
||||
|
||||
if (worldObj.rand.nextInt(angry ? 10 : 80) == 0) {
|
||||
if (worldObj.rand.nextInt(angry ? 10 : 200) == 0) {
|
||||
if (calmTime == 0) {
|
||||
if (canWork) {
|
||||
AxisAlignedBB boundingBox = AlleleEffect.getBounding(getContainedBee().getGenome(), this);
|
||||
@@ -119,19 +120,13 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
attack(entity, 2);
|
||||
}
|
||||
beeLogic.doWork();
|
||||
setActive(true);
|
||||
} else {
|
||||
setActive(false);
|
||||
}
|
||||
} else {
|
||||
calmTime--;
|
||||
if (calmTime == 0) {
|
||||
setActive(true);
|
||||
} else {
|
||||
setActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setActive(calmTime == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +198,11 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
setActive(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAngry() {
|
||||
return angry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttack(World world, BlockPos pos, EntityPlayer player) {
|
||||
if (calmTime == 0) {
|
||||
@@ -231,8 +231,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
if (damage > 0) {
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(entity, damageSourceBeeHive.damageType, true);
|
||||
damage -= damage / 4.0f * count;
|
||||
if (damage > 0) {
|
||||
if (entity.worldObj.rand.nextInt(4) >= count) {
|
||||
entity.attackEntityFrom(damageSourceBeeHive, damage);
|
||||
}
|
||||
}
|
||||
@@ -258,8 +257,30 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
@Nullable
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||
beeLogic.syncToClient();
|
||||
return super.getUpdatePacket();
|
||||
return new SPacketUpdateTileEntity(pos, 0, getUpdateTag());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
NBTTagCompound nbt = super.getUpdateTag();
|
||||
nbt.setBoolean("active", calmTime == 0);
|
||||
beeLogic.writeToNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
|
||||
super.handleUpdateTag(tag);
|
||||
setActive(tag.getBoolean("active"));
|
||||
beeLogic.readFromNBT(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
NBTTagCompound nbt = pkt.getNbtCompound();
|
||||
handleUpdateTag(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -314,7 +314,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
|
||||
Flower flower = flowerRegistry.getRandomPlantableFlower(FlowerManager.FlowerTypeVanilla, world.rand);
|
||||
setBlockState(world, flower.getBlock().getStateFromMeta(flower.getMeta()), j, i, k, box);
|
||||
setBlockState(world, flower.getBlockState(), j, i, k, box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FruitProviderNone implements IFruitProvider {
|
||||
|
||||
public OverlayType(String ident) {
|
||||
this.ident = ident;
|
||||
this.sprite = new ResourceLocation(Constants.RESOURCE_ID, "blocks/leaves/fruits." + ident);
|
||||
this.sprite = new ResourceLocation(Constants.MOD_ID, "blocks/leaves/fruits." + ident);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -126,13 +127,22 @@ public class WoodAccess implements IWoodAccess {
|
||||
|
||||
private static void registerVanilla() {
|
||||
IBlockState defaultLogState = Blocks.LOG.getDefaultState();
|
||||
register(EnumVanillaWoodType.OAK, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK), new ItemStack(Blocks.LOG, 1, 0));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH), new ItemStack(Blocks.LOG, 1, 1));
|
||||
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE), new ItemStack(Blocks.LOG, 1, 2));
|
||||
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.LOG, false, defaultLogState.withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE), new ItemStack(Blocks.LOG, 1, 3));
|
||||
List<EnumVanillaWoodType> oldLogTypes = Arrays.asList(EnumVanillaWoodType.OAK, EnumVanillaWoodType.SPRUCE, EnumVanillaWoodType.BIRCH, EnumVanillaWoodType.JUNGLE);
|
||||
for (EnumVanillaWoodType woodType : oldLogTypes) {
|
||||
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
|
||||
ItemStack itemStack = new ItemStack(Blocks.LOG, 1, vanillaType.getMetadata());
|
||||
IBlockState blockState = defaultLogState.withProperty(BlockOldLog.VARIANT, vanillaType);
|
||||
register(woodType, WoodBlockKind.LOG, false, blockState, itemStack);
|
||||
}
|
||||
|
||||
IBlockState defaultLog2State = Blocks.LOG2.getDefaultState();
|
||||
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.LOG, false, defaultLog2State.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA), new ItemStack(Blocks.LOG2, 1, 0));
|
||||
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.LOG, false, defaultLog2State.withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK), new ItemStack(Blocks.LOG2, 1, 1));
|
||||
List<EnumVanillaWoodType> newLogTypes = Arrays.asList(EnumVanillaWoodType.ACACIA, EnumVanillaWoodType.DARK_OAK);
|
||||
for (EnumVanillaWoodType woodType : newLogTypes) {
|
||||
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
|
||||
ItemStack itemStack = new ItemStack(Blocks.LOG2, 1, vanillaType.getMetadata() - 4);
|
||||
IBlockState blockState = defaultLog2State.withProperty(BlockNewLog.VARIANT, vanillaType);
|
||||
register(woodType, WoodBlockKind.LOG, false, blockState, itemStack);
|
||||
}
|
||||
|
||||
IBlockState defaultPlanksState = Blocks.PLANKS.getDefaultState();
|
||||
IBlockState defaultSlabState = Blocks.WOODEN_SLAB.getDefaultState();
|
||||
@@ -149,29 +159,29 @@ public class WoodAccess implements IWoodAccess {
|
||||
}
|
||||
|
||||
register(EnumVanillaWoodType.OAK, WoodBlockKind.FENCE, false, Blocks.OAK_FENCE.getDefaultState(), new ItemStack(Blocks.OAK_FENCE));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE, false, Blocks.BIRCH_FENCE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE));
|
||||
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.FENCE, false, Blocks.SPRUCE_FENCE.getDefaultState(), new ItemStack(Blocks.SPRUCE_FENCE));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE, false, Blocks.BIRCH_FENCE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE));
|
||||
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.FENCE, false, Blocks.JUNGLE_FENCE.getDefaultState(), new ItemStack(Blocks.JUNGLE_FENCE));
|
||||
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.FENCE, false, Blocks.ACACIA_FENCE.getDefaultState(), new ItemStack(Blocks.ACACIA_FENCE));
|
||||
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.FENCE, false, Blocks.DARK_OAK_FENCE.getDefaultState(), new ItemStack(Blocks.DARK_OAK_FENCE));
|
||||
|
||||
register(EnumVanillaWoodType.OAK, WoodBlockKind.FENCE_GATE, false, Blocks.OAK_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.OAK_FENCE_GATE));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE_GATE, false, Blocks.BIRCH_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE_GATE));
|
||||
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.FENCE_GATE, false, Blocks.SPRUCE_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.SPRUCE_FENCE_GATE));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE_GATE, false, Blocks.BIRCH_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE_GATE));
|
||||
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.FENCE_GATE, false, Blocks.JUNGLE_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.JUNGLE_FENCE_GATE));
|
||||
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.FENCE_GATE, false, Blocks.ACACIA_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.ACACIA_FENCE_GATE));
|
||||
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.FENCE_GATE, false, Blocks.DARK_OAK_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.DARK_OAK_FENCE_GATE));
|
||||
|
||||
register(EnumVanillaWoodType.OAK, WoodBlockKind.STAIRS, false, Blocks.OAK_STAIRS.getDefaultState(), new ItemStack(Blocks.OAK_STAIRS));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.STAIRS, false, Blocks.BIRCH_STAIRS.getDefaultState(), new ItemStack(Blocks.BIRCH_STAIRS));
|
||||
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.STAIRS, false, Blocks.SPRUCE_STAIRS.getDefaultState(), new ItemStack(Blocks.SPRUCE_STAIRS));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.STAIRS, false, Blocks.BIRCH_STAIRS.getDefaultState(), new ItemStack(Blocks.BIRCH_STAIRS));
|
||||
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.STAIRS, false, Blocks.JUNGLE_STAIRS.getDefaultState(), new ItemStack(Blocks.JUNGLE_STAIRS));
|
||||
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.STAIRS, false, Blocks.ACACIA_STAIRS.getDefaultState(), new ItemStack(Blocks.ACACIA_STAIRS));
|
||||
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.STAIRS, false, Blocks.DARK_OAK_STAIRS.getDefaultState(), new ItemStack(Blocks.DARK_OAK_STAIRS));
|
||||
|
||||
register(EnumVanillaWoodType.OAK, WoodBlockKind.DOOR, false, Blocks.OAK_DOOR.getDefaultState(), new ItemStack(Items.OAK_DOOR));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.DOOR, false, Blocks.BIRCH_DOOR.getDefaultState(), new ItemStack(Items.BIRCH_DOOR));
|
||||
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.DOOR, false, Blocks.SPRUCE_DOOR.getDefaultState(), new ItemStack(Items.SPRUCE_DOOR));
|
||||
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.DOOR, false, Blocks.BIRCH_DOOR.getDefaultState(), new ItemStack(Items.BIRCH_DOOR));
|
||||
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.DOOR, false, Blocks.JUNGLE_DOOR.getDefaultState(), new ItemStack(Items.JUNGLE_DOOR));
|
||||
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.DOOR, false, Blocks.ACACIA_DOOR.getDefaultState(), new ItemStack(Items.ACACIA_DOOR));
|
||||
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.DOOR, false, Blocks.DARK_OAK_DOOR.getDefaultState(), new ItemStack(Items.DARK_OAK_DOOR));
|
||||
|
||||
@@ -56,7 +56,7 @@ public class WoodHelper {
|
||||
WoodBlockKind blockKind = typed.getBlockKind();
|
||||
for (IWoodType woodType : typed.getWoodTypes()) {
|
||||
if (woodType instanceof EnumForestryWoodType) {
|
||||
resourceLocations.add(new ResourceLocation(Constants.RESOURCE_ID, blockKind + "/" + woodType));
|
||||
resourceLocations.add(new ResourceLocation(Constants.MOD_ID, blockKind + "/" + woodType));
|
||||
} else if (woodType instanceof EnumVanillaWoodType) {
|
||||
resourceLocations.add(new ResourceLocation("minecraft", woodType + "_" + blockKind));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -40,7 +41,7 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
|
||||
private final EnumForestryWoodType woodType;
|
||||
|
||||
public BlockArbDoor(EnumForestryWoodType woodType) {
|
||||
super(MaterialArbWood.ARB_WOOD);
|
||||
super(Material.WOOD);
|
||||
this.woodType = woodType;
|
||||
|
||||
setHarvestLevel("axe", 0);
|
||||
|
||||
@@ -2,6 +2,7 @@ package forestry.arboriculture.blocks;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
@@ -18,9 +19,11 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
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.Blocks;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -383,35 +386,49 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof ICharcoalPileComponent) {
|
||||
ICharcoalPileComponent pile = (ICharcoalPileComponent) tile;
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
if (getPileType() == EnumPileType.ASH) {
|
||||
if(pile.getTree() != null){
|
||||
ItemStack charcoal = new ItemStack(PluginArboriculture.items.charcoal, pile.getTree().getGenome().getCarbonization(), pile.getTree().getGenome().getCombustibility());
|
||||
list.add(charcoal);
|
||||
list.add(new ItemStack(PluginCore.items.ash, 3));
|
||||
}else{
|
||||
list.add(new ItemStack(Blocks.DIRT, 2));
|
||||
list.add(new ItemStack(PluginCore.items.ash, 2));
|
||||
}
|
||||
} else if (getPileType() == EnumPileType.DIRT) {
|
||||
list.add(new ItemStack(this));
|
||||
} else {
|
||||
list.add(createWoodPile(pile.getTree()));
|
||||
}
|
||||
drop.set(list);
|
||||
}
|
||||
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getActiveItemStack());
|
||||
drop.set(getPileDrop(world, pos, state, fortune));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = drop.get();
|
||||
drop.remove();
|
||||
|
||||
// not harvested, get drops normally
|
||||
if (drops == null) {
|
||||
drops = getPileDrop(world, pos, state, fortune);
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private List<ItemStack> getPileDrop(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof ICharcoalPileComponent) {
|
||||
ICharcoalPileComponent pile = (ICharcoalPileComponent) tile;
|
||||
|
||||
if (getPileType() == EnumPileType.ASH) {
|
||||
if (pile.getTree() != null) {
|
||||
ItemStack charcoal = new ItemStack(PluginArboriculture.items.charcoal, pile.getTree().getGenome().getCarbonization(), pile.getTree().getGenome().getCombustibility());
|
||||
list.add(charcoal);
|
||||
list.add(new ItemStack(PluginCore.items.ash, 3));
|
||||
} else {
|
||||
list.add(new ItemStack(Blocks.DIRT, 2));
|
||||
list.add(new ItemStack(PluginCore.items.ash, 2));
|
||||
}
|
||||
} else if (getPileType() == EnumPileType.DIRT) {
|
||||
list.add(new ItemStack(this));
|
||||
} else {
|
||||
list.add(createWoodPile(pile.getTree()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
|
||||
@@ -35,9 +35,9 @@ public enum BlockTypeArboricultureTesr implements IBlockTypeTesr {
|
||||
|
||||
<T extends TileForestry> BlockTypeArboricultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class WoodTypeStateMapper extends StateMapperBase {
|
||||
private ModelResourceLocation getForestryModelResourceLocation(IWoodType woodType, Map<IProperty<?>, Comparable<?>> properties) {
|
||||
String resourceLocation = "arboriculture/" + blockPath + '/' + woodType;
|
||||
String propertyString = this.getPropertyString(properties);
|
||||
return new ModelResourceLocation(Constants.RESOURCE_ID + ':' + resourceLocation, propertyString);
|
||||
return new ModelResourceLocation(Constants.MOD_ID + ':' + resourceLocation, propertyString);
|
||||
}
|
||||
|
||||
private ModelResourceLocation getVanillaModelResourceLocation(Block block, IWoodType woodType, Map<IProperty<?>, Comparable<?>> properties) {
|
||||
|
||||
@@ -42,8 +42,8 @@ public class WoodProvider implements IWoodProvider {
|
||||
@Override
|
||||
public void registerSprites(Item item, ITextureManager manager) {
|
||||
TextureMap textureMap = Proxies.common.getClientInstance().getTextureMapBlocks();
|
||||
woodTop = textureMap.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/wood/heart." + name));
|
||||
woodBark = textureMap.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/wood/bark." + name));
|
||||
woodTop = textureMap.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/wood/heart." + name));
|
||||
woodBark = textureMap.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/wood/bark." + name));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -73,14 +73,16 @@ public class ItemBlockPile<B extends Block> extends ItemBlockForestry<Block> {
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
|
||||
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
|
||||
|
||||
if(block == PluginArboriculture.blocks.piles.get(EnumPileType.WOOD)){
|
||||
if (block.hasTileEntity(newState)) {
|
||||
if (stack.hasTagCompound()) {
|
||||
TilePile tile = TileUtil.getTile(world, pos, TilePile.class);
|
||||
if (tile != null) {
|
||||
tile.readFromNBT(stack.getTagCompound());
|
||||
tile.setPos(pos);
|
||||
tile.markDirty();
|
||||
if (placed) {
|
||||
if (block == PluginArboriculture.blocks.piles.get(EnumPileType.WOOD)) {
|
||||
if (block.hasTileEntity(newState)) {
|
||||
if (stack.hasTagCompound()) {
|
||||
TilePile tile = TileUtil.getTile(world, pos, TilePile.class);
|
||||
if (tile != null) {
|
||||
tile.readFromNBT(stack.getTagCompound());
|
||||
tile.setPos(pos);
|
||||
tile.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,14 +92,14 @@ public class ModelLeaves extends ModelBlockDefault<BlockForestryLeaves> {
|
||||
TextureAtlasSprite leafSprite = map.getAtlasSprite(leafSpriteLocation.toString());
|
||||
|
||||
// Render the plain leaf block.
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, pos, leafSprite, 0);
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, leafSprite, 0);
|
||||
|
||||
// Render overlay for fruit leaves.
|
||||
ResourceLocation fruitSpriteLocation = tile.getFruitSprite();
|
||||
|
||||
if (fruitSpriteLocation != null) {
|
||||
TextureAtlasSprite fruitSprite = map.getAtlasSprite(fruitSpriteLocation.toString());
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, pos, fruitSprite, 1);
|
||||
baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, fruitSprite, 1);
|
||||
}
|
||||
|
||||
// Set the particle sprite
|
||||
|
||||
@@ -48,10 +48,10 @@ public class TextureLeaves {
|
||||
|
||||
private TextureLeaves(EnumLeafType enumLeafType) {
|
||||
String ident = enumLeafType.toString().toLowerCase(Locale.ENGLISH);
|
||||
this.plain = new ResourceLocation(Constants.RESOURCE_ID, "blocks/leaves/" + ident + ".plain");
|
||||
this.fancy = new ResourceLocation(Constants.RESOURCE_ID, "blocks/leaves/" + ident + ".fancy");
|
||||
this.pollinatedPlain = new ResourceLocation(Constants.RESOURCE_ID, "blocks/leaves/" + ident + ".changed.plain");
|
||||
this.pollinatedFancy = new ResourceLocation(Constants.RESOURCE_ID, "blocks/leaves/" + ident + ".changed");
|
||||
this.plain = new ResourceLocation(Constants.MOD_ID, "blocks/leaves/" + ident + ".plain");
|
||||
this.fancy = new ResourceLocation(Constants.MOD_ID, "blocks/leaves/" + ident + ".fancy");
|
||||
this.pollinatedPlain = new ResourceLocation(Constants.MOD_ID, "blocks/leaves/" + ident + ".changed.plain");
|
||||
this.pollinatedFancy = new ResourceLocation(Constants.MOD_ID, "blocks/leaves/" + ident + ".changed");
|
||||
}
|
||||
|
||||
private void registerSprites() {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FruitPodStateMapper extends ForestryStateMapper {
|
||||
String modID = fruit.getModID();
|
||||
if (Constants.MOD_ID.equals(modID)) {
|
||||
String modelName = fruit.getModelName();
|
||||
String resourcePath = Constants.RESOURCE_ID + ":pods/" + modelName;
|
||||
String resourcePath = Constants.MOD_ID + ":pods/" + modelName;
|
||||
for (IBlockState state : block.getBlockState().getValidStates()) {
|
||||
String propertyString = getPropertyString(state.getProperties());
|
||||
mapStateModelLocations.put(state, new ModelResourceLocation(resourcePath, propertyString));
|
||||
|
||||
@@ -27,7 +27,7 @@ public class PileStateMapper extends ForestryStateMapper {
|
||||
|
||||
@Override
|
||||
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
|
||||
String location = Constants.RESOURCE_ID + ":pile";
|
||||
String location = Constants.MOD_ID + ":pile";
|
||||
|
||||
IBlockState woodPileState = PluginArboriculture.blocks.piles.get(EnumPileType.WOOD).getDefaultState();
|
||||
mapStateModelLocations.put(woodPileState, new ModelResourceLocation(location, "type=wood"));
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CreativeTabForestry extends CreativeTabs {
|
||||
}
|
||||
}
|
||||
|
||||
public static final CreativeTabs tabForestry = new CreativeTabForestry(0, Constants.RESOURCE_ID);
|
||||
public static final CreativeTabs tabForestry = new CreativeTabForestry(0, Constants.MOD_ID);
|
||||
|
||||
private final int icon;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class EventHandlerCore {
|
||||
return;
|
||||
}
|
||||
|
||||
ResourceLocation resourceLocation = new ResourceLocation(Constants.RESOURCE_ID, event.getName().getResourcePath());
|
||||
ResourceLocation resourceLocation = new ResourceLocation(Constants.MOD_ID, event.getName().getResourcePath());
|
||||
LootTable forestryChestAdditions = LootTableLoader.loadBuiltinLootTable(resourceLocation);
|
||||
if (forestryChestAdditions != null) {
|
||||
for (String poolName : PluginManager.getLootPoolNames()) {
|
||||
|
||||
@@ -124,6 +124,14 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
return definition.getBoundingBox(pos, blockState);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
|
||||
IMachineProperties definition = getDefinition();
|
||||
return definition.getBoundingBox(pos, state).offset(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
|
||||
IMachineProperties definition = getDefinition();
|
||||
|
||||
@@ -31,7 +31,7 @@ public enum BlockTypeCoreTesr implements IBlockTypeTesr {
|
||||
private final IMachinePropertiesTesr machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeCoreTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class CommandSaveStats extends SubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Constants.RESOURCE_ID + "/stats/" + player.getDisplayName() + '-' + saveHelper.getFileSuffix() + ".log");
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Constants.MOD_ID + "/stats/" + player.getDisplayName() + '-' + saveHelper.getFileSuffix() + ".log");
|
||||
try {
|
||||
File folder = file.getParentFile();
|
||||
if (folder != null && !folder.exists()) {
|
||||
|
||||
@@ -16,8 +16,7 @@ import forestry.api.core.IForestryConstants;
|
||||
|
||||
public class Constants implements IForestryConstants {
|
||||
// System
|
||||
public static final String MOD_ID = "Forestry";
|
||||
public static final String RESOURCE_ID = "forestry";
|
||||
public static final String MOD_ID = "forestry";
|
||||
public static final String URL = "http://forestry.sengir.net/";
|
||||
|
||||
public static final String VERSION = "@VERSION@";
|
||||
@@ -41,15 +40,15 @@ public class Constants implements IForestryConstants {
|
||||
public static final String TEXTURE_APIARIST_ARMOR_PRIMARY = TEXTURE_PATH_ITEMS + "/apiarist_armor_1.png";
|
||||
public static final String TEXTURE_APIARIST_ARMOR_SECONDARY = TEXTURE_PATH_ITEMS + "/apiarist_armor_2.png";
|
||||
public static final String TEXTURE_NATURALIST_ARMOR_PRIMARY = TEXTURE_PATH_ITEMS + "/naturalist_armor_1.png";
|
||||
public static final String TEXTURE_SKIN_BEEKPEEPER = RESOURCE_ID + ":" + TEXTURE_PATH_ENTITIES + "/beekeeper.png";
|
||||
public static final String TEXTURE_SKIN_LUMBERJACK = RESOURCE_ID + ":" + TEXTURE_PATH_ENTITIES + "/lumberjack.png";
|
||||
public static final String TEXTURE_SKIN_BEEKPEEPER = Constants.MOD_ID + ":" + TEXTURE_PATH_ENTITIES + "/beekeeper.png";
|
||||
public static final String TEXTURE_SKIN_LUMBERJACK = Constants.MOD_ID + ":" + TEXTURE_PATH_ENTITIES + "/lumberjack.png";
|
||||
|
||||
// Villagers
|
||||
public static final String ID_VILLAGER_APIARIST = RESOURCE_ID + ":apiarist";
|
||||
public static final String ID_VILLAGER_ARBORIST = RESOURCE_ID + ":arborist";
|
||||
public static final String ID_VILLAGER_APIARIST = Constants.MOD_ID + ":apiarist";
|
||||
public static final String ID_VILLAGER_ARBORIST = Constants.MOD_ID + ":arborist";
|
||||
|
||||
// Village Loot Key
|
||||
public static final ResourceLocation VILLAGE_NATURALIST_LOOT_KEY = new ResourceLocation(RESOURCE_ID, "chests/village_naturalist");
|
||||
public static final ResourceLocation VILLAGE_NATURALIST_LOOT_KEY = new ResourceLocation(Constants.MOD_ID, "chests/village_naturalist");
|
||||
|
||||
// Item Ids
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public enum EnumErrorCode implements IErrorState {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerSprite() {
|
||||
texture = TextureManager.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "gui/errors/" + iconName));
|
||||
texture = TextureManager.registerSprite(new ResourceLocation(Constants.MOD_ID, "gui/errors/" + iconName));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist,
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return Constants.RESOURCE_ID + ":" + Constants.TEXTURE_NATURALIST_ARMOR_PRIMARY;
|
||||
return Constants.MOD_ID + ":" + Constants.TEXTURE_NATURALIST_ARMOR_PRIMARY;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -58,18 +58,20 @@ public class ItemBlockForestry<B extends Block> extends ItemBlock {
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
|
||||
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
|
||||
|
||||
if (block.hasTileEntity(newState)) {
|
||||
if (stack.getItem() instanceof ItemBlockNBT && stack.hasTagCompound()) {
|
||||
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
|
||||
if (tile != null) {
|
||||
tile.readFromNBT(stack.getTagCompound());
|
||||
tile.setPos(pos);
|
||||
if (placed) {
|
||||
if (block.hasTileEntity(newState)) {
|
||||
if (stack.getItem() instanceof ItemBlockNBT && stack.hasTagCompound()) {
|
||||
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
|
||||
if (tile != null) {
|
||||
tile.readFromNBT(stack.getTagCompound());
|
||||
tile.setPos(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (block instanceof BlockBase) {
|
||||
((BlockBase) block).rotateAfterPlacement(player, world, pos, side);
|
||||
if (block instanceof BlockBase) {
|
||||
((BlockBase) block).rotateAfterPlacement(player, world, pos, side);
|
||||
}
|
||||
}
|
||||
|
||||
return placed;
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ModelManager implements IModelManager {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(String identifier) {
|
||||
return getModelLocation(Constants.RESOURCE_ID, identifier);
|
||||
return getModelLocation(Constants.MOD_ID, identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,11 +23,14 @@ import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.animation.ITimeValue;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelIndex;
|
||||
@@ -115,7 +118,7 @@ public class ProxyRender {
|
||||
|
||||
/* FX */
|
||||
|
||||
public void addBeeHiveFX(@Nonnull World world, double x, double y, double z, int color, @Nonnull List<BlockPos> flowerPositions) {
|
||||
public void addBeeHiveFX(@Nonnull IBeeHousing housing, @Nonnull IBeeGenome genome, @Nonnull List<BlockPos> flowerPositions) {
|
||||
}
|
||||
|
||||
public void addEntityHoneyDustFX(World world, double x, double y, double z) {
|
||||
|
||||
@@ -28,11 +28,14 @@ import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
@@ -40,7 +43,13 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.animation.ITimeValue;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
import forestry.apiculture.entities.ParticleBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.apiculture.entities.ParticleBeeExplore;
|
||||
import forestry.apiculture.entities.ParticleBeeRoundTrip;
|
||||
import forestry.apiculture.entities.ParticleBeeTargetEntity;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
import forestry.apiculture.render.TextureHabitatLocator;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -62,6 +71,7 @@ import forestry.core.tiles.TileBase;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileMill;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import forestry.core.utils.VectUtil;
|
||||
|
||||
public class ProxyRenderClient extends ProxyRender {
|
||||
|
||||
@@ -188,16 +198,52 @@ public class ProxyRenderClient extends ProxyRender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBeeHiveFX(@Nonnull World world, double x, double y, double z, int color, @Nonnull List<BlockPos> flowerPositions) {
|
||||
public void addBeeHiveFX(@Nonnull IBeeHousing housing, @Nonnull IBeeGenome genome, @Nonnull List<BlockPos> flowerPositions) {
|
||||
World world = housing.getWorldObj();
|
||||
if (!shouldSpawnParticle(world)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
|
||||
|
||||
Vec3d particleStart = housing.getBeeFXCoordinates();
|
||||
|
||||
// Avoid rendering bee particles that are too far away, they're very small.
|
||||
// At 32+ distance, have no bee particles. Make more particles up close.
|
||||
BlockPos playerPosition = Proxies.common.getPlayer().getPosition();
|
||||
double playerDistanceSq = playerPosition.distanceSqToCenter(particleStart.xCoord, particleStart.yCoord, particleStart.zCoord);
|
||||
if (world.rand.nextInt(1024) < playerDistanceSq) {
|
||||
return;
|
||||
}
|
||||
|
||||
int color = genome.getPrimary().getSpriteColour(0);
|
||||
|
||||
if (!flowerPositions.isEmpty()) {
|
||||
BlockPos destination = flowerPositions.get(world.rand.nextInt(flowerPositions.size()));
|
||||
Particle particle = new ParticleBee(world, x, y, z, color, destination);
|
||||
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
|
||||
effectRenderer.addEffect(particle);
|
||||
int randomInt = world.rand.nextInt(100);
|
||||
|
||||
if (housing instanceof IHiveTile) {
|
||||
if (((IHiveTile) housing).isAngry() || randomInt >= 85) {
|
||||
List<EntityLivingBase> entitiesInRange = AlleleEffect.getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
if (!entitiesInRange.isEmpty()) {
|
||||
EntityLivingBase entity = entitiesInRange.get(world.rand.nextInt(entitiesInRange.size()));
|
||||
Particle particle = new ParticleBeeTargetEntity(world, particleStart, entity, color);
|
||||
effectRenderer.addEffect(particle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (randomInt < 75) {
|
||||
BlockPos destination = flowerPositions.get(world.rand.nextInt(flowerPositions.size()));
|
||||
Particle particle = new ParticleBeeRoundTrip(world, particleStart, destination, color);
|
||||
effectRenderer.addEffect(particle);
|
||||
} else {
|
||||
Vec3i area = AlleleEffect.getModifiedArea(genome, housing);
|
||||
Vec3i offset = housing.getCoordinates().add(-area.getX() / 2, -area.getY() / 4, -area.getZ() / 2);
|
||||
BlockPos destination = VectUtil.getRandomPositionInArea(world.rand, area).add(offset);
|
||||
Particle particle = new ParticleBeeExplore(world, particleStart, destination, color);
|
||||
effectRenderer.addEffect(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import forestry.core.config.Constants;
|
||||
public class ForestryResource extends ResourceLocation {
|
||||
|
||||
public ForestryResource(String path) {
|
||||
super(Constants.RESOURCE_ID, path);
|
||||
super(Constants.MOD_ID, path);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class TextureManager implements ITextureManager {
|
||||
"slots/blocked", "slots/blocked_2", "slots/liquid", "slots/container", "slots/locked",
|
||||
"mail/carrier.player", "mail/carrier.trader"};
|
||||
for (String identifier : defaultIconNames) {
|
||||
ResourceLocation resourceLocation = new ResourceLocation(Constants.RESOURCE_ID, "gui/" + identifier);
|
||||
ResourceLocation resourceLocation = new ResourceLocation(Constants.MOD_ID, "gui/" + identifier);
|
||||
TextureAtlasSprite icon = registerSprite(resourceLocation);
|
||||
defaultIcons.put(identifier, icon);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Log {
|
||||
}
|
||||
|
||||
private static void log(Level logLevel, String message, Object... params) {
|
||||
LogManager.getLogger(Constants.RESOURCE_ID).log(logLevel, message, params);
|
||||
LogManager.getLogger(Constants.MOD_ID).log(logLevel, message, params);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,11 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class VectUtil {
|
||||
public static BlockPos getRandomPositionInArea(Random random, Vec3i area) {
|
||||
@@ -53,4 +57,104 @@ public final class VectUtil {
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
|
||||
public static Iterable<BlockPos.MutableBlockPos> getAllInBoxFromCenterMutable(World world, final BlockPos from, final BlockPos center, final BlockPos to) {
|
||||
final BlockPos minPos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
|
||||
final BlockPos maxPos = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
|
||||
|
||||
return new Iterable<BlockPos.MutableBlockPos>() {
|
||||
@Override
|
||||
public Iterator<BlockPos.MutableBlockPos> iterator() {
|
||||
return new MutableBlockPosSpiralIterator(world, center, maxPos, minPos);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static class MutableBlockPosSpiralIterator extends AbstractIterator<BlockPos.MutableBlockPos> {
|
||||
private final World world;
|
||||
private final BlockPos center;
|
||||
private final BlockPos maxPos;
|
||||
private final BlockPos minPos;
|
||||
private int spiralLayer;
|
||||
private final int maxSpiralLayers;
|
||||
private int direction;
|
||||
|
||||
private BlockPos.MutableBlockPos theBlockPos;
|
||||
|
||||
public MutableBlockPosSpiralIterator(World world, BlockPos center, BlockPos maxPos, BlockPos minPos) {
|
||||
this.world = world;
|
||||
this.center = center;
|
||||
this.maxPos = maxPos;
|
||||
this.minPos = minPos;
|
||||
|
||||
int xDiameter = maxPos.getX() - minPos.getX();
|
||||
int zDiameter = maxPos.getZ() - minPos.getZ();
|
||||
this.maxSpiralLayers = Math.max(xDiameter, zDiameter) / 2;
|
||||
this.spiralLayer = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockPos.MutableBlockPos computeNext() {
|
||||
BlockPos.MutableBlockPos pos;
|
||||
|
||||
do {
|
||||
pos = nextPos();
|
||||
}
|
||||
while (pos != null && (pos.getX() > maxPos.getX() || pos.getY() > maxPos.getY() || pos.getZ() > maxPos.getZ() || pos.getX() < minPos.getX() || pos.getY() < minPos.getY() || pos.getZ() < minPos.getZ()));
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
protected BlockPos.MutableBlockPos nextPos() {
|
||||
if (this.theBlockPos == null) {
|
||||
this.theBlockPos = new BlockPos.MutableBlockPos(center.getX(), maxPos.getY(), center.getZ());
|
||||
int y = Math.min(this.maxPos.getY(), this.world.getHeight(this.theBlockPos).getY());
|
||||
this.theBlockPos.setY(y);
|
||||
return this.theBlockPos;
|
||||
} else if (spiralLayer > maxSpiralLayers) {
|
||||
return this.endOfData();
|
||||
} else {
|
||||
int x = this.theBlockPos.getX();
|
||||
int y = this.theBlockPos.getY();
|
||||
int z = this.theBlockPos.getZ();
|
||||
|
||||
if (y > minPos.getY() && y > 0) {
|
||||
y--;
|
||||
} else {
|
||||
switch (direction) {
|
||||
case 0:
|
||||
++x;
|
||||
if (x == center.getX() + spiralLayer) {
|
||||
++direction;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
++z;
|
||||
if (z == center.getZ() + spiralLayer) {
|
||||
++direction;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
--x;
|
||||
if (x == center.getX() - spiralLayer) {
|
||||
++direction;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
--z;
|
||||
if (z == center.getZ() - spiralLayer) {
|
||||
direction = 0;
|
||||
++spiralLayer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this.theBlockPos.setPos(x, y, z);
|
||||
y = Math.min(this.maxPos.getY(), this.world.getHeight(this.theBlockPos).getY());
|
||||
}
|
||||
|
||||
return this.theBlockPos.setPos(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,12 @@ public enum BlockTypeEngine implements IBlockTypeTesr {
|
||||
|
||||
protected static IMachinePropertiesTesr<?> createEngineProperties(@Nonnull Class<? extends TileEngine> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
TileEntitySpecialRenderer<TileEngine> renderer = PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + textureName + "_");
|
||||
return new MachinePropertiesEngine<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks" + textureName + ".0");
|
||||
return new MachinePropertiesEngine<>(teClass, name, renderer, Constants.MOD_ID + ":blocks" + textureName + ".0");
|
||||
}
|
||||
|
||||
protected static IMachinePropertiesTesr<?> createMachineProperties(@Nonnull Class<? extends TileBase> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
TileEntitySpecialRenderer<TileBase> renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + textureName + "_");
|
||||
return new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks" + textureName + ".0");
|
||||
return new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks" + textureName + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -47,11 +47,11 @@ public enum BlockTypeFactoryTesr implements IBlockTypeTesr {
|
||||
|
||||
<T extends TileBase> BlockTypeFactoryTesr(@Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
TileEntitySpecialRenderer<TileBase> renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
<T extends TileBase> BlockTypeFactoryTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -41,14 +41,14 @@ public enum EnumFarmBlockType implements IStringSerializable {
|
||||
public static void registerSprites() {
|
||||
TextureMap map = Proxies.common.getClientInstance().getTextureMapBlocks();
|
||||
sprites = Arrays.asList(
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/plain")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/reverse")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/top")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/band")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/gears")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/hatch")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/valve")),
|
||||
map.registerSprite(new ResourceLocation(Constants.RESOURCE_ID, "blocks/farm/control"))
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/plain")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/reverse")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/top")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/band")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/gears")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/hatch")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/valve")),
|
||||
map.registerSprite(new ResourceLocation(Constants.MOD_ID, "blocks/farm/control"))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.greenhouse;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -45,8 +45,8 @@ public class FakeGreenhouseState implements IGreenhouseState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IInternalBlock> getInternalBlocks() {
|
||||
return Collections.emptyList();
|
||||
public Set<IInternalBlock> getInternalBlocks() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.core.multiblock.IMultiblockControllerInternal;
|
||||
import forestry.core.multiblock.MultiblockRegistry;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
import forestry.greenhouse.multiblock.InternalBlockCheck;
|
||||
|
||||
public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
|
||||
@@ -28,7 +29,7 @@ public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
for (IMultiblockControllerInternal controllerInternal : MultiblockRegistry.getControllersFromWorld(world)) {
|
||||
if (controllerInternal instanceof IGreenhouseControllerInternal) {
|
||||
if (controllerInternal.isAssembled()) {
|
||||
if (isPosiotionInGreenhouse((IGreenhouseControllerInternal) controllerInternal, pos)) {
|
||||
if (isPositionInGreenhouse((IGreenhouseControllerInternal) controllerInternal, pos)) {
|
||||
return ((IGreenhouseControllerInternal) controllerInternal).createState();
|
||||
}
|
||||
}
|
||||
@@ -38,13 +39,9 @@ public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isPosiotionInGreenhouse(IGreenhouseControllerInternal controller, BlockPos pos) {
|
||||
for (IInternalBlock internalBlock : controller.getInternalBlocks()) {
|
||||
if (internalBlock.getPos().equals(pos)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
private static boolean isPositionInGreenhouse(IGreenhouseControllerInternal controller, BlockPos pos) {
|
||||
IInternalBlock checkBlock = new InternalBlockCheck(pos);
|
||||
return controller.getInternalBlocks().contains(checkBlock);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.greenhouse;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -24,10 +24,10 @@ public final class GreenhouseState implements IGreenhouseState {
|
||||
|
||||
private final float humidity;
|
||||
private final float temperature;
|
||||
private final List<IInternalBlock> internalBlocks;
|
||||
private final Set<IInternalBlock> internalBlocks;
|
||||
private final Collection<IMultiblockComponent> greenhouseComponents;
|
||||
|
||||
public GreenhouseState(float humidity, float temperature, List<IInternalBlock> internalBlocks, Collection<IMultiblockComponent> greenhouseComponents) {
|
||||
public GreenhouseState(float humidity, float temperature, Set<IInternalBlock> internalBlocks, Collection<IMultiblockComponent> greenhouseComponents) {
|
||||
this.humidity = humidity;
|
||||
this.temperature = temperature;
|
||||
this.internalBlocks = internalBlocks;
|
||||
@@ -59,7 +59,7 @@ public final class GreenhouseState implements IGreenhouseState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IInternalBlock> getInternalBlocks() {
|
||||
public Set<IInternalBlock> getInternalBlocks() {
|
||||
return internalBlocks;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public enum BlockGreenhouseType {
|
||||
|
||||
for (BlockGreenhouseSprites sprite : BlockGreenhouseSprites.VALUES) {
|
||||
if (sprite != BlockGreenhouseSprites.PLAIN && sprite != BlockGreenhouseSprites.GLASS) {
|
||||
ResourceLocation location = new ResourceLocation(Constants.RESOURCE_ID, "blocks/greenhouse/" + sprite.spriteName);
|
||||
ResourceLocation location = new ResourceLocation(Constants.MOD_ID, "blocks/greenhouse/" + sprite.spriteName);
|
||||
TextureAtlasSprite textureAtlasSprite = map.registerSprite(location);
|
||||
sprites.put(sprite, textureAtlasSprite);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.greenhouse.multiblock;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -97,8 +98,8 @@ public class FakeGreenhouseController extends FakeMultiblockController implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IInternalBlock> getInternalBlocks() {
|
||||
return Collections.emptyList();
|
||||
public Set<IInternalBlock> getInternalBlocks() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,6 +64,7 @@ import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.utils.CamouflageUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.energy.EnergyManager;
|
||||
@@ -76,7 +77,7 @@ import forestry.greenhouse.tiles.TileGreenhouseSprinkler;
|
||||
|
||||
public class GreenhouseController extends RectangularMultiblockControllerBase implements IGreenhouseControllerInternal, ILiquidTankTile {
|
||||
|
||||
private final List<IInternalBlock> internalBlocks = new ArrayList<>();
|
||||
private final Set<IInternalBlock> internalBlocks = new HashSet<>();
|
||||
private final Set<IGreenhouseComponent.Listener> listenerComponents = new HashSet<>();
|
||||
private final Set<IGreenhouseComponent.Climatiser> climatiserComponents = new HashSet<>();
|
||||
private final Set<IGreenhouseComponent.Active> activeComponents = new HashSet<>();
|
||||
@@ -288,35 +289,52 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
/* CAMOUFLAGE */
|
||||
@Override
|
||||
public void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock) {
|
||||
ItemStack oldCamouflageBlock;
|
||||
switch (type) {
|
||||
case DEFAULT:
|
||||
camouflagePlainBlock = camouflageBlock;
|
||||
break;
|
||||
case GLASS:
|
||||
camouflageGlassBlock = camouflageBlock;
|
||||
break;
|
||||
case DOOR:
|
||||
camouflageDoorBlock = camouflageBlock;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
case DEFAULT:
|
||||
oldCamouflageBlock = camouflagePlainBlock;
|
||||
break;
|
||||
case GLASS:
|
||||
oldCamouflageBlock = camouflageGlassBlock;
|
||||
break;
|
||||
case DOOR:
|
||||
oldCamouflageBlock = camouflageDoorBlock;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
for (IMultiblockComponent comp : connectedParts) {
|
||||
if (comp instanceof ICamouflagedTile) {
|
||||
ICamouflagedTile camBlock = (ICamouflagedTile) comp;
|
||||
if (camBlock.getCamouflageType() == type) {
|
||||
worldObj.markBlockRangeForRenderUpdate(camBlock.getCoordinates(), camBlock.getCoordinates());
|
||||
if(!ItemStackUtil.isIdenticalItem(camouflageBlock, oldCamouflageBlock)){
|
||||
switch (type) {
|
||||
case DEFAULT:
|
||||
camouflagePlainBlock = camouflageBlock;
|
||||
break;
|
||||
case GLASS:
|
||||
camouflageGlassBlock = camouflageBlock;
|
||||
break;
|
||||
case DOOR:
|
||||
camouflageDoorBlock = camouflageBlock;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
for (IMultiblockComponent comp : connectedParts) {
|
||||
if (comp instanceof ICamouflagedTile) {
|
||||
ICamouflagedTile camBlock = (ICamouflagedTile) comp;
|
||||
if (camBlock.getCamouflageType() == type) {
|
||||
worldObj.markBlockRangeForRenderUpdate(camBlock.getCoordinates(), camBlock.getCoordinates());
|
||||
}
|
||||
}
|
||||
}
|
||||
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type, true));
|
||||
}
|
||||
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type, true));
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(createState(), null, this, type));
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(createState(), null, this, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -515,10 +533,6 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
int minX = getSizeLimits().getMinimumXSize();
|
||||
int minY = getSizeLimits().getMinimumYSize();
|
||||
int minZ = getSizeLimits().getMinimumZSize();
|
||||
|
||||
if (connectedParts.size() < getSizeLimits().getMinimumNumberOfBlocksForAssembledMachine()) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.small", minX, minY, minZ));
|
||||
}
|
||||
|
||||
BlockPos maximumCoord = getMaximumCoord();
|
||||
BlockPos minimumCoord = getMinimumCoord();
|
||||
@@ -551,6 +565,10 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.small.z", minZ));
|
||||
}
|
||||
|
||||
if (connectedParts.size() < getSizeLimits().getMinimumNumberOfBlocksForAssembledMachine()) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.greenhouse.error.space.closed", minX, minY, minZ));
|
||||
}
|
||||
|
||||
// Now we run a simple check on each block within that volume.
|
||||
// Any block deviating = NO DEAL SIR
|
||||
TileEntity te;
|
||||
@@ -726,7 +744,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IInternalBlock> getInternalBlocks() {
|
||||
public Set<IInternalBlock> getInternalBlocks() {
|
||||
return internalBlocks;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class GreenhouseMultiblockSizeLimits implements IMultiblockSizeLimits {
|
||||
|
||||
@Override
|
||||
public int getMinimumNumberOfBlocksForAssembledMachine() {
|
||||
return 5 * 5 * 5 - 36;
|
||||
return (5 * 5 * 5) - (3 * 3 * 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ package forestry.greenhouse.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.greenhouse.IGreenhouseState;
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
@@ -53,7 +53,7 @@ public interface IGreenhouseControllerInternal extends IGreenhouseController, IM
|
||||
IGreenhouseState createState();
|
||||
|
||||
/**
|
||||
* @return A list with all internal block's of the greenhouse.
|
||||
* @return All internal blocks of the greenhouse.
|
||||
*/
|
||||
List<IInternalBlock> getInternalBlocks();
|
||||
Set<IInternalBlock> getInternalBlocks();
|
||||
}
|
||||
@@ -74,4 +74,9 @@ public class InternalBlock implements IInternalBlock {
|
||||
IInternalBlock internalBlock = (IInternalBlock) obj;
|
||||
return internalBlock.getPos().equals(getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pos.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package forestry.greenhouse.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.greenhouse.IInternalBlockFace;
|
||||
|
||||
/**
|
||||
* Used to check if a blockPos is in a collection of IInternalBlock
|
||||
*/
|
||||
public class InternalBlockCheck implements IInternalBlock {
|
||||
private final BlockPos pos;
|
||||
|
||||
public InternalBlockCheck(BlockPos pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IInternalBlock getRoot() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Collection<IInternalBlockFace> getFaces() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof IInternalBlock)) {
|
||||
return false;
|
||||
}
|
||||
IInternalBlock internalBlock = (IInternalBlock) obj;
|
||||
return internalBlock.getPos().equals(getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pos.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.ITitled;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouse;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
import forestry.greenhouse.gui.ContainerGreenhouse;
|
||||
@@ -93,15 +94,17 @@ public abstract class TileGreenhouse extends MultiblockTileEntityForestry<Multib
|
||||
|
||||
@Override
|
||||
public void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock) {
|
||||
this.camouflageBlock = camouflageBlock;
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type));
|
||||
if(!ItemStackUtil.isIdenticalItem(camouflageBlock, this.camouflageBlock)){
|
||||
this.camouflageBlock = camouflageBlock;
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type));
|
||||
}
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(getMultiblockLogic().getController().createState(), this, this, type));
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(getMultiblockLogic().getController().createState(), this, this, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TileGreenhouseControl extends TileGreenhouse implements IGreenhouse
|
||||
|
||||
@Override
|
||||
public <G extends IGreenhouseController & IGreenhouseHousing> boolean canWork(G greenhouse, boolean canWork) {
|
||||
return canWork && hasRedstoneSignal();
|
||||
return canWork && !hasRedstoneSignal();
|
||||
}
|
||||
|
||||
private boolean hasRedstoneSignal() {
|
||||
|
||||
@@ -47,6 +47,7 @@ import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouse;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
@@ -140,15 +141,17 @@ public class TileGreenhouseHatch extends MultiblockTileEntityBase<MultiblockLogi
|
||||
/* CONSTRUCTION MATERIAL */
|
||||
@Override
|
||||
public void setCamouflageBlock(EnumCamouflageType type, ItemStack camouflageBlock) {
|
||||
this.camouflageBlock = camouflageBlock;
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type));
|
||||
if(!ItemStackUtil.isIdenticalItem(camouflageBlock, this.camouflageBlock)){
|
||||
this.camouflageBlock = camouflageBlock;
|
||||
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
Proxies.net.sendToServer(new PacketCamouflageUpdate(this, type));
|
||||
}
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(getMultiblockLogic().getController().createState(), this, this, type));
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new CamouflageChangeEvent(getMultiblockLogic().getController().createState(), this, this, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TileGreenhouseSprinkler extends TileGreenhouseClimatiser {
|
||||
|
||||
public TileGreenhouseSprinkler() {
|
||||
super(definition);
|
||||
asm = Proxies.render.loadAnimationState(new ResourceLocation(Constants.RESOURCE_ID, "asms/block/sprinkler.json"), ImmutableMap.of(
|
||||
asm = Proxies.render.loadAnimationState(new ResourceLocation(Constants.MOD_ID, "asms/block/sprinkler.json"), ImmutableMap.of(
|
||||
"cycle_length", cycleLength,
|
||||
"click_time", clickTime
|
||||
));
|
||||
|
||||
@@ -35,9 +35,9 @@ public enum BlockTypeLepidopterologyTesr implements IBlockTypeTesr {
|
||||
|
||||
<T extends TileForestry> BlockTypeLepidopterologyTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.MOD_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CocoonStateMapper extends ForestryStateMapper {
|
||||
if(allele instanceof IAlleleButterflyCocoon){
|
||||
for(int age = 0;age < 3;age++){
|
||||
IAlleleButterflyCocoon cocoon = (IAlleleButterflyCocoon) allele;
|
||||
String resourcePath = Constants.RESOURCE_ID + ":cocoons/cocoon_" + cocoon.getCocoonName();
|
||||
String resourcePath = Constants.MOD_ID + ":cocoons/cocoon_" + cocoon.getCocoonName();
|
||||
IBlockState state = block.getDefaultState().withProperty(AlleleButterflyCocoon.COCOON, cocoon).withProperty(AlleleButterflyCocoon.AGE, age);
|
||||
String propertyString = "age=" + age;
|
||||
mapStateModelLocations.put(state, new ModelResourceLocation(resourcePath, propertyString));
|
||||
|
||||
@@ -315,7 +315,7 @@ public enum ButterflyDefinition implements IButterflyDefinition {
|
||||
|
||||
String texture = "butterflies/" + uid;
|
||||
|
||||
IAlleleButterflySpeciesBuilder speciesBuilder = ButterflyManager.butterflyFactory.createSpecies("forestry." + uid, unlocalizedName, "Sengir", unlocalizedDescription, Constants.RESOURCE_ID, texture, dominant, branchDefinition.getBranch(), binomial, serumColor);
|
||||
IAlleleButterflySpeciesBuilder speciesBuilder = ButterflyManager.butterflyFactory.createSpecies("forestry." + uid, unlocalizedName, "Sengir", unlocalizedDescription, Constants.MOD_ID, texture, dominant, branchDefinition.getBranch(), binomial, serumColor);
|
||||
speciesBuilder.setRarity(rarity);
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
this.species = speciesBuilder.build();
|
||||
|
||||
@@ -75,7 +75,7 @@ public enum MothDefinition implements IButterflyDefinition {
|
||||
|
||||
String texture = "butterflies/" + uid;
|
||||
|
||||
IAlleleButterflySpeciesBuilder speciesBuilder = ButterflyManager.butterflyFactory.createSpecies("forestry." + uid, unlocalizedName, "Sengir", unlocalizedDescription, Constants.RESOURCE_ID, texture, dominant, branchDefinition.getBranch(), binomial, serumColor);
|
||||
IAlleleButterflySpeciesBuilder speciesBuilder = ButterflyManager.butterflyFactory.createSpecies("forestry." + uid, unlocalizedName, "Sengir", unlocalizedDescription, Constants.MOD_ID, texture, dominant, branchDefinition.getBranch(), binomial, serumColor);
|
||||
speciesBuilder.setRarity(rarity);
|
||||
speciesBuilder.setNocturnal();
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
|
||||
@@ -78,7 +78,7 @@ public class AlleleButterflyCocoon extends AlleleCategorized implements IAlleleB
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getCocoonItemModel(int age) {
|
||||
return new ModelResourceLocation(Constants.RESOURCE_ID + ":lepidopterology/cocoons/cocoon_" + name + "_" + getAgeKey(age), "inventory");
|
||||
return new ModelResourceLocation(Constants.MOD_ID + ":lepidopterology/cocoons/cocoon_" + name + "_" + getAgeKey(age), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class AlleleButterflyEffect extends AlleleCategorized implements IAlleleB
|
||||
}
|
||||
|
||||
protected AlleleButterflyEffect(String valueName, boolean isDominant) {
|
||||
super(Constants.RESOURCE_ID, "bf", valueName, isDominant);
|
||||
super(Constants.MOD_ID, "bf", valueName, isDominant);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,8 +14,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
@@ -161,48 +163,48 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
private static void addFlowers() {
|
||||
Block flowers = GameRegistry.findBlock(BoP, "flowers");
|
||||
if (flowers != null) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Clover
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 1, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms); //Swampflower
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 2, 1.0, FlowerManager.FlowerTypeNether); //Deathbloom
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 3, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //GlowFlower
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 4, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Blue Hydrangea
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 5, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeJungle); //Orange Cosmos
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 6, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Pink Daffodil
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 7, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //WildFlower
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 8, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Violet
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 9, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // White Anemone
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 10, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Waterlily
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 11, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //EnderLotus (does not actually spawn in the end)
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 12, 1.0, FlowerManager.FlowerTypeCacti); //Bromeliad
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 13, 1.0, FlowerManager.FlowerTypeNether); // EyeBulb
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 14, 1.0, FlowerManager.FlowerTypeNether); // Unlisted top of the eyebulb
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 15, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Dandelion Puff
|
||||
}
|
||||
|
||||
Block flowers2 = GameRegistry.findBlock(BoP, "flowers2");
|
||||
if (flowers2 != null) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeJungle); //Pink Hibiscus
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 1, 1.0, FlowerManager.FlowerTypeVanilla); //Lily of the Valley
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 2, 1.0, FlowerManager.FlowerTypeNether); // Burning Blososm
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 3, 1.0, FlowerManager.FlowerTypeVanilla); // Lavender
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 4, 1.0, FlowerManager.FlowerTypeVanilla); // Goldenrod
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 5, 1.0, FlowerManager.FlowerTypeVanilla); //Bluebells
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 6, 1.0, FlowerManager.FlowerTypeVanilla); //Miner's delight
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 7, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Icy Iris
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 8, 1.0, FlowerManager.FlowerTypeVanilla); // Rose
|
||||
}
|
||||
// Toadstool 0 Portobello 1 Blue Milk cap 2 Glowshroom 3 flat mushroom 4 shadow shroom 5 'plants:12' tiny cactus
|
||||
Block mushrooms = GameRegistry.findBlock(BoP, "mushrooms");
|
||||
if (mushrooms != null) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(mushrooms, OreDictionary.WILDCARD_VALUE, 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(mushrooms, 3, 1.0, FlowerManager.FlowerTypeNether);
|
||||
}
|
||||
Block plants = GameRegistry.findBlock(BoP, "plants");
|
||||
if (plants != null) {
|
||||
FlowerManager.flowerRegistry.registerPlantableFlower(plants, 12, 1.0, FlowerManager.FlowerTypeCacti);
|
||||
}
|
||||
// Block flowers = Block.REGISTRY.getObject(new ResourceLocation(BoP, "flowers"));
|
||||
// if (flowers != null && flowers != Blocks.AIR) {
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Clover
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 1, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms); //Swampflower
|
||||
// // FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 2, 1.0, FlowerManager.FlowerTypeNether); //Deathbloom
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 3, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //GlowFlower
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 4, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Blue Hydrangea
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 5, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeJungle); //Orange Cosmos
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 6, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Pink Daffodil
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 7, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //WildFlower
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 8, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Violet
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 9, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // White Anemone
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 10, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Waterlily
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 11, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //EnderLotus (does not actually spawn in the end)
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 12, 1.0, FlowerManager.FlowerTypeCacti); //Bromeliad
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 13, 1.0, FlowerManager.FlowerTypeNether); // EyeBulb
|
||||
// // FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 14, 1.0, FlowerManager.FlowerTypeNether); // Unlisted top of the eyebulb
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers, 15, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Dandelion Puff
|
||||
// }
|
||||
//
|
||||
// Block flowers2 = Block.REGISTRY.getObject(new ResourceLocation(BoP, "flowers2"));
|
||||
// if (flowers2 != null && flowers2 != Blocks.AIR) {
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeJungle); //Pink Hibiscus
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 1, 1.0, FlowerManager.FlowerTypeVanilla); //Lily of the Valley
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 2, 1.0, FlowerManager.FlowerTypeNether); // Burning Blososm
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 3, 1.0, FlowerManager.FlowerTypeVanilla); // Lavender
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 4, 1.0, FlowerManager.FlowerTypeVanilla); // Goldenrod
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 5, 1.0, FlowerManager.FlowerTypeVanilla); //Bluebells
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 6, 1.0, FlowerManager.FlowerTypeVanilla); //Miner's delight
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 7, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); //Icy Iris
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(flowers2, 8, 1.0, FlowerManager.FlowerTypeVanilla); // Rose
|
||||
// }
|
||||
// // Toadstool 0 Portobello 1 Blue Milk cap 2 Glowshroom 3 flat mushroom 4 shadow shroom 5 'plants:12' tiny cactus
|
||||
// Block mushrooms = Block.REGISTRY.getObject(new ResourceLocation(BoP, "mushrooms"));
|
||||
// if (mushrooms != null && mushrooms != Blocks.AIR) {
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(mushrooms, OreDictionary.WILDCARD_VALUE, 1.0, FlowerManager.FlowerTypeMushrooms);
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(mushrooms, 3, 1.0, FlowerManager.FlowerTypeNether);
|
||||
// }
|
||||
// Block plants = Block.REGISTRY.getObject(new ResourceLocation(BoP, "plants"));
|
||||
// if (plants != null && plants != Blocks.AIR) {
|
||||
// FlowerManager.flowerRegistry.registerPlantableFlower(plants, 12, 1.0, FlowerManager.FlowerTypeCacti);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,6 +45,14 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
this.secondaryColor = secondaryColor.getRGB();
|
||||
}
|
||||
|
||||
public Set<Integer> getValidOreIds() {
|
||||
return validOreIds;
|
||||
}
|
||||
|
||||
public Set<String> getValidItemStacks() {
|
||||
return validItemStacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack backpack) {
|
||||
Item item = backpack.getItem();
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -59,6 +60,7 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.OreDictUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.lepidopterology.PluginLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
@@ -82,6 +84,15 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
private final Multimap<String, String> backpackOreDictRegexpDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackItemDefaults = HashMultimap.create();
|
||||
|
||||
private final List<String> forestryBackpackUids = Arrays.asList(
|
||||
BackpackManager.MINER_UID,
|
||||
BackpackManager.DIGGER_UID,
|
||||
BackpackManager.FORESTER_UID,
|
||||
BackpackManager.HUNTER_UID,
|
||||
BackpackManager.ADVENTURER_UID,
|
||||
BackpackManager.BUILDER_UID
|
||||
);
|
||||
|
||||
@Override
|
||||
public void setupAPI() {
|
||||
super.setupAPI();
|
||||
@@ -130,6 +141,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
registerFenceAndFenceGatesToOreDict();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@@ -142,18 +154,16 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
setDefaultsForConfig();
|
||||
|
||||
handleBackpackConfig(config, BackpackManager.MINER_UID);
|
||||
handleBackpackConfig(config, BackpackManager.DIGGER_UID);
|
||||
handleBackpackConfig(config, BackpackManager.FORESTER_UID);
|
||||
handleBackpackConfig(config, BackpackManager.HUNTER_UID);
|
||||
handleBackpackConfig(config, BackpackManager.ADVENTURER_UID);
|
||||
handleBackpackConfig(config, BackpackManager.BUILDER_UID);
|
||||
for (String backpackUid : forestryBackpackUids) {
|
||||
handleBackpackConfig(config, backpackUid);
|
||||
}
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
private void setDefaultsForConfig() {
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.MINER_UID).addAll(Arrays.asList(
|
||||
"obsidian",
|
||||
"ore[A-Z].*",
|
||||
"dust[A-Z].*",
|
||||
"gem[A-Z].*",
|
||||
@@ -166,17 +176,35 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.DIGGER_UID).addAll(Arrays.asList(
|
||||
"cobblestone",
|
||||
"dirt",
|
||||
"gravel",
|
||||
"netherrack",
|
||||
"stone",
|
||||
"stone[A-Z].*",
|
||||
"sand"
|
||||
));
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.HUNTER_UID).addAll(Arrays.asList(
|
||||
"bone",
|
||||
"egg",
|
||||
"enderpearl",
|
||||
"feather",
|
||||
"fish[A-Z].*",
|
||||
"gunpowder",
|
||||
"leather",
|
||||
"slimeball",
|
||||
"string"
|
||||
));
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.FORESTER_UID).addAll(Arrays.asList(
|
||||
"logWood",
|
||||
"stickWood",
|
||||
"woodStick",
|
||||
"saplingTree",
|
||||
"treeSapling",
|
||||
"vine",
|
||||
"sugarcane",
|
||||
"blockCactus",
|
||||
"crop[A-Z].*",
|
||||
"seed[A-Z].*",
|
||||
"tree[A-Z].*"
|
||||
@@ -189,11 +217,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"stainedClay[A-Z].*",
|
||||
"stainedGlass[A-Z].*",
|
||||
"stone",
|
||||
"sandstone",
|
||||
"plankWood",
|
||||
"stairWood",
|
||||
"slabWood",
|
||||
"fenceWood",
|
||||
"fenceGateWood",
|
||||
OreDictUtil.FENCE_WOOD,
|
||||
OreDictUtil.FENCE_GATE_WOOD,
|
||||
"glass",
|
||||
"paneGlass",
|
||||
"torch",
|
||||
@@ -204,7 +233,6 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.MINER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.OBSIDIAN),
|
||||
new ItemStack(Blocks.COAL_ORE),
|
||||
new ItemStack(Items.COAL),
|
||||
PluginCore.items.bronzePickaxe.getItemStack(),
|
||||
@@ -214,11 +242,10 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.DIGGER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.DIRT, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.GRAVEL),
|
||||
new ItemStack(Items.FLINT),
|
||||
new ItemStack(Blocks.NETHERRACK),
|
||||
new ItemStack(Blocks.SANDSTONE, 1, 0),
|
||||
new ItemStack(Items.CLAY_BALL),
|
||||
new ItemStack(Items.SNOWBALL),
|
||||
new ItemStack(Blocks.SOUL_SAND),
|
||||
PluginCore.items.bronzeShovel.getItemStack(),
|
||||
PluginCore.items.kitShovel.getItemStack(),
|
||||
@@ -228,49 +255,55 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
backpackItemDefaults.get(BackpackManager.FORESTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.RED_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.RED_FLOWER),
|
||||
new ItemStack(Blocks.RED_FLOWER, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.YELLOW_FLOWER),
|
||||
new ItemStack(Blocks.CACTUS),
|
||||
new ItemStack(Blocks.TALLGRASS, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.DOUBLE_PLANT, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.PUMPKIN),
|
||||
new ItemStack(Blocks.MELON_BLOCK),
|
||||
new ItemStack(Items.GOLDEN_APPLE),
|
||||
new ItemStack(Items.NETHER_WART),
|
||||
new ItemStack(Items.WHEAT_SEEDS),
|
||||
new ItemStack(Items.PUMPKIN_SEEDS),
|
||||
new ItemStack(Items.MELON_SEEDS)
|
||||
new ItemStack(Items.MELON_SEEDS),
|
||||
new ItemStack(Items.BEETROOT_SEEDS),
|
||||
new ItemStack(Items.BEETROOT),
|
||||
new ItemStack(Items.CHORUS_FRUIT),
|
||||
new ItemStack(Items.APPLE)
|
||||
)));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.HUNTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Items.FEATHER),
|
||||
new ItemStack(Items.GUNPOWDER),
|
||||
new ItemStack(Items.BLAZE_POWDER),
|
||||
new ItemStack(Items.BLAZE_ROD),
|
||||
new ItemStack(Items.BONE),
|
||||
new ItemStack(Items.STRING),
|
||||
new ItemStack(Items.ROTTEN_FLESH),
|
||||
new ItemStack(Items.SKULL, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Items.GHAST_TEAR),
|
||||
new ItemStack(Items.GOLD_NUGGET),
|
||||
new ItemStack(Items.ARROW),
|
||||
new ItemStack(Items.SPECTRAL_ARROW),
|
||||
new ItemStack(Items.TIPPED_ARROW),
|
||||
new ItemStack(Items.PORKCHOP),
|
||||
new ItemStack(Items.COOKED_PORKCHOP),
|
||||
new ItemStack(Items.BEEF),
|
||||
new ItemStack(Items.COOKED_BEEF),
|
||||
new ItemStack(Items.CHICKEN),
|
||||
new ItemStack(Items.COOKED_CHICKEN),
|
||||
new ItemStack(Items.LEATHER),
|
||||
new ItemStack(Items.EGG),
|
||||
new ItemStack(Items.ENDER_PEARL),
|
||||
new ItemStack(Items.MUTTON),
|
||||
new ItemStack(Items.COOKED_MUTTON),
|
||||
new ItemStack(Items.RABBIT),
|
||||
new ItemStack(Items.COOKED_RABBIT),
|
||||
new ItemStack(Items.RABBIT_FOOT),
|
||||
new ItemStack(Items.RABBIT_HIDE),
|
||||
new ItemStack(Items.SPIDER_EYE),
|
||||
new ItemStack(Items.FERMENTED_SPIDER_EYE),
|
||||
new ItemStack(Items.SLIME_BALL),
|
||||
new ItemStack(Items.DYE, 1, 0),
|
||||
new ItemStack(Blocks.HAY_BLOCK),
|
||||
new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Items.ENDER_EYE),
|
||||
new ItemStack(Items.MAGMA_CREAM),
|
||||
new ItemStack(Items.SPECKLED_MELON),
|
||||
new ItemStack(Items.FISH),
|
||||
new ItemStack(Items.COOKED_FISH),
|
||||
new ItemStack(Items.FISH, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Items.COOKED_FISH, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Items.LEAD),
|
||||
new ItemStack(Items.FISHING_ROD),
|
||||
new ItemStack(Items.NAME_TAG),
|
||||
@@ -283,15 +316,16 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
backpackItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.REDSTONE_TORCH),
|
||||
new ItemStack(Blocks.REDSTONE_LAMP),
|
||||
new ItemStack(Blocks.SEA_LANTERN),
|
||||
new ItemStack(Blocks.END_ROD),
|
||||
new ItemStack(Blocks.STONEBRICK, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.SANDSTONE, 1, 1),
|
||||
new ItemStack(Blocks.SANDSTONE, 1, 2),
|
||||
new ItemStack(Blocks.BRICK_BLOCK),
|
||||
new ItemStack(Blocks.CLAY),
|
||||
new ItemStack(Blocks.HARDENED_CLAY, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.PACKED_ICE),
|
||||
new ItemStack(Blocks.NETHER_BRICK),
|
||||
new ItemStack(Blocks.NETHER_BRICK_FENCE),
|
||||
new ItemStack(Blocks.CRAFTING_TABLE),
|
||||
new ItemStack(Blocks.FURNACE),
|
||||
new ItemStack(Blocks.LEVER),
|
||||
@@ -300,15 +334,27 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
new ItemStack(Blocks.LADDER),
|
||||
new ItemStack(Blocks.IRON_BARS),
|
||||
new ItemStack(Blocks.QUARTZ_BLOCK, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.COBBLESTONE_WALL),
|
||||
new ItemStack(Blocks.QUARTZ_STAIRS),
|
||||
new ItemStack(Blocks.SANDSTONE_STAIRS),
|
||||
new ItemStack(Blocks.RED_SANDSTONE_STAIRS),
|
||||
new ItemStack(Blocks.COBBLESTONE_WALL, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.STONE_BUTTON),
|
||||
new ItemStack(Blocks.WOODEN_BUTTON),
|
||||
new ItemStack(Blocks.STONE_SLAB),
|
||||
new ItemStack(Blocks.WOODEN_SLAB),
|
||||
new ItemStack(Blocks.STONE_SLAB, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.STONE_SLAB2, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.WOODEN_SLAB, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.PURPUR_BLOCK),
|
||||
new ItemStack(Blocks.PURPUR_PILLAR),
|
||||
new ItemStack(Blocks.PURPUR_STAIRS),
|
||||
new ItemStack(Blocks.PURPUR_SLAB),
|
||||
new ItemStack(Blocks.END_BRICKS),
|
||||
new ItemStack(Blocks.CARPET, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Blocks.TRAPDOOR),
|
||||
new ItemStack(Blocks.IRON_TRAPDOOR),
|
||||
new ItemStack(Blocks.STONE_PRESSURE_PLATE),
|
||||
new ItemStack(Blocks.WOODEN_PRESSURE_PLATE),
|
||||
new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE),
|
||||
new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE),
|
||||
new ItemStack(Items.SIGN),
|
||||
new ItemStack(Items.ITEM_FRAME),
|
||||
new ItemStack(Items.ACACIA_DOOR),
|
||||
@@ -327,6 +373,35 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
new ItemStack(beeBlocks.stump, 1, OreDictionary.WILDCARD_VALUE)
|
||||
)));
|
||||
}
|
||||
|
||||
// include everything added via the API
|
||||
for (String backpackUid : forestryBackpackUids) {
|
||||
BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(backpackUid);
|
||||
|
||||
Collection<String> oreDictDefaults = backpackOreDictRegexpDefaults.get(backpackUid);
|
||||
for (int oreId : backpackDefinition.getValidOreIds()) {
|
||||
String oreName = OreDictionary.getOreName(oreId);
|
||||
oreDictDefaults.add(oreName);
|
||||
}
|
||||
|
||||
backpackItemDefaults.get(backpackUid).addAll(backpackDefinition.getValidItemStacks());
|
||||
}
|
||||
}
|
||||
|
||||
// Should be ore dicted in Forge at some point.
|
||||
private static void registerFenceAndFenceGatesToOreDict() {
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_WOOD, Blocks.OAK_FENCE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_WOOD, Blocks.SPRUCE_FENCE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_WOOD, Blocks.BIRCH_FENCE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_WOOD, Blocks.JUNGLE_FENCE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_WOOD, Blocks.DARK_OAK_FENCE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_WOOD, Blocks.ACACIA_FENCE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.OAK_FENCE_GATE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.SPRUCE_FENCE_GATE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.BIRCH_FENCE_GATE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.JUNGLE_FENCE_GATE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.DARK_OAK_FENCE_GATE);
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.ACACIA_FENCE_GATE);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -367,9 +442,13 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
List<String> oreDictNameList = new ArrayList<>();
|
||||
for (String name : OreDictionary.getOreNames()) {
|
||||
for (String regex : backpackConf.getStringList()) {
|
||||
if (name.matches(regex)) {
|
||||
oreDictNameList.add(name);
|
||||
if (name == null) {
|
||||
Log.error("Found a null oreName in the ore dictionary");
|
||||
} else {
|
||||
for (String regex : backpackConf.getStringList()) {
|
||||
if (name.matches(regex)) {
|
||||
oreDictNameList.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treeAcacia"
|
||||
"speciesUid": "forestry.treeAcacia"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -56,7 +56,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -68,7 +68,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesModest"
|
||||
"speciesUid": "forestry.speciesModest"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
@@ -54,7 +54,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -66,7 +66,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesEnded"
|
||||
"speciesUid": "forestry.speciesEnded"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -23,7 +23,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesWintry"
|
||||
"speciesUid": "forestry.speciesWintry"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -23,7 +23,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesTropical"
|
||||
"speciesUid": "forestry.speciesTropical"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
@@ -51,7 +51,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treeSipiri"
|
||||
"speciesUid": "forestry.treeSipiri"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -23,7 +23,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSinister"
|
||||
"speciesUid": "forestry.speciesSinister"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesSteadfast"
|
||||
"speciesUid": "forestry.speciesSteadfast"
|
||||
}
|
||||
],
|
||||
"weight": 1
|
||||
@@ -23,7 +23,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesMonastic"
|
||||
"speciesUid": "forestry.speciesMonastic"
|
||||
}
|
||||
],
|
||||
"weight": 6
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesForest"
|
||||
"speciesUid": "forestry.speciesForest"
|
||||
}
|
||||
],
|
||||
"weight": 6
|
||||
@@ -67,7 +67,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesCommon"
|
||||
"speciesUid": "forestry.speciesCommon"
|
||||
}
|
||||
],
|
||||
"weight": 6
|
||||
@@ -79,7 +79,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.speciesMeadows"
|
||||
"speciesUid": "forestry.speciesMeadows"
|
||||
}
|
||||
],
|
||||
"weight": 6
|
||||
@@ -106,7 +106,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treeLime"
|
||||
"speciesUid": "forestry.treeLime"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
@@ -125,7 +125,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treeCherry"
|
||||
"speciesUid": "forestry.treeCherry"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
@@ -144,7 +144,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treeLarch"
|
||||
"speciesUid": "forestry.treeLarch"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
@@ -163,7 +163,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treeTeak"
|
||||
"speciesUid": "forestry.treeTeak"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
@@ -179,7 +179,7 @@
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_species_nbt",
|
||||
"speciesUid": "Forestry.treePadauk"
|
||||
"speciesUid": "forestry.treePadauk"
|
||||
},
|
||||
{
|
||||
"function": "set_count",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"modid": "Forestry",
|
||||
"modid": "forestry",
|
||||
"name": "Forestry",
|
||||
"description": "Trees, bees and more.",
|
||||
"credits": "mistaqur, Binnie, CovertJaguar, MysteriousAges, Nirek, Nedelosk",
|
||||
|
||||
Reference in new issue
Block a user