mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
#1321: Clean up some stuff which got missed during previous PRs
- Add missing CraftBukkit comment to CommandGive - Remove no longer needed IRegistryCustom from CraftStructure conversion - Use setBasePotionType instead of deprecated setBasePotionData By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
fd3e1799d3
commit
61052d56b5
@ -5,7 +5,7 @@
|
|||||||
if (flag && itemstack1.isEmpty()) {
|
if (flag && itemstack1.isEmpty()) {
|
||||||
itemstack1.setCount(1);
|
itemstack1.setCount(1);
|
||||||
- entityitem = entityplayer.drop(itemstack1, false);
|
- entityitem = entityplayer.drop(itemstack1, false);
|
||||||
+ entityitem = entityplayer.drop(itemstack1, false, false, false); // SPIGOT-2942: Add boolean to call event
|
+ entityitem = entityplayer.drop(itemstack1, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||||
if (entityitem != null) {
|
if (entityitem != null) {
|
||||||
entityitem.makeFakeItem();
|
entityitem.makeFakeItem();
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
if (structurestart.isValid()) {
|
if (structurestart.isValid()) {
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ StructureBoundingBox box = structurestart.getBoundingBox();
|
+ StructureBoundingBox box = structurestart.getBoundingBox();
|
||||||
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structuremanager.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(structure, iregistrycustom), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkcoordintpair.x, chunkcoordintpair.z);
|
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structuremanager.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(structure), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkcoordintpair.x, chunkcoordintpair.z);
|
||||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ return true;
|
+ return true;
|
||||||
|
@ -137,7 +137,6 @@ import org.bukkit.metadata.MetadataValue;
|
|||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.messaging.StandardMessenger;
|
import org.bukkit.plugin.messaging.StandardMessenger;
|
||||||
import org.bukkit.potion.PotionData;
|
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
import org.bukkit.util.BiomeSearchResult;
|
import org.bukkit.util.BiomeSearchResult;
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
@ -532,7 +531,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
EntityArrow arrow;
|
EntityArrow arrow;
|
||||||
if (TippedArrow.class.isAssignableFrom(clazz)) {
|
if (TippedArrow.class.isAssignableFrom(clazz)) {
|
||||||
arrow = EntityTypes.ARROW.create(world);
|
arrow = EntityTypes.ARROW.create(world);
|
||||||
((Arrow) arrow.getBukkitEntity()).setBasePotionData(new PotionData(PotionType.WATER, false, false));
|
((Arrow) arrow.getBukkitEntity()).setBasePotionType(PotionType.WATER);
|
||||||
} else if (SpectralArrow.class.isAssignableFrom(clazz)) {
|
} else if (SpectralArrow.class.isAssignableFrom(clazz)) {
|
||||||
arrow = EntityTypes.SPECTRAL_ARROW.create(world);
|
arrow = EntityTypes.SPECTRAL_ARROW.create(world);
|
||||||
} else if (Trident.class.isAssignableFrom(clazz)) {
|
} else if (Trident.class.isAssignableFrom(clazz)) {
|
||||||
@ -1925,7 +1924,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), getHandle().registryAccess()), CraftLocation.toBukkit(found.getFirst(), this));
|
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value()), CraftLocation.toBukkit(found.getFirst(), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,7 +87,6 @@ import org.bukkit.event.entity.EntityPotionEffectEvent;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionData;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
@ -436,7 +435,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
||||||
if (TippedArrow.class.isAssignableFrom(projectile)) {
|
if (TippedArrow.class.isAssignableFrom(projectile)) {
|
||||||
launch = new EntityTippedArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW));
|
launch = new EntityTippedArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW));
|
||||||
((Arrow) launch.getBukkitEntity()).setBasePotionData(new PotionData(PotionType.WATER, false, false));
|
((Arrow) launch.getBukkitEntity()).setBasePotionType(PotionType.WATER);
|
||||||
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
||||||
launch = new EntitySpectralArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW));
|
launch = new EntitySpectralArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW));
|
||||||
} else if (Trident.class.isAssignableFrom(projectile)) {
|
} else if (Trident.class.isAssignableFrom(projectile)) {
|
||||||
|
@ -2,7 +2,6 @@ package org.bukkit.craftbukkit.generator.structure;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.core.IRegistry;
|
import net.minecraft.core.IRegistry;
|
||||||
import net.minecraft.core.IRegistryCustom;
|
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.Registry;
|
import org.bukkit.Registry;
|
||||||
@ -13,7 +12,7 @@ import org.bukkit.generator.structure.StructureType;
|
|||||||
|
|
||||||
public class CraftStructure extends Structure {
|
public class CraftStructure extends Structure {
|
||||||
|
|
||||||
public static Structure minecraftToBukkit(net.minecraft.world.level.levelgen.structure.Structure minecraft, IRegistryCustom registryHolder) {
|
public static Structure minecraftToBukkit(net.minecraft.world.level.levelgen.structure.Structure minecraft) {
|
||||||
Preconditions.checkArgument(minecraft != null);
|
Preconditions.checkArgument(minecraft != null);
|
||||||
|
|
||||||
IRegistry<net.minecraft.world.level.levelgen.structure.Structure> registry = CraftRegistry.getMinecraftRegistry(Registries.STRUCTURE);
|
IRegistry<net.minecraft.world.level.levelgen.structure.Structure> registry = CraftRegistry.getMinecraftRegistry(Registries.STRUCTURE);
|
||||||
|
@ -39,7 +39,6 @@ import org.bukkit.entity.ThrownPotion;
|
|||||||
import org.bukkit.entity.TippedArrow;
|
import org.bukkit.entity.TippedArrow;
|
||||||
import org.bukkit.entity.WitherSkull;
|
import org.bukkit.entity.WitherSkull;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionData;
|
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
import org.bukkit.projectiles.BlockProjectileSource;
|
import org.bukkit.projectiles.BlockProjectileSource;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -92,7 +91,7 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
|||||||
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
||||||
if (TippedArrow.class.isAssignableFrom(projectile)) {
|
if (TippedArrow.class.isAssignableFrom(projectile)) {
|
||||||
launch = new EntityTippedArrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW));
|
launch = new EntityTippedArrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW));
|
||||||
((Arrow) launch.getBukkitEntity()).setBasePotionData(new PotionData(PotionType.WATER, false, false));
|
((Arrow) launch.getBukkitEntity()).setBasePotionType(PotionType.WATER);
|
||||||
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
||||||
launch = new EntitySpectralArrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW));
|
launch = new EntitySpectralArrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW));
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,7 +63,7 @@ public class CraftStructureTransformer {
|
|||||||
private EntityTransformer[] entityTransformers;
|
private EntityTransformer[] entityTransformers;
|
||||||
|
|
||||||
public CraftStructureTransformer(Cause cause, GeneratorAccessSeed generatoraccessseed, StructureManager structuremanager, Structure structure, StructureBoundingBox structureboundingbox, ChunkCoordIntPair chunkcoordintpair) {
|
public CraftStructureTransformer(Cause cause, GeneratorAccessSeed generatoraccessseed, StructureManager structuremanager, Structure structure, StructureBoundingBox structureboundingbox, ChunkCoordIntPair chunkcoordintpair) {
|
||||||
AsyncStructureGenerateEvent event = new AsyncStructureGenerateEvent(structuremanager.level.getMinecraftWorld().getWorld(), !Bukkit.isPrimaryThread(), cause, CraftStructure.minecraftToBukkit(structure, structuremanager.registryAccess()), new org.bukkit.util.BoundingBox(structureboundingbox.minX(), structureboundingbox.minY(), structureboundingbox.minZ(), structureboundingbox.maxX(), structureboundingbox.maxY(), structureboundingbox.maxZ()), chunkcoordintpair.x, chunkcoordintpair.z);
|
AsyncStructureGenerateEvent event = new AsyncStructureGenerateEvent(structuremanager.level.getMinecraftWorld().getWorld(), !Bukkit.isPrimaryThread(), cause, CraftStructure.minecraftToBukkit(structure), new org.bukkit.util.BoundingBox(structureboundingbox.minX(), structureboundingbox.minY(), structureboundingbox.minZ(), structureboundingbox.maxX(), structureboundingbox.maxY(), structureboundingbox.maxZ()), chunkcoordintpair.x, chunkcoordintpair.z);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
this.blockTransformers = event.getBlockTransformers().values().toArray(BlockTransformer[]::new);
|
this.blockTransformers = event.getBlockTransformers().values().toArray(BlockTransformer[]::new);
|
||||||
this.entityTransformers = event.getEntityTransformers().values().toArray(EntityTransformer[]::new);
|
this.entityTransformers = event.getEntityTransformers().values().toArray(EntityTransformer[]::new);
|
||||||
|
Loading…
Reference in New Issue
Block a user