mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 18:45:09 +00:00
We have not setup the download for that yet, to make it yourself just zip joined.srg name it deobfusication_data.zip and put it in lib
79 lines
2.4 KiB
Java
79 lines
2.4 KiB
Java
package net.minecraftforge.common;
|
|
|
|
import java.util.UUID;
|
|
|
|
import cpw.mods.fml.common.FMLLog;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.item.EntityItem;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraftforge.event.*;
|
|
import net.minecraftforge.event.entity.*;
|
|
import net.minecraftforge.event.world.WorldEvent;
|
|
|
|
public class ForgeInternalHandler
|
|
{
|
|
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
|
public void onEntityJoinWorld(EntityJoinWorldEvent event)
|
|
{
|
|
if (!event.world.isRemote)
|
|
{
|
|
ForgeChunkManager.loadEntity(event.entity);
|
|
}
|
|
|
|
Entity entity = event.entity;
|
|
if (entity.getClass().equals(EntityItem.class))
|
|
{
|
|
ItemStack stack = entity.getDataWatcher().getWatchableObjectItemStack(10);
|
|
|
|
if (stack == null)
|
|
{
|
|
//entity.setDead();
|
|
//event.setCanceled(true);
|
|
return;
|
|
}
|
|
|
|
Item item = stack.getItem();
|
|
if (item == null)
|
|
{
|
|
FMLLog.warning("Attempted to add a EntityItem to the world with a invalid item: ID %d at " +
|
|
"(%2.2f, %2.2f, %2.2f), this is most likely a config issue between you and the server. Please double check your configs",
|
|
stack.itemID, entity.posX, entity.posY, entity.posZ);
|
|
entity.setDead();
|
|
event.setCanceled(true);
|
|
return;
|
|
}
|
|
|
|
if (item.hasCustomEntity(stack))
|
|
{
|
|
Entity newEntity = item.createEntity(event.world, entity, stack);
|
|
if (newEntity != null)
|
|
{
|
|
entity.setDead();
|
|
event.setCanceled(true);
|
|
event.world.spawnEntityInWorld(newEntity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
|
public void onDimensionLoad(WorldEvent.Load event)
|
|
{
|
|
ForgeChunkManager.loadWorld(event.world);
|
|
}
|
|
|
|
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
|
public void onDimensionSave(WorldEvent.Save event)
|
|
{
|
|
ForgeChunkManager.saveWorld(event.world);
|
|
}
|
|
|
|
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
|
public void onDimensionUnload(WorldEvent.Unload event)
|
|
{
|
|
ForgeChunkManager.unloadWorld(event.world);
|
|
}
|
|
}
|