Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untipped Arrow Particles Bugfix #382

Merged
merged 2 commits into from
Feb 25, 2024
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ All changes are toggleable via config files.
* **Sleep Resets Weather:** Fixes sleeping always resetting rain and thunder times
* **Spectator Menu:** Fixes the spectator menu not showing player skins
* **Tile Entity Map:** Replaces the chunk position data table to prevent tile entity related issues
* **Untipped Arrow Particles:** Fixes untipped arrows emitting blue tipped arrow particles upon reloading a world
* **Villager Mantle:** Returns missing hoods to villager mantles
* **Witch Huts:** Fixes witch hut structure data not accounting for the height it is generated at

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package mod.acgaming.universaltweaks.bugfixes.entities.arrow.mixin;

import net.minecraft.entity.projectile.EntityTippedArrow;
import net.minecraft.init.PotionTypes;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionType;

import java.util.Set;

import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

// MC-107941
// https://bugs.mojang.com/browse/MC-107941
// Courtesy of fonnymunkey
@Mixin(EntityTippedArrow.class)
public abstract class UTEntityTippedArrowMixin
{
@Shadow
private PotionType potion;
@Shadow
@Final
private Set<PotionEffect> customPotionEffects;

@Redirect(method = "refreshColor", at = @At(value = "INVOKE", target = "Ljava/lang/Integer;valueOf(I)Ljava/lang/Integer;"))
public Integer utTippedArrowRefreshColor(int i)
{
if (UTConfigBugfixes.ENTITIES.utUntippedArrowParticlesToggle && potion == PotionTypes.EMPTY && customPotionEffects.isEmpty()) return -1;
return i;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ public static class EntitiesCategory
@Config.Name("Skeleton Aim")
@Config.Comment("Fixes skeletons not looking at their targets when strafing")
public boolean utSkeletonAimToggle = true;

@Config.RequiresMcRestart
@Config.Name("Untipped Arrow Particles")
@Config.Comment("Fixes untipped arrows emitting blue tipped arrow particles upon reloading a world")
public boolean utUntippedArrowParticlesToggle = true;

@Config.RequiresMcRestart
@Config.Name("Villager Mantle Hoods")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.bugfixes.entities.skeletonaim.json");
configs.add("mixins.bugfixes.entities.suffocation.json");
configs.add("mixins.bugfixes.entities.tracker.json");
configs.add("mixins.bugfixes.entities.untippedarrowparticles.json");
configs.add("mixins.bugfixes.misc.crafteditemstatistics.json");
configs.add("mixins.bugfixes.misc.enchantment.json");
configs.add("mixins.bugfixes.misc.packetsize.json");
Expand Down Expand Up @@ -404,6 +405,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigBugfixes.ENTITIES.utEntitySuffocationToggle;
case "mixins.bugfixes.entities.tracker.json":
return UTConfigBugfixes.ENTITIES.utEntityTrackerToggle && !spongeForgeLoaded;
case "mixins.bugfixes.entities.untippedarrowparticles.json":
return UTConfigBugfixes.ENTITIES.utUntippedArrowParticlesToggle;
case "mixins.bugfixes.world.chunksaving.json":
return UTConfigBugfixes.WORLD.utChunkSavingToggle && !spongeForgeLoaded;
case "mixins.bugfixes.world.tileentities.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.bugfixes.entities.arrow.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTEntityTippedArrowMixin"]
}
Loading