implemented charset carrying for most blocks

Closes #621
This commit is contained in:
Ellpeck 2017-02-07 18:25:45 +01:00
parent a33d6941ae
commit e2865afb49
2 changed files with 46 additions and 0 deletions

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.util;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.util.compat.IMCHandler;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
@ -52,6 +53,8 @@ public final class ItemUtil{
block.setCreativeTab(addTab ? CreativeTab.INSTANCE : null);
IMCHandler.doBlockIMC(block);
addUnderscoreNameToMapUnderscorelessName(block.getRegistryName());
}
@ -63,6 +66,8 @@ public final class ItemUtil{
item.setCreativeTab(addTab ? CreativeTab.INSTANCE : null);
IMCHandler.doItemIMC(item);
if(item instanceof IColorProvidingItem){
ActuallyAdditions.proxy.addColoredItem(item);
}

View file

@ -0,0 +1,41 @@
/*
* This file ("IMCHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.util.compat;
import de.ellpeck.actuallyadditions.mod.blocks.*;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import org.apache.commons.lang3.ArrayUtils;
public final class IMCHandler{
private static final Class<? extends Block>[] NO_CARRYING = new Class[]{
BlockGiantChest.class,
BlockWildPlant.class,
BlockPlant.class,
BlockPhantom.class,
BlockTinyTorch.class,
BlockItemViewer.class,
BlockLaserRelay.class
};
public static void doBlockIMC(Block block){
if(!ArrayUtils.contains(NO_CARRYING, block.getClass())){
FMLInterModComms.sendMessage("charsetlib", "addCarry", block.getRegistryName());
}
}
public static void doItemIMC(Item item){
}
}