Skip to content

Commit 1dcd407

Browse files
committed
Fix wolf heads + reload stability + bump rss pack version
1 parent e9a2b02 commit 1dcd407

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed
Binary file not shown.

config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ death-listener-priority: LOW
241241
# The head on the left is replaced with the one on the right when updated
242242
replace-heads:
243243
'PIG_ZOMBIE': 'ZOMBIFIED_PIGLIN'
244-
# 'ILLUSIONER': 'VILLAGER|FLETCHER|SWAMP'
244+
# 'WOLF': 'WOLF|PALE'
245+
# 'WOLF|GRUMM': 'WOLF|PALE|GRUMM'
245246

246247
# Whether to send usage statistics to bStats
247248
bstats-enabled: true

dh-localization/pack.mcmeta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"pack": {
3-
"pack_format": 32,
3+
"pack_format": 34,
44
"description": {"text":"DropHeads Localization","color":"gray"}
55
}
66
}

plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ description: Heads for every mob and player.
55
website: https://dev.bukkit.org/projects/dropheads
66
#3=major rewrite
77
#9=Reorganized texture file downloads, global click-info cooldown
8-
#6=1.21 EntityType name changes, added grumms, collared-wolf-variants, fixed looting, better texture-file downloading, legacy head stacking fix config option
9-
version: 3.9.6
8+
#7=fixed wolf heads not dropping
9+
version: 3.9.7
1010
api-version: 1.13
1111
softdepend: [HeadDatabase, Essentials, VanishNoPacket]
1212

src/net/evmodder/DropHeads/DropHeads.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import net.evmodder.EvLib.FileIO;
2626
import net.evmodder.EvLib.Updater;
2727

28-
//TODO:
28+
//TODO:MurilinHN
2929
// * /dropheads reload
3030
// * improve textures listed at the bottom of head-textures.txt
3131
// * move textures to DropHeads/textures/MOB_NAME.txt => "SHEEP|RED: value \n SHEEP|BLUE: value ..."?

src/net/evmodder/DropHeads/HeadAPI.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.evmodder.DropHeads;
22

33
import java.io.File;
4+
import java.io.InputStream;
45
import java.io.InputStreamReader;
56
import java.nio.charset.StandardCharsets;
67
import java.util.ArrayList;
@@ -202,11 +203,11 @@ void loadTextures(String headsList, boolean logMissingEntities, boolean logUnkno
202203
PREFER_VANILLA_HEADS = pl.getConfig().getBoolean("prefer-vanilla-heads", true);
203204

204205
//---------- <Load translations> ----------------------------------------------------------------------
205-
translationsFile = FileIO.loadConfig(pl, "translations.yml",
206-
getClass().getResourceAsStream("/translations.yml"), /*notifyIfNew=*/false);
207-
Configuration embeddedTranslationsFile = YamlConfiguration.loadConfiguration(
208-
new InputStreamReader(getClass().getResourceAsStream("/translations.yml")));
209-
translationsFile.setDefaults(embeddedTranslationsFile);
206+
translationsFile = FileIO.loadConfig(pl, "translations.yml", getClass().getResourceAsStream("/translations.yml"), /*notifyIfNew=*/false);
207+
final InputStream translationsIS = getClass().getResourceAsStream("/translations.yml"); // Can't reuse InputStreams
208+
if(translationsIS != null){ // getResourceAsStream() returns null after a plugin reload
209+
translationsFile.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(translationsIS)));
210+
}
210211
// See if we can use the 1.19.4+ "fallback" feature
211212
USE_TRANSLATE_FALLBACKS = translationsFile.getBoolean("use-translation-fallbacks", false) && Bukkit.getBukkitVersion().compareTo("1.19.4") >= 0;
212213

src/net/evmodder/DropHeads/JunkUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public final static double getSpawnCauseMult(Entity e){
128128

129129
@SuppressWarnings("deprecation")
130130
public final static int getLootingLevel(ItemStack item){
131+
if(item == null) return 0;
131132
Enchantment ench = Enchantment.getByName("LOOTING");
132133
if(ench == null) ench = Enchantment.getByName("LOOT_BONUS_MOBS");
133134
return item.getEnchantmentLevel(ench);

src/net/evmodder/DropHeads/TextureKeyLookup.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.evmodder.DropHeads;
22

33
import org.bukkit.DyeColor;
4+
import org.bukkit.Keyed;
45
import org.bukkit.Location;
56
import org.bukkit.block.BlockFace;
67
import org.bukkit.entity.Creeper;
@@ -189,7 +190,7 @@ public static String getTextureKey(Entity entity){
189190
((Wolf)entity).isAngry() ? "|ANGRY" : "";
190191
if(ReflectionUtils.getServerVersionString().compareTo("v1_20_5") < 0) return "WOLF"+tameAndCollarOrAngry;
191192
if(mWolfGetVariant == null) mWolfGetVariant = ReflectionUtils.getRefClass("org.bukkit.entity.Wolf").getMethod("getVariant");
192-
return "WOLF|"+((Enum)mWolfGetVariant.of(entity).call()).name()+tameAndCollarOrAngry;
193+
return "WOLF|"+((Keyed)mWolfGetVariant.of(entity).call()).getKey().getKey().toUpperCase()+tameAndCollarOrAngry;
193194
}
194195
case "CHEST_BOAT":
195196
if(mChestBoatGetType == null) mChestBoatGetType = ReflectionUtils.getRefClass("org.bukkit.entity.ChestBoat").getMethod("getBoatType");

0 commit comments

Comments
 (0)