Skip to content

Commit 3070abe

Browse files
BONNegitlocalize-app[bot]OnlyPWMarmur2020Wolerus
authored
Prepare 1.17 release (#88)
* Fixes a 1.18 world generator bug where it generated dirt-grass layers. Expose 3 world generator options for overworld: - natural-surface - generates surface that is natural(-ish). Currently, it may be just grass and dirt layers. - natural-caves - generates caves inside world. - natural-bedrock - generates natural looking bedrock pattern. This also fixes a bug with floor and roof config option not working properly. Fixes BentoBoxWorld/Level#258 * Fixes issue when ores were not generated in correct form. #77 * Init 1.17.0 version * Translate de.yml via GitLocalize (#84) Co-authored-by: Patrick <[email protected]> * Translate ru.yml via GitLocalize (#85) Co-authored-by: Marmur2020 <[email protected]> * Rework entity populator. The new world populator on some engines are multi-threaded, however, minecraft does not allow to remove entities outside main-thread. As entity populator spawned entity and then removed when there were no spot for it, servers crashed. The issue should be fixed now as I add custom entity bounding box calculator before it is spawned to check if there is place for entity. Fixes #86 * Caveblock TR locale (#87) * Translate tr.yml via GitLocalize * Translate tr.yml via GitLocalize * Translate tr.yml via GitLocalize Co-authored-by: Wolerus <[email protected]> Co-authored-by: Over_Brave <[email protected]> Co-authored-by: mt-gitlocalize <[email protected]> Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com> Co-authored-by: Patrick <[email protected]> Co-authored-by: Marmur2020 <[email protected]> Co-authored-by: Wolerus <[email protected]> Co-authored-by: Over_Brave <[email protected]> Co-authored-by: mt-gitlocalize <[email protected]>
1 parent 0cbb775 commit 3070abe

File tree

5 files changed

+409
-30
lines changed

5 files changed

+409
-30
lines changed

pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
<properties>
4444
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4545
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
46-
<java.version>16</java.version>
46+
<java.version>17</java.version>
4747
<!-- More visible way how to change dependency versions -->
48-
<spigot.version>1.18.1-R0.1-SNAPSHOT</spigot.version>
48+
<spigot.version>1.19.2-R0.1-SNAPSHOT</spigot.version>
4949
<bentobox.version>1.19.0</bentobox.version>
5050
<!-- Revision variable removes warning about dynamic version -->
5151
<revision>${build.version}-SNAPSHOT</revision>
5252
<!-- This allows to change between versions and snapshots. -->
53-
<build.version>1.16.0</build.version>
53+
<build.version>1.17.0</build.version>
5454
<build.number>-LOCAL</build.number>
5555
<sonar.organization>bentobox-world</sonar.organization>
5656
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

src/main/java/world/bentobox/caveblock/generators/populators/EntitiesPopulator.java

+83-10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import org.bukkit.generator.LimitedRegion;
1212
import org.bukkit.generator.WorldInfo;
1313
import org.bukkit.util.BoundingBox;
14+
import org.eclipse.jdt.annotation.NonNull;
15+
1416
import world.bentobox.bentobox.util.Pair;
1517
import world.bentobox.caveblock.CaveBlock;
1618
import world.bentobox.caveblock.Utils;
@@ -95,7 +97,7 @@ private void loadSettings() {
9597
* @param limitedRegion Region where population operates.
9698
*/
9799
@Override
98-
public void populate(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, LimitedRegion limitedRegion) {
100+
public void populate(WorldInfo worldInfo, @NonNull Random random, int chunkX, int chunkZ, @NonNull LimitedRegion limitedRegion) {
99101
int minHeight = worldInfo.getMinHeight();
100102
int height = Math.min(worldInfo.getMaxHeight(), worldHeight) - 1;
101103

@@ -168,29 +170,22 @@ private void tryToPlaceEntity(WorldInfo worldInfo, Location location, LimitedReg
168170
if (!limitedRegion.isInRegion(location)) return;
169171
if (!limitedRegion.getType(location).equals(originalMaterial)) return;
170172

171-
Entity entity = limitedRegion.spawnEntity(location, entityType);
172-
if (entity instanceof LivingEntity livingEntity) {
173-
livingEntity.setAI(hasAI);
174-
livingEntity.setRemoveWhenFarAway(false);
175-
}
173+
BoundingBox bb = this.getEntityBoundingBox(entityType, location);
176174

177-
BoundingBox bb = entity.getBoundingBox();
178175
for (int x = (int) Math.floor(bb.getMinX()); x < bb.getMaxX(); x++) {
179176
for (int z = (int) Math.floor(bb.getMinZ()); z < bb.getMaxZ(); z++) {
180177
int y = (int) Math.floor(bb.getMinY());
181178
if (!limitedRegion.isInRegion(x, y, z)) {
182-
entity.remove();
183179
return;
184180
}
185181

186182
for (; y <= bb.getMaxY(); y++) {
187183
if (addon.getSettings().isDebug()) {
188-
addon.log("DEBUG: Entity spawn: " + worldInfo.getName() + " " + x + " " + y + " " + z + " " + entity.getType());
184+
addon.log("DEBUG: Entity spawn: " + worldInfo.getName() + " " + x + " " + y + " " + z + " " + entityType);
189185
}
190186

191187
if (!limitedRegion.isInRegion(x, y, z) || !limitedRegion.getType(x, y, z).equals(originalMaterial)) {
192188
// Cannot place entity
193-
entity.remove();
194189
return;
195190
}
196191
limitedRegion.setType(x, y, z, WATER_ENTITIES.contains(entityType) ? Material.WATER : Material.AIR);
@@ -201,8 +196,86 @@ private void tryToPlaceEntity(WorldInfo worldInfo, Location location, LimitedReg
201196
}
202197
}
203198
}
199+
200+
Entity entity = limitedRegion.spawnEntity(location, entityType);
201+
202+
if (entity instanceof LivingEntity livingEntity)
203+
{
204+
livingEntity.setAI(hasAI);
205+
livingEntity.setRemoveWhenFarAway(false);
206+
}
207+
}
208+
209+
210+
/**
211+
* This is manual bounding box calculation base on entity type.
212+
* @param entityType Entity type which bounding box should be created.
213+
* @param location Location of the bounding box.
214+
* @return Approximate bounding box of the entity type.
215+
*/
216+
private BoundingBox getEntityBoundingBox(EntityType entityType, Location location)
217+
{
218+
BoundingBox boundingBox = new BoundingBox();
219+
// Set bounding box to 1 for all entities
220+
boundingBox.expand(1);
221+
// Shift to correct location.
222+
boundingBox.shift(location);
223+
224+
switch (entityType)
225+
{
226+
// Turtles base size is 1.1
227+
case TURTLE -> boundingBox.expand(-0.05, 0, -0.05, 0.05, 0, 0.05);
228+
// Panda base size is 1.3 and height is 1.25
229+
case PANDA -> boundingBox.expand(-0.15, 0, -0.15, 0.15, 0.25, 0.15);
230+
// Sheep height is 1.3
231+
case SHEEP -> boundingBox.expand(0, 0, 0, 0, 0.3, 0);
232+
// Cow height is 1.4
233+
case COW, MUSHROOM_COW -> boundingBox.expand(0, 0, 0, 0, 0.4, 0);
234+
// Polar Bear base size is 1.3 and height is 1.4
235+
case POLAR_BEAR -> boundingBox.expand(-0.15, 0, -0.15, 0.15, 0.4, 0.15);
236+
// Horse base size is 1.3964
237+
case HORSE, ZOMBIE_HORSE, SKELETON_HORSE -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 0.6, 0.2);
238+
// Llama height is 1.875
239+
case LLAMA -> boundingBox.expand(0, 0, 0, 0, 0.875, 0);
240+
// Ravager base size is 1.95 and height is 2.2
241+
case RAVAGER -> boundingBox.expand(-0.48, 0, -0.48, 0.48, 1.2, 0.48);
242+
// Spider base size is 1.4
243+
case SPIDER -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 0, 0.2);
244+
// Creeper height 1.7
245+
case CREEPER -> boundingBox.expand(0, 0, 0, 0, 0.7, 0);
246+
// Blaze height 1.8
247+
case BLAZE -> boundingBox.expand(0, 0, 0, 0, 0.8, 0);
248+
// Zombie, evoker, villager, husk, witch, vindicator, illusioner, drowned, pigman, villager and pillager height is 1.95
249+
case ZOMBIE, EVOKER, VILLAGER, HUSK, WITCH, VINDICATOR, ILLUSIONER, DROWNED, PIGLIN, PIGLIN_BRUTE, ZOMBIFIED_PIGLIN, ZOMBIE_VILLAGER, PILLAGER, WANDERING_TRADER ->
250+
boundingBox.expand(0, 0, 0, 0, 0.95, 0);
251+
// Skeletons height is 1.99
252+
case SKELETON, STRAY -> boundingBox.expand(0, 0, 0, 0, 0.99, 0);
253+
// Elder Guardians base height is 2
254+
case ELDER_GUARDIAN -> boundingBox.expand(-0.5, 0, -0.5, 0.5, 1, 0.5);
255+
// Slimes are up to 2.04
256+
case SLIME -> boundingBox.expand(-0.5, 0, -0.5, 0.5, 1, 0.5);
257+
// Wither skeletons height is 2.4
258+
case WITHER_SKELETON -> boundingBox.expand(0, 0, 0, 0, 1.4, 0);
259+
// Wither height is 3.5
260+
case WITHER -> boundingBox.expand(0, 0, 0, 0, 2.5, 0);
261+
// Enderman height is 2.9
262+
case ENDERMAN -> boundingBox.expand(0, 0, 0, 0, 1.9, 0);
263+
// Ghast base size is 4
264+
case GHAST -> boundingBox.expand(-2, 0, -2, 2, 3, 2);
265+
// Iron Golem base size is 1.4 and height is 2.7
266+
case IRON_GOLEM -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 1.7, 0.2);
267+
// Snowman height is 1.9
268+
case SNOWMAN -> boundingBox.expand(0, 0, 0, 0, 0.9, 0);
269+
// Hoglin base size is 1.4 and height is 1.3965
270+
case HOGLIN, ZOGLIN -> boundingBox.expand(-0.2, 0, -0.2, 0.2, 0.4, 0.2);
271+
// Warden height is 2.9
272+
case WARDEN -> boundingBox.expand(0, 0, 0, 0, 1.9, 0);
273+
}
274+
275+
return boundingBox;
204276
}
205277

278+
206279
// ---------------------------------------------------------------------
207280
// Section: Private Classes
208281
// ---------------------------------------------------------------------

src/main/resources/locales/de.yml

+19-17
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ caveblock:
1818
no-safe-location-found: "&cKann keinen sicheren Ort finden, an den du dich in
1919
der Höhle teleportieren kannst."
2020
not-owner: "&cDu bist nicht der Besitzer deiner Höhle!"
21+
cave-limit-reached: "&c Du hast die Spitze deiner Höhle erreicht. Höher geht
22+
nicht!"
2123
commands:
2224
admin:
2325
team:
@@ -81,7 +83,7 @@ caveblock:
8183
Höhlen im Müll
8284
setrange:
8385
description: Stellen Sie die Reichweite der Spielerhöhle ein
84-
range-updated: Höhlenbereich auf [Nummer] aktualisiert
86+
range-updated: Höhlenbereich auf [number] aktualisiert
8587
tp:
8688
description: teleportiere zur Höhle eines Spielers
8789
getrank:
@@ -141,15 +143,15 @@ caveblock:
141143
description: Lass einen Spieler in deiner Höhle ranken
142144
uncoop:
143145
you-are-no-longer-a-coop-member: "&cSie sind kein Coop-Mitglied mehr in
144-
der Höhle von [Name]"
146+
der Höhle von [name]"
145147
all-members-logged-off: "& cAlle Höhlenmitglieder haben sich abgemeldet,
146-
sodass Sie nicht länger ein Coop-Mitglied der Höhle von [Name] sind"
148+
sodass Sie nicht länger ein Coop-Mitglied der Höhle von [name] sind "
147149
trust:
148150
description: Gib einem Spieler einen vertrauenswürdigen Rang in deiner Höhle
149151
invite:
150152
description: Lade einen Spieler ein, sich deiner Höhle anzuschließen
151-
name-has-invited-you: "& a [Name] hat dich eingeladen, dich ihrer Höhle
152-
anzuschließen."
153+
name-has-invited-you: "& a [name] hat dich eingeladen, dich ihrer Höhle
154+
anzuschließen. "
153155
you-will-lose-your-island: "& WARNUNG! Sie werden Ihre Höhle verlieren,
154156
wenn Sie akzeptieren!"
155157
errors:
@@ -164,16 +166,16 @@ caveblock:
164166
reject:
165167
you-rejected-invite: "& aSie lehnten die Einladung ab, sich einer Höhle
166168
anzuschließen."
167-
name-rejected-your-invite: "& c [Name] hat deine Höhleneinladung abgelehnt!"
169+
name-rejected-your-invite: "& c [name] hat deine Höhleneinladung abgelehnt!"
168170
cancel:
169171
description: storniere die ausstehende Einladung, dich deiner Höhle anzuschließen
170172
leave:
171173
description: Verlasse deine Höhle
172-
left-your-island: "& c [Name] & spalte deine Höhle"
174+
left-your-island: "& c [name] & spalte deine Höhle"
173175
kick:
174176
description: Entferne ein Mitglied aus deiner Höhle
175177
owner-kicked: "& cDer Besitzer hat dich aus der Höhle geworfen!"
176-
success: "& b [Name] & wurde aus deiner Höhle geworfen."
178+
success: "& b [name] & wurde aus deiner Höhle geworfen."
177179
demote:
178180
description: Herabstufen eines Spielers in Ihrer Höhle um einen Rang
179181
promote:
@@ -182,27 +184,27 @@ caveblock:
182184
description: Übertragen Sie Ihren Höhlenbesitz auf ein Mitglied
183185
errors:
184186
target-is-not-member: "& cDieser Spieler ist nicht Teil Ihres Höhlenteams!"
185-
name-is-the-owner: "& a [Name] ist jetzt der Höhlenbesitzer!"
187+
name-is-the-owner: "& a [name] ist jetzt der Höhlenbesitzer!"
186188
you-are-the-owner: "& aSie sind jetzt der Höhlenbesitzer!"
187189
ban:
188190
description: verbanne einen Spieler aus deiner Höhle
189191
cannot-ban-more-players: "& cSie haben das Sperrlimit erreicht, können Sie
190192
keine Spieler mehr aus Ihrer Höhle verbannen."
191-
player-banned: "& b [Name] & c ist jetzt aus deiner Höhle verbannt."
192-
owner-banned-you: "& b [Name] & c hat dich aus ihrer Höhle verbannt!"
193+
player-banned: "& b [name] & c ist jetzt aus deiner Höhle verbannt."
194+
owner-banned-you: "& b [name] & c hat dich aus ihrer Höhle verbannt!"
193195
you-are-banned: "& bSie sind aus dieser Höhle verbannt!"
194196
unban:
195197
description: Entbinde einen Spieler aus deiner Höhle
196-
player-unbanned: "& b [Name] & a ist jetzt nicht mehr in deiner Höhle verboten."
197-
you-are-unbanned: "& b [Name] & a verbannt dich aus ihrer Höhle!"
198+
player-unbanned: "& b [name] & a ist jetzt nicht mehr in deiner Höhle verboten."
199+
you-are-unbanned: "& b [name] & a verbannt dich aus ihrer Höhle!"
198200
banlist:
199201
noone: "& aKeine Höhle ist in dieser Höhle verboten."
200202
settings:
201203
description: Höhleneinstellungen anzeigen
202204
expel:
203205
description: Vertreibe einen Spieler aus deiner Höhle
204206
not-on-island: "& cDieser Spieler ist nicht in deiner Höhle!"
205-
player-expelled-you: "& b [Name] & c hat dich aus der Höhle vertrieben!"
207+
player-expelled-you: "& b [name] & c hat dich aus der Höhle vertrieben!"
206208
ranks:
207209
owner: Zwergenkönig
208210
sub-owner: Zwergenritter
@@ -219,7 +221,7 @@ caveblock:
219221
& Ablocks aus Höhlen
220222
name: Enderman trauert
221223
ENTER_EXIT_MESSAGES:
222-
island: "[Name] Höhle"
224+
island: "[name] Höhle"
223225
GEO_LIMIT_MOBS:
224226
description: |-
225227
& aEntferne Mobs, die gehen
@@ -287,8 +289,8 @@ caveblock:
287289
hint: "& cSie können sich nicht in Ihre Höhle zurück teleportieren, während
288290
Sie fallen."
289291
locked: "& cDiese Höhle ist verschlossen!"
290-
protected: "& cCave protected: [Beschreibung]"
291-
spawn-protected: "& cSpawn protected: [Beschreibung]"
292+
protected: "& cCave protected: [description]"
293+
spawn-protected: "& cSpawn protected: [description]"
292294
panel:
293295
PROTECTION:
294296
description: |-

src/main/resources/locales/ru.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ caveblock:
1818
no-safe-location-found: "&cНе удалось найти безопасное место для телепортации
1919
в пещеру."
2020
not-owner: "&cВы не владелец этой пещеры!"
21+
cave-limit-reached: "&c Вы достигли вершины своей пещеры. Вы не можете стать
22+
выше!"
2123
commands:
2224
admin:
2325
team:

0 commit comments

Comments
 (0)