mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62a9677326 | ||
|
|
b259785bbc | ||
|
|
d4191557af | ||
|
|
6670fcdb5f |
No files matched your search
+9
-9
@@ -2,19 +2,19 @@
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-402-GTNH:api')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-504-GTNH:api')
|
||||
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.11.1-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.12.1-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.6.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.0:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.12.1-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.22:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.6.4:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.2:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.12.16-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.5.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.1-GTNH:api') {transitive=false}
|
||||
|
||||
compileOnly('curse.maven:computercraft-67504:2269339')
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
|
||||
+15
-4
@@ -50,10 +50,10 @@ enableGenericInjection = false
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass =
|
||||
generateGradleTokenClass = thaumic.tinkerer.Tags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
@@ -70,7 +70,7 @@ gradleTokenGroupName =
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile = LibMisc.java
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
@@ -85,6 +85,11 @@ accessTransformersFile = ThaumicTinkerer_at.cfg
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = true
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = true
|
||||
|
||||
@@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,8 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
Vendored
+2
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,13 @@ public class AspectCropLootManager {
|
||||
|
||||
addAspectLoot(Aspect.ENERGY, new ItemStack(ConfigItems.itemResource, 12));
|
||||
|
||||
addAspectLoot(Aspect.MAGIC, "materialAspectShard");
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 0));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 1));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 2));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 3));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 4));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 5));
|
||||
addAspectLoot(Aspect.MAGIC, new ItemStack(ConfigItems.itemShard, 1, 6));
|
||||
|
||||
addAspectLoot(Aspect.HEAL, new ItemStack(Items.golden_apple));
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -17,9 +16,12 @@ import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.lib.research.PlayerKnowledge;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
@@ -36,7 +38,9 @@ import thaumic.tinkerer.common.research.TTResearchItem;
|
||||
public class ItemShareBook extends ItemBase {
|
||||
|
||||
private static final String TAG_PLAYER = "player";
|
||||
private static final String NON_ASIGNED = "[none]";
|
||||
private static final String TAG_RESEARCH = "research";
|
||||
private static final String TAG_ASPECTS = "aspects";
|
||||
private static final String NON_ASSIGNED = "[none]";
|
||||
|
||||
public ItemShareBook() {
|
||||
super();
|
||||
@@ -83,44 +87,57 @@ public class ItemShareBook extends ItemBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
String name = getPlayerName(par1ItemStack);
|
||||
if (name.endsWith(NON_ASIGNED)) {
|
||||
setPlayerName(par1ItemStack, par3EntityPlayer.getGameProfile().getName());
|
||||
setPlayerResearch(par1ItemStack, par3EntityPlayer.getGameProfile().getName());
|
||||
if (!par2World.isRemote)
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.shareTome.write"));
|
||||
} else sync: {
|
||||
List<String> researchesDone = ResearchManager.getResearchForPlayer(name);
|
||||
|
||||
if (researchesDone == null) {
|
||||
if (par2World.isRemote) researchesDone = getPlayerResearch(par1ItemStack);
|
||||
else {
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.shareTome.sync"));
|
||||
break sync;
|
||||
}
|
||||
public ItemStack onItemRightClick(ItemStack bookStack, World world, EntityPlayer player) {
|
||||
String name = getPlayerName(bookStack);
|
||||
if (name.endsWith(NON_ASSIGNED)) {
|
||||
setPlayerName(bookStack, player.getGameProfile().getName());
|
||||
savePlayerResearch(ItemNBTHelper.getNBT(bookStack), player.getGameProfile().getName());
|
||||
if (!world.isRemote) {
|
||||
player.addChatMessage(new ChatComponentTranslation("ttmisc.shareTome.write"));
|
||||
}
|
||||
} else {
|
||||
// Try to load latest research for the saved player, fall back to the stored NBT if it fails.
|
||||
final NBTTagCompound researchSource;
|
||||
if (ResearchManager.getResearchForPlayer(name) != null) {
|
||||
researchSource = new NBTTagCompound();
|
||||
savePlayerResearch(researchSource, name);
|
||||
} else {
|
||||
researchSource = ItemNBTHelper.getNBT(bookStack);
|
||||
}
|
||||
|
||||
for (String key : researchesDone)
|
||||
ThaumicTinkerer.tcProxy.getResearchManager().completeResearch(par3EntityPlayer, key);
|
||||
loadPlayerResearch(researchSource, player);
|
||||
|
||||
if (!par2World.isRemote)
|
||||
par3EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.shareTome.sync"));
|
||||
if (!world.isRemote) {
|
||||
player.addChatMessage(new ChatComponentTranslation("ttmisc.shareTome.sync"));
|
||||
}
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
return bookStack;
|
||||
}
|
||||
|
||||
private List<String> getPlayerResearch(ItemStack par1ItemStack) {
|
||||
List<String> retVals = new ArrayList<>();
|
||||
NBTTagCompound cmp = ItemNBTHelper.getNBT(par1ItemStack);
|
||||
if (!cmp.hasKey("research")) return retVals;
|
||||
NBTTagList list = cmp.getTagList("research", Constants.NBT.TAG_STRING);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
|
||||
retVals.add(list.getStringTagAt(i));
|
||||
private void loadPlayerResearch(NBTTagCompound cmp, EntityPlayer player) {
|
||||
// Ensure full TC player data gets loaded
|
||||
final String playerName = player.getGameProfile().getName();
|
||||
ResearchManager.getResearchForPlayer(playerName);
|
||||
if (cmp.hasKey(TAG_RESEARCH)) {
|
||||
final NBTTagList list = cmp.getTagList(TAG_RESEARCH, Constants.NBT.TAG_STRING);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
final String research = list.getStringTagAt(i);
|
||||
ThaumicTinkerer.tcProxy.getResearchManager().completeResearch(player, research);
|
||||
}
|
||||
}
|
||||
if (cmp.hasKey(TAG_ASPECTS)) {
|
||||
final PlayerKnowledge pk = ThaumicTinkerer.tcProxy.getPlayerKnowledge();
|
||||
final NBTTagList list = cmp.getTagList(TAG_ASPECTS, Constants.NBT.TAG_STRING);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
final String aspectTag = list.getStringTagAt(i);
|
||||
final Aspect aspect = Aspect.getAspect(aspectTag);
|
||||
if (aspect != null) {
|
||||
pk.addDiscoveredAspect(playerName, aspect);
|
||||
}
|
||||
}
|
||||
ResearchManager.scheduleSave(player);
|
||||
}
|
||||
return retVals;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,7 +151,7 @@ public class ItemShareBook extends ItemBase {
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
String name = getPlayerName(par1ItemStack);
|
||||
par3List.add(
|
||||
name.equals(NON_ASIGNED) ? StatCollector.translateToLocal("ttmisc.shareTome.noAssign")
|
||||
name.equals(NON_ASSIGNED) ? StatCollector.translateToLocal("ttmisc.shareTome.noAssign")
|
||||
: String.format(StatCollector.translateToLocal("ttmisc.shareTome.playerName"), name));
|
||||
}
|
||||
|
||||
@@ -144,21 +161,32 @@ public class ItemShareBook extends ItemBase {
|
||||
}
|
||||
|
||||
private String getPlayerName(ItemStack stack) {
|
||||
return ItemNBTHelper.getString(stack, TAG_PLAYER, NON_ASIGNED);
|
||||
return ItemNBTHelper.getString(stack, TAG_PLAYER, NON_ASSIGNED);
|
||||
}
|
||||
|
||||
private void setPlayerName(ItemStack stack, String playerName) {
|
||||
ItemNBTHelper.setString(stack, TAG_PLAYER, playerName);
|
||||
}
|
||||
|
||||
private void setPlayerResearch(ItemStack stack, String playername) {
|
||||
List<String> researchesDone = ResearchManager.getResearchForPlayer(playername);
|
||||
NBTTagCompound cmp = ItemNBTHelper.getNBT(stack);
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (String tag : researchesDone) {
|
||||
list.appendTag(new NBTTagString(tag));
|
||||
private void savePlayerResearch(NBTTagCompound target, String playername) {
|
||||
// also loads the aspect list
|
||||
final List<String> researchesDone = ResearchManager.getResearchForPlayer(playername);
|
||||
// Save all unlocked research notes.
|
||||
final NBTTagList researchList = new NBTTagList();
|
||||
for (final String tag : researchesDone) {
|
||||
researchList.appendTag(new NBTTagString(tag));
|
||||
}
|
||||
cmp.setTag("research", list);
|
||||
target.setTag(TAG_RESEARCH, researchList);
|
||||
// Save all discovered aspect types.
|
||||
final PlayerKnowledge pk = Thaumcraft.proxy.getPlayerKnowledge();
|
||||
final NBTTagList aspectsToSave = new NBTTagList();
|
||||
final AspectList aspectsDiscovered = pk.getAspectsDiscovered(playername);
|
||||
if (aspectsDiscovered == null) {
|
||||
return;
|
||||
}
|
||||
aspectsDiscovered.aspects.keySet().stream().map(Aspect::getTag).sorted().map(NBTTagString::new)
|
||||
.forEach(aspectsToSave::appendTag);
|
||||
target.setTag(TAG_ASPECTS, aspectsToSave);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
*/
|
||||
package thaumic.tinkerer.common.lib;
|
||||
|
||||
import thaumic.tinkerer.Tags;
|
||||
|
||||
public final class LibMisc {
|
||||
|
||||
public static final String MOD_ID = "ThaumicTinkerer";
|
||||
public static final String MOD_NAME = "Thaumic Tinkerer";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
|
||||
public static final String NETWORK_CHANNEL = MOD_ID;
|
||||
|
||||
|
||||
Reference in new issue
Block a user