This commit is contained in:
intricate authored and GitHub committed 2022-02-28 19:45:44 +01:00
1 parent 43f5da90a8
commit 7f4a335c97
5 files changed
+116

No files matched your search

@@ -0,0 +1,28 @@
package carpet.mixins;
import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.vehicle.AbstractMinecart;
import net.minecraft.world.level.Level;
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.CallbackInfo;
@Mixin(AbstractMinecart.class)
public abstract class AbstractMinecart_scarpetEventsMixin extends Entity
{
public AbstractMinecart_scarpetEventsMixin(EntityType<?> type, Level world)
{
super(type, world);
}
@Inject(method = "tick", at = @At("HEAD"))
private void onTickCall(CallbackInfo ci)
{
// calling extra on_tick because falling blocks do not fall back to super tick call
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_TICK);
}
}
@@ -0,0 +1,28 @@
package carpet.mixins;
import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
import net.minecraft.world.level.Level;
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.CallbackInfo;
@Mixin(EndCrystal.class)
public abstract class EndCrystal_scarpetEventsMixin extends Entity
{
public EndCrystal_scarpetEventsMixin(EntityType<?> type, Level world)
{
super(type, world);
}
@Inject(method = "tick", at = @At("HEAD"))
private void onTickCall(CallbackInfo ci)
{
// calling extra on_tick because falling blocks do not fall back to super tick call
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_TICK);
}
}
@@ -0,0 +1,28 @@
package carpet.mixins;
import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.decoration.HangingEntity;
import net.minecraft.world.level.Level;
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.CallbackInfo;
@Mixin(HangingEntity.class)
public abstract class HangingEntity_scarpetEventsMixin extends Entity
{
public HangingEntity_scarpetEventsMixin(EntityType<?> type, Level world)
{
super(type, world);
}
@Inject(method = "tick", at = @At("HEAD"))
private void onTickCall(CallbackInfo ci)
{
// calling extra on_tick because falling blocks do not fall back to super tick call
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_TICK);
}
}
@@ -0,0 +1,28 @@
package carpet.mixins;
import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.item.PrimedTnt;
import net.minecraft.world.level.Level;
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.CallbackInfo;
@Mixin(PrimedTnt.class)
public abstract class PrimedTnt_scarpetEventsMixin extends Entity
{
public PrimedTnt_scarpetEventsMixin(EntityType<?> type, Level world)
{
super(type, world);
}
@Inject(method = "tick", at = @At("HEAD"))
private void onTickCall(CallbackInfo ci)
{
// calling extra on_tick because falling blocks do not fall back to super tick call
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_TICK);
}
}
+4
View File
@@ -147,7 +147,11 @@
"LivingEntity_scarpetEventsMixin", "LivingEntity_scarpetEventsMixin",
"Player_scarpetEventsMixin", "Player_scarpetEventsMixin",
"ServerPlayer_scarpetEventMixin", "ServerPlayer_scarpetEventMixin",
"AbstractMinecart_scarpetEventsMixin",
"EndCrystal_scarpetEventsMixin",
"FallingBlockEntity_scarpetEventsMixin", "FallingBlockEntity_scarpetEventsMixin",
"HangingEntity_scarpetEventsMixin",
"PrimedTnt_scarpetEventsMixin",
"BlockItem_scarpetEventMixin", "BlockItem_scarpetEventMixin",
"PlayerList_scarpetEventsMixin", "PlayerList_scarpetEventsMixin",
"Inventory_scarpetEventMixin", "Inventory_scarpetEventMixin",