Skip to content

Commit

Permalink
Merge pull request #382 from IcarussOne/main
Browse files Browse the repository at this point in the history
Untipped Arrow Particles Bugfix
  • Loading branch information
ACGaming authored Feb 25, 2024
2 parents 611cec2 + 96677a4 commit 6c4114e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
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"]
}

0 comments on commit 6c4114e

Please sign in to comment.