Initial patch update to 1.12.

Some things to note:
Netty is screwy so currently can't join single player. @cpw
Crafting has been MAJORY reworked. The current GameRegistry functions are nooped, this is IN THE WORKS.
  Just need to move the recipe list to a full class registry, and then re implement the in-code recipe registration.
  Also, it IS advised that modders move to JSON, because ideally we'll see a S->C recipe syncing system in 1.13
  which would allow servers to have custom recipes.
  OreDictionary currently 1/2 works, need to write a better algorithm for replacing ingredients.
  Please be patient
Rendering:
  A lot of functions got a new float parameter, this is similar to partial ticks, needs more research
This commit is contained in:
LexManos authored and cpw committed 2017-06-10 22:22:02 -04:00
1 parent 286777b824
commit f1cca475ea
342 files changed
+3878 -2936

No files matched your search

@@ -43,12 +43,6 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
final Map<ResourceLocation, ICapabilityProvider> caps;// package-private for ForgeEventFactory
private final Map<ResourceLocation, ICapabilityProvider> view;
@SuppressWarnings("unchecked")
@Deprecated
public AttachCapabilitiesEvent(T obj)
{
this((Class<T>)Object.class, obj);
}
public AttachCapabilitiesEvent(Class<T> type, T obj)
{
this(type, obj, Maps.<ResourceLocation, ICapabilityProvider>newLinkedHashMap());
@@ -93,83 +87,21 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
return view;
}
/**
* A version of the parent event which is only fired for Tile Entities.
*/
@Deprecated
public static class TileEntity extends AttachCapabilitiesEvent<net.minecraft.tileentity.TileEntity>
{
private final net.minecraft.tileentity.TileEntity te;
public TileEntity(net.minecraft.tileentity.TileEntity te)
{
super(net.minecraft.tileentity.TileEntity.class, te);
this.te = te;
}
public net.minecraft.tileentity.TileEntity getTileEntity()
{
return this.te;
}
}
/**
* A version of the parent event which is only fired for Entities.
*/
@Deprecated
public static class Entity extends AttachCapabilitiesEvent<net.minecraft.entity.Entity>
{
private final net.minecraft.entity.Entity entity;
public Entity(net.minecraft.entity.Entity entity)
{
super(net.minecraft.entity.Entity.class, entity);
this.entity = entity;
}
public net.minecraft.entity.Entity getEntity()
{
return this.entity;
}
}
/**
* A version of the parent event which is only fired for ItemStacks.
*/
@Deprecated
public static class Item extends AttachCapabilitiesEvent<net.minecraft.item.Item>
{
private final net.minecraft.item.ItemStack stack;
private final net.minecraft.item.Item item;
public Item(net.minecraft.item.Item item, @Nonnull net.minecraft.item.ItemStack stack)
{
super(net.minecraft.item.Item.class, item);
this.item = item;
this.stack = stack;
}
public net.minecraft.item.Item getItem()
{
return this.item;
}
@Nonnull
public net.minecraft.item.ItemStack getItemStack()
{
return this.stack;
}
}
/**
* A version of the parent event which is only fired for Worlds.
*/
@Deprecated
public static class World extends AttachCapabilitiesEvent<net.minecraft.world.World>
{
private final net.minecraft.world.World world;
public World(net.minecraft.world.World world)
{
super(net.minecraft.world.World.class, world);
this.world = world;
}
public net.minecraft.world.World getWorld()
{
return this.world;
}
}
}
@@ -1,117 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* 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
*/
package net.minecraftforge.event;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import net.minecraft.command.EntitySelector;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.common.IEntitySelectorFactory;
import net.minecraftforge.fml.common.eventhandler.Event;
import java.util.List;
import java.util.Map;
/**
* Is not fired anymore.
* Replaced by a factory, which has to be registered with {@link net.minecraftforge.fml.common.registry.GameRegistry#registerEntitySelector(IEntitySelectorFactory, String...)}
* TODO remove in 1.12
*/
@Deprecated
public class EntitySelectorEvent extends Event
{
private final Map<String, String> map;
private final String mainSelector;
private final ICommandSender sender;
private final Vec3d position;
private final List<Predicate<Entity>> selectors;
public EntitySelectorEvent(Map<String, String> map, String mainSelector, ICommandSender sender, Vec3d position)
{
this.map = map;
this.mainSelector = mainSelector;
this.sender = sender;
this.position = position;
selectors = Lists.newArrayList();
}
/**
* Add your custom selector.
* It is recommend to use "modid:name", if checking for own arguments, to avoid inter-mod interference (e.g. "@a[Forge:timeplayed=100]").
*
* @param selector Your custom predicate
*/
public void addPredicate(Predicate<Entity> selector)
{
if (selector == null)
{
throw new NullPointerException("Attempted to add null predicate as entity selector");
}
selectors.add(selector);
}
/**
* @return The main selector used (e.g. 'a' for all players or 'e' for all entities)
*/
public String getMainSelector()
{
return mainSelector;
}
/**
* Example: "@a[test=true]" would result in a map with "test"=>"true"
*
* @return The argument map. Maps all given argument names with its value.
*/
public Map<String, String> getArgumentMap()
{
return map;
}
/**
* See {@link EntitySelector#getPosFromArguments(Map, Vec3d)}
*
* @return A position either specified in the selector arguments or by the players position.
*/
public Vec3d getPosition()
{
return position;
}
/**
* @return The sender of the command.
*/
public ICommandSender getSender()
{
return sender;
}
/**
* @return The list of added custom selectors
*/
List<Predicate<Entity>> getSelectors()
{
return selectors;
}
}
@@ -27,6 +27,7 @@ import java.util.Random;
import com.google.common.base.Predicate;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
@@ -54,6 +55,7 @@ import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ChatType;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.village.Village;
import net.minecraft.world.Explosion;
@@ -62,7 +64,7 @@ import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.storage.IPlayerFileData;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.loot.LootTable;
@@ -125,15 +127,6 @@ import javax.annotation.Nullable;
public class ForgeEventFactory
{
/**
* @deprecated Use {@link #onPlayerMultiBlockPlace(EntityPlayer, List, EnumFacing, EnumHand)} instead.
*/
@Deprecated
public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List<BlockSnapshot> blockSnapshots, EnumFacing direction)
{
return onPlayerMultiBlockPlace(player, blockSnapshots, direction, null);
}
public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List<BlockSnapshot> blockSnapshots, EnumFacing direction, @Nullable EnumHand hand)
{
BlockSnapshot snap = blockSnapshots.get(0);
@@ -143,15 +136,6 @@ public class ForgeEventFactory
return event;
}
/**
* @deprecated Use {@link #onPlayerBlockPlace(EntityPlayer, BlockSnapshot, EnumFacing, EnumHand)} instead.
*/
@Deprecated
public static PlaceEvent onPlayerBlockPlace(EntityPlayer player, BlockSnapshot blockSnapshot, EnumFacing direction)
{
return onPlayerBlockPlace(player, blockSnapshot, direction, EnumHand.MAIN_HAND);
}
public static PlaceEvent onPlayerBlockPlace(@Nonnull EntityPlayer player, @Nonnull BlockSnapshot blockSnapshot, @Nonnull EnumFacing direction, @Nonnull EnumHand hand)
{
IBlockState placedAgainst = blockSnapshot.getWorld().getBlockState(blockSnapshot.getPos().offset(direction.getOpposite()));
@@ -254,17 +238,6 @@ public class ForgeEventFactory
return event.getDisplayname();
}
/**
* TODO remove in 1.12
*/
@Deprecated
public static List<Predicate<Entity>> gatherEntitySelectors(Map<String, String> map, String mainSelector, ICommandSender sender, Vec3d position)
{
EntitySelectorEvent event=new EntitySelectorEvent(map, mainSelector, sender, position);
MinecraftForge.EVENT_BUS.post(event);
return event.getSelectors();
}
public static float fireBlockHarvesting(List<ItemStack> drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player)
{
BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(world, pos, state, fortune, dropChance, drops, player, silkTouch);
@@ -272,9 +245,9 @@ public class ForgeEventFactory
return event.getDropChance();
}
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, ITooltipFlag flags)
{
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, toolTip, showAdvancedItemTooltips);
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, toolTip, flags);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
@@ -343,7 +316,7 @@ public class ForgeEventFactory
}
@Nullable
public static ITextComponent onClientChat(byte type, ITextComponent message)
public static ITextComponent onClientChat(ChatType type, ITextComponent message)
{
ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message);
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
@@ -368,14 +341,6 @@ public class ForgeEventFactory
return 0;
}
/**
* @deprecated Use {@link #onApplyBonemeal(EntityPlayer, World, BlockPos, IBlockState, ItemStack, EnumHand)} instead.
*/
@Deprecated
public static int onApplyBonemeal(EntityPlayer player, World world, BlockPos pos, IBlockState state, ItemStack stack)
{
return onApplyBonemeal(player, world, pos, state, stack, null);
}
public static int onApplyBonemeal(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull ItemStack stack, @Nullable EnumHand hand)
{
@@ -580,15 +545,15 @@ public class ForgeEventFactory
@Nullable
public static CapabilityDispatcher gatherCapabilities(TileEntity tileEntity)
{
return gatherCapabilities(new AttachCapabilitiesEvent.TileEntity(tileEntity), null);
return gatherCapabilities(new AttachCapabilitiesEvent<TileEntity>(TileEntity.class, tileEntity), null);
}
@Nullable
public static CapabilityDispatcher gatherCapabilities(Entity entity)
{
return gatherCapabilities(new AttachCapabilitiesEvent.Entity(entity), null);
return gatherCapabilities(new AttachCapabilitiesEvent<Entity>(Entity.class, entity), null);
}
@Nullable
public static CapabilityDispatcher gatherCapabilities(Village village)
{
@@ -610,7 +575,7 @@ public class ForgeEventFactory
@Nullable
public static CapabilityDispatcher gatherCapabilities(World world, ICapabilityProvider parent)
{
return gatherCapabilities(new AttachCapabilitiesEvent.World(world), parent);
return gatherCapabilities(new AttachCapabilitiesEvent<World>(World.class, world), parent);
}
@Nullable
@@ -658,30 +623,11 @@ public class ForgeEventFactory
return event.getResult() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY;
}
/**
* @deprecated Use {@link #onChunkPopulate(boolean, IChunkGenerator, World, Random, int, int, boolean)}<br>
* The Random param should not be world.rand, it should be the same chunk-position-seeded rand used by the Chunk Provider.
*/
@Deprecated
public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, int x, int z, boolean hasVillageGenerated)
{
MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, world.rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, world.rand, x, z, hasVillageGenerated));
}
public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, Random rand, int x, int z, boolean hasVillageGenerated)
{
MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, rand, x, z, hasVillageGenerated));
}
/**
* @deprecated Use {@link #loadLootTable(ResourceLocation, LootTable, LootTableManager)}<br>
*/
@Deprecated
public static LootTable loadLootTable(ResourceLocation name, LootTable table)
{
return loadLootTable(name, table, null);
}
public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTableManager lootTableManager)
{
LootTableLoadEvent event = new LootTableLoadEvent(name, table, lootTableManager);
@@ -705,7 +651,7 @@ public class ForgeEventFactory
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e);
return e.getLevel();
}
public static boolean onEntityDestroyBlock(EntityLivingBase entity, BlockPos pos, IBlockState state)
{
return !MinecraftForge.EVENT_BUS.post(new LivingDestroyBlockEvent(entity, pos, state));
@@ -62,12 +62,12 @@ public class BabyEntitySpawnEvent extends Event
//causedByPlayer calculated here to simplify the patch.
EntityPlayer causedByPlayer = null;
if (parentA instanceof EntityAnimal) {
causedByPlayer = ((EntityAnimal)parentA).getPlayerInLove();
causedByPlayer = ((EntityAnimal)parentA).func_191993_do();
}
if (causedByPlayer == null && parentB instanceof EntityAnimal)
{
causedByPlayer = ((EntityAnimal)parentB).getPlayerInLove();
causedByPlayer = ((EntityAnimal)parentB).func_191993_do();
}
this.parentA = parentA;
@@ -102,4 +102,4 @@ public class BabyEntitySpawnEvent extends Event
{
child = proposedChild;
}
}
}
@@ -1,43 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* 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
*/
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.stats.Achievement;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* When the player receives an achievement. If canceled the player will not receive anything.
*/
@Cancelable
public class AchievementEvent extends PlayerEvent {
private final Achievement achievement;
public AchievementEvent(EntityPlayer player, Achievement achievement)
{
super(player);
this.achievement = achievement;
}
public Achievement getAchievement()
{
return achievement;
}
}
@@ -20,6 +20,8 @@
package net.minecraftforge.event.entity.player;
import java.util.List;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -27,7 +29,7 @@ import javax.annotation.Nonnull;
public class ItemTooltipEvent extends PlayerEvent
{
private final boolean showAdvancedItemTooltips;
private final ITooltipFlag flags;
@Nonnull
private final ItemStack itemStack;
private final List<String> toolTip;
@@ -35,20 +37,20 @@ public class ItemTooltipEvent extends PlayerEvent
/**
* This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer.
*/
public ItemTooltipEvent(@Nonnull ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
public ItemTooltipEvent(@Nonnull ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, ITooltipFlag flags)
{
super(entityPlayer);
this.itemStack = itemStack;
this.toolTip = toolTip;
this.showAdvancedItemTooltips = showAdvancedItemTooltips;
this.flags = flags;
}
/**
* Whether the advanced information on item tooltips is being shown, toggled by F3+H.
* Use to determine if the advanced information on item tooltips is being shown, toggled by F3+H.
*/
public boolean isShowAdvancedItemTooltips()
public ITooltipFlag getFlags()
{
return showAdvancedItemTooltips;
return flags;
}
/**
@@ -67,4 +69,4 @@ public class ItemTooltipEvent extends PlayerEvent
{
return toolTip;
}
}
}
@@ -22,7 +22,7 @@ package net.minecraftforge.event.terraingen;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.IChunkGenerator;
public class ChunkGeneratorEvent extends Event
{
@@ -22,10 +22,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.ChunkProviderEnd;
import net.minecraft.world.gen.ChunkProviderHell;
import net.minecraft.world.gen.ChunkProviderOverworld;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -23,7 +23,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.MinecraftForge;
@@ -20,7 +20,6 @@
package net.minecraftforge.event.terraingen;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraft.world.gen.ChunkProviderSettings;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;