Skip to content

Instantly share code, notes, and snippets.

@hsyyid
Created November 13, 2015 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsyyid/ae6e14b6128f5aee27d8 to your computer and use it in GitHub Desktop.
Save hsyyid/ae6e14b6128f5aee27d8 to your computer and use it in GitHub Desktop.
package io.github.hsyyid.wilsonsmp.proxies;
import io.github.hsyyid.wilsonsmp.armor.DivingArmor;
import io.github.hsyyid.wilsonsmp.blocks.BlockReadableBookshelf;
import io.github.hsyyid.wilsonsmp.blocks.IceBlock;
import io.github.hsyyid.wilsonsmp.blocks.SnowBlock;
import io.github.hsyyid.wilsonsmp.creativetabs.WilsonSMPMiscCreativeTab;
import io.github.hsyyid.wilsonsmp.eventhandlers.BlockPlaceEventHandler;
import io.github.hsyyid.wilsonsmp.eventhandlers.EntityInteractEventHandler;
import io.github.hsyyid.wilsonsmp.eventhandlers.LivingFallEventHandler;
import io.github.hsyyid.wilsonsmp.eventhandlers.PlayerInteractEventHandler;
import io.github.hsyyid.wilsonsmp.eventhandlers.ServerTickEventHandler;
import io.github.hsyyid.wilsonsmp.items.ItemBandage;
import io.github.hsyyid.wilsonsmp.items.ItemHomestone;
import io.github.hsyyid.wilsonsmp.items.ItemSignalGun;
import io.github.hsyyid.wilsonsmp.items.ItemSignalRounds;
import io.github.hsyyid.wilsonsmp.tileentities.TileEntityReadableBookshelf;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.ExistingSubstitutionException;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
public class CommonProxy
{
public static CreativeTabs wilsonSMPMisc;
public static Item itemHomestone;
public static Item itemDivingHelmet;
public static Item itemSignalGun;
public static Item itemSignalRounds;
public static Item itemBandage;
public static Item itemSnowBlock;
public static Item itemIceBlock;
public static Block snowBlock;
public static Block iceBlock;
public static Block readableBookshelf;
public void intializeCreativeTabs(FMLPreInitializationEvent event)
{
wilsonSMPMisc = new WilsonSMPMiscCreativeTab(CreativeTabs.getNextID(), "wilsonSMPMiscCreativeTab");
}
public void registerItemsAndBlocks(FMLPreInitializationEvent event)
{
itemHomestone = new ItemHomestone().setUnlocalizedName("itemHomestone").setCreativeTab(wilsonSMPMisc);
itemDivingHelmet = new DivingArmor(ArmorMaterial.DIAMOND, 0, 0).setUnlocalizedName("itemDivingHelmet");
itemSignalRounds = new ItemSignalRounds().setUnlocalizedName("itemSignalRounds").setCreativeTab(wilsonSMPMisc);
itemSignalGun = new ItemSignalGun(itemSignalRounds).setUnlocalizedName("itemSignalGun").setCreativeTab(wilsonSMPMisc);
itemBandage = new ItemBandage().setUnlocalizedName("itemBandage").setCreativeTab(wilsonSMPMisc);
snowBlock = new SnowBlock().setUnlocalizedName("minecraft:snow");
iceBlock = new IceBlock().setUnlocalizedName("minecraft:ice");
readableBookshelf = new BlockReadableBookshelf().setUnlocalizedName("blockReadableBookshelf").setCreativeTab(wilsonSMPMisc);
itemIceBlock = new ItemBlock(iceBlock);
itemSnowBlock = new ItemBlock(snowBlock);
GameRegistry.registerItem(itemHomestone, "itemHomestone");
GameRegistry.registerItem(itemDivingHelmet, "itemDivingHelmet");
GameRegistry.registerItem(itemSignalRounds, "itemSignalRounds");
GameRegistry.registerItem(itemSignalGun, "itemSignalGun");
GameRegistry.registerItem(itemBandage, "itemBandage");
GameRegistry.registerBlock(readableBookshelf, "blockReadableBookshelf");
}
public void registerCraftingRecipies(FMLPreInitializationEvent event)
{
GameRegistry.addShapelessRecipe(new ItemStack(itemHomestone, 1), new ItemStack(Items.ender_pearl, 1), new ItemStack(itemHomestone, 1, OreDictionary.WILDCARD_VALUE));
}
public void registerRenderers(FMLInitializationEvent event)
{
;
}
public void registerSubstitutedBlocks(FMLInitializationEvent event)
{
try
{
GameRegistry.addSubstitutionAlias("minecraft:snow", GameRegistry.Type.BLOCK, snowBlock);
GameRegistry.addSubstitutionAlias("minecraft:snow", GameRegistry.Type.ITEM, itemSnowBlock);
GameRegistry.addSubstitutionAlias("minecraft:ice", GameRegistry.Type.BLOCK, iceBlock);
GameRegistry.addSubstitutionAlias("minecraft:ice", GameRegistry.Type.ITEM, itemIceBlock);
}
catch (ExistingSubstitutionException e)
{
e.printStackTrace();
}
}
public void registerEventHandlers(FMLInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(new PlayerInteractEventHandler());
MinecraftForge.EVENT_BUS.register(new LivingFallEventHandler());
MinecraftForge.EVENT_BUS.register(new EntityInteractEventHandler());
MinecraftForge.EVENT_BUS.register(new BlockPlaceEventHandler());
FMLCommonHandler.instance().bus().register(new ServerTickEventHandler());
}
public void registerTileEntities(FMLInitializationEvent event)
{
GameRegistry.registerTileEntity(TileEntityReadableBookshelf.class, "tileEntityReadableBookshelf");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment