Remove unnecessary return variables.

This commit is contained in:
Photon-GitHub 2022-07-25 13:41:44 +02:00
parent 8ba9dc0996
commit d71b6bcfa8
3 changed files with 4 additions and 9 deletions

View File

@ -113,12 +113,10 @@ public class StructureCache {
public static StructureModifier<Object> getStructure(final PacketType packetType) {
Preconditions.checkNotNull(packetType, "type cannot be null");
StructureModifier<Object> modifier = STRUCTURE_MODIFIER_CACHE.computeIfAbsent(packetType, type -> {
return STRUCTURE_MODIFIER_CACHE.computeIfAbsent(packetType, type -> {
Class<?> packetClass = PacketRegistry.getPacketClassFromType(type);
return new StructureModifier<>(packetClass, MinecraftReflection.getPacketClass(), true);
});
return modifier;
}
/**

View File

@ -176,8 +176,7 @@ public class BlockPosition {
// Construct the underlying BlockPosition
try {
Object result = blockPositionConstructor.newInstance(specific.x, specific.y, specific.z);
return result;
return blockPositionConstructor.newInstance(specific.x, specific.y, specific.z);
} catch (Exception e) {
throw new RuntimeException("Cannot construct BlockPosition.", e);
}
@ -197,8 +196,7 @@ public class BlockPosition {
if (intModifier.size() >= 3) {
try {
StructureModifier<Integer> instance = intModifier.withTarget(generic);
BlockPosition result = new BlockPosition(instance.read(0), instance.read(1), instance.read(2));
return result;
return new BlockPosition(instance.read(0), instance.read(1), instance.read(2));
} catch (FieldAccessException e) {
// This is an exeptional work-around, so we don't want to burden the caller with the messy details
throw new RuntimeException("Field access error.", e);

View File

@ -182,8 +182,7 @@ public class WrappedAttributeModifier extends AbstractWrapper {
StructureModifier<String> stringMod = modifier.withType(String.class);
if (stringMod.size() == 0) {
Supplier<String> supplier = (Supplier<String>) modifier.withType(Supplier.class).read(0);
this.name = supplier;
this.name = (Supplier<String>) modifier.withType(Supplier.class).read(0);
} else {
this.name = () -> stringMod.read(0);
}