本文整理汇总了Java中net.minecraftforge.fml.common.eventhandler.EventPriority.HIGH属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.HIGH属性的具体用法?Java EventPriority.HIGH怎么用?Java EventPriority.HIGH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.fml.common.eventhandler.EventPriority
的用法示例。
在下文中一共展示了EventPriority.HIGH属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: placeKiln
@SubscribeEvent(priority=EventPriority.HIGH)
public void placeKiln(PlayerInteractEvent.RightClickBlock event){
if(event.getWorld().getBlockState(event.getPos()).getBlock()==BlocksRegistry.potteryKiln){
event.setUseBlock(Result.ALLOW);
}else if(!event.isCanceled()&&event.getEntityPlayer().isSneaking()&&PotteryKilnRecipe.isValidInput(event.getItemStack())){
if(event.getFace()==EnumFacing.UP&&event.getWorld().getBlockState(event.getPos()).isSideSolid(event.getWorld(), event.getPos(), EnumFacing.UP)&&
event.getWorld().getBlockState(event.getPos().offset(EnumFacing.UP)).getBlock().isReplaceable(event.getWorld(), event.getPos().offset(EnumFacing.UP))){
if(!event.getWorld().isRemote){
event.getWorld().setBlockState(event.getPos().offset(EnumFacing.UP), BlocksRegistry.potteryKiln.getDefaultState());
TilePotteryKiln tile=((TilePotteryKiln)event.getWorld().getTileEntity(event.getPos().offset(EnumFacing.UP)));
event.getEntityPlayer().setHeldItem(event.getHand(), tile.pottery.insertItem(0, event.getItemStack(), false));
event.getWorld().playSound(null, event.getPos(), SoundEvents.BLOCK_GRAVEL_PLACE, SoundCategory.BLOCKS, 1F, 1F);
event.getWorld().notifyBlockUpdate(event.getPos().offset(EnumFacing.UP), BlocksRegistry.potteryKiln.getDefaultState(), BlocksRegistry.potteryKiln.getDefaultState(), 2);
}
event.setUseBlock(Result.DENY);
event.setUseItem(Result.DENY);
}
}
}
示例2: renderQuartzTooltip
@SubscribeEvent(priority = EventPriority.HIGH)
@SideOnly(Side.CLIENT)
public void renderQuartzTooltip(ItemTooltipEvent event)
{
ItemStack stack = event.getItemStack();
if(stack == null)
return;
NBTTagCompound compound = stack.getTagCompound();
if(!stack.isEmpty() && compound != null && compound.hasKey("QuartzCrystal"))
{
int growth = compound.getInteger("QuartzCrystalGrowth");
int souls = compound.getInteger("QuartzSouls");
event.getToolTip().add(TextFormatting.LIGHT_PURPLE+getSaturationString(growth,false));
if(souls > 0)
event.getToolTip().add(TextFormatting.DARK_RED+getSoulString(souls,27,false));
}
}
示例3: onEntityLivingDeath
@SubscribeEvent(priority = EventPriority.HIGH)
public void onEntityLivingDeath(LivingDeathEvent event) {
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
if (ExtendedConfig.spawnSkullCrawlersAtMobsDeath) {
if (event.getEntity() instanceof AbstractSkeleton) {
EntitySkullCrawler crawler;
if (MobSpawn.isWitherSkeleton((AbstractSkeleton) event.getEntity())) {
crawler = new EntityWitherSkullCrawler(event.getEntity().getEntityWorld());
} else if (MobSpawn.isStraySkeleton((AbstractSkeleton) event.getEntity())) {
crawler = new EntityStraySkullCrawler(event.getEntity().getEntityWorld());
} else {
crawler = new EntitySkullCrawler(event.getEntity().getEntityWorld());
}
MobSpawn.spawnCrawler(event.getEntity(), crawler);
} else if (event.getEntity() instanceof EntityZombie) {
MobSpawn.spawnCrawler(event.getEntity(), new EntityZombieSkullCrawler(event.getEntity().getEntityWorld()));
}
}
if (event.getEntity() instanceof EntityCreeper && ((EntityCreeper) event.getEntity()).getPowered()) {
// drop creeper statue if entity is a charged creeper
GSBlock.MEMORIAL.dropCreeperMemorial(event.getEntity().getEntityWorld(), new BlockPos(event.getEntity()));
}
}
}
示例4: onEntityLivingDamage
@SubscribeEvent(priority = EventPriority.HIGH)
public void onEntityLivingDamage(LivingDamageEvent event) {
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
Entity entity = event.getSource().getTrueSource();
if (entity instanceof EntityLivingBase && event.getEntity() instanceof EntityLivingBase) {
EntityLivingBase attacker = (EntityLivingBase) entity;
ItemStack itemMainHand = attacker.getHeldItemMainhand();
ItemStack itemOffHand = attacker.getHeldItemOffhand();
if (itemMainHand.getItem() instanceof IBoneSword) {
applyEntityLivingDamageEnchantments(attacker, (EntityLivingBase) event.getEntity(), itemMainHand, event.getAmount());
} else if (itemOffHand.getItem() instanceof IBoneSword) {
applyEntityLivingDamageEnchantments(attacker, (EntityLivingBase) event.getEntity(), itemOffHand, event.getAmount());
}
}
}
}
示例5: interaction
@SubscribeEvent(priority = EventPriority.HIGH)
public void interaction(
final PlayerInteractEvent.LeftClickBlock event )
{
if (BitDrawers.config.debugTrace) {
Vec3d vec = event.getHitVec();
BDLogger.info("Left Click %s %s %f %f %f", resultToString(event.getUseItem()), resultToString(event.getUseBlock()), vec.xCoord, vec.yCoord, vec.zCoord);
}
if ( event.getEntityPlayer() != null && event.getUseItem() != Event.Result.DENY )
{
final ItemStack is = event.getItemStack();
if ( is != null && (is.getItem() instanceof ItemChiseledBit) && event.getWorld().isRemote)
{
Block target = event.getWorld().getBlockState(event.getPos()).getBlock();
if (target instanceof BlockBitDrawers) {
target.onBlockClicked(event.getWorld(), event.getPos(), event.getEntityPlayer());
}
if (BitDrawers.config.debugTrace)
BDLogger.info("Bit Left Click");
}
}
}
示例6: addDirectionInfoToDebugScreen
@SubscribeEvent(priority = EventPriority.HIGH)
public void addDirectionInfoToDebugScreen(RenderGameOverlayEvent.Text event) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
float t = 360;
double yaw = ((player.rotationYaw % t) + t) % t;
yaw = Math.toRadians(yaw);
double x = -Math.sin(yaw);
double z = Math.cos(yaw);
for (int i = 0; i < event.left.size(); i++) {
String line = event.left.get(i);
if (line == null) continue;
if (line.startsWith("f:")) {
line += " (" + displ(x) + ", " + displ(z) + ")";
event.left.set(i, line);
break;
}
}
}
示例7: onLogin
@SubscribeEvent(priority = EventPriority.HIGH)
public static void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
if (!event.player.world.isRemote) {
FirstAid.logger.debug("Sending damage model to " + event.player.getName());
AbstractPlayerDamageModel damageModel = PlayerDataManager.getDamageModel(event.player);
if (damageModel.hasTutorial)
PlayerDataManager.tutorialDone.add(event.player.getName());
FirstAid.NETWORKING.sendTo(new MessageReceiveConfiguration(damageModel, FirstAidConfig.externalHealing, FirstAidConfig.damageSystem, FirstAidConfig.scaleMaxHealth), (EntityPlayerMP) event.player);
}
}
示例8: livingAttack
@SubscribeEvent(priority=EventPriority.HIGH)
public void livingAttack(LivingHurtEvent event) {
if(event.isCanceled() || event.getSource().isUnblockable())
return;
if(event.getEntityLiving().hasCapability(RIG.RIG_ITEM, null)) {
ItemStack rig=event.getEntityLiving().getCapability(RIG.RIG_ITEM, null).getStackInSlot(0);
if(rig.hasTagCompound()) {
int reslevel=1+rig.getTagCompound().getInteger("ResU");
if(event.getAmount() > 1f)
event.setAmount(Math.max(1f,event.getAmount() - reslevel * 0.5f));
}
}
}
示例9: onTextOverlay
@SubscribeEvent(priority = EventPriority.HIGH)
public void onTextOverlay(RenderGameOverlayEvent.Text event) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.gameSettings.showDebugInfo && !event.getRight().isEmpty()) {
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && mc.objectMouseOver.getBlockPos() != null) {
BlockPos pos = mc.objectMouseOver.getBlockPos();
IBlockState state = mc.world.getBlockState(pos);
try {
int meta = state.getBlock().getMetaFromState(state);
event.getRight().add("");
event.getRight().add("serialized as metadata: " + meta);
} catch (Exception ignored) {}
}
}
}
示例10: savePlayerInventoryOnDeath
@SubscribeEvent(priority = EventPriority.HIGH)
public void savePlayerInventoryOnDeath(LivingDeathEvent event)
{
if (!event.getEntityLiving().worldObj.getGameRules().getBoolean("keepInventory") && event.getEntityLiving() instanceof EntityPlayer && !((EntityPlayer)event.getEntityLiving()).worldObj.isRemote)
{
DeathInventoryHandler.createDeathInventory((EntityPlayer)event.getEntityLiving());
}
}
示例11: onShearMadnessRegisterVariations
@SubscribeEvent(priority = EventPriority.HIGH)
@Optional.Method(modid = IEReference.IMMERSIVE_ENGINEERING)
public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) {
final IVariationRegistry registry = event.getRegistry();
registry.registerVariation(
itemStack -> ItemStackHelper.isStackForBlock(itemStack, IELibrary.metalDecoration2, 0) ||
ItemStackHelper.isStackForBlock(itemStack, IELibrary.metalDecoration2, 2) ||
ItemStackHelper.isStackForBlock(itemStack, IELibrary.woodenDevice1, 3),
new ImmersiveEngineeringPostModelMaker()
);
registry.registerVariation(
itemStack ->
ItemStackHelper.isStackForBlock(itemStack, IELibrary.metalDecoration2, 1) ||
ItemStackHelper.isStackForBlock(itemStack, IELibrary.metalDecoration2, 3) ||
ItemStackHelper.isStackForBlock(itemStack, IELibrary.woodenDevice1, 4),
new ImmersiveEngineeringWallMountModelMaker()
);
registry.registerVariation(
itemStack -> ItemStackHelper.isStackForBlock(itemStack, IELibrary.conveyor),
new ConveyorTransformations()
);
registry.registerVariation(
itemStack -> ItemStackHelper.isStackForBlock(itemStack, IELibrary.clothDevice),
new ClothDeviceTransformations()
);
registry.registerVariation(
itemStack -> ItemStackHelper.isStackForBlock(itemStack, IELibrary.metalDevice1, 8),
new TeslaCoilTransformations(() -> -28)
);
registry.registerVariation(
itemStack -> ItemStackHelper.isStackForBlock(itemStack, IELibrary.connector, 11),
new TeslaCoilTransformations(() -> -15)
);
}
示例12: onAttack
@SuppressWarnings("BooleanVariableAlwaysNegated")
@SubscribeEvent(priority = EventPriority.HIGH)
public void onAttack(AttackEntityEvent event)
{
//Process for chiseling a sheep
final Entity sheep = event.getTarget();
if (sheep == null) return;
final EntityPlayer entityPlayer = event.getEntityPlayer();
ItemStack activeStack = entityPlayer.inventory.getCurrentItem();
boolean attackedWithChisel = false;
if (activeStack != null && ChiselLibrary.isChisel(activeStack.getItem()))
{
attackedWithChisel = true;
} else
{
activeStack = entityPlayer.inventory.offHandInventory[0];
if (activeStack != null && ChiselLibrary.isChisel(activeStack.getItem()))
{
attackedWithChisel = true;
}
}
if (!attackedWithChisel)
{
return;
}
if (!sheep.hasCapability(Capability.CHISELED_SHEEP, null)) {
return;
}
event.setCanceled(true);
Chiseling.chiselSheep(sheep, entityPlayer, activeStack);
}
示例13: onProjectileImpact
@SubscribeEvent(priority = EventPriority.HIGH)
public void onProjectileImpact(ProjectileImpactEvent.Throwable event) {
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
if (event.getThrowable() instanceof EntityPotion) {
EntityPotion entityPotion = (EntityPotion) event.getThrowable();
PotionType potionType = PotionUtils.getPotionFromItem(entityPotion.getPotion());
if (potionType == GSPotion.PURIFICATION_TYPE) {
PotionPurification.applyPotionOnBlocks(entityPotion);
}
}
}
}
示例14: handleClickOnSnowable
@SubscribeEvent(priority = EventPriority.HIGH)
public void handleClickOnSnowable(RightClickBlock e) {
if (e.getItemStack() == null || e.getItemStack().getItem() != Item.getItemFromBlock(Blocks.SNOW_LAYER))
return;
BlockPos pos = e.getPos().up();
BlockPos posUnder = e.getPos();
boolean result = handleClick(pos, posUnder, e.getWorld());
if (result)
e.setCanceled(result);
}
示例15: onLivingAttack
@SubscribeEvent(priority = EventPriority.HIGH)
public void onLivingAttack(LivingAttackEvent event) {
if (Always.isServer() && isEquipmented(event.getEntityLiving()) && isCDOver(event.getEntityLiving())) {
AlchemyEventSystem.markEventCanceled(event);
EntityLivingBase source = event.getSource().getTrueSource() instanceof EntityLivingBase ? (EntityLivingBase) event.getSource().getTrueSource() : null;
if (source != null)
source.attackEntityFrom(AlchemyDamageSourceLoader.dead_magic, event.getAmount());
EntityLivingBase living = event.getEntityLiving();
living.getCombatTracker().lastDamageTime = living.ticksExisted;
if (living instanceof EntityPlayerMP && !(living instanceof FakePlayer))
AlchemyNetworkHandler.network_wrapper.sendTo(new MessageGuardCallback(-1), (EntityPlayerMP) living);
}
}