-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak mixins to bypass mixin bug (???)
- Loading branch information
Showing
9 changed files
with
94 additions
and
41 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
20 changes: 20 additions & 0 deletions
20
...tual-entity/src/main/java/eu/pb4/polymer/virtualentity/api/elements/MobAnchorElement.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,20 @@ | ||
package eu.pb4.polymer.virtualentity.api.elements; | ||
|
||
import eu.pb4.polymer.virtualentity.api.tracker.EntityTrackedData; | ||
import eu.pb4.polymer.virtualentity.mixin.SlimeEntityAccessor; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
|
||
public class MobAnchorElement extends GenericEntityElement { | ||
public MobAnchorElement() { | ||
this.dataTracker.set(SlimeEntityAccessor.getSLIME_SIZE(), 0); | ||
this.dataTracker.set(EntityTrackedData.SILENT, true); | ||
this.dataTracker.set(EntityTrackedData.NO_GRAVITY, true); | ||
this.dataTracker.set(EntityTrackedData.FLAGS, (byte) ((1 << EntityTrackedData.INVISIBLE_FLAG_INDEX))); | ||
} | ||
|
||
@Override | ||
protected EntityType<? extends Entity> getEntityType() { | ||
return EntityType.SLIME; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...er-virtual-entity/src/main/java/eu/pb4/polymer/virtualentity/impl/PacketInterHandler.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,25 @@ | ||
package eu.pb4.polymer.virtualentity.impl; | ||
|
||
import eu.pb4.polymer.virtualentity.api.elements.DisplayElement; | ||
import eu.pb4.polymer.virtualentity.api.elements.VirtualElement; | ||
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.math.Vec3d; | ||
|
||
public record PacketInterHandler(ServerPlayerEntity player, VirtualElement.InteractionHandler interactionHandler) implements PlayerInteractEntityC2SPacket.Handler { | ||
@Override | ||
public void interact(Hand hand) { | ||
interactionHandler.interact(player, hand); | ||
} | ||
|
||
@Override | ||
public void interactAt(Hand hand, Vec3d pos) { | ||
interactionHandler.interactAt(player, hand, pos); | ||
} | ||
|
||
@Override | ||
public void attack() { | ||
interactionHandler.attack(player); | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
...-virtual-entity/src/main/java/eu/pb4/polymer/virtualentity/mixin/SlimeEntityAccessor.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,14 @@ | ||
package eu.pb4.polymer.virtualentity.mixin; | ||
|
||
import net.minecraft.entity.data.TrackedData; | ||
import net.minecraft.entity.mob.SlimeEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(SlimeEntity.class) | ||
public interface SlimeEntityAccessor { | ||
@Accessor | ||
static TrackedData<Integer> getSLIME_SIZE() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
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