mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 16:34:44 +01:00
85f704e537
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
82 lines
3.2 KiB
Diff
82 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
|
Date: Tue, 19 Mar 2024 19:23:44 +0100
|
|
Subject: [PATCH] remove CraftTropicalFish.CraftPattern
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
|
index 9e53c30801c700719c78c0fd521fd615c94e02c8..238ab5c01ad8b5b09f11259cddbafa1d3e0daf05 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
|
@@ -1,11 +1,8 @@
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
-import java.util.HashMap;
|
|
-import java.util.Map;
|
|
import org.bukkit.DyeColor;
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.entity.TropicalFish;
|
|
-import org.bukkit.entity.TropicalFish.Pattern;
|
|
|
|
public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFish implements TropicalFish { // Paper - Schooling Fish API
|
|
|
|
@@ -53,48 +50,9 @@ public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFi
|
|
this.getHandle().setPackedVariant(CraftTropicalFish.getData(this.getPatternColor(), this.getBodyColor(), pattern));
|
|
}
|
|
|
|
- public static enum CraftPattern {
|
|
- KOB(0, false),
|
|
- SUNSTREAK(1, false),
|
|
- SNOOPER(2, false),
|
|
- DASHER(3, false),
|
|
- BRINELY(4, false),
|
|
- SPOTTY(5, false),
|
|
- FLOPPER(0, true),
|
|
- STRIPEY(1, true),
|
|
- GLITTER(2, true),
|
|
- BLOCKFISH(3, true),
|
|
- BETTY(4, true),
|
|
- CLAYFISH(5, true);
|
|
-
|
|
- private final int variant;
|
|
- private final boolean large;
|
|
-
|
|
- //
|
|
- private static final Map<Integer, Pattern> BY_DATA = new HashMap<>();
|
|
-
|
|
- static {
|
|
- for (CraftPattern type : values()) {
|
|
- BY_DATA.put(type.getDataValue(), Pattern.values()[type.ordinal()]);
|
|
- }
|
|
- }
|
|
-
|
|
- public static Pattern fromData(int data) {
|
|
- return BY_DATA.get(data);
|
|
- }
|
|
-
|
|
- private CraftPattern(int variant, boolean large) {
|
|
- this.variant = variant;
|
|
- this.large = large;
|
|
- }
|
|
-
|
|
- public int getDataValue() {
|
|
- return this.variant << 8 | ((this.large) ? 1 : 0);
|
|
- }
|
|
- }
|
|
-
|
|
public static int getData(DyeColor patternColor, DyeColor bodyColor, Pattern type) {
|
|
- return patternColor.getWoolData() << 24 | bodyColor.getWoolData() << 16 | CraftPattern.values()[type.ordinal()].getDataValue();
|
|
+ net.minecraft.world.entity.animal.TropicalFish.Pattern pattern = net.minecraft.world.entity.animal.TropicalFish.Pattern.valueOf(type.name());
|
|
+ return patternColor.getWoolData() << 24 | bodyColor.getWoolData() << 16 | pattern.getPackedId();
|
|
}
|
|
|
|
public static DyeColor getPatternColor(int data) {
|
|
@@ -106,6 +64,6 @@ public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFi
|
|
}
|
|
|
|
public static Pattern getPattern(int data) {
|
|
- return CraftPattern.fromData(data & 0xFFFF);
|
|
+ return Pattern.valueOf(net.minecraft.world.entity.animal.TropicalFish.getPattern(data).name());
|
|
}
|
|
}
|