Skip to content

Commit 97e3250

Browse files
committed
Merge branch 'master' into genericsTake2
2 parents f610f5d + e0e944c commit 97e3250

6 files changed

Lines changed: 65 additions & 58 deletions

File tree

src/main/java/com/laytonsmith/core/ObjectGenerator.java

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public CArray location(MCLocation l, boolean includeYawAndPitch) {
182182
* @param c
183183
* @param w
184184
* @param t
185-
* @return
185+
* @return
186186
* @deprecated Use {@link #location(Mixed, MCWorld, Target, Environment)} instead.
187187
*/
188188
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -197,11 +197,12 @@ public MCLocation location(Mixed c, MCWorld w, Target t) {
197197
* 4 usages: <ul> <li>(x, y, z)</li> <li>(x, y, z, world)</li> <li>(x, y, z, yaw, pitch)</li> <li>(x, y, z, world,
198198
* yaw, pitch)</li> </ul> In all cases, the pitch and yaw default to 0, and the world defaults to the specified
199199
* world. <em>More conveniently: ([world], x, y, z, [yaw, pitch])</em>
200+
*
200201
* @param c
201202
* @param w
202203
* @param t
203204
* @param env
204-
* @return
205+
* @return
205206
*/
206207
public MCLocation location(Mixed c, MCWorld w, Target t, Environment env) {
207208
if(!(c.isInstanceOf(CArray.TYPE, null, env))) {
@@ -279,7 +280,6 @@ public MCLocation location(Mixed c, MCWorld w, Target t, Environment env) {
279280
*
280281
* @param is
281282
* @param t
282-
* @param env
283283
* @return An item array or CNull
284284
*/
285285
public Construct item(MCItemStack is, Target t) {
@@ -290,7 +290,7 @@ public Construct item(MCItemStack is, Target t) {
290290
CArray ret = CArray.GetAssociativeArray(t, null, null);
291291
ret.set("name", new CString(is.getType().getName(), t), t, null);
292292
ret.set("qty", new CInt(is.getAmount(), t), t, null);
293-
ret.set("meta", itemMeta(is, t, env), t, null);
293+
ret.set("meta", itemMeta(is, t), t, null);
294294
return ret;
295295
}
296296

@@ -323,7 +323,7 @@ public MCItemStack item(Mixed i, Target t, Environment env) {
323323
* @param i
324324
* @param t
325325
* @param legacy
326-
* @return
326+
* @return
327327
* @deprecated Use {@link #item(Mixed, Target, boolean, Environment)} instead.
328328
*/
329329
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -414,9 +414,12 @@ public MCItemStack item(Mixed i, Target t, boolean legacy, Environment env) {
414414
MCMaterial newmaterial;
415415
String entityName = spawntype.val().toUpperCase();
416416
newmaterial = switch(entityName) {
417-
case "MUSHROOM_COW" -> StaticLayer.GetMaterial("MOOSHROOM_SPAWN_EGG");
418-
case "PIG_ZOMBIE" -> StaticLayer.GetMaterial("ZOMBIE_PIGMAN_SPAWN_EGG");
419-
default -> StaticLayer.GetMaterial(entityName + "_SPAWN_EGG");
417+
case "MUSHROOM_COW" ->
418+
StaticLayer.GetMaterial("MOOSHROOM_SPAWN_EGG");
419+
case "PIG_ZOMBIE" ->
420+
StaticLayer.GetMaterial("ZOMBIE_PIGMAN_SPAWN_EGG");
421+
default ->
422+
StaticLayer.GetMaterial(entityName + "_SPAWN_EGG");
420423
};
421424
if(newmaterial != null) {
422425
material = newmaterial;
@@ -2221,6 +2224,9 @@ public CArray enchants(Map<MCEnchantment, Integer> map, Target t) {
22212224
}
22222225

22232226
/**
2227+
* @param enchantArray
2228+
* @param t
2229+
* @return
22242230
* @deprecated Use {@link #itemMeta(Mixed, MCMaterial, Target, Environment)} instead.
22252231
*/
22262232
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2305,7 +2311,7 @@ public CArray attributeModifier(MCAttributeModifier m, Target t) {
23052311
/**
23062312
* @param m
23072313
* @param t
2308-
* @return
2314+
* @return
23092315
* @deprecated Use {@link #attributeModifier(CArray, Target, Environment)} instead.
23102316
*/
23112317
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2427,7 +2433,7 @@ public CArray potions(List<MCLivingEntity.MCEffect> effectList, Target t) {
24272433
/**
24282434
* @param ea
24292435
* @param t
2430-
* @return
2436+
* @return
24312437
* @deprecated Use {@link #potions(CArray, Target, Environment)} instead.
24322438
*/
24332439
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2497,7 +2503,7 @@ public CArray potionData(MCPotionData mcpd, Target t) {
24972503
/**
24982504
* @param pd
24992505
* @param t
2500-
* @return
2506+
* @return
25012507
* @deprecated Use {@link #potionData(CArray, Target, Environment)} instead.
25022508
*/
25032509
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2543,7 +2549,7 @@ public MCPotionData potionData(CArray pd, Target t, Environment env) {
25432549
/**
25442550
* @param potionArray
25452551
* @param t
2546-
* @return
2552+
* @return
25472553
* @deprecated Use {@link #legacyPotionData(CArray, Target, Environment)} instead.
25482554
*/
25492555
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2621,7 +2627,7 @@ public CArray fireworkEffect(MCFireworkEffect mcfe, Target t) {
26212627
/**
26222628
* @param fe
26232629
* @param t
2624-
* @return
2630+
* @return
26252631
* @deprecated Use {@link #fireworkEffect(CArray, Target, Environment)} instead.
26262632
*/
26272633
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2790,7 +2796,7 @@ public Construct recipe(MCRecipe r, Target t, Environment env) {
27902796
/**
27912797
* @param c
27922798
* @param t
2793-
* @return
2799+
* @return
27942800
* @deprecated Use {@link #recipe(Mixed, Target, Environment)} instead.
27952801
*/
27962802
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -2931,7 +2937,8 @@ public MCRecipe recipe(Mixed c, Target t, Environment env) {
29312937
}
29322938
return ret;
29332939
}
2934-
default -> throw new CREIllegalArgumentException("Could not find valid recipe type.", t);
2940+
default ->
2941+
throw new CREIllegalArgumentException("Could not find valid recipe type.", t);
29352942
}
29362943
}
29372944

@@ -3047,7 +3054,7 @@ public MCMaterial material(Mixed name, Target t) {
30473054
/**
30483055
* @param ca
30493056
* @param t
3050-
* @return
3057+
* @return
30513058
* @deprecated Use {@link #blockData(CArray, Target, Environment)} instead.
30523059
*/
30533060
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -3064,7 +3071,7 @@ public MCBlockData blockData(CArray ca, Target t, Environment env) {
30643071
* @param ca
30653072
* @param blockType
30663073
* @param t
3067-
* @return
3074+
* @return
30683075
* @deprecated Use {@link #blockData(CArray, MCMaterial, Target, Environment)} instead.
30693076
*/
30703077
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")
@@ -3152,7 +3159,7 @@ private Construct blockState(String value) {
31523159
* @param l
31533160
* @param pa
31543161
* @param t
3155-
* @return
3162+
* @return
31563163
* @deprecated Use {@link #particleData(MCParticle, MCLocation, CArray, Target, Environment)} instead.
31573164
*/
31583165
@AggressiveDeprecation(deprecationDate = "2022-04-06", removalVersion = "3.3.7", deprecationVersion = "3.3.6")

src/main/java/com/laytonsmith/core/events/drivers/BlockEvents.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
261261

262262
CArray drops = new CArray(t, null, env);
263263
for(MCItemStack stack : event.getDrops()) {
264-
drops.push(ObjectGenerator.GetGenerator().item(stack, t, env), t, env);
264+
drops.push(ObjectGenerator.GetGenerator().item(stack, t), t, env);
265265
}
266266
map.put("drops", drops);
267267

@@ -400,7 +400,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
400400
map.put("player", new CString(event.getPlayer().getName(), t));
401401
map.put("block", new CString(mat.getName(), t));
402402
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false));
403-
map.put("item", ObjectGenerator.GetGenerator().item(event.getItemInHand(), Target.UNKNOWN, env));
403+
map.put("item", ObjectGenerator.GetGenerator().item(event.getItemInHand(), Target.UNKNOWN));
404404
if(event.getHand() == MCEquipmentSlot.WEAPON) {
405405
map.put("hand", new CString("main_hand", Target.UNKNOWN));
406406
} else {
@@ -1090,7 +1090,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
10901090
MCBlock block = event.getBlock();
10911091

10921092
map.put("type", new CString(block.getType().getName(), t));
1093-
map.put("item", ObjectGenerator.GetGenerator().item(event.getItem(), t, env));
1093+
map.put("item", ObjectGenerator.GetGenerator().item(event.getItem(), t));
10941094
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false));
10951095

10961096
CArray velocity = ObjectGenerator.GetGenerator().vector(event.getVelocity(), t);

src/main/java/com/laytonsmith/core/events/drivers/EntityEvents.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
149149
Map<String, Mixed> ret = evaluate_helper(event);
150150
ret.put("location", ObjectGenerator.GetGenerator().location(event.getLocation(), false));
151151
ret.put("id", new CString(event.getEntity().getUniqueId().toString(), t));
152-
ret.put("item", ObjectGenerator.GetGenerator().item(event.getEntity().getItemStack(), t, env));
152+
ret.put("item", ObjectGenerator.GetGenerator().item(event.getEntity().getItemStack(), t));
153153
return ret;
154154
} else {
155155
throw new EventException("Could not convert to MCItemDespawnEvent");
@@ -224,7 +224,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
224224
Map<String, Mixed> ret = evaluate_helper(event);
225225
ret.put("location", ObjectGenerator.GetGenerator().location(event.getLocation(), false));
226226
ret.put("id", new CString(event.getEntity().getUniqueId().toString(), t));
227-
ret.put("item", ObjectGenerator.GetGenerator().item(event.getEntity().getItemStack(), t, env));
227+
ret.put("item", ObjectGenerator.GetGenerator().item(event.getEntity().getItemStack(), t));
228228
return ret;
229229
} else {
230230
throw new EventException("Could not convert to MCItemSpawnEvent");
@@ -648,7 +648,7 @@ public Map<String, Mixed> evaluate(BindableEvent event, Environment env)
648648
Map<String, Mixed> map = evaluate_helper(event);
649649
CArray drops = new CArray(t, null, env);
650650
for(MCItemStack is : e.getDrops()) {
651-
drops.push(ObjectGenerator.GetGenerator().item(is, t, env), t, env);
651+
drops.push(ObjectGenerator.GetGenerator().item(is, t), t, env);
652652
}
653653
map.put("type", new CString(dead.getType().name(), t));
654654
map.put("id", new CString(dead.getUniqueId().toString(), t));
@@ -1123,7 +1123,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
11231123
MCPlayerDropItemEvent event = (MCPlayerDropItemEvent) e;
11241124
Map<String, Mixed> map = evaluate_helper(e);
11251125

1126-
map.put("item", ObjectGenerator.GetGenerator().item(event.getItemDrop().getItemStack(), Target.UNKNOWN, env));
1126+
map.put("item", ObjectGenerator.GetGenerator().item(event.getItemDrop().getItemStack(), Target.UNKNOWN));
11271127
map.put("id", new CString(event.getItemDrop().getUniqueId().toString(), Target.UNKNOWN));
11281128

11291129
return map;
@@ -1202,7 +1202,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
12021202
MCPlayerPickupItemEvent event = (MCPlayerPickupItemEvent) e;
12031203
Map<String, Mixed> map = evaluate_helper(e);
12041204
map.put("id", new CString(event.getItem().getUniqueId().toString(), Target.UNKNOWN));
1205-
map.put("item", ObjectGenerator.GetGenerator().item(event.getItem().getItemStack(), Target.UNKNOWN, env));
1205+
map.put("item", ObjectGenerator.GetGenerator().item(event.getItem().getItemStack(), Target.UNKNOWN));
12061206
map.put("remaining", new CInt(event.getRemaining(), Target.UNKNOWN));
12071207
return map;
12081208
} else {
@@ -1874,7 +1874,7 @@ public Map<String, Mixed> evaluate(BindableEvent event, Environment env) throws
18741874
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_17_X)) {
18751875
MCItemStack item = e.getItem();
18761876
if(item != null) {
1877-
ret.put("item", ObjectGenerator.GetGenerator().item(item, Target.UNKNOWN, env));
1877+
ret.put("item", ObjectGenerator.GetGenerator().item(item, Target.UNKNOWN));
18781878
} else {
18791879
ret.put("item", CNull.NULL);
18801880
}

0 commit comments

Comments
 (0)