Some code cleanup for 1.15 (#6362)
This commit is contained in:
parent
30b530836a
commit
747cb0f151
7 changed files with 26 additions and 27 deletions
|
@ -35,4 +35,5 @@ branches:
|
|||
- 1.13-pre
|
||||
- 1.13.x
|
||||
- 1.14.x
|
||||
- 1.15.x
|
||||
- /^noci-.*$/
|
||||
|
|
12
build.gradle
12
build.gradle
|
@ -795,16 +795,16 @@ project(':forge') {
|
|||
server: '/data/server.lzma'
|
||||
],
|
||||
MC_SLIM: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]"
|
||||
client: "[net.minecraft:client:${MC_VERSION}:slim]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}:slim]"
|
||||
],
|
||||
MC_SLIM_SHA: [
|
||||
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'",
|
||||
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
|
||||
],
|
||||
MC_EXTRA: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]"
|
||||
client: "[net.minecraft:client:${MC_VERSION}:extra]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}:extra]"
|
||||
],
|
||||
MC_EXTRA_SHA: [
|
||||
client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'",
|
||||
|
@ -892,7 +892,7 @@ project(':forge') {
|
|||
['slim', 'extra'].each { type ->
|
||||
def name = "download${side.capitalize()}${type.capitalize()}"
|
||||
task "${name}"(type: DownloadMavenArtifact) {
|
||||
artifact = "net.minecraft:${side}:${MC_VERSION}${MC_VERSION == '1.14.4' ? '-stable' : ''}:${type}"
|
||||
artifact = "net.minecraft:${side}:${MC_VERSION}:${type}"
|
||||
}
|
||||
installerJson.dependsOn(name)
|
||||
installerJson.inputs.file(tasks.getByName(name).output)
|
||||
|
@ -945,7 +945,7 @@ project(':forge') {
|
|||
artifacts.each { key, lib ->
|
||||
classpath += "libraries/${lib.downloads.artifact.path} "
|
||||
}
|
||||
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra${MC_VERSION == '1.14.4' ? '-stable' : ''}.jar"
|
||||
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra.jar"
|
||||
|
||||
MANIFESTS.each{ pkg, values ->
|
||||
if (pkg == '/') {
|
||||
|
|
|
@ -79,7 +79,7 @@ public class LibraryFinder {
|
|||
|
||||
static Path[] getMCPaths(final String mcVersion, final String mcpVersion, final String forgeVersion, final String forgeGroup, final String type) {
|
||||
Path srgMcPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "srg", mcVersion+"-"+mcpVersion));
|
||||
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "1.14.4".equals(mcVersion) ? "extra-stable" : "extra", mcVersion));
|
||||
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "extra", mcVersion));
|
||||
Path patchedBinariesPath = findLibsPath().resolve(MavenCoordinateResolver.get(forgeGroup, "forge", "", type, mcVersion+"-"+forgeVersion));
|
||||
LOGGER.debug(CORE,"SRG MC at {} is {}", srgMcPath.toString(), pathStatus(srgMcPath));
|
||||
LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));
|
||||
|
|
|
@ -116,7 +116,7 @@ import net.minecraft.world.ILightReader;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.DrawHighlightEvent;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
@ -164,12 +164,12 @@ public class ForgeHooksClient
|
|||
switch (target.getType()) {
|
||||
case BLOCK:
|
||||
if (!(target instanceof BlockRayTraceResult)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent.HighlightBlock(context, info, target, subID, partialTicks));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightBlock(context, info, target, subID, partialTicks));
|
||||
case ENTITY:
|
||||
if (!(target instanceof EntityRayTraceResult)) return false;
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent.HighlightEntity(context, info, target, subID, partialTicks));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightEntity(context, info, target, subID, partialTicks));
|
||||
}
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, info, target, subID, partialTicks));
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, subID, partialTicks));
|
||||
}
|
||||
|
||||
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks)
|
||||
|
|
|
@ -31,9 +31,8 @@ import net.minecraft.client.renderer.WorldRenderer;
|
|||
* An event called whenever the selection highlight around blocks is about to be rendered.
|
||||
* Canceling this event stops the selection highlight from being rendered.
|
||||
*/
|
||||
//TODO: in 1.15 rename to DrawHighlightEvent
|
||||
@Cancelable
|
||||
public class DrawBlockHighlightEvent extends Event
|
||||
public class DrawHighlightEvent extends Event
|
||||
{
|
||||
private final WorldRenderer context;
|
||||
private final ActiveRenderInfo info;
|
||||
|
@ -41,7 +40,7 @@ public class DrawBlockHighlightEvent extends Event
|
|||
private final int subID;
|
||||
private final float partialTicks;
|
||||
|
||||
public DrawBlockHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
public DrawHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
{
|
||||
this.context = context;
|
||||
this.info = info;
|
||||
|
@ -60,7 +59,7 @@ public class DrawBlockHighlightEvent extends Event
|
|||
* A variant of the DrawBlockHighlightEvent only called when a block is highlighted.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class HighlightBlock extends DrawBlockHighlightEvent
|
||||
public static class HighlightBlock extends DrawHighlightEvent
|
||||
{
|
||||
public HighlightBlock(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
{
|
||||
|
@ -79,7 +78,7 @@ public class DrawBlockHighlightEvent extends Event
|
|||
* Canceling this event has no effect.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class HighlightEntity extends DrawBlockHighlightEvent
|
||||
public static class HighlightEntity extends DrawHighlightEvent
|
||||
{
|
||||
public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
|
||||
{
|
|
@ -48,7 +48,7 @@ import net.minecraft.world.storage.WorldInfo;
|
|||
import net.minecraftforge.common.crafting.CompoundIngredient;
|
||||
import net.minecraftforge.common.crafting.ConditionalRecipe;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.IngredientNBT;
|
||||
import net.minecraftforge.common.crafting.NBTIngredient;
|
||||
import net.minecraftforge.common.crafting.VanillaIngredientSerializer;
|
||||
import net.minecraftforge.common.crafting.conditions.AndCondition;
|
||||
import net.minecraftforge.common.crafting.conditions.FalseCondition;
|
||||
|
@ -190,7 +190,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
|||
CraftingHelper.register(TagEmptyCondition.Serializer.INSTANCE);
|
||||
|
||||
CraftingHelper.register(new ResourceLocation("forge", "compound"), CompoundIngredient.Serializer.INSTANCE);
|
||||
CraftingHelper.register(new ResourceLocation("forge", "nbt"), IngredientNBT.Serializer.INSTANCE);
|
||||
CraftingHelper.register(new ResourceLocation("forge", "nbt"), NBTIngredient.Serializer.INSTANCE);
|
||||
CraftingHelper.register(new ResourceLocation("minecraft", "item"), VanillaIngredientSerializer.INSTANCE);
|
||||
|
||||
event.getRegistry().register(new ConditionalRecipe.Serializer<IRecipe<?>>().setRegistryName(new ResourceLocation("forge", "conditional")));
|
||||
|
|
|
@ -30,11 +30,10 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
//TODO: 1.15 Rename to NBTIngredient to match naming.
|
||||
public class IngredientNBT extends Ingredient
|
||||
public class NBTIngredient extends Ingredient
|
||||
{
|
||||
private final ItemStack stack;
|
||||
protected IngredientNBT(ItemStack stack)
|
||||
protected NBTIngredient(ItemStack stack)
|
||||
{
|
||||
super(Stream.of(new Ingredient.SingleItemList(stack)));
|
||||
this.stack = stack;
|
||||
|
@ -73,22 +72,22 @@ public class IngredientNBT extends Ingredient
|
|||
return json;
|
||||
}
|
||||
|
||||
public static class Serializer implements IIngredientSerializer<IngredientNBT>
|
||||
public static class Serializer implements IIngredientSerializer<NBTIngredient>
|
||||
{
|
||||
public static final Serializer INSTANCE = new Serializer();
|
||||
|
||||
@Override
|
||||
public IngredientNBT parse(PacketBuffer buffer) {
|
||||
return new IngredientNBT(buffer.readItemStack());
|
||||
public NBTIngredient parse(PacketBuffer buffer) {
|
||||
return new NBTIngredient(buffer.readItemStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IngredientNBT parse(JsonObject json) {
|
||||
return new IngredientNBT(CraftingHelper.getItemStack(json, true));
|
||||
public NBTIngredient parse(JsonObject json) {
|
||||
return new NBTIngredient(CraftingHelper.getItemStack(json, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(PacketBuffer buffer, IngredientNBT ingredient) {
|
||||
public void write(PacketBuffer buffer, NBTIngredient ingredient) {
|
||||
buffer.writeItemStack(ingredient.stack);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue