mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
use pattern variables
This commit is contained in:
+1
-2
@@ -34,8 +34,7 @@ public class Point {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof Point)) return false;
|
||||
Point that = (Point) obj;
|
||||
if(!(obj instanceof Point that)) return false;
|
||||
return this.x == that.x && this.z == that.z;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -40,12 +40,11 @@ public class BufferedLootApplication implements BufferedItem {
|
||||
public void paste(Vector3 origin, World world) {
|
||||
try {
|
||||
BlockEntity data = world.getBlockState(origin);
|
||||
if(!(data instanceof Container)) {
|
||||
if(!(data instanceof Container container)) {
|
||||
LOGGER.error("Failed to place loot at {}; block {} is not a container", origin, data);
|
||||
return;
|
||||
}
|
||||
Container container = (Container) data;
|
||||
|
||||
|
||||
LootPopulateEvent event = new LootPopulateEvent(container, table, world.getConfig().getPack(), structure);
|
||||
platform.getEventManager().callEvent(event);
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
+1
-2
@@ -33,8 +33,7 @@ public class Block implements Item<Block.ReturnInfo<?>> {
|
||||
Map<String, Variable<?>> scope = new HashMap<>(variableMap);
|
||||
for(Item<?> item : items) {
|
||||
Object result = item.apply(implementationArguments, scope);
|
||||
if(result instanceof ReturnInfo) {
|
||||
ReturnInfo<?> level = (ReturnInfo<?>) result;
|
||||
if(result instanceof ReturnInfo<?> level) {
|
||||
if(!level.getLevel().equals(ReturnLevel.NONE)) return level;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user