Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# v1.2.1
## Tinkers' Construct Integration
- Traits are automatically assigned from GT material properties (no hardcoded material lists):
- Holy (TiC built-in, Silver-bearing alloys), Heat Resistant (blast temp ≥ 2500 K), Cryogenic (vacuum-freezer processed, blast temp 1750–2499 K),
Anti-Corrosion (non-unbreakable, durability ≥ 2000), Heavy Blow (attack ≥ 10), Magnetic (TiC built-in, GT isMagnetic), Unbreakable (GT isUnbreakable)
- GT ToolProperty enchantments are automatically applied to TiC parts as traits.
- Harvest levels beyond Cobalt (GT level 5+) are now registered as distinct TiC harvest levels.
- Arrow Shaft stats are now registered; GT bolt items are supported as TiC part items.
- If a GT material shares a name with an existing TiC material (e.g. Flint, Diamond), stats are merged by taking the better value per stat.
- Custom trait tooltips follow TiC's native display format (italic flavor text + effect description).

* * *

# v1.2.0
## New: Tinkers' Construct Integration
- CEu tool materials are now registered as TiC materials with Head, Handle, Extra, and Bow stats.
Expand All @@ -7,11 +20,13 @@
* * *

# v1.1.2
## Better Builder's Wands Integration
- Fix BBW block preview showing on all GT tools.

* * *

# v1.1.1
## Chisel Integration
- Fix aluminum recipe conflicts with Chisel.

* * *
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@ This mod is an add-on for GregTech CEu that provides integration with various mo

### Tinkers' Construct Integration
- CEu tool materials are automatically registered as Tinkers' Construct materials
- Supports Head, Handle, Extra, and Bow stats derived from GT material properties
- Supports Head, Handle, Extra, Bow, and Arrow Shaft stats derived from GT material properties
- Material names are inherited from CEu's localization
- Molten fluid and smeltery casting/melting support for CEu materials with fluid properties
- GT bolt items are registered as TiC part items for Arrow Shaft crafting
- Traits are automatically assigned from GT material properties (no hardcoded material lists):
- **Holy** (TiC built-in) - Silver-bearing alloys deal bonus damage to undead
- **Heat Resistant** - Materials processed at blast temp ≥ 2500 K gain +30% mining speed in the Nether
- **Cryogenic** - Vacuum-freezer processed materials (blast temp 1750–2499 K) apply Slowness on hit
- **Anti-Corrosion** - High-durability alloys (≥ 2000) have 15% chance to negate durability loss
- **Heavy Blow** - High-attack materials (≥ 10 dmg) deal increased knockback
- **Magnetic** (TiC built-in) - Mirrors GT's isMagnetic flag; mined items go directly into inventory
- **Unbreakable** - Mirrors GT's isUnbreakable flag; tool never loses durability
- GT ToolProperty enchantments (e.g. Fortune, Looting) are automatically applied to TiC parts as traits
- Harvest levels beyond Cobalt are registered dynamically for GT materials with harvest level 5+
- If a GT material shares a name with an existing TiC material (e.g. Flint, Diamond), stats are merged by taking the better value per stat rather than skipping the material


## Credits
Expand Down
294 changes: 238 additions & 56 deletions src/main/java/com/github/gtexpert/gtmt/integration/tic/TiCMaterials.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.enchantment.Enchantment;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* Registry for all GTMT custom TiC traits.
*
* <p>
* Static traits are auto-registered with {@code TinkerRegistry} on class initialisation.
* Their display names and descriptions live in the mod's lang files
* ({@code assets/gtmt/lang/}) under {@code modifier.<id>.name} / {@code modifier.<id>.desc}.
*
* <p>
* Note: undead bonus-damage is handled by TiC's built-in {@code TinkerTraits#holy};
* this class only defines traits that have no TiC equivalent.
*
* <p>
* Dynamic enchantment traits are created on demand via
* {@link #getOrCreateEnchantmentTrait(Enchantment, int)} and their translations are injected
* at runtime because the set of enchantments is not known at compile time.
*/
public final class GTMTTraits {

/** Mining speed +30 % in the Nether — blast temperature ≥ 2500 K. */
public static final AbstractTrait HEAT_RESISTANT = new TraitHeatResistant();

/** 15 % chance to negate durability loss — non-unbreakable materials with durability ≥ 2000. */
public static final AbstractTrait ANTI_CORROSION = new TraitAntiCorrosion();

/** Applies Slowness on hit — blast temperature in [1750, 2500) K (vacuum-freezer processed). */
public static final AbstractTrait CRYOGENIC = new TraitCryogenic();

/** Knockback +50 % — materials with attack damage ≥ 10. */
public static final AbstractTrait HEAVY_BLOW = new TraitHeavyBlow();

/** Zero durability loss — GT {@code isUnbreakable} flag. */
public static final AbstractTrait UNBREAKABLE = new TraitUnbreakable();

private static final Map<String, AbstractTrait> enchantmentTraitCache = new HashMap<>();

private GTMTTraits() {}

/**
* Returns a TiC trait that applies the given vanilla enchantment to tools.
* Instances are cached by {@code "<enchantment>_<level>"} to avoid duplicate
* registrations with {@code TinkerRegistry}.
* Display name and description are provided directly by {@link TraitEnchantment}
* via its overridden {@code getLocalizedName()} / {@code getLocalizedDesc()} methods.
*/
public static AbstractTrait getOrCreateEnchantmentTrait(Enchantment enchantment, int level) {
String id = "gtmt_ench_" + enchantment.getRegistryName().getPath() +
(level > 1 ? "_" + level : "");
return enchantmentTraitCache.computeIfAbsent(id, k -> {
int color = enchantment.type != null ? enchantment.type.ordinal() * 0x112233 + 0x4488BB : 0xFFD700;
return new TraitEnchantment(id, color, enchantment, level);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* Each durability-damage event has a {@value #NEGATE_CHANCE} (15 %) chance of being negated entirely.
*
* <p>
* Assigned to non-unbreakable materials with a tool durability ≥ 2000.
*/
public class TraitAntiCorrosion extends AbstractTrait {

private static final float NEGATE_CHANCE = 0.15f;

public TraitAntiCorrosion() {
super("gtmt_anti_corrosion", 0x00CED1);
}

@Override
public int onToolDamage(ItemStack tool, int damage, int newDamage, EntityLivingBase entity) {
if (random.nextFloat() < NEGATE_CHANCE) {
newDamage = 0;
}
return super.onToolDamage(tool, damage, newDamage, entity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* Applies Slowness I for 2 seconds to the target on a successful hit.
*
* <p>
* Assigned to materials with a blast furnace temperature in [1750, 2500) K
* (i.e. those that require vacuum-freezer processing).
*/
public class TraitCryogenic extends AbstractTrait {

public TraitCryogenic() {
super("gtmt_cryogenic", 0x7EC8E3);
}

@Override
public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target,
float damageDealt, boolean wasCritical, boolean wasHit) {
if (wasHit && target.isEntityAlive()) {
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 40, 0));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.text.translation.I18n;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* A generic TiC trait that bakes a vanilla enchantment into the tool's NBT.
*
* <p>
* Instances are created dynamically from a GT material's
* {@code ToolProperty} enchantment map and cached in {@link GTMTTraits}.
* If the same enchantment is already present at a higher level it is left unchanged;
* if it is present at a lower level the level is upgraded.
*/
public class TraitEnchantment extends AbstractTrait {

private final Enchantment enchantment;
private final int level;

public TraitEnchantment(String identifier, int color, Enchantment enchantment, int level) {
super(identifier, color);
this.enchantment = enchantment;
this.level = level;
}

@Override
public String getLocalizedName() {
return enchantment.getTranslatedName(level);
}

@Override
public String getLocalizedDesc() {
// §o%s§r\n<desc> — the %s is replaced with the enchantment name (italic, material-colored)
return I18n.translateToLocalFormatted("gtmt.trait.ench.desc", enchantment.getTranslatedName(level));
}

@Override
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
super.applyEffect(rootCompound, modifierTag);

NBTTagList enchList = rootCompound.getTagList("ench", 10);
int enchId = Enchantment.getEnchantmentID(enchantment);

// Check if this enchantment is already present
for (int i = 0; i < enchList.tagCount(); i++) {
NBTTagCompound tag = enchList.getCompoundTagAt(i);
if (tag.getShort("id") == enchId) {
// Keep the higher level
if (tag.getShort("lvl") < level) {
tag.setShort("lvl", (short) level);
}
return;
}
}

// Add new enchantment entry
NBTTagCompound enchTag = new NBTTagCompound();
enchTag.setShort("id", (short) enchId);
enchTag.setShort("lvl", (short) level);
enchList.appendTag(enchTag);
rootCompound.setTag("ench", enchList);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.PlayerEvent;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* Increases mining speed by {@value #NETHER_SPEED_BONUS} (30 %) while in the Nether (dimension -1).
*
* <p>
* Assigned to materials with a blast furnace temperature ≥ 2500 K.
*/
public class TraitHeatResistant extends AbstractTrait {

private static final float NETHER_SPEED_BONUS = 0.3f;

public TraitHeatResistant() {
super("gtmt_heat_resistant", 0xFF6600);
}

@Override
public void miningSpeed(ItemStack tool, PlayerEvent.BreakSpeed event) {
if (event.getEntityPlayer().world.provider.getDimension() == -1) {
event.setNewSpeed(event.getNewSpeed() * (1.0f + NETHER_SPEED_BONUS));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* Multiplies the base knockback by (1 + {@value #KNOCKBACK_BONUS}), effectively +50 %.
*
* <p>
* Assigned to materials with an attack damage value ≥ 10.
*/
public class TraitHeavyBlow extends AbstractTrait {

private static final float KNOCKBACK_BONUS = 0.5f;

public TraitHeavyBlow() {
super("gtmt_heavy_blow", 0x555555);
}

@Override
public float knockBack(ItemStack tool, EntityLivingBase player, EntityLivingBase target,
float damage, float knockback, float newKnockback, boolean isCritical) {
return super.knockBack(tool, player, target, damage, knockback,
newKnockback + knockback * KNOCKBACK_BONUS, isCritical);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.gtexpert.gtmt.integration.tic.traits;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;

import slimeknights.tconstruct.library.traits.AbstractTrait;

/**
* Overrides every durability-damage event to 0, making the tool truly indestructible.
*
* <p>
* Assigned to GT materials whose {@code ToolProperty#isUnbreakable} flag is set.
*/
public class TraitUnbreakable extends AbstractTrait {

public TraitUnbreakable() {
super("gtmt_unbreakable", 0xFFFFFF);
}

@Override
public int onToolDamage(ItemStack tool, int damage, int newDamage, EntityLivingBase entity) {
return super.onToolDamage(tool, damage, 0, entity);
}
}
13 changes: 13 additions & 0 deletions src/main/resources/assets/gtmt/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,16 @@ gtmt.machine.auto_chisel.uv.tooltip=Your ideal, we will sculpt it/nMaterial in t

# recipemaps
recipemap.auto_chisel.name=Auto Chisel

# Tinkers' Construct integration — custom traits
modifier.gtmt_heat_resistant.name=Heat Resistant
modifier.gtmt_heat_resistant.desc=§oJust getting warmed up§r\nMining speed +30% in the Nether.
modifier.gtmt_anti_corrosion.name=Anti-Corrosion
modifier.gtmt_anti_corrosion.desc=§oNo rust, no rot, no compromise!§r\n15% chance to negate durability loss.
modifier.gtmt_cryogenic.name=Cryogenic
modifier.gtmt_cryogenic.desc=§oChill out!§r\nApplies Slowness on hit.
modifier.gtmt_heavy_blow.name=Heavy Blow
modifier.gtmt_heavy_blow.desc=§oSend them flying!§r\nIncreases knockback by 50%.
modifier.gtmt_unbreakable.name=Unbreakable
modifier.gtmt_unbreakable.desc=§oEternal, Absolute§r\nThis tool will never break.
gtmt.trait.ench.desc=§o%s§r\nApplies this enchantment permanently.
13 changes: 13 additions & 0 deletions src/main/resources/assets/gtmt/lang/ja_jp.lang
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,16 @@ gtmt.machine.auto_chisel.uv.tooltip=あなたの理想、彫刻します/n左が

# recipemaps
recipemap.auto_chisel.name=自動彫刻機

# Tinkers' Construct連携 — カスタムトレイト
modifier.gtmt_heat_resistant.name=耐熱性
modifier.gtmt_heat_resistant.desc=§oこれくらい序の口だ§r\nネザーでの採掘速度が30%上昇する。
modifier.gtmt_anti_corrosion.name=防食性
modifier.gtmt_anti_corrosion.desc=§o錆びない、腐らない!§r\n15%の確率で耐久消費を無効化する。
modifier.gtmt_cryogenic.name=極低温
modifier.gtmt_cryogenic.desc=§o少し冷えるか?§r\n攻撃時、対象へ鈍足を付与する。
modifier.gtmt_heavy_blow.name=重撃
modifier.gtmt_heavy_blow.desc=§oぶっ飛んでいけ!§r\nノックバックが50%増加する。
modifier.gtmt_unbreakable.name=破壊不可
modifier.gtmt_unbreakable.desc=§o永遠に、絶対に§r\nこのツールは耐久を消費しない。
gtmt.trait.ench.desc=§o%s§r\nこのエンチャントを恒久的に付与する。