mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Reformed Forestry!
* Updated for BC 6.0.x compatibility * Re-implemented the Pipes plugin * Converted to vanilla assets lang system * Converted to standard gradle file structure * General warnings cleanup
This commit is contained in:
1 parent
36248c02f1
commit
8f2d802f11
1602 files changed
+724
-736
No files matched your search
+70
@@ -0,0 +1,70 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 by SirSengir
|
||||
*
|
||||
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
|
||||
*
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
|
||||
******************************************************************************/
|
||||
package forestry.pipes.proxy;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.ItemPipe;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.TransportProxy;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.pipes.PipeItemsPropolis;
|
||||
import forestry.plugins.PluginPropolisPipe;
|
||||
|
||||
public class ProxyPipes {
|
||||
|
||||
public void registerCustomItemRenderer(Item item, IItemRenderer basemod) {
|
||||
}
|
||||
|
||||
public void initPropolisPipe() {
|
||||
PluginPropolisPipe.pipeItemsPropolis = createPipe(PipeItemsPropolis.class, CreativeTabBuildCraft.PIPES);
|
||||
}
|
||||
|
||||
public Item createPipe(Class<? extends Pipe> clas, CreativeTabBuildCraft creativeTab) {
|
||||
|
||||
return registerPipe(clas, creativeTab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriding the method in BlockGenericPipe to fix localizations.
|
||||
*/
|
||||
public static ItemPipe registerPipe(Class<? extends Pipe> clas, CreativeTabBuildCraft creativeTab) {
|
||||
ItemPipe item = null;
|
||||
try {
|
||||
Constructor<ItemPipe> ctor = ItemPipe.class.getDeclaredConstructor(CreativeTabBuildCraft.class);
|
||||
ctor.setAccessible(true);
|
||||
item = ctor.newInstance(creativeTab);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
assert item != null : "The ItemPipe instance must not be null";
|
||||
item.setUnlocalizedName(clas.getSimpleName());
|
||||
GameRegistry.registerItem(item, item.getUnlocalizedName());
|
||||
|
||||
BlockGenericPipe.pipes.put(item, clas);
|
||||
|
||||
Pipe dummyPipe = BlockGenericPipe.createPipe(item);
|
||||
if (dummyPipe != null) {
|
||||
item.setPipeIconIndex(dummyPipe.getIconIndexForItem());
|
||||
TransportProxy.proxy.setIconProviderFromPipe(item, dummyPipe);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public void registerCraftingPropolis(ItemStack resource) {
|
||||
GameRegistry.addRecipe(new ItemStack(PluginPropolisPipe.pipeItemsPropolis), "#X#", '#', resource, 'X', BuildCraftTransport.pipeItemsDiamond);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user