Try to fix #1 and update dependencies and remove some unwanted code

This commit is contained in:
Reo committed 2020-06-25 23:51:16 -07:00
1 parent 8c0cdc03b9
commit 3371c86083
13 files changed
+47 -47

No files matched your search

+15 -7
View File
@@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.15.2-2.0.4'
version = '1.15.2-2.0.5'
group = 'invtweaks' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'invtweaks'
@@ -25,7 +25,7 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20200611-1.15.1'
mappings channel: 'snapshot', version: '20200625-1.15.1'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
@@ -87,8 +87,14 @@ minecraft {
repositories {
maven {
name 'DVS1 Maven FS'
url 'https://dvs1.progwml6.com/files/maven'
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
}
@@ -115,9 +121,11 @@ dependencies {
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
compileOnly fg.deobf('mezz.jei:jei-1.15.2:6.0.0.2:api')
runtimeOnly fg.deobf('mezz.jei:jei-1.15.2:6.0.0.2')
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
}
task sourcesJar(type: Jar, dependsOn: classes) {
+3 -1
View File
@@ -1,4 +1,6 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=false
mc_version=1.15.2
jei_version=6.0.2.12
+3 -2
View File
@@ -1,5 +1,6 @@
#Thu Jun 25 23:09:44 PDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
-8
View File
@@ -1,8 +0,0 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Dec 28 07:40:14 EST 2019
sdk.dir=/Users/phuong/Library/Android/sdk
+7 -6
View File
@@ -207,7 +207,7 @@ public class InvTweaksMod {
.get(contClass);
if (!(event.getGui() instanceof DisplayEffectsScreen) && !Optional.ofNullable(override)
.filter(or -> or.isSortDisabled())
.filter(InvTweaksConfig.ContOverride::isSortDisabled)
.isPresent()) {
int x = InvTweaksConfig.NO_POS_OVERRIDE, y = InvTweaksConfig.NO_POS_OVERRIDE;
if (override != null) {
@@ -257,8 +257,8 @@ public class InvTweaksMod {
.thenComparingInt(s -> -s.yPos)).orElse(null);
}
private Map<PlayerEntity, EnumMap<Hand, Item>> itemsCache = new WeakHashMap<>();
private Map<PlayerEntity, Object2IntMap<Item>> usedCache = new WeakHashMap<>();
private final Map<PlayerEntity, EnumMap<Hand, Item>> itemsCache = new WeakHashMap<>();
private final Map<PlayerEntity, Object2IntMap<Item>> usedCache = new WeakHashMap<>();
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
@@ -401,7 +401,8 @@ public class InvTweaksMod {
.map(IntArrayList::new) // prevent modification
.orElseGet(IntArrayList::new);
frozen.sort(null);
assert ent != null;
if (Collections.binarySearch(frozen, ent.inventory.currentItem) >= 0) {
return;
}
@@ -417,9 +418,9 @@ public class InvTweaksMod {
}
int itemCount = IntStream.range(0, ent.inventory.mainInventory.size())
.filter(idx -> Collections.binarySearch(frozen, idx) < 0)
.mapToObj(idx -> ent.inventory.mainInventory.get(idx))
.mapToObj(ent.inventory.mainInventory::get)
.filter(st -> ItemHandlerHelper.canItemStacksStack(st, ent.getHeldItemMainhand()))
.mapToInt(st -> st.getCount())
.mapToInt(ItemStack::getCount)
.sum();
if (itemCount > ent.getHeldItemMainhand().getCount()) {
ItemStack toRender = ent.getHeldItemMainhand().copy();
@@ -33,15 +33,15 @@ import net.minecraftforge.fml.config.*;
public class InvTweaksConfig {
public static final ForgeConfigSpec CLIENT_CONFIG;
private static ForgeConfigSpec.ConfigValue<List<? extends UnmodifiableConfig>> CATS;
private static final ForgeConfigSpec.ConfigValue<List<? extends UnmodifiableConfig>> CATS;
private static ForgeConfigSpec.ConfigValue<List<? extends String>> RULES;
private static final ForgeConfigSpec.ConfigValue<List<? extends String>> RULES;
private static ForgeConfigSpec.BooleanValue ENABLE_AUTOREFILL;
private static final ForgeConfigSpec.BooleanValue ENABLE_AUTOREFILL;
private static ForgeConfigSpec.IntValue ENABLE_SORT;
private static final ForgeConfigSpec.IntValue ENABLE_SORT;
private static ForgeConfigSpec.IntValue ENABLE_BUTTONS;
private static final ForgeConfigSpec.IntValue ENABLE_BUTTONS;
/**
* Sentinel to indicate that the GUI position should be left alone.
@@ -53,7 +53,7 @@ public class InvTweaksConfig {
// containerClass
// x, y
// sortRange
private static ForgeConfigSpec.ConfigValue<List<? extends UnmodifiableConfig>> CONT_OVERRIDES;
private static final ForgeConfigSpec.ConfigValue<List<? extends UnmodifiableConfig>> CONT_OVERRIDES;
public static final Map<String, Category> DEFAULT_CATS = ImmutableMap.<String, Category>builder()
.put("sword", new Category("/instanceof:net.minecraft.item.SwordItem"))
@@ -67,7 +67,7 @@ public class InvTweaksConfig {
Items.POISONOUS_POTATO.getRegistryName(),
Items.PUFFERFISH.getRegistryName())
))
.put("torch", new Category(Items.TORCH.getRegistryName().toString()))
.put("torch", new Category(Objects.requireNonNull(Items.TORCH.getRegistryName()).toString()))
.put("cheapBlocks", new Category("/tag:forge:cobblestone", "/tag:forge:dirt"))
.put("blocks", new Category("/instanceof:net.minecraft.item.BlockItem"))
.build();
@@ -8,8 +8,9 @@ import net.minecraftforge.fml.client.gui.*;
import net.minecraftforge.fml.client.gui.widget.*;
public class InvTweaksButton extends ExtendedButton {
private ResourceLocation tex;
private int tx, ty;
private final ResourceLocation tex;
private final int tx;
private final int ty;
protected static final ResourceLocation BUTTON_SPRITES = new ResourceLocation(InvTweaksMod.MODID, "textures/gui/button_sprites.png");
@@ -31,7 +32,6 @@ public class InvTweaksButton extends ExtendedButton {
throw new RuntimeException(e);
}*/
if (visible) {
//System.out.println("Meh!");
mc.textureManager.bindTexture(tex);
GuiUtils.drawTexturedModalRect(
x, y, tx, ty,
@@ -3,14 +3,11 @@ package invtweaks.gui;
import invtweaks.*;
public class InvTweaksButtonSort extends InvTweaksButton {
@SuppressWarnings("unused")
private boolean isPlayer;
public InvTweaksButtonSort(int x, int y, boolean isPlayer) {
super(x, y, 0, 0, BUTTON_SPRITES, btn -> {
InvTweaksMod.requestSort(isPlayer);
});
this.isPlayer = isPlayer;
}
}
@@ -7,7 +7,7 @@ import net.minecraft.network.*;
import net.minecraftforge.fml.network.*;
public class PacketSortInv {
private boolean isPlayer;
private final boolean isPlayer;
public PacketSortInv(boolean isPlayer) { this.isPlayer = isPlayer; }
public PacketSortInv(PacketBuffer buf) {
@@ -56,10 +56,10 @@ public class PacketUpdateConfig {
public void handle(Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> {
InvTweaksConfig.setPlayerCats(ctx.get().getSender(), InvTweaksConfig.cfgToCompiledCats(cats));
InvTweaksConfig.setPlayerRules(ctx.get().getSender(), new InvTweaksConfig.Ruleset(rules));
InvTweaksConfig.setPlayerCats(Objects.requireNonNull(ctx.get().getSender()), InvTweaksConfig.cfgToCompiledCats(cats));
InvTweaksConfig.setPlayerRules(Objects.requireNonNull(ctx.get().getSender()), new InvTweaksConfig.Ruleset(rules));
InvTweaksConfig.setPlayerAutoRefill(ctx.get().getSender(), autoRefill);
InvTweaksConfig.setPlayerContOverrides(ctx.get().getSender(), InvTweaksConfig.cfgToCompiledContOverrides(contOverrides));
InvTweaksConfig.setPlayerContOverrides(Objects.requireNonNull(ctx.get().getSender()), InvTweaksConfig.cfgToCompiledContOverrides(contOverrides));
//InvTweaksMod.LOGGER.info("Received config from client!");
});
ctx.get().setPacketHandled(true);
+5 -6
View File
@@ -16,21 +16,20 @@ modId="invtweaks" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${version}" #mandatory
# A display name for the mod
displayName="Inventory Tweaks Reborn" #mandatory
displayName="Inventory Tweaks Renewed" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
# updateJSONURL="http://myurl.me/" #TODO add?
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="https://www.curseforge.com/minecraft/mc-mods/it-reborn"
displayURL="https://www.curseforge.com/minecraft/mc-mods/inventory-tweaks-renewed"
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="logo.png"
# A text field displayed in the mod UI
credits="JimeoWan for being the original creator of this mod, and Kobata for maintaining it until 1.12.2"
credits="JimeoWan, Kobata"
# A text field displayed in the mod UI
authors="Landmaster (phuong0429)"
authors="Yuitakaa(Maintainer), Landmaster (Original Author)"
# The description text for the mod (multi line!) (#mandatory)
description='''
Sick and tired of inventory clutter? Then this mod is for you!
Customizable sorting + fast tool swaps
Inventory Tweaks, but for modern versions of Minecraft.
'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.invtweaks]] #optional
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.