-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to make stands and frames immutable by default
- Loading branch information
1 parent
2b8e888
commit b43e2aa
Showing
5 changed files
with
64 additions
and
4 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
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
27 changes: 27 additions & 0 deletions
27
src/main/java/net/modfest/fireblanket/mixin/entity_immutability/MixinArmorStand.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,27 @@ | ||
package net.modfest.fireblanket.mixin.entity_immutability; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.decoration.ArmorStandEntity; | ||
import net.minecraft.world.World; | ||
import net.modfest.fireblanket.mixinsupport.ImmmovableLivingEntity; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ArmorStandEntity.class) | ||
public class MixinArmorStand { | ||
@Shadow | ||
private int disabledSlots; | ||
|
||
@Inject(method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V", at = @At("RETURN")) | ||
private void onInit(EntityType entityType, World world, CallbackInfo ci) { | ||
// Disable all slots by default | ||
this.disabledSlots = 4144959; | ||
// Disable movement (prevents abuse of fishing rods) | ||
if (this instanceof ImmmovableLivingEntity im) { | ||
im.setNoMovement(true); | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/net/modfest/fireblanket/mixin/entity_immutability/MixinItemFrame.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,21 @@ | ||
package net.modfest.fireblanket.mixin.entity_immutability; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.decoration.ItemFrameEntity; | ||
import net.minecraft.world.World; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ItemFrameEntity.class) | ||
public class MixinItemFrame { | ||
@Shadow | ||
private boolean fixed; | ||
|
||
@Inject(method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V", at = @At("RETURN")) | ||
private void onInit(EntityType entityType, World world, CallbackInfo ci) { | ||
this.fixed = true; | ||
} | ||
} |
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