Skip to content

Commit

Permalink
Fix unintended upgrading of Draconic Modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
LXGaming committed Apr 22, 2023
1 parent 49c9dc5 commit 44b27eb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@
@ConfigSerializable
public class TinkersEvolutionMixinCategory {

@Mapping(value = "tconevo.trait.draconicevolution.TraitEvolvedMixin", dependencies = "tconevo")
@Setting(value = "draconic-upgrade", comment = "If 'true', fixes unintended upgrading of Draconic Modifiers")
private boolean draconicUpgrade = false;

@Mapping(value = "tconevo.integration.redstonerepository.RedstoneRepositoryHooksImplMixin", dependencies = "tconevo")
@Setting(value = "redstone-repository", comment = "If 'true', fixes NoClassDefFoundError with Redstone Repository")
private boolean redstoneRepository = false;

public boolean isDraconicUpgrade() {
return draconicUpgrade;
}

public boolean isRedstoneRepository() {
return redstoneRepository;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2023 Alex Thomson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lxgaming.sledgehammer.mixin.tconevo.trait.draconicevolution;

import net.minecraft.nbt.NBTTagCompound;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import slimeknights.tconstruct.library.utils.TinkerUtil;
import xyz.phanta.tconevo.trait.draconicevolution.ModifierDraconic;
import xyz.phanta.tconevo.trait.draconicevolution.TraitEvolved;

@Mixin(value = TraitEvolved.class, remap = false)
public abstract class TraitEvolvedMixin {

@Redirect(
method = "applyEffect",
at = @At(
value = "INVOKE",
target = "Lxyz/phanta/tconevo/trait/draconicevolution/ModifierDraconic;apply(Lnet/minecraft/nbt/NBTTagCompound;)V"
)
)
private void onApply(ModifierDraconic mod, NBTTagCompound rootCompound, NBTTagCompound modifierTag) {
if (!TinkerUtil.hasTrait(rootCompound, mod.identifier)) {
mod.apply(rootCompound);
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/mixins.sledgehammer.tconevo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8",
"mixins": [
"integration.redstonerepository.RedstoneRepositoryHooksImplMixin"
"integration.redstonerepository.RedstoneRepositoryHooksImplMixin",
"trait.draconicevolution.TraitEvolvedMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 44b27eb

Please sign in to comment.