-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #356 from IcarussOne/main
Batch of Tweaks
- Loading branch information
Showing
11 changed files
with
175 additions
and
0 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
38 changes: 38 additions & 0 deletions
38
...cgaming/universaltweaks/bugfixes/entities/entitylists/mixins/UTEntityTilePistonMixin.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package mod.acgaming.universaltweaks.bugfixes.entities.entitylists.mixin; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.tileentity.TileEntityPiston; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.AxisAlignedBB; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfigBugfixes; | ||
import mod.acgaming.universaltweaks.config.UTConfigGeneral; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.Surrogate; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
// MC-108469 | ||
// https://bugs.mojang.com/browse/MC-108469 | ||
// Courtesy of mrgrim | ||
@Mixin(TileEntityPiston.class) | ||
public abstract class UTEntityTilePistonMixin extends TileEntity | ||
{ | ||
@Inject(method = "moveCollidedEntities", at = @At(value = "INVOKE", target = "Ljava/lang/ThreadLocal;set(Ljava/lang/Object;)V", ordinal = 1, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) | ||
public void utUpdateEntity(float p_184322_1_, CallbackInfo ci, EnumFacing enumfacing, double d0, List list, AxisAlignedBB axisalignedbb, List list1, boolean flag, int i, Entity entity, double d1) | ||
{ | ||
if (UTConfigBugfixes.ENTITIES.utEntityListsToggle) world.updateEntityWithOptionalForce(entity, false); | ||
} | ||
|
||
@Surrogate | ||
public void utUpdateEntity(float p_184322_1_, CallbackInfo ci, EnumFacing enumfacing, double d0, List list, AxisAlignedBB axisalignedbb, List list1, boolean flag, int i, Entity entity, double d1, int quark0) | ||
{ | ||
if (UTConfigBugfixes.ENTITIES.utEntityListsToggle) world.updateEntityWithOptionalForce(entity, false); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
.../java/mod/acgaming/universaltweaks/bugfixes/entities/entitylists/mixins/UTWorldMixin.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package mod.acgaming.universaltweaks.bugfixes.entities.entitylists.mixin; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.world.World; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.AxisAlignedBB; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfigBugfixes; | ||
import mod.acgaming.universaltweaks.config.UTConfigGeneral; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import org.spongepowered.asm.mixin.injection.Slice; | ||
|
||
// MC-108469 | ||
// https://bugs.mojang.com/browse/MC-108469 | ||
// Courtesy of mrgrim | ||
@Mixin(World.class) | ||
public abstract class UTWorldMixin | ||
{ | ||
@Redirect(method = "updateEntityWithOptionalForce", | ||
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getChunk(II)Lnet/minecraft/world/chunk/Chunk;", ordinal = 0), | ||
to = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getChunk(II)Lnet/minecraft/world/chunk/Chunk;", ordinal = 1)), | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPositionNonDirty()Z", ordinal = 0)) | ||
public boolean utAlwaysLoadChunk(Entity entityIn) | ||
{ | ||
if (UTConfigBugfixes.ENTITIES.utEntityListsToggle) | ||
{ | ||
return true; | ||
} else | ||
{ | ||
// Returns false | ||
return entityIn.setPositionNonDirty(); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...cgaming/universaltweaks/bugfixes/world/portalduplicationfixes/UTPortalDuplicationFix.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package mod.acgaming.universaltweaks.bugfixes.world.portalduplicationfixes; | ||
|
||
import org.apache.logging.log4j.Level; | ||
|
||
import net.minecraft.entity.EntityLiving; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraftforge.event.entity.EntityTravelToDimensionEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfigBugfixes; | ||
import mod.acgaming.universaltweaks.config.UTConfigGeneral; | ||
import mod.acgaming.universaltweaks.config.UTConfigTweaks; | ||
|
||
// Courtesy of fonnymunkey | ||
@Mod.EventBusSubscriber(modid = UniversalTweaks.MODID) | ||
public class UTPortalDuplicationFix | ||
{ | ||
@SubscribeEvent | ||
public static void dimensionChangeEvent(EntityTravelToDimensionEvent event) | ||
{ | ||
if (event.getEntity().world.isRemote || !(UTConfigBugfixes.WORLD.utPortalDuplicationFixToggle)) return; | ||
if (event.getEntity() instanceof EntityLiving && !(event.getEntity() instanceof EntityPlayer)) | ||
{ | ||
EntityLiving entity = (EntityLiving) event.getEntity(); | ||
|
||
if (entity.isDead || !entity.isEntityAlive() || entity.getHealth() <= 0) | ||
{ | ||
event.setCanceled(true); | ||
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.log(Level.WARN, "Possible attempted dupe at X: " + entity.posX + " Y: " + entity.posY + " Z: " + entity.posZ + " Entity Name: " + entity.getName()); | ||
} | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...in/java/mod/acgaming/universaltweaks/tweaks/entities/soulboundvexes/UTSoulboundVexes.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package mod.acgaming.universaltweaks.tweaks.entities.soulboundvexes; | ||
|
||
import org.apache.logging.log4j.Level; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.monster.EntityVex; | ||
import net.minecraft.util.DamageSource; | ||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfigBugfixes; | ||
import mod.acgaming.universaltweaks.config.UTConfigGeneral; | ||
import mod.acgaming.universaltweaks.config.UTConfigTweaks; | ||
|
||
@Mod.EventBusSubscriber(modid = UniversalTweaks.MODID) | ||
public class UTSoulboundVexes | ||
{ | ||
@SubscribeEvent | ||
public static void soulboundVexesEvent(LivingUpdateEvent event) | ||
{ | ||
if (!(UTConfigTweaks.ENTITIES.utSoulboundVexesToggle)) return; | ||
|
||
if (event.getEntity() instanceof EntityVex) | ||
{ | ||
Entity summoner = ((EntityVex) event.getEntity()).getOwner(); | ||
|
||
if (summoner != null && summoner.isDead && !(event.getEntity().isDead)) | ||
{ | ||
event.getEntity().attackEntityFrom(DamageSource.GENERIC.setDamageIsAbsolute().setDamageBypassesArmor(), event.getEntityLiving().getMaxHealth()); | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.bugfixes.entities.entitylists.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTEntityTilePistonMixin", "UTWorldMixin"] | ||
} |