Skip to content

Commit

Permalink
Merge pull request #67 from Grzybol/patch-4.30.1
Browse files Browse the repository at this point in the history
- fixed customMobs!!! now spider works
  • Loading branch information
Grzybol authored Jun 21, 2024
2 parents 889d3ca + da10956 commit 3e1df98
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>betterbox.mine.game</groupId>
<artifactId>BetterElo</artifactId>
<version>4.3.25-SNAPSHOT</version>
<version>4.3.28-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BetterElo</name>
Expand Down
30 changes: 20 additions & 10 deletions src/main/java/betterbox/mine/game/betterelo/CustomMobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,22 @@ public void spawnMob(Location location) {
setupMob(); // Teraz wywołujemy setupMob() po stworzeniu encji
((BetterElo) plugin).registerCustomMob(this.entity, this);
}
public CustomMob cloneForSpawn(Location spawnLocation) {
CustomMob newMob = new CustomMob(this.plugin, this.dropFileManager, this.mobName, this.entityType,
this.helmet.clone(), this.chestplate.clone(),
this.leggings.clone(), this.boots.clone(), this.weapon.clone(),
this.armor, this.hp, this.speed,
this.attackDamage,this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS,this.EMKSchance);
newMob.spawnMob(spawnLocation);
public CustomMob cloneForSpawn(Location spawnLocation, String mobType) {

CustomMob newMob = null;
if (mobType.equals("SKELETON")|| mobType.equals("ZOMBIE")) {
newMob = new CustomMob(this.plugin, this.dropFileManager, this.mobName, this.entityType,
this.helmet.clone(), this.chestplate.clone(),
this.leggings.clone(), this.boots.clone(), this.weapon.clone(),
this.armor, this.hp, this.speed,
this.attackDamage, this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS, this.EMKSchance);
newMob.spawnMob(spawnLocation);
}else{
newMob = new CustomMob(this.plugin, this.dropFileManager, this.mobName, this.entityType,
this.armor, this.hp, this.speed,
this.attackDamage, this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS, this.EMKSchance);
newMob.spawnMob(spawnLocation);
}
return newMob;
}

Expand Down Expand Up @@ -406,7 +415,7 @@ public void spawnCustomMob(Location location, String spawnerName, String mobName
CustomMob templateMob = customMobsMap.get(mobName);
if (templateMob != null) {
Location adjustedLocation = adjustLocationToAirAbove(location);
CustomMob newMob = templateMob.cloneForSpawn(adjustedLocation);
CustomMob newMob = templateMob.cloneForSpawn(adjustedLocation, templateMob.entityType.toString());
newMob.customMetadata.put("SpawnerName", spawnerName);
newMob.spawnerName = spawnerName;
//newMob.dropTable = fileManager.loadCustomDrops(newMob.dropTableName);
Expand All @@ -417,11 +426,12 @@ public void spawnCustomMob(Location location, String spawnerName, String mobName
}
}
public void spawnCustomMob(Location location, String mobName) {
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobs.spawnCustomMob called, mobName: " + mobName+", location: "+location);

CustomMob templateMob = customMobsMap.get(mobName);
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobs.spawnCustomMob called, mobName: " + mobName+", location: "+location+", mobtype: "+templateMob.entityType.toString());
if (templateMob != null) {
Location adjustedLocation = adjustLocationToAirAbove(location);
CustomMob newMob = templateMob.cloneForSpawn(adjustedLocation);
CustomMob newMob = templateMob.cloneForSpawn(adjustedLocation, templateMob.entityType.toString());
//newMob.dropTable = fileManager.loadCustomDrops(newMob.dropTableName);
pluginLogger.log(PluginLogger.LogLevel.DROP, "CustomMobs.spawnCustomMob newMob.dropTablename: "+newMob.dropTableName+", newMob.dropTable: "+newMob.dropTable);
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobs.spawnCustomMob newMob.spawnerName: "+newMob.spawnerName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
ItemStack weapon=null;

if (entityTypeString.equals("SKELETON")||entityTypeString.equals("ZOMBIE")) {// Wczytanie wyposażenia z pliku
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob mob is ZOMBIE or SKELETON");
helmet = loadItemStack(mobData, "equipment.helmet");
chestplate = loadItemStack(mobData, "equipment.chestplate");
leggings = loadItemStack(mobData, "equipment.leggings");
Expand Down Expand Up @@ -290,6 +291,7 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
// Zakładamy, że LivingEntity jest nullem, ponieważ tworzymy moba bez konkretnej encji w świecie
CustomMobs.CustomMob customMob=null;
if (entityTypeString.equals("SKELETON")||entityTypeString.equals("ZOMBIE")){
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob mob is ZOMBIE or SKELETON");
customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, helmet, chestplate, leggings, boots,weapon, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance);

}else{
Expand Down

0 comments on commit 3e1df98

Please sign in to comment.