Remap CraftBukkit to Mojang+Yarn Mappings

By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
CraftBukkit/Spigot
2024-12-11 22:26:55 +01:00
parent a265d64138
commit 30e4583dbe
1780 changed files with 44628 additions and 41274 deletions

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/damagesource/DamageSource.java
+++ b/net/minecraft/world/damagesource/DamageSource.java
@@ -21,6 +21,119 @@
@@ -21,7 +21,120 @@
private final Entity directEntity;
@Nullable
private final Vec3D damageSourcePosition;
private final Vec3 damageSourcePosition;
+ // CraftBukkit start
+ @Nullable
+ private org.bukkit.block.Block directBlock; // The block that caused the damage. damageSourcePosition is not used for all block damages
@@ -14,7 +14,7 @@
+ private boolean poison = false;
+ private Entity customEntityDamager = null; // This field is a helper for when direct entity damage is not set by vanilla
+ private Entity customCausingEntityDamager = null; // This field is a helper for when causing entity damage is not set by vanilla
+
+ public DamageSource sweep() {
+ this.sweep = true;
+ return this;
@@ -76,11 +76,11 @@
+ return this.directBlock;
+ }
+
+ public DamageSource directBlock(net.minecraft.world.level.World world, net.minecraft.core.BlockPosition blockPosition) {
+ public DamageSource directBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos blockPosition) {
+ if (blockPosition == null || world == null) {
+ return this;
+ }
+ return directBlock(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockPosition));
+ return this.directBlock(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockPosition));
+ }
+
+ public DamageSource directBlock(org.bukkit.block.Block block) {
@@ -117,6 +117,7 @@
+ return damageSource;
+ }
+ // CraftBukkit end
+
public String toString() {
return "DamageSource (" + this.type().msgId() + ")";
}

View File

@@ -8,18 +8,19 @@
+ private final DamageSource melting;
+ private final DamageSource poison;
public DamageSources(IRegistryCustom iregistrycustom) {
this.damageTypes = iregistrycustom.lookupOrThrow(Registries.DAMAGE_TYPE);
public DamageSources(RegistryAccess registryManager) {
this.damageTypes = registryManager.lookupOrThrow(Registries.DAMAGE_TYPE);
+ this.melting = this.source(DamageTypes.ON_FIRE).melting();
+ this.poison = this.source(DamageTypes.MAGIC).poison();
+ // CraftBukkit end
this.inFire = this.source(DamageTypes.IN_FIRE);
this.campfire = this.source(DamageTypes.CAMPFIRE);
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
@@ -85,6 +91,16 @@
return new DamageSource(this.damageTypes.getOrThrow(resourcekey), entity, entity1);
@@ -84,6 +90,16 @@
private DamageSource source(ResourceKey<DamageType> key, @Nullable Entity source, @Nullable Entity attacker) {
return new DamageSource(this.damageTypes.getOrThrow(key), source, attacker);
}
+
+ // CraftBukkit start
+ public DamageSource melting() {
+ return this.melting;
@@ -29,37 +30,38 @@
+ return this.poison;
+ }
+ // CraftBukkit end
+
public DamageSource inFire() {
return this.inFire;
}
@@ -254,7 +270,13 @@
@@ -254,17 +270,29 @@
}
public DamageSource explosion(@Nullable Entity entity, @Nullable Entity entity1) {
- return this.source(entity1 != null && entity != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION, entity, entity1);
public DamageSource explosion(@Nullable Entity source, @Nullable Entity attacker) {
- return this.source(attacker != null && source != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION, source, attacker);
+ // CraftBukkit start
+ return this.explosion(entity, entity1, entity1 != null && entity != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION);
+ }
+
+ return this.explosion(source, attacker, attacker != null && source != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION);
}
+ public DamageSource explosion(@Nullable Entity entity, @Nullable Entity entity1, ResourceKey<DamageType> resourceKey) {
+ return this.source(resourceKey, entity, entity1);
+ // CraftBukkit end
}
public DamageSource sonicBoom(Entity entity) {
@@ -262,7 +284,13 @@
}
public DamageSource badRespawnPointExplosion(Vec3D vec3d) {
- return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d);
+ // CraftBukkit start
+ return badRespawnPointExplosion(vec3d, null);
+ }
+
+ public DamageSource badRespawnPointExplosion(Vec3D vec3d, org.bukkit.block.BlockState blockState) {
+ return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d).directBlockState(blockState);
+ // CraftBukkit end
public DamageSource sonicBoom(Entity attacker) {
return this.source(DamageTypes.SONIC_BOOM, attacker);
}
public DamageSource badRespawnPointExplosion(Vec3 position) {
- return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
+ // CraftBukkit start
+ return this.badRespawnPointExplosion(position, null);
}
+ public DamageSource badRespawnPointExplosion(Vec3 vec3d, org.bukkit.block.BlockState blockState) {
+ return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d).directBlockState(blockState);
+ // CraftBukkit end
+ }
+
public DamageSource outOfBorder() {
return this.outsideBorder;
}