mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 06:43:05 +00:00
Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12
This commit is contained in:
commit
87563b6c97
12 files changed
+89
-24
No files matched your search
@@ -15,12 +15,9 @@ import com.google.common.base.Preconditions;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
@@ -44,7 +41,6 @@ import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.multiblock.MultiblockEventHandler;
|
||||
import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.MigrationHelper;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
@@ -61,7 +57,7 @@ import forestry.plugins.compat.PluginIC2;
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.12]",
|
||||
dependencies = "required-after:forge@[14.21.1.2395,);"
|
||||
+ "after:JEI@[4.7.0,);"
|
||||
+ "after:jei@[4.7.0,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
@@ -151,14 +147,4 @@ public class Forestry {
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
PluginManager.processIMCMessages(event.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingBlockMappings(RegistryEvent.MissingMappings<Block> event) {
|
||||
MigrationHelper.onMissingBlockMappings(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingItemMappings(RegistryEvent.MissingMappings<Item> event) {
|
||||
MigrationHelper.onMissingItemMappings(event);
|
||||
}
|
||||
}
|
||||
@@ -898,9 +898,11 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
|
||||
public void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
if (Config.getBeehivesAmount() > 0.0) {
|
||||
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
int chunkX = pos.getX() >> 4;
|
||||
int chunkZ = pos.getZ() >> 4;
|
||||
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class MigrationHelper {
|
||||
private static Map<String, String> blockRemappings = new HashMap<>();
|
||||
private static Map<String, String> itemRemappings = new HashMap<>();
|
||||
@@ -51,6 +55,7 @@ public class MigrationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMissingBlockMappings(RegistryEvent.MissingMappings<Block> event) {
|
||||
for (RegistryEvent.MissingMappings.Mapping<Block> missingMapping : event.getMappings()) {
|
||||
ResourceLocation resourceLocation = missingMapping.key;
|
||||
@@ -70,6 +75,7 @@ public class MigrationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMissingItemMappings(RegistryEvent.MissingMappings<Item> event) {
|
||||
for (RegistryEvent.MissingMappings.Mapping<Item> missingMapping : event.getMappings()) {
|
||||
ResourceLocation resourceLocation = missingMapping.key;
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -54,6 +55,11 @@ public class WorldGenerator implements IWorldGenerator {
|
||||
PluginManager.populateChunk(event.getGen(), event.getWorld(), event.getRand(), event.getChunkX(), event.getChunkZ(), event.isHasVillageGenerated());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void decorateBiome(DecorateBiomeEvent.Post event) {
|
||||
PluginManager.decorateBiome(event.getWorld(), event.getRand(), event.getPos());
|
||||
}
|
||||
|
||||
public void retroGen(Random random, int chunkX, int chunkZ, World world) {
|
||||
generateWorld(random, chunkX, chunkZ, world);
|
||||
PluginManager.populateChunkRetroGen(world, random, chunkX, chunkZ);
|
||||
|
||||
@@ -213,7 +213,7 @@ public class PluginFarming extends BlankForestryPlugin {
|
||||
valve.setTagCompound(compound);
|
||||
control.setTagCompound(compound);
|
||||
|
||||
RecipeUtil.addRecipe("farm_basic", basic,
|
||||
RecipeUtil.addRecipe("farm_basic_" + block.getUid(), basic,
|
||||
"I#I",
|
||||
"WCW",
|
||||
'#', block.getBase(),
|
||||
@@ -221,27 +221,27 @@ public class PluginFarming extends BlankForestryPlugin {
|
||||
'C', coreItems.tubes.get(EnumElectronTube.TIN, 1),
|
||||
'I', "ingotCopper");
|
||||
|
||||
RecipeUtil.addRecipe("farm_gearbox", gearbox,
|
||||
RecipeUtil.addRecipe("farm_gearbox_" + block.getUid(), gearbox,
|
||||
" # ",
|
||||
"TTT",
|
||||
'#', basic,
|
||||
'T', "gearTin");
|
||||
|
||||
RecipeUtil.addRecipe("farm_hatch", hatch,
|
||||
RecipeUtil.addRecipe("farm_hatch_" + block.getUid(), hatch,
|
||||
" # ",
|
||||
"TDT",
|
||||
'#', basic,
|
||||
'T', "gearTin",
|
||||
'D', OreDictUtil.TRAPDOOR_WOOD);
|
||||
|
||||
RecipeUtil.addRecipe("farm_valve", valve,
|
||||
RecipeUtil.addRecipe("farm_valve_" + block.getUid(), valve,
|
||||
" # ",
|
||||
"XTX",
|
||||
'#', basic,
|
||||
'T', "gearTin",
|
||||
'X', "blockGlass");
|
||||
|
||||
RecipeUtil.addRecipe("farm_control", control,
|
||||
RecipeUtil.addRecipe("farm_control_" + block.getUid(), control,
|
||||
" # ",
|
||||
"XTX",
|
||||
'#', basic,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package forestry.farming.compat;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.farming.PluginFarming;
|
||||
import forestry.farming.blocks.BlockRegistryFarming;
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
|
||||
@JEIPlugin
|
||||
public class FarmingJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
if (!ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockRegistryFarming blocks = PluginFarming.getBlocks();
|
||||
Item farmBlock = Item.getItemFromBlock(blocks.farm);
|
||||
subtypeRegistry.registerSubtypeInterpreter(farmBlock, itemStack -> {
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
EnumFarmBlockTexture texture = EnumFarmBlockTexture.getFromCompound(nbt);
|
||||
return itemStack.getItemDamage() + "." + texture.getUid();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package forestry.farming.compat;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import forestry.core.utils.FieldsAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -12,6 +12,8 @@ package forestry.farming.models;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -109,6 +111,10 @@ public enum EnumFarmBlockTexture {
|
||||
public String getName() {
|
||||
return base.getItem().getItemStackDisplayName(base);
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public ItemStack getBase() {
|
||||
return base;
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
@@ -111,6 +112,10 @@ public abstract class BlankForestryPlugin implements IForestryPlugin {
|
||||
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getHiddenItems(List<ItemStack> hiddenItems) {
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
@@ -58,6 +59,8 @@ public interface IForestryPlugin {
|
||||
|
||||
void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ);
|
||||
|
||||
void decorateBiome(World world, Random rand, BlockPos pos);
|
||||
|
||||
void getHiddenItems(List<ItemStack> hiddenItems);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.command.CommandHandler;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
@@ -286,6 +287,12 @@ public class PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
plugin.decorateBiome(world, rand, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public static void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
plugin.populateChunkRetroGen(world, rand, chunkX, chunkZ);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
//add canola oil fermenting in still
|
||||
Fluid oil = getFluid("oil");
|
||||
Fluid oil = getFluid("refinedcanolaoil");
|
||||
if (oil != null) {
|
||||
RecipeManagers.stillManager.addRecipe(200, new FluidStack(canolaOil, 5), new FluidStack(oil, 5));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user