|
@@ -17,10 +17,12 @@ import me.km.utils.*;
|
|
|
import net.minecraft.block.*;
|
|
|
import net.minecraft.command.ICommandSource;
|
|
|
import net.minecraft.entity.*;
|
|
|
+import net.minecraft.entity.passive.horse.AbstractHorseEntity;
|
|
|
import net.minecraft.entity.player.*;
|
|
|
import net.minecraft.inventory.*;
|
|
|
import net.minecraft.inventory.container.ClickType;
|
|
|
import net.minecraft.inventory.container.Container;
|
|
|
+import net.minecraft.inventory.container.HorseInventoryContainer;
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
import net.minecraft.item.crafting.ICraftingRecipe;
|
|
|
import net.minecraft.item.crafting.IRecipeType;
|
|
@@ -226,6 +228,9 @@ public class ScriptEvents implements BlockHarvest, Craft, ContainerClick {
|
|
|
|
|
|
@SubscribeEvent(receiveCanceled = true)
|
|
|
public void onLivingHurt(LivingHurtEvent e) {
|
|
|
+ if(e.getSource().getDamageType().equals("fireworks")) {
|
|
|
+ e.setCanceled(true);
|
|
|
+ }
|
|
|
handleEvent(e, "living_hurt", (sc) -> {
|
|
|
setLiving(sc, e.getEntityLiving());
|
|
|
sc.setVar("damage_source", e.getSource());
|
|
@@ -563,9 +568,19 @@ public class ScriptEvents implements BlockHarvest, Craft, ContainerClick {
|
|
|
|
|
|
@SubscribeEvent(receiveCanceled = true)
|
|
|
public void onEntityMount(EntityMountEvent e) {
|
|
|
+ Entity ent = e.getEntityBeingMounted();
|
|
|
+ if(ent instanceof AbstractHorseEntity) {
|
|
|
+ for(PlayerEntity p : ent.getEntityWorld().getPlayers()) {
|
|
|
+ if(p.openContainer == null
|
|
|
+ || !(p.openContainer instanceof HorseInventoryContainer)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ p.closeScreen();
|
|
|
+ }
|
|
|
+ }
|
|
|
handleEvent(e, "entity_mount", (sc) -> {
|
|
|
sc.setVar("mounting", e.isMounting());
|
|
|
- setEntity(sc, e.getEntityBeingMounted());
|
|
|
+ setEntity(sc, ent);
|
|
|
sc.setVar("rider", e.getEntityMounting());
|
|
|
});
|
|
|
}
|