mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
Initial 1.16.2 Update
This commit is contained in:
1 parent
a3c4ffd2c1
commit
fe43088c96
233 files changed
+1644
-2297
No files matched your search
@@ -29,6 +29,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.block.NetherPortalBlock;
|
||||
import net.minecraft.block.PortalSize;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.command.CommandSource;
|
||||
@@ -79,6 +80,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.MobSpawnInfo;
|
||||
import net.minecraft.world.storage.IServerWorldInfo;
|
||||
import net.minecraft.world.storage.PlayerData;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -232,7 +234,7 @@ public class ForgeEventFactory
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static List<Biome.SpawnListEntry> getPotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<Biome.SpawnListEntry> oldList)
|
||||
public static List<MobSpawnInfo.Spawners> getPotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<MobSpawnInfo.Spawners> oldList)
|
||||
{
|
||||
WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldList);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
@@ -363,7 +365,7 @@ public class ForgeEventFactory
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static BlockState onToolUse(BlockState originalState, World world, BlockPos pos, PlayerEntity player, ItemStack stack, ToolType toolType)
|
||||
{
|
||||
@@ -670,9 +672,10 @@ public class ForgeEventFactory
|
||||
return result == Result.DEFAULT ? def : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean onTrySpawnPortal(IWorld world, BlockPos pos, NetherPortalBlock.Size size)
|
||||
public static Optional<PortalSize> onTrySpawnPortal(IWorld world, BlockPos pos, Optional<PortalSize> size)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size));
|
||||
if (!size.isPresent()) return size;
|
||||
return MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size.get())) ? size : Optional.empty();
|
||||
}
|
||||
|
||||
public static int onEnchantmentLevelSet(World world, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int level)
|
||||
@@ -740,7 +743,7 @@ public class ForgeEventFactory
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getListeners();
|
||||
}
|
||||
|
||||
|
||||
public static void onCommandRegister(CommandDispatcher<CommandSource> dispatcher, Commands.EnvironmentType environment)
|
||||
{
|
||||
RegisterCommandsEvent event = new RegisterCommandsEvent(dispatcher, environment);
|
||||
|
||||
@@ -19,22 +19,21 @@
|
||||
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.tags.NetworkTagManager;
|
||||
import net.minecraft.tags.ITagCollectionSupplier;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* Fired on the client when {@link NetworkTagManager} has all of its tags synced from the server to the client (just after a client has connected).
|
||||
* Fired on the server when {@link NetworkTagManager} has read all tags from disk (during a data reload).
|
||||
* Fired on the client when {@link ITagCollectionSupplier} has all of its tags synced from the server to the client (just after a client has connected).
|
||||
* Fired on the server when {@link ITagCollectionSupplier} has read all tags from disk (during a data reload).
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
* On the client, this event fires on the Client Thread.
|
||||
* On the server, this event may be fired on the Server Thread, or an async reloader thread.
|
||||
*/
|
||||
public class TagsUpdatedEvent extends Event
|
||||
{
|
||||
|
||||
private final NetworkTagManager manager;
|
||||
|
||||
public TagsUpdatedEvent(NetworkTagManager manager)
|
||||
private final ITagCollectionSupplier manager;
|
||||
|
||||
public TagsUpdatedEvent(ITagCollectionSupplier manager)
|
||||
{
|
||||
this.manager = manager;
|
||||
}
|
||||
@@ -42,7 +41,7 @@ public class TagsUpdatedEvent extends Event
|
||||
/**
|
||||
* @return The network tag manager that has been updated with newly received tags.
|
||||
*/
|
||||
public NetworkTagManager getTagManager()
|
||||
public ITagCollectionSupplier getTagManager()
|
||||
{
|
||||
return manager;
|
||||
}
|
||||
|
||||
@@ -51,40 +51,31 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
@Cancelable
|
||||
public class LivingKnockBackEvent extends LivingEvent
|
||||
{
|
||||
protected Entity attacker;
|
||||
protected float strength;
|
||||
protected double ratioX, ratioZ;
|
||||
protected final Entity originalAttacker;
|
||||
protected final float originalStrength;
|
||||
protected final double originalRatioX, originalRatioZ;
|
||||
|
||||
public LivingKnockBackEvent(LivingEntity target, Entity attacker, float strength, double ratioX, double ratioZ)
|
||||
public LivingKnockBackEvent(LivingEntity target, float strength, double ratioX, double ratioZ)
|
||||
{
|
||||
super(target);
|
||||
this.attacker = this.originalAttacker = attacker;
|
||||
this.strength = this.originalStrength = strength;
|
||||
this.ratioX = this.originalRatioX = ratioX;
|
||||
this.ratioZ = this.originalRatioZ = ratioZ;
|
||||
}
|
||||
|
||||
public Entity getAttacker() {return this.attacker;}
|
||||
|
||||
public float getStrength() {return this.strength;}
|
||||
|
||||
public double getRatioX() {return this.ratioX;}
|
||||
|
||||
public double getRatioZ() {return this.ratioZ;}
|
||||
|
||||
public Entity getOriginalAttacker() {return this.originalAttacker;}
|
||||
|
||||
public float getOriginalStrength() {return this.originalStrength;}
|
||||
|
||||
public double getOriginalRatioX() {return this.originalRatioX;}
|
||||
|
||||
public double getOriginalRatioZ() {return this.originalRatioZ;}
|
||||
|
||||
public void setAttacker(Entity attacker) {this.attacker = attacker;}
|
||||
|
||||
public void setStrength(float strength) {this.strength = strength;}
|
||||
|
||||
public void setRatioX(double ratioX) {this.ratioX = ratioX;}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.NetherPortalBlock;
|
||||
import net.minecraft.block.PortalSize;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -432,24 +433,24 @@ public class BlockEvent extends Event
|
||||
@Cancelable
|
||||
public static class PortalSpawnEvent extends BlockEvent
|
||||
{
|
||||
private final NetherPortalBlock.Size size;
|
||||
private final PortalSize size;
|
||||
|
||||
public PortalSpawnEvent(IWorld world, BlockPos pos, BlockState state, NetherPortalBlock.Size size)
|
||||
public PortalSpawnEvent(IWorld world, BlockPos pos, BlockState state, PortalSize size)
|
||||
{
|
||||
super(world, pos, state);
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public NetherPortalBlock.Size getPortalSize()
|
||||
public PortalSize getPortalSize()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fired when when this block is right clicked by a tool to change its state.
|
||||
* For example: Used to determine if an axe can strip, a shovel can path, or a hoe can till.
|
||||
*
|
||||
*
|
||||
* This event is {@link Cancelable}. If canceled, this will prevent the tool
|
||||
* from changing the block's state.
|
||||
*/
|
||||
@@ -481,7 +482,7 @@ public class BlockEvent extends Event
|
||||
public ItemStack getHeldItemStack()
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
/**Gets the current type of the tool being compared against.*/
|
||||
public ToolType getToolType()
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.util.IProgressUpdate;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
||||
import net.minecraft.world.biome.MobSpawnInfo;
|
||||
import net.minecraft.world.storage.IServerWorldInfo;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
@@ -128,17 +128,17 @@ public class WorldEvent extends Event
|
||||
{
|
||||
private final EntityClassification type;
|
||||
private final BlockPos pos;
|
||||
private final List<SpawnListEntry> list;
|
||||
private final List<MobSpawnInfo.Spawners> list;
|
||||
|
||||
public PotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<SpawnListEntry> oldList)
|
||||
public PotentialSpawns(IWorld world, EntityClassification type, BlockPos pos, List<MobSpawnInfo.Spawners> oldList)
|
||||
{
|
||||
super(world);
|
||||
this.pos = pos;
|
||||
this.type = type;
|
||||
if (oldList != null)
|
||||
this.list = new ArrayList<SpawnListEntry>(oldList);
|
||||
this.list = new ArrayList<>(oldList);
|
||||
else
|
||||
this.list = new ArrayList<SpawnListEntry>();
|
||||
this.list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public EntityClassification getType()
|
||||
@@ -151,7 +151,7 @@ public class WorldEvent extends Event
|
||||
return pos;
|
||||
}
|
||||
|
||||
public List<SpawnListEntry> getList()
|
||||
public List<MobSpawnInfo.Spawners> getList()
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user