-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add invis armor stands. add hide item names. add frame sound; Close #7
- Loading branch information
Showing
12 changed files
with
223 additions
and
23 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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/tf/ssf/sfort/invisframes/mixin/FrameName.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,19 @@ | ||
package tf.ssf.sfort.invisframes.mixin; | ||
|
||
import net.minecraft.client.render.entity.ItemFrameEntityRenderer; | ||
import net.minecraft.entity.decoration.ItemFrameEntity; | ||
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.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ItemFrameEntityRenderer.class) | ||
public abstract class FrameName { | ||
@Inject(method="hasLabel(Lnet/minecraft/entity/decoration/ItemFrameEntity;)Z",at=@At("HEAD"), cancellable = true) | ||
public void itemHideName(ItemFrameEntity itemFrameEntity, CallbackInfoReturnable<Boolean> cir) { | ||
if (itemFrameEntity.isInvisible()&&!itemFrameEntity.getHeldItemStack().isEmpty()) { | ||
cir.setReturnValue(false); | ||
cir.cancel(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/tf/ssf/sfort/invisframes/mixin/FrameNameAlways.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,17 @@ | ||
package tf.ssf.sfort.invisframes.mixin; | ||
|
||
import net.minecraft.client.render.entity.ItemFrameEntityRenderer; | ||
import net.minecraft.entity.decoration.ItemFrameEntity; | ||
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.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ItemFrameEntityRenderer.class) | ||
public abstract class FrameNameAlways { | ||
@Inject(method="hasLabel(Lnet/minecraft/entity/decoration/ItemFrameEntity;)Z",at=@At("HEAD"), cancellable = true) | ||
public void itemHideName(ItemFrameEntity itemFrameEntity, CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(false); | ||
cir.cancel(); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/tf/ssf/sfort/invisframes/mixin/StandEntity.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,29 @@ | ||
package tf.ssf.sfort.invisframes.mixin; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.entity.decoration.ArmorStandEntity; | ||
import net.minecraft.world.World; | ||
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.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ArmorStandEntity.class) | ||
public abstract class StandEntity extends LivingEntity { | ||
protected StandEntity(EntityType<? extends LivingEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Inject(method="damage", at=@At("HEAD"), cancellable = true) | ||
public void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> info) { | ||
Entity attacker = source.getAttacker(); | ||
if (attacker !=null && attacker.isSneaky() && (FrameConf.allowStandProjectile || source.getName().equals("player"))) { | ||
this.setInvisible(!this.isInvisible()); | ||
info.setReturnValue(true); | ||
info.cancel(); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/tf/ssf/sfort/invisframes/mixin/StandEntityServer.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,41 @@ | ||
package tf.ssf.sfort.invisframes.mixin; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.entity.decoration.ArmorStandEntity; | ||
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; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ArmorStandEntity.class) | ||
public abstract class StandEntityServer extends LivingEntity { | ||
@Shadow public abstract void setInvisible(boolean invisible); | ||
|
||
protected StandEntityServer(EntityType<? extends LivingEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Inject(method="damage", at=@At("HEAD"), cancellable = true) | ||
public void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> info) { | ||
Entity attacker = source.getAttacker(); | ||
if (attacker !=null && attacker.isSneaky() && (FrameConf.allowStandProjectile || source.getName().equals("player"))) { | ||
this.setInvisible(!(this.isInvisible() || FrameConf.IsEmpty((ArmorStandEntity) (Object) this))); | ||
info.setReturnValue(true); | ||
info.cancel(); | ||
} else { | ||
this.setInvisible(false); | ||
} | ||
} | ||
@Inject(method="equipStack(Lnet/minecraft/entity/EquipmentSlot;Lnet/minecraft/item/ItemStack;)V", at=@At("RETURN")) | ||
public void update(CallbackInfo ci) { | ||
if (FrameConf.IsEmpty((ArmorStandEntity) (Object) this)) { | ||
this.setInvisible(false); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/tf/ssf/sfort/invisframes/mixin/StandRender.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,32 @@ | ||
package tf.ssf.sfort.invisframes.mixin; | ||
|
||
import net.minecraft.client.render.entity.ArmorStandEntityRenderer; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.decoration.ArmorStandEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(ArmorStandEntityRenderer.class) | ||
public abstract class StandRender { | ||
private boolean survivalflight$secondBool = false; | ||
|
||
@ModifyVariable(method="getRenderLayer(Lnet/minecraft/entity/LivingEntity;ZZZ)Lnet/minecraft/client/render/RenderLayer;", at=@At("HEAD"), ordinal=0, argsOnly=true) | ||
public boolean getRenderLayer(boolean old, LivingEntity entity, boolean bl) { | ||
if (entity instanceof ArmorStandEntity) { | ||
if (FrameConf.IsEmpty((ArmorStandEntity) entity)) { | ||
survivalflight$secondBool = false; | ||
return true; | ||
} else { | ||
survivalflight$secondBool = !old; | ||
} | ||
} | ||
return old; | ||
} | ||
@ModifyVariable(method="getRenderLayer(Lnet/minecraft/entity/LivingEntity;ZZZ)Lnet/minecraft/client/render/RenderLayer;", at=@At("HEAD"), ordinal=1, argsOnly=true) | ||
public boolean getRenderLayer2(boolean old, LivingEntity entity, boolean bl) { | ||
if (survivalflight$secondBool) return false; | ||
return old; | ||
} | ||
|
||
} |
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