@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/level/CommandBlockListenerAbstract.java
|
||||
+++ b/net/minecraft/world/level/CommandBlockListenerAbstract.java
|
||||
@@ -30,6 +30,10 @@
|
||||
@@ -31,6 +31,10 @@
|
||||
private IChatBaseComponent lastOutput;
|
||||
private String command = "";
|
||||
private IChatBaseComponent customName;
|
||||
private IChatBaseComponent name;
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public abstract org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper);
|
||||
+ // CraftBukkit end
|
||||
|
||||
public CommandBlockListenerAbstract() {
|
||||
this.customName = CommandBlockListenerAbstract.c;
|
||||
@@ -126,7 +130,7 @@
|
||||
this.name = CommandBlockListenerAbstract.DEFAULT_NAME;
|
||||
@@ -127,7 +131,7 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/Explosion.java
|
||||
+++ b/net/minecraft/world/level/Explosion.java
|
||||
@@ -42,6 +42,14 @@
|
||||
@@ -43,6 +43,14 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -14,43 +14,46 @@
|
||||
+
|
||||
public class Explosion {
|
||||
|
||||
private static final ExplosionDamageCalculator a = new ExplosionDamageCalculator();
|
||||
@@ -59,11 +67,12 @@
|
||||
private final ExplosionDamageCalculator l;
|
||||
private final List<BlockPosition> blocks = Lists.newArrayList();
|
||||
private final Map<EntityHuman, Vec3D> n = Maps.newHashMap();
|
||||
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
||||
@@ -61,6 +69,7 @@
|
||||
private final ExplosionDamageCalculator damageCalculator;
|
||||
private final List<BlockPosition> toBlow;
|
||||
private final Map<EntityHuman, Vec3D> hitPlayers;
|
||||
+ public boolean wasCanceled = false; // CraftBukkit - add field
|
||||
|
||||
public Explosion(World world, @Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
this.world = world;
|
||||
public Explosion(World world, @Nullable Entity entity, double d0, double d1, double d2, float f) {
|
||||
this(world, entity, d0, d1, d2, f, false, Explosion.Effect.DESTROY);
|
||||
@@ -85,7 +94,7 @@
|
||||
this.hitPlayers = Maps.newHashMap();
|
||||
this.level = world;
|
||||
this.source = entity;
|
||||
- this.size = f;
|
||||
+ this.size = (float) Math.max(f, 0.0); // CraftBukkit - clamp bad values
|
||||
this.posX = d0;
|
||||
this.posY = d1;
|
||||
this.posZ = d2;
|
||||
@@ -113,6 +122,11 @@
|
||||
- this.radius = f;
|
||||
+ this.radius = (float) Math.max(f, 0.0); // CraftBukkit - clamp bad values
|
||||
this.x = d0;
|
||||
this.y = d1;
|
||||
this.z = d2;
|
||||
@@ -135,6 +144,11 @@
|
||||
}
|
||||
|
||||
public void a() {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.size < 0.1F) {
|
||||
+ if (this.radius < 0.1F) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.a(this.source, GameEvent.EXPLODE, new BlockPosition(this.x, this.y, this.z));
|
||||
Set<BlockPosition> set = Sets.newHashSet();
|
||||
boolean flag = true;
|
||||
|
||||
@@ -146,7 +160,7 @@
|
||||
@@ -174,7 +188,7 @@
|
||||
f -= ((Float) optional.get() + 0.3F) * 0.3F;
|
||||
}
|
||||
|
||||
- if (f > 0.0F && this.l.a(this, this.world, blockposition, iblockdata, f)) {
|
||||
+ if (f > 0.0F && this.l.a(this, this.world, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions
|
||||
- if (f > 0.0F && this.damageCalculator.a(this, this.level, blockposition, iblockdata, f)) {
|
||||
+ if (f > 0.0F && this.damageCalculator.a(this, this.level, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions
|
||||
set.add(blockposition);
|
||||
}
|
||||
|
||||
@@ -190,7 +204,16 @@
|
||||
@@ -218,7 +232,16 @@
|
||||
double d12 = (double) a(vec3d, entity);
|
||||
double d13 = (1.0D - d7) * d12;
|
||||
|
||||
@@ -68,18 +71,18 @@
|
||||
double d14 = d13;
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
@@ -232,6 +255,51 @@
|
||||
@@ -260,6 +283,51 @@
|
||||
|
||||
Collections.shuffle(this.blocks, this.world.random);
|
||||
Iterator iterator = this.blocks.iterator();
|
||||
Collections.shuffle(this.toBlow, this.level.random);
|
||||
Iterator iterator = this.toBlow.iterator();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = this.world.getWorld();
|
||||
+ org.bukkit.World bworld = this.level.getWorld();
|
||||
+ org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
|
||||
+ Location location = new Location(bworld, this.posX, this.posY, this.posZ);
|
||||
+ Location location = new Location(bworld, this.x, this.y, this.z);
|
||||
+
|
||||
+ List<org.bukkit.block.Block> blockList = Lists.newArrayList();
|
||||
+ for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--) {
|
||||
+ BlockPosition cpos = (BlockPosition) this.blocks.get(i1);
|
||||
+ for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
|
||||
+ BlockPosition cpos = (BlockPosition) this.toBlow.get(i1);
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
|
||||
+ if (!bblock.getType().isAir()) {
|
||||
+ blockList.add(bblock);
|
||||
@@ -91,24 +94,24 @@
|
||||
+ float yield;
|
||||
+
|
||||
+ if (explode != null) {
|
||||
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.c == Explosion.Effect.DESTROY ? 1.0F / this.size : 1.0F);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.Effect.DESTROY ? 1.0F / this.radius : 1.0F);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+ cancelled = event.isCancelled();
|
||||
+ bukkitBlocks = event.blockList();
|
||||
+ yield = event.getYield();
|
||||
+ } else {
|
||||
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.c == Explosion.Effect.DESTROY ? 1.0F / this.size : 1.0F);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.Effect.DESTROY ? 1.0F / this.radius : 1.0F);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+ cancelled = event.isCancelled();
|
||||
+ bukkitBlocks = event.blockList();
|
||||
+ yield = event.getYield();
|
||||
+ }
|
||||
+
|
||||
+ this.blocks.clear();
|
||||
+ this.toBlow.clear();
|
||||
+
|
||||
+ for (org.bukkit.block.Block bblock : bukkitBlocks) {
|
||||
+ BlockPosition coords = new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ());
|
||||
+ blocks.add(coords);
|
||||
+ toBlow.add(coords);
|
||||
+ }
|
||||
+
|
||||
+ if (cancelled) {
|
||||
@@ -116,35 +119,35 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ iterator = this.blocks.iterator();
|
||||
+ iterator = this.toBlow.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
BlockPosition blockposition = (BlockPosition) iterator.next();
|
||||
@@ -246,8 +314,8 @@
|
||||
TileEntity tileentity = block.isTileEntity() ? this.world.getTileEntity(blockposition) : null;
|
||||
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.ORIGIN, Vec3D.a((BaseBlockPosition) blockposition)).set(LootContextParameters.TOOL, ItemStack.b).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity).setOptional(LootContextParameters.THIS_ENTITY, this.source);
|
||||
@@ -274,8 +342,8 @@
|
||||
TileEntity tileentity = iblockdata.isTileEntity() ? this.level.getTileEntity(blockposition) : null;
|
||||
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).a(this.level.random).set(LootContextParameters.ORIGIN, Vec3D.a((BaseBlockPosition) blockposition)).set(LootContextParameters.TOOL, ItemStack.EMPTY).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity).setOptional(LootContextParameters.THIS_ENTITY, this.source);
|
||||
|
||||
- if (this.c == Explosion.Effect.DESTROY) {
|
||||
- loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, this.size);
|
||||
+ if (this.c == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
|
||||
- if (this.blockInteraction == Explosion.Effect.DESTROY) {
|
||||
- loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, this.radius);
|
||||
+ if (this.blockInteraction == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
|
||||
+ loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
|
||||
}
|
||||
|
||||
iblockdata.a(loottableinfo_builder).forEach((itemstack) -> {
|
||||
@@ -277,7 +345,11 @@
|
||||
@@ -305,7 +373,11 @@
|
||||
BlockPosition blockposition2 = (BlockPosition) iterator1.next();
|
||||
|
||||
if (this.d.nextInt(3) == 0 && this.world.getType(blockposition2).isAir() && this.world.getType(blockposition2.down()).i(this.world, blockposition2.down())) {
|
||||
- this.world.setTypeUpdate(blockposition2, BlockFireAbstract.a((IBlockAccess) this.world, blockposition2));
|
||||
if (this.random.nextInt(3) == 0 && this.level.getType(blockposition2).isAir() && this.level.getType(blockposition2.down()).i(this.level, blockposition2.down())) {
|
||||
- this.level.setTypeUpdate(blockposition2, BlockFireAbstract.a((IBlockAccess) this.level, blockposition2));
|
||||
+ // CraftBukkit start - Ignition by explosion
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), this).isCancelled()) {
|
||||
+ this.world.setTypeUpdate(blockposition2, BlockFireAbstract.a((IBlockAccess) this.world, blockposition2));
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), this).isCancelled()) {
|
||||
+ this.level.setTypeUpdate(blockposition2, BlockFireAbstract.a((IBlockAccess) this.level, blockposition2));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,6 +357,7 @@
|
||||
@@ -313,6 +385,7 @@
|
||||
}
|
||||
|
||||
private static void a(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
--- a/net/minecraft/world/level/GameRules.java
|
||||
+++ b/net/minecraft/world/level/GameRules.java
|
||||
@@ -113,7 +113,7 @@
|
||||
@@ -118,7 +118,7 @@
|
||||
}
|
||||
|
||||
public <T extends GameRules.GameRuleValue<T>> T get(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- return (GameRules.GameRuleValue) this.J.get(gamerules_gamerulekey);
|
||||
+ return (T) this.J.get(gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
- return (GameRules.GameRuleValue) this.rules.get(gamerules_gamerulekey);
|
||||
+ return (T) this.rules.get(gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public NBTTagCompound a() {
|
||||
@@ -144,8 +144,8 @@
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
private void a(DynamicLike<?> dynamiclike) {
|
||||
this.rules.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
|
||||
- Optional optional = dynamiclike.get(gamerules_gamerulekey.id).asString().result();
|
||||
+ Optional<String> optional = dynamiclike.get(gamerules_gamerulekey.id).asString().result(); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(gamerules_gamerulevalue);
|
||||
optional.ifPresent(gamerules_gamerulevalue::setValue);
|
||||
@@ -152,8 +152,8 @@
|
||||
}
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
|
||||
@@ -19,26 +28,17 @@
|
||||
+ ((GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition).a(gamerules_gamerulevisitor, (GameRules.GameRuleKey<T>) gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public boolean getBoolean(GameRules.GameRuleKey<GameRules.GameRuleBoolean> gamerules_gamerulekey) {
|
||||
@@ -196,7 +196,7 @@
|
||||
public void a(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
|
||||
@@ -245,7 +245,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void setValue(String s) {
|
||||
+ public void setValue(String s) { // PAIL - protected->public
|
||||
this.b = Boolean.parseBoolean(s);
|
||||
public T getValue() {
|
||||
- return (GameRules.GameRuleValue) this.constructor.apply(this);
|
||||
+ return this.constructor.apply(this); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void setValue(String s) {
|
||||
+ public void setValue(String s) { // PAIL - protected->public
|
||||
this.b = c(s);
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@
|
||||
public void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
@@ -275,7 +275,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -47,12 +47,21 @@
|
||||
|
||||
public abstract String getValue();
|
||||
|
||||
@@ -339,7 +339,7 @@
|
||||
@@ -341,7 +341,7 @@
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
- return (GameRules.GameRuleValue) this.b.apply(this);
|
||||
+ return this.b.apply(this); // CraftBukkit - decompile error
|
||||
@Override
|
||||
- protected void setValue(String s) {
|
||||
+ public void setValue(String s) { // PAIL - protected->public
|
||||
this.value = Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void setValue(String s) {
|
||||
+ public void setValue(String s) { // PAIL - protected->public
|
||||
this.value = c(s);
|
||||
}
|
||||
|
||||
public void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/GeneratorAccess.java
|
||||
+++ b/net/minecraft/world/level/GeneratorAccess.java
|
||||
@@ -57,4 +57,6 @@
|
||||
default void triggerEffect(int i, BlockPosition blockposition, int j) {
|
||||
this.a((EntityHuman) null, i, blockposition, j);
|
||||
@@ -77,4 +77,6 @@
|
||||
default void a(@Nullable Entity entity, GameEvent gameevent, Entity entity1) {
|
||||
this.a(entity, gameevent, entity1.getChunkCoordinates());
|
||||
}
|
||||
+
|
||||
+ net.minecraft.server.level.WorldServer getMinecraftWorld(); // CraftBukkit
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
--- a/net/minecraft/world/level/IBlockAccess.java
|
||||
+++ b/net/minecraft/world/level/IBlockAccess.java
|
||||
@@ -41,8 +41,8 @@
|
||||
return BlockPosition.a(axisalignedbb).map(this::getType);
|
||||
@@ -26,7 +26,7 @@
|
||||
default <T extends TileEntity> Optional<T> a(BlockPosition blockposition, TileEntityTypes<T> tileentitytypes) {
|
||||
TileEntity tileentity = this.getTileEntity(blockposition);
|
||||
|
||||
- return tileentity != null && tileentity.getTileType() == tileentitytypes ? Optional.of(tileentity) : Optional.empty();
|
||||
+ return tileentity != null && tileentity.getTileType() == tileentitytypes ? (Optional<T>) Optional.of(tileentity) : Optional.empty(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
IBlockData getType(BlockPosition blockposition);
|
||||
@@ -58,8 +58,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
- default MovingObjectPositionBlock rayTrace(RayTrace raytrace) {
|
||||
- return (MovingObjectPositionBlock) a(raytrace, (raytrace1, blockposition) -> {
|
||||
- return (MovingObjectPositionBlock) a(raytrace.b(), raytrace.a(), raytrace, (raytrace1, blockposition) -> {
|
||||
+ // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
|
||||
+ default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
Fluid fluid = this.getFluid(blockposition);
|
||||
Vec3D vec3d = raytrace1.b();
|
||||
@@ -55,6 +55,12 @@
|
||||
@@ -72,6 +72,12 @@
|
||||
double d1 = movingobjectpositionblock1 == null ? Double.MAX_VALUE : raytrace1.b().distanceSquared(movingobjectpositionblock1.getPos());
|
||||
|
||||
return d0 <= d1 ? movingobjectpositionblock : movingobjectpositionblock1;
|
||||
@@ -19,14 +28,14 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ default MovingObjectPositionBlock rayTrace(RayTrace raytrace) {
|
||||
+ return (MovingObjectPositionBlock) a(raytrace, (raytrace1, blockposition) -> {
|
||||
+ return (MovingObjectPositionBlock) a(raytrace.b(), raytrace.a(), raytrace, (raytrace1, blockposition) -> {
|
||||
+ return this.rayTraceBlock(raytrace1, blockposition); // CraftBukkit - moved into separate method
|
||||
}, (raytrace1) -> {
|
||||
Vec3D vec3d = raytrace1.b().d(raytrace1.a());
|
||||
|
||||
@@ -130,7 +136,7 @@
|
||||
double d13 = d10 * (i1 > 0 ? 1.0D - MathHelper.h(d4) : MathHelper.h(d4));
|
||||
double d14 = d11 * (j1 > 0 ? 1.0D - MathHelper.h(d5) : MathHelper.h(d5));
|
||||
@@ -144,7 +150,7 @@
|
||||
double d13 = d10 * (i1 > 0 ? 1.0D - MathHelper.g(d4) : MathHelper.g(d4));
|
||||
double d14 = d11 * (j1 > 0 ? 1.0D - MathHelper.g(d5) : MathHelper.g(d5));
|
||||
|
||||
- Object object;
|
||||
+ T object; // CraftBukkit - decompile error
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
+++ b/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
@@ -60,6 +60,7 @@
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
public void setMobName(EntityTypes<?> entitytypes) {
|
||||
this.spawnData.getEntity().setString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
|
||||
+ this.mobs.clear(); // CraftBukkit - SPIGOT-3496, MC-92282
|
||||
this.nextSpawnData.getEntity().setString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
|
||||
+ this.spawnPotentials = MobSpawnerAbstract.EMPTY_POTENTIALS; // CraftBukkit - SPIGOT-3496, MC-92282
|
||||
}
|
||||
|
||||
private boolean h() {
|
||||
@@ -149,7 +150,7 @@
|
||||
}
|
||||
private boolean c(World world, BlockPosition blockposition) {
|
||||
@@ -156,7 +157,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!worldserver.addAllEntitiesSafely(entity)) {
|
||||
+ if (!worldserver.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit
|
||||
this.i();
|
||||
return;
|
||||
}
|
||||
- if (!worldserver.addAllEntitiesSafely(entity)) {
|
||||
+ if (!worldserver.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit
|
||||
this.d(worldserver, blockposition);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/world/level/RayTrace.java
|
||||
+++ b/net/minecraft/world/level/RayTrace.java
|
||||
@@ -24,7 +24,7 @@
|
||||
this.b = vec3d1;
|
||||
this.c = raytrace_blockcollisionoption;
|
||||
this.d = raytrace_fluidcollisionoption;
|
||||
- this.e = VoxelShapeCollision.a(entity);
|
||||
+ this.e = (entity == null) ? VoxelShapeCollision.a() : VoxelShapeCollision.a(entity); // CraftBukkit
|
||||
this.to = vec3d1;
|
||||
this.block = raytrace_blockcollisionoption;
|
||||
this.fluid = raytrace_fluidcollisionoption;
|
||||
- this.collisionContext = VoxelShapeCollision.a(entity);
|
||||
+ this.collisionContext = (entity == null) ? VoxelShapeCollision.a() : VoxelShapeCollision.a(entity); // CraftBukkit
|
||||
}
|
||||
|
||||
public Vec3D a() {
|
||||
@@ -53,7 +53,7 @@
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
private final Predicate<Fluid> predicate;
|
||||
private final Predicate<Fluid> canPick;
|
||||
|
||||
- private FluidCollisionOption(Predicate predicate) {
|
||||
+ private FluidCollisionOption(Predicate<Fluid> predicate) { // CraftBukkit - decompile error
|
||||
this.predicate = predicate;
|
||||
this.canPick = predicate;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/SpawnerCreature.java
|
||||
+++ b/net/minecraft/world/level/SpawnerCreature.java
|
||||
@@ -45,6 +45,11 @@
|
||||
@@ -47,6 +47,11 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public final class SpawnerCreature {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -66,7 +71,8 @@
|
||||
@@ -73,7 +78,8 @@
|
||||
if (entity instanceof EntityInsentient) {
|
||||
EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -101,10 +107,49 @@
|
||||
EnumCreatureType[] aenumcreaturetype = SpawnerCreature.c;
|
||||
@@ -108,10 +114,49 @@
|
||||
EnumCreatureType[] aenumcreaturetype = SpawnerCreature.SPAWNING_CATEGORIES;
|
||||
int i = aenumcreaturetype.length;
|
||||
|
||||
+ // CraftBukkit start - Other mob type spawn tick rate
|
||||
@@ -39,7 +39,7 @@
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
|
||||
+ // CraftBukkit start - Use per-world spawn limits
|
||||
+ boolean spawnThisTick = true;
|
||||
+ int limit = enumcreaturetype.c();
|
||||
+ int limit = enumcreaturetype.b();
|
||||
+ switch (enumcreaturetype) {
|
||||
+ case MONSTER:
|
||||
+ spawnThisTick = spawnMonsterThisTick;
|
||||
@@ -70,10 +70,10 @@
|
||||
+
|
||||
+ if ((flag || !enumcreaturetype.d()) && (flag1 || enumcreaturetype.d()) && (flag2 || !enumcreaturetype.e()) && spawnercreature_d.a(enumcreaturetype, limit)) {
|
||||
+ // CraftBukkit end
|
||||
a(enumcreaturetype, worldserver, chunk, (entitytypes, blockposition, ichunkaccess) -> {
|
||||
return spawnercreature_d.a(entitytypes, blockposition, ichunkaccess);
|
||||
}, (entityinsentient, ichunkaccess) -> {
|
||||
@@ -179,10 +224,14 @@
|
||||
Objects.requireNonNull(spawnercreature_d);
|
||||
SpawnerCreature.c spawnercreature_c = spawnercreature_d::a;
|
||||
|
||||
@@ -196,10 +241,14 @@
|
||||
entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
if (a(worldserver, entityinsentient, d2)) {
|
||||
groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
|
||||
@@ -83,7 +83,7 @@
|
||||
- spawnercreature_a.run(entityinsentient, ichunkaccess);
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL);
|
||||
+ if (!entityinsentient.dead) {
|
||||
+ if (!entityinsentient.isRemoved()) {
|
||||
+ ++j;
|
||||
+ ++k1;
|
||||
+ spawnercreature_a.run(entityinsentient, ichunkaccess);
|
||||
@@ -92,25 +92,25 @@
|
||||
if (j >= entityinsentient.getMaxSpawnGroup()) {
|
||||
return;
|
||||
}
|
||||
@@ -365,7 +414,7 @@
|
||||
@@ -370,7 +419,7 @@
|
||||
|
||||
if (entityinsentient.a((GeneratorAccess) worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) worldaccess)) {
|
||||
groupdataentity = entityinsentient.prepare(worldaccess, worldaccess.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
|
||||
- worldaccess.addAllEntities(entityinsentient);
|
||||
+ worldaccess.addAllEntities(entityinsentient, SpawnReason.CHUNK_GEN); // CraftBukkit
|
||||
flag = true;
|
||||
if (entityinsentient.a((GeneratorAccess) worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) worldaccess)) {
|
||||
groupdataentity = entityinsentient.prepare(worldaccess, worldaccess.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
|
||||
- worldaccess.addAllEntities(entityinsentient);
|
||||
+ worldaccess.addAllEntities(entityinsentient, SpawnReason.CHUNK_GEN); // CraftBukkit
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -488,8 +537,10 @@
|
||||
return this.d;
|
||||
@@ -486,8 +535,10 @@
|
||||
return this.unmodifiableMobCategoryCounts;
|
||||
}
|
||||
|
||||
- private boolean a(EnumCreatureType enumcreaturetype) {
|
||||
- int i = enumcreaturetype.c() * this.a / SpawnerCreature.b;
|
||||
- boolean a(EnumCreatureType enumcreaturetype) {
|
||||
- int i = enumcreaturetype.b() * this.spawnableChunkCount / SpawnerCreature.MAGIC_NUMBER;
|
||||
+ // CraftBukkit start
|
||||
+ private boolean a(EnumCreatureType enumcreaturetype, int limit) {
|
||||
+ int i = limit * this.a / SpawnerCreature.b;
|
||||
+ boolean a(EnumCreatureType enumcreaturetype, int limit) {
|
||||
+ int i = limit * this.spawnableChunkCount / SpawnerCreature.MAGIC_NUMBER;
|
||||
+ // CraftBukkit end
|
||||
|
||||
return this.b.getInt(enumcreaturetype) < i;
|
||||
return this.mobCategoryCounts.getInt(enumcreaturetype) < i;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/level/TickListServer.java
|
||||
+++ b/net/minecraft/world/level/TickListServer.java
|
||||
@@ -48,11 +48,17 @@
|
||||
@@ -47,11 +47,17 @@
|
||||
public void b() {
|
||||
int i = this.nextTickList.size();
|
||||
int i = this.tickNextTickList.size();
|
||||
|
||||
- if (i != this.nextTickListHash.size()) {
|
||||
- if (i != this.tickNextTickSet.size()) {
|
||||
+ if (false) { // CraftBukkit
|
||||
throw new IllegalStateException("TickNextTick list out of synch");
|
||||
} else {
|
||||
@@ -19,13 +19,13 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
ChunkProviderServer chunkproviderserver = this.e.getChunkProvider();
|
||||
@@ -91,7 +97,7 @@
|
||||
Iterator<NextTickListEntry<T>> iterator = this.tickNextTickList.iterator();
|
||||
@@ -89,7 +95,7 @@
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
} else {
|
||||
- this.a(nextticklistentry.a, nextticklistentry.b(), 0);
|
||||
+ this.a(nextticklistentry.a, (T) nextticklistentry.b(), 0); // CraftBukkit - decompile error
|
||||
- this.a(nextticklistentry.pos, nextticklistentry.b(), 0);
|
||||
+ this.a(nextticklistentry.pos, (T) nextticklistentry.b(), 0); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,37 @@
|
||||
--- a/net/minecraft/world/level/World.java
|
||||
+++ b/net/minecraft/world/level/World.java
|
||||
@@ -62,6 +62,21 @@
|
||||
@@ -67,6 +67,28 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutWorldBorder;
|
||||
+import net.minecraft.network.protocol.game.ClientboundSetBorderCenterPacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundSetBorderLerpSizePacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDelayPacket;
|
||||
+import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePacket;
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
+import net.minecraft.world.entity.item.EntityItem;
|
||||
+import net.minecraft.world.level.border.IWorldBorderListener;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.block.CapturedBlockState;
|
||||
+import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
+import org.bukkit.event.world.GenericGameEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -93,7 +108,49 @@
|
||||
@@ -103,7 +125,49 @@
|
||||
private final BiomeManager biomeManager;
|
||||
private final ResourceKey<World> dimensionKey;
|
||||
private final ResourceKey<World> dimension;
|
||||
|
||||
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
|
||||
+ // CraftBukkit start Added the following
|
||||
@@ -66,14 +73,14 @@
|
||||
+ this.ticksPerWaterSpawns = this.getServer().getTicksPerWaterSpawns(); // CraftBukkit
|
||||
+ this.ticksPerWaterAmbientSpawns = this.getServer().getTicksPerWaterAmbientSpawns(); // CraftBukkit
|
||||
+ this.ticksPerAmbientSpawns = this.getServer().getTicksPerAmbientSpawns(); // CraftBukkit
|
||||
+ this.typeKey = (ResourceKey) this.getServer().getHandle().getServer().customRegistry.a().c(dimensionmanager).orElseThrow(() -> {
|
||||
+ this.typeKey = (ResourceKey) this.getServer().getHandle().getServer().registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).c(dimensionmanager).orElseThrow(() -> {
|
||||
+ return new IllegalStateException("Unregistered dimension type: " + dimensionmanager);
|
||||
+ });
|
||||
+ // CraftBukkit end
|
||||
this.methodProfiler = supplier;
|
||||
this.worldData = worlddatamutable;
|
||||
this.x = dimensionmanager;
|
||||
@@ -103,12 +160,12 @@
|
||||
this.profiler = supplier;
|
||||
this.levelData = worlddatamutable;
|
||||
this.dimensionType = dimensionmanager;
|
||||
@@ -113,12 +177,12 @@
|
||||
this.worldBorder = new WorldBorder() {
|
||||
@Override
|
||||
public double getCenterX() {
|
||||
@@ -88,32 +95,32 @@
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -118,6 +175,35 @@
|
||||
this.serverThread = Thread.currentThread();
|
||||
@@ -128,6 +192,35 @@
|
||||
this.thread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, i, dimensionmanager.getGenLayerZoomer());
|
||||
this.debugWorld = flag1;
|
||||
this.isDebug = flag1;
|
||||
+ // CraftBukkit start
|
||||
+ getWorldBorder().world = (WorldServer) this;
|
||||
+ // From PlayerList.setPlayerFileData
|
||||
+ getWorldBorder().a(new IWorldBorderListener() {
|
||||
+ public void a(WorldBorder worldborder, double d0) {
|
||||
+ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE), worldborder.world);
|
||||
+ getServer().getHandle().sendAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void a(WorldBorder worldborder, double d0, double d1, long i) {
|
||||
+ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE), worldborder.world);
|
||||
+ getServer().getHandle().sendAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void a(WorldBorder worldborder, double d0, double d1) {
|
||||
+ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_CENTER), worldborder.world);
|
||||
+ getServer().getHandle().sendAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void a(WorldBorder worldborder, int i) {
|
||||
+ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_TIME), worldborder.world);
|
||||
+ getServer().getHandle().sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void b(WorldBorder worldborder, int i) {
|
||||
+ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_BLOCKS), worldborder.world);
|
||||
+ getServer().getHandle().sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void b(WorldBorder worldborder, double d0) {}
|
||||
@@ -124,7 +131,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,6 +267,17 @@
|
||||
@@ -185,6 +278,17 @@
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
@@ -139,10 +146,10 @@
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
if (this.isOutsideWorld(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.isDebugWorld()) {
|
||||
@@ -188,9 +285,24 @@
|
||||
@@ -192,9 +296,24 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -168,7 +175,7 @@
|
||||
return false;
|
||||
} else {
|
||||
IBlockData iblockdata2 = this.getType(blockposition);
|
||||
@@ -201,6 +313,7 @@
|
||||
@@ -205,6 +324,7 @@
|
||||
this.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
@@ -176,7 +183,7 @@
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.b(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -227,12 +340,65 @@
|
||||
@@ -231,12 +351,65 @@
|
||||
|
||||
this.a(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@@ -242,7 +249,7 @@
|
||||
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -314,6 +480,17 @@
|
||||
@@ -326,6 +499,17 @@
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
|
||||
try {
|
||||
@@ -260,7 +267,7 @@
|
||||
iblockdata.doPhysics(this, blockposition, block, blockposition1, false);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
|
||||
@@ -356,6 +533,14 @@
|
||||
@@ -368,6 +552,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
@@ -272,35 +279,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
if (this.isOutsideWorld(blockposition)) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
} else {
|
||||
@@ -503,9 +688,11 @@
|
||||
TileEntity tileentity1 = (TileEntity) this.tileEntityListPending.get(i);
|
||||
|
||||
if (!tileentity1.isRemoved()) {
|
||||
+ /* CraftBukkit start - Order matters, moved down
|
||||
if (!this.tileEntityList.contains(tileentity1)) {
|
||||
this.a(tileentity1);
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
if (this.isLoaded(tileentity1.getPosition())) {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
@@ -513,6 +700,12 @@
|
||||
|
||||
chunk.setTileEntity(tileentity1.getPosition(), tileentity1);
|
||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||
+ // CraftBukkit start
|
||||
+ // From above, don't screw this up - SPIGOT-1746
|
||||
+ if (!this.tileEntityList.contains(tileentity1)) {
|
||||
+ this.a(tileentity1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -557,12 +750,25 @@
|
||||
@@ -484,7 +676,17 @@
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -311,41 +293,47 @@
|
||||
+
|
||||
+ @Nullable
|
||||
+ public TileEntity getTileEntity(BlockPosition blockposition, boolean validate) {
|
||||
+ if (capturedTileEntities.containsKey(blockposition)) {
|
||||
+ return capturedTileEntities.get(blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return null;
|
||||
} else if (!this.isClientSide && Thread.currentThread() != this.serverThread) {
|
||||
return null;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (capturedTileEntities.containsKey(blockposition)) {
|
||||
+ return capturedTileEntities.get(blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
TileEntity tileentity = null;
|
||||
|
||||
if (this.tickingTileEntities) {
|
||||
@@ -597,6 +803,13 @@
|
||||
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
||||
if (!isOutsideWorld(blockposition)) {
|
||||
if (tileentity != null && !tileentity.isRemoved()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (captureBlockStates) {
|
||||
+ tileentity.setLocation(this, blockposition);
|
||||
+ capturedTileEntities.put(blockposition.immutableCopy(), tileentity);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.tickingTileEntities) {
|
||||
tileentity.setLocation(this, blockposition);
|
||||
Iterator iterator = this.tileEntityListPending.iterator();
|
||||
@@ -621,7 +834,7 @@
|
||||
return this.isOutsideWorld(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAtWorldCoords(blockposition).a(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
|
||||
}
|
||||
|
||||
public void removeTileEntity(BlockPosition blockposition) {
|
||||
- TileEntity tileentity = this.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = this.getTileEntity(blockposition, false); // CraftBukkit
|
||||
@@ -492,6 +694,12 @@
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
|
||||
if (tileentity != null && this.tickingTileEntities) {
|
||||
tileentity.al_();
|
||||
if (!this.isOutsideWorld(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (captureBlockStates) {
|
||||
+ capturedTileEntities.put(blockposition.immutableCopy(), tileentity);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.getChunkAtWorldCoords(blockposition).b(tileentity);
|
||||
}
|
||||
}
|
||||
@@ -595,7 +803,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
|
||||
- T t0 = (Entity) entitytypetest.a((Object) entitycomplexpart);
|
||||
+ T t0 = entitytypetest.a(entitycomplexpart);
|
||||
|
||||
if (t0 != null && predicate.test(t0)) {
|
||||
list.add(t0);
|
||||
@@ -921,6 +1129,14 @@
|
||||
public abstract LevelEntityGetter<Entity> getEntities();
|
||||
|
||||
protected void a(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {
|
||||
+ // CraftBukkit start
|
||||
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), new Location(this.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (entity == null) ? null : entity.getBukkitEntity(), i);
|
||||
+ getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ i = event.getRadius();
|
||||
+ // CraftBukkit end
|
||||
int j = SectionPosition.a(blockposition.getX() - i);
|
||||
int k = SectionPosition.a(blockposition.getZ() - i);
|
||||
int l = SectionPosition.a(blockposition.getX() + i);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/WorldAccess.java
|
||||
+++ b/net/minecraft/world/level/WorldAccess.java
|
||||
@@ -8,6 +8,12 @@
|
||||
WorldServer getMinecraftWorld();
|
||||
@@ -8,6 +8,17 @@
|
||||
WorldServer getLevel();
|
||||
|
||||
default void addAllEntities(Entity entity) {
|
||||
- entity.recursiveStream().forEach(this::addEntity);
|
||||
@@ -12,5 +12,10 @@
|
||||
+ default void addAllEntities(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ entity.recursiveStream().forEach((e) -> this.addEntity(e, reason));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default WorldServer getMinecraftWorld() {
|
||||
+ return getLevel();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
+++ b/net/minecraft/world/level/block/AzaleaBlock.java
|
||||
@@ -12,6 +12,13 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.TreeType;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.event.world.StructureGrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class AzaleaBlock extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
private static final AzaleaTreeGrower TREE_GROWER = new AzaleaTreeGrower();
|
||||
@@ -43,6 +50,29 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = true;
|
||||
+ // CraftBukkit end
|
||||
AzaleaBlock.TREE_GROWER.a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), blockposition, iblockdata, random);
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = false;
|
||||
+ if (worldserver.capturedBlockStates.size() > 0) {
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ Location location = new Location(worldserver.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ java.util.List<BlockState> blocks = new java.util.ArrayList<>(worldserver.capturedBlockStates.values());
|
||||
+ worldserver.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent event = null;
|
||||
+ if (treeType != null) {
|
||||
+ event = new StructureGrowEvent(location, treeType, false, null, blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event == null || !event.isCancelled()) {
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -248,7 +248,13 @@
|
||||
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
|
||||
@@ -354,7 +354,13 @@
|
||||
EntityItem entityitem = (EntityItem) supplier.get();
|
||||
|
||||
entityitem.defaultPickupDelay();
|
||||
- world.addEntity(entityitem);
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +285,7 @@
|
||||
@@ -380,7 +386,7 @@
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
|
||||
entityhuman.b(StatisticList.BLOCK_MINED.b(this));
|
||||
@@ -24,8 +24,8 @@
|
||||
dropItems(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
}
|
||||
|
||||
@@ -375,6 +381,12 @@
|
||||
return this;
|
||||
@@ -514,6 +520,12 @@
|
||||
return (ImmutableMap) this.stateDefinition.a().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), function));
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -36,4 +36,4 @@
|
||||
+
|
||||
public static final class a {
|
||||
|
||||
private final IBlockData a;
|
||||
private final IBlockData first;
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBamboo.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBamboo.java
|
||||
@@ -174,7 +174,7 @@
|
||||
@@ -187,7 +187,7 @@
|
||||
BlockPosition blockposition1 = blockposition.up(i);
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1);
|
||||
|
||||
- if (k >= 16 || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !worldserver.isEmpty(blockposition1.up())) {
|
||||
+ if (k >= 16 || !iblockdata1.a(Blocks.BAMBOO) || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !worldserver.isEmpty(blockposition1.up())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here
|
||||
- if (k >= 16 || (Integer) iblockdata1.get(BlockBamboo.STAGE) == 1 || !worldserver.isEmpty(blockposition1.up())) {
|
||||
+ if (k >= 16 || !iblockdata1.a(Blocks.BAMBOO) || (Integer) iblockdata1.get(BlockBamboo.STAGE) == 1 || !worldserver.isEmpty(blockposition1.up())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -195,14 +195,18 @@
|
||||
@@ -208,14 +208,18 @@
|
||||
BlockPosition blockposition1 = blockposition.down(2);
|
||||
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
|
||||
+ boolean shouldUpdateOthers = false; // CraftBukkit
|
||||
|
||||
if (i >= 1) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
||||
blockpropertybamboosize = BlockPropertyBambooSize.LARGE;
|
||||
if (iblockdata2.a(Blocks.BAMBOO)) {
|
||||
- world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||
- world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||
- world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
- world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
+ // CraftBukkit start - moved down
|
||||
+ // world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ // world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||
@@ -30,16 +30,16 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -213,7 +217,14 @@
|
||||
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1;
|
||||
@@ -226,7 +230,14 @@
|
||||
int j = (Integer) iblockdata.get(BlockBamboo.AGE) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1;
|
||||
int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
|
||||
|
||||
- world.setTypeAndData(blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3);
|
||||
- world.setTypeAndData(blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.AGE, j)).set(BlockBamboo.LEAVES, blockpropertybamboosize)).set(BlockBamboo.STAGE, k), 3);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.AGE, j)).set(BlockBamboo.LEAVES, blockpropertybamboosize)).set(BlockBamboo.STAGE, k), 3)) {
|
||||
+ if (shouldUpdateOthers) {
|
||||
+ world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||
+ world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBambooSapling.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBambooSapling.java
|
||||
@@ -86,6 +86,6 @@
|
||||
@@ -94,6 +94,6 @@
|
||||
}
|
||||
|
||||
protected void a(World world, BlockPosition blockposition) {
|
||||
- world.setTypeAndData(blockposition.up(), (IBlockData) Blocks.BAMBOO.getBlockData().set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) Blocks.BAMBOO.getBlockData().set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3); // CraftBukkit - BlockSpreadEvent
|
||||
- world.setTypeAndData(blockposition.up(), (IBlockData) Blocks.BAMBOO.getBlockData().set(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) Blocks.BAMBOO.getBlockData().set(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3); // CraftBukkit - BlockSpreadEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBed.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBed.java
|
||||
@@ -78,7 +78,8 @@
|
||||
@@ -88,7 +88,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
world.a(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
||||
|
||||
@@ -95,7 +96,16 @@
|
||||
@@ -105,7 +106,16 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
@@ -27,7 +27,7 @@
|
||||
if (entityhuman_enumbedresult != null) {
|
||||
entityhuman.a(entityhuman_enumbedresult.a(), true);
|
||||
}
|
||||
@@ -106,8 +116,27 @@
|
||||
@@ -116,8 +126,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBeehive.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBeehive.java
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -108,7 +108,7 @@
|
||||
EntityBee entitybee = (EntityBee) iterator.next();
|
||||
|
||||
if (entitybee.getGoalTarget() == null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockButtonAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockButtonAbstract.java
|
||||
@@ -26,6 +26,11 @@
|
||||
@@ -27,6 +27,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+
|
||||
public abstract class BlockButtonAbstract extends BlockAttachable {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
||||
@@ -92,6 +97,19 @@
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -97,6 +102,19 @@
|
||||
if ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)) {
|
||||
return EnumInteractionResult.CONSUME;
|
||||
} else {
|
||||
@@ -31,10 +31,10 @@
|
||||
+ // CraftBukkit end
|
||||
this.d(iblockdata, world, blockposition);
|
||||
this.a(entityhuman, world, blockposition, true);
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -142,6 +160,16 @@
|
||||
if (this.v) {
|
||||
this.e(iblockdata, (World) worldserver, blockposition);
|
||||
world.a((Entity) entityhuman, GameEvent.BLOCK_PRESS, blockposition);
|
||||
@@ -148,6 +166,16 @@
|
||||
if (this.sensitive) {
|
||||
this.e(iblockdata, worldserver, blockposition);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -49,7 +49,7 @@
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3);
|
||||
this.f(iblockdata, (World) worldserver, blockposition);
|
||||
this.a((EntityHuman) null, worldserver, blockposition, false);
|
||||
@@ -162,7 +190,44 @@
|
||||
@@ -169,11 +197,48 @@
|
||||
boolean flag = !list.isEmpty();
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockButtonAbstract.POWERED);
|
||||
|
||||
@@ -94,3 +94,8 @@
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, flag), 3);
|
||||
this.f(iblockdata, world, blockposition);
|
||||
this.a((EntityHuman) null, world, blockposition, flag);
|
||||
- world.a((Entity) list.stream().findFirst().orElse((Object) null), flag ? GameEvent.BLOCK_PRESS : GameEvent.BLOCK_UNPRESS, blockposition);
|
||||
+ world.a((Entity) list.stream().findFirst().orElse(null), flag ? GameEvent.BLOCK_PRESS : GameEvent.BLOCK_UNPRESS, blockposition); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockCactus extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.aj;
|
||||
@@ -57,7 +59,7 @@
|
||||
public static final BlockStateInteger AGE = BlockProperties.AGE_15;
|
||||
@@ -59,7 +61,7 @@
|
||||
int j = (Integer) iblockdata.get(BlockCactus.AGE);
|
||||
|
||||
if (j == 15) {
|
||||
@@ -18,7 +18,7 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockCactus.AGE, 0);
|
||||
|
||||
worldserver.setTypeAndData(blockposition, iblockdata1, 4);
|
||||
@@ -114,7 +116,9 @@
|
||||
@@ -116,7 +118,9 @@
|
||||
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCake.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCake.java
|
||||
@@ -58,7 +58,18 @@
|
||||
@@ -86,7 +86,18 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
entityhuman.a(StatisticList.EAT_CAKE_SLICE);
|
||||
@@ -19,4 +19,4 @@
|
||||
+ // CraftBukkit end
|
||||
int i = (Integer) iblockdata.get(BlockCake.BITES);
|
||||
|
||||
if (i < 6) {
|
||||
generatoraccess.a((Entity) entityhuman, GameEvent.EAT, blockposition);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCampfire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCampfire.java
|
||||
@@ -186,6 +186,11 @@
|
||||
if (flag && !(Boolean) iblockdata.get(BlockCampfire.LIT) && !(Boolean) iblockdata.get(BlockCampfire.d)) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
@@ -202,6 +202,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, iprojectile).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11);
|
||||
}
|
||||
if (!world.isClientSide && iprojectile.isBurning() && iprojectile.a(world, blockposition) && !(Boolean) iblockdata.get(BlockCampfire.LIT) && !(Boolean) iblockdata.get(BlockCampfire.WATERLOGGED)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, iprojectile).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.LIT, true), 11);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCauldron.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCauldron.java
|
||||
@@ -34,6 +34,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
+import org.bukkit.event.block.CauldronLevelChangeEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockCauldron extends Block {
|
||||
|
||||
public static final BlockStateInteger LEVEL = BlockProperties.ar;
|
||||
@@ -61,8 +63,13 @@
|
||||
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
|
||||
|
||||
if (!world.isClientSide && entity.isBurning() && i > 0 && entity.locY() <= (double) f) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) {
|
||||
+ return;
|
||||
+ }
|
||||
entity.extinguish();
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,18 +86,27 @@
|
||||
|
||||
if (item == Items.WATER_BUCKET) {
|
||||
if (i < 3 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, 3, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
entityhuman.a(enumhand, new ItemStack(Items.BUCKET));
|
||||
}
|
||||
|
||||
entityhuman.a(StatisticList.FILL_CAULDRON);
|
||||
- this.a(world, blockposition, iblockdata, 3);
|
||||
+ // this.a(world, blockposition, iblockdata, 3);
|
||||
+ // CraftBukkit end
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
} else if (item == Items.BUCKET) {
|
||||
if (i == 3 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, 0, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack.subtract(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -101,7 +117,8 @@
|
||||
}
|
||||
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
- this.a(world, blockposition, iblockdata, 0);
|
||||
+ // this.a(world, blockposition, iblockdata, 0);
|
||||
+ // CraftBukkit end
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -111,6 +128,10 @@
|
||||
|
||||
if (item == Items.GLASS_BOTTLE) {
|
||||
if (i > 0 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack1 = PotionUtil.a(new ItemStack(Items.POTION), Potions.WATER);
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
@@ -125,12 +146,17 @@
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
} else if (item == Items.POTION && PotionUtil.d(itemstack) == Potions.WATER) {
|
||||
if (i < 3 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i + 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack1 = new ItemStack(Items.GLASS_BOTTLE);
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
@@ -141,7 +167,8 @@
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
- this.a(world, blockposition, iblockdata, i + 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i + 1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -150,8 +177,13 @@
|
||||
IDyeable idyeable = (IDyeable) item;
|
||||
|
||||
if (idyeable.a(itemstack) && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
idyeable.c(itemstack);
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
entityhuman.a(StatisticList.CLEAN_ARMOR);
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
@@ -159,13 +191,18 @@
|
||||
|
||||
if (i > 0 && item instanceof ItemBanner) {
|
||||
if (TileEntityBanner.b(itemstack) > 0 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
itemstack1 = itemstack.cloneItemStack();
|
||||
itemstack1.setCount(1);
|
||||
TileEntityBanner.c(itemstack1);
|
||||
entityhuman.a(StatisticList.CLEAN_BANNER);
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack.subtract(1);
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -203,9 +240,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCauldron.LEVEL, MathHelper.clamp(i, 0, 3)), 2);
|
||||
+ this.changeLevel(world, blockposition, iblockdata, i, null, CauldronLevelChangeEvent.ChangeReason.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ private boolean changeLevel(World world, BlockPosition blockposition, IBlockData iblockdata, int i, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
|
||||
+ int newLevel = Integer.valueOf(MathHelper.clamp(i, 0, 3));
|
||||
+ CauldronLevelChangeEvent event = new CauldronLevelChangeEvent(
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ (entity == null) ? null : entity.getBukkitEntity(), reason, iblockdata.get(BlockCauldron.LEVEL), newLevel
|
||||
+ );
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCauldron.LEVEL, event.getNewLevel()), 2);
|
||||
world.updateAdjacentComparators(blockposition, this);
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -217,7 +270,7 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
if ((Integer) iblockdata.get(BlockCauldron.LEVEL) < 3) {
|
||||
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockCauldron.LEVEL), 2);
|
||||
+ this.a(world, blockposition, (IBlockData) iblockdata.a((IBlockState) BlockCauldron.LEVEL), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockChest.java
|
||||
+++ b/net/minecraft/world/level/block/BlockChest.java
|
||||
@@ -79,24 +79,7 @@
|
||||
@@ -88,24 +88,7 @@
|
||||
public Optional<ITileInventory> a(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
||||
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
- @Nullable
|
||||
- @Override
|
||||
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
- if (tileentitychest.e(entityhuman) && tileentitychest1.e(entityhuman)) {
|
||||
- tileentitychest.d(playerinventory.player);
|
||||
- tileentitychest1.d(playerinventory.player);
|
||||
- return ContainerChest.b(i, playerinventory, inventorylargechest);
|
||||
- if (tileentitychest.d(entityhuman) && tileentitychest1.d(entityhuman)) {
|
||||
- tileentitychest.e(playerinventory.player);
|
||||
- tileentitychest1.e(playerinventory.player);
|
||||
- return ContainerChest.b(i, playerinventory, (IInventory) inventorylargechest);
|
||||
- } else {
|
||||
- return null;
|
||||
- }
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
public Optional<ITileInventory> a(TileEntityChest tileentitychest) {
|
||||
@@ -109,6 +92,38 @@
|
||||
@@ -118,6 +101,38 @@
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,10 +46,10 @@
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
+ if (tileentitychest.e(entityhuman) && tileentitychest1.e(entityhuman)) {
|
||||
+ tileentitychest.d(playerinventory.player);
|
||||
+ tileentitychest1.d(playerinventory.player);
|
||||
+ return ContainerChest.b(i, playerinventory, inventorylargechest);
|
||||
+ if (tileentitychest.d(entityhuman) && tileentitychest1.d(entityhuman)) {
|
||||
+ tileentitychest.e(playerinventory.player);
|
||||
+ tileentitychest1.e(playerinventory.player);
|
||||
+ return ContainerChest.b(i, playerinventory, (IInventory) inventorylargechest);
|
||||
+ } else {
|
||||
+ return null;
|
||||
+ }
|
||||
@@ -64,10 +64,10 @@
|
||||
+
|
||||
protected BlockChest(BlockBase.Info blockbase_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
|
||||
super(blockbase_info, supplier);
|
||||
this.j((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.c, BlockPropertyChestType.SINGLE)).set(BlockChest.d, false));
|
||||
@@ -262,7 +277,7 @@
|
||||
}
|
||||
this.k((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).set(BlockChest.WATERLOGGED, false));
|
||||
@@ -276,7 +291,7 @@
|
||||
|
||||
@Override
|
||||
public DoubleBlockFinder.Result<? extends TileEntityChest> a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
||||
- BiPredicate bipredicate;
|
||||
+ BiPredicate<GeneratorAccess, BlockPosition> bipredicate; // CraftBukkit - decompile error
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
+
|
||||
public class BlockChorusFlower extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ah;
|
||||
public static final int DEAD_AGE = 5;
|
||||
@@ -84,8 +86,12 @@
|
||||
}
|
||||
|
||||
if (flag && b((IWorldReader) worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmpty(blockposition.up(2))) {
|
||||
- worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
- worldserver.setTypeAndData(blockposition, this.plant.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
- this.a(worldserver, blockposition1, i);
|
||||
+ // CraftBukkit start - add event
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
|
||||
+ worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
+ worldserver.setTypeAndData(blockposition, this.plant.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
+ this.a(worldserver, blockposition1, i);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
worldserver.setTypeAndData(blockposition, this.plant.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
} else {
|
||||
- this.a((World) worldserver, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.af;
|
||||
@@ -45,7 +47,7 @@
|
||||
public static final int MAX_AGE = 2;
|
||||
@@ -55,7 +57,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockCocoa.AGE);
|
||||
|
||||
if (i < 2) {
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +117,7 @@
|
||||
@@ -125,7 +127,7 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCommand.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCommand.java
|
||||
@@ -27,6 +27,8 @@
|
||||
@@ -26,6 +26,8 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockCommand extends BlockTileEntity {
|
||||
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -55,6 +57,15 @@
|
||||
@@ -56,6 +58,15 @@
|
||||
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||
boolean flag2 = tileentitycommand.f();
|
||||
@@ -24,4 +24,4 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
tileentitycommand.a(flag1);
|
||||
if (!flag2 && !tileentitycommand.g() && tileentitycommand.m() != TileEntityCommand.Type.SEQUENCE) {
|
||||
if (!flag2 && !tileentitycommand.g() && tileentitycommand.t() != TileEntityCommand.Type.SEQUENCE) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockComposter.java
|
||||
+++ b/net/minecraft/world/level/block/BlockComposter.java
|
||||
@@ -36,12 +36,18 @@
|
||||
@@ -38,6 +38,12 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -12,15 +12,17 @@
|
||||
+
|
||||
public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
public static final BlockStateInteger a = BlockProperties.as;
|
||||
public static final Object2FloatMap<IMaterial> b = new Object2FloatOpenHashMap();
|
||||
private static final VoxelShape c = VoxelShapes.b();
|
||||
- private static final VoxelShape[] d = (VoxelShape[]) SystemUtils.a((Object) (new VoxelShape[9]), (avoxelshape) -> {
|
||||
+ private static final VoxelShape[] d = (VoxelShape[]) SystemUtils.a((new VoxelShape[9]), (avoxelshape) -> { // CraftBukkit - decompile error
|
||||
public static final int READY = 8;
|
||||
@@ -47,7 +53,7 @@
|
||||
public static final Object2FloatMap<IMaterial> COMPOSTABLES = new Object2FloatOpenHashMap();
|
||||
private static final int AABB_SIDE_THICKNESS = 2;
|
||||
private static final VoxelShape OUTER_SHAPE = VoxelShapes.b();
|
||||
- private static final VoxelShape[] SHAPES = (VoxelShape[]) SystemUtils.a((Object) (new VoxelShape[9]), (avoxelshape) -> {
|
||||
+ private static final VoxelShape[] SHAPES = (VoxelShape[]) SystemUtils.a((new VoxelShape[9]), (avoxelshape) -> { // CraftBukkit - decompile error
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
avoxelshape[i] = VoxelShapes.a(BlockComposter.c, Block.a(2.0D, (double) Math.max(2, 1 + i * 2), 2.0D, 14.0D, 16.0D, 14.0D), OperatorBoolean.ONLY_FIRST);
|
||||
avoxelshape[i] = VoxelShapes.a(BlockComposter.OUTER_SHAPE, Block.a(2.0D, (double) Math.max(2, 1 + i * 2), 2.0D, 14.0D, 16.0D, 14.0D), OperatorBoolean.ONLY_FIRST);
|
||||
}
|
||||
@@ -187,18 +193,25 @@
|
||||
@@ -225,18 +231,25 @@
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
} else if (i == 8) {
|
||||
@@ -34,22 +36,22 @@
|
||||
|
||||
- public static IBlockData a(IBlockData iblockdata, WorldServer worldserver, ItemStack itemstack, BlockPosition blockposition) {
|
||||
+ public static IBlockData a(IBlockData iblockdata, WorldServer worldserver, ItemStack itemstack, BlockPosition blockposition, Entity entity) { // CraftBukkit
|
||||
int i = (Integer) iblockdata.get(BlockComposter.a);
|
||||
int i = (Integer) iblockdata.get(BlockComposter.LEVEL);
|
||||
|
||||
if (i < 7 && BlockComposter.b.containsKey(itemstack.getItem())) {
|
||||
- IBlockData iblockdata1 = b(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack);
|
||||
if (i < 7 && BlockComposter.COMPOSTABLES.containsKey(itemstack.getItem())) {
|
||||
- IBlockData iblockdata1 = a(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack);
|
||||
+ // CraftBukkit start
|
||||
+ double rand = worldserver.getRandom().nextDouble();
|
||||
+ IBlockData iblockdata1 = b(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
|
||||
+ IBlockData iblockdata1 = a(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
|
||||
+ if (iblockdata == iblockdata1 || org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
|
||||
+ return iblockdata;
|
||||
+ }
|
||||
+ iblockdata1 = b(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack, rand);
|
||||
+ iblockdata1 = a(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack, rand);
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.subtract(1);
|
||||
return iblockdata1;
|
||||
@@ -207,7 +220,15 @@
|
||||
@@ -245,7 +258,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +59,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ public static IBlockData d(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
+ if (entity != null) {
|
||||
+ IBlockData iblockdata1 = d(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition);
|
||||
+ IBlockData iblockdata1 = c(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition);
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
|
||||
+ return iblockdata;
|
||||
+ }
|
||||
@@ -66,69 +68,71 @@
|
||||
if (!world.isClientSide) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.random.nextFloat() * 0.7F) + 0.15000000596046448D;
|
||||
@@ -233,10 +254,16 @@
|
||||
@@ -271,10 +292,16 @@
|
||||
}
|
||||
|
||||
private static IBlockData b(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
static IBlockData a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
+ // CraftBukkit start
|
||||
+ return b(iblockdata, generatoraccess, blockposition, itemstack, generatoraccess.getRandom().nextDouble());
|
||||
+ return a(iblockdata, generatoraccess, blockposition, itemstack, generatoraccess.getRandom().nextDouble());
|
||||
+ }
|
||||
+
|
||||
+ private static IBlockData b(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack, double rand) {
|
||||
+ static IBlockData a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack, double rand) {
|
||||
+ // CraftBukkit end
|
||||
int i = (Integer) iblockdata.get(BlockComposter.a);
|
||||
float f = BlockComposter.b.getFloat(itemstack.getItem());
|
||||
int i = (Integer) iblockdata.get(BlockComposter.LEVEL);
|
||||
float f = BlockComposter.COMPOSTABLES.getFloat(itemstack.getItem());
|
||||
|
||||
- if ((i != 0 || f <= 0.0F) && generatoraccess.getRandom().nextDouble() >= (double) f) {
|
||||
+ if ((i != 0 || f <= 0.0F) && rand >= (double) f) {
|
||||
return iblockdata;
|
||||
} else {
|
||||
int j = i + 1;
|
||||
@@ -284,7 +311,8 @@
|
||||
@@ -322,7 +349,8 @@
|
||||
public IWorldInventory a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.get(BlockComposter.a);
|
||||
int i = (Integer) iblockdata.get(BlockComposter.LEVEL);
|
||||
|
||||
- return (IWorldInventory) (i == 8 ? new BlockComposter.ContainerOutput(iblockdata, generatoraccess, blockposition, new ItemStack(Items.BONE_MEAL)) : (i < 7 ? new BlockComposter.ContainerInput(iblockdata, generatoraccess, blockposition) : new BlockComposter.ContainerEmpty()));
|
||||
+ // CraftBukkit - empty generatoraccess, blockposition
|
||||
+ return (IWorldInventory) (i == 8 ? new BlockComposter.ContainerOutput(iblockdata, generatoraccess, blockposition, new ItemStack(Items.BONE_MEAL)) : (i < 7 ? new BlockComposter.ContainerInput(iblockdata, generatoraccess, blockposition) : new BlockComposter.ContainerEmpty(generatoraccess, blockposition)));
|
||||
}
|
||||
|
||||
static class ContainerInput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -296,6 +324,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
+ this.bukkitOwner = new CraftBlockInventoryHolder(generatoraccess, blockposition, this); // CraftBukkit
|
||||
this.a = iblockdata;
|
||||
this.b = generatoraccess;
|
||||
this.c = blockposition;
|
||||
@@ -348,6 +377,7 @@
|
||||
this.blockData = iblockdata;
|
||||
this.generatorAccess = generatoraccess;
|
||||
this.blockPosition = blockposition;
|
||||
private static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -337,6 +365,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
+ this.bukkitOwner = new CraftBlockInventoryHolder(generatoraccess, blockposition, this); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -372,15 +402,23 @@
|
||||
@@ -361,8 +390,15 @@
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
- BlockComposter.d(this.blockData, this.generatorAccess, this.blockPosition);
|
||||
- this.emptied = true;
|
||||
- BlockComposter.c(this.state, this.level, this.pos);
|
||||
- this.changed = true;
|
||||
+ // CraftBukkit start - allow putting items back (eg cancelled InventoryMoveItemEvent)
|
||||
+ if (this.isEmpty()) {
|
||||
+ BlockComposter.d(this.blockData, this.generatorAccess, this.blockPosition);
|
||||
+ this.emptied = true;
|
||||
+ BlockComposter.c(this.state, this.level, this.pos);
|
||||
+ this.changed = true;
|
||||
+ } else {
|
||||
+ this.generatorAccess.setTypeAndData(this.blockPosition, this.blockData, 3);
|
||||
+ this.emptied = false;
|
||||
+ this.level.setTypeAndData(this.pos, this.state, 3);
|
||||
+ this.changed = false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -375,6 +411,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
+ this.bukkitOwner = new CraftBlockInventoryHolder(generatoraccess, blockposition, this); // CraftBukkit
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -417,8 +454,9 @@
|
||||
|
||||
private static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {
|
||||
|
||||
- public ContainerEmpty() {
|
||||
+ public ContainerEmpty(GeneratorAccess generatoraccess, BlockPosition blockposition) { // CraftBukkit
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
+
|
||||
public class BlockConcretePowder extends BlockFalling {
|
||||
|
||||
private final IBlockData a;
|
||||
private final IBlockData concrete;
|
||||
@@ -25,7 +30,7 @@
|
||||
@Override
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) {
|
||||
if (canHarden(world, blockposition, iblockdata1)) {
|
||||
- world.setTypeAndData(blockposition, this.a, 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.a, 3); // CraftBukkit
|
||||
- world.setTypeAndData(blockposition, this.concrete, 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.concrete, 3); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
BlockPosition blockposition = blockactioncontext.getClickPosition();
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
- return canHarden(world, blockposition, iblockdata) ? this.a : super.getPlacedState(blockactioncontext);
|
||||
- return canHarden(world, blockposition, iblockdata) ? this.concrete : super.getPlacedState(blockactioncontext);
|
||||
+ // CraftBukkit start
|
||||
+ if (!canHarden(world, blockposition, iblockdata)) {
|
||||
+ return super.getPlacedState(blockactioncontext);
|
||||
@@ -33,7 +33,7 @@
|
||||
+
|
||||
+ // TODO: An event factory call for methods like this
|
||||
+ CraftBlockState blockState = CraftBlockState.getBlockState(world, blockposition);
|
||||
+ blockState.setData(this.a);
|
||||
+ blockState.setData(this.concrete);
|
||||
+
|
||||
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
|
||||
+ world.getMinecraftServer().server.getPluginManager().callEvent(event);
|
||||
@@ -47,19 +47,19 @@
|
||||
}
|
||||
|
||||
private static boolean canHarden(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -72,6 +94,24 @@
|
||||
@@ -72,7 +94,25 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return a((IBlockAccess) generatoraccess, blockposition) ? this.a : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
- return a((IBlockAccess) generatoraccess, blockposition) ? this.concrete : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit start
|
||||
+ if (a((IBlockAccess) generatoraccess, blockposition)) {
|
||||
+ // Suppress during worldgen
|
||||
+ if (!(generatoraccess instanceof World)) {
|
||||
+ return this.a;
|
||||
+ return this.concrete;
|
||||
+ }
|
||||
+ CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition);
|
||||
+ blockState.setData(this.a);
|
||||
+ blockState.setData(this.concrete);
|
||||
+
|
||||
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
|
||||
+ ((World) generatoraccess).getServer().getPluginManager().callEvent(event);
|
||||
@@ -72,4 +72,5 @@
|
||||
+ return super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!this.a((IBlockAccess) worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, this.a.getBlockData(), 2);
|
||||
worldserver.setTypeAndData(blockposition, this.deadBlock.getBlockData(), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCoralFan.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralFan.java
|
||||
@@ -29,6 +29,11 @@
|
||||
@@ -28,6 +28,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!c(iblockdata, (IBlockAccess) worldserver, blockposition)) {
|
||||
if (!e(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData().set(BlockCoralFan.b, false)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData().set(BlockCoralFan.WATERLOGGED, false)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, false), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) this.deadBlock.getBlockData().set(BlockCoralFan.WATERLOGGED, false), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCoralFanWall.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralFanWall.java
|
||||
@@ -29,6 +29,11 @@
|
||||
@@ -28,6 +28,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!c(iblockdata, (IBlockAccess) worldserver, blockposition)) {
|
||||
if (!e(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, false).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData().set(BlockCoralFanWall.WATERLOGGED, false).set(BlockCoralFanWall.FACING, iblockdata.get(BlockCoralFanWall.FACING))).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.deadBlock.getBlockData().set(BlockCoralFanWall.WATERLOGGED, false)).set(BlockCoralFanWall.FACING, (EnumDirection) iblockdata.get(BlockCoralFanWall.FACING)), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCoralPlant.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralPlant.java
|
||||
@@ -32,6 +32,11 @@
|
||||
@@ -33,6 +33,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!c(iblockdata, (IBlockAccess) worldserver, blockposition)) {
|
||||
if (!e(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralPlant.b, false)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData().set(BlockCoralPlant.WATERLOGGED, false)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) this.c.getBlockData().set(BlockCoralPlant.b, false), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) this.deadBlock.getBlockData().set(BlockCoralPlant.WATERLOGGED, false), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCrops.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCrops.java
|
||||
@@ -18,6 +18,8 @@
|
||||
@@ -21,6 +21,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ai;
|
||||
@@ -72,7 +74,7 @@
|
||||
public static final int MAX_AGE = 7;
|
||||
@@ -76,7 +78,7 @@
|
||||
float f = a((Block) this, (IBlockAccess) worldserver, blockposition);
|
||||
|
||||
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +89,7 @@
|
||||
@@ -91,7 +93,7 @@
|
||||
i = j;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
}
|
||||
|
||||
protected int a(World world) {
|
||||
@@ -145,7 +147,7 @@
|
||||
@@ -149,7 +151,7 @@
|
||||
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
- if (entity instanceof EntityRavager && world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
+ if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData(), !world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) { // CraftBukkit
|
||||
- if (entity instanceof EntityRavager && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // CraftBukkit
|
||||
world.a(blockposition, true, entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDaylightDetector.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDaylightDetector.java
|
||||
@@ -65,6 +65,7 @@
|
||||
@@ -67,6 +67,7 @@
|
||||
|
||||
i = MathHelper.clamp(i, 0, 15);
|
||||
if ((Integer) iblockdata.get(BlockDaylightDetector.POWER) != i) {
|
||||
+ i = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, blockposition, ((Integer) iblockdata.get(POWER)), i).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDaylightDetector.POWER, i), 3);
|
||||
}
|
||||
i = MathHelper.clamp(i, 0, 15);
|
||||
if ((Integer) iblockdata.get(BlockDaylightDetector.POWER) != i) {
|
||||
+ i = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, blockposition, ((Integer) iblockdata.get(POWER)), i).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDaylightDetector.POWER, i), 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
|
||||
|
||||
protected static final VoxelShape b = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
protected static final VoxelShape SHAPE = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
@@ -46,8 +48,18 @@
|
||||
boolean flag1 = this.a((World) worldserver, blockposition, iblockdata);
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, false), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.POWERED, false), 2);
|
||||
} else if (!flag) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.POWERED, true), 2);
|
||||
if (!flag1) {
|
||||
worldserver.getBlockTickList().a(blockposition, this, this.g(iblockdata), TickListPriority.VERY_HIGH);
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
} else {
|
||||
if (worldserver.getLightLevel(blockposition.up()) >= 9) {
|
||||
@@ -51,7 +56,7 @@
|
||||
BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
|
||||
BlockPosition blockposition1 = blockposition.c(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
|
||||
|
||||
if (worldserver.getType(blockposition1).a(Blocks.DIRT) && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) {
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).a(Blocks.SNOW)));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).a(Blocks.SNOW))); // CraftBukkit
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.SNOWY, worldserver.getType(blockposition1.up()).a(Blocks.SNOW)));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.SNOWY, worldserver.getType(blockposition1.up()).a(Blocks.SNOW))); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDispenser.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDispenser.java
|
||||
@@ -41,9 +41,10 @@
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
public static final BlockStateDirection FACING = BlockDirectional.FACING;
|
||||
public static final BlockStateBoolean TRIGGERED = BlockProperties.A;
|
||||
- public static final Map<Item, IDispenseBehavior> REGISTRY = (Map) SystemUtils.a((Object) (new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> {
|
||||
+ public static final Map<Item, IDispenseBehavior> REGISTRY = (Map) SystemUtils.a((new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
|
||||
public static final BlockStateBoolean TRIGGERED = BlockProperties.TRIGGERED;
|
||||
- public static final Map<Item, IDispenseBehavior> DISPENSER_REGISTRY = (Map) SystemUtils.a((Object) (new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> {
|
||||
+ public static final Map<Item, IDispenseBehavior> DISPENSER_REGISTRY = (Map) SystemUtils.a((new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
|
||||
object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
|
||||
});
|
||||
private static final int TRIGGER_DURATION = 4;
|
||||
+ public static boolean eventFired = false; // CraftBukkit
|
||||
|
||||
public static void a(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
|
||||
BlockDispenser.REGISTRY.put(imaterial.getItem(), idispensebehavior);
|
||||
@@ -86,6 +87,7 @@
|
||||
BlockDispenser.DISPENSER_REGISTRY.put(imaterial.getItem(), idispensebehavior);
|
||||
@@ -88,6 +89,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.a(itemstack);
|
||||
|
||||
if (idispensebehavior != IDispenseBehavior.NONE) {
|
||||
if (idispensebehavior != IDispenseBehavior.NOOP) {
|
||||
+ eventFired = false; // CraftBukkit - reset event status
|
||||
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDoor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDoor.java
|
||||
@@ -31,6 +31,8 @@
|
||||
@@ -34,6 +34,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -186,9 +188,24 @@
|
||||
@@ -192,9 +194,24 @@
|
||||
|
||||
@Override
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
@@ -30,9 +30,9 @@
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
- if (block != this && flag1 != (Boolean) iblockdata.get(BlockDoor.POWERED)) {
|
||||
- if (!this.getBlockData().a(block) && flag1 != (Boolean) iblockdata.get(BlockDoor.POWERED)) {
|
||||
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ // CraftBukkit end
|
||||
if (flag1 != (Boolean) iblockdata.get(BlockDoor.OPEN)) {
|
||||
this.a(world, blockposition, flag1);
|
||||
}
|
||||
world.a(flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockposition);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
+
|
||||
public class BlockDragonEgg extends BlockFalling {
|
||||
|
||||
protected static final VoxelShape a = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
protected static final VoxelShape SHAPE = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
@@ -44,6 +46,18 @@
|
||||
BlockPosition blockposition1 = blockposition.b(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
|
||||
BlockPosition blockposition1 = blockposition.c(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
|
||||
|
||||
if (world.getType(blockposition1).isAir()) {
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDropper.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDropper.java
|
||||
@@ -16,6 +16,12 @@
|
||||
import net.minecraft.world.level.block.entity.TileEntityHopper;
|
||||
import net.minecraft.world.level.block.state.BlockBase;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.InventoryLargeChest;
|
||||
@@ -12,10 +12,10 @@
|
||||
+
|
||||
public class BlockDropper extends BlockDispenser {
|
||||
|
||||
private static final IDispenseBehavior c = new DispenseBehaviorItem();
|
||||
private static final IDispenseBehavior DISPENSE_BEHAVIOUR = new DispenseBehaviorItem();
|
||||
@@ -53,8 +59,25 @@
|
||||
if (iinventory == null) {
|
||||
itemstack1 = BlockDropper.c.dispense(sourceblock, itemstack);
|
||||
itemstack1 = BlockDropper.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
|
||||
} else {
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.cloneItemStack().cloneAndSubtract(1), enumdirection.opposite());
|
||||
- if (itemstack1.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockEnderPortal.java
|
||||
+++ b/net/minecraft/world/level/block/BlockEnderPortal.java
|
||||
@@ -16,6 +16,13 @@
|
||||
@@ -19,6 +19,13 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
+
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
|
||||
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
||||
@@ -37,13 +44,22 @@
|
||||
protected static final VoxelShape SHAPE = Block.a(0.0D, 6.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
||||
@@ -40,13 +47,22 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canPortal() && VoxelShapes.c(VoxelShapes.a(entity.getBoundingBox().d((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- ResourceKey<World> resourcekey = world.getDimensionKey() == World.THE_END ? World.OVERWORLD : World.THE_END;
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == DimensionManager.THE_END ? World.OVERWORLD : World.THE_END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
- ResourceKey<World> resourcekey = world.getDimensionKey() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == DimensionManager.END_LOCATION ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
WorldServer worldserver = ((WorldServer) world).getMinecraftServer().getWorldServer(resourcekey);
|
||||
|
||||
if (worldserver == null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFenceGate.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
|
||||
@@ -125,6 +125,17 @@
|
||||
@@ -130,6 +130,17 @@
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
if (!world.isClientSide) {
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
+
|
||||
public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.aj;
|
||||
@@ -84,7 +91,24 @@
|
||||
public static final int MAX_AGE = 15;
|
||||
@@ -93,7 +100,24 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
@@ -40,16 +40,16 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +157,7 @@
|
||||
@@ -142,7 +166,7 @@
|
||||
worldserver.getBlockTickList().a(blockposition, this, a(worldserver.random));
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) {
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
if (!iblockdata.canPlace(worldserver, blockposition)) {
|
||||
- worldserver.a(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition.down());
|
||||
@@ -141,7 +165,7 @@
|
||||
@@ -150,7 +174,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockFire.AGE);
|
||||
|
||||
if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
|
||||
@@ -58,7 +58,7 @@
|
||||
} else {
|
||||
int j = Math.min(15, i + random.nextInt(3) / 2);
|
||||
|
||||
@@ -155,14 +179,14 @@
|
||||
@@ -164,14 +188,14 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
|
||||
if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
|
||||
@@ -69,13 +69,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (i == 15 && random.nextInt(4) == 0 && !this.e(worldserver.getType(blockposition.down()))) {
|
||||
if (i == 15 && random.nextInt(4) == 0 && !this.f(worldserver.getType(blockposition.down()))) {
|
||||
- worldserver.a(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -170,12 +194,14 @@
|
||||
@@ -179,12 +203,14 @@
|
||||
boolean flag1 = worldserver.u(blockposition);
|
||||
int k = flag1 ? -50 : 0;
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
|
||||
for (int l = -1; l <= 1; ++l) {
|
||||
@@ -201,7 +227,15 @@
|
||||
@@ -210,7 +236,15 @@
|
||||
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.a((World) worldserver, (BlockPosition) blockposition_mutableblockposition))) {
|
||||
int j2 = Math.min(15, i + random.nextInt(5) / 4);
|
||||
|
||||
@@ -113,8 +113,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,12 +259,24 @@
|
||||
return iblockdata.b(BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C) ? 0 : this.flameChances.getInt(iblockdata.getBlock());
|
||||
@@ -234,12 +268,24 @@
|
||||
return iblockdata.b(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.get(BlockProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(iblockdata.getBlock());
|
||||
}
|
||||
|
||||
- private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFireAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFireAbstract.java
|
||||
@@ -50,7 +50,14 @@
|
||||
@@ -125,7 +125,14 @@
|
||||
if (!entity.isFireProof()) {
|
||||
entity.setFireTicks(entity.getFireTicks() + 1);
|
||||
if (entity.getFireTicks() == 0) {
|
||||
@@ -15,8 +15,8 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
entity.damageEntity(DamageSource.FIRE, this.b);
|
||||
@@ -72,14 +79,14 @@
|
||||
entity.damageEntity(DamageSource.IN_FIRE, this.fireDamage);
|
||||
@@ -147,14 +154,14 @@
|
||||
}
|
||||
|
||||
if (!iblockdata.canPlace(world, blockposition)) {
|
||||
@@ -28,12 +28,12 @@
|
||||
}
|
||||
|
||||
private static boolean a(World world) {
|
||||
- return world.getDimensionKey() == World.OVERWORLD || world.getDimensionKey() == World.THE_NETHER;
|
||||
+ return world.getTypeKey() == net.minecraft.world.level.dimension.DimensionManager.OVERWORLD || world.getTypeKey() == net.minecraft.world.level.dimension.DimensionManager.THE_NETHER; // CraftBukkit - getTypeKey()
|
||||
- return world.getDimensionKey() == World.OVERWORLD || world.getDimensionKey() == World.NETHER;
|
||||
+ return world.getTypeKey() == net.minecraft.world.level.dimension.DimensionManager.OVERWORLD_LOCATION || world.getTypeKey() == net.minecraft.world.level.dimension.DimensionManager.NETHER_LOCATION; // CraftBukkit - getTypeKey()
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,4 +130,12 @@
|
||||
@@ -202,4 +209,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFluids.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFluids.java
|
||||
@@ -137,14 +137,20 @@
|
||||
if (world.getFluid(blockposition1).a((Tag) TagsFluid.WATER)) {
|
||||
Block block = world.getFluid(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
@@ -143,14 +143,20 @@
|
||||
if (world.getFluid(blockposition1).a((Tag) TagsFluid.WATER)) {
|
||||
Block block = world.getFluid(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
|
||||
- world.setTypeUpdate(blockposition, block.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, block.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flag && world.getType(blockposition1).a(Blocks.BLUE_ICE)) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.BASALT.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.BASALT.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
- world.setTypeUpdate(blockposition, block.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, block.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flag && world.getType(blockposition1).a(Blocks.BLUE_ICE)) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.BASALT.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.BASALT.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFungi.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFungi.java
|
||||
@@ -50,6 +50,13 @@
|
||||
@@ -51,6 +51,13 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -11,6 +11,6 @@
|
||||
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
((WorldGenFeatureConfigured) this.b.get()).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition);
|
||||
((WorldGenFeatureConfigured) this.feature.get()).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockGrass.java
|
||||
+++ b/net/minecraft/world/level/block/BlockGrass.java
|
||||
@@ -72,7 +72,7 @@
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
if (iblockdata3.canPlace(worldserver, blockposition2)) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockGrowingTop.java
|
||||
+++ b/net/minecraft/world/level/block/BlockGrowingTop.java
|
||||
@@ -44,7 +44,7 @@
|
||||
BlockPosition blockposition1 = blockposition.shift(this.a);
|
||||
@@ -45,7 +45,7 @@
|
||||
BlockPosition blockposition1 = blockposition.shift(this.growthDirection);
|
||||
|
||||
if (this.h(worldserver.getType(blockposition1))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockGrowingTop.d));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockGrowingTop.d)); // CraftBukkit
|
||||
if (this.g(worldserver.getType(blockposition1))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.a(iblockdata, worldserver.random));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.a(iblockdata, worldserver.random)); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockJukeBox.java
|
||||
+++ b/net/minecraft/world/level/block/BlockJukeBox.java
|
||||
@@ -63,7 +63,13 @@
|
||||
@@ -62,7 +62,13 @@
|
||||
TileEntity tileentity = generatoraccess.getTileEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof TileEntityJukeBox) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLeaves.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLeaves.java
|
||||
@@ -19,6 +19,8 @@
|
||||
@@ -21,6 +21,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockLeaves extends Block {
|
||||
|
||||
public static final BlockStateInteger DISTANCE = BlockProperties.an;
|
||||
@@ -42,6 +44,14 @@
|
||||
public static final int DECAY_DISTANCE = 7;
|
||||
@@ -46,6 +48,14 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLectern.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLectern.java
|
||||
@@ -196,12 +196,13 @@
|
||||
@@ -199,12 +199,13 @@
|
||||
}
|
||||
|
||||
private void d(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
if (tileentity instanceof TileEntityLectern) {
|
||||
TileEntityLectern tileentitylectern = (TileEntityLectern) tileentity;
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockLectern.a);
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockLectern.FACING);
|
||||
ItemStack itemstack = tileentitylectern.getBook().cloneItemStack();
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5500
|
||||
float f = 0.25F * (float) enumdirection.getAdjacentX();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLever.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLever.java
|
||||
@@ -22,6 +22,8 @@
|
||||
@@ -25,6 +25,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockLever extends BlockAttachable {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
||||
@@ -86,6 +88,20 @@
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -92,6 +94,20 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMagma.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMagma.java
|
||||
@@ -28,7 +28,9 @@
|
||||
@@ -30,7 +30,9 @@
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, Entity entity) {
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (!entity.isFireProof() && entity instanceof EntityLiving && !EnchantmentManager.i((EntityLiving) entity)) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
||||
entity.damageEntity(DamageSource.HOT_FLOOR, 1.0F);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
super.stepOn(world, blockposition, entity);
|
||||
super.stepOn(world, blockposition, iblockdata, entity);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMinecartDetector.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMinecartDetector.java
|
||||
@@ -26,6 +26,8 @@
|
||||
@@ -25,6 +25,8 @@
|
||||
import net.minecraft.world.level.block.state.properties.IBlockState;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.ad;
|
||||
@@ -78,6 +80,16 @@
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.RAIL_SHAPE_STRAIGHT;
|
||||
@@ -80,6 +82,16 @@
|
||||
}
|
||||
|
||||
IBlockData iblockdata1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMobSpawner.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMobSpawner.java
|
||||
@@ -23,9 +23,19 @@
|
||||
@@ -33,9 +33,19 @@
|
||||
@Override
|
||||
public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.dropNaturally(iblockdata, worldserver, blockposition, itemstack);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMonsterEggs.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMonsterEggs.java
|
||||
@@ -15,6 +15,8 @@
|
||||
import net.minecraft.world.level.block.state.BlockBase;
|
||||
@@ -18,6 +18,8 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.block.state.properties.IBlockState;
|
||||
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit
|
||||
+
|
||||
public class BlockMonsterEggs extends Block {
|
||||
|
||||
private final Block a;
|
||||
@@ -38,7 +40,7 @@
|
||||
private final Block hostBlock;
|
||||
@@ -43,7 +45,7 @@
|
||||
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.a((World) worldserver);
|
||||
|
||||
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
+
|
||||
public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
protected static final VoxelShape a = Block.a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
|
||||
@@ -58,7 +62,7 @@
|
||||
protected static final float AABB_OFFSET = 3.0F;
|
||||
@@ -61,7 +65,7 @@
|
||||
}
|
||||
|
||||
if (worldserver.isEmpty(blockposition2) && iblockdata.canPlace(worldserver, blockposition2)) {
|
||||
@@ -21,18 +21,10 @@
|
||||
}
|
||||
|
||||
@@ -82,6 +86,7 @@
|
||||
WorldGenFeatureConfigured worldgenfeatureconfigured;
|
||||
|
||||
if (this == Blocks.BROWN_MUSHROOM) {
|
||||
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
|
||||
worldgenfeatureconfigured = BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM;
|
||||
public boolean a(WorldServer worldserver, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
worldserver.a(blockposition, false);
|
||||
+ BlockSapling.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.BROWN_MUSHROOM; // CraftBukkit
|
||||
if (((WorldGenFeatureConfigured) this.featureSupplier.get()).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition)) {
|
||||
return true;
|
||||
} else {
|
||||
if (this != Blocks.RED_MUSHROOM) {
|
||||
@@ -89,6 +94,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
|
||||
worldgenfeatureconfigured = BiomeDecoratorGroups.HUGE_RED_MUSHROOM;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockNetherWart.java
|
||||
+++ b/net/minecraft/world/level/block/BlockNetherWart.java
|
||||
@@ -43,7 +43,7 @@
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
if (i < 3 && random.nextInt(10) == 0) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockNetherWart.AGE, i + 1);
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
+
|
||||
public class BlockObserver extends BlockDirectional {
|
||||
|
||||
public static final BlockStateBoolean b = BlockProperties.w;
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -41,8 +43,18 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockObserver.b)) {
|
||||
if ((Boolean) iblockdata.get(BlockObserver.POWERED)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, false), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.POWERED, false), 2);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.POWERED, true), 2);
|
||||
worldserver.getBlockTickList().a(blockposition, this, 2);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockOre.java
|
||||
+++ b/net/minecraft/world/level/block/BlockOre.java
|
||||
@@ -23,6 +23,7 @@
|
||||
@@ -25,6 +25,7 @@
|
||||
@Override
|
||||
public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.dropNaturally(iblockdata, worldserver, blockposition, itemstack);
|
||||
+ /* CraftBukkit start - Delegated to getExpDrop
|
||||
if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
int i = this.a(worldserver.random);
|
||||
int i = this.xpRange.a(worldserver.random);
|
||||
|
||||
@@ -30,6 +31,21 @@
|
||||
@@ -32,6 +33,21 @@
|
||||
this.dropExperience(worldserver, blockposition, i);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
+ if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
+ int i = this.a(worldserver.random);
|
||||
+ int i = this.xpRange.a(worldserver.random);
|
||||
+
|
||||
+ if (i > 0) {
|
||||
+ return i;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPlant.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPlant.java
|
||||
@@ -21,7 +21,14 @@
|
||||
@@ -23,7 +23,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPortal.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPortal.java
|
||||
@@ -23,6 +23,10 @@
|
||||
@@ -27,6 +27,10 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
+
|
||||
public class BlockPortal extends Block {
|
||||
|
||||
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.E;
|
||||
@@ -53,7 +57,8 @@
|
||||
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.HORIZONTAL_AXIS;
|
||||
@@ -58,7 +62,8 @@
|
||||
}
|
||||
|
||||
if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
if (entity != null) {
|
||||
entity.resetPortalCooldown();
|
||||
@@ -75,6 +80,10 @@
|
||||
@@ -80,6 +85,10 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.ad;
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.RAIL_SHAPE_STRAIGHT;
|
||||
@@ -113,6 +115,13 @@
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockPoweredRail.POWERED, flag1), 3);
|
||||
world.applyPhysics(blockposition.down(), this);
|
||||
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {
|
||||
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).b()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
||||
@@ -16,6 +16,8 @@
|
||||
@@ -18,6 +18,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public abstract class BlockPressurePlateAbstract extends Block {
|
||||
|
||||
protected static final VoxelShape a = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
@@ -79,6 +81,19 @@
|
||||
protected static final VoxelShape PRESSED_AABB = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
@@ -81,6 +83,19 @@
|
||||
boolean flag = i > 0;
|
||||
boolean flag1 = j > 0;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -81,6 +83,26 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
+
|
||||
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateInteger POWER = BlockProperties.az;
|
||||
public static final BlockStateInteger POWER = BlockProperties.POWER;
|
||||
@@ -27,7 +29,31 @@
|
||||
|
||||
@Override
|
||||
protected int b(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
||||
- int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.a(blockposition)).size(), this.maxWeight);
|
||||
+ // CraftBukkit start
|
||||
+ // int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
||||
+ int i = 0;
|
||||
+ java.util.Iterator iterator = world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).iterator();
|
||||
+ java.util.Iterator iterator = world.a(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.a(blockposition)).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Entity entity = (Entity) iterator.next();
|
||||
@@ -37,8 +37,8 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ i = Math.min(i, this.weight);
|
||||
+ i = Math.min(i, this.maxWeight);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (i > 0) {
|
||||
float f = (float) Math.min(this.weight, i) / (float) this.weight;
|
||||
float f = (float) Math.min(this.maxWeight, i) / (float) this.maxWeight;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
+
|
||||
public class BlockPumpkinCarved extends BlockFacingHorizontal implements ItemWearable {
|
||||
|
||||
public static final BlockStateDirection a = BlockFacingHorizontal.FACING;
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -64,19 +69,28 @@
|
||||
EntityPlayer entityplayer;
|
||||
int j;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.aG;
|
||||
@@ -91,7 +93,8 @@
|
||||
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.MODE_COMPARATOR;
|
||||
@@ -99,7 +101,8 @@
|
||||
|
||||
@Nullable
|
||||
private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) {
|
||||
@@ -19,8 +19,8 @@
|
||||
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
|
||||
});
|
||||
|
||||
@@ -146,8 +149,18 @@
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.c);
|
||||
@@ -154,8 +157,18 @@
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.POWERED);
|
||||
|
||||
if (flag1 && !flag) {
|
||||
+ // CraftBukkit start
|
||||
@@ -28,13 +28,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.c, false), 2);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.POWERED, false), 2);
|
||||
} else if (!flag1 && flag) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.c, true), 2);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.POWERED, true), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public class BlockRedstoneLamp extends Block {
|
||||
|
||||
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
|
||||
public static final BlockStateBoolean LIT = BlockRedstoneTorch.LIT;
|
||||
@@ -36,6 +38,11 @@
|
||||
if (flag1) {
|
||||
world.getBlockTickList().a(blockposition, this, 4);
|
||||
@@ -18,18 +18,18 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.LIT), 2);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +53,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !worldserver.isBlockIndirectlyPowered(blockposition)) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneLamp.LIT) && !worldserver.isBlockIndirectlyPowered(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.LIT), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
+
|
||||
public class BlockRedstoneOre extends Block {
|
||||
|
||||
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
|
||||
public static final BlockStateBoolean LIT = BlockRedstoneTorch.LIT;
|
||||
@@ -32,14 +37,30 @@
|
||||
|
||||
@Override
|
||||
@@ -22,24 +22,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, Entity entity) {
|
||||
- interact(world.getType(blockposition), world, blockposition);
|
||||
- super.stepOn(world, blockposition, entity);
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
- interact(iblockdata, world, blockposition);
|
||||
- super.stepOn(world, blockposition, iblockdata, entity);
|
||||
+ // CraftBukkit start
|
||||
+ // interact(world.getType(blockposition), world, blockposition);
|
||||
+ // super.stepOn(world, blockposition, entity);
|
||||
+ // interact(iblockdata, world, blockposition);
|
||||
+ // super.stepOn(world, blockposition, iblockdata, entity);
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ interact(world.getType(blockposition), world, blockposition, entity); // add entity
|
||||
+ super.stepOn(world, blockposition, entity);
|
||||
+ super.stepOn(world, blockposition, iblockdata, entity);
|
||||
+ }
|
||||
+ } else {
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ interact(world.getType(blockposition), world, blockposition, entity); // add entity
|
||||
+ super.stepOn(world, blockposition, entity);
|
||||
+ super.stepOn(world, blockposition, iblockdata, entity);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -62,25 +62,25 @@
|
||||
- private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity
|
||||
playEffect(world, blockposition);
|
||||
if (!(Boolean) iblockdata.get(BlockRedstoneOre.a)) {
|
||||
if (!(Boolean) iblockdata.get(BlockRedstoneOre.LIT)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.set(BlockRedstoneOre.a, true)).isCancelled()) {
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.set(BlockRedstoneOre.LIT, true)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, true), 3);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.LIT, true), 3);
|
||||
}
|
||||
|
||||
@@ -71,6 +97,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneOre.a)) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneOre.LIT)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.set(BlockRedstoneOre.a, false)).isCancelled()) {
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.set(BlockRedstoneOre.LIT, false)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, false), 3);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.LIT, false), 3);
|
||||
}
|
||||
|
||||
@@ -79,12 +110,25 @@
|
||||
@@ -108,4 +108,4 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private static void playEffect(World world, BlockPosition blockposition) {
|
||||
@Override
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
public static final BlockStateBoolean LIT = BlockProperties.r;
|
||||
@@ -73,8 +75,24 @@
|
||||
public static final BlockStateBoolean LIT = BlockProperties.LIT;
|
||||
@@ -77,8 +79,24 @@
|
||||
list.remove(0);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, false), 3);
|
||||
if (a(worldserver, blockposition, true)) {
|
||||
worldserver.triggerEffect(1502, blockposition, 0);
|
||||
@@ -82,6 +100,15 @@
|
||||
@@ -86,6 +104,15 @@
|
||||
}
|
||||
}
|
||||
} else if (!flag && !a(worldserver, blockposition, false)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
|
||||
@@ -34,6 +34,8 @@
|
||||
@@ -38,6 +38,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -8,8 +8,17 @@
|
||||
+
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.X;
|
||||
@@ -238,7 +240,16 @@
|
||||
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.NORTH_REDSTONE;
|
||||
@@ -55,7 +57,7 @@
|
||||
private static final Map<EnumDirection, VoxelShape> SHAPES_FLOOR = Maps.newEnumMap(ImmutableMap.of(EnumDirection.NORTH, Block.a(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), EnumDirection.SOUTH, Block.a(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), EnumDirection.EAST, Block.a(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), EnumDirection.WEST, Block.a(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D)));
|
||||
private static final Map<EnumDirection, VoxelShape> SHAPES_UP = Maps.newEnumMap(ImmutableMap.of(EnumDirection.NORTH, VoxelShapes.a((VoxelShape) BlockRedstoneWire.SHAPES_FLOOR.get(EnumDirection.NORTH), Block.a(3.0D, 0.0D, 0.0D, 13.0D, 16.0D, 1.0D)), EnumDirection.SOUTH, VoxelShapes.a((VoxelShape) BlockRedstoneWire.SHAPES_FLOOR.get(EnumDirection.SOUTH), Block.a(3.0D, 0.0D, 15.0D, 13.0D, 16.0D, 16.0D)), EnumDirection.EAST, VoxelShapes.a((VoxelShape) BlockRedstoneWire.SHAPES_FLOOR.get(EnumDirection.EAST), Block.a(15.0D, 0.0D, 3.0D, 16.0D, 16.0D, 13.0D)), EnumDirection.WEST, VoxelShapes.a((VoxelShape) BlockRedstoneWire.SHAPES_FLOOR.get(EnumDirection.WEST), Block.a(0.0D, 0.0D, 3.0D, 1.0D, 16.0D, 13.0D))));
|
||||
private static final Map<IBlockData, VoxelShape> SHAPES_CACHE = Maps.newHashMap();
|
||||
- private static final Vec3D[] COLORS = (Vec3D[]) SystemUtils.a((Object) (new Vec3D[16]), (avec3d) -> {
|
||||
+ private static final Vec3D[] COLORS = (Vec3D[]) SystemUtils.a((new Vec3D[16]), (avec3d) -> { // CraftBukkit - decompile error
|
||||
for (int i = 0; i <= 15; ++i) {
|
||||
float f = (float) i / 15.0F;
|
||||
float f1 = f * 0.6F + (f > 0.0F ? 0.4F : 0.3F);
|
||||
@@ -258,7 +260,16 @@
|
||||
private void a(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = this.a(world, blockposition);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockReed.java
|
||||
+++ b/net/minecraft/world/level/block/BlockReed.java
|
||||
@@ -55,7 +55,7 @@
|
||||
@@ -57,7 +57,7 @@
|
||||
int j = (Integer) iblockdata.get(BlockReed.AGE);
|
||||
|
||||
if (j == 15) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSapling.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSapling.java
|
||||
@@ -15,11 +15,19 @@
|
||||
@@ -15,12 +15,20 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -13,14 +13,15 @@
|
||||
+
|
||||
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger STAGE = BlockProperties.aA;
|
||||
protected static final VoxelShape b = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
|
||||
private final WorldGenTreeProvider c;
|
||||
public static final BlockStateInteger STAGE = BlockProperties.STAGE;
|
||||
protected static final float AABB_OFFSET = 6.0F;
|
||||
protected static final VoxelShape SHAPE = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
|
||||
private final WorldGenTreeProvider treeGrower;
|
||||
+ public static TreeType treeType; // CraftBukkit
|
||||
|
||||
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
|
||||
super(blockbase_info);
|
||||
@@ -35,7 +43,30 @@
|
||||
@@ -36,7 +44,30 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (worldserver.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockScaffolding.java
|
||||
+++ b/net/minecraft/world/level/block/BlockScaffolding.java
|
||||
@@ -94,7 +94,7 @@
|
||||
@@ -96,7 +96,7 @@
|
||||
int i = a((IBlockAccess) worldserver, blockposition);
|
||||
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.a, i)).set(BlockScaffolding.c, this.a(worldserver, blockposition, i));
|
||||
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.DISTANCE, i)).set(BlockScaffolding.BOTTOM, this.a(worldserver, blockposition, i));
|
||||
|
||||
- if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7) {
|
||||
+ if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - BlockFadeEvent
|
||||
if ((Integer) iblockdata.get(BlockScaffolding.a) == 7) {
|
||||
worldserver.addEntity(new EntityFallingBlock(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.set(BlockScaffolding.b, false)));
|
||||
- if ((Integer) iblockdata1.get(BlockScaffolding.DISTANCE) == 7) {
|
||||
+ if ((Integer) iblockdata1.get(BlockScaffolding.DISTANCE) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - BlockFadeEvent
|
||||
if ((Integer) iblockdata.get(BlockScaffolding.DISTANCE) == 7) {
|
||||
worldserver.addEntity(new EntityFallingBlock(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.set(BlockScaffolding.WATERLOGGED, false)));
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSnow.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSnow.java
|
||||
@@ -85,6 +85,11 @@
|
||||
@@ -87,6 +87,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+
|
||||
public class BlockSoil extends Block {
|
||||
|
||||
public static final BlockStateInteger MOISTURE = BlockProperties.aw;
|
||||
@@ -81,26 +86,49 @@
|
||||
public static final BlockStateInteger MOISTURE = BlockProperties.MOISTURE;
|
||||
@@ -82,26 +87,49 @@
|
||||
|
||||
if (!a((IWorldReader) worldserver, blockposition) && !worldserver.isRainingAt(blockposition.up())) {
|
||||
if (i > 0) {
|
||||
@@ -29,9 +29,9 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) {
|
||||
+ super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) && entity.getWidth() * entity.getWidth() * entity.getHeight() > 0.512F) {
|
||||
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
|
||||
+ super.fallOn(world, iblockdata, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getWidth() * entity.getWidth() * entity.getHeight() > 0.512F) {
|
||||
+ // CraftBukkit start - Interact soil
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
@@ -49,11 +49,11 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
fade(world.getType(blockposition), world, blockposition);
|
||||
fade(iblockdata, world, blockposition);
|
||||
}
|
||||
|
||||
- super.fallOn(world, blockposition, entity, f);
|
||||
+ // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up
|
||||
- super.fallOn(world, iblockdata, blockposition, entity, f);
|
||||
+ // super.fallOn(world, iblockdata, blockposition, entity, f); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
public static void fade(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSponge.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSponge.java
|
||||
@@ -16,6 +16,13 @@
|
||||
import net.minecraft.world.level.material.FluidTypes;
|
||||
@@ -15,6 +15,13 @@
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -13,8 +13,8 @@
|
||||
+
|
||||
public class BlockSponge extends Block {
|
||||
|
||||
protected BlockSponge(BlockBase.Info blockbase_info) {
|
||||
@@ -48,6 +55,7 @@
|
||||
public static final int MAX_DEPTH = 6;
|
||||
@@ -50,6 +57,7 @@
|
||||
|
||||
queue.add(new Tuple<>(blockposition, 0));
|
||||
int i = 0;
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
Tuple<BlockPosition, Integer> tuple = (Tuple) queue.poll();
|
||||
@@ -59,27 +67,31 @@
|
||||
@@ -61,27 +69,31 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
EnumDirection enumdirection = aenumdirection[l];
|
||||
BlockPosition blockposition2 = blockposition1.shift(enumdirection);
|
||||
@@ -35,8 +35,8 @@
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
if (fluid.a((Tag) TagsFluid.WATER)) {
|
||||
- if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(world, blockposition2, iblockdata) != FluidTypes.EMPTY) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata) != FluidTypes.EMPTY) { // CraftBukkit
|
||||
- if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).removeFluid(world, blockposition2, iblockdata).isEmpty()) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata).isEmpty()) { // CraftBukkit
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
@@ -49,9 +49,9 @@
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
}
|
||||
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||
- TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
- TileEntity tileentity = iblockdata.isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
+ // CraftBukkit start
|
||||
+ // TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
+ // TileEntity tileentity = iblockdata.isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
|
||||
- a(iblockdata, (GeneratorAccess) world, blockposition2, tileentity);
|
||||
- world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
|
||||
@@ -61,7 +61,7 @@
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
@@ -92,6 +104,39 @@
|
||||
@@ -94,6 +106,39 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -84,12 +84,12 @@
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+
|
||||
+ if (fluid.a(TagsFluid.WATER)) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata) != FluidTypes.EMPTY) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata).isEmpty()) {
|
||||
+ // NOP
|
||||
+ } else if (iblockdata.getBlock() instanceof BlockFluids) {
|
||||
+ // NOP
|
||||
+ } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||
+ TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
+ TileEntity tileentity = iblockdata.isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
+
|
||||
+ a(iblockdata, world, blockposition2, tileentity);
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockStem.java
|
||||
+++ b/net/minecraft/world/level/block/BlockStem.java
|
||||
@@ -15,6 +15,8 @@
|
||||
@@ -21,6 +21,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ai;
|
||||
@@ -47,14 +49,18 @@
|
||||
public static final int MAX_AGE = 7;
|
||||
@@ -57,14 +59,18 @@
|
||||
|
||||
if (i < 7) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, i + 1);
|
||||
@@ -20,17 +20,17 @@
|
||||
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1.down());
|
||||
|
||||
if (worldserver.getType(blockposition1).isAir() && (iblockdata1.a(Blocks.FARMLAND) || iblockdata1.a(Blocks.DIRT) || iblockdata1.a(Blocks.COARSE_DIRT) || iblockdata1.a(Blocks.PODZOL) || iblockdata1.a(Blocks.GRASS_BLOCK))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.blockFruit.getBlockData());
|
||||
if (worldserver.getType(blockposition1).isAir() && (iblockdata1.a(Blocks.FARMLAND) || iblockdata1.a((Tag) TagsBlock.DIRT))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.fruit.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.blockFruit.getBlockData())) {
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.getBlockData())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
||||
worldserver.setTypeUpdate(blockposition, (IBlockData) this.fruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
||||
}
|
||||
}
|
||||
@@ -78,7 +84,7 @@
|
||||
@@ -93,7 +99,7 @@
|
||||
int i = Math.min(7, (Integer) iblockdata.get(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockStem.AGE, i);
|
||||
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
+
|
||||
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger a = BlockProperties.ag;
|
||||
@@ -52,7 +60,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockSweetBerryBush.a);
|
||||
private static final float HURT_SPEED_THRESHOLD = 0.003F;
|
||||
@@ -59,7 +67,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockSweetBerryBush.AGE);
|
||||
|
||||
if (i < 3 && random.nextInt(5) == 0 && worldserver.getLightLevel(blockposition.up(), 0) >= 9) {
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); // CraftBukkit
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.AGE, i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.AGE, i + 1), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,7 +74,9 @@
|
||||
double d1 = Math.abs(entity.locZ() - entity.F);
|
||||
@@ -73,7 +81,9 @@
|
||||
double d1 = Math.abs(entity.locZ() - entity.zOld);
|
||||
|
||||
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
|
||||
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +93,15 @@
|
||||
@@ -90,7 +100,15 @@
|
||||
} else if (i > 1) {
|
||||
int j = 1 + world.random.nextInt(2);
|
||||
|
||||
@@ -48,6 +48,6 @@
|
||||
+ a(world, blockposition, CraftItemStack.asNMSCopy(itemStack));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_SWEET_BERRIES_PICK_FROM_BUSH, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, 1), 2);
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.SWEET_BERRY_BUSH_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F);
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.AGE, 1), 2);
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTNT.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTNT.java
|
||||
@@ -115,6 +115,11 @@
|
||||
@@ -121,6 +121,11 @@
|
||||
Entity entity = iprojectile.getShooter();
|
||||
|
||||
if (iprojectile.isBurning()) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
if (iprojectile.isBurning() && iprojectile.a(world, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
|
||||
world.a(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTallPlant.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTallPlant.java
|
||||
@@ -82,6 +82,11 @@
|
||||
@@ -84,6 +84,11 @@
|
||||
}
|
||||
|
||||
protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
|
||||
@@ -27,6 +27,8 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
+
|
||||
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateBoolean OPEN = BlockProperties.u;
|
||||
@@ -113,6 +115,19 @@
|
||||
public static final BlockStateBoolean OPEN = BlockProperties.OPEN;
|
||||
@@ -117,6 +119,19 @@
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||
|
||||
if (flag1 != (Boolean) iblockdata.get(BlockTrapdoor.c)) {
|
||||
if (flag1 != (Boolean) iblockdata.get(BlockTrapdoor.POWERED)) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTripwire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTripwire.java
|
||||
@@ -23,6 +23,8 @@
|
||||
@@ -24,6 +24,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockTripwire extends Block {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
||||
@@ -150,6 +152,40 @@
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -153,6 +155,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTripwireHook.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTripwireHook.java
|
||||
@@ -25,6 +25,8 @@
|
||||
@@ -26,6 +26,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockTripwireHook extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -155,6 +157,17 @@
|
||||
@@ -160,6 +162,17 @@
|
||||
this.a(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,38 +12,38 @@
|
||||
+
|
||||
public class BlockTurtleEgg extends Block {
|
||||
|
||||
private static final VoxelShape c = Block.a(3.0D, 0.0D, 3.0D, 12.0D, 7.0D, 12.0D);
|
||||
public static final int MAX_HATCH_LEVEL = 2;
|
||||
@@ -62,6 +68,19 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
if (iblockdata.a(Blocks.TURTLE_EGG)) {
|
||||
+ // CraftBukkit start - Step on eggs
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(world, blockposition));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
private void a(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, int i) {
|
||||
if (this.a(world, entity)) {
|
||||
if (!world.isClientSide && world.random.nextInt(i) == 0 && iblockdata.a(Blocks.TURTLE_EGG)) {
|
||||
+ // CraftBukkit start - Step on eggs
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(world, blockposition));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(world, blockposition, iblockdata);
|
||||
}
|
||||
}
|
||||
@@ -88,9 +107,19 @@
|
||||
int i = (Integer) iblockdata.get(BlockTurtleEgg.a);
|
||||
|
||||
if (i < 2) {
|
||||
+ // CraftBukkit start - Call BlockGrowEvent
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata.set(BlockTurtleEgg.a, i + 1), 2)) {
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2);
|
||||
this.a(world, blockposition, iblockdata);
|
||||
}
|
||||
|
||||
@@ -87,9 +106,19 @@
|
||||
int i = (Integer) iblockdata.get(BlockTurtleEgg.HATCH);
|
||||
|
||||
if (i < 2) {
|
||||
+ // CraftBukkit start - Call BlockGrowEvent
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata.set(BlockTurtleEgg.HATCH, i + 1), 2)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.HATCH, i + 1), 2);
|
||||
+ // worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above
|
||||
} else {
|
||||
+ // CraftBukkit start - Call BlockFadeEvent
|
||||
@@ -51,10 +51,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
worldserver.a(blockposition, false);
|
||||
|
||||
@@ -101,7 +130,7 @@
|
||||
@@ -100,7 +129,7 @@
|
||||
entityturtle.setAgeRaw(-24000);
|
||||
entityturtle.setHomePos(blockposition);
|
||||
entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockVine extends Block {
|
||||
|
||||
public static final BlockStateBoolean UP = BlockSprawling.e;
|
||||
@@ -190,20 +192,24 @@
|
||||
public static final BlockStateBoolean UP = BlockSprawling.UP;
|
||||
@@ -196,20 +198,24 @@
|
||||
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
|
||||
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
} else if (flag1 && worldserver.isEmpty(blockposition4) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection2), enumdirection3)) {
|
||||
- worldserver.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
|
||||
} else if ((double) worldserver.random.nextFloat() < 0.05D && a((IBlockAccess) worldserver, blockposition2.up(), EnumDirection.UP)) {
|
||||
} else if ((double) random.nextFloat() < 0.05D && a((IBlockAccess) worldserver, blockposition2.up(), EnumDirection.UP)) {
|
||||
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
} else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) {
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
|
||||
@@ -233,7 +239,7 @@
|
||||
@@ -239,7 +245,7 @@
|
||||
}
|
||||
|
||||
if (this.canSpread(iblockdata2)) {
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -248,7 +254,7 @@
|
||||
@@ -254,7 +260,7 @@
|
||||
IBlockData iblockdata4 = this.a(iblockdata, iblockdata3, random);
|
||||
|
||||
if (iblockdata3 != iblockdata4 && this.canSpread(iblockdata4)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockWitherRose.java
|
||||
+++ b/net/minecraft/world/level/block/BlockWitherRose.java
|
||||
@@ -31,7 +31,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
if (!entityliving.isInvulnerable(DamageSource.WITHER)) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
@@ -74,6 +82,15 @@
|
||||
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
|
||||
entitywither.aA = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
|
||||
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
|
||||
entitywither.beginSpawnSequence();
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -82,7 +99,7 @@
|
||||
CriterionTriggers.n.a(entityplayer, (Entity) entitywither);
|
||||
CriterionTriggers.SUMMONED_ENTITY.a(entityplayer, (Entity) entitywither);
|
||||
}
|
||||
|
||||
- world.addEntity(entitywither);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
+++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
@@ -44,7 +44,7 @@
|
||||
if (block != null) {
|
||||
IBlockData iblockdata2 = (IBlockData) ((IBlockData) block.getBlockData().set(AmethystClusterBlock.FACING, enumdirection)).set(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluid().getType() == FluidTypes.WATER);
|
||||
|
||||
- worldserver.setTypeUpdate(blockposition1, iblockdata2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
--- a/net/minecraft/world/level/block/CaveVines.java
|
||||
+++ b/net/minecraft/world/level/block/CaveVines.java
|
||||
@@ -15,17 +15,43 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.Collections;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.player.PlayerHarvestBlockEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public interface CaveVines {
|
||||
|
||||
VoxelShape SHAPE = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
BlockStateBoolean BERRIES = BlockProperties.BERRIES;
|
||||
|
||||
- static EnumInteractionResult harvest(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ static EnumInteractionResult harvest(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if ((Boolean) iblockdata.get(CaveVines.BERRIES)) {
|
||||
- Block.a(world, blockposition, new ItemStack(Items.GLOW_BERRIES, 1));
|
||||
+ // CraftBukkit start
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ PlayerHarvestBlockEvent event = CraftEventFactory.callPlayerHarvestBlockEvent(world, blockposition, (EntityHuman) entity, Collections.singletonList(new ItemStack(Items.GLOW_BERRIES, 1)));
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.SUCCESS; // We need to return a success either way, because making it PASS or FAIL will result in a bug where cancelling while harvesting w/ block in hand places block
|
||||
+ }
|
||||
+ for (org.bukkit.inventory.ItemStack itemStack : event.getItemsHarvested()) {
|
||||
+ Block.a(world, blockposition, CraftItemStack.asNMSCopy(itemStack));
|
||||
+ }
|
||||
+ } else {
|
||||
+ Block.a(world, blockposition, new ItemStack(Items.GLOW_BERRIES, 1));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
float f = MathHelper.b(world.random, 0.8F, 1.2F);
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.CAVE_VINES_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, f);
|
||||
+ // CraftBukkit start - call EntityChangeBlockEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, (IBlockData) iblockdata.set(CaveVines.BERRIES, false)).isCancelled()) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(CaveVines.BERRIES, false), 2);
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
} else {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/CaveVinesBlock.java
|
||||
+++ b/net/minecraft/world/level/block/CaveVinesBlock.java
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
- return CaveVines.harvest(iblockdata, world, blockposition);
|
||||
+ return CaveVines.harvest(iblockdata, world, blockposition, entityhuman); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/CaveVinesPlantBlock.java
|
||||
+++ b/net/minecraft/world/level/block/CaveVinesPlantBlock.java
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
- return CaveVines.harvest(iblockdata, world, blockposition);
|
||||
+ return CaveVines.harvest(iblockdata, world, blockposition, entityhuman); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/ChangeOverTimeBlock.java
|
||||
+++ b/net/minecraft/world/level/block/ChangeOverTimeBlock.java
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
if (random.nextFloat() < f1) {
|
||||
this.a(iblockdata).ifPresent((iblockdata2) -> {
|
||||
- worldserver.setTypeUpdate(blockposition, iblockdata2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, iblockdata2); // CraftBukkit
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
--- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
||||
@@ -17,6 +17,11 @@
|
||||
import net.minecraft.world.level.material.FluidType;
|
||||
import net.minecraft.world.level.material.FluidTypes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
+import org.bukkit.event.block.CauldronLevelChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class LayeredCauldronBlock extends AbstractCauldronBlock {
|
||||
|
||||
public static final int MIN_FILL_LEVEL = 1;
|
||||
@@ -56,10 +61,14 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!world.isClientSide && entity.isBurning() && this.a(iblockdata, blockposition, entity)) {
|
||||
- entity.extinguish();
|
||||
+ // CraftBukkit start
|
||||
if (entity.a(world, blockposition)) {
|
||||
- this.d(iblockdata, world, blockposition);
|
||||
+ if (!decreaseLevel(iblockdata, world, blockposition, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
+ entity.extinguish();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -69,15 +78,38 @@
|
||||
}
|
||||
|
||||
public static void e(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ decreaseLevel(iblockdata, world, blockposition, null, CauldronLevelChangeEvent.ChangeReason.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean decreaseLevel(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
|
||||
int i = (Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) - 1;
|
||||
|
||||
- world.setTypeUpdate(blockposition, i == 0 ? Blocks.CAULDRON.getBlockData() : (IBlockData) iblockdata.set(LayeredCauldronBlock.LEVEL, i));
|
||||
+ return changeLevel(iblockdata, world, blockposition, i == 0 ? Blocks.CAULDRON.getBlockData() : iblockdata.set(LayeredCauldronBlock.LEVEL, i), entity, reason);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public static boolean changeLevel(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
|
||||
+ CraftBlockState newState = CraftBlockState.getBlockState(world, blockposition);
|
||||
+ newState.setData(newBlock);
|
||||
+
|
||||
+ CauldronLevelChangeEvent event = new CauldronLevelChangeEvent(
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ (entity == null) ? null : entity.getBukkitEntity(), reason, newState
|
||||
+ );
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ newState.update(true);
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, BiomeBase.Precipitation biomebase_precipitation) {
|
||||
if (BlockCauldron.a(world) && (Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) != 3 && this.fillPredicate.test(biomebase_precipitation)) {
|
||||
- world.setTypeUpdate(blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL));
|
||||
+ changeLevel(iblockdata, world, blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +126,11 @@
|
||||
@Override
|
||||
protected void a(IBlockData iblockdata, World world, BlockPosition blockposition, FluidType fluidtype) {
|
||||
if (!this.c(iblockdata)) {
|
||||
- world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) + 1));
|
||||
+ // CraftBukkit start
|
||||
+ if (!changeLevel(iblockdata, world, blockposition, (IBlockData) iblockdata.set(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) + 1), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.triggerEffect(1047, blockposition, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
--- a/net/minecraft/world/level/block/LightningRodBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
|
||||
@@ -33,6 +33,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class LightningRodBlock extends RodBlock implements IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateBoolean WATERLOGGED = BlockProperties.WATERLOGGED;
|
||||
@@ -79,6 +84,18 @@
|
||||
}
|
||||
|
||||
public void d(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean powered = iblockdata.get(LightningRodBlock.POWERED);
|
||||
+ int old = (powered) ? 15 : 0;
|
||||
+ int current = (!powered) ? 15 : 0;
|
||||
+
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), old, current);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+
|
||||
+ if (eventRedstone.getNewCurrent() <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(LightningRodBlock.POWERED, true), 3);
|
||||
this.e(iblockdata, world, blockposition);
|
||||
world.getBlockTickList().a(blockposition, this, 8);
|
||||
@@ -135,7 +152,7 @@
|
||||
Entity entity = iprojectile.getShooter();
|
||||
|
||||
entitylightning.b(entity instanceof EntityPlayer ? (EntityPlayer) entity : null);
|
||||
- world.addEntity(entitylightning);
|
||||
+ ((WorldServer) world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.TRIDENT_THUNDER, SoundCategory.WEATHER, 5.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
--- a/net/minecraft/world/level/block/MultifaceBlock.java
|
||||
+++ b/net/minecraft/world/level/block/MultifaceBlock.java
|
||||
@@ -45,7 +45,7 @@
|
||||
private static final VoxelShape NORTH_AABB = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 1.0D);
|
||||
private static final VoxelShape SOUTH_AABB = Block.a(0.0D, 0.0D, 15.0D, 16.0D, 16.0D, 16.0D);
|
||||
private static final Map<EnumDirection, BlockStateBoolean> PROPERTY_BY_DIRECTION = BlockSprawling.PROPERTY_BY_DIRECTION;
|
||||
- private static final Map<EnumDirection, VoxelShape> SHAPE_BY_DIRECTION = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumDirection.class), (enummap) -> {
|
||||
+ private static final Map<EnumDirection, VoxelShape> SHAPE_BY_DIRECTION = (Map) SystemUtils.a(Maps.newEnumMap(EnumDirection.class), (enummap) -> { // CraftBukkit - decompile error
|
||||
enummap.put(EnumDirection.NORTH, MultifaceBlock.NORTH_AABB);
|
||||
enummap.put(EnumDirection.EAST, MultifaceBlock.EAST_AABB);
|
||||
enummap.put(EnumDirection.SOUTH, MultifaceBlock.SOUTH_AABB);
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
return (IBlockData) Arrays.stream(blockactioncontext.f()).map((enumdirection) -> {
|
||||
return this.c(iblockdata, (IBlockAccess) world, blockposition, enumdirection);
|
||||
- }).filter(Objects::nonNull).findFirst().orElse((Object) null);
|
||||
+ }).filter(Objects::nonNull).findFirst().orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -226,7 +226,7 @@
|
||||
if (optional.isPresent()) {
|
||||
Pair<BlockPosition, EnumDirection> pair = (Pair) optional.get();
|
||||
|
||||
- return this.a(generatoraccess, (BlockPosition) pair.getFirst(), (EnumDirection) pair.getSecond(), flag);
|
||||
+ return this.a(generatoraccess, (BlockPosition) pair.getFirst(), (EnumDirection) pair.getSecond(), flag, blockposition); // CraftBukkit
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -271,7 +271,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private boolean a(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection enumdirection, boolean flag) {
|
||||
+ private boolean a(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection enumdirection, boolean flag, BlockPosition source) { // CraftBukkit
|
||||
IBlockData iblockdata = generatoraccess.getType(blockposition);
|
||||
IBlockData iblockdata1 = this.c(iblockdata, (IBlockAccess) generatoraccess, blockposition, enumdirection);
|
||||
|
||||
@@ -280,7 +280,7 @@
|
||||
generatoraccess.A(blockposition).e(blockposition);
|
||||
}
|
||||
|
||||
- return generatoraccess.setTypeAndData(blockposition, iblockdata1, 2);
|
||||
+ return org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, source, blockposition, iblockdata1, 2); // CraftBukkit
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
@@ -43,6 +43,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PointedDripstoneBlock extends Block implements Fallable, IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateDirection TIP_DIRECTION = BlockProperties.VERTICAL_DIRECTION;
|
||||
@@ -125,6 +130,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
|
||||
if (!world.isClientSide && iprojectile.a(world, blockposition) && iprojectile instanceof EntityThrownTrident && iprojectile.getMot().f() > 0.6D) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.b(blockposition, true);
|
||||
}
|
||||
|
||||
@@ -133,7 +143,9 @@
|
||||
@Override
|
||||
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
|
||||
if (iblockdata.get(PointedDripstoneBlock.TIP_DIRECTION) == EnumDirection.UP && iblockdata.get(PointedDripstoneBlock.THICKNESS) == DripstoneThickness.TIP) {
|
||||
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||
entity.a(f + 2.0F, 2.0F, DamageSource.STALAGMITE);
|
||||
+ CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
} else {
|
||||
super.fallOn(world, iblockdata, blockposition, entity, f);
|
||||
}
|
||||
@@ -397,15 +409,15 @@
|
||||
if (a(iblockdata, enumdirection.opposite())) {
|
||||
c(iblockdata, (GeneratorAccess) worldserver, blockposition1);
|
||||
} else if (iblockdata.isAir() || iblockdata.a(Blocks.WATER)) {
|
||||
- a((GeneratorAccess) worldserver, blockposition1, enumdirection, DripstoneThickness.TIP);
|
||||
+ a((GeneratorAccess) worldserver, blockposition1, enumdirection, DripstoneThickness.TIP, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- private static void a(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection enumdirection, DripstoneThickness dripstonethickness) {
|
||||
+ private static void a(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection enumdirection, DripstoneThickness dripstonethickness, BlockPosition source) {
|
||||
IBlockData iblockdata = (IBlockData) ((IBlockData) ((IBlockData) Blocks.POINTED_DRIPSTONE.getBlockData().set(PointedDripstoneBlock.TIP_DIRECTION, enumdirection)).set(PointedDripstoneBlock.THICKNESS, dripstonethickness)).set(PointedDripstoneBlock.WATERLOGGED, generatoraccess.getFluid(blockposition).getType() == FluidTypes.WATER);
|
||||
|
||||
- generatoraccess.setTypeAndData(blockposition, iblockdata, 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, source, blockposition, iblockdata, 3); // CraftBukkit
|
||||
}
|
||||
|
||||
private static void c(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
@@ -420,8 +432,8 @@
|
||||
blockposition1 = blockposition.down();
|
||||
}
|
||||
|
||||
- a(generatoraccess, blockposition2, EnumDirection.DOWN, DripstoneThickness.TIP_MERGE);
|
||||
- a(generatoraccess, blockposition1, EnumDirection.UP, DripstoneThickness.TIP_MERGE);
|
||||
+ a(generatoraccess, blockposition2, EnumDirection.DOWN, DripstoneThickness.TIP_MERGE, blockposition); // CraftBukkit
|
||||
+ a(generatoraccess, blockposition1, EnumDirection.UP, DripstoneThickness.TIP_MERGE, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
public static void a(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -454,7 +466,7 @@
|
||||
|
||||
return (BlockPosition) a(generatoraccess, blockposition, enumdirection.e(), predicate, (iblockdata1) -> {
|
||||
return a(iblockdata1, flag);
|
||||
- }, i).orElse((Object) null);
|
||||
+ }, i).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,12 +579,12 @@
|
||||
return iblockdata.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock) iblockdata.getBlock()).a(fluidtype);
|
||||
};
|
||||
|
||||
- return (BlockPosition) a(world, blockposition, EnumDirection.DOWN.e(), BlockBase.BlockData::isAir, predicate, 11).orElse((Object) null);
|
||||
+ return (BlockPosition) a(world, blockposition, EnumDirection.DOWN.e(), BlockBase.BlockData::isAir, predicate, 11).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BlockPosition a(World world, BlockPosition blockposition) {
|
||||
- return (BlockPosition) a(world, blockposition, EnumDirection.UP.e(), BlockBase.BlockData::isAir, PointedDripstoneBlock::h, 11).orElse((Object) null);
|
||||
+ return (BlockPosition) a(world, blockposition, EnumDirection.UP.e(), BlockBase.BlockData::isAir, PointedDripstoneBlock::h, 11).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static FluidType b(World world, BlockPosition blockposition) {
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
@@ -68,7 +68,12 @@
|
||||
|
||||
entity.o(true);
|
||||
if (!world.isClientSide) {
|
||||
- if (entity.isBurning() && (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof EntityHuman) && entity.a(world, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entity.isBurning() && entity.a(world, blockposition)) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData(), !(world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof EntityHuman)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.b(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/level/block/RootedDirtBlock.java
|
||||
+++ b/net/minecraft/world/level/block/RootedDirtBlock.java
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
- worldserver.setTypeUpdate(blockposition.down(), Blocks.HANGING_ROOTS.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition.down(), Blocks.HANGING_ROOTS.getBlockData()); // CraftBukkit
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user