2016-06-23 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2020-07-02 17:49:11 +00:00
|
|
|
* Copyright (c) 2016-2020.
|
2016-06-23 03:49:47 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2012-09-27 00:54:15 +00:00
|
|
|
package net.minecraftforge.event;
|
2012-12-13 07:27:57 +00:00
|
|
|
|
2014-06-21 21:38:21 +00:00
|
|
|
import java.io.File;
|
2019-05-23 23:02:15 +00:00
|
|
|
import java.util.*;
|
2020-12-28 20:03:11 +00:00
|
|
|
import java.util.function.Consumer;
|
2014-12-07 08:28:41 +00:00
|
|
|
|
2018-12-22 18:31:18 +00:00
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2019-12-11 02:27:07 +00:00
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
|
|
|
|
2020-07-15 19:30:41 +00:00
|
|
|
import com.mojang.brigadier.CommandDispatcher;
|
2020-08-13 07:13:48 +00:00
|
|
|
import net.minecraft.block.PortalSize;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraft.block.BlockState;
|
2017-06-05 21:04:10 +00:00
|
|
|
import net.minecraft.client.util.ITooltipFlag;
|
2020-07-15 19:30:41 +00:00
|
|
|
import net.minecraft.command.CommandSource;
|
|
|
|
import net.minecraft.command.Commands;
|
2013-12-21 08:10:35 +00:00
|
|
|
import net.minecraft.entity.Entity;
|
2020-08-21 18:53:37 +00:00
|
|
|
import net.minecraft.entity.Pose;
|
|
|
|
import net.minecraft.entity.EntitySize;
|
2020-12-28 20:03:11 +00:00
|
|
|
import net.minecraft.entity.EntityType;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraft.entity.MobEntity;
|
|
|
|
import net.minecraft.entity.SpawnReason;
|
|
|
|
import net.minecraft.entity.LivingEntity;
|
|
|
|
import net.minecraft.entity.EntityClassification;
|
|
|
|
import net.minecraft.entity.effect.LightningBoltEntity;
|
|
|
|
import net.minecraft.entity.item.ItemEntity;
|
|
|
|
import net.minecraft.entity.monster.ZombieEntity;
|
|
|
|
import net.minecraft.entity.passive.AnimalEntity;
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
|
|
import net.minecraft.entity.player.PlayerEntity.SleepResult;
|
|
|
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
|
|
import net.minecraft.entity.projectile.AbstractArrowEntity;
|
|
|
|
import net.minecraft.entity.projectile.DamagingProjectileEntity;
|
2020-06-19 14:58:45 +00:00
|
|
|
import net.minecraft.entity.projectile.FireworkRocketEntity;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraft.entity.projectile.ThrowableEntity;
|
|
|
|
import net.minecraft.block.Blocks;
|
2012-12-13 07:27:57 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
2018-12-04 02:04:37 +00:00
|
|
|
import net.minecraft.item.ItemUseContext;
|
2020-06-19 14:58:45 +00:00
|
|
|
import net.minecraft.loot.LootTable;
|
|
|
|
import net.minecraft.loot.LootTableManager;
|
2020-07-06 19:41:57 +00:00
|
|
|
import net.minecraft.resources.IFutureReloadListener;
|
2020-07-08 21:24:01 +00:00
|
|
|
import net.minecraft.resources.DataPackRegistries;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraft.world.spawner.AbstractSpawner;
|
2016-03-02 07:38:31 +00:00
|
|
|
import net.minecraft.util.ActionResult;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraft.util.ActionResultType;
|
|
|
|
import net.minecraft.util.Direction;
|
|
|
|
import net.minecraft.util.Hand;
|
2016-11-13 22:09:54 +00:00
|
|
|
import net.minecraft.util.NonNullList;
|
2020-07-27 20:41:35 +00:00
|
|
|
import net.minecraft.util.RegistryKey;
|
2016-05-09 21:15:59 +00:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-03-08 19:43:05 +00:00
|
|
|
import net.minecraft.util.SoundCategory;
|
2016-03-08 05:06:54 +00:00
|
|
|
import net.minecraft.util.SoundEvent;
|
2016-03-01 08:31:58 +00:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraft.util.math.ChunkPos;
|
2016-03-02 04:42:36 +00:00
|
|
|
import net.minecraft.util.math.RayTraceResult;
|
2017-06-05 21:04:10 +00:00
|
|
|
import net.minecraft.util.text.ChatType;
|
2016-03-02 04:42:36 +00:00
|
|
|
import net.minecraft.util.text.ITextComponent;
|
2014-12-07 08:28:41 +00:00
|
|
|
import net.minecraft.world.Explosion;
|
2019-06-25 02:01:03 +00:00
|
|
|
import net.minecraft.world.GameRules;
|
2018-11-20 03:55:46 +00:00
|
|
|
import net.minecraft.world.IWorld;
|
2020-08-21 18:37:43 +00:00
|
|
|
import net.minecraft.world.IWorldReader;
|
2013-01-02 06:20:30 +00:00
|
|
|
import net.minecraft.world.World;
|
2019-07-20 03:33:15 +00:00
|
|
|
import net.minecraft.world.server.ServerWorld;
|
2020-08-13 07:13:48 +00:00
|
|
|
import net.minecraft.world.biome.MobSpawnInfo;
|
2020-06-24 00:56:24 +00:00
|
|
|
import net.minecraft.world.storage.IServerWorldInfo;
|
2020-06-19 14:58:45 +00:00
|
|
|
import net.minecraft.world.storage.PlayerData;
|
2019-12-11 02:27:07 +00:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2017-04-07 23:09:46 +00:00
|
|
|
import net.minecraftforge.client.event.ClientChatEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.client.event.ClientChatReceivedEvent;
|
2015-06-25 17:07:27 +00:00
|
|
|
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
|
|
|
|
import net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType;
|
2012-09-27 00:54:15 +00:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2020-08-03 23:49:26 +00:00
|
|
|
import net.minecraftforge.common.ToolType;
|
2016-01-12 00:04:22 +00:00
|
|
|
import net.minecraftforge.common.capabilities.CapabilityDispatcher;
|
|
|
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
2014-08-27 02:47:22 +00:00
|
|
|
import net.minecraftforge.common.util.BlockSnapshot;
|
2016-08-13 20:38:45 +00:00
|
|
|
import net.minecraftforge.event.brewing.PlayerBrewedPotionEvent;
|
2014-12-07 11:30:10 +00:00
|
|
|
import net.minecraftforge.event.brewing.PotionBrewEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.EntityEvent;
|
2018-04-01 07:48:25 +00:00
|
|
|
import net.minecraftforge.event.entity.EntityMobGriefingEvent;
|
2015-02-21 02:03:16 +00:00
|
|
|
import net.minecraftforge.event.entity.EntityMountEvent;
|
2013-12-21 08:10:35 +00:00
|
|
|
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
2017-10-31 18:34:48 +00:00
|
|
|
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.item.ItemExpireEvent;
|
2017-04-07 23:47:28 +00:00
|
|
|
import net.minecraftforge.event.entity.living.AnimalTameEvent;
|
2020-12-28 20:03:11 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingConversionEvent;
|
2017-04-07 22:34:26 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingDestroyBlockEvent;
|
2016-03-02 04:42:36 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent;
|
2015-04-13 22:09:42 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
|
2014-12-07 10:34:28 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingHealEvent;
|
2013-03-20 02:59:28 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
|
2013-01-02 06:20:30 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
2013-09-06 17:19:51 +00:00
|
|
|
import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn;
|
2013-10-13 16:21:57 +00:00
|
|
|
import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent;
|
2016-03-02 07:38:31 +00:00
|
|
|
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
|
|
|
import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
|
|
|
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
|
|
|
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
2013-09-23 08:50:59 +00:00
|
|
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
2013-03-05 04:29:05 +00:00
|
|
|
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
|
|
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
|
2015-10-10 22:39:27 +00:00
|
|
|
import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
|
|
|
|
import net.minecraftforge.event.entity.player.PlayerWakeUpEvent;
|
2016-01-09 21:39:12 +00:00
|
|
|
import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent;
|
2018-08-16 20:14:34 +00:00
|
|
|
import net.minecraftforge.event.entity.player.SleepingTimeCheckEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
2017-07-03 19:54:01 +00:00
|
|
|
import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent;
|
2013-09-07 04:10:08 +00:00
|
|
|
import net.minecraftforge.event.world.BlockEvent;
|
2020-08-03 23:49:26 +00:00
|
|
|
import net.minecraftforge.event.world.BlockEvent.BlockToolInteractEvent;
|
2019-04-24 00:42:08 +00:00
|
|
|
import net.minecraftforge.event.world.BlockEvent.CreateFluidSourceEvent;
|
2019-03-12 04:22:47 +00:00
|
|
|
import net.minecraftforge.event.world.BlockEvent.EntityMultiPlaceEvent;
|
|
|
|
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
2016-03-23 14:34:48 +00:00
|
|
|
import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent;
|
2019-05-23 23:02:15 +00:00
|
|
|
import net.minecraftforge.event.world.ChunkWatchEvent;
|
2014-12-07 08:28:41 +00:00
|
|
|
import net.minecraftforge.event.world.ExplosionEvent;
|
2019-08-02 21:12:21 +00:00
|
|
|
import net.minecraftforge.event.world.PistonEvent;
|
2018-12-13 09:15:53 +00:00
|
|
|
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
|
2019-12-02 22:08:14 +00:00
|
|
|
import net.minecraftforge.event.world.SleepFinishedTimeEvent;
|
2013-03-05 04:29:05 +00:00
|
|
|
import net.minecraftforge.event.world.WorldEvent;
|
2018-06-11 01:12:46 +00:00
|
|
|
import net.minecraftforge.eventbus.api.Event;
|
|
|
|
import net.minecraftforge.eventbus.api.Event.Result;
|
2016-11-03 18:53:12 +00:00
|
|
|
|
2012-09-27 00:54:15 +00:00
|
|
|
public class ForgeEventFactory
|
|
|
|
{
|
2014-08-27 02:47:22 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onMultiBlockPlace(@Nullable Entity entity, List<BlockSnapshot> blockSnapshots, Direction direction)
|
2019-03-12 04:22:47 +00:00
|
|
|
{
|
|
|
|
BlockSnapshot snap = blockSnapshots.get(0);
|
2019-05-23 23:02:15 +00:00
|
|
|
BlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite()));
|
2019-03-12 04:22:47 +00:00
|
|
|
EntityMultiPlaceEvent event = new EntityMultiPlaceEvent(blockSnapshots, placedAgainst, entity);
|
|
|
|
return MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onBlockPlace(@Nullable Entity entity, @Nonnull BlockSnapshot blockSnapshot, @Nonnull Direction direction)
|
2019-03-12 04:22:47 +00:00
|
|
|
{
|
2019-05-23 23:02:15 +00:00
|
|
|
BlockState placedAgainst = blockSnapshot.getWorld().getBlockState(blockSnapshot.getPos().offset(direction.getOpposite()));
|
2019-03-12 04:22:47 +00:00
|
|
|
EntityPlaceEvent event = new BlockEvent.EntityPlaceEvent(blockSnapshot, placedAgainst, entity);
|
|
|
|
return MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static NeighborNotifyEvent onNeighborNotify(World world, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate)
|
2015-03-01 06:53:32 +00:00
|
|
|
{
|
2016-11-13 22:09:54 +00:00
|
|
|
NeighborNotifyEvent event = new NeighborNotifyEvent(world, pos, state, notifiedSides, forceRedstoneUpdate);
|
2015-03-01 06:53:32 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event;
|
|
|
|
}
|
2014-08-27 02:47:22 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean doPlayerHarvestCheck(PlayerEntity player, BlockState state, boolean success)
|
2012-09-27 00:54:15 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, state, success);
|
2012-09-27 00:54:15 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
2016-03-02 04:42:36 +00:00
|
|
|
return event.canHarvest();
|
2012-09-27 00:54:15 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static float getBreakSpeed(PlayerEntity player, BlockState state, float original, BlockPos pos)
|
2014-04-01 21:40:53 +00:00
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, state, original, pos);
|
2016-03-24 08:44:52 +00:00
|
|
|
return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getNewSpeed());
|
2012-09-27 00:54:15 +00:00
|
|
|
}
|
2012-09-27 04:18:18 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void onPlayerDestroyItem(PlayerEntity player, @Nonnull ItemStack stack, @Nullable Hand hand)
|
2012-09-27 04:18:18 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
|
2012-09-27 04:18:18 +00:00
|
|
|
}
|
2013-01-02 06:20:30 +00:00
|
|
|
|
2019-09-03 22:15:48 +00:00
|
|
|
public static Result canEntitySpawn(MobEntity entity, IWorld world, double x, double y, double z, AbstractSpawner spawner, SpawnReason spawnReason)
|
2018-01-18 21:06:53 +00:00
|
|
|
{
|
|
|
|
if (entity == null)
|
|
|
|
return Result.DEFAULT;
|
2019-09-03 22:15:48 +00:00
|
|
|
LivingSpawnEvent.CheckSpawn event = new LivingSpawnEvent.CheckSpawn(entity, world, x, y, z, spawner, spawnReason);
|
2013-01-02 06:20:30 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getResult();
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean canEntitySpawnSpawner(MobEntity entity, World world, float x, float y, float z, AbstractSpawner spawner)
|
2018-01-18 21:06:53 +00:00
|
|
|
{
|
2019-09-03 22:15:48 +00:00
|
|
|
Result result = canEntitySpawn(entity, world, x, y, z, spawner, SpawnReason.SPAWNER);
|
2018-01-18 21:06:53 +00:00
|
|
|
if (result == Result.DEFAULT)
|
2019-12-02 22:54:00 +00:00
|
|
|
return entity.canSpawn(world, SpawnReason.SPAWNER) && entity.isNotColliding(world); // vanilla logic (inverted)
|
2018-01-18 21:06:53 +00:00
|
|
|
else
|
|
|
|
return result == Result.ALLOW;
|
|
|
|
}
|
|
|
|
|
2019-09-03 22:15:48 +00:00
|
|
|
public static boolean doSpecialSpawn(MobEntity entity, World world, float x, float y, float z, AbstractSpawner spawner, SpawnReason spawnReason)
|
2018-01-18 21:06:53 +00:00
|
|
|
{
|
2019-09-03 22:15:48 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z, spawner, spawnReason));
|
2013-03-05 04:29:05 +00:00
|
|
|
}
|
2013-01-02 06:20:30 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static Result canEntityDespawn(MobEntity entity)
|
2013-09-06 17:19:51 +00:00
|
|
|
{
|
2013-09-06 20:05:29 +00:00
|
|
|
AllowDespawn event = new AllowDespawn(entity);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getResult();
|
2013-09-06 17:19:51 +00:00
|
|
|
}
|
2016-01-12 00:04:22 +00:00
|
|
|
|
2018-09-21 06:50:50 +00:00
|
|
|
public static int getItemBurnTime(@Nonnull ItemStack itemStack, int burnTime)
|
2017-07-03 19:54:01 +00:00
|
|
|
{
|
|
|
|
FurnaceFuelBurnTimeEvent event = new FurnaceFuelBurnTimeEvent(itemStack, burnTime);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getBurnTime();
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int getExperienceDrop(LivingEntity entity, PlayerEntity attackingPlayer, int originalExperience)
|
2015-04-13 22:09:42 +00:00
|
|
|
{
|
|
|
|
LivingExperienceDropEvent event = new LivingExperienceDropEvent(entity, attackingPlayer, originalExperience);
|
|
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return event.getDroppedExperience();
|
|
|
|
}
|
2014-06-22 14:11:32 +00:00
|
|
|
|
2017-01-11 23:17:56 +00:00
|
|
|
@Nullable
|
2020-08-13 07:13:48 +00:00
|
|
|
public static List<MobSpawnInfo.Spawners> getPotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<MobSpawnInfo.Spawners> oldList)
|
2013-03-05 04:29:05 +00:00
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldList);
|
2013-03-05 04:29:05 +00:00
|
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
2019-05-23 23:02:15 +00:00
|
|
|
return Collections.emptyList();
|
2016-03-24 08:44:52 +00:00
|
|
|
return event.getList();
|
2013-01-02 06:20:30 +00:00
|
|
|
}
|
2014-06-22 14:11:32 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int getMaxSpawnPackSize(MobEntity entity)
|
2013-03-20 00:43:37 +00:00
|
|
|
{
|
2013-03-20 02:59:28 +00:00
|
|
|
LivingPackSizeEvent maxCanSpawnEvent = new LivingPackSizeEvent(entity);
|
2013-03-20 00:43:37 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent);
|
2016-03-24 08:44:52 +00:00
|
|
|
return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.getMaxPackSize() : entity.getMaxSpawnedInChunk();
|
2013-03-20 00:43:37 +00:00
|
|
|
}
|
2013-09-03 20:55:11 +00:00
|
|
|
|
2020-07-27 21:16:35 +00:00
|
|
|
public static ITextComponent getPlayerDisplayName(PlayerEntity player, ITextComponent username)
|
2013-09-03 20:55:11 +00:00
|
|
|
{
|
|
|
|
PlayerEvent.NameFormat event = new PlayerEvent.NameFormat(player, username);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
2016-03-24 08:44:52 +00:00
|
|
|
return event.getDisplayname();
|
2013-09-03 20:55:11 +00:00
|
|
|
}
|
2013-09-07 04:10:08 +00:00
|
|
|
|
2019-08-31 12:15:08 +00:00
|
|
|
public static BlockState fireFluidPlaceBlockEvent(IWorld world, BlockPos pos, BlockPos liquidPos, BlockState state)
|
2018-06-27 19:04:23 +00:00
|
|
|
{
|
|
|
|
BlockEvent.FluidPlaceBlockEvent event = new BlockEvent.FluidPlaceBlockEvent(world, pos, liquidPos, state);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getNewState();
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, @Nullable PlayerEntity entityPlayer, List<ITextComponent> list, ITooltipFlag flags)
|
2013-09-23 08:50:59 +00:00
|
|
|
{
|
2018-09-09 21:27:15 +00:00
|
|
|
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, list, flags);
|
2013-09-23 08:50:59 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event;
|
|
|
|
}
|
2013-10-13 16:21:57 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static SummonAidEvent fireZombieSummonAid(ZombieEntity zombie, World world, int x, int y, int z, LivingEntity attacker, double summonChance)
|
2013-10-13 16:21:57 +00:00
|
|
|
{
|
|
|
|
SummonAidEvent summonEvent = new SummonAidEvent(zombie, world, x, y, z, attacker, summonChance);
|
|
|
|
MinecraftForge.EVENT_BUS.post(summonEvent);
|
|
|
|
return summonEvent;
|
|
|
|
}
|
2013-12-21 08:10:35 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onEntityStruckByLightning(Entity entity, LightningBoltEntity bolt)
|
2013-12-21 08:10:35 +00:00
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, bolt));
|
|
|
|
}
|
2014-01-25 03:10:51 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int onItemUseStart(LivingEntity entity, ItemStack item, int duration)
|
2014-01-25 03:10:51 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Start(entity, item, duration);
|
2016-03-24 08:44:52 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration();
|
2014-01-25 03:10:51 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int onItemUseTick(LivingEntity entity, ItemStack item, int duration)
|
2014-01-25 03:10:51 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
LivingEntityUseItemEvent event = new LivingEntityUseItemEvent.Tick(entity, item, duration);
|
2016-03-24 08:44:52 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(event) ? -1 : event.getDuration();
|
2014-01-25 03:10:51 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onUseItemStop(LivingEntity entity, ItemStack item, int duration)
|
2014-01-25 03:10:51 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(new LivingEntityUseItemEvent.Stop(entity, item, duration));
|
2014-01-25 03:10:51 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static ItemStack onItemUseFinish(LivingEntity entity, ItemStack item, int duration, ItemStack result)
|
2014-01-25 03:10:51 +00:00
|
|
|
{
|
2016-03-02 04:42:36 +00:00
|
|
|
LivingEntityUseItemEvent.Finish event = new LivingEntityUseItemEvent.Finish(entity, item, duration, result);
|
2014-01-25 03:10:51 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
2016-03-24 08:44:52 +00:00
|
|
|
return event.getResultStack();
|
2014-01-25 03:10:51 +00:00
|
|
|
}
|
2014-06-22 14:11:32 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void onStartEntityTracking(Entity entity, PlayerEntity player)
|
2014-05-29 01:33:32 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerEvent.StartTracking(player, entity));
|
|
|
|
}
|
2014-06-22 14:11:32 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void onStopEntityTracking(Entity entity, PlayerEntity player)
|
2014-05-29 01:33:32 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerEvent.StopTracking(player, entity));
|
|
|
|
}
|
2014-06-21 21:38:21 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void firePlayerLoadingEvent(PlayerEntity player, File playerDirectory, String uuidString)
|
2014-06-21 21:38:21 +00:00
|
|
|
{
|
2014-06-22 14:11:32 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerDirectory, uuidString));
|
2014-06-21 21:38:21 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void firePlayerSavingEvent(PlayerEntity player, File playerDirectory, String uuidString)
|
2014-06-21 21:38:21 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerEvent.SaveToFile(player, playerDirectory, uuidString));
|
|
|
|
}
|
2014-06-22 18:39:23 +00:00
|
|
|
|
2020-06-19 14:58:45 +00:00
|
|
|
public static void firePlayerLoadingEvent(PlayerEntity player, PlayerData playerFileData, String uuidString)
|
2014-06-22 18:39:23 +00:00
|
|
|
{
|
2020-06-19 14:58:45 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerFileData.getPlayerDataFolder(), uuidString));
|
2014-06-22 18:39:23 +00:00
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2017-01-11 23:17:56 +00:00
|
|
|
@Nullable
|
2020-06-30 19:57:23 +00:00
|
|
|
public static ITextComponent onClientChat(ChatType type, ITextComponent message, @Nullable UUID senderUUID)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
2020-06-30 19:57:23 +00:00
|
|
|
ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message, senderUUID);
|
2016-03-24 08:44:52 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}
|
|
|
|
|
2017-04-07 23:09:46 +00:00
|
|
|
@Nonnull
|
|
|
|
public static String onClientSendMessage(String message)
|
|
|
|
{
|
|
|
|
ClientChatEvent event = new ClientChatEvent(message);
|
|
|
|
return MinecraftForge.EVENT_BUS.post(event) ? "" : event.getMessage();
|
|
|
|
}
|
|
|
|
|
2020-08-03 23:49:26 +00:00
|
|
|
//TODO: 1.17 Remove
|
|
|
|
@Deprecated
|
2018-12-04 02:04:37 +00:00
|
|
|
public static int onHoeUse(ItemUseContext context)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
2018-12-04 02:04:37 +00:00
|
|
|
UseHoeEvent event = new UseHoeEvent(context);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
|
|
|
if (event.getResult() == Result.ALLOW)
|
|
|
|
{
|
2019-06-22 02:42:16 +00:00
|
|
|
context.getItem().damageItem(1, context.getPlayer(), player -> player.sendBreakAnimation(context.getHand()));
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-13 07:13:48 +00:00
|
|
|
|
2020-08-03 23:49:26 +00:00
|
|
|
@Nullable
|
|
|
|
public static BlockState onToolUse(BlockState originalState, World world, BlockPos pos, PlayerEntity player, ItemStack stack, ToolType toolType)
|
|
|
|
{
|
|
|
|
BlockToolInteractEvent event = new BlockToolInteractEvent(world, pos, originalState, player, stack, toolType);
|
|
|
|
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getFinalState();
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int onApplyBonemeal(@Nonnull PlayerEntity player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull ItemStack stack)
|
2017-04-07 23:31:51 +00:00
|
|
|
{
|
2018-12-04 02:04:37 +00:00
|
|
|
BonemealEvent event = new BonemealEvent(player, world, pos, state, stack);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
|
|
|
if (event.getResult() == Result.ALLOW)
|
|
|
|
{
|
|
|
|
if (!world.isRemote)
|
2016-12-21 23:52:30 +00:00
|
|
|
stack.shrink(1);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-11 23:17:56 +00:00
|
|
|
@Nullable
|
2019-05-23 23:02:15 +00:00
|
|
|
public static ActionResult<ItemStack> onBucketUse(@Nonnull PlayerEntity player, @Nonnull World world, @Nonnull ItemStack stack, @Nullable RayTraceResult target)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
|
|
|
FillBucketEvent event = new FillBucketEvent(player, stack, world, target);
|
2019-05-23 23:02:15 +00:00
|
|
|
if (MinecraftForge.EVENT_BUS.post(event)) return new ActionResult<ItemStack>(ActionResultType.FAIL, stack);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
|
|
|
if (event.getResult() == Result.ALLOW)
|
|
|
|
{
|
2019-06-22 02:42:16 +00:00
|
|
|
if (player.abilities.isCreativeMode)
|
2019-05-23 23:02:15 +00:00
|
|
|
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2016-12-21 23:52:30 +00:00
|
|
|
stack.shrink(1);
|
|
|
|
if (stack.isEmpty())
|
2019-05-23 23:02:15 +00:00
|
|
|
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, event.getFilledBucket());
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2016-03-02 04:42:36 +00:00
|
|
|
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
|
2016-05-18 12:11:56 +00:00
|
|
|
player.dropItem(event.getFilledBucket(), false);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean canEntityUpdate(Entity entity)
|
|
|
|
{
|
|
|
|
EntityEvent.CanUpdate event = new EntityEvent.CanUpdate(entity);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
2016-03-24 08:44:52 +00:00
|
|
|
return event.getCanUpdate();
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 19:43:05 +00:00
|
|
|
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
|
2015-03-19 11:37:21 +00:00
|
|
|
{
|
2016-03-08 19:43:05 +00:00
|
|
|
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, category, volume, pitch);
|
2015-03-19 11:37:21 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event;
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int onItemExpire(ItemEntity entity, @Nonnull ItemStack item)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
2016-12-21 23:52:30 +00:00
|
|
|
if (item.isEmpty()) return -1;
|
|
|
|
ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.world)));
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
if (!MinecraftForge.EVENT_BUS.post(event)) return -1;
|
2016-03-24 08:44:52 +00:00
|
|
|
return event.getExtraLife();
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int onItemPickup(ItemEntity entityItem, PlayerEntity player)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
2017-06-15 18:26:14 +00:00
|
|
|
Event event = new EntityItemPickupEvent(player, entityItem);
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
|
|
|
return event.getResult() == Result.ALLOW ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2015-02-21 02:03:16 +00:00
|
|
|
public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting)
|
|
|
|
{
|
2016-12-21 23:52:30 +00:00
|
|
|
boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.world, isMounting));
|
2016-01-12 00:04:22 +00:00
|
|
|
|
2015-02-21 02:03:16 +00:00
|
|
|
if(isCanceled)
|
|
|
|
{
|
2020-02-26 03:45:14 +00:00
|
|
|
entityMounting.setPositionAndRotation(entityMounting.getPosX(), entityMounting.getPosY(), entityMounting.getPosZ(), entityMounting.prevRotationYaw, entityMounting.prevRotationPitch);
|
2015-02-21 02:03:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-01-12 00:04:22 +00:00
|
|
|
else
|
|
|
|
return true;
|
2015-02-21 02:03:16 +00:00
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onAnimalTame(AnimalEntity animal, PlayerEntity tamer)
|
2017-04-07 23:47:28 +00:00
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new AnimalTameEvent(animal, tamer));
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static SleepResult onPlayerSleepInBed(PlayerEntity player, Optional<BlockPos> pos)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
|
|
|
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
2016-03-24 08:44:52 +00:00
|
|
|
return event.getResultStatus();
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}
|
|
|
|
|
2019-12-11 02:27:07 +00:00
|
|
|
public static void onPlayerWakeup(PlayerEntity player, boolean wakeImmediately, boolean updateWorldFlag)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
2019-12-11 02:27:07 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag));
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void onPlayerFall(PlayerEntity player, float distance, float multiplier)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(player, distance, multiplier));
|
|
|
|
}
|
2016-01-12 00:04:22 +00:00
|
|
|
|
2020-07-27 20:41:35 +00:00
|
|
|
public static boolean onPlayerSpawnSet(PlayerEntity player, RegistryKey<World> world, BlockPos pos, boolean forced)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new PlayerSetSpawnEvent(player, world, pos, forced));
|
2015-10-10 22:39:27 +00:00
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void onPlayerClone(PlayerEntity player, PlayerEntity oldPlayer, boolean wasDeath)
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerEvent.Clone(player, oldPlayer, wasDeath));
|
|
|
|
}
|
2014-12-07 08:28:41 +00:00
|
|
|
|
|
|
|
public static boolean onExplosionStart(World world, Explosion explosion)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Start(world, explosion));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onExplosionDetonate(World world, Explosion explosion, List<Entity> list, double diameter)
|
|
|
|
{
|
|
|
|
//Filter entities to only those who are effected, to prevent modders from seeing more then will be hurt.
|
|
|
|
/* Enable this if we get issues with modders looping to much.
|
|
|
|
Iterator<Entity> itr = list.iterator();
|
|
|
|
Vec3 p = explosion.getPosition();
|
|
|
|
while (itr.hasNext())
|
|
|
|
{
|
|
|
|
Entity e = itr.next();
|
|
|
|
double dist = e.getDistance(p.xCoord, p.yCoord, p.zCoord) / diameter;
|
2018-09-22 10:40:22 +00:00
|
|
|
if (e.isImmuneToExplosions() || dist > 1.0F) itr.remove();
|
2014-12-07 08:28:41 +00:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Detonate(world, explosion, list));
|
|
|
|
}
|
2014-12-07 09:52:29 +00:00
|
|
|
|
2020-06-24 00:56:24 +00:00
|
|
|
public static boolean onCreateWorldSpawn(World world, IServerWorldInfo settings)
|
2014-12-07 09:52:29 +00:00
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new WorldEvent.CreateSpawnPosition(world, settings));
|
|
|
|
}
|
2014-12-07 10:34:28 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static float onLivingHeal(LivingEntity entity, float amount)
|
2014-12-07 10:34:28 +00:00
|
|
|
{
|
|
|
|
LivingHealEvent event = new LivingHealEvent(entity, amount);
|
2016-03-24 08:44:52 +00:00
|
|
|
return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.getAmount());
|
2014-12-07 10:34:28 +00:00
|
|
|
}
|
2014-12-07 11:30:10 +00:00
|
|
|
|
2016-11-13 22:09:54 +00:00
|
|
|
public static boolean onPotionAttemptBrew(NonNullList<ItemStack> stacks)
|
2014-12-07 11:30:10 +00:00
|
|
|
{
|
2016-12-21 23:52:30 +00:00
|
|
|
NonNullList<ItemStack> tmp = NonNullList.withSize(stacks.size(), ItemStack.EMPTY);
|
2016-11-13 22:09:54 +00:00
|
|
|
for (int x = 0; x < tmp.size(); x++)
|
|
|
|
tmp.set(x, stacks.get(x).copy());
|
2014-12-07 11:30:10 +00:00
|
|
|
|
|
|
|
PotionBrewEvent.Pre event = new PotionBrewEvent.Pre(tmp);
|
|
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
|
|
|
{
|
|
|
|
boolean changed = false;
|
2016-11-13 22:09:54 +00:00
|
|
|
for (int x = 0; x < stacks.size(); x++)
|
2014-12-07 11:30:10 +00:00
|
|
|
{
|
2016-11-13 22:09:54 +00:00
|
|
|
changed |= ItemStack.areItemStacksEqual(tmp.get(x), stacks.get(x));
|
|
|
|
stacks.set(x, event.getItem(x));
|
2014-12-07 11:30:10 +00:00
|
|
|
}
|
2014-12-07 11:41:53 +00:00
|
|
|
if (changed)
|
|
|
|
onPotionBrewed(stacks);
|
2014-12-07 11:30:10 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-13 22:09:54 +00:00
|
|
|
public static void onPotionBrewed(NonNullList<ItemStack> brewingItemStacks)
|
2014-12-07 11:30:10 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new PotionBrewEvent.Post(brewingItemStacks));
|
|
|
|
}
|
2016-08-14 08:48:41 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static void onPlayerBrewedPotion(PlayerEntity player, ItemStack stack)
|
2016-08-13 20:38:45 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new PlayerBrewedPotionEvent(player, stack));
|
|
|
|
}
|
2016-01-12 00:04:22 +00:00
|
|
|
|
2019-12-11 02:27:07 +00:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public static boolean renderFireOverlay(PlayerEntity player, MatrixStack mat)
|
2015-06-25 17:07:27 +00:00
|
|
|
{
|
2020-10-29 00:11:57 +00:00
|
|
|
return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), player.getPosition());
|
2015-06-25 17:07:27 +00:00
|
|
|
}
|
2016-01-12 00:04:22 +00:00
|
|
|
|
2019-12-11 02:27:07 +00:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public static boolean renderWaterOverlay(PlayerEntity player, MatrixStack mat)
|
2015-06-25 17:07:27 +00:00
|
|
|
{
|
2020-10-29 00:11:57 +00:00
|
|
|
return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.getDefaultState(), player.getPosition());
|
2015-06-25 17:07:27 +00:00
|
|
|
}
|
2016-01-12 00:04:22 +00:00
|
|
|
|
2019-12-11 02:27:07 +00:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public static boolean renderBlockOverlay(PlayerEntity player, MatrixStack mat, OverlayType type, BlockState block, BlockPos pos)
|
2015-06-25 17:07:27 +00:00
|
|
|
{
|
2019-12-11 02:27:07 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(new RenderBlockOverlayEvent(player, mat, type, block, pos));
|
2015-06-25 17:07:27 +00:00
|
|
|
}
|
2018-09-21 06:50:50 +00:00
|
|
|
|
2017-05-26 20:51:18 +00:00
|
|
|
@Nullable
|
2018-09-09 21:27:15 +00:00
|
|
|
public static <T extends ICapabilityProvider> CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider)
|
2017-05-26 20:51:18 +00:00
|
|
|
{
|
2018-09-09 21:27:15 +00:00
|
|
|
return gatherCapabilities(type, provider, null);
|
2017-05-26 20:51:18 +00:00
|
|
|
}
|
2018-09-21 06:50:50 +00:00
|
|
|
|
2018-09-09 21:27:15 +00:00
|
|
|
@SuppressWarnings("unchecked")
|
2017-10-03 03:24:11 +00:00
|
|
|
@Nullable
|
2018-09-09 21:27:15 +00:00
|
|
|
public static <T extends ICapabilityProvider> CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider, @Nullable ICapabilityProvider parent)
|
2017-10-03 03:24:11 +00:00
|
|
|
{
|
2018-09-09 21:27:15 +00:00
|
|
|
return gatherCapabilities(new AttachCapabilitiesEvent<T>((Class<T>) type, provider), parent);
|
2017-10-03 03:24:11 +00:00
|
|
|
}
|
|
|
|
|
2017-01-11 23:17:56 +00:00
|
|
|
@Nullable
|
|
|
|
private static CapabilityDispatcher gatherCapabilities(AttachCapabilitiesEvent<?> event, @Nullable ICapabilityProvider parent)
|
2016-01-12 00:04:22 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
2019-02-07 06:55:17 +00:00
|
|
|
return event.getCapabilities().size() > 0 || parent != null ? new CapabilityDispatcher(event.getCapabilities(), event.getListeners(), parent) : null;
|
2016-01-12 00:04:22 +00:00
|
|
|
}
|
2016-01-09 21:39:12 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean fireSleepingLocationCheck(LivingEntity player, BlockPos sleepingLocation)
|
2016-01-09 21:39:12 +00:00
|
|
|
{
|
|
|
|
SleepingLocationCheckEvent evt = new SleepingLocationCheckEvent(player, sleepingLocation);
|
|
|
|
MinecraftForge.EVENT_BUS.post(evt);
|
|
|
|
|
|
|
|
Result canContinueSleep = evt.getResult();
|
|
|
|
if (canContinueSleep == Result.DEFAULT)
|
2016-03-05 00:40:34 +00:00
|
|
|
{
|
2019-06-22 02:42:16 +00:00
|
|
|
return player.getBedPosition().map(pos-> {
|
2019-05-23 23:02:15 +00:00
|
|
|
BlockState state = player.world.getBlockState(pos);
|
|
|
|
return state.getBlock().isBed(state, player.world, pos, player);
|
|
|
|
}).orElse(false);
|
2016-03-05 00:40:34 +00:00
|
|
|
}
|
2016-01-09 21:39:12 +00:00
|
|
|
else
|
|
|
|
return canContinueSleep == Result.ALLOW;
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean fireSleepingTimeCheck(PlayerEntity player, Optional<BlockPos> sleepingLocation)
|
2018-08-16 20:14:34 +00:00
|
|
|
{
|
|
|
|
SleepingTimeCheckEvent evt = new SleepingTimeCheckEvent(player, sleepingLocation);
|
|
|
|
MinecraftForge.EVENT_BUS.post(evt);
|
|
|
|
|
|
|
|
Result canContinueSleep = evt.getResult();
|
|
|
|
if (canContinueSleep == Result.DEFAULT)
|
|
|
|
return !player.world.isDaytime();
|
|
|
|
else
|
|
|
|
return canContinueSleep == Result.ALLOW;
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static ActionResult<ItemStack> onArrowNock(ItemStack item, World world, PlayerEntity player, Hand hand, boolean hasAmmo)
|
2016-03-02 07:38:31 +00:00
|
|
|
{
|
|
|
|
ArrowNockEvent event = new ArrowNockEvent(player, item, hand, world, hasAmmo);
|
|
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
2019-05-23 23:02:15 +00:00
|
|
|
return new ActionResult<ItemStack>(ActionResultType.FAIL, item);
|
2016-03-02 07:38:31 +00:00
|
|
|
return event.getAction();
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static int onArrowLoose(ItemStack stack, World world, PlayerEntity player, int charge, boolean hasAmmo)
|
2016-03-02 07:38:31 +00:00
|
|
|
{
|
|
|
|
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, world, charge, hasAmmo);
|
|
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
|
|
|
return -1;
|
|
|
|
return event.getCharge();
|
|
|
|
}
|
|
|
|
|
2017-10-31 18:34:48 +00:00
|
|
|
public static boolean onProjectileImpact(Entity entity, RayTraceResult ray)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent(entity, ray));
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onProjectileImpact(AbstractArrowEntity arrow, RayTraceResult ray)
|
2017-10-31 18:34:48 +00:00
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Arrow(arrow, ray));
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onProjectileImpact(DamagingProjectileEntity fireball, RayTraceResult ray)
|
2017-10-31 18:34:48 +00:00
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Fireball(fireball, ray));
|
|
|
|
}
|
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onProjectileImpact(ThrowableEntity throwable, RayTraceResult ray)
|
2017-10-31 18:34:48 +00:00
|
|
|
{
|
2018-09-21 06:50:50 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.Throwable(throwable, ray));
|
2017-10-31 18:34:48 +00:00
|
|
|
}
|
2019-02-07 06:55:17 +00:00
|
|
|
|
2020-06-12 22:33:44 +00:00
|
|
|
public static boolean onProjectileImpact(FireworkRocketEntity fireworkRocket, RayTraceResult ray)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent.FireworkRocket(fireworkRocket, ray));
|
|
|
|
}
|
|
|
|
|
2017-04-07 23:22:49 +00:00
|
|
|
public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTableManager lootTableManager)
|
|
|
|
{
|
|
|
|
LootTableLoadEvent event = new LootTableLoadEvent(name, table, lootTableManager);
|
2016-05-09 21:15:59 +00:00
|
|
|
if (MinecraftForge.EVENT_BUS.post(event))
|
|
|
|
return LootTable.EMPTY_LOOT_TABLE;
|
|
|
|
return event.getTable();
|
|
|
|
}
|
|
|
|
|
2020-08-21 18:37:43 +00:00
|
|
|
public static boolean canCreateFluidSource(IWorldReader world, BlockPos pos, BlockState state, boolean def)
|
2016-07-23 02:22:02 +00:00
|
|
|
{
|
|
|
|
CreateFluidSourceEvent evt = new CreateFluidSourceEvent(world, pos, state);
|
|
|
|
MinecraftForge.EVENT_BUS.post(evt);
|
|
|
|
|
|
|
|
Result result = evt.getResult();
|
|
|
|
return result == Result.DEFAULT ? def : result == Result.ALLOW;
|
|
|
|
}
|
|
|
|
|
2020-08-13 07:13:48 +00:00
|
|
|
public static Optional<PortalSize> onTrySpawnPortal(IWorld world, BlockPos pos, Optional<PortalSize> size)
|
2018-05-17 05:48:14 +00:00
|
|
|
{
|
2020-08-13 07:13:48 +00:00
|
|
|
if (!size.isPresent()) return size;
|
2020-08-14 19:04:17 +00:00
|
|
|
return !MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size.get())) ? size : Optional.empty();
|
2018-05-17 05:48:14 +00:00
|
|
|
}
|
|
|
|
|
2016-12-17 21:06:51 +00:00
|
|
|
public static int onEnchantmentLevelSet(World world, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int level)
|
|
|
|
{
|
|
|
|
net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent e = new net.minecraftforge.event.enchanting.EnchantmentLevelSetEvent(world, pos, enchantRow, power, itemStack, level);
|
|
|
|
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e);
|
|
|
|
return e.getLevel();
|
|
|
|
}
|
2017-06-05 21:04:10 +00:00
|
|
|
|
2019-05-23 23:02:15 +00:00
|
|
|
public static boolean onEntityDestroyBlock(LivingEntity entity, BlockPos pos, BlockState state)
|
2017-04-07 22:34:26 +00:00
|
|
|
{
|
|
|
|
return !MinecraftForge.EVENT_BUS.post(new LivingDestroyBlockEvent(entity, pos, state));
|
|
|
|
}
|
2017-10-31 18:20:59 +00:00
|
|
|
|
2018-04-01 07:48:25 +00:00
|
|
|
public static boolean getMobGriefingEvent(World world, Entity entity)
|
|
|
|
{
|
|
|
|
EntityMobGriefingEvent event = new EntityMobGriefingEvent(entity);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
|
|
|
|
Result result = event.getResult();
|
2019-07-19 15:55:30 +00:00
|
|
|
return result == Result.DEFAULT ? world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) : result == Result.ALLOW;
|
2018-04-01 07:48:25 +00:00
|
|
|
}
|
2018-12-13 09:15:53 +00:00
|
|
|
|
|
|
|
public static boolean saplingGrowTree(IWorld world, Random rand, BlockPos pos)
|
|
|
|
{
|
|
|
|
SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, pos);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getResult() != Result.DENY;
|
|
|
|
}
|
2019-05-23 23:02:15 +00:00
|
|
|
|
|
|
|
public static void fireChunkWatch(boolean watch, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world)
|
2019-03-12 05:01:35 +00:00
|
|
|
{
|
2019-05-23 23:02:15 +00:00
|
|
|
if (watch)
|
|
|
|
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunkpos, world));
|
|
|
|
else
|
|
|
|
MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(entity, chunkpos, world));
|
2019-03-12 05:01:35 +00:00
|
|
|
}
|
2019-08-02 21:12:21 +00:00
|
|
|
|
2020-02-14 20:02:47 +00:00
|
|
|
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world)
|
|
|
|
{
|
|
|
|
if (wasLoaded != load)
|
|
|
|
fireChunkWatch(load, entity, chunkpos, world);
|
|
|
|
}
|
|
|
|
|
2019-08-02 21:12:21 +00:00
|
|
|
public static boolean onPistonMovePre(World world, BlockPos pos, Direction direction, boolean extending)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new PistonEvent.Pre(world, pos, direction, extending ? PistonEvent.PistonMoveType.EXTEND : PistonEvent.PistonMoveType.RETRACT));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean onPistonMovePost(World world, BlockPos pos, Direction direction, boolean extending)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new PistonEvent.Post(world, pos, direction, extending ? PistonEvent.PistonMoveType.EXTEND : PistonEvent.PistonMoveType.RETRACT));
|
|
|
|
}
|
2019-12-02 22:08:14 +00:00
|
|
|
|
|
|
|
public static long onSleepFinished(ServerWorld world, long newTime, long minTime)
|
|
|
|
{
|
|
|
|
SleepFinishedTimeEvent event = new SleepFinishedTimeEvent(world, newTime, minTime);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getNewTime();
|
|
|
|
}
|
2020-07-06 19:41:57 +00:00
|
|
|
|
2020-07-08 21:24:01 +00:00
|
|
|
public static List<IFutureReloadListener> onResourceReload(DataPackRegistries dataPackRegistries)
|
2020-07-06 19:41:57 +00:00
|
|
|
{
|
2020-07-08 21:24:01 +00:00
|
|
|
AddReloadListenerEvent event = new AddReloadListenerEvent(dataPackRegistries);
|
2020-07-06 19:41:57 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
return event.getListeners();
|
|
|
|
}
|
2020-08-13 07:13:48 +00:00
|
|
|
|
2020-07-15 19:30:41 +00:00
|
|
|
public static void onCommandRegister(CommandDispatcher<CommandSource> dispatcher, Commands.EnvironmentType environment)
|
|
|
|
{
|
|
|
|
RegisterCommandsEvent event = new RegisterCommandsEvent(dispatcher, environment);
|
|
|
|
MinecraftForge.EVENT_BUS.post(event);
|
|
|
|
}
|
2020-08-21 18:53:37 +00:00
|
|
|
|
|
|
|
public static net.minecraftforge.event.entity.EntityEvent.Size getEntitySizeForge(Entity player, Pose pose, EntitySize size, float eyeHeight)
|
|
|
|
{
|
|
|
|
EntityEvent.Size evt = new EntityEvent.Size(player, pose, size, eyeHeight);
|
|
|
|
MinecraftForge.EVENT_BUS.post(evt);
|
|
|
|
return evt;
|
|
|
|
}
|
2020-12-28 20:03:11 +00:00
|
|
|
|
|
|
|
public static boolean canLivingConvert(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer)
|
|
|
|
{
|
|
|
|
return !MinecraftForge.EVENT_BUS.post(new LivingConversionEvent.Pre(entity, outcome, timer));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onLivingConvert(LivingEntity entity, LivingEntity outcome)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new LivingConversionEvent.Post(entity, outcome));
|
|
|
|
}
|
2012-09-27 00:54:15 +00:00
|
|
|
}
|