Skip to content

Commit

Permalink
Merge branch 'EngineHub:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Euphillya authored Mar 7, 2024
2 parents 3c1cc57 + 055ff9e commit 6321eaa
Show file tree
Hide file tree
Showing 38 changed files with 424 additions and 533 deletions.
147 changes: 147 additions & 0 deletions verification/src/changes/accepted-core-public-api-changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,27 @@
"changes": [
"METHOD_NEW_DEFAULT"
]
},
{
"type": "com.sk89q.worldedit.registry.Keyed",
"member": "Method com.sk89q.worldedit.registry.Keyed.id()",
"changes": [
"METHOD_NEW_DEFAULT"
]
},
{
"type": "com.sk89q.worldedit.world.registry.ItemMaterial",
"member": "Method com.sk89q.worldedit.world.registry.ItemMaterial.maxDamage()",
"changes": [
"METHOD_NEW_DEFAULT"
]
},
{
"type": "com.sk89q.worldedit.world.registry.ItemMaterial",
"member": "Method com.sk89q.worldedit.world.registry.ItemMaterial.maxStackSize()",
"changes": [
"METHOD_NEW_DEFAULT"
]
}
],
"LazyReference was never publicly extensible": [
Expand Down Expand Up @@ -225,6 +246,132 @@
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.history.change.BiomeChange3D",
"member": "Class com.sk89q.worldedit.history.change.BiomeChange3D",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.history.change.BlockChange",
"member": "Class com.sk89q.worldedit.history.change.BlockChange",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.biome.BiomeType",
"member": "Class com.sk89q.worldedit.world.biome.BiomeType",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.biome.BiomeType",
"member": "Method com.sk89q.worldedit.world.biome.BiomeType.equals(java.lang.Object)",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.biome.BiomeType",
"member": "Method com.sk89q.worldedit.world.biome.BiomeType.hashCode()",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.entity.EntityType",
"member": "Class com.sk89q.worldedit.world.entity.EntityType",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.entity.EntityType",
"member": "Method com.sk89q.worldedit.world.entity.EntityType.equals(java.lang.Object)",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.entity.EntityType",
"member": "Method com.sk89q.worldedit.world.entity.EntityType.hashCode()",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.fluid.FluidType",
"member": "Class com.sk89q.worldedit.world.fluid.FluidType",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.fluid.FluidType",
"member": "Method com.sk89q.worldedit.world.fluid.FluidType.equals(java.lang.Object)",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.fluid.FluidType",
"member": "Method com.sk89q.worldedit.world.fluid.FluidType.hashCode()",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.gamemode.GameMode",
"member": "Class com.sk89q.worldedit.world.gamemode.GameMode",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.gamemode.GameMode",
"member": "Method com.sk89q.worldedit.world.gamemode.GameMode.equals(java.lang.Object)",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.gamemode.GameMode",
"member": "Method com.sk89q.worldedit.world.gamemode.GameMode.hashCode()",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.registry.SimpleItemMaterial",
"member": "Class com.sk89q.worldedit.world.registry.SimpleItemMaterial",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.weather.WeatherType",
"member": "Class com.sk89q.worldedit.world.weather.WeatherType",
"changes": [
"CLASS_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.weather.WeatherType",
"member": "Method com.sk89q.worldedit.world.weather.WeatherType.equals(java.lang.Object)",
"changes": [
"METHOD_NOW_FINAL"
]
},
{
"type": "com.sk89q.worldedit.world.weather.WeatherType",
"member": "Method com.sk89q.worldedit.world.weather.WeatherType.hashCode()",
"changes": [
"METHOD_NOW_FINAL"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2352,8 +2352,8 @@ protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial)
if (expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ(), typeVar, dataVar}, timeout) <= 0) {
return null;
}
int newType = (int) typeVariable.getValue();
int newData = (int) dataVariable.getValue();
int newType = (int) typeVariable.value();
int newData = (int) dataVariable.value();
if (newType != typeVar || newData != dataVar) {
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(newType, newData);
return state == null ? defaultMaterial : state.toBaseBlock();
Expand Down Expand Up @@ -2450,7 +2450,7 @@ public int deformRegion(final Region region, final Vector3 zero, final Vector3 u
// transform
expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout);

final BlockVector3 sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
final BlockVector3 sourcePosition = environment.toWorld(x.value(), y.value(), z.value());

// read block from world
final BaseBlock material = world.getFullBlock(sourcePosition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public Placement getPlacement() {
* @param placement the placement.
*/
public void setPlacement(Placement placement) {
if (placement.getPlacementType() == PlacementType.HERE) {
if (placement.placementType() == PlacementType.HERE) {
throw new IllegalStateException("PlacementType.HERE cannot be used. Use PLAYER or WORLD instead.");
}

Expand Down Expand Up @@ -610,7 +610,7 @@ public void setPlaceAtPos1(boolean placeAtPos1) {
*/
@Deprecated
public boolean isPlaceAtPos1() {
return this.placement.getPlacementType() == PlacementType.POS1;
return this.placement.placementType() == PlacementType.POS1;
}

/**
Expand All @@ -623,12 +623,12 @@ public boolean isPlaceAtPos1() {
*/
@Deprecated
public boolean togglePlacementPosition() {
if (this.placement.getPlacementType() == PlacementType.POS1) {
if (this.placement.placementType() == PlacementType.POS1) {
this.placement = new Placement(PlacementType.PLAYER, BlockVector3.ZERO);
} else {
this.placement = new Placement(PlacementType.POS1, BlockVector3.ZERO);
}
return this.placement.getPlacementType() == PlacementType.POS1;
return this.placement.placementType() == PlacementType.POS1;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private static void placementImpl(Actor actor, LocalSession session, Placement p
desc = "Switch between your position and pos1 for placement"
)
public void togglePlace(Actor actor, LocalSession session) {
if (session.getPlacement().getPlacementType() == PlacementType.POS1) {
if (session.getPlacement().placementType() == PlacementType.POS1) {
placementImpl(actor, session, new Placement(PlacementType.PLAYER, BlockVector3.ZERO));
} else {
placementImpl(actor, session, new Placement(PlacementType.POS1, BlockVector3.ZERO));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,10 @@

/**
* Items of metadata about shared clipboards.
*
* @param format the format of the clipboard
* @param name the name of the clipboard
* @param author the author of the clipboard
*/
public class ClipboardShareMetadata {
private final ClipboardFormat format;
private final String name;
private final String author;

public ClipboardShareMetadata(ClipboardFormat format, String name, String author) {
this.format = format;
this.name = name;
this.author = author;
}

public ClipboardFormat format() {
return this.format;
}

public String name() {
return this.name;
}

public String author() {
return this.author;
}
public record ClipboardShareMetadata(ClipboardFormat format, String name, String author) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,14 @@ public Operation createFromContext(final EditContext context) {
session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout());
}

private static final class DeformOperation implements Operation {
private final Extent destination;
private final Region region;
private final Vector3 zero;
private final Vector3 unit;
private final Expression expression;
private final int timeout;

private DeformOperation(Extent destination, Region region, Vector3 zero, Vector3 unit, Expression expression,
int timeout) {
this.destination = destination;
this.region = region;
this.zero = zero;
this.unit = unit;
this.expression = expression;
this.timeout = timeout;
}

private record DeformOperation(
Extent destination,
Region region,
Vector3 zero,
Vector3 unit,
Expression expression,
int timeout
) implements Operation {
@Override
public Operation resume(RunContext run) throws WorldEditException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,7 @@ public Mask2D toMask2D() {
}
}

private static class NegatedMask implements Mask {
private final Mask mask;

private NegatedMask(Mask mask) {
this.mask = mask;
}

private record NegatedMask(Mask mask) implements Mask {
@Override
public boolean test(BlockVector3 vector) {
return !mask.test(vector);
Expand All @@ -205,13 +199,7 @@ public Mask2D toMask2D() {
}
}

private static class NegatedMask2D implements Mask2D {
private final Mask2D mask;

private NegatedMask2D(Mask2D mask) {
this.mask = mask;
}

private record NegatedMask2D(Mask2D mask) implements Mask2D {
@Override
public boolean test(BlockVector2 vector) {
return !mask.test(vector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,16 @@ public BaseBlock applyBlock(BlockVector3 position) {
double offset = 0;

for (Chance chance : patterns) {
if (r <= (offset + chance.getChance()) / max) {
return chance.getPattern().applyBlock(position);
if (r <= (offset + chance.chance()) / max) {
return chance.pattern().applyBlock(position);
}
offset += chance.getChance();
offset += chance.chance();
}

throw new RuntimeException("ProportionalFillPattern");
}

private static class Chance {
private final Pattern pattern;
private final double chance;

private Chance(Pattern pattern, double chance) {
this.pattern = pattern;
this.chance = chance;
}

public Pattern getPattern() {
return pattern;
}

public double getChance() {
return chance;
}
private record Chance(Pattern pattern, double chance) {
}

}
Loading

0 comments on commit 6321eaa

Please sign in to comment.