Skip to content

Commit 99e2f95

Browse files
committed
Fix getting chest boat inventories after 1.21.2
1 parent f7c8d1d commit 99e2f95

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/java/com/laytonsmith/abstraction/bukkit/BukkitConvertor.java

+19
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCSkull;
4949
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCAgeable;
5050
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCAnimal;
51+
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCBoat;
5152
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCBreedable;
53+
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCChestBoat;
5254
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCCommandMinecart;
5355
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCComplexEntityPart;
5456
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCComplexLivingEntity;
@@ -130,7 +132,9 @@
130132
import org.bukkit.command.ConsoleCommandSender;
131133
import org.bukkit.entity.Ageable;
132134
import org.bukkit.entity.Animals;
135+
import org.bukkit.entity.Boat;
133136
import org.bukkit.entity.Breedable;
137+
import org.bukkit.entity.ChestBoat;
134138
import org.bukkit.entity.ComplexEntityPart;
135139
import org.bukkit.entity.ComplexLivingEntity;
136140
import org.bukkit.entity.Entity;
@@ -463,6 +467,21 @@ public static MCEntity BukkitGetCorrectEntity(Entity be) {
463467
return new BukkitMCMinecart(be);
464468
}
465469

470+
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_21_3)) {
471+
// boats were split into different classes by wood type
472+
if(be instanceof ChestBoat) {
473+
// Must come before Boat
474+
type.setWrapperClass(BukkitMCChestBoat.class);
475+
return new BukkitMCChestBoat(be);
476+
}
477+
478+
if(be instanceof Boat) {
479+
// Must come before Vehicle
480+
type.setWrapperClass(BukkitMCBoat.class);
481+
return new BukkitMCBoat(be);
482+
}
483+
}
484+
466485
if(be instanceof SizedFireball) {
467486
// Must come before Fireball
468487
type.setWrapperClass(BukkitMCSizedFireball.class);

0 commit comments

Comments
 (0)