mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
this is completely broken but maybe someone will fix it soon
This commit is contained in:
parent
38168423e7
commit
a40abe88af
16 changed files with 148 additions and 136 deletions
|
@ -23,7 +23,7 @@ if(hasProperty('buildnumber')){
|
|||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12-14.21.0.2331"
|
||||
version = "1.12-14.21.1.2387"
|
||||
runDir = "idea"
|
||||
|
||||
mappings = "snapshot_20161220"
|
||||
|
@ -48,7 +48,7 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
compile "net.darkhax.tesla:Tesla-1.12:1.0.59"
|
||||
deobfCompile "mezz.jei:jei_1.12:4.6.0.61"
|
||||
deobfCompile "mezz.jei:jei_1.12:4.7.0.68"
|
||||
deobfCompile "org.cyclops.commoncapabilities:CommonCapabilities:1.11.2-1.3.3-115"
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigurationHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
||||
|
@ -21,9 +20,7 @@ import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
|||
import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.OreGen;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||
|
@ -43,11 +40,11 @@ import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
|
|||
import de.ellpeck.actuallyadditions.mod.recipe.TreasureChestHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
@ -86,18 +83,13 @@ public class ActuallyAdditions{
|
|||
teslaLoaded = Loader.isModLoaded("tesla");
|
||||
commonCapsLoaded = Loader.isModLoaded("commoncapabilities");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new RegistryHandler());
|
||||
|
||||
new ConfigurationHandler(event.getSuggestedConfigurationFile());
|
||||
PacketHandler.init();
|
||||
InitToolMaterials.init();
|
||||
InitArmorMaterials.init();
|
||||
InitBlocks.init();
|
||||
InitFluids.init();
|
||||
InitItems.init();
|
||||
FuelHandler.init();
|
||||
BannerHelper.init();
|
||||
SoundHandler.init();
|
||||
InitOreDict.init();
|
||||
InitCrafting.init();
|
||||
new UpdateChecker();
|
||||
proxy.preInit(event);
|
||||
|
||||
|
@ -108,6 +100,8 @@ public class ActuallyAdditions{
|
|||
public void init(FMLInitializationEvent event){
|
||||
ModUtil.LOGGER.info("Starting Initialization Phase...");
|
||||
|
||||
BannerHelper.init();
|
||||
FuelHandler.init();
|
||||
//InitAchievements.init();
|
||||
GuiHandler.init();
|
||||
new OreGen();
|
||||
|
@ -125,7 +119,6 @@ public class ActuallyAdditions{
|
|||
public void postInit(FMLPostInitializationEvent event){
|
||||
ModUtil.LOGGER.info("Starting PostInitialization Phase...");
|
||||
|
||||
InitVillager.init();
|
||||
ItemCoffee.initIngredients();
|
||||
CrusherCrafting.init();
|
||||
HairyBallHandler.init();
|
||||
|
@ -155,22 +148,4 @@ public class ActuallyAdditions{
|
|||
public void serverStopped(FMLServerStoppedEvent event){
|
||||
WorldData.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void missingMapping(FMLMissingMappingsEvent event){
|
||||
int totalRemaps = 0;
|
||||
int workedRemaps = 0;
|
||||
|
||||
for(FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){
|
||||
totalRemaps++;
|
||||
|
||||
if(ItemUtil.remapName(mapping)){
|
||||
workedRemaps++;
|
||||
}
|
||||
}
|
||||
|
||||
if(totalRemaps > 0){
|
||||
ModUtil.LOGGER.info("Successfully remapped "+workedRemaps+" out of "+totalRemaps+" blocks and items to match the 1.11 naming conventions.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.util.FluidStateMapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientRegistryHandler{
|
||||
|
||||
public static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<ItemStack, ModelResourceLocation>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelRegistry(ModelRegistryEvent event){
|
||||
for(Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){
|
||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
||||
}
|
||||
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil);
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidOil);
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
||||
registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
||||
*/
|
||||
private static void registerCustomFluidBlockRenderer(Fluid fluid){
|
||||
Block block = fluid.getBlock();
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
||||
ModelLoader.registerItemVariants(item);
|
||||
ModelLoader.setCustomMeshDefinition(item, mapper);
|
||||
ModelLoader.setCustomStateMapper(block, mapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.InitCrafting;
|
||||
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.ore.InitOreDict;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//Class to wrap around the trainwreck that is the new registry system
|
||||
public class RegistryHandler{
|
||||
|
||||
public static final List<Block> BLOCKS_TO_REGISTER = new ArrayList<>();
|
||||
public static final List<Item> ITEMS_TO_REGISTER = new ArrayList<>();
|
||||
public static final List<SoundEvent> SOUNDS_TO_REGISTER = new ArrayList<>();
|
||||
public static final List<IRecipe> RECIPES_TO_REGISTER = new ArrayList<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockRegistry(Register<Block> event){
|
||||
InitBlocks.init();
|
||||
|
||||
for(Block block : BLOCKS_TO_REGISTER){
|
||||
event.getRegistry().register(block);
|
||||
}
|
||||
BLOCKS_TO_REGISTER.clear();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemRegistry(Register<Item> event){
|
||||
InitItems.init();
|
||||
|
||||
for(Item item : ITEMS_TO_REGISTER){
|
||||
event.getRegistry().register(item);
|
||||
}
|
||||
ITEMS_TO_REGISTER.clear();
|
||||
|
||||
//Hack to make this register before recipes :>
|
||||
InitOreDict.init();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onVillagerRegistry(Register<VillagerProfession> event){
|
||||
InitVillager.init();
|
||||
|
||||
event.getRegistry().register(InitVillager.jamProfession);
|
||||
event.getRegistry().register(InitVillager.engineerProfession);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCraftingRegistry(Register<IRecipe> event){
|
||||
InitCrafting.init();
|
||||
|
||||
for(IRecipe recipe : RECIPES_TO_REGISTER){
|
||||
event.getRegistry().register(recipe);
|
||||
}
|
||||
RECIPES_TO_REGISTER.clear();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSoundRegistry(Register<SoundEvent> event){
|
||||
SoundHandler.init();
|
||||
|
||||
for(SoundEvent sound : SOUNDS_TO_REGISTER){
|
||||
event.getRegistry().register(sound);
|
||||
}
|
||||
SOUNDS_TO_REGISTER.clear();
|
||||
}
|
||||
}
|
|
@ -191,16 +191,8 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
|
||||
protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank){
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
||||
|
||||
if(StackUtil.isValid(heldItem)){
|
||||
FluidActionResult result = FluidUtil.interactWithFluidHandler(heldItem, tank, player);
|
||||
if(result.isSuccess()){
|
||||
player.setHeldItem(hand, result.getResult());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,18 +33,8 @@ public class GuiFactory implements IModGuiFactory{
|
|||
return new GuiConfiguration(parentScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass(){
|
||||
return GuiConfiguration.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,6 @@ public final class BlockCrafting{
|
|||
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitBlocks.blockFluidPlacer), new ItemStack(InitBlocks.blockFluidPlacer));
|
||||
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitBlocks.blockFluidCollector), new ItemStack(InitBlocks.blockFluidCollector));
|
||||
|
||||
|
||||
//Battery Box
|
||||
RecipeHandler.addShapelessOreDictRecipe(new ItemStack(InitBlocks.blockBatteryBox),
|
||||
new ItemStack(InitBlocks.blockEnergizer),
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class RecipeBioMash extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe{
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class RecipePotionRingCharging extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe{
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ public final class InitVillager{
|
|||
MapGenStructureIO.registerStructureComponent(VillageComponentEngineerHouse.class, ModUtil.MOD_ID+":engineerHouseStructure");
|
||||
|
||||
engineerProfession = new VillagerProfession(ModUtil.MOD_ID+":engineer", ModUtil.MOD_ID+":textures/entity/villager/engineer_villager.png", ModUtil.MOD_ID+":textures/entity/villager/engineer_villager_zombie.png");
|
||||
VillagerRegistry.instance().register(engineerProfession);
|
||||
|
||||
VillagerCareer crystallizer = new VillagerCareer(engineerProfession, ModUtil.MOD_ID+".crystallizer");
|
||||
crystallizer.addTrade(1,
|
||||
|
@ -94,7 +93,6 @@ public final class InitVillager{
|
|||
|
||||
private static void initJamVillagePart(){
|
||||
jamProfession = new VillagerProfession(ModUtil.MOD_ID+":jamGuy", ModUtil.MOD_ID+":textures/entity/villager/jam_villager.png", ModUtil.MOD_ID+":textures/entity/villager/jam_villager_zombie.png");
|
||||
VillagerRegistry.instance().register(jamProfession);
|
||||
|
||||
VillagerCareer career = new VillagerCareer(jamProfession, ModUtil.MOD_ID+".jammer");
|
||||
career.addTrade(1,
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ItemFertilizer extends ItemBase{
|
|||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10){
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(ItemDye.applyBonemeal(stack, world, pos, player)){
|
||||
if(ItemDye.applyBonemeal(stack, world, pos, player, hand)){
|
||||
if(!world.isRemote){
|
||||
world.playEvent(2005, pos, 0);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.misc;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
|
@ -21,11 +22,7 @@ public final class SoundHandler{
|
|||
public static SoundEvent reconstructor;
|
||||
public static SoundEvent crusher;
|
||||
|
||||
private static int size = 0;
|
||||
|
||||
public static void init(){
|
||||
size = SoundEvent.REGISTRY.getKeys().size();
|
||||
|
||||
duhDuhDuhDuuuh = registerSound("duh_duh_duh_duuuh");
|
||||
coffeeMachine = registerSound("coffee_machine");
|
||||
reconstructor = registerSound("reconstructor");
|
||||
|
@ -36,9 +33,8 @@ public final class SoundHandler{
|
|||
ResourceLocation resLoc = new ResourceLocation(ModUtil.MOD_ID, name);
|
||||
|
||||
SoundEvent event = new SoundEvent(resLoc);
|
||||
SoundEvent.REGISTRY.register(size, resLoc, event);
|
||||
|
||||
size++;
|
||||
event.setRegistryName(resLoc);
|
||||
RegistryHandler.SOUNDS_TO_REGISTER.add(event);
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.proxy;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ClientRegistryHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
||||
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
||||
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
|
||||
|
@ -30,6 +31,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
|
@ -37,44 +39,22 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientProxy implements IProxy{
|
||||
|
||||
private static final List<Item> COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING = new ArrayList<Item>();
|
||||
private static final List<Block> COLOR_PRODIVIDING_BLOCKS_FOR_REGISTERING = new ArrayList<Block>();
|
||||
private static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<ItemStack, ModelResourceLocation>();
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event){
|
||||
ModUtil.LOGGER.info("PreInitializing ClientProxy...");
|
||||
|
||||
for(Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){
|
||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
|
||||
}
|
||||
|
||||
this.registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil);
|
||||
this.registerCustomFluidBlockRenderer(InitFluids.fluidOil);
|
||||
this.registerCustomFluidBlockRenderer(InitFluids.fluidCrystalOil);
|
||||
this.registerCustomFluidBlockRenderer(InitFluids.fluidEmpoweredOil);
|
||||
MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler());
|
||||
|
||||
InitEntities.initClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* (Excerpted from Tinkers' Construct with permission, thanks guys!)
|
||||
*/
|
||||
private void registerCustomFluidBlockRenderer(Fluid fluid){
|
||||
Block block = fluid.getBlock();
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
FluidStateMapper mapper = new FluidStateMapper(fluid);
|
||||
ModelLoader.registerItemVariants(item);
|
||||
ModelLoader.setCustomMeshDefinition(item, mapper);
|
||||
ModelLoader.setCustomStateMapper(block, mapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event){
|
||||
ModUtil.LOGGER.info("Initializing ClientProxy...");
|
||||
|
@ -96,8 +76,6 @@ public class ClientProxy implements IProxy{
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayItemWhitelist.class, laser);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayFluids.class, laser);
|
||||
|
||||
//VillagerRegistry.INSTANCE().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID, "textures/entity/villager/jamVillager.png"));
|
||||
|
||||
for(Item item : COLOR_PRODIVIDING_ITEMS_FOR_REGISTERING){
|
||||
if(item instanceof IColorProvidingItem){
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(((IColorProvidingItem)item).getItemColor(), item);
|
||||
|
@ -123,7 +101,7 @@ public class ClientProxy implements IProxy{
|
|||
|
||||
@Override
|
||||
public void addRenderRegister(ItemStack stack, ResourceLocation location, String variant){
|
||||
MODEL_LOCATIONS_FOR_REGISTERING.put(stack, new ModelResourceLocation(location, variant));
|
||||
ClientRegistryHandler.MODEL_LOCATIONS_FOR_REGISTERING.put(stack, new ModelResourceLocation(location, variant));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.util;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.compat.IMCHandler;
|
||||
|
@ -23,17 +24,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
//TODO Remove the whole registry name mapping thing once the 1.11 fading phase is over
|
||||
public final class ItemUtil{
|
||||
|
||||
private static final Map<String, String> UNDERSCORELESS_TO_UNDERSCORED_NAMES = new HashMap<String, String>();
|
||||
|
||||
public static Item getItemFromName(String name){
|
||||
ResourceLocation resLoc = new ResourceLocation(name);
|
||||
if(Item.REGISTRY.containsKey(resLoc)){
|
||||
|
@ -46,10 +41,10 @@ public final class ItemUtil{
|
|||
block.setUnlocalizedName(ModUtil.MOD_ID+"."+name);
|
||||
|
||||
block.setRegistryName(ModUtil.MOD_ID, name);
|
||||
GameRegistry.register(block);
|
||||
RegistryHandler.BLOCKS_TO_REGISTER.add(block);
|
||||
|
||||
itemBlock.setRegistryName(block.getRegistryName());
|
||||
GameRegistry.register(itemBlock);
|
||||
RegistryHandler.ITEMS_TO_REGISTER.add(itemBlock);
|
||||
|
||||
block.setCreativeTab(addTab ? CreativeTab.INSTANCE : null);
|
||||
|
||||
|
@ -58,15 +53,13 @@ public final class ItemUtil{
|
|||
if(block instanceof IColorProvidingBlock){
|
||||
ActuallyAdditions.proxy.addColoredBlock(block);
|
||||
}
|
||||
|
||||
addUnderscoreNameToMapUnderscorelessName(block.getRegistryName());
|
||||
}
|
||||
|
||||
public static void registerItem(Item item, String name, boolean addTab){
|
||||
item.setUnlocalizedName(ModUtil.MOD_ID+"."+name);
|
||||
|
||||
item.setRegistryName(ModUtil.MOD_ID, name);
|
||||
GameRegistry.register(item);
|
||||
RegistryHandler.ITEMS_TO_REGISTER.add(item);
|
||||
|
||||
item.setCreativeTab(addTab ? CreativeTab.INSTANCE : null);
|
||||
|
||||
|
@ -75,37 +68,6 @@ public final class ItemUtil{
|
|||
if(item instanceof IColorProvidingItem){
|
||||
ActuallyAdditions.proxy.addColoredItem(item);
|
||||
}
|
||||
|
||||
addUnderscoreNameToMapUnderscorelessName(item.getRegistryName());
|
||||
}
|
||||
|
||||
private static void addUnderscoreNameToMapUnderscorelessName(ResourceLocation name){
|
||||
String underscoreless = name.toString().replaceAll("_", "");
|
||||
UNDERSCORELESS_TO_UNDERSCORED_NAMES.put(underscoreless, name.toString());
|
||||
}
|
||||
|
||||
public static boolean remapName(FMLMissingMappingsEvent.MissingMapping mapping){
|
||||
if(mapping != null && mapping.name != null){
|
||||
if(mapping.name.toLowerCase(Locale.ROOT).contains("distributor")){
|
||||
mapping.ignore();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UNDERSCORELESS_TO_UNDERSCORED_NAMES.containsKey(mapping.name)){
|
||||
String newName = UNDERSCORELESS_TO_UNDERSCORED_NAMES.get(mapping.name);
|
||||
ResourceLocation newResLoc = new ResourceLocation(newName);
|
||||
|
||||
if(Block.REGISTRY.containsKey(newResLoc) && mapping.type == GameRegistry.Type.BLOCK){
|
||||
mapping.remap(Block.REGISTRY.getObject(newResLoc));
|
||||
return true;
|
||||
}
|
||||
else if(Item.REGISTRY.containsKey(newResLoc) && mapping.type == GameRegistry.Type.ITEM){
|
||||
mapping.remap(Item.REGISTRY.getObject(newResLoc));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean contains(ItemStack[] array, ItemStack stack, boolean checkWildcard){
|
||||
|
|
|
@ -12,6 +12,6 @@ package de.ellpeck.actuallyadditions.mod.util.crafting;
|
|||
|
||||
public interface IRecipeGrouped{
|
||||
|
||||
public String getRecipeGroup();
|
||||
String getRecipeGroup();
|
||||
|
||||
}
|
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.util.crafting;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.RecipeBioMash;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.RecipePotionRingCharging;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -23,7 +24,6 @@ import net.minecraft.item.crafting.*;
|
|||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreIngredient;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -132,7 +132,7 @@ public final class RecipeHandler{
|
|||
}
|
||||
|
||||
recipe.setRegistryName(res);
|
||||
GameRegistry.register(recipe);
|
||||
RegistryHandler.RECIPES_TO_REGISTER.add(recipe);
|
||||
lastRecipe = recipe;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ public final class RecipeHandler{
|
|||
return namespace+":"+((IRecipeGrouped)item).getRecipeGroup();
|
||||
}
|
||||
if(item instanceof ItemBlock){
|
||||
Block block = ((ItemBlock)item).block;
|
||||
Block block = ((ItemBlock)item).getBlock();
|
||||
if(block instanceof IRecipeGrouped){
|
||||
return namespace+":"+((IRecipeGrouped)block).getRecipeGroup();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue