Upload magma
This commit is contained in:
commit
dfa9ee0b24
5008 changed files with 653442 additions and 0 deletions
37
patches/minecraft/net/minecraft/core/Holder.java.patch
Normal file
37
patches/minecraft/net/minecraft/core/Holder.java.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
--- a/net/minecraft/core/Holder.java
|
||||
+++ b/net/minecraft/core/Holder.java
|
||||
@@ -11,7 +_,22 @@
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
||||
-public interface Holder<T> {
|
||||
+public interface Holder<T> extends java.util.function.Supplier<T>, net.minecraftforge.registries.tags.IReverseTag<T> {
|
||||
+ @Override
|
||||
+ default boolean containsTag(TagKey<T> key) {
|
||||
+ return this.m_203656_(key);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default Stream<TagKey<T>> getTagKeys() {
|
||||
+ return this.m_203616_();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default T get() {
|
||||
+ return this.m_203334_();
|
||||
+ }
|
||||
+
|
||||
T m_203334_();
|
||||
|
||||
boolean m_203633_();
|
||||
@@ -193,6 +_,10 @@
|
||||
|
||||
public Stream<TagKey<T>> m_203616_() {
|
||||
return this.f_205749_.stream();
|
||||
+ }
|
||||
+
|
||||
+ public Type getType() {
|
||||
+ return this.f_205750_;
|
||||
}
|
||||
|
||||
public String toString() {
|
33
patches/minecraft/net/minecraft/core/HolderSet.java.patch
Normal file
33
patches/minecraft/net/minecraft/core/HolderSet.java.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- a/net/minecraft/core/HolderSet.java
|
||||
+++ b/net/minecraft/core/HolderSet.java
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.VisibleForTesting;
|
||||
|
||||
-public interface HolderSet<T> extends Iterable<Holder<T>> {
|
||||
+public interface HolderSet<T> extends Iterable<Holder<T>>, net.minecraftforge.common.extensions.IForgeHolderSet<T> {
|
||||
Stream<Holder<T>> m_203614_();
|
||||
|
||||
int m_203632_();
|
||||
@@ -133,6 +_,9 @@
|
||||
|
||||
public void m_205835_(List<Holder<T>> p_205836_) {
|
||||
this.f_205830_ = List.copyOf(p_205836_);
|
||||
+ for (Runnable runnable : this.invalidationCallbacks) {
|
||||
+ runnable.run(); // FORGE: invalidate listeners when tags rebind
|
||||
+ }
|
||||
}
|
||||
|
||||
public TagKey<T> m_205839_() {
|
||||
@@ -161,6 +_,11 @@
|
||||
|
||||
public boolean m_207277_(HolderOwner<T> p_256542_) {
|
||||
return this.f_254711_.m_254921_(p_256542_);
|
||||
+ }
|
||||
+ // FORGE: Keep a list of invalidation callbacks so they can be run when tags rebind
|
||||
+ private List<Runnable> invalidationCallbacks = new java.util.ArrayList<>();
|
||||
+ public void addInvalidationListener(Runnable runnable) {
|
||||
+ invalidationCallbacks.add(runnable);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
--- a/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/net/minecraft/core/MappedRegistry.java
|
||||
@@ -121,7 +_,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ private static final Set<ResourceLocation> KNOWN = new java.util.LinkedHashSet<>();
|
||||
+ public static Set<ResourceLocation> getKnownRegistries() {
|
||||
+ return java.util.Collections.unmodifiableSet(KNOWN);
|
||||
+ }
|
||||
+ protected final void markKnown() {
|
||||
+ KNOWN.add(m_123023_().m_135782_());
|
||||
+ }
|
||||
+
|
||||
public Holder.Reference<T> m_203704_(int p_256563_, ResourceKey<T> p_256594_, T p_256374_, Lifecycle p_256469_) {
|
||||
+ markKnown();
|
||||
this.m_205921_(p_256594_);
|
||||
Validate.notNull(p_256594_);
|
||||
Validate.notNull(p_256374_);
|
||||
@@ -145,6 +_,8 @@
|
||||
reference = this.f_205842_.computeIfAbsent(p_256594_, (p_258168_) -> {
|
||||
return Holder.Reference.m_254896_(this.m_255331_(), p_258168_);
|
||||
});
|
||||
+ // Forge: Bind the value immediately so it can be queried while the registry is not frozen
|
||||
+ reference.m_247654_(p_256374_);
|
||||
}
|
||||
|
||||
this.f_205842_.put(p_256594_, reference);
|
||||
@@ -300,14 +_,17 @@
|
||||
return this.f_205842_.containsKey(p_175392_);
|
||||
}
|
||||
|
||||
+ /** @deprecated Forge: For internal use only. Use the Register events when registering values. */
|
||||
+ @Deprecated
|
||||
+ public void unfreeze() {
|
||||
+ this.f_205845_ = false;
|
||||
+ }
|
||||
+
|
||||
public Registry<T> m_203521_() {
|
||||
if (this.f_205845_) {
|
||||
return this;
|
||||
} else {
|
||||
this.f_205845_ = true;
|
||||
- this.f_205843_.forEach((p_247989_, p_247990_) -> {
|
||||
- p_247990_.m_247654_(p_247989_);
|
||||
- });
|
||||
List<ResourceLocation> list = this.f_205842_.entrySet().stream().filter((p_211055_) -> {
|
||||
return !p_211055_.getValue().m_203633_();
|
||||
}).map((p_211794_) -> {
|
||||
@@ -321,7 +_,8 @@
|
||||
throw new IllegalStateException("Some intrusive holders were not registered: " + this.f_244282_.values());
|
||||
}
|
||||
|
||||
- this.f_244282_ = null;
|
||||
+ // Forge: We freeze/unfreeze vanilla registries more than once, so we need to keep the unregistered intrusive holders map around.
|
||||
+ // this.unregisteredIntrusiveHolders = null;
|
||||
}
|
||||
|
||||
return this;
|
|
@ -0,0 +1,12 @@
|
|||
--- a/net/minecraft/core/RegistryCodecs.java
|
||||
+++ b/net/minecraft/core/RegistryCodecs.java
|
||||
@@ -40,7 +_,8 @@
|
||||
}
|
||||
|
||||
public static <E> Codec<Registry<E>> m_246213_(ResourceKey<? extends Registry<E>> p_248884_, Lifecycle p_251810_, Codec<E> p_250169_) {
|
||||
- Codec<Map<ResourceKey<E>, E>> codec = Codec.unboundedMap(ResourceKey.m_195966_(p_248884_), p_250169_);
|
||||
+ // FORGE: Fix MC-197860
|
||||
+ Codec<Map<ResourceKey<E>, E>> codec = new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceKey.m_195966_(p_248884_), p_250169_);
|
||||
return codec.xmap((p_258184_) -> {
|
||||
WritableRegistry<E> writableregistry = new MappedRegistry<>(p_248884_, p_251810_);
|
||||
p_258184_.forEach((p_258191_, p_258192_) -> {
|
|
@ -0,0 +1,34 @@
|
|||
--- a/net/minecraft/core/RegistrySetBuilder.java
|
||||
+++ b/net/minecraft/core/RegistrySetBuilder.java
|
||||
@@ -37,6 +_,10 @@
|
||||
return this.m_255162_(p_256261_, Lifecycle.stable(), p_256010_);
|
||||
}
|
||||
|
||||
+ public List<? extends ResourceKey<? extends Registry<?>>> getEntryKeys() {
|
||||
+ return this.f_254732_.stream().map(RegistrySetBuilder.RegistryStub::f_254738_).toList();
|
||||
+ }
|
||||
+
|
||||
private RegistrySetBuilder.BuildState m_254900_(RegistryAccess p_256400_) {
|
||||
RegistrySetBuilder.BuildState registrysetbuilder$buildstate = RegistrySetBuilder.BuildState.m_255369_(p_256400_, this.f_254732_.stream().map(RegistrySetBuilder.RegistryStub::f_254738_));
|
||||
this.f_254732_.forEach((p_255629_) -> {
|
||||
@@ -87,7 +_,7 @@
|
||||
RegistrySetBuilder.UniversalLookup registrysetbuilder$universallookup = new RegistrySetBuilder.UniversalLookup(registrysetbuilder$compositeowner);
|
||||
ImmutableMap.Builder<ResourceLocation, HolderGetter<?>> builder = ImmutableMap.builder();
|
||||
p_255995_.m_206193_().forEach((p_258197_) -> {
|
||||
- builder.put(p_258197_.f_206233_().m_135782_(), RegistrySetBuilder.m_254882_(p_258197_.f_206234_().m_255303_()));
|
||||
+ builder.put(p_258197_.f_206233_().m_135782_(), net.minecraftforge.common.ForgeHooks.wrapRegistryLookup(p_258197_.f_206234_().m_255303_()));
|
||||
});
|
||||
p_256495_.forEach((p_256603_) -> {
|
||||
builder.put(p_256603_.m_135782_(), registrysetbuilder$universallookup);
|
||||
@@ -108,6 +_,11 @@
|
||||
|
||||
public <S> HolderGetter<S> m_255420_(ResourceKey<? extends Registry<? extends S>> p_255961_) {
|
||||
return (HolderGetter<S>) BuildState.this.f_254690_.getOrDefault(p_255961_.m_135782_(), BuildState.this.f_254749_);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public <S> Optional<HolderLookup.RegistryLookup<S>> registryLookup(ResourceKey<? extends Registry<? extends S>> registry) {
|
||||
+ return Optional.ofNullable((HolderLookup.RegistryLookup<S>) BuildState.this.f_254690_.get(registry.m_135782_()));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/core/RegistrySynchronization.java
|
||||
+++ b/net/minecraft/core/RegistrySynchronization.java
|
||||
@@ -29,7 +_,7 @@
|
||||
m_245912_(builder, Registries.f_266076_, TrimMaterial.f_266095_);
|
||||
m_245912_(builder, Registries.f_256787_, DimensionType.f_63843_);
|
||||
m_245912_(builder, Registries.f_268580_, DamageType.f_268510_);
|
||||
- return builder.build();
|
||||
+ return net.minecraftforge.registries.DataPackRegistriesHooks.grabNetworkableRegistries(builder); // FORGE: Keep the map so custom registries can be added later
|
||||
});
|
||||
public static final Codec<RegistryAccess> f_244380_ = m_247146_();
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
--- a/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
+++ b/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
@@ -28,6 +_,7 @@
|
||||
import net.minecraft.world.level.block.entity.BannerBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
+import org.bukkit.event.block.CauldronLevelChangeEvent;
|
||||
|
||||
public interface CauldronInteraction {
|
||||
Map<Item, CauldronInteraction> f_175606_ = m_175617_();
|
||||
@@ -49,6 +_,11 @@
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
if (!p_175663_.f_46443_) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(p_175662_, p_175663_, p_175664_, p_175665_, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack = new ItemStack(Blocks.f_50456_);
|
||||
if (p_175667_.m_41782_()) {
|
||||
itemstack.m_41751_(p_175667_.m_41783_().m_6426_());
|
||||
@@ -126,7 +_,7 @@
|
||||
p_175735_.m_21008_(p_175736_, ItemUtils.m_41813_(p_175737_, p_175735_, new ItemStack(Items.f_42590_)));
|
||||
p_175735_.m_36220_(Stats.f_12944_);
|
||||
p_175735_.m_36246_(Stats.f_12982_.m_12902_(item));
|
||||
- p_175733_.m_46597_(p_175734_, Blocks.f_152476_.m_49966_());
|
||||
+ // p_175733_.setBlockAndUpdate(p_175734_, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit
|
||||
p_175733_.m_5594_((Player)null, p_175734_, SoundEvents.f_11769_, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
p_175733_.m_142346_((Entity)null, GameEvent.f_157769_, p_175734_);
|
||||
}
|
||||
@@ -142,11 +_,16 @@
|
||||
});
|
||||
f_175607_.put(Items.f_42590_, (p_175718_, p_175719_, p_175720_, p_175721_, p_175722_, p_175723_) -> {
|
||||
if (!p_175719_.f_46443_) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(p_175718_, p_175719_, p_175720_, p_175721_, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = p_175723_.m_41720_();
|
||||
p_175721_.m_21008_(p_175722_, ItemUtils.m_41813_(p_175723_, p_175721_, PotionUtils.m_43549_(new ItemStack(Items.f_42589_), Potions.f_43599_)));
|
||||
p_175721_.m_36220_(Stats.f_12944_);
|
||||
p_175721_.m_36246_(Stats.f_12982_.m_12902_(item));
|
||||
- LayeredCauldronBlock.m_153559_(p_175718_, p_175719_, p_175720_);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(p_175718_, p_175719_, p_175720_); // CraftBukkit
|
||||
p_175719_.m_5594_((Player)null, p_175720_, SoundEvents.f_11770_, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
p_175719_.m_142346_((Entity)null, GameEvent.f_157816_, p_175720_);
|
||||
}
|
||||
@@ -156,10 +_,15 @@
|
||||
f_175607_.put(Items.f_42589_, (p_175704_, p_175705_, p_175706_, p_175707_, p_175708_, p_175709_) -> {
|
||||
if (p_175704_.m_61143_(LayeredCauldronBlock.f_153514_) != 3 && PotionUtils.m_43579_(p_175709_) == Potions.f_43599_) {
|
||||
if (!p_175705_.f_46443_) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(p_175704_, p_175705_, p_175706_, p_175704_.m_61122_(LayeredCauldronBlock.f_153514_), p_175707_, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
p_175707_.m_21008_(p_175708_, ItemUtils.m_41813_(p_175709_, p_175707_, new ItemStack(Items.f_42590_)));
|
||||
p_175707_.m_36220_(Stats.f_12944_);
|
||||
p_175707_.m_36246_(Stats.f_12982_.m_12902_(p_175709_.m_41720_()));
|
||||
- p_175705_.m_46597_(p_175706_, p_175704_.m_61122_(LayeredCauldronBlock.f_153514_));
|
||||
+ // p_175705_.setBlockAndUpdate(p_175706_, p_175704_.cycle(LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
||||
p_175705_.m_5594_((Player)null, p_175706_, SoundEvents.f_11769_, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
p_175705_.m_142346_((Entity)null, GameEvent.f_157769_, p_175706_);
|
||||
}
|
||||
@@ -231,11 +_,16 @@
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
if (!p_175637_.f_46443_) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(p_175636_, p_175637_, p_175638_, Blocks.f_50256_.m_49966_(), p_175639_, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = p_175641_.m_41720_();
|
||||
p_175639_.m_21008_(p_175640_, ItemUtils.m_41813_(p_175641_, p_175639_, p_175642_));
|
||||
p_175639_.m_36220_(Stats.f_12944_);
|
||||
p_175639_.m_36246_(Stats.f_12982_.m_12902_(item));
|
||||
- p_175637_.m_46597_(p_175638_, Blocks.f_50256_.m_49966_());
|
||||
+ // p_175637_.setBlockAndUpdate(p_175638_, Blocks.CAULDRON.defaultBlockState()); // CraftBukkit
|
||||
p_175637_.m_5594_((Player)null, p_175638_, p_175644_, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
p_175637_.m_142346_((Entity)null, GameEvent.f_157816_, p_175638_);
|
||||
}
|
||||
@@ -246,11 +_,16 @@
|
||||
|
||||
static InteractionResult m_175618_(Level p_175619_, BlockPos p_175620_, Player p_175621_, InteractionHand p_175622_, ItemStack p_175623_, BlockState p_175624_, SoundEvent p_175625_) {
|
||||
if (!p_175619_.f_46443_) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(p_175624_, p_175619_, p_175620_, p_175624_, p_175621_, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = p_175623_.m_41720_();
|
||||
p_175621_.m_21008_(p_175622_, ItemUtils.m_41813_(p_175623_, p_175621_, new ItemStack(Items.f_42446_)));
|
||||
p_175621_.m_36220_(Stats.f_12943_);
|
||||
p_175621_.m_36246_(Stats.f_12982_.m_12902_(item));
|
||||
- p_175619_.m_46597_(p_175620_, p_175624_);
|
||||
+ // p_175619_.setBlockAndUpdate(p_175620_, p_175624_); // CraftBukkit
|
||||
p_175619_.m_5594_((Player)null, p_175620_, p_175625_, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
p_175619_.m_142346_((Entity)null, GameEvent.f_157769_, p_175620_);
|
||||
}
|
8
patches/minecraft/net/minecraft/core/cauldron/index.html
Normal file
8
patches/minecraft/net/minecraft/core/cauldron/index.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/cauldron/</title></head>
|
||||
<body>
|
||||
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/cauldron/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="CauldronInteraction.java.patch">CauldronInteraction.java.patch</a> 07-Oct-2023 14:12 6347
|
||||
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="a39762bae7769df86d6866fa9ed25d7a" data-cf-beacon='{"rayId":"85f017476e2a50c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,58 @@
|
|||
--- a/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java
|
||||
@@ -3,10 +_,14 @@
|
||||
import net.minecraft.core.BlockSource;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Position;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
+import net.minecraft.world.level.block.entity.DispenserBlockEntity;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
|
||||
public abstract class AbstractProjectileDispenseBehavior extends DefaultDispenseItemBehavior {
|
||||
public ItemStack m_7498_(BlockSource p_123366_, ItemStack p_123367_) {
|
||||
@@ -14,9 +_,38 @@
|
||||
Position position = DispenserBlock.m_52720_(p_123366_);
|
||||
Direction direction = p_123366_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
Projectile projectile = this.m_6895_(level, position, p_123367_);
|
||||
- projectile.m_6686_((double)direction.m_122429_(), (double)((float)direction.m_122430_() + 0.1F), (double)direction.m_122431_(), this.m_7104_(), this.m_7101_());
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = p_123367_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(p_123366_.m_7961_().m_123341_(), p_123366_.m_7961_().m_123342_(), p_123366_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) direction.m_122429_(), (double) ((float) direction.m_122430_() + 0.1F), (double) direction.m_122431_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123367_.m_41769_(1);
|
||||
+ return p_123367_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123367_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123366_, eventStack);
|
||||
+ return p_123367_;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ projectile.m_6686_(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.m_7104_(), this.m_7101_());
|
||||
+ ((Entity) projectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((DispenserBlockEntity) p_123366_.m_8118_());
|
||||
+ // CraftBukkit end
|
||||
level.m_7967_(projectile);
|
||||
- p_123367_.m_41774_(1);
|
||||
+ // p_123367_.shrink(1); // CraftBukkit - Handled during event processing
|
||||
return p_123367_;
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
--- a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java
|
||||
@@ -10,6 +_,8 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
|
||||
public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior {
|
||||
private final DefaultDispenseItemBehavior f_123368_ = new DefaultDispenseItemBehavior();
|
||||
@@ -33,22 +_,51 @@
|
||||
double d2 = p_123375_.m_7098_() + (double)((float)direction.m_122430_() * 1.125F);
|
||||
double d3 = p_123375_.m_7094_() + (double)direction.m_122431_() * d0;
|
||||
BlockPos blockpos = p_123375_.m_7961_().m_121945_(direction);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = p_123376_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(p_123375_.m_7961_().m_123341_(), p_123375_.m_7961_().m_123342_(), p_123375_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123376_.m_41769_(1);
|
||||
+ return p_123376_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123376_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123375_, eventStack);
|
||||
+ return p_123376_;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Boat boat = this.f_235889_ ? new ChestBoat(level, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()) : new Boat(level, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ boat.m_28464_(this.f_123369_);
|
||||
+ boat.m_146922_(direction.m_122435_());
|
||||
double d4;
|
||||
- if (level.m_6425_(blockpos).m_205070_(FluidTags.f_13131_)) {
|
||||
+ if (boat.canBoatInFluid(level.m_6425_(blockpos))) {
|
||||
d4 = 1.0D;
|
||||
} else {
|
||||
- if (!level.m_8055_(blockpos).m_60795_() || !level.m_6425_(blockpos.m_7495_()).m_205070_(FluidTags.f_13131_)) {
|
||||
+ if (!level.m_8055_(blockpos).m_60795_() || !boat.canBoatInFluid(level.m_6425_(blockpos.m_7495_()))) {
|
||||
return this.f_123368_.m_6115_(p_123375_, p_123376_);
|
||||
}
|
||||
|
||||
d4 = 0.0D;
|
||||
}
|
||||
|
||||
- Boat boat = (Boat)(this.f_235889_ ? new ChestBoat(level, d1, d2 + d4, d3) : new Boat(level, d1, d2 + d4, d3));
|
||||
- boat.m_28464_(this.f_123369_);
|
||||
- boat.m_146922_(direction.m_122435_());
|
||||
- level.m_7967_(boat);
|
||||
- p_123376_.m_41774_(1);
|
||||
+ boat.m_6034_(d1, d2 + d4, d3);
|
||||
+ if (!level.m_7967_(boat)) p_123376_.m_41769_(1); // CraftBukkit
|
||||
+ // p_123376_.shrink(1); // CraftBukkit - handled during event processing
|
||||
return p_123376_;
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
--- a/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
|
||||
@@ -7,8 +_,25 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.util.CraftVector;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
|
||||
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ private boolean dropper;
|
||||
+
|
||||
+ public DefaultDispenseItemBehavior(boolean dropper) {
|
||||
+ this.dropper = dropper;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // Magma
|
||||
+ public DefaultDispenseItemBehavior() {
|
||||
+ }
|
||||
+
|
||||
public final ItemStack m_6115_(BlockSource p_123391_, ItemStack p_123392_) {
|
||||
ItemStack itemstack = this.m_7498_(p_123391_, p_123392_);
|
||||
this.m_6823_(p_123391_);
|
||||
@@ -20,11 +_,19 @@
|
||||
Direction direction = p_123385_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
Position position = DispenserBlock.m_52720_(p_123385_);
|
||||
ItemStack itemstack = p_123386_.m_41620_(1);
|
||||
- m_123378_(p_123385_.m_7727_(), itemstack, 6, direction, position);
|
||||
+ // CraftBukkit start
|
||||
+ if (!spawnItem(p_123385_.m_7727_(), itemstack, 6, direction, p_123385_, dropper)) {
|
||||
+ itemstack.m_41769_(1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return p_123386_;
|
||||
}
|
||||
|
||||
- public static void m_123378_(Level p_123379_, ItemStack p_123380_, int p_123381_, Direction p_123382_, Position p_123383_) {
|
||||
+ // CraftBukkit start - void -> boolean return, IPosition -> ISourceBlock last argument, dropper
|
||||
+ public static boolean spawnItem(Level p_123379_, ItemStack p_123380_, int p_123381_, Direction p_123382_, BlockSource blockSource, boolean dropper) {
|
||||
+ if (p_123380_.m_41619_()) return true;
|
||||
+ Position p_123383_ = DispenserBlock.m_52720_(blockSource);
|
||||
+ // CraftBukkit end
|
||||
double d0 = p_123383_.m_7096_();
|
||||
double d1 = p_123383_.m_7098_();
|
||||
double d2 = p_123383_.m_7094_();
|
||||
@@ -37,7 +_,39 @@
|
||||
ItemEntity itementity = new ItemEntity(p_123379_, d0, d1, d2, p_123380_);
|
||||
double d3 = p_123379_.f_46441_.m_188500_() * 0.1D + 0.2D;
|
||||
itementity.m_20334_(p_123379_.f_46441_.m_216328_((double)p_123382_.m_122429_() * d3, 0.0172275D * (double)p_123381_), p_123379_.f_46441_.m_216328_(0.2D, 0.0172275D * (double)p_123381_), p_123379_.f_46441_.m_216328_((double)p_123382_.m_122431_() * d3, 0.0172275D * (double)p_123381_));
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = p_123379_.getWorld().getBlockAt(blockSource.m_7961_().m_123341_(), blockSource.m_7961_().m_123342_(), blockSource.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123380_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), CraftVector.toBukkit(itementity.m_20184_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ p_123379_.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ itementity.m_32045_(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ itementity.m_20256_(CraftVector.toNMS(event.getVelocity()));
|
||||
+
|
||||
+ if (!dropper && !event.getItem().getType().equals(craftItem.getType())) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior.getClass() != DefaultDispenseItemBehavior.class) {
|
||||
+ idispensebehavior.m_6115_(blockSource, eventStack);
|
||||
+ } else {
|
||||
+ p_123379_.m_7967_(itementity);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
p_123379_.m_7967_(itementity);
|
||||
+
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void m_6823_(BlockSource p_123384_) {
|
|
@ -0,0 +1,688 @@
|
|||
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -38,34 +_,12 @@
|
||||
import net.minecraft.world.entity.projectile.ThrownExperienceBottle;
|
||||
import net.minecraft.world.entity.projectile.ThrownPotion;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
-import net.minecraft.world.item.ArmorItem;
|
||||
-import net.minecraft.world.item.BoneMealItem;
|
||||
-import net.minecraft.world.item.DispensibleContainerItem;
|
||||
-import net.minecraft.world.item.DyeColor;
|
||||
-import net.minecraft.world.item.HoneycombItem;
|
||||
-import net.minecraft.world.item.Item;
|
||||
-import net.minecraft.world.item.ItemStack;
|
||||
-import net.minecraft.world.item.Items;
|
||||
-import net.minecraft.world.item.SpawnEggItem;
|
||||
+import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
-import net.minecraft.world.level.block.BaseFireBlock;
|
||||
-import net.minecraft.world.level.block.BeehiveBlock;
|
||||
-import net.minecraft.world.level.block.Block;
|
||||
-import net.minecraft.world.level.block.Blocks;
|
||||
-import net.minecraft.world.level.block.BucketPickup;
|
||||
-import net.minecraft.world.level.block.CampfireBlock;
|
||||
-import net.minecraft.world.level.block.CandleBlock;
|
||||
-import net.minecraft.world.level.block.CandleCakeBlock;
|
||||
-import net.minecraft.world.level.block.CarvedPumpkinBlock;
|
||||
-import net.minecraft.world.level.block.DispenserBlock;
|
||||
-import net.minecraft.world.level.block.RespawnAnchorBlock;
|
||||
-import net.minecraft.world.level.block.ShulkerBoxBlock;
|
||||
-import net.minecraft.world.level.block.SkullBlock;
|
||||
-import net.minecraft.world.level.block.TntBlock;
|
||||
-import net.minecraft.world.level.block.WitherSkullBlock;
|
||||
+import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.DispenserBlockEntity;
|
||||
@@ -76,6 +_,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.TreeType;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseArmorEvent;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+import org.bukkit.event.block.BlockFertilizeEvent;
|
||||
+import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public interface DispenseItemBehavior {
|
||||
@@ -181,6 +_,33 @@
|
||||
Direction direction = p_123523_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
EntityType<?> entitytype = ((SpawnEggItem)p_123524_.m_41720_()).m_43228_(p_123524_.m_41783_());
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ ServerLevel worldserver = p_123523_.m_7727_();
|
||||
+ ItemStack itemstack1 = p_123524_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(p_123523_.m_7961_().m_123341_(), p_123523_.m_7961_().m_123342_(), p_123523_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123524_.m_41769_(1);
|
||||
+ return p_123524_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123524_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123523_, eventStack);
|
||||
+ return p_123524_;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
try {
|
||||
entitytype.m_20592_(p_123523_.m_7727_(), p_123524_, (Player)null, p_123523_.m_7961_().m_121945_(direction), MobSpawnType.DISPENSER, direction != Direction.UP, false);
|
||||
} catch (Exception exception) {
|
||||
@@ -188,7 +_,8 @@
|
||||
return ItemStack.f_41583_;
|
||||
}
|
||||
|
||||
- p_123524_.m_41774_(1);
|
||||
+ // p_123524_.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
p_123523_.m_7727_().m_142346_((Entity)null, GameEvent.f_157810_, p_123523_.m_7961_());
|
||||
return p_123524_;
|
||||
}
|
||||
@@ -203,12 +_,40 @@
|
||||
Direction direction = p_123461_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
BlockPos blockpos = p_123461_.m_7961_().m_121945_(direction);
|
||||
ServerLevel serverlevel = p_123461_.m_7727_();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = p_123462_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = serverlevel.getWorld().getBlockAt(p_123461_.m_7961_().m_123341_(), p_123461_.m_7961_().m_123342_(), p_123461_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ serverlevel.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123462_.m_41769_(1);
|
||||
+ return p_123462_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123462_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123461_, eventStack);
|
||||
+ return p_123462_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
Consumer<ArmorStand> consumer = EntityType.m_264081_((p_277236_) -> {
|
||||
p_277236_.m_146922_(direction.m_122435_());
|
||||
}, serverlevel, p_123462_, (Player)null);
|
||||
ArmorStand armorstand = EntityType.f_20529_.m_262455_(serverlevel, p_123462_.m_41783_(), consumer, blockpos, MobSpawnType.DISPENSER, false, false);
|
||||
if (armorstand != null) {
|
||||
- p_123462_.m_41774_(1);
|
||||
+ // p_123462_.shrink(1); // CraftBukkit - Handled during event processing
|
||||
}
|
||||
|
||||
return p_123462_;
|
||||
@@ -225,6 +_,33 @@
|
||||
}
|
||||
});
|
||||
if (!list.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = p_123530_.m_41620_(1);
|
||||
+ Level world = p_123529_.m_7727_();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(p_123529_.m_7961_().m_123341_(), p_123529_.m_7961_().m_123342_(), p_123529_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) list.get(0).getBukkitEntity());
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123530_.m_41769_(1);
|
||||
+ return p_123530_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123530_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != ArmorItem.f_40376_) {
|
||||
+ idispensebehavior.m_6115_(p_123529_, eventStack);
|
||||
+ return p_123530_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
((Saddleable)list.get(0)).m_5853_(SoundSource.BLOCKS);
|
||||
p_123530_.m_41774_(1);
|
||||
this.m_123573_(true);
|
||||
@@ -242,7 +_,35 @@
|
||||
return p_289248_.m_6084_() && p_289248_.m_7482_();
|
||||
})) {
|
||||
if (abstracthorse.m_6010_(p_123536_) && !abstracthorse.m_7481_() && abstracthorse.m_30614_()) {
|
||||
- abstracthorse.m_141942_(401).m_142104_(p_123536_.m_41620_(1));
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = p_123536_.m_41620_(1);
|
||||
+ Level world = p_123535_.m_7727_();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(p_123535_.m_7961_().m_123341_(), p_123535_.m_7961_().m_123342_(), p_123535_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) abstracthorse.getBukkitEntity());
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123536_.m_41769_(1);
|
||||
+ return p_123536_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123536_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != ArmorItem.f_40376_) {
|
||||
+ idispensebehavior.m_6115_(p_123535_, eventStack);
|
||||
+ return p_123536_;
|
||||
+ }
|
||||
+ }
|
||||
+ abstracthorse.m_141942_(401).m_142104_(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ // CraftBukkit end
|
||||
this.m_123573_(true);
|
||||
return p_123536_;
|
||||
}
|
||||
@@ -278,8 +_,34 @@
|
||||
for(AbstractChestedHorse abstractchestedhorse : p_123541_.m_7727_().m_6443_(AbstractChestedHorse.class, new AABB(blockpos), (p_289249_) -> {
|
||||
return p_289249_.m_6084_() && !p_289249_.m_30502_();
|
||||
})) {
|
||||
- if (abstractchestedhorse.m_30614_() && abstractchestedhorse.m_141942_(499).m_142104_(p_123542_)) {
|
||||
- p_123542_.m_41774_(1);
|
||||
+ // CraftBukkit start
|
||||
+ if (abstractchestedhorse.m_30614_()) {
|
||||
+ ItemStack itemstack1 = p_123542_.m_41620_(1);
|
||||
+ Level world = p_123541_.m_7727_();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(p_123541_.m_7961_().m_123341_(), p_123541_.m_7961_().m_123342_(), p_123541_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) abstractchestedhorse.getBukkitEntity());
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123542_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != ArmorItem.f_40376_) {
|
||||
+ idispensebehavior.m_6115_(p_123541_, eventStack);
|
||||
+ return p_123542_;
|
||||
+ }
|
||||
+ }
|
||||
+ abstractchestedhorse.m_141942_(499).m_142104_(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ // CraftBukkit end
|
||||
+ // p_123542_.shrink(1); // CraftBukkit - handled above
|
||||
this.m_123573_(true);
|
||||
return p_123542_;
|
||||
}
|
||||
@@ -291,11 +_,41 @@
|
||||
DispenserBlock.m_52672_(Items.f_42688_, new DefaultDispenseItemBehavior() {
|
||||
public ItemStack m_7498_(BlockSource p_123547_, ItemStack p_123548_) {
|
||||
Direction direction = p_123547_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ Level worldserver = p_123547_.m_7727_();
|
||||
+ ItemStack itemstack1 = p_123548_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(p_123547_.m_7961_().m_123341_(), p_123547_.m_7961_().m_123342_(), p_123547_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(direction.m_122429_(), direction.m_122430_(), direction.m_122431_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123548_.m_41769_(1);
|
||||
+ return p_123548_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123548_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123547_, eventStack);
|
||||
+ return p_123548_;
|
||||
+ }
|
||||
+ }
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+
|
||||
FireworkRocketEntity fireworkrocketentity = new FireworkRocketEntity(p_123547_.m_7727_(), p_123548_, p_123547_.m_7096_(), p_123547_.m_7098_(), p_123547_.m_7096_(), true);
|
||||
DispenseItemBehavior.m_123395_(p_123547_, fireworkrocketentity, direction);
|
||||
fireworkrocketentity.m_6686_((double)direction.m_122429_(), (double)direction.m_122430_(), (double)direction.m_122431_(), 0.5F, 1.0F);
|
||||
p_123547_.m_7727_().m_7967_(fireworkrocketentity);
|
||||
- p_123548_.m_41774_(1);
|
||||
+ // p_123548_.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return p_123548_;
|
||||
}
|
||||
|
||||
@@ -315,11 +_,38 @@
|
||||
double d3 = randomsource.m_216328_((double)direction.m_122429_(), 0.11485000000000001D);
|
||||
double d4 = randomsource.m_216328_((double)direction.m_122430_(), 0.11485000000000001D);
|
||||
double d5 = randomsource.m_216328_((double)direction.m_122431_(), 0.11485000000000001D);
|
||||
- SmallFireball smallfireball = new SmallFireball(level, d0, d1, d2, d3, d4, d5);
|
||||
- level.m_7967_(Util.m_137469_(smallfireball, (p_123552_) -> {
|
||||
- p_123552_.m_37010_(p_123557_);
|
||||
- }));
|
||||
- p_123557_.m_41774_(1);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = p_123557_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(p_123556_.m_7961_().m_123341_(), p_123556_.m_7961_().m_123342_(), p_123556_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123557_.m_41769_(1);
|
||||
+ return p_123557_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123557_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123556_, eventStack);
|
||||
+ return p_123557_;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ SmallFireball entitysmallfireball = new SmallFireball(level, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ entitysmallfireball.m_37010_(itemstack1);
|
||||
+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((DispenserBlockEntity) p_123556_.m_8118_());
|
||||
+ level.m_7967_(entitysmallfireball);
|
||||
+ // p_123557_.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return p_123557_;
|
||||
}
|
||||
|
||||
@@ -352,9 +_,49 @@
|
||||
DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_123562_.m_41720_();
|
||||
BlockPos blockpos = p_123561_.m_7961_().m_121945_(p_123561_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
Level level = p_123561_.m_7727_();
|
||||
- if (dispensiblecontaineritem.m_142073_((Player)null, level, blockpos, (BlockHitResult)null)) {
|
||||
+ // CraftBukkit start
|
||||
+ int x = blockpos.m_123341_();
|
||||
+ int y = blockpos.m_123342_();
|
||||
+ int z = blockpos.m_123343_();
|
||||
+ BlockState iblockdata = level.m_8055_(blockpos);
|
||||
+ if (iblockdata.m_60795_() || iblockdata.m_247087_() || (dispensiblecontaineritem instanceof BucketItem && iblockdata.m_60734_() instanceof LiquidBlockContainer && ((LiquidBlockContainer) iblockdata.m_60734_()).m_6044_(level, blockpos, iblockdata, ((BucketItem) dispensiblecontaineritem).getFluid()))) {
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(p_123561_.m_7961_().m_123341_(), p_123561_.m_7961_().m_123342_(), p_123561_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123562_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123562_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123561_, eventStack);
|
||||
+ return p_123562_;
|
||||
+ }
|
||||
+ }
|
||||
+ dispensiblecontaineritem = (DispensibleContainerItem) CraftItemStack.asNMSCopy(event.getItem()).m_41720_();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (dispensiblecontaineritem.emptyContents((Player)null, level, blockpos, (BlockHitResult)null, p_123562_)) {
|
||||
dispensiblecontaineritem.m_142131_((Player)null, level, p_123562_, blockpos);
|
||||
- return new ItemStack(Items.f_42446_);
|
||||
+ // CraftBukkit start - Handle stacked buckets
|
||||
+ Item item = Items.f_42446_;
|
||||
+ p_123562_.m_41774_(1);
|
||||
+ if (p_123562_.m_41619_()) {
|
||||
+ p_123562_.setItem(Items.f_42446_);
|
||||
+ p_123562_.m_41764_(1);
|
||||
+ } else if (((DispenserBlockEntity) p_123561_.m_8118_()).m_59237_(new ItemStack(item)) < 0) {
|
||||
+ this.f_123558_.m_6115_(p_123561_, new ItemStack(item));
|
||||
+ }
|
||||
+ return p_123562_;
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
return this.f_123558_.m_6115_(p_123561_, p_123562_);
|
||||
}
|
||||
@@ -373,7 +_,7 @@
|
||||
private final DefaultDispenseItemBehavior f_123563_ = new DefaultDispenseItemBehavior();
|
||||
|
||||
public ItemStack m_7498_(BlockSource p_123566_, ItemStack p_123567_) {
|
||||
- LevelAccessor levelaccessor = p_123566_.m_7727_();
|
||||
+ Level levelaccessor = p_123566_.m_7727_();
|
||||
BlockPos blockpos = p_123566_.m_7961_().m_121945_(p_123566_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
BlockState blockstate = levelaccessor.m_8055_(blockpos);
|
||||
Block block = blockstate.m_60734_();
|
||||
@@ -384,6 +_,33 @@
|
||||
} else {
|
||||
levelaccessor.m_142346_((Entity)null, GameEvent.f_157816_, blockpos);
|
||||
Item item = itemstack.m_41720_();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = levelaccessor.getWorld().getBlockAt(p_123566_.m_7961_().m_123341_(), p_123566_.m_7961_().m_123342_(), p_123566_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockpos.m_123341_(), blockpos.m_123342_(), blockpos.m_123343_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ levelaccessor.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123566_, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itemstack = ((BucketPickup) block).m_142598_(levelaccessor, blockpos, blockstate); // From above
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
p_123567_.m_41774_(1);
|
||||
if (p_123567_.m_41619_()) {
|
||||
return new ItemStack(item);
|
||||
@@ -403,6 +_,28 @@
|
||||
DispenserBlock.m_52672_(Items.f_42409_, new OptionalDispenseItemBehavior() {
|
||||
protected ItemStack m_7498_(BlockSource p_123412_, ItemStack p_123413_) {
|
||||
Level level = p_123412_.m_7727_();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = level.getWorld().getBlockAt(p_123412_.m_7961_().m_123341_(), p_123412_.m_7961_().m_123342_(), p_123412_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123413_);
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123413_;
|
||||
+ }
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123412_, eventStack);
|
||||
+ return p_123413_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.m_123573_(true);
|
||||
Direction direction = p_123412_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
BlockPos blockpos = p_123412_.m_7961_().m_121945_(direction);
|
||||
@@ -411,15 +_,20 @@
|
||||
level.m_46597_(blockpos, BaseFireBlock.m_49245_(level, blockpos));
|
||||
level.m_142346_((Entity)null, GameEvent.f_157797_, blockpos);
|
||||
} else if (!CampfireBlock.m_51321_(blockstate) && !CandleBlock.m_152845_(blockstate) && !CandleCakeBlock.m_152910_(blockstate)) {
|
||||
- if (blockstate.m_60734_() instanceof TntBlock) {
|
||||
- TntBlock.m_57433_(level, blockpos);
|
||||
- level.m_7471_(blockpos, false);
|
||||
+ if (blockstate.isFlammable(level, blockpos, p_123412_.m_6414_().m_61143_(DispenserBlock.f_52659_).m_122424_())) {
|
||||
+ blockstate.onCaughtFire(level, blockpos, p_123412_.m_6414_().m_61143_(DispenserBlock.f_52659_).m_122424_(), null);
|
||||
+ if (blockstate.m_60734_() instanceof TntBlock)
|
||||
+ level.m_7471_(blockpos, false);
|
||||
} else {
|
||||
this.m_123573_(false);
|
||||
}
|
||||
} else {
|
||||
- level.m_46597_(blockpos, blockstate.m_61124_(BlockStateProperties.f_61443_, Boolean.valueOf(true)));
|
||||
- level.m_142346_((Entity)null, GameEvent.f_157792_, blockpos);
|
||||
+ // CraftBukkit start - Ignition by dispensing flint and steel
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, blockpos, p_123412_.m_7961_()).isCancelled()) {
|
||||
+ level.m_46597_(blockpos, BaseFireBlock.m_49245_(level, blockpos));
|
||||
+ level.m_142346_((Entity) null, GameEvent.f_157797_, blockpos);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.m_123570_() && p_123413_.m_220157_(1, level.f_46441_, (ServerPlayer)null)) {
|
||||
@@ -434,12 +_,65 @@
|
||||
this.m_123573_(true);
|
||||
Level level = p_123416_.m_7727_();
|
||||
BlockPos blockpos = p_123416_.m_7961_().m_121945_(p_123416_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(p_123416_.m_7961_().m_123341_(), p_123416_.m_7961_().m_123342_(), p_123416_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123417_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123417_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123416_, eventStack);
|
||||
+ return p_123417_;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ level.captureTreeGeneration = true;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!BoneMealItem.m_40627_(p_123417_, level, blockpos) && !BoneMealItem.m_40631_(p_123417_, level, blockpos, (Direction)null)) {
|
||||
this.m_123573_(false);
|
||||
} else if (!level.f_46443_) {
|
||||
level.m_46796_(1505, blockpos, 0);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ level.captureTreeGeneration = false;
|
||||
+ if (level.capturedBlockStates.size() > 0) {
|
||||
+ TreeType treeType = SaplingBlock.treeType;
|
||||
+ SaplingBlock.treeType = null;
|
||||
+ Location location = new Location(level.getWorld(), blockpos.m_123341_(), blockpos.m_123342_(), blockpos.m_123343_());
|
||||
+ List<org.bukkit.block.BlockState> blocks = new java.util.ArrayList<>(level.capturedBlockStates.values());
|
||||
+ level.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent structureEvent = null;
|
||||
+ if (treeType != null) {
|
||||
+ structureEvent = new StructureGrowEvent(location, treeType, false, null, blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(structureEvent);
|
||||
+ }
|
||||
+
|
||||
+ BlockFertilizeEvent fertilizeEvent = new BlockFertilizeEvent(location.getBlock(), null, blocks);
|
||||
+ fertilizeEvent.setCancelled(structureEvent != null && structureEvent.isCancelled());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(fertilizeEvent);
|
||||
+
|
||||
+ if (!fertilizeEvent.isCancelled()) {
|
||||
+ for (org.bukkit.block.BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
return p_123417_;
|
||||
}
|
||||
});
|
||||
@@ -447,11 +_,39 @@
|
||||
protected ItemStack m_7498_(BlockSource p_123425_, ItemStack p_123426_) {
|
||||
Level level = p_123425_.m_7727_();
|
||||
BlockPos blockpos = p_123425_.m_7961_().m_121945_(p_123425_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
- PrimedTnt primedtnt = new PrimedTnt(level, (double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_(), (double)blockpos.m_123343_() + 0.5D, (LivingEntity)null);
|
||||
+ // CraftBukkit start
|
||||
+
|
||||
+ ItemStack itemstack1 = p_123426_.m_41620_(1);
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(p_123425_.m_7961_().m_123341_(), p_123425_.m_7961_().m_123342_(), p_123425_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockpos.m_123341_() + 0.5D, (double) blockpos.m_123342_(), (double) blockpos.m_123343_() + 0.5D));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ p_123426_.m_41769_(1);
|
||||
+ return p_123426_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ p_123426_.m_41769_(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123425_, eventStack);
|
||||
+ return p_123426_;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ PrimedTnt primedtnt = new PrimedTnt(level, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (LivingEntity) null);
|
||||
+ // CraftBukkit end
|
||||
level.m_7967_(primedtnt);
|
||||
level.m_6263_((Player)null, primedtnt.m_20185_(), primedtnt.m_20186_(), primedtnt.m_20189_(), SoundEvents.f_12512_, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
level.m_142346_((Entity)null, GameEvent.f_157810_, blockpos);
|
||||
- p_123426_.m_41774_(1);
|
||||
+ // p_123426_.shrink(1); // CraftBukkit - handled above
|
||||
return p_123426_;
|
||||
}
|
||||
});
|
||||
@@ -472,6 +_,31 @@
|
||||
Level level = p_123433_.m_7727_();
|
||||
Direction direction = p_123433_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
BlockPos blockpos = p_123433_.m_7961_().m_121945_(direction);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = level.getWorld().getBlockAt(p_123433_.m_7961_().m_123341_(), p_123433_.m_7961_().m_123342_(), p_123433_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123434_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockpos.m_123341_(), blockpos.m_123342_(), blockpos.m_123343_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123434_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123433_, eventStack);
|
||||
+ return p_123434_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (level.m_46859_(blockpos) && WitherSkullBlock.m_58267_(level, blockpos, p_123434_)) {
|
||||
level.m_7731_(blockpos, Blocks.f_50312_.m_49966_().m_61124_(SkullBlock.f_56314_, Integer.valueOf(RotationSegment.m_245225_(direction))), 3);
|
||||
level.m_142346_((Entity)null, GameEvent.f_157797_, blockpos);
|
||||
@@ -494,6 +_,31 @@
|
||||
Level level = p_123437_.m_7727_();
|
||||
BlockPos blockpos = p_123437_.m_7961_().m_121945_(p_123437_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
CarvedPumpkinBlock carvedpumpkinblock = (CarvedPumpkinBlock)Blocks.f_50143_;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = level.getWorld().getBlockAt(p_123437_.m_7961_().m_123341_(), p_123437_.m_7961_().m_123342_(), p_123437_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123438_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockpos.m_123341_(), blockpos.m_123342_(), blockpos.m_123343_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123438_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123437_, eventStack);
|
||||
+ return p_123438_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (level.m_46859_(blockpos) && carvedpumpkinblock.m_51381_(level, blockpos)) {
|
||||
if (!level.f_46443_) {
|
||||
level.m_7731_(blockpos, carvedpumpkinblock.m_49966_(), 3);
|
||||
@@ -537,6 +_,31 @@
|
||||
ServerLevel serverlevel = p_123444_.m_7727_();
|
||||
BlockPos blockpos = p_123444_.m_7961_().m_121945_(p_123444_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
BlockState blockstate = serverlevel.m_8055_(blockpos);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = serverlevel.getWorld().getBlockAt(p_123444_.m_7961_().m_123341_(), p_123444_.m_7961_().m_123342_(), p_123444_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123445_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockpos.m_123341_(), blockpos.m_123342_(), blockpos.m_123343_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ serverlevel.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123445_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123444_, eventStack);
|
||||
+ return p_123445_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (blockstate.m_204338_(BlockTags.f_13072_, (p_123442_) -> {
|
||||
return p_123442_.m_61138_(BeehiveBlock.f_49564_) && p_123442_.m_60734_() instanceof BeehiveBlock;
|
||||
}) && blockstate.m_61143_(BeehiveBlock.f_49564_) >= 5) {
|
|
@ -0,0 +1,59 @@
|
|||
--- a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
@@ -19,13 +_,38 @@
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
|
||||
public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
|
||||
protected ItemStack m_7498_(BlockSource p_123580_, ItemStack p_123581_) {
|
||||
ServerLevel serverlevel = p_123580_.m_7727_();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = serverlevel.getWorld().getBlockAt(p_123580_.m_7961_().m_123341_(), p_123580_.m_7961_().m_123342_(), p_123580_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123581_);
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ serverlevel.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123581_;
|
||||
+ }
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123580_, eventStack);
|
||||
+ return p_123581_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!serverlevel.m_5776_()) {
|
||||
BlockPos blockpos = p_123580_.m_7961_().m_121945_(p_123580_.m_6414_().m_61143_(DispenserBlock.f_52659_));
|
||||
- this.m_123573_(m_123576_(serverlevel, blockpos) || m_123582_(serverlevel, blockpos));
|
||||
+ this.m_123573_(m_123576_(serverlevel, blockpos) || tryShearLivingEntity(serverlevel, blockpos, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.m_123570_() && p_123581_.m_220157_(1, serverlevel.m_213780_(), (ServerPlayer)null)) {
|
||||
p_123581_.m_41764_(0);
|
||||
}
|
||||
@@ -52,10 +_,15 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- private static boolean m_123582_(ServerLevel p_123583_, BlockPos p_123584_) {
|
||||
+ private static boolean tryShearLivingEntity(ServerLevel p_123583_, BlockPos p_123584_, org.bukkit.block.Block bukkitBlock, CraftItemStack craftItem) { // CraftBukkit - add args
|
||||
for(LivingEntity livingentity : p_123583_.m_6443_(LivingEntity.class, new AABB(p_123584_), EntitySelector.f_20408_)) {
|
||||
if (livingentity instanceof Shearable shearable) {
|
||||
if (shearable.m_6220_()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockShearEntityEvent(livingentity, bukkitBlock, craftItem).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
shearable.m_5851_(SoundSource.BLOCKS);
|
||||
p_123583_.m_142346_((Entity)null, GameEvent.f_157781_, p_123584_);
|
||||
return true;
|
|
@ -0,0 +1,42 @@
|
|||
--- a/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
|
||||
@@ -9,6 +_,8 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.DirectionalPlaceContext;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior {
|
||||
@@ -21,6 +_,30 @@
|
||||
Direction direction = p_123587_.m_6414_().m_61143_(DispenserBlock.f_52659_);
|
||||
BlockPos blockpos = p_123587_.m_7961_().m_121945_(direction);
|
||||
Direction direction1 = p_123587_.m_7727_().m_46859_(blockpos.m_7495_()) ? direction : Direction.UP;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = p_123587_.m_7727_().getWorld().getBlockAt(p_123587_.m_7961_().m_123341_(), p_123587_.m_7961_().m_123342_(), p_123587_.m_7961_().m_123343_());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(p_123588_);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockpos.m_123341_(), blockpos.m_123342_(), blockpos.m_123343_()));
|
||||
+ if (!DispenserBlock.eventFired) {
|
||||
+ p_123587_.m_7727_().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return p_123588_;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.f_52661_.get(eventStack.m_41720_());
|
||||
+ if (idispensebehavior != DispenseItemBehavior.f_123393_ && idispensebehavior != this) {
|
||||
+ idispensebehavior.m_6115_(p_123587_, eventStack);
|
||||
+ return p_123588_;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
try {
|
||||
this.m_123573_(((BlockItem)item).m_40576_(new DirectionalPlaceContext(p_123587_.m_7727_(), blockpos, direction, p_123588_, direction1)).m_19077_());
|
13
patches/minecraft/net/minecraft/core/dispenser/index.html
Normal file
13
patches/minecraft/net/minecraft/core/dispenser/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<html>
|
||||
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/dispenser/</title></head>
|
||||
<body>
|
||||
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/dispenser/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="AbstractProjectileDispenseBehavior.java.patch">AbstractProjectileDispenseBehavior.java.patch</a> 07-Oct-2023 14:12 3108
|
||||
<a href="BoatDispenseItemBehavior.java.patch">BoatDispenseItemBehavior.java.patch</a> 07-Oct-2023 14:12 3407
|
||||
<a href="DefaultDispenseItemBehavior.java.patch">DefaultDispenseItemBehavior.java.patch</a> 07-Oct-2023 14:12 4093
|
||||
<a href="DispenseItemBehavior.java.patch">DispenseItemBehavior.java.patch</a> 07-Oct-2023 14:12 38K
|
||||
<a href="ShearsDispenseItemBehavior.java.patch">ShearsDispenseItemBehavior.java.patch</a> 07-Oct-2023 14:12 3316
|
||||
<a href="ShulkerBoxDispenseBehavior.java.patch">ShulkerBoxDispenseBehavior.java.patch</a> 07-Oct-2023 14:12 2278
|
||||
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="00303fdba8b6196fb5981dcdaaa50ed1" data-cf-beacon='{"rayId":"85f0174a1b6350c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
17
patches/minecraft/net/minecraft/core/index.html
Normal file
17
patches/minecraft/net/minecraft/core/index.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<html>
|
||||
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/</title></head>
|
||||
<body>
|
||||
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="cauldron/">cauldron/</a> 07-Oct-2023 14:12 -
|
||||
<a href="dispenser/">dispenser/</a> 07-Oct-2023 14:12 -
|
||||
<a href="particles/">particles/</a> 07-Oct-2023 14:12 -
|
||||
<a href="registries/">registries/</a> 07-Oct-2023 14:12 -
|
||||
<a href="Holder.java.patch">Holder.java.patch</a> 07-Oct-2023 14:12 885
|
||||
<a href="HolderSet.java.patch">HolderSet.java.patch</a> 07-Oct-2023 14:12 1212
|
||||
<a href="MappedRegistry.java.patch">MappedRegistry.java.patch</a> 07-Oct-2023 14:12 2236
|
||||
<a href="RegistryCodecs.java.patch">RegistryCodecs.java.patch</a> 07-Oct-2023 14:12 735
|
||||
<a href="RegistrySetBuilder.java.patch">RegistrySetBuilder.java.patch</a> 07-Oct-2023 14:12 2058
|
||||
<a href="RegistrySynchronization.java.patch">RegistrySynchronization.java.patch</a> 07-Oct-2023 14:12 621
|
||||
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="b81504a3cb56a43b371d71d49d69d6b9" data-cf-beacon='{"rayId":"85f01649d9bc50c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
--- a/net/minecraft/core/particles/BlockParticleOption.java
|
||||
+++ b/net/minecraft/core/particles/BlockParticleOption.java
|
||||
@@ -51,4 +_,15 @@
|
||||
public BlockState m_123642_() {
|
||||
return this.f_123626_;
|
||||
}
|
||||
+
|
||||
+ //FORGE: Add a source pos property, so we can provide models with additional model data
|
||||
+ private net.minecraft.core.BlockPos pos;
|
||||
+ public BlockParticleOption setPos(net.minecraft.core.BlockPos pos) {
|
||||
+ this.pos = pos;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.core.BlockPos getPos() {
|
||||
+ return pos;
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/core/particles/ItemParticleOption.java
|
||||
+++ b/net/minecraft/core/particles/ItemParticleOption.java
|
||||
@@ -35,7 +_,7 @@
|
||||
|
||||
public ItemParticleOption(ParticleType<ItemParticleOption> p_123705_, ItemStack p_123706_) {
|
||||
this.f_123701_ = p_123705_;
|
||||
- this.f_123702_ = p_123706_;
|
||||
+ this.f_123702_ = p_123706_.m_41777_(); //Forge: Fix stack updating after the fact causing particle changes.
|
||||
}
|
||||
|
||||
public void m_7711_(FriendlyByteBuf p_123716_) {
|
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/particles/</title></head>
|
||||
<body>
|
||||
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/particles/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="BlockParticleOption.java.patch">BlockParticleOption.java.patch</a> 07-Oct-2023 14:12 551
|
||||
<a href="ItemParticleOption.java.patch">ItemParticleOption.java.patch</a> 07-Oct-2023 14:12 480
|
||||
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="e86bb514c20f11fb707643ced5e9ece6" data-cf-beacon='{"rayId":"85f0174c8fe650c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,310 @@
|
|||
--- a/net/minecraft/core/registries/BuiltInRegistries.java
|
||||
+++ b/net/minecraft/core/registries/BuiltInRegistries.java
|
||||
@@ -114,41 +_,89 @@
|
||||
public static final DefaultedRegistry<GameEvent> f_256726_ = m_257834_(Registries.f_256827_, "step", (p_260052_) -> {
|
||||
return GameEvent.f_157785_;
|
||||
});
|
||||
- public static final Registry<SoundEvent> f_256894_ = m_258002_(Registries.f_256840_, (p_260167_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#SOUND_EVENTS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<SoundEvent> f_256894_ = forge(Registries.f_256840_, (p_260167_) -> {
|
||||
return SoundEvents.f_12019_;
|
||||
});
|
||||
- public static final DefaultedRegistry<Fluid> f_257020_ = m_257834_(Registries.f_256808_, "empty", (p_259453_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#FLUIDS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<Fluid> f_257020_ = forge(Registries.f_256808_, "empty", (p_259453_) -> {
|
||||
return Fluids.f_76191_;
|
||||
});
|
||||
- public static final Registry<MobEffect> f_256974_ = m_258002_(Registries.f_256929_, (p_259689_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#MOB_EFFECTS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<MobEffect> f_256974_ = forge(Registries.f_256929_, (p_259689_) -> {
|
||||
return MobEffects.f_19621_;
|
||||
});
|
||||
- public static final DefaultedRegistry<Block> f_256975_ = m_257834_(Registries.f_256747_, "air", (p_259909_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#BLOCKS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<Block> f_256975_ = forge(Registries.f_256747_, "air", (p_259909_) -> {
|
||||
return Blocks.f_50016_;
|
||||
});
|
||||
- public static final Registry<Enchantment> f_256876_ = m_258002_(Registries.f_256762_, (p_259104_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#ENCHANTMENTS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<Enchantment> f_256876_ = forge(Registries.f_256762_, (p_259104_) -> {
|
||||
return Enchantments.f_44987_;
|
||||
});
|
||||
- public static final DefaultedRegistry<EntityType<?>> f_256780_ = m_257834_(Registries.f_256939_, "pig", (p_259175_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#ENTITY_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<EntityType<?>> f_256780_ = forge(Registries.f_256939_, "pig", (p_259175_) -> {
|
||||
return EntityType.f_20510_;
|
||||
});
|
||||
- public static final DefaultedRegistry<Item> f_257033_ = m_257834_(Registries.f_256913_, "air", (p_260227_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#ITEMS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<Item> f_257033_ = forge(Registries.f_256913_, "air", (p_260227_) -> {
|
||||
return Items.f_41852_;
|
||||
});
|
||||
- public static final DefaultedRegistry<Potion> f_256980_ = m_257988_(Registries.f_256973_, "empty", (p_259869_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#POTIONS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<Potion> f_256980_ = forge(Registries.f_256973_, "empty", (p_259869_) -> {
|
||||
return Potions.f_43598_;
|
||||
});
|
||||
- public static final Registry<ParticleType<?>> f_257034_ = m_258002_(Registries.f_256890_, (p_260266_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#PARTICLE_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<ParticleType<?>> f_257034_ = forge(Registries.f_256890_, (p_260266_) -> {
|
||||
return ParticleTypes.f_123794_;
|
||||
});
|
||||
- public static final Registry<BlockEntityType<?>> f_257049_ = m_258002_(Registries.f_256922_, (p_259434_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#BLOCK_ENTITY_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<BlockEntityType<?>> f_257049_ = forge(Registries.f_256922_, (p_259434_) -> {
|
||||
return BlockEntityType.f_58917_;
|
||||
});
|
||||
- public static final DefaultedRegistry<PaintingVariant> f_257051_ = m_257988_(Registries.f_256836_, "kebab", PaintingVariants::m_218942_);
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#PAINTING_VARIANTS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<PaintingVariant> f_257051_ = forge(Registries.f_256836_, "kebab", PaintingVariants::m_218942_);
|
||||
public static final Registry<ResourceLocation> f_256771_ = m_258002_(Registries.f_256887_, (p_259833_) -> {
|
||||
return Stats.f_12926_;
|
||||
});
|
||||
- public static final DefaultedRegistry<ChunkStatus> f_256940_ = m_257988_(Registries.f_256755_, "empty", (p_259971_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#CHUNK_STATUS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<ChunkStatus> f_256940_ = forge(Registries.f_256755_, "empty", (p_259971_) -> {
|
||||
return ChunkStatus.f_62314_;
|
||||
});
|
||||
public static final Registry<RuleTestType<?>> f_256978_ = m_258002_(Registries.f_256947_, (p_259641_) -> {
|
||||
@@ -160,42 +_,90 @@
|
||||
public static final Registry<PosRuleTestType<?>> f_256957_ = m_258002_(Registries.f_257009_, (p_259262_) -> {
|
||||
return PosRuleTestType.f_74205_;
|
||||
});
|
||||
- public static final Registry<MenuType<?>> f_256818_ = m_258002_(Registries.f_256798_, (p_259341_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#MENU_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<MenuType<?>> f_256818_ = forge(Registries.f_256798_, (p_259341_) -> {
|
||||
return MenuType.f_39964_;
|
||||
});
|
||||
- public static final Registry<RecipeType<?>> f_256990_ = m_258002_(Registries.f_256954_, (p_259086_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#RECIPE_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<RecipeType<?>> f_256990_ = forge(Registries.f_256954_, (p_259086_) -> {
|
||||
return RecipeType.f_44107_;
|
||||
});
|
||||
- public static final Registry<RecipeSerializer<?>> f_256769_ = m_258002_(Registries.f_256764_, (p_260230_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#RECIPE_SERIALIZERS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<RecipeSerializer<?>> f_256769_ = forge(Registries.f_256764_, (p_260230_) -> {
|
||||
return RecipeSerializer.f_44077_;
|
||||
});
|
||||
- public static final Registry<Attribute> f_256951_ = m_258002_(Registries.f_256728_, (p_260300_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#ATTRIBUTES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<Attribute> f_256951_ = forge(Registries.f_256728_, (p_260300_) -> {
|
||||
return Attributes.f_22286_;
|
||||
});
|
||||
public static final Registry<PositionSourceType<?>> f_256972_ = m_258002_(Registries.f_256792_, (p_259113_) -> {
|
||||
return PositionSourceType.f_157871_;
|
||||
});
|
||||
- public static final Registry<ArgumentTypeInfo<?, ?>> f_256979_ = m_258002_(Registries.f_256982_, (RegistryBootstrap)ArgumentTypeInfos::m_235384_);
|
||||
- public static final Registry<StatType<?>> f_256899_ = m_258002_(Registries.f_256849_, (p_259967_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#COMMAND_ARGUMENT_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<ArgumentTypeInfo<?, ?>> f_256979_ = forge(Registries.f_256982_, (RegistryBootstrap)ArgumentTypeInfos::m_235384_);
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#STAT_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<StatType<?>> f_256899_ = forge(Registries.f_256849_, (p_259967_) -> {
|
||||
return Stats.f_12982_;
|
||||
});
|
||||
public static final DefaultedRegistry<VillagerType> f_256934_ = m_257988_(Registries.f_257019_, "plains", (p_259473_) -> {
|
||||
return VillagerType.f_35821_;
|
||||
});
|
||||
- public static final DefaultedRegistry<VillagerProfession> f_256735_ = m_257988_(Registries.f_256749_, "none", (p_259037_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#VILLAGER_PROFESSIONS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<VillagerProfession> f_256735_ = forge(Registries.f_256749_, "none", (p_259037_) -> {
|
||||
return VillagerProfession.f_35585_;
|
||||
});
|
||||
- public static final Registry<PoiType> f_256941_ = m_258002_(Registries.f_256805_, PoiTypes::m_218082_);
|
||||
- public static final DefaultedRegistry<MemoryModuleType<?>> f_256784_ = m_257988_(Registries.f_257023_, "dummy", (p_259248_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#POI_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<PoiType> f_256941_ = forge(Registries.f_256805_, PoiTypes::m_218082_);
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#MEMORY_MODULE_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<MemoryModuleType<?>> f_256784_ = forge(Registries.f_257023_, "dummy", (p_259248_) -> {
|
||||
return MemoryModuleType.f_26349_;
|
||||
});
|
||||
- public static final DefaultedRegistry<SensorType<?>> f_256733_ = m_257988_(Registries.f_256937_, "dummy", (p_259757_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#SENSOR_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final DefaultedRegistry<SensorType<?>> f_256733_ = forge(Registries.f_256937_, "dummy", (p_259757_) -> {
|
||||
return SensorType.f_26809_;
|
||||
});
|
||||
- public static final Registry<Schedule> f_256962_ = m_258002_(Registries.f_256723_, (p_259540_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#SCHEDULES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<Schedule> f_256962_ = forge(Registries.f_256723_, (p_259540_) -> {
|
||||
return Schedule.f_38012_;
|
||||
});
|
||||
- public static final Registry<Activity> f_256785_ = m_258002_(Registries.f_257025_, (p_260197_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#ACTIVITIES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<Activity> f_256785_ = forge(Registries.f_257025_, (p_260197_) -> {
|
||||
return Activity.f_37979_;
|
||||
});
|
||||
public static final Registry<LootPoolEntryType> f_257035_ = m_258002_(Registries.f_257032_, (p_260042_) -> {
|
||||
@@ -228,10 +_,18 @@
|
||||
public static final Registry<BlockPredicateType<?>> f_256906_ = m_258002_(Registries.f_256774_, (p_260006_) -> {
|
||||
return BlockPredicateType.f_190444_;
|
||||
});
|
||||
- public static final Registry<WorldCarver<?>> f_257001_ = m_258002_(Registries.f_256812_, (p_260200_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#WORLD_CARVERS} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<WorldCarver<?>> f_257001_ = forge(Registries.f_256812_, (p_260200_) -> {
|
||||
return WorldCarver.f_64974_;
|
||||
});
|
||||
- public static final Registry<Feature<?>> f_256810_ = m_258002_(Registries.f_256833_, (p_259143_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#FEATURES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<Feature<?>> f_256810_ = forge(Registries.f_256833_, (p_259143_) -> {
|
||||
return Feature.f_65731_;
|
||||
});
|
||||
public static final Registry<StructurePlacementType<?>> f_256950_ = m_258002_(Registries.f_256888_, (p_259179_) -> {
|
||||
@@ -246,10 +_,18 @@
|
||||
public static final Registry<PlacementModifierType<?>> f_256986_ = m_258002_(Registries.f_256843_, (p_260335_) -> {
|
||||
return PlacementModifierType.f_191853_;
|
||||
});
|
||||
- public static final Registry<BlockStateProviderType<?>> f_256760_ = m_258002_(Registries.f_256891_, (p_259345_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#BLOCK_STATE_PROVIDER_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<BlockStateProviderType<?>> f_256760_ = forge(Registries.f_256891_, (p_259345_) -> {
|
||||
return BlockStateProviderType.f_68752_;
|
||||
});
|
||||
- public static final Registry<FoliagePlacerType<?>> f_256861_ = m_258002_(Registries.f_256905_, (p_260329_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#FOLIAGE_PLACER_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<FoliagePlacerType<?>> f_256861_ = forge(Registries.f_256905_, (p_260329_) -> {
|
||||
return FoliagePlacerType.f_68591_;
|
||||
});
|
||||
public static final Registry<TrunkPlacerType<?>> f_256920_ = m_258002_(Registries.f_256963_, (p_259690_) -> {
|
||||
@@ -258,7 +_,11 @@
|
||||
public static final Registry<RootPlacerType<?>> f_256742_ = m_258002_(Registries.f_256768_, (p_259493_) -> {
|
||||
return RootPlacerType.f_225898_;
|
||||
});
|
||||
- public static final Registry<TreeDecoratorType<?>> f_256987_ = m_258002_(Registries.f_256845_, (p_259122_) -> {
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use {@link net.minecraftforge.registries.ForgeRegistries#TREE_DECORATOR_TYPES} instead.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final Registry<TreeDecoratorType<?>> f_256987_ = forge(Registries.f_256845_, (p_259122_) -> {
|
||||
return TreeDecoratorType.f_70043_;
|
||||
});
|
||||
public static final Registry<FeatureSizeType<?>> f_256958_ = m_258002_(Registries.f_256720_, (p_259370_) -> {
|
||||
@@ -289,10 +_,18 @@
|
||||
return m_258073_(p_260095_, Lifecycle.stable(), p_259057_);
|
||||
}
|
||||
|
||||
+ private static <T> Registry<T> forge(ResourceKey<? extends Registry<T>> key, BuiltInRegistries.RegistryBootstrap<T> def) {
|
||||
+ return forge(key, Lifecycle.stable(), def);
|
||||
+ }
|
||||
+
|
||||
private static <T> DefaultedRegistry<T> m_257988_(ResourceKey<? extends Registry<T>> p_259887_, String p_259325_, BuiltInRegistries.RegistryBootstrap<T> p_259759_) {
|
||||
return m_257600_(p_259887_, p_259325_, Lifecycle.stable(), p_259759_);
|
||||
}
|
||||
|
||||
+ private static <T> DefaultedRegistry<T> forge(ResourceKey<? extends Registry<T>> key, String defKey, BuiltInRegistries.RegistryBootstrap<T> def) {
|
||||
+ return forge(key, defKey, Lifecycle.stable(), def);
|
||||
+ }
|
||||
+
|
||||
private static <T> DefaultedRegistry<T> m_257834_(ResourceKey<? extends Registry<T>> p_259296_, String p_259101_, BuiltInRegistries.RegistryBootstrap<T> p_259485_) {
|
||||
return m_257762_(p_259296_, p_259101_, Lifecycle.stable(), p_259485_);
|
||||
}
|
||||
@@ -301,10 +_,19 @@
|
||||
return m_257895_(p_259121_, new MappedRegistry<>(p_259121_, p_259977_, false), p_259874_, p_259977_);
|
||||
}
|
||||
|
||||
+ private static <T> Registry<T> forge(ResourceKey<? extends Registry<T>> key, Lifecycle cycle, BuiltInRegistries.RegistryBootstrap<T> def) {
|
||||
+ return m_257895_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle), def, cycle);
|
||||
+ }
|
||||
+
|
||||
private static <T> DefaultedRegistry<T> m_257600_(ResourceKey<? extends Registry<T>> p_259400_, String p_259678_, Lifecycle p_259157_, BuiltInRegistries.RegistryBootstrap<T> p_259806_) {
|
||||
return m_257895_(p_259400_, new DefaultedMappedRegistry<>(p_259678_, p_259400_, p_259157_, false), p_259806_, p_259157_);
|
||||
}
|
||||
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ private static <T> DefaultedRegistry<T> forge(ResourceKey<? extends Registry<T>> key, String defKey, Lifecycle cycle, BuiltInRegistries.RegistryBootstrap<T> def) {
|
||||
+ return (DefaultedRegistry<T>) m_257895_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle, defKey), def, cycle);
|
||||
+ }
|
||||
+
|
||||
private static <T> DefaultedRegistry<T> m_257762_(ResourceKey<? extends Registry<T>> p_260010_, String p_260220_, Lifecycle p_260139_, BuiltInRegistries.RegistryBootstrap<T> p_260185_) {
|
||||
return m_257895_(p_260010_, new DefaultedMappedRegistry<>(p_260220_, p_260010_, p_260139_, true), p_260185_, p_260139_);
|
||||
}
|
||||
@@ -350,7 +_,7 @@
|
||||
|
||||
if (p_259410_ instanceof DefaultedRegistry) {
|
||||
ResourceLocation resourcelocation = ((DefaultedRegistry)p_259410_).m_122315_();
|
||||
- Validate.notNull(p_259410_.m_7745_(resourcelocation), "Missing default of DefaultedMappedRegistry: " + resourcelocation);
|
||||
+ Validate.notNull(p_259410_.m_7745_(resourcelocation), "Missing default of DefaultedMappedRegistry: " + p_260209_.m_123023_() + ", Entry: " + resourcelocation);
|
||||
}
|
||||
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head><title>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/registries/</title></head>
|
||||
<body>
|
||||
<h1>Index of /mirror/src/Magma-1-20-x/patches/minecraft/net/minecraft/core/registries/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="BuiltInRegistries.java.patch">BuiltInRegistries.java.patch</a> 07-Oct-2023 14:12 16K
|
||||
</pre><hr><script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" nonce="109d7e8c15604af040f6e74bebea898e" data-cf-beacon='{"rayId":"85f0174eec9d50c2","version":"2024.2.4","r":1,"token":"583109dda43e47a593fd006526a81120","b":1}' crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue