-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting mixins sucks. Injected interfaces are neat though
- Loading branch information
1 parent
a9e65c7
commit 8f0be7c
Showing
40 changed files
with
300 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
src/main/java/de/dafuqs/spectrum/api/item/FermentedItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
package de.dafuqs.spectrum.api.item; | ||
|
||
import de.dafuqs.spectrum.registries.*; | ||
import net.minecraft.item.*; | ||
import net.minecraft.nbt.*; | ||
import net.minecraft.util.*; | ||
|
||
public interface FermentedItem { | ||
|
||
static boolean isPreviewStack(ItemStack stack) { | ||
NbtCompound nbtCompound = stack.getNbt(); | ||
return nbtCompound != null && nbtCompound.getBoolean("Preview"); | ||
return stack.contains(SpectrumDataComponentTypes.IS_PREVIEW_ITEM); | ||
} | ||
|
||
static void setPreviewStack(ItemStack stack) { | ||
NbtCompound compound = stack.getOrCreateNbt(); | ||
compound.putBoolean("Preview", true); | ||
stack.setNbt(compound); | ||
stack.set(SpectrumDataComponentTypes.IS_PREVIEW_ITEM, Unit.INSTANCE); | ||
} | ||
|
||
} |
20 changes: 0 additions & 20 deletions
20
src/main/java/de/dafuqs/spectrum/api/status_effect/Incurable.java
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/java/de/dafuqs/spectrum/api/status_effect/IncurablePacketInject.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 12 additions & 9 deletions
21
src/main/java/de/dafuqs/spectrum/mixin/CrossbowItemMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package de.dafuqs.spectrum.mixin; | ||
|
||
import de.dafuqs.spectrum.helpers.SpectrumEnchantmentHelper; | ||
import de.dafuqs.spectrum.*; | ||
import de.dafuqs.spectrum.helpers.*; | ||
import de.dafuqs.spectrum.registries.*; | ||
import net.minecraft.enchantment.*; | ||
import net.minecraft.entity.*; | ||
import net.minecraft.item.*; | ||
import net.minecraft.util.*; | ||
import net.minecraft.world.*; | ||
import org.jetbrains.annotations.*; | ||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.callback.*; | ||
|
||
@Mixin(CrossbowItem.class) | ||
public abstract class CrossbowItemMixin { | ||
|
||
@Inject(method = "getSpeed(Lnet/minecraft/item/ItemStack;)F", at = @At("RETURN"), cancellable = true) | ||
private static void getSpeed(ItemStack stack, CallbackInfoReturnable<Float> cir) { | ||
int snipingLevel = SpectrumEnchantmentHelper.getLevel(drm, SpectrumEnchantments.SNIPING, stack); | ||
if (snipingLevel > 0) { | ||
cir.setReturnValue(cir.getReturnValue() + 1.0F * snipingLevel); | ||
} | ||
@ModifyArg(method = "use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/CrossbowItem;shootAll(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;FFLnet/minecraft/entity/LivingEntity;)V"), index = 4) | ||
private float spectrum$applySnipingSpeed(World world, LivingEntity shooter, Hand hand, ItemStack stack, float speed, float divergence, @Nullable LivingEntity target) { | ||
return SpectrumCommon.getRegistryLookup() | ||
.map(lookup -> SpectrumEnchantmentHelper.getLevel(lookup, SpectrumEnchantments.SNIPING, stack)) | ||
.map(level -> speed * 1.0f * level) | ||
.orElse(speed); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
src/main/java/de/dafuqs/spectrum/mixin/EntityStatusEffectS2CPacketMixin.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.