Skip to content

Commit 3ab19aa

Browse files
committed
Merge branch 'master' into genericsTake2
2 parents 1ea175b + da2b820 commit 3ab19aa

31 files changed

Lines changed: 686 additions & 694 deletions

deprecation.txt

-1.41 MB
Binary file not shown.

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

Lines changed: 496 additions & 494 deletions
Large diffs are not rendered by default.

src/main/java/com/laytonsmith/core/events/Prefilters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static void match(Map<String, Mixed> map, String key,
158158
@Deprecated
159159
public static void match(Map<String, Mixed> map, String key,
160160
MCLocation actualValue, PrefilterType type, Environment env) throws PrefilterNonMatchException {
161-
match(map, key, ObjectGenerator.GetGenerator().location(actualValue, false, env), type, env);
161+
match(map, key, ObjectGenerator.GetGenerator().location(actualValue, false), type, env);
162162
}
163163

164164
@Deprecated

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

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
8080
Target t = Target.UNKNOWN;
8181
Map<String, Mixed> map = evaluate_helper(event);
8282

83-
map.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false, env));
83+
map.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false));
8484
map.put("isSticky", CBoolean.get(event.isSticky()));
8585
map.put("direction", new CString(event.getDirection().name(), t));
8686

@@ -261,11 +261,11 @@ 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);
264+
drops.push(ObjectGenerator.GetGenerator().item(stack, t, env), t, env);
265265
}
266266
map.put("drops", drops);
267267

268-
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false, env));
268+
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false));
269269
map.put("xp", new CInt(event.getExpToDrop(), t));
270270

271271
return map;
@@ -280,7 +280,7 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent e, Environment
280280
if(value.isInstanceOf(CArray.TYPE, null, env)) {
281281
CArray arr = (CArray) value;
282282
for(int i = 0; i < arr.size(env); i++) {
283-
CArray item = ArgumentValidation.getArray(arr.get(i, value.getTarget()), value.getTarget(), env);
283+
CArray item = ArgumentValidation.getArray(arr.get(i, value.getTarget(), env), value.getTarget(), env);
284284
MCItemStack stack = ObjectGenerator.GetGenerator().item(item, value.getTarget(), env);
285285
if(!stack.isEmpty()) {
286286
drops.add(stack);
@@ -399,7 +399,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
399399

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

544544
map.put("block", new CString(block.getType().getName(), t));
545-
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false, env));
545+
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false));
546546

547547
MCBlock source = event.getFireBlock();
548548
if(source == null) {
@@ -628,10 +628,10 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
628628
MCBlock b = event.getIgnitingBlock();
629629
if(b != null) {
630630
map.put("ignitingblock", new CString(b.getType().getName(), t));
631-
map.put("ignitingblocklocation", ObjectGenerator.GetGenerator().location(b.getLocation(), false, env));
631+
map.put("ignitingblocklocation", ObjectGenerator.GetGenerator().location(b.getLocation(), false));
632632
}
633633

634-
map.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false, env));
634+
map.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false));
635635
map.put("cause", new CString(event.getCause().name(), t));
636636

637637
return map;
@@ -760,12 +760,12 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
760760
MCBlock block = event.getBlock();
761761

762762
map.put("block", new CString(block.getType().getName(), t));
763-
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false, env));
763+
map.put("location", ObjectGenerator.GetGenerator().location(block.getLocation(), false));
764764

765765
MCBlock toblock = event.getToBlock();
766766

767767
map.put("toblock", new CString(toblock.getType().getName(), t));
768-
map.put("tolocation", ObjectGenerator.GetGenerator().location(toblock.getLocation(), false, env));
768+
map.put("tolocation", ObjectGenerator.GetGenerator().location(toblock.getLocation(), false));
769769

770770
map.put("face", new CString(event.getBlockFace().toString(), t));
771771
return map;
@@ -787,11 +787,11 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event, Environ
787787
if(value.isInstanceOf(CArray.TYPE, null, env)) {
788788
CArray blockArray = (CArray) value;
789789
if(blockArray.containsKey("name")) {
790-
Mixed name = blockArray.get("name", value.getTarget());
790+
Mixed name = blockArray.get("name", value.getTarget(), env);
791791
int data = 0;
792792
if(blockArray.containsKey("data")) {
793793
try {
794-
data = Integer.parseInt(blockArray.get("data", value.getTarget()).val());
794+
data = Integer.parseInt(blockArray.get("data", value.getTarget(), env).val());
795795
} catch (Exception ex) {
796796
throw new CREFormatException("blockArray is invalid", value.getTarget());
797797
}
@@ -809,13 +809,13 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event, Environ
809809
int type;
810810
int data = 0;
811811
try {
812-
type = Integer.parseInt(blockArray.get("type", value.getTarget()).val());
812+
type = Integer.parseInt(blockArray.get("type", value.getTarget(), env).val());
813813
} catch (Exception ex) {
814814
throw new CREFormatException("blockArray is invalid", value.getTarget());
815815
}
816816
if(blockArray.containsKey("data")) {
817817
try {
818-
data = Integer.parseInt(blockArray.get("data", value.getTarget()).val());
818+
data = Integer.parseInt(blockArray.get("data", value.getTarget(), env).val());
819819
} catch (Exception ex) {
820820
throw new CREFormatException("blockArray is invalid", value.getTarget());
821821
}
@@ -843,11 +843,11 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event, Environ
843843
if(value.isInstanceOf(CArray.TYPE, null, env)) {
844844
CArray blockArray = (CArray) value;
845845
if(blockArray.containsKey("name")) {
846-
Mixed name = blockArray.get("name", value.getTarget());
846+
Mixed name = blockArray.get("name", value.getTarget(), env);
847847
int data = 0;
848848
if(blockArray.containsKey("data")) {
849849
try {
850-
data = Integer.parseInt(blockArray.get("data", value.getTarget()).val());
850+
data = Integer.parseInt(blockArray.get("data", value.getTarget(), env).val());
851851
} catch (Exception ex) {
852852
throw new CREFormatException("blockArray is invalid", value.getTarget());
853853
}
@@ -865,13 +865,13 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event, Environ
865865
int type;
866866
int data = 0;
867867
try {
868-
type = Integer.parseInt(blockArray.get("type", value.getTarget()).val());
868+
type = Integer.parseInt(blockArray.get("type", value.getTarget(), env).val());
869869
} catch (Exception ex) {
870870
throw new CREFormatException("blockArray is invalid", value.getTarget());
871871
}
872872
if(blockArray.containsKey("data")) {
873873
try {
874-
data = Integer.parseInt(blockArray.get("data", value.getTarget()).val());
874+
data = Integer.parseInt(blockArray.get("data", value.getTarget(), env).val());
875875
} catch (Exception ex) {
876876
throw new CREFormatException("blockArray is invalid", value.getTarget());
877877
}
@@ -958,7 +958,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
958958

959959
map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN));
960960
map.put("text", event.getLines(env));
961-
map.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false, env));
961+
map.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false));
962962
map.put("side", new CString(event.getSide().name(), Target.UNKNOWN));
963963

964964
return map;
@@ -985,7 +985,7 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event, Environ
985985
String[] lines = {"", "", "", ""};
986986

987987
for(int i = 0; i < 4; i++) {
988-
lines[i] = val.get(i, value.getTarget()).toString();
988+
lines[i] = val.get(i, value.getTarget(), env).toString();
989989
}
990990

991991
sce.setLines(lines);
@@ -1020,9 +1020,9 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent event, Environ
10201020
public BindableEvent convert(CArray manual, Target t, Environment env) {
10211021
MCSignChangeEvent e = EventBuilder.instantiate(
10221022
MCSignChangeEvent.class,
1023-
Static.GetPlayer(manual.get("player", Target.UNKNOWN).val(), Target.UNKNOWN, env),
1024-
manual.get("1", Target.UNKNOWN).val(), manual.get("2", Target.UNKNOWN).val(),
1025-
manual.get("3", Target.UNKNOWN).val(), manual.get("4", Target.UNKNOWN).val());
1023+
Static.GetPlayer(manual.get("player", Target.UNKNOWN, env).val(), Target.UNKNOWN, env),
1024+
manual.get("1", Target.UNKNOWN, env).val(), manual.get("2", Target.UNKNOWN, env).val(),
1025+
manual.get("3", Target.UNKNOWN, env).val(), manual.get("4", Target.UNKNOWN, env).val());
10261026
return e;
10271027
}
10281028
}
@@ -1091,9 +1091,9 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
10911091

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

1096-
CArray velocity = ObjectGenerator.GetGenerator().vector(event.getVelocity(), t, env);
1096+
CArray velocity = ObjectGenerator.GetGenerator().vector(event.getVelocity(), t);
10971097
velocity.set("magnitude", new CDouble(event.getVelocity().length(), t), t, env);
10981098
map.put("velocity", velocity);
10991099

@@ -1234,7 +1234,7 @@ public Map<String, Mixed> evaluate(BindableEvent event, Environment env) throws
12341234

12351235
mapEvent.put("block", new CString(e.getBlock().getType().getName(), t));
12361236
mapEvent.put("newblock", new CString(e.getNewState().getType().getName(), t));
1237-
mapEvent.put("location", ObjectGenerator.GetGenerator().location(e.getBlock().getLocation(), false, env));
1237+
mapEvent.put("location", ObjectGenerator.GetGenerator().location(e.getBlock().getLocation(), false));
12381238
return mapEvent;
12391239
}
12401240

@@ -1287,7 +1287,7 @@ public Map<String, Mixed> evaluate(BindableEvent event, Environment env) throws
12871287
Target t = Target.UNKNOWN;
12881288
Map<String, Mixed> map = new HashMap<>();
12891289

1290-
map.put("location", ObjectGenerator.GetGenerator().location(e.getBlock().getLocation(), false, env));
1290+
map.put("location", ObjectGenerator.GetGenerator().location(e.getBlock().getLocation(), false));
12911291
map.put("instrument", new CString(e.getInstrument().name(), t));
12921292
map.put("tone", new CString(e.getNote().getTone().name() + (e.getNote().isSharped() ? "#" : ""), t));
12931293
map.put("octave", new CInt(e.getNote().getOctave(), t));
@@ -1388,7 +1388,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
13881388
mapEvent.put("block", new CString(event.getBlock().getType().getName(), t));
13891389
mapEvent.put("newblock", new CString(event.getNewState().getType().getName(), t));
13901390

1391-
mapEvent.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false, env));
1391+
mapEvent.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false));
13921392
return mapEvent;
13931393
}
13941394

@@ -1442,10 +1442,10 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
14421442
Map<String, Mixed> ret = evaluate_helper(event);
14431443

14441444
MCBlock blk = event.getBlock();
1445-
ret.put("location", ObjectGenerator.GetGenerator().location(blk.getLocation(), false, env));
1445+
ret.put("location", ObjectGenerator.GetGenerator().location(blk.getLocation(), false));
14461446
CArray blocks = new CArray(t, null, env);
14471447
for(MCBlock b : event.getBlocks()) {
1448-
blocks.push(ObjectGenerator.GetGenerator().location(b.getLocation(), false, env), t, env);
1448+
blocks.push(ObjectGenerator.GetGenerator().location(b.getLocation(), false), t, env);
14491449
}
14501450
ret.put("blocks", blocks);
14511451
ret.put("yield", new CDouble(event.getYield(), t));
@@ -1532,7 +1532,7 @@ public Map<String, Mixed> evaluate(BindableEvent e, Environment env) throws Even
15321532
Map<String, Mixed> mapEvent = this.evaluate_helper(e);
15331533
mapEvent.put("block", new CString(event.getBlock().getType().getName(), t));
15341534
mapEvent.put("newblock", new CString(event.getNewState().getType().getName(), t));
1535-
mapEvent.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false, env));
1535+
mapEvent.put("location", ObjectGenerator.GetGenerator().location(event.getBlock().getLocation(), false));
15361536
return mapEvent;
15371537
}
15381538
}

0 commit comments

Comments
 (0)