Add in bukkit support for recipe change

This commit is contained in:
Christian 2012-06-26 15:40:30 -04:00
parent 64dab3c8d7
commit a7caad10ba
3 changed files with 51 additions and 37 deletions

View File

@ -65,7 +65,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
public final void onServerLogin(Object handler) {
// NOOP
}
public final void onServerLogout() {
// NOOP
}
@ -80,7 +80,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
{
onClientLogout((EntityHuman)player);
}
@Override
public final void onPlayerChangedDimension(Object player)
{
@ -129,16 +129,16 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
public void onRegisterAnimations() {
// NOOP on servers
}
@Override
public void onRenderHarvest(Map renderers) {
public void onRenderHarvest(@SuppressWarnings("rawtypes") Map renderers) {
// NOOP on servers
}
// BASEMOD API
/**
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
*
*
* @param id
* @param metadata
* @return
@ -155,7 +155,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Override if you wish to perform some action other than just dispensing the item from the dispenser
*
*
* @param world
* @param x
* @param y
@ -172,7 +172,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Override if you wish to generate Nether (Hell biome) blocks
*
*
* @param world
* @param random
* @param chunkX
@ -184,7 +184,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Override if you wish to generate Overworld (not hell or the end) blocks
*
*
* @param world
* @param random
* @param chunkX
@ -196,7 +196,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Return the name of your mod. Defaults to the class name
*
*
* @return
*/
public String getName()
@ -206,7 +206,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Get your mod priorities
*
*
* @return
*/
public String getPriorities()
@ -216,7 +216,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Return the version of your mod
*
*
* @return
*/
public abstract String getVersion();
@ -240,7 +240,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Handle item pickup
*
*
* @param player
* @param item
*/
@ -250,7 +250,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
*
*
* @param minecraftServer the server
* @return true to continue receiving ticks
*/
@ -267,23 +267,23 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Only implemented on the client side
* {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)}
*
*
* @param text
*/
public void receiveChatPacket(String text)
{
}
/**
* Only called on the client side
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)}
*
*
* @param packet
*/
public void receiveCustomPacket(Packet250CustomPayload packet)
{
}
public void registerAnimation(Object game)
@ -304,7 +304,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Called when someone crafts an item from a crafting table
*
*
* @param player
* @param item
* @param matrix
@ -344,7 +344,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Called when a chat message is received. Return true to stop further processing
*
*
* @param source
* @param chat
* @return true if you want to consume the message so it is not available for further processing
@ -365,8 +365,8 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Called when a new client logs in.
*
* @param player
*
* @param player
*/
public void onClientLogin(EntityHuman player)
{
@ -374,23 +374,23 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
/**
* Called when a client logs out of the server.
*
*
* @param player
*/
public void onClientLogout(EntityHuman player)
{
}
/**
*
*
* Called when a client changes dimensions on the server.
*
*
* @param player
*/
public void onClientDimensionChanged(EntityHuman player)
{
}
// Spare client junk
@ -401,7 +401,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
// boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID);
// boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui);
// void keyboardEvent(KeyBinding event);
@Override
public void keyBindingEvent(Object keybinding) {
// NOOP on server

View File

@ -1,6 +1,5 @@
package net.minecraft.server;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -24,6 +23,13 @@ public class BukkitRegistry implements IMinecraftRegistry
CraftingManager.getInstance().registerShapelessRecipe((ItemStack) output, params);
}
@SuppressWarnings("unchecked")
@Override
public void addRecipe(net.minecraft.src.IRecipe recipe)
{
CraftingManager.getInstance().getRecipies().add(recipe);
}
@Override
public void addSmelting(int input, net.minecraft.src.ItemStack output)
{
@ -52,19 +58,22 @@ public class BukkitRegistry implements IMinecraftRegistry
}
}
@Override
@SuppressWarnings("unchecked")
@Override
public void registerEntityID(Class <? extends net.minecraft.src.Entity > entityClass, String entityName, int id)
{
EntityTypes.addNewEntityListMapping((Class<? extends Entity>) entityClass, entityName, id);
}
@Override
@SuppressWarnings("unchecked")
@Override
public void registerEntityID(Class <? extends net.minecraft.src.Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
{
EntityTypes.addNewEntityListMapping((Class<? extends Entity>) entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
}
@Override
@SuppressWarnings("unchecked")
@Override
public void registerTileEntity(Class <? extends net.minecraft.src.TileEntity > tileEntityClass, String id)
{
TileEntity.addNewTileEntityMapping((Class<? extends TileEntity>) tileEntityClass, id);
@ -84,7 +93,7 @@ public class BukkitRegistry implements IMinecraftRegistry
{
@SuppressWarnings("unchecked")
List<BiomeMeta> spawns = ((BiomeBase)biome).getMobs((EnumCreatureType)typeOfCreature);
for (BiomeMeta entry : spawns)
{
//Adjusting an existing spawn entry
@ -96,7 +105,7 @@ public class BukkitRegistry implements IMinecraftRegistry
break;
}
}
spawns.add(new BiomeMeta(entityClass, weightedProb, min, max));
}
}
@ -106,7 +115,7 @@ public class BukkitRegistry implements IMinecraftRegistry
public void addSpawn(String entityName, int weightedProb, int min, int max, net.minecraft.src.EnumCreatureType spawnList, BiomeGenBase... biomes)
{
Class <? extends Entity > entityClazz = EntityTypes.getEntityToClassMapping().get(entityName);
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
addSpawn((Class <? extends net.minecraft.src.EntityLiving >) entityClazz, weightedProb, min, max, spawnList, biomes);
@ -127,7 +136,7 @@ public class BukkitRegistry implements IMinecraftRegistry
{
@SuppressWarnings("unchecked")
List<BiomeMeta> spawns = ((BiomeBase)biome).getMobs((EnumCreatureType) typeOfCreature);
Iterator<BiomeMeta> entries = spawns.iterator();
while (entries.hasNext())
{
@ -145,7 +154,7 @@ public class BukkitRegistry implements IMinecraftRegistry
public void removeSpawn(String entityName, net.minecraft.src.EnumCreatureType spawnList, BiomeGenBase... biomes)
{
Class <? extends Entity > entityClazz = EntityTypes.getEntityToClassMapping().get(entityName);
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
removeSpawn((Class <? extends net.minecraft.src.EntityLiving >) entityClazz, spawnList, biomes);

View File

@ -0,0 +1,5 @@
package net.minecraft.src;
public interface IRecipe {
}