Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.damage.DamageSource;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.AnimalTamer;
Expand Down Expand Up @@ -268,7 +270,7 @@ public void damage(Damageable target, double amount, Entity source) {
if (target instanceof ArmorStand) {
double newHealth = Math.max(0, target.getHealth() - amount);
if (newHealth <= 0) {
EntityDeathEvent deathEvent = new EntityDeathEvent((ArmorStand) target, new ArrayList<>());
EntityDeathEvent deathEvent = new EntityDeathEvent((ArmorStand) target, DamageSource.builder(DamageType.MAGIC).build(), new ArrayList<>());
Bukkit.getPluginManager().callEvent(deathEvent);
target.remove();
} else {
Expand Down Expand Up @@ -302,7 +304,7 @@ protected ThrownPotion getOrCreatePotionEntity(Location location) {
if (potion == null) {
potion = (ThrownPotion) world.spawnEntity(
location,
EntityType.POTION);
EntityType.SPLASH_POTION);
potion.remove();

ref = new WeakReference<>(potion);
Expand Down Expand Up @@ -1893,6 +1895,7 @@ public boolean removeItemAttributes(ItemStack item) {
return true;
}

@SuppressWarnings("all")
protected AttributeModifier createAttributeModifier(UUID attributeUUID, double value, AttributeModifier.Operation operation, EquipmentSlotGroup equipmentSlotGroup) {
return new AttributeModifier(attributeUUID, "Equipment Modifier", value, operation, equipmentSlotGroup);
}
Expand Down Expand Up @@ -2064,15 +2067,15 @@ public boolean undiscoverRecipe(HumanEntity entity, String key) {
@Override
public double getMaxHealth(Damageable li) {
if (li instanceof LivingEntity) {
return ((LivingEntity)li).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
return ((LivingEntity)li).getAttribute(Attribute.MAX_HEALTH).getValue();
}
return 0;
}

@Override
public void setMaxHealth(Damageable li, double maxHealth) {
if (li instanceof LivingEntity) {
((LivingEntity)li).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth);
((LivingEntity)li).getAttribute(Attribute.MAX_HEALTH).setBaseValue(maxHealth);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginManager;

import com.elmakers.mine.bukkit.api.magic.MageController;

public interface PaperUtils {
void registerEvents(MageController controller, PluginManager pm);

void loadChunk(World world, int x, int z, boolean generate, Consumer<Chunk> consumer);
}

void setSwingAnimation(ItemStack itemStack);
}
7 changes: 7 additions & 0 deletions CompatibilityLib/main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,12 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>CompatibilityLib-v1_21_11</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions CompatibilityLib/paper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<version>1.21.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import java.util.function.Consumer;

import io.papermc.paper.datacomponent.DataComponentTypes;
import io.papermc.paper.datacomponent.item.SwingAnimation;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginManager;

import com.elmakers.mine.bukkit.api.magic.MageController;
Expand All @@ -18,4 +21,12 @@ public void loadChunk(World world, int x, int z, boolean generate, Consumer<Chun
public void registerEvents(MageController controller, PluginManager pm) {
pm.registerEvents(new PaperPlayerListener(controller), controller.getPlugin());
}

@Override
public void setSwingAnimation(ItemStack itemStack) {
itemStack.setData(DataComponentTypes.SWING_ANIMATION, SwingAnimation.swingAnimation()
.type(SwingAnimation.Animation.STAB)
.duration(18)
.build());
}
}
1 change: 1 addition & 0 deletions CompatibilityLib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<module>v1_21_8</module>
<module>v1_21_9</module>
<module>v1_21_10</module>
<module>v1_21_11</module>
<module>main</module>
</modules>

Expand Down
76 changes: 76 additions & 0 deletions CompatibilityLib/v1_21_11/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.elmakers.mine.bukkit.compatibility</groupId>
<artifactId>CompatibilityLib-parent</artifactId>
<version>10.10.6-SNAPSHOT</version>
</parent>
<artifactId>CompatibilityLib-v1_21_11</artifactId>

<properties>
<bukkit.version>1.21.11-R0.1-SNAPSHOT</bukkit.version>
</properties>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${bukkit.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${bukkit.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>CompatibilityLib-base_v1_21_4</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${bukkit.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${bukkit.version}:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${bukkit.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${bukkit.version}:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading