@@ -15,8 +15,8 @@
|
||||
|
||||
});
|
||||
|
||||
- minecraftserver.getCommandDispatcher().a(commandlistenerwrapper, this.command);
|
||||
+ minecraftserver.getCommandDispatcher().dispatchServerCommand(commandlistenerwrapper, this.command); // CraftBukkit
|
||||
- minecraftserver.getCommands().performCommand(commandlistenerwrapper, this.command);
|
||||
+ minecraftserver.getCommands().dispatchServerCommand(commandlistenerwrapper, this.command); // CraftBukkit
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Executing command block");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Command to be executed");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/Explosion.java
|
||||
+++ b/net/minecraft/world/level/Explosion.java
|
||||
@@ -43,6 +43,14 @@
|
||||
@@ -42,6 +42,14 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class Explosion {
|
||||
|
||||
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
||||
@@ -61,6 +69,7 @@
|
||||
@@ -60,6 +68,7 @@
|
||||
private final ExplosionDamageCalculator damageCalculator;
|
||||
private final List<BlockPosition> toBlow;
|
||||
private final Map<EntityHuman, Vec3D> hitPlayers;
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
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 @@
|
||||
@@ -84,7 +93,7 @@
|
||||
this.hitPlayers = Maps.newHashMap();
|
||||
this.level = world;
|
||||
this.source = entity;
|
||||
@@ -32,28 +32,27 @@
|
||||
this.x = d0;
|
||||
this.y = d1;
|
||||
this.z = d2;
|
||||
@@ -135,6 +144,11 @@
|
||||
@@ -134,6 +143,11 @@
|
||||
}
|
||||
|
||||
public void a() {
|
||||
public void explode() {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.radius < 0.1F) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.a(this.source, GameEvent.EXPLODE, new BlockPosition(this.x, this.y, this.z));
|
||||
this.level.gameEvent(this.source, GameEvent.EXPLODE, new BlockPosition(this.x, this.y, this.z));
|
||||
Set<BlockPosition> set = Sets.newHashSet();
|
||||
boolean flag = true;
|
||||
@@ -218,7 +232,16 @@
|
||||
double d12 = (double) a(vec3d, entity);
|
||||
@@ -217,7 +231,15 @@
|
||||
double d12 = (double) getSeenPercent(vec3d, entity);
|
||||
double d13 = (1.0D - d7) * d12;
|
||||
|
||||
- entity.damageEntity(this.b(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
- entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
+ // CraftBukkit start
|
||||
+ // entity.damageEntity(this.b(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
+ CraftEventFactory.entityDamage = source;
|
||||
+ entity.forceExplosionKnockback = false;
|
||||
+ boolean wasDamaged = entity.damageEntity(this.b(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
+ boolean wasDamaged = entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
+ if (!wasDamaged && !(entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) && !entity.forceExplosionKnockback) {
|
||||
+ continue;
|
||||
@@ -62,7 +61,7 @@
|
||||
double d14 = d13;
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
@@ -260,6 +283,51 @@
|
||||
@@ -259,6 +281,51 @@
|
||||
|
||||
Collections.shuffle(this.toBlow, this.level.random);
|
||||
Iterator iterator = this.toBlow.iterator();
|
||||
@@ -114,34 +113,34 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
BlockPosition blockposition = (BlockPosition) iterator.next();
|
||||
@@ -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);
|
||||
@@ -273,8 +340,8 @@
|
||||
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
|
||||
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
|
||||
|
||||
- if (this.blockInteraction == Explosion.Effect.DESTROY) {
|
||||
- loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, this.radius);
|
||||
- loottableinfo_builder.withParameter(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
|
||||
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
|
||||
}
|
||||
|
||||
iblockdata.a(loottableinfo_builder).forEach((itemstack) -> {
|
||||
@@ -305,7 +373,11 @@
|
||||
iblockdata.getDrops(loottableinfo_builder).forEach((itemstack) -> {
|
||||
@@ -304,7 +371,11 @@
|
||||
BlockPosition blockposition2 = (BlockPosition) iterator1.next();
|
||||
|
||||
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));
|
||||
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition2).isAir() && this.level.getBlockState(blockposition2.below()).isSolidRender(this.level, blockposition2.below())) {
|
||||
- this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
|
||||
+ // CraftBukkit start - Ignition by explosion
|
||||
+ 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));
|
||||
+ this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,6 +385,7 @@
|
||||
@@ -312,6 +383,7 @@
|
||||
}
|
||||
|
||||
private static void a(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {
|
||||
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5425
|
||||
int i = objectarraylist.size();
|
||||
|
||||
|
||||
@@ -3,56 +3,56 @@
|
||||
@@ -118,7 +118,7 @@
|
||||
}
|
||||
|
||||
public <T extends GameRules.GameRuleValue<T>> T get(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
public <T extends GameRules.GameRuleValue<T>> T getRule(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- return (GameRules.GameRuleValue) this.rules.get(gamerules_gamerulekey);
|
||||
+ return (T) this.rules.get(gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public NBTTagCompound a() {
|
||||
public NBTTagCompound createTag() {
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
private void a(DynamicLike<?> dynamiclike) {
|
||||
private void loadFromTag(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);
|
||||
optional.ifPresent(gamerules_gamerulevalue::deserialize);
|
||||
@@ -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) {
|
||||
- gamerules_gamerulevisitor.a(gamerules_gamerulekey, gamerules_gameruledefinition);
|
||||
- gamerules_gameruledefinition.a(gamerules_gamerulevisitor, gamerules_gamerulekey);
|
||||
+ gamerules_gamerulevisitor.a((GameRules.GameRuleKey<T>) gamerules_gamerulekey, (GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition); // CraftBukkit - decompile error
|
||||
+ ((GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition).a(gamerules_gamerulevisitor, (GameRules.GameRuleKey<T>) gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
private static <T extends GameRules.GameRuleValue<T>> void callVisitorCap(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
|
||||
- gamerules_gamerulevisitor.visit(gamerules_gamerulekey, gamerules_gameruledefinition);
|
||||
- gamerules_gameruledefinition.callVisitor(gamerules_gamerulevisitor, gamerules_gamerulekey);
|
||||
+ gamerules_gamerulevisitor.visit((GameRules.GameRuleKey<T>) gamerules_gamerulekey, (GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition); // CraftBukkit - decompile error
|
||||
+ ((GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition).callVisitor(gamerules_gamerulevisitor, (GameRules.GameRuleKey<T>) gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public void a(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
|
||||
public void assignFrom(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
|
||||
@@ -245,7 +245,7 @@
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
public T createRule() {
|
||||
- return (GameRules.GameRuleValue) this.constructor.apply(this);
|
||||
+ return this.constructor.apply(this); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
public void callVisitor(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
@@ -275,7 +275,7 @@
|
||||
|
||||
}
|
||||
|
||||
- protected abstract void setValue(String s);
|
||||
+ public abstract void setValue(String s); // PAIL - private->public
|
||||
- protected abstract void deserialize(String s);
|
||||
+ public abstract void deserialize(String s); // PAIL - private->public
|
||||
|
||||
public abstract String getValue();
|
||||
public abstract String serialize();
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void setValue(String s) {
|
||||
+ public void setValue(String s) { // PAIL - protected->public
|
||||
- protected void deserialize(String s) {
|
||||
+ public void deserialize(String s) { // PAIL - protected->public
|
||||
this.value = Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void setValue(String s) {
|
||||
+ public void setValue(String s) { // PAIL - protected->public
|
||||
this.value = c(s);
|
||||
- protected void deserialize(String s) {
|
||||
+ public void deserialize(String s) { // PAIL - protected->public
|
||||
this.value = safeParse(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
--- a/net/minecraft/world/level/GeneratorAccess.java
|
||||
+++ b/net/minecraft/world/level/GeneratorAccess.java
|
||||
@@ -77,4 +77,6 @@
|
||||
default void a(@Nullable Entity entity, GameEvent gameevent, Entity entity1) {
|
||||
this.a(entity, gameevent, entity1.getChunkCoordinates());
|
||||
@@ -31,11 +31,11 @@
|
||||
|
||||
LevelTickAccess<Block> getBlockTicks();
|
||||
|
||||
- private default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) {
|
||||
+ default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) { // CraftBukkit - decompile error
|
||||
return new NextTickListEntry(t0, blockposition, this.getLevelData().getGameTime() + (long) i, ticklistpriority, this.nextSubTickCount());
|
||||
}
|
||||
|
||||
- private default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i) {
|
||||
+ default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i) { // CraftBukkit - decompile error
|
||||
return new NextTickListEntry(t0, blockposition, this.getLevelData().getGameTime() + (long) i, this.nextSubTickCount());
|
||||
}
|
||||
|
||||
@@ -102,4 +102,6 @@
|
||||
default void gameEvent(@Nullable Entity entity, GameEvent gameevent, Entity entity1) {
|
||||
this.gameEvent(entity, gameevent, entity1.blockPosition());
|
||||
}
|
||||
+
|
||||
+ net.minecraft.server.level.WorldServer getMinecraftWorld(); // CraftBukkit
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
--- a/net/minecraft/world/level/IBlockAccess.java
|
||||
+++ b/net/minecraft/world/level/IBlockAccess.java
|
||||
@@ -26,7 +26,7 @@
|
||||
default <T extends TileEntity> Optional<T> a(BlockPosition blockposition, TileEntityTypes<T> tileentitytypes) {
|
||||
TileEntity tileentity = this.getTileEntity(blockposition);
|
||||
default <T extends TileEntity> Optional<T> getBlockEntity(BlockPosition blockposition, TileEntityTypes<T> tileentitytypes) {
|
||||
TileEntity tileentity = this.getBlockEntity(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
|
||||
- return tileentity != null && tileentity.getType() == tileentitytypes ? Optional.of(tileentity) : Optional.empty();
|
||||
+ return tileentity != null && tileentity.getType() == tileentitytypes ? (Optional<T>) Optional.of(tileentity) : Optional.empty(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
IBlockData getType(BlockPosition blockposition);
|
||||
IBlockData getBlockState(BlockPosition blockposition);
|
||||
@@ -58,8 +58,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
- default MovingObjectPositionBlock rayTrace(RayTrace raytrace) {
|
||||
- return (MovingObjectPositionBlock) a(raytrace.b(), raytrace.a(), raytrace, (raytrace1, blockposition) -> {
|
||||
- default MovingObjectPositionBlock clip(RayTrace raytrace) {
|
||||
- return (MovingObjectPositionBlock) traverseBlocks(raytrace.getFrom(), raytrace.getTo(), 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();
|
||||
+ default MovingObjectPositionBlock clip(RayTrace raytrace1, BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.getBlockState(blockposition);
|
||||
Fluid fluid = this.getFluidState(blockposition);
|
||||
Vec3D vec3d = raytrace1.getFrom();
|
||||
@@ -72,6 +72,12 @@
|
||||
double d1 = movingobjectpositionblock1 == null ? Double.MAX_VALUE : raytrace1.b().distanceSquared(movingobjectpositionblock1.getPos());
|
||||
double d1 = movingobjectpositionblock1 == null ? Double.MAX_VALUE : raytrace1.getFrom().distanceToSqr(movingobjectpositionblock1.getLocation());
|
||||
|
||||
return d0 <= d1 ? movingobjectpositionblock : movingobjectpositionblock1;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ default MovingObjectPositionBlock rayTrace(RayTrace raytrace) {
|
||||
+ return (MovingObjectPositionBlock) a(raytrace.b(), raytrace.a(), raytrace, (raytrace1, blockposition) -> {
|
||||
+ return this.rayTraceBlock(raytrace1, blockposition); // CraftBukkit - moved into separate method
|
||||
+ default MovingObjectPositionBlock clip(RayTrace raytrace) {
|
||||
+ return (MovingObjectPositionBlock) traverseBlocks(raytrace.getFrom(), raytrace.getTo(), raytrace, (raytrace1, blockposition) -> {
|
||||
+ return this.clip(raytrace1, blockposition); // CraftBukkit - moved into separate method
|
||||
}, (raytrace1) -> {
|
||||
Vec3D vec3d = raytrace1.b().d(raytrace1.a());
|
||||
Vec3D vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
|
||||
|
||||
@@ -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));
|
||||
double d13 = d10 * (i1 > 0 ? 1.0D - MathHelper.frac(d4) : MathHelper.frac(d4));
|
||||
double d14 = d11 * (j1 > 0 ? 1.0D - MathHelper.frac(d5) : MathHelper.frac(d5));
|
||||
|
||||
- Object object;
|
||||
+ T object; // CraftBukkit - decompile error
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/world/level/IWorldWriter.java
|
||||
+++ b/net/minecraft/world/level/IWorldWriter.java
|
||||
@@ -28,4 +28,10 @@
|
||||
default boolean addEntity(Entity entity) {
|
||||
default boolean addFreshEntity(Entity entity) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ default boolean addEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ default boolean addFreshEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
+++ b/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
@@ -73,6 +73,7 @@
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
public void setMobName(EntityTypes<?> entitytypes) {
|
||||
this.nextSpawnData.getEntity().setString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
|
||||
+ this.spawnPotentials = MobSpawnerAbstract.EMPTY_POTENTIALS; // CraftBukkit - SPIGOT-3496, MC-92282
|
||||
public void setEntityId(EntityTypes<?> entitytypes) {
|
||||
this.nextSpawnData.getEntityToSpawn().putString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
|
||||
+ this.spawnPotentials = SimpleWeightedRandomList.empty(); // CraftBukkit - SPIGOT-3496, MC-92282
|
||||
}
|
||||
|
||||
private boolean c(World world, BlockPosition blockposition) {
|
||||
@@ -156,7 +157,7 @@
|
||||
private boolean isNearPlayer(World world, BlockPosition blockposition) {
|
||||
@@ -146,7 +147,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!worldserver.addAllEntitiesSafely(entity)) {
|
||||
+ if (!worldserver.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit
|
||||
this.d(worldserver, blockposition);
|
||||
- if (!worldserver.tryAddFreshEntityWithPassengers(entity)) {
|
||||
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit
|
||||
this.delay(worldserver, blockposition);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
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
|
||||
- this.collisionContext = VoxelShapeCollision.of(entity);
|
||||
+ this.collisionContext = (entity == null) ? VoxelShapeCollision.empty() : VoxelShapeCollision.of(entity); // CraftBukkit
|
||||
}
|
||||
|
||||
public Vec3D a() {
|
||||
public Vec3D getTo() {
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
private final Predicate<Fluid> canPick;
|
||||
|
||||
@@ -16,31 +16,31 @@
|
||||
if (entity instanceof EntityInsentient) {
|
||||
EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
|
||||
- if (entityinsentient.isPersistent() || entityinsentient.isSpecialPersistence()) {
|
||||
- if (entityinsentient.isPersistenceRequired() || entityinsentient.requiresCustomPersistence()) {
|
||||
+ // CraftBukkit - Split out persistent check, don't apply it to special persistent mobs
|
||||
+ if (entityinsentient.isTypeNotPersistent(0) && entityinsentient.isPersistent()) {
|
||||
+ if (entityinsentient.removeWhenFarAway(0) && entityinsentient.isPersistenceRequired()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -108,10 +114,54 @@
|
||||
@@ -111,10 +117,54 @@
|
||||
EnumCreatureType[] aenumcreaturetype = SpawnerCreature.SPAWNING_CATEGORIES;
|
||||
int i = aenumcreaturetype.length;
|
||||
|
||||
+ // CraftBukkit start - Other mob type spawn tick rate
|
||||
+ WorldData worlddata = worldserver.getWorldData();
|
||||
+ boolean spawnAnimalThisTick = worldserver.ticksPerAnimalSpawns != 0L && worlddata.getTime() % worldserver.ticksPerAnimalSpawns == 0L;
|
||||
+ boolean spawnMonsterThisTick = worldserver.ticksPerMonsterSpawns != 0L && worlddata.getTime() % worldserver.ticksPerMonsterSpawns == 0L;
|
||||
+ boolean spawnWaterThisTick = worldserver.ticksPerWaterSpawns != 0L && worlddata.getTime() % worldserver.ticksPerWaterSpawns == 0L;
|
||||
+ boolean spawnAmbientThisTick = worldserver.ticksPerAmbientSpawns != 0L && worlddata.getTime() % worldserver.ticksPerAmbientSpawns == 0L;
|
||||
+ boolean spawnWaterAmbientThisTick = worldserver.ticksPerWaterAmbientSpawns != 0L && worlddata.getTime() % worldserver.ticksPerWaterAmbientSpawns == 0L;
|
||||
+ boolean spawnWaterUndergroundCreatureThisTick = worldserver.ticksPerWaterUndergroundCreatureSpawns != 0L && worlddata.getTime() % worldserver.ticksPerWaterUndergroundCreatureSpawns == 0L;
|
||||
+ WorldData worlddata = worldserver.getLevelData();
|
||||
+ boolean spawnAnimalThisTick = worldserver.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % worldserver.ticksPerAnimalSpawns == 0L;
|
||||
+ boolean spawnMonsterThisTick = worldserver.ticksPerMonsterSpawns != 0L && worlddata.getGameTime() % worldserver.ticksPerMonsterSpawns == 0L;
|
||||
+ boolean spawnWaterThisTick = worldserver.ticksPerWaterSpawns != 0L && worlddata.getGameTime() % worldserver.ticksPerWaterSpawns == 0L;
|
||||
+ boolean spawnAmbientThisTick = worldserver.ticksPerAmbientSpawns != 0L && worlddata.getGameTime() % worldserver.ticksPerAmbientSpawns == 0L;
|
||||
+ boolean spawnWaterAmbientThisTick = worldserver.ticksPerWaterAmbientSpawns != 0L && worlddata.getGameTime() % worldserver.ticksPerWaterAmbientSpawns == 0L;
|
||||
+ boolean spawnWaterUndergroundCreatureThisTick = worldserver.ticksPerWaterUndergroundCreatureSpawns != 0L && worlddata.getGameTime() % worldserver.ticksPerWaterUndergroundCreatureSpawns == 0L;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
|
||||
+ // CraftBukkit start - Use per-world spawn limits
|
||||
+ boolean spawnThisTick = true;
|
||||
+ int limit = enumcreaturetype.b();
|
||||
+ int limit = enumcreaturetype.getMaxInstancesPerChunk();
|
||||
+ switch (enumcreaturetype) {
|
||||
+ case MONSTER:
|
||||
+ spawnThisTick = spawnMonsterThisTick;
|
||||
@@ -68,54 +68,54 @@
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- if ((flag || !enumcreaturetype.d()) && (flag1 || enumcreaturetype.d()) && (flag2 || !enumcreaturetype.e()) && spawnercreature_d.a(enumcreaturetype)) {
|
||||
- if ((flag || !enumcreaturetype.isFriendly()) && (flag1 || enumcreaturetype.isFriendly()) && (flag2 || !enumcreaturetype.isPersistent()) && spawnercreature_d.canSpawnForCategory(enumcreaturetype, chunk.getPos())) {
|
||||
+ if (!spawnThisTick || limit == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if ((flag || !enumcreaturetype.d()) && (flag1 || enumcreaturetype.d()) && (flag2 || !enumcreaturetype.e()) && spawnercreature_d.a(enumcreaturetype, limit)) {
|
||||
+ if ((flag || !enumcreaturetype.isFriendly()) && (flag1 || enumcreaturetype.isFriendly()) && (flag2 || !enumcreaturetype.isPersistent()) && spawnercreature_d.canSpawnForCategory(enumcreaturetype, chunk.getPos(), limit)) {
|
||||
+ // CraftBukkit end
|
||||
Objects.requireNonNull(spawnercreature_d);
|
||||
SpawnerCreature.c spawnercreature_c = spawnercreature_d::a;
|
||||
SpawnerCreature.c spawnercreature_c = spawnercreature_d::canSpawn;
|
||||
|
||||
@@ -196,10 +246,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);
|
||||
@@ -199,10 +249,14 @@
|
||||
entityinsentient.moveTo(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
if (isValidPositionForMob(worldserver, entityinsentient, d2)) {
|
||||
groupdataentity = entityinsentient.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
|
||||
- ++j;
|
||||
- ++k1;
|
||||
- worldserver.addAllEntities(entityinsentient);
|
||||
- worldserver.addFreshEntityWithPassengers(entityinsentient);
|
||||
- spawnercreature_a.run(entityinsentient, ichunkaccess);
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityinsentient, SpawnReason.NATURAL);
|
||||
+ if (!entityinsentient.isRemoved()) {
|
||||
+ ++j;
|
||||
+ ++k1;
|
||||
+ spawnercreature_a.run(entityinsentient, ichunkaccess);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (j >= entityinsentient.getMaxSpawnGroup()) {
|
||||
if (j >= entityinsentient.getMaxSpawnClusterSize()) {
|
||||
return;
|
||||
}
|
||||
@@ -370,7 +424,7 @@
|
||||
@@ -377,7 +431,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
|
||||
if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) {
|
||||
groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
|
||||
- worldaccess.addFreshEntityWithPassengers(entityinsentient);
|
||||
+ worldaccess.addFreshEntityWithPassengers(entityinsentient, SpawnReason.CHUNK_GEN); // CraftBukkit
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
@@ -486,8 +540,10 @@
|
||||
@@ -498,8 +552,10 @@
|
||||
return this.unmodifiableMobCategoryCounts;
|
||||
}
|
||||
|
||||
- boolean a(EnumCreatureType enumcreaturetype) {
|
||||
- int i = enumcreaturetype.b() * this.spawnableChunkCount / SpawnerCreature.MAGIC_NUMBER;
|
||||
- boolean canSpawnForCategory(EnumCreatureType enumcreaturetype, ChunkCoordIntPair chunkcoordintpair) {
|
||||
- int i = enumcreaturetype.getMaxInstancesPerChunk() * this.spawnableChunkCount / SpawnerCreature.MAGIC_NUMBER;
|
||||
+ // CraftBukkit start
|
||||
+ boolean a(EnumCreatureType enumcreaturetype, int limit) {
|
||||
+ boolean canSpawnForCategory(EnumCreatureType enumcreaturetype, ChunkCoordIntPair chunkcoordintpair, int limit) {
|
||||
+ int i = limit * this.spawnableChunkCount / SpawnerCreature.MAGIC_NUMBER;
|
||||
+ // CraftBukkit end
|
||||
|
||||
return this.mobCategoryCounts.getInt(enumcreaturetype) < i;
|
||||
return this.mobCategoryCounts.getInt(enumcreaturetype) >= i ? false : this.localMobCapCalculator.canSpawn(enumcreaturetype, chunkcoordintpair);
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.world.level;
|
||||
|
||||
import com.mojang.datafixers.DataFixUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
--- a/net/minecraft/world/level/TickListServer.java
|
||||
+++ b/net/minecraft/world/level/TickListServer.java
|
||||
@@ -47,11 +47,17 @@
|
||||
public void b() {
|
||||
int i = this.tickNextTickList.size();
|
||||
|
||||
- if (i != this.tickNextTickSet.size()) {
|
||||
+ if (false) { // CraftBukkit
|
||||
throw new IllegalStateException("TickNextTick list out of synch");
|
||||
} else {
|
||||
if (i > 65536) {
|
||||
- i = 65536;
|
||||
+ // CraftBukkit start - If the server has too much to process over time, try to alleviate that
|
||||
+ if (i > 20 * 65536) {
|
||||
+ i = i / 20;
|
||||
+ } else {
|
||||
+ i = 65536;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
Iterator<NextTickListEntry<T>> iterator = this.tickNextTickList.iterator();
|
||||
@@ -89,7 +95,7 @@
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
} else {
|
||||
- this.a(nextticklistentry.pos, nextticklistentry.b(), 0);
|
||||
+ this.a(nextticklistentry.pos, (T) nextticklistentry.b(), 0); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -103,7 +125,52 @@
|
||||
private final BiomeManager biomeManager;
|
||||
@@ -104,7 +126,52 @@
|
||||
private final ResourceKey<World> dimension;
|
||||
private long subTickCount;
|
||||
|
||||
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
|
||||
+ // CraftBukkit start Added the following
|
||||
@@ -76,98 +76,105 @@
|
||||
+ this.ticksPerWaterAmbientSpawns = this.getCraftServer().getTicksPerWaterAmbientSpawns(); // CraftBukkit
|
||||
+ this.ticksPerWaterUndergroundCreatureSpawns = this.getCraftServer().getTicksPerWaterUndergroundCreatureSpawns(); // CraftBukkit
|
||||
+ this.ticksPerAmbientSpawns = this.getCraftServer().getTicksPerAmbientSpawns(); // CraftBukkit
|
||||
+ this.typeKey = (ResourceKey) this.getCraftServer().getHandle().getServer().registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).c(dimensionmanager).orElseThrow(() -> {
|
||||
+ this.typeKey = (ResourceKey) this.getCraftServer().getHandle().getServer().registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getResourceKey(dimensionmanager).orElseThrow(() -> {
|
||||
+ return new IllegalStateException("Unregistered dimension type: " + dimensionmanager);
|
||||
+ });
|
||||
+ // CraftBukkit end
|
||||
this.profiler = supplier;
|
||||
this.levelData = worlddatamutable;
|
||||
this.dimensionType = dimensionmanager;
|
||||
@@ -113,12 +180,12 @@
|
||||
@@ -114,12 +181,12 @@
|
||||
this.worldBorder = new WorldBorder() {
|
||||
@Override
|
||||
public double getCenterX() {
|
||||
- return super.getCenterX() / dimensionmanager.getCoordinateScale();
|
||||
- return super.getCenterX() / dimensionmanager.coordinateScale();
|
||||
+ return super.getCenterX(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCenterZ() {
|
||||
- return super.getCenterZ() / dimensionmanager.getCoordinateScale();
|
||||
- return super.getCenterZ() / dimensionmanager.coordinateScale();
|
||||
+ return super.getCenterZ(); // CraftBukkit
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -128,6 +195,35 @@
|
||||
@@ -129,6 +196,42 @@
|
||||
this.thread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, i, dimensionmanager.getGenLayerZoomer());
|
||||
this.biomeManager = new BiomeManager(this, i);
|
||||
this.isDebug = flag1;
|
||||
+ // CraftBukkit start
|
||||
+ getWorldBorder().world = (WorldServer) this;
|
||||
+ // From PlayerList.setPlayerFileData
|
||||
+ getWorldBorder().a(new IWorldBorderListener() {
|
||||
+ public void a(WorldBorder worldborder, double d0) {
|
||||
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world);
|
||||
+ getWorldBorder().addListener(new IWorldBorderListener() {
|
||||
+ @Override
|
||||
+ public void onBorderSizeSet(WorldBorder worldborder, double d0) {
|
||||
+ getCraftServer().getHandle().broadcastAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void a(WorldBorder worldborder, double d0, double d1, long i) {
|
||||
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world);
|
||||
+ @Override
|
||||
+ public void onBorderSizeLerping(WorldBorder worldborder, double d0, double d1, long i) {
|
||||
+ getCraftServer().getHandle().broadcastAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void a(WorldBorder worldborder, double d0, double d1) {
|
||||
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world);
|
||||
+ @Override
|
||||
+ public void onBorderCenterSet(WorldBorder worldborder, double d0, double d1) {
|
||||
+ getCraftServer().getHandle().broadcastAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void a(WorldBorder worldborder, int i) {
|
||||
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world);
|
||||
+ @Override
|
||||
+ public void onBorderSetWarningTime(WorldBorder worldborder, int i) {
|
||||
+ getCraftServer().getHandle().broadcastAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void b(WorldBorder worldborder, int i) {
|
||||
+ getCraftServer().getHandle().sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world);
|
||||
+ @Override
|
||||
+ public void onBorderSetWarningBlocks(WorldBorder worldborder, int i) {
|
||||
+ getCraftServer().getHandle().broadcastAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world);
|
||||
+ }
|
||||
+
|
||||
+ public void b(WorldBorder worldborder, double d0) {}
|
||||
+ @Override
|
||||
+ public void onBorderSetDamagePerBlock(WorldBorder worldborder, double d0) {}
|
||||
+
|
||||
+ public void c(WorldBorder worldborder, double d0) {}
|
||||
+ @Override
|
||||
+ public void onBorderSetDamageSafeZOne(WorldBorder worldborder, double d0) {}
|
||||
+ });
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,6 +281,17 @@
|
||||
@@ -186,6 +289,17 @@
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
+ // CraftBukkit start - tree generation
|
||||
+ if (this.captureTreeGeneration) {
|
||||
+ CapturedBlockState blockstate = capturedBlockStates.get(blockposition);
|
||||
+ if (blockstate == null) {
|
||||
+ blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i);
|
||||
+ this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
|
||||
+ this.capturedBlockStates.put(blockposition.immutable(), blockstate);
|
||||
+ }
|
||||
+ blockstate.setData(iblockdata);
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.isOutsideWorld(blockposition)) {
|
||||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.isDebugWorld()) {
|
||||
@@ -192,9 +299,24 @@
|
||||
} else if (!this.isClientSide && this.isDebug()) {
|
||||
@@ -193,9 +307,24 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
Chunk chunk = this.getChunkAt(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
- IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0);
|
||||
- IBlockData iblockdata1 = chunk.setBlockState(blockposition, iblockdata, (i & 64) != 0);
|
||||
+
|
||||
+ // CraftBukkit start - capture blockstates
|
||||
+ boolean captured = false;
|
||||
+ if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) {
|
||||
+ CapturedBlockState blockstate = CapturedBlockState.getBlockState(this, blockposition, i);
|
||||
+ this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
|
||||
+ this.capturedBlockStates.put(blockposition.immutable(), blockstate);
|
||||
+ captured = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag
|
||||
+ IBlockData iblockdata1 = chunk.setBlockState(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag
|
||||
|
||||
if (iblockdata1 == null) {
|
||||
+ // CraftBukkit start - remove blockstate if failed (or the same)
|
||||
@@ -177,18 +184,18 @@
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
} else {
|
||||
IBlockData iblockdata2 = this.getType(blockposition);
|
||||
@@ -205,6 +327,7 @@
|
||||
this.getMethodProfiler().exit();
|
||||
IBlockData iblockdata2 = this.getBlockState(blockposition);
|
||||
@@ -206,6 +335,7 @@
|
||||
this.getProfiler().pop();
|
||||
}
|
||||
|
||||
+ /*
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.b(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -231,12 +354,69 @@
|
||||
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -232,12 +362,69 @@
|
||||
|
||||
this.a(blockposition, iblockdata1, iblockdata2);
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
+ */
|
||||
+
|
||||
@@ -211,17 +218,17 @@
|
||||
+ IBlockData iblockdata2 = actualBlock;
|
||||
+ if (iblockdata2 == iblockdata) {
|
||||
+ if (iblockdata1 != iblockdata2) {
|
||||
+ this.b(blockposition, iblockdata1, iblockdata2);
|
||||
+ this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
||||
+ }
|
||||
+
|
||||
+ if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getState() != null && chunk.getState().isAtLeast(PlayerChunk.State.TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
|
||||
+ this.notify(blockposition, iblockdata1, iblockdata, i);
|
||||
+ if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(PlayerChunk.State.TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
|
||||
+ this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
|
||||
+ }
|
||||
+
|
||||
+ if ((i & 1) != 0) {
|
||||
+ this.update(blockposition, iblockdata1.getBlock());
|
||||
+ if (!this.isClientSide && iblockdata.isComplexRedstone()) {
|
||||
+ this.updateAdjacentComparators(blockposition, newBlock.getBlock());
|
||||
+ this.blockUpdated(blockposition, iblockdata1.getBlock());
|
||||
+ if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) {
|
||||
+ this.updateNeighbourForOutputSignal(blockposition, newBlock.getBlock());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -229,7 +236,7 @@
|
||||
+ int k = i & -34;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ iblockdata1.b(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
|
||||
+ iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
|
||||
+ CraftWorld world = ((WorldServer) this).getWorld();
|
||||
+ if (world != null) {
|
||||
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
|
||||
@@ -240,24 +247,24 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ iblockdata.a((GeneratorAccess) this, blockposition, k, j - 1);
|
||||
+ iblockdata.b(this, blockposition, k, j - 1);
|
||||
+ iblockdata.updateNeighbourShapes(this, blockposition, k, j - 1);
|
||||
+ iblockdata.updateIndirectNeighbourShapes(this, blockposition, k, j - 1);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - SPIGOT-5710
|
||||
+ if (!preventPoiUpdated) {
|
||||
+ this.a(blockposition, iblockdata1, iblockdata2);
|
||||
+ this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -326,6 +506,17 @@
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
@@ -327,6 +514,17 @@
|
||||
IBlockData iblockdata = this.getBlockState(blockposition);
|
||||
|
||||
try {
|
||||
+ // CraftBukkit start
|
||||
@@ -271,13 +278,13 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
iblockdata.doPhysics(this, blockposition, block, blockposition1, false);
|
||||
iblockdata.neighborChanged(this, blockposition, block, blockposition1, false);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
|
||||
@@ -368,6 +559,14 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception while updating neighbours");
|
||||
@@ -369,6 +567,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
public IBlockData getBlockState(BlockPosition blockposition) {
|
||||
+ // CraftBukkit start - tree generation
|
||||
+ if (captureTreeGeneration) {
|
||||
+ CapturedBlockState previous = capturedBlockStates.get(blockposition);
|
||||
@@ -286,53 +293,52 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.isOutsideWorld(blockposition)) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
} else {
|
||||
@@ -484,7 +683,17 @@
|
||||
|
||||
@@ -494,6 +700,16 @@
|
||||
@Nullable
|
||||
@Override
|
||||
+ // CraftBukkit start
|
||||
public TileEntity getTileEntity(BlockPosition blockposition) {
|
||||
+ return getTileEntity(blockposition, true);
|
||||
public TileEntity getBlockEntity(BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ return getBlockEntity(blockposition, true);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public TileEntity getTileEntity(BlockPosition blockposition, boolean validate) {
|
||||
+ public TileEntity getBlockEntity(BlockPosition blockposition, boolean validate) {
|
||||
+ if (capturedTileEntities.containsKey(blockposition)) {
|
||||
+ return capturedTileEntities.get(blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return this.isOutsideWorld(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAtWorldCoords(blockposition).a(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
|
||||
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
|
||||
}
|
||||
|
||||
@@ -492,6 +701,12 @@
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
@@ -501,6 +717,12 @@
|
||||
BlockPosition blockposition = tileentity.getBlockPos();
|
||||
|
||||
if (!this.isOutsideWorld(blockposition)) {
|
||||
if (!this.isOutsideBuildHeight(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (captureBlockStates) {
|
||||
+ capturedTileEntities.put(blockposition.immutableCopy(), tileentity);
|
||||
+ capturedTileEntities.put(blockposition.immutable(), tileentity);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.getChunkAtWorldCoords(blockposition).b(tileentity);
|
||||
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
|
||||
}
|
||||
}
|
||||
@@ -595,7 +810,7 @@
|
||||
@@ -605,7 +827,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
|
||||
- T t0 = (Entity) entitytypetest.a((Object) entitycomplexpart);
|
||||
+ T t0 = entitytypetest.a(entitycomplexpart);
|
||||
- T t0 = (Entity) entitytypetest.tryCast(entitycomplexpart);
|
||||
+ T t0 = entitytypetest.tryCast(entitycomplexpart); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 != null && predicate.test(t0)) {
|
||||
list.add(t0);
|
||||
@@ -921,6 +1136,14 @@
|
||||
@@ -931,6 +1153,14 @@
|
||||
public abstract LevelEntityGetter<Entity> getEntities();
|
||||
|
||||
protected void a(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {
|
||||
protected void postGameEventInRadius(@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);
|
||||
+ getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -341,6 +347,6 @@
|
||||
+ }
|
||||
+ 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);
|
||||
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
|
||||
int k = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);
|
||||
int l = SectionPosition.blockToSectionCoord(blockposition.getX() + i);
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@@ -8,6 +8,17 @@
|
||||
WorldServer getLevel();
|
||||
|
||||
default void addAllEntities(Entity entity) {
|
||||
- entity.recursiveStream().forEach(this::addEntity);
|
||||
default void addFreshEntityWithPassengers(Entity entity) {
|
||||
- entity.getSelfAndPassengers().forEach(this::addFreshEntity);
|
||||
+ // CraftBukkit start
|
||||
+ this.addAllEntities(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ this.addFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
}
|
||||
+
|
||||
+ default void addAllEntities(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ entity.recursiveStream().forEach((e) -> this.addEntity(e, reason));
|
||||
+ default void addFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ entity.getSelfAndPassengers().forEach((e) -> this.addFreshEntity(e, reason));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
|
||||
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
|
||||
@@ -39,6 +39,11 @@
|
||||
@@ -38,6 +38,11 @@
|
||||
@Override
|
||||
public void a(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
if (!world.isClientSide && iprojectile.isBurning() && this.c(iblockdata)) {
|
||||
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
if (!world.isClientSide && iprojectile.isOnFire() && this.canBeLit(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, movingobjectpositionblock.getBlockPosition(), iprojectile).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, movingobjectpositionblock.getBlockPos(), iprojectile).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
a(world, iblockdata, movingobjectpositionblock.getBlockPosition(), true);
|
||||
setLit(world, iblockdata, movingobjectpositionblock.getBlockPos(), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
@@ -43,6 +50,29 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
public void performBonemeal(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);
|
||||
AzaleaBlock.TREE_GROWER.growTree(worldserver, worldserver.getChunkSource().getGenerator(), blockposition, iblockdata, random);
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = false;
|
||||
+ if (worldserver.capturedBlockStates.size() > 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
+++ b/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
@@ -40,12 +40,17 @@
|
||||
@@ -42,6 +42,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -12,27 +12,20 @@
|
||||
public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged {
|
||||
|
||||
private static final BlockStateBoolean WATERLOGGED = BlockProperties.WATERLOGGED;
|
||||
private static final BlockStateEnum<Tilt> TILT = BlockProperties.TILT;
|
||||
private static final int NO_TICK = -1;
|
||||
- private static final Object2IntMap<Tilt> DELAY_UNTIL_NEXT_TILT_STATE = (Object2IntMap) SystemUtils.a((Object) (new Object2IntArrayMap()), (object2intarraymap) -> {
|
||||
+ private static final Object2IntMap<Tilt> DELAY_UNTIL_NEXT_TILT_STATE = (Object2IntMap) SystemUtils.a((new Object2IntArrayMap()), (object2intarraymap) -> { // CraftBukkit - decompile error
|
||||
object2intarraymap.defaultReturnValue(-1);
|
||||
object2intarraymap.put(Tilt.UNSTABLE, 10);
|
||||
object2intarraymap.put(Tilt.PARTIAL, 10);
|
||||
@@ -108,7 +113,7 @@
|
||||
@@ -110,7 +115,7 @@
|
||||
|
||||
@Override
|
||||
public void a(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
- this.a(iblockdata, world, movingobjectpositionblock.getBlockPosition(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.a(iblockdata, world, movingobjectpositionblock.getBlockPosition(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, iprojectile); // CraftBukkit
|
||||
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
- this.setTiltAndScheduleTick(iblockdata, world, movingobjectpositionblock.getBlockPos(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.setTiltAndScheduleTick(iblockdata, world, movingobjectpositionblock.getBlockPos(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, iprojectile); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,7 +172,20 @@
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
@@ -169,7 +174,20 @@
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!world.isClientSide) {
|
||||
if (iblockdata.get(BigDripleafBlock.TILT) == Tilt.NONE && a(blockposition, entity) && !world.isBlockIndirectlyPowered(blockposition)) {
|
||||
- this.a(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null);
|
||||
if (iblockdata.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(blockposition, entity) && !world.hasNeighborSignal(blockposition)) {
|
||||
- this.setTiltAndScheduleTick(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null);
|
||||
+ // CraftBukkit start - tilt dripleaf
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
@@ -45,60 +38,60 @@
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.setTiltAndScheduleTick(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null, entity);
|
||||
+ // CraftBukkit end
|
||||
+ this.a(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -181,9 +199,9 @@
|
||||
Tilt tilt = (Tilt) iblockdata.get(BigDripleafBlock.TILT);
|
||||
@@ -183,9 +201,9 @@
|
||||
Tilt tilt = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
|
||||
|
||||
if (tilt == Tilt.UNSTABLE) {
|
||||
- this.a(iblockdata, (World) worldserver, blockposition, Tilt.PARTIAL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.a(iblockdata, (World) worldserver, blockposition, Tilt.PARTIAL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit
|
||||
- this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.PARTIAL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.PARTIAL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit
|
||||
} else if (tilt == Tilt.PARTIAL) {
|
||||
- this.a(iblockdata, (World) worldserver, blockposition, Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.a(iblockdata, (World) worldserver, blockposition, Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit
|
||||
- this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.setTiltAndScheduleTick(iblockdata, worldserver, blockposition, Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, null); // CraftBukkit
|
||||
} else if (tilt == Tilt.FULL) {
|
||||
d(iblockdata, worldserver, blockposition);
|
||||
resetTilt(iblockdata, worldserver, blockposition);
|
||||
}
|
||||
@@ -209,8 +227,10 @@
|
||||
return entity.isOnGround() && entity.getPositionVector().y > (double) ((float) blockposition.getY() + 0.6875F);
|
||||
@@ -211,8 +229,10 @@
|
||||
return entity.isOnGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
|
||||
}
|
||||
|
||||
- private void a(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect) {
|
||||
- a(iblockdata, world, blockposition, tilt);
|
||||
- private void setTiltAndScheduleTick(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect) {
|
||||
- setTilt(iblockdata, world, blockposition, tilt);
|
||||
+ // CraftBukkit start
|
||||
+ private void a(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect, @Nullable Entity entity) {
|
||||
+ if (!a(iblockdata, world, blockposition, tilt, entity)) return;
|
||||
+ private void setTiltAndScheduleTick(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect, @Nullable Entity entity) {
|
||||
+ if (!setTilt(iblockdata, world, blockposition, tilt, entity)) return;
|
||||
+ // CraftBukkit end
|
||||
if (soundeffect != null) {
|
||||
a(world, blockposition, soundeffect);
|
||||
playTiltSound(world, blockposition, soundeffect);
|
||||
}
|
||||
@@ -224,19 +244,27 @@
|
||||
@@ -226,19 +246,27 @@
|
||||
}
|
||||
|
||||
private static void d(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- a(iblockdata, world, blockposition, Tilt.NONE);
|
||||
+ a(iblockdata, world, blockposition, Tilt.NONE, null); // CraftBukkit
|
||||
if (iblockdata.get(BigDripleafBlock.TILT) != Tilt.NONE) {
|
||||
a(world, blockposition, SoundEffects.BIG_DRIPLEAF_TILT_UP);
|
||||
private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- setTilt(iblockdata, world, blockposition, Tilt.NONE);
|
||||
+ setTilt(iblockdata, world, blockposition, Tilt.NONE, null); // CraftBukkit
|
||||
if (iblockdata.getValue(BigDripleafBlock.TILT) != Tilt.NONE) {
|
||||
playTiltSound(world, blockposition, SoundEffects.BIG_DRIPLEAF_TILT_UP);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- private static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt) {
|
||||
- private static void setTilt(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt) {
|
||||
+ // CraftBukkit start
|
||||
+ private static boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable Entity entity) {
|
||||
+ private static boolean setTilt(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable Entity entity) {
|
||||
+ if (entity != null) {
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.set(BigDripleafBlock.TILT, tilt)).isCancelled()) {
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.setValue(BigDripleafBlock.TILT, tilt)).isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BigDripleafBlock.TILT, tilt), 2);
|
||||
if (tilt.a()) {
|
||||
world.a(GameEvent.BLOCK_CHANGE, blockposition);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2);
|
||||
if (tilt.causesVibration()) {
|
||||
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition);
|
||||
}
|
||||
|
||||
+ return true; // CraftBukkit
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -354,7 +354,13 @@
|
||||
@@ -352,7 +352,13 @@
|
||||
EntityItem entityitem = (EntityItem) supplier.get();
|
||||
|
||||
entityitem.defaultPickupDelay();
|
||||
- world.addEntity(entityitem);
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
- world.addFreshEntity(entityitem);
|
||||
+ // CraftBukkit start
|
||||
+ if (world.captureDrops != null) {
|
||||
+ world.captureDrops.add(entityitem);
|
||||
+ } else {
|
||||
+ world.addEntity(entityitem);
|
||||
+ world.addFreshEntity(entityitem);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +386,7 @@
|
||||
@@ -378,7 +384,7 @@
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
|
||||
entityhuman.b(StatisticList.BLOCK_MINED.b(this));
|
||||
- entityhuman.applyExhaustion(0.005F);
|
||||
+ entityhuman.applyExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent
|
||||
dropItems(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
|
||||
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
|
||||
- entityhuman.causeFoodExhaustion(0.005F);
|
||||
+ entityhuman.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent
|
||||
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
}
|
||||
|
||||
@@ -514,6 +520,12 @@
|
||||
return (ImmutableMap) this.stateDefinition.a().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), function));
|
||||
@@ -512,6 +518,12 @@
|
||||
return (ImmutableMap) this.stateDefinition.getPossibleStates().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), function));
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBamboo.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBamboo.java
|
||||
@@ -187,7 +187,7 @@
|
||||
BlockPosition blockposition1 = blockposition.up(i);
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1);
|
||||
@@ -186,7 +186,7 @@
|
||||
BlockPosition blockposition1 = blockposition.above(i);
|
||||
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
|
||||
|
||||
- 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
|
||||
- if (k >= 16 || (Integer) iblockdata1.getValue(BlockBamboo.STAGE) == 1 || !worldserver.isEmptyBlock(blockposition1.above())) {
|
||||
+ if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BlockBamboo.STAGE) == 1 || !worldserver.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,14 +208,18 @@
|
||||
BlockPosition blockposition1 = blockposition.down(2);
|
||||
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||
@@ -207,14 +207,18 @@
|
||||
BlockPosition blockposition1 = blockposition.below(2);
|
||||
IBlockData iblockdata2 = world.getBlockState(blockposition1);
|
||||
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
|
||||
+ boolean shouldUpdateOthers = false; // CraftBukkit
|
||||
|
||||
if (i >= 1) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.is(Blocks.BAMBOO) && iblockdata1.getValue(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.is(Blocks.BAMBOO) && iblockdata1.getValue(BlockBamboo.LEAVES) != BlockPropertyBambooSize.NONE) {
|
||||
blockpropertybamboosize = BlockPropertyBambooSize.LARGE;
|
||||
if (iblockdata2.a(Blocks.BAMBOO)) {
|
||||
- world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
- world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
if (iblockdata2.is(Blocks.BAMBOO)) {
|
||||
- world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
- world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(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);
|
||||
+ // world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ // world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
+ shouldUpdateOthers = true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -226,7 +230,14 @@
|
||||
int j = (Integer) iblockdata.get(BlockBamboo.AGE) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1;
|
||||
@@ -225,7 +229,14 @@
|
||||
int j = (Integer) iblockdata.getValue(BlockBamboo.AGE) != 1 && !iblockdata2.is(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.AGE, j)).set(BlockBamboo.LEAVES, blockpropertybamboosize)).set(BlockBamboo.STAGE, k), 3);
|
||||
- world.setBlock(blockposition.above(), (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(BlockBamboo.AGE, j)).setValue(BlockBamboo.LEAVES, blockpropertybamboosize)).setValue(BlockBamboo.STAGE, k), 3);
|
||||
+ // CraftBukkit start
|
||||
+ 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 (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.above(), (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(BlockBamboo.AGE, j)).setValue(BlockBamboo.LEAVES, blockpropertybamboosize)).setValue(BlockBamboo.STAGE, k), 3)) {
|
||||
+ if (shouldUpdateOthers) {
|
||||
+ world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
+ world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected int a(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
protected int getHeightAboveUpToMax(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@@ -94,6 +94,6 @@
|
||||
}
|
||||
|
||||
protected void a(World world, BlockPosition blockposition) {
|
||||
- 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
|
||||
protected void growBamboo(World world, BlockPosition blockposition) {
|
||||
- world.setBlock(blockposition.above(), (IBlockData) Blocks.BAMBOO.defaultBlockState().setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.above(), (IBlockData) Blocks.BAMBOO.defaultBlockState().setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3); // CraftBukkit - BlockSpreadEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBed.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBed.java
|
||||
@@ -88,7 +88,8 @@
|
||||
@@ -87,7 +87,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!a(world)) {
|
||||
- if (!canSetSpawn(world)) {
|
||||
+ // CraftBukkit - moved world and biome check into EntityHuman
|
||||
+ if (false && !a(world)) {
|
||||
world.a(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
||||
+ if (false && !canSetSpawn(world)) {
|
||||
world.removeBlock(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
||||
|
||||
@@ -105,7 +106,16 @@
|
||||
@@ -104,7 +105,16 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
@@ -18,16 +18,16 @@
|
||||
+ IBlockData finaliblockdata = iblockdata;
|
||||
+ BlockPosition finalblockposition = blockposition;
|
||||
+ // CraftBukkit end
|
||||
entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> {
|
||||
entityhuman.startSleepInBed(blockposition).ifLeft((entityhuman_enumbedresult) -> {
|
||||
+ // CraftBukkit start - handling bed explosion from below here
|
||||
+ if (!world.getDimensionManager().isBedWorks()) {
|
||||
+ if (!world.dimensionType().bedWorks()) {
|
||||
+ this.explodeBed(finaliblockdata, world, finalblockposition);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entityhuman_enumbedresult != null) {
|
||||
entityhuman.a(entityhuman_enumbedresult.a(), true);
|
||||
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
||||
}
|
||||
@@ -116,8 +126,27 @@
|
||||
@@ -115,8 +125,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,24 +35,24 @@
|
||||
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ {
|
||||
+ {
|
||||
+ world.a(blockposition, false);
|
||||
+ BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
||||
+ world.removeBlock(blockposition, false);
|
||||
+ BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
||||
+
|
||||
+ if (world.getType(blockposition1).getBlock() == this) {
|
||||
+ world.a(blockposition1, false);
|
||||
+ if (world.getBlockState(blockposition1).getBlock() == this) {
|
||||
+ world.removeBlock(blockposition1, false);
|
||||
+ }
|
||||
+
|
||||
+ world.createExplosion((Entity) null, DamageSource.a(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
|
||||
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static boolean a(World world) {
|
||||
- return world.getDimensionManager().isBedWorks();
|
||||
public static boolean canSetSpawn(World world) {
|
||||
- return world.dimensionType().bedWorks();
|
||||
+ // CraftBukkit - moved world and biome check into EntityHuman
|
||||
+ return true || world.getDimensionManager().isBedWorks();
|
||||
+ return true || world.dimensionType().bedWorks();
|
||||
}
|
||||
|
||||
private boolean a(World world, BlockPosition blockposition) {
|
||||
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -108,7 +108,7 @@
|
||||
EntityBee entitybee = (EntityBee) iterator.next();
|
||||
|
||||
if (entitybee.getGoalTarget() == null) {
|
||||
- entitybee.setGoalTarget((EntityLiving) list1.get(world.random.nextInt(i)));
|
||||
+ entitybee.setGoalTarget((EntityLiving) list1.get(world.random.nextInt(i)), org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit
|
||||
if (entitybee.getTarget() == null) {
|
||||
- entitybee.setTarget((EntityLiving) list1.get(world.random.nextInt(i)));
|
||||
+ entitybee.setTarget((EntityLiving) list1.get(world.random.nextInt(i)), org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -97,6 +102,19 @@
|
||||
if ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)) {
|
||||
if ((Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED)) {
|
||||
return EnumInteractionResult.CONSUME;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ boolean powered = ((Boolean) iblockdata.get(POWERED));
|
||||
+ boolean powered = ((Boolean) iblockdata.getValue(POWERED));
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int old = (powered) ? 15 : 0;
|
||||
+ int current = (!powered) ? 15 : 0;
|
||||
@@ -29,12 +29,12 @@
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.d(iblockdata, world, blockposition);
|
||||
this.a(entityhuman, world, blockposition, true);
|
||||
world.a((Entity) entityhuman, GameEvent.BLOCK_PRESS, blockposition);
|
||||
this.press(iblockdata, world, blockposition);
|
||||
this.playSound(entityhuman, world, blockposition, true);
|
||||
world.gameEvent(entityhuman, GameEvent.BLOCK_PRESS, blockposition);
|
||||
@@ -148,6 +166,16 @@
|
||||
if (this.sensitive) {
|
||||
this.e(iblockdata, worldserver, blockposition);
|
||||
this.checkPressed(iblockdata, worldserver, blockposition);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -46,12 +46,12 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3);
|
||||
this.f(iblockdata, (World) worldserver, blockposition);
|
||||
this.a((EntityHuman) null, worldserver, blockposition, false);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockButtonAbstract.POWERED, false), 3);
|
||||
this.updateNeighbours(iblockdata, worldserver, blockposition);
|
||||
this.playSound((EntityHuman) null, worldserver, blockposition, false);
|
||||
@@ -169,11 +197,48 @@
|
||||
boolean flag = !list.isEmpty();
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockButtonAbstract.POWERED);
|
||||
boolean flag1 = (Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED);
|
||||
|
||||
+ // CraftBukkit start - Call interact event when arrows turn on wooden buttons
|
||||
+ if (flag1 != flag && flag) {
|
||||
@@ -91,11 +91,11 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
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
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockButtonAbstract.POWERED, flag), 3);
|
||||
this.updateNeighbours(iblockdata, world, blockposition);
|
||||
this.playSound((EntityHuman) null, world, blockposition, flag);
|
||||
- world.gameEvent((Entity) list.stream().findFirst().orElse((Object) null), flag ? GameEvent.BLOCK_PRESS : GameEvent.BLOCK_UNPRESS, blockposition);
|
||||
+ world.gameEvent((Entity) list.stream().findFirst().orElse(null), flag ? GameEvent.BLOCK_PRESS : GameEvent.BLOCK_UNPRESS, blockposition); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.AGE_15;
|
||||
@@ -59,7 +61,7 @@
|
||||
int j = (Integer) iblockdata.get(BlockCactus.AGE);
|
||||
int j = (Integer) iblockdata.getValue(BlockCactus.AGE);
|
||||
|
||||
if (j == 15) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.getBlockData());
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.getBlockData()); // CraftBukkit
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockCactus.AGE, 0);
|
||||
- worldserver.setBlockAndUpdate(blockposition1, this.defaultBlockState());
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.defaultBlockState()); // CraftBukkit
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockCactus.AGE, 0);
|
||||
|
||||
worldserver.setTypeAndData(blockposition, iblockdata1, 4);
|
||||
worldserver.setBlock(blockposition, iblockdata1, 4);
|
||||
@@ -116,7 +118,9 @@
|
||||
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
+ CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
||||
entity.damageEntity(DamageSource.CACTUS, 1.0F);
|
||||
entity.hurt(DamageSource.CACTUS, 1.0F);
|
||||
+ CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCake.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCake.java
|
||||
@@ -86,7 +86,18 @@
|
||||
@@ -85,7 +85,18 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
entityhuman.a(StatisticList.EAT_CAKE_SLICE);
|
||||
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);
|
||||
- entityhuman.getFoodData().eat(2, 0.1F);
|
||||
+ // CraftBukkit start
|
||||
+ // entityhuman.getFoodData().eat(2, 0.1F);
|
||||
@@ -17,6 +17,6 @@
|
||||
+
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate();
|
||||
+ // CraftBukkit end
|
||||
int i = (Integer) iblockdata.get(BlockCake.BITES);
|
||||
int i = (Integer) iblockdata.getValue(BlockCake.BITES);
|
||||
|
||||
generatoraccess.a((Entity) entityhuman, GameEvent.EAT, blockposition);
|
||||
generatoraccess.gameEvent(entityhuman, GameEvent.EAT, blockposition);
|
||||
|
||||
@@ -10,26 +10,26 @@
|
||||
+
|
||||
public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged {
|
||||
|
||||
protected static final VoxelShape SHAPE = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
|
||||
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
|
||||
@@ -92,7 +96,9 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!entity.isFireProof() && (Boolean) iblockdata.get(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.i((EntityLiving) entity)) {
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!entity.fireImmune() && (Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||
entity.damageEntity(DamageSource.IN_FIRE, (float) this.fireDamage);
|
||||
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
super.a(iblockdata, world, blockposition, entity);
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
@@ -202,6 +208,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.isBurning() && iprojectile.a(world, blockposition) && !(Boolean) iblockdata.get(BlockCampfire.LIT) && !(Boolean) iblockdata.get(BlockCampfire.WATERLOGGED)) {
|
||||
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(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);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true), 11);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
private static final float RAIN_FILL_CHANCE = 0.05F;
|
||||
@@ -51,11 +55,11 @@
|
||||
@Override
|
||||
protected void a(IBlockData iblockdata, World world, BlockPosition blockposition, FluidType fluidtype) {
|
||||
protected void receiveStalactiteDrip(IBlockData iblockdata, World world, BlockPosition blockposition, FluidType fluidtype) {
|
||||
if (fluidtype == FluidTypes.WATER) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.WATER_CAULDRON.getBlockData());
|
||||
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.getBlockData(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
world.triggerEffect(1047, blockposition, 0);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
- world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState());
|
||||
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
world.levelEvent(1047, blockposition, 0);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
} else if (fluidtype == FluidTypes.LAVA) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.LAVA_CAULDRON.getBlockData());
|
||||
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.LAVA_CAULDRON.getBlockData(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
world.triggerEffect(1046, blockposition, 0);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
- world.setBlockAndUpdate(blockposition, Blocks.LAVA_CAULDRON.defaultBlockState());
|
||||
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.LAVA_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
world.levelEvent(1046, blockposition, 0);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/level/block/BlockChest.java
|
||||
+++ b/net/minecraft/world/level/block/BlockChest.java
|
||||
@@ -88,24 +88,7 @@
|
||||
public Optional<ITileInventory> a(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
||||
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
||||
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
|
||||
|
||||
- return Optional.of(new ITileInventory() {
|
||||
- @Nullable
|
||||
- @Override
|
||||
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
- if (tileentitychest.d(entityhuman) && tileentitychest1.d(entityhuman)) {
|
||||
- tileentitychest.e(playerinventory.player);
|
||||
- tileentitychest1.e(playerinventory.player);
|
||||
- return ContainerChest.b(i, playerinventory, (IInventory) inventorylargechest);
|
||||
- if (tileentitychest.canOpen(entityhuman) && tileentitychest1.canOpen(entityhuman)) {
|
||||
- tileentitychest.unpackLootTable(playerinventory.player);
|
||||
- tileentitychest1.unpackLootTable(playerinventory.player);
|
||||
- return ContainerChest.sixRows(i, playerinventory, inventorylargechest);
|
||||
- } else {
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public IChatBaseComponent getScoreboardDisplayName() {
|
||||
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble")));
|
||||
- public IChatBaseComponent getDisplayName() {
|
||||
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : new ChatMessage("container.chestDouble")));
|
||||
- }
|
||||
- });
|
||||
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
|
||||
}
|
||||
|
||||
public Optional<ITileInventory> a(TileEntityChest tileentitychest) {
|
||||
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
|
||||
@@ -118,6 +101,38 @@
|
||||
}
|
||||
};
|
||||
@@ -46,29 +46,29 @@
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
+ if (tileentitychest.d(entityhuman) && tileentitychest1.d(entityhuman)) {
|
||||
+ tileentitychest.e(playerinventory.player);
|
||||
+ tileentitychest1.e(playerinventory.player);
|
||||
+ return ContainerChest.b(i, playerinventory, (IInventory) inventorylargechest);
|
||||
+ if (tileentitychest.canOpen(entityhuman) && tileentitychest1.canOpen(entityhuman)) {
|
||||
+ tileentitychest.unpackLootTable(playerinventory.player);
|
||||
+ tileentitychest1.unpackLootTable(playerinventory.player);
|
||||
+ return ContainerChest.sixRows(i, playerinventory, inventorylargechest);
|
||||
+ } else {
|
||||
+ return null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IChatBaseComponent getScoreboardDisplayName() {
|
||||
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble")));
|
||||
+ public IChatBaseComponent getDisplayName() {
|
||||
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : new ChatMessage("container.chestDouble")));
|
||||
+ }
|
||||
+ };
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected BlockChest(BlockBase.Info blockbase_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
|
||||
super(blockbase_info, supplier);
|
||||
this.k((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).set(BlockChest.WATERLOGGED, false));
|
||||
this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(BlockChest.FACING, EnumDirection.NORTH)).setValue(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).setValue(BlockChest.WATERLOGGED, false));
|
||||
@@ -276,7 +291,7 @@
|
||||
|
||||
@Override
|
||||
public DoubleBlockFinder.Result<? extends TileEntityChest> a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
||||
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
||||
- BiPredicate bipredicate;
|
||||
+ BiPredicate<GeneratorAccess, BlockPosition> bipredicate; // CraftBukkit - decompile error
|
||||
|
||||
@@ -77,16 +77,16 @@
|
||||
@@ -292,7 +307,14 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public ITileInventory getInventory(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- return (ITileInventory) ((Optional) this.a(iblockdata, world, blockposition, false).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
||||
public ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, false).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
||||
+ // CraftBukkit start
|
||||
+ return getInventory(iblockdata, world, blockposition, false);
|
||||
+ return getMenuProvider(iblockdata, world, blockposition, false);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public ITileInventory getInventory(IBlockData iblockdata, World world, BlockPosition blockposition, boolean ignoreObstructions) {
|
||||
+ return (ITileInventory) ((Optional) this.a(iblockdata, world, blockposition, ignoreObstructions).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
||||
+ public ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition, boolean ignoreObstructions) {
|
||||
+ return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, ignoreObstructions).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static DoubleBlockFinder.Combiner<TileEntityChest, Float2FloatFunction> a(final LidBlockEntity lidblockentity) {
|
||||
public static DoubleBlockFinder.Combiner<TileEntityChest, Float2FloatFunction> opennessCombiner(final LidBlockEntity lidblockentity) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockChorusFlower.java
|
||||
+++ b/net/minecraft/world/level/block/BlockChorusFlower.java
|
||||
@@ -20,6 +20,8 @@
|
||||
@@ -18,6 +18,8 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateInteger;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
|
||||
@@ -9,30 +9,30 @@
|
||||
public class BlockChorusFlower extends Block {
|
||||
|
||||
public static final int DEAD_AGE = 5;
|
||||
@@ -84,8 +86,12 @@
|
||||
@@ -82,8 +84,12 @@
|
||||
}
|
||||
|
||||
if (flag && b((IWorldReader) worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmpty(blockposition.up(2))) {
|
||||
- worldserver.setTypeAndData(blockposition, this.plant.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
- this.a(worldserver, blockposition1, i);
|
||||
if (flag && allNeighborsEmpty(worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmptyBlock(blockposition.above(2))) {
|
||||
- worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
|
||||
- this.placeGrownFlower(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.plant.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
+ this.a(worldserver, blockposition1, i);
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.defaultBlockState().setValue(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
|
||||
+ worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
|
||||
+ this.placeGrownFlower(worldserver, blockposition1, i);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i < 4) {
|
||||
j = random.nextInt(4);
|
||||
if (flag1) {
|
||||
@@ -99,18 +105,30 @@
|
||||
BlockPosition blockposition2 = blockposition.shift(enumdirection);
|
||||
@@ -97,18 +103,30 @@
|
||||
BlockPosition blockposition2 = blockposition.relative(enumdirection);
|
||||
|
||||
if (worldserver.isEmpty(blockposition2) && worldserver.isEmpty(blockposition2.down()) && b((IWorldReader) worldserver, blockposition2, enumdirection.opposite())) {
|
||||
- this.a(worldserver, blockposition2, i + 1);
|
||||
if (worldserver.isEmptyBlock(blockposition2) && worldserver.isEmptyBlock(blockposition2.below()) && allNeighborsEmpty(worldserver, blockposition2, enumdirection.getOpposite())) {
|
||||
- this.placeGrownFlower(worldserver, blockposition2, i + 1);
|
||||
- flag2 = true;
|
||||
+ // CraftBukkit start - add event
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
|
||||
+ this.a(worldserver, blockposition2, i + 1);
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, this.defaultBlockState().setValue(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
|
||||
+ this.placeGrownFlower(worldserver, blockposition2, i + 1);
|
||||
+ flag2 = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -40,20 +40,20 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
worldserver.setTypeAndData(blockposition, this.plant.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
|
||||
} else {
|
||||
- this.a((World) worldserver, blockposition);
|
||||
- this.placeDeadFlower(worldserver, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.a((World) worldserver, blockposition);
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.defaultBlockState().setValue(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.placeDeadFlower(worldserver, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
- this.a((World) worldserver, blockposition);
|
||||
- this.placeDeadFlower(worldserver, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.a((World) worldserver, blockposition);
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.defaultBlockState().setValue(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.placeDeadFlower(worldserver, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
|
||||
public static final int MAX_AGE = 2;
|
||||
@@ -55,7 +57,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockCocoa.AGE);
|
||||
int i = (Integer) iblockdata.getValue(BlockCocoa.AGE);
|
||||
|
||||
if (i < 2) {
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); // CraftBukkkit
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCocoa.AGE, i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockCocoa.AGE, i + 1), 2); // CraftBukkkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +127,7 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); // CraftBukkit
|
||||
public void performBonemeal(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCocoa.AGE, (Integer) iblockdata.getValue(BlockCocoa.AGE) + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockCocoa.AGE, (Integer) iblockdata.getValue(BlockCocoa.AGE) + 1), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCommand.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCommand.java
|
||||
@@ -26,6 +26,8 @@
|
||||
@@ -27,6 +27,8 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -56,6 +58,15 @@
|
||||
@@ -57,6 +59,15 @@
|
||||
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||
boolean flag2 = tileentitycommand.f();
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition);
|
||||
boolean flag2 = tileentitycommand.isPowered();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int old = flag2 ? 15 : 0;
|
||||
@@ -23,5 +23,5 @@
|
||||
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ // CraftBukkit end
|
||||
|
||||
tileentitycommand.a(flag1);
|
||||
if (!flag2 && !tileentitycommand.g() && tileentitycommand.t() != TileEntityCommand.Type.SEQUENCE) {
|
||||
tileentitycommand.setPowered(flag1);
|
||||
if (!flag2 && !tileentitycommand.isAutomatic() && tileentitycommand.getMode() != TileEntityCommand.Type.SEQUENCE) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockComposter.java
|
||||
+++ b/net/minecraft/world/level/block/BlockComposter.java
|
||||
@@ -38,6 +38,12 @@
|
||||
@@ -37,6 +37,12 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -13,53 +13,44 @@
|
||||
public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
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.OUTER_SHAPE, Block.a(2.0D, (double) Math.max(2, 1 + i * 2), 2.0D, 14.0D, 16.0D, 14.0D), OperatorBoolean.ONLY_FIRST);
|
||||
}
|
||||
@@ -225,18 +231,25 @@
|
||||
@@ -224,18 +230,25 @@
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
} else if (i == 8) {
|
||||
- d(iblockdata, world, blockposition);
|
||||
+ d(iblockdata, world, blockposition, (Entity) null); // CraftBukkit - no event for players
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
- extractProduce(iblockdata, world, blockposition);
|
||||
+ extractProduce(iblockdata, world, blockposition, (Entity) null); // CraftBukkit - no event for players
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
- 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.LEVEL);
|
||||
- public static IBlockData insertItem(IBlockData iblockdata, WorldServer worldserver, ItemStack itemstack, BlockPosition blockposition) {
|
||||
+ public static IBlockData insertItem(IBlockData iblockdata, WorldServer worldserver, ItemStack itemstack, BlockPosition blockposition, Entity entity) { // CraftBukkit
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
if (i < 7 && BlockComposter.COMPOSTABLES.containsKey(itemstack.getItem())) {
|
||||
- IBlockData iblockdata1 = a(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack);
|
||||
- IBlockData iblockdata1 = addItem(iblockdata, worldserver, blockposition, itemstack);
|
||||
+ // CraftBukkit start
|
||||
+ double rand = worldserver.getRandom().nextDouble();
|
||||
+ IBlockData iblockdata1 = a(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
|
||||
+ IBlockData iblockdata1 = addItem(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
|
||||
+ if (iblockdata == iblockdata1 || org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
|
||||
+ return iblockdata;
|
||||
+ }
|
||||
+ iblockdata1 = a(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack, rand);
|
||||
+ iblockdata1 = addItem(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack, rand);
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.subtract(1);
|
||||
itemstack.shrink(1);
|
||||
return iblockdata1;
|
||||
@@ -245,7 +258,15 @@
|
||||
@@ -244,7 +257,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public static IBlockData d(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- public static IBlockData extractProduce(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ public static IBlockData d(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
+ public static IBlockData extractProduce(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
+ if (entity != null) {
|
||||
+ IBlockData iblockdata1 = c(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition);
|
||||
+ IBlockData iblockdata1 = empty(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition);
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
|
||||
+ return iblockdata;
|
||||
+ }
|
||||
@@ -68,17 +59,17 @@
|
||||
if (!world.isClientSide) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.random.nextFloat() * 0.7F) + 0.15000000596046448D;
|
||||
@@ -271,10 +292,16 @@
|
||||
@@ -270,10 +291,16 @@
|
||||
}
|
||||
|
||||
static IBlockData a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
static IBlockData addItem(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
+ // CraftBukkit start
|
||||
+ return a(iblockdata, generatoraccess, blockposition, itemstack, generatoraccess.getRandom().nextDouble());
|
||||
+ return addItem(iblockdata, generatoraccess, blockposition, itemstack, generatoraccess.getRandom().nextDouble());
|
||||
+ }
|
||||
+
|
||||
+ static IBlockData a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack, double rand) {
|
||||
+ static IBlockData addItem(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack, double rand) {
|
||||
+ // CraftBukkit end
|
||||
int i = (Integer) iblockdata.get(BlockComposter.LEVEL);
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
float f = BlockComposter.COMPOSTABLES.getFloat(itemstack.getItem());
|
||||
|
||||
- if ((i != 0 || f <= 0.0F) && generatoraccess.getRandom().nextDouble() >= (double) f) {
|
||||
@@ -86,9 +77,9 @@
|
||||
return iblockdata;
|
||||
} else {
|
||||
int j = i + 1;
|
||||
@@ -322,7 +349,8 @@
|
||||
public IWorldInventory a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.get(BlockComposter.LEVEL);
|
||||
@@ -321,7 +348,8 @@
|
||||
public IWorldInventory getContainer(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.getValue(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
|
||||
@@ -96,7 +87,7 @@
|
||||
}
|
||||
|
||||
public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -337,6 +365,7 @@
|
||||
@@ -336,6 +364,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -104,25 +95,25 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -361,8 +390,15 @@
|
||||
@@ -360,8 +389,15 @@
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
- BlockComposter.c(this.state, this.level, this.pos);
|
||||
public void setChanged() {
|
||||
- BlockComposter.empty(this.state, this.level, this.pos);
|
||||
- this.changed = true;
|
||||
+ // CraftBukkit start - allow putting items back (eg cancelled InventoryMoveItemEvent)
|
||||
+ if (this.isEmpty()) {
|
||||
+ BlockComposter.c(this.state, this.level, this.pos);
|
||||
+ BlockComposter.empty(this.state, this.level, this.pos);
|
||||
+ this.changed = true;
|
||||
+ } else {
|
||||
+ this.level.setTypeAndData(this.pos, this.state, 3);
|
||||
+ this.level.setBlock(this.pos, this.state, 3);
|
||||
+ this.changed = false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +411,7 @@
|
||||
@@ -374,6 +410,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
@@ -130,7 +121,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -417,8 +454,9 @@
|
||||
@@ -416,8 +453,9 @@
|
||||
|
||||
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockConcretePowder.java
|
||||
+++ b/net/minecraft/world/level/block/BlockConcretePowder.java
|
||||
@@ -13,6 +13,12 @@
|
||||
@@ -12,6 +12,12 @@
|
||||
import net.minecraft.world.level.block.state.BlockBase;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -13,23 +13,23 @@
|
||||
public class BlockConcretePowder extends BlockFalling {
|
||||
|
||||
private final IBlockData concrete;
|
||||
@@ -25,7 +31,7 @@
|
||||
@@ -24,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.concrete, 3);
|
||||
public void onLand(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) {
|
||||
if (shouldSolidify(world, blockposition, iblockdata1)) {
|
||||
- world.setBlock(blockposition, this.concrete, 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.concrete, 3); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +42,24 @@
|
||||
BlockPosition blockposition = blockactioncontext.getClickPosition();
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
@@ -35,7 +41,24 @@
|
||||
BlockPosition blockposition = blockactioncontext.getClickedPos();
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
- return canHarden(world, blockposition, iblockdata) ? this.concrete : super.getPlacedState(blockactioncontext);
|
||||
- return shouldSolidify(world, blockposition, iblockdata) ? this.concrete : super.getStateForPlacement(blockactioncontext);
|
||||
+ // CraftBukkit start
|
||||
+ if (!canHarden(world, blockposition, iblockdata)) {
|
||||
+ return super.getPlacedState(blockactioncontext);
|
||||
+ if (!shouldSolidify(world, blockposition, iblockdata)) {
|
||||
+ return super.getStateForPlacement(blockactioncontext);
|
||||
+ }
|
||||
+
|
||||
+ // TODO: An event factory call for methods like this
|
||||
@@ -37,24 +37,24 @@
|
||||
+ blockState.setData(this.concrete);
|
||||
+
|
||||
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
|
||||
+ world.getMinecraftServer().server.getPluginManager().callEvent(event);
|
||||
+ world.getServer().server.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ return blockState.getHandle();
|
||||
+ }
|
||||
+
|
||||
+ return super.getPlacedState(blockactioncontext);
|
||||
+ return super.getStateForPlacement(blockactioncontext);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private static boolean canHarden(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -72,7 +95,25 @@
|
||||
private static boolean shouldSolidify(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -71,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.concrete : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return touchesLiquid(generatoraccess, blockposition) ? this.concrete : super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit start
|
||||
+ if (a((IBlockAccess) generatoraccess, blockposition)) {
|
||||
+ if (touchesLiquid(generatoraccess, blockposition)) {
|
||||
+ // Suppress during worldgen
|
||||
+ if (!(generatoraccess instanceof World)) {
|
||||
+ return this.concrete;
|
||||
@@ -70,7 +70,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ return super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoral.java
|
||||
@@ -26,6 +26,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!this.a((IBlockAccess) worldserver, blockposition)) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!this.scanForWater(worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, this.deadBlock.getBlockData(), 2);
|
||||
worldserver.setBlock(blockposition, this.deadBlock.defaultBlockState(), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralFan.java
|
||||
@@ -28,6 +28,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!e(iblockdata, worldserver, blockposition)) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!scanForWater(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData().set(BlockCoralFan.WATERLOGGED, false)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralFan.WATERLOGGED, false)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) this.deadBlock.getBlockData().set(BlockCoralFan.WATERLOGGED, false), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) this.deadBlock.defaultBlockState().setValue(BlockCoralFan.WATERLOGGED, false), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralFanWall.java
|
||||
@@ -28,6 +28,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!e(iblockdata, worldserver, blockposition)) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!scanForWater(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData().set(BlockCoralFanWall.WATERLOGGED, false).set(BlockCoralFanWall.FACING, iblockdata.get(BlockCoralFanWall.FACING))).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralFanWall.WATERLOGGED, false).setValue(BlockCoralFanWall.FACING, iblockdata.getValue(BlockCoralFanWall.FACING))).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.deadBlock.getBlockData().set(BlockCoralFanWall.WATERLOGGED, false)).set(BlockCoralFanWall.FACING, (EnumDirection) iblockdata.get(BlockCoralFanWall.FACING)), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) ((IBlockData) this.deadBlock.defaultBlockState().setValue(BlockCoralFanWall.WATERLOGGED, false)).setValue(BlockCoralFanWall.FACING, (EnumDirection) iblockdata.getValue(BlockCoralFanWall.FACING)), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralPlant.java
|
||||
@@ -33,6 +33,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!e(iblockdata, worldserver, blockposition)) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!scanForWater(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.getBlockData().set(BlockCoralPlant.WATERLOGGED, false)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralPlant.WATERLOGGED, false)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) this.deadBlock.getBlockData().set(BlockCoralPlant.WATERLOGGED, false), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) this.deadBlock.defaultBlockState().setValue(BlockCoralPlant.WATERLOGGED, false), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
public static final int MAX_AGE = 7;
|
||||
@@ -76,7 +78,7 @@
|
||||
float f = a((Block) this, (IBlockAccess) worldserver, blockposition);
|
||||
float f = getGrowthSpeed(this, worldserver, blockposition);
|
||||
|
||||
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
- worldserver.setTypeAndData(blockposition, this.setAge(i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.setAge(i + 1), 2); // CraftBukkit
|
||||
- worldserver.setBlock(blockposition, this.getStateForAge(i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getStateForAge(i + 1), 2); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,17 +22,17 @@
|
||||
i = j;
|
||||
}
|
||||
|
||||
- world.setTypeAndData(blockposition, this.setAge(i), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.setAge(i), 2); // CraftBukkit
|
||||
- world.setBlock(blockposition, this.getStateForAge(i), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getStateForAge(i), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
protected int a(World world) {
|
||||
protected int getBonemealAgeIncrease(World world) {
|
||||
@@ -149,7 +151,7 @@
|
||||
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
- 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);
|
||||
+ if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // CraftBukkit
|
||||
world.destroyBlock(blockposition, true, entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDaylightDetector.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDaylightDetector.java
|
||||
@@ -67,6 +67,7 @@
|
||||
@@ -66,6 +66,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, (int) 0, (int) 15);
|
||||
if ((Integer) iblockdata.getValue(BlockDaylightDetector.POWER) != i) {
|
||||
+ i = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, blockposition, ((Integer) iblockdata.getValue(POWER)), i).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockDaylightDetector.POWER, i), 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDiodeAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDiodeAbstract.java
|
||||
@@ -20,6 +20,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
@@ -19,6 +19,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.ticks.TickListPriority;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
|
||||
|
||||
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);
|
||||
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
@@ -45,8 +47,18 @@
|
||||
boolean flag1 = this.shouldTurnOn(worldserver, blockposition, iblockdata);
|
||||
|
||||
if (flag && !flag1) {
|
||||
+ // CraftBukkit start
|
||||
@@ -18,13 +18,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.POWERED, false), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(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.POWERED, true), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockDiodeAbstract.POWERED, true), 2);
|
||||
if (!flag1) {
|
||||
worldserver.getBlockTickList().a(blockposition, this, this.g(iblockdata), TickListPriority.VERY_HIGH);
|
||||
worldserver.scheduleTick(blockposition, (Block) this, this.getDelay(iblockdata), TickListPriority.VERY_HIGH);
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
|
||||
@@ -42,6 +42,11 @@
|
||||
@@ -41,6 +41,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) {
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!canBeGrass(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
worldserver.setBlockAndUpdate(blockposition, Blocks.DIRT.defaultBlockState());
|
||||
} else {
|
||||
if (worldserver.getLightLevel(blockposition.up()) >= 9) {
|
||||
@@ -51,7 +56,7 @@
|
||||
BlockPosition blockposition1 = blockposition.c(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
|
||||
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9) {
|
||||
@@ -50,7 +55,7 @@
|
||||
BlockPosition blockposition1 = blockposition.offset(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.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
|
||||
if (worldserver.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, worldserver, blockposition1)) {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW)));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDispenser.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDispenser.java
|
||||
@@ -41,10 +41,11 @@
|
||||
|
||||
public static final BlockStateDirection FACING = BlockDirectional.FACING;
|
||||
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
|
||||
@@ -46,6 +46,7 @@
|
||||
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.DISPENSER_REGISTRY.put(imaterial.getItem(), idispensebehavior);
|
||||
@@ -88,6 +89,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.a(itemstack);
|
||||
public static void registerBehavior(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
|
||||
BlockDispenser.DISPENSER_REGISTRY.put(imaterial.asItem(), idispensebehavior);
|
||||
@@ -89,6 +90,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
||||
|
||||
if (idispensebehavior != IDispenseBehavior.NOOP) {
|
||||
+ eventFired = false; // CraftBukkit - reset event status
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDoor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDoor.java
|
||||
@@ -34,6 +34,8 @@
|
||||
@@ -33,6 +33,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -192,9 +194,24 @@
|
||||
@@ -191,9 +193,24 @@
|
||||
|
||||
@Override
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
- boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition.shift(iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN));
|
||||
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
- boolean flag1 = world.hasNeighborSignal(blockposition) || world.hasNeighborSignal(blockposition.relative(iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN));
|
||||
+ // CraftBukkit start
|
||||
+ BlockPosition otherHalf = blockposition.shift(iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN);
|
||||
+ BlockPosition otherHalf = blockposition.relative(iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN);
|
||||
+
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -24,15 +24,15 @@
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+ int powerTop = blockTop.getBlockPower();
|
||||
+ if (powerTop > power) power = powerTop;
|
||||
+ int oldPower = (Boolean) iblockdata.get(BlockDoor.POWERED) ? 15 : 0;
|
||||
+ int oldPower = (Boolean) iblockdata.getValue(BlockDoor.POWERED) ? 15 : 0;
|
||||
+
|
||||
+ if (oldPower == 0 ^ power == 0) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
- if (!this.getBlockData().a(block) && flag1 != (Boolean) iblockdata.get(BlockDoor.POWERED)) {
|
||||
- if (!this.defaultBlockState().is(block) && flag1 != (Boolean) iblockdata.getValue(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);
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockDoor.OPEN)) {
|
||||
this.playSound(world, blockposition, flag1);
|
||||
world.gameEvent(flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockposition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDragonEgg.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDragonEgg.java
|
||||
@@ -15,6 +15,8 @@
|
||||
@@ -16,6 +16,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
+
|
||||
public class BlockDragonEgg extends BlockFalling {
|
||||
|
||||
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.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));
|
||||
protected static final VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
@@ -47,6 +49,18 @@
|
||||
BlockPosition blockposition1 = blockposition.offset(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()) {
|
||||
if (world.getBlockState(blockposition1).isAir() && worldborder.isWithinBounds(blockposition1)) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block from = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ org.bukkit.block.Block to = world.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDropper.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDropper.java
|
||||
@@ -16,6 +16,12 @@
|
||||
@@ -15,6 +15,12 @@
|
||||
import net.minecraft.world.level.block.state.BlockBase;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
public class BlockDropper extends BlockDispenser {
|
||||
|
||||
private static final IDispenseBehavior DISPENSE_BEHAVIOUR = new DispenseBehaviorItem();
|
||||
@@ -53,8 +59,25 @@
|
||||
@@ -52,8 +58,25 @@
|
||||
if (iinventory == null) {
|
||||
itemstack1 = BlockDropper.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
|
||||
} else {
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.cloneItemStack().cloneAndSubtract(1), enumdirection.opposite());
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.copy().split(1), enumdirection.getOpposite());
|
||||
- if (itemstack1.isEmpty()) {
|
||||
+ // CraftBukkit start - Fire event when pushing items into other inventories
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().cloneAndSubtract(1));
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copy().split(1));
|
||||
+
|
||||
+ org.bukkit.inventory.Inventory destinationInventory;
|
||||
+ // Have to special case large chests as they work oddly
|
||||
@@ -35,9 +35,9 @@
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection.opposite());
|
||||
+ itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection.getOpposite());
|
||||
+ if (event.getItem().equals(oitemstack) && itemstack1.isEmpty()) {
|
||||
+ // CraftBukkit end
|
||||
itemstack1 = itemstack.cloneItemStack();
|
||||
itemstack1.subtract(1);
|
||||
itemstack1 = itemstack.copy();
|
||||
itemstack1.shrink(1);
|
||||
} else {
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
+
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
|
||||
protected static final VoxelShape SHAPE = Block.a(0.0D, 6.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
||||
protected static final VoxelShape SHAPE = Block.box(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.END ? World.OVERWORLD : World.END;
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- ResourceKey<World> resourcekey = world.dimension() == 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);
|
||||
WorldServer worldserver = ((WorldServer) world).getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver == null) {
|
||||
- return;
|
||||
@@ -32,10 +32,10 @@
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entity).b(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ ((EntityPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.b(worldserver);
|
||||
entity.changeDimension(worldserver);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFenceGate.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
|
||||
@@ -130,6 +130,17 @@
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
@@ -129,6 +129,17 @@
|
||||
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
if (!world.isClientSide) {
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ boolean oldPowered = iblockdata.get(BlockFenceGate.POWERED);
|
||||
+ boolean oldPowered = iblockdata.getValue(BlockFenceGate.POWERED);
|
||||
+ if (oldPowered != flag1) {
|
||||
+ int newPower = flag1 ? 15 : 0;
|
||||
+ int oldPower = oldPowered ? 15 : 0;
|
||||
@@ -16,5 +16,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if ((Boolean) iblockdata.get(BlockFenceGate.POWERED) != flag1) {
|
||||
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) iblockdata.set(BlockFenceGate.POWERED, flag1)).set(BlockFenceGate.OPEN, flag1), 2);
|
||||
if ((Boolean) iblockdata.getValue(BlockFenceGate.POWERED) != flag1) {
|
||||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(BlockFenceGate.POWERED, flag1)).setValue(BlockFenceGate.OPEN, flag1), 2);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFire.java
|
||||
@@ -28,6 +28,14 @@
|
||||
@@ -27,6 +27,14 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -15,19 +15,19 @@
|
||||
public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
public static final int MAX_AGE = 15;
|
||||
@@ -93,7 +101,24 @@
|
||||
@@ -92,7 +100,24 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return this.canPlace(iblockdata, generatoraccess, blockposition) ? this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)) : Blocks.AIR.getBlockData();
|
||||
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return this.canSurvive(iblockdata, generatoraccess, blockposition) ? this.getStateWithAge(generatoraccess, blockposition, (Integer) iblockdata.getValue(BlockFire.AGE)) : Blocks.AIR.defaultBlockState();
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.canPlace(iblockdata, generatoraccess, blockposition)) {
|
||||
+ if (!this.canSurvive(iblockdata, generatoraccess, blockposition)) {
|
||||
+ // Suppress during worldgen
|
||||
+ if (!(generatoraccess instanceof World)) {
|
||||
+ return Blocks.AIR.getBlockData();
|
||||
+ return Blocks.AIR.defaultBlockState();
|
||||
+ }
|
||||
+ CraftBlockState blockState = CraftBlockStates.getBlockState(generatoraccess, blockposition);
|
||||
+ blockState.setData(Blocks.AIR.getBlockData());
|
||||
+ blockState.setData(Blocks.AIR.defaultBlockState());
|
||||
+
|
||||
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||
+ ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -36,94 +36,94 @@
|
||||
+ return blockState.getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ return this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE));
|
||||
+ return this.getStateWithAge(generatoraccess, blockposition, (Integer) iblockdata.getValue(BlockFire.AGE));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +167,7 @@
|
||||
worldserver.getBlockTickList().a(blockposition, this, a(worldserver.random));
|
||||
@@ -141,7 +166,7 @@
|
||||
worldserver.scheduleTick(blockposition, (Block) this, getFireTickDelay(worldserver.random));
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
if (!iblockdata.canPlace(worldserver, blockposition)) {
|
||||
- worldserver.a(blockposition, false);
|
||||
if (!iblockdata.canSurvive(worldserver, blockposition)) {
|
||||
- worldserver.removeBlock(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition.down());
|
||||
@@ -150,7 +175,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockFire.AGE);
|
||||
IBlockData iblockdata1 = worldserver.getBlockState(blockposition.below());
|
||||
@@ -149,7 +174,7 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockFire.AGE);
|
||||
|
||||
if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
|
||||
- worldserver.a(blockposition, false);
|
||||
if (!flag && worldserver.isRaining() && this.isNearRain(worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
|
||||
- worldserver.removeBlock(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - extinguished by rain
|
||||
} else {
|
||||
int j = Math.min(15, i + random.nextInt(3) / 2);
|
||||
|
||||
@@ -164,14 +189,14 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
@@ -163,14 +188,14 @@
|
||||
BlockPosition blockposition1 = blockposition.below();
|
||||
|
||||
if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
|
||||
- worldserver.a(blockposition, false);
|
||||
if (!worldserver.getBlockState(blockposition1).isFaceSturdy(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
|
||||
- worldserver.removeBlock(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (i == 15 && random.nextInt(4) == 0 && !this.f(worldserver.getType(blockposition.down()))) {
|
||||
- worldserver.a(blockposition, false);
|
||||
if (i == 15 && random.nextInt(4) == 0 && !this.canBurn(worldserver.getBlockState(blockposition.below()))) {
|
||||
- worldserver.removeBlock(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -179,12 +204,14 @@
|
||||
boolean flag1 = worldserver.u(blockposition);
|
||||
@@ -178,12 +203,14 @@
|
||||
boolean flag1 = worldserver.isHumidAt(blockposition);
|
||||
int k = flag1 ? -50 : 0;
|
||||
|
||||
- this.trySpread(worldserver, blockposition.east(), 300 + k, random, i);
|
||||
- this.trySpread(worldserver, blockposition.west(), 300 + k, random, i);
|
||||
- this.trySpread(worldserver, blockposition.down(), 250 + k, random, i);
|
||||
- this.trySpread(worldserver, blockposition.up(), 250 + k, random, i);
|
||||
- this.trySpread(worldserver, blockposition.north(), 300 + k, random, i);
|
||||
- this.trySpread(worldserver, blockposition.south(), 300 + k, random, i);
|
||||
- this.checkBurnOut(worldserver, blockposition.east(), 300 + k, random, i);
|
||||
- this.checkBurnOut(worldserver, blockposition.west(), 300 + k, random, i);
|
||||
- this.checkBurnOut(worldserver, blockposition.below(), 250 + k, random, i);
|
||||
- this.checkBurnOut(worldserver, blockposition.above(), 250 + k, random, i);
|
||||
- this.checkBurnOut(worldserver, blockposition.north(), 300 + k, random, i);
|
||||
- this.checkBurnOut(worldserver, blockposition.south(), 300 + k, random, i);
|
||||
+ // CraftBukkit start - add source blockposition to burn calls
|
||||
+ this.trySpread(worldserver, blockposition.east(), 300 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.west(), 300 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.down(), 250 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.up(), 250 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.below(), 250 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.above(), 250 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.north(), 300 + k, random, i, blockposition);
|
||||
+ this.trySpread(worldserver, blockposition.south(), 300 + k, random, i, blockposition);
|
||||
+ // CraftBukkit end
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
|
||||
for (int l = -1; l <= 1; ++l) {
|
||||
@@ -210,7 +237,15 @@
|
||||
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.a((World) worldserver, (BlockPosition) blockposition_mutableblockposition))) {
|
||||
@@ -209,7 +236,15 @@
|
||||
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.isNearRain(worldserver, blockposition_mutableblockposition))) {
|
||||
int j2 = Math.min(15, i + random.nextInt(5) / 4);
|
||||
|
||||
- worldserver.setTypeAndData(blockposition_mutableblockposition, this.a(worldserver, blockposition_mutableblockposition, j2), 3);
|
||||
- worldserver.setBlock(blockposition_mutableblockposition, this.getStateWithAge(worldserver, blockposition_mutableblockposition, j2), 3);
|
||||
+ // CraftBukkit start - Call to stop spread of fire
|
||||
+ if (worldserver.getType(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) {
|
||||
+ if (worldserver.getBlockState(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition_mutableblockposition, blockposition).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition_mutableblockposition, this.a(worldserver, blockposition_mutableblockposition, j2), 3); // CraftBukkit
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition_mutableblockposition, this.getStateWithAge(worldserver, blockposition_mutableblockposition, j2), 3); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,12 +269,24 @@
|
||||
return iblockdata.b(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.get(BlockProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(iblockdata.getBlock());
|
||||
@@ -233,12 +268,24 @@
|
||||
return iblockdata.hasProperty(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(iblockdata.getBlock());
|
||||
}
|
||||
|
||||
- private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j) {
|
||||
- private void checkBurnOut(World world, BlockPosition blockposition, int i, Random random, int j) {
|
||||
+ private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
|
||||
int k = this.getBurnChance(world.getType(blockposition));
|
||||
int k = this.getBurnOdd(world.getBlockState(blockposition));
|
||||
|
||||
if (random.nextInt(i) < k) {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFireAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFireAbstract.java
|
||||
@@ -125,7 +125,14 @@
|
||||
if (!entity.isFireProof()) {
|
||||
entity.setFireTicks(entity.getFireTicks() + 1);
|
||||
if (entity.getFireTicks() == 0) {
|
||||
- entity.setOnFire(8);
|
||||
@@ -124,7 +124,14 @@
|
||||
if (!entity.fireImmune()) {
|
||||
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
|
||||
if (entity.getRemainingFireTicks() == 0) {
|
||||
- entity.setSecondsOnFire(8);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setOnFire(event.getDuration(), false);
|
||||
+ entity.setSecondsOnFire(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
entity.damageEntity(DamageSource.IN_FIRE, this.fireDamage);
|
||||
@@ -147,14 +154,14 @@
|
||||
entity.hurt(DamageSource.IN_FIRE, this.fireDamage);
|
||||
@@ -146,14 +153,14 @@
|
||||
}
|
||||
|
||||
if (!iblockdata.canPlace(world, blockposition)) {
|
||||
- world.a(blockposition, false);
|
||||
if (!iblockdata.canSurvive(world, blockposition)) {
|
||||
- world.removeBlock(blockposition, false);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(World world) {
|
||||
- return world.getDimensionKey() == World.OVERWORLD || world.getDimensionKey() == World.NETHER;
|
||||
private static boolean inPortalDimension(World world) {
|
||||
- return world.dimension() == World.OVERWORLD || world.dimension() == 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
|
||||
@@ -202,4 +209,12 @@
|
||||
@@ -201,4 +208,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ protected void fireExtinguished(GeneratorAccess world, BlockPosition position) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, position, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ world.a(position, false);
|
||||
+ protected void fireExtinguished(net.minecraft.world.level.GeneratorAccess world, BlockPosition position) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, position, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ world.removeBlock(position, false);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFluids.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFluids.java
|
||||
@@ -143,14 +143,20 @@
|
||||
if (world.getFluid(blockposition1).a((Tag) TagsFluid.WATER)) {
|
||||
Block block = world.getFluid(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
@@ -141,14 +141,20 @@
|
||||
if (world.getFluidState(blockposition1).is((Tag) TagsFluid.WATER)) {
|
||||
Block block = world.getFluidState(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
|
||||
- world.setTypeUpdate(blockposition, block.getBlockData());
|
||||
- world.setBlockAndUpdate(blockposition, block.defaultBlockState());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, block.getBlockData())) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, block.defaultBlockState())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flag && world.getType(blockposition1).a(Blocks.BLUE_ICE)) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.BASALT.getBlockData());
|
||||
if (flag && world.getBlockState(blockposition1).is(Blocks.BLUE_ICE)) {
|
||||
- world.setBlockAndUpdate(blockposition, Blocks.BASALT.defaultBlockState());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.BASALT.getBlockData())) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.BASALT.defaultBlockState())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -51,6 +51,13 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
public void performBonemeal(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
+ // CraftBukkit start
|
||||
+ if (this == Blocks.WARPED_FUNGUS) {
|
||||
+ BlockSapling.treeType = org.bukkit.TreeType.WARPED_FUNGUS;
|
||||
@@ -11,6 +11,6 @@
|
||||
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
((WorldGenFeatureConfigured) this.feature.get()).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition);
|
||||
((WorldGenFeatureConfigured) this.feature.get()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/BlockGrass.java
|
||||
+++ b/net/minecraft/world/level/block/BlockGrass.java
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
if (iblockdata3.canPlace(worldserver, blockposition2)) {
|
||||
- worldserver.setTypeAndData(blockposition2, iblockdata3, 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition2, iblockdata3, 3); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@
|
||||
@@ -43,6 +43,11 @@
|
||||
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
+ // CraftBukkit start - do not fade if the block is valid here
|
||||
+ if (iblockdata.canPlace(worldserver, blockposition)) {
|
||||
+ if (iblockdata.canSurvive(worldserver, blockposition)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
BlockSoil.fade(iblockdata, worldserver, blockposition);
|
||||
BlockSoil.turnToDirt(iblockdata, worldserver, blockposition);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockGrowingTop.java
|
||||
+++ b/net/minecraft/world/level/block/BlockGrowingTop.java
|
||||
@@ -45,7 +45,7 @@
|
||||
BlockPosition blockposition1 = blockposition.shift(this.growthDirection);
|
||||
@@ -44,7 +44,7 @@
|
||||
BlockPosition blockposition1 = blockposition.relative(this.growthDirection);
|
||||
|
||||
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
|
||||
if (this.canGrowInto(worldserver.getBlockState(blockposition1))) {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, this.getGrowIntoState(iblockdata, worldserver.random));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.getGrowIntoState(iblockdata, worldserver.random)); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockIce.java
|
||||
+++ b/net/minecraft/world/level/block/BlockIce.java
|
||||
@@ -50,6 +50,11 @@
|
||||
@@ -49,6 +49,11 @@
|
||||
}
|
||||
|
||||
protected void melt(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, world.getDimensionManager().isNether() ? Blocks.AIR.getBlockData() : Blocks.WATER.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, world.dimensionType().ultraWarm() ? Blocks.AIR.defaultBlockState() : Blocks.WATER.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.getDimensionManager().isNether()) {
|
||||
world.a(blockposition, false);
|
||||
if (world.dimensionType().ultraWarm()) {
|
||||
world.removeBlock(blockposition, false);
|
||||
} else {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/level/block/BlockJukeBox.java
|
||||
+++ b/net/minecraft/world/level/block/BlockJukeBox.java
|
||||
@@ -62,7 +62,13 @@
|
||||
TileEntity tileentity = generatoraccess.getTileEntity(blockposition);
|
||||
@@ -59,7 +59,13 @@
|
||||
TileEntity tileentity = generatoraccess.getBlockEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof TileEntityJukeBox) {
|
||||
- ((TileEntityJukeBox) tileentity).setRecord(itemstack.cloneItemStack());
|
||||
- ((TileEntityJukeBox) tileentity).setRecord(itemstack.copy());
|
||||
+ // CraftBukkit start - There can only be one
|
||||
+ itemstack = itemstack.cloneItemStack();
|
||||
+ itemstack = itemstack.copy();
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ itemstack.setCount(1);
|
||||
+ }
|
||||
+ ((TileEntityJukeBox) tileentity).setRecord(itemstack);
|
||||
+ // CraftBukkit end
|
||||
generatoraccess.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockJukeBox.HAS_RECORD, true), 2);
|
||||
generatoraccess.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockJukeBox.HAS_RECORD, true), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLeaves.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLeaves.java
|
||||
@@ -21,6 +21,8 @@
|
||||
@@ -20,6 +20,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
public class BlockLeaves extends Block {
|
||||
|
||||
public static final int DECAY_DISTANCE = 7;
|
||||
@@ -46,6 +48,14 @@
|
||||
@@ -45,6 +47,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) {
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!(Boolean) iblockdata.getValue(BlockLeaves.PERSISTENT) && (Integer) iblockdata.getValue(BlockLeaves.DISTANCE) == 7) {
|
||||
+ // CraftBukkit start
|
||||
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled() || worldserver.getType(blockposition).getBlock() != this) {
|
||||
+ if (event.isCancelled() || worldserver.getBlockState(blockposition).getBlock() != this) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
c(iblockdata, (World) worldserver, blockposition);
|
||||
worldserver.a(blockposition, false);
|
||||
dropResources(iblockdata, worldserver, blockposition);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLectern.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLectern.java
|
||||
@@ -199,12 +199,13 @@
|
||||
@@ -198,12 +198,13 @@
|
||||
}
|
||||
|
||||
private void d(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- TileEntity tileentity = world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = world.getTileEntity(blockposition, false); // CraftBukkit - don't validate, type may be changed already
|
||||
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- TileEntity tileentity = world.getBlockEntity(blockposition);
|
||||
+ TileEntity tileentity = world.getBlockEntity(blockposition, false); // CraftBukkit - don't validate, type may be changed already
|
||||
|
||||
if (tileentity instanceof TileEntityLectern) {
|
||||
TileEntityLectern tileentitylectern = (TileEntityLectern) tileentity;
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockLectern.FACING);
|
||||
ItemStack itemstack = tileentitylectern.getBook().cloneItemStack();
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockLectern.FACING);
|
||||
ItemStack itemstack = tileentitylectern.getBook().copy();
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5500
|
||||
float f = 0.25F * (float) enumdirection.getAdjacentX();
|
||||
float f1 = 0.25F * (float) enumdirection.getAdjacentZ();
|
||||
float f = 0.25F * (float) enumdirection.getStepX();
|
||||
float f1 = 0.25F * (float) enumdirection.getStepZ();
|
||||
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + 0.5D + (double) f, (double) (blockposition.getY() + 1), (double) blockposition.getZ() + 0.5D + (double) f1, itemstack);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLever.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLever.java
|
||||
@@ -25,6 +25,8 @@
|
||||
@@ -23,6 +23,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
public class BlockLever extends BlockAttachable {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -92,6 +94,20 @@
|
||||
@@ -90,6 +92,20 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
+ // CraftBukkit start - Interact Lever
|
||||
+ boolean powered = iblockdata.get(BlockLever.POWERED); // Old powered state
|
||||
+ boolean powered = iblockdata.getValue(BlockLever.POWERED); // Old powered state
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int old = (powered) ? 15 : 0;
|
||||
+ int current = (!powered) ? 15 : 0;
|
||||
@@ -27,6 +27,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
iblockdata1 = this.d(iblockdata, world, blockposition);
|
||||
float f = (Boolean) iblockdata1.get(BlockLever.POWERED) ? 0.6F : 0.5F;
|
||||
iblockdata1 = this.pull(iblockdata, world, blockposition);
|
||||
float f = (Boolean) iblockdata1.getValue(BlockLever.POWERED) ? 0.6F : 0.5F;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -30,7 +30,9 @@
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (!entity.isFireProof() && entity instanceof EntityLiving && !EnchantmentManager.i((EntityLiving) entity)) {
|
||||
if (!entity.fireImmune() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((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);
|
||||
entity.hurt(DamageSource.HOT_FLOOR, 1.0F);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -25,4 +25,4 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (flag1 && !flag) {
|
||||
iblockdata1 = (IBlockData) iblockdata.set(BlockMinecartDetector.POWERED, true);
|
||||
iblockdata1 = (IBlockData) iblockdata.setValue(BlockMinecartDetector.POWERED, true);
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMobSpawner.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMobSpawner.java
|
||||
@@ -33,9 +33,19 @@
|
||||
@@ -33,9 +33,16 @@
|
||||
@Override
|
||||
public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.dropNaturally(iblockdata, worldserver, blockposition, itemstack);
|
||||
+ /* CraftBukkit start - Delegate to getExpDrop
|
||||
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
|
||||
|
||||
this.dropExperience(worldserver, blockposition, i);
|
||||
+ */
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack);
|
||||
+ // CraftBukkit start - Delegate to getExpDrop
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
+ int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
|
||||
+
|
||||
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
|
||||
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
private final Block hostBlock;
|
||||
@@ -43,7 +45,7 @@
|
||||
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.a((World) worldserver);
|
||||
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.create(worldserver);
|
||||
|
||||
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- worldserver.addEntity(entitysilverfish);
|
||||
+ worldserver.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
|
||||
entitysilverfish.doSpawnEffect();
|
||||
entitysilverfish.moveTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- worldserver.addFreshEntity(entitysilverfish);
|
||||
+ worldserver.addFreshEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
|
||||
entitysilverfish.spawnAnim();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
@@ -61,7 +65,7 @@
|
||||
}
|
||||
|
||||
if (worldserver.isEmpty(blockposition2) && iblockdata.canPlace(worldserver, blockposition2)) {
|
||||
- worldserver.setTypeAndData(blockposition2, iblockdata, 2);
|
||||
if (worldserver.isEmptyBlock(blockposition2) && iblockdata.canSurvive(worldserver, blockposition2)) {
|
||||
- worldserver.setBlock(blockposition2, iblockdata, 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata, 2); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +86,7 @@
|
||||
|
||||
public boolean a(WorldServer worldserver, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
worldserver.a(blockposition, false);
|
||||
public boolean growMushroom(WorldServer worldserver, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
worldserver.removeBlock(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)) {
|
||||
if (((WorldGenFeatureConfigured) this.featureSupplier.get()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition)) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
if (i < 3 && random.nextInt(10) == 0) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockNetherWart.AGE, i + 1);
|
||||
- worldserver.setTypeAndData(blockposition, iblockdata, 2);
|
||||
iblockdata = (IBlockData) iblockdata.setValue(BlockNetherWart.AGE, i + 1);
|
||||
- worldserver.setBlock(blockposition, iblockdata, 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
--- a/net/minecraft/world/level/block/BlockNote.java
|
||||
+++ b/net/minecraft/world/level/block/BlockNote.java
|
||||
@@ -49,7 +49,8 @@
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
if (flag1 != (Boolean) iblockdata.get(BlockNote.POWERED)) {
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
|
||||
if (flag1) {
|
||||
- this.play(world, blockposition);
|
||||
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
||||
+ iblockdata = world.getType(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
||||
- this.playNote(world, blockposition);
|
||||
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
|
||||
+ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
||||
}
|
||||
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockNote.POWERED, flag1), 3);
|
||||
@@ -57,9 +58,14 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
|
||||
@@ -56,9 +57,14 @@
|
||||
|
||||
}
|
||||
|
||||
- private void play(World world, BlockPosition blockposition) {
|
||||
+ private void play(World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
|
||||
if (world.getType(blockposition.up()).isAir()) {
|
||||
- world.playBlockAction(blockposition, this, 0, 0);
|
||||
- private void playNote(World world, BlockPosition blockposition) {
|
||||
+ private void playNote(World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
|
||||
if (world.getBlockState(blockposition.above()).isAir()) {
|
||||
- world.blockEvent(blockposition, this, 0, 0);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.get(BlockNote.INSTRUMENT), data.get(BlockNote.NOTE));
|
||||
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(BlockNote.INSTRUMENT), data.getValue(BlockNote.NOTE));
|
||||
+ if (!event.isCancelled()) {
|
||||
+ world.playBlockAction(blockposition, this, 0, 0);
|
||||
+ world.blockEvent(blockposition, this, 0, 0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,7 +77,7 @@
|
||||
@@ -70,7 +76,7 @@
|
||||
} else {
|
||||
iblockdata = (IBlockData) iblockdata.a((IBlockState) BlockNote.NOTE);
|
||||
world.setTypeAndData(blockposition, iblockdata, 3);
|
||||
- this.play(world, blockposition);
|
||||
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.a(StatisticList.TUNE_NOTEBLOCK);
|
||||
iblockdata = (IBlockData) iblockdata.cycle(BlockNote.NOTE);
|
||||
world.setBlock(blockposition, iblockdata, 3);
|
||||
- this.playNote(world, blockposition);
|
||||
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.awardStat(StatisticList.TUNE_NOTEBLOCK);
|
||||
return EnumInteractionResult.CONSUME;
|
||||
}
|
||||
@@ -80,7 +86,7 @@
|
||||
@@ -79,7 +85,7 @@
|
||||
@Override
|
||||
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
if (!world.isClientSide) {
|
||||
- this.play(world, blockposition);
|
||||
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.a(StatisticList.PLAY_NOTEBLOCK);
|
||||
- this.playNote(world, blockposition);
|
||||
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.awardStat(StatisticList.PLAY_NOTEBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockNylium.java
|
||||
+++ b/net/minecraft/world/level/block/BlockNylium.java
|
||||
@@ -31,6 +31,11 @@
|
||||
@@ -30,6 +30,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) {
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!canBeNylium(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.NETHERRACK.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.NETHERRACK.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeUpdate(blockposition, Blocks.NETHERRACK.getBlockData());
|
||||
worldserver.setBlockAndUpdate(blockposition, Blocks.NETHERRACK.defaultBlockState());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,20 +11,20 @@
|
||||
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.POWERED)) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.getValue(BlockObserver.POWERED)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.POWERED, false), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(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.POWERED, true), 2);
|
||||
worldserver.getBlockTickList().a(blockposition, this, 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockObserver.POWERED, true), 2);
|
||||
worldserver.scheduleTick(blockposition, (Block) this, 2);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,24 @@
|
||||
--- a/net/minecraft/world/level/block/BlockOre.java
|
||||
+++ b/net/minecraft/world/level/block/BlockOre.java
|
||||
@@ -25,6 +25,7 @@
|
||||
@@ -25,13 +25,20 @@
|
||||
@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.xpRange.a(worldserver.random);
|
||||
|
||||
@@ -32,6 +33,21 @@
|
||||
this.dropExperience(worldserver, blockposition, i);
|
||||
}
|
||||
}
|
||||
+ // */
|
||||
|
||||
}
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack);
|
||||
+ // CraftBukkit start - Delegated to getExpDrop
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
+ if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
+ int i = this.xpRange.a(worldserver.random);
|
||||
+
|
||||
+ if (i > 0) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
int i = this.xpRange.sample(worldserver.random);
|
||||
|
||||
if (i > 0) {
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ return i; // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
+ return 0; // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
@@ -23,7 +23,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return !iblockdata.canPlace(generatoraccess, blockposition) ? Blocks.AIR.getBlockData() : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return !iblockdata.canSurvive(generatoraccess, blockposition) ? Blocks.AIR.defaultBlockState() : super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit start
|
||||
+ if (!iblockdata.canPlace(generatoraccess, blockposition)) {
|
||||
+ if (!iblockdata.canSurvive(generatoraccess, blockposition)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) {
|
||||
+ return Blocks.AIR.getBlockData();
|
||||
+ return Blocks.AIR.defaultBlockState();
|
||||
+ }
|
||||
+ }
|
||||
+ return super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ return super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -14,21 +14,21 @@
|
||||
@@ -58,7 +62,8 @@
|
||||
}
|
||||
|
||||
if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
|
||||
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false);
|
||||
if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
|
||||
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.above(), EnumMobSpawn.STRUCTURE, false, false);
|
||||
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
|
||||
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.above(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
|
||||
if (entity != null) {
|
||||
entity.resetPortalCooldown();
|
||||
entity.setPortalCooldown();
|
||||
@@ -80,6 +85,10 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions()) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
entity.d(blockposition);
|
||||
entity.handleInsidePortal(blockposition);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
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);
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition) || this.findPoweredRailSignal(world, blockposition, iblockdata, true, 0) || this.findPoweredRailSignal(world, blockposition, iblockdata, false, 0);
|
||||
|
||||
if (flag1 != flag) {
|
||||
+ // CraftBukkit start
|
||||
@@ -20,6 +20,6 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockPoweredRail.POWERED, flag1), 3);
|
||||
world.applyPhysics(blockposition.down(), this);
|
||||
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).b()) {
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockPoweredRail.POWERED, flag1), 3);
|
||||
world.updateNeighborsAt(blockposition.below(), this);
|
||||
if (((BlockPropertyTrackPosition) iblockdata.getValue(BlockPoweredRail.SHAPE)).isAscending()) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+
|
||||
public abstract class BlockPressurePlateAbstract extends Block {
|
||||
|
||||
protected static final VoxelShape PRESSED_AABB = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
protected static final VoxelShape PRESSED_AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
@@ -81,6 +83,19 @@
|
||||
boolean flag = i > 0;
|
||||
boolean flag1 = j > 0;
|
||||
@@ -27,5 +27,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i != j) {
|
||||
IBlockData iblockdata1 = this.a(iblockdata, j);
|
||||
IBlockData iblockdata1 = this.setSignalForState(iblockdata, j);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
+ if (this.getPower(world.getType(blockposition)) == 0) {
|
||||
+ if (this.getSignalForState(world.getBlockState(blockposition)) == 0) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
@@ -33,6 +33,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!entity.isIgnoreBlockTrigger()) {
|
||||
if (!entity.isIgnoringBlockTriggers()) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
@@ -27,7 +29,31 @@
|
||||
|
||||
@Override
|
||||
protected int b(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.a(blockposition)).size(), this.maxWeight);
|
||||
protected int getSignalStrength(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).size(), this.maxWeight);
|
||||
+ // CraftBukkit start
|
||||
+ // int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
||||
+ // int i = Math.min(world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).size(), this.maxWeight);
|
||||
+ int i = 0;
|
||||
+ java.util.Iterator iterator = world.a(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.a(blockposition)).iterator();
|
||||
+ java.util.Iterator iterator = world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -18,57 +18,57 @@
|
||||
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator
|
||||
if (shapedetector_shapedetectorcollection != null) {
|
||||
for (i = 0; i < this.getSnowmanShape().b(); ++i) {
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0);
|
||||
for (i = 0; i < this.getOrCreateSnowGolemFull().getHeight(); ++i) {
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.getBlock(0, i, 0);
|
||||
|
||||
- world.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2);
|
||||
- world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a()));
|
||||
+ blockList.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
|
||||
+ // world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a())); // CraftBukkit
|
||||
- world.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2);
|
||||
- world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState()));
|
||||
+ blockList.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
|
||||
+ // world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState())); // CraftBukkit
|
||||
}
|
||||
|
||||
EntitySnowman entitysnowman = (EntitySnowman) EntityTypes.SNOW_GOLEM.a(world);
|
||||
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition();
|
||||
EntitySnowman entitysnowman = (EntitySnowman) EntityTypes.SNOW_GOLEM.create(world);
|
||||
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.getBlock(0, 2, 0).getPos();
|
||||
|
||||
entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entitysnowman);
|
||||
entitysnowman.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addFreshEntity(entitysnowman);
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
|
||||
+ if (!world.addFreshEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (BlockPosition pos : blockList.getBlocks()) {
|
||||
+ world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos)));
|
||||
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
|
||||
+ }
|
||||
+ blockList.updateList();
|
||||
+ // CraftBukkit end
|
||||
iterator = world.a(EntityPlayer.class, entitysnowman.getBoundingBox().g(5.0D)).iterator();
|
||||
iterator = world.getEntitiesOfClass(EntityPlayer.class, entitysnowman.getBoundingBox().inflate(5.0D)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -96,8 +110,8 @@
|
||||
for (int k = 0; k < this.getIronGolemShape().b(); ++k) {
|
||||
ShapeDetectorBlock shapedetectorblock2 = shapedetector_shapedetectorcollection.a(i, k, 0);
|
||||
for (int k = 0; k < this.getOrCreateIronGolemFull().getHeight(); ++k) {
|
||||
ShapeDetectorBlock shapedetectorblock2 = shapedetector_shapedetectorcollection.getBlock(i, k, 0);
|
||||
|
||||
- world.setTypeAndData(shapedetectorblock2.getPosition(), Blocks.AIR.getBlockData(), 2);
|
||||
- world.triggerEffect(2001, shapedetectorblock2.getPosition(), Block.getCombinedId(shapedetectorblock2.a()));
|
||||
+ blockList.setTypeAndData(shapedetectorblock2.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
|
||||
+ // world.triggerEffect(2001, shapedetectorblock2.getPosition(), Block.getCombinedId(shapedetectorblock2.a())); // CraftBukkit
|
||||
- world.setBlock(shapedetectorblock2.getPos(), Blocks.AIR.defaultBlockState(), 2);
|
||||
- world.levelEvent(2001, shapedetectorblock2.getPos(), Block.getId(shapedetectorblock2.getState()));
|
||||
+ blockList.setBlock(shapedetectorblock2.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
|
||||
+ // world.levelEvent(2001, shapedetectorblock2.getPos(), Block.getId(shapedetectorblock2.getState())); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +120,15 @@
|
||||
|
||||
entityirongolem.setPlayerCreated(true);
|
||||
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entityirongolem);
|
||||
entityirongolem.moveTo((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addFreshEntity(entityirongolem);
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
|
||||
+ if (!world.addFreshEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (BlockPosition pos : blockList.getBlocks()) {
|
||||
+ world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos)));
|
||||
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
|
||||
+ }
|
||||
+ blockList.updateList();
|
||||
+ // CraftBukkit end
|
||||
iterator = world.a(EntityPlayer.class, entityirongolem.getBoundingBox().g(5.0D)).iterator();
|
||||
iterator = world.getEntitiesOfClass(EntityPlayer.class, entityirongolem.getBoundingBox().inflate(5.0D)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneComparator.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneComparator.java
|
||||
@@ -28,6 +28,8 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
@@ -26,6 +26,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.ticks.TickListPriority;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.MODE_COMPARATOR;
|
||||
@@ -99,7 +101,8 @@
|
||||
@@ -97,7 +99,8 @@
|
||||
|
||||
@Nullable
|
||||
private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) {
|
||||
- List<EntityItemFrame> list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (entityitemframe) -> {
|
||||
private EntityItemFrame getItemFrame(World world, EnumDirection enumdirection, BlockPosition blockposition) {
|
||||
- List<EntityItemFrame> list = world.getEntitiesOfClass(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (entityitemframe) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ List<EntityItemFrame> list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (java.util.function.Predicate<EntityItemFrame>) (entityitemframe) -> {
|
||||
+ List<EntityItemFrame> list = world.getEntitiesOfClass(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (java.util.function.Predicate<EntityItemFrame>) (entityitemframe) -> {
|
||||
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
|
||||
});
|
||||
|
||||
@@ -154,8 +157,18 @@
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.POWERED);
|
||||
@@ -152,8 +155,18 @@
|
||||
boolean flag1 = (Boolean) iblockdata.getValue(BlockRedstoneComparator.POWERED);
|
||||
|
||||
if (flag1 && !flag) {
|
||||
+ // CraftBukkit start
|
||||
@@ -28,13 +28,13 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.POWERED, false), 2);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(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.POWERED, true), 2);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneComparator.POWERED, true), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneLamp.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneLamp.java
|
||||
@@ -12,6 +12,8 @@
|
||||
@@ -11,6 +11,8 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
||||
import net.minecraft.world.level.block.state.properties.IBlockState;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockRedstoneLamp extends Block {
|
||||
|
||||
public static final BlockStateBoolean LIT = BlockRedstoneTorch.LIT;
|
||||
@@ -36,6 +38,11 @@
|
||||
@@ -35,6 +37,11 @@
|
||||
if (flag1) {
|
||||
world.getBlockTickList().a(blockposition, this, 4);
|
||||
world.scheduleTick(blockposition, (Block) this, 4);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.LIT), 2);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockRedstoneLamp.LIT), 2);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +53,11 @@
|
||||
@@ -45,6 +52,11 @@
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneLamp.LIT) && !worldserver.isBlockIndirectlyPowered(blockposition)) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneLamp.LIT) && !worldserver.hasNeighborSignal(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.LIT), 2);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockRedstoneLamp.LIT), 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@
|
||||
+ 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
|
||||
+ interact(world.getBlockState(blockposition), world, blockposition, entity); // add entity
|
||||
+ super.stepOn(world, blockposition, iblockdata, entity);
|
||||
+ }
|
||||
+ } else {
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ interact(world.getType(blockposition), world, blockposition, entity); // add entity
|
||||
+ interact(world.getBlockState(blockposition), world, blockposition, entity); // add entity
|
||||
+ super.stepOn(world, blockposition, iblockdata, entity);
|
||||
+ }
|
||||
+ }
|
||||
@@ -48,62 +48,58 @@
|
||||
@Override
|
||||
@@ -47,7 +68,7 @@
|
||||
if (world.isClientSide) {
|
||||
playEffect(world, blockposition);
|
||||
spawnParticles(world, blockposition);
|
||||
} else {
|
||||
- interact(iblockdata, world, blockposition);
|
||||
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
}
|
||||
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -55,9 +76,14 @@
|
||||
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).b() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS;
|
||||
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
- 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.LIT)) {
|
||||
spawnParticles(world, blockposition);
|
||||
if (!(Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.set(BlockRedstoneOre.LIT, true)).isCancelled()) {
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata.setValue(BlockRedstoneOre.LIT, true)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.LIT, true), 3);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(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.LIT)) {
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.set(BlockRedstoneOre.LIT, false)).isCancelled()) {
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.setValue(BlockRedstoneOre.LIT, false)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.LIT, false), 3);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, false), 3);
|
||||
}
|
||||
|
||||
@@ -79,12 +110,25 @@
|
||||
@@ -79,12 +110,20 @@
|
||||
@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 = 1 + worldserver.random.nextInt(5);
|
||||
|
||||
this.dropExperience(worldserver, blockposition, i);
|
||||
}
|
||||
+ // */
|
||||
+
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack);
|
||||
+ // CraftBukkit start - Delegated to getExpDrop
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
|
||||
+ if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
+ int i = 1 + worldserver.random.nextInt(5);
|
||||
+
|
||||
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
int i = 1 + worldserver.random.nextInt(5);
|
||||
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
+ }
|
||||
}
|
||||
|
||||
+ return 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.plugin.PluginManager manager = worldserver.getCraftServer().getPluginManager();
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int oldCurrent = ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
||||
+ int oldCurrent = ((Boolean) iblockdata.getValue(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
||||
+
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||
+ // CraftBukkit end
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneTorch.LIT)) {
|
||||
if (flag) {
|
||||
+ // CraftBukkit start
|
||||
+ if (oldCurrent != 0) {
|
||||
@@ -31,13 +31,13 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, false), 3);
|
||||
if (a(worldserver, blockposition, true)) {
|
||||
worldserver.triggerEffect(1502, blockposition, 0);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneTorch.LIT, false), 3);
|
||||
if (isToggledTooFrequently(worldserver, blockposition, true)) {
|
||||
worldserver.levelEvent(1502, blockposition, 0);
|
||||
@@ -86,6 +104,15 @@
|
||||
}
|
||||
}
|
||||
} else if (!flag && !a(worldserver, blockposition, false)) {
|
||||
} else if (!flag && !isToggledTooFrequently(worldserver, blockposition, false)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (oldCurrent != 15) {
|
||||
+ event.setNewCurrent(15);
|
||||
@@ -47,6 +47,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, true), 3);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneTorch.LIT, true), 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
|
||||
@@ -38,6 +38,8 @@
|
||||
@@ -37,6 +37,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -9,22 +9,13 @@
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
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);
|
||||
@@ -257,7 +259,16 @@
|
||||
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = this.calculateTargetStrength(world, blockposition);
|
||||
|
||||
- if ((Integer) iblockdata.get(BlockRedstoneWire.POWER) != i) {
|
||||
- if ((Integer) iblockdata.getValue(BlockRedstoneWire.POWER) != i) {
|
||||
+ // CraftBukkit start
|
||||
+ int oldPower = (Integer) iblockdata.get(BlockRedstoneWire.POWER);
|
||||
+ int oldPower = (Integer) iblockdata.getValue(BlockRedstoneWire.POWER);
|
||||
+ if (oldPower != i) {
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -33,6 +24,6 @@
|
||||
+ }
|
||||
+ if (oldPower != i) {
|
||||
+ // CraftBukkit end
|
||||
if (world.getType(blockposition) == iblockdata) {
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2);
|
||||
if (world.getBlockState(blockposition) == iblockdata) {
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneWire.POWER, i), 2);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockReed.java
|
||||
+++ b/net/minecraft/world/level/block/BlockReed.java
|
||||
@@ -57,7 +57,7 @@
|
||||
int j = (Integer) iblockdata.get(BlockReed.AGE);
|
||||
int j = (Integer) iblockdata.getValue(BlockReed.AGE);
|
||||
|
||||
if (j == 15) {
|
||||
- worldserver.setTypeUpdate(blockposition.up(), this.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition.up(), this.getBlockData()); // CraftBukkit
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, 0), 4);
|
||||
- worldserver.setBlockAndUpdate(blockposition.above(), this.defaultBlockState());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition.above(), this.defaultBlockState()); // CraftBukkit
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockReed.AGE, 0), 4);
|
||||
} else {
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, j + 1), 4);
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockReed.AGE, j + 1), 4);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSapling.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSapling.java
|
||||
@@ -15,12 +15,20 @@
|
||||
@@ -14,12 +14,20 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
|
||||
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);
|
||||
protected static final VoxelShape SHAPE = Block.box(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);
|
||||
@@ -36,7 +44,30 @@
|
||||
@@ -35,7 +43,30 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (worldserver.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9 && random.nextInt(7) == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = true;
|
||||
+ // CraftBukkit end
|
||||
this.grow(worldserver, blockposition, iblockdata, random);
|
||||
this.advanceTree(worldserver, blockposition, iblockdata, random);
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = false;
|
||||
+ if (worldserver.capturedBlockStates.size() > 0) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/BlockScaffolding.java
|
||||
+++ b/net/minecraft/world/level/block/BlockScaffolding.java
|
||||
@@ -96,7 +96,7 @@
|
||||
int i = a((IBlockAccess) worldserver, blockposition);
|
||||
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.DISTANCE, i)).set(BlockScaffolding.BOTTOM, this.a(worldserver, blockposition, i));
|
||||
int i = getDistance(worldserver, blockposition);
|
||||
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.setValue(BlockScaffolding.DISTANCE, i)).setValue(BlockScaffolding.BOTTOM, this.isBottom(worldserver, blockposition, i));
|
||||
|
||||
- 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)));
|
||||
- if ((Integer) iblockdata1.getValue(BlockScaffolding.DISTANCE) == 7) {
|
||||
+ if ((Integer) iblockdata1.getValue(BlockScaffolding.DISTANCE) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit - BlockFadeEvent
|
||||
if ((Integer) iblockdata.getValue(BlockScaffolding.DISTANCE) == 7) {
|
||||
worldserver.addFreshEntity(new EntityFallingBlock(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.setValue(BlockScaffolding.WATERLOGGED, false)));
|
||||
} else {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSnow.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSnow.java
|
||||
@@ -87,6 +87,11 @@
|
||||
@@ -86,6 +86,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
c(iblockdata, (World) worldserver, blockposition);
|
||||
worldserver.a(blockposition, false);
|
||||
dropResources(iblockdata, worldserver, blockposition);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
public static final BlockStateInteger MOISTURE = BlockProperties.MOISTURE;
|
||||
@@ -82,26 +87,49 @@
|
||||
|
||||
if (!a((IWorldReader) worldserver, blockposition) && !worldserver.isRainingAt(blockposition.up())) {
|
||||
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
|
||||
if (i > 0) {
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit
|
||||
} else if (!a((IBlockAccess) worldserver, blockposition)) {
|
||||
fade(iblockdata, worldserver, blockposition);
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, i - 1), 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit
|
||||
} else if (!isUnderCrops(worldserver, blockposition)) {
|
||||
turnToDirt(iblockdata, worldserver, blockposition);
|
||||
}
|
||||
} else if (i < 7) {
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); // CraftBukkit
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, 7), 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, 7), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@
|
||||
@Override
|
||||
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) {
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
|
||||
+ // CraftBukkit start - Interact soil
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
@@ -45,23 +45,23 @@
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
fade(iblockdata, world, blockposition);
|
||||
turnToDirt(iblockdata, world, blockposition);
|
||||
}
|
||||
|
||||
- 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) {
|
||||
public static void turnToDirt(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeUpdate(blockposition, a(iblockdata, Blocks.DIRT.getBlockData(), world, blockposition));
|
||||
world.setBlockAndUpdate(blockposition, pushEntitiesUp(iblockdata, Blocks.DIRT.defaultBlockState(), world, blockposition));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSponge.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSponge.java
|
||||
@@ -15,6 +15,13 @@
|
||||
@@ -14,6 +14,13 @@
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public class BlockSponge extends Block {
|
||||
|
||||
public static final int MAX_DEPTH = 6;
|
||||
@@ -50,6 +57,7 @@
|
||||
@@ -49,6 +56,7 @@
|
||||
|
||||
queue.add(new Tuple<>(blockposition, 0));
|
||||
int i = 0;
|
||||
@@ -22,46 +22,46 @@
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
Tuple<BlockPosition, Integer> tuple = (Tuple) queue.poll();
|
||||
@@ -61,27 +69,31 @@
|
||||
@@ -60,27 +68,31 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
EnumDirection enumdirection = aenumdirection[l];
|
||||
BlockPosition blockposition2 = blockposition1.shift(enumdirection);
|
||||
- IBlockData iblockdata = world.getType(blockposition2);
|
||||
- Fluid fluid = world.getFluid(blockposition2);
|
||||
BlockPosition blockposition2 = blockposition1.relative(enumdirection);
|
||||
- IBlockData iblockdata = world.getBlockState(blockposition2);
|
||||
- Fluid fluid = world.getFluidState(blockposition2);
|
||||
+ // CraftBukkit start
|
||||
+ IBlockData iblockdata = blockList.getType(blockposition2);
|
||||
+ Fluid fluid = blockList.getFluid(blockposition2);
|
||||
+ IBlockData iblockdata = blockList.getBlockState(blockposition2);
|
||||
+ Fluid fluid = blockList.getFluidState(blockposition2);
|
||||
+ // CraftBukkit end
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
if (fluid.a((Tag) TagsFluid.WATER)) {
|
||||
- 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
|
||||
if (fluid.is((Tag) TagsFluid.WATER)) {
|
||||
- if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(world, blockposition2, iblockdata).isEmpty()) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(blockList, blockposition2, iblockdata).isEmpty()) { // CraftBukkit
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
}
|
||||
} else if (iblockdata.getBlock() instanceof BlockFluids) {
|
||||
- world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
|
||||
+ blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); // CraftBukkit
|
||||
- world.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ blockList.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
}
|
||||
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||
- TileEntity tileentity = iblockdata.isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
- TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null;
|
||||
+ // CraftBukkit start
|
||||
+ // TileEntity tileentity = iblockdata.isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
+ // TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null;
|
||||
|
||||
- a(iblockdata, (GeneratorAccess) world, blockposition2, tileentity);
|
||||
- world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
|
||||
+ // a(iblockdata, (GeneratorAccess) world, blockposition2, tileentity);
|
||||
+ blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
|
||||
- dropResources(iblockdata, world, blockposition2, tileentity);
|
||||
- world.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ // dropResources(iblockdata, world, blockposition2, tileentity);
|
||||
+ blockList.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ // CraftBukkit end
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
@@ -94,6 +106,39 @@
|
||||
@@ -93,6 +105,39 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -79,22 +79,22 @@
|
||||
+
|
||||
+ for (CraftBlockState block : blocks) {
|
||||
+ BlockPosition blockposition2 = block.getPosition();
|
||||
+ IBlockData iblockdata = world.getType(blockposition2);
|
||||
+ Fluid fluid = world.getFluid(blockposition2);
|
||||
+ IBlockData iblockdata = world.getBlockState(blockposition2);
|
||||
+ Fluid fluid = world.getFluidState(blockposition2);
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+
|
||||
+ if (fluid.a(TagsFluid.WATER)) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata).isEmpty()) {
|
||||
+ if (fluid.is(TagsFluid.WATER)) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(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.isTileEntity() ? world.getTileEntity(blockposition2) : null;
|
||||
+ TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null;
|
||||
+
|
||||
+ a(iblockdata, world, blockposition2, tileentity);
|
||||
+ dropResources(iblockdata, world, blockposition2, tileentity);
|
||||
+ }
|
||||
+ }
|
||||
+ world.setTypeAndData(blockposition2, block.getHandle(), block.getFlag());
|
||||
+ world.setBlock(blockposition2, block.getHandle(), block.getFlag());
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -12,30 +12,30 @@
|
||||
@@ -57,14 +59,18 @@
|
||||
|
||||
if (i < 7) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, i + 1);
|
||||
- worldserver.setTypeAndData(blockposition, iblockdata, 2);
|
||||
iblockdata = (IBlockData) iblockdata.setValue(BlockStem.AGE, i + 1);
|
||||
- worldserver.setBlock(blockposition, iblockdata, 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
|
||||
} else {
|
||||
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random);
|
||||
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1.down());
|
||||
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.getRandomDirection(random);
|
||||
BlockPosition blockposition1 = blockposition.relative(enumdirection);
|
||||
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1.below());
|
||||
|
||||
if (worldserver.getType(blockposition1).isAir() && (iblockdata1.a(Blocks.FARMLAND) || iblockdata1.a((Tag) TagsBlock.DIRT))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.fruit.getBlockData());
|
||||
if (worldserver.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is((Tag) TagsBlock.DIRT))) {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, this.fruit.defaultBlockState());
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.getBlockData())) {
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.defaultBlockState())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeUpdate(blockposition, (IBlockData) this.fruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
||||
worldserver.setBlockAndUpdate(blockposition, (IBlockData) this.fruit.getAttachedStem().defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection));
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
int i = Math.min(7, (Integer) iblockdata.getValue(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockStem.AGE, i);
|
||||
|
||||
- worldserver.setTypeAndData(blockposition, iblockdata1, 2);
|
||||
- worldserver.setBlock(blockposition, iblockdata1, 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit
|
||||
if (i == 7) {
|
||||
iblockdata1.b(worldserver, blockposition, worldserver.random);
|
||||
iblockdata1.randomTick(worldserver, blockposition, worldserver.random);
|
||||
}
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
|
||||
private static final float HURT_SPEED_THRESHOLD = 0.003F;
|
||||
@@ -59,7 +67,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockSweetBerryBush.AGE);
|
||||
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
|
||||
|
||||
if (i < 3 && random.nextInt(5) == 0 && worldserver.getLightLevel(blockposition.up(), 0) >= 9) {
|
||||
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.AGE, i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.AGE, i + 1), 2); // CraftBukkit
|
||||
if (i < 3 && random.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1), 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,7 +81,9 @@
|
||||
double d1 = Math.abs(entity.locZ() - entity.zOld);
|
||||
double d1 = Math.abs(entity.getZ() - entity.zOld);
|
||||
|
||||
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
|
||||
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||
entity.damageEntity(DamageSource.SWEET_BERRY_BUSH, 1.0F);
|
||||
entity.hurt(DamageSource.SWEET_BERRY_BUSH, 1.0F);
|
||||
+ CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
}
|
||||
@@ -38,16 +38,16 @@
|
||||
} else if (i > 1) {
|
||||
int j = 1 + world.random.nextInt(2);
|
||||
|
||||
- a(world, blockposition, new ItemStack(Items.SWEET_BERRIES, j + (flag ? 1 : 0)));
|
||||
- popResource(world, blockposition, new ItemStack(Items.SWEET_BERRIES, j + (flag ? 1 : 0)));
|
||||
+ // CraftBukkit start
|
||||
+ PlayerHarvestBlockEvent event = CraftEventFactory.callPlayerHarvestBlockEvent(world, blockposition, entityhuman, Collections.singletonList(new ItemStack(Items.SWEET_BERRIES, j + (flag ? 1 : 0))));
|
||||
+ 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()) {
|
||||
+ a(world, blockposition, CraftItemStack.asNMSCopy(itemStack));
|
||||
+ popResource(world, blockposition, CraftItemStack.asNMSCopy(itemStack));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
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);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, 1), 2);
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTNT.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTNT.java
|
||||
@@ -121,6 +121,11 @@
|
||||
Entity entity = iprojectile.getShooter();
|
||||
Entity entity = iprojectile.getOwner();
|
||||
|
||||
if (iprojectile.isBurning() && iprojectile.a(world, blockposition)) {
|
||||
if (iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
|
||||
world.a(blockposition, false);
|
||||
explode(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
|
||||
world.removeBlock(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
@@ -92,6 +92,11 @@
|
||||
}
|
||||
|
||||
protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
protected static void preventCreativeDropFromBottomPart(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
BlockPropertyDoubleBlockHalf blockpropertydoubleblockhalf = (BlockPropertyDoubleBlockHalf) iblockdata.get(BlockTallPlant.HALF);
|
||||
BlockPropertyDoubleBlockHalf blockpropertydoubleblockhalf = (BlockPropertyDoubleBlockHalf) iblockdata.getValue(BlockTallPlant.HALF);
|
||||
|
||||
if (blockpropertydoubleblockhalf == BlockPropertyDoubleBlockHalf.UPPER) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
|
||||
@@ -29,6 +29,8 @@
|
||||
@@ -27,6 +27,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,23 +9,23 @@
|
||||
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateBoolean OPEN = BlockProperties.OPEN;
|
||||
@@ -117,6 +119,19 @@
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
|
||||
@@ -115,6 +117,19 @@
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition);
|
||||
|
||||
if (flag1 != (Boolean) iblockdata.get(BlockTrapdoor.POWERED)) {
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockTrapdoor.POWERED)) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+
|
||||
+ int power = bblock.getBlockPower();
|
||||
+ int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
|
||||
+ int oldPower = (Boolean) iblockdata.getValue(OPEN) ? 15 : 0;
|
||||
+
|
||||
+ if (oldPower == 0 ^ power == 0 || block.getBlockData().isPowerSource()) {
|
||||
+ if (oldPower == 0 ^ power == 0 || block.defaultBlockState().isSignalSource()) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if ((Boolean) iblockdata.get(BlockTrapdoor.OPEN) != flag1) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockTrapdoor.OPEN, flag1);
|
||||
this.a((EntityHuman) null, world, blockposition, flag1);
|
||||
if ((Boolean) iblockdata.getValue(BlockTrapdoor.OPEN) != flag1) {
|
||||
iblockdata = (IBlockData) iblockdata.setValue(BlockTrapdoor.OPEN, flag1);
|
||||
this.playSound((EntityHuman) null, world, blockposition, flag1);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Call interact even when triggering connected tripwire
|
||||
+ if (flag != flag1 && flag1 && (Boolean)iblockdata.get(ATTACHED)) {
|
||||
+ if (flag != flag1 && flag1 && (Boolean)iblockdata.getValue(ATTACHED)) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
|
||||
+ org.bukkit.block.Block block = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -48,5 +48,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1 != flag) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockTripwire.POWERED, flag1);
|
||||
world.setTypeAndData(blockposition, iblockdata, 3);
|
||||
iblockdata = (IBlockData) iblockdata.setValue(BlockTripwire.POWERED, flag1);
|
||||
world.setBlock(blockposition, iblockdata, 3);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -160,6 +162,17 @@
|
||||
this.a(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
this.playSound(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -24,6 +24,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.a(world, blockposition, flag4, flag5, flag2, flag3);
|
||||
this.playSound(world, blockposition, flag4, flag5, flag2, flag3);
|
||||
if (!flag) {
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata3.set(BlockTripwireHook.FACING, enumdirection), 3);
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata3.setValue(BlockTripwireHook.FACING, enumdirection), 3);
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
public static final int MAX_HATCH_LEVEL = 2;
|
||||
@@ -62,6 +68,19 @@
|
||||
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)) {
|
||||
private void destroyEgg(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, int i) {
|
||||
if (this.canDestroyEgg(world, entity)) {
|
||||
if (!world.isClientSide && world.random.nextInt(i) == 0 && iblockdata.is(Blocks.TURTLE_EGG)) {
|
||||
+ // CraftBukkit start - Step on eggs
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
@@ -30,36 +30,36 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(world, blockposition, iblockdata);
|
||||
this.decreaseEggs(world, blockposition, iblockdata);
|
||||
}
|
||||
|
||||
@@ -87,9 +106,19 @@
|
||||
int i = (Integer) iblockdata.get(BlockTurtleEgg.HATCH);
|
||||
int i = (Integer) iblockdata.getValue(BlockTurtleEgg.HATCH);
|
||||
|
||||
if (i < 2) {
|
||||
+ // CraftBukkit start - Call BlockGrowEvent
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata.set(BlockTurtleEgg.HATCH, i + 1), 2)) {
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata.setValue(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
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockTurtleEgg.HATCH, i + 1), 2);
|
||||
+ // worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockTurtleEgg.HATCH, i + 1), 2); // CraftBukkit - handled above
|
||||
} else {
|
||||
+ // CraftBukkit start - Call BlockFadeEvent
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
worldserver.a(blockposition, false);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
|
||||
@@ -100,7 +129,7 @@
|
||||
entityturtle.setAgeRaw(-24000);
|
||||
entityturtle.setAge(-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);
|
||||
- worldserver.addEntity(entityturtle);
|
||||
+ worldserver.addEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
|
||||
entityturtle.moveTo((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
|
||||
- worldserver.addFreshEntity(entityturtle);
|
||||
+ worldserver.addFreshEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,49 +10,49 @@
|
||||
|
||||
public static final BlockStateBoolean UP = BlockSprawling.UP;
|
||||
@@ -196,20 +198,24 @@
|
||||
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
|
||||
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
|
||||
BlockPosition blockposition3 = blockposition2.relative(enumdirection1);
|
||||
BlockPosition blockposition4 = blockposition2.relative(enumdirection2);
|
||||
|
||||
+ // CraftBukkit start - Call BlockSpreadEvent
|
||||
+ BlockPosition source = blockposition;
|
||||
+
|
||||
if (flag && a((IBlockAccess) worldserver, blockposition3, enumdirection1)) {
|
||||
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
|
||||
} else if (flag1 && a((IBlockAccess) worldserver, blockposition4, enumdirection2)) {
|
||||
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
|
||||
if (flag && isAcceptableNeighbour(worldserver, blockposition3, enumdirection1)) {
|
||||
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
|
||||
} else if (flag1 && isAcceptableNeighbour(worldserver, blockposition4, enumdirection2)) {
|
||||
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
|
||||
} else {
|
||||
EnumDirection enumdirection3 = enumdirection.opposite();
|
||||
EnumDirection enumdirection3 = enumdirection.getOpposite();
|
||||
|
||||
if (flag && worldserver.isEmpty(blockposition3) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection1), enumdirection3)) {
|
||||
- worldserver.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
|
||||
} 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) 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);
|
||||
if (flag && worldserver.isEmptyBlock(blockposition3) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection1), enumdirection3)) {
|
||||
- worldserver.setBlock(blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
|
||||
} else if (flag1 && worldserver.isEmptyBlock(blockposition4) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection2), enumdirection3)) {
|
||||
- worldserver.setBlock(blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
|
||||
} else if ((double) random.nextFloat() < 0.05D && isAcceptableNeighbour(worldserver, blockposition2.above(), EnumDirection.UP)) {
|
||||
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) {
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
|
||||
} else if (isAcceptableNeighbour(worldserver, blockposition2, enumdirection)) {
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(getPropertyForFace(enumdirection), true), 2);
|
||||
@@ -239,7 +245,7 @@
|
||||
}
|
||||
|
||||
if (this.canSpread(iblockdata2)) {
|
||||
- worldserver.setTypeAndData(blockposition1, iblockdata2, 2);
|
||||
if (this.hasHorizontalConnection(iblockdata2)) {
|
||||
- worldserver.setBlock(blockposition1, iblockdata2, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -254,7 +260,7 @@
|
||||
IBlockData iblockdata4 = this.a(iblockdata, iblockdata3, random);
|
||||
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, random);
|
||||
|
||||
if (iblockdata3 != iblockdata4 && this.canSpread(iblockdata4)) {
|
||||
- worldserver.setTypeAndData(blockposition2, iblockdata4, 2);
|
||||
if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {
|
||||
- worldserver.setBlock(blockposition2, iblockdata4, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockWaterLily.java
|
||||
@@ -25,7 +25,7 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
super.a(iblockdata, world, blockposition, entity);
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
- if (world instanceof WorldServer && entity instanceof EntityBoat) {
|
||||
+ if (world instanceof WorldServer && entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
|
||||
world.a(new BlockPosition(blockposition), true, entity);
|
||||
+ if (world instanceof WorldServer && entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
|
||||
world.destroyBlock(new BlockPosition(blockposition), true, entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
if (!entityliving.isInvulnerable(DamageSource.WITHER)) {
|
||||
if (!entityliving.isInvulnerableTo(DamageSource.WITHER)) {
|
||||
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40));
|
||||
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -15,50 +15,50 @@
|
||||
@@ -50,6 +55,7 @@
|
||||
}
|
||||
|
||||
public static void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
|
||||
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
|
||||
+ if (world.captureBlockStates) return; // CraftBukkit
|
||||
if (!world.isClientSide) {
|
||||
IBlockData iblockdata = tileentityskull.getBlock();
|
||||
boolean flag = iblockdata.a(Blocks.WITHER_SKELETON_SKULL) || iblockdata.a(Blocks.WITHER_SKELETON_WALL_SKULL);
|
||||
IBlockData iblockdata = tileentityskull.getBlockState();
|
||||
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
|
||||
@@ -59,12 +65,14 @@
|
||||
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition);
|
||||
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.find(world, blockposition);
|
||||
|
||||
if (shapedetector_shapedetectorcollection != null) {
|
||||
+ // CraftBukkit start - Use BlockStateListPopulator
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world);
|
||||
for (int i = 0; i < shapedetector.c(); ++i) {
|
||||
for (int j = 0; j < shapedetector.b(); ++j) {
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(i, j, 0);
|
||||
for (int i = 0; i < shapedetector.getWidth(); ++i) {
|
||||
for (int j = 0; j < shapedetector.getHeight(); ++j) {
|
||||
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.getBlock(i, j, 0);
|
||||
|
||||
- world.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2);
|
||||
- world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a()));
|
||||
+ blockList.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
|
||||
+ // world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a())); // CraftBukkit
|
||||
- world.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2);
|
||||
- world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState()));
|
||||
+ blockList.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
|
||||
+ // world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState())); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.yBodyRot = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
|
||||
entitywither.beginSpawnSequence();
|
||||
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
|
||||
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
|
||||
entitywither.makeInvulnerable();
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
+ if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (BlockPosition pos : blockList.getBlocks()) {
|
||||
+ world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos)));
|
||||
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
|
||||
+ }
|
||||
+ blockList.updateList();
|
||||
+ // CraftBukkit end
|
||||
Iterator iterator = world.a(EntityPlayer.class, entitywither.getBoundingBox().g(50.0D)).iterator();
|
||||
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -82,7 +99,7 @@
|
||||
CriterionTriggers.SUMMONED_ENTITY.a(entityplayer, (Entity) entitywither);
|
||||
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
|
||||
}
|
||||
|
||||
- world.addEntity(entitywither);
|
||||
+ // world.addEntity(entitywither); // CraftBukkit - moved up
|
||||
- world.addFreshEntity(entitywither);
|
||||
+ // world.addFreshEntity(entitywither); // CraftBukkit - moved up
|
||||
|
||||
for (int k = 0; k < shapedetector.c(); ++k) {
|
||||
for (int l = 0; l < shapedetector.b(); ++l) {
|
||||
for (int k = 0; k < shapedetector.getWidth(); ++k) {
|
||||
for (int l = 0; l < shapedetector.getHeight(); ++l) {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
+++ 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);
|
||||
IBlockData iblockdata2 = (IBlockData) ((IBlockData) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == FluidTypes.WATER);
|
||||
|
||||
- worldserver.setTypeUpdate(blockposition1, iblockdata2);
|
||||
- worldserver.setBlockAndUpdate(blockposition1, iblockdata2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2); // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
+
|
||||
public interface CaveVines {
|
||||
|
||||
VoxelShape SHAPE = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
VoxelShape SHAPE = Block.box(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));
|
||||
- static EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ static EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if ((Boolean) iblockdata.getValue(CaveVines.BERRIES)) {
|
||||
- Block.popResource(world, blockposition, new ItemStack(Items.GLOW_BERRIES, 1));
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, (IBlockData) iblockdata.set(CaveVines.BERRIES, false)).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, (IBlockData) iblockdata.setValue(CaveVines.BERRIES, false)).isCancelled()) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+
|
||||
@@ -32,13 +32,13 @@
|
||||
+ 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));
|
||||
+ Block.popResource(world, blockposition, CraftItemStack.asNMSCopy(itemStack));
|
||||
+ }
|
||||
+ } else {
|
||||
+ Block.a(world, blockposition, new ItemStack(Items.GLOW_BERRIES, 1));
|
||||
+ Block.popResource(world, blockposition, new ItemStack(Items.GLOW_BERRIES, 1));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
float f = MathHelper.b(world.random, 0.8F, 1.2F);
|
||||
float f = MathHelper.randomBetween(world.random, 0.8F, 1.2F);
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.CAVE_VINES_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, f);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user