Some code cleanup for 1.15 (#6362)

This commit is contained in:
ichttt 2019-12-19 05:39:41 +01:00 committed by LexManos
parent 30b530836a
commit 747cb0f151
7 changed files with 26 additions and 27 deletions

View File

@ -35,4 +35,5 @@ branches:
- 1.13-pre - 1.13-pre
- 1.13.x - 1.13.x
- 1.14.x - 1.14.x
- 1.15.x
- /^noci-.*$/ - /^noci-.*$/

View File

@ -795,16 +795,16 @@ project(':forge') {
server: '/data/server.lzma' server: '/data/server.lzma'
], ],
MC_SLIM: [ MC_SLIM: [
client: "[net.minecraft:client:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]", client: "[net.minecraft:client:${MC_VERSION}:slim]",
server: "[net.minecraft:server:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]" server: "[net.minecraft:server:${MC_VERSION}:slim]"
], ],
MC_SLIM_SHA: [ MC_SLIM_SHA: [
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'", client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'",
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'" server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
], ],
MC_EXTRA: [ MC_EXTRA: [
client: "[net.minecraft:client:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]", client: "[net.minecraft:client:${MC_VERSION}:extra]",
server: "[net.minecraft:server:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]" server: "[net.minecraft:server:${MC_VERSION}:extra]"
], ],
MC_EXTRA_SHA: [ MC_EXTRA_SHA: [
client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'", client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'",
@ -892,7 +892,7 @@ project(':forge') {
['slim', 'extra'].each { type -> ['slim', 'extra'].each { type ->
def name = "download${side.capitalize()}${type.capitalize()}" def name = "download${side.capitalize()}${type.capitalize()}"
task "${name}"(type: DownloadMavenArtifact) { 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.dependsOn(name)
installerJson.inputs.file(tasks.getByName(name).output) installerJson.inputs.file(tasks.getByName(name).output)
@ -945,7 +945,7 @@ project(':forge') {
artifacts.each { key, lib -> artifacts.each { key, lib ->
classpath += "libraries/${lib.downloads.artifact.path} " 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 -> MANIFESTS.each{ pkg, values ->
if (pkg == '/') { if (pkg == '/') {

View File

@ -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) { 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 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)); 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,"SRG MC at {} is {}", srgMcPath.toString(), pathStatus(srgMcPath));
LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath)); LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));

View File

@ -116,7 +116,7 @@ import net.minecraft.world.ILightReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraftforge.client.event.ColorHandlerEvent; 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.EntityViewRenderEvent;
import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.GuiScreenEvent;
@ -164,12 +164,12 @@ public class ForgeHooksClient
switch (target.getType()) { switch (target.getType()) {
case BLOCK: case BLOCK:
if (!(target instanceof BlockRayTraceResult)) return false; 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: case ENTITY:
if (!(target instanceof EntityRayTraceResult)) return false; 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) public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks)

View File

@ -31,9 +31,8 @@ import net.minecraft.client.renderer.WorldRenderer;
* An event called whenever the selection highlight around blocks is about to be rendered. * An event called whenever the selection highlight around blocks is about to be rendered.
* Canceling this event stops the selection highlight from being rendered. * Canceling this event stops the selection highlight from being rendered.
*/ */
//TODO: in 1.15 rename to DrawHighlightEvent
@Cancelable @Cancelable
public class DrawBlockHighlightEvent extends Event public class DrawHighlightEvent extends Event
{ {
private final WorldRenderer context; private final WorldRenderer context;
private final ActiveRenderInfo info; private final ActiveRenderInfo info;
@ -41,7 +40,7 @@ public class DrawBlockHighlightEvent extends Event
private final int subID; private final int subID;
private final float partialTicks; 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.context = context;
this.info = info; this.info = info;
@ -60,7 +59,7 @@ public class DrawBlockHighlightEvent extends Event
* A variant of the DrawBlockHighlightEvent only called when a block is highlighted. * A variant of the DrawBlockHighlightEvent only called when a block is highlighted.
*/ */
@Cancelable @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) 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. * Canceling this event has no effect.
*/ */
@Cancelable @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) public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
{ {

View File

@ -48,7 +48,7 @@ import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.crafting.CompoundIngredient; import net.minecraftforge.common.crafting.CompoundIngredient;
import net.minecraftforge.common.crafting.ConditionalRecipe; import net.minecraftforge.common.crafting.ConditionalRecipe;
import net.minecraftforge.common.crafting.CraftingHelper; 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.VanillaIngredientSerializer;
import net.minecraftforge.common.crafting.conditions.AndCondition; import net.minecraftforge.common.crafting.conditions.AndCondition;
import net.minecraftforge.common.crafting.conditions.FalseCondition; import net.minecraftforge.common.crafting.conditions.FalseCondition;
@ -190,7 +190,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
CraftingHelper.register(TagEmptyCondition.Serializer.INSTANCE); CraftingHelper.register(TagEmptyCondition.Serializer.INSTANCE);
CraftingHelper.register(new ResourceLocation("forge", "compound"), CompoundIngredient.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); CraftingHelper.register(new ResourceLocation("minecraft", "item"), VanillaIngredientSerializer.INSTANCE);
event.getRegistry().register(new ConditionalRecipe.Serializer<IRecipe<?>>().setRegistryName(new ResourceLocation("forge", "conditional"))); event.getRegistry().register(new ConditionalRecipe.Serializer<IRecipe<?>>().setRegistryName(new ResourceLocation("forge", "conditional")));

View File

@ -30,11 +30,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
//TODO: 1.15 Rename to NBTIngredient to match naming. public class NBTIngredient extends Ingredient
public class IngredientNBT extends Ingredient
{ {
private final ItemStack stack; private final ItemStack stack;
protected IngredientNBT(ItemStack stack) protected NBTIngredient(ItemStack stack)
{ {
super(Stream.of(new Ingredient.SingleItemList(stack))); super(Stream.of(new Ingredient.SingleItemList(stack)));
this.stack = stack; this.stack = stack;
@ -73,22 +72,22 @@ public class IngredientNBT extends Ingredient
return json; return json;
} }
public static class Serializer implements IIngredientSerializer<IngredientNBT> public static class Serializer implements IIngredientSerializer<NBTIngredient>
{ {
public static final Serializer INSTANCE = new Serializer(); public static final Serializer INSTANCE = new Serializer();
@Override @Override
public IngredientNBT parse(PacketBuffer buffer) { public NBTIngredient parse(PacketBuffer buffer) {
return new IngredientNBT(buffer.readItemStack()); return new NBTIngredient(buffer.readItemStack());
} }
@Override @Override
public IngredientNBT parse(JsonObject json) { public NBTIngredient parse(JsonObject json) {
return new IngredientNBT(CraftingHelper.getItemStack(json, true)); return new NBTIngredient(CraftingHelper.getItemStack(json, true));
} }
@Override @Override
public void write(PacketBuffer buffer, IngredientNBT ingredient) { public void write(PacketBuffer buffer, NBTIngredient ingredient) {
buffer.writeItemStack(ingredient.stack); buffer.writeItemStack(ingredient.stack);
} }
} }