mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
Update to Minecraft 1.16.1
This commit is contained in:
parent
be6aaf046e
commit
7ea3c040bc
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Advancement.java
|
||||
+++ b/net/minecraft/server/Advancement.java
|
||||
@@ -27,6 +27,7 @@
|
||||
@@ -26,6 +26,7 @@
|
||||
private final String[][] requirements;
|
||||
private final Set<Advancement> children = Sets.newLinkedHashSet();
|
||||
private final IChatBaseComponent chatComponent;
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map<String, Criterion> map, String[][] astring) {
|
||||
this.key = minecraftkey;
|
||||
@@ -210,7 +211,7 @@
|
||||
@@ -209,7 +210,7 @@
|
||||
}
|
||||
|
||||
public Advancement b(MinecraftKey minecraftkey) {
|
||||
|
@ -1,23 +1,23 @@
|
||||
--- a/net/minecraft/server/AdvancementDataPlayer.java
|
||||
+++ b/net/minecraft/server/AdvancementDataPlayer.java
|
||||
@@ -160,7 +160,11 @@
|
||||
Advancement advancement = this.d.getAdvancementData().a((MinecraftKey) entry.getKey());
|
||||
@@ -163,7 +163,11 @@
|
||||
Advancement advancement = advancementdataworld.a((MinecraftKey) entry.getKey());
|
||||
|
||||
if (advancement == null) {
|
||||
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e);
|
||||
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.f);
|
||||
+ // CraftBukkit start
|
||||
+ if (entry.getKey().getNamespace().equals("minecraft")) {
|
||||
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e);
|
||||
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.f);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.a(advancement, (AdvancementProgress) entry.getValue());
|
||||
}
|
||||
@@ -275,6 +279,7 @@
|
||||
this.i.add(advancement);
|
||||
@@ -278,6 +282,7 @@
|
||||
this.j.add(advancement);
|
||||
flag = true;
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
+ this.player.world.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
advancement.d().a(this.player);
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean(GameRules.ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.d.getPlayerList().sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}));
|
||||
this.e.sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}), ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/ArgumentBlock.java
|
||||
+++ b/net/minecraft/server/ArgumentBlock.java
|
||||
@@ -41,7 +41,7 @@
|
||||
private static final Function<SuggestionsBuilder, CompletableFuture<Suggestions>> h = SuggestionsBuilder::buildFuture;
|
||||
@@ -43,7 +43,7 @@
|
||||
};
|
||||
private final StringReader i;
|
||||
private final boolean j;
|
||||
- private final Map<IBlockState<?>, Comparable<?>> k = Maps.newHashMap();
|
||||
@ -9,7 +9,7 @@
|
||||
private final Map<String, String> l = Maps.newHashMap();
|
||||
private MinecraftKey m = new MinecraftKey("");
|
||||
private BlockStateList<Block, IBlockData> n;
|
||||
@@ -217,7 +217,7 @@
|
||||
@@ -219,7 +219,7 @@
|
||||
Iterator iterator = iblockstate.getValues().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
if (t0 instanceof Integer) {
|
||||
suggestionsbuilder.suggest((Integer) t0);
|
||||
@@ -486,7 +486,7 @@
|
||||
@@ -488,7 +488,7 @@
|
||||
Optional<T> optional = iblockstate.b(s);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@ -27,12 +27,12 @@
|
||||
this.k.put(iblockstate, optional.get());
|
||||
} else {
|
||||
this.i.setCursor(i);
|
||||
@@ -520,7 +520,7 @@
|
||||
@@ -522,7 +522,7 @@
|
||||
private static <T extends Comparable<T>> void a(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
|
||||
stringbuilder.append(iblockstate.a());
|
||||
stringbuilder.append(iblockstate.getName());
|
||||
stringbuilder.append('=');
|
||||
- stringbuilder.append(iblockstate.a(comparable));
|
||||
+ stringbuilder.append(iblockstate.a((T) comparable)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public CompletableFuture<Suggestions> a(SuggestionsBuilder suggestionsbuilder) {
|
||||
public CompletableFuture<Suggestions> a(SuggestionsBuilder suggestionsbuilder, Tags<Block> tags) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/AttributeRanged.java
|
||||
+++ b/net/minecraft/server/AttributeRanged.java
|
||||
@@ -32,6 +32,8 @@
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
@Override
|
||||
public double a(double d0) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/server/BehaviorCareer.java
|
||||
+++ b/net/minecraft/server/BehaviorCareer.java
|
||||
@@ -1,6 +1,11 @@
|
||||
package net.minecraft.server;
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Optional;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftVillager;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@ -12,10 +12,19 @@
|
||||
|
||||
public class BehaviorCareer extends Behavior<EntityVillager> {
|
||||
|
||||
@@ -20,7 +25,14 @@
|
||||
IRegistry.VILLAGER_PROFESSION.d().filter((villagerprofession) -> {
|
||||
return villagerprofession.b() == villageplacetype;
|
||||
}).findFirst().ifPresent((villagerprofession) -> {
|
||||
@@ -19,7 +24,7 @@
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBehaviorController().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
|
||||
entityvillager.getBehaviorController().removeMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
|
||||
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
|
||||
|
||||
@@ -30,7 +35,14 @@
|
||||
return villagerprofession.b() == villageplacetype;
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
@ -25,6 +34,6 @@
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.a(worldserver);
|
||||
entityvillager.b(worldserver);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,70 +1,70 @@
|
||||
--- a/net/minecraft/server/BehaviorFarm.java
|
||||
+++ b/net/minecraft/server/BehaviorFarm.java
|
||||
@@ -79,8 +79,8 @@
|
||||
@@ -58,8 +58,8 @@
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
if (i > this.d && this.a != null) {
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.a)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.a), 0.5F, 1)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.a))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.a), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
if (i > this.c && this.farmBlock != null) {
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.farmBlock)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.farmBlock))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,7 +99,11 @@
|
||||
Block block1 = worldserver.getType(this.a.down()).getBlock();
|
||||
@@ -79,7 +79,11 @@
|
||||
Block block1 = worldserver.getType(this.farmBlock.down()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata) && this.c) {
|
||||
- worldserver.a(this.a, true, entityvillager);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.a, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ worldserver.a(this.a, true, entityvillager);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata)) {
|
||||
- worldserver.a(this.farmBlock, true, entityvillager);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.farmBlock, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ worldserver.a(this.farmBlock, true, entityvillager);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && this.b) {
|
||||
@@ -110,19 +114,28 @@
|
||||
boolean flag = false;
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.canPlant()) {
|
||||
@@ -90,19 +94,28 @@
|
||||
boolean flag = false;
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ Block planted = null;
|
||||
if (itemstack.getItem() == Items.WHEAT_SEEDS) {
|
||||
- worldserver.setTypeAndData(this.a, Blocks.WHEAT.getBlockData(), 3);
|
||||
+ planted = Blocks.WHEAT;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.POTATO) {
|
||||
- worldserver.setTypeAndData(this.a, Blocks.POTATOES.getBlockData(), 3);
|
||||
+ planted = Blocks.POTATOES;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.CARROT) {
|
||||
- worldserver.setTypeAndData(this.a, Blocks.CARROTS.getBlockData(), 3);
|
||||
+ planted = Blocks.CARROTS;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.BEETROOT_SEEDS) {
|
||||
- worldserver.setTypeAndData(this.a, Blocks.BEETROOTS.getBlockData(), 3);
|
||||
+ planted = Blocks.BEETROOTS;
|
||||
flag = true;
|
||||
}
|
||||
if (!itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ Block planted = null;
|
||||
if (itemstack.getItem() == Items.WHEAT_SEEDS) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.WHEAT.getBlockData(), 3);
|
||||
+ planted = Blocks.WHEAT;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.POTATO) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.POTATOES.getBlockData(), 3);
|
||||
+ planted = Blocks.POTATOES;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.CARROT) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.CARROTS.getBlockData(), 3);
|
||||
+ planted = Blocks.CARROTS;
|
||||
flag = true;
|
||||
} else if (itemstack.getItem() == Items.BEETROOT_SEEDS) {
|
||||
- worldserver.setTypeAndData(this.farmBlock, Blocks.BEETROOTS.getBlockData(), 3);
|
||||
+ planted = Blocks.BEETROOTS;
|
||||
flag = true;
|
||||
}
|
||||
+
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.a, planted.getBlockData()).isCancelled()) {
|
||||
+ worldserver.setTypeAndData(this.a, planted.getBlockData(), 3);
|
||||
+ } else {
|
||||
+ flag = false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.farmBlock, planted.getBlockData()).isCancelled()) {
|
||||
+ worldserver.setTypeAndData(this.farmBlock, planted.getBlockData(), 3);
|
||||
+ } else {
|
||||
+ flag = false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -141,8 +154,8 @@
|
||||
this.a = this.a(worldserver);
|
||||
if (this.a != null) {
|
||||
this.d = i + 20L;
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.a), 0.5F, 1)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.a)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.a), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.a))); // CraftBukkit - decompile error
|
||||
if (flag) {
|
||||
@@ -121,8 +134,8 @@
|
||||
this.farmBlock = this.a(worldserver);
|
||||
if (this.farmBlock != null) {
|
||||
this.c = i + 20L;
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.farmBlock)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.farmBlock), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.farmBlock))); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
+ }
|
||||
+ // CaftBukkit end
|
||||
((BlockDoor) block).setDoor(worldserver, blockposition, flag);
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition);
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
|
||||
|
||||
if (!behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).isPresent() && flag) {
|
||||
- behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BehaviorMakeLove.java
|
||||
+++ b/net/minecraft/server/BehaviorMakeLove.java
|
||||
@@ -100,6 +100,11 @@
|
||||
@@ -93,6 +93,11 @@
|
||||
|
||||
private Optional<EntityVillager> a(EntityVillager entityvillager, EntityVillager entityvillager1) {
|
||||
EntityVillager entityvillager2 = entityvillager.createChild(entityvillager1);
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
if (entityvillager2 == null) {
|
||||
return Optional.empty();
|
||||
@@ -108,7 +113,7 @@
|
||||
@@ -101,7 +106,7 @@
|
||||
entityvillager1.setAgeRaw(6000);
|
||||
entityvillager2.setAgeRaw(-24000);
|
||||
entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F);
|
||||
@ -21,9 +21,9 @@
|
||||
entityvillager.world.broadcastEntityEffect(entityvillager2, (byte) 12);
|
||||
return Optional.of(entityvillager2);
|
||||
}
|
||||
@@ -117,6 +122,6 @@
|
||||
@@ -110,6 +115,6 @@
|
||||
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition);
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
|
||||
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, (Object) globalpos);
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
|
||||
|
@ -25,6 +25,6 @@
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.a(worldserver);
|
||||
entityvillager.b(worldserver);
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,39 @@
|
||||
--- a/net/minecraft/server/BehaviorUtil.java
|
||||
+++ b/net/minecraft/server/BehaviorUtil.java
|
||||
@@ -31,7 +31,7 @@
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
public static void c(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entityliving1)));
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1))); // CraftBukkit - decompile error
|
||||
public static void a(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entityliving1, true)));
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void d(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
@@ -46,11 +46,12 @@
|
||||
BehaviorPositionEntity behaviorpositionentity = new BehaviorPositionEntity(entityliving1);
|
||||
MemoryTarget memorytarget = new MemoryTarget(behaviorpositionentity, f, i);
|
||||
private static void b(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -51,18 +51,19 @@
|
||||
public static void a(EntityLiving entityliving, Entity entity, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entity, false), f, i);
|
||||
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) behaviorpositionentity);
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(entity, true)));
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, behaviorpositionentity); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entity, true))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, ItemStack itemstack, EntityLiving entityliving1) {
|
||||
public static void a(EntityLiving entityliving, BlockPosition blockposition, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorTarget(blockposition), f, i);
|
||||
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(blockposition)));
|
||||
- entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) memorytarget);
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(blockposition))); // CraftBukkit - decompile error
|
||||
+ entityliving.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, memorytarget); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static void a(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
|
||||
double d0 = entityliving.getHeadY() - 0.30000001192092896D;
|
||||
EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX(), d0, entityliving.locZ(), itemstack);
|
||||
BlockPosition blockposition = new BlockPosition(entityliving1);
|
||||
@@ -66,7 +67,7 @@
|
||||
float f = 0.3F;
|
||||
@@ -76,7 +77,7 @@
|
||||
|
||||
public static SectionPosition a(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
int j = worldserver.b(sectionposition);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Block.java
|
||||
+++ b/net/minecraft/server/Block.java
|
||||
@@ -489,7 +489,13 @@
|
||||
@@ -217,7 +217,13 @@
|
||||
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
|
||||
|
||||
entityitem.defaultPickupDelay();
|
||||
@ -15,8 +15,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,6 +688,12 @@
|
||||
return "Block{" + IRegistry.BLOCK.getKey(this) + "}";
|
||||
@@ -344,6 +350,12 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -25,6 +25,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static enum EnumRandomOffset {
|
||||
public static final class a {
|
||||
|
||||
NONE, XZ, XYZ;
|
||||
private final IBlockData a;
|
||||
|
@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/server/BlockBamboo.java
|
||||
+++ b/net/minecraft/server/BlockBamboo.java
|
||||
@@ -159,14 +159,18 @@
|
||||
@@ -168,14 +168,18 @@
|
||||
BlockPosition blockposition1 = blockposition.down(2);
|
||||
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
|
||||
+ boolean shouldUpdateOthers = false; // CraftBukkit
|
||||
|
||||
if (i >= 1) {
|
||||
if (iblockdata1.getBlock() == Blocks.BAMBOO && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.getBlock() == Blocks.BAMBOO && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||
if (iblockdata1.a(Blocks.BAMBOO) && iblockdata1.get(BlockBamboo.e) != BlockPropertyBambooSize.NONE) {
|
||||
blockpropertybamboosize = BlockPropertyBambooSize.LARGE;
|
||||
if (iblockdata2.getBlock() == Blocks.BAMBOO) {
|
||||
if (iblockdata2.a(Blocks.BAMBOO)) {
|
||||
- world.setTypeAndData(blockposition.down(), (IBlockData) iblockdata1.set(BlockBamboo.e, BlockPropertyBambooSize.SMALL), 3);
|
||||
- world.setTypeAndData(blockposition1, (IBlockData) iblockdata2.set(BlockBamboo.e, BlockPropertyBambooSize.NONE), 3);
|
||||
+ // CraftBukkit start - moved down
|
||||
@ -21,8 +21,8 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -177,7 +181,14 @@
|
||||
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && iblockdata2.getBlock() != Blocks.BAMBOO ? 0 : 1;
|
||||
@@ -186,7 +190,14 @@
|
||||
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1;
|
||||
int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
|
||||
|
||||
- world.setTypeAndData(blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3);
|
||||
|
@ -1,54 +1,67 @@
|
||||
--- a/net/minecraft/server/BlockBed.java
|
||||
+++ b/net/minecraft/server/BlockBed.java
|
||||
@@ -43,7 +43,8 @@
|
||||
@@ -39,7 +39,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (world.worldProvider.canRespawn() && world.getBiome(blockposition) != Biomes.NETHER) {
|
||||
- if (!a(world)) {
|
||||
+ // CraftBukkit - moved world and biome check into EntityHuman
|
||||
+ if (true || world.worldProvider.canRespawn() && world.getBiome(blockposition) != Biomes.NETHER) {
|
||||
if ((Boolean) iblockdata.get(BlockBed.OCCUPIED)) {
|
||||
if (!this.a(world, blockposition)) {
|
||||
entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.occupied", new Object[0])), true);
|
||||
@@ -51,7 +52,16 @@
|
||||
+ if (false && !a(world)) {
|
||||
world.a(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ IBlockData finaliblockdata = iblockdata;
|
||||
+ BlockPosition finalblockposition = blockposition;
|
||||
+ // CraftBukkit end
|
||||
entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> {
|
||||
+ // CraftBukkit start - handling bed explosion from below here
|
||||
+ if (entityhuman_enumbedresult == EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE) {
|
||||
+ this.explodeBed(finaliblockdata, world, finalblockposition);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entityhuman_enumbedresult != null) {
|
||||
entityhuman.a(entityhuman_enumbedresult.a(), true);
|
||||
}
|
||||
@@ -59,7 +69,14 @@
|
||||
});
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
+ // CraftBukkit start - moved bed explosion into separate method
|
||||
@@ -56,7 +57,16 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ IBlockData finaliblockdata = iblockdata;
|
||||
+ BlockPosition finalblockposition = blockposition;
|
||||
+ // CraftBukkit end
|
||||
entityhuman.sleep(blockposition).ifLeft((entityhuman_enumbedresult) -> {
|
||||
+ // CraftBukkit start - handling bed explosion from below here
|
||||
+ if (entityhuman_enumbedresult == EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE) {
|
||||
+ this.explodeBed(finaliblockdata, world, finalblockposition);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entityhuman_enumbedresult != null) {
|
||||
entityhuman.a(entityhuman_enumbedresult.a(), true);
|
||||
}
|
||||
@@ -67,8 +77,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ {
|
||||
+ {
|
||||
+ world.a(blockposition, false);
|
||||
+ BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
||||
+
|
||||
+ if (world.getType(blockposition1).getBlock() == this) {
|
||||
+ world.a(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);
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
world.a(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
|
||||
|
||||
@@ -69,8 +86,7 @@
|
||||
|
||||
world.createExplosion((Entity) null, DamageSource.a(), (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();
|
||||
+ // CraftBukkit - moved world and biome check into EntityHuman
|
||||
+ return true || world.getDimensionManager().isBedWorks();
|
||||
}
|
||||
|
||||
private boolean a(World world, BlockPosition blockposition) {
|
||||
@@ -225,7 +254,7 @@
|
||||
AxisAlignedBB axisalignedbb = entitytypes.a(vec3d.x, vec3d.y, vec3d.z);
|
||||
|
||||
if (iworldreader.b(axisalignedbb)) {
|
||||
- Stream stream = iworldreader.a(axisalignedbb.b(0.0D, -0.20000000298023224D, 0.0D));
|
||||
+ Stream<IBlockData> stream = iworldreader.a(axisalignedbb.b(0.0D, -0.20000000298023224D, 0.0D)); // CraftBukkit - decompile error
|
||||
|
||||
entitytypes.getClass();
|
||||
if (stream.noneMatch(entitytypes::a)) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
public abstract class BlockButtonAbstract extends BlockAttachable {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.w;
|
||||
@@ -71,6 +76,19 @@
|
||||
@@ -70,6 +75,19 @@
|
||||
if ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)) {
|
||||
return EnumInteractionResult.CONSUME;
|
||||
} else {
|
||||
@ -31,9 +31,9 @@
|
||||
+ // CraftBukkit end
|
||||
this.d(iblockdata, world, blockposition);
|
||||
this.a(entityhuman, world, blockposition, true);
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
@@ -121,6 +139,16 @@
|
||||
if (this.D) {
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -120,6 +138,16 @@
|
||||
if (this.v) {
|
||||
this.e(iblockdata, (World) worldserver, blockposition);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
@ -47,9 +47,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3);
|
||||
this.f(iblockdata, worldserver, blockposition);
|
||||
this.f(iblockdata, (World) worldserver, blockposition);
|
||||
this.a((EntityHuman) null, worldserver, blockposition, false);
|
||||
@@ -141,7 +169,44 @@
|
||||
@@ -140,7 +168,44 @@
|
||||
boolean flag = !list.isEmpty();
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockButtonAbstract.POWERED);
|
||||
|
||||
|
@ -8,17 +8,17 @@
|
||||
+
|
||||
public class BlockCactus extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ad;
|
||||
@@ -32,7 +34,7 @@
|
||||
int j = (Integer) iblockdata.get(BlockCactus.AGE);
|
||||
public static final BlockStateInteger AGE = BlockProperties.aj;
|
||||
@@ -37,7 +39,7 @@
|
||||
int j = (Integer) iblockdata.get(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);
|
||||
if (j == 15) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.getBlockData());
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.getBlockData()); // CraftBukkit
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockCactus.AGE, 0);
|
||||
|
||||
worldserver.setTypeAndData(blockposition, iblockdata1, 4);
|
||||
@@ -90,7 +92,9 @@
|
||||
worldserver.setTypeAndData(blockposition, iblockdata1, 4);
|
||||
@@ -94,7 +96,9 @@
|
||||
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/BlockCampfire.java
|
||||
+++ b/net/minecraft/server/BlockCampfire.java
|
||||
@@ -148,6 +148,11 @@
|
||||
if (flag1 && !(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
@@ -144,6 +144,11 @@
|
||||
if (flag && !(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, entity).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, entity).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
+
|
||||
public class BlockCauldron extends Block {
|
||||
|
||||
public static final BlockStateInteger LEVEL = BlockProperties.al;
|
||||
public static final BlockStateInteger LEVEL = BlockProperties.ar;
|
||||
@@ -27,8 +29,13 @@
|
||||
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
} else if (item == Items.BUCKET) {
|
||||
if (i == 3 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
@ -82,7 +82,7 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
} else if (item == Items.POTION && PotionUtil.d(itemstack) == Potions.WATER) {
|
||||
if (i < 3 && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
@ -101,7 +101,7 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -116,8 +143,13 @@
|
||||
IDyeable idyeable = (IDyeable) item;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
-
|
||||
- @Override
|
||||
- public IChatBaseComponent getScoreboardDisplayName() {
|
||||
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
|
||||
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble")));
|
||||
- }
|
||||
- });
|
||||
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
|
||||
@ -57,15 +57,15 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public IChatBaseComponent getScoreboardDisplayName() {
|
||||
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
|
||||
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble")));
|
||||
+ }
|
||||
+ };
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected BlockChest(Block.Info block_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
|
||||
super(block_info, supplier);
|
||||
this.p((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.c, BlockPropertyChestType.SINGLE)).set(BlockChest.d, false));
|
||||
@@ -217,7 +232,7 @@
|
||||
protected BlockChest(BlockBase.Info blockbase_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
|
||||
super(blockbase_info, supplier);
|
||||
this.j((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.c, BlockPropertyChestType.SINGLE)).set(BlockChest.d, false));
|
||||
@@ -218,7 +233,7 @@
|
||||
}
|
||||
|
||||
public DoubleBlockFinder.Result<? extends TileEntityChest> a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
||||
|
@ -8,47 +8,39 @@
|
||||
+
|
||||
public class BlockChorusFlower extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ab;
|
||||
@@ -58,8 +60,12 @@
|
||||
}
|
||||
public static final BlockStateInteger AGE = BlockProperties.ah;
|
||||
@@ -68,8 +70,12 @@
|
||||
}
|
||||
|
||||
if (flag && b((IWorldReader) worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmpty(blockposition.up(2))) {
|
||||
- worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
- this.b(worldserver, blockposition1, i);
|
||||
+ // CraftBukkit start - add event
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
|
||||
+ worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
+ this.b(worldserver, blockposition1, i);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i < 4) {
|
||||
j = random.nextInt(4);
|
||||
if (flag1) {
|
||||
@@ -73,18 +79,30 @@
|
||||
BlockPosition blockposition2 = blockposition.shift(enumdirection);
|
||||
if (flag && b((IWorldReader) worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmpty(blockposition.up(2))) {
|
||||
- worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
- this.b(worldserver, blockposition1, i);
|
||||
+ // CraftBukkit start - add event
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
|
||||
+ worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
+ this.b(worldserver, blockposition1, i);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i < 4) {
|
||||
j = random.nextInt(4);
|
||||
if (flag1) {
|
||||
@@ -83,18 +89,30 @@
|
||||
BlockPosition blockposition2 = blockposition.shift(enumdirection);
|
||||
|
||||
if (worldserver.isEmpty(blockposition2) && worldserver.isEmpty(blockposition2.down()) && b((IWorldReader) worldserver, blockposition2, enumdirection.opposite())) {
|
||||
- this.b(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.b(worldserver, blockposition2, i + 1);
|
||||
+ flag2 = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
} else {
|
||||
- this.a((World) 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 (worldserver.isEmpty(blockposition2) && worldserver.isEmpty(blockposition2.down()) && b((IWorldReader) worldserver, blockposition2, enumdirection.opposite())) {
|
||||
- this.b(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.b(worldserver, blockposition2, i + 1);
|
||||
+ flag2 = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
|
||||
} else {
|
||||
- this.a((World) worldserver, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
@ -57,5 +49,13 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
} else {
|
||||
- this.a((World) worldserver, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.a((World) worldserver, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.Z;
|
||||
@@ -22,7 +24,7 @@
|
||||
public static final BlockStateInteger AGE = BlockProperties.af;
|
||||
@@ -27,7 +29,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockCocoa.AGE);
|
||||
|
||||
if (i < 2) {
|
||||
@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +94,7 @@
|
||||
@@ -97,7 +99,7 @@
|
||||
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
|
@ -8,15 +8,15 @@
|
||||
|
||||
public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
public static final BlockStateInteger a = BlockProperties.am;
|
||||
public static final BlockStateInteger a = BlockProperties.as;
|
||||
public static final Object2FloatMap<IMaterial> b = new Object2FloatOpenHashMap();
|
||||
public static final VoxelShape c = VoxelShapes.b();
|
||||
private static final VoxelShape c = VoxelShapes.b();
|
||||
- private static final VoxelShape[] d = (VoxelShape[]) SystemUtils.a((Object) (new VoxelShape[9]), (avoxelshape) -> {
|
||||
+ private static final VoxelShape[] d = (VoxelShape[]) SystemUtils.a((new VoxelShape[9]), (avoxelshape) -> { // CraftBukkit - decompile error
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
avoxelshape[i] = VoxelShapes.a(BlockComposter.c, Block.a(2.0D, (double) Math.max(2, 1 + i * 2), 2.0D, 14.0D, 16.0D, 14.0D), OperatorBoolean.ONLY_FIRST);
|
||||
}
|
||||
@@ -220,7 +221,8 @@
|
||||
@@ -254,7 +255,8 @@
|
||||
public IWorldInventory a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.get(BlockComposter.a);
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
static class ContainerInput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -232,6 +234,7 @@
|
||||
@@ -266,6 +268,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
@ -34,7 +34,7 @@
|
||||
this.a = iblockdata;
|
||||
this.b = generatoraccess;
|
||||
this.c = blockposition;
|
||||
@@ -282,6 +285,7 @@
|
||||
@@ -318,6 +321,7 @@
|
||||
this.blockData = iblockdata;
|
||||
this.generatorAccess = generatoraccess;
|
||||
this.blockPosition = blockposition;
|
||||
@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -306,15 +310,23 @@
|
||||
@@ -342,15 +346,23 @@
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
private final IBlockData a;
|
||||
@@ -12,7 +17,7 @@
|
||||
@Override
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) {
|
||||
if (canHarden(world, blockposition, iblockdata1)) {
|
||||
- world.setTypeAndData(blockposition, this.a, 3);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.a, 3); // CraftBukkit
|
||||
|
@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/server/BlockCoral.java
|
||||
@@ -15,6 +15,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!this.a((IBlockAccess) worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData()).isCancelled()) {
|
||||
|
@ -2,8 +2,8 @@
|
||||
+++ b/net/minecraft/server/BlockCoralFan.java
|
||||
@@ -19,6 +19,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!b_(iblockdata, worldserver, blockposition)) {
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!c(iblockdata, (IBlockAccess) worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData().set(BlockCoralFan.b, false)).isCancelled()) {
|
||||
+ return;
|
||||
|
@ -2,8 +2,8 @@
|
||||
+++ b/net/minecraft/server/BlockCoralFanWall.java
|
||||
@@ -19,6 +19,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!b_(iblockdata, worldserver, blockposition)) {
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!c(iblockdata, (IBlockAccess) worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, false).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) {
|
||||
+ return;
|
||||
|
@ -2,8 +2,8 @@
|
||||
+++ b/net/minecraft/server/BlockCoralPlant.java
|
||||
@@ -20,6 +20,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!b_(iblockdata, worldserver, blockposition)) {
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!c(iblockdata, (IBlockAccess) worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralPlant.b, false)).isCancelled()) {
|
||||
+ return;
|
||||
|
@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ac;
|
||||
@@ -52,7 +54,7 @@
|
||||
public static final BlockStateInteger AGE = BlockProperties.ai;
|
||||
@@ -56,7 +58,7 @@
|
||||
float f = a((Block) this, (IBlockAccess) worldserver, blockposition);
|
||||
|
||||
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +69,7 @@
|
||||
@@ -71,7 +73,7 @@
|
||||
i = j;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
protected int a(World world) {
|
||||
@@ -125,7 +127,7 @@
|
||||
@@ -129,7 +131,7 @@
|
||||
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
|
@ -27,4 +27,4 @@
|
||||
+ // CraftBukkit end
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2);
|
||||
if (!flag1) {
|
||||
worldserver.getBlockTickList().a(blockposition, this, this.h(iblockdata), TickListPriority.VERY_HIGH);
|
||||
worldserver.getBlockTickList().a(blockposition, this, this.g(iblockdata), TickListPriority.VERY_HIGH);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockDirtSnowSpreadable.java
|
||||
+++ b/net/minecraft/server/BlockDirtSnowSpreadable.java
|
||||
@@ -30,6 +30,11 @@
|
||||
@@ -32,6 +32,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) {
|
||||
@ -12,12 +12,12 @@
|
||||
worldserver.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
} else {
|
||||
if (worldserver.getLightLevel(blockposition.up()) >= 9) {
|
||||
@@ -39,7 +44,7 @@
|
||||
@@ -41,7 +46,7 @@
|
||||
BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
|
||||
|
||||
if (worldserver.getType(blockposition1).getBlock() == Blocks.DIRT && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) {
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).getBlock() == Blocks.SNOW));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); // CraftBukkit
|
||||
if (worldserver.getType(blockposition1).a(Blocks.DIRT) && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) {
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).a(Blocks.SNOW)));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).a(Blocks.SNOW))); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
public static void a(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
|
||||
BlockDispenser.REGISTRY.put(imaterial.getItem(), idispensebehavior);
|
||||
@@ -58,6 +59,7 @@
|
||||
@@ -53,6 +54,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.a(itemstack);
|
||||
|
||||
if (idispensebehavior != IDispenseBehavior.NONE) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -171,9 +173,24 @@
|
||||
@@ -155,9 +157,24 @@
|
||||
|
||||
@Override
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
|
@ -11,21 +11,19 @@
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
|
||||
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
||||
@@ -21,7 +26,16 @@
|
||||
@Override
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!world.isClientSide && !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)) {
|
||||
- entity.a(world.worldProvider.getDimensionManager() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END);
|
||||
@@ -28,6 +33,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entity).a(world.worldProvider.getDimensionManager().getType() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ ((EntityPlayer) entity).a(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ return;
|
||||
+ }
|
||||
+ entity.a(world.worldProvider.getDimensionManager().getType() == DimensionManager.THE_END ? DimensionManager.OVERWORLD : DimensionManager.THE_END);
|
||||
+ // CraftBukkit end
|
||||
entity.a(worldserver);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,28 +1,26 @@
|
||||
--- a/net/minecraft/server/BlockFire.java
|
||||
+++ b/net/minecraft/server/BlockFire.java
|
||||
@@ -7,6 +7,15 @@
|
||||
import java.util.Map.Entry;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -5,6 +5,13 @@
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.block.BlockBurnEvent;
|
||||
+import org.bukkit.event.block.BlockFadeEvent;
|
||||
+import org.bukkit.event.block.BlockSpreadEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockFire extends Block {
|
||||
public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ad;
|
||||
@@ -33,7 +42,20 @@
|
||||
public static final BlockStateInteger AGE = BlockProperties.aj;
|
||||
@@ -26,7 +33,20 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return this.canPlace(iblockdata, generatoraccess, blockposition) ? (IBlockData) this.a((IBlockAccess) generatoraccess, blockposition).set(BlockFire.AGE, iblockdata.get(BlockFire.AGE)) : Blocks.AIR.getBlockData();
|
||||
- return this.canPlace(iblockdata, generatoraccess, blockposition) ? this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)) : Blocks.AIR.getBlockData();
|
||||
+ // CraftBukkit start
|
||||
+ if (!iblockdata.canPlace(generatoraccess, blockposition)) {
|
||||
+ if (!this.canPlace(iblockdata, generatoraccess, blockposition)) {
|
||||
+ CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition);
|
||||
+ blockState.setData(Blocks.AIR.getBlockData());
|
||||
+
|
||||
@ -33,21 +31,21 @@
|
||||
+ return blockState.getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ return this.a((IBlockAccess) generatoraccess, blockposition).set(BlockFire.AGE, iblockdata.get(BlockFire.AGE));
|
||||
+ return this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -82,7 +104,7 @@
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
@Override
|
||||
@@ -97,7 +117,7 @@
|
||||
worldserver.getBlockTickList().a(blockposition, this, a(worldserver.random));
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) {
|
||||
if (!iblockdata.canPlace(worldserver, blockposition)) {
|
||||
- worldserver.a(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
Block block = worldserver.getType(blockposition.down()).getBlock();
|
||||
@@ -90,7 +112,7 @@
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition.down());
|
||||
@@ -105,7 +125,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockFire.AGE);
|
||||
|
||||
if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
|
||||
@ -56,7 +54,7 @@
|
||||
} else {
|
||||
int j = Math.min(15, i + random.nextInt(3) / 2);
|
||||
|
||||
@@ -105,14 +127,14 @@
|
||||
@@ -119,14 +139,14 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
|
||||
if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
|
||||
@ -67,57 +65,57 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (i == 15 && random.nextInt(4) == 0 && !this.h(worldserver.getType(blockposition.down()))) {
|
||||
if (i == 15 && random.nextInt(4) == 0 && !this.e(worldserver.getType(blockposition.down()))) {
|
||||
- worldserver.a(blockposition, false);
|
||||
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -120,12 +142,14 @@
|
||||
boolean flag1 = worldserver.s(blockposition);
|
||||
@@ -134,12 +154,14 @@
|
||||
boolean flag1 = worldserver.u(blockposition);
|
||||
int k = flag1 ? -50 : 0;
|
||||
|
||||
- this.a(worldserver, blockposition.east(), 300 + k, random, i);
|
||||
- this.a(worldserver, blockposition.west(), 300 + k, random, i);
|
||||
- this.a(worldserver, blockposition.down(), 250 + k, random, i);
|
||||
- this.a(worldserver, blockposition.up(), 250 + k, random, i);
|
||||
- this.a(worldserver, blockposition.north(), 300 + k, random, i);
|
||||
- this.a(worldserver, blockposition.south(), 300 + k, random, i);
|
||||
- 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);
|
||||
+ // CraftBukkit start - add source blockposition to burn calls
|
||||
+ this.a(worldserver, blockposition.east(), 300 + k, random, i, blockposition);
|
||||
+ this.a(worldserver, blockposition.west(), 300 + k, random, i, blockposition);
|
||||
+ this.a(worldserver, blockposition.down(), 250 + k, random, i, blockposition);
|
||||
+ this.a(worldserver, blockposition.up(), 250 + k, random, i, blockposition);
|
||||
+ this.a(worldserver, blockposition.north(), 300 + k, random, i, blockposition);
|
||||
+ this.a(worldserver, blockposition.south(), 300 + k, random, i, blockposition);
|
||||
+ 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.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) {
|
||||
@@ -151,7 +175,15 @@
|
||||
@@ -165,7 +187,15 @@
|
||||
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.a((World) worldserver, (BlockPosition) blockposition_mutableblockposition))) {
|
||||
int j2 = Math.min(15, i + random.nextInt(5) / 4);
|
||||
|
||||
- worldserver.setTypeAndData(blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) worldserver, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3);
|
||||
- worldserver.setTypeAndData(blockposition_mutableblockposition, this.a(worldserver, blockposition_mutableblockposition, j2), 3);
|
||||
+ // CraftBukkit start - Call to stop spread of fire
|
||||
+ if (worldserver.getType(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition_mutableblockposition, blockposition).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) worldserver, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); // CraftBukkit
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition_mutableblockposition, this.a(worldserver, blockposition_mutableblockposition, j2), 3); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,12 +207,24 @@
|
||||
return iblockdata.b((IBlockState) BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C) ? 0 : this.flameChances.getInt(iblockdata.getBlock());
|
||||
@@ -189,12 +219,24 @@
|
||||
return iblockdata.b(BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C) ? 0 : this.flameChances.getInt(iblockdata.getBlock());
|
||||
}
|
||||
|
||||
- private void a(World world, BlockPosition blockposition, int i, Random random, int j) {
|
||||
+ private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
|
||||
int k = this.i(world.getType(blockposition));
|
||||
- private void trySpread(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));
|
||||
|
||||
if (random.nextInt(i) < k) {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
@ -137,29 +135,3 @@
|
||||
if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
|
||||
int l = Math.min(j + random.nextInt(5) / 4, 15);
|
||||
|
||||
@@ -241,9 +285,10 @@
|
||||
@Override
|
||||
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
if (iblockdata1.getBlock() != iblockdata.getBlock()) {
|
||||
- if (world.worldProvider.getDimensionManager() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
|
||||
+ // CraftBukkit - getType()
|
||||
+ if (world.worldProvider.getDimensionManager().getType() != DimensionManager.OVERWORLD && world.worldProvider.getDimensionManager().getType() != DimensionManager.NETHER || !((BlockPortal) Blocks.NETHER_PORTAL).a((GeneratorAccess) world, blockposition)) {
|
||||
if (!iblockdata.canPlace(world, blockposition)) {
|
||||
- world.a(blockposition, false);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
|
||||
}
|
||||
@@ -392,4 +437,12 @@
|
||||
blockfire.a(Blocks.BEEHIVE, 5, 20);
|
||||
blockfire.a(Blocks.BEE_NEST, 30, 20);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ private void fireExtinguished(GeneratorAccess world, BlockPosition position) {
|
||||
+ if (!CraftEventFactory.callBlockFadeEvent(world, position, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ world.a(position, false);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
44
nms-patches/BlockFireAbstract.patch
Normal file
44
nms-patches/BlockFireAbstract.patch
Normal file
@ -0,0 +1,44 @@
|
||||
--- a/net/minecraft/server/BlockFireAbstract.java
|
||||
+++ b/net/minecraft/server/BlockFireAbstract.java
|
||||
@@ -41,7 +41,14 @@
|
||||
if (!entity.isFireProof()) {
|
||||
entity.setFireTicks(entity.getFireTicks() + 1);
|
||||
if (entity.getFireTicks() == 0) {
|
||||
- entity.setOnFire(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.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setOnFire(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
entity.damageEntity(DamageSource.FIRE, this.g);
|
||||
@@ -53,9 +60,10 @@
|
||||
@Override
|
||||
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
if (!iblockdata1.a(iblockdata.getBlock())) {
|
||||
- if (world.getDimensionKey() != World.OVERWORLD && world.getDimensionKey() != World.THE_NETHER || !BlockPortal.a((GeneratorAccess) world, blockposition)) {
|
||||
+ // CraftBukkit - getTypeKey()
|
||||
+ if (world.getTypeKey()!= DimensionManager.OVERWORLD && world.getTypeKey()!= DimensionManager.THE_NETHER || !BlockPortal.a((GeneratorAccess) world, blockposition)) {
|
||||
if (!iblockdata.canPlace(world, blockposition)) {
|
||||
- world.a(blockposition, false);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,4 +100,12 @@
|
||||
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ // 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);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
@ -1,27 +1,27 @@
|
||||
--- a/net/minecraft/server/BlockFluids.java
|
||||
+++ b/net/minecraft/server/BlockFluids.java
|
||||
@@ -111,14 +111,20 @@
|
||||
Fluid fluid = world.getFluid(blockposition);
|
||||
@@ -113,14 +113,20 @@
|
||||
if (world.getFluid(blockposition1).a((Tag) TagsFluid.WATER)) {
|
||||
Block block = world.getFluid(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
|
||||
if (fluid.isSource()) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.OBSIDIAN.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.OBSIDIAN.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
- world.setTypeUpdate(blockposition, block.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, block.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fluid.getHeight(world, blockposition) >= 0.44444445F) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.COBBLESTONE.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.COBBLESTONE.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
if (flag && world.getType(blockposition1).a(Blocks.BLUE_ICE)) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.BASALT.getBlockData());
|
||||
- this.fizz(world, blockposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, Blocks.BASALT.getBlockData())) {
|
||||
+ this.fizz(world, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
nms-patches/BlockGrowingTop.patch
Normal file
11
nms-patches/BlockGrowingTop.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/server/BlockGrowingTop.java
|
||||
+++ b/net/minecraft/server/BlockGrowingTop.java
|
||||
@@ -36,7 +36,7 @@
|
||||
BlockPosition blockposition1 = blockposition.shift(this.a);
|
||||
|
||||
if (this.h(worldserver.getType(blockposition1))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockGrowingTop.d));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockGrowingTop.d)); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
protected void melt(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, world.worldProvider.isNether() ? Blocks.AIR.getBlockData() : Blocks.WATER.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, world.getDimensionManager().isNether() ? Blocks.AIR.getBlockData() : Blocks.WATER.getBlockData()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.worldProvider.isNether()) {
|
||||
if (world.getDimensionManager().isNether()) {
|
||||
world.a(blockposition, false);
|
||||
} else {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockJukeBox.java
|
||||
+++ b/net/minecraft/server/BlockJukeBox.java
|
||||
@@ -25,7 +25,13 @@
|
||||
@@ -42,7 +42,13 @@
|
||||
TileEntity tileentity = generatoraccess.getTileEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof TileEntityJukeBox) {
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/server/BlockKelp.java
|
||||
+++ b/net/minecraft/server/BlockKelp.java
|
||||
@@ -44,7 +44,7 @@
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1);
|
||||
|
||||
if (iblockdata1.getBlock() == Blocks.WATER && (Integer) iblockdata.get(BlockKelp.a) < 25 && random.nextDouble() < 0.14D) {
|
||||
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
@ -8,10 +8,10 @@
|
||||
+
|
||||
public class BlockLeaves extends Block {
|
||||
|
||||
public static final BlockStateInteger DISTANCE = BlockProperties.ah;
|
||||
@@ -20,6 +22,14 @@
|
||||
public static final BlockStateInteger DISTANCE = BlockProperties.an;
|
||||
@@ -25,6 +27,14 @@
|
||||
@Override
|
||||
public void b(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
|
||||
+ // CraftBukkit start
|
||||
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockLectern.java
|
||||
+++ b/net/minecraft/server/BlockLectern.java
|
||||
@@ -151,12 +151,13 @@
|
||||
@@ -165,12 +165,13 @@
|
||||
}
|
||||
|
||||
private void d(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.X;
|
||||
@@ -62,6 +64,16 @@
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.ad;
|
||||
@@ -57,6 +59,16 @@
|
||||
}
|
||||
|
||||
IBlockData iblockdata1;
|
||||
|
@ -9,12 +9,12 @@
|
||||
public class BlockMonsterEggs extends Block {
|
||||
|
||||
private final Block a;
|
||||
@@ -29,7 +31,7 @@
|
||||
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.a(world);
|
||||
@@ -26,7 +28,7 @@
|
||||
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.a(world);
|
||||
|
||||
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entitysilverfish);
|
||||
+ world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
|
||||
entitysilverfish.doSpawnEffect();
|
||||
}
|
||||
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entitysilverfish);
|
||||
+ world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
|
||||
entitysilverfish.doSpawnEffect();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,14 +74,16 @@
|
||||
@@ -69,14 +73,16 @@
|
||||
WorldGenFeatureConfigured worldgenfeatureconfigured;
|
||||
|
||||
if (this == Blocks.BROWN_MUSHROOM) {
|
||||
@ -38,4 +38,4 @@
|
||||
+ worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b(BiomeDecoratorGroups.HUGE_RED_MUSHROOM); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
if (worldgenfeatureconfigured.a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition)) {
|
||||
if (worldgenfeatureconfigured.a(worldserver, worldserver.getStructureManager(), worldserver.getChunkProvider().getChunkGenerator(), random, blockposition)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockNetherWart.java
|
||||
+++ b/net/minecraft/server/BlockNetherWart.java
|
||||
@@ -28,7 +28,7 @@
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
if (i < 3 && random.nextInt(10) == 0) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockNetherWart.AGE, i + 1);
|
||||
@ -8,4 +8,4 @@
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
|
||||
}
|
||||
|
||||
super.tick(iblockdata, worldserver, blockposition, random);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
- this.play(world, blockposition);
|
||||
+ this.play(world, blockposition, iblockdata); // CraftBukkit
|
||||
entityhuman.a(StatisticList.TUNE_NOTEBLOCK);
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
return EnumInteractionResult.CONSUME;
|
||||
}
|
||||
@@ -58,7 +64,7 @@
|
||||
@Override
|
||||
|
@ -11,7 +11,7 @@
|
||||
public static final BlockStateBoolean b = BlockProperties.w;
|
||||
@@ -29,8 +31,18 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockObserver.b)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
public class BlockPiston extends BlockDirectional {
|
||||
|
||||
public static final BlockStateBoolean EXTENDED = BlockProperties.g;
|
||||
@@ -113,6 +121,18 @@
|
||||
@@ -103,6 +111,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,13 +31,13 @@
|
||||
+ }
|
||||
+ // PAIL: checkME - what happened to setTypeAndData?
|
||||
+ // CraftBukkit end
|
||||
world.playBlockAction(blockposition, this, b0, enumdirection.b());
|
||||
world.playBlockAction(blockposition, this, b0, enumdirection.c());
|
||||
}
|
||||
|
||||
@@ -284,6 +304,48 @@
|
||||
int j = list.size() + list2.size();
|
||||
IBlockData[] aiblockdata = new IBlockData[j];
|
||||
@@ -277,6 +297,48 @@
|
||||
IBlockData[] aiblockdata = new IBlockData[list.size() + list2.size()];
|
||||
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
|
||||
int j = 0;
|
||||
+ // CraftBukkit start
|
||||
+ final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockPlant.java
|
||||
+++ b/net/minecraft/server/BlockPlant.java
|
||||
@@ -14,7 +14,14 @@
|
||||
@@ -12,7 +12,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
|
@ -13,19 +13,19 @@
|
||||
+
|
||||
public class BlockPortal extends Block {
|
||||
|
||||
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.D;
|
||||
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.E;
|
||||
@@ -34,7 +41,8 @@
|
||||
}
|
||||
|
||||
if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIE_PIGMAN)) {
|
||||
- Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false);
|
||||
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);
|
||||
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
|
||||
+ Entity entity = EntityTypes.ZOMBIE_PIGMAN.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.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
|
||||
if (entity != null) {
|
||||
entity.portalCooldown = entity.ba();
|
||||
entity.portalCooldown = entity.getDefaultPortalCooldown();
|
||||
@@ -48,8 +56,10 @@
|
||||
BlockPortal.Shape blockportal_shape = this.b(generatoraccess, blockposition);
|
||||
BlockPortal.Shape blockportal_shape = b(generatoraccess, blockposition);
|
||||
|
||||
if (blockportal_shape != null) {
|
||||
- blockportal_shape.createPortal();
|
||||
@ -45,7 +45,7 @@
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
entity.c(blockposition);
|
||||
entity.d(blockposition);
|
||||
}
|
||||
|
||||
@@ -172,6 +186,7 @@
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
public Shape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
this.a = generatoraccess;
|
||||
@@ -230,6 +245,9 @@
|
||||
@@ -228,6 +243,9 @@
|
||||
}
|
||||
|
||||
protected int c() {
|
||||
@ -66,9 +66,9 @@
|
||||
int i;
|
||||
|
||||
label56:
|
||||
@@ -252,11 +270,21 @@
|
||||
block = this.a.getType(blockposition.shift(this.d)).getBlock();
|
||||
if (block != Blocks.OBSIDIAN) {
|
||||
@@ -247,9 +265,19 @@
|
||||
if (i == 0) {
|
||||
if (!this.a.getType(blockposition.shift(this.d)).a(Blocks.OBSIDIAN)) {
|
||||
break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
+ } else {
|
||||
@ -76,20 +76,18 @@
|
||||
+ blocks.add(CraftBlock.at(this.a, pos).getState());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (i == this.width - 1) {
|
||||
block = this.a.getType(blockposition.shift(this.c)).getBlock();
|
||||
if (block != Blocks.OBSIDIAN) {
|
||||
break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
+ } else {
|
||||
+ BlockPosition pos = blockposition.shift(this.c);
|
||||
+ blocks.add(CraftBlock.at(this.a, pos).getState());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (i == this.width - 1 && !this.a.getType(blockposition.shift(this.c)).a(Blocks.OBSIDIAN)) {
|
||||
break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
+ } else {
|
||||
+ BlockPosition pos = blockposition.shift(this.c);
|
||||
+ blocks.add(CraftBlock.at(this.a, pos).getState());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -266,6 +294,11 @@
|
||||
if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) {
|
||||
}
|
||||
@@ -258,6 +286,11 @@
|
||||
if (!this.a.getType(this.position.shift(this.c, i).up(this.height)).a(Blocks.OBSIDIAN)) {
|
||||
this.height = 0;
|
||||
break;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
@ -100,7 +98,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +322,29 @@
|
||||
@@ -279,7 +312,29 @@
|
||||
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
|
||||
}
|
||||
|
||||
@ -131,7 +129,7 @@
|
||||
for (int i = 0; i < this.width; ++i) {
|
||||
BlockPosition blockposition = this.position.shift(this.c, i);
|
||||
|
||||
@@ -298,6 +353,7 @@
|
||||
@@ -288,6 +343,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
+
|
||||
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.X;
|
||||
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.ad;
|
||||
@@ -102,6 +104,13 @@
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);
|
||||
|
||||
@ -21,4 +21,4 @@
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockPoweredRail.POWERED, flag1), 3);
|
||||
world.applyPhysics(blockposition.down(), this);
|
||||
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).b()) {
|
||||
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
public abstract class BlockPressurePlateAbstract extends Block {
|
||||
|
||||
protected static final VoxelShape a = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
@@ -66,6 +68,19 @@
|
||||
@@ -65,6 +67,19 @@
|
||||
boolean flag = i > 0;
|
||||
boolean flag1 = j > 0;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
+
|
||||
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateInteger POWER = BlockProperties.at;
|
||||
public static final BlockStateInteger POWER = BlockProperties.az;
|
||||
@@ -13,7 +15,31 @@
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,7 @@
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPumpkinCarved extends BlockFacingHorizontal {
|
||||
public class BlockPumpkinCarved extends BlockFacingHorizontal implements ItemWearable {
|
||||
|
||||
public static final BlockStateDirection a = BlockFacingHorizontal.FACING;
|
||||
@@ -42,19 +48,28 @@
|
||||
|
@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.az;
|
||||
@@ -70,7 +72,8 @@
|
||||
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.aG;
|
||||
@@ -67,7 +69,8 @@
|
||||
|
||||
@Nullable
|
||||
private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) {
|
||||
@ -19,7 +19,7 @@
|
||||
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
|
||||
});
|
||||
|
||||
@@ -125,8 +128,18 @@
|
||||
@@ -122,8 +125,18 @@
|
||||
boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.c);
|
||||
|
||||
if (flag1 && !flag) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
public class BlockRedstoneLamp extends Block {
|
||||
|
||||
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
|
||||
@@ -37,6 +39,11 @@
|
||||
@@ -27,6 +29,11 @@
|
||||
if (flag1) {
|
||||
world.getBlockTickList().a(blockposition, this, 4);
|
||||
} else {
|
||||
@ -21,9 +21,9 @@
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
|
||||
}
|
||||
}
|
||||
@@ -47,6 +54,11 @@
|
||||
@@ -37,6 +44,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !worldserver.isBlockIndirectlyPowered(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
public class BlockRedstoneOre extends Block {
|
||||
|
||||
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
|
||||
@@ -18,14 +23,30 @@
|
||||
@@ -13,14 +18,30 @@
|
||||
|
||||
@Override
|
||||
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
@ -46,14 +46,17 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,14 +55,19 @@
|
||||
@@ -28,7 +49,7 @@
|
||||
if (world.isClientSide) {
|
||||
playEffect(world, blockposition);
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
- interact(iblockdata, world, blockposition);
|
||||
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
@@ -36,9 +57,14 @@
|
||||
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).b() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
- private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@ -68,7 +71,7 @@
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, true), 3);
|
||||
}
|
||||
|
||||
@@ -50,6 +76,11 @@
|
||||
@@ -52,6 +78,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if ((Boolean) iblockdata.get(BlockRedstoneOre.a)) {
|
||||
@ -80,7 +83,7 @@
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, false), 3);
|
||||
}
|
||||
|
||||
@@ -58,12 +89,25 @@
|
||||
@@ -60,12 +91,25 @@
|
||||
@Override
|
||||
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
|
||||
super.dropNaturally(iblockdata, world, blockposition, itemstack);
|
||||
|
@ -9,13 +9,13 @@
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
public static final BlockStateBoolean LIT = BlockProperties.r;
|
||||
@@ -70,8 +72,24 @@
|
||||
@@ -62,8 +64,24 @@
|
||||
list.remove(0);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ org.bukkit.plugin.PluginManager manager = worldserver.getServer().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;
|
||||
+
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||
@ -31,13 +31,13 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, false), 3);
|
||||
if (a(world, blockposition, true)) {
|
||||
world.triggerEffect(1502, blockposition, 0);
|
||||
@@ -79,6 +97,15 @@
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, false), 3);
|
||||
if (a(worldserver, blockposition, true)) {
|
||||
worldserver.triggerEffect(1502, blockposition, 0);
|
||||
@@ -71,6 +89,15 @@
|
||||
}
|
||||
}
|
||||
} else if (!flag && !a(world, blockposition, false)) {
|
||||
} else if (!flag && !a(worldserver, blockposition, false)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (oldCurrent != 15) {
|
||||
+ event.setNewCurrent(15);
|
||||
@ -47,6 +47,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, true), 3);
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, true), 3);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockRedstoneWire.java
|
||||
+++ b/net/minecraft/server/BlockRedstoneWire.java
|
||||
@@ -11,6 +11,8 @@
|
||||
@@ -9,6 +9,8 @@
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -8,20 +8,20 @@
|
||||
+
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.R;
|
||||
@@ -206,6 +208,15 @@
|
||||
l = j;
|
||||
}
|
||||
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.X;
|
||||
@@ -213,7 +215,14 @@
|
||||
private void a(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = this.a(world, blockposition);
|
||||
|
||||
- if ((Integer) iblockdata.get(BlockRedstoneWire.POWER) != i) {
|
||||
+ // CraftBukkit start
|
||||
+ if (i != l) {
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, l);
|
||||
+ int oldPower = (Integer) iblockdata.get(BlockRedstoneWire.POWER);
|
||||
+ if (oldPower != i) {
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ l = event.getNewCurrent();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i != l) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, l);
|
||||
if (world.getType(blockposition) == iblockdata1) {
|
||||
+ i = event.getNewCurrent();
|
||||
+ // CraftBukkit end
|
||||
if (world.getType(blockposition) == iblockdata) {
|
||||
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockReed.java
|
||||
+++ b/net/minecraft/server/BlockReed.java
|
||||
@@ -33,7 +33,7 @@
|
||||
@@ -39,7 +39,7 @@
|
||||
int j = (Integer) iblockdata.get(BlockReed.AGE);
|
||||
|
||||
if (j == 15) {
|
||||
|
@ -13,16 +13,16 @@
|
||||
+
|
||||
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger STAGE = BlockProperties.au;
|
||||
public static final BlockStateInteger STAGE = BlockProperties.aA;
|
||||
protected static final VoxelShape b = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
|
||||
private final WorldGenTreeProvider c;
|
||||
+ public static TreeType treeType; // CraftBukkit
|
||||
|
||||
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, Block.Info block_info) {
|
||||
super(block_info);
|
||||
@@ -23,7 +31,30 @@
|
||||
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
|
||||
super(blockbase_info);
|
||||
@@ -22,7 +30,30 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
super.tick(iblockdata, worldserver, blockposition, random);
|
||||
if (worldserver.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockSnow.java
|
||||
+++ b/net/minecraft/server/BlockSnow.java
|
||||
@@ -58,6 +58,11 @@
|
||||
@@ -67,6 +67,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
|
||||
|
@ -11,23 +11,22 @@
|
||||
+
|
||||
public class BlockSoil extends Block {
|
||||
|
||||
public static final BlockStateInteger MOISTURE = BlockProperties.aq;
|
||||
@@ -53,12 +58,12 @@
|
||||
public static final BlockStateInteger MOISTURE = BlockProperties.aw;
|
||||
@@ -58,26 +63,49 @@
|
||||
|
||||
if (!a((IWorldReader) worldserver, blockposition) && !worldserver.isRainingAt(blockposition.up())) {
|
||||
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);
|
||||
}
|
||||
} 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
|
||||
if (!a((IWorldReader) worldserver, blockposition) && !worldserver.isRainingAt(blockposition.up())) {
|
||||
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);
|
||||
}
|
||||
|
||||
} 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
|
||||
}
|
||||
@@ -66,14 +71,37 @@
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
+ // CraftBukkit end
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
if (fluid.a(TagsFluid.WATER)) {
|
||||
if (fluid.a((Tag) TagsFluid.WATER)) {
|
||||
- if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(world, blockposition2, iblockdata) != FluidTypes.EMPTY) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && ((IFluidSource) iblockdata.getBlock()).removeFluid(blockList, blockposition2, iblockdata) != FluidTypes.EMPTY) { // CraftBukkit
|
||||
++i;
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/BlockStateInteger.java
|
||||
+++ b/net/minecraft/server/BlockStateInteger.java
|
||||
@@ -9,9 +9,15 @@
|
||||
public class BlockStateInteger extends BlockState<Integer> {
|
||||
public class BlockStateInteger extends IBlockState<Integer> {
|
||||
|
||||
private final ImmutableSet<Integer> a;
|
||||
+ // CraftBukkit start
|
||||
|
@ -8,8 +8,8 @@
|
||||
+
|
||||
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockProperties.ac;
|
||||
@@ -35,14 +37,18 @@
|
||||
public static final BlockStateInteger AGE = BlockProperties.ai;
|
||||
@@ -34,14 +36,18 @@
|
||||
|
||||
if (i < 7) {
|
||||
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, i + 1);
|
||||
@ -18,9 +18,9 @@
|
||||
} else {
|
||||
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random);
|
||||
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
||||
Block block = worldserver.getType(blockposition1.down()).getBlock();
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1.down());
|
||||
|
||||
if (worldserver.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
|
||||
if (worldserver.getType(blockposition1).isAir() && (iblockdata1.a(Blocks.FARMLAND) || iblockdata1.a(Blocks.DIRT) || iblockdata1.a(Blocks.COARSE_DIRT) || iblockdata1.a(Blocks.PODZOL) || iblockdata1.a(Blocks.GRASS_BLOCK))) {
|
||||
- worldserver.setTypeUpdate(blockposition1, this.blockFruit.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.blockFruit.getBlockData())) {
|
||||
@ -30,12 +30,12 @@
|
||||
worldserver.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
||||
}
|
||||
}
|
||||
@@ -66,7 +72,7 @@
|
||||
@@ -65,7 +71,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);
|
||||
|
||||
- worldserver.setTypeAndData(blockposition, iblockdata1, 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit
|
||||
if (i == 7) {
|
||||
iblockdata1.a(worldserver, blockposition, worldserver.random);
|
||||
iblockdata1.b(worldserver, blockposition, worldserver.random);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
@@ -24,7 +28,7 @@
|
||||
@@ -28,7 +32,7 @@
|
||||
int i = (Integer) iblockdata.get(BlockSweetBerryBush.a);
|
||||
|
||||
if (i < 3 && random.nextInt(5) == 0 && worldserver.getLightLevel(blockposition.up(), 0) >= 9) {
|
||||
@ -20,8 +20,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,7 +42,9 @@
|
||||
double d1 = Math.abs(entity.locZ() - entity.G);
|
||||
@@ -42,7 +46,9 @@
|
||||
double d1 = Math.abs(entity.locZ() - entity.F);
|
||||
|
||||
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
|
||||
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/BlockTNT.java
|
||||
+++ b/net/minecraft/server/BlockTNT.java
|
||||
@@ -95,6 +95,11 @@
|
||||
@@ -94,6 +94,11 @@
|
||||
|
||||
if (entityarrow.isBurning()) {
|
||||
if (iprojectile.isBurning()) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null);
|
||||
a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
|
||||
world.a(blockposition, false);
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/BlockTallPlant.java
|
||||
+++ b/net/minecraft/server/BlockTallPlant.java
|
||||
@@ -54,6 +54,11 @@
|
||||
@@ -66,6 +66,11 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
protected static void b(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);
|
||||
BlockPosition blockposition1 = blockpropertydoubleblockhalf == BlockPropertyDoubleBlockHalf.LOWER ? blockposition.up() : blockposition.down();
|
||||
IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
|
||||
if (blockpropertydoubleblockhalf == BlockPropertyDoubleBlockHalf.UPPER) {
|
||||
|
@ -13,27 +13,27 @@
|
||||
|
||||
public class BlockTurtleEgg extends Block {
|
||||
|
||||
@@ -35,6 +41,19 @@
|
||||
super.stepOn(world, blockposition, entity);
|
||||
} else {
|
||||
if (!world.isClientSide && world.random.nextInt(i) == 0) {
|
||||
+ // CraftBukkit start - Step on eggs
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(world, blockposition));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(world, blockposition, world.getType(blockposition));
|
||||
}
|
||||
@@ -36,6 +42,19 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
@@ -60,9 +79,19 @@
|
||||
if (iblockdata.a(Blocks.TURTLE_EGG)) {
|
||||
+ // CraftBukkit start - Step on eggs
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(world, blockposition));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a(world, blockposition, iblockdata);
|
||||
}
|
||||
}
|
||||
@@ -62,9 +81,19 @@
|
||||
int i = (Integer) iblockdata.get(BlockTurtleEgg.a);
|
||||
|
||||
if (i < 2) {
|
||||
@ -54,9 +54,9 @@
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
worldserver.a(blockposition, false);
|
||||
|
||||
@@ -73,7 +102,7 @@
|
||||
@@ -75,7 +104,7 @@
|
||||
entityturtle.setAgeRaw(-24000);
|
||||
entityturtle.g(blockposition);
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/BlockVine.java
|
||||
+++ b/net/minecraft/server/BlockVine.java
|
||||
@@ -6,6 +6,8 @@
|
||||
import java.util.Map.Entry;
|
||||
@@ -5,6 +5,8 @@
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
@ -9,7 +9,7 @@
|
||||
public class BlockVine extends Block {
|
||||
|
||||
public static final BlockStateBoolean UP = BlockSprawling.e;
|
||||
@@ -177,20 +179,24 @@
|
||||
@@ -166,20 +168,24 @@
|
||||
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
|
||||
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
|
||||
|
||||
@ -39,21 +39,21 @@
|
||||
}
|
||||
} else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) {
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
|
||||
@@ -220,7 +226,7 @@
|
||||
@@ -209,7 +215,7 @@
|
||||
}
|
||||
|
||||
if (this.canSpread(iblockdata3)) {
|
||||
- worldserver.setTypeAndData(blockposition1, iblockdata3, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit
|
||||
if (this.canSpread(iblockdata2)) {
|
||||
- worldserver.setTypeAndData(blockposition1, iblockdata2, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -235,7 +241,7 @@
|
||||
IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random);
|
||||
@@ -224,7 +230,7 @@
|
||||
IBlockData iblockdata4 = this.a(iblockdata, iblockdata3, random);
|
||||
|
||||
if (iblockdata4 != iblockdata5 && this.canSpread(iblockdata5)) {
|
||||
- worldserver.setTypeAndData(blockposition2, iblockdata5, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit
|
||||
if (iblockdata3 != iblockdata4 && this.canSpread(iblockdata4)) {
|
||||
- worldserver.setTypeAndData(blockposition2, iblockdata4, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BlockWitherRose.java
|
||||
+++ b/net/minecraft/server/BlockWitherRose.java
|
||||
@@ -20,7 +20,7 @@
|
||||
@@ -18,7 +18,7 @@
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
if (!entityliving.isInvulnerable(DamageSource.WITHER)) {
|
||||
|
@ -18,8 +18,8 @@
|
||||
public static void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
|
||||
+ if (world.captureBlockStates) return; // CraftBukkit
|
||||
if (!world.isClientSide) {
|
||||
Block block = tileentityskull.getBlock().getBlock();
|
||||
boolean flag = block == Blocks.WITHER_SKELETON_SKULL || block == Blocks.WITHER_SKELETON_WALL_SKULL;
|
||||
IBlockData iblockdata = tileentityskull.getBlock();
|
||||
boolean flag = iblockdata.a(Blocks.WITHER_SKELETON_SKULL) || iblockdata.a(Blocks.WITHER_SKELETON_WALL_SKULL);
|
||||
@@ -35,12 +41,14 @@
|
||||
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition);
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
}
|
||||
|
||||
@@ -50,6 +58,15 @@
|
||||
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
|
||||
entitywither.aI = shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
|
||||
entitywither.l();
|
||||
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.aH = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
|
||||
entitywither.beginSpawnSequence();
|
||||
+ // CraftBukkit start
|
||||
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
+ return;
|
||||
|
35
nms-patches/ChatHexColor.patch
Normal file
35
nms-patches/ChatHexColor.patch
Normal file
@ -0,0 +1,35 @@
|
||||
--- a/net/minecraft/server/ChatHexColor.java
|
||||
+++ b/net/minecraft/server/ChatHexColor.java
|
||||
@@ -10,7 +10,7 @@
|
||||
public final class ChatHexColor {
|
||||
|
||||
private static final Map<EnumChatFormat, ChatHexColor> a = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
- return new ChatHexColor(enumchatformat.e(), enumchatformat.f());
|
||||
+ return new ChatHexColor(enumchatformat.e(), enumchatformat.f(), enumchatformat); // CraftBukkit
|
||||
}));
|
||||
private static final Map<String, ChatHexColor> b = (Map) ChatHexColor.a.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
return chathexcolor.name;
|
||||
@@ -18,16 +18,22 @@
|
||||
private final int rgb;
|
||||
@Nullable
|
||||
public final String name;
|
||||
+ // CraftBukkit start
|
||||
+ @Nullable
|
||||
+ public final EnumChatFormat format;
|
||||
|
||||
- private ChatHexColor(int i, String s) {
|
||||
+ private ChatHexColor(int i, String s, EnumChatFormat format) {
|
||||
this.rgb = i;
|
||||
this.name = s;
|
||||
+ this.format = format;
|
||||
}
|
||||
|
||||
private ChatHexColor(int i) {
|
||||
this.rgb = i;
|
||||
this.name = null;
|
||||
+ this.format = null;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public String b() {
|
||||
return this.name != null ? this.name : this.c();
|
23
nms-patches/ChatModifier.patch
Normal file
23
nms-patches/ChatModifier.patch
Normal file
@ -0,0 +1,23 @@
|
||||
--- a/net/minecraft/server/ChatModifier.java
|
||||
+++ b/net/minecraft/server/ChatModifier.java
|
||||
@@ -114,6 +114,20 @@
|
||||
return new ChatModifier(this.color, this.bold, obool, this.underlined, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public ChatModifier setStrikethrough(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, obool, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setUnderline(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, obool, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setRandom(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, obool, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public ChatModifier setChatClickable(@Nullable ChatClickable chatclickable) {
|
||||
return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, this.obfuscated, chatclickable, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
@ -1,6 +1,24 @@
|
||||
--- a/net/minecraft/server/Chunk.java
|
||||
+++ b/net/minecraft/server/Chunk.java
|
||||
@@ -95,8 +95,19 @@
|
||||
@@ -31,7 +31,7 @@
|
||||
private BiomeStorage d;
|
||||
private final Map<BlockPosition, NBTTagCompound> e;
|
||||
public boolean loaded;
|
||||
- public final World world;
|
||||
+ public final WorldServer world; // CraftBukkit - type
|
||||
public final Map<HeightMap.Type, HeightMap> heightMap;
|
||||
private final ChunkConverter i;
|
||||
public final Map<BlockPosition, TileEntity> tileEntities;
|
||||
@@ -65,7 +65,7 @@
|
||||
this.m = Maps.newHashMap();
|
||||
this.n = new ShortList[16];
|
||||
this.entitySlices = (EntitySlice[]) (new EntitySlice[16]);
|
||||
- this.world = world;
|
||||
+ this.world = (WorldServer) world; // CraftBukkit - type
|
||||
this.loc = chunkcoordintpair;
|
||||
this.i = chunkconverter;
|
||||
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
|
||||
@@ -96,8 +96,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +38,7 @@
|
||||
public Chunk(World world, ProtoChunk protochunk) {
|
||||
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null);
|
||||
Iterator iterator = protochunk.y().iterator();
|
||||
@@ -138,6 +149,7 @@
|
||||
@@ -139,6 +150,7 @@
|
||||
|
||||
this.b(protochunk.r());
|
||||
this.s = true;
|
||||
@ -28,7 +46,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,9 +240,16 @@
|
||||
@@ -229,9 +241,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +63,7 @@
|
||||
int i = blockposition.getX() & 15;
|
||||
int j = blockposition.getY();
|
||||
int k = blockposition.getZ() & 15;
|
||||
@@ -282,7 +301,8 @@
|
||||
@@ -283,7 +302,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +73,7 @@
|
||||
iblockdata.onPlace(this.world, blockposition, iblockdata1, flag);
|
||||
}
|
||||
|
||||
@@ -377,7 +397,12 @@
|
||||
@@ -378,7 +398,12 @@
|
||||
|
||||
@Nullable
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
@ -69,8 +87,8 @@
|
||||
|
||||
if (tileentity == null) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
|
||||
@@ -423,6 +448,13 @@
|
||||
tileentity1.ab_();
|
||||
@@ -424,6 +449,13 @@
|
||||
tileentity1.an_();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -83,7 +101,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,6 +504,50 @@
|
||||
@@ -473,6 +505,50 @@
|
||||
|
||||
}
|
||||
|
||||
@ -134,7 +152,7 @@
|
||||
public void markDirty() {
|
||||
this.s = true;
|
||||
}
|
||||
@@ -525,7 +601,7 @@
|
||||
@@ -526,7 +602,7 @@
|
||||
Iterator iterator = this.entitySlices[k].a(Entity.class).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -143,7 +161,7 @@
|
||||
|
||||
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
|
||||
list.add(entity);
|
||||
@@ -546,7 +622,7 @@
|
||||
@@ -547,7 +623,7 @@
|
||||
Iterator iterator = this.entitySlices[k].a(oclass).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -152,7 +170,7 @@
|
||||
|
||||
if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) {
|
||||
list.add(t0);
|
||||
@@ -620,7 +696,7 @@
|
||||
@@ -621,7 +697,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isNeedsSaving() {
|
||||
@ -161,7 +179,7 @@
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
@@ -761,7 +837,7 @@
|
||||
@@ -763,7 +839,7 @@
|
||||
|
||||
public void B() {
|
||||
if (this.o instanceof ProtoChunkTickList) {
|
||||
@ -170,7 +188,7 @@
|
||||
return this.getType(blockposition).getBlock();
|
||||
});
|
||||
this.o = TickListEmpty.b();
|
||||
@@ -771,7 +847,7 @@
|
||||
@@ -773,7 +849,7 @@
|
||||
}
|
||||
|
||||
if (this.p instanceof ProtoChunkTickList) {
|
||||
@ -179,18 +197,18 @@
|
||||
return this.getFluid(blockposition).getType();
|
||||
});
|
||||
this.p = TickListEmpty.b();
|
||||
@@ -783,12 +859,12 @@
|
||||
@@ -785,12 +861,12 @@
|
||||
}
|
||||
|
||||
public void a(WorldServer worldserver) {
|
||||
- if (this.o == TickListEmpty.b()) {
|
||||
+ if (this.o == TickListEmpty.<Block>b()) { // CraftBukkit - decompile error
|
||||
this.o = new TickListChunk<>(IRegistry.BLOCK::getKey, worldserver.getBlockTickList().a(this.loc, true, false));
|
||||
this.o = new TickListChunk<>(IRegistry.BLOCK::getKey, worldserver.getBlockTickList().a(this.loc, true, false), worldserver.getTime());
|
||||
this.setNeedsSaving(true);
|
||||
}
|
||||
|
||||
- if (this.p == TickListEmpty.b()) {
|
||||
+ if (this.p == TickListEmpty.<FluidType>b()) { // CraftBukkit - decompile error
|
||||
this.p = new TickListChunk<>(IRegistry.FLUID::getKey, worldserver.getFluidTickList().a(this.loc, true, false));
|
||||
this.p = new TickListChunk<>(IRegistry.FLUID::getKey, worldserver.getFluidTickList().a(this.loc, true, false), worldserver.getTime());
|
||||
this.setNeedsSaving(true);
|
||||
}
|
||||
|
@ -1,21 +1,31 @@
|
||||
--- a/net/minecraft/server/ChunkGenerator.java
|
||||
+++ b/net/minecraft/server/ChunkGenerator.java
|
||||
@@ -147,6 +147,18 @@
|
||||
StructureStart structurestart1 = StructureStart.a;
|
||||
BiomeBase biomebase = biomemanager.a(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9));
|
||||
@@ -214,6 +214,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
StructureFeature<?, ?> structurefeature = (StructureFeature) iterator.next();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (structuregenerator == WorldGenerator.STRONGHOLD) {
|
||||
+ synchronized (structuregenerator) {
|
||||
+ if (structuregenerator.a(biomemanager, chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z, biomebase)) {
|
||||
+ StructureStart structurestart2 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, StructureBoundingBox.a(), i, chunkgenerator.getSeed());
|
||||
+
|
||||
+ structurestart2.a(this, definedstructuremanager, chunkcoordintpair.x, chunkcoordintpair.z, biomebase);
|
||||
+ structurestart1 = structurestart2.e() ? structurestart2 : StructureStart.a;
|
||||
+ }
|
||||
+ }
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (structuregenerator.a(biomemanager, chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z, biomebase)) {
|
||||
StructureStart structurestart2 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, StructureBoundingBox.a(), i, chunkgenerator.getSeed());
|
||||
+ // CraftBukkit start
|
||||
+ if (structurefeature.b == StructureGenerator.STRONGHOLD) {
|
||||
+ synchronized (structurefeature) {
|
||||
+ this.a(structurefeature, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
|
||||
+ }
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
this.a(structurefeature, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
|
||||
}
|
||||
|
||||
@@ -293,9 +300,11 @@
|
||||
}
|
||||
|
||||
static {
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", (Object) ChunkGeneratorAbstract.d);
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", (Object) ChunkProviderFlat.d);
|
||||
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", (Object) ChunkProviderDebug.e);
|
||||
+ // CraftBukkit start - decompile errors
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", ChunkGeneratorAbstract.d);
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", ChunkProviderFlat.d);
|
||||
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", ChunkProviderDebug.e);
|
||||
+ // CraftBukkit end
|
||||
a = IRegistry.CHUNK_GENERATOR.dispatchStable(ChunkGenerator::a, Function.identity());
|
||||
}
|
||||
}
|
||||
|
32
nms-patches/ChunkGeneratorAbstract.patch
Normal file
32
nms-patches/ChunkGeneratorAbstract.patch
Normal file
@ -0,0 +1,32 @@
|
||||
--- a/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
+++ b/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
@@ -23,7 +23,7 @@
|
||||
return chunkgeneratorabstract.h;
|
||||
})).apply(instance, instance.stable(ChunkGeneratorAbstract::new));
|
||||
});
|
||||
- private static final float[] i = (float[]) SystemUtils.a((Object) (new float[13824]), (afloat) -> {
|
||||
+ private static final float[] i = (float[]) SystemUtils.a((new float[13824]), (afloat) -> { // CraftBukkit - decompile error
|
||||
for (int i = 0; i < 24; ++i) {
|
||||
for (int j = 0; j < 24; ++j) {
|
||||
for (int k = 0; k < 24; ++k) {
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
});
|
||||
- private static final float[] j = (float[]) SystemUtils.a((Object) (new float[25]), (afloat) -> {
|
||||
+ private static final float[] j = (float[]) SystemUtils.a((new float[25]), (afloat) -> { // CraftBukkit - decompile error
|
||||
for (int i = -2; i <= 2; ++i) {
|
||||
for (int j = -2; j <= 2; ++j) {
|
||||
float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F);
|
||||
@@ -190,6 +190,11 @@
|
||||
f6 = f4;
|
||||
f7 = f5;
|
||||
}
|
||||
+ // CraftBukkit start - fix MC-54738
|
||||
+ if (f6 < -1.8F) {
|
||||
+ f6 = -1.8F;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
float f8 = f4 > f3 ? 0.5F : 1.0F;
|
||||
float f9 = f8 * ChunkGeneratorAbstract.j[l + 2 + (i1 + 2) * 5] / (f6 + 2.0F);
|
@ -8,7 +8,7 @@
|
||||
+ if ((entry.getValue()).removeIf((ticket) -> { // CraftBukkit - decompile error
|
||||
return ticket.b(this.currentTick);
|
||||
})) {
|
||||
this.e.b(entry.getLongKey(), a((ArraySetSorted) entry.getValue()), false);
|
||||
this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
|
||||
@@ -95,10 +95,25 @@
|
||||
}
|
||||
|
||||
@ -38,15 +38,6 @@
|
||||
return true;
|
||||
} else {
|
||||
if (!this.l.isEmpty()) {
|
||||
@@ -120,7 +135,7 @@
|
||||
|
||||
completablefuture.thenAccept((either) -> {
|
||||
this.m.execute(() -> {
|
||||
- this.k.a((Object) ChunkTaskQueueSorter.a(() -> {
|
||||
+ this.k.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error
|
||||
}, j, false));
|
||||
});
|
||||
});
|
||||
@@ -134,23 +149,25 @@
|
||||
}
|
||||
}
|
||||
@ -54,13 +45,13 @@
|
||||
- private void addTicket(long i, Ticket<?> ticket) {
|
||||
+ private boolean addTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
|
||||
int j = a(arraysetsorted);
|
||||
int j = getLowestTicketLevel(arraysetsorted);
|
||||
- Ticket<?> ticket1 = (Ticket) arraysetsorted.a((Object) ticket);
|
||||
+ Ticket<?> ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error
|
||||
|
||||
ticket1.a(this.currentTick);
|
||||
if (ticket.b() < j) {
|
||||
this.e.b(i, ticket.b(), true);
|
||||
this.ticketLevelTracker.update(i, ticket.b(), true);
|
||||
}
|
||||
|
||||
+ return ticket == ticket1; // CraftBukkit
|
||||
@ -80,7 +71,7 @@
|
||||
@@ -158,16 +175,29 @@
|
||||
}
|
||||
|
||||
this.e.b(i, a(arraysetsorted), false);
|
||||
this.ticketLevelTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
|
||||
+ return removed; // CraftBukkit
|
||||
}
|
||||
|
||||
@ -123,7 +114,7 @@
|
||||
+ ArraySetSorted<Ticket<?>> tickets = entry.getValue();
|
||||
+ if (tickets.remove(target)) {
|
||||
+ // copied from removeTicket
|
||||
+ this.e.b(entry.getLongKey(), a(tickets), false); // PAIL ticketLevelTracker // PAIL update // PAIL getLowestTicketLevel
|
||||
+ this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel(tickets), false);
|
||||
+
|
||||
+ // can't use entry after it's removed
|
||||
+ if (tickets.isEmpty()) {
|
||||
@ -137,28 +128,3 @@
|
||||
class a extends ChunkMap {
|
||||
|
||||
public a() {
|
||||
@@ -331,13 +381,13 @@
|
||||
Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i));
|
||||
|
||||
if (flag1) {
|
||||
- ChunkMapDistance.this.j.a((Object) ChunkTaskQueueSorter.a(() -> {
|
||||
+ ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error
|
||||
ChunkMapDistance.this.m.execute(() -> {
|
||||
if (this.c(this.c(i))) {
|
||||
ChunkMapDistance.this.addTicket(i, ticket);
|
||||
ChunkMapDistance.this.l.add(i);
|
||||
} else {
|
||||
- ChunkMapDistance.this.k.a((Object) ChunkTaskQueueSorter.a(() -> {
|
||||
+ ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error
|
||||
}, i, false));
|
||||
}
|
||||
|
||||
@@ -346,7 +396,7 @@
|
||||
return j;
|
||||
}));
|
||||
} else {
|
||||
- ChunkMapDistance.this.k.a((Object) ChunkTaskQueueSorter.a(() -> {
|
||||
+ ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error
|
||||
ChunkMapDistance.this.m.execute(() -> {
|
||||
ChunkMapDistance.this.removeTicket(i, ticket);
|
||||
});
|
||||
|
@ -1,23 +0,0 @@
|
||||
--- a/net/minecraft/server/ChunkProviderGenerate.java
|
||||
+++ b/net/minecraft/server/ChunkProviderGenerate.java
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
public class ChunkProviderGenerate extends ChunkGeneratorAbstract<GeneratorSettingsOverworld> {
|
||||
|
||||
- private static final float[] h = (float[]) SystemUtils.a((Object) (new float[25]), (afloat) -> {
|
||||
+ private static final float[] h = (float[]) SystemUtils.a((new float[25]), (afloat) -> { // CraftBukkit - decompile error
|
||||
for (int i = -2; i <= 2; ++i) {
|
||||
for (int j = -2; j <= 2; ++j) {
|
||||
float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F);
|
||||
@@ -83,6 +83,11 @@
|
||||
f4 = 1.0F + f4 * 2.0F;
|
||||
f5 = 1.0F + f5 * 4.0F;
|
||||
}
|
||||
+ // CraftBukkit start - fix MC-54738
|
||||
+ if (f4 < -1.8F) {
|
||||
+ f4 = -1.8F;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
float f6 = ChunkProviderGenerate.h[l + 2 + (i1 + 2) * 5] / (f4 + 2.0F);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -51,6 +51,16 @@
|
||||
@@ -54,6 +54,16 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -95,7 +105,7 @@
|
||||
@@ -98,7 +108,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
|
||||
ichunkaccess = this.cacheChunk[l];
|
||||
@ -26,7 +26,7 @@
|
||||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -141,12 +151,12 @@
|
||||
@@ -144,12 +154,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.a(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -173,7 +183,15 @@
|
||||
@@ -176,7 +186,15 @@
|
||||
int l = 33 + ChunkStatus.a(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getChunk(k);
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.a(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
@@ -192,7 +210,7 @@
|
||||
@@ -195,7 +213,7 @@
|
||||
}
|
||||
|
||||
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
|
||||
@ -67,7 +67,30 @@
|
||||
}
|
||||
|
||||
public boolean isLoaded(int i, int j) {
|
||||
@@ -294,11 +312,31 @@
|
||||
@@ -257,19 +275,19 @@
|
||||
public boolean a(Entity entity) {
|
||||
long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
|
||||
|
||||
- return this.a(i, PlayerChunk::b);
|
||||
+ return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(ChunkCoordIntPair chunkcoordintpair) {
|
||||
- return this.a(chunkcoordintpair.pair(), PlayerChunk::b);
|
||||
+ return this.a(chunkcoordintpair.pair(), (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition) {
|
||||
long i = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
|
||||
- return this.a(i, PlayerChunk::a);
|
||||
+ return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::a); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
|
||||
@@ -291,11 +309,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
@ -100,66 +123,22 @@
|
||||
public void tick(BooleanSupplier booleansupplier) {
|
||||
this.world.getMethodProfiler().enter("purge");
|
||||
this.chunkMapDistance.purgeTickets();
|
||||
@@ -318,13 +356,19 @@
|
||||
@@ -315,12 +353,12 @@
|
||||
this.lastTickTime = i;
|
||||
WorldData worlddata = this.world.getWorldData();
|
||||
boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES;
|
||||
boolean flag = this.world.isDebugWorld();
|
||||
- boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING);
|
||||
+ boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
this.world.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
|
||||
BlockPosition blockposition = this.world.getSpawn();
|
||||
- boolean flag2 = worlddata.getTime() % 400L == 0L;
|
||||
+ // CraftBukkit start - Other mob type spawn tick rate
|
||||
+ boolean spawnAnimalThisTick = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L;
|
||||
+ boolean spawnMonsterThisTick = world.ticksPerMonsterSpawns != 0L && worlddata.getTime() % world.ticksPerMonsterSpawns == 0L;
|
||||
+ boolean spawnWaterThisTick = world.ticksPerWaterSpawns != 0L && worlddata.getTime() % world.ticksPerWaterSpawns == 0L;
|
||||
+ boolean spawnAmbientThisTick = world.ticksPerAmbientSpawns != 0L && worlddata.getTime() % world.ticksPerAmbientSpawns == 0L;
|
||||
+ boolean flag2 = spawnAnimalThisTick;
|
||||
+ // CraftBukkit end
|
||||
+ boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
|
||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||
int l = this.chunkMapDistance.b();
|
||||
@@ -353,8 +397,35 @@
|
||||
for (int j1 = 0; j1 < i1; ++j1) {
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1];
|
||||
|
||||
+ // CraftBukkit start - Use per-world spawn limits
|
||||
+ boolean spawnThisTick = true;
|
||||
+ int limit = enumcreaturetype.b();
|
||||
+ switch (enumcreaturetype) {
|
||||
+ case MONSTER:
|
||||
+ spawnThisTick = spawnMonsterThisTick;
|
||||
+ limit = world.getWorld().getMonsterSpawnLimit();
|
||||
+ break;
|
||||
+ case CREATURE:
|
||||
+ spawnThisTick = spawnAnimalThisTick;
|
||||
+ limit = world.getWorld().getAnimalSpawnLimit();
|
||||
+ break;
|
||||
+ case WATER_CREATURE:
|
||||
+ spawnThisTick = spawnWaterThisTick;
|
||||
+ limit = world.getWorld().getWaterAnimalSpawnLimit();
|
||||
+ break;
|
||||
+ case AMBIENT:
|
||||
+ spawnThisTick = spawnAmbientThisTick;
|
||||
+ limit = world.getWorld().getAmbientSpawnLimit();
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (!spawnThisTick || limit == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) {
|
||||
- int k1 = enumcreaturetype.b() * l / ChunkProviderServer.b;
|
||||
+ int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits
|
||||
|
||||
if (object2intmap.getInt(enumcreaturetype) <= k1) {
|
||||
SpawnerCreature.a(enumcreaturetype, this.world, chunk, blockposition);
|
||||
@@ -507,12 +578,18 @@
|
||||
@@ -507,12 +545,18 @@
|
||||
|
||||
@Override
|
||||
protected boolean executeNext() {
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/CommandBlockListenerAbstract.java
|
||||
+++ b/net/minecraft/server/CommandBlockListenerAbstract.java
|
||||
@@ -4,6 +4,7 @@
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
|
||||
public abstract class CommandBlockListenerAbstract implements ICommandListener {
|
||||
|
||||
@@ -16,6 +17,10 @@
|
||||
@@ -17,6 +18,10 @@
|
||||
private IChatBaseComponent lastOutput;
|
||||
private String command = "";
|
||||
private IChatBaseComponent customName;
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
public CommandBlockListenerAbstract() {
|
||||
this.customName = CommandBlockListenerAbstract.c;
|
||||
@@ -112,7 +117,7 @@
|
||||
@@ -113,7 +118,7 @@
|
||||
|
||||
});
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/server/CommandDispatcher.java
|
||||
+++ b/net/minecraft/server/CommandDispatcher.java
|
||||
@@ -19,12 +19,21 @@
|
||||
@@ -17,12 +17,21 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.base.Joiner;
|
||||
+import java.util.Collection;
|
||||
+import java.util.LinkedHashSet;
|
||||
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
|
||||
+import org.bukkit.event.player.PlayerCommandSendEvent;
|
||||
+import org.bukkit.event.server.ServerCommandEvent;
|
||||
+// CraftBukkit end
|
||||
@ -17,30 +17,29 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> b = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
- public CommandDispatcher(boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ public final CommandDispatcher init(boolean flag) {
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype) {
|
||||
+ this(); // CraftBukkit
|
||||
CommandAdvancement.a(this.b);
|
||||
CommandAttribute.a(this.b);
|
||||
CommandExecute.a(this.b);
|
||||
CommandBossBar.a(this.b);
|
||||
@@ -100,14 +109,59 @@
|
||||
@@ -103,14 +112,57 @@
|
||||
}
|
||||
|
||||
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
||||
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection);
|
||||
+ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection); // CraftBukkit
|
||||
});
|
||||
+ return this;
|
||||
- this.b.setConsumer((commandcontext, flag, i) -> {
|
||||
- ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public CommandDispatcher() {
|
||||
+ // CraftBukkit end
|
||||
this.b.setConsumer((commandcontext, flag1, i) -> {
|
||||
((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag1, i);
|
||||
+ this.b.setConsumer((commandcontext, flag1, i) -> {
|
||||
+ ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag1, i);
|
||||
});
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public int dispatchServerCommand(CommandListenerWrapper sender, String command) {
|
||||
+ Joiner joiner = Joiner.on(" ");
|
||||
+ if (command.startsWith("/")) {
|
||||
@ -84,16 +83,16 @@
|
||||
StringReader stringreader = new StringReader(s);
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -134,7 +188,7 @@
|
||||
@@ -137,7 +189,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatBaseComponent ichatbasecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).a((chatmodifier) -> {
|
||||
- chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s));
|
||||
+ chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).format((chatmodifier) -> {
|
||||
- return chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s));
|
||||
+ return chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
|
||||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -184,11 +238,36 @@
|
||||
@@ -187,11 +239,36 @@
|
||||
}
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
@ -131,7 +130,7 @@
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -199,7 +278,7 @@
|
||||
@@ -202,7 +279,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
@ -140,7 +139,7 @@
|
||||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -222,7 +301,7 @@
|
||||
@@ -225,7 +302,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CommandEffect.java
|
||||
+++ b/net/minecraft/server/CommandEffect.java
|
||||
@@ -63,7 +63,7 @@
|
||||
@@ -62,7 +62,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@
|
||||
@@ -88,7 +88,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@
|
||||
@@ -113,7 +113,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
+import com.mojang.brigadier.tree.CommandNode;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -31,6 +32,7 @@
|
||||
import java.util.Set;
|
||||
@@ -32,6 +33,7 @@
|
||||
private final ResultConsumer<CommandListenerWrapper> l;
|
||||
private final ArgumentAnchor.Anchor m;
|
||||
private final Vec2F n;
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
|
||||
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
|
||||
@@ -120,9 +122,22 @@
|
||||
@@ -121,9 +123,22 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int i) {
|
||||
@ -39,18 +39,18 @@
|
||||
public Vec3D getPosition() {
|
||||
return this.d;
|
||||
}
|
||||
@@ -184,7 +199,7 @@
|
||||
@@ -185,7 +200,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (entityplayer != this.base && this.i.getPlayerList().isOp(entityplayer.getProfile())) {
|
||||
+ if (entityplayer != this.base && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
|
||||
entityplayer.sendMessage(ichatbasecomponent1);
|
||||
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.b);
|
||||
}
|
||||
}
|
||||
@@ -234,4 +249,10 @@
|
||||
public CompletableFuture<Suggestions> a(CommandContext<ICompletionProvider> commandcontext, SuggestionsBuilder suggestionsbuilder) {
|
||||
return null;
|
||||
@@ -240,4 +255,10 @@
|
||||
public Set<ResourceKey<World>> p() {
|
||||
return this.i.E();
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
19
nms-patches/CommandReload.patch
Normal file
19
nms-patches/CommandReload.patch
Normal file
@ -0,0 +1,19 @@
|
||||
--- a/net/minecraft/server/CommandReload.java
|
||||
+++ b/net/minecraft/server/CommandReload.java
|
||||
@@ -36,6 +36,16 @@
|
||||
return collection1;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public static void reload(MinecraftServer minecraftserver) {
|
||||
+ ResourcePackRepository<?> resourcepackrepository = minecraftserver.getResourcePackRepository();
|
||||
+ SaveData savedata = minecraftserver.getSaveData();
|
||||
+ Collection<String> collection = resourcepackrepository.d();
|
||||
+ Collection<String> collection1 = a(resourcepackrepository, savedata, collection);
|
||||
+ minecraftserver.a(collection1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
|
||||
com_mojang_brigadier_commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) CommandDispatcher.a("reload").requires((commandlistenerwrapper) -> {
|
||||
return commandlistenerwrapper.hasPermission(2);
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/CommandSpreadPlayers.java
|
||||
@@ -58,7 +58,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getScoreboardTeam());
|
||||
} else {
|
||||
@ -9,32 +9,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
@@ -270,7 +270,7 @@
|
||||
|
||||
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
|
||||
blockposition_mutableblockposition.c(EnumDirection.DOWN);
|
||||
- flag1 = iblockaccess.getType(blockposition_mutableblockposition).isAir();
|
||||
+ flag1 = getType(iblockaccess, blockposition_mutableblockposition).isAir(); // CraftBukkit
|
||||
if (!flag1 && flag2 && flag) {
|
||||
return blockposition_mutableblockposition.getY() + 1;
|
||||
}
|
||||
@@ -283,7 +283,7 @@
|
||||
|
||||
blockposition = blockposition.down();
|
||||
- } while (iblockaccess.getType(blockposition).isAir());
|
||||
+ } while (getType(iblockaccess, blockposition).isAir()); // CraftBukkit
|
||||
|
||||
return blockposition.getY() + 1;
|
||||
}
|
||||
@@ -282,7 +282,7 @@
|
||||
}
|
||||
|
||||
blockposition = blockposition.down();
|
||||
- iblockdata = iblockaccess.getType(blockposition);
|
||||
+ iblockdata = getType(iblockaccess, blockposition); // CraftBukkit
|
||||
} while (iblockdata.isAir());
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = getType(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
@@ -294,5 +294,12 @@
|
||||
|
||||
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -293,5 +293,12 @@
|
||||
this.a = MathHelper.a(random, d0, d2);
|
||||
this.b = MathHelper.a(random, d1, d3);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - add a version of getType which force loads chunks
|
||||
+ private static IBlockData getType(IBlockAccess iblockaccess, BlockPosition position) {
|
||||
+ ((ChunkProviderServer) ((World) iblockaccess).chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4, true);
|
||||
+ ((WorldServer) iblockaccess).getChunkProvider().getChunkAt(position.getX() >> 4, position.getZ() >> 4, true);
|
||||
+ return iblockaccess.getType(position);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/server/CommandSummon.java
|
||||
+++ b/net/minecraft/server/CommandSummon.java
|
||||
@@ -30,7 +30,7 @@
|
||||
if (EntityTypes.getName(EntityTypes.LIGHTNING_BOLT).equals(minecraftkey)) {
|
||||
EntityLightning entitylightning = new EntityLightning(commandlistenerwrapper.getWorld(), vec3d.x, vec3d.y, vec3d.z, false);
|
||||
|
||||
- commandlistenerwrapper.getWorld().strikeLightning(entitylightning);
|
||||
+ commandlistenerwrapper.getWorld().strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.COMMAND); // CraftBukkit
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.summon.success", new Object[]{entitylightning.getScoreboardDisplayName()}), true);
|
||||
return 1;
|
||||
} else {
|
@ -12,37 +12,37 @@
|
||||
|
||||
public class CommandTeleport {
|
||||
|
||||
@@ -121,9 +126,9 @@
|
||||
}
|
||||
@@ -128,9 +133,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == entity.world) {
|
||||
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
|
||||
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
} else {
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
}
|
||||
if (worldserver == entity.world) {
|
||||
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
|
||||
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
} else {
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
}
|
||||
|
||||
entity.setHeadRotation(f);
|
||||
@@ -132,6 +137,21 @@
|
||||
float f3 = MathHelper.g(f1);
|
||||
entity.setHeadRotation(f);
|
||||
@@ -139,6 +144,21 @@
|
||||
float f3 = MathHelper.g(f1);
|
||||
|
||||
f3 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
|
||||
+ worldserver.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
f3 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
|
||||
+ worldserver.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ d0 = to.getX();
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f3 = to.getPitch();
|
||||
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
if (worldserver == entity.world) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f3);
|
||||
entity.setHeadRotation(f2);
|
||||
+ d0 = to.getX();
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f3 = to.getPitch();
|
||||
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
if (worldserver == entity.world) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f3);
|
||||
entity.setHeadRotation(f2);
|
||||
|
@ -1,18 +1,17 @@
|
||||
--- a/net/minecraft/server/CommandTime.java
|
||||
+++ b/net/minecraft/server/CommandTime.java
|
||||
@@ -4,6 +4,11 @@
|
||||
@@ -4,6 +4,10 @@
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import java.util.Iterator;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.world.TimeSkipEvent;
|
||||
+// CrafBukkit end
|
||||
+
|
||||
import java.util.Iterator;
|
||||
|
||||
public class CommandTime {
|
||||
@@ -47,7 +52,13 @@
|
||||
|
||||
@@ -46,7 +50,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
@ -27,7 +26,7 @@
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
|
||||
@@ -60,7 +71,13 @@
|
||||
@@ -59,7 +69,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
protected Container(@Nullable Containers<?> containers, int i) {
|
||||
this.e = containers;
|
||||
this.windowId = i;
|
||||
@@ -180,6 +213,7 @@
|
||||
@@ -202,6 +235,7 @@
|
||||
k = playerinventory.getCarried().getCount();
|
||||
Iterator iterator = this.i.iterator();
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Slot slot1 = (Slot) iterator.next();
|
||||
ItemStack itemstack3 = playerinventory.getCarried();
|
||||
@@ -195,12 +229,48 @@
|
||||
@@ -217,12 +251,48 @@
|
||||
}
|
||||
|
||||
k -= itemstack4.getCount() - j1;
|
||||
@ -107,20 +107,20 @@
|
||||
}
|
||||
|
||||
this.d();
|
||||
@@ -217,8 +287,11 @@
|
||||
@@ -239,8 +309,11 @@
|
||||
if (i == -999) {
|
||||
if (!playerinventory.getCarried().isEmpty()) {
|
||||
if (j == 0) {
|
||||
- entityhuman.drop(playerinventory.getCarried(), true);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack carried = playerinventory.getCarried();
|
||||
playerinventory.setCarried(ItemStack.a);
|
||||
playerinventory.setCarried(ItemStack.b);
|
||||
+ entityhuman.drop(carried, true);
|
||||
+ // CraftBukkit start
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
@@ -306,6 +379,15 @@
|
||||
@@ -328,6 +401,15 @@
|
||||
}
|
||||
|
||||
slot2.d();
|
||||
@ -135,15 +135,15 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
} else if (inventoryclicktype == InventoryClickType.SWAP && j >= 0 && j < 9) {
|
||||
@@ -408,8 +490,11 @@
|
||||
} else if (inventoryclicktype == InventoryClickType.SWAP) {
|
||||
@@ -430,8 +512,11 @@
|
||||
PlayerInventory playerinventory = entityhuman.inventory;
|
||||
|
||||
if (!playerinventory.getCarried().isEmpty()) {
|
||||
- entityhuman.drop(playerinventory.getCarried(), false);
|
||||
+ // CraftBukkit start - SPIGOT-4556
|
||||
+ ItemStack carried = playerinventory.getCarried();
|
||||
playerinventory.setCarried(ItemStack.a);
|
||||
playerinventory.setCarried(ItemStack.b);
|
||||
+ entityhuman.drop(carried, false);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/ContainerAnvil.java
|
||||
+++ b/net/minecraft/server/ContainerAnvil.java
|
||||
@@ -6,6 +6,10 @@
|
||||
@@ -6,12 +6,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -8,68 +8,57 @@
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ContainerAnvil extends Container {
|
||||
public class ContainerAnvil extends ContainerAnvilAbstract {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -16,6 +20,12 @@
|
||||
private int h;
|
||||
public String renameText;
|
||||
private final EntityHuman player;
|
||||
public final ContainerProperty levelCost;
|
||||
+ // CraftBukkit start
|
||||
+ public int maximumRepairCost = 40;
|
||||
+ private int lastLevelCost;
|
||||
+ private CraftInventoryView bukkitEntity;
|
||||
+ private PlayerInventory playerInventory;
|
||||
+ // CraftBukkit end
|
||||
|
||||
public ContainerAnvil(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, ContainerAccess.a);
|
||||
@@ -23,6 +33,7 @@
|
||||
|
||||
public ContainerAnvil(int i, PlayerInventory playerinventory, final ContainerAccess containeraccess) {
|
||||
super(Containers.ANVIL, i);
|
||||
+ this.playerInventory = playerinventory; // CraftBukkit
|
||||
this.resultInventory = new InventoryCraftResult();
|
||||
this.repairInventory = new InventorySubcontainer(2) {
|
||||
@Override
|
||||
@@ -123,7 +134,7 @@
|
||||
@@ -85,7 +93,7 @@
|
||||
byte b1 = 0;
|
||||
|
||||
if (itemstack.isEmpty()) {
|
||||
- this.resultInventory.setItem(0, ItemStack.a);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
|
||||
- this.resultInventory.setItem(0, ItemStack.b);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
|
||||
this.levelCost.set(0);
|
||||
} else {
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
@@ -141,7 +152,7 @@
|
||||
@@ -103,7 +111,7 @@
|
||||
if (itemstack1.e() && itemstack1.getItem().a(itemstack, itemstack2)) {
|
||||
k = Math.min(itemstack1.getDamage(), itemstack1.h() / 4);
|
||||
if (k <= 0) {
|
||||
- this.resultInventory.setItem(0, ItemStack.a);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
|
||||
- this.resultInventory.setItem(0, ItemStack.b);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
|
||||
this.levelCost.set(0);
|
||||
return;
|
||||
}
|
||||
@@ -156,7 +167,7 @@
|
||||
@@ -118,7 +126,7 @@
|
||||
this.h = i1;
|
||||
} else {
|
||||
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) {
|
||||
- this.resultInventory.setItem(0, ItemStack.a);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
|
||||
- this.resultInventory.setItem(0, ItemStack.b);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
|
||||
this.levelCost.set(0);
|
||||
return;
|
||||
}
|
||||
@@ -246,7 +257,7 @@
|
||||
@@ -208,7 +216,7 @@
|
||||
}
|
||||
|
||||
if (flag2 && !flag1) {
|
||||
- this.resultInventory.setItem(0, ItemStack.a);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit
|
||||
- this.resultInventory.setItem(0, ItemStack.b);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.b); // CraftBukkit
|
||||
this.levelCost.set(0);
|
||||
return;
|
||||
}
|
||||
@@ -270,11 +281,11 @@
|
||||
itemstack1 = ItemStack.a;
|
||||
@@ -232,11 +240,11 @@
|
||||
itemstack1 = ItemStack.b;
|
||||
}
|
||||
|
||||
- if (b1 == i && b1 > 0 && this.levelCost.get() >= 40) {
|
||||
@ -80,10 +69,10 @@
|
||||
|
||||
- if (this.levelCost.get() >= 40 && !this.player.abilities.canInstantlyBuild) {
|
||||
+ if (this.levelCost.get() >= maximumRepairCost && !this.player.abilities.canInstantlyBuild) { // CraftBukkit
|
||||
itemstack1 = ItemStack.a;
|
||||
itemstack1 = ItemStack.b;
|
||||
}
|
||||
|
||||
@@ -293,7 +304,7 @@
|
||||
@@ -255,7 +263,7 @@
|
||||
EnchantmentManager.a(map, itemstack1);
|
||||
}
|
||||
|
||||
@ -92,15 +81,7 @@
|
||||
this.c();
|
||||
}
|
||||
}
|
||||
@@ -312,6 +323,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canUse(EntityHuman entityhuman) {
|
||||
+ if (!this.checkReachable) return true; // CraftBukkit
|
||||
return (Boolean) this.containerAccess.a((world, blockposition) -> {
|
||||
return !world.getType(blockposition).a(TagsBlock.ANVIL) ? false : entityhuman.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
|
||||
}, true);
|
||||
@@ -370,4 +382,18 @@
|
||||
@@ -278,4 +286,18 @@
|
||||
|
||||
this.e();
|
||||
}
|
||||
|
10
nms-patches/ContainerAnvilAbstract.patch
Normal file
10
nms-patches/ContainerAnvilAbstract.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/server/ContainerAnvilAbstract.java
|
||||
+++ b/net/minecraft/server/ContainerAnvilAbstract.java
|
||||
@@ -79,6 +79,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canUse(EntityHuman entityhuman) {
|
||||
+ if (!this.checkReachable) return true; // CraftBukkit
|
||||
return (Boolean) this.containerAccess.a((world, blockposition) -> {
|
||||
return !this.a(world.getType(blockposition)) ? false : entityhuman.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
|
||||
}, true);
|
@ -34,7 +34,7 @@
|
||||
return a(this.containerAccess, entityhuman, Blocks.BEACON);
|
||||
}
|
||||
|
||||
@@ -145,4 +153,17 @@
|
||||
@@ -143,4 +151,17 @@
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@
|
||||
this.c();
|
||||
});
|
||||
} else {
|
||||
@@ -167,25 +231,53 @@
|
||||
@@ -167,9 +231,24 @@
|
||||
ItemStack itemstack2 = itemstack;
|
||||
List<WeightedRandomEnchant> list = this.a(itemstack, i, this.costs[i]);
|
||||
|
||||
@ -142,6 +142,7 @@
|
||||
|
||||
if (flag) {
|
||||
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
|
||||
@@ -182,16 +261,29 @@
|
||||
this.enchantSlots.setItem(0, itemstack2);
|
||||
}
|
||||
|
||||
@ -177,7 +178,7 @@
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack1.subtract(j);
|
||||
if (itemstack1.isEmpty()) {
|
||||
@@ -232,6 +324,7 @@
|
||||
@@ -238,6 +330,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canUse(EntityHuman entityhuman) {
|
||||
@ -185,7 +186,7 @@
|
||||
return a(this.containerAccess, entityhuman, Blocks.ENCHANTING_TABLE);
|
||||
}
|
||||
|
||||
@@ -285,4 +378,17 @@
|
||||
@@ -289,4 +382,17 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
@ -51,9 +51,9 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,4 +206,17 @@
|
||||
public int h() {
|
||||
return this.craftInventory.f();
|
||||
@@ -192,4 +210,17 @@
|
||||
public InventoryCrafting j() {
|
||||
return this.craftInventory;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
39
nms-patches/ContainerSmithing.patch
Normal file
39
nms-patches/ContainerSmithing.patch
Normal file
@ -0,0 +1,39 @@
|
||||
--- a/net/minecraft/server/ContainerSmithing.java
|
||||
+++ b/net/minecraft/server/ContainerSmithing.java
|
||||
@@ -3,12 +3,17 @@
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
||||
+
|
||||
public class ContainerSmithing extends ContainerAnvilAbstract {
|
||||
|
||||
private final World g;
|
||||
@Nullable
|
||||
private RecipeSmithing h;
|
||||
private final List<RecipeSmithing> i;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity;
|
||||
+ // CraftBukkit end
|
||||
|
||||
public ContainerSmithing(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, ContainerAccess.a);
|
||||
@@ -68,4 +73,18 @@
|
||||
return recipesmithing.a(itemstack);
|
||||
});
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public CraftInventoryView getBukkitView() {
|
||||
+ if (bukkitEntity != null) {
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithing(
|
||||
+ this.repairInventory, this.resultInventory);
|
||||
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
@ -44,7 +44,7 @@
|
||||
+ protected static void a(int i, World world, EntityHuman entityhuman, InventoryCrafting inventorycrafting, InventoryCraftResult inventorycraftresult, Container container) { // CraftBukkit
|
||||
if (!world.isClientSide) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
|
||||
ItemStack itemstack = ItemStack.a;
|
||||
ItemStack itemstack = ItemStack.b;
|
||||
@@ -55,6 +67,7 @@
|
||||
itemstack = recipecrafting.a(inventorycrafting);
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
});
|
||||
public static final Containers<ContainerLoom> LOOM = a("loom", ContainerLoom::new);
|
||||
public static final Containers<ContainerMerchant> MERCHANT = a("merchant", ContainerMerchant::new);
|
||||
@@ -30,12 +30,17 @@
|
||||
private final Containers.Supplier<T> x;
|
||||
@@ -31,12 +31,17 @@
|
||||
private final Containers.Supplier<T> y;
|
||||
|
||||
private static <T extends Container> Containers<T> a(String s, Containers.Supplier<T> containers_supplier) {
|
||||
- return (Containers) IRegistry.a(IRegistry.MENU, s, (Object) (new Containers<>(containers_supplier)));
|
||||
@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
private Containers(Containers.Supplier<T> containers_supplier) {
|
||||
this.x = containers_supplier;
|
||||
this.y = containers_supplier;
|
||||
}
|
||||
|
||||
- interface Supplier<T extends Container> {}
|
||||
|
54
nms-patches/Convertable.patch
Normal file
54
nms-patches/Convertable.patch
Normal file
@ -0,0 +1,54 @@
|
||||
--- a/net/minecraft/server/Convertable.java
|
||||
+++ b/net/minecraft/server/Convertable.java
|
||||
@@ -175,8 +175,10 @@
|
||||
};
|
||||
}
|
||||
|
||||
- public Convertable.ConversionSession c(String s) throws IOException {
|
||||
- return new Convertable.ConversionSession(s);
|
||||
+ // CraftBukkit start
|
||||
+ public Convertable.ConversionSession c(String s, ResourceKey<WorldDimension> dimensionType) throws IOException {
|
||||
+ return new Convertable.ConversionSession(s, dimensionType);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public class ConversionSession implements AutoCloseable {
|
||||
@@ -185,8 +187,12 @@
|
||||
public final java.nio.file.Path folder;
|
||||
private final String levelName;
|
||||
private final Map<SavedFile, java.nio.file.Path> e = Maps.newHashMap();
|
||||
+ // CraftBukkit start
|
||||
+ private final ResourceKey<WorldDimension> dimensionType;
|
||||
|
||||
- public ConversionSession(String s) throws IOException {
|
||||
+ public ConversionSession(String s, ResourceKey<WorldDimension> dimensionType) throws IOException {
|
||||
+ this.dimensionType = dimensionType;
|
||||
+ // CraftBukkit end
|
||||
this.levelName = s;
|
||||
this.folder = Convertable.this.universe.resolve(s);
|
||||
this.lock = SessionLock.a(this.folder);
|
||||
@@ -203,9 +209,23 @@
|
||||
}
|
||||
|
||||
public File a(ResourceKey<World> resourcekey) {
|
||||
- return DimensionManager.a(resourcekey, this.folder.toFile());
|
||||
+ // CraftBukkit start
|
||||
+ return this.getFolder(this.folder.toFile());
|
||||
}
|
||||
|
||||
+ private File getFolder(File file) {
|
||||
+ if (dimensionType == WorldDimension.OVERWORLD) {
|
||||
+ return file;
|
||||
+ } else if (dimensionType == WorldDimension.THE_NETHER) {
|
||||
+ return new File(file, "DIM-1");
|
||||
+ } else if (dimensionType == WorldDimension.THE_END) {
|
||||
+ return new File(file, "DIM1");
|
||||
+ } else {
|
||||
+ throw new IllegalArgumentException("Unknwon dimension " + this.dimensionType);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private void checkSession() {
|
||||
if (!this.lock.a()) {
|
||||
throw new IllegalStateException("Lock is no longer valid");
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user